<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss version="2.0">
  <channel>
    <title>digital:pardoe Blog</title>
    <link>http://digitalpardoe.co.uk/</link>
    <description>digital:pardoe main blog feed.</description>
    <language>en-en</language>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/digitalpardoe/blog/feed" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
      <title>Software Updates</title>
      <description>&lt;p&gt;I&amp;#8217;ve finally gotten round to updating iSyncIt and Set Icon for Snow Leopard, as always you can download iSyncIt &lt;a href="http://digitalpardoe.co.uk/software/show/1_iSyncIt"&gt;here&lt;/a&gt; and Set Icon &lt;a href="http://digitalpardoe.co.uk/software/show/10_Set_Icon"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The new release of iSyncIt fixes the only bug I could find under Snow Leopard &amp;#8211; the icon not changing correctly under bluetooth on / off conditions.&lt;/p&gt;
&lt;p&gt;The Set Icon release fixes the problem of the application not performing it&amp;#8217;s one and only function &amp;#8211; setting a drive icon. Along with the bug fix I modified the image conversion to prevent the (frankly awful) stretching of non-square images to fill a 512&amp;#215;512 icon, images now scale nicely. I also removed the terrible tool-tips that show up when you start the application I used to think they were &amp;#8216;cool&amp;#8217; but soon realised the error of my ways. However, in place of this I added some &amp;#8216;brilliant&amp;#8217; window resizing when you remove an icon &amp;#8211; we&amp;#8217;ll see how long that lasts. Oh, the application will also run as a 64 bit application now &amp;#8211; not that &lt;em&gt;that&lt;/em&gt; makes any difference what-so-ever, I just did it because I could.&lt;/p&gt;
&lt;p&gt;Check back soon.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9sDIBBtQDkMRHLd11pMRLQR6Oks/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9sDIBBtQDkMRHLd11pMRLQR6Oks/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/9sDIBBtQDkMRHLd11pMRLQR6Oks/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9sDIBBtQDkMRHLd11pMRLQR6Oks/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 10 Sep 2009 10:28:32 +0100</pubDate>
      <author>Alex</author>
      <link>http://digitalpardoe.co.uk/blog/show/124_Software_Updates</link>
    </item>
    <item>
      <title>Clearing Out Old Sessions</title>
      <description>&lt;p&gt;A while ago I started setting up my websites to use ActiveRecord as a session store, this means that the session information for all the visitors to my website is placed in a table in my database. It may or may not be the best way to store sessions but it&amp;#8217;s certainly faster than the filesystem and my VPS doesn&amp;#8217;t really have the memory capacity for an &amp;#8216;in memory&amp;#8217; store.&lt;/p&gt;
&lt;p&gt;Anyway, one day I decided to perform some DB maintenance, check tables where okay etc, upon logging into the DB I noticed that my sessions table had grown quite large, almost 125,000 records, little did I realize that the sessions are persisted forever in the DB.&lt;/p&gt;
&lt;p&gt;I didn&amp;#8217;t think it was the best idea to keep all the session data so wrote the following script and put it in &amp;#8216;lib/tasks/session.rake&amp;#8217;;&lt;/p&gt;
&lt;pre class="syntax"&gt;namespace &lt;span class="UserDefinedConstant"&gt;&lt;span class="VariablePunctuation"&gt;:&lt;/span&gt;session&lt;/span&gt; &lt;span class="HackKeywordControlRubyStartBlock"&gt;do&lt;/span&gt;
    desc &lt;span class="String"&gt;&lt;span class="StringPunctuation"&gt;&amp;quot;&lt;/span&gt;Prune old session data&lt;span class="StringPunctuation"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
    task &lt;span class="UserDefinedConstant"&gt;&lt;span class="VariablePunctuation"&gt;:&lt;/span&gt;prune&lt;/span&gt; &lt;span class="ObjectPunctuation"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="UserDefinedConstant"&gt;&lt;span class="VariablePunctuation"&gt;:&lt;/span&gt;environment&lt;/span&gt; &lt;span class="HackKeywordControlRubyStartBlock"&gt;do&lt;/span&gt;
        sql &lt;span class="KeywordOperator"&gt;=&lt;/span&gt; &lt;span class="LibraryClassType"&gt;ActiveRecord&lt;/span&gt;&lt;span class="Function"&gt;&lt;span class="MetaDelimiter"&gt;::&lt;/span&gt;&lt;span class="SpecialFunction"&gt;Base&lt;/span&gt;&lt;/span&gt;&lt;span class="Function"&gt;&lt;span class="MetaDelimiter"&gt;.&lt;/span&gt;&lt;span class="SpecialFunction"&gt;connection&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaBraceCurlyFunction"&gt;(&lt;/span&gt;&lt;span class="MetaBraceCurlyFunction"&gt;)&lt;/span&gt;
        sql&lt;span class="Function"&gt;&lt;span class="MetaDelimiter"&gt;.&lt;/span&gt;&lt;span class="SpecialFunction"&gt;execute&lt;/span&gt;&lt;/span&gt; &lt;span class="String"&gt;&lt;span class="StringPunctuation"&gt;&amp;quot;&lt;/span&gt;SET autocommit=0&lt;span class="StringPunctuation"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
        sql&lt;span class="Function"&gt;&lt;span class="MetaDelimiter"&gt;.&lt;/span&gt;&lt;span class="SpecialFunction"&gt;begin_db_transaction&lt;/span&gt;&lt;/span&gt;
            response &lt;span class="KeywordOperator"&gt;=&lt;/span&gt; sql&lt;span class="Function"&gt;&lt;span class="MetaDelimiter"&gt;.&lt;/span&gt;&lt;span class="SpecialFunction"&gt;execute&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaBraceCurlyFunction"&gt;(&lt;/span&gt;&lt;span class="String"&gt;&lt;span class="StringPunctuation"&gt;&amp;quot;&lt;/span&gt;DELETE FROM sessions WHERE `updated_at` &amp;lt; DATE_SUB(CURDATE(), INTERVAL 1 DAY)&lt;span class="StringPunctuation"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaBraceCurlyFunction"&gt;)&lt;/span&gt;&lt;span class="Source"&gt;;&lt;/span&gt;
        sql&lt;span class="Function"&gt;&lt;span class="MetaDelimiter"&gt;.&lt;/span&gt;&lt;span class="SpecialFunction"&gt;commit_db_transaction&lt;/span&gt;&lt;/span&gt;
    &lt;span class="KeywordControl"&gt;end&lt;/span&gt;
