About the author

Steven HarmanSteven Harman is a passionate developer who believes that writing great software isn't just a job, its a craft.

ASP.NET MVP

For recent posts and more about me, scroll to the bottom.

Subscribe

  • Subscribe to my feed. via RSS
  • Subscribe via email via email

News

devLINK Technical Conference

Jobs

Badges

  • Subtext Project
  • Support Subtext
  • HiddenNetwork.com Banner

Tips & Tricks.

Things I've learned (sometimes the hard way) along the way...

Save Your Fingers, Use a BDD AutoHotKey Script!

Tired of typing all those underscores_while_writing_your_BDD_specifications? Yeah, I wasn’t really either. However I’ve heard read complaints from some folks that typing the underscore so many times was getting annoying, so they had opted for PascalCasing instead. Just deal with it Maybe its because of my exposure to Ruby and the joy that is RSpec, but I don’t think such minor annoyance is enough of a reason to top using a more readable style. Repetitive Stress Injury, be damned! Or maybe not! The other day while cleaning out my RSS reader I came across AutoHotKey (thanks JP), a...

Visual Studio Usability Tip: Highlight Current Line

This may seem like a completely obvious tip to some, and like a complete waste of time to others. But you know what? Its something that I've found extremely useful so I'm going to share it anyhow. Hey, this is my blog and I can do what I want! :) Update: I forgot to explain how to enable Highlight Current Line in the original post. I've now added instructions. Highlight Current Line This feature is not available in vanilla Visual Studio - its part of my favorite zero-friction productivity enhancer, ReSharper....

Hacking Visual Studio to Use More Than 2Gigabytes of Memory

Visual Studio can be a tremendous resource hog, especially if you have a large solution and you're using a productivity add-in or two. On my current project we're running VS 2008, we've got just under 20 projects in the solution, and several of us are using the ReSharper 4.0 EAP nightly builds to enhance our dev-fu. And you know what... we're restarting VS at least a half dozen times a day to work around a nasty exception we regularly encounter while trying to compile: Not enough storage is available to complete this operation. ...

Visual Studio Tip: Kill that Build!

At the day job I spend the majority of my time in Visual Studio, writing, refactoring, debugging, and banging my face against code. C# code specifically. And what is my #1 complaint about C#? The Compilation Tax. I get over taxed! I have a little problem that causes me to pay that tax more often that I think I ought to. I have some kind of weird internal clock that causes my fingers to issue the Ctrl + S, Ctrl + Shift + B keystrokes every five minutes, causing the IDE to freeze up while it...

Search Driven Uninstall for Visual Studio 2008 Betas

Like everyone else, I’ve been playing the uninstall-before-we-install dance in preparation for the new Visual Studio 2008 bits. One hott tip for getting the uninstall part right is to follow ScottGu’s excellent post, Steps to Uninstall VS 2008 Beta2 before installing the VS 2008 Final Release. One pseudo-problem that my co-workers and I have run into is trying to find those particular programs in the huge list of programs in the list of programs on your box. It’s like the old needle in a stack of needles problem. Search Driven Navigation If you’re running on...

Setting Visual Studio Split View Defaults

I’ve been using Visual Studio 2008 to do my Subtexting and while I’m really digging some of the new features like JavaScript IntelliSense, there is one new feature that is just driving me nuts. Split View. By default VS 2008 opens HTML documents, which includes .aspx, .ascx, and other markup document types, in the split view. Split view is great if you’re interested in working in the design surface and still want quick and easy access to the raw markup responsible for creating the pretty UI. However... I’m deathly allergic to the design surface and try to avoid...

Multi-Targeting VS2005 and VS2008 Web Application Projects, a Gotcha!

One of the things I’m most excited about with Visual Studio 2008 is it’s ability to target various versions of the .net framework, a feature known as multi-targeting. I recently rebuilt a (hand-me-down) laptop for use at developer group meetings, conferences, and coding from the couch. When building out the machine I decided to only install VS2008 and make use of multi-targeting to work on my various .net 2.0 projects... like Subtext. Today I finally got around to loading Subtext up in VS2008 and I was expecting some heartache. But I did a little research first and...

