Setting the Default Browser in Visual Studio 2010

If you haven’t read Scott Hanselman’s awesome post on how to use PowerShell to set the Default browser for Visual Studio you should.  I went about doing this for my environment, made the external commands and modified the PowerShell script to take the browser name as a parameter.  Everything works great.  At this point I wanted to add icons for my new toolbar when I found out that the VS2010 team, in their transition from a Win32 based UI (shell and command system) to one based solely on WPF, didn’t have time to implement the ability to add icons to commands through the Customize dialog.  They simply didn’t have time before the launch.  But after reading through the comments of that post I found the link to a Visual Studio extension to change command images by Ryan Molden who is on the Visual Studio team (download the extension here).

When you invoke the extension through the ‘Tools…Customize Command Images’ command you’ll get a dialog like this:

CommandingImage

Through this dialog you can add any custom icons and then apply them to your commands.  After creating icons for each browser and adding them with the tool, my new toolbar looks like this:

Toolbar

On a side note, I used IcoFX’s ‘Extract…’ feature to get the icons from each browsers executable.  Scott Hanselman had another great post on how to create custom PowerShell icons for your Visual Studio command prompt.

Now, when I want to run a site I can choose which browser I want.  When I click the IE command button I get:

BrowserChangeToIE

for the Firefox command button:

BrowserChangeToFirefox

and for the Chrome command button:

BrowserChangeToChrome

Hopefully this functionality will get added to Visual Studio in a future service pack.

Nice Mercurial Cheatsheet

I’m starting to dig into Mercurial outside of work and really enjoy it, a lot!  I’m currently hosting a couple projects up at Bitbucket.org.  Their services are great and the free account gives you one private repository.  Their upgrade path is wallet friendly also.  If you haven’t tried their services I’d recommend you give them a good look over, you’ll be happy you did.

Back to the point of the post, since I’m doing more and more mercurial, I ran across this cheatsheet last night and I think it’s organized rather well.  Print it out and commit & push away!

Comments & Tasks in Visual Studio

Here's a good article on how to do comments and tasks inside Visual Studio.  There are a lot of good tips in there, definitely a good read.

 

Adding NUnit Template for ASP.NET MVC (Win7 x64)

I figure I would share this as I’ve been having a heck of a time adding the NUnit test framework to ASP.NET MVC project in VS2008 Professional.  I’m running Windows 7 RTM 64-bit and most of the examples on the web don’t take into account the differences associated with a 64-bit OS.  So keep in mind this template is for a 64-bit OS, specifically Windows 7. 

To start, the path in the registry where the NUnit entries need to get added is:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\MVC\TestProjectTemplates\NUnit\C#

Also, the template zip file needs to get copied to the following folder:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates\CSharp\Test\1033

A lot of people instruct people to place it one directory above the one I listed, which wouldn’t work for some reason.  I zipped everything up so just download the zip file, unzip it, and run the regnunittomvc.bat to install.  Also keep in mind that this will work with any version of NUnit.  I just installed this with NUnit 2.5.2.9222 and it worked beautifully.  I also included Rhino.Mocks with this template also (version 3.6).  Enjoy.

 

image image
   

Great Idea for an iPhone Dock

While searching for a potential docking station for my new iPhone, I came across this DIY Paper Dock that, well, is simply awesome!

diy_paperdock

Be sure to check out the link as there is also an instructional video.  I think I’m going to go with this one :)

Microsoft adds StartCom as Root Certificate Authority

I've been using StartCom for my personal email certificates and also for my domain for SSL for over 2 years now.  They offer a great service, excellent customer service, and very fast turn-around on identity verification during your account setup.  I just read via twitter from @dm_the_company that Microsoft added StartCom to their list of trusted root certificate authorities.  Windows 7 will come out-of-the-box with StartCom as a root CA and Microsoft also has an optional patch available for XP and Vista that can be installed to add the StartCom certificates to those operating systems, which allows those certificates to be recognized by the OS without any extra work done by the user.  Very good news.  I recommend you give them a look if you're in the market for getting a certificate for your domain or personal email.  Also, their Class 1 certificates are free and for minimal cost you can upgrade to Class 2 or 3 validation depending on your needs.

CC.NET 1.4.4 & IIS 7

