<?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>SQUARISM &#187; Development</title>
	<atom:link href="http://squarism.com/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://squarism.com</link>
	<description>addicted to pixels</description>
	<lastBuildDate>Tue, 20 Jul 2010 15:12:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Fixing IRB autocompletion on OSX</title>
		<link>http://squarism.com/2010/07/10/fixing-irb-autocompletion-on-osx/</link>
		<comments>http://squarism.com/2010/07/10/fixing-irb-autocompletion-on-osx/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 16:25:44 +0000</pubDate>
		<dc:creator>Dillon</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://squarism.com/?p=583</guid>
		<description><![CDATA[Using macports version of ruby (and irb), I noticed that the lovely and wonderful tab autocompletion wasn't working: $ irb --simple-prompt >> "foo".cap (The tab key! It does nothing!) So you can see that I was hitting tab expecting to see .cap resolve to .capitalize but it did nothing. I'm not quite sure if this [...]]]></description>
			<content:encoded><![CDATA[<p>Using macports version of ruby (and irb), I noticed that the lovely and wonderful tab autocompletion wasn't working:<br />
<code><br />
$ irb --simple-prompt<br />
>> "foo".cap  (The tab key!  It does nothing!)<br />
</code></p>
<p>So you can see that I was hitting tab expecting to see .cap resolve to .capitalize but it did nothing.  I'm not quite sure if this has been broken for a long time or forever.  On Linux, irb seems to just work.  So I found a fix out on the 'tubes.</p>
<p><code>sudo gem install bond<br />
$ cat ~/.irbrc<br />
require 'rubygems';<br />
require 'bond';<br />
Bond.start</code></p>
<p>And now the tab is delicious.</p>
<p><code>>> "foo".cap   [tab]<br />
>> "foo.capitalize<br />
=> "Foo"</code></p>
<p>Now while you're at it, might as well get the color going with wirble:<br />
<code>sudo gem install wirble</code><br />
Add some more lines to .irbrc.  Now our .irbrc looks like this:<br />
<code>$ cat ~/.irbrc<br />
require 'rubygems'<br />
require 'wirble'<br />
require 'bond'<br />
Wirble.init<br />
Wirble.colorize<br />
Bond.start</code></p>
<p><img src="http://squarism.com/wp-content/uploads/2010/07/wirble_bond.png" alt="" title="wirble_bond" width="141" height="26" class="alignright size-full wp-image-587" />Irb will have color and [tab] now which you can see in the screenshot right there.  The colors can be customized in wirble but it seems to be limited to ANSI terminal colors.  I wish the terminal would support RGB #html_codes, you could really go crazy and port some of the awesome Textmate themes over to the irb term.</p>
]]></content:encoded>
			<wfw:commentRss>http://squarism.com/2010/07/10/fixing-irb-autocompletion-on-osx/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IRB return trick</title>
		<link>http://squarism.com/2010/07/09/irb-return-trick/</link>
		<comments>http://squarism.com/2010/07/09/irb-return-trick/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 03:13:56 +0000</pubDate>
		<dc:creator>Dillon</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://squarism.com/?p=604</guid>
		<description><![CDATA[Irb, like ruby and many other languages, returns things to the left. When you say: x = 5 5 gets sent to x and x gets sent to the console or to the bit bucket if nothing is watching for it. Irb with Ruby will tell you this explicitly which is great for debugging and [...]]]></description>
			<content:encoded><![CDATA[<p>Irb, like ruby and many other languages, returns things to the left.  When you say:</p>
<p><code>x = 5</code></p>
<p>5 gets sent to x and x gets sent to the console or to the bit bucket if nothing is watching for it.  Irb with Ruby will tell you this explicitly which is great for debugging and developing.</p>
<p><code>>> x = 5<br />
=> 5</code></p>
<p>But sometimes it's annoying.  Like when you have a massive array of objects and you're iterating through them.  A quick trick is to add another meaningless return on the end like this:</p>
<p><code>>> x = 5; 1<br />
=> 1</code></p>
<p>If x=5 was a huge database result set or a large array, it'd be hard to read.  But 1 is easy to ignore.</p>
]]></content:encoded>
			<wfw:commentRss>http://squarism.com/2010/07/09/irb-return-trick/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Watchr Unit Tests + Growl + Doomguy</title>
		<link>http://squarism.com/2010/05/23/watchr-unit-tests-growl-doomguy/</link>
		<comments>http://squarism.com/2010/05/23/watchr-unit-tests-growl-doomguy/#comments</comments>
		<pubDate>Sun, 23 May 2010 16:57:06 +0000</pubDate>
		<dc:creator>Dillon</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://squarism.com/?p=489</guid>
		<description><![CDATA[I read this post about setting up autotest with growl. The little doomguy was a nice effect and got a literal lol out of me (llol?). However, the post was from 2007 and apparently autotest has some problems with 1.9. I'm not running 1.9 but on the eve of rails3, I probably will be. Ok, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://squarism.com/wp-content/uploads/2010/05/doomguy_passed-580x150.jpg" alt="" title="doomguy_passed" width="580" height="150" class="aligncenter size-large wp-image-496" /><br />
I read <a href="http://szeryf.wordpress.com/2007/07/30/way-beyond-cool-autotest-growl-doomguy/">this post about setting up autotest with growl</a>.  The little doomguy was a nice effect and got a literal lol out of me (llol?).  However, the post was from 2007 and apparently autotest has some problems with 1.9.  I'm not running 1.9 but on the eve of rails3, I probably will be.  Ok, <a href="http://www.google.com/search?hl=en&#038;source=hp&#038;q=%22better+than+autotest%22&#038;aq=f&#038;aqi=&#038;aql=f&#038;oq=&#038;gs_rfai=">what's cooler than autotest</a>?  Apparently not much, three hits on google.</p>
<h5>Install a gem</h5>
<p>I found <a href="http://github.com/mynyml/watchr">Watchr</a>.  It's not too hard to set up.  <code>sudo gem install watchr</code> to get the gem.  If you're on *nix, grab the filesystem event gem: <code>sudo gem install rev</code>.  Now we have watchr up but we need a config.</p>
<h5>Create the watchr config</h5>
<p>The docs tell you to edit a config/watchr.rb file.  Mine came from <a href="http://wiki.github.com/mynyml/watchr/prepackaged-scripts">the examples on their wiki</a>.  It worked out of the box.  It's posted <a href="http://squarism.com/files/watchr_doom/watchr.rb">here</a>.  It's a basic rails testing config that I haven't had to edit.  It's very readable if you need to futz with it.</p>
<h5>Create a test case</h5>
<p>Ok so watchr just runs `rake test` which you can do in your rails app root.  But perhaps you don't have any test cases created.  The generators will create them for you.  But assuming you don't have one, create a file named [rails app root]/test/functional/hello_test.rb.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'test_helper'</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> HelloTest <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveSupport::TestCase</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> test_hello
    s = <span style="color:#996600;">&quot;Hello&quot;</span>
    assert_equal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Hello&quot;</span>, s<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Obviously this is a crappy assertion.</p>
<h5>Get Growlnotify</h5>
<p>Obviously, you'll need growl installed.  But you also need the growlnotify binary.  It's good to have anyway (I use it in Automator).  I didn't have it by default on two of my machines so I assume that the normal Growl install doesn't install it.  It's on the Growl 1.2 dmg under extras.  You just have to copy it to /usr/local/bin.  Download the <a href="http://growl.info/">growl dmg</a>, open the dmg.  You don't need to reinstall growl.<br />
<code>sudo cp /Volumes/Growl-1.2/Extras/growlnotify/growlnotify /usr/local/bin</code></p>
<p>You can test it with:<br />
<code>growlnotify -t "Title" -m "Message"</code></p>
<h5>Make doomguy happen</h5>
<p>Create a directory for the growl icons: <code>mkdir ~/.watchr_images</code>.<br />
Copy <a href="http://squarism.com/files/watchr_doom/failed.png">these</a> <a href="http://squarism.com/files/watchr_doom/passed.png">two</a> doomguy faces to ~/.watchr_images/.  On mac, hit Shift+Cmd+G and go to the hidden folder.<br />
<img src="http://squarism.com/wp-content/uploads/2010/05/doomguy_go.png" alt="" title="doomguy_go" width="433" height="127" class="aligncenter size-full wp-image-490" /></p>
<p>Now we should have two pngs in our hidden folder.<br />
<img src="http://squarism.com/wp-content/uploads/2010/05/doomguy_pngs.png" alt="" title="doomguy_pngs" width="217" height="141" class="aligncenter size-full wp-image-491" /></p>
<p>The watchr.rb file references these images.  If you want to put it somewhere else (like maybe under ~/Pictures), you can change the .rb.</p>
<h5>Ok Go!</h5>
<p>Launch with: watchr config/watchr.rb from your rails app root.  Watchr should be in your $PATH because you installed the gem.  You should have a blank screen now where watchr is waiting.</p>
<p>When you save a file, watchr will fire.  Depending on the file you saved, a different test will run.  If you save a controller, for example, the functional test for that controller will fire.  If you save a model object, a unit test for that model object will fire.  If you want to force a whole test suite to run hit Ctrl+\ in the watchr window.</p>
<p>When things pass:<br />
<img src="http://squarism.com/wp-content/uploads/2010/05/watchr_growl_overlay.png" alt="" title="watchr_growl_overlay" width="326" height="81" class="aligncenter size-full wp-image-492" /></p>
<p>When things fail:<br />
<img src="http://squarism.com/wp-content/uploads/2010/05/watchr_growl_overlay_fail.png" alt="" title="watchr_growl_overlay_fail" width="325" height="100" class="aligncenter size-full wp-image-493" /></p>
<p>The growl display setting is "Music Video".  I have it popping up on my 3rd monitor which is less distracting but still visible.  However if you put it on your main monitor, the overlay won't interfere with mouse clicks, which is nice.  It makes for a killer setup where I don't have to test my app with a browser or with contrived/non-automated tests.  Now I just need to write more tests.</p>
]]></content:encoded>
			<wfw:commentRss>http://squarism.com/2010/05/23/watchr-unit-tests-growl-doomguy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Developer Activation Problem</title>
		<link>http://squarism.com/2010/05/10/iphone-developer-activation-problem/</link>
		<comments>http://squarism.com/2010/05/10/iphone-developer-activation-problem/#comments</comments>
		<pubDate>Mon, 10 May 2010 22:58:06 +0000</pubDate>
		<dc:creator>Dillon</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[ObjC]]></category>

		<guid isPermaLink="false">http://squarism.com/?p=461</guid>
		<description><![CDATA[I went to renew my membership on my iPhone developer account and although the membership is $99/year, my expiration date was only extended out for 3 months. I opened a ticket and it took about a month or two to get this thing resolved. I had to send screenshots, steps and evidence that I was [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://squarism.com/wp-content/uploads/2010/05/iphone_portal_expiration.png" alt="" title="iphone_portal_expiration" width="264" height="95" class="alignright size-full wp-image-466" /><br />
I went to renew my membership on my iPhone developer account and although the membership is $99/year, my expiration date was only extended out for 3 months.  I opened a ticket and it took about a month or two to get this thing resolved.  I had to send screenshots, steps and evidence that I was doing the right thing (ok, fine, tier 1 support).  Eventually I got a person that had a trick up their sleeve but didn't quite get it right.  I'm blogging this in case this is happening to someone else.</p>
<p>First, the symptoms.  Let's say your dev account is about to expire in January 2010.  You want to renew for another year.  You add a year subscription to your cart, pay for it.  You'd expect your new expire date to be Jan-2011.  But in your profile and in the "thanks for ordering" activation page it says March 2010 or something else wrong.  Support send me activation links basically to the same page that wouldn't activate any differently.  Each time I checked out, it would say March 2010.</p>
<p>The trick was to click on renew membership (as if paying again), click the checkbox to select which membership you want to buy ($99 year) and hit continue.  Now you're on a "Review your purchase" page.  Click continue here.  Finally, it says "Proceed to your country's Apple Online Store to purchase" and has an add to cart button.  Stop here.</p>
<p>Click the following link: <a href="http://developer.apple.com/iphone/enroll/activate.action">http://developer.apple.com/iphone/enroll/activate.action</a>.  It should bring you to a page with a single textbox for your activation code (the one you've been trying to use all along).  Put this in and hit continue.  Your expire date should be correct now.  If not, try using a link formatted like this:<br />
<code>http://developer.apple.com/iphone/enroll/activate.action?activationCode=YOURCODEHERE</code></p>
<p>Seems like they have some bug in the dev store.  Please comment if this helped you so it's documented.</p>
]]></content:encoded>
			<wfw:commentRss>http://squarism.com/2010/05/10/iphone-developer-activation-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RMagic, ImageMagick, Snow Leopard and Ruby 1.9</title>
		<link>http://squarism.com/2010/03/08/rmagic-imagemagick-snow-leopard-and-ruby-1-9/</link>
		<comments>http://squarism.com/2010/03/08/rmagic-imagemagick-snow-leopard-and-ruby-1-9/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 03:32:28 +0000</pubDate>
		<dc:creator>Dillon</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://squarism.com/?p=381</guid>
		<description><![CDATA[I ran into a problem that kept me busy over the weekend. It seems that rmagick (which is requires for the awesome sparklines project will compile and run on Snow Leopard, however it has a critical bug when trying to use it. The script/server process will crash with a "Trace/BPT trap" error. The logs won't [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into a problem that kept me busy over the weekend.  It seems that rmagick (which is requires for <a href="http://nubyonrails.com/pages/sparklines">the awesome sparklines project</a> will compile and run on Snow Leopard, however it has a critical bug when trying to use it.  The script/server process will crash with a "Trace/BPT trap" error.  The logs won't say anything and the hell if anything is going to appear on the browser.  WTF.</p>
<p>Here's my stack on my Mac: (do not use this stack, this is just for informational purposes only)</p>
<ul>
<li>ruby19 installed via macports: sudo install ruby19</li>
<li>regular rubygems installed</li>
<li>ImageMagick 6.6.0-0 installed via macports</li>
<li>A bunch of github gems installed but not firing on the controller method that crashes</li>
</ul>
<p>So I started over on a CentOS 5.4 VM just to try out my stack and it worked.  Except, I used ruby 1.8.7 compiled via source.  It's a really lengthy process and it'll be part of my README if I ever get this project done.  On CentOS you have to compile and install ImageMagick yourself because yum has a really old version.  There's a ton of devel dependencies too.  If anyone needs the instructions, leave a comment and I'll copy/paste from my README.</p>
<p>So I suspected that ruby 1.9 was causing problems my mac laptop and that turned out to be true.  I did a <code>sudo port uninstall ruby19</code> and then a <code>sudo port install ruby</code>.  I had to reinstall all the gems again but it wasn't too bad.  If port gives you a ln error, just exit your shell and open a new one.</p>
<p>So RMagick, ImageMagick and ruby 1.9 do not play together.</p>
]]></content:encoded>
			<wfw:commentRss>http://squarism.com/2010/03/08/rmagic-imagemagick-snow-leopard-and-ruby-1-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduino command protocol</title>
		<link>http://squarism.com/2010/02/28/arduino-command-protocol/</link>
		<comments>http://squarism.com/2010/02/28/arduino-command-protocol/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 16:40:57 +0000</pubDate>
		<dc:creator>Dillon</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[C/C++]]></category>

		<guid isPermaLink="false">http://squarism.com/?p=354</guid>
		<description><![CDATA[Here's my IRC Arduino Bot. It uses a regular Arduino 328 and an Ethernet Shield both from sparkfun. As for software, I'm using the Ethernet2 library (see my previous post about this), the WString library and a homerolled IRC protocol parser. The breadboard's power is connected to arbitrary pin 5 and some resistors to keep [...]]]></description>
			<content:encoded><![CDATA[<p>Here's my IRC Arduino Bot.  It uses a regular <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=666">Arduino 328</a> and an <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=9026">Ethernet Shield</a> both from sparkfun.  As for software, I'm using the Ethernet2 library (see <a href="http://squarism.com/2010/02/06/ethernet2-arduino-library-fix-on-0017/">my previous post</a> about this), the <a href="http://www.arduino.cc/en/Tutorial/TextString">WString library</a> and a homerolled <a href="http://www.ietf.org/rfc/rfc1459.txt">IRC protocol</a> parser.  The breadboard's power is connected to arbitrary pin 5 and some resistors to keep the LED from burning out.</p>
<p><img src="http://squarism.com/wp-content/uploads/2010/02/arduino_irc_light-580x435.png" alt="arduino_irc_light" title="arduino_irc_light" width="580" height="435" class="aligncenter size-large wp-image-355" /></p>
<p>Basically, my bot joins an IRC channel and then listens for PRIVMSG commands starting with a password.  It takes those commands and controls an LED.  For example, I'd send this privately to the Arduino:<br />
<code>command password LEDON</code></p>
<p>And then the red LED comes on.  I tell it "LEDOFF" and it turns off.  Ok, it's not a new RFC spec worthy of IEEE recognition and international adoption.  But it got the job done in a human-readable manner.  Previously on my facebook status light project, I had done much of the processing on my laptop and only send hex codes to the Arduino to light up LEDs.  The difference now is that the Arduino is doing the processing and no computer is needed.</p>
<p>While I was working on this little project, I had the bot join the channel and announce itself.<br />
<img src="http://squarism.com/wp-content/uploads/2010/02/irc_log.png" alt="irc_log" title="irc_log" width="556" height="372" class="aligncenter size-full wp-image-356" /></p>
<p>At one point, I was working on code and then my bot would disconnect.  I checked the serial monitor and the server seemed to drop me after a few minutes.  The channel would say that I timed out.  I realized that I wasn't responding to the PING from the server.  So I threw in some code that checks for anything from the server that starts with "PING :".  I then respond with "PONG".  I remember seeing PING?/PONG! messages in mIRC back in the day.  Now it makes sense why mIRC was doing that in the console window.</p>
<p>It works great and I was excited about how much this little board could do in 14KB.  And then I kept testing it.  After about 7 or 8 "turn on" and "turn off" commands, the Arduino wouldn't do anything anymore.  It's like it just froze.  If I typed 5 commands, it'd stay connected for a long time.  But every time I'd send it 7 to 8 commands, it would lock up.  And by lock up, I mean the commands wouldn't work anymore and it would time out from the server.  WTF.  So close!</p>
<p>So I figure that it's something to do with pointers and memory.  I really don't have a solid grasp on pointers and C.  I got a lot of this working by iterative experimentation over many days.  So I was looking for a better way to send human readable commands to my bot.  By human readable I mean something that works like a unix command "command arg1 arg2".  Of course this human readable bit introduces strings which is tricky enough in C (for me) and even worse on the Arduino.  I figured this was a problem that someone smarter than me had solved.</p>
<p>I found a library called <a href="http://www.arduino.cc/playground/Code/Messenger">Messenger</a>.  It's pretty simple to install, just throw it in your ~/Documents/Arduino/libraries folder on Mac and um ... the equivalent on Windows?  There are examples in the Messenger folder that you can checkout.  HOWEVER the whole point of me posting this big long thing is the following.</p>
<p>The example checkString really threw me for a loop.  It did exactly what I need it do to in a much cleaner way.  I uploaded to the Arduino and then broke out to a shell.</p>
<p><code>$ screen /dev/tty.usbserial-A9005bCr 115200</code></p>
<p>Substitute your virtual usb device for the /dev/tty path.  Note that the sketch uses 115k serial speed.  You won't see anything when you type but if you hit "enter" (to clear the buffer) "on[enter]" in screen LED 13 will turn on.  Type "off[enter]" ([enter] means the enter key) and it will turn off.  Great!  Exactly what I need.  But then I tried typing "on" then "off" then "muffins" then "on" and the light stayed off.  Any garbage gets the Arduino stuck like my sketch.  Ok, is what I'm trying to do impossible or is this just coincidence?</p>
<p>I modified the checkString example to look like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// This example demonstrates Messenger's checkString method</span>
<span style="color: #666666; font-style: italic;">// It turns on the LED attached to pin 13 if it receives &quot;on&quot;</span>
<span style="color: #666666; font-style: italic;">// It turns it off if it receives &quot;off&quot;</span>
&nbsp;
&nbsp;
#include <span style="color: #339933;">&lt;</span>Messenger.<span style="color: #006633;">h</span><span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">// Instantiate Messenger object with the message function and the default separator </span>
<span style="color: #666666; font-style: italic;">// (the space character)</span>
Messenger message <span style="color: #339933;">=</span> Messenger<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">// Define messenger function</span>
<span style="color: #000066; font-weight: bold;">void</span> messageCompleted<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">// This loop will echo each element of the message separately</span>
  <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span> message.<span style="color: #006633;">available</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> message.<span style="color: #006633;">checkString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;on&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      digitalWrite<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">13</span>,HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> message.<span style="color: #006633;">checkString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;off&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      digitalWrite<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">13</span>,LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>       <span style="color: #666666; font-style: italic;">// ADD THIS</span>
      <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>     <span style="color: #666666; font-style: italic;">// ADD THIS</span>
    <span style="color: #009900;">&#125;</span>                <span style="color: #666666; font-style: italic;">// ADD THIS</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">// Initiate Serial Communication</span>
  Serial.<span style="color: #006633;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">115200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
  message.<span style="color: #006633;">attach</span><span style="color: #009900;">&#40;</span>messageCompleted<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  pinMode<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">13</span>,OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> loop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// The following line is the most effective way of </span>
  <span style="color: #666666; font-style: italic;">// feeding the serial data to Messenger</span>
  <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span> Serial.<span style="color: #006633;">available</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> message.<span style="color: #006633;">process</span><span style="color: #009900;">&#40;</span> Serial.<span style="color: #006633;">read</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>I added the break and it's able to deal with garbage.  I tested more than 20 commands with banging on the keyboard in between and it seems pretty solid.  Now I just need to integrate this with my IRC bot and I might have something that can stay online for a while.</p>
<p>By the way, after you use screen to connect to a serial port, hit "Ctrl+A, k" to kill the window and break out of screen.</p>
<p><strong>Update</strong>: People have asked for the code.  It's posted after the break.<br />
<span id="more-354"></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// UNSTABLE IRC BOT</span>
<span style="color: #666666; font-style: italic;">// TODO: Integrate with Messenger.h for stability</span>
#include <span style="color: #339933;">&lt;</span>Ethernet2.<span style="color: #006633;">h</span><span style="color: #339933;">&gt;</span>
#include <span style="color: #339933;">&lt;</span>WString.<span style="color: #006633;">h</span><span style="color: #339933;">&gt;</span>
&nbsp;
#define STRING_BUFFER_SIZE <span style="color: #cc66cc;">128</span>
<span style="color: #003399;">String</span> buffer <span style="color: #339933;">=</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#40;</span>STRING_BUFFER_SIZE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// string variable to hold server name detection</span>
<span style="color: #003399;">String</span> hostString <span style="color: #339933;">=</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">byte</span> mac<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// CHANGE ME</span>
<span style="color: #000066; font-weight: bold;">byte</span> ip<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">3</span>, <span style="color: #cc66cc;">4</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// arduino IP: 1.2.3.4</span>
<span style="color: #000066; font-weight: bold;">byte</span> gateway<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">3</span>, <span style="color: #cc66cc;">4</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// your router IP: 1.2.3.4</span>
<span style="color: #000066; font-weight: bold;">byte</span> subnet<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> <span style="color: #cc66cc;">255</span>, <span style="color: #cc66cc;">255</span>, <span style="color: #cc66cc;">255</span>, <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// your network mask</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// irc.freenode.net</span>
<span style="color: #000066; font-weight: bold;">byte</span> ircServer<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> <span style="color: #cc66cc;">74</span>, <span style="color: #cc66cc;">208</span>, <span style="color: #cc66cc;">174</span>, <span style="color: #cc66cc;">239</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// IP of freenode.net</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">int</span> responseWait <span style="color: #339933;">=</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">;</span>         <span style="color: #666666; font-style: italic;">// default: 1000</span>
<span style="color: #000066; font-weight: bold;">int</span> joinWait <span style="color: #339933;">=</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">;</span>             <span style="color: #666666; font-style: italic;">// default: 1000</span>
<span style="color: #000066; font-weight: bold;">int</span> pingCheckThrottle <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10000</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// check for PING event every 10 seconds once connected</span>
<span style="color: #000066; font-weight: bold;">int</span> reconnectWait <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5000</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// CHANGE ME</span>
<span style="color: #000066; font-weight: bold;">char</span> ircNick<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">20</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;DuinoFace&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">char</span> channel<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">20</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;#freebsToTheDee&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">boolean</span> isLoggedIn <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
Client client<span style="color: #009900;">&#40;</span>ircServer, <span style="color: #cc66cc;">6667</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// turn on when debugging</span>
<span style="color: #000066; font-weight: bold;">boolean</span> isDebugOn <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// logged in (in channel) status light</span>
<span style="color: #000066; font-weight: bold;">int</span> ledPin <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">//router time?</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">500</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  Serial.<span style="color: #006633;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">9600</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">// opens serial port, sets data rate to 9600 bps</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Say hello:</span>
  debugNoLine<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;String Library version: &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  debug<span style="color: #009900;">&#40;</span>buffer.<span style="color: #006633;">version</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  Ethernet.<span style="color: #006633;">begin</span><span style="color: #009900;">&#40;</span>mac, ip, gateway, subnet<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  delay<span style="color: #009900;">&#40;</span>responseWait<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  debug<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;client.connect()&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>client.<span style="color: #006633;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    debug<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;client.connect() failed.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// status light</span>
  pinMode<span style="color: #009900;">&#40;</span>ledPin, OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> loop<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;">if</span> <span style="color: #009900;">&#40;</span>client.<span style="color: #006633;">available</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> client.<span style="color: #006633;">connected</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// parse the incoming buffer</span>
    readIRCRequest<span style="color: #009900;">&#40;</span>client<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;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>client.<span style="color: #006633;">connected</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    debug<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Disconnected&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    client.<span style="color: #006633;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    delay<span style="color: #009900;">&#40;</span>reconnectWait<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    debug<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Reconnecting...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    isLoggedIn <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    setStatusLight<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    client.<span style="color: #006633;">connect</span><span style="color: #009900;">&#40;</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;
&nbsp;
<span style="color: #000066; font-weight: bold;">int</span> readIRCRequest<span style="color: #009900;">&#40;</span>Client client<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">char</span> inChar <span style="color: #339933;">=</span> client.<span style="color: #006633;">read</span><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;">if</span> <span style="color: #009900;">&#40;</span>inChar <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    buffer.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span>inChar<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> 
  <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
    debugNoLine<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Buffer: &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    debug<span style="color: #009900;">&#40;</span>buffer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>isLoggedIn<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>buffer.<span style="color: #006633;">contains</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;NOTICE * :*** No Ident response&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        login<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        buffer <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: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>buffer.<span style="color: #006633;">contains</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;:End of /MOTD command.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        join<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span> 
      <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>buffer.<span style="color: #006633;">contains</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;:End of /NAMES list.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        say<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        isLoggedIn <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
        setStatusLight<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span> 
    <span style="color: #009900;">&#125;</span> 
    <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
      checkCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>        
      checkPing<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">//delay(pingCheckThrottle);</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// clear out buffer for next line read</span>
    buffer <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">/* We need to send something that looks like this
 *   NICK yaytofu
 *   USER yaytofu 0 * yaytofu
 * Where yaytofu is our nickname
 */</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> login<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003399;">String</span> msg <span style="color: #339933;">=</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  msg <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;NICK &quot;</span><span style="color: #339933;">;</span>
  msg.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span>ircNick<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #666666; font-style: italic;">//if (debug) Serial.println(msg);</span>
  debug<span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  client.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  delay<span style="color: #009900;">&#40;</span>responseWait<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* wait for a response */</span>
&nbsp;
  msg <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;USER &quot;</span><span style="color: #339933;">;</span>
  msg.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span>ircNick<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  msg.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; 0 * &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  msg.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span>ircNick<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  debug<span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  client.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  delay<span style="color: #009900;">&#40;</span>responseWait<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* wait for a response */</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> join<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  delay<span style="color: #009900;">&#40;</span>joinWait<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  debug<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;JOIN...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  client.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>strcat<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;JOIN &quot;</span>, channel<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  delay<span style="color: #009900;">&#40;</span>responseWait<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> say<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">//if (debug) Serial.println(&quot;Sending something to the channel.&quot;);</span>
  debug<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Sending something to channel.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  client.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;PRIVMSG #freebsToTheDee :Arduino with Ethernet Shield is here.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> say<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">char</span> <span style="color: #339933;">*</span>msg<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  debug<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Sending something to channel.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  client.<span style="color: #006633;">print</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;PRIVMSG #freebsToTheDee :&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  client.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> checkPing<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;">if</span> <span style="color: #009900;">&#40;</span>buffer.<span style="color: #006633;">startsWith</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;PING :&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    debug<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;GOT PING!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// parse and store hostname in string</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>hostString.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      hostString <span style="color: #339933;">=</span> buffer.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span>, buffer.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// respond to ping</span>
    debug<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;PONG!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    client.<span style="color: #006633;">print</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;PONG &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    client.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>hostString<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    setStatusLight<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> checkCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">// :nick!~nick@static-1-13-5-1.domain.com PRIVMSG #freebsToTheDee :wut</span>
  <span style="color: #666666; font-style: italic;">// state codes 0=DNS   1=PRIVMSG   2=channel  3=message</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>buffer.<span style="color: #006633;">startsWith</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;:&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> buffer.<span style="color: #006633;">contains</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;PRIVMSG&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">int</span> state <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">int</span> spaces<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// split on spaces, TODO: state check</span>
    <span style="color: #000066; font-weight: bold;">char</span> <span style="color: #339933;">*</span>bufferArray <span style="color: #339933;">=</span> buffer.<span style="color: #006633;">getChars</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> buffer.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">char</span> test <span style="color: #339933;">=</span> bufferArray<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>test <span style="color: #339933;">==</span> <span style="color: #0000ff;">' '</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        debugNoLine<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;found space at:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        debug<span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        spaces<span style="color: #009900;">&#91;</span>state<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> i<span style="color: #339933;">;</span>
        state<span style="color: #339933;">++;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
    <span style="color: #003399;">String</span> dnsName <span style="color: #339933;">=</span> buffer.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, spaces<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">String</span> privMsg <span style="color: #339933;">=</span> buffer.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span>spaces<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span>, spaces<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">String</span> channel <span style="color: #339933;">=</span> buffer.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span>spaces<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span>, spaces<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">String</span> cmd <span style="color: #339933;">=</span> buffer.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span>spaces<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">2</span>, buffer.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    debugNoLine<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;dnsName:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    debug<span style="color: #009900;">&#40;</span>dnsName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    debugNoLine<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;privMsg:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    debug<span style="color: #009900;">&#40;</span>privMsg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    debugNoLine<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;channel:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    debug<span style="color: #009900;">&#40;</span>channel<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    debugNoLine<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;cmd:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    debug<span style="color: #009900;">&#40;</span>cmd<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> setStatusLight<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;">if</span> <span style="color: #009900;">&#40;</span>isLoggedIn<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    debug<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Setting status light to ON.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>ledPin, HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> 
  <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
    debug<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Setting status light to OFF.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>ledPin, LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// No carriage return</span>
<span style="color: #000066; font-weight: bold;">void</span> debugNoLine<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">char</span> <span style="color: #339933;">*</span>msg<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>isDebugOn<span style="color: #009900;">&#41;</span> Serial.<span style="color: #006633;">print</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// No carriage return overloaded</span>
<span style="color: #000066; font-weight: bold;">void</span> debugNoLine<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> <span style="color: #339933;">*</span>msg<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>isDebugOn<span style="color: #009900;">&#41;</span> Serial.<span style="color: #006633;">print</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> debugNoLine<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> <span style="color: #339933;">*</span>msg<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>isDebugOn<span style="color: #009900;">&#41;</span> Serial.<span style="color: #006633;">print</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Carriage return</span>
<span style="color: #000066; font-weight: bold;">void</span> debug<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">char</span> <span style="color: #339933;">*</span>msg<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>isDebugOn<span style="color: #009900;">&#41;</span> Serial.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Carriage return overloaded</span>
<span style="color: #000066; font-weight: bold;">void</span> debug<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> <span style="color: #339933;">*</span>msg<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>isDebugOn<span style="color: #009900;">&#41;</span> Serial.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> debug<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> msg<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>isDebugOn<span style="color: #009900;">&#41;</span> Serial.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Be sure to change the two sections of CHANGE ME.  Also please note that like I said in my post, I never integrated these two source files together.  So the IRC bot is unstable after about 8 commands.</p>
]]></content:encoded>
			<wfw:commentRss>http://squarism.com/2010/02/28/arduino-command-protocol/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Dataloading ftw</title>
		<link>http://squarism.com/2009/11/12/dataloading-ftw/</link>
		<comments>http://squarism.com/2009/11/12/dataloading-ftw/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 03:03:14 +0000</pubDate>
		<dc:creator>Dillon</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://squarism.com/?p=277</guid>
		<description><![CDATA[Man. I need to finish this ruby project I started. I've had this RSS loader running on a box since 7/10/2009 and: mysql> select count(*) from jobs; +----------+ &#124; 1414595 &#124; +----------+ mysql> select count(*) from entries; +----------+ &#124; 184149 &#124; +----------+ mysql> select count(*) from batches; +----------+ &#124; 35170 &#124; +----------+ 1.4 millions jobs [...]]]></description>
			<content:encoded><![CDATA[<p>Man.  I need to finish this ruby project I started.  I've had this RSS loader running on a box since 7/10/2009 and:</p>
<pre>mysql> select count(*) from jobs;
+----------+
|  1414595 |
+----------+

mysql> select count(*) from entries;
+----------+
|   184149 |
+----------+

mysql> select count(*) from batches;
+----------+
|    35170 |
+----------+
</pre>
<p>1.4 millions jobs with 184k RSS posts.  Eep.  I need to finish the analyzer part and turn this off.  It's only a 200mb DB right now but my procrastination could cause /var to fill up.  Heh.</p>
]]></content:encoded>
			<wfw:commentRss>http://squarism.com/2009/11/12/dataloading-ftw/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rails on Leopard via davesouth.org</title>
		<link>http://squarism.com/2009/07/18/rails-on-leopard-via-davesouthorg/</link>
		<comments>http://squarism.com/2009/07/18/rails-on-leopard-via-davesouthorg/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 17:29:20 +0000</pubDate>
		<dc:creator>Dillon</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://squarism.com/?p=251</guid>
		<description><![CDATA[Started a side project on rails, many guides on how to upgrade a Mac. Every OS has it's weirdness. Ubuntu wants to control ruby and the gems. OSX has an older version included. Macports sometimes doesn't add the PATH. It was all really muddy. Then I found a page by Dave South. The article's post [...]]]></description>
			<content:encoded><![CDATA[<p>Started a side project on rails, many guides on how to upgrade a Mac.  Every OS has it's weirdness.  Ubuntu wants to control ruby and the gems.  OSX has an older version included.  Macports sometimes doesn't add the PATH.  It was all really muddy.</p>
<p><a href="http://www.davesouth.org/stories/install-ruby-on-rails-using-macports">Then I found a page by Dave South</a>.  The article's post date is old but at the bottom you'll see he keeps it updated.  Thanks Dave!</p>
]]></content:encoded>
			<wfw:commentRss>http://squarism.com/2009/07/18/rails-on-leopard-via-davesouthorg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stanford iPhone class on iTunes U</title>
		<link>http://squarism.com/2009/05/02/stanford-iphone-class-on-itunes-u/</link>
		<comments>http://squarism.com/2009/05/02/stanford-iphone-class-on-itunes-u/#comments</comments>
		<pubDate>Sat, 02 May 2009 22:10:50 +0000</pubDate>
		<dc:creator>Dillon</dc:creator>
				<category><![CDATA[ObjC]]></category>

		<guid isPermaLink="false">http://squarism.com/?p=199</guid>
		<description><![CDATA[Going through the CS193P Stanford iTunes U class as if I'm taking it. It was done in April but I'm going to use the assignment due dates as deadlines for May. If it's due on April 9, then it's due on May 9 for me. So far the content is good. The introductory stuff I [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://squarism.com/wp-content/uploads/2009/05/cs193p.png" alt="cs193p" title="cs193p" width="376" height="58" class="aligncenter size-full wp-image-202" /><br />
Going through the CS193P <a href="http://itunes.stanford.edu/">Stanford iTunes U class</a> as if I'm taking it.  It was done in April but I'm going to use the assignment due dates as deadlines for May.  If it's due on April 9, then it's due on May 9 for me.  So far the content is good.  The introductory stuff I got from the book&#038;fail method but it's nice hearing someone explain it.</p>
<p><a href="http://www.stanford.edu/class/cs193p/downloads/Assignment1B.pdf">Assignment 1B</a> is a good API doc researching exercise.</p>
]]></content:encoded>
			<wfw:commentRss>http://squarism.com/2009/05/02/stanford-iphone-class-on-itunes-u/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Synergy2 mouse centering</title>
		<link>http://squarism.com/2007/10/04/synergy2-mouse-centering/</link>
		<comments>http://squarism.com/2007/10/04/synergy2-mouse-centering/#comments</comments>
		<pubDate>Fri, 05 Oct 2007 02:29:38 +0000</pubDate>
		<dc:creator>Dillon</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://squarism.com/2007/10/04/synergy2-mouse-centering/</guid>
		<description><![CDATA[Synergy is a great tool for sharing multiple screens (reverse KVM) but for some reason lately I've noticed that if I'm physically on the center screen, then the mouse recenters occasionally. It's pretty annoying. I turned on debug log and looked in ~/Library/Logs/synergyd.log. I found this: 2007-10-04 22:12:11.894 Synergyd[337] DEBUG: dropped bogus motion -840,-526 I [...]]]></description>
			<content:encoded><![CDATA[<p>Synergy is a great tool for sharing multiple screens (reverse KVM) but for some reason lately I've noticed that if I'm physically on the center screen, then the mouse recenters occasionally.  It's pretty annoying.</p>
<p>I turned on debug log and looked in ~/Library/Logs/synergyd.log.  I found this:</p>
<blockquote><p>2007-10-04 22:12:11.894 Synergyd[337] DEBUG: dropped bogus motion -840,-526</p></blockquote>
<p>I searched sourceforge for that string and found code that essentially centers the mouse when it detects motion on the primary screen.  There doesn't seem to be an option to control the behavior, so short of me making a patch, I don't see a solution.</p>
<p>UPDATE: I found a workaround, simply move your mouse over to the display that it being buggy and the if() condition doesn't fire off.  So in my case, my mac connects to my PC's keyboard and mouse.  I move the PC's mouse over to the Mac screen and the Mac stops acting weird (the centering problem).</p>
]]></content:encoded>
			<wfw:commentRss>http://squarism.com/2007/10/04/synergy2-mouse-centering/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
