Scott Hanselman

Two Must-Have Tools for a More Readable Web

August 27, '10 Comments [61] Posted in Tools
Sponsored By

Here's how most folks use the Web. You get a link in email, Twitter, Facebook, IM, whatever and you open it in a new tab.

Instapaper - Google Chrome

Then, at some point in your copious free time, and possibly while reading other more pressing things, you'll read these 43 tabs, right? Even better, some of the articles are 8 pages long so you'll load up pages 1-4 and 6 and you don't even know why.

Then, maybe your browser crashes or your system reboots or something locks up or you get confused as to why you wanted to read that in the first place.

This is not cool and I refuse to use the web in this way anymore. Here's what I do.

Consider this new workflow. You'll either Read It Now or Read It Later.

First, Reading Stuff Later

Workflow Flow Chart - sorry if you are blind. There's text about this soon.

Whenever you find something long that you KNOW you want to read but you just don't have time now, don't open a tab. Save it to Instapaper. I've got a bookmarklet for Instapaper in my bookmark bar on all my computers in all my browsers. This important, hence the bold.


If it's not setup on all your machines in any browser where you might find content, you'll fall back to old habits and not use it. Take the 10 minutes and do it. The bookmarklet even works from within Google Reader. Anywhere you find stuff you want to read later. You can even have your Instapaper queue sent over to your Kindle if it makes you happy.

Example Workflow

Lets say I see this article by Phil Haack tweeted. I visit the page and while it looks interesting, he's SO loquacious and I'm busy now. I'll read it later.

We’re Not Paid To Write Code - Google Chrome

I'll click "Read Later" in my bookmarks bar, and I see this notification.


Fast forward some hours. I've got time and I've collected a few interesting bits that I'm looking forward to reading. I visit Instapaper and see this:

Instapaper - Google Chrome (2)

There's the articles I've saved lately, with new ones first. It knows what I've read, what I've starred and what's been articled.

Here's an interesting bit, while I can click the link for Phil and visit his site, I don't. I'll click "Text" for Phil's article using a filter. The Instapaper filter is a lot like Readability (more on that later) in that it removes the non-content parts of the article. It also adds a little bar at the top where I can select between readable fonts, change the width, font size and line spacing. Everything here is focused on text and making the content I'm consuming more soluble.

We’re Not Paid To Write Code - Google Chrome (2)

