WHS and SmugMug – Keeping Track of Files

The question that has to be asked at the beginning of every software project, hobbyist or commercial is: “What are we trying to achieve here?”.

For this project, the aim is to move all the contents of one folder to a gallery on SmugMug – and keep them up-to-date. This means that modifications ( tags, edits, etc), additions and deletions are replicated on the gallery in question.

This requires two things:

  • The program to be aware of what is happening to those folders
  • And for the program to be aware of what has already been uploaded.

Number one requires a FileWatcher Object from System.IO.

The Filewatcher throws an event for creations, deletions  and modifications. This allows us to determine the nature of, say, a create event and decide if its a file or directory that has been created. Based on that we can take other action.

We do this by calling System.IO.Directory.Exists(string path) that returns a boolean. You could use the File.Exists(string path) method as well.

Second, a running tally has to be kept of what is going on. We do that by maintaining a master file in our root directory (say \\Photos\SmugMug)  and child files in each directory. The actual directory may or may not be exposed as a setting via the Console.

The master file is essentially has a queue of file events to execute on the server the next time its syncs. This stops large file  ( i.e. large numbers of files) operations overloading the server (resulting in multiple create events) as Demigrator.exe is working on those files as well. So better  to queue the uploads to take place when the disks are idle. I’m using XML and handwriting the read and write procedures – you’ll understand why at the end of the post.

The second requires a file in each directory with the SmugMug Gallery ID and  a list of each file and its SmugMug ID in that Directory. This allows us quick access to files instead of iterating over the lot and comparing each file to the one on SmugMug.

As far as scheduling the uploader is concerned, I haven’t gone into that in too much detail. I could schedule an exe to run using the task scheduler. Its not a bad way of doing things. Norton Internet Security does just that for its scheduling. That, of course has a disadvantage of spitting up the add-in into a logical front-end and back-end.

And by the way, I’m writing this in Visual Studio 2005 using C#. I’m going to do a second version in C# Express 2008 (to use LINQ-to-XML, mainly) for a comparison.

WHS and Smugmug 1

The first thing I looked for after signing up for SmugMug was a WHS Add-In since there is one for Flikr. Lo and behold, there isn’t one.

So last night I started writing an application architecture post when it occurred to me that the best way of explaining it was to write a program from scratch.

Enter the SmugMug Add-In idea. So I’ll be doing that in a short series of posts.

First things first, I haven’t decided whether to use Visual Studio 2005 or Express 2008.

Second, the WHS SDK is already in your servers’ Program Files\Windows Home Server folder, so don’t bother looking online for it. You’ll need these two files added as references in Visual Studio ( or Express):

  • HomeServerExt.dll
  • Microsoft.HomeServer.SDK.Interop.v1.dll

Third, the Smugmug API can be downloaded from SmugMug.com. And it looks to be rather straight forward to write code against it (Note – I always say that looking at an API for the first time, then regret it later). And you’ll need an API key from SmugMug. And you’ll need to add the API in as a reference in Visual Studio or Express.

For a quick look at it, Evan Leventhal’s .NET wrapper SmugMug.NET, is a good start.

Fourth there the way the program will work is pretty straight forward :

  • The folder name can be the name of the gallery OR an XML file in the folder will identify which gallery it corresponds to (that is the SmugMug Gallery ID) ala SyncToy.
  • Since I keep far more photos than I post in \\Server\Photos,  it would be a good idea to create a separate folder containing all the gallery folders for syncing.
  • As far as checking the folders themselves, the .Net 2.0 has a FileWatcher object ( or something to that effect).
  • A settings tab will have a list of folders in the gallery folder that will be synced by default unless you uncheck it.
  • As far as a console tab goes, I have no idea – stats, gallery browser, etc.
  • And scheduling of some sort, could do somthing ala SyncToy (and no, I’m not french).

I’m writing this primarily for myself  as I’m fed up with having to Remote in and use the Send To SmugMug shell app but it will be packaged neatly and on Codeplex once its finished, I imagine.

Blog Directions

So, this is supposed to be a tech blog (along with the few hundred thousand of them already out there). Thing is that I’ve only used it for two things lately: Youtube videos to do with Apple and various complaints mostly to do with Google et al.

I need to narrow the scope down a bit. not quite sure exactly what on. Lets go through it.

SQL Server? I get the basics but I’d rather use Subsonic any day of the week.

ASP.net? Yes, but 2.0. I’ve used the Visual Studio 2008 and it rocks for web design, so a tour of Visual Web Designer Express 2008 sounds good.

Visual Basic 8.0? Again, I haven’t got round to using it, at least not with .Net 3.5. I’m rather good at VB, if I do say so myself.

C# 3.0? The C version of VB ( I’m kidding 🙂 ), but yeah getting to grips with it might prove entertaining.

LINQ? Haven’t touched it, though I’ve diligently read Scott’s posts on the topic. It sure rocks so I might take it for asp on some Commerce Starter Kit databases I have lying around.

Virtual Server? I actually had a draft post about that lying around somewhere. I’ll get it up as soon as I’ve completed taking VS for a test drive ( always handy to have a copy of Windows Server 2003 and SQL 2005  lying around).

