Archive for productivity

Maintaining Consistent Line Lengths

Today’s tip comes from the “Anally Retentive” department. In the .NET CLR team likes to keep their lines of code under 110 characters long. I’m assuming that they’re trying to maintain consistency and readability. I often try to maintain an imaginary line length limit, but I doubt I’m very consistent.

Vertical line in Visual Studio

Fortunately, Visual Studio provides a hidden feature that lets you draw a vertical line in the text editor to show you where a certain line length would end. Fire up your registry editor and find this key:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Text Editor

If you’re using a version of Visual Studio before 2008, you’ll need to decrement the 9.0 version number in the path above.

Then, add the following value (as a string or REG_SZ) with the name of “Guides”:

RGB(192,192,192) 110

The first part is the color, and the second part is the line length. Personally, I use a line length of 110 to stay consistent with how Microsoft has chosen to do it. I like the color listed above because it’s faint, but visible. Since the line is almost impossible to see in the screenshot above, here is an un-scaled screenshot of the line itself:

Vertical Line

To further enforce the 110 character limit, you could also resize the code portion of your Visual Studio window so that it’s near the line. This will make the line itself a little less annoying, while allowing you to use the rest of the window for other information. For example, take a look at how much room I have on a 1920×1200 screen when I horizontally resize my code window:

Utilizing a large monitor in Visual Studio 

Obviously this tip isn’t for everyone. You may be working with legacy code with long lines, or you might work on a team that doesn’t mind long lines. The great news is that Visual Studio is pretty accommodating to however you like to work.

Convenient Synchronization with Mesh and DropBox

A couple of weeks ago, I finally signed up for DropBox. If you’re unfamiliar with the service, it’s a file synchronization service. You install a client on multiple machines, and you get a special folder (aka a dropbox). When you make changes on any computer, it’s synchronized with a central server, as well as the other clients.

image

Now that I’ve gotten the chance to put DropBox through its paces, I have to say that I’m very impressed. I’ve done a lot of operations that can sometimes choke file monitoring software like moving and renaming files, copying files while synchronizing, and in-use files. DropBox powered through like a champ, never giving me any errors, and without any noticeable mistakes.

In addition to simply synchronizing your files, their service also keeps a copy of your files on their server. Better yet, it automatically revisions the files. It seems to be fairly efficient, even considering all my files and revisions. Right now I’m only using 7.8% of the 2GB of space they give you for free.

One of the applications that I use the most is OneNote. Pretty much all of my disconnected thoughts go into OneNote until I can get them organized. I figured it was a great application to test the responsiveness of DropBox. I opened OneNote on two different computers. When I changed the text on one machine, the changes showed up on the other in 10-15 seconds. Perfect for keeping my notes in sync!

My one and only complaint about DropBox is that I can’t create multiple DropBoxes. A single DropBox is simple and efficient, but it would be nice to have a little more flexibility.

Live Mesh

A few nights ago, I got a demo of the Azure platform by a Microsoft Evangelist. Azure is a huge blank term for a group of confusing technologies. Even the name itself is confusing, since Azure is a cloud computing platform and is also the color of the sky when there are no clouds.

image

More importantly, one great thing to come out of the “Live Services” portion, is a free product called “Live Mesh”. It’s essentially a competitor to DropBox. The nice thing about Live Mesh is it’s flexibility. I can make any number of synchronized folders, and they all seem to be as reliable as DropBox. Thanks to a sophisticated permissions system, you can even share folders with other people. For example, you can have a folder set up to distribute your photos to your family.

The Microsoft Azure Evangelist showed us a demo with the client installed on his laptop, and another client installed on his Windows Mobile phone. When he takes a picture on his phone, it’s immediately pushed over to the other clients. It’s a neat trick, and does make my mobile device more useful.

imageimage

As far as I can tell, Live Mesh doesn’t have plans to support a revision system like DropBox. I think this is a horrible, horrible mistake. Having a file on multiple machines provides nice redundancy, yet if you accidentally delete a file on one computer, Live Mesh will happily delete every copy of it. It even happened to Scott Hanselman. In my opinion, this completely destroys any hope it has of competing with DropBox (at least for me). I’m hoping that they’ll add a backup feature, or someone will use their API to add it for them.

Others

One service I have yet to try is SugarSync. It looks promising because it syncs multiple folders, stores revisions, and even has a Windows Mobile version (although it’s missing real-time sync). On paper, it looks like it has all the options you would expect from this type of service.

Syncplicity looks respectable, but with so many alternatives, I’m just not sure if they have anything unique that sets them apart.

Conclusion

I think this type of application is going to have a huge market. This is one of those few killer app’s that if done well, will be on everyone’s computer. Obviously Microsoft’s offering will be positioned to dominate, but we all know that they don’t always have the absolute best product.

For now, I’ll be using DropBox for my main document folder. It suits my needs, and until it messes up, I won’t need to look elsewhere.

Tip for success – Track your accomplishments

When it’s time for your yearly performance reviews, how do you convey all of the great ideas you’ve had, the money you’ve saved the company, and the customers you’ve delighted? My suggestion is to start keeping track of your accomplishments. I think this is especially important in the software business where you may be seen as the guy that sits around at a computer all day.

