<?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>Matt Keally&#039;s Blog &#187; programming</title>
	<atom:link href="http://www.keally.org/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.keally.org</link>
	<description>Life of the ABD grad student...</description>
	<lastBuildDate>Tue, 27 Jul 2010 21:32:29 +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>Windows 7 vs. Ubuntu 10.04</title>
		<link>http://www.keally.org/2010/05/23/windows-7-vs-ubuntu-10-04/</link>
		<comments>http://www.keally.org/2010/05/23/windows-7-vs-ubuntu-10-04/#comments</comments>
		<pubDate>Sun, 23 May 2010 22:57:35 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[opinions]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[troubleshooting]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.keally.org/?p=1245</guid>
		<description><![CDATA[A few years ago, I was simultaneously running machines with OS X, Windows XP, and Linux.  After giving up PC gaming and my Macbook started aging, I switched to Linux exclusively, since it had nearly everything I needed for school/work.  I did however, keep a Windows XP partition on my laptop for PowerPoint presentations since [...]]]></description>
			<content:encoded><![CDATA[<p>A few years ago, I was simultaneously running machines with OS X, Windows XP, and Linux.  After giving up PC gaming and my Macbook started aging, I switched to Linux exclusively, since it had nearly everything I needed for school/work.  I did however, keep a Windows XP partition on my laptop for PowerPoint presentations since I find Open Office to be seriously lacking.  Using Linux almost exclusively worked pretty well for the last couple years and I managed never to have touched Windows Vista.</p>
<p>Since the release of Windows 7, I&#8217;ve heard plenty of good reviews about this latest Windows version and I decided to give it a try.  A month ago, I installed it on my MSI netbook so I could travel lightweight and give a paper presentation using PowerPoint.  Shortly thereafter, Ubuntu released its latest version into the wild and after using both Windows and Linux for about a month, I&#8217;ve been able to come up with some strong and weak points on both.  Some of my comments apply to Windows and Linux in general and not just to these latest versions or distributions.</p>
<h2>Windows 7</h2>
<h3>Pros</h3>
<ul>
<li>A solid UI.  I&#8217;m a real fan of the Aero theme, system fonts, and improved start menu.  The taskbar really takes the cake by using icons and clustering multiple instances of the same program.  Hovering over the taskbar gives a cool preview of each open window.</li>
<li>Fast.  My netbook with Windows 7 feels just as responsive as it did when it ran Linux.  Boot times are a little slower, however.</li>
<li>Robustness.  I had no difficulty with the Windows 7 install on my netbook and Microsoft even provides a Windows 7 CD to USB image utility for netbooks.  Unlike my Ubuntu experience, there aren&#8217;t any weird hacks to go through in order to get your display or wireless connection working correctly following a fresh install.  Furthermore, I haven&#8217;t encountered any system crashes and Windows seems to keep any malfunctioning program from taking down the whole system.</li>
<li>Good hardware support.  I plug in a camera and it&#8217;s automatically recognized and drivers are installed from the internet.  I plug in an external monitor or projector and the correct model is detected and my desktop is extended on to it with the correct resolution.  It&#8217;s great for presentations since there isn&#8217;t much fiddling with the projector or Control Panel settings to get everything looking good.</li>
<li>Software availability.  Everything has a Windows version, even most open source software.  I find that most developers put more effort into Windows versions since that&#8217;s what most people are running.  For example, I&#8217;ve had fewer crashes and slowdowns with the Windows versions of Firefox and Skype.  The Windows version of Skype is also much more polished than its Linux counterpart.  Furthermore, many software programs are only available on Windows.  MS Office, despite its incredible price tag, is still far superior to Open Office, and of course, only runs on Windows.</li>
<li>Games.  Most of the latest AAA titles are available for Windows, a few might be available for Mac, and I&#8217;ve heard of only one or two released right off the bat for Linux.  If you&#8217;re into PC gaming, Windows is the only way to go.</li>
</ul>
<h3>Cons</h3>
<ul>
<li>Lack of a centralized software repository.  This makes it a real pain to download and  install software since I have to go to a separate website for each program I want to install, find the download page, and click through a bunch of installation dialogs.  Even worse is that nearly every Windows program I install runs a background process on startup that constantly checks for updates and bogs down my system.  Also because of this lack of a centralized repository, programs inconsistently install themselves in many different places.</li>
<li>Difficult to configure system settings.  The Control Panel is a real maze of links, buttons, and dialogs which are dumbed down at the highest level and utterly confusing once I drill down into specific settings.  Some settings can&#8217;t even be accessed with the Control Panel: for example, I still find myself using msconfig.exe to remove unwanted startup items.</li>
<li>Windows Update is still very intrusive.  A large number of updates require me to reboot and will display a nag timer forcing me to do so.  I really don&#8217;t like the OS to get in the way and nag at me.  Some of the system updates take quite awhile to install and can bring my system to a crawl.</li>
<li>Libraries.  This feature, which wasn&#8217;t in XP, is similar to Unix symlinks.  A library clusters together files and folders from several locations in the filesystem, making it unclear where the files are really located.  I would prefer that all my music, movies, or PowerPoint slideshows be stored in a single location in the directory structure such that I can easily back everything up or find something via Windows Explorer.  Windows seems to want you to not have any knowledge about its directory structure and instead rely on searches and libraries.</li>
<li>Developer Tools.  This is the exception to the software availability and quality rule.  I&#8217;ve been using Eclipse for Linux and Windows and it works well enough on both platforms with plugins for Subversion and LaTeX editing.  However, other tools such as a basic text editor, LaTeX compiler, and command line tools such as make are either lacking or nonexistent.  I find it much easier to work with the command line than a GUI when creating plots with Gnuplot and documents with LaTeX.  I can quickly switch from one thing to the next without clicking through a whole pile of menus and dialogs.</li>
</ul>
<h2>Ubuntu 10.04</h2>
<h3>Pros</h3>
<ul>
<li>A centralized software repository.  This is the main reason I like Debian and its variants so much. &#8220;apt-get install&#8221; will give me any program I want and provide automatic updates.  Removal is just as easy.</li>
<li>Fast boot times.  On my 3 year old laptop, Ubuntu is up and running in 30 seconds or less from the moment I hit the power button.</li>
<li>Easy to configure and control.  Adjusting a system setting is easily performed from a GUI tool or from the command line.  Configurations are stored in well documented text files as opposed to the nasty Windows Registry.  It&#8217;s really easy to track down where a program&#8217;s install directory is located and tweak something.</li>
<li>A customizable UI.  The sheer number of themes available is astounding, with Compiz providing some really cool desktop visual effects that rivals anything Windows has to offer.</li>
<li>Enthusiastic user base (support).  I&#8217;ve found that tons other Linux enthusiasts are more than willing to help with problems on message boards and websites.  For things I&#8217;ve had trouble with, a quick google search or message board post will return tons of answers with other people who had the exact same problem and had already solved it.  With Windows issues, answers seem a lot more difficult to come by and the user base isn&#8217;t nearly as friendly.</li>
<li>Developer Tools.  Just about everything under the sun is readily available for developers in Linux, including a plethora of compilers, text editors, and command line tools.  Working from the command line makes things a snap compared to painstakingly navigating through different dialogs and menus.</li>
</ul>
<h3>Cons</h3>
<ul>
<li>New software versions take time to be added to the repository.  For example, Firefox 3.6 has been out for months but was only recently included in the 10.04 Lucid Lynx release.  Prior to that, I had to compile and install Firefox 3.6 from source.</li>
<li>Installation headaches still persist.  With every Ubuntu release, something doesn&#8217;t work post-install.  With 10.04, it was my video drivers.  During the upgrade process from 9.10, the installer whined about my video drivers and supposedly aborted the install.  Upon rebooting my computer, however, it was clear that the install had not aborted and my display was completely messed up.  After rebooting again, Ubuntu downloaded and installed the required video drivers automatically.  Also, Ubuntu now tries on boot to mount a remote drive in my /etc/fstab for which I don&#8217;t have a saved key, halting the boot process until I manually override the mounting process.</li>
<li>Software quality and robustness.  Productivity software, such as Open Office, isn&#8217;t nearly as capable or as featureful as Microsoft Office.  I&#8217;ve had trouble with Flash causing browser crashes and other programs crashing all on their own which run stably in Windows.  I&#8217;ve had a heck of a time figuring out why some fonts are rendered terribly and look blurry in some programs, among other things.  More effort should be placed on creating polished products in order for open source software to really take off.</li>
<li>Lacking hardware support.  This goes with the above bullet: I plug in an external monitor or projector and I still have to fidget with resolutions and positioning to get everything to work.  Suspending to disk often borks the external monitor configuration and then I have to do it all over again.</li>
</ul>
<p>In all, I can&#8217;t say that either the latest Windows or Linux versions are better.  Windows provides a more robust and polished solution, while Linux gives more power and control to its users.  I find Linux to be a better choice for development, but Windows is the clear winner for gaming.  Both Windows 7 and Ubuntu 10.04 run reasonably fast &#8212; Windows 7 does quite well on my netbook, but Ubuntu clearly takes the cake with boot times.  Until open source software takes quality up a notch and Windows provides a better development environment, I&#8217;ll probably be dual booting, running virtual machines, or using multiple computers with both operating systems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.keally.org/2010/05/23/windows-7-vs-ubuntu-10-04/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Low Level Serial Control in TinyOS</title>
		<link>http://www.keally.org/2010/03/30/low-level-serial-control-in-tinyos/</link>
		<comments>http://www.keally.org/2010/03/30/low-level-serial-control-in-tinyos/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 16:38:20 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tinyos]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wirelesssensornetworks]]></category>

		<guid isPermaLink="false">http://www.keally.org/?p=1137</guid>
		<description><![CDATA[It&#8217;s been awhile since my last TinyOS post, but a new project required me to return to programming motes.  In this case, we needed to send ASCII characters over the serial port to the PC, bypassing the default TinyOS serial stack. The TinyOS serial stack is designed to work with Active Messages so that packets [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been awhile since my last TinyOS post, but a new project required me to return to programming motes.  In this case, we needed to send ASCII characters over the serial port to the PC, bypassing the default TinyOS serial stack.</p>
<p>The <a href="http://www.tinyos.net/tinyos-2.x/doc/html/tep113.html">TinyOS serial stack</a> is designed to work with Active Messages so that packets received over the radio can be easily forwarded on to the PC.  To that end, the high-level serial and radio components provide the same interfaces.  The TinyOS serial stack has layers for packet formatting, error checking, and a read/write buffer.  However, for our project, we wanted to simplify the PC side so we didn&#8217;t have to use the TinyOS JNI libraries to receive TinyOS Active Message packets.  A simple program to read ASCII characters over the serial connection would suffice for our purposes &#8212; <a href="http://en.wikipedia.org/wiki/Minicom">Minicom</a> does this quite well and is easily installed on Ubuntu Linux and can be configured to read from attached USB devices.</p>
<p>The goal was to produce a TinyOS component that provided a command for transmitting ASCII character strings over the serial connection to a PC.  The  implementation is very similar to the <a href="http://www.keally.org/2009/06/15/bci-pulse-oximeter-in-tinyos-2-1/"><span style="color: #000000;">Pulse Oximeter</span></a> code I wrote for Atmel-based devices, however this time I targeted MSP430-based devices, such as the TelosB or Tmote Sky.  The implementation uses the <code>Msp430Uart1C</code> component for accessing the serial connection.  This component provides the <code>UartByte</code> or <code>UartStream</code> interfaces for reading and writing and the <code>Resource</code> interface for gaining control of the UART.  <code>Msp430Uart1C</code> also provides the <code>Msp430UartConfigure</code> interface for setting the baud rate.</p>
<p>The control flow for writing a character string is as follows: First, request the UART resource.  Second, when the resource has been granted, call <code>UartStream.send()</code> to transmit the string.  Lastly, when <code>UartStream.sendDone()</code> is signaled, signal the higher level application that the character string has been sent or an error message if something went wrong.  In my <code>SerialAscii</code> module, I have the following command to send a character string:</p>
<pre>  command error_t SerialAscii.sendAscii(char *str)
  {
    bufferLength = strlen(str);
    if(bufferLength &gt; BUFFER_SIZE)
      return FAIL;
    memcpy(strBuffer,str,bufferLength);  // copy string into a buffer
    call Resource.request(); // request access to the UART
    return SUCCESS;
  }</pre>
<p>I copy the string into a buffer to keep the application from modifying it before being transmitted.  When the resource request is granted, I transmit the string:</p>
<pre>  event void Resource.granted()
  {
    error_t result = call UartStream.send(strBuffer,bufferLength);
    if(result == FAIL)
      post sendDoneFailTask();  // return failure message to the user if something bad happened
  }</pre>
<p>Lastly, when the string is sent, I release the resource and signal the higher level application:</p>
<pre>  async event void UartStream.sendDone(uint8_t *buf, uint16_t len, error_t error)
  {
    // call Resource.release() in each of these tasks
    if(error == SUCCESS)
      post sendDoneSuccessTask(); // signal SerialAscii.sendAsciiDone(SUCCESS);
    else
      post sendDoneFailTask(); // signal SerialAscii.sendAsciiDone(FAIL);
  }</pre>
<p>I&#8217;ve made my code available <a href="http://www.cs.wm.edu/~makeal/projects/serialAscii/SerialAscii.tar.gz">here</a>.  Let me know if you find any bugs or have any comments or suggestions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.keally.org/2010/03/30/low-level-serial-control-in-tinyos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Freedom or Stability?</title>
		<link>http://www.keally.org/2010/01/30/freedom-or-stability/</link>
		<comments>http://www.keally.org/2010/01/30/freedom-or-stability/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 22:03:07 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[troubleshooting]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.keally.org/?p=1093</guid>
		<description><![CDATA[Windows and Mac users can download and install the newest Firefox version with a couple of mouse clicks.  With Ubuntu Linux, however, no Firefox 3.6 is available in the Canonical package repository.  Even worse, none of the developers plan to add any new Firefox versions to the repository until the next Ubuntu release.  So, I [...]]]></description>
			<content:encoded><![CDATA[<p>Windows and Mac users can download and install the newest Firefox version with a couple of mouse clicks.  With Ubuntu Linux, however, no Firefox 3.6 is available in the Canonical package repository.  Even worse, none of the developers plan to add any new Firefox versions to the repository until the next Ubuntu release.  So, I attempted to install precompiled versions from the Mozilla website and the Ubuntu Firefox development build repository, but both installs really messed up the fonts, making them blurry and hard to read.</p>
<p>I tried desperately to fix the fonts, summoning the help of the Ubuntu forums.  I tried <a href="http://ubuntuforums.org/showthread.php?t=1200992">editing font rendering settings</a> in my local .fonts.conf.  I <a href="http://ubuntuforums.org/showthread.php?t=1389077">deleted the font cache</a> and reconfigured fontconfig.  I tried <a href="http://ubuntuforums.org/showpost.php?p=8746650&amp;postcount=381">adjusting a font quality parameter</a> in Firefox&#8217;s about:config. For some forums posters, these solutions worked.  For me, nothing seemed to help.  Finally, I was able to get Firefox 3.6 installed with normal fonts by downloading and compiling the source code and installing the binaries compiled on my own system.</p>
<p><a href="http://blogs.computerworld.com/15443/talling_firefox_3_6_one_more_reason_linux_isnt_ready_for_the_prime_time_mass_market">I&#8217;m not the only one</a> who is frustrated by this.  This was probably the first time I&#8217;ve resorted to compiling a third party application from source since first using Ubuntu and Debian in 2006.  Normally, it&#8217;s just <code>apt-get install</code> whatever program you want.  The package manager automatically updates everything and keeps out of my way, rarely nagging to reboot unless the kernel was updated.  The package repository was one of the main reasons I switched to Linux in the first place: an easy, single step way to install anything and keep it up to date.  No hunting for a download website somewhere on the internet or clicking through a bunch of dialogs in an install wizard.</p>
<p>With such lag before new third party applications get added to the Ubuntu software repository, plenty argue that Linux isn&#8217;t ready for the mainstream.  I agree completely.  Most people will have to go through similar steps as I to get many of the latest third party applications installed, and it can be a real pain.  However, in Linux, I am free (as in speech) to customize or rewrite any part of the operating system and share my changes with others.  It also gives me a free (as in beer), top notch development environment for my work.  The problem is that such freedom comes at a cost: tinkering to get everything to work correctly.  Every time I&#8217;ve upgraded to the latest Ubuntu version, something doesn&#8217;t work and has to be fixed.  In another example, I recently installed the netbook remix version on my netbook and was rewarded by a flickering screen, which was fixed with a BIOS update.</p>
<p>Mainstream users just don&#8217;t want to be faced with flickering screens and BIOS updates, they want something that just works.  Consequently, they are willing to give up some of that freedom (as in speech and beer) to have a device that boots normally and doesn&#8217;t have font rendering issues when they install the latest version of a program.  Such users are better off with an Apple, and indeed Apple charges them a price in terms of money and control.</p>
<p>The iPad has <a href="http://www.fsf.org/news/ibad_launch">launched a storm of controversy</a> over its lack of user control.  Essentially, the device is a large iPhone, except there is no phone.  All applications must be purchased from the Apple-controlled App Store.  The real question is: do  mainstream users really need fine-grained control over their devices?  One comment on a <a href="http://apple.slashdot.org/story/10/01/28/1434222/iPad-Is-a-Huge-Step-Backward?art_pos=3">Slashdot post</a> really makes an interesting argument:</p>
<blockquote><p>What has choice done? It&#8217;s given us the chaos of spam, malware, worms  etc&#8230;  The average consumer should get a locked down device such  as what Apple are proposing, a limited device with a closed market. And  you do realise this is really no different to a games console.  Full  blown computers should be reserved for those of us who know how to  manage them responsibly&#8230;Computers as they are today are simply too complex and difficult to  manage for the average consumer, so you either give them something  simple or you take the management out of their hands.</p></blockquote>
<p>Combined with the &#8220;Linux is not for mainstream&#8221; argument, this really makes the case that perhaps devices that work well but allow little user freedom may be the best for most people.  Most of the time, it&#8217;s the best choice for me.  I&#8217;ve got a phone, media player, GPS device, and others that I want to just work and perform a very specific function.  In these cases, I would rather they perform their jobs reliably than be extensively customizable.  However, I do think that the option to exercise greater control should be there for those who want it, no matter how few.  In the case of PCs, I&#8217;ll take that option, stick to Linux, and keep compiling from source when I have to.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.keally.org/2010/01/30/freedom-or-stability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BCI Pulse Oximeter in TinyOS 2.1</title>
		<link>http://www.keally.org/2009/06/15/bci-pulse-oximeter-in-tinyos-2-1/</link>
		<comments>http://www.keally.org/2009/06/15/bci-pulse-oximeter-in-tinyos-2-1/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 00:33:54 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[mts310]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[research]]></category>
		<category><![CDATA[school]]></category>
		<category><![CDATA[tinyos]]></category>
		<category><![CDATA[wirelesssensornetworks]]></category>

		<guid isPermaLink="false">http://www.keally.org/?p=748</guid>
		<description><![CDATA[After days of getting lost in TinyOS 1.1 and 2.1 low level hardware abstractions, the Harvard design BCI pulse oximeter now works in TinyOS 2.1. Prior to writing the driver/interface code, I had to procure the pulseox hardware.  Detailed descriptions of hardware, software, and applications are found at the Harvard CodeBlue website.  I first ordered [...]]]></description>
			<content:encoded><![CDATA[<p>After days of getting lost in TinyOS 1.1 and 2.1 low level hardware abstractions, the Harvard design BCI pulse oximeter now works in TinyOS 2.1.</p>
<p>Prior to writing the driver/interface code, I had to procure the pulseox hardware.  Detailed descriptions of hardware, software, and applications are found at the <a href="http://fiji.eecs.harvard.edu/CodeBlue">Harvard CodeBlue website</a>.  I first ordered a <a href="http://www.smiths-medical.com/bci-oem/">Smiths Medical OEM Digital Micro Power Pulse Oximeter Board</a>.  I was able to get in contact with sales staff by emailing Smiths Medical.  The pulseox board comes with a finger sensor and runs about $200.</p>
<p>Next, I needed an interface board to connect the BCI pulseox board to the 51 pin connector on the Crossbow IRIS.  The Harvard CodeBlue source code has documentation for a PCB layout and suggests that you order the PCB from an online manufacturer.  You also have to purchase some other components that must be soldered onto the interface board.  Fortunately, I was able to &#8220;skip&#8221; this step with the help of <a href="http://www.cs.virginia.edu/~ls2ef/">Leo Selavo</a>, who graciously supplied me with two interface boards.  He emphasized that soldering the components onto the interface board requires a lot of skill and experience and if I were to try on my own that I would most likely break the PCB or components several times until I got it right.  The setup with pulseox board, interface board, IRIS mote, and finger sensor is illustrated below:</p>
<div id="attachment_752" class="wp-caption aligncenter" style="width: 410px"><a rel="attachment wp-att-752" href="http://www.keally.org/2009/06/15/bci-pulse-oximeter-in-tinyos-2-1/bciirissm/"><img class="size-full wp-image-752" title="Pulse Oximeter on IRIS" src="http://www.keally.org/wp-content/uploads/2009/06/bciIrisSm.jpg" alt="Pulse Oximeter on IRIS" width="400" height="300" /></a><p class="wp-caption-text">Pulse Oximeter on IRIS</p></div>
<p>With the pulseox board, interface board, and of course IRIS mote, I was ready to get my heart rate.  The biggest challenge still lay ahead: writing code to interface with the pulseox.  The CodeBlue pulseox code was written in 2005 for TinyOS 1.0.  All of the low level UART and mote hardware interfaces have changed drastically since then, so the old code wouldn&#8217;t just work right out of the box.  I had seen plenty of posts on the CodeBlue mailing list about implementations for the pulseox in TinyOS 2.x, but nobody had bitten the bullet and actually written anything.</p>
<p>What I wanted was to be able to use the pulseox like a sensor on the MTS300/310 sensorboard: call a Pulse.read() or Oxygen.read() command and get back a uint16_t with pulse or blood oxygen saturation.  This is fairly straightforward since I had experience <a href="2009/05/14/mts300310-sensorboard-sampling-multiple-sensors-simultaneously/">modifying the MTS310 sensorboard code to power on the sensors manually</a>.  I created configurations PulseC and OxygenC to provide SplitControl and Read interfaces to power on the sensor and read, respectively.  I then wired PulseC and OxygenC to a PulseoxP, which functioned as an intermediary between the application and the low-level pulseox driver code.  Like in the original CodeBlue source, I created a BciC configuration and BciP implementation to communicate with the pulseox directly through the UART and return data back to PulseoxP.</p>
<p>The key changes between the CodeBlue TinyOS 1.0 code and my implementation are all found in BciP (or BCIM.nc in the original CodeBlue source).  Two issues come to mind.  First, setting the mote hardware pins is done differently in TinyOS 2.1.  Calls like TOSH_SET_PW0_PIN() are replaced by abstractions.  I had to wire MicaBusC.PW0 to the GeneralIO interface in BciC and then call GeneralIO.set() in BciP.</p>
<p>The second difference is with the UART.  TinyOS 1.0 uses the HPLUART interface for low level UART communication, but this has been replaced by Atm128Uart0C for the Atmel 1281 architecture.  The CodeBlue source code initializes the low level UART to its default state, turns it off, and then sets the hardware registers to the desired UART configuration so that the mote can communicate with the pulseox board.  After figuring out what the CodeBlue UART configuration code did, I can&#8217;t believe that you can actually write to the registers directly!  Imagine if you could do that with user-level code on a PC!  To enable transmissions and reception along with interrupts for the UART in TinyOS 1.x, you had to do the following:<br />
<code><br />
// Enable tx/rx interrupts and tx/rx<br />
outp(((1 &lt;&lt; RXCIE) | (1 &lt;&lt; TXCIE) | (1 &lt;&lt; RXEN) | (1 &lt;&lt; TXEN)) ,UCSR0B);<br />
</code><br />
TinyOS 1.0 uses the outp() macro to set bits of a given register, but this macro does not exist in TinyOS 2.x.  Instead, the UART register bits are configured in a struct with fields for each bit in the register.  For the above example in TinyOS 2.1, the following union represents the control register in Atm128Uart.h:<br />
<code><br />
/* UART Control Register */<br />
typedef union {<br />
struct Atm128_UCSRB_t {<br />
uint8_t txb8  : 1;  //!&lt; UART Transmit Data Bit 8<br />
uint8_t rxb8  : 1;  //!&lt; UART Receive Data Bit 8<br />
uint8_t ucsz2 : 1;  //!&lt; UART Character Size (Bit 2)<br />
uint8_t txen  : 1;  //!&lt; UART Transmitter Enable<br />
uint8_t rxen  : 1;  //!&lt; UART Receiver Enable<br />
uint8_t udrie : 1;  //!&lt; USART Data Register Enable<br />
uint8_t txcie : 1;  //!&lt; UART TX Complete Interrupt Enable<br />
uint8_t rxcie : 1;  //!&lt; UART RX Complete Interrupt Enable<br />
} bits;<br />
uint8_t flat;<br />
} Atm128UartControl_t;<br />
</code><br />
The flat uint8_t is a real slick way to convert all the elements in the struct to a single word, which can then be written to the register.  Following the code that initializes the UART in tos/chips/atm128/HplAtm128UartP.nc, I was able to configure the UART to run with the pulseox board requirements: 4800 baud, double rate, transmission and reception interrupts enabled, no parity checking, 1 stop bit, and 8 bit word size.  So, with the previous example to enable transmissions and reception, you do the following in TinyOS 2.x:<br />
<code><br />
Atm128UartControl_t ctrl;<br />
ctrl.bits = (struct Atm128_UCSRB_t) {rxcie:1, txcie:1, rxen:1, txen:1};<br />
UCSR0B = ctrl.flat; // ctrl.flat<br />
</code><br />
I ran my concerns by the CodeBlue mailing list, which elicited a reply from <a href="http://www.eecs.harvard.edu/~mdw/">Prof. Matt Welsh</a> that I was headed in the right direction.  I finished my implementation, worked out some compile errors, and loaded the new pulseox and general data collection code onto a mote to see what would happen.  Almost never does my TinyOS code run correctly on the first try &#8212; usually I spend hours or days debugging, but this time it was magic.  A number jumped onto the screen in the data column of my PC Java application, which was connected wirelessly though a base station mote to the pulseox mote.  The sensor readings seemed reasonable for a heart rate, for jumping up and down and breathing hard made it go up and laying down and trying to breathe slowly made it slow down.</p>
<div id="attachment_753" class="wp-caption aligncenter" style="width: 471px"><a rel="attachment wp-att-753" href="http://www.keally.org/2009/06/15/bci-pulse-oximeter-in-tinyos-2-1/pulseoxdata/"><img class="size-full wp-image-753" title="Pulse Oximeter data returned to PC" src="http://www.keally.org/wp-content/uploads/2009/06/pulseoxData.jpg" alt="Pulse Oximeter Reading" width="461" height="77" /></a><p class="wp-caption-text">Pulse Oximeter Reading</p></div>
<p>I have made my <a href="http://www.cs.wm.edu/~makeal/projects/pulseox/pulseox.zip">code available here</a> and any feedback, suggestions, or questions are encouraged.  To use it, place the pulseox directory into the tos/sensorboards directory in TinyOS 2.x.  In the makefile for your application, add the line &#8220;SENSORBOARD=pulseox&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.keally.org/2009/06/15/bci-pulse-oximeter-in-tinyos-2-1/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>MTS300/310 Sensorboard: Sampling multiple sensors simultaneously</title>
		<link>http://www.keally.org/2009/05/14/mts300310-sensorboard-sampling-multiple-sensors-simultaneously/</link>
		<comments>http://www.keally.org/2009/05/14/mts300310-sensorboard-sampling-multiple-sensors-simultaneously/#comments</comments>
		<pubDate>Thu, 14 May 2009 21:27:23 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[mts310]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tinyos]]></category>
		<category><![CDATA[wirelesssensornetworks]]></category>

		<guid isPermaLink="false">http://www.keally.org/?p=680</guid>
		<description><![CDATA[My current project involves sampling data with the Crossbow Iris and MTS310 sensorboard. I wish to sample data at regular intervals, say 20ms, using all available modalities on the MTS310: x and y-axis accelerometer, x and y-axis magnetometer, light, temperature, and acoustic. Every 20ms, a timer fires and collects data samples from each sensor using [...]]]></description>
			<content:encoded><![CDATA[<p>My current project involves sampling data with the <a href="http://www.xbow.com/Products/productdetails.aspx?sid=264">Crossbow Iris</a> and <a href="http://www.xbow.com/Products/productdetails.aspx?sid=177">MTS310 sensorboard</a>.  I wish to sample data at regular intervals, say 20ms, using all available modalities on the MTS310: x and y-axis accelerometer, x and y-axis magnetometer, light, temperature, and acoustic.  Every 20ms, a timer fires and collects data samples from each sensor using the Read interface.  As it turns out, the current TinyOS 2.x code for the MTS300/310 does not allow this.</p>
<p>I found that every time I called Read.read() for some of the sensors, that there would often be a delay in getting my data back with Read.readDone().  This delay was because each call to Read.read() would power on the sensor, requiring a warm-up time before a sample could be retrieved.  While the warm-up time for the accelerometer is 17ms, the warm-up time for the light sensor is an excruciatingly long 1200ms!  So, I would call Read.read() at 20ms intervals, but have to wait over a second to get data from the light sensor.  When the data sample is returned at Read.readDone(), the sensor would power off again, thus requiring another warm-up the next time a sample is requested.  Basically, the constant warm-up lag in the current TinyOS code prevents sampling at a reasonably fast rate using Read.</p>
<p>I also found that if I wished to get both axes of the accelerometer or magnetometer simultaneously, that only one axis would ever return data.  The accelerometer, magnetometer, and light/photo sensors use the ArbitratedResource interface to block all other sensors that use the same resource when one sensor has a lock on the resource.  If the x-axis accelerometer was sampling with Read.read(), it would have a lock on a UQ_ACCEL_RESOURCE identifier, preventing the y-axis from sampling simultaneously, since its resource is also identified by UQ_ACCEL_RESOURCE.  I wasn&#8217;t the only one with these problems, as illustrated by <a href="https://www.millennium.berkeley.edu/pipermail/tinyos-help/2009-January/037930.html">this TinyOS mailing list post</a>.  The mailing list poster also points out that the ReadStream interface blocks data sampling for all sensors but the first one that calls it: if you try using ReadStream to get streaming data for the accelerometer x-axis and the magnetometer x-axis, the call to ReadStream.read() for the accelerometer would block the sampling of the magnetometer if it was called first.  With ReadStream, all sensors use the same resource identifier, so when one is sampling, it has the lock, and all others must wait.  The resource arbitration effectively prevents multiple sensors from sampling data simultaneously using ReadStream.</p>
<p>This automated power control for Read as well as the blocking for Read and ReadStream really limits the functionality of the sensorboard.  Initially, I thought it was a hardware constraint.  You would think that since the board has all those sensors on it, the manufacturers would have designed it such that you can use all the sensors at the same time.  It turns out, that it isn&#8217;t a hardware problem &#8212; it&#8217;s just that the MTS300/310 sensorboard code is written so you can only effectively use one sensor at a time.  I managed to change this by modifiying the behavior of the Read.read() of every MTS sensor.</p>
<p>The current TinyOS code uses SplitControlPowerManagerC to power on the sensor when you call Read.read().  Read.read() triggers the power manager to call the sensor&#8217;s SplitControl interface.  Supposedly, when Read.readDone() is signaled and the sensor data is ready, the power manager will keep the sensor powered on for some amount of time in case the sensor is needed again &#8212; this is from the comments in PowerManagerP.nc.   However, from my testing, there is no evidence that the sensor stays on after Read.readDone() is signaled.  The warm-up routine starts all over again the next time Read.read() is called.  It&#8217;s possible that 20ms is too much time between samples, but it appears from the power manager code that the sensor is turned off immediately if no resource requests for that sensor are pending.  Currently, I can&#8217;t find anywhere in the MTS310 sensorboard code or in the power manager code where some kind of backoff timer is set before powering down the sensor.</p>
<p>To that end, I eliminated this automated power control through the power manager.  I altered each sensor&#8217;s interface in the mts300 code library so that each sensor provided a SplitControl interface.  This now allows me to manually power on each sensor I want to use before I start sampling.  I then have a timer call Read.read() at regular intervals for each sensor I want, which returns the data with Read.readDone().  When I&#8217;m done sampling, I can turn the sensors off.</p>
<p>The current code is more a less a hack and has a weird side effect.  For example, since the x and y-axis accelerometers use the same AccelP module with the same SplitControl power interface, only one accelerometer has to call SplitControl.start() to turn the sensor on.  The same goes for the magnetometer and the light/photo sensors, as well as for calling SplitControl.stop() to power down the sensors.  Otherwise, the warm-up/power on sequence is triggered twice for the same sensor if you want to use both axes of the accelerometer or magnetometer, or wish to use both light and temperature sensors. <em>Edit: this issue has been fixed in the code.  Calling SplitControl.start() for both axes of the accelerometer/magnetometer will only run the power on sequence once, but both calls will return SplitControl.startDone().  The same applies for SplitControl.stop().</em></p>
<p>The modified sensorboard code can be <a href="http://www.cs.wm.edu/~makeal/projects/mts310/mts310.zip">downloaded here</a>, which is a zipped directory of all the mts300 sensor code, but changed to mts310.  Just unzip it into the tos/sensorboards directory.  The configurations AccelXC, AccelYC, MagXC, MagYC, MicC, PhotoC, and TempC have all been modified to provide the SplitControl interface, so for example you can call AccelXC.start() to power on the accelerometer, then AccelXC.read() to get data, and then AccelXC.stop() to power the accelerometer off.  I&#8217;ve used this extensively with the accelerometers, magnetometers, acoustic, and light sensors and it seems to work without any issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.keally.org/2009/05/14/mts300310-sensorboard-sampling-multiple-sensors-simultaneously/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Defusing the Binary Bomb</title>
		<link>http://www.keally.org/2009/05/12/defusing-the-binary-bomb/</link>
		<comments>http://www.keally.org/2009/05/12/defusing-the-binary-bomb/#comments</comments>
		<pubDate>Tue, 12 May 2009 17:56:15 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[school]]></category>

		<guid isPermaLink="false">http://www.keally.org/?p=672</guid>
		<description><![CDATA[Looking for the &#8220;secret defusion phrases&#8221; for the binary bomb project? I&#8217;m not going to just spit them out for you.  What is the challenge in just typing in the answers?  Despite an earlier post about the binary bomb when I took a Computer Architecture class, you will not find the answers here. To solve [...]]]></description>
			<content:encoded><![CDATA[<p>Looking for the &#8220;secret defusion phrases&#8221; for the <a href="http://www.cs.wm.edu/~lowekamp/classes/304-F07/labs/bomblab.pdf">binary bomb project</a>?  I&#8217;m not going to just spit them out for you.  What is the challenge in just typing in the answers?  Despite an <a href="http://www.keally.org/2003/10/12/congratulations-youve-defused-the-bomb/">earlier post about the binary bomb</a> when I took a Computer Architecture class, you will not find the answers here.</p>
<p>To solve it, you can do the same thing I did: disassemble the binary and use the debugger.  Be sure to set a breakpoint so that you won&#8217;t set off the bomb accidentally.  As long as you&#8217;ve got that breakpoint set, you&#8217;ll never lose any points.  Step through the assembly code line by line and try to figure out how the input is manipulated.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.keally.org/2009/05/12/defusing-the-binary-bomb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One reason grad school is different</title>
		<link>http://www.keally.org/2009/05/06/one-reason-grad-school-is-different/</link>
		<comments>http://www.keally.org/2009/05/06/one-reason-grad-school-is-different/#comments</comments>
		<pubDate>Wed, 06 May 2009 19:42:21 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[knee]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[research]]></category>
		<category><![CDATA[school]]></category>
		<category><![CDATA[surgery]]></category>
		<category><![CDATA[tests]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://www.keally.org/?p=653</guid>
		<description><![CDATA[My sister (and others) have been complaining about the gobs of work they&#8217;ve got to get done during exam period. There are papers, projects, and of course, exams. My case is somewhat different. I remember how it seemed all kinds of massive projects and papers were due right before or during exams, and then I [...]]]></description>
			<content:encoded><![CDATA[<p>My sister (and others) have been complaining about the gobs of work they&#8217;ve got to get done during exam period.  There are papers, projects, and of course, exams.  My case is somewhat different.  I remember how it seemed all kinds of massive projects and papers were due right before or during exams, and then I would have to suffer through a whole ton of exams.  It was a huge weight off my back when it was done.  </p>
<p>But now, it&#8217;s almost worse.  I started working on my current project in September, right after my knee surgery.  It&#8217;s been going for nine months and now I am finally cramming all of those nine months into ten pages or less, double column.</p>
<p>To put this in perspective for an undergrad: take all the papers, all the projects, all the homework assignments, and all the exams, tests, and quizzes in the last two semesters and make them all due next week.  That is the weight of what I am working on.  It nags at me every day that I have been working for so long and have nothing to show for it.  I think about it in bed before I go to sleep, I think about it when I wake up, I think about it when I&#8217;m in the shower, and I think about it when I&#8217;m on the bike.  As an undergrad and even for the first part of grad school, I got closure incrementally: with periodic assignments and tests and at the finish of each semester when classes end.  Closure is now when I get a paper out, and the time span for that seems indefinite.</p>
<p>My first project and paper was faster &#8212; it took a semester and a summer.  However, I&#8217;m still dealing with that project now &#8212; I&#8217;m going to present it at SECON and when I do, it will almost be a year since the first version of the paper went out.</p>
<p>It seems most undergrads treat papers lightly: &#8220;Oh, I can crank out a ten page paper in a few hours and still get an A&#8230;&#8221;  I was the same way &#8212; it was spit something out as fast as possible to get it over with, but put enough effort into it to get a decent grade.  Now, papers are everything.  The paper is how everyone else sees your work.  I may have spent the past nine months creating something that could have huge implications for the future of wireless sensor networks, but nobody but my adviser would know about it unless I tell them in a paper.  The reviewers will lay the smack down on you if you try to whip out a paper in a matter of hours.  Yesterday, I spent six hours writing and got out about five paragraphs.  They were five critical paragraphs about the core of what I did, and they had better be comprehensive and understandable from the perspective of an outsider.</p>
<p>I find it hard to tell the story of my project, but I think the difficulty is from inexperience.  There are key things that reviewers look for that I must give special attention in addressing.  Because of this, there is a pretty rigid way to write a research paper, but even then I find it difficult.  It is hard to convey specific algorithmic details, yet be concise and easy to understand.  I have to remember the main selling points of my work and refer back to them throughout the paper.  For these projects, I find the initial problem discovery, solution design, and implementation to be interesting and sometimes even fun.  Enough experience programming and thinking about solutions to problems has helped with that, but I haven&#8217;t done much writing.</p>
<p>With time, I imagine writing will get easier.  I will know exactly what to do.  With my current paper, I&#8217;m almost there.  I&#8217;m almost to the point where I feel good about what I have written and know that everything will turn out okay.  I just have to keep working and get it done.  Then there will be some closure.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.keally.org/2009/05/06/one-reason-grad-school-is-different/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This weekend I&#8230;</title>
		<link>http://www.keally.org/2009/04/05/this-weekend-i/</link>
		<comments>http://www.keally.org/2009/04/05/this-weekend-i/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 22:31:34 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[microfracture]]></category>
		<category><![CDATA[biking]]></category>
		<category><![CDATA[cartilage]]></category>
		<category><![CDATA[crosscountry]]></category>
		<category><![CDATA[knee]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[pain]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rehab]]></category>
		<category><![CDATA[research]]></category>
		<category><![CDATA[Running]]></category>
		<category><![CDATA[school]]></category>
		<category><![CDATA[surgery]]></category>
		<category><![CDATA[track]]></category>
		<category><![CDATA[weather]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://www.keally.org/?p=633</guid>
		<description><![CDATA[&#8230; rode outside for the first time since the surgery.  This was a huge step forward and I had been waiting too long. Over the past week or two I had been getting really restless.  The hour on the trainer every day gave me a workout, but the weather was starting to turn.  Spending nearly [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230; rode outside for the first time since the surgery.  This was a huge step forward and I had been waiting too long.</p>
<p>Over the past week or two I had been getting really restless.  The hour on the trainer every day gave me a workout, but the weather was starting to turn.  Spending nearly 95% of my time indoors over the past seven months was starting to really get to me.  As goes the quote from &#8220;Office Space,&#8221; &#8220;Human beings were not meant to sit in little cubicles staring at computer screens all day,&#8221; which was pretty much what I have been doing.  I would walk back and forth from the Computer Science office and that was about it in terms of getting outside.  Something was about to give.</p>
<p>It gave this weekend.  The Colonial Relays was this weekend, and on Friday I walked over from the office and watched some of the distance races.  The hour or so that I was out there had been the longest I&#8217;d been outside in quite a long time.  That night, I went back and talked to a few of my teammates and alumni that had come back to watch.  It was a great change of pace and was good to see everyone run.  I talked to a lot of people that I hadn&#8217;t talked to in months, some even longer than that.  A lot of people asked me when I would try running again, since the doctors have given me the okay to start.  I replied that I wasn&#8217;t sure, but it would be soon.  In talking to my old teammates, I had forgotten what I had left behind.  For quite awhile, I&#8217;ve been in my own really tiny world, working on my projects.</p>
<p>Until now, the only times I would be shocked back into reality was when I would be having a discussion with my adviser in the late afternoon.  We would be having a discussion on the whiteboard in his office and I would happen to glance out the window and see all my teammates run by in a blur.  It&#8217;s a real kick in the butt to see that and remember what I used to do.  In the world of computer science, the atmosphere is mellow, but determined.  In the world that I came from, it&#8217;s about getting on the track and suffering.  Unfortunately, in the context in which I live now, I don&#8217;t think anyone says, &#8220;I really dominated in that conference paper.&#8221;  You don&#8217;t sweat and breathe hard while thinking up and coding a slick algorithm.</p>
<p>On Saturday, I got up, ate breakfast and prepared to do what I had done since before Thanksgiving: get on the trainer and pound away for about an hour.  I would open the window, turn on the fan, and listen to music while I looked outside at the law students coming and going from the library.  But on Saturday, the sun was shining and it was getting warm.  I couldn&#8217;t take it any longer: it was time to go out.</p>
<p>It was about the best feeling I&#8217;ve ever had.  I was uncaged, released into the wild, my natural habitat.  I hauled it out past the state park at York River.  The weather said the wind was blowing 30 mph gusts from the west, but I didn&#8217;t notice a thing.  I powered up hills where over the summer I remember being exhausted and downshifting into the lowest gear.  I remember trying to upshift, only to look down and see there were no more gears to use.  A dog bolted out from its house and chased after me for nearly a quarter mile, but I kept it at bay.  I turned around right before the road ended at the river.  As I got closer to home, I never got tired.  I looped around campus and got to the track just in time to watch the 4&#215;800.</p>
<p>Yesterday was the first day in months that I didn&#8217;t do any work before dinner.  I still did a little before I went to bed, so I couldn&#8217;t call it a complete day off.  I was outside at the meet all day and got a nasty sunburn.  I guess that happens when you don&#8217;t have a built up tolerance from running or biking outside every day.  I watched all the distance relays and hung out with everyone some more.  By the end of the day, I was exhausted.  On the bike, I&#8217;d gone 45 minutes over an hour, and despite feeling much easier than the trainer, was enough to make me not want to move for most of the afternoon.</p>
<p>Today I went out again, but took it easier.  I was definitely more tired today and felt more normal as compared with pre-surgery rides.</p>
<p>As for my knee, I was out of the saddle several times and really hammered up some hills without any real discomfort.  I might have felt something this afternoon walking around, but I can&#8217;t be sure.  I do know, that if my knee could handle what I did today and yesterday, I&#8217;m pretty sure I&#8217;ll be able to do at least some running.  Sometime soon, the same thing will happen with biking outdoors and I&#8217;ll just start running on a whim.  It won&#8217;t take much to push me over the edge.</p>
<p>I finally broke down and got a new bike.  For awhile, I&#8217;ve been worried that the rear cogs are so worn that someday I&#8217;ll go up a hill and the chain will just rip off.  I tried a few new bikes out at the bike shop, the first one being a Specialized aluminum frame.  It felt like my old one, nothing really special about it.  But, I tried a Giant TCR-0 with a carbon frame and it felt like a rocket.  It was an unused 2006 and I <em>think</em> I got a pretty good deal on it since equivalent new models of just about every manufacturer go for about $1000 more.  I&#8217;d been to bike shops quite a bit in the past few years and I don&#8217;t often see anything older or discounted.  It seems most owners keep a limited stock.  The components had been switched up and have a combination of Shimano Ultegra and 105.  I really don&#8217;t need the way high end components since I don&#8217;t care too much about saving some fraction of an ounce of weight.  As it is, the bike feels like a feather compared to the steel Bianchi.  Since my shoes and pedals were a mess, I went ahead and replaced those.  Hopefully I&#8217;ll be able to try out the bike before the weather crashes this week.</p>
<p>If I can bike or even run outside more often it will provide more of a balance to my life.  I really can&#8217;t just hole up and work all day &#8212; there&#8217;s got to be a balance to the equation.  The recent discussion about <a href="http://www.computerworld.com/action/article.do?command=viewArticleBasic&amp;articleId=9131066">goofing off boosting productivity</a> probably has some merit in it.  Biking or running isn&#8217;t really goofing off, but it provides the same release.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.keally.org/2009/04/05/this-weekend-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubiquitous Computing: The Nag Factor and Bad Design Decisions</title>
		<link>http://www.keally.org/2009/03/05/ubiquitous-computing-the-nag-factor-and-bad-design-decisions/</link>
		<comments>http://www.keally.org/2009/03/05/ubiquitous-computing-the-nag-factor-and-bad-design-decisions/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 18:12:30 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[displays]]></category>
		<category><![CDATA[gaming]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[isp]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[opinions]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[psp]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[Running]]></category>
		<category><![CDATA[travel]]></category>
		<category><![CDATA[ubiquitouscomputing]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[weird]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://www.keally.org/?p=616</guid>
		<description><![CDATA[Yesterday, the guy from HP came back and delivered a monitor that seems to be in working order. Finally, after ordering the monitor in January I get replacement number three in March that doesn&#8217;t have any problems. But everything wasn&#8217;t in working order for long. This morning on the bike, my iPod ran out of [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, the guy from HP came back and delivered a monitor that seems to be in working order.  Finally, after ordering the monitor in January I get replacement number three in March that doesn&#8217;t have any problems.  But everything wasn&#8217;t in working order for long.  This morning on the bike, my iPod ran out of batteries and shut down after about five minutes.  I have a feeling its Nickel-Cadmium battery is about finished.  It was a rough hour and it got me thinking.</p>
<p>As I see it, the ultimate goal in the computer science community is to provide systems that improve our lives without us even being aware of it.  Stuff should just happen in the background that we don&#8217;t even know about to provide drastic improvements in general areas like productivity, entertainment, and communication.  All the background noise should be filtered out by these hidden systems so that we only see things that are important to us.  For now, it seems, nothing is being filtered out and we are subjected to an increasing amount of information, almost all of which we really don&#8217;t care about.  For example, this morning I searched Google for &#8220;mp3 players&#8221; (as in the physical devices) and only got hits for software programs.  Problems like this shouldn&#8217;t happen, and I shouldn&#8217;t have to type in some weird query to specifically exclude certain results from my search.  Some serious work has to be done to limit the scope of what we see to only the things that matter, and do it in such a way that isn&#8217;t annoying.  Basically, operating systems and software should just work and not require any hacks to get solutions we want.</p>
<p>The first issue that comes to mind is with today&#8217;s operating systems.  Gigabytes of patches and updates are released each month and harass the living daylights out of the end users to install them.  This is one of the best examples of the Nag Factor.  An operating system should not endlessly nag the user about installing updates and allowing administrative privileges.  Ideally, the user shouldn&#8217;t even be aware that he or she is using a computer at all.  Updates should be automatic and occur in the background without the user even knowing.  Nothing is more annoying than to be deep into writing a paper or watching a movie when up comes a nag balloon demanding that some updates be installed and the machine rebooted.</p>
<p>Windows is far and away the worst when it comes to the nag factor.  I&#8217;m almost completely off Windows at this point, with the exception that I use a partition on my laptop for my USB TV tuner, which unfortunately doesn&#8217;t have Linux drivers.  It seems every time I start up the machine, about five nag balloons pop up telling me what wireless network I&#8217;ve connected to.  About once a week another torrent of nag balloons pop up telling me to install software updates.  When I finally install the updates, Windows forcefully reboots my machine.  Nothing, I mean absolutely nothing, should ever forcefully reboot your machine.  It&#8217;s a complete disruption of anything resembling the mantra of ubiquitous computing.  A professor I had for a software engineering class once told me that it takes about eight minutes for someone to become completely engaged in a task.  When some moron at Microsoft thinks it&#8217;s a good time to make your machine reboot, that&#8217;s about five minutes of lost productivity due to the reboot, and another eight to get back to where you were.  Even <a href="http://blog.seattlepi.nwsource.com/microsoft/archives/141821.asp">Bill Gates complains</a> about the forced reboots in Windows.  Since I&#8217;ve never used Vista, I&#8217;ve heard another annoying &#8220;feature&#8221; is the User Account Control system, which ceaselessly has you type in your administrative password for stuff as simple as connecting to a wireless network.</p>
<p>Next up is OS X.  Two years ago, I started the shift away from Windows with a Macbook.  My Windows desktop began rusting from disuse almost immediately.  Unfortunately, OS X suffers from the update nag almost as badly as Windows.  Nearly every update is hundreds of megabytes and requires a reboot.  iTunes updates even require reboots &#8212; what were they thinking?  And when you install the stuff, it takes forever.  Sometimes on an OS X update, my machine has rebooted two or three times over about ten minutes before the login screen comes up again.  The updates first make their way to you through the extremely aggravating dock icon jumping out at you.  While the dock is a good feature, the jumping icons are not.  I can&#8217;t describe how irritating it is to be doing something and have a dock icon start leaping out into the center of my vision, ceaselessly pushing my buttons until I deal with it.  There is probably a way to disable the icon jumping, but I&#8217;ve moved on from OS X, so it doesn&#8217;t matter at this point.  UAC is also present in OS X but the designers did a decent job of only prompting you when changing administrative settings or installing software.</p>
<p>For the past year, I&#8217;ve almost exclusively used Ubuntu Linux for all of my computing.  Finally, a group of developers has the right idea.  It works almost seamlessly.  An operating system should do its best to get out of the way and let the user do what he or she wants.  Ubuntu is really close to doing this.  The package manager is excellent &#8212; you can install anything under the sun (for free) and it updates automatically.  You can&#8217;t even do this with the Mac by default, unless you install something like DarwinPorts, and even that is a real hassle to set up.  The downside is that since every program you install is controlled by the package manager, there are frequent updates that require your authorization to install.  Nearly every day something has a patch, but the package manager does its best to be minimally invasive.  Nag balloons are infrequent, and a small icon appears in the task bar indicating that an update is available.  Reboots are almost never required except for things that affect the kernel and nothing is ever forced on you.  For now, I&#8217;m extremely satisfied with my Linux experience and will probably not switch back to Windows or Mac unless some serious revamping occurs.</p>
<p>The nag factor isn&#8217;t present in operating systems alone.  The devices that are beginning to make ubiquitous computing a reality are providing irritations of their own.  Whenever I miss a call, get a voicemail, or receive a text message, my cell phone beeps and hums to no end until I touch the screen acknowledging its nags.  I&#8217;ve had two phones, and they both did this.  Neither has the option to turn it off.  I can check manually to see if anything came in while I was away from my phone and would prefer to do so instead of being constantly annoyed.  I&#8217;ve also noticed that late model cars now beep at you if you start the engine and have your seatbelt off.  Apparently, this is mandated by the federal government, but it&#8217;s just another irritating nag.  Some cars will nag at you after the mileage counter gets beyond a certain amount since your last service.</p>
<p>It isn&#8217;t just the nagging that&#8217;s a problem, though.  Some poor design decisions really limit the usability of computing systems and ubiquitous computing devices.  The worst of this is proprietary software and hardware, with Apple really standing out as the worst culprit.  The iPod that&#8217;s starting to die on me has a proprietary USB jack to plug it into my computer.  What makes me mad is that it didn&#8217;t come with a wall plug to charge it &#8212; I&#8217;ve got to use the proprietary adapter to charge it via USB or for over $40 for a wall adapter.  Since I don&#8217;t need to sync my iPod every day and would like to be able to travel with it without bringing my computer, a wall plug would be great.  Thanks to the wall plug adapter scam, I don&#8217;t think I&#8217;ll be getting another iPod if I can help it.  Apple&#8217;s computers also make use of proprietary headphone jacks and video outputs such as mini-DVI and mini-DisplayPort.  I had to fork over $20 to get a mini-DVI to DVI adapter so I could use an external monitor with my Macbook.  Universal hardware standards would make ubiquitous computing much more of a reality, with devices seamlessly integrating with each other and providing minimal headaches to the end user.</p>
<p>With respect to proprietary software, the iPod/iTunes combination also takes the cake.  When I first got my iPod, I was using Windows, and installed iTunes on Windows to keep my music and iPod in order.  After I got my Mac, I tried plugging the iPod into the Mac and using the Mac to keep everything synced.  Did this work?  Of course not.  iTunes on the Mac whined that my iPod was formatted for Windows and that it couldn&#8217;t write anything to it unless it was reformatted.  I don&#8217;t see why the geniuses at Apple could have written some drivers so that the iPod&#8217;s file system could be accessed from any operating system.  It all seems to be about control.  Downloading songs from iTunes only allows you to have those songs installed on three machines simultaneously and you can only load them onto an iPod in a proprietary format.</p>
<p>Cell phones are another example of this walled garden approach.  You not only pay for the access to a cell network, but you have to get a proprietary operating system running on a proprietary phone to go along with it.  You can&#8217;t just build your own cell phone out of spare parts, install your own operating system, and expect to connect to Verizon&#8217;s network even if you&#8217;ve paid for it.  Google&#8217;s Android seems to be a step forward to breaking down this situation by permitting custom applications, but there&#8217;s a long way to go.  Without all this proprietary junk to get in the way, you could see some seriously interesting applications, such as P2P file sharing on cell networks, refinement of video and text messaging, and the eventual integration of portable gaming, media, and communication into one device (the iPhone still sucks).  For now, I&#8217;ve got to carry around my laptop for web browsing and programming, my cell phone for telephone calls, my iPod for music, and my PSP for gaming.  Oh, and maybe a watch to tell time.</p>
<p>Finally, coming back to my dying iPod, battery technology needs significant improvements in order to further the goals of ubiquitous computing.  Reducing I/O and computational complexity on the software side can only help but so much.  The typical Ni-Cd battery, regardless of the device, lasts about two to three years and only runs for a few hours under full load.  This is crap.  Until batteries last for a week under full load and hold a full charge for nearly ten years, we&#8217;re just going to be throwing away perfectly good equipment.  My iPod, which is perfectly fine with the exception of the battery, could last an indefinite amount of time.  It seems really wasteful to toss cell phones and other mobile devices every few years just because a battery died.  Reduced reliance on proprietary hardware and software could help this problem as well, for parts could be easily interchanged or upgraded if new features become available.</p>
<p>If the tech industry would focus on reducing the nag factor and increasing the openness of design standards, the shift to ubiquitous computing could be faster and more seamless.  Until then, we&#8217;ve got to deal with the endless OS nag balloons, proprietary devices, and terrible battery life.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.keally.org/2009/03/05/ubiquitous-computing-the-nag-factor-and-bad-design-decisions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling ACKs in TinyOS 2.x</title>
		<link>http://www.keally.org/2009/02/25/enabling-acks-in-tinyos-2x/</link>
		<comments>http://www.keally.org/2009/02/25/enabling-acks-in-tinyos-2x/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 20:26:10 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tests]]></category>
		<category><![CDATA[tinyos]]></category>
		<category><![CDATA[wirelesssensornetworks]]></category>

		<guid isPermaLink="false">http://www.keally.org/?p=608</guid>
		<description><![CDATA[I&#8217;ve seen a lot of questions about how to enable ACKs in TinyOS and not too many responses. Unlike a lot of TinyOS problems I&#8217;ve had, this one isn&#8217;t too bad. Some sample code for enabling ACKs is available in $TOSROOT/apps/tests/cc2420/TestAcks. In your configuration .nc file, just wire the PacketAcknowledgements interface: implementation { ... MainC.PacketAcknowledgements [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve seen a lot of questions about how to enable ACKs in TinyOS and not too many responses.  Unlike a lot of TinyOS problems I&#8217;ve had, this one isn&#8217;t too bad.  Some sample code for enabling ACKs is available in $TOSROOT/apps/tests/cc2420/TestAcks.  In your configuration .nc file, just wire the PacketAcknowledgements interface:<br />
<code><br />
implementation {<br />
...<br />
MainC.PacketAcknowledgements -&gt; ActiveMessageC;<br />
}<br />
</code><br />
Then, in your implementation file:<br />
<code><br />
module TestAcksP {<br />
uses {<br />
interface PacketAcknowledgements;<br />
...<br />
</code><br />
Then, just before you call AMSend.send() for a message_t testMsg:<br />
<code><br />
call PacketAcknowledgements.requestAck(&amp;testMsg);<br />
</code><br />
When a packet arrives with an ACK request, the ACK will be sent automatically.  In the sender&#8217;s AMSend.sendDone(), you will want to make sure the packet was ACKed to determine if a retransmission is required:<br />
<code><br />
if(!call PacketAcknowledgements.wasAcked(&amp;testMsg))<br />
retransmit();<br />
</code><br />
And that&#8217;s pretty much it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.keally.org/2009/02/25/enabling-acks-in-tinyos-2x/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->