Quick Tip: Clear You DNS Cache

Need to clear you machine’s DNS Cache? Running Microsoft Windows? It’s pretty simple and straight forward. Fire up a Command Prompt† Run the following command > ipconfig /flushdns You can also take a look at what’s in your DNS resolver cache with the following command > ipconfig /displaydns Why would you clear your cache? Most DNS clients will cache the results...

Get Northwind, the Database That Won't Die, On SQL Server 2005

I am getting ready to put together a few sample applications to show off some of my favorite JavaScript libraries and demonstrate just how easy they make building AJAX enabled web applications. To simplify the process I was planning to use a little SubSonic magic to wire up REST interface to my database. But what to what database? Hello Northwind! Well the Northwind database, naturally! Problem is, I use SQL Server 2005 on both my main dev box and my laptop and it doesn’t include the sample databases. Actually, that’s entirely not true. Hello AdventureWorks...? As...

Attn: Windows Update - Stop Installing the Same Updates Over and Over!

Recently everyone’s favorite Redmond software company used their notorious Automatic Update service to push out a new security fix. This particular was also know as KB937061 - a fix for Visual Studio 2005 SP1. No big deal, happens all the time... right? Apparently not This particular update targets some security holes in the Crystal Reports component of the VS suite. It is also one of the more invasive updates as it requires you to restart your system before the fix takes effect. But that’s not the really fun part. The part is that even after allowing...

Calling Tech Support? Speak Phonetically, Save Time

The tech support for a certain large computer manufacturer, who shall remain nameless... but their initials start with an H and end with a P, recently stole more than eight hours of my life. Yep, that’s a whole work day’s worth of my life that I’ll never get back. Sound familiar? It should. Anyone who has ever owned or been responsible for any significantly complex piece of technology and/or equipment (read: magic) has at some point called tech support or customer service. Calling tech support/customer service is never fun. No one likes to spend their already limited...

How-To: CTRL + ALT + DEL in Remote Desktop

I’m a big fan of Microsoft’s Remote Desktop - it’s built right into Windows and allows me to quickly and easily administer a remote box from the comfort of my own work station. I use it at my house to administer the headless servers on my home network, the Subtext build server, and the co-located VelocIT servers. Gotta' love that magic! Today a co-worker asked me how to send the infamous Control + Alt + Delete keystroke combination to a machine he was working on via RDP. This is a pretty common keystroke to use when trying administer windows... it...

Avoiding Accidental Recursion with ReSharper 3.0