I just reformatted one of my boxes at home here where I run IIS, SQL Server 2008, host my subversion repositories, and CruiseControl.NET.  I upgraded the OS on this box from Vista Ultimate SP1 to Windows 7 Ultimate RTM.  During the process of reinstalling all of my apps, development tools and reconfiguring those tools I ran into the problem of getting CC.NET to work under IIS 7.  One of the issues I had was that the virtual directory that the CC.NET installer creates was not getting created.  I then manually created the virtual directory and pointed it to the webdashboard directory where CC.NET was installed.  This didn't work either.  After doing some searching I found that the virtual directory needs to have the "Classic .NET AppPool" application pool in order for it to work propertly.  After I made that change I got a little further but received this error when trying to view the project web page:

Server Error
--------------------------------------------------------------------------------
HTTP Error 404.11 – URL_DOUBLE_ESCAPED
HRESULT: 0
Description of HRESULT # The operation completed successfully.

I found a Microsoft KB article that describes the problem and how to fix it, offering several ways to get around it.  The option I chose was to open a command prompt and issue the following command:

Appcmd set config "Default Web Site" /section:system.webServer/Security/requestFiltering -allowDoubleEscaping:True

I then reset IIS and boom, all was running properly.  Hope this helps anyone encountering these problems trying to get CC.NET running on IIS 7.

Reasons to Have a Blog

Curt Monash has a nice article on why every IT person should have his/her own blog.  I used to have reservations about having a blog.  I used to think no one would want to read what I had to say, or even worse, I’d have nothing to actually say.  But the reasons he gives to have a blog counter those thoughts.  Go give it a read here.

Code Formatter for Windows Live Writer

Steve Dunn recently released a new version of his Windows Live Writer plugin that allows you to insert code into your blog posts that properly formats and highlights everything.  It’s customizable and easy to use with a plethora of options.  This is by far the best code formatter for Live Writer out there.  And best of all, its FREE!  Here are a few samples of the different formats you can use:

