<?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>timhodson.com</title>
	<atom:link href="http://timhodson.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://timhodson.com</link>
	<description>inventomatic</description>
	<lastBuildDate>Fri, 25 Jun 2010 16:28:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Diagnosis &#8211; A dialogue.</title>
		<link>http://timhodson.com/2010/06/diagnosis-a-dialogue/</link>
		<comments>http://timhodson.com/2010/06/diagnosis-a-dialogue/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 16:28:11 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Poetry]]></category>
		<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://timhodson.com/?p=377</guid>
		<description><![CDATA[I can see an end.
I see it in your face.
I see it in your eyes;
the things you don&#8217;t say.
The things you don&#8217;t say.
I see pain in your eyes,
I see pain in your face.
I can&#8217;t say sorry.
He can&#8217;t say sorry.
Sorry is meaningless,
confronted with nothing.
It&#8217;s not his to say sorry.
it&#8217;s my own diagnosis.
]]></description>
			<content:encoded><![CDATA[<blockquote><p>I can see an end.<br />
I see it in your face.<br />
I see it in your eyes;<br />
the things you don&#8217;t say.</p>
<p>The things you don&#8217;t say.<br />
I see pain in your eyes,<br />
I see pain in your face.<br />
I can&#8217;t say sorry.</p>
<p>He can&#8217;t say sorry.<br />
Sorry is meaningless,<br />
confronted with nothing.<br />
It&#8217;s not his to say sorry.<br />
it&#8217;s my own diagnosis.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://timhodson.com/2010/06/diagnosis-a-dialogue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An Easter Birdy</title>
		<link>http://timhodson.com/2010/04/an-easter-birdy/</link>
		<comments>http://timhodson.com/2010/04/an-easter-birdy/#comments</comments>
		<pubDate>Sat, 03 Apr 2010 15:28:55 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://timhodson.com/?p=368</guid>
		<description><![CDATA[Well it was time.
After about 2000 miles on the Dahon Vitesse D7, it was time to get a new bike. The Dahon had it&#8217;s fair share of problems. The frame split where the seat post frame tube met the cross tube &#8211; luckily within warranty, so a new frame was fitted. The wheels on the [...]]]></description>
			<content:encoded><![CDATA[<p>Well it was time.</p>
<p><img class="size-medium wp-image-369 alignleft" title="Dahon Unfolded" src="http://timhodson.com/wp-content/uploads/2010/04/Dahon-Unfolded-225x300.jpg" alt="" width="135" height="180" />After about 2000 miles on the Dahon Vitesse D7, it was time to get a new bike. The Dahon had it&#8217;s fair share of problems. The frame split where the seat post frame tube met the cross tube &#8211; luckily within warranty, so a new frame was fitted. The wheels on the Dahon where very poor.  On average a spoke broke on the rear wheel every three to four weeks.  Eventually I had the rear wheel rebuilt with new spokes.</p>
<p>Of course there was all the usual stuff with chains wearing and the like&#8230; but that is normal for a bike that does 8 miles a day four day&#8217;s a week. So the Dahon is being retired to &#8217;second bike&#8217; for use in emergencies.</p>
<p>So, what about the new bike?</p>
<p>I am now a proud owner of a Birdy Touring bike.</p>
<p><img class="alignleft size-medium wp-image-370" title="Birdy Touring 09" src="http://timhodson.com/wp-content/uploads/2010/04/09_Birdy_touring_blau-300x216.jpg" alt="" width="300" height="216" />This bike has 24 gears, nicely distributed from very low (hill climbing will be so much easier!) to pretty high. One of the things that I found with the Dahon was that there was not enough high end in the gears, and I was quickly at top speed, with a feeling that I could have gone further. The new bike has by contrast a massive high end in the gears. I topped 42 mph on the flat &#8211; with a tail wind!</p>
<p>It has full suspension using a combination of elastomer (rear) and spring/elastomer (front). And on a canal tow-path trip which varied from very uneven brick to muddy pools, it coped well.</p>
<p>It is fully kitted out with mudguards and Pannier racks (front and back).</p>
<p>And of course it folds.</p>
]]></content:encoded>
			<wfw:commentRss>http://timhodson.com/2010/04/an-easter-birdy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Outlook to Skype SMS</title>
		<link>http://timhodson.com/2010/03/outlook-to-skype-sms/</link>
		<comments>http://timhodson.com/2010/03/outlook-to-skype-sms/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 10:59:53 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://timhodson.com/?p=356</guid>
		<description><![CDATA[I wanted to know when a process on a customer&#8217;s server had failed. In fact I wanted it to wake me up in the middle of the night so that I could fix it.
About the only usable outbound communication supported by the server is email, but my phone is not email capable (well it is, [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to know when a process on a customer&#8217;s server had failed. In fact I wanted it to wake me up in the middle of the night so that I could fix it.</p>
<p>About the only usable outbound communication supported by the server is email, but my phone is not email capable (well it is, but not for work emails!).</p>
<p>So a colleague mentioned using MSN chat or Skype chat to send comments, and that set me wondering&#8230;</p>
<p><a href="https://developer.skype.com/Docs/Skype4COM" target="_blank">Skype has a COM library</a> which can be used to interface with the Skype application. (A reinstall of Skype with the Extras Manager option ticked was needed to get the library installed.) The Skype4COM library allows you to send SMS. Outlook of course allows you to apply rules to incoming mail messages, and one of these allows you to run some code in a VBA module (the <em>run a script</em> option).</p>
<p>So put it all together and we have:</p>
<ol>
<li>A script on the customer&#8217;s server will monitor another script&#8217;s progress. If it detects a particular condition it will generate an email sent to my work email account.</li>
<li>Outlook has a rule to look for specific text in the email subject (for example &#8220;ERROR&#8221;).  If it detects a suitable email, it will run a piece of VBA.</li>
<li>The VBA will call skype and send the SMS message</li>
</ol>
<h3>Installation of outlook VBA code</h3>
<ol>
<li>Add the code below to an outlook module</li>
<li>Add a reference to the Skype4COM object in the module.</li>
<li>Create a button in outlook that is linked to the macro SendTestSMS</li>
<li>Create a rule in outlook that searches your incoming mail and will &#8216;run a script&#8217; if it finds something. the script to run is the SendSMSRule VBA macro.</li>
</ol>
<h3>Running the solution</h3>
<ol>
<li>Have outlook running and make sure that macros are enabled.</li>
<li>Click the button you created in step 4 above and enter your phone number. The VBA app will remember your phone number, but you will want to send a test SMS, because you will probably have to &#8216;allow&#8217; outlook to access Skype the first time after starting outlook.  Skype will ask you for confirmation.</li>
<li>If Skype is not running, it will be started for you by the VBA code.</li>
<li>Have some credit in Skype for sending sms!</li>
<li>Wait for email&#8217;s to arrive.</li>
</ol>
<h3>The VBA Code</h3>
<pre class="brush:vb">Public Sub SendTestSMS()
    Dim strMsg As String
    Dim strContact As String
    Dim strPhoneNumber As String

    strPhoneNumber = GetSetting("SendSkypeSMS", "PhoneNumber", "Data", "")

    strContact = InputBox("Make sure you allow Outlook to use Skype when prompted in Skype." &amp; vbCrLf &amp; _
                            "You will probably have to do this for every session" &amp; vbCrLf &amp; _
                            "Enter your mobile number (+44123456789)", "Enter Phone Number", strPhoneNumber)

    SaveSetting "SendSkypeSMS", "PhoneNumber", "Data", strContact

    If Len(strContact) = 0 Then
        Exit Sub
    End If

    strMsg = "A test message from Outlook"
    subSendSMS strContact, strMsg

    strPhoneNumber = GetSetting("SendSkypeSMS", "PhoneNumber", "Data", "")
    MsgBox "Sent a text to: " &amp; strPhoneNumber
    SaveSetting "SendSkypeSMS", "PhoneNumber", "Data", strPhoneNumber

End Sub

Public Sub SendSMSRule(Item As Outlook.MailItem) 'Outlook will give us the mail item that matched the rule
    Dim strPhoneNumber As String

    strPhoneNumber = GetSetting("SendSkypeSMS", "PhoneNumber", "Data")

    If strPhoneNumber = "" Then
        MsgBox "You have to send a test SMS message so that I know what your phone number is!", vbCritical
        Exit Sub
    End If

    subSendSMS strPhoneNumber, Item.Subject

End Sub

Private Sub subSendSMS(strRecipients As String, strMessage As String)
    Dim objSkype        As SKYPE4COMLib.Skype
    Dim objSMS          As SKYPE4COMLib.SmsMessage

    Set objSkype = New SKYPE4COMLib.Skype

    If Not objSkype.Client.IsRunning Then
        objSkype.Client.Start
    End If

    objSkype.Attach , True

    Set objSMS = objSkype.CreateSms(smsMessageTypeOutgoing, strRecipients)

    With objSMS
        .Body = strMessage
        .Send
    End With

    objSkype.Convert.SmsMessageStatusToText (objaStatus)

KillObjects:
    Set objSMS = Nothing
    Set objSkype = Nothing
End Sub
</pre>
]]></content:encoded>
			<wfw:commentRss>http://timhodson.com/2010/03/outlook-to-skype-sms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Command line twitter</title>
		<link>http://timhodson.com/2010/02/commandline-twitter/</link>
		<comments>http://timhodson.com/2010/02/commandline-twitter/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 22:37:59 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://timhodson.com/?p=351</guid>
		<description><![CDATA[I had half a thought that I might want to have a wee utility to alert me that other wee utilities had finished whatever it was they were doing. So seeing as I usually have at least one terminal window open at a time, a minimal command line tool for twittering follows. called &#8216;twit&#8217;.
It has [...]]]></description>
			<content:encoded><![CDATA[<p>I had half a thought that I might want to have a wee utility to alert me that other wee utilities had finished whatever it was they were doing. So seeing as I usually have at least one terminal window open at a time, a minimal command line tool for twittering follows. called &#8216;twit&#8217;.</p>
<p>It has a dependency on your having cURL installed.</p>
<pre class="brush:bash/shell">
$cat `which twit`
#!/bin/bash
# script to post to twitter

USER=timhodson
PASS=twth0842
UPDATE=$1
LEN=${#UPDATE}
SILENT=$2

if [ "$SILENT" == "" ]; then
	SILENT="1>/dev/null 2>&#038;1"
fi

if [ $LEN -lt 140 ] ; then

	eval curl --basic --user $USER:$PASS --user-agent "twit/1.0" --data status=\"$UPDATE\" http://api.twitter.com/1/statuses/update.xml $SILENT

	if [ $? == 0 ]; then
		echo -e "Tweet Sent"
	fi
else
	echo -e "ERROR: tweet too long ($LEN)\a"
fi

#ends</pre>
]]></content:encoded>
			<wfw:commentRss>http://timhodson.com/2010/02/commandline-twitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Taking the plunge</title>
		<link>http://timhodson.com/2010/02/taking-the-plunge/</link>
		<comments>http://timhodson.com/2010/02/taking-the-plunge/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 21:08:31 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://timhodson.com/?p=344</guid>
		<description><![CDATA[Ever been really indecisive?
Yes?
No?
Taking the plunge by Tim Hodson is licensed under a Creative Commons Attribution-Non-Commercial-No Derivative Works 2.0 UK: England &#38; Wales License.Based on a work at timhodson.com.
]]></description>
			<content:encoded><![CDATA[<p>Ever been really indecisive?<br />
Yes?<br />
No?</p>

<iframe src="http://docs.google.com/viewer?url=http%3A%2F%2Ftimhodson.com%2Fwp-content%2Fuploads%2F2010%2F02%2Ftaking-the-plunge.pdf&embedded=true" width="600" height="300" frameborder="0" style="min-width:305px;" class="gde-frame"></iframe>

<p class="gde-text"><a href="http://timhodson.com/wp-content/uploads/2010/02/taking-the-plunge.pdf" target="_blank" class="gde-link">Download taking-the-plunge.pdf (PDF, 55.61KB)</a></p>
<p><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/uk/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-nd/2.0/uk/88x31.png" /></a><br /><span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/Text" property="dc:title" rel="dc:type">Taking the plunge</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://www.timhodson.com" property="cc:attributionName" rel="cc:attributionURL">Tim Hodson</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/uk/">Creative Commons Attribution-Non-Commercial-No Derivative Works 2.0 UK: England &amp; Wales License</a>.<br />Based on a work at <a xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://timhodson.com/wp-content/uploads/2010/02/taking-the-plunge.pdf" rel="dc:source">timhodson.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://timhodson.com/2010/02/taking-the-plunge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shepherd cries wolf</title>
		<link>http://timhodson.com/2010/02/shepherd-cries-wolf/</link>
		<comments>http://timhodson.com/2010/02/shepherd-cries-wolf/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 20:42:21 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://timhodson.com/?p=334</guid>
		<description><![CDATA[Shepherd cries wolf was written for a crib service at St Paul&#8217;s in Hereford.  The madder and the more like compo (last of the summer wine) the shepherd appears, the better.  
Released under the following license:
Shepherd Cries Wolf by Tim Hodson is licensed under a Creative Commons Attribution-Non-Commercial-No Derivative Works 2.0 UK: England &#38; [...]]]></description>
			<content:encoded><![CDATA[<p>Shepherd cries wolf was written for a crib service at St Paul&#8217;s in Hereford.  The madder and the more like compo (last of the summer wine) the shepherd appears, the better. <img src='http://timhodson.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<iframe src="http://docs.google.com/viewer?url=http%3A%2F%2Ftimhodson.com%2Fwp-content%2Fuploads%2F2010%2F02%2Fshepherdcrieswolf.pdf&embedded=true" width="600" height="300" frameborder="0" style="min-width:305px;" class="gde-frame"></iframe>

<p class="gde-text"><a href="http://timhodson.com/wp-content/uploads/2010/02/shepherdcrieswolf.pdf" target="_blank" class="gde-link">Download shepherdcrieswolf.pdf (PDF, 44.34KB)</a></p>
<p>Released under the following license:<br />
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/uk/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-nd/2.0/uk/88x31.png" /></a><br /><span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/Text" property="dc:title" rel="dc:type">Shepherd Cries Wolf</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://www.timhodson.com" property="cc:attributionName" rel="cc:attributionURL">Tim Hodson</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/uk/">Creative Commons Attribution-Non-Commercial-No Derivative Works 2.0 UK: England &amp; Wales License</a>.<br />Based on a work at <a xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://timhodson.com/2010/02/shepherd-cries-wolf/" rel="dc:source">timhodson.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://timhodson.com/2010/02/shepherd-cries-wolf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clive&#8217;s Funny Valentine</title>
		<link>http://timhodson.com/2010/02/clives-funny-valentine/</link>
		<comments>http://timhodson.com/2010/02/clives-funny-valentine/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 22:01:09 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://timhodson.com/?p=328</guid>
		<description><![CDATA[Written for a children&#8217;s talk at Lakeside Community Church Perton, this sketch was written with a view to being a screen play.
Hence the video.
Clive is waiting for a valentine day card from someone. anyone&#8230;


Clive&#8217;s Funny Valentine by Tim Hodson is licensed under a Creative Commons Attribution-Non-Commercial-No Derivative Works 2.0 UK: England &#38; Wales License.Based on [...]]]></description>
			<content:encoded><![CDATA[<p>Written for a children&#8217;s talk at <a href="http://lakesideperton.co.uk" target="_blank">Lakeside Community Church Perton</a>, this sketch was written with a view to being a screen play.</p>
<p>Hence the video.</p>
<p>Clive is waiting for a valentine day card from someone. anyone&#8230;</p>
<div style="text-align:center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/j0t9EfV8yHM&amp;hl=en_GB&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="385" src="http://www.youtube.com/v/j0t9EfV8yHM&amp;hl=en_GB&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object>
</div>

<iframe src="http://docs.google.com/viewer?url=http%3A%2F%2Ftimhodson.com%2Fwp-content%2Fuploads%2F2010%2F02%2FThe-Apostle-Clive-on-Valentines-day.pdf&embedded=true" width="600" height="300" frameborder="0" style="min-width:305px;" class="gde-frame"></iframe>

<p class="gde-text"><a href="http://timhodson.com/wp-content/uploads/2010/02/The-Apostle-Clive-on-Valentines-day.pdf" target="_blank" class="gde-link">Download The-Apostle-Clive-on-Valentines-day.pdf (PDF, 51.07KB)</a></p>
<p><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/uk/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-nd/2.0/uk/88x31.png" /></a><br /><span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/Text" property="dc:title" rel="dc:type">Clive&#8217;s Funny Valentine</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://www.timhodson.com" property="cc:attributionName" rel="cc:attributionURL">Tim Hodson</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/uk/">Creative Commons Attribution-Non-Commercial-No Derivative Works 2.0 UK: England &amp; Wales License</a>.<br />Based on a work at <a xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://timhodson.com/2010/02/clives-funny-valentine/" rel="dc:source">timhodson.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://timhodson.com/2010/02/clives-funny-valentine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A little bash deployment assistant</title>
		<link>http://timhodson.com/2010/02/a-little-bash-deployment-assistant/</link>
		<comments>http://timhodson.com/2010/02/a-little-bash-deployment-assistant/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 12:12:32 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://timhodson.com/?p=322</guid>
		<description><![CDATA[I wanted to copy some files from one directory to another while I am working on  my wordpress blog-in-blog plugin.  Basically I needed to copy the files checked out from svn, from the working directory, to the root of the web directory on my local machine.
Feature requirements:

Should only move a file if it has [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to copy some files from one directory to another while I am working on  my <a href="http://bit.ly/ds72eh" target="_blank">wordpress blog-in-blog plugin</a>.  Basically I needed to copy the files checked out from svn, from the working directory, to the root of the web directory on my local machine.</p>
<p>Feature requirements:</p>
<ul>
<li>Should only move a file if it has been edited. (we assume that the filesize will have changed by at least 1 byte!)</li>
<li>Should not just sit there copying all the time.</li>
<li>Should find out about all files in the specified directory.</li>
<li>Should report when it updated the file and which file was updated</li>
<li>First run should copy all files to the destination directory. (assumes I have updated my working copy from svn)</li>
</ul>
<p>So after several attempts, here is a more polished version which stores the filename and the last size of the file in a &#8216;bash hash&#8217;. OK bash doesn&#8217;t have hashes (mores the pity) but reading around on the web I found <a href="http://bit.ly/bQPeKq">this post</a> with a comment from <a href="http://www.omnisys.com/">Scott Mcdermott</a> which does the job nicely (once I had stripped offending characters from the file names).</p>
<p>So here is the full code of the deployment assistant:</p>
<pre class="brush:bash/shell">#!/bin/bash
# script to deploy code from SOURCEDIR to DELIVERDIR 

PROJECTNAME="blog-in-blog"
SOURCEDIR=blog-in-blog/trunk
DELIVERDIR=/var/www/wordpress/wp-content/plugins/blog-in-blog/
FILENAMES=blog-in-blog/trunk/*
LASTFILESIZE=0
COUNTER=1

echo "======================================================"
echo -e "delivering changes \n\tin \033[1m$SOURCEDIR\033[0m \n\tto \033[1m$DELIVERDIR\033[0m"
echo "======================================================"		

if [ -z $1 ]
then
	echo "usage$  $0 "
	exit 1
fi

hash_insert ()
{
	local name=$1 key=$2 val=$3
	eval __hash_${name}_${key}=$val
}

hash_find ()
{
	local name=$1 key=$2
	local var=__hash_${name}_${key}
	echo -n ${!var}
}

while true
do
	for FILE in $FILENAMES
	do
		FILESIZE=$(stat -c%s "$FILE")

		#tidy up file to avoid problems in variable name
		FILE=`basename $FILE`
		FILEORIG=$FILE
		FILE=`echo "$FILE" | sed 's/[\.\_-]//g'`

		LASTFILESIZE=`hash_find fileHash $FILE`
		#echo "filesize:"$FILESIZE
		#echo "lastfilesize:"$LASTFILESIZE
		if [ "$FILESIZE" != "$LASTFILESIZE" ]
		then
			echo "--- $COUNTER ---------------------------------------"
			date
			echo -e "deploying \033[1m$FILEORIG\033[0m from project $PROJECTNAME"
			echo "Size was $LASTFILESIZE bytes, now $FILESIZE bytes."
			cp $SOURCEDIR/$FILEORIG $DELIVERDIR
			hash_insert fileHash $FILE $FILESIZE
			UPDATE=1
		elif [ "$UPDATE" -ne "1" ]
		then
			UPDATE=0
		fi
	done

	if [ "$UPDATE" = 1 ]
	then
		echo "======================================================"
		let COUNTER+=1
		UPDATE=0
	fi

	sleep $1
done
#ends</pre>
]]></content:encoded>
			<wfw:commentRss>http://timhodson.com/2010/02/a-little-bash-deployment-assistant/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stop motion animation</title>
		<link>http://timhodson.com/2010/01/stop-motion-animation/</link>
		<comments>http://timhodson.com/2010/01/stop-motion-animation/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 14:26:15 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://timhodson.com/?p=308</guid>
		<description><![CDATA[This animation is a test using a DV camera and a little script I wrote to control it.
Basically I wanted to be able to use my DV camera to take single frames, which could then be rolled into a finished video.

A little shell script follows, which does just what I need, using dvgrab and ffplay.
#!/bin/bash
# [...]]]></description>
			<content:encoded><![CDATA[<p>This animation is a test using a DV camera and a little script I wrote to control it.</p>
<p>Basically I wanted to be able to use my DV camera to take single frames, which could then be rolled into a finished video.</p>
<div class="youtube-video" style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="wmode" value="transparent" /><param name="src" value="http://www.youtube.com/v/0IrpDmZhRd4&amp;feature=youtube_gdata" /><embed type="application/x-shockwave-flash" width="425" height="355" src="http://www.youtube.com/v/0IrpDmZhRd4&amp;feature=youtube_gdata" wmode="transparent"></embed></object></div>
<p>A little shell script follows, which does just what I need, using dvgrab and ffplay.</p>
<pre class="brush:bash/shell">#!/bin/bash
# script to take a shot with DV camera

count=1
calldir=`pwd`
wrapdir='wraps'

function help_me
{
echo -e "HELP!"
echo -e "h - shows this help!"
echo -e "s - takes a shot"
echo -e "p - shows a preview of all the shots so far"
echo -e "w - writes the shots to a wrap file in ./$wrapdir"
echo -e "q - quits\n"
}

help_me

if [ ! -d $calldir/$wrapdir ] ; then
mkdir $calldir/$wrapdir || exit
fi

while [ "$ans" != "q" ]
do

echo -e "I'm waiting for instructions:(h|s|p|w|q)"
read -sn1 ans

if [ "$ans" = "h" ] ; then

help_me

elif [ "$ans" = "s" ] ; then

echo -e "grabbing a frame"
dvgrab --every 25 --duration 1 2&gt;/dev/null
echo -e "grabbed $count\n\a"

count=$(($count+1))

elif [ "$ans" = "p" ] ; then

echo -e "Preview"
cat $calldir/*.dv | ffplay -
echo -e "Preview ended"

elif [ "$ans" = "w" ] ; then

echo -e "Wrapping up"
echo -e "Creating in in $calldir/$wrapdir"
echo -e "Enter filename for wrap:"

read filename

cd $calldir/$wrapdir || exit

cat $calldir/*.dv | dvgrab -stdin --format dv2 $filename 2&gt;/dev/null

clear

# reset count after wrapping file
count=1

echo -e "Tidying up last wrap: deleting $calldir/*.dv"
rm $calldir/*.dv

echo -e "Preview wrap"
ffplay $calldir/$wrapdir/$filename*
echo -e "Preview wrap ended"

cd $calldir || exit

elif [ "$ans" = "q" ] ; then

echo -e "Quitting...\n"
exit

fi

done</pre>
]]></content:encoded>
			<wfw:commentRss>http://timhodson.com/2010/01/stop-motion-animation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Day in the life&#8230;</title>
		<link>http://timhodson.com/2010/01/a-day-in-the-life/</link>
		<comments>http://timhodson.com/2010/01/a-day-in-the-life/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 14:14:58 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://timhodson.com/2010/01/a-day-in-the-life/</guid>
		<description><![CDATA[
A Day In The Life.  
]]></description>
			<content:encoded><![CDATA[<div class="youtube-video"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="wmode" value="transparent" /><param name="src" value="http://www.youtube.com/v/_SPLNcphtSw&amp;feature=youtube_gdata" /><embed type="application/x-shockwave-flash" width="425" height="355" src="http://www.youtube.com/v/_SPLNcphtSw&amp;feature=youtube_gdata" wmode="transparent"></embed></object></div>
<p>A Day In The Life. <img src='http://timhodson.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://timhodson.com/2010/01/a-day-in-the-life/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
