vs, GeekSpeak comments edit

Recently when I was working on my first Firefox extension, I struggled for a while to figure out the best way to work with the code - the script, CSS, etc. - involved with the extension.

I like using Visual Studio as my environment for the other projects I’m on, so I thought I’d look around and see if other folks had figured out how to use it while working with Firefox extensions. The closest I got was this article over on DevSource which really talks more about creating the extension’s folder structure than it does about how you actually manage the project in Visual Studio. With that, I figured it was up to me, and here’s how I got it working.

First, follow the Mozilla instructions on setting up a developer profile for extension building and creating the base extension structure. It might even be worth getting the full Hello World plugin running so you know you’ve got something working to start.

Now we’re going to create a Visual Studio solution to manage the code with. We’ll end up with a folder/file structure that looks something like this:

You have a folder that houses your extension (“ExampleExtension”) and then you have the actual folder structure under that which has the extension code (“extension”). Ostensibly, you’ll end up zipping everything under “extension” into an .xpi file for distribution later.

We need to create the solution you see in the folder right above the extension code so fire up Visual Studio. Go to “File->New Project” and under “Other Project Types” click “Visual Studio Solutions” and elect to create a Blank Solution. Put the blank solution in the folder right above the main extension code (“ExampleExtension” in the above folder tree).

Save the solution file and close it. Visual Studio always does this thing where it creates a folder for the solution but you don’t want that folder here - you’ve already got a structure you’re working in. Go grab the .sln file that was just created and put it in the folder right above the extension code (“ExampleExtension”). You can then delete the folder Visual Studio stuck it in as well as the .suo file.

You should have the .sln file right above the “extension” folder with your Firefox extension code, just like the picture above. Now open the solution in Visual Studio. We’re going to use the Web Site project type to work with the extension code. Extensions are mostly XML, CSS, and script anyway, so it mostly makes sense, right?

In Visual Studio, go to “File -> Add -> New Web Site…” to open the web site template dialog. Select the “ASP.NET Web Site” project template. Under “Location,” select “File System” and point to the folder that contains the extension code (“extension”). It doesn’t really matter which language you select, since you’re not going to be really making a web site, so select what you want. (I selected Visual C#.)

When you click “OK,” it’s going to find the extension folders and such you already have. It will then ask you how you want to proceed. Select “Open the existing web site” and click OK. This will add everything for your extension into the “web site” without adding anything to it. You should see it all in Solution Explorer. Here’s a screen shot of my extension in Solution Explorer with all the requisite files.

That’s it. You should now be able to add, remove, and update files for your extension from Visual Studio.

Now, I know I could install Eclipse and do things differently, or choose some other environment, but I really wanted to see how VS would work. Seems to work reasonably well, at least for what I’m doing.

What about debugging?

Well, you can’t really do debugging of your extension from inside Visual Studio, but you can execute your Firefox developer environment to see your extension run. Right-click the Web Site project proper (the little “globe” icon you see in Solution Explorer) and select “Browse With…”

In that dialog, click “Add” to add a new browser. In the “Program Name” box, type the full command line that you need to run the developer profile with (you have that from when you set up your extension developer environment). In the “Friendly Name” box, put something like “Firefox Extension Developer Environment.” Then click OK.

You will get warned with something that says “File name does not exist, is invalid, or contains parameters that cannot be validated. Do you want to change your entry?” Say NO. That warning will close and the “Firefox Extension Development Environment” browser will appear in the list.

From now on, you can select “Browse With,” select your developer environment, click the “Browse” button, and the developer version of Firefox, with your extension installed, will pop up. (You mustset up the Firefox extension proxy file when you set up your development environment or it won’t matter that you popped open the dev browser - your extension won’t be there.)

How about building/packaging the extension?

I haven’t figured out a way to do it from inside Visual Studio (though I’m sure you could through post-build tasks or modifying the .sln file directly), however, with the use of MSBuild Community Tasks I’ve got a very simple build script that zips up the extension as an .xpi in a build_output folder (peer to the extension code). Yours for the taking. YMMV, no support, no warranty expressed nor implied, etc.

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="All" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildProjectDirectory)\lib\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
  <Target Name="All" DependsOnTargets="Clean;Compile">
  <Target Name="Clean">
    <RemoveDir Directories="$(BuildDirectory)" Condition="Exists('$(BuildDirectory)')"/>
  <Target Name="Compile">
       Exclude="$(ExtensionDirectory)\**\_svn\**\*.*" />
    <Zip Files="@(ExtensionFiles)"
     ZipFileName="$(BuildDirectory)\$(ExtensionName).xpi" />

