<?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>Dabbler &#187; exchange</title>
	<atom:link href="http://sethjust.com/tag/exchange/feed/" rel="self" type="application/rss+xml" />
	<link>http://sethjust.com</link>
	<description>If it ain&#039;t broke, fix it!</description>
	<lastBuildDate>Fri, 16 Jul 2010 00:19:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Update: Migratory Internet Junk</title>
		<link>http://sethjust.com/2010/05/27/update-migratory-internet-junk/</link>
		<comments>http://sethjust.com/2010/05/27/update-migratory-internet-junk/#comments</comments>
		<pubDate>Thu, 27 May 2010 16:54:26 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[2d barcode]]></category>
		<category><![CDATA[barcode]]></category>
		<category><![CDATA[barcode scanner]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[junk]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[symbology]]></category>
		<category><![CDATA[tgimboej]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=155</guid>
		<description><![CDATA[I know it&#8217;s taken me a long time to post this, but I received my box of migratory junk on May 10! I got box INTJ-7 which had been shipped out by a nice guy from San Diego. I don&#8217;t have a lot to say now (and no pictures) but I&#8217;d like to share some [...]]]></description>
			<content:encoded><![CDATA[<p>I know it&#8217;s taken me a long time to post this, but I received my <a href="http://sethjust.com/2010/05/03/heads-up-migratory-internet-junk/">box of migratory junk</a> on May 10! I got box <a href="http://tgimboej.org/Box_Code:_INTJ-7">INTJ-7</a> which had been shipped out by a nice guy from San Diego. I don&#8217;t have a lot to say now (and no pictures) but I&#8217;d like to share some of what I got out of it. Perhaps my biggest find was right on top: a Hand Held Products IT4410 2D barcode scanner. On the <a href="http://www.honeywellaidc.com/Site.aspx/na/en/support/technical_support/retired_products/retired/?product=33">product page</a> I found the <a href="http://www.honeywellaidc.com/download.aspx/44-4710+UG+.pdf?download=/data/57bcf1c7-a155-4520-9031-4fc0aac5db7f.pdf">manual</a> (pdf link) which explains all of its features.</p>
<p><img class="alignright size-full wp-image-163" title="hhp4410hd" src="http://sethjust.com/wp-content/uploads/2010/05/hhp4410hd.jpg" alt="HHP 4410HD Barcode Scanner" width="80" height="80" /></p>
<p>It turns out that the scanner emulates a PS/2 keyboard and will read almost any 1D or 2D barcode <a href="http://en.wikipedia.org/wiki/Barcode#Symbologies">symbology</a>. After a few hijinks with a loose ribbon cable and flaky PS/2 support on my computer I got the scanner working perfectly. I was even able to change its configuration by scanning barcodes from the manual displayed on my LCD (though I don&#8217;t know if it will work with glossy screens &#8212; mine is matte).</p>
<p>I&#8217;m planning on putting up a more complete summary of what I&#8217;ve found, but here are a few other things that caught my eye:</p>
<ul>
<li>A solenoid-controlled <a href="http://en.wikipedia.org/wiki/Proportioning_valve">proportional valve</a> for small pneumatics or hydraulics.</li>
<li>A bag of large rubber grommets, one of which I cut up to replace the feet on a table lamp.</li>
<li>Three matched stepper motors.</li>
<li>A worm-gearbox connected to a large motor with integrated optical encoder.</li>
<li>A wide variety of IR LED/phototransistor gates.</li>
<li>A pile of 1.8V, 2.5V and 3.3V voltage regulators.</li>
</ul>
<p>Stay tuned for pictures and more details on what I&#8217;m taking and what I&#8217;m going to do with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2010/05/27/update-migratory-internet-junk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Heads Up: Migratory Internet Junk</title>
		<link>http://sethjust.com/2010/05/03/heads-up-migratory-internet-junk/</link>
		<comments>http://sethjust.com/2010/05/03/heads-up-migratory-internet-junk/#comments</comments>
		<pubDate>Tue, 04 May 2010 04:08:18 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[junk]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[tgimboej]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=152</guid>
		<description><![CDATA[If you haven&#8217;t heard of TGIMBOEJ (The Great Internet Migratory Box Of Electronics Junk), you should definitely check it out. The basic idea is that a box of random electronic junk gets shipped between makers and tinkerers, each of whom take something and contribute something to the box, and document what they end up doing. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://tgimboej.org/images/8/8b/Initial_contents.jpg"><img class="alignright" src="http://tgimboej.org/images/8/8b/Initial_contents.jpg" alt="" width="240" height="180" /></a>If you haven&#8217;t heard of <a href="http://tgimboej.org/">TGIMBOEJ</a> (The Great Internet Migratory Box Of Electronics Junk), you should definitely check it out. The basic idea is that a box of random electronic junk gets shipped between makers and tinkerers, each of whom take something and contribute something to the box, and document what they end up doing.</p>
<p>To make a long story short, I was recently offered a chance to receive one of these migratory lending libraries, so expect to see something in this space about it soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2010/05/03/heads-up-migratory-internet-junk/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fast and Simple Stock Quotes Using Perl</title>
		<link>http://sethjust.com/2008/10/23/fast-and-simple-stock-quotes-using-perl/</link>
		<comments>http://sethjust.com/2008/10/23/fast-and-simple-stock-quotes-using-perl/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 06:18:05 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[CPAN]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[finance]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[stocks]]></category>
		<category><![CDATA[ticker]]></category>

		<guid isPermaLink="false">http://sethjust.wordpress.com/?p=21</guid>
		<description><![CDATA[One of the things that makes perl so powerful and fascinating is the huge number of modules that are available online, especially through the CPAN repository. Today I stumbled upon one called Finance::Quote, which does one thing, very simply: it retrieves stock (or mutual fund) quotes. You feed it a ticker symbol and it gives [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things that makes perl so powerful and fascinating is the huge number of modules that are available online, especially through the CPAN repository. Today I stumbled upon one called Finance::Quote, which does one thing, very simply: it retrieves stock (or mutual fund) quotes. You feed it a ticker symbol and it gives back a hash with all sorts of information, but most importantly, the price. I&#8217;m going to show how to use this to create a command line tool that will grab an up-to-the minute stock quote for any ticker symbol you give it.</p>
<p><span id="more-21"></span><br />
To start, installing Finance::Quote is a breeze. As long as you have CPAN installed, just type at the command line:</p>
<pre>$perl -MCPAN -e shell
&gt;install Finance::Quote</pre>
<p>From there it&#8217;s easy to get start, it&#8217;s just a matter of importing the module and creating and instance. This means the beginning of our script will look like:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p21code4'); return false;">View Code</a> PERL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p214"><td class="code" id="p21code4"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl -w</span>
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># import module</span>
<span style="color: #000000; font-weight: bold;">use</span> Finance<span style="color: #339933;">::</span><span style="color: #006600;">Quote</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;"># create object</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$q</span> <span style="color: #339933;">=</span> Finance<span style="color: #339933;">::</span><span style="color: #006600;">Quote</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">new</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>The instance that we created has one main method: fetch(). It takes a list of arguments, with the first being a the exchange to look for quotes on, and the remaining being a list or array of ticker symbols. The <a href="http://search.cpan.org/~ecocode/Finance-Quote-1.14/lib/Finance/Quote.pm">Finance::Quote documentation</a> provides the following list of valid exchanges:</p>
<pre>australia           Australan Stock Exchange
dwsfunds            Deutsche Bank Gruppe funds
fidelity            Fidelity Investments
tiaacref            TIAA-CREF
troweprice          T. Rowe Price
europe              European Markets
canada              Canadian Markets
usa                 USA Markets
nyse                New York Stock Exchange
nasdaq              NASDAQ
uk_unit_trusts      UK Unit Trusts
vanguard            Vanguard Investments
vwd                 Vereinigte Wirtschaftsdienste GmbH</pre>
<p>For the purposes of this script, I&#8217;m going to stick to &#8220;usa&#8221; because it covers both NYSE and NASDAQ, and those are the stocks I&#8217;m interested in.<br />
Fetch() returns a two-dimensional hash of results. The first index (or dimension) is the ticker symbol of the stock and the second is the label for the specific piece of information. For now, the labels that we&#8217;re interested are the name of the company (&#8216;name&#8217;) and the price (&#8216;price&#8217;). A full listing of labels is available in the <a href="http://search.cpan.org/~ecocode/Finance-Quote-1.14/lib/Finance/Quote.pm#LABELS">Finance::Quote documentation</a>.<br />
Using this information we can now build a simple script to fetch a stock quote:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p21code5'); return false;">View Code</a> PERL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p215"><td class="code" id="p21code5"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl -w</span>
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># import module</span>
<span style="color: #000000; font-weight: bold;">use</span> Finance<span style="color: #339933;">::</span><span style="color: #006600;">Quote</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># create object</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$q</span> <span style="color: #339933;">=</span> Finance<span style="color: #339933;">::</span><span style="color: #006600;">Quote</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">new</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># retrieve stock quote</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">%data</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$q</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">fetch</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'usa'</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'GOOG'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># print price</span>
<span style="color: #000066;">print</span> <span style="color: #0000ff;">$data</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'GOOG'</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'price'</span><span style="color: #009900;">&#125;</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">&quot;n&quot;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>This script, although it does what it&#8217;s supposed to, isn&#8217;t very pretty. By adding a little code to read ticker symbols from the command line we can check on multiple stocks at the same time, as well as remove the need to hard-code the ticker symbols. We can also make it produce much prettier results by adding more information about the company and add some basic error checking, which yields the following script:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p21code6'); return false;">View Code</a> PERL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p216"><td class="code" id="p21code6"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl -w</span>
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># import module</span>
<span style="color: #000000; font-weight: bold;">use</span> Finance<span style="color: #339933;">::</span><span style="color: #006600;">Quote</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># create object</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$q</span> <span style="color: #339933;">=</span> Finance<span style="color: #339933;">::</span><span style="color: #006600;">Quote</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">new</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#print usage information</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">length</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><span style="color: #000000; font-weight: bold;">ARGV</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;Usage: $0 ticker1, ticker2, ... , tickerNn&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000066;">exit</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># get stock symbols from the command line and</span>
<span style="color: #666666; font-style: italic;"># format them correctly (uppercase)</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><span style="color: #000000; font-weight: bold;">ARGV</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #0000ff;">$_</span> <span style="color: #339933;">=</span> <span style="color: #000066;">uc</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># retrieve stock quote</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">%data</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$q</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">fetch</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'usa'</span><span style="color: #339933;">,</span> <span style="color: #339933;">@</span><span style="color: #000000; font-weight: bold;">ARGV</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># print result for each stock</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><span style="color: #000000; font-weight: bold;">ARGV</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$data</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$_</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'success'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>		<span style="color: #666666; font-style: italic;"># if getting the quote succeeded</span>
		<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$data</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$_</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'name'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;"># build a report</span>
		<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$price</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$data</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$_</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'price'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$message</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">''</span><span style="color: #339933;">;</span>
		<span style="color: #0000ff;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">$name</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">' ('</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">$_</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">')'</span><span style="color: #339933;">;</span>
		<span style="color: #0000ff;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #ff0000;">' '</span> x<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">25</span> <span style="color: #339933;">-</span> <span style="color: #000066;">length</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #0000ff;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #ff0000;">&quot;$$pricen&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000066;">print</span> <span style="color: #0000ff;">$message</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;Failed to retrieve quote for $_: $data{$_, 'errormsg'}n&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>This is very simple, but it does its job well:</p>
<pre>$ quote goog msft aapl dell java
GOOGLE (GOOG)            $352.32
MICROSOFT CP (MSFT)      $22.32
APPLE INC (AAPL)         $98.23
DELL INC (DELL)          $11.99
SUN MICROSYSTEMS (JAVA)  $4.54</pre>
<p><a href="http://people.reed.edu/~justs/quote.pl">Download the script here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2008/10/23/fast-and-simple-stock-quotes-using-perl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
