Tools

Conditional Compile based on .net framework version

Ok, I've been after this one for quite a while. I want to include stuff like Moth.Linq and ExtensionAttribute in .net 2.0 compilations, but exclude them from .net 3.5 compilations. In effect, I want to cross compile to .net 2.0 and .net 3.5. Not only do I want to do this from within Visual Studio, I also want the Continuous Integration server to do it too. Tall order? Yes. A bit of background: - Moth.Linq is a mechanism for producing LINQ functionality in assemblies compiled in Visual Studio 2008 targeted to the .net 2.0 framework. You...

LINQ to SQL Visualizer isn't in the transaction it is visualizing

The LINQ to SQL Visualizer is a phenomenal tool.  This is how debugging should be done.  Scott Guthrie introduced it in the Visual Studio 2008 Beta 2 timeframe, and I've been hooked ever since.  It's now bundled in the Visual Studio 2008 RTM samples, though it's not installed by default.  Instructions of how to install it are here. Well, I'm splunking along in some code that happens to be in a transaction.  I've just inserted a row, and I'm about to execute the select that refreshes the business object with generated content including the primary key.  I open up...

Compile time reminders

For ages I've wanted to be able to put a comment of some kind in my code that I could get to come up during a build.  "Hey, you haven't finished this" or "This is an assumption we need to run by the suits" or "you dork, how could you even think to do it this way" or similar -- notes to myself and others that there is work left to be done here. Well, after trying unsuccessfully to look towards subclassing or hacking the Obsolete attribute the answer was handed to me: 1. I build comments in...

Filter Sql Server Profiler by Database

Ok, I stumbled with this one enough times to log it here.  I want to tune a database I'm working with.  I dutifully fire up Sql Server's Profiler, and no where in the options do I see "filter by database". Ok, the option is there, but it takes some doing to get there.  When you're building the profile, in the events selection tab, choose "show all columns", then you'll find the "Database Name" column.  Pop in the database name in question, and you're golden. source: http://sqljunkies.com/Forums/ShowPost.aspx?PostID=14078

Double-click the document in Solution Explorer -> Code View by default

Ok, this has been an annoyance for long enough.  I'm in Visual Studio.  I double-click on a web service's code behind file in the Solution Explorer, and up pops an empty designer window.  I close the irrelevant window (once it finishes loading), right-click on the file, and choose "View Code", then promptly kick myself for doing it again. The solution comes from http://www.thescripts.com/forum/thread106933.html: If you want to go to code mode by default, do the following: 1) Right click on the document name in the Solution Explorer 2) Choose "Open With" 3) Select "Csharp editor" 4) Choose "set as default" I did this, and I'm golden --...

Update Statistics for all tables

Statistics in Sql Server are awesome for improving performance of queries.  There's a lot of voodoo behind the scenes, but the end result is fast, and that makes users smile. From time to time, table and index statistics get stale.  Updating statistics regularly is a good use of a sql agent job or a db maintenance plan step.  In the cases where I want to do it manually, I frequently have to search for a way to extract table names from sys tables, construct the update statistics command, and execute. The 'a-ha' moment came.  The answer is in.  It need not be...

LINQPad -- Query Analizer for Linq

There's an awesome tool called LINQPad by Joseph Albahari -- completely free, download here.  ("LINQPad is not an open-source product and the source code is protected by standard copyright laws.  Nonetheless, you are free to disassemble the executable to satisfy your curiosity..." says the author.)  It's billed as the Query Analyzer for Linq to Sql.  It does wonders for giving you a quick chance to mock up some Linq to Sql.  It is an awesome product for getting you into Linq, but it seems to fall short of it's full potential. What it does really well: - Get you to...

Linq to Sql Query Visualizer

Scott Guthrie described an awesome Linq to Sql Query Visualizer here.  His context is Visual Studio 2008 Beta 2.  Since then, it's gotten (almost) baked into Visual Studio 2008 RTM.  The functionality is the same, installing it is slightly different. What is it: During debugging, show the actual sql that will get executed from your linq query, and allow you to execute the query and see the results -- all within a debugger visualizer. How to get it: 1. Navigate to C:\Program Files\Microsoft Visual Studio 9.0\Samples\1033  (Modify to suite if you installed Visual Studio 2008 to a different directory.) 2. unzip CSharpSamples.zip 3. Navigate inside the...

Using VS 2005 and VS 2008 simultaniously

Much has been written on the fact that Visual Studio 2008 can build .net 2.0 applications, and that they can be installed side-by-side on the same machine.  This is phenomenal as it allows organizations to upgrade developer tools without forcing clients to also upgrade .net framework versions.  Very nice. However, what isn't as fully documented is using Visual Studio 2008 and Visual Studio 2005 together on a development team.  For example, Sally Slickster is an early adopter, downloaded the VS 2008 iso from MSDN 8 minutes after Scott Guthrie posted the RTM news.  She'd like to use it for all development...

TortoiseSVN committed a file like myapp.pdb or Thumbs.db. Now what?

