<?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"
	>

<channel>
	<title>Courtland&#124;Code</title>
	<atom:link href="http://courtlandlogistics.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://courtlandlogistics.com/blog</link>
	<description>Generic ramblings</description>
	<pubDate>Wed, 23 Apr 2008 04:02:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Bootcamp Time Resync for Windows XP</title>
		<link>http://courtlandlogistics.com/blog/2007/10/03/bootcamp-time-resync-for-windows-xp/</link>
		<comments>http://courtlandlogistics.com/blog/2007/10/03/bootcamp-time-resync-for-windows-xp/#comments</comments>
		<pubDate>Wed, 03 Oct 2007 15:14:44 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://courtlandlogistics.com/blog/2007/10/03/bootcamp-time-resync-for-windows-xp/</guid>
		<description><![CDATA[Every so often while booted in Windows XP, I notice that the system time is off by 3 hours. This is due to the differences between how Windows and UNIX/OS X read time from the hardware clock, but that&#8217;s not important.
To solve it, I created a batch file in Notepad.exe containing one line:
w32tm /resync /rediscover
I [...]]]></description>
			<content:encoded><![CDATA[<p>Every so often while booted in Windows XP, I notice that the system time is off by 3 hours. This is due to the differences between how Windows and UNIX/OS X read time from the hardware clock, but that&#8217;s not important.</p>
<p>To solve it, I created a batch file in Notepad.exe containing one line:</p>
<p>w32tm /resync /rediscover</p>
<p>I saved it as resync.bat to my startup folder (right click Start, open Programs>Startup) and dragged a shortcut to the desktop. Now XP resyncs to the correct time when I reboot, and if it strays I just double click the batch file.</p>
]]></content:encoded>
			<wfw:commentRss>http://courtlandlogistics.com/blog/2007/10/03/bootcamp-time-resync-for-windows-xp/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SEO and me</title>
		<link>http://courtlandlogistics.com/blog/2007/05/06/seo-and-me/</link>
		<comments>http://courtlandlogistics.com/blog/2007/05/06/seo-and-me/#comments</comments>
		<pubDate>Sun, 06 May 2007 03:02:44 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://courtlandlogistics.com/blog/2007/05/06/seo-and-me/</guid>
		<description><![CDATA[One of my consulting clients ( Newfields Inc, http://www.newfields.ca ) has asked me to improve their website&#8217;s Google ranking. Never one to back down from a challenge, I&#8217;m learning all I can about search engine optimization.
If anyone has any tips (or needs a dental microscope installed in Canada!) let me know.
]]></description>
			<content:encoded><![CDATA[<p>One of my consulting clients ( Newfields Inc, <a title="http://www.newfields.ca" href="http://www.newfields.ca">http://www.newfields.ca</a> ) has asked me to improve their website&#8217;s Google ranking. Never one to back down from a challenge, I&#8217;m learning all I can about search engine optimization.</p>
<p>If anyone has any tips (or needs a dental microscope installed in Canada!) let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://courtlandlogistics.com/blog/2007/05/06/seo-and-me/feed/</wfw:commentRss>
		</item>
		<item>
		<title>NSLevelIndicator</title>
		<link>http://courtlandlogistics.com/blog/2007/04/12/nslevelindicator/</link>
		<comments>http://courtlandlogistics.com/blog/2007/04/12/nslevelindicator/#comments</comments>
		<pubDate>Thu, 12 Apr 2007 22:51:50 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://courtlandlogistics.com/blog/2007/04/12/nslevelindicator/</guid>
		<description><![CDATA[After a year or so of low-level C coding, I&#8217;ve decided to switch over into the Xcode/Objective-C development side of things (GUI apps are a lot prettier than command-line apps). I&#8217;ve never been one to learn from books, so my current coding style is such that whenever I encounter a problem, I turn to Google.
Today, [...]]]></description>
			<content:encoded><![CDATA[<p>After a year or so of low-level C coding, I&#8217;ve decided to switch over into the Xcode/Objective-C development side of things (GUI apps are a lot prettier than command-line apps). I&#8217;ve never been one to learn from books, so my current coding style is such that whenever I encounter a problem, I turn to Google.</p>
<p>Today, Google failed me.</p>
<p>I felt like playing around with NSLevelIndicator, as it&#8217;s a fancy 10.4 indicator that just looks cool. After hooking it up in Interface Builder, I tried to interact with it. Aside from setting the  runtime value, I couldn&#8217;t figure out the command to set the value on the fly. The Apple documentation was no help, as all it provided was information on setting ranges and tick marks.</p>
<div align="center"><a title="greenLevelIndicator" class="imagelink" href="http://courtlandlogistics.com/blog/wp-content/uploads/2007/04/level1.jpg"><img title="discreteLevelIndicator" alt="discreteLevelIndicator" id="image5" src="http://courtlandlogistics.com/blog/wp-content/uploads/2007/04/discrete.jpg" /></a></div>
<div style="text-align: center"><a class="imagelink" title="greenLevelIndicator" href="http://courtlandlogistics.com/blog/wp-content/uploads/2007/04/level1.jpg"><img id="image6" alt="greenLevelIndicator" title="greenLevelIndicator" src="http://courtlandlogistics.com/blog/wp-content/uploads/2007/04/level1.jpg" /></a></div>
<div style="text-align: center"><img id="image7" alt="yellowLevelIndicator" title="yellowLevelIndicator" src="http://courtlandlogistics.com/blog/wp-content/uploads/2007/04/level2.jpg" /></div>
<div style="text-align: center"><img title="redLevelIndicator" alt="redLevelIndicator" id="image8" src="http://courtlandlogistics.com/blog/wp-content/uploads/2007/04/level3.jpg" /></div>
<p align="left">No other sites could help me either. It turns out the solution was easier than I had expected: [NSLevelIndicator setDoubleValue:1.3]; (or any double value). It should also respond to setIntValue:n and setFloatValue:n.nn.</p>
<p align="left">Other useful tidbits:</p>
<p align="left">[NSLevelIndicator setFrameRotation: 90.0]; //makes a vertical NSLevelIndicator<br />
[NSLevelIndicator setContinuous:YES]; //allows user interaction via dragging<br />
[NSLevelIndicator setEnabled:NO]; //disables user interaction, enabled by default</p>
]]></content:encoded>
			<wfw:commentRss>http://courtlandlogistics.com/blog/2007/04/12/nslevelindicator/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Let&#8217;s get right into it&#8230;</title>
		<link>http://courtlandlogistics.com/blog/2007/04/12/lets-get-right-into-it/</link>
		<comments>http://courtlandlogistics.com/blog/2007/04/12/lets-get-right-into-it/#comments</comments>
		<pubDate>Thu, 12 Apr 2007 22:47:36 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://courtlandlogistics.com/blog/2007/04/12/lets-get-right-into-it/</guid>
		<description><![CDATA[I recently picked up a BU-353 USGlobalSat USB GPS receiver for $50 off eBay. After some &#8220;troubles&#8221; with the not-well-advertised included magnet (more on that later) I hooked it up and began to search for ways to access the NMEA 0183 data stream.
It&#8217;s a fairly straightforward process, though accessing the stream using the right communication [...]]]></description>
			<content:encoded><![CDATA[<p>I recently picked up a <a target="_blank" title="BU-353 USGlobalSat" href="http://www.usglobalsat.com/item.asp?itemid=60">BU-353 USGlobalSat</a> USB GPS receiver for $50 off eBay. After some &#8220;troubles&#8221; with the not-well-advertised included magnet (more on that later) I hooked it up and began to search for ways to access the NMEA 0183 data stream.</p>
<p>It&#8217;s a fairly straightforward process, though accessing the stream using the right communication settings (8n1, 4800 baud) is somewhat confusing.</p>
<p><code>#include    /* Standard input/output definitions */<br />
#include   /* String function definitions */<br />
#include   /* UNIX standard function definitions */<br />
#include    /* File control definitions */<br />
#include    /* Error number definitions */<br />
#include  /* POSIX terminal control definitions */<br />
int fd;<br />
struct termios options;<br />
int streamGPSdata()<br />
{<br />
char b[255];  /* Input buffer */<br />
char out[255];<br />
char *bufptr;      /* Current char in buffer */<br />
int  nbytes;       /* Number of bytes read */<br />
int  tries;        /* Number of tries so far */<br />
fd = open(&#8221;/dev/cu.usbserial&#8221;, O_RDONLY | O_NOCTTY);<br />
fcntl(fd, F_SETFL, 0);<br />
tcgetattr(fd, &#038;options);<br />
cfsetispeed(&#038;options, B4800);<br />
cfsetospeed(&#038;options, B4800);<br />
options.c_cflag |= (CS8);<br />
tcsetattr(fd, TCSANOW, &#038;options);<br />
for (tries = 0; tries < 20; tries ++)<br />
{<br />
bufptr = b;<br />
while ((nbytes = read(fd, bufptr, b + sizeof(b) - bufptr - 1)) > 0)<br />
{<br />
bufptr += nbytes;<br />
if (bufptr[-1] == &#8216;$&#8217;)<br />
{<br />
int d;<br />
for(d = 0; d < 255; d++)<br />
{<br />
if(b[d]==&#8217;$'||b[d]==&#8217;A'||b[d]==&#8217;B'||b[d]==&#8217;C'||b[d]==&#8217;D&#8217;<br />
||b[d]==&#8217;E'||b[d]==&#8217;F'||b[d]==&#8217;G'||b[d]==&#8217;H'||b[d]==&#8217;I&#8217;<br />
||b[d]==&#8217;J'||b[d]==&#8217;K'||b[d]==&#8217;L'||b[d]==&#8217;M'||b[d]==&#8217;N&#8217;<br />
||b[d]==&#8217;O'||b[d]==&#8217;P'||b[d]==&#8217;Q'||b[d]==&#8217;R'||b[d]==&#8217;S&#8217;<br />
||b[d]==&#8217;T'||b[d]==&#8217;U'||b[d]==&#8217;V'||b[d]==&#8217;W'||b[d]==&#8217;X&#8217;<br />
||b[d]==&#8217;Y'||b[d]==&#8217;Z'||b[d]==&#8217;0&#8242;||b[d]==&#8217;1&#8242;||b[d]==&#8217;2&#8242;<br />
||b[d]==&#8217;3&#8242;||b[d]==&#8217;4&#8242;||b[d]==&#8217;5&#8242;||b[d]==&#8217;6&#8242;||b[d]==&#8217;7&#8242;<br />
||b[d]==&#8217;8&#8242;||b[d]==&#8217;9&#8242;||b[d]==&#8217;,'||b[d]==&#8217;.'||b[d]==&#8217;*'){<br />
if(b[d] != &#8216;*&#8217;){<br />
out[d]=b[d];<br />
}else{<br />
out[d]=&#8217;\0&#8242;;<br />
break;<br />
}<br />
//    out[d]=b[d];<br />
}<br />
}<br />
//printf(&#8221;\n&#8221;);<br />
break;<br />
}<br />
}<br />
if (strncmp(out, &#8220;GPGLL&#8221;, 5) == 0){<br />
/* header, ddmm.mmmm (lat), N/S, dddmm.mmmm, E/W, hhmmss.sss, valid  */<br />
/*  GPGLL, 4553.6629,        N,  06422.4178,  W,  142608.000,  A*2B,0$9,18.7,M,022.1,M,18.8,0000*4E??$? */<br />
printf(&#8221;We&#8217;ve got latitude/longitude!\n&#8221;);<br />
printf(&#8221;%s\n\n&#8221;, out);<br />
}<br />
else if (strncmp(out, &#8220;GPRMC&#8221;, 5) == 0){<br />
printf(&#8221;Time, date, position, course, speed.\n&#8221;);<br />
/* header, hhmmss.sss, valid, ddmm.mmmm (lat), N/S, dddmm.mmmm (lon), E/W, speed, course, ddmmyy, magvar,  */<br />
/*  GPRMC, 142607.000,   A,   4553.6627,        N,  06422.4175,        W,  0.23,  137.29, 100407,      ,*xx */<br />
printf(&#8221;%s\n\n&#8221;, out);<br />
}<br />
else if (strncmp(out, &#8220;GPVTG&#8221;, 5) == 0){<br />
/* header, course, T, course, M, speed, units, speed, units  */<br />
/*  GPVTG, 284.29, T,       , M,  0.20,     N,   0.4,     K*xx */<br />
printf(&#8221;We&#8217;ve got a course and speed.\n&#8221;);<br />
printf(&#8221;%s\n\n&#8221;, out);<br />
}<br />
else if (strncmp(out, &#8220;GPGSV&#8221;, 5) == 0){<br />
/* header, #messages, message#, numsats, idCh1, elevation, azimuth, SNR, idCh2, elev, azim, SNR, idCh3, elev, azim, SNR, idCh4, elev, azim, SNR  */<br />
/*  GPGSV,         3,       1,       12,    02,        76,     329,  32,    04,   51,  086,  31,    10,   49,  229,  30,    13,   34,  061,  20*xx */<br />
printf(&#8221;This is overall satellite data.\n&#8221;);<br />
printf(&#8221;%s\n\n&#8221;, out);<br />
}<br />
else if (strncmp(out, &#8220;GPGSA&#8221;, 5) == 0){<br />
/* header, A, 2/3D, satUsedCh1, Ch2,Ch3,Ch4,Ch5,Ch6,Ch7,Ch8,Ch9,Ch10,Ch11,Ch12, PDOP, HDOP, VDOP */<br />
/*  GPGSA, A,  3,      12,       04, 02, 10, 05, 13, 30, 17, 23,    ,    ,    ,  1.5,  0.9,  1.3*xx */<br />
printf(&#8221;This is active satellite data.\n&#8221;);<br />
printf(&#8221;%s\n\n&#8221;, out);<br />
}<br />
else if (strncmp(out, &#8220;GPGGA&#8221;, 5) == 0){<br />
/* header, hhmmss.sss, ddmm.mmmm (lat), N/S, dddmm.mmmm (lon), E/W, 1, numsats[0-12], HDOP, altitude, units, geoid sep, units, diff. corr., 0000 */<br />
/*  GPGGA, 143727.000, 4553.6654,        N,  06422.4203,        W,  1,   06,           2.2,   29.3,     M,    022.1,      M,   18.8,        0000*xx*/<br />
printf(&#8221;This is GPS fixed data.\n&#8221;);<br />
printf(&#8221;%s\n\n&#8221;, out);<br />
}<br />
}<br />
return (-1);<br />
}<br />
int main()<br />
{<br />
streamGPSdata();<br />
printf(&#8221;Quitting now.\n&#8221;);<br />
close(fd);<br />
}</code></p>
<p>The code is somewhat hackish - it scans through the NMEA stream (which consists primarily of ASCII garbage) for $GPxxx data (which only uses the shortened alphabet I scan for). It&#8217;s also still hardcoded for the Prolific-based BU-353, which installs a driver at /dev/cu.usbserial.</p>
<p>Compiled and tested under Mac OS X 10.4.8, gcc 4.0.0: gcc code.c -o app; ./app</p>
]]></content:encoded>
			<wfw:commentRss>http://courtlandlogistics.com/blog/2007/04/12/lets-get-right-into-it/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