&lt;span class="KeywordControl"&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;This gave me a &amp;#8216;session:prune&amp;#8217; rake task. The task removes all sessions older than 1 day from the sessions table. I then added a  &lt;a href="http://en.wikipedia.org/wiki/Cron" target="_blank"&gt;CRON&lt;/a&gt; job for in the following format;&lt;/p&gt;
&lt;pre&gt;
0 0 * * * cd /home/user/railsapp &amp;amp;&amp;amp; rake RAILS_ENV=production session:prune &amp;gt; /dev/null 2&amp;gt;&amp;amp;1
&lt;/pre&gt;
&lt;p&gt;The job above basically calls the &amp;#8216;session:prune&amp;#8217; rake task at midnight every night.&lt;/p&gt;
&lt;p&gt;The code in the task in MySQL specific but without a model representing the session table I couldn&amp;#8217;t (or at least couldn&amp;#8217;t think of a way) to make the code any more ruby-fied. In the event that you do have, or decide to create a session model the following code may work in your task (&lt;strong&gt;warning:&lt;/strong&gt; untested);&lt;/p&gt;
&lt;pre class="syntax"&gt;&lt;span class="LibraryClassType"&gt;Session&lt;/span&gt;&lt;span class="Function"&gt;&lt;span class="MetaDelimiter"&gt;.&lt;/span&gt;&lt;span class="SpecialFunction"&gt;destroy_all&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaBraceCurlyFunction"&gt;(&lt;/span&gt;&lt;span class="String"&gt;&lt;span class="StringPunctuation"&gt;&amp;quot;&lt;/span&gt;created_at&lt;span class="StringPunctuation"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class="KeywordOperator"&gt;&amp;lt;&lt;/span&gt; &lt;span class="MetaBraceCurlyFunction"&gt;(&lt;/span&gt;&lt;span class="LibraryClassType"&gt;Time&lt;/span&gt;&lt;span class="Function"&gt;&lt;span class="MetaDelimiter"&gt;.&lt;/span&gt;&lt;span class="SpecialFunction"&gt;now&lt;/span&gt;&lt;/span&gt; &lt;span class="KeywordOperator"&gt;-&lt;/span&gt; &lt;span class="Number"&gt;1&lt;/span&gt;&lt;span class="Function"&gt;&lt;span class="MetaDelimiter"&gt;.&lt;/span&gt;&lt;span class="SpecialFunction"&gt;day&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaBraceCurlyFunction"&gt;)&lt;/span&gt;&lt;span class="MetaBraceCurlyFunction"&gt;)&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;Hope the above snippet solves at least one of your ActiveRecord session woes.&lt;/p&gt;
&lt;p&gt;Check back soon.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/XIAwal2Bz4cwdI73RZhedbV7ZU0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/XIAwal2Bz4cwdI73RZhedbV7ZU0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/XIAwal2Bz4cwdI73RZhedbV7ZU0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/XIAwal2Bz4cwdI73RZhedbV7ZU0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 03 May 2009 18:31:00 +0100</pubDate>
      <author>Alex</author>
      <link>http://digitalpardoe.co.uk/blog/show/123_Clearing_Out_Old_Sessions</link>
    </item>
    <item>
      <title>Clearing Out The rFlickr Cache</title>
      <description>&lt;p&gt;Assuming you&amp;#8217;ve followed the &lt;a href="http://digitalpardoe.co.uk/blog/show/111_Caching_Your_Photographs"&gt;Caching Your Photographs&lt;/a&gt; tutorial at some point, you&amp;#8217;ll probably have had a lot of fun either deleting the cache every time you upload a new photo or you&amp;#8217;ve written your own automated method by now. For those of you that haven&amp;#8217;t written your own method of dumping the cache yet, here&amp;#8217;s how I do it.&lt;/p&gt;
