Wednesday, November 24, 2010

Rename files in SVN and Git in Visual Studios

If you haven't shelled out for VisualSVN you have probably had to rename a file in source control manually while it's being tracked in Visual Studio. This can be a pain if things go out of order. So here it is.

This is in C#, which assumes a safe rename refactor exists. Sorry C++!

Svn with Tortoise:
  • Right click file (Foo.cs) in Visual Studio, click "Exclude from project"
  • Find Foo.cs in the Explorer, right click and select TortoiseSVN->Rename...
  • Rename your file.
  • In Visual Studio, right click the folder your file is in (or the project if it's at the top level), and select Add->Existing Item
  • Open the newly renamed file, rename the class FooPrime, hover over the red box below your rename, and select the 'Rename Foo to FooPrime' option.
  • Compile, success!
  • Commit your changes (in Explorer, right click at the top level folder and select SVN Commit)
Git with Git Bash
  • Right click file (Foo.cs) in Visual Studio, click "Exclude from project"
  • cd to the folder containing Foo.cs
  • rename your file with 'git mv Foo.cs FooPrime.cs'
  • In Visual Studio, right click the folder your file is in (or the project if it's at the top level), and select Add->Existing Item
  • Open the newly renamed file, rename the class FooPrime, hover over the red box below your rename, and select the 'Rename Foo to FooPrime' option.
  • Compile, success!
  • Commit your changes (git commit -a)

Note, to move files in TortoiseSVN you have to right click and drag to the new folder (use two explorer windows if the folder isn't easily accessible from your current location). Then select 'Svn move versioned item(s) here...'


Tuesday, November 23, 2010

Really Microsoft?

Today I spent an hour trying to share a folder between two machines on my local network. Yesterday I spent a half hour trying to do the same thing. In both instances, I was able to get it to work somehow, but the 'solution' is still a mystery to me, and I wasn't able to take away any consistent steps to make this work in the future. What a stupid waste of my time.

I have spent about 12 hours trying to get SQL Server Express 2008 into some sort of usable state. I tried to perform a standalone installation because I didn't want to upgrade 2005 express. Apparently that was a bad idea, and after trying to uninstall and reinstall 6 times I had about 20 orphaned installations in the magic Uninstall registry key buried somewhere deep inside the registry. After nuking all of those I was able to successfully install the app. Now I can't access the db from more then one application at a time. Want to use SSMS and then switch back to Visual Studio? Okay, please restart the SQL Server instance. Want to drop and recreate your db, restart the server first. Want to get some work done? Too bad, restart SQL Server all day instead.

Thursday, March 25, 2010

Working Effectively

Just because you are working hard does not mean you are worth your paycheck. Working effectively means maximizing the amount of work not done. For example, it is less expensive to maintain one copy of your codebase than to maintain two copies. Therefore, if you opt to branch your code irresponsibly, you will work harder but not as effectively. Most developers can't tell the difference and go home feeling proud of themselves for having worked hard. Somebody should let them know that most of their effort is spent paying down interest on the debt they accrue every day.