Who here loves ReSharper? I do, I do! Now that I’ve got that out of the way, let me tell you yet one more reason that I <3 ReSharper. While doing a little Subtexting tonight I was looking through a new class and noticed a couple those little yellow ReSharper (R# from now on) warning lights. You know, the ones it so kindly puts next to the vertical scroll bar to let you know there are some things that need your attention. The first one was safe to ignore - a warning about an unused...

Visual Studio: The Output Window, External Tools, and a Gremlin

I’ve been using SubSonic for a while now and I totally love it. Not only has it made developing in .net fun again, it’s also been a huge productivity booster for me and the guys I work with. And while I appreciate all of the hard work that the team has put into the SubSonic Build Provider for use with WebSite Projects, I just don’t work that way. I like having the actual generated code files included in my project (be it a WebSite or WebApplication) and checked into source control. I gives me the warm and fuzzies. But...

Hardware Problems: My eSATA + SATA II Enclosure Won't Play Nice

Tonight I wasted several hours troubleshooting hardware/driver issues with my development box - a fully loaded Dell OptiPlex GX620. I've been fighting with this particular machine since the day I got it. Recently it's been freezing up, the USB controllers malfunction at random times, it hangs during boot (before the OS even starts loading), and all kinds of other fun stuff. I've already upgraded the BIOS to the latest available version, released back in December 2006, and applied all relevant firmware and chipset driver updates. Oh, and I'm running Vista Ultimate 32-bit... though I had the same hardware issues...

Add Option Elements to a Select List with JavaScript

While working on a web application I had the need to dynamically add new Option elements to a Select element (drop down list) using some fancy client-side JavaScript. The obvious solution was to do something like this: var theSelectList = $('theBigFatSelectList'); var myNewOption = new Option("My Option", "123"); theSelectList.selectedIndex = InsertNewOption(myNewOption, theSelectList); function InsertNewOption(newOption, selectElement) { var optsLen = selectElement.options.length; selectElement.options[optsLen] = newOption; return optsLen; } And it worked just as I’d expected. I got a new option in the drop down list and all was right with...

Use the PageRequestManager to Get More Control of Your UpdatePanels.

Being Web 2.0 is a hot topic right now. So much so that everyone and their mom is out to dress up their web presence with whatever Ajaxy goodness they can. Lucky for the Internet the ASP.NET AJAX framework has made adding Ajax functionality to asp.net web sites and web applications a pretty simple task. The simplicity is made possible because the framework hides much of the magical mechanics of doing the actual Ajax and DOM work behind a new control, the UpdatePanel. However, like most magical solutions this one comes at a cost. Actually a couple of costs. Two...

Some Small Ways to Reduce Daily Development Friction

Brennan recently posted a great tip for changing the RSS Feeds that Visual Studio displays on the Startup page. Finally I can get rid of those horrible Microsoft articles and get some good content in that window! I quickly realized that many VS users probably already knew about this, but to many others, self included, this was totally new. And what's more, it's useful! So with that in mind, I decided I would start sharing some simple tips, tricks, and shortcuts that I use within the VS IDE and Windows environment to reduce the friction of many day-to-day development tasks. Open Containing Folder...

URL and HTML Encoding on the Client? JavaScript to the Rescue!

Phil recently wrote about some of The Most Useful .NET Utility Classes Developers Tend to Reinvent Rather Than Reuse - an article chock full of tasty tips, tricks, and reminders about [.net] framework features you forgot (or never knew) existed. One of the utility classes Phil mentioned was the System.Web.HttpUtility class. Two of the super useful methods this class offers are UrlEncode and UrlDecode... used to uh, convert a string into a URL encoded string and decode a URL encoded string, respectively. Do you encode? All web developers, regardless of language/platform, should be intimately familiar with the basic encoding schemes...

Tip: Put Connection Strings in Their Own Configuration File

asp.net 2.0 introduced a new section in the web.config file -ConnectionStrings. This new configuration section allows you to add connection strings in your web.config, like we always have, or in a different data source. In Subtext 2.0 we're using this new feature to split the connection string out into a new configuration file, user.config. Doing this should make day to day development easier for our development team by reducing the number of merge conflicts in web.config. Since most every developer has a different database configuration, it makes sense to keep this information in its own file and away from the...

Twitter Tip: @username

As I mentioned before, I've recently become wrapped up in the Twitter-craze that is sweeping the web. I'm still a bit of a noob but one think I noticed quickly was some of the Twitter-centric lexicon that was being used by other Twits. Of particular interest is the @username syntax. What does that do? Well as luck would have it the Twitter Help pages have an answer: When someone sends a Twitter that inspires a reply, what can you do? Direct Text the person if your reply is personal and only meant for their eyes.  But sometimes you want everyone...

[Note to Self] SubSonic Requires a Primary Key for Every Table

After stumbling over this a couple of times in the past week I decided to blog-it so I won't forget again. By convention, SubSonic requires that any tables to be auto-generated into the DAL have a primary key. #1 sign you're missing a primary key You have your super-sweet database humming along in it's fully normalized form. You try to generate your DAL with SubSonic but one of your tables isn't being code-gened. For example, if you have a Customer table then SubSonic should generate the following three classes: Customer CustomerCollection CustomerController Note: Customer and CustomerCollection will...

Remote Debugging without the Administrator Account, a Gotcha'

CSS Friendly Adapters - Using Comments in your Browser File can be Touchy

If you're using CSS Friendly Control Adapters to get some of your asp.net 2.0 controls under control - at least when it comes to the markup they render - be careful when adding comments to the CSSFriendlyAdapters.browser file. The .browser file is an XML formatted file that the asp.net runtime uses to configure what adapter(s) gets attached to which framework control(s). And as some of you may be aware, there are some known issues with using the CSS Adapters with some of the new Login controls. One common solution work around is to disable the CSS Adapters for the controls...

WebForm_PostBackOptions is Undefined - Check Your httpModules

While working on a new client application and ran into a bizarre issue with the WebResource.axd handler. The issue manifests itself as a JavaScript error when trying to do a PostBack from your WebForm. In IE7 you'll get the standard Error pop-up message informing you that 'WebForm_PostBackOptions' is undefined Not exactly the most useful error message. After a little JavaScript debugging in Firebug I found that the error was thrown because the WebForm_PostBackOptions method was missing. Yikes! How is it missing? As of asp.net 2.0, the Framework uses a new WebResource.axd handler to send assembly resources (like images, CSS...

CSS Friendly Control Adapters, CreateUserWizard, and ViewState... Oh My!

So you're using the CSS Friendly Control Adapters to generate lean, mean markup for your asp.net 2.0 controls, awesome! And you're also using some of the new Login controls to cut down on the hand-rolled authentication/authorization code, great. Do you also have ViewState disabled? Are you also having trouble getting values out of the controls during PostBack processing? I was! My scenario I was using the CSS Friendly Control Adapters and the Login controls without ViewState. Specifically I was using the CreateUserWizard and it's ContentTemplate to generate a sleek user registration UI. I had attached a LoginCancelEventHandler to the wizard's...

Using Virtual PC with Multiple Monitors, Sort Of

I'm a huge fan of using multiple monitors and the productivity gains they bring. I'm also a big proponent of using Virtual Machines to isolate client projects... once you get over the initial work it takes to get your VM Image library going, the productivity gains are gi-normous! However, the lack of real multi-monitor support in Virtual PC (both 2004 and 2007) tends to limit the productivity gains you can squeeze out of your VMs. This is especially evident when using VMs as a development environment on a daily basis. I was hoping that Microsoft would address the issue and...

World Clock for your Vista Sidebar

If you're like me (or perhaps you just want to be more like me) and your daily work spans time zones you know how difficult that can be. My work day typically starts 3 hours before my co-workers out on the west coast. Same goes for the end of the work day - I try to end my day job around 6:30p.m. (EST) or so. But that's the middle of the afternoon for Phil, Jon, Micah, and the rest of the gang out in the PST. It really gets sticky when we're scheduling meetings and other important events. Often I'll be one a phone call...

SQL Server Installation and MSDTC

While setting up a new VM for an upcoming project I ran into an issue while trying to install SQL Server 2005. During the step with the setup wizard checks all of the necessary components and system configuration settings on your machine it gave me a warning message about the COM Plus catalog Requirement. The message dialog had the following messages: COM Plus Catalog Requirement If SQL Server Setup fails, Setup will roll back the installation but my not remove all .manifest files. The workaround is to rename the files and then rerun Setup. For more information, see...

Avoiding the '401 Unauthorized' Error when Using the ReportViewer in Your Web Application

A couple of days ago I was using ASP.NET WebForms and the new ReportViewer control to put together a quick demo for rendering SQL Server Reporting Services (SSRS) reports right in your web application. If you're not familiar with the ReportViewer control, Thom Robbins put together a great screencast to introduce the ReportViewer control. How I used the control I was running the control in remote mode - meaning it pulls the reports down from a fully managed SSRS installation, and then renders them directly in the web browser - all from within my application. I was also using Windows Authentication because the client required it....

I'm all Zipped Up

Jeff Coding Horror Atwood recently posted an interesting and enlightening article about how he is reducing his site’s bandwidth usage. As Jeff hints, these changes were prompted by the high bandwidth demands of his recent Why Can’t Programmers... Program? post (a.k.a. - The FizzBuzz Test). At it’s peak that post kicked his bandwidth usage up to 9GB in a single day. In looking at his pretty bandwidth usage graph I also noticed his typical daily bandwidth is around 2.5GB. Now, I’m not nearly as popular a blogger as Mr. Horror, so I don’t expect that my daily bandwidth usage is...

Search & Replace - For Your Database

UPDATE: It appears that the .zip file I posted earlier was actually busted - I guess that's what I get for being lazy and not testing the parameterized version before putting it out there. Anyhow, Phil emailed me a version that actually works as advertised. I've updated the link at the bottom of this post, so grab the updated version from there. Search and replace is a common (and most useful) feature that is present in even the most basic of text editors. Some of the more powerful text editors (I like notepad++) even allow you to use Regular...

Reporting Services + Your Custom Assembly = #Error. WTF?

OK, so you've spent the last (fill in some obscenely long time period) trying to get SQL Server Reporting Services to use your Custom Assembly for retrieving data from your application. But no matter what you try, you keep seeing #Error rather than your data when you run the report on the server. By this point you've read countless white papers, tutorials, blog posts, etc... that outlining how the scenario should work*. That's right, you've added the necessary <codegroup> to your .config files. You've added references to your assembly from your report, and you've even made some example code (from the previously...

Trying To Be Productive

This past week at CodeMash I sat in on Neal Ford's The Productive Programmer session, and am I ever glad I did! This session shows you how to become a more productive programmer every day by using tools that you didn't know you already had. I would describe the session as a fast paced cookbook-style run down of tips and tricks to help recapture minutes (or even hours) a day that you would normally spend doing a lot of really mundane tasks. One of the best points Neal made was that our computers have some how turned the tables...

CSS Friendly Control Adapters - Add 'em to Your Site

Recently I've been playing around with the new ASP.NET 2.0 CSS Friendly Control Adapters as I loath the bloated and overly complex table based markup that so many WebControls render by default. After building a test website using the Web Site template that is included with the adapter's v1.0 download I decided to incorporate them into a project I'm currently work on. There is a good white paper that walks you thru integrating the adapters into your existing web site that I followed step-by-step... almost. First off, my site was using the Web Application Project model, not the Web Site Project...

Installing VS 2005 Service Pack 1 - It went well!

Despite the horror stories I'd read/heard regarding the upgrade to Visual Studio 2005 SP1, last night I decided to just bite the bullet and go for it. Had I gone delirious from too many hours of scanning the blogosphere in search of the ultimate How-To guide for upgrading? Was I being naive... or perhaps suffering from delusions of grandeur? Who knows. But once I decided that I was going to do the upgrade, I knew there was no turning back. How I did it As I said, I spent several hours scouring the web for all of the tips, tricks, and gottcha's...

Skype & Logitech QuickCam, They Don't Play Nice!

My daily commute to work is roughly 2,500 miles... so you can just image how much time I spend sitting in traffic! OK, seriously... I really do work that far from our official HQ, but that's because our entire company is very technology forward. In fact, I might even go so far as to say that we make up the quintessential Virtual Office. One of the key tools that I/we use on a daily basis to talk with co-workers (and friends in general) is Skype. One of the cool features of Skype is that it lets you start conference calls with...

Mapping Drives via Remote Desktop

Microsoft's integrated Remote Desktop Protocol (RDP) is an essential tool in my developer's utility belt... and is one tool that I think every developer/computer geek should keep close at hand. For the uninitiated, a Remote Desktop Connection allows you to log into a Microsoft Windows OS installed on a remote computer (i.e. - not the one you're sitting at) and use it just like you were sitting at it. You have full mouse & keyboard functionality, and you even seen the full UI on your local monitor. What's it for? At home I use Remote Desktop connections to log...