&lt;p&gt;First of all, I created a &amp;#8216;lib/actions&amp;#8217; folder in the root of my rails project. Inside this folder I created the file &amp;#8216;photography_action.rb&amp;#8217; with the following contents;&lt;/p&gt;
&lt;pre class="syntax"&gt;&lt;span class="Class"&gt;&lt;span class="KeywordControl"&gt;class&lt;/span&gt; &lt;span class="ClassName"&gt;PhotographyAction&lt;/span&gt;&lt;/span&gt;
    &lt;span class="Function"&gt;&lt;span class="KeywordControl"&gt;def&lt;/span&gt; &lt;span class="FunctionName"&gt;self.clear_cache&lt;/span&gt;&lt;/span&gt;
        &lt;span class="LibraryClassType"&gt;ActionController&lt;/span&gt;&lt;span class="Function"&gt;&lt;span class="MetaDelimiter"&gt;::&lt;/span&gt;&lt;span class="SpecialFunction"&gt;Base&lt;/span&gt;&lt;/span&gt;&lt;span class="Function"&gt;&lt;span class="MetaDelimiter"&gt;.&lt;/span&gt;&lt;span class="SpecialFunction"&gt;new&lt;/span&gt;&lt;/span&gt;&lt;span class="Function"&gt;&lt;span class="MetaDelimiter"&gt;.&lt;/span&gt;&lt;span class="SpecialFunction"&gt;expire_fragment&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaBraceCurlyFunction"&gt;(&lt;/span&gt;&lt;span class="StringRegex"&gt;&lt;span class="StringPunctuationIi"&gt;%r{&lt;/span&gt;photography.cache&lt;span class="StringPunctuationIi"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaBraceCurlyFunction"&gt;)&lt;/span&gt;
    &lt;span class="KeywordControl"&gt;end&lt;/span&gt;
