Unfuddling.

Recently I began using a service known as Unfuddle to manage a little personal software development project I have underway.

According to Unfuddle.com:

“Unfuddle is a secure, hosted project management solution for software development teams.”

This is a succinct and accurate description of what the service offers, however in conversation I tend to describe Unfuddle as:

Trac & Subversion that you don’t have to set-up & manage yourself.”

Much like Trac, Unfuddle offers a wiki with file attachments, ticket/issue tracking with version control integration, milestone tracking & basic scheduling, source repository browser, and commit/change-set explorer.  All the basic tools for managing work in a small to medium sized software development project.

Some things that Unfuddle offers, that Trac (out of the box) does not, include Git SCM support, email activity notifications and unified user authorization/access control administration.  Ie, your Unfuddle website log-in is the same as your Subversion/Git log-in and as an administrator you have fairly fine grained control over what each user can do at the Unfuddle website and via SCM.

Each account at Unfuddle gets their own subdomain. For example mine is deeperdesign.unfuddle.com. Within that domain you can create a number of different projects & users, with users having potentially different access to different projects. The number of projects and users you can have in your account is determined by your subscription level. Free Unfuddle accounts are limited to 1 project and two users. For $9 a month you can have 10 users and 4 active projects. Likewise the amount of storage space your account has varies based on your subscription level.

So far I’ve been very happy with Unfuddle’s performance and price. Sure I could save some money by setting up my own instances of Trac & Subversion on an existing hosting account, like DreamHost.com. But that involves time & work. Time I’d rather spend “getting things done“.

There are really only two things to complain about with Unfuddle.

  1. Storage space – Although you’re unlikely to exceed your accounts allocated space unless you store lots of binary assets in source control, the allocations at each account level seem fairly paltry considering today’s terabyte hard drives and “cloud” storage services like Amazon EBS. Hopefully with Unfuddle’s recent migration away from Rackspace to Amazon EC2 they will be able to take advantage of the cheaper storage solutions and pass those savings and space gains on to their customers.
  2. No “public” access – All access to Unfuddle is for “cathedral” developers. It would be nice, for example, to be able to expose certain parts of the ticket/issue tracking system or wiki to “public” users. For user bug reports and other such things. Though perhaps services such as Uservoice are better suited to that role.

If you have a need of an easy to use online software development project management solution I can highly recommend Unfuddle.com.

Why I love Jetbrains and Resharper.

I neeeed Resharper.  Like a drug.  When I don’t have it installed in Visual Studio I feel like my hands have been lopped off.

The other day I upgraded my aging personal license of Resharper 2.5 to the shiny new 4.1 version.  However due either my own stupidity or a glitch in the Jetbrains purchase process I got charged the full license rather than the upgrade price (which is significantly cheaper).

Having noticed this error I sent a polite email to Jetbrains requesting a refund for the price difference.  This is the response I got:

Thank you for letting us know. This is what we are going to do:
– We are going to delete the purchase of a new 4.x commercial license in your user account.
– We are going to send you a license key for an upgrade from 2.x ReSharper to 4.x ReSharper Full Edition Personal License.
– We are going to send you a refund of 210USD.

Hell yeah!  Thanks Jetbrains, for being so awesome.

Resharper - The best C# & VB.NET refactoring plugin for Visual Studio

Stackoverflow.com is addictive.

I’ve recently started contributing to stackoverflow.com.  For those who are unaware, Stack Overflow is a question and answer site where you earn “karma” for asking and answering programming questions.

Currently my Karma is low (~56) compared to some others on the site (>10k).  But I can see how they got up there.  They got addicted to answering people’s questions.  There is a certain amount of ego polishing that you get enamored with when someone up-votes your answer or otherwise accepts your answer to their question.  The system has been engineered from the get go to reward users for providing valuable contributions.  It even has XBOX 360 style “achievements” or badges as they are known on Stack Overflow.

The site was put together by a team lead by Jeff Atwood of Coding Horror fame.  He and Joel Spolsky of Joel On Software came up with the idea of the site and have been conducting a nice little weekly podcast about its development and subsequent launch.

It even lets you create an RSS feed of your activity on the site so I’ve added that as a side bar to this very blog.

On the whole I’m very impressed.

Be explicit.

What happens with this C++ code?

class Foo
{
public:
	Foo(bool myDefault = true): default(myDefault) {}
	bool default;
};

void FunctionFoo(const Foo& foo)
{
	if(foo.default)
		cout << "default";
	else
		cout << "not default";
}

void main(){
	Foo* pFoo = new Foo(false);
	FunctionFoo(pFoo);
}

