Scott Hanselman

Hanselminutes Podcast 163 - Software Metrics with Patrick Smacchia

May 28, 2009 Comment on this post [6] Posted in Learning .NET | Podcast
Sponsored By

419346614_2444548850 My one-hundred-and-sixty-third podcast is up. Scott sits down with Patrick Smacchia, lead developer of NDepend, and talks about Software Metrics. What metrics lie beyond Lines of Code?

Subscribe: Subscribe to Hanselminutes Subscribe to my Podcast in iTunes

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 a 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, we can provide the building blocks to take your application a step closer to your imagination. Explore the leading UI suites for ASP.NET and Windows Forms. Enjoy the versatility of our new-generation Reporting Tool. Dive into our online community. 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 bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

When Word of Mouth Got a Permalink - Companies, Customers and Twitter

May 27, 2009 Comment on this post [17] Posted in Musings
Sponsored By

iStock_000002294470XSmallDerek Powazek dropped this little piece of truth on Twitter recently:

Twitter was more fun when I could b*tch about a company without them replying to ask how they can provide me with excellent service today.

Things have changed since Word of Mouth got a permalink. When I'm complaining about a company to my friends or while walking down the street, no one seems to care. When I'm calling a company and complaining one-on-one, I don't always get excellent service. Boy, but if you mention a company on your blog, or even better, on Twitter, you'll likely get a reply in minutes.

It's getting to the point that I get better customer service (and hence, satisfaction) on Twitter than I do calling a 1-800 number. I'll spend less time on hold as well!

Where's my Mower?

I recently ordered a Lawn Mower from HomeDepot.com and was bummed when I realize that HomeDepot is NOT Amazon. By that I mean, not every online retailer ships virtually instantly like Amazon. Seems like Amazon has your package being prepared while it's still in the shopping cart. Click Checkout and walk to the mailbox, bam! With other retailers, not so much.,

With my Lawn Mower, it wasn't available anywhere locally so I ordered it online. I was bummed when checking the order status that it was still "processing" four days later and I complained (lower-case "c") on Twitter at 1:26pm on May 19. Sarah from Home Depot replied first thing the morning of the 20th offering to look into it for me. That's pretty cool, so kudos to HD for offering to help.

There's 100s of brands on Twitter (here's the top 100). I'd say, that Comcast got on board first, as I recall, and made really good use of Twitter for customer support. Twitter's also nice for customer support as it's (almost always) clearly a human behind the account. Twitter's not just for customer support, but also for collecting feedback and posting coupons, offers, etc. It's a brilliant medium because of it's elegant publisher-subscriber model and the its brevity constraint.

Why doesn't Home Depot (or any company, as HD isn't the point of this post) jump when I complain on Facebook?

One word: Permalinks.

Facebook is a walled garden, as you likely know. My facebook posts aren't indexed on Google and even within Facebook, they aren't easy to search and very hard to link to, IMHO. On Twitter, tweets are easy to search and you can bet that every one of these folks are using Tweetdeck to hunt for mentions of their brands. That's no doubt how HomeDepot found mine. You don't need a lot of followers, you just need to mention their name.

I've said before, don't give bile a permalink. Brands with an online or social media presence live in constant fear that you will, and it'll be about their brand.

They know that the spark of a negative tweet can fan the flames of rebellion. The threat of RT (retweets) or blog posts about tweets only pours gas on the flames. Even worse, tweets can end up in newspapers and if the company doesn't handle it well, it's over.

Consumer-driven > Company-driven

To Derek's point, yes, it WAS more fun before. I'm not sure I like the reframing of my relationship with these (often global) brands being based on fear, especially their fear of a global uprising based on potential negative publicity. I do like the idea that not only is one not complaining alone any more, but also that Twitter allows the customer (me) to reassert my role as the driving force behind the relationship.

My  question is, however, is this going to scale? I can't see how. There's only, what, 10 million people on Twitter? It's nice now, while there's so few people on Twitter, but it'll be really interesting when Twitter becomes Customer Service Central for every brand on the planet.

I still think it's lame that it took 4-5 days for my Lawn Mower to ship, but I think it's cool that Sarah at Home Depot offered to help me out.

