Archive for software

Friends of red-gate

I recently was accepted into the Friends of Red Gate program from red-gate software. red-gate makes some unbelievably useful tools for Sql Server/.Net development, my favorite (so far) being the Sql Compare tool that compares two databases and generates a change script to synchronize them in either direction, very nice.

When I joined the program, they asked for my address so they could send me a “welcome kit.” I was expecting the usual propaganda about red-gate, their products, etc. About a week later I got the kit, and I was shocked. The contents included:

  • red-gate t-shirt
  • red-gate coffee mug
  • red-gate 256MB usb drive

By far the best “welcome kit” I’ve ever gotten, and certainly better than the MCSD certification “welcome kit” that MS sends out :) The best part is that people would be happy enough just to get  licenses of red-gate software as part of the program, but they go the extra mile and send you some cool, useful stuff.

Dual UIs: Windows Forms and WPF in the Same Application

A little bit ago I mentioned that I was working on v2 of Walnut and adding a WPF user interface. As I was thinking about the new UI I thought that it would be convenient to keep the “old” Windows Forms UI around, so that I wouldn’t have to require people to have .Net 3.0 installed to use Walnut. This is kind of similar to an Ajax web application gracefully downgrading when users have javascript disabled.

After thinking about how to implement these dual UIs, I came up with what I think is a pretty cool solution. In v1 of Walnut, there are two projects in my soluion file:

  • Walnut.Core - This is a class library that contains the business logic of Walnut as well as other application code that doesn’t relate to the UI.
  • Walnut.Shell - This is the Walnut.exe executable that contains the Windows Forms UI and references the Walnut.Core project.

When I press F5 in Visual Studio, the project that gets started is Walnut.Shell.

Now in v2 I have three projects:

  • Walnut.Shell - This is now class library project that contains the Windows Forms UI implementation.
  • Walnut.WPFShell - This is the new project that is also a class library and contains the WPF UI implementation.
  • Walnut.Core - This project is now the Walnut.exe project and contains the same business logic.

So now instead of starting the Walnut.Shell project, the Walnut.Core project contains the Main() method that starts Walnut. When the application starts up, it determines which shell to start(Windows forms vs. WPF) and loads the correct assembly. To facilitate this, I added an interface to Walnut.Core called IShell that is defined as follows:

public interface IShell
{
    void RunUI();
    void Initialize();
    void Shutdown();
}

Each of the shell projects has a class that implements this interface. When the application starts and determines which shell to load (which is a config setting for now), it loads the assembly and finds the class that implements the interface, using reflection. Once it finds the class I just have to instantiate it and call the RunUI() method which starts the UI.

After I got this concept working in the code, I had to make some changes to the way the projects build in Visual Studio. I have an MSBuild script which makes a release build so that I can package it up into an installer, but I also like to be able to press F5 in Visual Studio to get some instant feedback on code. Since the Walnut.Core project doesn’t reference either of the two shell projects (that would make a circular reference) I had to set the build directory for each project to the same location, otherwise the assemblies wouldn’t exist in the right locations.

I also had to change the MSBuild script as well as the Wix script, no big deal. Now all I have to do is learn WPF :)

New Site Design

I spent some time tonight getting a new theme on my blog site. I was getting a little tired of the old one, it was time for a change.

I used the “fresh” theme available at: http://www.ilemoned.com/wordpress/wptheme-fresh/

I modified some of the theme, took out some stuff, added some other stuff. I still need to recreate my “Contact Me” page, but everything else is there, thats whats nice about switching themes in wordpress, not a whole lot of pain involved :)

Branching and Merging Pain

So I’ve started work on v2 of Walnut. I’m adding a new WPF interface for v2 as a way to learn WPF. I started messing around with it briefly, but its so much different than WinForms that its gonna take awhile to figure it all out.

But, the point of this post is about branching and merging in Subversion. I created a new branch for v2 in my repository, in the ‘branches’ directory. I got it all setup and then left it alone for awhile and fixed some bugs, added some small features to the trunk.

Now I want to start work on v2, but first I want to merge all the changes from the trunk first, so I know I’ve got an up-to-date repository. This is where the pain comes in. I cannot figure out how to pull in changes from the HEAD of the trunk to the HEAD of my branch.

The interface in TortoiseSVN doesn’t make sense to me. I’ve tried initializing the merge from the trunk and from the branch, but neither option seems to do what I want. Heres what I’m trying to do:

  1. Update any file in the branch that has been updated in the trunk.
  2. Add any file from the trunk thats been added that doesn’t exist in the branch.
  3. Delete any file from the branch that has been deleted from the trunk.
  4. IGNORE any file thats been added to the branch

All I want is to pull in changes FROM the trunk TO the branch, sounds simple enough.
Since I’ve already added some files to the branch (that don’t exist in the trunk), Tortoise keeps trying to either delete these files when I’m merging FROM the trunk, or adding these files when I’m merging TO the trunk.

