Mar 30, 2011

Bravo, Suncorp! Bravo!

BYO Hardware at SunCorp

To quote:

“In what could prove to be a watershed moment for corporate Australia, financial services firm Suncorp will let thousands of employees use their personal computers, including Apple iPads, at work."

In case it’s not obvious, the approach taken means that the devices people choose to use will just be thin clients accessing Citrix virtualised applications and web based internal apps and I think it’s fair to assume that people will need to ensure anti-virus and firewalls are running on their devices where appropriate.

I for one think this is a great move and I hope more large enterprises follow suit.  The more places I can use my own hardware and the fewer places where I have to use horrible desktops, with awful keyboards and crappy screens the better.

Mar 28, 2011

How To: In Place Branch Switching with TFS 2010

One of the nice features of some of the newer version control systems is the ability to do fast in-place branch switching.

This is really useful when you are working on a web application and you have mapped an IIS virtual directory to your source folder and want to switch between branches without having to reconfigure your IIS mappings.

If you’re using TFS then most likely branch switching is a pain because you have branches mapped to separate folders and have to constantly close the solution, remap IIS and open the solution again from the other branch folder.  But you don’t have to! You can actually have multiple branches using the same local working folder, just not at the same time.

Here’s how to do in place branch switching with TFS 2010.

Starting Point

Let’s assume we have the following source tree in TFS, with a branch per story arrangement (this is using Source Control Explorer in Visual Studio 2010).  We currently have no branches mapped, thus the grey folders.

image

Let’s now map the integration branch and then get the source locally to our working folder.

image

image

When we look at the workspace details we then see this:

image

Switching Branches In Place

Now let’s say I want to switch to one of my story branches to make some changes.  The easiest way is right click the folder in source control and select “Map to Local Folder”

image

Alternatively, if you have the power tools installed into VS2010, you could click on the path mapping at the top of the source control explorer window:

image

We then enter the same working folder that we used for the integration branch above.  Given we’re wanting to reuse our working folder this should be obvious.

image

image

If we now look at source control explorer we’ll see that the integration branch is no longer mapped (it’s greyed out) and that our 2703 story is now the active branch.

image

We can confirm this by looking at the workspace details, seeing that the integration branch is no longer mapped and that our story branch is set to the working folder.

image

Note that if you change the source control folder in the working folders section of the workspace dialog you will also trigger the remapping operation.

When the get operation executes to pull down files, TFS will only send you files that are different between the two branches. It’s not a full recursive get, which means this operation is quite fast.

Note that this only works if we are switching between TFS branches.  If you try switching between non-branch folders you’ll get an error indicating the folder is already mapped.

image

Command Line Goodness

OK, so let’s go and switch back to the integration branch but this time we’ll do it via the command line.  We need two commands for this:

tf workfold /map <<< to change the workspace folder mapping

tf get /remap <<< to bring the local folder contents up to date

image

And as you can see TFS 2010 has only given us the files that are different between the branches.  Nice.

Now, you may ask, why would I use this method and not do it all via Visual Studio 2010?

Well, firstly it’s faster to do it this way (at least for me it is), plus it’s very easy to create a small batch file to make this even quicker and simpler, but a more pragmatic reason is that if I have a solution open when branch switching occurs then you’ll see this in Visual Studio 2010:

image

Which means I have to wait for the solution to close, for the get operation to complete and then I have to manually reopen the solution.  It’s easier than closing the solution in one folder and reopening the solution from another folder, but it’s still somewhat annoying.

If on the other hand I do the branch remapping from the command line then I simply get this:

image

Visual Studio just prompts to reload open files that have changed, which makes the switching process much easier since I only can just click yes to all and be done.  Note that if project or solution files have changed you’ll be prompted to reload them, but there’s no simple way around this.

Oh, one other reason for the command line usage is that at times Visual Studio gets confused about the workspace mapping changes and can sometimes block the switch by showing the “already mapped” error we saw earlier.  The command line has no such problems that I’ve seen.

Hang On! What If We Have Pending Changes?

Fair enough.  Let’s see what happens.

Assume we’re currently on the integration branch and that we have edited a file.  The pending changes window shows this pending edit.

image

If we now switch to the story branch we get a conflict:

