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

<channel>
	<title>Jay Paroline - Grooveshark Dev &#187; fun</title>
	<atom:link href="http://wanderr.com/jay/category/fun/feed/" rel="self" type="application/rss+xml" />
	<link>http://wanderr.com/jay</link>
	<description>Rantings of a Grooveshark Developer</description>
	<lastBuildDate>Thu, 26 Jan 2012 20:07:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Controlling Arduino via Serial USB + PHP</title>
		<link>http://wanderr.com/jay/controlling-arduino-via-serial-usb-php/2010/12/28/</link>
		<comments>http://wanderr.com/jay/controlling-arduino-via-serial-usb-php/2010/12/28/#comments</comments>
		<pubDate>Tue, 28 Dec 2010 12:01:54 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[fun]]></category>

		<guid isPermaLink="false">http://wanderr.com/jay/?p=446</guid>
		<description><![CDATA[Paloma bought me an Arduino for Christmas, and I&#8217;ve been having lots of fun with it, first following some tutorials to get familiar with the platform but of course the real excitement for me is being able to control it from my computer, so I&#8217;ve started playing around with serial communication over the USB port. [...]]]></description>
			<content:encoded><![CDATA[<p>Paloma bought me an <a href="http://www.arduino.cc/">Arduino</a> for Christmas, and I&#8217;ve been having lots of fun with it, first following some tutorials to get familiar with the platform but of course the real excitement for me is being able to control it from my computer, so I&#8217;ve started playing around with serial communication over the USB port.</p>
<p>I messed around with <a href="http://processing.org/">Processing</a> a bit, and while Processing seems pretty cool and pretty powerful for drawing and making a quick interface, I want to be able to get up and running fast communicating with all of our existing systems, so I thought PHP would be ideal.</p>
<p>I&#8217;ve never used PHP to communicate over a serial port before, so I did some digging and actually came across an example of <a href="http://www.arduinoprojects.com/node/10">using PHP to communicate with an Arduino</a>, but it wasn&#8217;t working properly for me. My LED was blinking twice every time, and if I changed it to a value comparison (i.e. sending 1 in PHP and checking for 1 on Arduino) it was never matching. Turns out for some reason by default the com port wasn&#8217;t running in the right mode from PHP. The solution is a simple additional line:</p>
<p><code>exec("mode com3: BAUD=9600 PARITY=N data=8 stop=1 xon=off");<br />
</code></p>
<p>&#8230;but make sure you adjust to match the settings appropriate for your computer.</p>
<p>Of course I had to write my own little demo once I got it working. This PHP script takes command line arguments and passes them along to the arduino, which looks for ones and zeroes to turn the LEDs off or on. Unlike the example I linked to, I&#8217;m working with a shift register to drive 8 LEDs, but you&#8217;ll get the idea, and it should be obvious how to convert it to work with a single LED.</p>
<p><code>
<pre>&lt;?php
ini_set('display_errors', 'On');
exec("mode com3: BAUD=9600 PARITY=N data=8 stop=1 xon=off");
$fp = fopen("COM3", "w");

 foreach ($argv as $i => $arg) {
    if ($i > 0) {//skip the first arg since it's the name of the file
        print "writing " . $arg . "\n";
        $arg = chr($arg);//fwrite takes a string, so convert
        fwrite($fp, $arg);
        sleep(1);
    }
 }
print "closing\n";
fclose($fp);
?></pre>
<p></code></p>
<p>And for the Arduino:</p>
<p><code>
<pre>
//Pin connected to latch pin (ST_CP) of 74HC595
const int latchPin = 4;
const int clockPin = 3;
const int dataPin = 2;
void setup() {
    pinMode(latchPin, OUTPUT);
    pinMode(dataPin, OUTPUT);
    pinMode(clockPin, OUTPUT);
    Serial.begin(9600);
    //reset LEDs to all off
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, B00000000);
    digitalWrite(latchPin, HIGH);
}

void loop() {
    byte val = B11111111;
    if (Serial.available() > 0) {
        byte x = Serial.read();
        if (x == 1) {
            val = B11111111;
        } else {
            val = B00000000;
        }

        digitalWrite(latchPin, LOW);
        shiftOut(dataPin, clockPin, MSBFIRST, val);
        digitalWrite(latchPin, HIGH);
        delay(500);
    }
}
</pre>
<p></code></p>
<p>For bonus debugging points, if you&#8217;re using a shift register like this, send x instead of val to shiftOut, and you can actually see which bytes are being sent, very handy if you&#8217;re not getting what you are expecting (like I was)!</p>
]]></content:encoded>
			<wfw:commentRss>http://wanderr.com/jay/controlling-arduino-via-serial-usb-php/2010/12/28/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Obama Scary</title>
		<link>http://wanderr.com/jay/obama-scary/2009/08/12/</link>
		<comments>http://wanderr.com/jay/obama-scary/2009/08/12/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 11:09:03 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[fun]]></category>

		<guid isPermaLink="false">http://wanderr.com/jay/?p=200</guid>
		<description><![CDATA[I hope I&#8217;m not the only one who finds this incredibly amusing. I made this clip: From this clip: The Daily Show With Jon Stewart Mon &#8211; Thurs 11p / 10c]]></description>
			<content:encoded><![CDATA[<p>I hope I&#8217;m not the only one who finds this incredibly amusing. I made this clip:</p>
<p><object width="250" height="40"><param name="movie" value="http://listen.grooveshark.com/songWidget.swf"></param><param name="wmode" value="window"></param><param name="allowScriptAccess" value="always"></param><param name="flashvars" value="hostname=cowbell.grooveshark.com&#038;widgetID=13691252&#038;style=metal&#038;p=0"></param> <embed src="http://listen.grooveshark.com/songWidget.swf" type="application/x-shockwave-flash" width="250" height="40" flashvars="hostname=cowbell.grooveshark.com&#038;widgetID=13691252&#038;style=metal&#038;p=0" allowScriptAccess="always" wmode="window"></embed></object></p>
<p>From this clip:</p>
<table style='font:11px arial; color:#333; background-color:#f5f5f5' cellpadding='0' cellspacing='0' width='360' height='353'>
<tbody>
<tr style='background-color:#e5e5e5' valign='middle'>
<td style='padding:2px 1px 0px 5px;'><a target='_blank' style='color:#333; text-decoration:none; font-weight:bold;' href='http://www.thedailyshow.com'>The Daily Show With Jon Stewart</a></td>
<td style='padding:2px 5px 0px 5px; text-align:right; font-weight:bold;'>Mon &#8211; Thurs 11p / 10c</td>
</tr>
<tr style='height:14px;' valign='middle'>
<td style='padding:2px 1px 0px 5px;' colspan='2'<a target='_blank' style='color:#333; text-decoration:none; font-weight:bold;' href='http://www.thedailyshow.com/watch/mon-august-10-2009/healther-skelter'>Healther Skelter<a></a></td>
</tr>
<tr style='height:14px; background-color:#353535' valign='middle'>
<td colspan='2' style='padding:2px 5px 0px 5px; width:360px; overflow:hidden; text-align:right'><a target='_blank' style='color:#96deff; text-decoration:none; font-weight:bold;' href='http://www.thedailyshow.com/'>www.thedailyshow.com</a></td>
</tr>
<tr valign='middle'>
<td style='padding:0px;' colspan='2'><embed style='display:block' src='http://media.mtvnservices.com/mgid:cms:item:comedycentral.com:240655' width='360' height='301' type='application/x-shockwave-flash' wmode='window' allowFullscreen='true' flashvars='autoPlay=false' allowscriptaccess='always' allownetworking='all' bgcolor='#000000'></embed></td>
</tr>
<tr style='height:18px;' valign='middle'>
<td style='padding:0px;' colspan='2'>
<table style='margin:0px; text-align:center' cellpadding='0' cellspacing='0' width='100%' height='100%'>
<tr valign='middle'>
<td style='padding:3px; width:33%;'><a target='_blank' style='font:10px arial; color:#333; text-decoration:none;' href='http://www.thedailyshow.com/full-episodes'>Daily Show<br /> Full Episodes</a></td>
<td style='padding:3px; width:33%;'><a target='_blank' style='font:10px arial; color:#333; text-decoration:none;' href='http://www.indecisionforever.com'>Political Humor</a></td>
<td style='padding:3px; width:33%;'><a target='_blank' style='font:10px arial; color:#333; text-decoration:none;' href='http://www.thedailyshow.com/watch/tue-july-28-2009/spinal-tap-extended-performance'>Spinal Tap Performance</a></td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://wanderr.com/jay/obama-scary/2009/08/12/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What&#8217;s been keeping me busy</title>
		<link>http://wanderr.com/jay/whats-been-keeping-me-busy/2008/04/14/</link>
		<comments>http://wanderr.com/jay/whats-been-keeping-me-busy/2008/04/14/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 07:12:19 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[fun]]></category>
		<category><![CDATA[grooveshark]]></category>

		<guid isPermaLink="false">http://wanderr.com/jay/?p=65</guid>
		<description><![CDATA[Katy and I have been hard at work this past month on a top-secret project, code-named tambourine. It will be known to the public as Grooveshark Lite. We&#8217;re nearing the end and we&#8217;ve been given permission to leak a tiny little bit. There&#8217;s other big news coming down the pipe very soon, but this is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://thingsthatwork.net/">Katy</a> and I have been hard at work this past month on a top-secret project, code-named tambourine. It will be known to the public as Grooveshark Lite.</p>
<p>We&#8217;re nearing the end and we&#8217;ve been given permission to leak a tiny little bit. There&#8217;s other big news coming down the pipe very soon, but this is pretty big to us too. Teaser screenshots:</p>
<p>Grooveshark Lite:<br />
<img src="http://wanderr.com/jay/wp-content/uploads/2008/04/gslite.png" style="float:none"/></p>
<p>Search:<br />
<img src="http://wanderr.com/jay/wp-content/uploads/2008/04/gslite-search.png" style="float:none"/></p>
<p>Listen to any song cached on Grooveshark:<br />
<img src="http://wanderr.com/jay/wp-content/uploads/2008/04/gslite-player.png" style="float:none"/></p>
<p>Unlike the current Grooveshark website, Grooveshark Lite doesn&#8217;t require the sharkbyte client, and doesn&#8217;t require a user account to listen, search or browse.</p>
]]></content:encoded>
			<wfw:commentRss>http://wanderr.com/jay/whats-been-keeping-me-busy/2008/04/14/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Fun office pranks</title>
		<link>http://wanderr.com/jay/fun-office-pranks/2008/02/08/</link>
		<comments>http://wanderr.com/jay/fun-office-pranks/2008/02/08/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 13:31:23 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[fun]]></category>

		<guid isPermaLink="false">http://wanderr.com/jay/fun-office-pranks/2008/02/08/</guid>
		<description><![CDATA[One of our co-workers recently managed to leave his computer unlocked when he left work for the day. Time for hilarious pranks! The standard &#8220;punishment&#8221; for leaving ones computer unlocked is to modify their system settings, often times setting their background to something humorous or embarrassing. Katy wrote up a long blog post explaining in [...]]]></description>
			<content:encoded><![CDATA[<p>One of our co-workers recently managed to leave his computer unlocked when he left work for the day. Time for hilarious pranks!</p>
<p>The standard &#8220;punishment&#8221; for leaving ones computer unlocked is to modify their system settings, often times setting their background to something humorous or embarrassing.</p>
<p>Katy wrote up a long blog post explaining in detail <a href="http://thingsthatwork.net/index.php/2008/02/07/fun-with-os-x-defaults-and-launchd/">how to hijack the background of an unlocked mac</a>, inspired by a prank we pulled on a co-worker who made just such a mistake. In summary we set his background wallpaper to get set every couple of minutes, also causing his dock to restart, very closely mimicking the symptoms of a virus&#8230;but on a mac. I don&#8217;t have any Mac-fu, but I was able to use my linux-fu to make the prank even more devious.</p>
<p><code>touch -f sourcefile destinationfile</code><br />
copies the timestamp from one file to another. If you put your prank image in a directory with a bunch of other files, you can help your file blend in by giving it a timestamp that&#8217;s the same as another file.</p>
<p>The other trick is to move the file into a folder whose name starts with a . so it is harder to find. While you&#8217;re at it, might as well name the file with a starting with a . also.</p>
<p>We stashed the trouble files in his .keepass folder and named them things like .specialkey.</p>
<p>finally, <code>history -c</code> clears out your terminal history so that nobody can see what you have been up to.</p>
<p>Sadly, Katy felt guilty about being so mischievous and left instructions on how to &#8216;fix&#8217; it, so he never got to appreciate the extra detail we went through to make it tricky to find and fix.</p>
<p>But you can bet he locks his computer now, <em>and</em> he learned how to make his Mac show hidden files.</p>
]]></content:encoded>
			<wfw:commentRss>http://wanderr.com/jay/fun-office-pranks/2008/02/08/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BooStringlean</title>
		<link>http://wanderr.com/jay/oops/2008/01/27/</link>
		<comments>http://wanderr.com/jay/oops/2008/01/27/#comments</comments>
		<pubDate>Sun, 27 Jan 2008 08:42:24 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[fun]]></category>

		<guid isPermaLink="false">http://wanderr.com/jay/oops/2008/01/27/</guid>
		<description><![CDATA[What happens when your UI doesn&#8217;t behave the way you expect it to? Yesterday, Katy managed to create a new type: BooStringlean. Oddly, her IDE did not complain that it had never heard of a BooStringlean; it was her auto-documenter that complained.]]></description>
			<content:encoded><![CDATA[<p>What happens when your UI doesn&#8217;t behave the way you expect it to?<br />
Yesterday, <a href="http://krichard.tumblr.com/">Katy</a> managed to create a new type: <a href="http://krichard.tumblr.com/post/24694013">BooStringlean</a>.</p>
<p>Oddly, her IDE did not complain that it had never heard of a BooStringlean; it was her auto-documenter that complained.</p>
]]></content:encoded>
			<wfw:commentRss>http://wanderr.com/jay/oops/2008/01/27/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: basic (User agent is rejected)

Served from: wanderr.com @ 2012-05-18 17:48:55 -->