Yeah, that’s a lot to just build a zip file, but it always cleans out any existing build and repackages the thing, plus if you end up having more to do (like adding other files or doing additional filtering), this is a starting point.

Hopefully this will help some of you folks trying to break into Firefox extension development!

media, windows comments edit

UPDATE 7/8/2011: MozyHome has changed their pricing so I’m using CrashPlan to back up my Home Server now.

I’ve been looking for a good online backup solution for Windows Home Server for a while. I’ve been using KeepVault for almost a year now and it works acceptably - there have been some kinks in the plugin (don’t let your backup history log get too big and then try to view it or you’ll lock the console), but overall it’s decent. The problem I have is the cost.

I have about 200GB of data to back up. That’s the important stuff - all my photos, my music collection, and my documents. I don’t need to back up my 5TB of DVD images because it’d take longer to restore over the network than it would to just rip the original source material.

When I originally signed up for KeepVault, I got in for $100/year with unlimited storage. That’s perfectly in line with my expectations. I previously had MozyHome to back up all of my computers and that has unlimited storage as well, and that ran $60/year per computer. With the Windows Home Server doing the computer backup, I needed to switch to backing up the Windows Home Server. (Assuming the important documents are all kept on the Windows Home Server and not on the computers, that’s safe - I haven’t yet found a system that will back up your computer backups online.)

KeepVault is, unfortunately, raising its prices. As such, I figured it was time to do a price comparison. Not counting any “startup costs” (some of them have a one-time fee to license software)…

Service Price for 1 year of 200GB Backup Support for WHS?
Carbonite $55 Terminal Service installation.
MozyHome $55 No.**
KeepVault $188 Plugin for WHS Console.
backupanytime.com $300 No.*
Jungle Disk/Amazon S3 $360 + data transfer and request costs Plugin for WHS Console.
iDrive $499.50*** Terminal Service installation.
MozyPro $1200 Terminal Service installation.
IBackup $1999.50 No.*

* backupanytime.com and IBackup support Windows Server 2003 (which WHS is based on) so you might be able to hack around and get it to work. I couldn’t find anyone who’d blogged success with that.

** MozyHome specifically does not support Windows Server 2003, nor does it support WHS. You have to use MozyPro for server-class OS backup. Yeah, that’s dumb, and I’ve told them so. I’m not a business so I don’t understand why I’d be charged business prices just because I happen to store my data centrally.

*** iDrive jumps from 150GB personal plan ($49.50/yr) to a 500GB business plan ($499.50). Since I have 200GB to back up, I listed the 500GB plan cost.

So. From a cost perspective, Carbonite and MozyHome are the clear winners. That’s where my secondary requirement comes in:

I don’t want to hack anything on my Windows Home Server.

I want my WHS to be fully supported, as much as possible. I want the “appliance-like” experience it offers. I don’t want to be tweaking registry keys or modifying stuff because it inevitably starts off a chain reaction of having to maintain it forever. For Carbonite and MozyHome, that means I wouldn’t be trying to install them on the WHS directly. The question then comes down to:

Is it worth an extra $133/year to get the KeepVault support for WHS or can I figure out a better way to get a client backup program to do the work for less?

I went with the client backup and chose MozyHome. Why not Carbonite? I’ve had experience with MozyHome and it works really well. Honestly, it came down to brand affinity. You could have chosen Carbonite and tried the Terminal Service installation (though it’s unsupported, which is why I didn’t go that route), or you could use Carbonite in the manner I’m using MozyHome.

