Wednesday, December 31, 2008

Robocopy error: ERROR 5 (0x00000005) Changing File Attributes

I use robocopy to backup my files to a network drive with the following command:

robocopy [source folder] [target folder] /MIR

The MIR option will create the target folder as a mirror of the source folder. The command above works pretty well when both source and target folder are NTFS file systems.

When I changed the target folder to my DNS-323 network storage, which uses a Linux file system (ext2/ext3), I started getting the following errors with the command above:
  • Although some files are virtually identical in both content and timestamp, robocopy still thinks they are different and show them as "Newer". So, whenever you run the command above, robocopy will always copy these files even if they did not change (not good for incremental backups!).
  • "ERROR 5 (0x00000005) Changing File Attributes ... Access is denied".
For the first error, you need to use the /FFT flag to assume FAT file times (2 second granularity). Although the target folder is ext2/ext3, these file systems also implement file times with 2 second granularity.

For the second error (ERROR 5), you need to turn off the attribute copying. Robocopy uses the /COPY:DAT by default, which means to copy data, attributes and timestamp. You should turn off attribute copying by explicit setting /COPY:DT.

So, the command to backup from a NTFS partition to a ext2/ext3 partition should be:

robocopy [source folder] [target folder] /MIR /COPY:DT /FFT

Monday, December 29, 2008

Upgrading to SQL Server 2008 Express and Management Studio Express 2008

In my developer machine, I have Visual Studio 2008 Professional which comes with SQL Server Express 2005. I decided to upgrade to SQL Server Express 2008 and also use the new Management Studio Express 2008.

For the 2005 versions, we have two separate installers: one for SQL Express and another one for Management Studio Express. For the 2008 version, these products are deployed in the same installer: Microsoft SQL Server 2008 Express with Tools. Lots of people are complaining that they cannot get the Management Studio installed (see discussion here), but the trick is to run the installer twice: first run to upgrade to SQL Express 2008, and the second run to add features to the current installation (Management Tools - Basic). The main steps of this installation are:

1. Download the installer from Microsoft SQL Server 2008 Express with Tools and run it.

2. In the Installation screen, select Upgrade from SQL Server 2000 or SQL Server 2005, and just follow the next screens. During the upgrade, it is not possible to select new features to be added (Management Tools), so you will have to run this installer again later to add the management tools.

3. After the installation is completed, close the SQL Server Installation Center if it is still open. Then run again the same installer that you downloaded on step 1, in my case SQLEXPRWT_x86_ENU.exe.

4. In the Installation screen, select New SQL Server stand-alonegrade from SQL Server 2000 or SQL Server 2005, and just follow the next screens.

5. In the SQL Server 2008 Setup - Installation Type screen, select Add features to an existing instance of SQL Server 2008, and click on Next.

6. In the SQL Server 2008 Setup - Feature Selection screen, select Management Tools - Basic, and click on Next, and just follow all the remaining screens.

When installation finishes, you will be able to access Microsoft SQL Server Management Studio from Start/Programs/Microsoft SQL Server 2008 menu, or by just running ssms.exe.

During the installation, the Setup Support Rules screen showed all the time. I understand their concern to verify that we meet all the installation requirements, but they should show this screen only if we fail in meeting some requirements, otherwise it becomes annoying.

Tuesday, December 23, 2008

Team Foundation Server Power Tools

I work on some open source projects in Codeplex (Repository Factory and Chinook Database) and I've been using Visual Studio Team Explorer to access the source code repository in their Team Foundation Server.

Although TortoiseSVN is my favorite client, and I could use it through SVNBridge, I am still insisting in using VS Team Explorer just to get used to a different tool. One of the things I miss on it is the ability to undo files that were not changed. Perforce, another source code control that I used for many years, has this feature to undo unchanged files. This feature is important so that you only check in files that you modify, thus avoiding having unchanged files in your change list that would waste time of your reviewers!! If it is a small change set, it is not a big deal to manually undo them. When I was converting some projects from VS 2005 to 2008, I had to open for edit all files before initiating the conversion, otherwise it would fail. Most of the files did not change, and it became impractical to manually undo them due to the large number of files involved.

After a few searches, I found Team Foundation Server Power Tools which consists of a set of enhancements, tools and command-line utilities that improve the Team Foundation Server user experience. It requires you to have Windows PowerShell installed. One of the tools included is the command line utility tfpt.exe which provides the following commands:

In order to undo unchanged files in your workspace, you need to use the following command:
   tfpt uu
This command will list all unchanged files and then prompt you if you really want to undo them. It worked really well for me and saved me lots of time!

Besides the tfpt.exe command line tool, Team Foundation Power Tools also includes:
  • TFS Best Practices Analyzer
  • Process Template Editor
  • Work Item Templates
  • Custom check-in policies
  • TFS Server Manager
  • TFS Users tool
  • Alert Editor

Tuesday, December 16, 2008

patterns & practices Application Architecture Guide 2.0 - Community Technology Preview (CTP)

The Patterns and Practices team just released the Community Technology Preview (CTP) of Application Architecture Guide 2.0. This guide provides design-level guidance for the architecture and design of applications built on the .NET Framework. This is a CTP, and the release of this guidance in the MSDN Library is currently scheduled for February 2009.

Monday, December 08, 2008

Home, PageUp, PageDown and arrow keys not working inside VMware virtual machine

When running my Windows XP Pro 32-bit virtual machine on my Ubuntu 8.10 64-bit host, several keys are not working properly, including: Home, PageUp, PageDown, End, arrow keys, etc.

This virtual machine works fine when the host is Windows Vista 32-bit. This looks like a common issue when running vmware on Ubuntu 8.10. Thanks to this post which provided a simple solution for this annoying problem. In your Ubuntu host, edit the file /etc/vmware/config, and add the following line:
xkeymap.nokeycodeMap = true
This worked out for me! For more info see the original post.

Spring Boot Configuration Properties Localization

Spring Boot allows to externalize application configuration by using properties files or YAML files. Spring Profiles  provide a way to segr...