Friday, December 24, 2010

The AnkhSVN plug-in for Visual Studio

My department recently switched source control tools, moving from Microsoft's Visual Source Safe to Subversion.  We've been using the Windows Explorer-based Tortoise as a front-end, but we've been encountering difficulties with the lack of integration into Visual Studio.  For example, it's very easy to forgot to add new source files to the repository, often resulting in a broken build.

So I've started looking into VS plug-ins for SVN, and have been impressed with the open-source AnkhSVN.  It has a very attractive integration into the Solution Explorer, has Commit, Diff and Annotate/Blame features that display as VS window panes, and it automatically includes new solution files in the commit.  Overall, it appears to have been built with a great deal of care.  For example, the unmodified state is displayed with blue check marks, not green, because this is easier for color blind people to distinguish from red.    I've included some screen shots below the fold.

Sunday, November 7, 2010

Clean Code

I've started reading Robert Martin's Clean Code: A Handbook of Agile Software Craftsmanship and am thoroughly inspired to whip my code base into shape. Here's a sample:

“But wait!” you say. “If I don’t do what my manager says, I’ll be fired.” Probably not. Most managers want the truth, even when they don’t act like it. Most managers want good code, even when they are obsessing about the schedule. They may defend the schedule and requirements with passion; but that’s their job. It’s your job to defend the code with equal passion.

From "Attitude" in Chapter 1.

Thursday, September 30, 2010

Sitecore Multi-Site Black Arts

I just came back from a very stimulating presentation at the New England Sitecore User Group by Rick Cabral of ISite Design on setting up multi-site environments in Sitecore.  Among the things I learned:

Sunday, September 12, 2010

Extreme Programming Dangers

While doing some online research on development methodologies, I came across a useful analysis of how Extreme Programming (XP) can break down in real life, because each component methodology (lack of fixed design, pair programming, constant refactoring) is too dependent on the others for success. An example:
Constant refactoring (i.e. constant tweaking and improving of your code) creates an unnecessary overhead. Outside the XP world, occasional refactoring is welcome, as it is useful to check and improve ('de-fluff') your design; but constant refactoring makes no sense. In fact it only makes sense in the XP world, where the design is made up as you go along.

Friday, August 13, 2010

The open source model comes to medical research

An intriguing article in today's New York Times about a new way of organizing medical research--get all the raw material out there, so lots of eyes can see it:

The key to the Alzheimer’s project was an agreement as ambitious as its goal: not just to raise money, not just to do research on a vast scale, but also to share all the data, making every single finding public immediately, available to anyone with a computer anywhere in the world.

No one would own the data. No one could submit patent applications, though private companies would ultimately profit from any drugs or imaging tests developed as a result of the effort.

Sound familiar? I like the distinction drawn between open information and "ultimate profit". It reminds be of Richard Stallman's definition of Free Software: "Think of free as in Free Speech, not as in Free Beer."

Doing Unix-type things on the Windows CMD prompt


I've playing around with the SVN command line recently, and the inability to use UNIX command-line tools like grep has been irritating. I've done some Googling for Windows equivalents to the basic Unix command line toolkit, and here's what I've found.

Thursday, August 12, 2010

Sitecore 6.2 WebDAV features

With 6.2, Sitecore allows you to access uploaded Media Resources as if they were on your local file system--drag and drop file upload, right click to edit, etc. Here's a useful walk through from Sitecore:

Wednesday, August 11, 2010

Sitecore Coming Attractions

Just attended a user group presentation on Sitecore 6.3 and Sitecore Azure.  6.3 is all about cleaning up the relationship between Content Management and Content Authoring servers.  The Staging Module goes away, and is replaced by an event queuing architecture that enables, among other things, multiple Content Management servers (e.g one in California, one in the UK), to stay in sync.

But things get really cool with Sitecore Azure, which allows one-click style deployment of Content Management and Content Delivery servers from the cloud, for rapid scale up.  This looks like a big deal for Microsoft, since it provides a pretty nifty front-end to Azure.

Update: Microsoft posted a case study on Sitecore Azure.

Thursday, August 5, 2010

How to avoid Merge clutter