Now that we’ve picked a service, how do we hook it up? Actually, it’s pretty simple.

First, some startup costs. Get yourself…

  • An external USB drive big enough to hold the data you want to back up. It doesn’t have to be the same size as your full Home Server storage; it just has to be enough to hold the important stuff you want to have backed up. You may not need everything on your Windows Home Server backed up, and in some cases you’re probably using the file doubling offered by WHS, so you need to do some calculations on space. For example, you probably don’t need to back up your recorded TV episodes. I picked upa 1TB USB drive for $93 from NewEgg.
  • A copy of Allway Sync for $20. You’re going to use that to get your WHS data onto the external drive.

Now set up the backup:

  1. Install Allway Sync onto a Windows client computer that’s generally always on. This will be the computer that backs up your WHS data.
  2. Plug the external drive into that computer.
  3. Set up Allway Sync to do a one-way sync from your WHS shared folders (the important ones) to the external drive. Make sure you propagate deletions so if you delete something from the WHS it’ll delete from your external drive, and set deleted files to be deleted permanently so your recycle bin doesn’t fill up. (These options are in the Advanced job properties dialog.)
  4. For each of the Allway Sync jobs you set up (one per shared folder), set them to automatically synchronize on a scheduled basis. This will add an entry to the Windows Task Scheduler.
    1. Run the sync nightly (or more often, if you like).
    2. Make sure to select the “Wake up computer to perform this task” option so the sync will wake your computer up if it happens to have gone to sleep.
  5. Run the sync the first time and verify the results. Look at what got copied onto the external drive and make sure it’s getting everything you want.
  6. Sign up for a MozyHome account. I got the yearly renewal in case some better backup solution pops up for Windows Home Server between now and then.
  7. Download and install the Mozy software on the computer with the external drive.
  8. Set up Mozy to back up the entire external drive. In the advanced configuration, go to the “File System” tab and select the external drive. (If you want to back other stuff up, that’s fine, just make sure you’ve got the external drive selected.)

That’s it. What you’ve got:

  • Nightly (or more frequent) backups to the external drive allow you on-site access to things you might have accidentally deleted in the last period.
  • Continuous online backup to Mozy ensures you have historical versions of files and things that have been removed from the nightly backup. It also ensures that in the event of catastrophe, you have things stored elsewhere.

I have this set up and running now and it works like a champ. No maintenance required - the sync job runs, the Mozy software backs it up - appliance-style, just like I want. From a cost perspective, it’s a no-brainer: $113 startup (drive and sync program), $55/year for backup space - beats the next best thing, KeepVault, by $20 the first year (including startup costs) and $133 each subsequent year. It’s potentially a little convoluted, but for the price and the results, I can’t complain.

General Ramblings comments edit

So I just installed Windows Live Writer 2009 and I’m posting from there. I wasn’t super impressed last time I used WLW (which was, admittedly, a while ago) so I’m hoping this is better.

So far, it is. I’ll post my next few posts with this and see how it goes.

One thing that would be nice would be an ImageShack plugin so I can upload pictures to that rather than directly to my blog. (Saves on bandwidth, right?) Did a quick search and didn’t find anything. I suppose if I like WLW and use it, I should probably write the plugin, eh?

vs comments edit

UPDATE: BAH! I was sort of wrong about this. Turns out, as noted in comments, that if you use the solution I outline, then when you hit the key combo, it re-enables the “Track Active Item in Solution Explorer” option that you want disabled. So if you do this, you need to hit the key TWICE - once to select the current item, once to turn the setting back off. If I find a better solution to the problem I’ll update this post.

When I’m working in Visual Studio, I generally turn off the option to automatically track the current item in the Solution Explorer. I don’t like the Solution Explorer hopping about as I switch from file to file. Sometimes I do like to find whatever I’m working on, though, and that can be painful if you do it manually.

Fortunately, Visual Studio has a command you can bind to a keystroke to do exactly that: View.TrackActivityinSolutionExplorer

