Changing the user profile path in Windows 7

Posted on Thu 12 July 2012 in Sysadmin • Tagged with profile, windows7

Nothing programmatic about this post, unfortunately. Instead, a bit of rambling about Windows. :-) One of the reasons I don’t use Linux on my desktop computer is that it requires too much constant tweaking, configuring and fixing to get things to work together properly. I tried it twice, and I ...

Continue reading

Offline repository sync using git bundle

Posted on Mon 11 June 2012 in Tools • Tagged with bundle, git

Keeping git repositories in sync is usually and easily done using git pull and git push. However, for those rare times when you don’t have network connectivity (or limited connectivity) and still need to transfer the contents of a repository to somewhere else, there’s git bundle.

The bundle ...

Continue reading

Regular expression multiline mode - what's a newline?

Posted on Wed 30 May 2012 in Coding • Tagged with newline, regular expressions, csharp, java

I stumbled upon an interesting little detail as I was using a regular expression in a unit test case in a C# application. I had a multiline string and was searching for a particular substring in multiline mode. The newlines in the string were Windows newlines, meaning CR followed by ...

Continue reading

Testing asynchronous background workers in .NET

Posted on Tue 08 May 2012 in Coding • Tagged with async, background worker, test, .net

When you build a GUI, all lengthy operations that can be triggered by the user should take place on a background thread so that the GUI doesn’t become unresponsive. Why would it? Well, it’s because all GUI operations take place on a single thread - the GUI thread (the ...

Continue reading

Your decisions are likely to suck

Posted on Wed 25 April 2012 in Opinion • Tagged with agile, decision making, decisions

I apologize in advance for being blunt! And it’s not really as bad as the title suggests. But my point is that every decision you make, whether it’s about a small piece of isolated code or the architecture as a whole, may not stand the test of time ...

Continue reading

Abusing XML literals in VB.NET

Posted on Wed 25 April 2012 in Coding • Tagged with, format strings, xml literals

One of the things I do like about VB.NET is XML literals. Given that XML is so common, it’s really a great idea! Here’s a tiny example:

Dim x = <p>Some test.</p>

I thought I’d write about how XML literals can be abused to create ...

Continue reading

Swedish to not-so-Swedish through diacritics removal

Posted on Fri 06 April 2012 in Coding • Tagged with diacritics, Swedish, unicode

According to Merriam-Webster, a diacritic is:

a mark near or through an orthographic or phonetic character or combination of characters indicating a phonetic value different from that given the unmarked or otherwise marked element

Right! :-) In the Swedish language, there are three common letters with diacritics, namely å, ä and ö. The diacritics ...

Continue reading

Mocking __iter__ with a magic mock in Python

Posted on Thu 29 March 2012 in Coding • Tagged with iteration, list comprehension, magic mock, Python

I just ran into a tiny little problem and thought I’d share the solution.

I was writing some tests in which I was mocking a dependency using Mock. My test code was roughly equivalent to the following (based on an example in the Mock documentation on magic methods):

>>> sub1 ...

Continue reading

Nothing surprises me in VB.NET

Posted on Tue 27 March 2012 in Coding • Tagged with nothing, null,

I currently work in a VB.NET project with a customer, and what amazes me is that I over and over again get the feeling that the language is designed to be easy to work with, but at the same time there are so many aspects of it that behave ...

Continue reading

NSubstitute vs Moq - a quick comparison

Posted on Mon 27 February 2012 in Coding • Tagged with mock, moq, nsubstitute, test

When you write unit tests, you occasionally need to mock away dependencies of the subject under test (SUT). By far the easiest way to do this is to use a mocking library, which has the added benefit that it allows you to verify the behavior of the SUT by inspecting ...

Continue reading