<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.1" -->
<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:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>HunterDavis.com</title>
	<link>http://hunterdavis.com</link>
	<description>3.0!</description>
	<pubDate>Mon, 28 Jul 2008 15:06:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
	<language>en</language>
		<!-- podcast_generator="podPress/8.8" -->
		<copyright>&#xA9; </copyright>
		<managingEditor>hunter@hunterdavis.com ()</managingEditor>
		<webMaster>hunter@hunterdavis.com()</webMaster>
		<category></category>
		<ttl>1440</ttl>
		<itunes:keywords></itunes:keywords>
		<itunes:subtitle></itunes:subtitle>
		<itunes:summary>3.0!</itunes:summary>
		<itunes:author></itunes:author>
		<itunes:category text="Society &amp; Culture"/>
		<itunes:owner>
			<itunes:name></itunes:name>
			<itunes:email>hunter@hunterdavis.com</itunes:email>
		</itunes:owner>
		<itunes:block>No</itunes:block>
		<itunes:explicit>no</itunes:explicit>
		<itunes:image href="http://hunterdavis.com/wp-content/plugins/podpress/images/powered_by_podpress_large.jpg" />
		<image>
			<url>http://hunterdavis.com/wp-content/plugins/podpress/images/powered_by_podpress.jpg</url>
			<title>HunterDavis.com</title>
			<link>http://hunterdavis.com</link>
			<width>144</width>
			<height>144</height>
		</image>
		<item>
		<title>Food (and diet) management for the unix geek, a python script</title>
		<link>http://hunterdavis.com/archives/24</link>
		<comments>http://hunterdavis.com/archives/24#comments</comments>
		<pubDate>Mon, 14 Jul 2008 22:39:05 +0000</pubDate>
		<dc:creator>hunter</dc:creator>
		
		<category><![CDATA[Automation and Robotics]]></category>

		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Programs]]></category>

		<guid isPermaLink="false">http://hunterdavis.com/archives/24</guid>
		<description><![CDATA[For many a scientist like myself, the pear-shaped waistline which has become synonymous with the unix guru has become all too familiar.  While there are a number of mitigating factors, I&#8217;m going to chalk it up to the sedentary lifestyle of the typical programmer.  A study posted on Digg last week showed that [...]]]></description>
			<content:encoded><![CDATA[<p>For many a scientist like myself, the pear-shaped waistline which has become synonymous with the unix guru has become all too familiar.  While there are a number of mitigating factors, I&#8217;m going to chalk it up to the sedentary lifestyle of the typical programmer.  A study posted on Digg last week showed that on average, dieters who kept a food journal lose twice as much weight as those who don&#8217;t.  That&#8217;s a pretty powerful tool.  Carrying around a notepad doesn&#8217;t make a lot of sense for me, as I&#8217;m almost never without my laptop, so I&#8217;ve been keeping a csv spreadsheet like below:<br />
<code><br />
07:53 ,oatmeal        , 160<br />
07:55 ,water          , 000<br />
10:40 ,kudos          , 100<br />
10:40 ,water          , 000<br />
</code><br />
Which is fine.  It accomplishes what needs to be accomplished, with regards to the diary at least.  However, I would like some statistics with my diet.  How many calories do I have left in the day, how many glasses of water, how many calories did I eat at lunch, etc.  These little statistics and calculations really drive home the message.  I always keep today&#8217;s .food file on my desktop, and I have my .bashrc set up to show me my dietary information whenever I login or open a shell like so:</p>
<p><code><br />
# display how many calories I've left/eaten today<br />
echo "Remember to fill in your .food file today"<br />
echo "-----------------------------------------"<br />
~/Scripts/DotFoodStatistics.py ~/Desktop/*.food | grep today<br />
echo "-----------------------------------------"<br />
</code></p>
<p>Attached->  <a href='http://hunterdavis.com/wp-content/uploads/2008/07/dotfoodprocessing.py' title='python “food processor” diet statistics'>python “food processor” diet statistics</a> <- is the simple python script I wrote to calculate food statistics and keep track of my dietary intake:</p>
<p>As you can see it&#8217;s a very simple procedural script.  Took me all of 20 minutes for the python.  Only time will tell if the dieting is as straightforward.</p>
]]></content:encoded>
			<wfw:commentRss>http://hunterdavis.com/archives/24/feed</wfw:commentRss>
		</item>
		<item>
		<title>Half a line of shell to display to screen while compressing output&#8230; The most useful shell I&#8217;ve written in forever</title>
		<link>http://hunterdavis.com/archives/23</link>
		<comments>http://hunterdavis.com/archives/23#comments</comments>
		<pubDate>Tue, 10 Jun 2008 15:11:16 +0000</pubDate>
		<dc:creator>hunter</dc:creator>
		
		<category><![CDATA[Automation and Robotics]]></category>

		<category><![CDATA[Programs]]></category>

		<guid isPermaLink="false">http://hunterdavis.com/archives/23</guid>
		<description><![CDATA[Ok, so here&#8217;s the deal.  I write a lot of C in my line of work, so when I get the chance to write some clever shell script, I relish it.  I do a lot of long supercomputer simulations, which tend to be hard to debug (especially when a problem arrises 3 days [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so here&#8217;s the deal.  I write a lot of C in my line of work, so when I get the chance to write some clever shell script, I relish it.  I do a lot of long supercomputer simulations, which tend to be hard to debug (especially when a problem arrises 3 days into a 4 day run).  This is where logfiles come in handy, I know I&#8217;m not alone in this.  Unfortunately, for really long runs these logfiles can add up to hundreds of gigs of space, which is a hard to come by commodity on supercomputing clusters.   I found numerous solutions online, all of them tending to be long and overly complex shell scripts&#8230; No thanks!, when I want something done on shell it needs to follow the shell paradigm, small and powerful.</p>
<p>The problem:<br />
I want to see the logfiles as they are created, but I also want them stored and compressed and not taking up space.</p>
<p>The solution:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
<code> | tee >(gzip > logfile.tgz) </code><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Let&#8217;s break it down one bit at a time<br />
<code> | tee </code><br />
Standard output is piped through tee, the unix t-shaped pipe, pretty much comes standard with all *nixes.  Tee has two outputs, first it outputs to a file (or file handle), and second it pipes the output to the screen.  </p>
<p><code> >() </code><br />
This right caret/parenthesis pair comes in very handy.  It opens a sub shell, leaving an implicit file handle that can be piped to.  Tee sees this as a regular file, and begins piping standard output to it.</p>
<p><code>gzip > logfile.tgz</code><br />
  Gzip defaults to standard in for the input if no file handle is given.  It uses lz77 encoding along with Huffman trees in a 32k sliding window.  Decoding data (Huffman trees) are placed at the beginning of each block.  This means </p>
<li> that it can compress iteratively</li>
<li>the CPU/memory overhead is pretty much nil.</li>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<code>| tee >(gzip > logfile.gz) </code><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Putting it all together, we pipe standard output to tee which pipes to screen as well as the implicit file handle created by the sub shell.  The sub shell is gzipping the piped standard input at maximum compression and outputting the resultant gzip file to logfile.gz.  Just pipe any huge log file through this bit of code, and you&#8217;ve taken your space requirements from gigs to megs, with virtually no cpu/memory overhead.  Handy, and fits easily into most launch scripts.</p>
]]></content:encoded>
			<wfw:commentRss>http://hunterdavis.com/archives/23/feed</wfw:commentRss>
		</item>
		<item>
		<title>Snesaver - Zsnes screen saver for linux</title>
		<link>http://hunterdavis.com/archives/20</link>
		<comments>http://hunterdavis.com/archives/20#comments</comments>
		<pubDate>Fri, 11 Jan 2008 23:15:36 +0000</pubDate>
		<dc:creator>hunter</dc:creator>
		
		<category><![CDATA[Multimedia]]></category>

		<category><![CDATA[Programs]]></category>

		<category><![CDATA[snes roms screensaver]]></category>

		<guid isPermaLink="false">http://hunterdavis.com/archives/20</guid>
		<description><![CDATA[Ok, so here&#8217;s  a fun bit of perl code I wrote last night.   It&#8217;s called snesaver, and you can download it here.  Here&#8217;s how it works,
1.  You&#8217;ll need to be running some flavor of *nix (self=ubuntu), with perl installed
2.  You&#8217;ll need to have xscreensaver set up as your screensaver [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so here&#8217;s  a fun bit of perl code I wrote last night.   It&#8217;s called snesaver, <a href="http://www.hunterdavis.com/snesaver.pl" title="snesaver - snes screen saver">and you can download it here</a>.  Here&#8217;s how it works,</p>
<p>1.  You&#8217;ll need to be running some flavor of *nix (self=ubuntu), with perl installed<br />
2.  You&#8217;ll need to have xscreensaver set up as your screensaver (though it should be simplicity itself to do this for most any other screensaver)<br />
3.  You&#8217;ll need to have zsnes installed<br />
4.  You&#8217;ll have to supply your own roms (legality), and record your own rom state movies in zsnes (simple simple!)</p>
<p>And that&#8217;s about all you&#8217;ll need.  Just open up your ~/.xscreensaver file and put an entry for snesaver.pl (should be in your path) under the &#8220;programs&#8221; section.  Then edit the script to point to /your/rom/directory/structure/ and you&#8217;re all set.</p>
<p>Here&#8217;s a youtube video of it in action.</p>
<p><object width="425" height="355">
<param name="movie" value="http://www.youtube.com/v/46vB8-7PLLY&#038;rel=1"></param>
<param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/46vB8-7PLLY&#038;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p>
<p>/H</p>
]]></content:encoded>
			<wfw:commentRss>http://hunterdavis.com/archives/20/feed</wfw:commentRss>
		</item>
		<item>
		<title>Easy Execution Library - c++ class library for spawning processes</title>
		<link>http://hunterdavis.com/archives/19</link>
		<comments>http://hunterdavis.com/archives/19#comments</comments>
		<pubDate>Sun, 30 Dec 2007 18:11:23 +0000</pubDate>
		<dc:creator>hunter</dc:creator>
		
		<category><![CDATA[Programs]]></category>

		<guid isPermaLink="false">http://hunterdavis.com/archives/19</guid>
		<description><![CDATA[       	Easy Execute - An extremely easy to use C++ library for spawning processes and executing arbitrary commands.
This library is intended for developers who wish to simply execute some command, without worrying about the underlying
fork/exec/system calls,  string parsing, setting up timers, recording the run time of the command, [...]]]></description>
			<content:encoded><![CDATA[<p>       	Easy Execute - An extremely easy to use C++ library for spawning processes and executing arbitrary commands.<br />
This library is intended for developers who wish to simply execute some command, without worrying about the underlying<br />
fork/exec/system calls,  string parsing, setting up timers, recording the run time of the command, etc.  <a href="http://www.hunterdavis.com/easyexecute.zip" title="Easy Execute Library">This library<br />
makes it all completely plug and play</a>.  GPLv3.</p>
<table>
<tr>
<td>Author</td>
<td>Hunter Davis <a href="mailto:hunter@hunterdavis.com">email</a></td>
</tr>
<tr>
<td>Operating Systems Supported</td>
<td>Linux, Unix, OSX, Cygwin, any POSIX type system</td>
</tr>
<tr>
<td>Included with Application</td>
<td>C++ class definition and header, examples</td>
</tr>
<tr>
<td>Target Audience</td>
<td>Begining developers, any developer who does not wish to involve themselves with mid to low level process code, timing code, etc.</td>
</tr>
<tr>
<td>ScreenShot</td>
<td>N/A</td>
</tr>
<tr>
<td>Documentation</td>
<td>Included with archive.  Driver program/unit tests also included</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://hunterdavis.com/archives/19/feed</wfw:commentRss>
		</item>
		<item>
		<title>Casey on youtube!</title>
		<link>http://hunterdavis.com/archives/18</link>
		<comments>http://hunterdavis.com/archives/18#comments</comments>
		<pubDate>Fri, 28 Dec 2007 22:35:29 +0000</pubDate>
		<dc:creator>hunter</dc:creator>
		
		<category><![CDATA[Multimedia]]></category>

		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://hunterdavis.com/archives/18</guid>
		<description><![CDATA[I&#8217;ve uploaded a video to youtube of casey (my pointer hound) doing some tricks.  Fun!



]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve uploaded a video to youtube of casey (my pointer hound) doing some tricks.  Fun!</p>
<p><object width="425" height="355">
<param name="movie" value="http://www.youtube.com/v/-Cku26l_Bfw&#038;rel=1"></param>
<param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/-Cku26l_Bfw&#038;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://hunterdavis.com/archives/18/feed</wfw:commentRss>
		</item>
		<item>
		<title>Re-Writing the laser pointer paint program (image processing) in C/C++ - 10x speed improvement</title>
		<link>http://hunterdavis.com/archives/17</link>
		<comments>http://hunterdavis.com/archives/17#comments</comments>
		<pubDate>Wed, 19 Dec 2007 23:45:02 +0000</pubDate>
		<dc:creator>hunter</dc:creator>
		
		<category><![CDATA[Automation and Robotics]]></category>

		<guid isPermaLink="false">http://hunterdavis.com/archives/17</guid>
		<description><![CDATA[  This should significantly increase our capture and processing speed. First, install libcv1 in ubuntu, I like to get the documentation and python bindings as well, and these will install libcv1 anyway.  sudo aptitdue install python-cv opencv-doc  Now we&#8217;ll start writing some C code. As I have the benefit of writing this [...]]]></description>
			<content:encoded><![CDATA[<p>  This should significantly increase our capture and processing speed. First, install libcv1 in ubuntu, I like to get the documentation and python bindings as well, and these will install libcv1 anyway. <code> sudo aptitdue install python-cv opencv-doc </code> Now we&#8217;ll start writing some C code. As I have the benefit of writing this article after the code, I know that one can render/display 30fps without processing, and can render/display without lag with processing as well (thank you compiled code!). You can compile opencv code in linux using the following command:</p>
<p><code>gcc `pkg-config --cflags opencv` `pkg-config --libs opencv` -o MY_PROJECT_RUNME MY_PROJECT.cpp</code></p>
<p>Well that&#8217;s simple enough.  The structure of the program has a few changes.</p>
<ol>
<li>Program takes first command line argument as the image filter size (try 2-10 for good results)</li>
<li>Program no longer does image subtraction for a mask over the image, it&#8217;s direct processing now</li>
<li>Program is significantly (10x) faster, depending on speed of camera frame grabs</li>
<li>Check out the openCV tutorial for grabbing images from a camera, then check out the code below..</li>
<li>You can snag it <a href="http://www.hunterdavis.com/cam.cpp">here</a></li>
<li>Also, please note that &#8216;escape&#8217; will end the loop and finish the program</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://hunterdavis.com/archives/17/feed</wfw:commentRss>
		</item>
		<item>
		<title>Home Automation + Gmail in Ubuntu</title>
		<link>http://hunterdavis.com/archives/16</link>
		<comments>http://hunterdavis.com/archives/16#comments</comments>
		<pubDate>Wed, 19 Dec 2007 23:41:21 +0000</pubDate>
		<dc:creator>hunter</dc:creator>
		
		<category><![CDATA[Automation and Robotics]]></category>

		<guid isPermaLink="false">http://hunterdavis.com/archives/16</guid>
		<description><![CDATA[ Ok, now that we have a working home automation server setup (see article 1), let&#8217;s plug in a lamp module and have it flash when our gmail arrives. First up, plug in the light module, select your house code (&#8217;heyu info&#8217; will tell you your house code) and an unused x10 number on the [...]]]></description>
			<content:encoded><![CDATA[<p> Ok, now that we have a working home automation server setup (see article 1), let&#8217;s plug in a lamp module and have it flash when our gmail arrives. First up, plug in the light module, select your house code (&#8217;heyu info&#8217; will tell you your house code) and an unused x10 number on the dial.<br />
Find a lamp you&#8217;d like to have flash (or turn on, or dim etc etc) and plug it into any other outlet. Turn on the lamp, you want to be sure the light is actually on before you start cursing at your x10 module. Now plug the &#8216;on&#8217; light into the x10 module. Let&#8217;s try turning on the module with a heyu on A3 Where A is your house code and 3 is your module number. Voila, you should have light. a quick heyu off A3 will get us back to the off state. There are many heyu options (dimming !) to try out, but they all work in this manner. Now, let&#8217;s install gmail-notify with a sudo aptitude install gmail-notify Gmail notify is a great python script to notify you when you have gmail. We will insert an execute command into the python code (very simple) so when gmail-notify runs and we have an unread email, flash the light (or dim the light, or turn on your lava lamp, etc.)</p>
<p>Fire up your favorite editor (I prefer vim, but most guides prefer nano) sudo nano /usr/lib/gmail-notify/notifier.py Now head down to line 208 (it was 208 as of 9/07). You are looking for this block of code: if attrs[1]&gt;0: print str(attrs[1])+&#8221; new messages&#8221; We will change it to: if attrs[1]&gt;0: path = &#8216;/usr/bin/gmflash.sh&#8217; os.system(path) #execute gmflash print str(attrs[1])+&#8221; new messages&#8221; What we&#8217;ve done is told gmail-notify to execute the script /usr/bin/gmflash.sh when there is new gmail. Now we&#8217;ll need to create this script with a sudo nano /usr/bin/gmflash.sh Here we&#8217;ll tell the x10 light to flash on, then off. It takes my x10 module 1 second to deactivate a light and 1 seconds to activate one. It takes my light 2 seconds to &#8216;warm up&#8217; to bright. We&#8217;ll want our script to pause for at least (1 + cycle time + bulb time) seconds, so in my case that&#8217;s 4. Insert into your editor window: heyu on A3 sleep 4 heyu off A3 Save it, close it, and make it executable with: sudo chmod +x /usr/bin/gmflash.sh</p>
<p>That&#8217;s all there is to it. Fire up gmail-notify, put in your gmail settings, and send yourself a test email to check. If your light doesn&#8217;t flash, try executing /usr/bin/gmflash.sh. If this doesn&#8217;t work, time to re-check your setup. Fin.</p>
]]></content:encoded>
			<wfw:commentRss>http://hunterdavis.com/archives/16/feed</wfw:commentRss>
		</item>
		<item>
		<title>Using scilab video processing toolbox and a laser pointer to &#8220;paint&#8221; a scene in realtime.</title>
		<link>http://hunterdavis.com/archives/15</link>
		<comments>http://hunterdavis.com/archives/15#comments</comments>
		<pubDate>Wed, 19 Dec 2007 23:36:53 +0000</pubDate>
		<dc:creator>hunter</dc:creator>
		
		<category><![CDATA[Automation and Robotics]]></category>

		<guid isPermaLink="false">http://hunterdavis.com/archives/15</guid>
		<description><![CDATA[A little tic/toc ery has shown that without an image draw scilab can process 3 fps.  So here&#8217;s  	a loop unrolled version that delays image rendering till 3 dots have been drawn.
//&#8221;paint&#8221; a scene with a laser pointer in realtime
//speed of update depends on speed of camera + processor
//could also easily be used [...]]]></description>
			<content:encoded><![CDATA[<p>A little tic/toc ery has shown that without an image draw scilab can process 3 fps.  So here&#8217;s  	a loop unrolled version that delays image rendering till 3 dots have been drawn.<br />
//&#8221;paint&#8221; a scene with a laser pointer in realtime<br />
//speed of update depends on speed of camera + processor</p>
<p>//could also easily be used on a video file</p>
<p>n = camopen();</p>
<p>for idx=1:15,</p>
<p>//give the camera time to auto white balance</p>
<p>im1=avireadframe(n);</p>
<p>end;</p>
<p>im3prime = rgb2gray(im1);</p>
<p>//save our &#8220;primary scene&#8221;</p>
<p>im3 = im3prime;			 imshow(im3);</p>
<p>//show us our primary scene</p>
<p>r=x_message([&#8217;Baseline Set&#8217;],[&#8217;Ok&#8217;]);</p>
<p>//let us know when to laser pointer</p>
<p>for ido=1:15, 	mask = zeros(im3);</p>
<p>//clear out our mask quickly</p>
<p>for idx=1:3,</p>
<p>//or however many frames/sec you can process</p>
<p>//tic;</p>
<p>im2=avireadframe(n);</p>
<p>//read a frame in</p>
<p>//subtract the greyscale current image from the primary scene</p>
<p>//then take that logical array, convert to numerical and</p>
<p>//use it as a mask over im3</p>
<p>mask = mask + bool2s(imsubtract(rgb2gray(im2), im3prime) &gt; 50);</p>
<p>//imshow(im3);</p>
<p>//toc</p>
<p>end;</p>
<p>im3(mask == 1) = 255;</p>
<p>imshow(im3);</p>
<p>end;</p>
<p>avicloseall();</p>
]]></content:encoded>
			<wfw:commentRss>http://hunterdavis.com/archives/15/feed</wfw:commentRss>
		</item>
		<item>
		<title>Installing scilab and the scilab image and video processing toolbox in ubuntu linux.</title>
		<link>http://hunterdavis.com/archives/14</link>
		<comments>http://hunterdavis.com/archives/14#comments</comments>
		<pubDate>Wed, 19 Dec 2007 23:36:03 +0000</pubDate>
		<dc:creator>hunter</dc:creator>
		
		<category><![CDATA[Automation and Robotics]]></category>

		<guid isPermaLink="false">http://hunterdavis.com/archives/14</guid>
		<description><![CDATA[For some time now I&#8217;ve been into computer vision.  However, much of computer vision is done  			  on matlab, a 1000$ piece of software that doesn&#8217;t jive with my open source philosophy.  Luckily, 			  there are a number of open source alternatives.  I prefer scilab, though octave is a [...]]]></description>
			<content:encoded><![CDATA[<p>For some time now I&#8217;ve been into computer vision.  However, much of computer vision is done  			  on matlab, a 1000$ piece of software that doesn&#8217;t jive with my open source philosophy.  Luckily, 			  there are a number of open source alternatives.  I prefer scilab, though octave is a good alternative. 			  However, scilab has the advantage of an open source video toolbox.  In this first 			   article, I&#8217;ll show you how to setup scilab, opencv (the intel open computer vision library),  			   and the sivp toolbox.  Then we&#8217;ll verify its working by processing video from an avi file  			   or in this case, a live webcam stream.</p>
<ol>
<li>First, lets start by installing scilab and preparing our system to compile ffmpeg and opencv</li>
<p><code>sudo aptitude install scilab</code></p>
<li>Now follow <a href="http://dircweb.king.ac.uk/reason/opencv_cvs.php#Feisty">this</a> guide to get opencv and ffmpeg compiled. Remember to make sure ffmpeg, v4l, and v4l2 are compiled options, or we&#8217;ll be unable to process video, webcam, or newer webcam video</li>
<li>Now head on over to the SIVP <a href="http://sivp.sourceforge.net/doc.php">webpage</a> and follow 				the typical <code>./configure &amp;&amp; make &amp;&amp; sudo make install</code></li>
<li>At this point we should have video streaming in scilab.  Fire up scilab from the command line <code>scilab</code></li>
<li>Here, we&#8217;ll want to make sure the video/image toolbox is loaded. Hit the toolbox menu, then the sivp toolbox. You should get a message about it being loaded</li>
<li>Now, hit the examples button, and make sure your main scilab window stays open. From here click the sivp section, and we can grab straight from a videocam, image, video etc.</li>
<li>The best part about the examples is the (very simple) code is displayed in your main scilab window, very cool!</li>
</ol>
<p>From here the sky is the limit!</p>
]]></content:encoded>
			<wfw:commentRss>http://hunterdavis.com/archives/14/feed</wfw:commentRss>
		</item>
		<item>
		<title>Building a completely automated, web/ssh/vnc controlled, home automation server from a clamshell ibook (with a faulty cd drive) and 10$ worth of electronics</title>
		<link>http://hunterdavis.com/archives/13</link>
		<comments>http://hunterdavis.com/archives/13#comments</comments>
		<pubDate>Wed, 19 Dec 2007 23:33:24 +0000</pubDate>
		<dc:creator>hunter</dc:creator>
		
		<category><![CDATA[Automation and Robotics]]></category>

		<guid isPermaLink="false">http://hunterdavis.com/archives/13</guid>
		<description><![CDATA[Ok, so i&#8217;ve got this old clamshell ibook.  The main weakness of these models was the screen, a paltry 800&#215;600 resolution.   				The main sweetness of the project:

 				Control your house lights from your phone, any web browser, any ssh client, etc
 				Automate your lights, run complex temperature analysis and face detection.
 				Run [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so i&#8217;ve got this old clamshell ibook.  The main weakness of these models was the screen, a paltry 800&#215;600 resolution.   				The main sweetness of the project:</p>
<blockquote>
<li> 				Control your house lights from your phone, any web browser, any ssh client, etc</li>
<li> 				Automate your lights, run complex temperature analysis and face detection.</li>
<li> 				Run ubuntu linux, fully support all hardware functions on ppc architecture, failsafe in case of power failure .</li>
<li> 				Dns forwarding from easy to remember address.</li>
<li> 				Future development: laser calibration.</li>
</blockquote>
<p align="left">Ok, first thing&#8217;s first, what will we need?<br />
1. ibook clamshell<br />
2. 1x usb-&gt;serial adapter (~1$)<br />
3. 1x x-10 heyu compatible adapter (~10$ ebay)<br />
4. whatever x10 controllers you&#8217;d like (lights, power outlets) cheap on ebay<br />
5. any old usb camera should work (firewire maybe? stay tuned!)<br />
The ibook has the following specs, but any computer ~ these specs would be fine:<br />
366mz g3 ppc proc.<br />
368mb ram<br />
10gb hdd<br />
800&#215;600 lcd<br />
1x usb 1.1 port<br />
1x firewire port<br />
Ok first of all, let&#8217;s get linux installed on here. Because the cd-rom drives tend to die in these units, this was the case here. The solution was to burn an ~12mb iso image to a cd - The ubuntu mini ppc.iso image, and keep retrying this boot disk till the laptop booted the cd (about 20 tries). You could also use any other macbook in firewire host mode (check the mac forums for that). The feisty image (works great!, install xubuntu) supports the airport card and the Ethernet port naively, so that was nice. Remember to hold the &#8216;c&#8217; key on your mac to boot from the cdrom.</p>
<p align="left">&nbsp;</p>
<p align="left">While you have that running, let&#8217;s do some multitasking. First head over to dyndns and get yourself a dns forwarding address (if you don&#8217;t want to have to remember your constantly changing ip address). While you&#8217;re at the site, check out their guide to inadyn, some cool open source software to update dyndns with your dynamic ip. Also, if you have a router, make sure to forward the ports for whatever services you want (20-25 ssh, telnet, ping etc, 80 or 8080 etc for web, 5090-5092 vnc, etc)</p>
<p align="left">&nbsp;</p>
<p align="left">Ok so at this point we&#8217;ve got an ibook running xubuntu feisty, let&#8217;s install some packages.  We&#8217;ll want to:<br />
Rock open a terminal and break out your su hat. sudo aptitude install the following packages and the firewall software of your choice.<br />
openssh-server //this is if you want ssh access to your machine<br />
inadyn			//this will automatically update your dydns<br />
tightvnc-server //if you&#8217;re into vnc<br />
gnome-power-preferences, gnome-power-settings //easy power profiles (i.e. close the lid, blank the screen)</p>
<p align="left">&nbsp;</p>
<p align="left">Now it&#8217;s time to plug in you usb-&gt;serial adapter. I broke down and paid 5$ on ebay for one, but I&#8217;ve seen them locally for about 1$. In a terminal, cat /var/log/messages, and look for lines like &#8216;usb 1-1, pl2303 (or your chipset) converter now attached to ttyUSB0&#8242;. This is your new serial port, and what you&#8217;ll specify to hey-u (software to control your serial port controlled x-10 power line controller). Now go download hey-u. In terminal, run the whole configure/make/sudo make install shebang. The install is pretty user friendly, and they ask you for your serial port (which we got earlier from /var/log/messages). Time to try &#8216;heyu info&#8217; Fingers crossed&#8230;<br />
It works!</p>
<p align="left">&nbsp;</p>
<p align="left">It should be immediately apparent if your device is found, you&#8217;ll get firmware info as well.</p>
<p align="left">&nbsp;</p>
<p align="left">At this point things are coming together. We&#8217;ve got remote access from any ssh capable device to a command line interface to all the x10 power devices in our house. Next up, if you have a way to get jar files onto your phone, or your phone has a browser, I highly recommend midpssh from <a href="http://www.xk72.com/midpssh/">here</a>.</p>
<p align="left">&nbsp;</p>
<p align="left">At this point the sky is the limit, but first thing I recommend is installing a web frontend to hey-u like the one 			found <a href="http://domus.link.co.pt/screenshots/">here</a>.  So for this, we&#8217;ll need apache and php.  So get your fix with a  &#8217;sudo tasksel install lamp-server&#8217;. 			I also recommend that right after installing apache, you &#8217;sudo touch /var/www/index.html&#8217;, so your web directory isn&#8217;t open.	 			How about a fusion of web/ssh access?<br />
I recommend grabbing the isnetwork release of mindterm 			ssh for java applet from <a href="http://downloads.planetmirror.com/pub/hobbes/java/apps/isnetworksmindterm1.2.1scp3.zip">here</a><br />
Just move everything in the applet directory in the zip into a folder on your website, change the netscape.html to index.html, 			and you&#8217;ve got an ssh client available from any computer that has java.  Sweet.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://hunterdavis.com/archives/13/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
