November 2010 - Posts

Pre-commit.hook 

setlocal

set REPOS=%1
set TXN=%2
set SVNLOOK="%PROGRAMFILES(X86)%\VisualSVN Server\bin\svnlook.exe"

REM Make sure that the log message contains some text.
FOR /F "usebackq delims==" %%g IN (`%SVNLOOK% log -t %TXN% %REPOS% FINDSTR /R /C:......`) DO goto NORMAL_EXIT

:ERROR_TOO_SHORT
echo "Must provide comments" >&2
goto ERROR_EXIT

:ERROR_EXIT
exit /b 1

REM All checks passed, so allow the commit.
:NORMAL_EXIT
exit 0

2012-01-03: Post on StackOverflow on this: http://stackoverflow.com/questions/247888/how-to-require-commit-messages-in-visualsvn-server

I had a long plan to demonstrate in an animated way a software project progress without using any software or what is know in agile as Sticky Borad (stickies board). Wanted to capture the process of thought, the evolution and how things are dynamically progressing. The chance finally came to do so.

This is my 300th blog on weblogs.asp.net – circle being closed.

Enjoy:

Create your own video slideshow at animoto.com.

Row tests are fun. You can simulate various inputs with expected outputs and execute them all with a single observation (test). The problem for myself was always the fact that when this was done, the only way to accomplish it was to merge the logical because which operates on system under test behaviour and the observation itself (assertion). This leads to a slightly less readable code IMO.

[Row(“hello”, 5)]
[Row(“you”, 3)]
public void behaviour_and_observation(string value, int expected_number_of_letters)
{
	system_under_test.GetLenth(value).Should_be_equal_to(expected_number_of_letters);
}

Luckily, as pointed out by one of my ex-coworkers Dragosh, MbUnit has a way to assist with a specification that is trying to keep concerns separated. It’s called ParameterAttribute.

What specification does look like then?

[Header("Value", "ExpectedLength")]
[Row("hello", 5)]
[Row("you", 3)]
[Specification]
public class Some_specification : ContextSpecification
{
	[Parameter]
                 public string Value{ get; set; }
 
                 [Parameter]
                 public int ExpectedLength{ get; set; }
 
                 [Because]
                 protected void When_obtaining_length()
                 {
                          result = system_under_test.GetLength(Value);
                 }
 
                 [Observation]
      	 public void Should_get_proper_length()
                 {
                          result.Should_be_equal_to(ExpectedLength);
                 }
}

This is a trivial code, but with a bit more complex code the technique becomes really handy.

imageI like to refresh my memory on the basics. A lot of times you’ll look at something that you already know slightly different every single time. So is true with this book. It’s a great reference for C# as well as cover for the new features introduced in 4.0 (one of those I have already blogged about).

It started with Jonathan talking about the video he saw, Drive: The surprising truthimage about what motivates us. I really liked it, and decided to proceed to the book. The book is outstanding, hits in the target. Among other things, I can definitely use it to explain a good portion of things that happened to me in the past. What is interesting, is what Daniel Pink describes as “Drive”, Mihaly Csikszentmihalyi describes as “Flow” (another book to read). I really liked the language and associations Pink has used in the book – software and computers. This makes analogies and examples extremely simple. Good read.

More Posts