Networking?? I’m laying gigabit throughout the house to a central 24-port switch. So details on that later.

What else? Java??? Seriously, although I can see the languages’ power and potential as well a pretty safe choice when undertaking any software project, I wish Microsoft would do a deal with Jonathan Schwartz and include it as part of Visual Studio. With a .Net interop??? And Sun, please make your Java download page a wee bit more understandable to a  (relative) newbie.

Programming in general?? Perhaps something slightly more advanced than Hello World. Toolkits I use and so on. I mean, application architecture is a huge subject, as is project planning (UML, etc). Plenty we could go over in there.

At the end of the day, its good opportunity to consider moving any future photography posts to their own blog.

You never know.

MacWorld Fallout

iPod Touch update downloaded and installed. Add-on purchased.

I’ve only had a cursory look at the features. And boy do they rock. I was going to say that I really needed a Notes app and his Steveness has gone ahead and stole my thunder. Not that I’m complaining 🙂 .

The Add-on was cheap when I think of the iPod classic owners that I know – they are going to really  be envious.

I’m currently looking at my new Dell Inspiron and wondering who I might sell to get an Air (yes, who).

While I think that one over here’s a Youtube clip making fun of the OTHER software company in action:

Media Centre or not?

The issue of streaming media (TV, Music, Photos) across a network really zeros in on the reason for having a home network.

For those of you who read this blog, you’ll know that I’ve been trying out SageTv for Windows Home Server. And it works great, if you set aside the EPG issues. Recorded TV is of high quality, crisp and clear; and watching from a SageTv Client is only slightly spotty (mainly due to the server being busy and the wireless connection).

My problem is two fold. One WHS is actually a server and is busy all the time and only has a Celeron D.

Two, SageTV shows only play in SageTv itself or in Real Player. Requiring re-encoding to watch via WMP11 or for use in Movie Maker. Which is a pain since a 27 minute show comes out at 650MB at Normal quality and takes about 4 and a half hours for Windows Media Encoder to process.

The EPG issue that I’m encountering means that the Program Guide only has info for about 4 channels out of 24. It is irritating in the extreme since identifying shows requires that you watch them. UK EPG support is quite spotty the forums tell me.

The solution to all of this is, I think, a Media Centre PC. A dedicated hardware device. The whole point of dedicated hardware is to share the load. My broadband connection goes though a router instead of a PC. A GPU handles 3D graphics instead of a normal, general purpose processor. In this case, WHS can stick to the business of serving files and taking backups and let the Media Centre take the load.

I’ve only heard positive reviews for Media Centre Edition (XP) and it seems pretty good. On top of that, Microsoft has a good strategy as far as extenders are concerned such as the Xbox 360 and so on. Also it should slip seamlessly into an all-Microsoft network.

I’d be using WHS for Storage, and WMP11 to watch the content on a PC. It also makes the purchase of a 360 more likely (I’ve been sitting on the fence lately and can’t decide either way).

To actually build the hardware, I’d use the same method that I did for my Windows Home Server. Order the shell (Chassis, power supply, motherboard, processor(s), hard drive) from Dell and then order the rest of the kit from Amazon.

The thing is, how much juice do you need in a Media Centre? SageTV uses about 15% CPU at record time and not much RAM.

Dual Quad Core 2 might be pushing it a little far. A single Core Duo 2 might cut it, but then again, you don’t want “might” to be anywhere near your Media Center. Specially since after-market upgrading can be extremely expensive for hardware like this.

RAM is dependant on whether Vista Media Centre is 64-bit. I’d say that 2 or 4 GB is safe enough.

The next thing is required for this is, well, a network. Streaming media over wireless is Ok if its small enough and you are close enough to the Access Point to get the and excellent signal ( In my house that practically means sitting right next to it). For real media streaming, you need Gigabit Ethernet. More on that to come.

Photography: Beginning

Whew, Photography isin’t easy. You need the camera, the software,the online storage and so on. Not to mention the accessories.

I bought a Nikon D40x a few weeks ago and haven’t stopped playing with it since. Which is one reason the blog has been suffering. Got a 55-200mm lense in addition to the supplied 18-55mm lense. And a flash and tripod for night shooting. Though I might have to take the tripod back and get a better model.

After thinking about the moment for a while I finally settled on Smugmug mainly because I get a kick from dealing with faceless corporations everyday (not 🙂 ).  Take a look at their About us page to see what I mean .Plus they really have a good reputation.

I’ve got a few photo’s from holiday (4,300, to be exact – I went overboard). A good portion of that is from Luxor, Egypt and they’ll be the first ones up once I get them sorted. And I’ll cross-post the best of the best here.

I came within a whisker of splashing out and buying the Educational version of CS3 Design ( I qualify as a Second Year undergraduate). Though I definitely get it next month. What really sealed it was the fact that Smugmug  has a CS3 add-on for uploading your newly tweaked shot from within CS3. I’m getting it mainly for Photoshop, but Acrobat and Illustrator would be useful as well.

