They Got Rob Conery, Too !?!?

I knew it would happen!

How long until Atwood and Galloway fall?

Congrats, Rob. You really deserve it.

Microsoft seems to be making all the right moves lately.

Brain Food 10-26-2007

Visual Studio Tip: Navigate Backward/Forward

One small but handy feature in Visual Studio that took me a while to notice is the "Navigate" feature.

Have you ever right-clicked on a method call, selected "Go To Definition" (another feature I hope people know about), and then struggled to find your way back to the file and line you just came from?

Have you ever been messing around with some method, decided to take a quick look at some property or field declared near the top of the code file, and then couldn't remember the exact name of the method you were just looking at or where exactly it was buried in your file?

Next time this happens, look for the little "Back button" pictured below, and click it!  You'll be magically transported back to your last cursor position.  And I'm sure you can imagine what the little "Forward button" sitting next to it does as well.

Navigate button

Never "lose your place" again!

(Maybe next time I'll write about the "Bookmark" feature, this feature's more robust and long-term cousin.)

Easy Notifications with System.Media.SystemSounds

I was working on a console application the other day that very commonly took several minutes (or in some cases, hours) to run to completion.

Right before terminating, it would print out a little summary of what it had done.  Instead of sitting there staring at the console waiting for my program to finish, I would start it up, work on something else for a little while, and periodically pull up the console to see if the program had finished.

After many instances of pulling up the console only to see it had not yet finished, I started to think about how I could have the application notify me upon termination.  I wanted to stop having to check in on it every couple minutes and just have it let me know when it was done.

Knowing that many applications that occupy the taskbar notification area (or the "system tray") often use a standard Windows sound to notify the user of events, I began looking for something easy I could do from C# to get a similar effect for my console application.

I had to look no further than System.Media.SystemSounds to get what I wanted.

Right before my program is set to terminate, I simply added the line:

System.Media.SystemSounds.Beep.Play();

Now my console application emits a standard Windows "ding" right before it terminates, and I avoid having to constantly check in on its progress.  Problem solved!

 

Note: You can also try Console.WriteLine('\a') to write out the ASCII control character known as the "alert" or "bell," but I wouldn't recommend it.  I scared myself half to death doing this, as the sound you'll hear is not regulated by the Windows volume setting and will likely be very loud and unexpected. :)

Debuggers Considered Harmful?

"Debuggers are based on the idea that the code base has enough places bugs could happen that the work of locating the bug is involved enough to justify machine assistance. This is not true of well-tested code. More importantly, the whole point of [T|B]DD is that you identify the bugs before you write the code. As tools which track down bugs in existing code, debuggers presume and encourage a workflow which is exactly backwards."

- Giles Bowkett

Web 2.Overload

"If I was Mike Arrington I’d go to the nearest bridge, tie a noose around my neck, jump off, shoot myself during the freefall, and have my head torn off by the amount of slack in my rope."

- Mark Seremet

What's It Like to Be a Web Developer?

I was thinking today about how to describe the experience of being a Web developer.

I'd compare it to having a schizophrenic family member (or friend) that you visit every day at the asylum where he lives.

The first day that you go to visit, his ramblings are so chaotic and disorganized that you're almost overwhelmed.

one_flew

But as time goes on, you start to discern patterns in his ramblings and become familiar with his eccentricities. He's still obviously crazy, but you can faintly detect a certain order in his madness.

You eventually come to terms with his insanity but always hold out hope that one day you might be able to have a normal conversation with him.

ASP.NET DropDownList for the 50 States

If you need a DropDownList that contains all 50 states and DC (and who hasn't needed this at one time or another?), feel free to copy these and paste them into your project.

There are two flavors here.  Credit for the first one goes to this fellow.

Flavor #1

Flavor #2

Enjoy!

ReSharper Tip: Go to File by Name

This is one of my favorite little ReSharper features that took me a while to discover and fully appreciate.

Let's say you're working in a huge application with a deeply nested directory structure.  You're chugging along, editing some arbitrary file somewhere.  Ok, now you're ready to jump to some other file in your application and read some code or make some changes there.  The things is, you only kind of remember the name of the file, you don't really remember which folder it's in, and you really don't feel like digging through the whole folder structure of your application to find out where the file is hiding.

In comes ReSharper's "Go to File by Name" feature to save the day.

Let's say that file you're looking for is a master page, and you think it's name starts with "Guest".

Hit Ctrl+Shift+N and start typing "guest".  You'll get a list of all the files in your application that start with "guest".  Now just select the file you're after, and bam!  There you are.

screen1

Let's say you know that the file you need is a master page, but you don't remember anything else.

Hit Ctrl+Shift+N and start typing ".master".  Unfortunately, since the file name obviously doesn't start with ".master", ReSharper can't match any files, and you see that the text turns red.

screen2

But, thanks to a little feature I discovered recently, you can type an asterisk ('*'), and ReSharper will treat it as a wildcard.

So, try your query again, but this time type "*.master".  Now you'll see a list of all the master page files in your application, and you can easily locate the file you're after.

screen3

Obviously, this is only a very simple example.  I'll leave it as an exercise to the reader to imagine all the various ways that this could help one to locate arbitrary files in a large application.

Enjoy! (And get ReSharper if you don't already have it!)

Dear Twitter

I mean this in the most constructive way possible: Why is your Facebook application such a piece of crap?

I love the idea of your Facebook application so much.  But in reality, the application is so unreliable that it's essentially worthless.

How much of a priority is it for you guys to fix this thing?  Facebook is so hot right now, and I'd think the number of users you turn off because of the terrible quality of your Facebook application would be unacceptable to you guys.

Please keep in mind that I'm only writing you now because I love you, and I'm hoping against hope that you will someday get your act together.

Your loyal fan,

Matt B.