Scott Hanselman

Websense update - I'm not banned anymore!

July 31, '06 Comments [4] Posted in Musings
Sponsored By

A number of readers have emailed recently saying that the oppressive regime that is their IT department had banned this blog via their Websense tool because it was categorized as "Personal Web Sites; Society and Lifestyles."

I'm pleased to announce:

Thank you for writing to Websense.

The site you submitted has been reviewed.  We have made an update to the following URL in our master database to address this issue:

http://hanselman.com/blog/ - Information Technology

Categorization updates should be available in the next scheduled publication of the database.  A new database is published every business day, five days a week, Pacific Standard Time.  You should notice any updates referred to in this message within 72 hours.

Thank you for your assistance,

The Websense Database Services Staff

Yay! Welcome folks from behind the wall.

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

PUSHD reminder - it automatically maps network drives

July 31, '06 Comments [0] Posted in PowerShell
Sponsored By

I've blogged a few times about how cool PUSHD (and POPD) is from the cmd.exe prompt. It's one of the most powerful "DOS" commands that few folks use.

PUSHD, of course, maintains a stack of where you are in your file system. It will PUSH a directory on the stack and move you there automatically. Combined with a PROMPT variable that includes (somewhere) a $+, you'll get a very powerful way to move about.

Example from CMD>EXE:

C:\Documents and Settings\Scott>PUSHD c:\windows
C:\WINDOWS+>pushd system32
C:\WINDOWS\system32++>popd
C:\WINDOWS+>popd
C:\Documents and Settings\Scott>

One thing that I don't see a lot is PUSHD with UNC Paths, and how it will automatically map a drive for you, starting at Z: moving backwrads and will unmap them when you POPD.

Example from CMD.EXE:

C:\Documents and Settings\Scott>PUSHD \\SCOTTPC\D
Z:\+>PUSHD \\SCOTTPC\DESKTOP
Y:\++>POPD
Z:\+>POPD
C:\Documents and Settings\Scott>cd
\\scottpc\desktop
'\\scottpc\desktop'
CMD does not support UNC paths as current directories.

But, of course, I can't CD to a UNC path with CMD.EXE.

However, all these scenarios, plus CD'ing to UNC paths work within Powershell:

PS C:\Documents and Settings\Scott> pushd \\scottpc\desktop
PS Microsoft.PowerShell.Core\FileSystem::\\scottpc\desktop> cd \\scottpc\d
PS Microsoft.PowerShell.Core\FileSystem::\\scottpc\d> cd \\scottpc\desktop
PS Microsoft.PowerShell.Core\FileSystem::\\scottpc\desktop> c:
PS C:\Documents and Settings\Scott> PUSHD
\\SCOTTPC\D
PS Microsoft.PowerShell.Core\FileSystem::\\SCOTTPC\D> PUSHD \\SCOTTPC\DESKTOP
PS Microsoft.PowerShell.Core\FileSystem::\\SCOTTPC\DESKTOP> POPD
PS Microsoft.PowerShell.Core\FileSystem::\\SCOTTPC\D> POPD
PS C:\Documents and Settings\Scott> cd
\\SCOTTPC\DESKTOP

Nice stuff to know. Thanks to Ryan Carr for the reminder.

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

Sandcastle - Microsoft CTP of a Help CHM file generator on the tails of the death of NDoc

July 30, '06 Comments [12] Posted in PowerShell | DasBlog | Subversion | NUnit | NCover | Nant | XML | Bugs | Tools
Sponsored By

Sandcastle1Moments ago (my time) the Sandcastle CTP was released. Here's the Sandcastle Blog and here's a PowerPoint presentation on the new project. This is a very early CTP from Microsoft that supports generating documentation from any .NET language, much like NDoc.

It's great that Microsoft is paying attention to the whole "need for help files thing." However, be warned, this is uber-early stuff, and not very smooth. Actually, it's pretty darned rough. The instructions on what your batch/build/msbuild/powershell/whatever is going to need to orchestrate is here. The instructions are ghetto. Here's a slightly less ghetto Powershell script that will at least compile the example, assuming you have Powershell.

  • Assuming you have .NET 2.0 SDK and Powershell...you'll need to, of course, enable scripts via something like set-executionpolicy unrestricted
    • Note: Powershell has nothing to do with Sandcastle. I just did the script because it's wicked easy in PSH.
  • Download Sandcastle July CTP.
  • Run this Powershell script of mine to build the example: File Attachment: sandcastledoc.ps1 (1 KB)

