<?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>MrBalky Heavy Industries &#187; experiments</title>
	<atom:link href="http://www.mrbalky.com/category/experiments/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mrbalky.com</link>
	<description>Fat free with endorphins, anti-oxidants, bioflavonoids, creatine, glucosamine and caffeine!</description>
	<lastBuildDate>Mon, 07 Jun 2010 22:33:42 +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>Weather station &#8211; one last thing</title>
		<link>http://www.mrbalky.com/2010/05/09/weather-station-one-last-thing/</link>
		<comments>http://www.mrbalky.com/2010/05/09/weather-station-one-last-thing/#comments</comments>
		<pubDate>Sun, 09 May 2010 22:04:06 +0000</pubDate>
		<dc:creator>mrbalky</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[te923]]></category>
		<category><![CDATA[weather]]></category>

		<guid isPermaLink="false">http://www.mrbalky.com/?p=538</guid>
		<description><![CDATA[It is also possible to read version and status information from the weather station, and the te923con application gives access to this data as well. It is formatted the same way as the weather data, and so was also trivial to process in PHP. I wrote a script that gets the station and sensor status, [...]]]></description>
			<content:encoded><![CDATA[<p>It is also possible to read version and status information from the weather station, and the <em>te923con</em> application gives access to this data as well.  It is formatted the same way as the weather data, and so was also trivial to process in PHP.  I wrote a script that gets the station and sensor status, and sends a notification email if one of the sensors has a low battery.  That script is also included in the <a href="/wp-content/uploads/te923.zip">te923 zip file</a>.  Again, I know my PHP skills are weak, so if you have improvements I&#8217;d be interested in them.</p>
<p>I scheduled it to run once a day at midnight:</p>
<pre><code>0 0 * * * sleep 30;php te923Status.php &lt;notify email address&gt;</code></pre>
<p>The 30 second sleep is intended to offset the status check from the normal weather data check that happens exactly on the minute.</p>
<p>Debian out of the box doesn&#8217;t relay mail to external domains, so I had to do another tweak here.  To enable forwarding, I reconfigured exim according to <a href="http://pkg-exim4.alioth.debian.org/README/README.Debian.etch.html ">http://pkg-exim4.alioth.debian.org/README/README.Debian.etch.html</a>.</p>
<p>It&#8217;s not really the proper way to create a real relay server, but since I&#8217;m behind a firewall and only using the server for this purpose, I didn&#8217;t feel it necessary to do more.  But the email does look suspicious to the receiving mail system, so if you send to an address outside your domain (like gmail, for example), the mail is likely to be determined as spam.  You&#8217;ll need to create whatever filters necessary at the recipient account to avoid this.</p>
<p>And that&#8217;s it so far.  I expect I&#8217;ll delve into <a href="http://oss.oetiker.ch/rrdtool/">RRDTool</a> and <a href="http://code.google.com/p/rrdweather/">RRDWeather</a> now to see if I can create graphs of readings Weather Underground does not (like humidity, for example).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mrbalky.com/2010/05/09/weather-station-one-last-thing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Weather Station &#8211; fixing the bugs</title>
		<link>http://www.mrbalky.com/2010/05/09/weather-station-fixing-the-bugs/</link>
		<comments>http://www.mrbalky.com/2010/05/09/weather-station-fixing-the-bugs/#comments</comments>
		<pubDate>Sun, 09 May 2010 22:00:35 +0000</pubDate>
		<dc:creator>mrbalky</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[te923]]></category>
		<category><![CDATA[weather]]></category>

		<guid isPermaLink="false">http://www.mrbalky.com/?p=479</guid>
		<description><![CDATA[The first thing I discovered is that the te923con application has a bug in decoding UV index data from the station. The index jumps from .9 to 10.0. A simple patch to te923_com.h is required. This diff output actually is a change to a single line that I split up for clarity here: @@ -138,7 [...]]]></description>
			<content:encoded><![CDATA[<p>The first thing I discovered is that the te923con application has a bug in decoding UV index data from the station.  The index jumps from .9 to 10.0.  A simple patch to te923_com.h is required.  This diff output actually is a change to a single line that I split up for clarity here:</p>
<pre><code>@@ -138,7 +138,7 @@
     }

     else {
-        data-&gt;uv = bcd2int( buf[18] &amp; 0x0F ) / 10.0 +
               bcd2int( buf[18] &amp; 0xF0 ) +
               bcd2int( buf[19] &amp; 0x0F ) * 10.0;
+        data-&gt;uv = bcd2int( buf[18] &amp; 0x0F ) / 10.0 +
               bcd2int( ( buf[18] &amp; 0xF0 ) &gt;&gt; 4 ) +
               bcd2int( buf[19] &amp; 0x0F ) * 10.0;
         data-&gt;_uv = 0;
     }</code></pre>
<p>The next thing to address is the permissions problem.  To this point, the only way to get data from the station was to be root.  Otherwise, you get this error:</p>
<pre><code>[mcp:…/te923/te923] te923con -D
Error while setting configuration (-1).</code></pre>
<p>This is a generic issue with USB devices, and I found an item on a wiki (<a href="http://wiki.openstreetmap.org/wiki/USB_Garmin_on_GNU/Linux#Fixing_Device_Permissions">http://wiki.openstreetmap.org/wiki/USB_Garmin_on_GNU/Linux#Fixing_Device_Permissions</a>) about GPS units that got me going.</p>
<p>That page discusses how to set the group ownership on the device, as well as the permissions on the device.  Long story short, I created the device rule set <em>/etc/udev/rules.d/99-te923.rules</em> (all on one line):</p>
<pre><code>ATTRS{idVendor}=="1130", ATTRS{idProduct}=="6801",
                    MODE="0660", GROUP="plugdev"</code></pre>
<p><em>idVendor</em> and <em>idProduct</em> identify the TE923 weather station, <em>mode</em> tells the USB driver to give read/write permissions to the user and group that owns the device, and <em>group</em> tells the driver to assign group ownership to &#8220;plugdev&#8221;.  My user on the machine is a member of that group so I should be OK.</p>
<p>Ask the system to reload the USB rulesets:</p>
<pre><code>[mcp:.../te923/te923] sudo udevadm control --reload_rules</code></pre>
<p>And now I can get valid data back from the unit without being root:</p>
<pre><code>[mcp:.../cwanek/cronjobs] te923con
1273414489::::59:::::::::1003.1:5.0:3:0:9:0.4:0.0:11.7:215</code></pre>
<p>Unfortunately, though, some readings (specifically current temp readings) are empty.  Even wide-open permissions on the device don&#8217;t help.  This doesn&#8217;t make sense to me, and I have not yet solved this issue, so I&#8217;m still stuck with being root to run <em>te923con</em>.  I&#8217;d love to know why it would work only partially.</p>
<p>Still, I don&#8217;t really want to have root&#8217;s crontab running the script, so I configured sudo to skip the password prompt for the group <em>plugdev</em> for the te928con application.  With <em>visudo</em>, add:</p>
<pre><code>%plugdev ALL=NOPASSWD: /usr/local/bin/te923con</code></pre>
<p>Moving on, the I was still not able to run <em>te923con</em> without removing the USB human interface device module (<em>sudo rmmod usbhid</em>).  While removing it allows access to the te923 station, it would also cause any other HID like a mouse or keyboard to stop functioning.  So the trick is to get the <em>usbhid</em> module to release just the weather station.</p>
<p>There are many sites that document how to get usbhid to unbind a device.  I found <a href="http://lwn.net/Articles/143397/">http://lwn.net/Articles/143397/</a>, which give me the following command:</p>
<pre><code>sudo bash -c "echo -n 2-1:1.0 &gt; /sys/bus/usb/drivers/usbhid/unbind"</code></pre>
<p><em>bash -c</em> is required so the shell redirection to <em>unbind</em> will succeed.</p>
<p>Digging deeper, I learned (<a href="http://reactivated.net/writing_udev_rules.html">http://reactivated.net/writing_udev_rules.html</a>) that you can configure the unbind to happen immediately after the device is connected, by using the &#8220;RUN=&#8221; option in the device rules file (this is all on one line in <em>/etc/udev/rules.d/99-te923.rules</em>):</p>
<pre><code>ATTRS{idVendor}=="1130", ATTRS{idProduct}=="6801",
    MODE="0660", GROUP="plugdev",
    RUN="/bin/sh -c 'echo -n $id:1.0 &gt; /sys/bus/usb/drivers/usbhid/unbind'"</code></pre>
<p>So now, apart from the missing data when running as a non-privileged user, the te923 weather station is coexisting with other USB devices, and I am able to schedule the upload script in my own user crontab.</p>
<p>There&#8217;s <a href="http://www.mrbalky.com/2010/05/09/weather-station-one-last-thing/">one last thing</a>&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mrbalky.com/2010/05/09/weather-station-fixing-the-bugs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting the weather station online</title>
		<link>http://www.mrbalky.com/2010/05/09/getting-the-weather-station-online/</link>
		<comments>http://www.mrbalky.com/2010/05/09/getting-the-weather-station-online/#comments</comments>
		<pubDate>Sun, 09 May 2010 21:55:49 +0000</pubDate>
		<dc:creator>mrbalky</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[te923]]></category>
		<category><![CDATA[weather]]></category>

		<guid isPermaLink="false">http://www.mrbalky.com/?p=505</guid>
		<description><![CDATA[Weather Underground has a very simple data upload protocol published on their site at http://wiki.wunderground.com/index.php/PWS_-_Upload_Protocol. Because running child processes and fetching web pages is easy in PHP, I chose it for coding the application to read, parse and upload the weather data. (All of the code I wrote for this can be downloaded in a [...]]]></description>
			<content:encoded><![CDATA[<p>Weather Underground has a very simple data upload protocol published on their site at <a href="http://wiki.wunderground.com/index.php/PWS_-_Upload_Protocol">http://wiki.wunderground.com/index.php/PWS_-_Upload_Protocol</a>.  Because running child processes and fetching web pages is easy in PHP, I chose it for coding the application to read, parse and upload the weather data.  (All of the code I wrote for this can be <a href="/wp-content/uploads/te923.zip">downloaded in a zip file</a>.)</p>
<p>Sure, there are packages like <a href="http://code.google.com/p/rrdweather/">RRD Weather</a> that can do this too, but where&#8217;s the fun in that.</p>
<p>The <em>te923con</em> application returns most of the data included in the wunderground protocol directly, so it&#8217;s a simple matter of parsing it from the application output.  Weather Underground wants imperial units, but maybe someday I&#8217;ll want proper metric units, so I made it a parse option.</p>
<p>The weather station apparently does not return a calculated dew point, which is part of the upload protocol.  It turns out that calculating dew point is not straighforward.  But many people have implemented calculators.  A guy named <a href="http://www.decatur.de/">Wolfgang Kühn</a> <a href="http://www.decatur.de/javascript/dew/index.html">implemented one in javascript</a> that seemed very thorough, so I did a quick port of it to PHP.</p>
<p>The weather station also returns only the accumulated rainfall total since the station was started, so I implemented a simple array mechanism to retain historical data from the rain counter.  I can then calculate the &#8220;rain in last hour&#8221; and &#8220;rain since midnight&#8221; values required by the WUnderground protocol.</p>
<p>From there, it&#8217;s a simple matter to build the URL string for data upload, and a <em>file_get_contents</em> call to upload and get the success or failure result.</p>
<p>I save the rain counters and the other weather data as PHP code in a cache file that is reloaded with a PHP include the next time the script runs.</p>
<p>WUnderground can accept data as fast as once a second, but the weather station does not update from its sensors with anywhere near that frequency, so I felt scheduling upload once a minute via cron was more than often enough.  The script takes station id, password and cache file name on the command line (all on one line):</p>
<pre><code>* * * * * php te923WunderUpload.php &lt;station ID&gt;
                       &lt;wunderground password&gt; &lt;cache file name&gt;</code></pre>
<p>Because of the permissions issues with the USB device, for now this is scheduled in the root user&#8217;s crontab.</p>
<p>Now on to <a href="http://www.mrbalky.com/2010/05/09/weather-station-fixing-the-bugs/">fixing the bugs</a>&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mrbalky.com/2010/05/09/getting-the-weather-station-online/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Weather station &#8211; my new toy</title>
		<link>http://www.mrbalky.com/2010/05/09/weather-station-tinkering/</link>
		<comments>http://www.mrbalky.com/2010/05/09/weather-station-tinkering/#comments</comments>
		<pubDate>Sun, 09 May 2010 21:53:00 +0000</pubDate>
		<dc:creator>mrbalky</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[te923]]></category>
		<category><![CDATA[weather]]></category>

		<guid isPermaLink="false">http://www.mrbalky.com/?p=477</guid>
		<description><![CDATA[For some reason I can&#8217;t explain, I&#8217;ve wanted a weather station for years. A piece in Wired last month pushed me over the edge and I picked up the Honeywell TE923W. It&#8217;s relatively cheap, and while not as good as a Davis, accurate enough for me. The problem with this station, though, is that it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>For some reason I can&#8217;t explain, I&#8217;ve wanted a weather station for years.  A piece in <a href="http://www.wired.com/">Wired</a>  last month pushed me over the edge and I picked up the <a href="http://honeywellweatherstations.com/TE923W.html">Honeywell TE923W</a>.  It&#8217;s relatively cheap, and while not as good as a <a href="http://www.davisnet.com/weather/products/weather_product.asp?pnum=06152">Davis</a>, accurate enough for me.</p>
<p><a href="http://www.mrbalky.com/wp-content/uploads/te923w003-1.gif"><img src="http://www.mrbalky.com/wp-content/uploads/te923w003-1.gif" alt="" title="te923w003 - 1" width="382" height="278" class="alignnone size-full wp-image-500" /></a></p>
<p>The problem with this station, though, is that it&#8217;s a USB station, and Linux is not supported by the software that ships with it.  But I figured I could find a way around that, and indeed I could, but it wasn&#8217;t so straightforward.  Along the way I learned some arcane details about USB on Debian Linux.  This series of posts is something of a blow-by-blow of the process.</p>
<p>The hardest part was already done for me by <a href="http://www.fukz.de/">Sebastian John</a> who created an application that reads the current raw data from the station.  The source is available at <a href="http://te923.fukz.org/index">http://te923.fukz.org/index</a>.  Building the source requires libusb, and the site links to it, but I was able to build with the vanilla libusb-dev installed by apt-get:</p>
<pre><code>apt-get install libusb-dev</code></pre>
<p>The build creates the executable <em>te923con</em>, which I then installed in <em>/usr/local/bin</em>.</p>
<p>The first time I tried to run it, I got the following error message:</p>
<pre><code>[mcp:…/te923/te923] te923con -D
Error while setting configuration (-1).</code></pre>
<p>This indicates insufficient privileges to access the USB device, so to get things going I ran the te923con application as root.  That got me to the next error:</p>
<pre><code>[mcp:.../te923/te923] sudo ./te923con -D
Error while setting configuration (-16).</code></pre>
<p>The dmesg shows the following error (all on one line):</p>
<pre><code>[24464516.452385] usb 2-1: usbfs: interface 0 claimed
                    by usbhid while 'te923con' sets config #1</code></pre>
<p>It seems that the TE923 registers itself as a human interface device (HID) for some reason, so the OS tries to treat it a such.  The author of a package of code that creates a web view for the TE923 has the solution on his blog, though without explanation of the problem or why: <a href="http://firewall.haringstad.com/TE923-Frontend/blog/TE923-Frontend-Info/TE923-Frontend%20Blog/B9EF42CC-F942-41DE-ABDF-461549FEFB46.html">http://firewall.haringstad.com/TE923-Frontend/blog/TE923-Frontend-Info/TE923-Frontend%20Blog/B9EF42CC-F942-41DE-ABDF-461549FEFB46.html</a></p>
<p>He removes the usbhid kernel module:</p>
<pre><code>sudo rmmod usbhid</code></pre>
<p>And success:</p>
<pre><code>[mcp:.../te923/te923] sudo ./te923con -D
[DEBUG] got |07|00|0a|0a|00|0a|0a|00|
[DEBUG] got |07|0a|0a|00|0a|30|00|af|
[DEBUG] got |07|3d|03|57|c0|28|00|35|
[DEBUG] got |05|00|0a|b2|00|66|00|35|
[DEBUG] got |01|5a|0a|b2|00|66|00|35|
[DEBUG] got |02|28|82|b2|00|66|00|35|
[DEBUG] got |07|37|64|c0|96|0a|00|0a|
[DEBUG] got |07|0a|00|0a|0a|00|0a|0a|
[DEBUG] got |07|00|0a|30|00|af|3d|03|
[DEBUG] got |07|57|c0|28|00|35|00|0a|
[DEBUG] got |03|b2|00|66|00|35|00|0a|
[DEBUG] TMP 0 BUF[00]=28 BUF[01]=82 BUF[02]=37
[DEBUG] TMP 1 BUF[03]=64 BUF[04]=c0 BUF[05]=96
[DEBUG] TMP 2 BUF[06]=0a BUF[07]=00 BUF[08]=0a
[DEBUG] TMP 3 BUF[09]=0a BUF[10]=00 BUF[11]=0a
[DEBUG] TMP 4 BUF[12]=0a BUF[13]=00 BUF[14]=0a
[DEBUG] TMP 5 BUF[15]=0a BUF[16]=00 BUF[17]=0a
[DEBUG] UVX   BUF[18]=30 BUF[19]=00
[DEBUG] PRESS BUF[20]=af BUF[21]=3d
[DEBUG] STAT  BUF[22]=03
[DEBUG] WCHIL BUF[23]=57 BUF[24]=c0
[DEBUG] WGUST BUF[25]=28 BUF[26]=00
[DEBUG] WSPEE BUF[27]=35 BUF[28]=00
[DEBUG] WDIR  BUF[29]=0a
[DEBUG] RAINC BUF[29]=00 BUF[30]=b2 BUF[31]=00
1272059734:22.80:37:6.40:96:::::::::986.9:3.0:3:0:10:1.6:1.3:5.7:178</code></pre>
<p>Hooray!  There are still a few problems to work out with the device interface, and there is a bug in the te923con application to fix, but now I have a working interface to my weather station.  Next up, <a href="http://www.mrbalky.com/2010/05/09/getting-the-weather-station-online/">getting the weather data</a> onto <a href="http://www.wunderground.com/">Weather Underground</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mrbalky.com/2010/05/09/weather-station-tinkering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Access -&gt; MySQL</title>
		<link>http://www.mrbalky.com/2009/10/23/access-mysql/</link>
		<comments>http://www.mrbalky.com/2009/10/23/access-mysql/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 19:54:09 +0000</pubDate>
		<dc:creator>mrbalky</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[hacks]]></category>

		<guid isPermaLink="false">http://www.mrbalky.com/?p=460</guid>
		<description><![CDATA[Long, long ago I hacked together a Java app that imports the freedb CD info files from my local drive to an MS Access database. The CD ripper application I use creates a local freedb with a file for each CD I rip (all of them). So importing from that freedb to a database seemed [...]]]></description>
			<content:encoded><![CDATA[<p>Long, long ago I hacked together a Java app that imports the <a href="http://www.freedb.org/">freedb</a> CD info files from my local drive to an <a href="http://en.wikipedia.org/wiki/Microsoft_Access">MS Access</a> database.  The CD ripper application I use creates a local freedb with a file for each CD I rip (all of them).  So importing from that freedb to a database seemed a natural thing to do.</p>
<p>Access was all that I had access (heh) to, and it had a &#8220;music collection&#8221; database template, so with slight modification to the template that&#8217;s what I used.</p>
<p>Well now, I no longer have access (heh) to Access, Access is a <a href="http://www.urbandictionary.com/define.php?term=PITA">PITA</a>, and I already have <a href="http://www.mysql.com/">MySQL</a> available on my home server, so I figured it was time to finally migrate.</p>
<p>I found a handy application called <a href="http://www.navicat.com/">Navicat</a> (fully functional trial), that will import directly from the Access .MDB file to a MySQL database.</p>
<p>While Navicat mostly worked, I was not quite done.  The import did not properly get the auto_increment attribute on the tables&#8217; &#8216;id&#8217; column.  Also, the Access database tables had spaces in their names which is kind of a drag.  Fortunately both were easily solved by exporting from MySQL to text using mysqldump, editing the .sql file that resulted, and then reimporting to MySQL from the .sql file.</p>
<p>Sure it&#8217;s a ridiculous thing nobody in their right mind will ever have to do, but I&#8217;m not in my right mind.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mrbalky.com/2009/10/23/access-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TwitPic upload hack</title>
		<link>http://www.mrbalky.com/2009/01/13/twitpic-upload-hack/</link>
		<comments>http://www.mrbalky.com/2009/01/13/twitpic-upload-hack/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 01:46:48 +0000</pubDate>
		<dc:creator>mrbalky</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[twitpic]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.mrbalky.com/?p=304</guid>
		<description><![CDATA[Some Twitter users have been using TwitPic to link photos to tweets. I, on the other hand, have been using Flickr and Snipr. It&#8217;s a PITA, so I&#8217;m giving TwitPic a whirl. Sadly, Digsby, does not support TwitPic, and I&#8217;m not installing yet another app. TwitPic has an API, so I rolled my own simple [...]]]></description>
			<content:encoded><![CDATA[<p>Some <a href="http://twitter.com">Twitter</a> users have been using <a href="http://twitpic.com/">TwitPic</a> to link photos to tweets.  I, on the other hand, have been using Flickr and <a href="http://snipr.com/">Snipr</a>.  It&#8217;s a PITA, so I&#8217;m giving TwitPic a whirl.  Sadly, <a href="http://www.digsby.com/">Digsby</a>, does not support TwitPic, and I&#8217;m not installing yet another app.</p>
<p>TwitPic has an <a href="http://twitpic.com/api.do">API</a>, so I rolled my own simple uploader with <a href="http://www.cygwin.com/">cygwin</a> and <a href="http://curl.haxx.se/">curl</a>.  There&#8217;s no doubt in my mind that I&#8217;ve reinvented the wheel here&#8230;</p>
<p><em>Standard disclaimer applies: this is quick n’ dirty(tm)</em>:</p>
<pre>
<code>#!/bin/bash

# curl executable.  I'm a PC.
CURL=C:/cygwin/bin/curl

# The upload script that will accept the data
UPLOAD_URL=http://twitpic.com/api/uploadAndPost

# Snag stuff off the command line
TWITTER_USER=$1
TWITTER_PW=$2
PHOTO=`cygpath -m "$3"`
TWEET_MSG=$4

# Prompt for message if it's not given
if [ "$TWEET_MSG" = "" ]; then
   read -p "Tweet msg: " TWEET_MSG
fi

# Go
echo Uploading...
$CURL \
  --form username=$TWITTER_USER \
  --form password=$TWITTER_PW \
  --form media=@"$PHOTO" \
  --form message="$TWEET_MSG" $UPLOAD_URL

# Wait for user to read result message
echo
read -p "Press &lt;enter&gt; to continue" bogus</code>
</pre>
<p>Create a desktop shortcut with uid and password:</p>
<pre><code>C:\cygwin\bin\sh.exe ~/twitpic.sh --userid-- --password--</code></pre>
<p>Now just drag and drop the photo onto the desktop shortcut.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mrbalky.com/2009/01/13/twitpic-upload-hack/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Some things you do just because you can</title>
		<link>http://www.mrbalky.com/2008/10/24/some-things-you-do-just-because-you-can/</link>
		<comments>http://www.mrbalky.com/2008/10/24/some-things-you-do-just-because-you-can/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 16:35:33 +0000</pubDate>
		<dc:creator>mrbalky</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[sonos]]></category>

		<guid isPermaLink="false">http://www.mrbalky.com/?p=214</guid>
		<description><![CDATA[Need another Sonos controller? Hack together openlink, perl, sonosweb and iphone sonos: I had to go through Perl dependency hell (Perl really is an abomination) to get sonosweb working on the linkstation, but it works pretty well now. Throw in a little DD-WRT and ssh and you can really mess with your S.O. by changing [...]]]></description>
			<content:encoded><![CDATA[<p>Need another <a href="http://www.sonos.com/">Sonos</a> <a href="http://www.sonos.com/whattobuy/controllers/CR100/default.aspx">controller</a>?</p>
<p>Hack together <a href="http://buffalo.nas-central.org/index.php?title=Projects/OpenLink">openlink</a>, <a href="http://www.perl.org/">perl</a>, <a href="http://www.purple.org/sonos/">sonosweb</a> and <a href="http://www.nowsms.com/download/sonoswebiphone.zip">iphone sonos</a>:<br />
<a href="http://www.mrbalky.com/wp-content/uploads/ipod-sonos.jpg"><img src="http://www.mrbalky.com/wp-content/uploads/ipod-sonos-300x175.jpg" alt="" title="sonos on the itouch" width="300" height="175" class="alignnone size-medium wp-image-215" /></a></p>
<p>I had to go through Perl dependency hell (Perl really is an abomination) to get sonosweb working on the <a href="http://www.buffalotech.com/products/network-storage/linkstation/">linkstation</a>, but it works pretty well now.</p>
<p>Throw in a little <a href="http://www.sonos.com/whattobuy/controllers/CR100/default.aspx">DD-WRT</a> and <a href="http://www.openssh.com/">ssh</a> and you can really mess with your S.O. by changing the music at home from the office.</p>
<p>Now I need to write up how I got through the seven circles of dependency hell before I forget.  It took more than a quarter to Charon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mrbalky.com/2008/10/24/some-things-you-do-just-because-you-can/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Random text post</title>
		<link>http://www.mrbalky.com/2007/04/20/random-text-post/</link>
		<comments>http://www.mrbalky.com/2007/04/20/random-text-post/#comments</comments>
		<pubDate>Fri, 20 Apr 2007 20:58:06 +0000</pubDate>
		<dc:creator>mrbalky</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[lijit]]></category>

		<guid isPermaLink="false">http://mrbalky.com/2007/04/20/random-text-post/</guid>
		<description><![CDATA[Here&#8217;s some random text for The Google to index: I thought, &#8220;sldfkjdlkjd wwerrrjrjs ttlljjjgllkkttj sldfe sdfw?&#8221; But naturally, fjwjejrb jboegj and wllejrbbbjelti3! So instead I wnne85gnns dlfkjwrng yot! Shortly thereafter, wnern6xioa hgqqp38ng alasjtq8p6 sgklgfnqp lanffsan ouq dlfn sda gqpq dnfgga. But still, there is the matter of akl e7a z fngfn lqn fqi ore. &#8220;IuthlzJKSf [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s some random text for The Google to index:</p>
<p>I thought, &#8220;sldfkjdlkjd wwerrrjrjs ttlljjjgllkkttj sldfe sdfw?&#8221;  But naturally, fjwjejrb jboegj and wllejrbbbjelti3!  So instead I wnne85gnns dlfkjwrng yot!</p>
<p>Shortly thereafter, wnern6xioa hgqqp38ng alasjtq8p6 sgklgfnqp lanffsan ouq dlfn sda gqpq dnfgga.  But still, there is the matter of akl e7a z fngfn  lqn fqi ore.</p>
<p>&#8220;IuthlzJKSf hnaa jasdj tjla5!&#8221; I said.  &#8220;A hafaljsda nfqo ietyalf hld sh q5a.&#8221;</p>
<p>No, that will never work.  Aj awfahqeol q89 ahlfqp3984 bdfalkf.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mrbalky.com/2007/04/20/random-text-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wijit Gadget</title>
		<link>http://www.mrbalky.com/2007/04/10/wijit-gadget/</link>
		<comments>http://www.mrbalky.com/2007/04/10/wijit-gadget/#comments</comments>
		<pubDate>Tue, 10 Apr 2007 14:22:28 +0000</pubDate>
		<dc:creator>mrbalky</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[lijit]]></category>

		<guid isPermaLink="false">http://mrbalky.com/?p=22</guid>
		<description><![CDATA[Or is that gadget wijit? Anyway, there&#8217;s an official one now, so I turned off the old, experimental one. Get the new one here:]]></description>
			<content:encoded><![CDATA[<p>Or is that gadget wijit?  Anyway, there&#8217;s an official one now, so I turned off the old, experimental one.</p>
<p>Get the new one here: <a href="http://www.lijit.com/wijitgadget/gadgetInstall.php?username=MrBalky"><img src="http://www.lijit.com/wijitgadget/add-to-google-small.gif" alt="add to google" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mrbalky.com/2007/04/10/wijit-gadget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A TiVo post</title>
		<link>http://www.mrbalky.com/2007/04/04/a-tivo-post/</link>
		<comments>http://www.mrbalky.com/2007/04/04/a-tivo-post/#comments</comments>
		<pubDate>Wed, 04 Apr 2007 18:44:10 +0000</pubDate>
		<dc:creator>mrbalky</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[tivo]]></category>

		<guid isPermaLink="false">http://mrbalky.com/?p=20</guid>
		<description><![CDATA[This is a post about TiVo. &#8220;TiVo&#8221; is a favorite search term at Lijit, so I&#8217;m writing a post about it so TiVo will come up in my search results. You can see what&#8217;s currently recorded on my TiVo in the sidebar on the right.]]></description>
			<content:encoded><![CDATA[<p>This is a post about <a href="http://tivo.com">TiVo</a>.  &#8220;TiVo&#8221; is a favorite search term at Lijit, so I&#8217;m writing a post about it so TiVo will come up in my search results.</p>
<p>You can see what&#8217;s currently recorded on my TiVo in the sidebar on the right.</p>
<p><a href='http://tivo.com'><img src='http://mrbalky.com/wp-content/uploads/2007/04/tivologo.thumbnail.jpg' alt='tivo logo' /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mrbalky.com/2007/04/04/a-tivo-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lijit Wijit Gadget</title>
		<link>http://www.mrbalky.com/2007/03/22/lijit-wijit-gadget/</link>
		<comments>http://www.mrbalky.com/2007/03/22/lijit-wijit-gadget/#comments</comments>
		<pubDate>Thu, 22 Mar 2007 13:34:22 +0000</pubDate>
		<dc:creator>mrbalky</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[lijit]]></category>

		<guid isPermaLink="false">http://mrbalky.com/?p=18</guid>
		<description><![CDATA[A few weeks ago I quit using My Yahoo! and began using Google Personalized Home instead. Call me old school; I still like that kind of portal page. Google Home is just a collection of &#8220;Gadgets&#8221;, and it turns out it&#8217;s pretty easy to write one. So I converted the Lijit Wijit into a Gadget; [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago I quit using <a href="http://my.yahoo.com">My Yahoo!</a> and began using <a href="http://www.google.com/ig?hl=en">Google Personalized Home</a> instead.  Call me old school; I still like that kind of portal page.</p>
<p>Google Home is just a collection of &#8220;Gadgets&#8221;, and it turns out it&#8217;s pretty easy to write one.  So I converted the <a href="http://www.lijit.com/informers/wijit_kit/pvs">Lijit Wijit</a> into a Gadget; the Lijit Wijit Gadget.</p>
<p>So if you use Google Home and want to add MrBalky search to your page, just <a href="http://www.lijit.com/wijitgadget/gadgetInstall.php?username=MrBalky"> <img src="http://www.google.com/webmasters/add-to-google-plus.gif" alt="add to google home" /></a>.</p>
<p>It&#8217;s really just a test.  Look for a better Lijit Wijit Gadget, coming soon from your good friends at <a href="http://www.lijit.com">Lijit Networks</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mrbalky.com/2007/03/22/lijit-wijit-gadget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