Any guesses?

Well it prints “default”. You may have expected it to print “not default”. Why is that, you ask?

Well, what happens is that in main FunctionFoo() gets passed a default constructed version of Foo. Not the Foo instance pointed to by pFoo. Quite a subtle bug I think. Especially because the compiler says nothing. How do you fix this problem. Easy. Put the keyword “explicit” in front of the constructor.

This has to do with the fact that C++ will implicitly convert parameters to methods/functions whenever it feels it can. See Effective C++ Item #18.

In C++ it is possible to declare constructors for a class, taking a single parameter, and use those constructors for doing type conversion. For example:

class A {
public:
	A(int);
};

void f(A) {}

void g()
{
	A a1 = 37;
        A a2 = A(47);
        A a3(57);
        a1 = 67;
        f(77);
}

A declaration like:

A a1 = 37;

says to call the A(int) constructor to create an A object from the integer value. Such a constructor is called a “converting constructor”.

However, this type of implicit conversion can be confusing, and there is a way of disabling it, using the keyword “explicit” in the constructor declaration:

class A {
public:
	explicit A(int);
};

void f(A) {}

void g()
{
	A a1 = 37; 	// illegal
        A a2 = A(47); 	// OK
        A a3(57);	// OK
        a1 = 67;	// illegal
        f(77);		// illegal
}

Using the explicit keyword, a constructor is declared to be “nonconverting”, and explicit constructor syntax is required:

class A {
public:
	explicit A(int);
};

void f(A) {}

void g()
{
	A a1 = A(37); 	// OK
        A a2 = A(47); 	// OK
        A a3(57);	// OK
        a1 = A(67);	// OK
        f(A(77));	// OK
}

Note that an expression such as:

A(47)

is closely related to function-style casts supported by C++. For example:

double d = 12.34;
int i = int(d);

While I “knew” this stuff, I’ve been bitten by hidden bugs due to implicit converting constructors a couple of times recently so I thought I’d share it just in case others were not aware or had forgotten.

I highly recommend using the explicit keyword on all your single parameter constructors unless you explicitly want to use C++’s implicit conversion feature. Personally I think this is a broken language feature. 99% of the time you don’t want implicit conversion. When you do you should have to specify an “implicit” conversion constructor eg:

class A {
public:
	implicit A(int);
};

But I’m not on the C++ standards body so I don’t get to make those decisions.

Why compiling your code in GCC is a good idea.

Sometimes Microsoft’s C++ compiler just produces bad binaries.

At the moment I’m working on code that compiles just fine using the Microsoft C++ Win32 & Xbox 360 compilers. However it does not run. It crashes during static initialization deep inside the C runtime library. It crashes hard well before the debugger can even load the debug symbols so I don’t even know in where it might be dying. It crashed the Xbox 360 so hard it crashed the IDE.

This is no fun to debug.

GCC on the other hand won’t even compile my code. I’ve been a very bad boy in many spots without even thinking about it and the Microsoft C++ compiler hasn’t complained. At all. Not one little bit. I’ve even got warnings cranked all the way up.

Now after running GCC over my code until it is satisfied that I’ve been a good boy, I compile my code again with Visual C++. This produces a working executable and I can get on with my job.

GCC FTW.

Paint.Net C# Code.

Today at work I needed a Color Chooser dialog that supported Alpha. The standard Windows Color Picker from Common Controls can’t do that I don’t think.  Hence I decided to have a look at the code in Paint.Net’s color dialog which does.

Outwardly Paint.Net looks well engineered, therefore I went looking at the source. Crikey what a mess. Now I know how hard it is to write and manage a moderately sized code-base with a small team, but I at least try and organize my code well. I also constantly refactor to improve the design & code readability.

Paint.Net Color Picker.

After spending the day trying to adapt Paint.Net’s color picker I ran into some serious performance issues (amongst other things). It seems their gradient widget renderer is very slow for anything other than the tiny little gradients that get rendered in their color picker form. I think someone needs to introduce them to LinearGradientBrush‘s InterpolationColors property and ColorBlend.

I think the coders on Paint.Net probably already know some of their code is pretty dire, considering this comment in ColorsForm.cs.

// TODO: rewrite this … the code is out of control here as it has grown organically,
// and it’s impossible to maintain. post-3.0

Now I’m not trying to pick on the coders responsible for Paint.Net. I’d actually like to thank them, as I use the application regularly and appreciate that the code is MIT licensed. This is what enables me to go rifling through their code in the first place.

But unfortunately for me the Color Picker code is not good enough and is too Paint.Net specific.  I’m going to have to write my own damn fancy color picker.