(I got the Toro Personal Pace Mower, on sale at the time, plus a coupon, if you care.)

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 bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Windows 7 - Seamless Apps in Windows Virtual PC (Virtual XP) and Application Compatibility

May 23, 2009 Comment on this post [27] Posted in Win7
Sponsored By

I'm running the Windows 7 RC and I'm the Windows Virtual PC Beta along with Virtual Windows XP (a separate download). If you have an application that won't run in Windows 7 by default (they're out there) then you have two choices, aside from getting a version that does work.

First Try: Compatibility Mode

You have two choices with Compatibility Mode. You can always just right click on the program's Icon and click Compatibility Mode, and "lie" to the program about what version of Windows this is. This isn't just a version fib, it also patches up APIs and generally makes things friendly for your old application.

Alternatively, you can type in "Compatibility" in your Start Menu and select "Run Programs made for previous version of Windows. This will start a troubleshooter that will help you select your app and figure out what it needs.

image

You walk through a Wizard, explaining what worked before (different OS, etc) and it'll suggest what it can do about it.

Second Try: Seamless "Virtual XP Mode"

People who know what Virtualization usually assume this means that they'll need to run a Windows XP VM (which they do) and it'll be a hassle (which it isn't) as they'll have a "window of an OS inside their OS."

Here's the process, once you've installed Windows Virtual PC and Virtual XP. Run Virtual XP from the Start Menu, or from your "Virtual Machines" folder.

Virtual Machines

Once it's started, install the old application you want. I'm going to install FileZilla, an FTP client.

NOTE: There's NOTHING wrong with FileZilla under Windows7. This is JUST an example.

Select "for all users of this computer" during the installation, as you want the icon published to the "All Users" part of the Start Menu. If you don't have this option, you can always move the icon later.

Virtual Windows XP - Windows Virtual PC

Now, shut down the Virtual XP machine by clicking the close icon. It will hibernate.

Notice in your Windows 7 Start Menu that FileZilla (or whatever) has appeared...it's in the Windows 7 Start Menu.

image

Run FileZIlla it from here, like you would any other program. You can, of course, even pin it to the Windows 7 Taskbar. When you run it, there may be a moment where you'll see 'Initializing Virtual Environment, and you might see this dialog:

Virtual Windows XP - Windows Virtual PC (2)

Here you can decide to run the App or the Machine. I'll run the App. After I start running Apps, I'll not see this dialog again, unless I start the Machine again directly.

Here's FileZilla running from inside the Windows XP VM. It looks like Windows XP (notice the Crayola Colors) but the Windows 7 Task Manager is running over the top of it.

image

You can see the Virtual PC Host Process in the task manager. There's also a "Virtual PC Application Launcher" that you might see.

If I hover over the icon in the Windows 7 Taskbar, it says "remote."

image

You'll even see Tray Notifications from the Virtual XP machine (like Security Center, etc) published to the "host" tray. (Yes, I know it's not officially called the tray, but it is de facto "The Tray.")

You can even "publish" Internet Explorer 6, by copying its icon to the All Users Start Menu. I right-clicked on the Start Menu from within Virtual XP and clicked "Open All Users", then right-dragged the Internet Explorer icon to the All Users Start Menu. Now IE6 is a choice:

image

...and I have an unholy alliance between IE6 and IE8, as you can see them both running here on my Win7 machine:

image

It's also worth pointing out that this trick works with Vista Virtual Machines as well. So, while Windows 7 (I hear) is profoundly compatible with Windows Vista (basically everything works) you can still run a Vista SP1+ VM and have "Seamless Apps" jump out of it by making sure the right integration features are enabled. I tried this running Visual Studio 2003 under Vista and Visual Studio 2002 under XP, then publishing them both so I could work on them seamlessly under Win 7.

This is all stuff you can do NOW, so go have fun.

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 bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Less Virtual, More Machine - Windows 7 and the magic of Boot to VHD

May 22, 2009 Comment on this post [46] Posted in Tools | Win7
Sponsored By

NOTE: This is some advanced stuff and you may lose a finger. No warranty express or implied. There's always workarounds somewhere on the 'tubes, but this stuff works only in Win7 or Windows Server 2008 R2. Be afraid.