Once I have that I can start shooting in RAW and acting like a proper photographer 🙂 .

One thing that really would make life easier is a WHS Add on for Uploading straight to Smugmug from your Photos folder.

As a side note I subscribe to Thomas Hawks’ Blog. He has some really great shots.

Also see this list of the best photoblogs of 2007.

Great things to come…

Data: Mine or Theirs?

Although I’m writing this under the fallout of  Scoble-Facebook, I don’t think the issue of who owns your data is either confined only to Digital identity or has been very well thought out.

First, a roundup of the various reactions:

It’s not about data portability. It’s about trust.

Offline, my friends and I share a mutual connection. Maybe it’s around work, maybe it’s around our kids or something in our past. Whatever it is, they’re my friend because they know something about me beyond what’s easily accessible to others. Keyword here is mutual. I know a bit about them too. Their relationship with me is unique as compared to their relationship with others.

Online, those lines are blurred. For what I would guess is at least 4,500 of the 5,000 “friends” Robert Scoble has on Facebook, he is the equivalent of a magazine publisher and you are his subscriber base/audience. He says it’s mutual and that’s the beauty of the social and connected web, but he only cares about you when you put something on the table that he’s interested in. It’s not about you. Yet, he’s “sitting” right next to your real friends, getting the same information about you that you’re sharing with them. If he takes that information and abuses it, however un- or good-intentioned, it serves you both right.

Robert Scoble valued his relationship with Plaxo more than he valued his relationship with his “friends,” otherwise he would have posted to them what he was doing with an experimental, alpha-quality and untested script before he did it…or he wouldn’t have done it at all.

Judi Sohn

I think there are two questions here. The first is whether users should be able to extract their data [including social graph data] from one service and import it into another. I personally believe the answer is Yes and this philosophy underlies what we’ve been working on at Windows Live and specifically the team I’m on which is responsible for the social graph contacts platform.

Dare Obasanjo

Then there is the oft-cited  post by Paul Buchheit (the guy who created Gmail).

Now I’m not on Facebook et al for a reason: data, in the case of a person,  is that person. Whereas data for iTunes is essentially  the signals sent to your sound card. Se the difference

Is it important to guard those things? Yes, or course. At the end of the day, its all you are left with if everything goes to hell: Your sense of self and identity, and your friends ( real friends, that is).

So we essentially have two options:

  1. Manage that data ourselves in a way that gives complete and utter control over every aspect of things
  2. Give our data over to a less than trustworthy service that essentially controls who you are, your identity ( on- and off-line) and who your freinds are and what your realtionship is with them

I’ll take option one any day of the week. Why? Becuase of control. It is all about control.

Plaxo may or may not keep your data after you opt-out ( i think its the former rather than the latter). Facebook has the awesome power of wiping out very single trace of you from its universe with a simple mouse-click. Add a hundred and one other web services that suck your data out of Google, Hotmail and the like.

There is a missing element in the above situations. Find it yet? And its not trust. Its control. And I mean, complete and utter control.

At least Twitter gives you more granular control( in terms of message recipients)  and has a proper API.

Better yet, Open ID, while somewhat flawed, is a brilliant idea insofar as you have a digital identity provided and vouchsafed by a trusted source ( AOL, for example). This blog is my digital identity ( since WP supports Open ID).  I can decide what to do with that identity, what to reveal, what to password protect. If I move on to from one blog to another, I can export all my posts and import them else where.

In short I have complete control of that Open ID identity (short of running my own webserver).

So because I have control I can never be in a Scoble snafu like that ( And I don’t care for the fact that Scoble was pressing FB’s buttons on purpose – he gave up his control over that data and he knew it).

In a  sense, its the MS DOS command line all over again. And  loss of control is like letting Vista hide the RUN command and the task manager and tickle itself silly with crashes.

Nerd Humor

If you don’t read the Official Playstation.Blog from Sony, you really should be. Its really good and is a daily staple of my blog diet, along with the Gamerscore Blog from Microsoft. I don’t have either console ( 360 or PS3) , but I really enjoy reading the posts.

Take this recent post from Jason Coker, Associate Producer of the PlayStation Network title PAIN for PS3:

What I CAN tell you is that it has been a blast to work on. It hasn’t been easy, but it sure has been hilarious. Here are just a couple of the gems I’ve heard (or said):

* “Coker, can you write up a description of a little person hip-hop pirate right quick?” (Yeah, I had the same reaction. You’ll see.)

* “Ummmm….who did the voice-over for that? That’s nasty.”

* “Hey man, if I get you a big glass of water, can you step into the recording booth and belch for about half an hour?”

* “Check the Leaderboards, Son. Spank. The. Monkey.”

* “Dude, I just really don’t think the farts are loud enough.”

* “Did you just grab that Granny by her head? Do it again! Do it again!”

* “That’s him right there. We call him the Ooch Master. He can’t be touched.” (You know who you are at Idol Minds, and I’m coming for you. The student has become the Master, baby!)

* “OH, *&%*!! THAT *^&%*#@ DONUT!!!!!!”

What are you waiting for? Subscribe!!