<?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>sfpeter.com</title>
	<atom:link href="http://www.sfpeter.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sfpeter.com</link>
	<description>must have blog.</description>
	<lastBuildDate>Fri, 31 Aug 2012 17:46:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>Why is Time Machine backing up gigabytes of data every hour?</title>
		<link>http://www.sfpeter.com/2012/08/why-is-time-machine-backing-up-gigabytes-of-data-every-hour/</link>
		<comments>http://www.sfpeter.com/2012/08/why-is-time-machine-backing-up-gigabytes-of-data-every-hour/#comments</comments>
		<pubDate>Thu, 30 Aug 2012 17:15:55 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.sfpeter.com/?p=112</guid>
		<description><![CDATA[This has been bothering me for a while&#8230; I hardly change any files on my system, but every hour when<a href="http://www.sfpeter.com/2012/08/why-is-time-machine-backing-up-gigabytes-of-data-every-hour/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>This has been bothering me for a while&#8230; I hardly change any files on my system, but every hour when Time Machine runs it somehow determines that 7 gigs of data has changed. Time Machine is ok for what it is, it&#8217;s biggest strength is probably ease of use. But it gives you no insight into what it&#8217;s copying exactly when it&#8217;s pushing gigabytes of data to my network backup.<br />
As it turns out, there&#8217;s a handy little tool that tells you exactly what&#8217;s changed with your latest backup.</p>
<p><a title="Timedog" href="http://code.google.com/p/timedog/" target="_blank">Timedog</a> will tell you exactly which directories were backed up and how much data they represented. For me, the culprit turned out to be my Thunderbird mail client. It stores all email for a mailbox into a single flat file, and some of my mailboxes are gigabytes in size. Every new message I receive is causing the entire mailbox to get backed up again, eating up all my available backup storage pretty quickly.</p>
<p>Now that I figured it out, fixing this was pretty easy: simply put an exclude filter in Time Machine preferences to ignore any changes in my Thunderbird folder. All of my email is stored in my Gmail so it&#8217;s already in 2 places anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sfpeter.com/2012/08/why-is-time-machine-backing-up-gigabytes-of-data-every-hour/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting grayscale PNG to RGB PNG</title>
		<link>http://www.sfpeter.com/2012/06/converting-grayscale-png-to-rgb-png/</link>
		<comments>http://www.sfpeter.com/2012/06/converting-grayscale-png-to-rgb-png/#comments</comments>
		<pubDate>Fri, 15 Jun 2012 05:13:06 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.sfpeter.com/?p=83</guid>
		<description><![CDATA[Today I needed to convert a transparent Grayscale PNG image to the same format, but in the RGB color space.<a href="http://www.sfpeter.com/2012/06/converting-grayscale-png-to-rgb-png/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>Today I needed to convert a transparent Grayscale PNG image to the same format, but in the RGB color space. (some processing software that we use cannot handle grayscale transparent PNGs for some reason.)</p>
<p>Ultimately this is what worked for me. I was only able to figure this out through several hours of experimenting with ImageMagick options, so I hope this will help someone. </p>
<pre class="brush:shell">
  convert in.png -type TrueColorMatte -define png:color-type=6 out.png
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sfpeter.com/2012/06/converting-grayscale-png-to-rgb-png/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to win the Mega Millions lottery</title>
		<link>http://www.sfpeter.com/2012/05/how-to-win-the-mega-millions-lottery/</link>
		<comments>http://www.sfpeter.com/2012/05/how-to-win-the-mega-millions-lottery/#comments</comments>
		<pubDate>Tue, 15 May 2012 18:14:45 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.sfpeter.com/?p=54</guid>
		<description><![CDATA[I&#8217;ve ignored my blog for several years so it&#8217;s time for a blog revival&#8230; I&#8217;m planning on sharing some of<a href="http://www.sfpeter.com/2012/05/how-to-win-the-mega-millions-lottery/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve ignored my blog for several years so it&#8217;s time for a blog revival&#8230; I&#8217;m planning on sharing some of the recent lessons I&#8217;ve learned in Ruby on Rails development. For today, let&#8217;s keep it simple. Here&#8217;s my Ruby one-liner that will help you win the Mega Millions lottery:</p>
<pre class="brush:ruby">
a=[];until(a.length==5);n=1+rand(56);a&lt;&lt;n if(!a.include?(n));end;puts "your numbers are #{a.sort*','} and Mega Ball #{1+rand(46)}"
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sfpeter.com/2012/05/how-to-win-the-mega-millions-lottery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pixel Peeper</title>
		<link>http://www.sfpeter.com/2009/02/pixel-peeper/</link>
		<comments>http://www.sfpeter.com/2009/02/pixel-peeper/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 08:53:56 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[photography]]></category>
		<category><![CDATA[sites]]></category>

		<guid isPermaLink="false">http://www.sfpeter.com/2009/02/18/pixel-peeper/</guid>
		<description><![CDATA[If you&#8217;re like me and somewhat serious about photography, you probably research your lenses and cameras before you buy them.<a href="http://www.sfpeter.com/2009/02/pixel-peeper/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re like me and somewhat serious about photography, you probably research your lenses and cameras before you buy them. While I&#8217;m eagerly waiting for my new Panasonic LX3 to arrive, I was browsing around a bit to see what other LX3 owners have been able to produce with that camera. Not so surprisingly, I found a lot of great photos. But I also found a cool website that I wasn&#8217;t aware of until now: <a href="http://www.pixel-peeper.com/" title="Pixel Peeper" target="_blank">pixel-peeper.com</a>. It uses the Flickr API to let you search for photos made by pretty much any kind of camera or lens.<br />
Have a look and judge picture quality for yourself. Of course it&#8217;s true that a $6000 lens also typically has a better photographer behind it so comparing its photos to other random photos taken with a $100 piece of glass probably isn&#8217;t entirely fair. But it&#8217;s fun comparing anyhow.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sfpeter.com/2009/02/pixel-peeper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running the Glassfish updatetool on a remote server</title>
		<link>http://www.sfpeter.com/2008/09/glassfish-updatetool-on-remote-server/</link>
		<comments>http://www.sfpeter.com/2008/09/glassfish-updatetool-on-remote-server/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 08:25:01 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.sfpeter.com/2008/09/11/glassfish-updatetool-on-remote-server/</guid>
		<description><![CDATA[I&#8217;ve been playing around with JRuby on Rails and Glassfish and really like the simplicity of deploying simple WAR files<a href="http://www.sfpeter.com/2008/09/glassfish-updatetool-on-remote-server/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around with JRuby on Rails and Glassfish and really like the simplicity of deploying simple WAR files to a Glassfish server. Messing around with Apache configurations and managing a bunch of mongrel processes is just not my favorite pastime, plus I like to have the option of running other J2EE webapps on the same server, and interface my RoR app with existing Java libraries.</p>
<p>I ran into some problems trying to get the updatetool for Glassfish working on my VPS (at Rimuhosting) though. The updatetool is a Java Swing app and I&#8217;ve never run any GUI apps on this remote host before. It doesn&#8217;t have Gnome or KDE running so VNC was not an option. The trick is mostly just to set up your systems for running remote X11 applications over a SSH tunnel. Here&#8217;s how I got it to work&#8230;. I should say this server runs Ubuntu Hardy and locally I&#8217;m on Mac OS X so the X11 install from the Mac OS installation disks was the easy part.</p>
<p>Here&#8217;s what I had to do on the remote host:</p>
<p><span id="more-32"></span> open /etc/ssh/sshd_config and make sure you set</p>
<pre class="brush:bash">
  X11Forwarding yes</pre>
<p>in /etc/ssh/ssh_config  check that you have the following settings:</p>
<pre class="brush:bash">
  ForwardAgent yes
  ForwardX11 yes</pre>
<p>there are a few other dependencies that you may not have yet on a clean Ubuntu install. I was getting very confusing java link errors in my stacktraces until I&#8217;d installed all of them. So grab these with:</p>
<pre class="brush:bash">
  sudo apt-get install xauth libxp-java libxtst-dev libxi-dev</pre>
<p>at this point, log out and log back in with</p>
<pre class="brush:bash">
  ssh -X  yourname@yourhost</pre>
<p>The -X option is important here : it&#8217;s telling the server that you&#8217;re going to want to run a X11 application over this SSH tunnel.<br />
On my system I got the following message after logging back in:</p>
<pre class="brush:bash">
  /usr/bin/X11/xauth:  creating new authority file /root/.Xauthority</pre>
<p>that&#8217;s all. I was now able to run the Glassfish updatetool simply by calling</p>
<pre class="brush:bash">
  /var/www/glassfish/updatecenter/bin/updatetool</pre>
<p>and the application came up nicely on my Mac desktop. These steps will probably work to run just about any Java Swing application on a remote Ubuntu/Debian server.</p>
<p>I hope this helps some people&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sfpeter.com/2008/09/glassfish-updatetool-on-remote-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>new Trendnet TV-IP400W controller for Zoneminder 1.23.x</title>
		<link>http://www.sfpeter.com/2008/07/new-trendnet-tv-ip400w-controller-for-zoneminder-123x/</link>
		<comments>http://www.sfpeter.com/2008/07/new-trendnet-tv-ip400w-controller-for-zoneminder-123x/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 08:10:02 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Home Automation]]></category>

		<guid isPermaLink="false">http://www.sfpeter.com/2008/07/31/new-trendnet-tv-ip400w-controller-for-zoneminder-123x/</guid>
		<description><![CDATA[I&#8217;ve finally gotten around to rewriting my old Trendnet PTZ controller for Zoneminder 1.22.x to support the new API for<a href="http://www.sfpeter.com/2008/07/new-trendnet-tv-ip400w-controller-for-zoneminder-123x/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally gotten around to rewriting my old Trendnet PTZ controller for Zoneminder 1.22.x to support the new API for Zoneminder 1.23.x. It includes all the old features (moving the camera in horizontally, vertically, diagonally, and going to preset and home position) as well as a new bonus feature: move the camera simply by clicking a point in the live video that you want the camera to recenter on. This is not extremely accurate, but good enough for most uses, and faster than having to click an arrow 20 times.</p>
<p><iframe src="http://rcm.amazon.com/e/cm?t=sfpetercom-20&amp;o=1&amp;p=8&amp;l=as1&amp;asins=B000COC7T6&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr" style="width: 120px; height: 240px" marginwidth="0" marginheight="0" align="right" frameborder="0" scrolling="no"></iframe></p>
<p>Here&#8217;s the basic steps on how to get this Trendnet TV-IP400 / IV-IP400W driver to work in ZoneMinder: <span id="more-31"></span></p>
<ul>
<li>Make sure you have indeed version 1.23.x. You can see this in the title of the main  console window. If you are still using version 1.22.x, either <a href="http://www.zoneminder.com/downloads.html" target="_blank">upgrade</a> your ZoneMinder or <a href="http://www.sfpeter.com/2007/08/14/controlling-the-trendnet-tv-ip400w-camera-with-zoneminder/">use my old driver</a>.</li>
</ul>
<ul></ul>
<ul>
<li><a href="http://www.sfpeter.com/files/trendnet_new/TVIP400.pm" onclick="javascript: pageTracker._trackPageview('/trendnet/newdriver');" target="_blank">Download the driver file</a> here, and store it in the right directory. For me (having compiled Zoneminder from source on ubuntu) that location is /usr/local/perl/5.8.8/ZoneMinder/control.  If that location doesn&#8217;t exist on your system, you can do a search for another camera driver such as Visca.pm and store the TVIP400.pm file in the same location.</li>
</ul>
<ul>
<li>Create a new camera for your TV-IP400 if you haven&#8217;t already done so. The source tab looks something like this:</li>
</ul>
<p><img src="http://www.sfpeter.com/files/trendnet_new/source_tab.png" height="445" width="440" /><br />
Make sure you change the IP address and port number if necessary. You will need to make sure that access control is turned off by the way.</p>
<p>If you had enabled the  ZM_OPT_CONTROL setting in the system options screen, you will also see a control tab in the camera config window.  This tab should look like this:</p>
<p><img src="http://www.sfpeter.com/files/trendnet_new/control_tab.png" height="445" width="440" /></p>
<p>Again, make sure you set the correct IP address (the same as what you set in the source tab). You won&#8217;t have a TV-IP400 option yet in the Control Type dropdown, so click on &#8216;edit&#8217; there and let&#8217;s create one.</p>
<p>In the Control Capabilities window, click &#8216;Add New Control&#8217;. Then set the settings in the Main and Move tabs as follows:</p>
<p><img src="http://www.sfpeter.com/files/trendnet_new/main_tab.png" height="561" width="440" /></p>
<p><img src="http://www.sfpeter.com/files/trendnet_new/move_tab.png" height="561" width="440" /></p>
<p>In the Pan tab, only check the &#8216;Can Pan&#8217; option and leave the rest blank.<br />
In the Tilt tab, only check the &#8216;Can Tilt&#8217; option.</p>
<p>All options in the Zoom, Focus, White and Iris tabs can be left blank since none of these features are supported.</p>
<p>The Presets tab should be set as follows:</p>
<p><img src="http://www.sfpeter.com/files/trendnet_new/presets_tab.png" height="561" width="440" /></p>
<p>Though you can&#8217;t actually set presets through ZoneMinder, you can move the camera to presets that you&#8217;ve configured through the Trendnet web interface. I&#8217;m only using 5 presets but I believe you could access all 24 presets that the Trendnet supports.</p>
<p>That&#8217;s all! Save the configuration, and give your new controllable camera a spin in ZoneMinder. Let me know how you like it.</p>
<p><em>Thanks to Armando Oritz for his help in testing this driver. </em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sfpeter.com/2008/07/new-trendnet-tv-ip400w-controller-for-zoneminder-123x/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>jQuery plugin for communication between browser windows</title>
		<link>http://www.sfpeter.com/2008/03/communication-between-browser-windows-with-jquery-my-new-plugin/</link>
		<comments>http://www.sfpeter.com/2008/03/communication-between-browser-windows-with-jquery-my-new-plugin/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 06:49:08 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.sfpeter.com/2008/03/13/communication-between-browser-windows-with-jquery-my-new-plugin/</guid>
		<description><![CDATA[Ajax is great for sending data back and forth between a browser window and the server, but when it comes<a href="http://www.sfpeter.com/2008/03/communication-between-browser-windows-with-jquery-my-new-plugin/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p><em>Ajax is great for sending data back and forth between a browser window and the server, but when it comes to communication between two browser windows, there are few libraries that can help you out there. </em></p>
<p>I&#8217;ve been working with jQuery for over a year now and have always wanted to give something back to the user community by releasing my own plugin. Unfortunately it seemed like every type of generic functionality I might ever need had already been developed by others. Until last night.</p>
<p>I was working on a webapp in which my main browser window had to open a popup window, and the user would then perform an action in this window. Upon completion of that action the main (parent) browser window needed to be notified.<br />
Though parent and child window can easily access eachother&#8217;s DOM, a common way to get a value from one window to another is by setting a value on a hidden input field of a form in the other window. This requires you to add form markup to your page, which is clunky. A second issue is that if you have several types of events or data to send to the other window, you&#8217;ll need to add an input field for each type. And a third issue I ran into is that &#8216;change&#8217; events do not seem to fire for an input field if that field was updated by another window. &#8216;change&#8217; or custom events using jQuery didn&#8217;t work either this way. &#8216;click&#8217; events on links or buttons do work, but they would need to be hidden, otherwise the user could click on them too. I got it all working but this all started to look like an ugly hack, cluttering my pages with messy javascript and markup code.</p>
<p><span id="more-27"></span> Long story short, this is where my new skills of creating jQuery plugins came to the rescue.  This could all be put into a nice little plugin that would hide all the messy details of adding a form to your page and using hidden form elements to transfer data back and forth between windows. Even better, my new plugin makes it very easy to use multiple callback handlers, so you can define your own events that you can send from one browser window to the other. And events can be sent both ways in almost the same fashion. To my delight, it worked flawlessly in all browsers I&#8217;ve tried (FF, safari on Mac, and FF and IE7 on Windows).</p>
<p>Here&#8217;s how to use it:</p>
<p>In any page that needs to receive window events, make sure to call the initialization function upon page load:</p>
<pre class="brush:js">
$.initWindowMsg();</pre>
<p>The parent window can open a child window the good old way:</p>
<pre class="brush:js">
childWin = window.open('child.html', 'mychildwindow');</pre>
<p>and then send it an event with data:</p>
<pre class="brush:js">
$.triggerWindowEvent(childWin, "myevent", "some data");</pre>
<p>The child window can register a callback handler for this event as follows:</p>
<pre class="brush:js">
$.windowMsg("myevent",  function(message) {
    // do  something  with message from parent
});</pre>
<p>The child window can send a message back to the parent with:</p>
<pre class="brush:js">
$.triggerParentEvent("parentevent", "message to parent");</pre>
<p>The parent can register a handler for this event in the same way:</p>
<pre class="brush:js">
$.windowMsg("parentevent",  function(message) {
    // do  something  with message from child
});</pre>
<p>That&#8217;s all.</p>
<p><a href="/files/windowmsg/parent.html" onclick="javascript:urchinTracker('/windowmsg/demo');" target="_blank">You can see a simple demo here</a>. (make sure your popup blocker is turned off).</p>
<p><a href="/files/windowmsg/windowmsg.zip" onclick="javascript:urchinTracker('/windowmsg/download')">Download the plugin and demo files</a><br />
One thing to keep in mind is that it is of course a requirement that one of the windows opened the other, and that neither window has navigated to any other pages. Once they&#8217;ve lost the reference to eachother, there&#8217;s no reconnecting. The triggerWindowEvent and triggerParentEvent functions return a boolean which indicates if the event could be sent or not. I could pretty easily add a function that could check if the parent or child window is still there actually&#8230; will add that in the first update of the plugin.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sfpeter.com/2008/03/communication-between-browser-windows-with-jquery-my-new-plugin/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Ruby controller for the Trendnet TV-IP400W PTZ camera</title>
		<link>http://www.sfpeter.com/2008/02/ruby-controller-for-the-trendnet-ip-400w-ptz-camera/</link>
		<comments>http://www.sfpeter.com/2008/02/ruby-controller-for-the-trendnet-ip-400w-ptz-camera/#comments</comments>
		<pubDate>Fri, 29 Feb 2008 08:16:10 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[Home Automation]]></category>

		<guid isPermaLink="false">http://www.sfpeter.com/2008/02/29/ruby-controller-for-the-trendnet-ip-400w-ptz-camera/</guid>
		<description><![CDATA[I thought I’d follow up on my post of a little while ago about the drivers for the Trendnet TV-IP400W<a href="http://www.sfpeter.com/2008/02/ruby-controller-for-the-trendnet-ip-400w-ptz-camera/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>I thought I’d follow up on my post of a little while ago about the drivers for the Trendnet TV-IP400W Pan-Tilt-Zoom camera. I wrote a ruby driver for this thing, which makes it trivial to control the camera from any Ruby application. It’s just a single Ruby file, and though I’ve entertained the thought of figuring out how to pour it into a gem and publish it to the plugin repository, I’d probably only do that if there are a significant amount of people interested in using it and/or contributing to it.</p>
<p><iframe src="http://rcm.amazon.com/e/cm?t=sfpetercom-20&amp;o=1&amp;p=8&amp;l=as1&amp;asins=B000COC7T6&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr" style="width: 120px; height: 240px" marginwidth="0" marginheight="0" align="right" frameborder="0" scrolling="no"></iframe></p>
<p>As with the old Perl driver for Zoneminder (which I’ve been told doesn’t work anymore with the latest version of ZM, since the interfaces for the PTZ drivers have completely changed), this driver only controls the pan and tilt functions of the camera. Actually, you can also put it in swing mode and store or access preset positions, but none of the available functions actually do anything with the video stream. The video can simply be accessed at:</p>
<p>http://yourcam/image.jpg to grab a single frame of the current camera view<br />
http://yourcam/video.cgi to get the mjpeg stream from the camera</p>
<p>There&#8217;s no real zoom control since the cam only has a digital zoom, which I believe is implemented in the client software only (so there&#8217;s no way to actually have it stream a zoomed image to your client).</p>
<p><span id="more-26"></span>Okay, onto the example script now. The code below demonstrates how to use all the features of the camera driver.</p>
<pre class="brush:ruby">
require 'Ip400.rb'

# substitute your host IP address or name and port number here.
# If you have turned off access control, you can simply use:
# ptz = Ip400.new("192.168.0.140")
# if your camera is accessible at a port other than 80, simply
# specify the address like this: "192.168.0.140:90"
ptz = Ip400.new("192.168.0.140", "ruby", "ybur")

# go to the home position
ptz.home
sleep 3

# pan right 3 steps
ptz.pan(3, Ip400::RIGHT)
sleep 3

# pan left 5 steps
ptz.pan(5, Ip400::LEFT)
sleep 3

# tilt up 3 steps
ptz.tilt(3, Ip400::UP)
sleep 3

# tilt down 3 steps
ptz.tilt(3, Ip400::DOWN)
sleep 3

# pan and tilt at the same time
ptz.move(4, Ip400::RIGHT, 2, Ip400::DOWN)
sleep 3

# go to 1 of the 24 preset positions
ptz.goto_preset(1)
sleep 3

# visit all preset positions with about 5 second intervals
ptz.swing_preset
sleep 20
ptz.stop_swing # stop the swing mode again

# go into continuous scan mode (scan left and right with 1 second intervals)
ptz.swing_scan
sleep 10
ptz.stop_swing  # don't forget this!

# get the current absolute position of the camera
pos = ptz.abs_position
# store this position at preset 15
ptz.set_preset(pos['pan'], pos['tilt'], "myposition", 15)</pre>
<p>These examples should get even a Ruby novice going pretty quickly, and the Ip400.rb driver class can be used in or outside of a Rails app. The camera you&#8217;re controlling can be in a different room or even in a different country.<br />
I’m releasing it under the MIT license so it’s open for further hacking. If you end up using this code anywhere I’d love to hear from you, and I’ll release it as a real Ruby plugin if enough people show interest.</p>
<p>Have fun!</p>
<p><a href="http://www.sfpeter.com/files/trendnet/ip400.zip" onclick="urchinTracker('/downloadRubyDriver');">Download the above example file and the IP400.rb file</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sfpeter.com/2008/02/ruby-controller-for-the-trendnet-ip-400w-ptz-camera/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>A day in the SF eastbay</title>
		<link>http://www.sfpeter.com/2008/02/a-day-in-the-sf-eastbay/</link>
		<comments>http://www.sfpeter.com/2008/02/a-day-in-the-sf-eastbay/#comments</comments>
		<pubDate>Fri, 15 Feb 2008 21:56:40 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[sites]]></category>

		<guid isPermaLink="false">http://www.sfpeter.com/2008/02/15/a-day-in-the-sf-eastbay/</guid>
		<description><![CDATA[I love outdoor webcams, because they can give you an instant and live view of what the weather and/or a<a href="http://www.sfpeter.com/2008/02/a-day-in-the-sf-eastbay/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>I love outdoor webcams, because they can give you an instant and live view of what the weather and/or a location looks like in places all around the world. Two sites that are great for exploring these live views all around the world are  <a href="http://www.earthcam.com/" target="_blank">earthcam</a> and <a href="http://www.cammap.net" target="_blank">cammap.net</a> (though the latter appears to show only US based cams).  They are simple services that simply put a database of webcams around the world on top of interactive maps. It&#8217;s the kind of site I&#8217;ve always wanted to build myself&#8230; It&#8217;s been done now but that&#8217;s ok because I plenty of ideas for other types of web sites left.<br />
As I was browing our local webcams I came across an interesting one though&#8230; The <a href="http://sv.berkeley.edu/view/" target="_blank">Lawrence Hall of Science</a> in Berkeley has a fixed cam pointed towards the bay of San Francisco, and records a snapshot of the view every minute of every day. Every day they automatically generate a little movie out of that, which you can view online. I&#8217;ve embedded the video here too, so what you&#8217;re seeing here is what yesterday looked like over here. Depending on what day you look at this video, you may catch some of our fantastic sunsets over the bay, the beautiful fog rolling in or out, or all kinds of other weather patterns moving over the East Bay. For the real weather enthousiast, check out the <a href="http://sv.berkeley.edu/view/" target="_blank">timelaps movie archive</a> with some of the most stunning days caught on video.</p>
<p><a href="http://sv.berkeley.edu/view/timelapse/yesterdayview.avi" target="_blank"><img src="http://sv.berkeley.edu/view/images/newview.jpg" /></a><br />
<i>The above image of the view from the East Bay hills is at most a couple of minutes old (unless the camera is down). Click to view yesterday&#8217;s timelapse movie.</i></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sfpeter.com/2008/02/a-day-in-the-sf-eastbay/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://sv.berkeley.edu/view/timelapse/yesterdayview.avi" length="13736974" type="video/x-msvideo" />
<enclosure url="http://sv.berkeley.edu/view/timelapse/yesterdayview.mp4" length="13316860" type="video/mp4" />
		</item>
		<item>
		<title>Saint Nicholas in the Netherlands</title>
		<link>http://www.sfpeter.com/2007/11/saint-nicholas-in-the-netherlands/</link>
		<comments>http://www.sfpeter.com/2007/11/saint-nicholas-in-the-netherlands/#comments</comments>
		<pubDate>Thu, 15 Nov 2007 23:51:48 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Dutch expat]]></category>

		<guid isPermaLink="false">http://www.sfpeter.com/2007/11/15/saint-nicholas-in-the-netherlands/</guid>
		<description><![CDATA[It&#8217;s that time of year again&#8230; Saint Nicholas (aka Sinterklaas) has arrived (or is about to arrive) in the Netherlands,<a href="http://www.sfpeter.com/2007/11/saint-nicholas-in-the-netherlands/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s that time of year again&#8230; Saint Nicholas (aka Sinterklaas) has arrived (or is about to arrive) in the Netherlands, on his boat from Spain. He will be riding his white horse around Holland,  getting ready to celebrate his birthday on December 5th and hand out presents to the kids. Actually his birthday is on December 6th but many decades or so ago he must have decided that the 5th would be a better day to celebrate it. Anyway, it&#8217;s complicated. In the US I have always had a hard time explaining the tradition of Sinterklaas without being laughed at, or without people bringing up the (to them) obvious references to slavery in the Saint Nicholas tradition. Granted, I wouldn&#8217;t paint my face black, dress up like a Black Pete (Zwarte Piet) and go wander around Oakland like that, as people who are less aware of the Dutch tradition might  misinterpret what they&#8217;re seeing.</p>
<p>I came across a hilarious essay by David Sedaris on youtube that (fairly accurately) describes the Saint Nicholas tradition in Holland. You can view it right here &#8211; highly recommended. (it&#8217;s in 3 parts, make sure to watch all three of them&#8230;)</p>
<p><object width="470" height="406"><param name="movie" value="http://www.youtube.com/p/217900EA4317FD4E" /><param name="wmode" value="transparent" /><embed src="http://www.youtube.com/p/217900EA4317FD4E" type="application/x-shockwave-flash" width="470" height="406" wmode="transparent"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sfpeter.com/2007/11/saint-nicholas-in-the-netherlands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