I can of course also read from my phone (I'm working on a Windows Phone 7 version) or whatever device makes me happy. It's the same queue.

Instapaper in iPhone Instapaper in iPhone

Second, Read It Now - with Readability

Sometimes I want to read something right now, but the site I'm looking at is just too busy. Recently I wanted to read this article on overclocking my motherboard. However the site looked like Las Vegas.

I have another bookmarklet called Readability.

Introduction - Gigabyte X58A-UD9 Extreme Motherboard Review  [H]ardOCP - Google Chrome

There it is...


And as Rob Conery likes to say pressing it "is like closing the car windows while driving on the freeway."

Introduction - Gigabyte X58A-UD9 Extreme Motherboard Review  [H]ardOCP - Google Chrome (2)

I find that the simple introduction of these two tools, Instapaper for Reading Later and Readability for Reading Now not only allow me to consume and collect MORE information than before, but I'm slightly less stressed out while I'm doing it. Goodbye 43 tabs.

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

The Programmer's Body

August 27, '10 Comments [86] Posted in Musings
Sponsored By

150568960I am broken, my friends. I've blogged before on:

Today I'm wearing a neck brace. Yes, I'm one of the "looks like they are suing someone" people. I hate those people and now I'm one of them.

I was totally fine, all was well, playing at the playground with 2 and 4 when I decided to do some chin-ups on the monkey bars. I can usually do ten good ones so I didn't think it was a big deal. I worked out like a fiend from age 15 to 25 so I thought I had some decent muscle maturity. Turns out that's not true and I'm tight as hell.

Sitting in front of a computer for the last 20+ years has broken me, my friends. I'm tense and some muscle in my neck ripped on chin-up #2 quite nicely. I dropped and haven't been able to move my head since Sunday. Now I'm doing physical therapy, chiropractic, exercises, stretching and generally being sad.

Fortunately Microsoft is pretty cool about this and only want to me to get my ass back to making money for the company get better, so they're getting me a desk that will be motorized and go up and down so I can sit AND stand while working.

I'm hoping this experience will be the kick in the head (and neck) that will get me back in shape. I'd hate it if I ran out of keystrokes.



Let this be a lesson to YOU, Dear Reader. Take breaks, stretch, make sure your desk area is setup ergonomically.

How do YOU keep your body, hands, back and neck from breaking down completely?

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

Installing Ubuntu 10.4 LTS on Windows Virtual PC on Windows 7

August 27, '10 Comments [51] Posted in Tools
Sponsored By

There's lots of info spread around on how to install various older versions of Ubuntu under various older versions of Virtual PC, but I didn't find any referring to the newish Ubuntu 10.4 and VPC on Win 7.

I did now find some useful command-line parameters in this blog post from Mark Wilson. I'm trying to make this post as complete as possible. If you have new or update or better info that is specific to the new changes in Ubuntu 10.4, let me know.

Here's what I did.

  • Download Ubuntu.
  • Download Windows Virtual PC.
  • Go into the Virtual Machines folder, and click Create Virtual Machine. Give you VM at least a gig of RAM. I have 8 gigs on my machine, so I give it probably more than was needed and allocated 3gigs.

Virtual Machines

When you create a Hard Drive, create a Fixed one rather than a dynamic one. I find this is faster and can avoid some strange disk errors with Ubuntu and the VM. I saw some strangeness with dynamically expanding disks.

In the Settings for your VM, tell it that the DVD drive actually be the Ubuntu ISO that you downloaded.

Ubuntu - Windows Virtual PC Settings (2)

Hit OK and start your VM.

IMPORTANT: When it starts booting, hit ESC when you see a blinking cursor, then you'll find yourself here. If you let it just boot without hitting ESC it'll start a bit, then give up.


Hit F6, then ESC. Then add vga=791 noreplace-paravirt at the end of the white command line so it looks like:


Hit Enter


You find yourself at a desktop...make sure that from Tools|Settings that your Network Card in the VM is attached to a REAL physical network card.


If you click in your VM, the mouse will be captured. You can get out with Ctrl+Alt+Left Arrow.


Double-Click Install Ubuntu and start the process using all the defaults.


Blah blah blah...


Wait a while...and IMPORTANT do not restart when it's done or you are screwed.


Instead, you need to make a few changes to make your new system bootable. Click "Continue Testing."

Now, go to the Places Menu in the top menu and click your File System. That will open up a disk browsing window with a GUID (yes, a GUID) in the title bar. You're going to need to type that, so get emotionally ready. You'll also want to rearrange the windows so you can open up a Terminal Window (from Applications, Accessories) and have the two near each other.


Now, open your Terminal. From Marks's blog, type:

sudo mount -o bind /dev /media/THATGUID/dev
sudo chroot /media/THATGUID/ /bin/bash
mount -t proc none /proc
nano /etc/default/grub

That last line will bring up a text editor.


From the text editor, change "quiet splash" to VGA=788 or one of the VGA codes from this table. Mark also recommends commenting outu GRUD_HIDDEN_TIMEOUT with a #. Oddly, while the codes for resolutions seem to work initially, X switches back to 800x600 when it starts.

Depth 800×600 1024×768 1152×864
1280×1024 1600×1200
8 bit vga=771 vga=773 vga=353 vga=775 vga=796
16 bit vga=788 vga=791 vga=355 vga=794 vga=798
24 bit vga=789 vga=792   vga=795 vga=799


Save with Ctrl-X, then run nano /etc/grub.d/10_linux from the terminal to edit one more file. Add noreplace-paravirt (remember that) after args="$4" like this:


Finally, run "update-grub" from the command line. NOW you can restart using the on-off button dealie on in the upper-right corner. I had to hit enter a few times in text mode to get it to finally restart. Ignore the error about Casper and just press enter.


At this point with Ubuntu 10.4 on Virtual PC:

  • No sound - faking it with modprobe snd-sb16 doesn't work
  • No mouse wheel - hacks found around don't appear to work
  • Difficult to change resolution.

Of course, using the Virtual Box virtualization tool works great with Ubuntu right out of the box and includes Virtual Additions that are custom to Linux and allow resizing, but I was (am) hoping to get this VPC thing working completely so I can stick with my one standard virtualization solution.

If you've solved any of these, specific to Ubuntu 10.4, then please let me know and I'll update this post.

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

How to change the default browser in Visual Studio programmatically with PowerShell and possibly poke yourself in the eye

August 21, '10 Comments [29] Posted in ASP.NET | ASP.NET MVC | PowerShell | VS2010
Sponsored By

UPDATE: Why my own MacGyver solution was brilliant in its horrible way, the folks over at World of VS have taken up the challenge and created a proper Visual Studio extension that you should use. I'll chat with them and get some details and maybe a write-up of how they did it. So, while I encourage you to enjoy my tale below, go get the World of VS Default Browser Switcher now!

I've heard and seen lots of complaints about how it's hard to set the default browser that Visual Studio launches when you launch a debug session for a website.

Step 0 - Adequate

Folks spend time hunting around the Tools|Options dialog in Visual Studio looking for setting. They eventually realize it's not in there at all, but instead you have to right-click on an ASPX page within a Web Project and click "Browse With..."

Right Click | Browse With

From this dialog you can click Set Default, which is totally obvious, right my daimies? Um, no. This doesn't work for ASP.NET MVC people who use other view engines and might not even have a .ASPX file in their solution. Plus, it's slow and irritating. Sa da tay.

Browse With - Default.aspx 

It IS interesting that I can add other browsers, like Google Chrome to this dialog via Add. Note that Google Chrome installs in C:\Users\Scott\appdata\Local\Google\Chrome\Application\chrome.exe which may not be c:\Program Files where you usually go hunting for these things.

"What my thought process was" - or - "CSI: Visual Studio Default Browser"

Where is this browser information stored? That was my first question. Remember that your computer is NOT a black box. Even good programmers make this mistake and they "flip this switch and hope that light turns on" without confirming that the switch and the light are connected with good wire and they know how electricity works.

I can guess all day, or I can open up ProcMon and just see for myself. Seriously, learn how to use this freaking tool. You can flip light switches all day or you can just open up the wall and see the wires. If you know how to use Process Monitor competently, people of both sexes will immediately find you more attractive. It's true. I get all sorts of free Tacos and Chips when folks look can I run ProcMon like Keanu Reeves can look sad.

I fired ProcMon up set it to only show the devenv.exe process, and I took a chance and set 'contains browser' for the path. If this didn't work I'd open the flood gates and start sifting a bit. I could also have said 'highlight' things with the word browser if I liked.

Process Monitor Filter (2)

I launch VS, open the Browse With dialog and sweet sassy mollassy. Look at all that good stuff.

Process Monitor - Sysinternals

Oh, fonts too small, let me zoom in.

Registry Zoomed In

Looks like we're reading values out of the registry at HKCU:\Software\Microsoft\VisualStudio\10.0\WebBrowser\ConfigTimestamp and...


...reading out of the browsers.xml file at C:\Users\Scott\AppData\Local\Microsoft\VisualStudio\10.0\browsers.xml.

What's in that file? I'm guessing XML with no schema, given it was probably 2003 when someone wrote this.

<?xml version="1.0"?>
<Name>Google Chrome</Name>

I've seen folks attempt to change this with various extensions in Visual Studio and using automation calls within Visual Studio, but to the best of my knowledge, this feature has been in here for years and years and there's no way to get at it programmatically.

Step 1 - Slightly Awesome

Interestingly as well, my first attempt at changing the browser programmatically consisted of this brilliance:

C:\Users\Scott\AppData\Local\Microsoft\VisualStudio\10.0>copy "browsers - firefox.xml" browsers.xml /y
1 file(s) copied.

But, it seems that those registry keys are serious and really used for something, because each time I opened Browse With... I found my changes thrown away, probably because VS isn't watching for file for change notification, but rather caching the file in memory.

Looks like a job for PowerShell (yes, I know can do this with batch files, but PowerShell is way batter, so nyah. Learn it.)

First I need to figure out what's going on in this registry. If I got to that key (by right-clicking the key within ProcMon and clicking Jump To), then right-click on the key in the Registry Editor I get:

Windows Registry Editor Version 5.00


Ok, so that's the location of the file we already know about, and  looks like the file size in hex, as well as some magic goo for CacheFileDateLastMod and LastConfigurationTimestamp.

One at a time. The CacheFileSizeBytes is easy. Did you know that the Windows 7 calculator was quietly upgraded while you were out there not learning how to convert hex in your head? It's true! (Yes, you can also just look at the decimal value in the Registry, but again, this is more fun. Yes, you could always convert between Hex and Dec in calc.exe, but again, fun. What's your beef? ;) )