&lt;span class="KeywordControl"&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;The above fragment naming assumes that your photos are on a page called &amp;#8216;photography&amp;#8217; if they are elsewhere, change the fragment to expire that page instead.&lt;/p&gt;
&lt;p&gt;Fairly simple I think you&amp;#8217;ll agree, you may also be asking yourself &amp;#8216;why the extra file?&amp;#8217;, the main reason for the new file is so that the cache clearing can be executed from a new rake task that doesn&amp;#8217;t remove &lt;em&gt;all&lt;/em&gt; your cached pages or from an admin page on the website.&lt;/p&gt;
&lt;p&gt;You&amp;#8217;ll also need to update your &amp;#8216;config.load_paths&amp;#8217; in &amp;#8216;environment.rb&amp;#8217;. After updating, mine looks like this;&lt;/p&gt;
&lt;pre class="syntax"&gt;config&lt;span class="Function"&gt;&lt;span class="MetaDelimiter"&gt;.&lt;/span&gt;&lt;span class="SpecialFunction"&gt;load_paths&lt;/span&gt;&lt;/span&gt; &lt;span class="KeywordOperator"&gt;+=&lt;/span&gt; &lt;span class="String"&gt;&lt;span class="StringPunctuation"&gt;%W(&lt;/span&gt; &lt;span class="SourceStringSource"&gt;&lt;span class="StringEmbeddedSource"&gt;#{&lt;/span&gt;&lt;span class="ConstantVariable"&gt;RAILS_ROOT&lt;/span&gt;&lt;span class="StringEmbeddedSource"&gt;}&lt;/span&gt;&lt;/span&gt;/app/sweepers &lt;span class="SourceStringSource"&gt;&lt;span class="StringEmbeddedSource"&gt;#{&lt;/span&gt;&lt;span class="ConstantVariable"&gt;RAILS_ROOT&lt;/span&gt;&lt;span class="StringEmbeddedSource"&gt;}&lt;/span&gt;&lt;/span&gt;/lib/actions &lt;span class="StringPunctuation"&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;Inside some action in some, preferably protected, controller somewhere, add the following (redirecting to anywhere you fancy);&lt;/p&gt;
&lt;pre class="syntax"&gt;&lt;span class="LibraryClassType"&gt;PhotographyAction&lt;/span&gt;&lt;span class="Function"&gt;&lt;span class="MetaDelimiter"&gt;.&lt;/span&gt;&lt;span class="SpecialFunction"&gt;clear_cache&lt;/span&gt;&lt;/span&gt;
&lt;span class="LibraryFunction"&gt;redirect_to&lt;/span&gt; &lt;span class="UserDefinedConstant"&gt;&lt;span class="VariablePunctuation"&gt;:&lt;/span&gt;action&lt;/span&gt; &lt;span class="ObjectPunctuation"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="String"&gt;&lt;span class="StringPunctuation"&gt;'&lt;/span&gt;index&lt;span class="StringPunctuation"&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;Now for the rake task. Inside the directory &amp;#8216;lib/tasks&amp;#8217; (create it if it doesn&amp;#8217;t exists) create the file &amp;#8216;photography.rake&amp;#8217; then put the following code inside the file;&lt;/p&gt;
&lt;pre class="syntax"&gt;namespace &lt;span class="UserDefinedConstant"&gt;&lt;span class="VariablePunctuation"&gt;:&lt;/span&gt;photo&lt;/span&gt; &lt;span class="HackKeywordControlRubyStartBlock"&gt;do&lt;/span&gt;
    namespace &lt;span class="UserDefinedConstant"&gt;&lt;span class="VariablePunctuation"&gt;:&lt;/span&gt;cache&lt;/span&gt; &lt;span class="HackKeywordControlRubyStartBlock"&gt;do&lt;/span&gt;
        desc &lt;span class="String"&gt;&lt;span class="StringPunctuation"&gt;&amp;quot;&lt;/span&gt;Clear out photography cache&lt;span class="StringPunctuation"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
        task &lt;span class="UserDefinedConstant"&gt;&lt;span class="VariablePunctuation"&gt;:&lt;/span&gt;clear&lt;/span&gt; &lt;span class="ObjectPunctuation"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="UserDefinedConstant"&gt;&lt;span class="VariablePunctuation"&gt;:&lt;/span&gt;environment&lt;/span&gt; &lt;span class="HackKeywordControlRubyStartBlock"&gt;do&lt;/span&gt;
            &lt;span class="LibraryClassType"&gt;PhotographyAction&lt;/span&gt;&lt;span class="Function"&gt;&lt;span class="MetaDelimiter"&gt;.&lt;/span&gt;&lt;span class="SpecialFunction"&gt;clear_cache&lt;/span&gt;&lt;/span&gt;
        &lt;span class="KeywordControl"&gt;end&lt;/span&gt;
    &lt;span class="KeywordControl"&gt;end&lt;/span&gt;
&lt;span class="KeywordControl"&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;You should then be able to run;&lt;/p&gt;
&lt;pre&gt;
rake photo:cache:clear
&lt;/pre&gt;
&lt;p&gt;From the base of your project in order to clear the cache.&lt;/p&gt;
&lt;p&gt;Bear in mind, the code above is literally just a convenient way of clearing out the fragment cache so new photos show up on your photo page, it does not delete photos, nor does it perform a refresh automatically, although, you could add it to a &lt;a href="http://en.wikipedia.org/wiki/Cron" target="_blank"&gt;CRON&lt;/a&gt; job.&lt;/p&gt;
&lt;p&gt;When I get chance, I intend to automate this process and build it into &lt;a href="http://github.com/digitalpardoe/rflickr" target="_blank"&gt;rFlickr&lt;/a&gt; along with a new, improved, caching mechanism. I&amp;#8217;m sure the above will tide you over for now though.&lt;/p&gt;
&lt;p&gt;Check back soon.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Zl5v1exrh802nyob4K5pwa38qEY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Zl5v1exrh802nyob4K5pwa38qEY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Zl5v1exrh802nyob4K5pwa38qEY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Zl5v1exrh802nyob4K5pwa38qEY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 03 May 2009 17:50:00 +0100</pubDate>
      <author>Alex</author>
      <link>http://digitalpardoe.co.uk/blog/show/122_Clearing_Out_The_rFlickr_Cache</link>
    </item>
    <item>
      <title>New rFlickr Ruby Gem</title>
      <description>&lt;p&gt;After I started to use the rFlickr gem it didn&amp;#8217;t take me long to realize that development of the gem had all but halted, yes it worked, which was more than the original Flickr gem did, but it was still a little bit out of date and in the end, a little bit broken.&lt;/p&gt;
&lt;p&gt;In one of my &lt;a href="http://digitalpardoe.co.uk/blog/show/105"&gt;older posts&lt;/a&gt; I documented a fix for the gem and provided a download to unzip into your plugins folder, however, with the advent of the wonderful GitHub and it&amp;#8217;s marvelous gem support I&amp;#8217;ve decided to move the project onto GitHub.&lt;/p&gt;
&lt;p&gt;I have preserved the original gem&amp;#8217;s GPL license and copied the source code from it&amp;#8217;s original repository on &lt;a href="http://rubyforge.org/projects/rflickr/" target="_blank"&gt;RubyForge&lt;/a&gt; to a new, public, GitHub repository. In the process of the move I have dropped old code from the project, updated the readme &amp;amp; license information and generally performed a little house-keeping.&lt;/p&gt;
&lt;p&gt;You can find the project at: &lt;a href="http://github.com/digitalpardoe/rflickr/" target="_blank"&gt;http://github.com/digitalpardoe/rflickr/&lt;/a&gt;. You can install the gem using one of the following methods. First involves adding GitHub as a gem source (always a good idea) and installing the gem:&lt;/p&gt;
&lt;pre class="syntax"&gt;$ gem sources -a http://gems.github.com
$ sudo gem install digitalpardoe-rflickr
&lt;/pre&gt;
&lt;p&gt;The second method it to add the gem as a gem dependency to the environment.rb of your Rails project:&lt;/p&gt;
&lt;pre class="syntax"&gt;config.gem &lt;span class="String"&gt;&lt;span class="StringPunctuation"&gt;'&lt;/span&gt;digitalpardoe-rflickr&lt;span class="StringPunctuation"&gt;'&lt;/span&gt;&lt;/span&gt;, :lib =&lt;span class="KeywordOperator"&gt;&amp;gt;&lt;/span&gt; &lt;span class="String"&gt;&lt;span class="StringPunctuation"&gt;'&lt;/span&gt;flickr&lt;span class="StringPunctuation"&gt;'&lt;/span&gt;&lt;/span&gt;, :source =&lt;span class="KeywordOperator"&gt;&amp;gt;&lt;/span&gt; &lt;span class="String"&gt;&lt;span class="StringPunctuation"&gt;'&lt;/span&gt;http://gems.github.com&lt;span class="StringPunctuation"&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;And run a rake task to install the gem:&lt;/p&gt;
&lt;pre class="syntax"&gt;$ sudo rake gems:install
&lt;/pre&gt;
&lt;p&gt;Whilst performing the code migration I also added the fix that was documented in my original post and implemented support for the (not so) new &amp;#8216;farm&amp;#8217; based Flickr URLs for images (which should make things easier to implement).&lt;/p&gt;
&lt;p&gt;The future plans for rFlickr include new tests, improved usage examples, updated readme / documentation and implementation of missing API methods, time permitting of course.&lt;/p&gt;
&lt;p&gt;Until the readme is updated please refer to the original post for information on &lt;a href="http://digitalpardoe.co.uk/blog/show/87"&gt;how to use rFlickr&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;That&amp;#8217;s all for now, enjoy the new gem and as they say, if you don&amp;#8217;t like it, fork it.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/JmuEACpt_KksNLBnuHARoY3bjwQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JmuEACpt_KksNLBnuHARoY3bjwQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/JmuEACpt_KksNLBnuHARoY3bjwQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JmuEACpt_KksNLBnuHARoY3bjwQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 12 Mar 2009 21:22:00 +0000</pubDate>
      <author>Alex</author>
      <link>http://digitalpardoe.co.uk/blog/show/121_New_rFlickr_Ruby_Gem</link>
    </item>
    <item>
      <title>Guess Who&amp;#8217;s Back</title>
      <description>&lt;p&gt;As you may have noticed, it&amp;#8217;s been a long time since my last post. There isn&amp;#8217;t really any good reason for this. Plenty has happened, I just haven&amp;#8217;t got round to writing any of it down.&lt;/p&gt;
&lt;p&gt;First off I&amp;#8217;d like to mention the website, it went through a fairly radical redesign a few months ago and I mentioned nothing about it. For some reason it&amp;#8217;s not in my nature to be happy with what I make hence the many faces and iterations of the website. This website, whilst being my home on the internet, is also the test bed for my RoR programming, you may get tired of hearing about it&amp;#8217;s re-designs and re-codes but that&amp;#8217;s part of the reason I created it. Anyway, another re-design is coming, this time it&amp;#8217;s not visual but all back end, the main difference you will notice is that I am doing away with user accounts and having a more open comment system (I could be shooting myself in the foot with this decision, we&amp;#8217;ll have to see how the spam bots take it). To the people that have commented on the blog already, your comments will be preserved and, when I roll out the changes, I intend to reply to all the comments I haven&amp;#8217;t yet replied to.&lt;/p&gt;
&lt;p&gt;The second thing I wanted to mention, again website related, is my hosting. A good proportion of my posts seem to be apologizing for the downtime of the website. I was actually getting pretty bored of this so decided to, quite literally, take matters into my own hands. The website is now hosted on a virtual private server set up and maintained by me. This again, may be a case where I&amp;#8217;ve shot myself in the foot. For those of you interested, the VPS is provided by the wonderful folks at &lt;a href="http://www.bytemark.co.uk/" target="_blank"&gt;Bytemark Hosting&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Number three. Many of the posts of my website relate to the use of the &amp;#8216;rflickr&amp;#8217; RubyGem. Development of this gem seems to have been at a stand still for a good while now, I&amp;#8217;ve therefore taken the decision to clone it and try to continue development in my spare time. More on this in a later post.&lt;/p&gt;
&lt;p&gt;Four. Any of you interested in my photography will have noticed a lack of it over the past few months, it&amp;#8217;s not that I haven&amp;#8217;t been taking any photographs, it&amp;#8217;s just that I&amp;#8217;ve not published any. To try and remedy this I uploaded a batch of photos today that have been sitting on my computer for a while. You can take a look at them on the &lt;a href="http://digitalpardoe.co.uk/photography"&gt;photo&lt;/a&gt; page of the website or on my &lt;a href="http://www.flickr.com/photos/digitalpardoe/" target="_blank"&gt;Flickr page&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Eqk1Za78AB9mdHZEXIY5wU2jG7c/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Eqk1Za78AB9mdHZEXIY5wU2jG7c/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Eqk1Za78AB9mdHZEXIY5wU2jG7c/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Eqk1Za78AB9mdHZEXIY5wU2jG7c/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 08 Mar 2009 17:19:00 +0000</pubDate>
      <author>Alex</author>
      <link>http://digitalpardoe.co.uk/blog/show/120_Guess_Whos_Back</link>
    </item>
    <item>
      <title>Arghh, Downtime</title>
      <description>&lt;p&gt;Apologies to anyone that has visited the website in the last couple of days, it would appear that there has been a fairly large amount of downtime. Everything is back up and operational again. I will be keeping a closer eye on the status of the website from now on to try and prevent this type of situation arising again. Thanks for your understanding.&lt;/p&gt;
&lt;p&gt;Check back soon.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; It would also appear that the category browsing is currently broken, I am working on a fix and will push it out shortly.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/I81TumnPFPUGl7r9oo7vUzRW1iA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/I81TumnPFPUGl7r9oo7vUzRW1iA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/I81TumnPFPUGl7r9oo7vUzRW1iA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/I81TumnPFPUGl7r9oo7vUzRW1iA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 06 Nov 2008 09:39:00 +0000</pubDate>
      <author>Alex</author>
      <link>http://digitalpardoe.co.uk/blog/show/118_Arghh_Downtime</link>
    </item>
    <item>
      <title>Just An Introduction</title>
      <description>&lt;p&gt;I&amp;#8217;ve been promising to write this post for a while now, it is exactly what is says in the title, an introduction. A good friend of mine, after much persuasion has finally &amp;#8216;got his blog on&amp;#8217;. Fortunately he has a far better blogging style than me and blogs far more often so it shouldn&amp;#8217;t be too much of a strain on the senses to bookmark him and/or add him to your feed reader. Funnily enough he is also a keen photographer so don&amp;#8217;t forget to check out his Flickr page, you&amp;#8217;ll find a link from his blog.&lt;/p&gt;
&lt;p&gt;So here he is, (drum roll please), Mr Rob Young: &lt;a href="http://robyoung.me.uk/" target="_blank"&gt;robyoung.me.uk&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Be nice, I don&amp;#8217;t want him scared back off the internet, it took long enough to get him on here.&lt;/p&gt;
&lt;p&gt;Don&amp;#8217;t forget to check back here sometimes too.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/7ZfhxsJ5VNGh_Lv6K6L8ev_teZk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7ZfhxsJ5VNGh_Lv6K6L8ev_teZk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/7ZfhxsJ5VNGh_Lv6K6L8ev_teZk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7ZfhxsJ5VNGh_Lv6K6L8ev_teZk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 12 Oct 2008 17:51:00 +0100</pubDate>
      <author>Alex</author>
      <link>http://digitalpardoe.co.uk/blog/show/117_Just_An_Introduction</link>
    </item>
    <item>
      <title>Calculating Work Days In Java</title>
      <description>&lt;p&gt;In work this week I came across a couple of problems in which I needed to performs some calculations involving dates and a number of &amp;#8220;work days&amp;#8221; rather than just normal numbers of days. My first few attempts filed miserably, so I did some Googling to see if I could find anyone else that had come across the same problem and of course, there were plenty of people.&lt;/p&gt;
&lt;p&gt;The code I eventually used I found shoehorned into the middle of a coding help forum and, with a little bit of tweaking, it calculated the number of whole work days in between two dates. The code is as follows;&lt;/p&gt;
&lt;pre class="syntax"&gt;&lt;span class="ClassMethod"&gt;&lt;span class="StorageModifier"&gt;public static &lt;/span&gt;&lt;span class="Storage"&gt;int&lt;/span&gt; &lt;span class="FunctionName"&gt;calculateDuration&lt;/span&gt;&lt;span class="FunctionArgument"&gt;(&lt;span class="LibraryClassType"&gt;Date&lt;/span&gt; startDate, &lt;span class="LibraryClassType"&gt;Date&lt;/span&gt; endDate&lt;/span&gt;)&lt;/span&gt;
&lt;span class="ClassMethod"&gt;&lt;/span&gt;{
    &lt;span class="LibraryClassType"&gt;Calendar&lt;/span&gt; startCal = &lt;span class="LibraryClassType"&gt;Calendar&lt;/span&gt;.getInstance();
    startCal.setTime(startDate);

    &lt;span class="LibraryClassType"&gt;Calendar&lt;/span&gt; endCal = &lt;span class="LibraryClassType"&gt;Calendar&lt;/span&gt;.getInstance();
    endCal.setTime(endDate);

    &lt;span class="Storage"&gt;int&lt;/span&gt; workDays = &lt;span class="Number"&gt;0&lt;/span&gt;;

    &lt;span class="KeywordControl"&gt;if&lt;/span&gt; (startCal.getTimeInMillis() &lt;span class="KeywordOperator"&gt;&amp;gt;&lt;/span&gt; endCal.getTimeInMillis())
    {
        startCal.setTime(endDate);
        endCal.setTime(startDate);
    }

    &lt;span class="KeywordControl"&gt;do&lt;/span&gt;
    {
        startCal.add(&lt;span class="LibraryClassType"&gt;Calendar&lt;/span&gt;.&lt;span class="BuiltInConstant"&gt;DAY_OF_MONTH&lt;/span&gt;, &lt;span class="Number"&gt;1&lt;/span&gt;);
        &lt;span class="KeywordControl"&gt;if&lt;/span&gt; (startCal.get(&lt;span class="LibraryClassType"&gt;Calendar&lt;/span&gt;.&lt;span class="BuiltInConstant"&gt;DAY_OF_WEEK&lt;/span&gt;) &lt;span class="KeywordOperator"&gt;!=&lt;/span&gt; &lt;span class="LibraryClassType"&gt;Calendar&lt;/span&gt;.&lt;span class="BuiltInConstant"&gt;SATURDAY&lt;/span&gt; &lt;span class="KeywordOperator"&gt;&amp;amp;&amp;amp;&lt;/span&gt; startCal.get(&lt;span class="LibraryClassType"&gt;Calendar&lt;/span&gt;.&lt;span class="BuiltInConstant"&gt;DAY_OF_WEEK&lt;/span&gt;) &lt;span class="KeywordOperator"&gt;!=&lt;/span&gt; &lt;span class="LibraryClassType"&gt;Calendar&lt;/span&gt;.&lt;span class="BuiltInConstant"&gt;SUNDAY&lt;/span&gt;)
        {
            workDays&lt;span class="KeywordOperator"&gt;++&lt;/span&gt;;
        }
    }
    &lt;span class="KeywordControl"&gt;while&lt;/span&gt; (startCal.getTimeInMillis() &lt;span class="KeywordOperator"&gt;&amp;lt;=&lt;/span&gt; endCal.getTimeInMillis());

    &lt;span class="KeywordControl"&gt;return&lt;/span&gt; workDays;
}
&lt;/pre&gt;
&lt;p&gt;This code solved my first problem, however I couldn&amp;#8217;t find any code to solve my second problem, how to calculate a final date from a start date and a specified number of work days, to do the calculation I came up with the following code;&lt;/p&gt;
&lt;pre class="syntax"&gt;&lt;span class="ClassMethod"&gt;&lt;span class="StorageModifier"&gt;public static &lt;/span&gt;&lt;span class="Storage"&gt;Date&lt;/span&gt; &lt;span class="FunctionName"&gt;calculateEndDate&lt;/span&gt;&lt;span class="FunctionArgument"&gt;(&lt;span class="LibraryClassType"&gt;Date&lt;/span&gt; startDate, &lt;span class="Storage"&gt;int&lt;/span&gt; duration&lt;/span&gt;)&lt;/span&gt;
&lt;span class="ClassMethod"&gt;&lt;/span&gt;{        
    &lt;span class="LibraryClassType"&gt;Calendar&lt;/span&gt; startCal = &lt;span class="LibraryClassType"&gt;Calendar&lt;/span&gt;.getInstance();

    startCal.setTime(startDate);
        
    &lt;span class="KeywordControl"&gt;for&lt;/span&gt; (&lt;span class="Storage"&gt;int&lt;/span&gt; i = &lt;span class="Number"&gt;1&lt;/span&gt;; i &lt;span class="KeywordOperator"&gt;&amp;lt;&lt;/span&gt; duration; i&lt;span class="KeywordOperator"&gt;++&lt;/span&gt;)
    {
        startCal.add(&lt;span class="LibraryClassType"&gt;Calendar&lt;/span&gt;.&lt;span class="BuiltInConstant"&gt;DAY_OF_MONTH&lt;/span&gt;, &lt;span class="Number"&gt;1&lt;/span&gt;);
        &lt;span class="KeywordControl"&gt;while&lt;/span&gt; (startCal.get(&lt;span class="LibraryClassType"&gt;Calendar&lt;/span&gt;.&lt;span class="BuiltInConstant"&gt;DAY_OF_WEEK&lt;/span&gt;) &lt;span class="KeywordOperator"&gt;==&lt;/span&gt; &lt;span class="LibraryClassType"&gt;Calendar&lt;/span&gt;.&lt;span class="BuiltInConstant"&gt;SATURDAY&lt;/span&gt; &lt;span class="KeywordOperator"&gt;||&lt;/span&gt; startCal.get(&lt;span class="LibraryClassType"&gt;Calendar&lt;/span&gt;.&lt;span class="BuiltInConstant"&gt;DAY_OF_WEEK&lt;/span&gt;) &lt;span class="KeywordOperator"&gt;==&lt;/span&gt; &lt;span class="LibraryClassType"&gt;Calendar&lt;/span&gt;.&lt;span class="BuiltInConstant"&gt;SUNDAY&lt;/span&gt;)
        {
            startCal.add(&lt;span class="LibraryClassType"&gt;Calendar&lt;/span&gt;.&lt;span class="BuiltInConstant"&gt;DAY_OF_MONTH&lt;/span&gt;, &lt;span class="Number"&gt;1&lt;/span&gt;);
        }
    }

    &lt;span class="KeywordControl"&gt;return&lt;/span&gt; startCal.getTime();
}
&lt;/pre&gt;
&lt;p&gt;Hope this code works as well for you as it did for me.&lt;/p&gt;
&lt;p&gt;Check back soon.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Improved the calculating code with the suggestion from Anass (below) and made some more accuracy &amp;amp; business logic improvements to the &amp;#8216;calculateDuration&amp;#8217; method. Enjoy.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/0311vSLtZb3V286AG_tcXtHg7mo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0311vSLtZb3V286AG_tcXtHg7mo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/0311vSLtZb3V286AG_tcXtHg7mo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0311vSLtZb3V286AG_tcXtHg7mo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 12 Oct 2008 14:31:00 +0100</pubDate>
      <author>Alex</author>
      <link>http://digitalpardoe.co.uk/blog/show/116_Calculating_Work_Days_In_Java</link>
    </item>
    <item>
      <title>Flickr BBCode</title>
      <description>&lt;p&gt;phpBB is one of the most widely used forum systems on the internet and Flickr is one of the most popular photo sharing websites, unfortunately there is still no concrete way to integrate the two of them. As a temporary solution I came up with the following piece of BBCode to allow for the easy display of Flickr images in phpBB forums.&lt;/p&gt;
&lt;p&gt;First, you will need to navigate to the &amp;#8220;Admin Control Panel&amp;#8221; of phpBB then to the &amp;#8220;Posting&amp;#8221; section. From here navigate to the screen that allows you to add custom BBCode.&lt;/p&gt;
&lt;p&gt;In the &amp;#8220;Usage&amp;#8221; section paste the following code (&amp;#8216;\&amp;#8217;s denote a continuation of the current line, don&amp;#8217;t include them);&lt;/p&gt;
&lt;pre&gt;
[flickr=&amp;lt;a href="{URL1}" title="{TEXT1}"&amp;gt;&amp;lt;img src="{URL2}" width="{NUMBER1}" \
height="{NUMBER2}" alt="{TEXT2}" /&amp;gt;&amp;lt;/a&amp;gt;][/flickr]
&lt;/pre&gt;
&lt;p&gt;In the &amp;#8220;HTML&amp;#8221; section paste;&lt;/p&gt;
&lt;pre&gt;
&amp;lt;a href="{URL1}" title="{TEXT1}"&amp;gt;&amp;lt;img src="{URL2}" width="{NUMBER1}" \
height="{NUMBER2}" alt="{TEXT2}" /&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;a href="{URL1}"&amp;gt;{TEXT2}&amp;lt;/a&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Then in the &amp;#8220;Help&amp;#8221; section paste:&lt;/p&gt;
&lt;pre&gt;
Flickr: [flickr=&amp;lt;Flickr, Medium Size, Copy &amp;amp; Paste HTML&amp;gt;][/flickr]
&lt;/pre&gt;
&lt;p&gt;And that&amp;#8217;s it, you can use the tag by navigating to one of your photo&amp;#8217;s Flickr &amp;#8220;All Sizes &amp;#8594; Medium&amp;#8221; page (e.g. &lt;a href="http://www.flickr.com/photos/digitalpardoe/2900618617/sizes/m/"&gt;http://www.flickr.com/photos/digitalpardoe/2900618617/sizes/m/&lt;/a&gt;), copying the code in the &amp;#8220;1. Copy and paste this HTML into your webpage:&amp;#8221; box. And inserting it after the &amp;#8220;=&amp;#8221; in the Flickr BBCode tag, e.g;&lt;/p&gt;
&lt;pre&gt;
[flickr=&amp;lt;a href="http://www.flickr.com/photos/digitalpardoe/2900618617/" \
title="Isolation by digital:pardoe, on Flickr"&amp;gt; \
&amp;lt;img src="http://farm4.static.flickr.com/3095/2900618617_26bc8abc12.jpg" \
width="500" height="334" alt="Isolation" /&amp;gt;&amp;lt;/a&amp;gt;][/flickr]
&lt;/pre&gt;
&lt;p&gt;Check back soon.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/aEDzx-DmLpBBb621T3WGcRCOXX8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/aEDzx-DmLpBBb621T3WGcRCOXX8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/aEDzx-DmLpBBb621T3WGcRCOXX8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/aEDzx-DmLpBBb621T3WGcRCOXX8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 12 Oct 2008 14:00:00 +0100</pubDate>
      <author>Alex</author>
      <link>http://digitalpardoe.co.uk/blog/show/115_Flickr_BBCode</link>
    </item>
    <item>
      <title>Updates, Updates, Updates</title>
      <description>&lt;p&gt;Again, it has been quite a while since my last post (almost a month in fact) and quite a lot has happened since then. Any regular visitors to the website will have noticed the new theme, the website maintains the new layout released a couple of months ago but the colour scheme has changed to something a bit more minimal. Along with the new theme I have re-introduced some small adverts to the bottom of pages and modified the URL of the blog feed to allow tracking through FeedBurner.&lt;/p&gt;
&lt;p&gt;The other main updates to the website are the introduction of My Book Icons 0.8 and My Passport Icons 0.3. The My Book Icons update includes a new icon for the Western Digital My Book Studio II drive. Both of the icon sets now include icons in Windows ICO format and Linux PNG format. On the Mac side of the icon sets, after popular demand, I have added copy &amp;amp; pasteable icons to allow setting of icons using the &amp;#8220;Get Info&amp;#8221; window in Finder.&lt;/p&gt;
&lt;p&gt;You can download My Book Icons &lt;a href="http://digitalpardoe.co.uk/software/show/9"&gt;here&lt;/a&gt; and My Passport Icons &lt;a href="http://digitalpardoe.co.uk/software/show/11"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;That&amp;#8217;s all for now, check back soon.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/quFSzC9VkzE9DLdDyyKdbTwj34s/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/quFSzC9VkzE9DLdDyyKdbTwj34s/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/quFSzC9VkzE9DLdDyyKdbTwj34s/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/quFSzC9VkzE9DLdDyyKdbTwj34s/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Mon, 25 Aug 2008 21:48:00 +0100</pubDate>
      <author>Alex</author>
      <link>http://digitalpardoe.co.uk/blog/show/114_Updates_Updates_Updates</link>
    </item>
  </channel>
</rss>
