digital:pardoe http://digitalpardoe.co.uk/ digital:pardoe Blog Feed en-en My Passport Icons <p>By popular demand, but a little late, I have released a set of icons to represent the Western Digital My Passport range of external hard drives, this release was driven primarily by requests that I have received and the fact that I have just purchased a WD My Passport drive myself.</p> <p>For now the release contains only two icons, they are for the red and black &#8220;Essential&#8221; variants of the My Passport drive. I will be releasing icons for the remaining drives shortly so if you don&#8217;t have one of the two drives included keep checking the website.</p> <p>You can download the icons <a href="http://digitalpardoe.co.uk/software/show/11">here</a>.</p> <p>I will be writing a post shortly to explain why my presence has been lacking recently and why releases are so slow in coming too, so, check back soon.</p> Sun, 27 Jul 2008 13:39:00 +0100 Alex http://digitalpardoe.co.uk/blog/show/113 Just A Few Updates <p>It&#8217;s been almost a month since my last post and a lot has happened since then so I thought I&#8217;d bring any readers of my blog up to date.</p> <p>If you are a frequent visitor to the website you may have noticed the new layout (implemented about 20 days ago now). The layout is much simplified over the old layout. It makes use of a single column layout with items from the old sidebar in the top corners. For now the advertising and Last.fm widgets have been removed whilst I decide if they should make an appearance in the new website. The visual changes comes with a fairly comprehensive code re-write that should drastically improve the performance and security of the website, the changes come thanks to a series of Rails podcasts I have discovered, you can find them <a href="http://railscasts.com/" target="_blank">here</a>.</p> <p>A quick list of the main changes to the website are as follows; the removal of all AJAX &#38; AJAX-like functionality (other than Lightbox), everything now works statically for increased accessibility, the blog can now be browsed by category. More user feedback has been introduced. The appearance of forms has been improved and the website now makes sole us of PNG and JPEG images for transparency and quality.</p> <p>The secondary reason for this post is to officially announce the availability of iSyncIt 1.5, you can download it <a href="http://digitalpardoe.co.uk/software/show/1">here</a>. This release, whilst not been too far detached visually from version 1.3.1 comes with a boat load of code improvements. The main changes are as follows; a new preferences system, doesn&#8217;t look any different but it&#8217;s easier for me to manage. The move to Leopard only. A fix for the problems that were caused in version 1.3 by Growl notifications. You can now enable &#38; disable the login item from within the application. Updates to Sparkle &#38; Growl. Menus now update properly. Scheduling now functions better and the control of bluetooth is improved.</p> <p>Finally, an unfortunate side-effect of the iSyncIt re-write is the loss of German localization. I will be getting in touch with my friendly volunteer translator shortly to see if he will be willing to re-localize the application for me.</p> <p>That&#8217;s all for now, check back soon.</p> Tue, 24 Jun 2008 11:30:00 +0100 Alex http://digitalpardoe.co.uk/blog/show/112 Caching Your Photographs <p>If you have at some point followed my now fairly ancient <a href="http://digitalpardoe.co.uk/blog/show/87">rFlickr tutorial</a> you may have noticed that your photo page loads quite slowly, and that my photo page loads fairly quickly. To get my page to load as quickly as it does required a small custom caching method and a willingness on my part to sacrifice some bandwidth. Here&#8217;s how I did it.</p> <p>This tutorial assumes that you have already worked through the previously mentioned rFlickr tutorial and have something similar to it set up. It also assumes that you have some knowledge of Rails, not that my knowledge was particularly wide ranging at the point I wrote this caching method.</p> <p>First of all, you will need a table in your database to store the information about your photographs, I suggest the structure illustrated in the migration below;</p> <pre> class CreatePhotos &lt; ActiveRecord::Migration def self.up create_table :photos, :id =&gt; false do |t| t.column "flickr_id", :string, :limit =&gt; 25, :null =&gt; false t.column "title", :string, :limit =&gt; 250 t.column "description", :text t.column "url", :string, :limit =&gt; 250 end add_index :photos, :flickr_id end def self.down drop_table :photos end end </pre> <p>Once you have created this table you will need to create some folders to store the cached images, I created the following folders and will be using them throughout this tutorial;</p> <pre> #{RAILS_ROOT}/public/images/flickr_cache/small/ #{RAILS_ROOT}/public/images/flickr_cache/large/ </pre> <p>Then generate the model for this photos table;</p> <pre> $ cd /your/rails/application $ ./script/generate model Photo </pre> <p>Your view from the first tutorial can remain almost the same (details at the end of the post), however, to see the greatest speed improvement I suggest caching it, i.e;</p> <pre> &lt;% cache do %&gt; ... Your view code here. ... &lt;% end %&gt; </pre> <p>Then modify your view method in your photography controller to read something like;</p> <pre> def view unless read_fragment({}) check_cache @photos = Photo.find(:all) end end </pre> <p>The above code will make sure that a cached photography page doesn&#8217;t already exist, if it doesn&#8217;t, then and only then will it check that the photograph cache is up to date and query the database.</p> <p>We have not yet created a &#8216;check_cache&#8217; method, this method is the core method to make the photography page load much, much faster, even when the photography page&#8217;s cache does not exist. The method should be placed as the last method in your photography controller, the code is as follows;</p> <pre> private def check_cache if ENV['RAILS_ENV'] != 'development' flickr = Flickr.new(RAILS_ROOT + "/config/flickr.cache", \ FLICKR_API_KEY, FLICKR_SHARED_SECRET) @photos = flickr.people.getPublicPhotos\ (flickr.people.findByUsername(FLICKR_USERNAME)) for photo in @photos.reverse if Photo.count(:all, :conditions =&gt; ["flickr_id = ?", photo.id]) == 0 db_photo = Photo.new(:flickr_id =&gt; photo.id.to_i, :title =&gt; \ photo.flickr.photos.getInfo(photo.id).title, :description =&gt; \ photo.flickr.photos.getInfo(photo.id).description, :url =&gt; \ photo.flickr.photos.getInfo(photo.id).urls.values[0]) db_photo.save open(File.expand_path \ ("#{RAILS_ROOT}/public/images/flickr_cache/small/" + \ photo.id + ".jpg"),"w").write(open(photo.url('s')).read) open(File.expand_path \ ("#{RAILS_ROOT}/public/images/flickr_cache/large/" + \ photo.id + ".jpg"),"w").write(open(photo.url).read) end end end end </pre> <p>The following code will only run if you are in production mode (and probably test mode too). It will then load the necessary information from Flickr using the methods outlined in the <a href="http://digitalpardoe.co.uk/blog/show/87">rFlickr tutorial</a> post. The method then iterates through the collection of photos from Flickr in reverse, so they appear in the same order in the database as the order they appear on Flickr.</p> <p>It will then check if the photo already exists in the database, if it does not it will store a copy of the photograph&#8217;s information in the database and download previews of the images from Flickr to your server, previews of images can then be loaded from your server rather than Flickr&#8217;s slow servers .</p> <p>To take advantage of the cache you will also need to modify your view to access the thumbnails from your newly created local repository rather than from Flickr&#8217;s servers, i.e;</p> <pre> &lt;% for photo in @photos.reverse %&gt; &lt;%= image_tag("/images/flickr_cache/small/" + \ photo.flickr_id + ".jpg", :alt =&gt; photo.title) %&gt; &lt;% end %&gt; </pre> <p>Hope this goes some way to helping you improve the speed of your website.</p> <p>Check back soon.</p> <p><strong>Update: </strong>As I have just been reminded in the comments, I forgot a piece of code to make this tutorial work correctly. You should put the line;</p> <pre> require 'open-uri' </pre> <p>Either in the bottom of you &#8216;environment.rb&#8217; file or just under the &#8216;class&#8217; line in the controller that is responsible for your photography page.</p> Fri, 30 May 2008 23:03:00 +0100 Alex http://digitalpardoe.co.uk/blog/show/111 Oops <p>Due to a massive oversight on my part at the point I implemented a user groups system on the website it would appear, for standard users at least, that the comments system has not been functioning correctly. The problem has now been solved and the comments system should be working correctly. Apologies to anyone that have ever tried to post a comment on the website for it not to work.</p> <p>Check back soon.</p> Sat, 17 May 2008 12:35:00 +0100 Alex http://digitalpardoe.co.uk/blog/show/110 About Time Too <p>It&#8217;s been well over a month since I managed to write a post now so I thought it was about time I started the cogs whirring again, especially as all my assignments are now finished and handed in.</p> <p>Even though there has been a lack of posts in the recent month there hasn&#8217;t been a lack of feverish activity. First on the books was the release of Set Icon 0.2, this release just bought basic bug fixes and a much improved authentication system. This was followed in recent weeks by the release of Set Icon 0.3, in this release I fixed yet more bugs and introduce an option to remove a custom icon from a hard drive. You can, as always, download Set Icon from it&#8217;s <a href="http://digitalpardoe.co.uk/software/show/10">download</a> page.</p> <p>On a more website orientated note, I have moved the website to new servers. Prime Hosting weren&#8217;t terribly Ruby on Rails centric in the end, hence the continual website downtime. The website is now hosted with <a href="http://hosting.media72.co.uk/uk_rails_hosting" target="_blank">media72</a>. They have proven themselves over the last month to be far more reliable hosts than Prime, even though I am hosted on their beta testing server.</p> <p>Along with the change of host I have modified the way in which the website is run, updates to the website are now performed via Capistrano, I hope to write a little more on this system in a later post to explain how it can help improve your Ruby on Rails development.</p> <p>Don&#8217;t expect too many posts or software updates over the next two weeks, unfortunately I have a series of exams that require some serious revision, however, if I get really bored of revising you might see some posts / software appearing.</p> <p>I&#8217;ve also recently acquired a new lens for my camera, a Tokina 12-24mm f/4. As part of my endeavor to expand what I write about I will hopefully (assuming I remember) write a small review about the lens as it took me a long time to find any concrete opinions on it before I purchased it.</p> <p>That&#8217;s all I can think of to write for now, no doubt I will think of something else eventually.</p> <p>Check back soon.</p> Sat, 03 May 2008 13:06:00 +0100 Alex http://digitalpardoe.co.uk/blog/show/109 Set Icon, The Initial Release <p>After literally tens of emails from people having problems applying the &#8216;My Book Icons&#8217; to their external hard drives I came to the decision that I needed to write some software to make the whole process a little easier. The result of this decision and a couple of (short) days work is Set Icon.</p> <p>You may remember from my previous <a href="http://digitalpardoe.co.uk/blog/show/100">tutorial</a> that setting a custom hard drive icon (correctly) required some Terminal wizardry and some extra command line tools. Set Icon provides and all in one, drag and drop way of setting a custom (ICNS format) icon for a hard drive (including your internal hard drive), without the need for any external tools.</p> <p>The advantages of using Set Icon rather than copy &#38; paste are; the icon will appear correctly in the Finder sidebar under Leopard, will appear correctly when the hard drive is mounted over a network and will appear correctly in the Boot Camp chooser.</p> <p>There are a few extra features I plan on adding to Set Icon and I also plan on creating a Tiger compatible version in the near future so all you Tiger users don&#8217;t feel left out.</p> <p>You can download Set Icon from its <a href="http://digitalpardoe.co.uk/software/show/10">software page</a>. If you like the software please consider making a donation using the button on the right hand side of the website.</p> <p>That&#8217;s all the news for now, check back soon.</p> Tue, 25 Mar 2008 22:34:00 +0000 Alex http://digitalpardoe.co.uk/blog/show/108 My Book Icons 0.7 <p>It must be that time of the year again, I&#8217;m on holiday so I&#8217;ve started to update all of the downloads I maintain. The first of these updates, and the one most requested, are the vertical orientation icons for the new Western Digital My Book drives. You can download the new version of these icons from <a href="http://digitalpardoe.co.uk/software/show/9">the downloads page</a>. I am planning on updating iSyncIt in the next few weeks too.</p> <p>The website has also undergone a bit of an update, nothing major, just a few tweaks to make things work a little better now. For example when you login, you will no longer be sent to a confirmation page, you will be returned to the page you were on. Much more convenient when posting comments.</p> <p>P.S. If you are having trouble applying the icons see if this tutorial helps: <a href="http://digitalpardoe.co.uk/blog/show/100">Setting Hard Drive Icons In OS X</a>.</p> <p>That&#8217;s all for now, check back soon.</p> Fri, 21 Mar 2008 19:49:00 +0000 Alex http://digitalpardoe.co.uk/blog/show/107 The Advantages Of Time Machine <p>I wasn&#8217;t sure about Time Machine when it was announced, sure it was great to have regular, up-to-date backups with no effort but I couldn&#8217;t believe that restoring would be as easy as Apple said it would be. Unfortunately I had a chance to test Time Machine to it&#8217;s fullest in the week just gone.</p> <p>My iMac was feeling a little sluggish so I ran the cleanup scripts in a program called OnyX, the program has never let me down before but as the scripts were running I noticed the whole contents of my home directory beginning to disappear. I panicked a little but new Time Machine had just completed a backup before I ran the scripts.</p> <p>First I tried restoring all my data from Time Machine piece by piece but it was taking far too long. The solutions was easy, boot of the Leopard DVD and select the option to restore my whole system from time machine, 45 minutes later the computer rebooted and I was greeted with my old system, all my files, back where they used to be like nothing had happened.</p> <p>My Aperture library was backed up separately using vaults because Time Machine always insists on backing up the whole library, the restore for Aperture was another half-hour and all my photos were back too.</p> <p>I couldn&#8217;t have asked for an easier restore, yet another shining example of Apple&#8217;s software. I won&#8217;t personally be using OnyX again but a word of warning, if you don&#8217;t use Time Machine, back up your system as frequently as you can afford to. You think data loss will never happen to you but more than likely it will and it saves a lot of trouble (and possibly heartbreak) if you have good backups.</p> <p>Check back soon for more tales of survival.</p> Sat, 08 Mar 2008 23:47:00 +0000 Alex http://digitalpardoe.co.uk/blog/show/106 rFlickr And Rails 2.0 <p>Any of you that followed my tutorial on setting up rFlickr and have subsequently upgraded to Ruby on Rails 2.0 may have noticed some server errors on your photo pages, this is due to the fact that a single line of code in rFlickr does not work correctly with Rails 2.0.</p> <p>You can download the hopefully fixed rFlickr from <a href="http://digitalpardoe.co.uk/downloads/rflickr/rflickr.zip">digitalpardoe.co.uk/downloads/rflickr/rflickr.zip</a>. Simply unzip this file into your rails applications &#8216;vendor/plugins&#8217; directory and restart the application, everything should start working again as expected.</p> <p>For those of you that are interested line 644 of &#8216;lib/base.rb&#8217; had to be modified from:</p> <pre> def from_xml(xml,photo=nil) </pre> <p>to:</p> <pre> def self.from_xml(xml,photo=nil) </pre> <p>Hope this gets you back on your feet, so to speak. Check back soon.</p> <p><strong>Update:</strong> You may also want to install the updated version of &#8216;actionwebservice&#8217; because it is no longer bundled with the Rails distribution. Other people have reported rFlickr not working because of a lack of this gem, however, the lack of this gem didn&#8217;t affect my setup at all.</p> Tue, 19 Feb 2008 21:13:00 +0000 Alex http://digitalpardoe.co.uk/blog/show/105 Ruby On Rails 2.0 <p>Rails 2.0 has been out for a couple of months now, I had refrained from upgrading to it because I wasn&#8217;t sure what it would break. After putting the website under version control I decided it was too easy not to upgrade to Rails 2.0, so here it is, a website that looks and runs exactly like it did and only a few problems to be found.</p> <p>To go along with the upgrade I have also added a couple of new features to the website, the <a href="http://digitalpardoe.co.uk/photography">photography</a> page now links to my Flickr photostream so if you want to post comments on my photos, feel free. I have also added the ability for me to add images from other sources to the blog, not that important but no doubt you&#8217;ll notice the change. The largest change at the moment is the addition of social networking sites on the sidebar. If you like what you read to can add the page to <a href="http://del.icio.us/" target="_blank">Delicious</a>, <a href="http://digg.com/" target="_blank">Digg</a>, <a href="http://reddit.com/" target="_blank">reddit</a> or <a href="http://stumbleupon.com/" target="_blank">StumbleUpon</a>.</p> <p>Mainly to test the upgrade, you can admire one of my flickr photos, the most popular of my photos, or check back soon.</p> <p><strong>Update:</strong> Oops, no image. Remember, if you update something to allow longer links, update the database too.</p> <p><strong>Update:</strong> Generally a broken site is a sign of bad testing, that&#8217;s true in this case, the archives were broken, now they&#8217;re fixed.</p> Tue, 19 Feb 2008 20:58:00 +0000 Alex http://digitalpardoe.co.uk/blog/show/104