It’s not bound to a key by default, but you can go to Tools -> Options and bind it yourself. I’ve got mine bound to Ctrl+Shift+Alt+T. (‘T’ for ‘Track’ but you might want something more memorable for you.)

View.TrackActivityinSolutionExplorer key

media, windows, music comments edit

When setting up my Windows Media Center solution the primary goal was access to my DVD movie library. Getting access to my music was a “nice to have” feature, but not really required.

Since then, I’ve figured out how to get iTunes music (AAC, M4A, Apple Lossless) to play natively in Windows Media Center, but my other DLNA media devices - Playstation 3, Xbox 360 - still couldn’t play that music because Windows Media Connect, the thing that Windows Home Server uses for UPnP media sharing, is an older service that doesn’t understand those formats.

Some folks have solved this by doing a sort of hacky upgrade to Windows Media Player 11 (which is not supported on WHS, but enables more file formats to be shared). One of my big goals with Windows Home Server (and my media center solution in general) is to not hack around on the thing. I want a polished, appliance-like experience. I want support. I really don’t want to have to mess around with tweaking this and fixing that just to get things working. I get to do that all day at work; at home I just want things to behave.

To that end,I’d all but abandoned the idea that the Xbox or PS3 could share my music until I foundAsset UPnP.

Asset UPnP is a Windows Home Server add-in that enables sharing of virtually every kind of music format out there. The really cool bit is that it can transcode formats that your player doesn’t support into either Wave, LPCM, or MP3 format so your DLNA player will understand them.

We Got ServedandHome Server Plushave some good discussions about the functionality of the server and how it works, at least for version 1.1. The Asset UPnP page also has some good screen shots showing how to set things up and what your options are. I won’t duplicate all of that here.

Setting up Asset UPnP in its default configuration will enable DLNA media players and renderers to access the files that Windows Media Connect previously didn’t share because it didn’t understand. The power (and coolness) is in Asset’s “Force Streaming” function, which decodes audio formats before streaming them to the player - that enables

What I will tell you is how to get things working with your Playstation 3 and Xbox 360.

Get your metadata in order. Asset UPnP makes a lot of use of metadata tags - artist, album, album art, etc. - to generate the hierarchy you can browse to get to your music. Getting this right will make it far easier to find your music through your player.

Install version 2 of Asset UPnP. As of this writing, version 2 is in release candidate status but it has some features and bug fixes that version 1.1 doesn’t have that you’re going to want. I didn’t bother with version 1.1 and have found the RC of version 2 to be nice and stable. You can get the installer from the Asset UPnP page. Make sure you download the Windows Home Server version and not the standalone version.

Use the “Force Streaming” function for unsupported formats. You can get to the advanced configuration screen by seleting the “Edit Advanced Settings” button on the main WHS plugin control panel for Asset.

Select the AAC, M4A, M4B, and MP4 formats for iTunes music (that’s what I was working with). If you have FLAC or other music that isn’t supported directly by your player, select those formats, too.

Now the tricky part is to pick which format to stream the selected items in. For Playstation 3, select Wave. For Xbox 360, select LPCM. Unfortunately, Xbox 360 does not understand the Wave streaming and Playstation 3 doesn’t understand LPCM streaming. That means you can’t have both players working at the same time. At least, not right now. I don’t know if a fix is planned for a later release or not.

UPDATE 9/26/2010: Since the time of the original article, new versions of Asset UPnP have been released. If you are using Asset UPnP version 2, select LPCM streaming and it works with both PS3 and Xbox

  1. If you are using Asset UPnP version 3, select 256kbps MP3 streaming and it will work with PS3, Xbox 360, and Android DLNA clients.

Asset UPnP "Force Streaming"

Once you’ve got that set up, Asset will restart itself and you should be able to use your player (PS3 or Xbox 360 or whatever) to play your whole music library. If that’s good enough, you won’t have to mess with adding codec support to Windows Media Center.

UPDATE 9/26/2010: I posted an article explaining how to get your iTunes or Windows Media Player playlists into Asset. If you’re interested, check out that article.