A very specific rule for using source control is to avoid putting temporary files, user files, or compiled content into the repository.  These files change far too frequently and offer little value to the versioning and historical process.  More than anything, they'll just make the repository excessively large and make everyone update their checked out copies more.  However, keeping temporary files out of SVN using TortoiseSVN isn't a perfect science. TortoiseSVN will suck in everything in the folder, including hidden files and folders.  Windows hides the Thumbs.db file -- a cache of image thumbnails in the folder.  To see this file,...

Can't stream flash video in IIS

I've got more than one gray hair from this one. The symptom is simple: Cassini (the development web server) hosts streaming flash videos just fine. IIS shows a white box. The answer is annoyingly simple: 1. Open IIS Manager, choose the website. 2. In IIS 7, choose "Mime Types". In IIS6, right-click, choose properties, choose the HTTP Headers tab, and choose File Types. 3. Click Add. Extension is ".flv" (no quotes), mime type is "video/x-flv" (no quotes) Not sure if you need to restart the website for changes to take effect. Now hopefully, I'll remember that next time I'm ready...

"My VM disk is too small"

I've loaded up a Vista VMware session with all sorts of fun gizmos, and came to a perplexing dilema: "My VM disk is too small".  Yeah, I could've just created a new virtual disk, called it D: and been done with it, but I wanted more space for Documents, Program Files, Windows Updates, etc, etc.  I didn't want a D: drive, I wanted a bigger C: drive. Here's what I did: 1. vmware-vdiskmanager -x 32GB myDisk.vmdk  That was easy ... kinda.  vmware-vdiskmanager expands the disk, not the partition.  C: is still the original 16 gigs.  vmware-vdiskmanager is in the VMware Workstation directory,...

Outlook 2007, the RSS Reader

I finally sat down to load up all my RSS feeds from Google Desktop to Outlook 2007.  Um, oops. My RSS needs are simple: - I want to group feeds and aggregate their results - I want multiple groups of these aggregated results so I don't lose infrequently posted sources Group 1: I download my daily 'newspaper' by aggregating cnn, slashdot, abcnews, engadget, the register, wired, etc.  I consider this for the most part disposable knowledge: if I miss a post or a day's worth of posts, so what.  I want to read my news as an aggregated list: newest first, combine all the...

NAnt intellisense in Visual Studio

NAnt is a phenomenally cool tool for automating build scripts. Coding NAnt build files feels natural to me: unix shell script style functions and xml style syntax. However, getting all the parameters just so is a bit intense. Visual Studio can provide intellisense for NAnt, if it has an xsd file to use for reference. NAnt comes with an nant.xsd, and some pretty good docs for installing it. This is great for NAnt tasks, but doesn't handle NAntContrib's features. Clint describes a technique here and here for using NAnt to build the nant.xsd file. He was...

NAnt

NAnt is my new best friend. NAnt is very easy to learn, very straight forward to use, and very powerful in it's execution. NAnt is an automated build tool. Why would you deviate from Visual Studio's Build menu? Here's why. .config files. I've got a dev config file, I've got a production config file, various customers like their own pre-packaged config files, and I like to be able to debug live data issues with their config files as well. Well, I want that config file baked into the .msi installer I deliver to them. ...

NUnit

High on my list of stuff I need to do is NUnit. Last I tried NUnit, it was wonderful and infuriating. I could run tests or debug code, but not both. My, how times have changed. I must conclude NUnit rocks! NUnit is for making automated tests of .NET code. Each test is a piece of C# code with a special [Test] attribute. There are 1000 quick start tutorials out there, so I won't bore you. Do a Google search, and you're good. And the NUnit quick start docs are also quite good. Here's...

SSH on Windows

Apologies up front to those who will flame me for this, but I must concede. I've been trying to find a good excuse to get into Linux for a while. I like the idea of open-source software running my organization. I like the idea of creating a test environment or another machine simply by downloading and installing. I can only imagine the headaches and dollars saved by moving to Linux. However, I have yet to find a reason to do so. My latest example is a good one. I want the ability to ssh. ...

Subversion Rocks!

I've long been a fan of CVS. I've used CVSNT and TortoiseCVS for ages. It's a great (and free) way to keep my source code in check. I've scripted it on Unix with automated build and deploy scenarios. I've saved my bacon more than once with it in Windows when I got down a coded road that just didn't work out. CVS is cool. I've always wanted to test out Subversion -- see how green the grass was on the other side of the fence. Eric Sink's presentation to the Arizona .NET User's Group was...

Subversion at Desert Code Camp

Desert Code Camp was October 28, 2006. It rocked! Among other things, I co-taught 'Intro to Subversion' with Wendy Smoak. It was incredible. I felt somewhat selfish in that I think I learned the most. For those of you who missed it, it was a great adventure. The main thesis of the presentation was that source control isn't hard, and you can get Subversion running now. Wendy has made a really nice online article of screen shots and slides. Check it out here. A PDF of the powerpoint slides is also available here. Rob