Calculator in Windows 7 - Being Awesome in Programmer Mode

Click Dec(imal) and looks like 230 bytes, the size of my browser.xml file. What's the deal with those mod dates, though? They a probably a Windows file time, if they aren't ticks. Ticks are seconds since 1970-1-1 and a Windows FileTime is the number of 100-nanosecond ticks since 1601-1-1 rounded to the nearest millisecond. Why? Because 1601 was an awesome year. I mean, the Battle of Kinsale stopped the siege in Kinsale, Ireland, and famine killed half the Estonians. Sheesh, that was a horrible year! What were we thinking!?

Anyway, the easiest way to convert something you think might be a Date into a Date (and reason number 0x3b for you to finally learn PowerShell) is this line in PowerShell.

PS C:\> [DateTime]129268523480000000
Saturday, August 21, 0410 8:19:08 AM

Lemme do that again against a blue background with a screenshot so you really believe me.

Windows PowerShell, again, being awesome.

Oh yes, I'm on a horse. Cool. Those are FileTimes. So, tappity tappity and here's a PowerShell script to check the current values and output them for testing.

cd C:\Users\Scott\AppData\Local\Microsoft\VisualStudio\10.0

$browsers = [xml](get-content 'browsers.xml')
$browsers.BrowserInfo.Browser.Name + " " + $browsers.BrowserInfo.Browser.Path