Accomplishment-Target

I used to work for an incredibly huge (read: bureaucratic) company that required everyone to fill out a form every year, which was basically a resume. You were essentially going through the process of re-applying for your own job to determine your performance, and subsequently, your raise. Everyone hated doing it, but in hindsight I believe it was a good exercise. If I had been keeping a running list of my accomplishments, the process would have been much less painful.

In an ideal world, your boss would really understand your job and would know exactly how great you are. In fact, if you’re a development manager reading this, I suggest you start keeping track of those types of things somewhere other than your head. It will help you evaluate your employees that don’t listen to me!

If you’re not keeping track of all of the amazing things you’re doing throughout the year, there are a couple of obvious problems. First, there is usually a “dead” period right after a review in which your accomplishments are so distant from your next review that they slowly fade from everyone’s mind. Second, you’re just one of many employees that your boss has to manage. How likely is he or she to notice everything that you make look so easy? Not only that, but your career is more than just the accomplishments you had from the last year.

What should this list look like? Each line should be in the same format as an accomplishment on your resume. After all, you’re trying to sell yourself just as you would when applying for a job.

Feb 09

  • Implemented a new CMS system for the finance department saving $5300 annually.

  • Shortened the project planning process by removing duplicate steps, allowing projects to be delivered an average of 10% faster.

Personally, I’ve already starting tracking my accomplishments. The next time I have a performance review coming up, I can send my boss the highlights for the past year, keeping them fresh in his mind. I hope I can motivate as least one other person to do the same. If I ever want to make a career move, I believe the list will also be very useful when updating my resume.

Do you already keep a list of your accomplishments? How have you found it useful?

Advantages of a 3rd party diff/compare tool

I recently spent nearly an hour trying to figure out why all of my unit tests stopped working in a particular class. It turns out that I had accidentally deleted a single character in one of my strings, but the built in diff tool that comes with Team Foundation Server is very simplistic. Learn how and why you can replace your stock compare tool with something a little more powerful.

Here is a screenshot of what you’ll see in the stock Team Foundation Server compare tool:

Default TFS Compare Tool

See how hard it is to spot the difference? The problem is, ANY change on the entire line causes it to show up as “changed”. That includes whitespace changes. For this reason, I frequently end up with extra full lines that are colored as having been changed, making it harder to see the actual code changes. For the most part, I really don’t care about whitespace changes because they deal with the formatting of the document, and I’m more concerned with functional changes to my code.

The good news is that those smart guys at Microsoft make it easy to integrate a third party compare tool right into their tools. James Manning was even kind enough to include detailed instructions and the exact settings needed for every major compare tool. You can even use them for merging if you like.

Since my background is in Subversion and TortoiseSVN specifically, I pulled out my trusty KDiff3 (SourceForge) compare tool. It’s a common alternative for TortoiseSVN’s own diff tool.

After wiring up KDiff3, here is what I saw when I compared revisions:

KDiff3 Character Difference

Notice how easy it is to see that I changed a single letter (it’s obviously easier when it’s full-size).

There are other good reasons to use a third party compare tool (which vary by tool obviously):

  • Easily compare entire file structures (folder diff)
  • Inline editing
  • Easy to use outside of Visual Studio – often with an explorer context menu

I recommend giving a few of the compare tools a try and see which works best for you. I don’t really see any risk in using a third party compare tool, but there are certainly a lot of advantages that you may not even know you’re missing right now. I suggest also taking a look at WinMerge in addition to KDiff3, since it seems to be fairly popular and feature-rich as well.

ClearType in Remote Desktop with XP

A new feature in XP SP3 that should of particular interest to developers is ClearType over RDP (remote desktop protocol). If you occasionally use remote desktop to work from home, or work remotely to your development machine, please read on.

If you’re not familiar with ClearType, you can head over to Wikipedia for a full explanation. In a nutshell, it takes advantage of the fact that each pixel in an LCD screen actually has 3 sub-pixels. They can be “hacked” to improve the anti-aliasing of text displayed on the screen. I’ve been a huge fan of the feature, especially for source code, and I have a hard time living without it. In XP (locally), it’s turned off by default, but turned on in Vista.

ClearType Effects Dialog

I had always noticed the remote desktop would not give me ClearType. However, I became curious when I found the following options on my Vista machine. Apparently ClearType over RDP is now supported in the client, and is also supported when using Vista as the RDP server (no hacking needed).

RDP Experience Options

Unfortunately, these options have no effect when using XP. If you want ClearType over RDP with XP SP3 (sorry, only SP3+), add the following registry key:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations]
"AllowFontAntiAlias"=dword:00000001

After you add that registry key, simply reboot the server (XP), and reconnect. From what I can tell, the client options no longer matter. Even if I uncheck the “Font Smoothing” option, it still uses ClearType. It’s not a big deal, but I thought it was worth mentioning.

So far, after using this option for a while, I haven’t seen a significant performance impact over a VPN on the Internet.

If you want to take this a step further, install Consolas, it’s a font designed specifically for software development, and to take advantage of ClearType. It’s a free download from Microsoft.