Is there some other command that should be using to accomplish this? It seems like a common scenario, but its driving me crazy!

UPDATE 8:54 PM: Jake helped me out with the merge command, and after figuring out how it works, I realized that I made a bad decision by branching version 2. What I should have done was branch the existing trunk to its own branch for maintenance and left v2 on the trunk. It shouldn’t be too hard to rectify that problem though.

The Road to Hell is Paved With Good Intentions

Some background info:

  1. A little while ago, I formatted the second hard drive (the one I had installed Linux on) and moved Erin’s and my “My Documents” folder to the G: drive. I also moved my projects folder, and our folder of ripped mp3’s. This is in preparation for upgrading to Vista. I wanted our files on a separate drive so that if everything goes to hell, we won’t lose our stuff.
  2. Yesterday, I went to General Nanosystems and bought a stick of RAM to upgrade the machine with, also in preparation for Vista.

I got home and plugged the RAM in and tried to restart. When I got to the XP login screen, there was a message about a corrupt registry key that had been successfully restored. This all sounded good to me. I tried to logon and the screen froze up.
I restarted the machine and the same thing happened. I took out the RAM and everything was back to normal.

Sort of.

When I logged in, my user settings had been reset, so all my preferences were gone, including the new My Documents mapping to the G: drive. I remapped My Documents to the G: drive, reset my wallpaper, etc. which didn’t take long. I assumed that my settings had been lost because of the freeze when I tried to login, and that Erin’s settings were fine, because I hadn’t logged in as her.

When Erin plugged in her iPod this afternoon, it wouldn’t let her sync, saying that some other computer “owned” the iPod. Also, there was a lot of music missing from her library. Now, its bad enough when I screw something of MINE up, let alone something of hers.

So I figured out that since I had moved the music directory to the C: drive to the G: drive, thats why it couldn’t find the music. So I re-added the music folder from its new location, hoping that iTunes would recognize that the songs already existed and just update the locations. It doesn’t do that apparently. Now there were a BUNCH of duplicate songs; the new ones I had just added and all the old ones that iTunes couldn’t find. Worse still, all of her playlists referenced the bad songs and there doesn’t appear to be a way to “swap” songs or anything.

There was still the issue of iTunes not letting her sync up. Then I realized it. Her user settings had been reset, just like mine, so her My Documents was still pointing to “C:\Documents and Settings\”, etc. so she now had a brand new iTunes profile, which made the iPod think this was a new machine.

I remapped her My Documents to the new location, and the sync functionality came back, whew.

Back to the invalid songs and all the duplicates. I found the iTunes library xml file and took a peek. Very easy to understand file, you can see the tag where iTunes stores the path to the path on the file system. I thought I was all set, just a quick find and replace on all the invalid file paths, and I’m back in business. I tried this and fired up iTunes. All the songs were still invalid. I looked at the xml file again, and all the invalid paths were back!

It seems iTunes knows if someone had tinkered with the xml file and restores it if its been modified. Ugh.

In the end, I just had to wipe the library and re-import all the folders and now the playlists will have to be recreated. Not the best result but at least everything can be fixed, its just a pain in the ass.

I just have to laugh a little because I rarely buy new RAM for a computer and I also rarely (if ever) add a new hard drive and remap the “My Documents” folder, but since I did both of those, they joined forces to screw me over, and I didn’t even get to add the damn RAM!

(Never did figure out what the problem was, but I don’t want to tempt fate and put it back in, that shits going back to GN)

New Book on its Way

Erin emailed me while we were at work the other day and said that we had some online coupon to Barnes and Noble and asked if there was any book I wanted. I did some browsing and remembered the book I had waffled on buying for a little while:

agile web development with rails

Between this book and Founders at Work, I should have some good beach reading for our Mexico vacation in a week. As an added bonus, I shouldn’t have to worry about anyone stealing, or mistakenly taking, my books :)

Trying out Google Reader, Again

Update 2/6: It only lasted about a day and half and I’m back to Bloglines, I just couldn’t do it.

I decided this morning to give Google Reader another try. I tried it out in its first incarnation, when it really sucked, and I’ve been very happy with Bloglines for a long time now.

Two things that stand out right away that I don’t like:

  • I can’t seem to find a gadget for my Google homepage that simply shows the number of new items. I don’t want to actually SEE the items, just a count.
  • I also don’t see the number of people who subscribe to each feed, which I always thought was a cool feature in Bloglines.

One thing that I like right off the bat (after ~30 minutes), is the starring of items. I typically will “save” items in Bloglines that I want to read later, and those items always add to the unread count that I see on my Google homepage, which is misleading. When I star items in Google Reader they are marked as read and I can access the starred items on top, separate from the new items.

As long as theres some way to get the unread count on my Google homepage I’ll be a happy camper, we’ll see how it goes.

S3 Backup Resolution

This post from Jason Bock reminded me that I never followed up on my Amazon S3 backup plan.