$regkey = "HKCU:\Software\Microsoft\VisualStudio\10.0\WebBrowser\ConfigTimestamp"

"LastConfigTimestamp: " + ([DateTime](get-itemproperty $regkey).LastConfigurationTimestamp).ToLocalTime()
"CacheFileDateLastMod: " + ([DateTime](get-itemproperty $regkey).CacheFileDateLastMod).ToLocalTime()
"CacheFileSizeBytes: " + (get-itemproperty $regkey).CacheFileSizeBytes

I'll go and develop and run this script in the PowerShell ISE (that's S for Scripting) that you already have on your computer. Freaky how Microsoft sneaks stuff like this on your machine. If you've got Windows 7, you're already got this.

Windows PowerShell ISE (x86)

I run Visual Studio and click Browse|With... a few times and watch the values change. Seems I need the SET to my GET script, so why not something like this. I've made copies of browsers.xml like browsers-chrome and browsers-firefox. You can do the same if you like.

cd C:\Users\Scott\AppData\Local\Microsoft\VisualStudio\10.0 

copy '.\browsers - firefox.xml' .\browsers.xml
$regkey = "HKCU:\Software\Microsoft\VisualStudio\10.0\WebBrowser\ConfigTimestamp"

set-itemproperty $regkey -name LastConfigurationTimestamp -value (&{[DateTime]::Now.ToUniversalTime().ToFileTime()}) -type qword
set-itemproperty $regkey -name CacheFileDateLastMod -value (&{((dir .\browsers.xml).LastWriteTimeUtc).ToFileTime()}) -type qword
set-itemproperty $regkey -name CacheFileSizeBytes -value (&{(dir .\browsers.xml).Length}) -type dword

What I am doing in this script? I'm copying my browser xml over the main one AND I'm updating the TimeStamp to now to get Visual Studio to re-read the file. Visual Studio seems to be checking and triple checking and if the CacheFileDateLastMod and CacheFileSizeBytes don't reflect reality, it will freak out and just delete my file completely and rebuild a new browsers.xml from scratch. Paranoid.

