How to access network drives in Nikon PictureProject

July 29, 2007

This is just a quick post regarding Nikon’s PictureProject software. I decided to import my entire catalogue of photos into PictureProject to evaluate how good it is. Unfortunately they’re on a network drive and PictureProject just wouldn’t recognise it. The import kept failing saying it couldn’t find the folder and I was unable to transfer files directly to a network drive from the camera either.

The answer for the import at least was that PictureProject will only recognise network drives that appear in “My Network Places” under Windows XP. The drive I was using wasn’t there, but as soon as I added it I was able to use import to pull in photos.

This change didn’t fix the problem with transferring pictures directly to the network drive. The “OK” button still grays out if I try and choose a network drive as a destination; Even if you try and select one through the My Network Places tree.


Agile Web Dev Second Edition Arrives!

December 23, 2006

The postman brought a nice surprise from Amazon this morning, in the form of the second edition of Agile Web Development With Rails. I’ve had the book on preorder for a couple of weeks, but it’s been showing as a “won’t arrive until after Christmas” item right up until I last checked a couple of days ago.

First impressions of the book are good. It’s grown significantly since the first edition, with some notable additions to the sample application built in the second section. The book is a rewrite of the first edition rather than a cosmetic update which means that changes between the two aren’t signposted. It looks like it’ll take a bit of time leafing through to see exactly what’s changed.

You’ll also need to be running rails 1.2 to take full advantage of the shiny new stuff that’s covered. At the time of writing 1.2 isn’t yet available as a gem. There is a release candidate available though, and you can see what’s included and get installation instructions here.

It looks like I have some reading to do while I let my turkey go down this holiday season. Excellent.


URL Validation in Ruby/Rails

October 16, 2006

A project I’m working on has a need to validate URLs that users enter. Thinking that this would be just a straightforward exercise in regular expressions, I hit Google to find out who’d already done the hard work for me. The true spirit of reuse 🙂

A couple of false starts later and I’d found url_validation_improved. This seemed to be just the ticket, it has a regex for checking the URL format and even tests the connection.

To get started with my own validation I just wanted the regular expression part as my own project currently only needs to validate the format of the URL. Here’s the regex from url validation improved:

/^(http|https)://[a-z0-9]+([-.]{1}[a-z0-9]+)*

.[a-z]{2,5}(([0-9]{1,5})?/.*)?$/ix

Looking good. I’m not overly familiar with using regular expressions, so I plugged it into my model with validates_format_of and whipped up a unit test to throw a bunch of URLs at it. Everything was going fine, until I added the URL for a test server the application will be interfacing with to the unit test. As it’s a locally hosted rails app, the base URL is http://127.0.0.1:3000. Suddenly, my tests imploded. It turns out that this regex doesn’t allow IP speficied URLs or port numbers. Back to the drawing board Google I went.

Not finding anything much within Google, I started to wonder whether any of the built-in Ruby classes or libararies could help. It wasn’t long before URI caught my eye, flirting with me and giggling as it showed off its parse method, which takes a uri string and returns an appropriate URI subclass representing the URI. The hussy. Not only does it do that, but it raises a URI::InvalidURIError if the uri given is, well, invalid.

Ripping the disappointing validates_format_of from my model, in went a shiny new validate method. All it has to do is check wether a URI::InvalidURIError has been raised, and also ensure that the returned URI subclass is for a protocol that’s acceptable. Here’s the whole thing:

def validate
  begin
    uri = URI.parse(url)
    if uri.class != URI::HTTP
      errors.add(:url, 'Only HTTP protocol addresses can be used')
    end
    rescue URI::InvalidURIError
      errors.add(:url, 'The format of the url is not valid.')
    end
  end

As there was now a possibility of two different error messages appearing on my model I had to update my unit test. Once that was done, everything passes. The balance of the universe is restored.

There’s just a couple of caveats. Sometimes, URI.parse returns a URI::Generic, which is the parent of the other URI types. I’ve not looked deeply into why this is, but it seems to happen when URI is sure enough that the string you’ve passed really does represent a URI, but can’t actually identify a protocol. Since I know I only want to deal with valid HTTP addresses, I restrict my code to only accept those as valid.

It should also be noted that there are some subtle differences between URIs and URLs (URLs are a subset of URIs) but finding out what that means in practical terms seems to be tricky. I’m making the assumption that if a string passes this validation that I can use it as what I would think of as an URL.

Interestingly, the url_validation_improved code calls URI.parse about 5 lines after it checks URLs against the regex. I wonder why it don’t use that as the test of URL validity…?


Prey Downloaders to Get Boxed Copy

October 11, 2006

3D Realms have posted a news update for customers who bought the game through the (now apparently defunct) digital download service, Triton:

2K has set up a replacement program for customers who purchased Prey via the Triton download service. A new boxed copy of Prey will be shipped to each customer who purchased the game via Triton, DiStream or http://www.playtriton.com, as Triton is undergoing a reorganization process and copies downloaded from the service may not function properly. There is no action required on the part of the purchaser. Boxed copies will be mailed automatically to the credit card address on file. Thank you for your patience during this interim period; we look forward to getting affected customers back up and playing Prey as soon as possible.

Whatever’s going on between the companies involved, it’s good to see 3DRealms making sure the customer is taken care of and kept as happy as possible in the circumstances.


Video Games! In Lego!

October 10, 2006

No, not that game. This is Bitflicks, a stupendous fusion of games, real little bits of plastic and stop-motion animation. CGI possibly included, along with a generous dollop of sheer brilliance.


Google Code Search is Live

October 8, 2006

Google have launched a new tool, Code Search that can be used to find stuff in publicly available source code. A quick search on has_many reveals that the search giant has already indexed RubyForge, which could make example code much easier to find for those of us learning Ruby and Rails.

The advanced code search even allows searching using regular expressions, limiting searching to a given language or open source licence, and other options.

SecurityFocus have published an article warning that this tool may make it easier to find poorly written and vulnerable code. While that may be the case, the benefits of a more efficient code search tool will hopefully outweigh these concerns.


Prey’s Digital Distribution Service Closing?

October 8, 2006

An interesting story is breaking at Blues News, where it’s reported that Triton, the digital distribution and management system behind Prey is closing or may already have closed. According to Blues:

The service was responsible for the digital distribution and management of Prey, and without it running, download copies of the game cannot authorize and launch

That’s really worrying for all of us, as digital distribution of games is starting to take more and more of a foothold. Just how safe are the games we’ve bought and downloaded over Steam, the EA Downloader or any other similar service? Do any of them offer a warrantied ability to be able to access the games we’ve bought if the service runs into trouble? Should they place an unlock key in the secure hands of a third party to ensure that we can access what we’ve paid for if the worst happens?

Whatever has or hasn’t happened to Triton, it’s going to be interesting to see how this plays out.

Perhaps it’s just a downed transmitter…

Update
A member of Triton staff has apparently posted at the 3drealms forums:

I know many of you are curious why I have been silent, and that is because of legal reasons, so this is not a statement I am making from the company’s perspective. I can’t go into details, but I can say that all users that purchased the game from Triton will not be screwed, or left out in the cold. There will be a patch that will remove the dependency from the live system and allow you to backup / copy and play your games. Next step will allow you to run the games direct without any of the triton code.I am making sure I have permission to get this pach out first so that I dont run into legal issues. When some of the dust settles, I should be able to give a better picture. From my perspective on digital distribution, this is essential that the patch be released so that no one is left out in the cold and it doesnt get a mark against it.