Highlighted code:

 

        /// <summary>
        /// Retrieves all articles.
        /// </summary>
        public override List<ArticleDetails> GetArticles(int pageIndex, int pageSize)
        {
            List<ArticleDetails> articles = new List<ArticleDetails>();
            using (SqlConnection cn = new SqlConnection(this.ConnectionString))

 

Formatted code:

        /// <summary>
        /// Retrieves all articles.
        /// </summary>
        public override List<ArticleDetails> GetArticles(int pageIndex, int pageSize)
        {
            List<ArticleDetails> articles = new List<ArticleDetails>();
            using (SqlConnection cn = new SqlConnection(this.ConnectionString))

 

Code as bitmap:

 

This is a great tool – you can download the plugin here.  Enjoy!

New LINQPad Features Coming

I just received an email from Joe Albahari, creator of LINQPad, about a webinar he’s giving on April 16, 2009.  Joe has added some great new features to the upcoming version and has even placed the beta on his web site for us to preview.  Some of the new features are:

  • The ability to query your own LINQ to SQL or Entity Framework classes
  • ESQL querying
  • First-class support for 1:1 relationships
  • Enhanced autocompletion support including smart tags
  • The ability to edit stored procedures, functions and views within LINQPad

Very good stuff.  You can get the preview here.

ASP.NET MVC 1.0 Final Released Today

I guess Microsoft wanted to generate some excitement at MIX09 so it looks as if they released the final version for ASP.NET MVC 1.0.  You can download it here from Microsoft Downloads.

For those of you new to ASP.NET MVC, David Hayden has compiled a list of ASP.NET MVC Sample Web Applications.  This is a great place to visit if you’re just starting out with ASP.NET MVC.

Doug

Quote of the Day

90% Bush + 9% Cheney + 1% Maverick + 0% Knowledge of the Economy = 100% John McCain.

From a comment on this CNN article.

Remote Desktop, /Console, and You

Recently I was having a heck of a time figuring out why I couldn't connect to my work machine through VPN to the console.  I could in the past, but for some reason could not anymore.  I tried a variety of settings, both on my home machine and my work machine to no avail.  Finally, after searching the web, I found that if you have Windows XP SP3 installed, the /console command doesn't work anymore.  After I read that I realized that I did indeed update my home machine (its a Virtual PC) to SP3.  With SP3 you must use /admin instead of /console.  I guess I'm not mad about the change, but what really annoys me is that the new command has no compatibility with the old command.  It simply leaves you dead in the water.  They just removed the /console parameter and removed it from the documentation also.  So the command I use now is:

mstsc /v:machinename /admin /f

I hope this saves someone the frustration I had until I found out the new paramter name.

BlogEngine.NET Conversion Done

I finally set aside some time to finish my conversion from Community Server 2007 over to BlogEngine.NET 1.4.  The main problem I was having was getting my old posts/comments/categories/etc out of CS2007 and into BE.NET.  The built-in export tool wasn't working and would fail with several hard to decipher errors.  I even tried using the BlogML tool to export all of my data and that wasn't working either (thanks Keyvan Nayyeri for trying to help!).  Just by chance, I was reading Dave Burke's blog and noticed that he just finished his conversion from CS2007 to BE.NET.  I sent him an email asking how he was able to get all of his data out of CS2007 and he told he did it manually via SQL.  He was even kind enough to send me some of the queries he used and it worked!

The first thing you have to do is add a new column to the be_Posts table that allows you to link posts to post comments:

ALTER TABLE be_Posts ADD csPostID int null

Next, we copy over the posts:

INSERT INTO be_Posts

    (PostID, Title, PostContent, DateCreated, DateModified, Author, IsPublished, cspostID)

SELECT

    NEWID(),

    subject,

    body,

    postdate,

    postdate,

    'drohm',

    1,

    postID

FROM

    SQL2005_347492_dougrohm.dbo.cs_Posts

WHERE

    sectionID = 3 AND

    postlevel = 1


You'll need to change 'drohm' to the name of your blog in CS2007.  The section id for my blog in CS2007 is '3'.  This most likely is different for you and you'll need to get that value and enter it here.  Also, change 'SQL2005_347492_dougrohm' to whatever the name of your CS2007 database is named.

Next, we can migrate over post comments:

INSERT INTO be_PostComment

    (postID, CommentDate, author, email, website, comment, isapproved)

SELECT

    b.postid,

    c.postdate,

    (SQL2005_347492_dougrohm.dbo.FetchExtendendAttributeValue('SubmittedUserName', c.PropertyNames, c.PropertyValues)),

    'doug@dougrohm.com',

    (SQL2005_347492_dougrohm.dbo.FetchExtendendAttributeValue('TitleUrl', c.PropertyNames, c.PropertyValues)),

    c.body,

    1

FROM

    be_posts b INNER JOIN SQL2005_347492_dougrohm.dbo.cs_posts c

ON

    b.csPostID = c.parentID

WHERE

    c.sectionid = 3 AND

    c.postlevel = 2 AND

    c.posttype = 1 AND

    c.applicationposttype <> 8


Trackbacks are not being migrated here so if you want to capture that information you'll need to update this query.  Also, you'll need the FetchExtendedAttribute SQL function to extract the comment author and website info.  You can find that great tool here.  One other note, I'm using my email address for the email field.  On my CS2007 blog I didn't allow users to register.  If you want to migrate this information, you'll need to modify that here as well.

I then update the author field for any comments that don't have a value for the name:

UPDATE

    be_PostComment

SET

    author = 'Douglas Rohm'

WHERE

    author is null


The last step is to migrate over categories:

ALTER TABLE be_Categories ADD csCategoryID int null

 

INSERT INTO be_Categories

    (categoryname, csCategoryID) select [name], categoryID

FROM

    SQL2005_347492_dougrohm.dbo.cs_post_categories c

WHERE

    c.isenabled = 1 AND

    sectionID = 3

 

UPDATE

    be_Categories

SET

    csCategoryID = c.categoryID

FROM

    SQL2005_347492_dougrohm.dbo.cs_post_categories c, be_Categories b

WHERE

    b.categoryname = c.name

 

INSERT INTO be_PostCategory

    (postid, categoryid)

SELECT

    b.postid, bc.categoryID

FROM

    be_Categories bc

        INNER JOIN SQL2005_347492_dougrohm.dbo.cs_post_categories c ON c.categoryID = bc.csCategoryID

        INNER JOIN SQL2005_347492_dougrohm.dbo.cs_posts_incategories cic ON c.categoryID = cic.categoryID

        INNER JOIN SQL2005_347492_dougrohm.dbo.cs_posts p ON cic.postid = p.postid

        INNER JOIN be_posts b ON b.cspostID = p.postID


Like earlier, I'm adding a column to the be_Categories table so we can link the two.  Be sure to change the section id and 'SQL2005_347492_dougrohm' to the name of your CS2007 database and you should be all set.

Now that I have BlogEngine.NET 1.4 running, I have to say it's very fast and super easy to configure.  Kudos to the BE.NET team.

The Agile Pitch

Have you ever had someone ask you what Agile is and how it can help a development team or project?  Even worse, what if that person were your boss or stakeholder?  Mike Cottmeyer does a great job of explaining it in under 30 seconds.  Nicely said.