Scott Hanselman

Hanselminutes Podcast 255 - The Opinionated Cloud - Learning about AppHarbor

March 2, '11 Comments [1] Posted in ASP.NET | Cloud | Podcast
Sponsored By

Cloud Scott sits down with Rune from AppHarbor. AppHarbor has some strong opinions about how the cloud should work and how applications should be deployed. Is there room for another cloud offering? Is the cloud about elasticity or something else? What's a Cloud and what's Platform as a Service. All this and more as Scott gets educated.

Download: MP3 Full Show

NOTE: If you want to download our complete archives as a feed - that's all 255 shows, subscribe to the Complete MP3 Feed here.

Also, please do take a moment and review the show on iTunes.

Subscribe: Subscribe to Hanselminutes or Subscribe to my Podcast in iTunes or Zune

Do also remember the complete archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

Telerik is our sponsor for this show.

Building quality software is never easy. It requires skills and imagination. We cannot promise to improve your skills, but when it comes to User Interface and developer tools, we can provide the building blocks to take your application a step closer to your imagination. Explore the leading UI suites for ASP.NETAJAX,MVC,Silverlight,Windows Forms and WPF. Enjoy developer tools like .NET Reporting, ORM,Automated Testing Tools, Agile Project Management Tools, and Content Management Solution. And now you can increase your productivity with JustCode, Telerik’s new productivity tool for code analysis and refactoring. Visit www.telerik.com.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselminutes Podcast 254 - ASP.NET Web Forms - Reports of my Death of been exaggerated, with Damian Edwards

February 22, '11 Comments [15] Posted in ASP.NET | Podcast
Sponsored By

image Scott chats with Damian Edwards about new features coming in ASP.NET WebForms, new techniques, controls, model binding, HTML 5 and more.

Download: MP3 Full Show

NOTE: If you want to download our complete archives as a feed - that's all 254 shows, subscribe to the Complete MP3 Feed here.

Also, please do take a moment and review the show on iTunes.

Subscribe: Subscribe to Hanselminutes or Subscribe to my Podcast in iTunes or Zune

Do also remember the complete archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

Telerik is our sponsor for this show.

Building quality software is never easy. It requires skills and imagination. We cannot promise to improve your skills, but when it comes to User Interface and developer tools, we can provide the building blocks to take your application a step closer to your imagination. Explore the leading UI suites for ASP.NETAJAX,MVC,Silverlight,Windows Forms and WPF. Enjoy developer tools like .NET Reporting, ORM,Automated Testing Tools, Agile Project Management Tools, and Content Management Solution. And now you can increase your productivity with JustCode, Telerik’s new productivity tool for code analysis and refactoring. Visit www.telerik.com.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselminutes Podcast 253 - Organizing your own Virtual Technical Conference - MVCConf Post-Mortem

February 22, '11 Comments [1] Posted in ASP.NET MVC | Channel9 | Podcast
Sponsored By

Link to all MvcConf2 videos on Channel 9 Scott talks to Javier Lozano and Jon Galloway (and Eric Hexter in spirit) about MVCConf. Thousands of viewers logged in and watched hours of top technical content on ASP.NET MVC this last week. How was it organized? How was it paid for? Can you put together your own free conference?

Download: MP3 Full Show

Links from the Show

NOTE: If you want to download our complete archives as a feed - that's all 253 shows, subscribe to the Complete MP3 Feed here.

Also, please do take a moment and review the show on iTunes.

Subscribe: Subscribe to Hanselminutes or Subscribe to my Podcast in iTunes or Zune

Do also remember the complete archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

Telerik is our sponsor for this show.

Building quality software is never easy. It requires skills and imagination. We cannot promise to improve your skills, but when it comes to User Interface and developer tools, we can provide the building blocks to take your application a step closer to your imagination. Explore the leading UI suites for ASP.NETAJAX,MVC,Silverlight,Windows Forms and WPF. Enjoy developer tools like .NET Reporting, ORM,Automated Testing Tools, Agile Project Management Tools, and Content Management Solution. And now you can increase your productivity with JustCode, Telerik’s new productivity tool for code analysis and refactoring. Visit www.telerik.com.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Enabling Dragging of an Image to Pin a Site to the Windows Taskbar in IE9

February 18, '11 Comments [8] Posted in IE9
Sponsored By

