TFS undo checkout of unedited files

posted on 13 April 2012 in programming

It bugs me when developers check in files to TFS that haven’t been modified. It’s easy to do, you open a file, edit it, change your mind and ctrl-z it. Now you have a checked out file with no changes and when you do your next check in you’ll probably check that file in too, unless you’re really on the ball and compare each file manually first. TFS makes no distinction between checked in files that were modified and those that weren’t, which makes the job of reviewing code that much harder.

Read Article

Create branch of modified working copy in TFS

posted on 29 March 2012 in programming

So you’ve been working on your code from Team Foundation Server (TFS), made changes then realised you should really have started a branch for it.

I couldn’t find a good tutorial anywhere for how to do this so here’s the best workflow I found.

Read Article

Delete Dependents When Removing an Entity From Entity Framework

posted on 06 September 2011 in programming

This post is based on Entity Framework 4.1 Code First Fluent API.
I have an Entity Framework model being used in the business layer called Patient, it has a collection of dependent entities called Responses, when a response needs to be deleted I simply remove it from the collection and expect that it’ll get deleted from the database. It doesn’t.

Read Article

Conditional Validation in ASP.NET MVC3

posted on 10 June 2011 in programming

Need to perform validation on a model’s property based on some other state of the model? Here’s a way to achieve it using the IValidatableObject interface and data annotations.

Read Article

Using LINQ to list all duplicates

posted on 11 March 2011 in programming

There’s plenty of examples on how to find duplicates using LINQ’s GroupBy method, but usually they use a projection to return a new object, like this:

_filteredSubmissions = (from s in _filteredSubmissions
                        group s by s.Email
                        into g
                        where g.Count() > 1
                        select new { Emails = g.Key, DuplicateCount = g.Count() }
Read Article

Unindent in Expression Blend

posted on 14 February 2011 in programming

Unindenting in Expression Blend drove me mad, I just couldn’t get it to work. Today I figured out why.

The code I am copying from Visual Studio uses spaces for indentation, in Blend I was using tabs, this means when I paste code from VS, Blend doesn’t see any tabs to ‘unindent’.

Simple solution - make sure your Visual Studio indentation settings match your Blend settings.

Read Article

WPF RadioButton Binding to IsChecked Property

posted on 08 July 2010 in programming

I wasted a few development hours discovering this strange behaviour when binding to the IsChecked property of a RadioButton in WPF when using MVVM. You can read about the issue on the MSDN forum, but from my experience if you have a two way binding on the is IsChecked property of a RadioButton which is part of a group, then after you set the bound property in code a couple of times, the RadioButton loses it’s binding all together.

Read Article

Logging Messages in Dot Net

posted on 17 June 2010 in programming

The .Net Framework provides an easy way to log messages using the System.Diagnostics.Trace class. By using Trace the user can configure where and what to log in the config file.

Below are two simple ways to log a message to a text file.

Read Article

phreplace Goes Open Source

posted on 14 June 2010 in general

I’ve decided to release phreplace as open source software in order to continue it’s development, I no longer have the time to give it the attention it requires.

The VB6 source code will be released under the GNU Lesser General Public License (LGPL), in my understanding this means that anyone can use phreplace and even include the library in a greater works (e.g. PSPad), however if they modify the code it must be released under a similar open source library, in order that everyone will benefit from the changes.

The source code is available at Assembla, feel free to send any code changes to me to be included in the project.

Read Article

IE Autocomplete Doesn't Fire onchange Event Handler

posted on 17 April 2010 in programming

While testing an ASP validation control in Internet Explorer I found that the validation wasn’t triggered if I selected an item from the autocomplete list for a text box, this was the same in Safari for Windows, but worked fine in Mozilla Firefox. What?!

IE form autocomplete feature

Read Article