<?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>EchoTech &#187; Programming</title>
	<atom:link href="http://www.echo-technology.co.uk/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.echo-technology.co.uk</link>
	<description>technology blogging for the moribund</description>
	<lastBuildDate>Tue, 06 Apr 2010 12:35:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Twitter + Growl = Trowel v1.0</title>
		<link>http://www.echo-technology.co.uk/2009/01/26/twitter-growl-trowel-v10/</link>
		<comments>http://www.echo-technology.co.uk/2009/01/26/twitter-growl-trowel-v10/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 17:58:29 +0000</pubDate>
		<dc:creator>Richard Stelling</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[Growl]]></category>
		<category><![CDATA[launchd]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.echo-technology.co.uk/?p=79</guid>
		<description><![CDATA[You may have already read my how-to on integrating Twitter and Growl but this is the upgrade! I will go through the code for those interested, please help me improve the code by leaving a comment, good or bad.

I have some quite ambitious plans for this project, but this is not the time to bore you with promises, so vaporware it will remain &#8211; for [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.echo-technology.co.uk%2F2009%2F01%2F26%2Ftwitter-growl-trowel-v10%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.echo-technology.co.uk%2F2009%2F01%2F26%2Ftwitter-growl-trowel-v10%2F" height="61" width="51" /></a></div><p>You may have already read my <a href="http://www.echo-technology.co.uk/2008/11/11/how-to-growl-and-twitter/" target="_blank">how-to on integrating Twitter and Growl</a> but this is the upgrade! I will go through the code for those interested, please help me improve the code by leaving a comment, good or bad.</p>
<p><span id="more-79"></span></p>
<p>I have some quite ambitious plans for this project, but this is not the time to bore you with promises, so vaporware it will remain &#8211; for now.</p>
<p>I&#8217;d like to start by thanking everyone who has commented on this project so far &#8211; it&#8217;s been such a big help, keep them coming.</p>
<p> </p>
<h2>What&#8217;s new?</h2>
<p>If you can&#8217;t see a feature you requested its not because I am ignoring it, it&#8217;s simply I haven&#8217;t got round to it or it been superseded. As alway comments will always be read so you can always bug me there.</p>
<p>1. Profile images now supported</p>
<p>2. Run in the background and optionally use launchd</p>
<p>3. Sticky notifications for selected users</p>
<p>4. Loads more command line options</p>
<p> </p>
<h2>Bugs Fixed</h2>
<p>UTF-8 encoding issue.</p>
<p> </p>
<h2>Download</h2>
<p><a title="Download Code" href="http://www.echo-technology.co.uk/development/twitter+growl/trowel.txt" target="_blank">Download here</a>. Remember you&#8217;ll need some command line experience. See an example <a href="/development/twitter+growl/com.edm.trowel.plist.txt" target="_blank">launchd plist file here</a>.</p>
<p> </p>
<h2>Install</h2>
<p>Installation is relatively simple, you will need to install some Perl modules, refer to the <a href="http://www.echo-technology.co.uk/2008/11/11/how-to-growl-and-twitter/">previous post</a> for details.</p>
<p> </p>
<h2>Running</h2>
<p><em>NB: I have split this command for ease of readability.</em></p>
<pre>$ ./trowel -u &lt;&lt;EMAIL&gt;&gt; -p &lt;&lt;PASSOWRD&gt;&gt; -vv \</pre>
<pre>-I guykawasaki,twitter,stephenfry,rjstelling,macrumors,2009show \</pre>
<pre>-t twitter,stephenfry,rjstelling</pre>
<p> </p>
<p><strong>-I </strong>tells the script what to notify you about</p>
<p><strong>-t </strong>makes the notification sticky</p>
<p> </p>
<h2>Know Issues</h2>
<p>There does seem to be an issues when running in launcd mode where Tweets are duplicated, any testing and info you can supply on this bug will help no end.</p>
<p> </p>
<h2>Documentation </h2>
<pre>NAME
		trowel - display Twitter messages with Growl.

SYSOPSIS
		trowel -u -p [options]

EXAMPLES
		trowel -u &lt;username&gt; -p &lt;password&gt; -i 5 -l 180 -f "%t %d" \</pre>
<pre>		-t twitter,stephenfry,rjstelling \</pre>
<pre>		-I guykawasaki,twitter,stephenfry,rjstelling

OPTIONS
		-u, --username
			Twitter username

		-p, --password
			Twitter passord, if omitted it will be </pre>
<pre>		 	requested interactively</pre>
<pre>		-i
			interval between displaying tweets

		-l, --poll
			time between polls of Twitter feed

		-x, --exclude
			list of users to exclude

		-t, --sticky
			list of users who's tweets are sticky, </pre>
<pre>			-x and -i will override this

		-I, --include
			list of users to include

		-o
			output to STDOUT only, by-passing Growl,</pre>
<pre>			 use this for piping to another application

		-n
			initial number of Tweets to request, default is 5 

		-f "&lt;format&gt;"
			format of the Tweet
				%u - user
				%t - tweet
				%d - date time
				%l - location

		-g, --config
			a configuration file that sets command line </pre>
<pre>			parameters, this function is not implemented

		-h, --help
			show this help 

		-v
			verbose mode

		-vv
			very verbose mode

		-vvv
			debug verbose mode</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.echo-technology.co.uk/2009/01/26/twitter-growl-trowel-v10/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>How To: Growl and Twitter</title>
		<link>http://www.echo-technology.co.uk/2008/11/11/how-to-growl-and-twitter/</link>
		<comments>http://www.echo-technology.co.uk/2008/11/11/how-to-growl-and-twitter/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 11:12:08 +0000</pubDate>
		<dc:creator>Richard Stelling</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Web Sites]]></category>
		<category><![CDATA[CPAN]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.echo-technology.co.uk/?p=28</guid>
		<description><![CDATA[THIS POST HAS BEEN SUPERSEDED BY Twitter + Growl = Trowel v1.0
 
OK, so I&#8217;m new to Twitter. I didn&#8217;t (don&#8217;t) get it. Who wants to know what I&#8217;m doing? Well as I keep telling myself thats not the point. The point is to spread information, I had a lot of fun on Election night tweeting away about the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.echo-technology.co.uk%2F2008%2F11%2F11%2Fhow-to-growl-and-twitter%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.echo-technology.co.uk%2F2008%2F11%2F11%2Fhow-to-growl-and-twitter%2F" height="61" width="51" /></a></div><h2><strong>THIS POST HAS BEEN SUPERSEDED BY </strong><a title="Twitter + Growl = Trowel v1.0" href="http://www.echo-technology.co.uk/2009/01/26/twitter-growl-trowel-v10/"><strong>Twitter + Growl = Trowel v1.0</strong></a></h2>
<p> </p>
<p>OK, so I&#8217;m new to <a href="http://twitter.com">Twitter</a>. I didn&#8217;t (don&#8217;t) get it. Who wants to know what I&#8217;m doing? Well as I keep telling myself thats not the point. The point is to spread information, I had a lot of fun on <a href="http://twitter.com/rjstelling">Election night tweeting</a> away about the coverage and calling states (I was surprisingly accurate).</p>
<p>The one thing that did annoy me was it added another website to check &#8211; not just a lunch but a refresh every 5 minutes. Something had to be done.<span id="more-28"></span></p>
<p>For anyone who has <a href="http://www.adiumx.com">Adium</a> installed on their Mac, you will be aware of <a href="http://growl.info/">Growl</a> it&#8217;s a notification system that has yet to reach it&#8217;s full potential. As with background messages I wanted my incoming Tweets to be shown in small unobtrusive transparent bubble.</p>
<p>To cut a long story short &#8211; I couldn&#8217;t find anything. I found a few Ruby scripts (that didn&#8217;t work), I tried some nice applications but I didn&#8217;t want to run another app I wanted Growl!</p>
<p>So an hour or 2 or Googling and research for scripts I found some Perl modules that I could combine to produce the desired output.</p>
<p>My steps and code are listed below, its not 100% fool proof &#8211; please leave comments on how I can improve it.</p>
<p> </p>
<p><strong>1. Installing the Modules</strong></p>
<p>You will need only 3 modules <a href="http://search.cpan.org/~cnandor/Mac-Growl-0.67/lib/Mac/Growl.pm">Mac::Growl</a>, <a href="http://search.cpan.org/~cthom/Net-Twitter-1.17/lib/Net/Twitter.pm">Net::Twitter</a> and <a href="http://search.cpan.org/~gbarr/TimeDate-1.16/lib/Date/Format.pm">Date::Format</a>, if your lucky Date::Format might even be already installed. Type the following commands into terminal.</p>
<p>$ sudo perl -MCPAN -e shell</p>
<p>This will launch a <a href="http://cpan.org">CPAN</a> command line session to install the modules type (at the prompt):</p>
<p>&gt; install Mac::Growl</p>
<p>Agree to any dependancies, when it done type:</p>
<p>&gt; install Net::Twitter</p>
<p>Again agree to all dependancies, and lastly:</p>
<p>&gt; install Date::Format</p>
<p>&gt; exit</p>
<p>If you had any problems it may be because You need Apple&#8217;s Development tools installed, these are a free <a href="http://developer.apple.com/">download form Apple</a>. Please leave any problems in the comments.</p>
<p> </p>
<p><strong>2. Coding</strong></p>
<p>Now for the code, just copy the following into a empty text file and save as some thing sensible like growl_tweet.pl:</p>
<pre>#! /usr/bin/perl -wT

use Mac::Growl ':all';
use Net::Twitter;
use Date::Format;

my $app    = 'Growl/Twitter';
my @names  = ('New Tweet');

RegisterNotifications($app, \@names, [$names[0]]);

my $tweet = Net::Twitter-&gt;new( username=&gt;'##REPLACE WITH USERNAME##', password=&gt;'##REPLACE WITH PASSWORD##' );

my $last_id = undef;
my $switch = 0;

while(1)
{
<span> </span>my @tt = ();

<span> </span>if($last_id)
<span> </span>{
<span> </span>@tt = $tweet-&gt;friends_timeline({count =&gt; 200, since_id =&gt; $last_id });
<span> </span>}
<span> </span>else
<span> </span>{
<span> </span>@tt = $tweet-&gt;friends_timeline({count =&gt; 5 });
<span> </span>}

<span> </span>foreach my $t (@{$tt[0]})
<span> </span>{
<span> </span>if(!$switch) { $last_id = $t-&gt;{id}; $switch++; };

<span> </span>PostNotification($app, $names[0], $t-&gt;{user}{screen_name}, $t-&gt;{text});

<span> </span>printf("%s: %s\n", $t-&gt;{user}{screen_name}, $t-&gt;{text});

<span> </span>print "sleep 4\n";

<span> </span>sleep(4);
<span> </span>}

<span> </span>$switch = 0;</pre>
<pre><span> </span>print "sleep 37\n";
<span> </span>sleep(37);
}

exit;</pre>
<p> </p>
<p><strong>3. Running</strong></p>
<p>Now, simply run the script:</p>
<p>$ perl ./growl_tweet.pl</p>
<p>And bingo! All your tweets appear! Leave a comment if it works and especially if it doesn&#8217;t &#8211; if there is enough interest I might consider adding features and real installer!</p>
<p> </p>
<p><strong>4. Here&#8217;s one I made earlier</strong></p>
<p>If you would like the code, you can down load it here (with out any formatting issues).</p>
<p><a title="Growl+Twitter" href="http://www.echo-technology.co.uk/development/twitter+growl/growl.pl.txt" target="_blank">http://www.echo-technology.co.uk/development/twitter+growl/growl.pl.txt</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.echo-technology.co.uk/2008/11/11/how-to-growl-and-twitter/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
	</channel>
</rss>