My site's custom jumplist including Archives, Videos, Twitter and FacebookI blogged in September about a some features of IE9 that I really dug, specifically adding Jump Lists to your website and Pinning WebSites to the Taskbar.

I made a few small markup changes and now you can pin this blog to your taskbar if you're running Windows 7. I also added right-click Jump Lists to this blog as well.

However, I just noticed that the IE9 Release Candidate that just came out includes a little feature where you can drag an image from a website to pin the site to the taskbar.

Clearly this feature was created as an opportunity for me to enable you, Dear Reader, do drag my giant forehead to the Windows 7 taskbar. No question.

Enabling Dragging of an Image to Pin a Site to the Windows Taskbar in IE9

All I had to do was add:

class="msPinSite"

to the image I wanted to use. You can set other options as well, like the image that's used while dragging (it uses favicon by default) as well as callouts for mouseovers and stuff.

I just did this, as it was simpler:

<img class="msPinSite" src="http://www.hanselman.com/blog/images/tinyheadshot2.jpg" alt="Scott Hanselman" title="Drag this image to your Windows 7 Taskbar to pin this site with IE9 - Scott Hanselman">

Here I am dragging my headshot to the taskbar to pin it. Of course, you can always pin any site by dragging the favicon from the address bar.

Dragging the image down to the Taskbar. 

You can even add little toolbars to taskbar with JavaScript (for sites like Pandora, etc). It's all standard markup and JavaScript and it's setup in such a way that other browsers ignore it as they like.

You can also use JavaScript to push alerts to the icon, maybe for new messages, chat, etc. It's easy to this stuff, check it out there's a whole section on MSDN on Site Pinning. You can also View Source on this demo and figure it out. It took me 5-10 minutes. The hardest part for the Jump List was finding cool icons.

One more very nice browser for my collection of All Non-Released Browsers. Yet.

IE9, FireFox 4, Chrome 11, Opera 11

Enjoy.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Updating and Publishing a NuGet Package - Plus making NuGet packages smarter and avoiding source edits with WebActivator

February 18, '11 Comments [7] Posted in ASP.NET | ASP.NET MVC | NuGet | VS2010
Sponsored By

I wrote a post a few days ago called "Creating a NuGet Package in 7 easy steps - Plus using NuGet to integrate ASP.NET MVC 3 into existing Web Forms applications." Long enough title? I think so.

The post exists for two reasons: First to show folks how insanely easy it is to create a NuGet package (and prompt you to make some yourself) and second to share with you some experiments where one enables new/interesting functionality after File|New Project. In that example, we had an existing ASP.NET WebForms application and added ASP.NET MVC to it in one line, making it an easy hybrid application.

install-package AddMvc3ToWebForms

Well, not really one line. In version 0.5 of the AddMvc3ToWebForms package you still have to hook up the Areas, Routes and Filters yourself in the Global.asax. I made a helper method that gets it done to one additional line, but still, it's ever so slightly lame.

Now, to THIS post that exists for two reasons: First, to show you how to create an update to a package, and what the update process looks like for the consumer. Second, to show you how (and why) you should put a tiny bit more effort in your packages up front so that things "just work" for the user.

Creating an Update to a NuGet Package

Step 1 - Update the NuSpec file

I opened up my AddMvc3ToWebForms.nuspec file and changed the version a notch to 0.6. I also added a dependency to another NuGet package called WebActivator that I'm going to use to make my package just work and avoid the need for that extra line of code. I'm being specific and asking for WebActivator 1.1 or higher because that version has a specific feature I need.

<?xml version="1.0"?>
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>AddMvc3ToWebForms</id>
<version>0.6</version>
<authors>Scott Hanselman</authors>
<owners>Scott Hanselman</owners>
<iconUrl>http://www.hanselman.com/images/nugeticon.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A totally unsupported way to quickly add ASP.NET MVC 3 support to your WebForms Application. Works on my machine.</description>
<tags>MVC MVC3 ASP.NET WebForms</tags>
<dependencies>
<dependency id="WebActivator" version="1.1" />
</dependencies>
</metadata>
</package>

Step 2 - Make your new changes

When bringing in multiple NuGet packages it's common to want to have a few things run at application startup. Perhaps setting some context, connection strings, defaults for software factories, or dependency resolvers. There are a number of packages that need this functionality, and David Ebbo created the WebActivator package to make it easier. It's a formalized wrapper around a new ASP.NET 4 attributed called "PreApplicationStartMethod," and David also enables a PostApplicationStartMethod.