Subversion marks unmodified files as modified - Stack Overflow explains why you get tons of extraneous files and folders as modified after doing a merge. Basic takeaways:
  1. Always merge to the root directory.
  2. Once merge info gets into a file or folder, the merge info gets updated with every merge.
  3. The only way to fix this is with a recursive delete of the merge info in children of the project root.
  4. Before doing this, you need to make sure that the list of merges in the project root is exhaustive, or you may end up applying a merge twice. This is unlikely however, as merge info is a recent addition to SVN, and the underlying code is designed to recognize if a merge has already been applied.

Sunday, July 25, 2010

Resolving SVN Tree Conflicts

The Red Bean SVN Book has a good explanation of how to fix Tree Conflicts in the chapter Dealing with Structural Conflicts.  Basically, this happens because one developer has made a change to a file or directory that another user has deleted or renamed.  The svn status command will indicate which file is at issue:
C:\testrepos>svn st
M       baz.cs
M       foo.cs
A  +  C bar.cs
      >   local edit, incoming delete upon update
The "C" in column 5 next to bar.cs indicates a tree conflict, namely that this file has been renamed by another user.
To resolve this, do an SVN UPDATE, which will bring in the renamed version, apply your changes to this version, use SVN REMOVE to delete bar.cs, and finally, let SVN know that the conflict is resolved with this command:
svn resolve --accept=working bar.cs
This lets Subversion know that the change we made to bar.cs, namely deleting it, should be propagated up to the repository. Finally, do a commit to mark the change complete.

UPDATE: We moved to GIT, so these are now a distant memory. Git can handle this scenario cleanly.

Saturday, July 24, 2010

Subversion FAQ

Digging into the Subversion FAQ. It has a lot of useful tips, such as this one:
I have a file in my project that every developer must change, but I don't want those local mods to ever be committed. How can I make 'svn commit' ignore the file?

The answer is: don't put that file under version control. Instead, put a template of the file under version control, something like 'file.tmpl'.

Then, after the initial 'svn checkout', have your users (or your build system) do a normal OS copy of the template to the proper filename, and have users customize the copy. The file is unversioned, so it will never be committed. And if you wish, you can add the file to its parent directory's svn:ignore property, so it doesn't show up as '?' in the 'svn status' command.

Tuesday, July 20, 2010

Just wondering...

Why doesn't windows provide a command line interface to uncompress *.zip files?  Something legal, or they just don't want us doing that in our bat scripts?

Wednesday, July 14, 2010

Excluding .svn Directories from the MSBUILD Copy task

This post shows how to exclude .svn directories from an MSBUILD task. The magic syntax to exclude them is this:
<ItemGroup>
     <LibraryFiles Include="$(LibrariesReleaseDir)\**\*.*" Exclude="$(LibrariesReleaseDir)\**\.svn\**" />
</ItemGroup>

Monday, July 12, 2010

Keeping Web.Config nice and tidy

I've been digging through .Net blogs to get some ideas about how to tidy up the web.config file.

OdeToCode recommends building an encapsulation layer between Web.Config and your code, so that the string values keys used to access Web.Config settings are replaced with property names of a Configuration class.   This also provides a place for casting not string values, and for replacing the source of the data at a later point in a way that will be transparent to the rest of the application.

Sunday, July 11, 2010

Tweaking the project file to customize MSBUILD

Compiling Apps With Custom Tasks For The Microsoft Build Engine explains the black art of tweaking your .csproj file.

Web Deployment projects ...

... are very cool.  They let you automate deployment to production or test environments either from Visual Studio or from the MSBUILD.exe command, with pre- and post- build customized tasks, and web.config overrides, all driven by the Configuration setting.  I've found a good blog post but not a lot of documentation, so I'm still figuring out how the tasks work.

Update: There's an open source project to write custom MSBUILD tasks.

Monday, March 8, 2010

XSL for getting a Sitecore path


Getting started with Sitecore is forcing me to come to grips with XSLT. Which is a gnarly beast. As I figure out how to do things simple and not so simple, I'll post them here, where I can find them.

First on the list--how to generate an item path.  Along the way, we'll cover recursion in XSLT, and how Sitecore   represents content in XML.