You can go and fancy these scripts up with command-line parameters all you want because you're a better programmer than I, but I am all Save|As, baby. I have "UpdateDefaultBrowserToChrome.ps1" and, yes, wait for it, "UpdateDefaultBrowserToFireFox.ps1" and I sleep at night just fine, thank you very much.

I can right click on them on my desktop and select Run with PowerShell if I like.

Right clicking on my PowerShell script on my desktop could be more awesome. Darn my parents and the work ethic they instilled in me as a small child.

Step 2 - Extremely Awesome

You can run PowerShell scripts from the regular not-really-DOS command line like this if you like.

C:\Users\Scott\Desktop>powershell .\UpdateDefaultVSBrowserToChrome.ps1

I could even install PowerConsole and run these commands from INSIDE Visual Studio 2010 if I like and I want to rip a hole in the space time continuum. My, is that intellisense inside PowerShell inside Visual Studio? Double sun power!!!!

Powershell being awesome INSIDE Visual Studio 2010. Double Sun Power!!!!!

Still, this doesn't fit my mindless point and click mouse-like workflow. I'll go to Tools | External Tools and add two. Make sure you select the right PowerShell, which will be x86 even if you're on x64 so you correctly access the registry. I also checked Use Output window and added a single line of text at the bottom of each script.

External Tools 

Nice, but why not a toolbar?

Step 3 - Profit! I mean, Profoundly Awesome!

Right click on any Toolbar, this Customize and add buttons for External Tools (in my case #6 and #7) and...

Switchy Browser Toolbar buttons

Which gives me this when I click:

Pow, Sally. Browser changed to Chrome.

And shows this in Browse With, showing me it worked:

Browse With - Default.aspx again with Chrome

Yay! Enjoy.

Roll Up Instructions

  1. Go to C:\Users\YOURNAME\AppData\Local\Microsoft\VisualStudio\10.0
  2. Make a bunch of browser-whatever xml files for your browsers, or populate your list from Visual Studio, then make copies.
  3. Make yourself a few of these (or make one that switches if you're awesome)
cd C:\Users\YOURNAME\AppData\Local\Microsoft\VisualStudio\10.0

copy '.\browsers - CUSTOMBROWSER.xml' .\browsers.xml
$regkey = "HKCU:\Software\Microsoft\VisualStudio\10.0\WebBrowser\ConfigTimestamp"

set-itemproperty $regkey -name LastConfigurationTimestamp -value (&{[DateTime]::Now.ToUniversalTime().ToFileTime()}) -type qword
set-itemproperty $regkey -name CacheFileDateLastMod -value (&{((dir .\browsers.xml).LastWriteTimeUtc).ToFileTime()}) -type qword
set-itemproperty $regkey -name CacheFileSizeBytes -value (&{(dir .\browsers.xml).Length}) -type dword
"Bam, son. Browser changed to CUSTOM BROWSER."
  1. Add some external tools that call PowerShell with your new scripts as parameters.
  2. Add toolbar buttons if you feel like it.
  3. Go write a proper Visual Studio 2010 extension that does all this and packages it up in one click, put in on the VS Gallery and impress your friends and family. Crap. Now *I* need to do that for my next post, don't I? Shoot. Kzu? Give me a call and teach me how to do this.

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 228 - Performance of Silverlight on Windows Phone 7

August 20, '10 Comments [2] Posted in Podcast | Silverlight | WinPhone
Sponsored By

4 Windows Phone 7 Series Phones Scott talks to Jeff Wilcox, a Developer on the Silverlight Team about developing on Windows Phone 7. What kinds of performance can we expect from the phone? Jeff Wilcox shows Scott some tips and tricks on how to get the smoothest animations from your phone. Frame Rate Counters and more fun are explained!

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

Subscribe: Subscribe to Hanselminutes Subscribe to my Podcast in iTunes

Download: MP3 Full Show

Links from the Show

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.NET AJAX,MVC,Silverlight,Windows Formsand WPF. Enjoy developer tools like .NET reporting,ORM,Automated Testing Tools, TFS, and Content Management Solution. And now you can increase your productivity with JustCode, Telerik’s new productivity tool for code analysis and refactoring.

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

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