Remember you'll need HTML Help Workshop if you're going to make CHMs (Compiled Help files). Here's the compiled example test.chm: File Attachment: Test.chm (31 KB)

Sandcastle for .NET 1.1

One note, I was able to get Sandcastle to generate help for a .NET 1.1 application, which is a very important developer scenario I hope they don't forget about. However, Sandcastle linked the 1.1 help up to the Framework 2.0 XML help for the .NET Framework BCL (Base Class Library) by default. If you change the sandcastle.config to refer to
<data files="%SystemRoot%\Microsoft.NET\Framework\v1.1.4322\*.xml" /> (line 48 in this CTP)
it appears to link up nicely for 1.1 apps even though Sandcastle uses .NET 2.0 for its reflection.

NDoc: The Death of a (great) Open Source Project

On a related note, it's going to take a while (6 months to a year?) for Microsoft to really get Sandcastle to the point where Kevin Downs got NDoc. Will this new tool be as rich and useful? Or will it be forgotten like HTML Help Workshop?

Recently Kevin Downs, the leader of NDoc, emailed a NDoc folks announcing that NDoc is dead. I was shocked to get this email, but sadly, not surprised. Here's an important part of his email:

Unfortunately, despite the almost ubiquitous use of NDoc, there has been no support for the project from the .Net developer community either financially or by development contributions. Since 1.3 was released, there have been the grand total of eleven donations to the project. In fact, were it not for Oleg Tkachenko’s kind donation of a MS MVP MSDN subscription, I would not even have a copy of VS2005 to work with!

To put this into perspective, if only roughly 1-in-10 of the those who downloaded NDoc had donated the minimum allowable amount of $5 then I could have worked on NDoc 2.0 full-time and it could have been released months ago! Now, I am not suggesting that this should have occurred, or that anyone owes me anything for the work I have done, rather I am trying to demonstrate that if the community values open-source projects then it should do *something* to support them. MS has for years acknowledged community contributions via the MVP program but there is absolutely no support for community projects.

Apparently Kevin started getting threats - yes, you heard right, threats - about a .NET 2.0 version and has been email-bombed. He's rightfully decided to bow out after a successful run.

If you're a fan of the whole N* stack, you've used NAnt, NUnit, NDoc, NCover, for years. We take for granted that these programs just work. They are fundamental. Some folks think they are our right to possess, but they forget about the real people with real lives that write this Open Source stuff in their spare time.

Hanselman Editorial Aside: It's a shame that Microsoft can't put together an organization like INETA (who already gives small stipends to folks to speak at User Groups) and gave away grants/stipends to the 20 or so .NET Open Source Projects that TRULY make a difference in measurable ways. The whole thing could be managed out of the existing INETA organization and wouldn't cost more than a few hundred grand - the price of maybe 3-4 Microsoft Engineers.

Phil makes a good point when it compares Open Source to "Source Available" with regards to Community Server. It's great that some OS products can turn into commercial apps with an OS "lite" version.

For "base of the pyramid" fundamental stuff like Build, Test, Coverage, Docs, will we pay for them? We should. Should we have given the NDoc project $5? Did NDoc help me personally and my company? Totally. Did I donate? No, and that was a mistake. I agree with Phil. Support those 5, 10, 20 truly Open Source projects with a little of your time or money.

Personally, as an Open Source project co-leader, I'd much rather folks who use DasBlog pick a bug and send me a patch (unified diff format) than give money.  I suspect that Kevin would have been happy with a dozen engineers taking on tasks and taking on bugs in their spare time.

We are blessed. This Open Source stuff is free. But it's free like a puppy. It takes years of care and feeding. You don't get to criticise a free puppy that you bring in to your home.

Goodbye Kevin and thanks for your hard work on NDoc.

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

Scott Hanselman: Developer Productivity Tools Video Part 3

July 27, '06 Comments [4] Posted in Reviews | PowerShell | TechEd | Speaking | XML | Web Services | Tools
Sponsored By

Scottvideo3When I was at TechEd I visited the Beantown.net INETA User Group and gave a (fairly ad-hoc) talk on Developer Productivity Tools. Jim Minatel loaned me his microphone and a copy of Camtasia and we recorded the talk. Thanks Jim!