I use a lot of Virtual Machines. I've used VMWare, VirtualBox, HyperV and Virtual PC. Recently, since all my machines have been updated to Windows 7 RC, I've downloaded Windows Virtual PC so I could use "Virtual XP." I've got a lot of VHD (Virtual Hard Drive Files) around now.

You can see here where I've got a VM called "Dev10onVista" because I can use not just Windows XP, but also Vista. However, it's still a VM and it's slower than I'd like.

Dan has a great post on the pros and cons of Virtualization vs. Dual Booting. He points out:

  • Multiboot:
    • Good performance (runs natively on the machine, no extra abstraction layers)
    • Good hardware integration (everything that is built into or attached to the machine is visible to the running OS)
    • Clunky setup (different boot loaders overwriting each other, partitions cannot easily be resized or moved around)
  • Virtualisation
    • Very flexible (only takes up as much hard disk space as the solution requires)
    • Can run virtually any Operating System
    • Non-Optimal performance (running piggyback off another Operating System, consuming resource in both)
    • Marginal hardware integration (all major system components are virtual only; depending on the virtualisation solution, SOME components might be surfaced inside the virtual machine)

This is right on. I'm always afraid to multi-boot, concerned that one OS will some how make one of the others angry, as they are all sharing disks.

Virtual Machines

I'm just not willing to install VS2010 Beta 1 on bare hardware just now, as I know I'll want to put the Next Beta on a clean machine. I *could* sacrifice an extra machine, but I'd rather use the main machine I always use. I want less virtual, more machine.

Mounting/Attaching VHDs like Hard Drives

With Windows 7 I can mount VHD and use them like regular hard drives. Just type in "Disk Management" from your start menu. From the Action menu I can select "Create VHD" or "Attach VHD." Below I'd just attached a 7 GIG VHD file that thinks it's a 40 gig hard drive. Notice that the disk icon is blue. This is a really convenient way to just "pass a hard drive around as a file" as well as a nice way to get files on and off VMs that aren't running.

Disk Management (3)

The best part is that I can make one of these during Windows 7 setup (NOTE: This is advanced and may hurt you, your computer, or your cat.) and install Win7 directly to it.

Install Windows 7 to a new, fresh VHD

Assuming you already have a Windows 7 installation, you can boot off the Windows 7 DVD, and when it gets to "Install Now" click "Repair Your Computer." Don't select an installation, then select Command Prompt. (You can also press Shift-F10) to open a command prompt.

From the Command Prompt, run "diskpart."

Make a new VHD on an internal fixed disk:

create vdisk file="C:\win7\win7.vhd" type=expandable maximum=50000

This will make an expandable VHD with a 50Gig max, for example. Now select it and attach/mount it:

select vdisk file="c:\win7\win7.vhd"
attach vdisk

Type "exit" and go back to the setup window and install Win7. Make sure you select the correct disk - the new virtual one!

Setting up your Windows Boot Menu to boot to an Existing VHD

If you have an existing Win 7 VHD already, or perhaps you've taking your Windows 7 installation Disc and "syspreped" a VHD image. Now, from an Administrator Command Prompt, you need to tell the Windows Boot Manager that there's another option. You go:

C:\>bcdedit /copy {current} /d "My New VHD Option"

This will return a GUID. Select it using the Mark command by right-clicking in the Command Prompt and copy it to the clipboard.

Now, using that {guid}, type these commands:

C:\>bcdedit /set {guid} device vhd=[driveletter:]\<directory>\<vhd filename>
C:\>bcdedit /set {guid} osdevice vhd=[driverletter:]\<directory>\<vhd filename>
C:\>bcdedit /set {guid} detecthal on

See the [driveletter:] stuff in brackets? It's NOT obvious, but you need to include those, so:

bcdedit /set {guid} device vhd=[C:]\win7\win7.vhd

You can confirm it's setup with bcdedit /v:. You'll see something like this. The interesting part is at the bottom.

Windows Boot Manager
--------------------
identifier {9dea862c-5cdd-4e70-acc1-f32b344d4795}
device partition=C:
description Windows Boot Manager
locale en-US
inherit {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}
default {34433bb7-628f-11dc-a941-001a6bcd5d3a}
resumeobject {34433bb8-628f-11dc-a941-001a6bcd5d3a}
displayorder {34433bb7-628f-11dc-a941-001a6bcd5d3a}
{280ffa1e-f8a9-11dd-b0a9-001c26fdc6b4}
toolsdisplayorder {b2721d73-1db4-4c62-bf78-c548a880142d}
timeout 30
custom:45000001 1

