<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Dabbler</title>
	
	<link>http://sethjust.com</link>
	<description>If it ain't broke, fix it!</description>
	<lastBuildDate>Sun, 02 Dec 2012 01:07:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/sjdabbler" /><feedburner:info uri="sjdabbler" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Java Tuples</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/wrDeAmdnsEw/</link>
		<comments>http://sethjust.com/2012/11/17/java-tuples/#comments</comments>
		<pubDate>Sat, 17 Nov 2012 19:59:07 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=415</guid>
		<description><![CDATA[One oft-noted feature of the Java language is it&#8217;s lack of a tuple data type. This leads to an abundance of classes that provide the convenience of grouping more than one value into a single object. These classes usually look more or less like this: public class ObjectPair&#60;A, B&#62; &#123; private A primary; private B [...]]]></description>
			<content:encoded><![CDATA[<p>One oft-noted feature of the Java language is it&#8217;s lack of a tuple data type. This leads to an abundance of classes that provide the convenience of grouping more than one value into a single object. These classes usually look more or less like this:</p>

<div class="wp_codebox"><table><tr id="p4155"><td class="code" id="p415code5"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ObjectPair<span style="color: #339933;">&lt;</span>A, B<span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">private</span> A primary<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> B secondary<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> ObjectPair<span style="color: #009900;">&#40;</span>A primary, B secondary<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">primary</span> <span style="color: #339933;">=</span> primary<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">secondary</span> <span style="color: #339933;">=</span> secondary<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> A getPrimary<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> primary<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> B getSecondary<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> secondary<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    @Override
    <span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> toString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;(&quot;</span> <span style="color: #339933;">+</span> primary.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;, &quot;</span> <span style="color: #339933;">+</span> secondary.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;)&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>
<p>Sometimes you&#8217;ll see more specific classes like ObjectWithString, but the idea is the same. This approach is fine for many common tasks, but if you find yourself needing multiple cardinalities of tuple, this approach get&#8217;s tedious quickly, as you find yourself writing ObjectTriple, ObjectFourTuple, ObjectFiveTuple, and so on. Thinking that it would be smart to have one class that could create a tuple of any length, you might end up being tempted to write a class like this:</p>

<div class="wp_codebox"><table><tr id="p4156"><td class="code" id="p415code6"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Tuple<span style="color: #339933;">&lt;</span>A<span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> Tuple<span style="color: #339933;">&lt;</span>A<span style="color: #339933;">&gt;</span> getTuple<span style="color: #009900;">&#40;</span>A... <span style="color: #006633;">args</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> Tuple<span style="color: #009900;">&#40;</span>args<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> A<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> items<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> Tuple<span style="color: #009900;">&#40;</span>A<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> items<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">items</span> <span style="color: #339933;">=</span> items<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> A getItem<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> index<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> items<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>But this is even worse than what we had before! Not only are we limited to one type of object (which adds the major headache of unsafe casting to a common use of tuples) but we no longer have any idea of how many items our tuple holds. This approach seems to be a real step backwards, as it&#8217;s really just a wrapper around an array, which gets rid of any advantage of having a tuple type available.</p>
<p>To make the single-class approach work, we&#8217;ll need some way of storing more information in the type of our tuple objects, by taking an idea from functional programming. We define a type that contains information about how long our tuple is, and what type exists at each location. This recursive type is simply defined, but allows us to create tuples of any length:</p>

<div class="wp_codebox"><table><tr id="p4157"><td class="code" id="p415code7"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000000; font-weight: bold;">class</span> Tuple<span style="color: #339933;">&lt;</span>T, U <span style="color: #000000; font-weight: bold;">extends</span> Tuple<span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">abstract</span> T getItem<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">abstract</span> U getTuple<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #339933;">&lt;</span>T<span style="color: #339933;">&gt;</span> Tuple<span style="color: #339933;">&lt;</span>T, EmptyTuple<span style="color: #339933;">&gt;</span> getTuple<span style="color: #009900;">&#40;</span>T item<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> SingleItem<span style="color: #339933;">&lt;</span>T<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span>item<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #339933;">&lt;</span>T, U <span style="color: #000000; font-weight: bold;">extends</span> Tuple<span style="color: #339933;">&gt;</span> Tuple<span style="color: #339933;">&lt;</span>T, U<span style="color: #339933;">&gt;</span> getTuple<span style="color: #009900;">&#40;</span>T item, U tuple<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> SingleItemAndTuple<span style="color: #339933;">&lt;</span>T, U<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span>item, tuple<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000000; font-weight: bold;">class</span> EmptyTuple <span style="color: #000000; font-weight: bold;">extends</span> Tuple <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">class</span> SingleItem<span style="color: #339933;">&lt;</span>T<span style="color: #339933;">&gt;</span> <span style="color: #000000; font-weight: bold;">extends</span> Tuple<span style="color: #339933;">&lt;</span>T, EmptyTuple<span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">private</span> T item<span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">public</span> SingleItem<span style="color: #009900;">&#40;</span>T item<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">item</span> <span style="color: #339933;">=</span> item<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">public</span> T getItem<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">return</span> item<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">public</span> EmptyTuple getTuple<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">class</span> SingleItemAndTuple<span style="color: #339933;">&lt;</span>T, U <span style="color: #000000; font-weight: bold;">extends</span> Tuple<span style="color: #339933;">&gt;</span> <span style="color: #000000; font-weight: bold;">extends</span> Tuple<span style="color: #339933;">&lt;</span>T, U<span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">public</span> T item<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">public</span> U tuple<span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">public</span> SingleItemAndTuple<span style="color: #009900;">&#40;</span>T item, U tuple<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">item</span> <span style="color: #339933;">=</span> item<span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">tuple</span> <span style="color: #339933;">=</span> tuple<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">public</span> T getItem<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">return</span> item<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">public</span> U getTuple<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">return</span> tuple<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Now we have all of the tuple type-safety we could want, at the expense of clumsy notation:</p>

<div class="wp_codebox"><table><tr id="p4158"><td class="code" id="p415code8"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> TupleTest <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        Tuple<span style="color: #339933;">&lt;</span>String, Tuple<span style="color: #339933;">&lt;</span>Integer, Tuple.<span style="color: #006633;">EmptyTuple</span><span style="color: #339933;">&gt;&gt;</span> tuple <span style="color: #339933;">=</span> Tuple.<span style="color: #006633;">getTuple</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Test&quot;</span>, Tuple.<span style="color: #006633;">getTuple</span><span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainteger+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Integer</span></a>.<span style="color: #006633;">valueOf</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>tuple.<span style="color: #006633;">getItem</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>tuple.<span style="color: #006633;">getTuple</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getItem</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/wrDeAmdnsEw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2012/11/17/java-tuples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2012/11/17/java-tuples/</feedburner:origLink></item>
		<item>
		<title>Re-enable virtual terminals on Ubuntu 12.04</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/HfGQiCmjHNw/</link>
		<comments>http://sethjust.com/2012/06/22/re-enable-virtual-terminals-on-ubuntu-12-04/#comments</comments>
		<pubDate>Fri, 22 Jun 2012 21:24:04 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[GRUB]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nvidia]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=406</guid>
		<description><![CDATA[In the past month I&#8217;ve been getting accustomed to Ubuntu 12.04, and all of the changes it brings to the user interface of Ubuntu. One issue I&#8217;ve been especially bothered by is the lack of virtual terminals, at least of users of NVIDIA&#8217;s proprietary drivers (myself included). The issue seems to stem from the fact [...]]]></description>
			<content:encoded><![CDATA[<p>In the past month I&#8217;ve been getting accustomed to Ubuntu 12.04, and all of the changes it brings to the user interface of Ubuntu. One issue I&#8217;ve been especially bothered by is the <a href="https://mok0.wordpress.com/2012/03/23/sacrosanct-linux-feature-dies/">lack of virtual terminals</a>, at least of users of NVIDIA&#8217;s proprietary drivers (myself included). The issue seems to stem from the fact that Ubuntu 12.04 makes use of a hardware framebuffer to draw a splash screen on boot, which causes issues with the driver when attempting to switch virtual terminals. I had a hard time finding any solutions to my problem, until I found <a href="http://askubuntu.com/questions/150610/why-are-virtual-terminal-blank-using-nvidia-propietary-drivers/150626#150626">this post on AskUbuntu</a> which gives a couple suggestions. While the poster suggests going all out and completely disabling graphical boot, he also suggests a less drastic solution, adding a flag to the linux boot options that prevent loading framebuffer modes that interfere with virtual terminals.</p>
<p>To do this, open <span style="font-family: monospace;">/etc/default/grub</span> in a text editor and find the line that reads</p>
<pre>GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"</pre>
<p>and change it to read</p>
<pre>GRUB_CMDLINE_LINUX_DEFAULT="quiet splash vga=normal"</pre>
<p>Rebooting your computer should leave the grub menu and boot splashscreen unchanged, while the virtual terminals work perfectly! Of course, your mileage may vary, depending on your system. This works for me on a fully updated install of Ubuntu 12.04, with an NVIDIA 9800 GT.</p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/HfGQiCmjHNw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2012/06/22/re-enable-virtual-terminals-on-ubuntu-12-04/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2012/06/22/re-enable-virtual-terminals-on-ubuntu-12-04/</feedburner:origLink></item>
		<item>
		<title>Google Maps Easter-egg</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/dAXZtI_mxfM/</link>
		<comments>http://sethjust.com/2012/04/24/google-maps-easter-egg/#comments</comments>
		<pubDate>Wed, 25 Apr 2012 04:19:01 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[reed]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=392</guid>
		<description><![CDATA[Google is constantly updating its map database to provide better maps, which includes adding labels to buildings around the Reed College campus, as well as a little something extra at the east end of the canyon. You can check it out on the Google Maps site here.]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">Google is constantly updating its map database to provide better maps, which includes adding labels to buildings around the Reed College campus, as well as a little something extra at the east end of the canyon.</p>
<p style="text-align: center;"><a href="http://sethjust.com/wp-content/uploads/2012/04/google_maps_reed.png"><img class="aligncenter  wp-image-393 alignnone" title="google_maps_reed" src="http://sethjust.com/wp-content/uploads/2012/04/google_maps_reed.png" alt="" width="NaN" height="438" /></a></p>
<p style="text-align: left;"><span style="text-align: center;">You can check it out on the Google Maps site </span><a style="text-align: center;" href="https://maps.google.com/maps?q=reed+college&amp;hl=en&amp;ll=45.481228,-122.630918&amp;spn=0.012999,0.026715&amp;sll=37.0625,-95.677068&amp;sspn=59.206892,109.423828&amp;hq=reed+college&amp;t=m&amp;z=16">here</a><span style="text-align: center;">.</span></p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/dAXZtI_mxfM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2012/04/24/google-maps-easter-egg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2012/04/24/google-maps-easter-egg/</feedburner:origLink></item>
		<item>
		<title>More Map Scripts</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/LAYxo6xr0D4/</link>
		<comments>http://sethjust.com/2012/02/11/more-map-scripts/#comments</comments>
		<pubDate>Sun, 12 Feb 2012 03:32:40 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[GPS]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=390</guid>
		<description><![CDATA[In the last installment‎ I wrote a script (gdal_slice.py) to cut up geotagged images and save them in a format that GPSdrive will read. I&#8217;ve uploaded that script into a new repository on GitHub. I&#8217;ve also uploaded a script I wrote called get_quad.py, which will download USGS topographic maps automatically. This script naturally complements gdal_slice.py; [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://sethjust.com/2011/07/13/map-tiles-with-python-gdal/ ">last installment</a>‎ I wrote a script (gdal_slice.py) to cut up geotagged images and save them in a format that GPSdrive will read. I&#8217;ve uploaded that script into a <a href="https://github.com/sethjust/map_scripts">new repository on GitHub</a>.</p>
<p>I&#8217;ve also uploaded a script I wrote called get_quad.py, which will download USGS topographic maps automatically. This script naturally complements gdal_slice.py; using the two together allows for almost-totally automatic population of GPSdrive&#8217;s map database with high quality topographic maps.</p>
<pre>usage: get_quad.py [-h] [-q] [-s STATE] (-g | -c COORD COORD)</pre>
<pre>Get DRG USGS quad for given latitude and longitude from LibreMaps.org</pre>
<pre>optional arguments:
 -h, --help show this help message and exit
 -q, --silent don't produce any output
 -s STATE, --state STATE
 Postal abbr. for the state in which the quad falls, so
 we don't need to look it up
 -g, --gps get coordinates from GPSd
 -c COORD COORD, --coords COORD COORD
 specify latitude N and longitude E (respectively) in
 decimal degrees; longitude should be negative, as all
 maps fall in the western hemisphere</pre>
<p>Unfortunately, because of the way USGS maps are organized, the script needs to know the state in which the coordinates fall. If the -s flag is not given, this is inferred from the coordinates, but this lookup requires internet access.</p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/LAYxo6xr0D4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2012/02/11/more-map-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2012/02/11/more-map-scripts/</feedburner:origLink></item>
		<item>
		<title>Bluetooth Android GPS on OS X</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/OIy7W9k5Exk/</link>
		<comments>http://sethjust.com/2012/02/11/bluetooth-android-gps-on-os-x/#comments</comments>
		<pubDate>Sun, 12 Feb 2012 02:47:39 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[GPS]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[bluetooth]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[program]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=368</guid>
		<description><![CDATA[Inspired by this link from the GPSd homepage I set out to use my brand new Android phone as a bluetooth gps. Naturally, I wanted to use it with GPSd, but on OS X. I read through the Linux directions and thought &#8220;this shouldn&#8217;t be terribly hard on a Mac!&#8221; As it turns out, I was right! [...]]]></description>
			<content:encoded><![CDATA[<p>Inspired by <a href="https://bvargo.com/blog/2010/10/17/bluetooth-blues-getting-linux-pc-use-gps-android-d/">this</a> link from the <a href="http://catb.org/gpsd/">GPSd homepage</a> I set out to use my brand new Android phone as a bluetooth gps. Naturally, I wanted to use it with GPSd, but on OS X. I read through the Linux directions and thought &#8220;this shouldn&#8217;t be terribly hard on a Mac!&#8221; As it turns out, I was right!</p>
<p>The first step was downloading an app to the phone. I used the free <a href="https://market.android.com/details?id=com.Saenko.GpsOverBt&amp;hl=en">GPS over BT</a>, but the steps should work with most other programs like it.<a href="http://sethjust.com/wp-content/uploads/2012/02/SC20120208-172857.png"><img class="aligncenter size-medium wp-image-373" title="SC20120208-172857" src="http://sethjust.com/wp-content/uploads/2012/02/SC20120208-172857-180x300.png" alt="" width="180" height="300" /></a></p>
<p>Once that&#8217;s up and running, it&#8217;s time to pair your computer and phone. Make sure that the GPS to BT program is running at this point!</p>
<p><img class="aligncenter size-medium wp-image-369" title="Screen shot 2012-02-08 at 5.31.45 PM" src="http://sethjust.com/wp-content/uploads/2012/02/Screen-shot-2012-02-08-at-5.31.45-PM-300x204.png" alt="" width="300" height="204" /><img class="aligncenter size-medium wp-image-374" title="SC20120208-173149" src="http://sethjust.com/wp-content/uploads/2012/02/SC20120208-173149-180x300.png" alt="" width="180" height="300" /></p>
<p>If everything worked properly, you should see the following:<a href="http://sethjust.com/wp-content/uploads/2012/02/Screen-shot-2012-02-08-at-5.32.33-PM.png"><img class="aligncenter size-medium wp-image-370" title="Screen shot 2012-02-08 at 5.32.33 PM" src="http://sethjust.com/wp-content/uploads/2012/02/Screen-shot-2012-02-08-at-5.32.33-PM-300x204.png" alt="" width="300" height="204" /></a>Make sure that it says &#8220;A computer serial port was created&#8221;. If it doesn&#8217;t say this, your computer didn&#8217;t pick up on the serial data stream from the GPS program, and you should retry pairing.</p>
<p>Once OS X has created a serial port, you simply need to point GPSd at it. In a terminal, run</p>
<pre>ls /dev/tty.*</pre>
<p>One of the results should be /dev/tty.[[devicename]]-BluetoothService &#8212; this is what to point GPSd at:</p>
<pre>sudo gpsd -n /dev/tty.[[devicename]]-BluetoothService</pre>
<p>and you should be up and running!<a href="http://sethjust.com/wp-content/uploads/2012/02/Screen-shot-2012-02-11-at-6.39.38-PM.png"><img class="aligncenter size-medium wp-image-375" title="Screen shot 2012-02-11 at 6.39.38 PM" src="http://sethjust.com/wp-content/uploads/2012/02/Screen-shot-2012-02-11-at-6.39.38-PM-300x179.png" alt="" width="300" height="179" /></a></p>
<p>At the moment there is one caveat: you have to re-pair your devices each time you want to fire up the GPS &#8212; at the moment OS X seems unable to open the bluetooth serial port on request. Other than that, it works like a charm!</p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/OIy7W9k5Exk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2012/02/11/bluetooth-android-gps-on-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2012/02/11/bluetooth-android-gps-on-os-x/</feedburner:origLink></item>
		<item>
		<title>IndieWeb, or how to avoid Digital Sharecropping</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/blN3ZPl6XBk/</link>
		<comments>http://sethjust.com/2011/08/14/indieweb-or-how-to-avoid-digital-sharecropping/#comments</comments>
		<pubDate>Sun, 14 Aug 2011 18:54:57 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[addon]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[social]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=332</guid>
		<description><![CDATA[Thanks to the DorkbotPDX blog I found my way onto the website of this year&#8217;s IndieWebCamp, which took place in Portland June 25 &#38; 26. Although I was saddened that I wasn&#8217;t in town for it, the projects that ended up being developed by the camp immediately grabbed my interest. Although I had never been [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to the <a href="http://dorkbotpdx.org/">DorkbotPDX blog</a> I found my way onto the website of this year&#8217;s <a href="http://indiewebcamp.com/Main_Page">IndieWebCamp</a>, which took place in Portland June 25 &amp; 26. Although I was saddened that I wasn&#8217;t in town for it, the <a href="http://indiewebcamp.com/Demos">projects</a> that ended up being developed by the camp immediately grabbed my interest.</p>
<p>Although I had never been aware of the term &#8220;indie web&#8221; (which seems to have been around for almost 15 years, judging by <a href="http://www.uzine.net/article63.html">this article</a> from uzine.net), I&#8217;ve been building my own independent web presence for more than four years. In the words of the IndieWebCamp home page:</p>
<blockquote><p>Rather than posting content on many third-party silos of content, we should all begin owning the content we&#8217;re creating. Publish short status updates on your own domain, and syndicate to Twitter. Publish photos on your own domain, syndicate to Flickr, etc, etc.</p></blockquote>
<p>For some good summaries of the ideas and goals of the IndieWebCamp, <a href="http://gigaom.com/collaboration/the-indie-web-who-owns-your-identity/">this article</a> from GigaOm and <a href="http://markmhendrickson.com/homesteading-on-the-indie-web">this post</a> from Mark Hendrickson are a great place to start, while each of the camp&#8217;s <a href="http://indiewebcamp.com/Guest_List">guests</a> also have their own websites, each with a wealth of information.</p>
<p>While I&#8217;ve been using this domain for quite a while, it&#8217;s been in use alongside Facebook, Delicious (and Flickr, to a smaller degree) as a part of my web presence. However, since I ditched Facebook five or six months ago, I&#8217;ve been relying on this domain for more, and overall I&#8217;ve been pleased. However, as the IndieWebCamp is readily willing to admit, there is room for a lot of room for technical innovation in expanding the functionality of the indie web. Towards that end, I see three threads of work that I&#8217;m interested in pursuing:</p>
<ul>
<li>Using my site for Flickr-like photo sharing. While this might include syndication to Flickr at some point, I mostly want a light-weight DIY solution to photo sharing.</li>
<li>Similarly, using my site for bookmarking. I really like the service that delicious offers, but I want to own the data and let delicious simply keep a copy of it (see <a href="http://adactio.com/journal/4197/">http://adactio.com/journal/4197/</a> for some ideas).</li>
<li>Finally, I&#8217;m hugely enamored of the work on delivery-agnostic messaging that took place at IndieWebCamp, which you can find details of <a href="http://aaronparecki.com/IndieWeb_Messaging">here</a>. Not only is it a ridiculously simple protocol, but it starts to address some real issues of a distributed social web, in that it allows two-party communication based solely on domain names as unique identifiers, therefore eliminating the middleman in social-web-type communications.</li>
</ul>
<div>Hopefully I&#8217;ll have time to get one of these ideas worked out and running on my site soon (before school starts), so check back here soon, I&#8217;ll be sure to keep you posted.</div>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/blN3ZPl6XBk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2011/08/14/indieweb-or-how-to-avoid-digital-sharecropping/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2011/08/14/indieweb-or-how-to-avoid-digital-sharecropping/</feedburner:origLink></item>
		<item>
		<title>Map Tiles with Python + GDAL</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/O1Cz9LIf5BM/</link>
		<comments>http://sethjust.com/2011/07/13/map-tiles-with-python-gdal/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 21:36:55 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[GPS]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[gdal]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=341</guid>
		<description><![CDATA[After getting GPSDrive running on OS X I started looking into different sources for maps. The GPSDrive wiki has a couple of interesting pages about this: one on creating maps and one on map sources. The second page pointed me to the LibreMap Project which has a complete collection of  USGS 1:24000 (large scale) topographic maps for the [...]]]></description>
			<content:encoded><![CDATA[<p>After <a href="http://sethjust.com/2011/07/13/gpsdrive-on-os-x/">getting GPSDrive running on OS X</a> I started looking into different sources for maps. The GPSDrive wiki has a couple of interesting pages about this: one on <a href="http://sourceforge.net/apps/mediawiki/gpsdrive/index.php?title=Creating_maps">creating maps</a> and one on <a href="http://sourceforge.net/apps/mediawiki/gpsdrive/index.php?title=Data_sources">map sources</a>. The second page pointed me to <a href="http://libremap.org/">the LibreMap Project</a> which has a complete collection of  USGS 1:24000 (large scale) topographic maps for the entire US. These files are distributed as high-resolution GeoTIFF files, along with <a href="http://en.wikipedia.org/wiki/World_file">world files</a>, so the maps are fully geotagged. This means that they contain all of the information needed to generate GPSDrive-friendly map tiles, but GPSDrive will not read them directly. The <a href="http://sourceforge.net/apps/mediawiki/gpsdrive/index.php?title=Creating_maps">creating maps</a> page gives some (heavily out-of-date) advice on how to use the <span style="font-family: monospace;">gdal_slice.sh</span> script distributed with GPSDrive to create map tiles using the tools from <a href="http://gdal.org/">GDAL</a>. Sadly, this script is completely unusable on OS X, because of incompatibilities in the command line tools that are used by the shell script. After spending about five minutes trying to tune it to work with the tools that Apple ships, I completely gave up and looked into other approaches.</p>
<p>Luckily, I quickly found out that GDAL ships with Python bindings. I installed GDAL from <a href="https://trac.osgeo.org/gdal/wiki/DownloadSource">source</a> using the <a href="https://trac.osgeo.org/gdal/wiki/BuildingOnUnix">instructions</a> from their wiki. To make sure it built with Python modules I ran <span style="font-family: monospace;">./configure &#8211;with-python</span>. After that <span style="font-family: monospace;">make</span> and <span style="font-family: monospace;">sudo make install</span> ran without a hitch.</p>
<p>I then set about re-implementing <span style="font-family: monospace;">gdal_slice.sh</span> in Python. Once I got a handle on how to use the Python bindings it was fairly easy to write. You can find the script <a href="http://homepage.sethjust.com/files/gdal_slice.txt">here</a>.</p>
<p>Using <span style="font-family: monospace;">gdal_slice.py</span> is very similar to using <span style="font-family: monospace;">gdal_slice.sh</span>:</p>
<pre>$ ./gdal_slice.py -h
Usage: gdal_slice.py [options] FILENAME

Options:
  -h, --help            show this help message and exit
  -o OVERLAP, --overlap=OVERLAP
                        percentage tiles will overlap. should be at least 20%
  -a, --add             write map info to map_koord.txt in current working
                        directory
  -m, --map             use *_map folders for output; use if input image is
                        UTM. Default behavior
  -t, --topo            use *_top folders for output; use if input image is
                        not UTM
  -v, --verbose         enable debugging output</pre>
<p>The biggest difference is that <span style="font-family: monospace;">gdal_slice.py</span> does not perform any format conversion; it will write maps to TIFF files. Although the file size is decidedly larger than that of PNGs, my version of GDAL is unable to create PNGs, and disk space is (fairly) cheap. If I&#8217;m motivated I&#8217;ll get around to adding a format option, at least to allow conversion to PNG.</p>
<p>Running <span style="font-family: monospace;">gdal_slice.py filename.ext</span> will create a folder named filename_map (or _top, if you use the -t flag) that contains a set of 1280&#215;1024 TIFF files, as well as a map_koord_draft.txt file. Moving this folder into GPSDrive&#8217;s map directory, and merging filename_[map|top]/map_koord_draft.txt with map_koord.txt will make the new maps available to GPSDrive. Note that filename.ext must be in the current working directory, as the script handles filenames/paths somewhat naivëly.</p>
<p>So far I&#8217;ve only tested this with GeoTIFFs from LibreMaps, but it seems to work great, with the caveat that LibreMaps&#8217; files include the borders of map, and my script doesn&#8217;t do any cropping, so you see borders if you&#8217;re near the edges of quads. This doesn&#8217;t bother me terribly much, but you may need to turn mapsets on and off in the Map Control dialog to see the appropriate images.</p>
<p><b>Update 7-14-11:</b> I&#8217;ve modified the script with an additional flag (-a) that will automatically merge the generated map_koords file with map_koord.txt in the current working directory. This means that if you run the script from inside .gpsdrive/maps with the -a flag the generated tiles will be automatically added to GPSDrive&#8217;s database. The script avoids creating duplicate entries in map_koord.txt, as well as alphabetizing all entries.</p>
<p>I&#8217;ve modified the documentation here, as well as the links, to reference the latest version.</p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/O1Cz9LIf5BM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2011/07/13/map-tiles-with-python-gdal/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2011/07/13/map-tiles-with-python-gdal/</feedburner:origLink></item>
		<item>
		<title>GPSDrive on OS X</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/BqDOzP5ZGGY/</link>
		<comments>http://sethjust.com/2011/07/13/gpsdrive-on-os-x/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 19:30:37 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[GPS]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[program]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=303</guid>
		<description><![CDATA[After getting GPSd to compile on OS X, I set my sights on GPSDrive, an open source navigation and map viewing program. When I posted about GPS a couple years ago, I installed GPSDrive, using the version from Fink. However, the latest version of GPSDrive on Fink nowadays is 2.08pre12, while the latest stable release [...]]]></description>
			<content:encoded><![CDATA[<p>After <a href="http://sethjust.com/2011/07/10/gpsd-under-os-x-revisited/">getting GPSd to compile on OS X</a>, I set my sights on <a href="http://www.gpsdrive.de/">GPSDrive</a>, an open source navigation and map viewing program. When I <a href="http://sethjust.com/2009/01/13/gpsd-under-os-x/">posted about GPS a couple years ago</a>, I installed GPSDrive, using the version from Fink. However, the latest version of GPSDrive on Fink nowadays is 2.08pre12, while the latest stable release is 2.11. I&#8217;ve also moved away from using Fink and/or MacPorts for package management in favor of <a href="http://mxcl.github.com/homebrew/" class="broken_link">Homebrew</a>.</p>
<p>To get GPSDrive running I had to do a little bit of fiddling, but it&#8217;s fairly easy. First off, I needed to downgrade GPSd from 2.96 to 2.95 &#8212; apparently the newest version introduced slight changes to the library that GPSDrive hasn&#8217;t yet picked up. However, building the two versions is exactly the same &#8212; see my <a href="http://sethjust.com/2011/07/10/gpsd-under-os-x-revisited/">post on building 2.96</a> for instructions that apply to 2.95. You can get the source package for either version <a href="http://developer.berlios.de/project/showfiles.php?group_id=2116">here</a>.</p>
<p>Next I used homebrew to install the dependencies that GPSDrive needs by running <span style="font-family: monospace;">brew install gtk+ cairo gtkglext postgresql gettext</span>. Note that these are just the packages I didn&#8217;t have going into the build &#8212; you may need more, depending on your setup.</p>
<p>With preliminaries out of the way, I downloaded gpsdrive-2.11 from <a href="http://www.gpsdrive.de/download.shtml">here</a>. As per their build instructions I created a build directory (mkdir build), moved into it (cd build), and then ran cmake. After some serious wrestling with dependency locations and linker flags I figured out the following two steps to get GPSDrive to compile and build.</p>
<p>First, because GPSDrive seems to want to automatically link against libcrypt, which OS X bundles in it&#8217;s libc, you need to tell cmake not to use it. I couldn&#8217;t figure out how to do with with a cmake configuration option, so I edited gpsrive-2.11/src/CMakeLists.txt and commented out (put a # in front) of the two lines containing the word &#8220;crypt&#8221;. You could also delete these lines &#8212; it has the same effect. This is along the lines of the patch <a href="http://lists.gpsdrivers.org/pipermail/gpsdrive/2010-March/002452.html">here</a> (see the attachment), that was posted to the GPSDrive mailing list last year, when I pointed out this bug. Sadly, the patch has not been applied to the source tree yet, but I can attest it works, if you care to apply it yourself.</p>
<p>With that out of the way, we can now run the following command from inside the build directory.</p>

<div class="wp_codebox"><table><tr id="p30310"><td class="code" id="p303code10"><pre class="text" style="font-family:monospace;">cmake -DCMAKE_BUILD_TYPE=Debug\
 -DWITH_FRIENDSD=OFF\
 -DWITH_KISMET=OFF\
 -DWITH_MAPNIK=OFF\
 -DWITH_POSTGIS=OFF\
 -DWITH_SPEECH=OFF\
 -DLIBGPS_OLD=OFF\
 -DGTK2_ATK_INCLUDE_PATH=/usr/local/Cellar/atk/2.0.0/include/atk-1.0\
 -DGTK2_GLIBCONFIG_INCLUDE_PATH=/usr/local/lib/glib-2.0/include\
 -DGTK2_GLIB_INCLUDE_PATH=/usr/local/include/glib-2.0\
 -DGTK2_PANGO_INCLUDE_PATH=/usr/local/Cellar/pango/1.28.4/include/pango-1.0\
 -DGTK2_CAIRO_INCLUDE_PATH=/usr/local/Cellar/cairo/1.10.2/include/cairo\
 -DGTK2_GDKCONFIG_INCLUDE_PATH=/usr/local/Cellar/gtk+/2.24.4/lib/gtk-2.0/include\
 -DGTK2_GTK_LIBRARY=/usr/local/lib/libgtk-x11-2.0.0.dylib\
 -DCMAKE_C_FLAGS=&quot;-I/usr/local/Cellar/gdk-pixbuf/2.22.1/include/gdk-pixbuf-2.0&quot;\
 -DCMAKE_EXE_LINKER_FLAGS=&quot;-lgdk_pixbuf-2.0.0 -lpango-1.0.0 -lgobject-2.0.0 -L/usr/local/Cellar/gettext/0.18.1.1/lib -lintl&quot;\
 -DMSGFMT_EXECUTABLE=/usr/local/Cellar/gettext/0.18.1.1/bin/msgfmt\
 ..</pre></td></tr></table></div>

<p>After cmake generates all the necessary files, you can run <span style="font-family: monospace;">make</span>, and assuming it doesn&#8217;t give you errors, <span style="font-family: monospace;">./src/gpsdrive</span> will allow you to test your newly built executable, and <span style="font-family: monospace;">sudo make install</span> will install it.</p>
<p>Once GPSDrive is up and running you should be able to see your current location (assuming you have a GPS connected to GPSd). If you want to get maps, you can download them from within GPSDrive, which has support for OpenStreeMap tiles, as well as NASA Landsat images (although I haven&#8217;t been able to get Landsat to download correctly).</p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/BqDOzP5ZGGY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2011/07/13/gpsdrive-on-os-x/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2011/07/13/gpsdrive-on-os-x/</feedburner:origLink></item>
		<item>
		<title>Sign your email like Randall Waterhouse</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/K5QqpPDpsNU/</link>
		<comments>http://sethjust.com/2011/07/11/sign-your-email-like-randall-waterhouse/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 00:57:04 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[GPS]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[Mail.app]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[thunderbird]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=307</guid>
		<description><![CDATA[Neal Stephenson&#8217;s novel Cryptonomicon is a fascinating book; I&#8217;m re-reading it for the umpteenth time and loving it every bit as much as when I first read it in 7th grade. One thing that caught my attention on this reading (especially in light of my recent GPS post) is the way that one of the main [...]]]></description>
			<content:encoded><![CDATA[<p>Neal Stephenson&#8217;s novel <em><a href="http://www.amazon.com/gp/product/B004R96U4A/ref=as_li_ss_tl?ie=UTF8&#038;tag=dabbler-20&#038;linkCode=as2&#038;camp=217145&#038;creative=399373&#038;creativeASIN=B004R96U4A">Cryptonomicon</a><img src="http://www.assoc-amazon.com/e/ir?t=&#038;l=as2&#038;o=1&#038;a=B004R96U4A&#038;camp=217145&#038;creative=399373" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></em> is a fascinating book; I&#8217;m re-reading it for the umpteenth time and loving it every bit as much as when I first read it in 7th grade. One thing that caught my attention on this reading (especially in light of my recent <a href="http://sethjust.com/2011/07/10/gpsd-under-os-x-revisited/">GPS post</a>) is the way that one of the main characters, Randall Lawrence Waterhouse, signs his email:</p>
<blockquote><p>Randall Lawrence Waterhouse</p>
<p>Current meatspace coordinates, hot from the GPS receiver card in my laptop:</p>
<p>8 degrees, 52.33 minutes N latitude 117 degrees, 42.75 minutes E longitude</p>
<p>Nearest geographical feature: Palawan, the Philippines</p></blockquote>
<p>(from <a href="http://www.euskalnet.net/larraorma/crypto/slide51.html">http://www.euskalnet.net/larraorma/crypto/slide51.html</a>)</p>
<p>Using GPSd&#8217;s python bindings, and the free, CC-licenced RESTful API from <a href="http://geonames.org">GeoNames.org</a>, I wrote a short python script that will produce a similar output:</p>
<blockquote><p>Seth Just</p>
<p>Current meatspace coordinates, hot from the GPS receiver card in my laptop:</p>
<p>41.751 N latitude, 111.807 W longitude</p>
<p>Nearest geographical feature: Logan Canyon, Utah, United States</p></blockquote>
<p>The core of the script is two functions &#8212; one that gets GPS coordinates from GPSd, and a second that does a lookup for geographical features (mountains, canyons, islands, etc) on <a href="http://geonames.org">GeoNames.org</a>. For more details, see the final section of this post.</p>
<h2>Using gpssig.py</h2>
<p>To use gpssig.py, first download it from <a href="http://homepage.sethjust.com/files/gpssig.txt">here</a>, and change the extension to .py.</p>
<p>In order to be useful as an email signature, I had to produce output in HTML format, which allows almost any mail client to use the output as a signature. I&#8217;ve gone through the effort of setting it up with the two clients I use the most: Mozilla Thunderbird and Apple&#8217;s Mail.app. Of these two, Thunderbird has documented support for HTML signatures (see <a href="http://opensourcearticles.com/thunderbird_15/english/part_03">here</a> for details), and should be the most like other email clients. This script has been tested on Mac OS X Snow Leopard, and should run on Linux without problems (although I haven&#8217;t tried it on versions of python higher than 2.6.1).</p>
<p>Using gpssig.py takes two steps: first configure your Mail client to take a signature from a file, and then configure gpssig.py to run automatically to update that file.</p>
<p>Thunderbird is relatively easy to set up with an HTML signature. Because it only supports one signature per account, you simply need to tell it to draw that signature from a file. Under each account&#8217;s settings there&#8217;s an option to &#8220;Attach the signature from a file&#8221; (see <a href="http://opensourcearticles.com/thunderbird_15/english/part_03">here</a> for a detailed howto). I chose to use ~/.signature.html, but you can use any file you&#8217;d like to, just remember the location you choose.</p>
<p>Mail.app is a more finicky beast &#8212; although the script supports it, I recommend using Thunderbird, mainly because Mail only refreshes its signatures from files on every launch, whereas Thunderbird will read the file each time you compose a message. However, if that limitation is acceptable (if you don&#8217;t move very much, perhaps), it will work just fine. The main issue with Mail.app is that it doesn&#8217;t store signatures in an HTML file, but instead in the proprietary <a href="http://en.wikipedia.org/wiki/Webarchive">.webarchive</a> format. These files can be found in ~/Library/Mail/Signatures. To use gpssig.py with Mail, you need to follow steps 4&amp;5 from <a href="http://bytes.com/topic/macosx/insights/825900-setup-html-signatures-apple-mail-mail-app">http://bytes.com/topic/macosx/insights/825900-setup-html-signatures-apple-mail-mail-app</a>. First create a new signature (under Preferences-&gt;Signatures). This will create a new file in the signature folder &#8212; take note of the file name. You will use this file name to configure gpssig.py.</p>
<p>gpssig.py is configured with command line options:</p>
<pre>Usage: gpssig.py [options] NAME FILENAME
Note: NAME should be enclosed in quotes, unless it contains no spaces.

Options:
  -h, --help   show this help message and exit
  --no-gps     don't attempt to get coordinates from GPS
  -a, --amail  generate files for Apple's Mail.app (.webarchive)
  --lat=LAT    default latitude, if GPS is unavailable
  --lon=LON    default longitude, if GPS is unavailable</pre>
<p>The simplest way to use it is manually &#8212; simply running it whenever you want to update your signature. For example, I use <span style="font-family:monospace;">./gpssig.py &#8211;lat=41.752 &#8211;lon=-111.793 &#8216;Seth Just&#8217; ~/.signature.html</span> to generate a signature for Thunderbird.</p>
<p>If you want to make this automatic, you&#8217;ll need to have the script run automatically. On OS X you&#8217;ll need to use launchd, while on linux you need cron. Both of these make setting up repeating actions very easy &#8212; see <a href="https://arunxjacob.wordpress.com/2008/08/28/mac-launchd-and-launchctl-the-osx-alternative-to-cron/">here</a> for information on launchd and <a href="https://arunxjacob.wordpress.com/2008/08/28/mac-launchd-and-launchctl-the-osx-alternative-to-cron/">here</a> for information on cron.</p>
<p>Sadly I haven&#8217;t yet figured out a way to run the script whenever you write an email &#8212; if I figure it out, I&#8217;ll be sure to post something.</p>
<h2>The Script</h2>
<p>gpssig.py is built around three major functions &#8212; one gets coordinates from GPSd, one gets geographical feature information from</p>
<p>The function I use to get GPS information is a bit hacky &#8212; there doesn&#8217;t seem to be terribly much documentation on GPSd&#8217;s python bindings, so I made do with what I could figure out:</p>

<div class="wp_codebox"><table><tr id="p30714"><td class="code" id="p307code14"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">class</span> NoGPSError <span style="color: black;">&#40;</span><span style="color: #008000;">Exception</span><span style="color: black;">&#41;</span>: <span style="color: #ff7700;font-weight:bold;">pass</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> get_lat_lon<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
  <span style="color: #808080; font-style: italic;"># GPSd Python bindings</span>
  <span style="color: #ff7700;font-weight:bold;">import</span> gps
&nbsp;
  <span style="color: #808080; font-style: italic;"># Create GPS object</span>
  session = gps.<span style="color: black;">gps</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;"># Set GPS object as an iterator over reports from GPSd</span>
  session.<span style="color: black;">stream</span><span style="color: black;">&#40;</span>gps.<span style="color: black;">WATCH_ENABLE</span>|gps.<span style="color: black;">WATCH_NEWSTYLE</span><span style="color: black;">&#41;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;"># Loop until we get a report with lat and lon. The limit of 5 loops should be more than enough -- my gps never takes more than three when it has a lock</span>
  i = <span style="color: #ff4500;">0</span>
  <span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">try</span>:
      session.<span style="color: black;">next</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
      lat, lon = session.<span style="color: black;">data</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'lat'</span><span style="color: black;">&#93;</span>, session.<span style="color: black;">data</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'lon'</span><span style="color: black;">&#93;</span>
      <span style="color: #ff7700;font-weight:bold;">break</span>
    <span style="color: #ff7700;font-weight:bold;">except</span>:
      <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span>i <span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;</span> <span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span>: <span style="color: #ff7700;font-weight:bold;">raise</span> NoGPSError 
      i += <span style="color: #ff4500;">1</span>
&nbsp;
  <span style="color: #ff7700;font-weight:bold;">return</span> lat, lon</pre></td></tr></table></div>

<p>The other function is more straightforward &#8212; it makes two http requests to <a href="http://geonames.org">GeoNames.org</a> to get the nearest geographical feature and locality. It then combines those responses in a way that should provide a good response almost anywhere in the world (provided that GeoNames has good, local data). I&#8217;ve tested it with a variety of coordinates (provided by <a href="http://www.getlatlon.com/" class="broken_link">http://www.getlatlon.com/</a>), and the responses seem to be pretty good.</p>

<div class="wp_codebox"><table><tr id="p30715"><td class="code" id="p307code15"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> get_geo_string<span style="color: black;">&#40;</span>lat, lon<span style="color: black;">&#41;</span>:
  <span style="color: #808080; font-style: italic;"># Modules for REST/XML request from GeoNames</span>
  <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">urllib</span>
  <span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">xml</span>.<span style="color: black;">etree</span> <span style="color: #ff7700;font-weight:bold;">import</span> ElementTree <span style="color: #ff7700;font-weight:bold;">as</span> ET
&nbsp;
  <span style="color: #808080; font-style: italic;"># Request the name of the nearest geographical feature</span>
  placename = ET.<span style="color: black;">parse</span><span style="color: black;">&#40;</span>
      <span style="color: #dc143c;">urllib</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;http://api.geonames.org/findNearby?lat=&quot;</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>lat<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">&quot;&amp;lng=&quot;</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>lon<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">&quot;&amp;featureClass=T&amp;username=sethjust&quot;</span><span style="color: black;">&#41;</span>
      <span style="color: black;">&#41;</span>
  subdiv = ET.<span style="color: black;">parse</span><span style="color: black;">&#40;</span>
      <span style="color: #dc143c;">urllib</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;http://api.geonames.org/countrySubdivision?lat=&quot;</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>lat<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">&quot;&amp;lng=&quot;</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>lon<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">&quot;&amp;username=sethjust&quot;</span><span style="color: black;">&#41;</span>
      <span style="color: black;">&#41;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;"># Format and return place, region, country</span>
  <span style="color: #ff7700;font-weight:bold;">try</span>:
    country = subdiv.<span style="color: black;">getiterator</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;countryName&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">text</span>
  <span style="color: #ff7700;font-weight:bold;">except</span>:
    <span style="color: #ff7700;font-weight:bold;">try</span>:
      country = placename.<span style="color: black;">getiterator</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;countryName&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">text</span>
    <span style="color: #ff7700;font-weight:bold;">except</span>:
      country = <span style="color: #483d8b;">''</span>
  <span style="color: #ff7700;font-weight:bold;">try</span>:
    region = subdiv.<span style="color: black;">getiterator</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;adminName1&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">text</span>
  <span style="color: #ff7700;font-weight:bold;">except</span>:
    region = <span style="color: #483d8b;">''</span>
  <span style="color: #ff7700;font-weight:bold;">try</span>:
    name = placename.<span style="color: black;">getiterator</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;name&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">text</span>
  <span style="color: #ff7700;font-weight:bold;">except</span>:
    name = <span style="color: #483d8b;">''</span>
&nbsp;
  <span style="color: #ff7700;font-weight:bold;">if</span> country:
    <span style="color: #ff7700;font-weight:bold;">if</span> region:
      <span style="color: #ff7700;font-weight:bold;">if</span> name:
        result = <span style="color: #483d8b;">&quot;%s, %s, %s&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>name, region, country<span style="color: black;">&#41;</span>
      <span style="color: #ff7700;font-weight:bold;">else</span>:
        result = <span style="color: #483d8b;">&quot;%s, %s&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>region, country<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
      <span style="color: #ff7700;font-weight:bold;">if</span> name:
        result = <span style="color: #483d8b;">&quot;%s, %s&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>name, country<span style="color: black;">&#41;</span>
      <span style="color: #ff7700;font-weight:bold;">else</span>:
        result = country
  <span style="color: #ff7700;font-weight:bold;">else</span>:
    result = <span style="color: #483d8b;">&quot;unknown&quot;</span>
&nbsp;
  <span style="color: #ff7700;font-weight:bold;">return</span> result</pre></td></tr></table></div>

<p>Finally, the main method of the program parses arguments, determines what coordinates to use, gets the geographical feature string, and then generates the proper HTML and copies it into the correct place.</p>

<div class="wp_codebox"><table><tr id="p30716"><td class="code" id="p307code16"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span>__name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span><span style="color: black;">&#41;</span>:
  <span style="color: #808080; font-style: italic;"># Parse command line options</span>
  <span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">optparse</span> <span style="color: #ff7700;font-weight:bold;">import</span> OptionParser
  <span style="color: #dc143c;">parser</span> = OptionParser<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Usage: %prog [options] NAME FILENAME<span style="color: #000099; font-weight: bold;">\n</span>Note: NAME should be enclosed in quotes, unless it contains no spaces.&quot;</span><span style="color: black;">&#41;</span>
  <span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;--no-gps&quot;</span>, action=<span style="color: #483d8b;">&quot;store_true&quot;</span>, dest=<span style="color: #483d8b;">&quot;nogps&quot;</span>, default=<span style="color: #008000;">False</span>, <span style="color: #008000;">help</span>=<span style="color: #483d8b;">&quot;don't attempt to get coordinates from GPS&quot;</span><span style="color: black;">&#41;</span>
  <span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;-a&quot;</span>, <span style="color: #483d8b;">&quot;--amail&quot;</span>, action=<span style="color: #483d8b;">&quot;store_true&quot;</span>, dest=<span style="color: #483d8b;">&quot;amail&quot;</span>, default=<span style="color: #008000;">False</span>, <span style="color: #008000;">help</span>=<span style="color: #483d8b;">&quot;generate files for Apple's Mail.app (.webarchive)&quot;</span><span style="color: black;">&#41;</span>
  <span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;--lat&quot;</span>, action=<span style="color: #483d8b;">&quot;store&quot;</span>, <span style="color: #008000;">type</span>=<span style="color: #483d8b;">&quot;float&quot;</span>, dest=<span style="color: #483d8b;">&quot;lat&quot;</span>, <span style="color: #008000;">help</span>=<span style="color: #483d8b;">&quot;default latitude, if GPS is unavailable&quot;</span><span style="color: black;">&#41;</span>
  <span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;--lon&quot;</span>, action=<span style="color: #483d8b;">&quot;store&quot;</span>, <span style="color: #008000;">type</span>=<span style="color: #483d8b;">&quot;float&quot;</span>, dest=<span style="color: #483d8b;">&quot;lon&quot;</span>, <span style="color: #008000;">help</span>=<span style="color: #483d8b;">&quot;default longitude, if GPS is unavailable&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
  options, args = <span style="color: #dc143c;">parser</span>.<span style="color: black;">parse_args</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
  <span style="color: #ff7700;font-weight:bold;">try</span>: <span style="color: #ff7700;font-weight:bold;">assert</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span>args<span style="color: black;">&#41;</span> == <span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>
  <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">AssertionError</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;You must provide NAME FILENAME<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
    <span style="color: #dc143c;">parser</span>.<span style="color: black;">print_help</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    exit<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
  <span style="color: #ff7700;font-weight:bold;">try</span>: <span style="color: #ff7700;font-weight:bold;">assert</span><span style="color: black;">&#40;</span><span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>options.<span style="color: black;">lat</span><span style="color: #66cc66;">!</span>=<span style="color: #008000;">None</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&amp;</span> <span style="color: black;">&#40;</span>options.<span style="color: black;">lon</span><span style="color: #66cc66;">!</span>=<span style="color: #008000;">None</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span> | <span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>options.<span style="color: black;">lat</span>==<span style="color: #008000;">None</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&amp;</span> <span style="color: black;">&#40;</span>options.<span style="color: black;">lon</span>==<span style="color: #008000;">None</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
  <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">AssertionError</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;You must provide both lat and lon arguments<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
    <span style="color: #dc143c;">parser</span>.<span style="color: black;">print_help</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    exit<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;"># Modules for creating signature file</span>
  <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">tempfile</span>, <span style="color: #dc143c;">os</span>
&nbsp;
  <span style="color: #ff7700;font-weight:bold;">try</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span>options.<span style="color: black;">nogps</span><span style="color: black;">&#41;</span>: <span style="color: #ff7700;font-weight:bold;">raise</span> NoGPSError
    lat, lon = get_lat_lon<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Got %f, %f from gps&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>lat, lon<span style="color: black;">&#41;</span>
  <span style="color: #ff7700;font-weight:bold;">except</span> NoGPSError:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">not</span> options.<span style="color: black;">nogps</span><span style="color: black;">&#41;</span>: <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Failed to get coordinates from GPS&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">try</span>:
      <span style="color: #ff7700;font-weight:bold;">assert</span><span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>options.<span style="color: black;">lat</span><span style="color: #66cc66;">!</span>=<span style="color: #008000;">None</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&amp;</span> <span style="color: black;">&#40;</span>options.<span style="color: black;">lon</span><span style="color: #66cc66;">!</span>=<span style="color: #008000;">None</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">AssertionError</span>:
      <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;No default coordinates provided; exiting&quot;</span>
      exit<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    lat, lon = options.<span style="color: black;">lat</span>, options.<span style="color: black;">lon</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Using %f, %f as coordinates&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>lat, lon<span style="color: black;">&#41;</span>
&nbsp;
  geostring = get_geo_string<span style="color: black;">&#40;</span>lat, lon<span style="color: black;">&#41;</span>
&nbsp;
  lac, loc = <span style="color: #483d8b;">'N'</span>, <span style="color: #483d8b;">'E'</span>
  <span style="color: #ff7700;font-weight:bold;">if</span> lat <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">0</span>:
    lat <span style="color: #66cc66;">*</span>= -<span style="color: #ff4500;">1</span>
    lac = <span style="color: #483d8b;">'S'</span>
  <span style="color: #ff7700;font-weight:bold;">if</span> lon <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">0</span>:
    lon <span style="color: #66cc66;">*</span>= -<span style="color: #ff4500;">1</span>
    loc = <span style="color: #483d8b;">'W'</span>
&nbsp;
  <span style="color: #008000;">file</span> = <span style="color: #dc143c;">tempfile</span>.<span style="color: black;">NamedTemporaryFile</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
  <span style="color: #008000;">file</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&lt;html&gt;&lt;body&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;p&gt;&quot;</span><span style="color: black;">&#41;</span>
  <span style="color: #008000;">file</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span>args<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
  <span style="color: #008000;">file</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&lt;/p&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;p&gt;&quot;</span><span style="color: black;">&#41;</span>
  <span style="color: #008000;">file</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Current meatspace coordinates, hot from the GPS receiver card in my laptop:&quot;</span><span style="color: black;">&#41;</span>
  <span style="color: #008000;">file</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&lt;/p&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;p&gt;&quot;</span><span style="color: black;">&#41;</span>
  <span style="color: #008000;">file</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;%.3f %s latitude, %.3f %s longitude&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>lat, lac, lon, loc<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
  <span style="color: #008000;">file</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&lt;/p&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;p&gt;&quot;</span><span style="color: black;">&#41;</span>
  <span style="color: #008000;">file</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Nearest geographical feature: &quot;</span> + geostring<span style="color: black;">&#41;</span>
  <span style="color: #008000;">file</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&lt;/p&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
  <span style="color: #008000;">file</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&lt;/html&gt;&lt;/body&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
  <span style="color: #008000;">file</span>.<span style="color: black;">flush</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
  <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span>options.<span style="color: black;">amail</span><span style="color: black;">&#41;</span>:
    <span style="color: #dc143c;">os</span>.<span style="color: black;">system</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;textutil -convert webarchive -output &quot;</span> + args<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> + <span style="color: #483d8b;">&quot; &quot;</span> + <span style="color: #008000;">file</span>.<span style="color: black;">name</span><span style="color: black;">&#41;</span>
  <span style="color: #ff7700;font-weight:bold;">else</span>:
    <span style="color: #dc143c;">os</span>.<span style="color: black;">system</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;cp &quot;</span> + <span style="color: #008000;">file</span>.<span style="color: black;">name</span> + <span style="color: #483d8b;">&quot; &quot;</span> + args<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/K5QqpPDpsNU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2011/07/11/sign-your-email-like-randall-waterhouse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2011/07/11/sign-your-email-like-randall-waterhouse/</feedburner:origLink></item>
		<item>
		<title>GPSd under OS X (revisited)</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/vFx5PU0QN4E/</link>
		<comments>http://sethjust.com/2011/07/10/gpsd-under-os-x-revisited/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 04:07:27 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[GPS]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[program]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=305</guid>
		<description><![CDATA[It&#8217;s been almost 2 and half years since I originally posted about GPSd and OS X. That post got quite a bit of traffic for a while, but a whole lot has changed since then. If you&#8217;re interested in some in-depth background information, you should check out the old post; this post is mostly about [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been almost 2 and half years since I originally posted about <a href="http://sethjust.com/2009/01/13/gpsd-under-os-x/">GPSd and OS X</a>. That post got quite a bit of traffic for a while, but a whole lot has changed since then. If you&#8217;re interested in some in-depth background information, you should check out the old post; this post is mostly about the changes in the GPSd project since then, and the process of getting it running on OS X.</p>
<p>Two and a half years ago, GPSd had just released version 2.38. The latest version, which I just downloaded, is 2.96. Most significantly, GPSd has updated their communication protocol from a simple character-command format to one based on JSON-packed data. Further, they&#8217;ve built a significant portion of the project around python, and consequently built better python interfaces into the project.</p>
<p>OS X has also been updated, from whatever 10.5.x was current three Januaries ago, to 10.6.8. Luckily, the under-the-hood changes that Snow Leopard brought to the table should only make compiling software easier.</p>
<p>Building GPSd is a whole lot easier than it was the last time I went through all of this. I downloaded the latest source package (from <a href="http://prdownload.berlios.de/gpsd/gpsd-2.96bis.tar.gz">http://prdownload.berlios.de/gpsd/gpsd-2.96bis.tar.gz</a>). The bundled INSTALL file lists only python and py-gtk2 as dependencies, which makes compilation easy, given that python comes bundled with OS X. Although py-gtk2 is available through MacPorts (using <span style="font-family: monospace;">sudo port install py-gtk2</span>) I chose to avoid install the ridiculously long list of dependencies that it requires, as it is only required for the graphical test client (xgps), and GPSd also ships the perfectly functional command-line tool cgps, which provides the same information, albeit in a more sparse manner.</p>
<p>The actual build process is surprisingly easy: I ran <span style="font-family: monospace;">./configure &#8211;x-includes=/usr/X11R6/include</span>, as suggested by the INSTALL file. As this indicated no issues, I ran <span style="font-family: monospace;">make</span> and <span style="font-family: monospace;">sudo make install</span>, which ran without a hitch, and gave me a working set of gps tools.</p>
<p>At this point it is possible for me to attach my GPS (see my old post for information about getting devices up and running), run <span style="font-family: monospace;">gpsd -n /dev/cu.usbserial</span>, and then use <span style="font-family: monospace;">cgps</span>to get coordinates, date, and satellite information. However, this isn&#8217;t everything &#8212; all of the python based GPSd tools, such as gpsprof, still don&#8217;t work. This is because of Apple&#8217;s slightly special python distribution &#8212; while GPSd&#8217;s <span style="font-family: monospace;">sudo make install</span> puts python modules into /usr/local/lib/python2.6/site-packages/, they need to be in /Library/Python/2.6/site-packages/. Instead of having to install these manually, you can use the bundled python install script to put the modules in the correct path by running <span style="font-family: monospace;">sudo python setup.py install</span> (thanks to <a href="http://docs.python.org/install/index.html">http://docs.python.org/install/index.html</a>).</p>
<p>Now that I have the most recent GPSd up and running I&#8217;m hoping to do some fun things with it. If I do, you&#8217;ll see it here!</p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/vFx5PU0QN4E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2011/07/10/gpsd-under-os-x-revisited/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2011/07/10/gpsd-under-os-x-revisited/</feedburner:origLink></item>
		<item>
		<title>Chrome + Grooveshark = Blank Page!?!</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/sfo76ZCxd80/</link>
		<comments>http://sethjust.com/2011/06/23/chrome-grooveshark-blank-page/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 20:01:42 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[grooveshark]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=296</guid>
		<description><![CDATA[Recently I was having a pretty frustrating issue viewing Grooveshark in Chrome &#8212; it would only load a blank, white page. This had me tearing my hair out, and Google was no help at all; there seemed to be a handful of people posting about this problem, but their posts didn&#8217;t offer any solutions. I [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was having a pretty frustrating issue viewing <a href="http://grooveshark.com">Grooveshark</a> in Chrome &#8212; it would only load a blank, white page. This had me tearing my hair out, and Google was no help at all; there seemed to be a handful of people posting about this problem, but their posts didn&#8217;t offer any solutions.</p>
<p><a href="http://sethjust.com/wp-content/uploads/2011/06/Screen-shot-2011-06-23-at-1.54.25-PM.png"><br />
<img class="alignright" title="Screen shot 2011-06-23 at 1.54.25 PM" src="http://sethjust.com/wp-content/uploads/2011/06/Screen-shot-2011-06-23-at-1.54.25-PM-300x47.png" alt="" width="300" height="47" /></a> I noticed that I was able to load the website just fine in Safari, and that&#8217;s when I had an insight &#8212; I noticed that Safari was loading http://grooveshark.com, while Chrome was taking me to http<strong>s</strong>://grooveshark.com. It turns out that the issue was with a plugin I use &#8212; the <a href="https://code.google.com/p/kbsslenforcer/">KB SSL Enforcer</a>. While it&#8217;s a great piece of software, it was forcing Chrome to connect to the SSL site, which for some odd reason was causing the blank page to be displayed.</p>
<p>The fix for this issue was easy. I just opened up the SSL Enforcer options and added grooveshark.com to the blacklist; telling the plugin to never force SSL for Grooveshark.<br />
<a href="http://sethjust.com/wp-content/uploads/2011/06/Screen-shot-2011-06-23-at-1.54.44-PM.png"><img class="aligncenter size-medium wp-image-298" title="Screen shot 2011-06-23 at 1.54.44 PM" src="http://sethjust.com/wp-content/uploads/2011/06/Screen-shot-2011-06-23-at-1.54.44-PM-300x96.png" alt="" width="300" height="96" /></a></p>
<p>Now I&#8217;m happily listening to tunes online without having a second browser open!<br />
<a href="http://sethjust.com/wp-content/uploads/2011/06/Screen-shot-2011-06-23-at-1.56.32-PM.png"><img class="aligncenter size-full wp-image-299" title="Screen shot 2011-06-23 at 1.56.32 PM" src="http://sethjust.com/wp-content/uploads/2011/06/Screen-shot-2011-06-23-at-1.56.32-PM.png" alt="" width="263" height="210" /></a></p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/sfo76ZCxd80" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2011/06/23/chrome-grooveshark-blank-page/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2011/06/23/chrome-grooveshark-blank-page/</feedburner:origLink></item>
		<item>
		<title>Web Laundry, Smart Cards, Python and OS X Smorgasbord</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/yxNZx-Wf-90/</link>
		<comments>http://sethjust.com/2011/06/14/laundry-smart-cards/#comments</comments>
		<pubDate>Wed, 15 Jun 2011 00:22:11 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[laundry]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[smart card]]></category>
		<category><![CDATA[stored value]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=285</guid>
		<description><![CDATA[Disclaimer: This article is for informational purposes, the author shall not be held liable for any actions taken on the basis of the information presented. I do not condone fraud, theft, or other malfeasance. In September 2010, Hans Viksler posted an article about the insecurity of the stored-value smart card system used by Web Laundry (now [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">Disclaimer: This article is for informational purposes, the author shall not be held liable for any actions taken on the basis of the information presented. I do not condone fraud, theft, or other malfeasance.</span></p>
<p>In September 2010, <a rel="author" href="http://www.blogger.com/profile/09056609859376859009">Hans Viksler</a> posted an <a href="http://ihackiam.blogspot.com/2010/09/web-laundry-insecurity.html">article</a> about the insecurity of the stored-value smart card system used by <a href="http://weblaundry.com/">Web Laundry</a> (now <a href="http://www.washlaundry.com/">Wash Laundry</a>). I&#8217;ll let that article stand on its own &#8212; it gives a good overview of the bone-headed system that the engineers there had in place. In short, they used a secure memory card made by Atmel (specifically, from the CryptoMemory line), the AT88SC0404C (datasheet <a href="http://www.atmel.com/dyn/resources/prod_documents/doc5211.pdf">here</a>), but neglected to change the default master password. This means that all you need to read or write the stored data is a ISO-7816-3 compliant smart card reader.</p>
<p>This is where my story starts &#8212; this summer I&#8217;m living in a dorm that uses a Web Laundry stored value system. That was enough of a push for me to buy a smart card reader, seeing as I&#8217;d always wanted to play with them, and this looked like a good opportunity. I picked up a smart card reader from Amazon.com, an <a id="static_txt_preview" href="http://www.amazon.com/gp/product/B0012K5P02/ref=as_li_ss_tl?ie=UTF8&amp;tag=dabbler-20&amp;linkCode=as2&amp;camp=217153&amp;creative=399349&amp;creativeASIN=B0012K5P02" class="broken_link">SCM Microsystems SCR3310</a>. It was both cheap and, according to the manufacturer&#8217;s <a href="https://www.scmmicro.com/security/view_product_en.php?PID=4">product page</a>, offers full ISO 7816, CCID and PC/SC compatibility (i.e. all of the relevant standards), as well as drivers for OS X, which is my primary operating system for the time being.</p>
<p>Doing some research, it turns out that Apple ships a (modified) version of the open-source <a href="http://pcsclite.alioth.debian.org/">PCSC Lite</a> framework for smart card integration. This means that all I would need to get up and running was a driver for my device and a way to interface it. Once the reader arrived I installed the drivers, and ran pcsctest (from PCSC Lite) on the command line. Sadly, all I got was an error message:</p>
<pre>Testing SCardEstablishContext    : Service not available.</pre>
<p>Googling told me that the appropriate services are supposed to start whenever a smart card reader with appropriate drivers is plugged in, which made this error all the more confusing. Luckily, I found <a href="http://support.scmmicro.com/forum/viewtopic.php?f=10&amp;t=552">this thread</a> on SCM&#8217;s forums &#8212; it seems that the driver they have posted doesn&#8217;t include the USB identifiers for the version of the reader I had, but a helpful poster left instructions to modify a plist file in the driver (mirrored <a href="http://homepage.sethjust.com/files/SCM3310_OSX.html">here</a> for archival purposes). With that, I was up and running!</p>
<p>pcsctest spat out useful output this time around:</p>
<pre>$ pcsctest

MUSCLE PC/SC Lite Test Program

Testing SCardEstablishContext    : Command successful.
Testing SCardGetStatusChange
Please insert a working reader   : Command successful.
Testing SCardListReaders         : Command successful.
Reader 01: SCM SCR 3310 00 00
Enter the reader number          : 1
Waiting for card insertion
                                 : Command successful.
Testing SCardConnect             : Command successful.
Testing SCardStatus              : Command successful.
Current Reader Name              : SCM SCR 3310 00 00
Current Reader State             : 0x34
Current Reader Protocol          : 0x0
Current Reader ATR Size          : 8 (0x8)
Current Reader ATR Value         : 3B B2 11 00 10 80 00 04
Testing SCardDisconnect          : Command successful.
Testing SCardReleaseContext      : Command successful.</pre>
<p>That left me with the issue of interacting with the smart card somehow. In case you hadn&#8217;t guessed from the post title, that solution was Python. Specifically, the pyscard bindings for PCSC Lite, from <a href="http://pyscard.sourceforge.net/">pyscard.sourceforge.net</a>. There&#8217;s a nice array of examples, and so I wrote up a python script for interacting with <em>this particular </em>CryptoMemory card, based on the command set from the datasheet and the examples. It&#8217;s not as polished or feature-rich as the software Hans posted, but if you&#8217;re running OS X or Linux, it should be helpful. At the moment this script is extremely rough &#8212; it gets the job done, but in an ugly and unsafe way. I&#8217;m posting it <a href="http://homepage.sethjust.com/files/CryptoMemory.txt">here</a>, but you <strong>SHOULD NOT USE IT IF YOU DON&#8217;T KNOW WHAT YOU&#8217;RE DOING</strong>. If you aren&#8217;t careful, it will mess up your card. Hopefully I&#8217;ll have time to wrap it all in a library that will abstract away the messiness and provide nice features like exception handling; if I do, you&#8217;ll see it here.</p>
<p>Using my script I was able to verify Hans&#8217; findings &#8212; although the card is configured to require cryptographic authentication to access the user zones (where the goodies can be found), the password is left at the default value, which makes overwriting the access registers and conducting a replay attack (as demonstrated by the video in his post) a walk in the park. Following his example, I won&#8217;t post any information on how the cards store their values, but it&#8217;s surprising that this security hole still isn&#8217;t fixed, seeing as it would cost nothing to overwrite the master password when they first configure the cards.</p>
<p>Hopefully this post will give some of you who&#8217;ve wanted to work with smart cards a push in that direction &#8212; although there are a few hurdles along the way, it&#8217;s an interesting area to work on. I&#8217;m hoping to move on from poking at other people&#8217;s cards and start using my new hardware for authentication and encryption.</p>
<p>Happy hacking!</p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/yxNZx-Wf-90" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2011/06/14/laundry-smart-cards/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2011/06/14/laundry-smart-cards/</feedburner:origLink></item>
		<item>
		<title>RGB LED Sun with Rainbowduino</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/RXYXPEacIaY/</link>
		<comments>http://sethjust.com/2011/04/26/rgb-led-sun-with-rainbowduino/#comments</comments>
		<pubDate>Tue, 26 Apr 2011 17:50:58 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[display]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[Rainbowduino]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=251</guid>
		<description><![CDATA[So my current project (outside of massive amounts of school work) is building a large, bright, RGB LED display for my college&#8217;s weekend-long end-of-year party. I&#8217;ve got three of these strips from DealExtreme, which have 30 RGB LEDs in separable strips of three LEDs. That makes for a total of 30 RGB dots, which is [...]]]></description>
			<content:encoded><![CDATA[<p>So my current project (outside of massive amounts of school work) is building a large, bright, RGB LED display for my college&#8217;s weekend-long end-of-year party. I&#8217;ve got three of <a href="http://www.dealextreme.com/p/rgb-multicolored-1-meter-30-led-6w-light-strip-dc-12v-14965">these</a> strips from <a href="http://www.dealextreme.com/">DealExtreme</a>, which have 30 RGB LEDs in separable strips of three LEDs. That makes for a total of 30 RGB dots, which is presents no problem for a <a href="http://garden.seeedstudio.com/index.php?title=Rainbowduino_LED_driver_platform_-_Atmega_328">Rainbowduino</a>.</p>
<p>My goal for this post is to record my process in putting this project together. I&#8217;m nowhere near done at the moment, but I&#8217;ll keep updating it as I go.</p>
<h2>Planning</h2>
<p>The plan for this project came together slowly &#8211; I knew that I wanted to make a large RGB LED display, and I had already bought one light strip to play with a year or so ago. I&#8217;m not sure how the Rainbowduino came across my radar, but it seemed perfect, because it could drive up to 64 RGB LEDs simultaneously, so could support up to 6 strips. However, the funding for the project chose to use 3, and I felt that that was more than enough to get the effect I was shooting for.</p>
<p>Because the strips run at 12 volts, and are each rated for 6 amps, I decided to use a spare PC power supply to provide power because it supplies a well-regulated voltage and plenty of current.</p>
<p>Finally, the Rainbowduino can operate in one of three ways: standalone mode, serial mode, or I2C mode. The second and third allow you to stream patterns to the Rainbowduino from another microcontroller or computer. However, I want this sun to stand on its own, so I&#8217;m planning on having it run in standalone mode. This means I&#8217;ll need a way of programming it with whatever patterns I want it to use. The Rainbowduino has a 6-pin ICSP plug, which will work perfectly with the AVR programmer I already have, Lady Ada&#8217;s <a href="http://www.ladyada.net/make/usbtinyisp/">UsbTinyISP</a>.</p>
<h2>Preparation</h2>
<p>To prepare for putting the whole display together, I wanted to test my LEDs, power supply and control board. I used an RGB driver based on a <a href="http://www.pjrc.com/teensy/">Teensy 2.0</a>, a few FETs and a wall-wart (which I know works well with these strips) as a simple tester for the LEDs, and found no problems. The power supply also checked out, I took apart a single 4-pin plug to get the +12V and GND wires and checked the voltage with a multimeter. The reading was good and steady, but attaching it to the Rainbowduino caused one of the power-filtering capacitors to explode (which was unexpected, given the board is rated for 12V), but removing the damaged cap fixed the problem, and soon I had it powered up and lighting LEDs. I also connected the UsbTinyISP and used <a href="http://savannah.nongnu.org/projects/avrdude">Avrdude</a> to ensure I could program the Rainbowduino. (As an aside, the Avrdude part name for the ATMEGA328P is &#8216;m328p&#8217;, which took me way too long to figure out).</p>
<p>At this point I felt comfortable that I had everything I needed to put the display together (except for some sort of mounting board. However, the end of the weekend was drawing to a close, so I had to wait to get more done.</p>
<h2>Steeling Myself</h2>
<p><a href="http://sethjust.com/wp-content/uploads/2011/04/layout.png"><img class="alignright size-medium wp-image-264" title="layout" src="http://sethjust.com/wp-content/uploads/2011/04/layout-300x220.png" alt="" width="300" height="220" /></a>Before I prepared to cut my 3 strips into 30 smaller ones, and soldered 4 wires to each one, I decided to get a picture of what the final wiring would look like. This was a job for Cadsoft&#8217;s <a href="http://www.cadsoftusa.com/">Eagle</a>, the defacto-standard for making schematics and PCB layouts. Even though I&#8217;m planning on laying out the display by hand, with wires, I felt that having a reference for wiring the matrix would be worthwhile. I built a <a href="http://sethjust.com/wp-content/uploads/2011/04/schematic.png">schematic</a> to show the control layout for the LEDs, as a matrix, which is what the Rainbowduino is designed to drive. I then built a <a href="http://sethjust.com/wp-content/uploads/2011/04/layout.png">layout</a> based on the schematic that corresponds (roughly, and not to scale) to how I&#8217;m planning to arrange the LED strips, although the footprints of all the parts are completely arbitrary. However, the pin layout of the headers on either side match the layout of those on the Rainbowduino, which will make it helpful when it comes time to connect all 120 wires.</p>
<h2>Wiring</h2>
<p><strong>Update, May 2:</strong> I&#8217;ve now finished wiring the matrix: I attached all of the strips to a piece of foamcore board using their adhesive backing and soldered all of the connections. Everything worked on the first try, and I flashed the code (rainbowduino_v1_0_4) from <a href="http://code.google.com/p/rainbowduino/downloads/list">here</a>. The demo patterns looked amazing, but sadly, shortly after powering it up (before Icould even get a video), something stopped working. Not only were the patterns not being displayed, but I couldn&#8217;t get my programmer to connect to the rainbowduino! Luckily, I emailed SeeedStudio, and one of their very helpful employe has promised me that a replacement is already on the way. Hopefully it arrives before the fifth, when I was hoping to set up the display on campus. Until it arrives, and I can replace the defective board on the display, enjoy the only two photos I took while it was working (before I flashed the new firmware onto it).</p>
<div class="aligncenter"><a href="http://sethjust.com/wp-content/uploads/2011/04/0501111603-00.jpg"><img class="size-medium wp-image-277" title="Rainbowduino Sun displaying test pattern" src="http://sethjust.com/wp-content/uploads/2011/04/0501111603-00-300x225.jpg" alt="" width="300" height="225" /></a><a href="http://sethjust.com/wp-content/uploads/2011/04/0501111603-01.jpg"><img class="size-medium wp-image-278" title="Rainbowduino with USBTinyISP attached" src="http://sethjust.com/wp-content/uploads/2011/04/0501111603-01-300x225.jpg" alt="" width="300" height="225" /></a></div>
<p><span style="font-size: 20px; font-weight: bold;">Final words</span></p>
<p>Despite the setback with my Rainbowduino, I went ahead with getting the display ready for this weekend, where (hopefully) it will be sitting in a central place, entertaining people with colorful patterns. To do this, I used a large zip-tie to strap the ATX power supply to the back of the piece of foamcore board, and used some more zip ties to position all of the wires out of sight, as well as to securely fasten the two wires running 12V to the display. All in all it looks good, and I&#8217;m excited to load some exciting patters onto it once my new control board arrives.</p>
<p>Also, this post is still in progress &#8212; check back soon for updates! Apologies for the lack of photos, they should be coming soon.
<a href='http://sethjust.com/2011/04/26/rgb-led-sun-with-rainbowduino/schematic/' title='schematic'><img width="150" height="150" src="http://sethjust.com/wp-content/uploads/2011/04/schematic-150x150.png" class="attachment-thumbnail" alt="schematic" title="schematic" /></a>
<a href='http://sethjust.com/2011/04/26/rgb-led-sun-with-rainbowduino/layout/' title='layout'><img width="150" height="150" src="http://sethjust.com/wp-content/uploads/2011/04/layout-150x150.png" class="attachment-thumbnail" alt="layout" title="layout" /></a>
<a href='http://sethjust.com/2011/04/26/rgb-led-sun-with-rainbowduino/0501111603-00/' title='Rainbowduino Sun displaying test pattern'><img width="150" height="150" src="http://sethjust.com/wp-content/uploads/2011/04/0501111603-00-150x150.jpg" class="attachment-thumbnail" alt="Rainbowduino Sun displaying test pattern" title="Rainbowduino Sun displaying test pattern" /></a>
<a href='http://sethjust.com/2011/04/26/rgb-led-sun-with-rainbowduino/0501111603-01/' title='Rainbowduino with USBTinyISP attached'><img width="150" height="150" src="http://sethjust.com/wp-content/uploads/2011/04/0501111603-01-150x150.jpg" class="attachment-thumbnail" alt="Rainbowduino with USBTinyISP attached" title="Rainbowduino with USBTinyISP attached" /></a>
</p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/RXYXPEacIaY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2011/04/26/rgb-led-sun-with-rainbowduino/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2011/04/26/rgb-led-sun-with-rainbowduino/</feedburner:origLink></item>
		<item>
		<title>Submit an HTML form using the enter key, without JavaScript</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/oIWxpaPi7TU/</link>
		<comments>http://sethjust.com/2010/12/22/submit-an-html-form-using-the-enter-key/#comments</comments>
		<pubDate>Wed, 22 Dec 2010 13:05:04 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[hint]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=213</guid>
		<description><![CDATA[I was delving into some simple PHP coding for the first time in a while, and was having trouble getting a form to submit when I pressed enter. Googling was ineffective, and only seemed to come up with javascript approaches, which I wanted to avoid. However, this StackOverflow question suggested the answer: add a hidefocus="true" [...]]]></description>
			<content:encoded><![CDATA[<p>I was delving into some simple PHP coding for the first time in a while, and was having trouble getting a form to submit when I pressed enter. Googling was ineffective, and only seemed to come up with javascript approaches, which I wanted to avoid. However, <a href="http://stackoverflow.com/questions/477691/html-submitting-a-form-by-pressing-enter-without-a-submit-button">this</a> StackOverflow question suggested the answer: add a</p>
<pre>hidefocus="true"</pre>
<p>attribute to the submit button. I did this, and everything worked beautifully.</p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/oIWxpaPi7TU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2010/12/22/submit-an-html-form-using-the-enter-key/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2010/12/22/submit-an-html-form-using-the-enter-key/</feedburner:origLink></item>
		<item>
		<title>New Keyboard — Reviewed!</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/NLpITYAXnb8/</link>
		<comments>http://sethjust.com/2010/11/05/new-keyboard-reviewed/#comments</comments>
		<pubDate>Fri, 05 Nov 2010 20:29:04 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[cheap]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[keyboard]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=187</guid>
		<description><![CDATA[Have you ever had one of those days when you bought a keyboard for no good reason? Well I did the other day, and ended up with an &#8220;Irocks Chocolate Key Style Slim Keyboard for Pc with Elegant Body&#8221;. It felt like a steal &#8212; I got it $12.99 with free two day shipping. It [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sethjust.com/wp-content/uploads/2010/11/1105101317-01.jpg"><img class="size-medium wp-image-190 alignright" title="Keyboard Comparison" src="http://sethjust.com/wp-content/uploads/2010/11/1105101317-01-300x225.jpg" alt="" width="300" height="225" /></a>Have you ever had one of those days when you bought a keyboard for no good reason? Well I did the other day, and ended up with an <a href="http://www.amazon.com/gp/product/B002NR2CJ0?ie=UTF8&amp;tag=dabbler-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=B002NR2CJ0">&#8220;Irocks Chocolate Key Style Slim Keyboard for Pc with Elegant Body&#8221;</a>. It felt like a steal &#8212; I got it $12.99 with free two day shipping.</p>
<p>It is now replacing an older, wireless, but more compact keyboard from the same company, which, despite serving me well, had been getting flaky in age.</p>
<p>Hit the jump for another picture and a review/comparison of the two keyboards</p>
<p><span id="more-187"></span>As I said, this keyboard is replacing my old wireless one, and offers several advantages over it. The first thing I noticed after taking it out of the box was the size: the new one is considerably bigger, allowing it room for a full, proper numpad and, arrow keys, and Home/End/PgUp/PgDn/Ins/Del keys that need a Fn key on the old keyboard.</p>
<p style="text-align: center;">The second major difference is the new key design, which they call &#8220;chocolate key&#8221;. It&#8217;s the same design as Macbook keyboards, with flat keys shaped like rounded rectangles. The combination of a new key design and layout mean that the new keyboard is a lot roomier &#8212; my hands don&#8217;t feel cramped and can move freely.<a href="http://sethjust.com/wp-content/uploads/2010/11/1105101317-03.jpg"><img class="size-medium wp-image-191 aligncenter" title="1105101317-03" src="http://sethjust.com/wp-content/uploads/2010/11/1105101317-03-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>The last thing I noticed quickly after getting the new keyboard set up is the feel of the keys. While the old, wireless keyboard has the mush feel of most laptop keyboards, the new key design has a much crisper feel and a more &#8220;clicky&#8221; feel, even though it still uses scissor-style key switches. While this makes typing slightly louder, it feels much nicer, and makes typing more enjoyable and responsive.</p>
<p>In all, the new keyboard is a welcome update. However, it won&#8217;t completely replace the old one. The biggest reason is the wireless keyboard&#8217;s range: because it will work anywhere within hearing range of the computer, I use it as a remote control for my music player.</p>
<p></p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/NLpITYAXnb8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2010/11/05/new-keyboard-reviewed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2010/11/05/new-keyboard-reviewed/</feedburner:origLink></item>
		<item>
		<title>Sexy Alphabet Image Generator</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/UD4aH5VbJA0/</link>
		<comments>http://sethjust.com/2010/05/31/erotic-alphabet-image-generator/#comments</comments>
		<pubDate>Mon, 31 May 2010 21:58:57 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[alphabet]]></category>
		<category><![CDATA[erotic]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[sex]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=178</guid>
		<description><![CDATA[When my girlfriend came across this erotic alphabet, the first thing she wanted was to be able  to spell out various things with it. Add a pinch of python and php and the result is the Erotic Alphabet Image Generator. The source code of the script used to generate the images is available here.]]></description>
			<content:encoded><![CDATA[<p>When my girlfriend came across <a href="http://sexoteric.com/blog/index.php/__show_article/_a000018-001091.htm">this</a> erotic alphabet, the first thing she wanted was to be able  to spell out various things with it. Add a pinch of python and php and the result is the <a href="http://homepage.sethjust.com/erotic_alphabet/">Erotic Alphabet Image Generator</a>.</p>
<p>The source code of the script used to generate the images is available <a href="http://homepage.sethjust.com/files/erotic_alphabet_image_generator.txt">here</a>.</p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/UD4aH5VbJA0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2010/05/31/erotic-alphabet-image-generator/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2010/05/31/erotic-alphabet-image-generator/</feedburner:origLink></item>
		<item>
		<title>M-Set update</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/H6nofKf4rkA/</link>
		<comments>http://sethjust.com/2010/05/27/m-set-update/#comments</comments>
		<pubDate>Thu, 27 May 2010 17:16:29 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[mandelbrot]]></category>
		<category><![CDATA[program]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=167</guid>
		<description><![CDATA[So, I know that I&#8217;ve been harping on this a bit, but I&#8217;ve re-written my M-Set renderer in C, so it&#8217;s faster, and I&#8217;ve added a few more command line flags to make it easier to use. Get the code here.]]></description>
			<content:encoded><![CDATA[<p><a href="http://homepage.sethjust.com/files/mandel_py.png"></a><a href="http://sethjust.com/wp-content/uploads/2010/05/mandel_py.png"><img class="alignright size-medium wp-image-222" title="mandel_py" src="http://sethjust.com/wp-content/uploads/2010/05/mandel_py-300x229.png" alt="" width="300" height="229" /></a>So, I know that I&#8217;ve been harping on this a bit, but I&#8217;ve re-written my M-Set renderer in C, so it&#8217;s faster, and I&#8217;ve added a few more command line flags to make it easier to use.</p>
<p>Get the code <a href="http://sethjust.com/wp-content/uploads/2010/05/mandel.c">here</a>.</p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/H6nofKf4rkA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2010/05/27/m-set-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2010/05/27/m-set-update/</feedburner:origLink></item>
		<item>
		<title>Update: Migratory Internet Junk</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/QKc47scRuv0/</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> <a href="http://dl.owneriq.net/0/01135fd7-73fa-4351-a685-a9b05408a412.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>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/QKc47scRuv0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2010/05/27/update-migratory-internet-junk/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2010/05/27/update-migratory-internet-junk/</feedburner:origLink></item>
		<item>
		<title>Heads Up: Migratory Internet Junk</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/Mqm_fxXG8ek/</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>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/Mqm_fxXG8ek" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2010/05/03/heads-up-migratory-internet-junk/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2010/05/03/heads-up-migratory-internet-junk/</feedburner:origLink></item>
		<item>
		<title>Clever Stencil</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/WgB8rKenVyQ/</link>
		<comments>http://sethjust.com/2009/12/19/clever-stencil/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 02:02:23 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[art]]></category>
		<category><![CDATA[graffiti]]></category>
		<category><![CDATA[reed]]></category>
		<category><![CDATA[stencil]]></category>
		<category><![CDATA[vodka]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=132</guid>
		<description><![CDATA[I ran into this stencil on the side of a fire extinguisher box at Reed College and thought it was delightful.]]></description>
			<content:encoded><![CDATA[<p><a href="http://sethjust.com/wp-content/uploads/2009/12/1128092037-00-e1261274318100.jpg"><img class="aligncenter size-medium wp-image-131" title="Vodka Extinguisher Graffiti" src="http://sethjust.com/wp-content/uploads/2009/12/1128092037-00-e1261274318100-225x300.jpg" alt="" width="225" height="300" /></a>I ran into this stencil on the side of a fire extinguisher box at Reed College and thought it was delightful.</p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/WgB8rKenVyQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2009/12/19/clever-stencil/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2009/12/19/clever-stencil/</feedburner:origLink></item>
		<item>
		<title>More Mandelbrot</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/0SdEeoKNj_I/</link>
		<comments>http://sethjust.com/2009/12/19/more-mandelbrot/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 00:27:19 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=122</guid>
		<description><![CDATA[I just recently revisited the M-Set code from my Perl Snippets post. The code I had was pretty ugly, so I decided to rewrite it in Python. The result is not only a lot cleaner and easier to understand, but it&#8217;s also a lot faster: $ time python mandel.py &#62; \dev\null real 0m0.051s user 0m0.036s [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sethjust.com/wp-content/uploads/2010/05/mandel_py.png"><img class="alignright size-medium wp-image-222" title="mandel_py" src="http://sethjust.com/wp-content/uploads/2010/05/mandel_py-300x229.png" alt="" width="300" height="229" /></a>I just recently revisited the M-Set code from my <a href="http://sethjust.com/2009/03/24/perl-snippets/">Perl Snippets</a> post. The code I had was pretty ugly, so I decided to rewrite it in Python. The result is not only a lot cleaner and easier to understand, but it&#8217;s also a lot faster:</p>
<pre>$ time python mandel.py &gt; \dev\null
real	0m0.051s
user	0m0.036s
sys	0m0.010s
$ time perl mandel.pl &gt; \dev\null
real	0m3.518s
user	0m3.463s
sys	0m0.029s</pre>
<p>You can find the code <a href="http://homepage.sethjust.com/files/mandel.txt">here</a>.</p>
<p>This script works well for zooms, as long as you stay below a few thousand iterations. The following picture was generated with x=-1.1887204, y=-0.3032472, width=0.01 and 150 iterations.</p>
<p style="text-align: center;"><a href="http://sethjust.com/wp-content/uploads/2009/12/mandel_py_zoom.png"><img class="size-medium wp-image-224 aligncenter" title="mandel_py_zoom" src="http://sethjust.com/wp-content/uploads/2009/12/mandel_py_zoom-300x229.png" alt="" width="300" height="229" /></a></p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/0SdEeoKNj_I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2009/12/19/more-mandelbrot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2009/12/19/more-mandelbrot/</feedburner:origLink></item>
		<item>
		<title>Conky Calendar with Date Highlight</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/DYkvfPa4P3Q/</link>
		<comments>http://sethjust.com/2009/08/03/a-useful-calendar-in-conky/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 03:34:09 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[cal]]></category>
		<category><![CDATA[calendar]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[conky]]></category>
		<category><![CDATA[desktop]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://sethjust.com/?p=114</guid>
		<description><![CDATA[Since I got a new desktop a month or so ago, I&#8217;ve been running Ubuntu as my main operating system, and am using Conky for a nice heads-up-display. There are a lot of articles on the web about both Ubuntu and Conky, but one thing I couldn&#8217;t find a good, accurate how-to on was getting [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">Since I got a new desktop a month or so ago, I&#8217;ve been running <a href="http://www.ubuntu.com">Ubuntu</a> as my main operating system, and am using <a href="http://conky.sourceforge.net/">Conky</a> for a nice heads-up-display. There are a lot of articles on the web about both Ubuntu and Conky, but one thing I couldn&#8217;t find a good, accurate how-to on was getting a calendar that highlighted the current date. While getting the calendar is easy using the cal command, actually getting the date highlighted is somewhat hard, and all of the articles I found suggested methods that broke in various situations. However, I managed to get it all worked out, and have a beautiful calendar that looks like this:</p>
<p style="text-align: center;"><a href="http://sethjust.com/wp-content/uploads/2009/08/conky_cal.png"><img class="size-full wp-image-230 aligncenter" title="conky_cal" src="http://sethjust.com/wp-content/uploads/2009/08/conky_cal.png" alt="" width="129" height="120" /></a></p>
<p style="text-align: left;">After the jump, I&#8217;ll give you the code and explain how it all works.<span id="more-114"></span></p>
<h2 style="text-align: left;">How it Works:</h2>
<p style="text-align: left;">The code from ~/.conkyrc that makes this calendar is simple:</p>
<p style="text-align: left;">Edit: I&#8217;ve updated the code as Zacco suggested in the comments to fix a minor bug on certain dates.</p>
<pre style="text-align: left;">${color orange}CALENDAR ${hr 2}$color
${execpi 60 DJS=`date +%_d`; cal | sed s/"\(^\|[^0-9]\)$DJS"'\b'/'\1${color orange}'"$DJS"'$color'/}}</pre>
<p>This is a somewhat complicated expression, but what it does is fairly simple. The first line simply draws the title for the section, and it&#8217;s the second line that does the magic. Let me break it down and explain it.</p>
<pre style="text-align: left;">${execpi 60</pre>
<p>This command tells Conky to execute the next argument every 60 seconds, and, importantly, parse the output of that argument. This way, when we put in commands that change the text color, Conky will obey them instead of printing them.</p>
<pre style="text-align: left;">DJS=`date +%_d`;</pre>
<p>DJS (which stands for &#8220;date&#8221; followed by my initials) is a temporary variable that holds the current day of the month, padded with a leading space, if necessary (so that we&#8217;ll catch the first of the month, not every 1 in the calendar, for example).</p>
<pre style="text-align: left;">cal |</pre>
<p>cal simply prints out a simple calendar, and the pipe feeds that output through to the next commmand:</p>
<pre style="text-align: left;">
<pre>sed s/"\([^0-9]\)$DJS"'\b'/'${color orange}'"$DJS"'$color'/</pre>
<p>This is one big mess of a command, but the main body is a <a href="http://en.wikipedia.org/wiki/Regex">regex</a> that sed takes as an argument. The regex searches for the string &#8220;\([^0-9]\)$DJS&#8221;&#8216;\b&#8217;, which means the contents of the variable DJS (which we set earlier) preceded by anything other than a digit, and followed by a word boundary &#8211; a change from printable characters to white space. This means that it will find the current date (one or two digits) but won&#8217;t find the 3 of the 30th on the third of the month. It also means that it will work correctly if the current date is on the far left or right column of the calendar.</p>
<p>The second half of the regex simply wraps what it found the first time around in a couple of Conky commands that change to color to orange, and then back to what it was before.</p>
<p>Lastly, the closing bracket (}) at the end of the line closes out the opening one that is required for all Conky commands with arguments.</p>
<p>Now go forth and cover your desktop in beautiful calendars.</p>
<p><strong>Update: </strong>Erik in the comments has a modification to center the entire calendar, if left-aligning isn&#8217;t for you.</p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/DYkvfPa4P3Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2009/08/03/a-useful-calendar-in-conky/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2009/08/03/a-useful-calendar-in-conky/</feedburner:origLink></item>
		<item>
		<title>iWork Autosave</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/oBtcdrCQUWU/</link>
		<comments>http://sethjust.com/2009/03/29/iwork-autosave/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 02:10:31 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[autosave]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[iwork]]></category>
		<category><![CDATA[pages]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[school]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://sethjust.wordpress.com/?p=74</guid>
		<description><![CDATA[So I had the wonderful experience this weekend of losing over 1,200 words of work on a paper because I forgot to save it regularly. I was really, really sad about that and really bummed that Pages, my word processor of choice (I love the formatting tools), doesn&#8217;t support either autosaving or document recovery. However, [...]]]></description>
			<content:encoded><![CDATA[<p>So I had the wonderful experience this weekend of losing over 1,200 words of work on a paper because I forgot to save it regularly. I was really, really sad about that and really bummed that <a href="http://www.apple.com/iwork/pages/">Pages</a>, my word processor of choice (I love the formatting tools), doesn&#8217;t support either autosaving or document recovery. However, my preference for Pages is strong enough that I didn&#8217;t jump ship to an auto-saving editor. Instead I went out and found <a href="http://tristanchadwick.com/worksaver/" class="broken_link">WorkSaver</a>. <img class="alignright size-full wp-image-78" style="float:right;" title="WorkSaver" src="http://sethjust.files.wordpress.com/2009/03/picture-3.png" alt="WorkSaver" width="265" height="212" /><br />
Worksaver simply sits in your menubar and, at a definable interval will save every iWork document you have open, provided that it&#8217;s already been saved once. This means that when I&#8217;m writing I don&#8217;t have to even worry about saving my document after creating it and choosing where to save it. Of course, it&#8217;s a shame that you have to manually save the file when you create it, but it&#8217;s a lot better than losing all your work. I can highly recommend <a href="http://tristanchadwick.com/worksaver/" class="broken_link">WorkSaver</a> if you use iWork simply for the peace of mind it provides. Of course, it&#8217;s not perfect for everybody, but when I&#8217;d rather focus on writing a paper than on making sure my computer doesn&#8217;t decide to make it all go away, <a href="http://tristanchadwick.com/worksaver/" class="broken_link">WorkSaver</a> is just what I need.</p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/oBtcdrCQUWU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2009/03/29/iwork-autosave/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2009/03/29/iwork-autosave/</feedburner:origLink></item>
		<item>
		<title>Perl Snippets</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/MzC0rtqXaEY/</link>
		<comments>http://sethjust.com/2009/03/24/perl-snippets/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 02:39:05 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[japh]]></category>
		<category><![CDATA[m-set]]></category>
		<category><![CDATA[mandlebrot]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[obfuscation]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://sethjust.wordpress.com/?p=65</guid>
		<description><![CDATA[I&#8217;ve been getting into a mood lately that makes me fiddle around with fun Perl stuff, but sadly school&#8217;s picking up to the point that writing anything up isn&#8217;t going to happen. However, I have a couple short scripts that I&#8217;m just dying to share. Just Another Perl Hacker I figured that it was about [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been getting into a mood lately that makes me fiddle around with fun Perl stuff, but sadly school&#8217;s picking up to the point that writing anything up isn&#8217;t going to happen. However, I have a couple short scripts that I&#8217;m just dying to share.</p>
<h2>Just Another Perl Hacker</h2>
<p>I figured that it was about time in my hacking career (read: I was bored enough) that I should make a <a href="http://en.wikipedia.org/wiki/Just_another_Perl_hacker">japh script</a>. After a couple attempts I came up with this:</p>

<div class="wp_codebox"><table><tr id="p6518"><td class="code" id="p65code18"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span>
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #009999;">&lt;DATA&gt;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
 	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><a href="http://perldoc.perl.org/functions/map.html"><span style="color: #000066;">map</span></a><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/ord.html"><span style="color: #000066;">ord</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$_</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">33</span><span style="color: #009900;">&#125;</span><a href="http://perldoc.perl.org/functions/split.html"><span style="color: #000066;">split</span></a> <span style="color: #ff0000;">''</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: #0000ff;">$_</span><span style="color: #339933;">||</span><span style="color: #009900;">&#40;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a><span style="color: #009900;">&#40;</span><a href="http://perldoc.perl.org/functions/chr.html"><span style="color: #000066;">chr</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$__</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">19</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;&amp;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$__</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">__END__</span>
                   <span style="color: #339933;">/|</span>                        <span style="color: #339933;">|</span>\
      <span style="color: #339933;">!</span>            <span style="color: #339933;">;</span> <span style="color: #339933;">:</span>                        <span style="color: #339933;">:</span> <span style="color: #339933;">:</span>
                  <span style="color: #339933;">|</span> Y<span style="color: #339933;">,</span>                      <span style="color: #339933;">,</span>P <span style="color: #339933;">|</span>
     <span style="color: #339933;">!</span>             <span style="color: #339933;">|</span>  Yb<span style="color: #339933;">.</span>        __        <span style="color: #339933;">,</span>dP  <span style="color: #339933;">|</span>
                  l\  YMMb<span style="color: #339933;">,</span>_ _<span style="color: #339933;">,/</span>  \<span style="color: #339933;">,</span>_ _<span style="color: #339933;">,</span>dMMP  <span style="color: #339933;">/</span>f
  <span style="color: #339933;">!</span>                 j<span style="color: #339933;">;</span>  <span style="color: #ff0000;">`YMMP'  `</span><span style="color: #339933;">--</span><span style="color: #ff0000;">'  `YMMP'</span>  <span style="color: #339933;">;</span>j
                   <span style="color: #339933;">:</span> \   YP<span style="color: #ff0000;">`-._    _.-'YP   / ;
  !            !      <span style="color: #000099; font-weight: bold;">\ </span>`</span>\<span style="color: #339933;">,</span>  _<span style="color: #339933;">,</span><span style="color: #0000ff;">\_</span>    _<span style="color: #339933;">/,</span>_  <span style="color: #339933;">,/</span><span style="color: #ff0000;">' /
                     `,_,   \`o&gt;  &lt;o'</span><span style="color: #339933;">/</span>   <span style="color: #339933;">,</span>_<span style="color: #339933;">,!</span><span style="color: #ff0000;">'
                         `\            /'</span>
                           <span style="color: #339933;">|</span>  _    _  <span style="color: #339933;">|</span>
      <span style="color: #339933;">!</span>                     <span style="color: #339933;">/</span> 88b  d88 \
                           \ <span style="color: #ff0000;">`8P  Y8' /`</span><span style="color: #ff0000;">`-.
             !               `</span>\<span style="color: #339933;">,</span>    <span style="color: #339933;">,/</span>      \
                             _<span style="color: #ff0000;">`----'        <span style="color: #000099; font-weight: bold;">\</span>
                  !        _.'/ '          `</span><span style="color: #339933;">,</span> \
                        <span style="color: #339933;">.</span><span style="color: #ff0000;">'_,'</span>_<span style="color: #339933;">...</span>_          \ <span style="color: #339933;">;</span>
       <span style="color: #339933;">!</span>               <span style="color: #339933;">.</span><span style="color: #ff0000;">',/.dMMMMMMb. |      /  \
                    .'</span><span style="color: #339933;">./.</span>MMMMMMMMMMM <span style="color: #339933;">;</span> <span style="color: #339933;">!</span>    <span style="color: #339933;">/</span>    <span style="color: #339933;">;</span>
                   <span style="color: #009966; font-style: italic;">/ /</span><span style="color: #339933;">.</span>MMMMMMMMMMMMM<span style="color: #339933;">/</span>     <span style="color: #339933;">/</span>     <span style="color: #339933;">;</span>
                  <span style="color: #339933;">|</span> <span style="color: #339933;">;</span>dMMMMMMMMMMM<span style="color: #339933;">!</span>P<span style="color: #339933;">/</span><span style="color: #ff0000;">'   ,/'</span>   <span style="color: #339933;">!</span>    <span style="color: #339933;">;</span>
                  <span style="color: #339933;">|/</span>dMMMMMMMMMP<span style="color: #ff0000;">'     .'</span>          <span style="color: #339933;">|</span>
   <span style="color: #339933;">!</span>               <span style="color: #339933;">;</span>dMMMMMMMMM<span style="color: #339933;">|</span>     _<span style="color: #339933;">/</span>            <span style="color: #339933;">|</span>
                 <span style="color: #339933;">;</span>dMMMMMMMMMMb_<span style="color: #339933;">|</span>_<span style="color: #339933;">!|</span> <span style="color: #339933;">/;</span>            <span style="color: #339933;">;</span>\<span style="color: #339933;">,</span>
                 dMMMMMMMMMMMM<span style="color: #ff0000;">`M`</span>M<span style="color: #ff0000;">`;.---..      '   `</span>\<span style="color: #339933;">,</span>
                <span style="color: #339933;">:</span>M<span style="color: #339933;">!</span>MMMMMMMMMMMMMMMP<span style="color: #339933;">/</span><span style="color: #ff0000;">'     `\            \
               /|MMMMMMMMMMMMMMP/          \    _!_      `.
  !            / |MMMMMMMMMMMMMM|            |.-'</span>  <span style="color: #ff0000;">`-._    <span style="color: #000099; font-weight: bold;">\ </span>        .'<span style="color: #000099; font-weight: bold;">\</span>
             ;!  ;MMMMMMMMMMMMMM|            :         `</span><span style="color: #339933;">-.</span>_ <span style="color: #ff0000;">`-.     /  _<span style="color: #000099; font-weight: bold;">\</span>
             |   ;!MMMMMMMMMMMMM;            |             `</span><span style="color: #339933;">-.</span> <span style="color: #ff0000;">`-.._.'/
              <span style="color: #000099; font-weight: bold;">\ </span>  `</span><span style="color: #0000ff;">\YMMMMM</span><span style="color: #339933;">!</span>MMMP<span style="color: #339933;">/</span><span style="color: #ff0000;">'\           |                `~~----'</span>
               <span style="color: #ff0000;">`-._, `</span><span style="color: #ff0000;">`YMMMP'_.-'<span style="color: #000099; font-weight: bold;">\ </span>        ! ;_
                 |      /         `</span><span style="color: #339933;">-.,</span>_<span style="color: #339933;">./</span>     <span style="color: #cc66cc;">7</span>
                _<span style="color: #339933;">/</span>    <span style="color: #ff0000;">`<span style="color: #000099; font-weight: bold;">\,</span>    !        /      _/
             ,-' ,  ,   /         _.'      /
            (_(_(__(__.'       !,-'        /
                              (__(__(_(_/'</span></pre></td></tr></table></div>

<p><a href="http://people.reed.edu/~justs/japh.pl" class="broken_link">Download</a>.</p>
<p>I&#8217;ll let you go ahead and figure it out on your own. It&#8217;s not super-hard, but it&#8217;s fun.</p>
<h2>Mandelbrot</h2>
<p>In another fit of boredom I decided that it was finally time to create a mandelbrot set renderer. I originally tried to make one of these in basic, long before I had the math to do so. I was proud that I got the real axis to render, and figured it was time to complexify it. To keep things simple I decided to make it render an ASCII-art version of the set that would fit in a terminal window. The output looks like this:</p>
<pre>                        ...............................:::::oo@@@@o::::..........
                      ...............................::::::O@@@@@@@@o:::::.......
                     .............................::::::::oO@@@@@@@@o::::::::....
                   ...........................::::OOO8ooO@O88@@@@@@8@O8o::::Oo:..
                  .......................:::::::::o8@@@@@@@@@@@@@@@@@@@@OO@@@@::.
                 ...................:::::::::::::oOO@@@@@@@@@@@@@@@@@@@@@@@@@o:::
                ................:::::::::::::::o@@@@@@@@@@@@@@@@@@@@@@@@@@@@Oo:::
               ..............::::@oo::oOoo:::ooo@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@8o:
               ...........:::::::oO@@@O@@8@OooO8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O::
              ..........:::::::::oO@@@@@@@@@@88@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@::
              ........:::::::8ooO8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@o::
              .:::::::::::::oO@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@o:::
              @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Oo::::
              .:::::::::::::oO@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@o:::
              ........:::::::8ooO8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@o::
              ..........:::::::::oO@@@@@@@@@@88@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@::
               ...........:::::::oO@@@O@@8@OooO8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O::
               ..............::::@oo::oOoo:::ooo@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@8o:
                ................:::::::::::::::o@@@@@@@@@@@@@@@@@@@@@@@@@@@@Oo:::
                 ...................:::::::::::::oOO@@@@@@@@@@@@@@@@@@@@@@@@@o:::
                  .......................:::::::::o8@@@@@@@@@@@@@@@@@@@@OO@@@@::.
                   ...........................::::OOO8ooO@O88@@@@@@8@O8o::::Oo:..
                     .............................::::::::oO@@@@@@@@o::::::::....
                      ...............................::::::O@@@@@@@@o:::::.......
                        ...............................:::::oo@@@@o::::..........</pre>
<p>The code&#8217;s far from polished and not what I like to publish, but it&#8217;s a fun thing to look at and offers you some neat abilities to poke things around and fix some pesky problems that just need clear thinking applied to them. It&#8217;s available <a href="http://people.reed.edu/~justs/mandel.pl" class="broken_link">here</a>.</p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/MzC0rtqXaEY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2009/03/24/perl-snippets/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2009/03/24/perl-snippets/</feedburner:origLink></item>
		<item>
		<title>Make a Money/Card Clip</title>
		<link>http://feedproxy.google.com/~r/sjdabbler/~3/2M98bAU0poU/</link>
		<comments>http://sethjust.com/2009/03/11/make-a-moneycard-clip/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 03:44:45 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[card clip]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[fork]]></category>
		<category><![CDATA[make]]></category>
		<category><![CDATA[money clip]]></category>
		<category><![CDATA[wallet]]></category>

		<guid isPermaLink="false">http://sethjust.wordpress.com/?p=57</guid>
		<description><![CDATA[So the other day I finally got tired with my (awesome) wallet and decided to make something new. I ended up choosing a money clip. Not only would it be a nice, high quality, metal object living in my pocket, instead of a crummy, dirty wallet, but a money clip is good looking, classy and [...]]]></description>
			<content:encoded><![CDATA[<p>So the other day I finally got tired with my (awesome) <a href="http://www.instructables.com/id/Paper-Wallet/">wallet</a> and decided to make something new. I ended up choosing a <a href="http://en.wikipedia.org/wiki/Money_clip">money clip</a>. Not only would it be a nice, high quality, metal object living in my pocket, instead of a crummy, dirty wallet, but a money clip is good looking, classy and minimalistic way of keeping a hold of my money and cards. Looking around my room I didn&#8217;t really get any inspiration, until I saw an old metal fork lying in a box. I cut the head off with my dremel and a fiberglass cutting wheel. A little bit of sanding and bending resulted in a, super-useful money clip. I&#8217;ve been using it for the past few days and it&#8217;s been serving me really well, looking good, and altogether holding up like a quality product.</p>

<a href='http://sethjust.com/2009/03/11/make-a-moneycard-clip/photo-28/' title='Money Clip Profile 2'><img width="150" height="150" src="http://sethjust.com/wp-content/uploads/2009/03/photo-28-150x150.jpg" class="attachment-thumbnail" alt="Money Clip Profile 2" title="Money Clip Profile 2" /></a>
<a href='http://sethjust.com/2009/03/11/make-a-moneycard-clip/photo-27/' title='Money Clip Profile 1'><img width="150" height="150" src="http://sethjust.com/wp-content/uploads/2009/03/photo-27-150x150.jpg" class="attachment-thumbnail" alt="Money Clip Profile 1" title="Money Clip Profile 1" /></a>
<a href='http://sethjust.com/2009/03/11/make-a-moneycard-clip/photo-26/' title='Money Clip Front'><img width="150" height="150" src="http://sethjust.com/wp-content/uploads/2009/03/photo-26-150x150.jpg" class="attachment-thumbnail" alt="Money Clip Front" title="Money Clip Front" /></a>
<a href='http://sethjust.com/2009/03/11/make-a-moneycard-clip/photo-25/' title='Money Clip Back'><img width="150" height="150" src="http://sethjust.com/wp-content/uploads/2009/03/photo-25-150x150.jpg" class="attachment-thumbnail" alt="Money Clip Back" title="Money Clip Back" /></a>

<p>If there&#8217;s interest, I&#8217;ll put up more information / pictures and maybe put some of these bad boys up for sale.</p>
<img src="http://feeds.feedburner.com/~r/sjdabbler/~4/2M98bAU0poU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2009/03/11/make-a-moneycard-clip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	<feedburner:origLink>http://sethjust.com/2009/03/11/make-a-moneycard-clip/</feedburner:origLink></item>
	</channel>
</rss>