In my new version of the AddMvc3ToWebForms package I created a new file called AppStart_RegisterRoutesAreasFilters.cs.pp. Note the .pp extension that signals to NuGet to preprocess the file and replace tokens like $rootnamespace$, kind of like a mini-mini-code-generator.

The rest should look familiar; we're registering the Areas, GlobalFilters and Routes. The informal naming convention is to prefix the class and file with AppStart_ so that projects that include packages that add an AppStart_*.* will group the files together.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Microsoft.Web.Infrastructure;

[assembly: WebActivator.PostApplicationStartMethod(typeof($rootnamespace$.AppStart_RegisterRoutesAreasFilters), "Start")]

namespace $rootnamespace$ {
public static class AppStart_RegisterRoutesAreasFilters {
public static void Start() {
// Set everything up with you having to do any work.
// I'm doing this because it means that
// your app will just run. You might want to get rid of this
// and integrate with your own Global.asax.
// It's up to you.
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
}

public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}

public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
}
}

Note the line:

[assembly: WebActivator.PostApplicationStartMethod(typeof($rootnamespace$.AppStart_RegisterRoutesAreasFilters), "Start")]

David added the "PostApplicationStart" option because PreApplicationStart happens too early in the process to register Areas, so for my package, I want things to run just after App_Start. This is all new and under development, so feel free to share with David if you have any thoughts, improvements or strong opinions.

Step 3 - Build a new NuPkg file

From the command line, call...

NuGet pack

...and you'll automatically get a new file, like this screenshot:

Building a new package - Look at all my packages in the explorer window. Cool.

Step 4 - Publish the Update to http://nuget.org (or any NuGet server or file share)

I could log in to my account and upload the file from the browser interface, but since I'm thinking I'll being making changes here and there, I figure it'd be nice to publish from the command line.

I'll grab my API key from the site...

image

..and use it to publish from the command line (using my magic new publish.bat) with contents like these:

nuget push AddMvc3ToWebForms.0.6.nupkg e5c2bbe6-xxxx

...and the result...

C:\AddMvc3ToWebForms>nuget push AddMvc3ToWebForms.0.6.nupkg e5c2bbe6-xxxx
Creating an entry for your package [ID:AddMvc3ToWebForms Ver:0.6]...
Your package was uploaded to the server but not published.
Publishing your package [ID:AddMvc3ToWebForms Ver:0.6] to the live feed...
Your package was published to the feed.

Now I'm set. I've got version 0.6 live now. What's the experience for the user of this library?

Getting an Update to a NuGet Package

There's two ways to find out what NuGet packages my project is using and update them.

Package Manager Console

From the package manager console I can type Get-Package...

PM> Get-Package

Id Version Description
-- ------- -----------
AddMvc3ToWebForms 0.5 A totally unsupported way to quickly add ASP.NET MVC 3 support to your WebForms Application. Works on my machine.

Looks like I have version 0.5. I can update it via...

PM> Update-Package AddMvc3ToWebForms
'WebActivator (≥ 1.1)' not installed. Attempting to retrieve dependency from source...
Done.
Successfully installed 'WebActivator 1.1.0.0'.
Successfully installed 'AddMvc3ToWebForms 0.6'.
Successfully removed 'AddMvc3ToWebForms 0.5' from WebApplication7.
Successfully uninstalled 'AddMvc3ToWebForms 0.5'.
Successfully added 'WebActivator 1.1.0.0' to WebApplication7.
Successfully added 'AddMvc3ToWebForms 0.6' to WebApplication7.

Notice that NuGet automatically removed AddMvc3ToWebForms 0.5 and installed AddMvc3ToWebForms 0.6. It also automatically brought in the dependency on WebActivator 1.1.

Add Library Reference

Alternatively, from Visual Studio right click on the References node in the Solution Explorer and select Add Library Reference (or select the same directly from the Tools menu).

Select Updates from the left side. A list of updates will appear. Click Update.

Updating Packages - Add Library Package Reference

It's all good. Now my AddMvc3ToWebForms NuGet Package can add ASP.NET MVC functionality to an ASP.NET WebForms projects with no additional lines of code. This makes for a nice out of the box experience, especially if I bring in other projects that use the same functionality.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.