Windows Boot Loader
-------------------
identifier {34433bb7-628f-11dc-a941-001a6bcd5d3a}
device partition=C:
path \Windows\system32\winload.exe
description Windows 7
locale en-US
inherit {6efb52bf-1766-41db-a6b3-0ee5eff72bd7}
recoverysequence {280ffa1b-f8a9-11dd-b0a9-001c26fdc6b4}
recoveryenabled Yes
testsigning Yes
osdevice partition=C:
systemroot \Windows
resumeobject {34433bb8-628f-11dc-a941-001a6bcd5d3a}
nx OptIn
custom:42000002 \system32\winload.exe
custom:45000001 2
custom:47000005 301989892
3

Windows Boot Loader
-------------------
identifier {280ffa1e-f8a9-11dd-b0a9-001c26fdc6b4}
device vhd=[C:]\VMs\Win7\Win7.vhd,locate=custom:12000002
path \Windows\system32\winload.exe
description Win 7 VHD - Dev10
locale en-US
inherit {6efb52bf-1766-41db-a6b3-0ee5eff72bd7}
recoverysequence {280ffa1b-f8a9-11dd-b0a9-001c26fdc6b4}
recoveryenabled Yes
testsigning Yes
osdevice vhd=[C:]\VMs\Win7\Win7.vhd,locate=custom:22000002
systemroot \Windows
resumeobject {34433bb8-628f-11dc-a941-001a6bcd5d3a}
nx OptIn
detecthal Yes
custom:42000002 \system32\winload.exe
custom:45000001 2
custom:47000005 301989892
3

If it doesn't work, you can always run bcdedit /delete {guid} /cleanup and try again.

Here's what my Boot Manager (pressing F8 when I start up my machine) looks like now:

 My Win 7 Boot Manager