It was a great crowd, a lot of fun. We had a number of "off the cuff" discussions about random stuff so I hope it doesn't take away from the gist of the talk.

The complete presentation was around 1 hour 45 minutes, so for online, Jim has split it into 4 segments. This week's segment is #3 and is available now and is about 30 minutes long. If you watch it in your browser, I recommend you double click on Windows Media Player to make the video go full screen. You can also download the full video.

It covers:

  • 00:00 Title
  • 00:23 Scott's introduction (repeated from the first video segment)
  • 00:55 Let's look at PowerShell
  • 02:45 Starting to show some code in PowerShell - "It's .NET at the command line."
  • 07:10 PowerShell Type extensions
  • 13:40 cd into the registry, files, and more
  • 17:00 Calling an existing .NET object (an RSS feed) and putting it in a variable

The remaining segment for next week will cover roughly:

  • Week 4: Active Words, Code Rush, SOAP Scope, XML doc viewer - 23 minutes

Here's a few notes about the video quality from Jim:

1. Why can't I fast forward or skip ahead through the video while it's streaming? Answer: We're running these off of a standard IIS server, not a Windows Media Server. IIS supports streaming, but not indexed playback during streaming to allow skipping ahead. If you want to do that, just download the whole video and all of the forwarding and timeline controls will be available in Windows Media Player.

2. Why isn't the video quality better? Is Camtasia to blame? No, Camtasia rocks. The raw videos I'm getting in Camtasia format are 100% clear, as if you were looking right at the presenter's monitor. The problem I've discovered is with the Windows Media Encoder. It just isn't well suited to on-screen presentation videos like this. The blurring and color blotching seems worst in Scott Hanselman's videos and I think I know why. When I watch the raw presentation, he's flying back and forth between open windows, background tools that pop up, and his desktop. It's just faster switching between very varied images than the encoder can seem to keep up with. I've twidled all the settings and got the best I can for now without doubling or tripling the file sizes. The other option would be to post an alternate version in Camtasia format and a link to download their playback codec [Scott: or a large FLV]. Because WMV is universal for my .NET developer audience, that has to be my common choice though.

There's also some other good screencasts up at Wrox. The growing list of videos is available at wrox.com. The first few videos in the series are:

I hope you enjoy them.

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

Dictionary Password Generator in Powershell

July 26, '06 Comments [6] Posted in Programming
Sponsored By

A fellow at work wanted a script to generate strong passwords from a dictionary file. The "l337" hashtable in the first line is the list of characters that we'll be replacing. The $skip variable adds a little variance so we won't (likely) generate the same password twice given the same word.

$leet = @{e=3;o=0;l=1;a=4;i='!';t=7}
$rand = new-object System.Random
$words = import-csv dict.csv
$word = ($words[$rand.Next(0,$words.Count)]).Word
if ($args[0]) { $word = $args[0] }
$leet.Keys | foreach-object { $skip = $rand.Next(0,3); if ($skip -ne 0){ $word = $word.Replace($_,$leet[$_]) } }
$word

Here's the dictionary I used: File Attachment: dict.csv (6 KB)

> ./generate-password.ps1
1ass!7ude
!nterd!ct
c4j013
par!ah
ruff!4n
r3cant
pl3th0r4
> ./generate-password.ps1 "quixotic"
qu!x07!c
quixo7ic
quix0tic

UPDATE: Jeff opines (correctly) passphrases are where it's at, so...

$rand = new-object System.Random
$conjunction = "the","my","we","our","and","but","+"
$words = import-csv dict.csv
$word1 = ($words[$rand.Next(0,$words.Count)]).Word
$con = ($conjunction[$rand.Next(0,$conjunction.Count)])
$word2 = ($words[$rand.Next(0,$words.Count)]).Word
return $word1 + " " + $con + " " + $word2

Yielding:

> ./generate-passphrase.ps1'
foible my finesse
bolster but permeate
augury my dogmatic
surfeit the mercurial
reconcile but dexterity
acarpous our inveigh
perilous and bequest
cognizant we foible
calipers and vilify
trickle our enzyme
vigorous we ominous
ascertain + dubious
suborn but middling

I totally agree that passphrases are better. I've advocated them to family and friends and have a few long-ass passphrases myselfs

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.