image

So at this point we do the obvious and click “Checkout File and AutoMerge”, right?  Well, not so fast!

image

This is because the file hasn’t been downloaded to our workspace yet (remember we’re switching our workspace around). Here’s what we see in source control explorer if we want proof:

image

I’d much rather the pending changes window didn’t show the unusable option, but that aside, we grudgingly take the only choice available to us and overwrite the local file.  Our changes are wiped out and the file is now exactly as it is in the story branch we just switched to.

At this point if we look at the pending changes window we see this…

image

Huh? What’s up with that? TFS is saying there’s a pending change on our file that we just overwrote, but this is the pending change for our original branch isn’t it?  If we check in at this point would we make a mess in our original branch.  Urgh!

What if we now didn’t look and we went and edited EngineTest.cs in our story branch?  If we do and we refresh the pending changes window we see this:

image

Ah! So the refresh of pending changes shows that we not only have a change in our current story branch but that we also have a pending change for the integration branch still hanging around, but that the integration branch change isn’t mapped to a local file.

I should probably check that integration change in so things don’t get confusing.  If we switch back to the integration branch, what happens?  Why, we get a merge conflict of course!

image

Well, we’d better overwrite the local file since we it currently contains changes for the story branch not our integration branch

Unfortunately if we do so, our local changes will now be gone.  The pending changes we had floating about somewhere are toast!  In fact if we try and commit a file that is not currently mapped we get a dialog like this:

image

Hmm. OK. Not great.

Good Practices for In Place Branch Switching with TFS 2010

This means that in order for us to make branch switching as painless as possible with TFS, we should remember a few simple things:

  1. Ensure there are no pending changes before switching.  Use shelvesets as needed to preserve changes.
  2. The command line is faster.  Don’t be afraid to use it.
  3. Ensure our workspace mappings are to folders marked as branches in TFS 2010

And that’s it.  Go make the most of it, and if you bump into any edge cases feel free to post a comment about it.

Mar 15, 2011

Whither the User Group?

I’d love to hear some opinions on this so please leave comment(s) below or send me a tweet.

The Problem and Some Questions

In recent times in the Sydney area there have been a number of user group closures, extended breaks, sabbaticals and hiatuses.  The Sydney Mobile User Group has closed, the Sydney Business and Technology User Group is on an extended break, the Sydney Architecture User Group is going on sabbatical, the Sydney .NET Users Group has been on an extended break recently, the Sydney Windows Infrastructure User Group is talking of resurrection after being dead for over a year and both the Sydney Deep .NET User Group and the Sydney BizTalk group have been closed for quite some time now.

Whilst there are still a number of groups in action, it seems that the traditional user group format is losing traction.  The question I pose to you is this: Why? And what can we do about it?

Is it because the way we consume information has changed over the last few years?  For example I reach a much larger number of people via the Talking Shop Down Under podcast each week than I can via a face to face user group meeting.  Larger podcasts like Dot Net Rocks regularly get 60,000+ listeners per show, but a large user group only reaches 100 people once a month.

Is it because our sense of community is now online.  Twitter, mailing lists, social coding, Q&A sites like stack overflow and more all help us form online communities and allow people to connect with each other in ways that we’ve not done in the past, and help us avoid the awkward "I have to introduce myself to people in the flesh” moments that a lot of developer types find really difficult and that are needed if people are going to really communicate at user groups.

Is it because face to face meetings can be somewhat hit and miss?  There’s a time cost to attending a user group meeting and they occur at specific times.  Do people find the value of attending to low to make the time and inconvenience cost of being there in person worthwhile?

Do virtual meetings work?  Virtual is great for learning and reflects the changing nature of how we consume information, but they’re not so great for interactive discussions. We’ve run virtual alt.net meetings in the past and it worked for a while, but it was less than what I’d hoped it would be. Can we improve how these are done and make them really valuable for people?

Or is it something as simple as those who were running the group became burnt out or left the community and no one else stepped up to fill the leadership gap?

Some Thoughts

As a scrum person I like to regularly have retrospectives and “inspect and adapt”.  Add to that the alt.net approach of wanting to push the boundaries and challenge the status quo then it’s probably no surprise that I think it’s time to reinvent the user group as we know it.  The question now is how?  What would it look like?

