Using MS Onenote to manage bug and release information

The problem

Interruptions cause a real problem with lost time during software development. Jeff Atwood summarizes this nicely:

Even adding a single project to your workload is profoundly debilitating by Weinberg’s calculation. You lose 20% of your time. By the time you add a third project to the mix, nearly half your time is wasted in task switching.

As a software developer, I’m constantly trying to avoid getting distracted by production incidents, other bugs, and high priority features that need to get implemented. Don’t get me wrong — I think each of those things is a necessary (evil) part of software development.

The solution: taking notes

We’re already using the computer to program, I figure it makes more sense to take notes on the computer (vs pen and paper). After trying to use Evernote and getting frustrated with the lack of a decent print view or formatting options, I chose MS Onenote and haven’t looked back.

Continue reading

Using wildcards with git operations

I’ve been using the awesome ‘git‘ source code control system for the past year now. The transition from Subversion to git was prompted mostly by my desire to use the awesome application hosting platform AppHarbor, but I picked up git with ease and haven’t looked back.

One of the things I’ve learned about using git in conjunction with Visual Studio 2010 is that git usually likes to be in control of certain operations. In particular, git likes to be in control of ‘remove’ operations.

Removing a file from git is as simple as running

rm filepath/filename.ext

from the git command line, but when that is a long path and filename, it can get a bit … tedious.

Luckily, there are a few quick tips I can share when using the git commandline:

First, the tab key provides command-line completion, just like in a Linux ‘bash’ prompt.

Second (and perhaps even more awesome) — you can use bash (or even DOS-style) wildcards for the filename!

This means that you can easily use the following syntax:

rm MyApp.Library/Some/Really/Long/Path/MyLongFile*.*

How cool is that!?

Fun with Javascript … pointers?

I just spent the last hour trying to debug some Javascript code that wasn’t working the way I expected. It turns out I was dealing with the shallow copying behavior of Javascript. If you deal in Javascript objects regularly, you need to know this information!

Here is a quick example that illustrates what I saw while debugging today:

// First object, with a simple string property
args1 = {};
args1.test1 = "blah";

// Second object, 'created' from the first
args2 = args1;

// As you might expect...
// args2.test1 is "blah"

// Set the property to something different
// on the second object
args2.test1 = "boo!";

// But wait -- the objects are linked!
// args1.test1 is now "boo!" too!

As you can see — the two objects ended up being ‘linked’ to each other due to the nature of how Javascript ‘shallow copies’ work with objects.

Spotting this in your code is the hard part. The way to work around this is simple (as long as you’re using jQuery):

// First object, with a simple string property
args1 = {};
args1.test1 = "blah";

// Second object, deep copied from the first
args3 = $.extend(true, {}, args1)

// As you might expect...
// args3.test1 is "blah"

// Set the property to something different
// on the second object
args3.test1 = "boo!";

// The objects are not linked
// args1.test1 is "blah"

For more information, see this answer on StackOverflow (by John Resig himself).