<?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>im addicted &#187; dev</title>
	<atom:link href="http://imaddicted.ca/category/dev/feed/" rel="self" type="application/rss+xml" />
	<link>http://imaddicted.ca</link>
	<description>i'm always on</description>
	<lastBuildDate>Mon, 28 Nov 2011 05:42:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Interactive music with arduino and sheevaplug, part 1</title>
		<link>http://imaddicted.ca/dev/interactive-music-with-arduino-and-sheevaplug-part-1/</link>
		<comments>http://imaddicted.ca/dev/interactive-music-with-arduino-and-sheevaplug-part-1/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 01:23:34 +0000</pubDate>
		<dc:creator>lance_</dc:creator>
				<category><![CDATA[dev]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SheevaPlug]]></category>
		<category><![CDATA[USB]]></category>

		<guid isPermaLink="false">http://imaddicted.ca/?p=684</guid>
		<description><![CDATA[Recently someone from the hacklab put up a note saying that he had a SheevaPlug to give to a good home. I jumped on the offer. Thanks again, Brian! I&#8217;m going to be blogging a little bit about what I&#8217;m doing to show that I do have a good home for it. The first thing [...]]]></description>
			<content:encoded><![CDATA[<p>Recently someone from the hacklab put up a note saying that he had a SheevaPlug to give to a good home. I jumped on the offer. Thanks again, Brian! I&#8217;m going to be blogging a little bit about what I&#8217;m doing to show that I do have a good home for it.</p>
<div class="zemanta-img zemanta-action-dragged" style="margin: 1em; display: block;">
<div class="wp-caption alignright" style="width: 310px"><a href="http://commons.wikipedia.org/wiki/File:Sheevaplug.jpg"><img title="Sheevaplug plug computer with iPhone for scale" src="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e4/Sheevaplug.jpg/300px-Sheevaplug.jpg" alt="Sheevaplug plug computer with iPhone for scale" width="300" height="200" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
</div>
<p>The first thing that I&#8217;m going to use it for is an interactive music player or generator for a friend&#8217;s art piece. It&#8217;s going to change what&#8217;s played based on how many people are in what parts of the room. I&#8217;m going to do this by counting the number of people who enter the room using infrared LED sensors, and then setting up sonar threshholds for people to be counted as they cross. To implement this I&#8217;ll use the sheevaplug, two arduinos, a bunch of range finders, and either a long cable connecting the two duinos or a couple of xbees.</p>
<p>I&#8217;m going to have four pairs of rangefinders on a post, each pair pointing in a different direction. If I see the distance from one rangefinder in the pair drop (call it A), then the other (call it B), I can guess that a person just walked in the direction A to B. I&#8217;ll decrement the count of people from A&#8217;s quadrant and increment it in B&#8217;s quadrant. The music will change depending on how many people are in the room, and how many are in each quadrant.</p>
<p>Why the sheevaplug? It&#8217;s powerful enough to generate sound and pipe it through a USB sound card.</p>
<p><a href="http://imaddicted.ca/wp-content/arduino-on-sheevaplug.png"><img class="alignleft size-thumbnail wp-image-733" title="Connecting to the arduino via the sheevaplug" src="http://imaddicted.ca/wp-content/arduino-on-sheevaplug-150x82.png" alt="" width="150" height="82" /></a>The first step in this ordeal was to get FTDI working on the sheevaplug. <a href="http://www.arcfn.com/2009/06/arduino-sheevaplug-cool-hardware.html">It appears I wasn&#8217;t the only one with this idea</a>. This is great news for me because the kernel I needed to get FTDI working was already compiled. I had some trouble at first, I&#8217;d see the kernel was being uncompressed and then it&#8217;d hang. As it turns out I forgot to run a few setenv commands. Oops. I was able to run those from the serial console and get going. Now the plug is running just fine.</p>
<p>My next step is to pick up a couple of motion sensors and see if I can get the people counter working. I expect to run into some problems with interference, so I&#8217;ll have to play around with the transmit timings. If it works with the two then we&#8217;ll see about getting funding. In any case I&#8217;m trying to get the costs down, those range finders are expensive!</p>
]]></content:encoded>
			<wfw:commentRss>http://imaddicted.ca/dev/interactive-music-with-arduino-and-sheevaplug-part-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Greasemonkey script for Torontonian Goodread users</title>
		<link>http://imaddicted.ca/dev/greasemonkey-script-for-torontonian-goodread-users/</link>
		<comments>http://imaddicted.ca/dev/greasemonkey-script-for-torontonian-goodread-users/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 01:22:47 +0000</pubDate>
		<dc:creator>lance_</dc:creator>
				<category><![CDATA[dev]]></category>
		<category><![CDATA[goodreads]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[toronto]]></category>
		<category><![CDATA[toronto public library]]></category>

		<guid isPermaLink="false">http://imaddicted.ca/?p=670</guid>
		<description><![CDATA[Image by rb3m via Flickr This target market is pretty specific, I know, but I wrote a script to make searching for books at available at my local library more easy while browsing Goodreads. I&#8217;m starting to use Goodreads to track what I&#8217;m reading and also find suggestions from friends. Connie Crosby linked via Twitter [...]]]></description>
			<content:encoded><![CDATA[<div class="zemanta-img" style="margin: 1em; display: block;">
<div>
<dl class="wp-caption alignleft" style="width: 190px;">
<dt class="wp-caption-dt"><a href="http://www.flickr.com/photos/61239510@N00/2665284075"><img title="Toronto Public Library" src="http://imaddicted.ca/wp-content/2665284075_cf55ee0981_m.jpg" alt="Toronto Public Library" width="180" height="240" /></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image by <a href="http://www.flickr.com/photos/61239510@N00/2665284075">rb3m</a> via Flickr</dd>
</dl>
</div>
</div>
<p>This target market is pretty specific, I know, but I wrote a <a href="http://userscripts.org/scripts/show/71170">script to make searching for books at available at my local library more easy while browsing Goodreads</a>. I&#8217;m starting to use <a href="http://www.goodreads.com/">Goodreads</a> to track what I&#8217;m reading and also find suggestions from friends.</p>
<p><a href="http://conniecrosby.blogspot.com/">Connie Crosby</a> linked via Twitter to a <a href="http://www.davemadethat.com/2009/10/23/your-library-on-amazon/">blog post on how to automatically search your local libraries while browsing Amazon</a>. I don&#8217;t browse Amazon that often but it did get me thinking.</p>
<p>When I want to read a book I generally first check out the <a href="http://beta.torontopubliclibrary.ca/books-video-music/downloads-ebooks/">TPL&#8217;s downloadable section</a>. It&#8217;s a little sparse for anything other than computer books. (Yes, I do read things other than computer books.) Anyhow, I&#8217;ve already gotten some use out of <a href="http://userscripts.org/scripts/show/71170">my script</a> when only dead tree editions were available, and I imagine others will find the script handy too.</p>
<p>What it does is it searches the Toronto Public Library&#8217;s catalog for the 13 digit ISBN of any book that you visit on Goodreads. If it&#8217;s in the catalog, you can click a link that&#8217;ll pop up a list showing what branches it&#8217;s available at, and place a hold if you want.</p>
<p>This was made possible by the <a href="http://beta.torontopubliclibrary.ca/">new beta website</a> which is still a work in progress. Still, very cool features have been rolled out.</p>
<p>Known issue with the script: I couldn&#8217;t get the &#8220;place hold&#8221; button to select the right branch, no matter which &#8220;place hold&#8221; link you click it will ask you to select your branch.</p>
<p>Watch the 1.5 minute video below if you want a preview of what the script does.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/8PyiBLemRj4&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/8PyiBLemRj4&amp;hl=en&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://www.wired.com/geekdad/2010/01/catalog-your-books-online/">Catalog Your Books Online</a> (wired.com)</li>
<li class="zemanta-article-ul-li"><a href="http://www.makeuseof.com/tag/book-recommendation-engines-quick-book-searches/">Three Book Recommendation Engines For Quick Book Searches</a> (makeuseof.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/pixy.gif?x-id=1dd0977b-96fb-4c02-8c44-28b6b2af1697" alt="" /><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
<p><!-- WP Theme Credits -->
<div style="display: none">И не забудьте: онлайн <a href="http://tur-nado.ru/avia/"><b>бронирование авиабилетов</b></a></div>
]]></content:encoded>
			<wfw:commentRss>http://imaddicted.ca/dev/greasemonkey-script-for-torontonian-goodread-users/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CrisisCampTO</title>
		<link>http://imaddicted.ca/dev/crisiscampto/</link>
		<comments>http://imaddicted.ca/dev/crisiscampto/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 22:58:32 +0000</pubDate>
		<dc:creator>lance_</dc:creator>
				<category><![CDATA[dev]]></category>

		<guid isPermaLink="false">http://imaddicted.ca/?p=664</guid>
		<description><![CDATA[Yesterday was the first CrisisCamp in Toronto. I heard about it from Jacqui Maher&#8216;s presentation at CUSEC, and I decided to attend not really knowing what to expect. It turned out that there were six projects to tackle, and I tried to help with the machine translation project. The idea was to provide an easily [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday was the first CrisisCamp in Toronto. I heard about it from <a href="http://brighter.net/">Jacqui Maher</a>&#8216;s presentation at CUSEC, and I decided to attend not really knowing what to expect. It turned out that there were six projects to tackle, and I tried to help with the <a href="http://code.google.com/p/ccmts/">machine translation project</a>.</p>
<p>The idea was to provide an easily accessible translator for people on the ground. At the time the project started there was no Google Translate project that worked back and forth between for English and Haitian Creole. I think it was Chris that got a translator working based on moses after it&#8217;d been fed a corpus of every piece of Creole that he could get his hands on. The CCTO team&#8217;s job was to put together a web front end, and an API.</p>
<p>We were asked to write in python. There was no binding for the frontend, but Google had just made their Creole translator accessible. For testing purposes, we&#8217;re using their AJAX frontend. After a couple false starts with mod_python and Django, Brian and Kevin rewrote using the Twisted framework. It&#8217;s a little more obscure but it&#8217;s going to be easier to plug in other mediums like SMS.</p>
<p>We did in eight hours what a more organized team could&#8217;ve done in one. It&#8217;s hard to feel like I contributed anything other than two false starts and a bit of test code, but I&#8217;m still glad I went. I got to participate in creating what I think will be useful on the ground, even if I didn&#8217;t add much traction. At the very least I got to learn what it feels like to have a deliverable and a deadline but no spec.</p>
]]></content:encoded>
			<wfw:commentRss>http://imaddicted.ca/dev/crisiscampto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Worthwhile vim tips</title>
		<link>http://imaddicted.ca/dev/worthwhile-vim-tips/</link>
		<comments>http://imaddicted.ca/dev/worthwhile-vim-tips/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 07:12:46 +0000</pubDate>
		<dc:creator>lance_</dc:creator>
				<category><![CDATA[dev]]></category>

		<guid isPermaLink="false">http://imaddicted.ca/?p=594</guid>
		<description><![CDATA[David Wolever is the man who made me productive in vim. Not from the ground up, mind you. I already knew the basics from my internship like how to swap between modes. I&#8217;d internalized that each string of keystrokes forms a command with a verb[0] and, if applicable, movement keys. It was enough to use [...]]]></description>
			<content:encoded><![CDATA[<p>David Wolever is the man who made me productive in vim. Not from the ground up, mind you. I already knew the basics from my internship like how to swap between modes. I&#8217;d internalized that each string of keystrokes forms a command with a verb<sup>[0]</sup> and, if applicable, movement keys. It was enough to use as a lowest common denominator if I had to edit a configuration file on a server but I was fooling myself by thinking I knew enough to use it as a <a class="zem_slink" title="Integrated development environment" rel="wikipedia" href="http://en.wikipedia.org/wiki/Integrated_development_environment">development environment</a>.</p>
<p>Here he puts into writing <a href="http://blog.codekills.net/archives/63-You-and-Your-Editor-The-Bare-Minimum-You-Should-Be-Doing-1-of-N.html">the same tips he gave me last year</a> when taking an operating systems course together. (It was the first time I had to use vim on a project of a considerable size.)</p>
<blockquote>
<div><span> </span></p>
<div>
<p>It&#8217;s come up a few times, so I&#8217;ll just go and post it here: the things, in no particular order, I believe to be the bare minimum you should be able to do while you&#8217;re editing source code (and how to do them in Vim): [Easily move between files, jump-to-definition, and search for/highlight the current word.]</p></div>
</div>
</blockquote>
<p>The first two tips on movement between files, and jumping to function definitions are the most important and have turned vim from small project editor (like, oh, university assignments excepting the operating systems course) to an editor that I can use on moderately sized projects. It doesn&#8217;t take that much practice to use the :tag command but I still fumble when using the hjkl movement keys. David was right to encourage me to use them over the arrow keys, though, as it&#8217;s the convention used in just about all of the vim commands.</p>
<p>In the same spirit here&#8217;s a couple things that I wish someone told me about while I was still an intern, using vim to edit config files because it was the only thing available on those Solaris boxes. They&#8217;re basic where David&#8217;s tips are intermediate, but they&#8217;re also essential:</p>
<h3>Know your movement keys</h3>
<p>And not just hjkl or the arrow keys. Vim likes to have upper and lowercase characters mean different things but it doesn&#8217;t always hold in the case of movement keys. Know that &#8220;b&#8221; goes to the beginning of a word and &#8220;e&#8221; goes to the end of the word. Meanwhile, &#8220;g&#8221; goes to the beginning of the document and &#8220;G&#8221; goes to the end of the document. These can be combined with commands like delete. The [t]ill movement key is especially helpful there, and I often find myself typing &#8220;dt(&#8221; which means &#8220;delete until the ( character.&#8221; Lastly, you can easily jump to a specific line number mentioned in the trace by prefixing it with a colon, so skip to line 13 with :13.</p>
<h3>Use set</h3>
<p>Even today half the time that I use vim it&#8217;s on someone else&#8217;s machine. The easiest way to turn on line numbering is to type &#8220;:set number&#8221; which will toggle it on. To toggle it off you use &#8220;:set nonumber&#8221;. There&#8217;s no meddling with someone&#8217;s .vimrc this way and it won&#8217;t persist, so no worries about upsetting anyone&#8217;s preferences.</p>
<p>Similarly, you can use set to change values of settings, like change the tabstop to five spaces with &#8220;:set tabstop=5&#8243;. This is especially useful when editing someone else&#8217;s python files where they use a different tabstop than you, and you don&#8217;t want to permanently change your tabstop but just want to edit their file.</p>
<h3>String search and replace</h3>
<p>Okay, now you&#8217;ve got line numbering on, so you can do a search and replace. It works based on the string search and replace regular expression. You have to specify a range, but there&#8217;s a convenient shorthand for a range of the entire file.</p>
<p>For lines 5-15 inclusive, you can replace &#8220;fizz&#8221; with &#8220;buzz&#8221; by:</p>
<p>:5,15 s/fizz/buzz/g</p>
<p>And to replace fizz with buzz on the entire file, use:</p>
<p>:% s/fizz/buzz/g</p>
<p>Using the regular expression here can be quite powerful, so if you&#8217;re not aware then I suggest you read up on it. If not, know that the s denotes string search and replace, the first thing between the slashes (fizz) is what you&#8217;re replacing, the second (buzz) is what you&#8217;re replacing it with, and the &#8220;g&#8221; means that you&#8217;re doing a &#8220;replace all.&#8221; Remove the trailing &#8220;g&#8221; if you only want to replace the first instance from the cursor.</p>
<p>And it&#8217;s not related to vim, but you can do a string search and replace on several files by using a command similar to:</p>
<p>perl -pi -e &#8220;s/string_to_replace/string_to_replace_with/g&#8221; *.conf</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://zzzoot.blogspot.com/2009/07/emacs-mode-and-learning-modes.html">Emacs &#8216;mode&#8217; and learning `modes`</a> (zzzoot.blogspot.com)</li>
</ul>
<p><sup>[0]</sup> Wincent.com has <a href="https://wincent.com/blog/10-minutes-with-vim">a writeup that includes similar observations</a>, and contrasts to <a class="zem_slink" title="Emacs" rel="homepage" href="http://www.gnu.org/software/emacs/">Emacs</a>.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/1768ccac-669c-4e64-a95e-a5e7b975a90c/"><img class="zemanta-pixie-img" style="border: medium none ; float: right;" src="http://img.zemanta.com/reblog_c.png?x-id=1768ccac-669c-4e64-a95e-a5e7b975a90c" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://imaddicted.ca/dev/worthwhile-vim-tips/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