If we go to the source of all truth (Wikipedia!) and look at the online communities topic we see that there are a few stages that people go through to enter and participate in a community.  They are:

  1. Peripheral (i.e. Lurker) – An outside, unstructured participation
  2. Inbound (i.e. Novice) – Newcomer is invested in the community and heading towards full participation
  3. Insider (i.e. Regular) – Full committed community participant
  4. Boundary (i.e. Leader) – A leader, sustains membership participation and brokers interactions
  5. Outbound (i.e. Elder) – Process of leaving the community due to new relationships, new positions, new outlooks

A user group generally targets the Insider/Boundary members, but there is often a barrier of entry for the lurkers and novices to overcome.  Attending a group when you don’t know anyone is hard.  Attending a group in a location you’ve not been to before is hard. Attending a group at night when family beckons is hard. People who have been attending for some time often forget about this and whilst they are more than welcoming of newcomers, most groups fall into behavioural patterns where the regular attenders talking to each other and the newbies sit quietly on the outer feeling semi-ostracized until someone drags them into a conversation.

A virtual group on the other hand encourages the peripheral and inbound people by making the barrier to entry low, but without the “stickiness” of face to face communication few people transition to insiders and help build a true community.

Another thing to consider is what motivates people to join a community, to remain in it and to participate in it.  Looking at the online participation topic you see a few key ideas.  Ideas that are simply reflections of real world communities.

Reciprocity – there’s got to be something worthwhile in return for the time cost of participating
Recognition – obvious enough
Influence – people want to have some effect on others in the community through high value contributions
Sense of community – it’s all about connections with other people.  We’re social beings, even if we’re introverts.

User group meetings provide the opportunity for all of these ideas to be borne out, though online communities do so as well.  Facebook being the poster child for this.  That said, the connections made via facebook, twitter and other online communities are far looser that those made face to face.  There’s nothing like meeting people in person that you’ve only talked with online – it turns “friends” into friends, for example:

image

A Proposal

So what can we do to reinvent user groups?  I don’t like talking about a problem without at least throwing some ideas for a solution out there to prompt conversation, so here’s a few tweets from some discussions this morning after I asked a few open ended questions about user groups…

image

image

image

image

So what do you think?

Is it time to move the traditional monthly user group meeting to become a more social event with regular online presentations around the topics the group is interested in? It’s how the Perth Alt.Net group operates and I know of a number of other groups that are starting to do the same.

If your user group did become a mixed virtual/physical group, how would you want to see the things run?  Social meetings at a bar, restaurant, someone’s house with a barbeque? Would you like the virtual meetings via Livemeeting? Livestream or Kyte.TV, etc? Or something else.

Click the comments link below and let me know (or send a tweet or start a thread on the Australian Alt.Net mailing list).  I’m really curious to hear what you think.

Mar 3, 2011

Git-TFS Recent Improvements

If you like using Git for local development work but work in a team environment where TFS in use then you’ll be glad to know that the git-tfs project has been progressing well since I last posted about it.

The best new feature is that now you can do a checkin direct from git-tfs instead of needing to shelve, and then check in via team explorer, making the whole process much, much smoother.

Here’s an example of how things now work (assuming you have already cloned the TFS repository)

image

When you run the git tfs ct (aka checkintool) command, you will see the check in dialog so you can commit the changes.  Note that this is only supported with TFS2010.

image

I’ve got a small change in my fork which will hopefully be pulled in to the main project shortly that pulls the commit messages from git and populates the comment field of the check in. UPDATE: This is now included in the main project so use spraint's version.

Once the check in completes git-tfs then automatically pulls the changeset from the remote TFS server and merges the change locally to save you having to remember doing that yourself.

image

image

Finished!  Now we can get back to our normal development flow. This is so much easier.

The advantage of having the checkin tool is that we can also associate our commit with work items in TFS as well as dealing with check in policies.  This is excellent!

If you don’t want to use the check in tool UI, then you can use the git tfs checkin command and supply the –w option to associate to a work item.  Policy failures should result in the checkin failing.

Note that for now, you will have to build git-tfs from source to get this functionality, but that shouldn’t be a problem for anyone wanting to use this tool :-)