In my last post, I mentioned that I was ditching JungleDisk to use S3Drive because it didn’t cache the files locally, and it mirrored my file structure with no encryption which makes it convenient to use.

After trying to backup my files with S3 Drive, I’ve now made the switch back to JungleDisk, primarily because the file transfer speeds with S3Drive were horrendous (~2k/sec).  At those speeds doing a backup of all our pictures would have taken days upon days.

JungleDisk has also had a couple releases since then and made some improvements.  I also turned the cache down to 100MB, so while its still caching files, its not going to eat away my hard drive while I’m backing stuff up, and they’ve said they are considering an option to turn off the cache completely.

And, while the encryption of my files is less convenient in the sense that I now need JungleDisk to read my S3 files, its not a bad trade off to make considering that my files are more secure.

So my setup is: JungleDisk to interface with S3 account and Robocopy to actually manage the backup process.  Heres my robocopy command line setup too, with some options that work best for me:

set defaults=/MIR /XD “My Music” /XA:H /R:1 /W:2 /Z /V /XO /SEC /COPY:D /XX

robocopy.exe “PATH_TO_BACKUP” “DESTINATION_OF_BACKUP” %defaults% /LOG:LOG_FILE_PATH

/MIR - This tells Robocopy to mirror the file structure
/XD “My Music” - Excludes the “My Music” directory
/XA:H - Excludes hidden files
/R:1 - Allows for 1 retry of failed transfers
/W:2 - When retrying, wait for 2 seconds before starting again
/Z - Copy files in restartable mode to account for network glitches
/V - Turn on verbose logging
/XO - Excludes “older” files, so files that haven’t changed since the last backup won’t be transferred.
/SEC - Copy files with security
/COPY:D - Copy only file data, not other attributes
/XX - Excludes “extras”, this will delete files from S3 if they don’t exist locally

You can find a great list of all robocopy parameters here.

Ratings Systems

Way back when Netflix released a huge dataset for their competition, I got to thinking about ratings systems like the one Netflix has for movies that you rent.

You can log into Netflix and begin browsing movies and rate movies that that you like or dislike. For instance, I gave “The ‘Burbs” four out of five stars. Based on your ratings, netflix can better recommend movies that you might like.

A similar ratings system exists on the Yahoo Music player. As songs are playing you can rate them 1-4 stars or click on the “no smoking” sign which indicates that the song sucks really bad and you never want to hear it again (of course, there are ways that Yahoo will queue it up for you again, as I’ve heard “drops of jupiter” several times even though it makes my ears bleed).

I like the idea of these ratings systems because I’ve found a lot of music/movies that I like based on the recommendations of Yahoo and Netflix. What I don’t like about these ratings systems  is that they have too many options.

I nearly always end up rating songs at 3 out of 4 stars on Yahoo (if I rate it at all), and I think this is my thought process:

  1. I like this song, what should I rate it?
  2. Well, its not the BEST song ever, so its not a 4
  3. On the other hand, I like the song, and a 2 seems like a bad rating
  4. I’ll go with a 3

At least to me, theres no reason to have any other option besides “Thumbs Up” or “Thumbs Down”, either I like the movie/song or I don’t. Digg got this part right on their site, you either “digg” a story, or you don’t, simple as that.  I would think that simplifying the ratings system would make the recommendation engine a little easier too, since they don’t have to account for different “levels” of how much you like something.

As an aside, when I first started using the Yahoo music engine, I found that there was some way to change the rating system from a 4 star to a 0 - 100 system. 0 - 100??!?!  “Gosh, I don’t know, is this song a 33 or a 34?”. Give me a break.

Streaming Netflix

So I saw today on Slashdot that Netflix is offering streaming movies. It looks pretty cool because you don’t have to pay anything extra to get 18 hours of streaming content a month. You can watch whatever you want, whenever you want, until you hit 18 hours. I’m not sure if you can pay more to get more monthly hours or not, I’m sure that will be an option eventually.

This has, more than anything else, made me want to get some device (Apple TV, Xbox, etc) that will allow me to stream movies from my computer to the TV, preferably over a wireless connection. In the past (before today), I wasn’t all that interested in these solutions because I don’t have a huge library of movies, nor do I want to maintain a huge collection. Now that Netflix can host my collection for me, connecting my TV to my computer makes a lot more sense.

A couple questions still remain though.

  • Is it possible to stream a netflix movie from my computer to the TV?  There is a special movie player that you have to use and I don’t know enough about streaming content from the computer to the TV to answer this.
  • What’s the maximum quality we can achieve?  DVD?  HD?  It says that Netflix will detect your connection speed to determine the quality it can give you, but I would be willing to wait 10 - 15 minutes to buffer a higher quality movie.
  • What’s the selection like?  The screencast above mentions that Netflix currently has ~1000 titles available.  I’m assuming that will continue to grow.

So we’ll see what happens, I’m not sure what it would cost to get a decent streaming solution from my computer to my TV, but hopefully I can get something eventually.