Now, I can boot up with my VHD mounted. Am I running a Virtual machine? No. I'm running Windows, on the hardware, with only the DISK Virtualized. I don't work for that team, but I'm guessing I'm losing 3-5% (that number came out of my butt) on the disk side - and nothing anywhere else. How do I know? Well, Windows Experience is smart enough to keep me from checking (although I could use another disk tester tool, but I'll leave that as an exercise to the Reader.).

Performance Information and Tools

I notice that Disk Management still gives me access to my was-C: drive, even though the VHD is now my C. My hardware C: drive got moved down, and it's E: now. Nice than I can still see it!

Disk Management (2)

What does the Device Manager say? It says the Msft Virtual Disk SCSI Disk Drive is there! That's the only "virtual" thing going on here. Notice I've still got my actual Video Drivers (running multiple monitors across multiple display drivers). All my stuff is there, because I've got, forgive me, less virtual and more machine. 

Computer Management

Hey, are those my four processors and my 8 gigs or RAM? Ah, yes, they are.

Windows Task Manager

Love it. I'm going to use the hell out of it.

A few caveats. One, I haven't figured out how boot off a VHD that is on USB or External Drive. I'm looking into it. It may be because there's no drive letter assigned yet, or that I'm an idiot. We'll see. Second, doing this makes your VHD less portable, because if you move it inside Virtual PC or to another machine, all the devices will freak out and try to reinstall (or maybe just not work) so be aware of that.

That said, I'm running Visual Studio 2010 Beta 1 without fear on my awesome hardware with hardware-speeds. Shiny.

Related Links

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 bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Demo Dashboard and IDE Extensions - Whirlwind Tour around .NET 4 (and Visual Studio 2010) Beta 1

May 21, 2009 Comment on this post [8] Posted in Open Source | Source Code | TechEd | Tools
Sponsored By

It's getting considerably easier to create and distribute Visual Studio Extensions.  With Visual Studio 2008, you can find extensions at the Visual Studio Gallery. There's also a very good VSX (Visual Studio Extensibility) Developer Center on MSDN that has a ridiculous amount of information on how to extend VS, and there are LOTS of great VS 2008 add-ins. The documentation is really well fleshed-out. It also includes info on the little-known, but totally awesome "VS Shell," but that's another post.

Visual Studio 2010 Beta 1 shows some new and interesting was to extend VS. One nice way to say it is "moving beyond add-ins." One example is that the Editor in VS2010 uses MEF (Managed Extensibility Framework) at its heart. It also uses Immutable Text Snapshots that make accessing the buffer from other threads easier. I talked to Noah Richards, one of the devs on the editor, in a recent episode of my podcast.

Terry Clancy points out how much easier it is. Seriously, the post is of epic length, check it out.

For the Visual Studio 2010 Shell, we’ve made targeted investments to the developer experience:

· No more complicated load keys! - Developers are no longer required to procure a Package Load Key (PLK) or a Shell Load Key (SLK) to develop Visual Studio 2010 Shell applications!

· No requirement for Registry. Packages can now be installed without requiring developers to update configuration settings in the Windows registry.  In many cases, this means that packages can now be x-copy deployed.

· Easier, more robust deployment – The redistributable shell installers have been updated to support Windows Installer source caching features, thus is during a repair, user’s won’t be required to point MSI to the original installation file or media.

· Improved SDK tooling – New templates have been added to make it easier to get started with the Visual Studio Shell, and create common types of extensions.  For Visual Studio Shell (Isolated Mode) developers, we’ve significantly improved performance of our F5 Debugging experience.

So what does a VS2010 extension look like?

Installing a VS2010 Extension with the Online Gallery and Extension Manager

Doing my talk on .NET 4 at TechEd this year, I got to use a new extension from the folks at Clarius Consulting called the Demo Dashboard. The idea is that while you're giving a talk at a conference like TechEd, the audience is using Twitter and a hash-tag that you set (I used #scottha) to give you real time feedback on your presentation. They can tell you if you're doing a good job, if your fonts are the right size, your speed, and they'll also give you a headcount of twitter users in your talk.

The code for the Demo Dashboard is up at Codeplex under Ms-PL while the extension itself is at the VS Gallery. It's actually a VS extension WITH extensions of it's own!

demo_dashboard

The plugin integrates with the Editor and hangs around (it can be collapsed) while you're giving your talk. For my talk, I used a debug build and just dropped it into the C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Components folder.

However, you can just go to the Extensions Manager and download it directly into Visual Studio:

Extension Manager (2)

If you download it manually from a website like the Visuals Studio Gallery, you'll notice the VSIX extension is associated with Visual Studio:

File Download (2)

You'll be warned that 'VSLauncher' is trying to run something, and if you accept it, the VSIXInstaller will do its thing. It's easier to just do it from inside the Extension Manager in Visual Studio.

The Demo Dashboard is entirely written in managed code and is actually a WPF app. Notice in this screenshot of the main XAML file that the plugin is actually running inside the WPF editor at the bottom of the split-screen view.

VsSpeakerCompanion - Microsoft Visual Studio (Administrator) (2)

They Demo Dashboard folks created a whole sub-plugin model you can use to extend this dashboard for your own conference. Using MEF (now built into .NET 4), they're pulling in a Twitter Service, and having Widget DLLs provide one or more widgets.

namespace CoolnessWidget
{
[Export(typeof(IWidgetProvider))]
[Widget(Name = "Cool Widget", After = "Font Size Widget")]
internal class CoolWidgetProvider : IWidgetProvider
{
IEnumerable<IWidget> IWidgetProvider.GetWidgets(Context context)
{
// creates an instance of our widget providing it the core context and twitter service to work with
CoolWidget widget = new CoolWidget(context, this.TwitterService);
return new List<IWidget> { widget };
}

[Import]
private TwitterService TwitterService { get; set; }
}
}

There's a lot of great examples in the code on clever ways to use MEF to make consumption of services easier by plugins. The WidgetManager class brings together a bunch or "hard to deal with" classes, then Exports them via MEF to make consumption easier by other classes and plugins downstream.

I think, however that it could be even MEFier. Remember, it's Ms-PL, and a CodePlex project, and there's a lot of TODO:'s marked in the comments, do we're free to change and improve the code. Go check it out.

Related Links

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 bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

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