Rants, rambles, news and notes from another geek

MSH Script: set-consolesize.msh

I often find that I have to switch between a number of different resolutions as part of my work. My laptop’s native resolution is too big for most projectors, so I have to switch to 1024x768. But I also like to have my MSH window pretty big… still windowed but almost full-screen.

But when you have your console window big at 1400x1050, it is too big at 1024x768.

So I wrote this little MSH script. To use it, you can pass it nothing, in which case it will set your active console to 132x45 characters, you can pass it one value which it will use as a width and calculate and appropriate height, or you can pass it both a width and a height.

$size = new-object System.Management.Automation.Host.Size 

[int] $width = 132 
[int] $height = 45 

switch( $args.Length ) { 
    2 { 
        $width = $args[0] 
        $length = $args[1] 
    } 
     
    1 { 
        $width = [int] $args[0] 
        $height = [int] ($width / 3) 
    } 
    0 { 
        "No args..." | out-host 
    } 
} 

"Setting to $width x $height" | out-host 

$bufferWidth = $host.UI.RawUI.BufferSize.Width 

if( $bufferWidth -lt $width ) { 
    $size = $host.UI.RawUI.BufferSize 
    $size.Width = $width 
    $host.UI.RawUI.BufferSize = $size 

    $size.Width = $width 
    $size.Height = $height 
    $host.UI.RawUI.WindowSize = $size 
} 
else 
{ 
    $size.Width = $width 
    $size.Height = $height 
    $host.UI.RawUI.WindowSize = $size 

    $size = $host.UI.RawUI.BufferSize 
    $size.Width = $width 
    $host.UI.RawUI.BufferSize = $size 
} 

Enjoy!

So Long and Thanks for All the Fish

We’ve all been keeping this under our hats for a while now, but since Scott has let the cat out of the bag&nbsp_place_holder;about his departure from patterns & practices, we can finally say our public goodbyes.

I first met Scott Densmore at Buca di Beppo in Seattle during the 2004 MVP Summit. A bunch of guys from Chris Sells’ Win Tech Off Topic mailing list had organized a dinner for those who were in town. Attending the dinner were a number of great people, most of whom I can’t remember. But I do remember first meeting Scott Densmore there.

Scott had come along with Jim Newkirk, who was at the time his boss in p&p. I’d already met Jim at the 2003 PDC a few months prior, but I hadn’t met Scott before. We all had a great time eating Italian food, drinking wine, and arguing about whether/why all software developers have OCD. (As I recall, Scott Densmore and Scott Hanselman said that we all do, Jim Newkirk and I said that we don’t, Shawn Van Ness was on the fence.)

But what I remember the most is when Scott looked over at Jim and said, “You know that job we were talking about? Peter would be perfect for it.”

“Ha ha ha,” I said, thinking he was joking and then put it out of my mind. After all, they wouldn’t actually take me at Microsoft would they?

After dinner, a bunch of people decided to head over to one of the hotels (the W?) for drinks. Scott and Jim offered to give me a ride and we continued to talk tech on the way over and after we arrived. At some point, I asked Jim, “So this job thingΓǪ were you serious?”

“Damn straight we are!” Scott chimed in.

The rest as they say is history. I later interviewed, was offered a job working with Scott and Jim in patterns & practices, accepted and then in August 2004 we moved out here to the Seattle area.

Once I got here, Scott took me under his wing and became my unofficial mentor. I had an official mentor who taught me the official MS stuff, but Scott taught me the down and dirty stuff. You know, like the best way to tell someone to go to hell and the best way to do what you want even when you’ve been told not to. That kind of stuff. The stuff that takes years to learn.

I sat as right hand to Scott as Enterprise Library 1.0 wrapped up and then struck out on my own on the CAB project. But I continued to depend on Scott for advice all the time. I still do.

We will miss Scott in the halls of building 5, but he won’t be that far away. I know we’ll still see each other a lot (our kids and wives are friends), but I will miss working with him. Maybe someday we’ll be able to work together again. I sure hope so.

Good luck on your new top-secret adventure Scott. I know you will do well.

CAB Sample Visualizations Now Available for Download

If you’ve been playing with the Composite User Interface Application Block, you may have found that it can be challenging to figure out what is going on inside your application at runtime. Since the entire application assembles itself dynamically using our ObjectBuilder dependency injection framework, how do you figure out what went wrong when your app doesn’t come up correctly?

We knew this would be a challenge for people so we included support inside of CAB for a thing called a Visualizer. A CAB Visualizer is a tool that runs alongside your application letting you peek under the covers of your app, while it is running. The Visualizer is a little CAB application in its own right to which you can add your own views, called Visualizations.

Perhaps I can best illustrate this with a screenshot of our BankTeller QuickStart running with the Sample WorkItem Visualization:

CAB_Visualizer

&nbsp_place_holder;As you can see, the Visualizer pops up a separate window that basically has&nbsp_place_holder;a TabbedWorkspace in it. Each visualization listed in the app.config file is loaded into its own tab.

Once loaded, the Visualization has access to anything that is exposed in the Root WorkItem of the running CAB application. This means you can inspect the WorkItem heirarchy (as shown in this sample), subscribe to Event Broker messages, or do special domain specific things things that only make sense within your application. It doesn’t matter.

We’re hopeful that the CAB community will eagerly adopt this stuff and start producing a d sharing all kinds of interesting Visualizations.

You can download the CAB Sample Visualizations from our codegallery site. Many thanks to Brad Wilson who worked hard to get this sample done and published.

Composite UI Application Block December 2005 Release Now on MSDN!

The Microsoft patterns & practices Smart Client Team is pleased to announce the MSDN release of the Composite UI Application Block for C# and Visual Basic .NET.

Please visit http://msdn.microsoft.com/library/en-us/dnpag2/html/cab.asp for more information and to download this release.

Highlights of the release:

  • Source code for the block in both C# and Visual Basic .NET&nbsp_place_holder;
  • Tests for Visual Studio Team System and NUnit in both C# and Visual Basic .NET&nbsp_place_holder;
  • Comprehensive QuickStarts&nbsp_place_holder;
  • Intergated documentation&nbsp_place_holder;
  • Fixed bugs found since November 2005 Release.

For a list of the code changes since the November 2005 release, please see this post by Brad Wilson.

Please do continue to send the excellent feedback either by sending an e-mail to pagcabfb@microsoft.com or in the web forums on our codegallery site.

Thanks to everyone who has been following the development of this guidance offering.

Go get it!

Penn Jillette - "This I Believe"

Disclaimer: This post is about religion, philosophy, atheism and the like. Stop reading if you are sensitive to these subjects.

I don’t know about you, but I love listening to NPR on my drive into work in the morning. It is about the only way I get my traditional news anymore and I find that it sets me up for a good day at work.

On Monday mornings, NPR does a weekly thing called This I Believe where people spend a minute or two reading a 500 word essay they’ve written that describes their personal beliefs. I have found that most of them are good, even if you don’t agree with the author. But every now and then one will come on that perfectly jives with your personal beliefs (or lack thereof).

This morning, was one of those times. Penn Jillette, author, lecturer and the bigger half of magical team Penn and Teller came out firing with both barrells this morning in his essay titled There is No God.

I believe that there is no God. I’m beyond Atheism. Atheism is not believing in God. Not believing in God is easy – you can’t prove a negative, so there’s no work to do.

Wow. As he said those words, they rang true for me. I apologize if this offends you, but it shouldn’t. I do not prosceletize my beliefs and this blog post is not about trying to convince or convert you. Just something I felt like I had to say about myself.

So, anyone with a love for truth outside of herself has to start with no belief in God and then look for evidence of God. She needs to search for some objective evidence of a supernatural power.

Again, Penn is right on the money here. You see, I’m a deep believer in the scientific method. I use it at work to debug code. I use it in my life when I can’t figure something out. All Penn is saying here is that people should use it to help them make a decision about faith.

Having taken that step, it informs every moment of my life. I’m not greedy. I have love, blue skies, rainbows and Hallmark cards, and that has to be enough. It has to be enough, but it’s everything in the world and everything in the world is plenty for me. It seems just rude to beg the invisible for more. Just the love of my family that raised me and the family I’m raising now is enough that I don’t need heaven. I won the huge genetic lottery and I get joy every day.

When I have had discussions with religious people about this topic, it is interesting to me how often they feel that religion provides some sort of moral compass that helps people be “good people”. I, like Penn, believe that you can be a good person without a religious order to do so. In fact, not having a forgiving god to fall back on should give you more reason to be good:

Believing there’s no God means I can’t really be forgiven except by kindness and faulty memories. That’s good; it makes me want to be more thoughtful. I have to try to treat people right the first time around.

Penn’s final point is, I think, one of his strongest. How many times are you watching something on television and you see the all-star athelete thank god for his successes. Or the family crying “praise the lord” when some brave person rescues their child from a flood. God gets all the props when people do well. But no one ever seems to give him/her any credit for the bad things.

Believing there is no God means the suffering I’ve seen in my family, and indeed all the suffering in the world, isn’t caused by an omniscient, omnipresent, omnipotent force that isn’t bothered to help or is just testing us, but rather something we all may be able to help others with in the future. No God means the possibility of less suffering in the future.

That is perhaps the best argument there is. Less suffering for more people.

Yes please. I’d like two of those and a side of fries.

(For the full transcript of Penn’s essay, visit NPR at http://www.npr.org/templates/story/story.php?storyId=5015557.)

Patterns & Practices Summit - Redmond - Dec 13-15

The patterns & practices Summits are starting again. Up next is the USA West event here in Redmond with keynotes by Alan Cooper, Anders Hejlsberg and GotDotNet CodeSlam with Chris Sell.

This time around I’m involved in two presentations, one with Brad Wilson and one with Brian Button:

Agile Development in the patterns & practices “war room” - Peter Provost & Brad Wilson

Learn how the p&p collaborative “war room” used an agile development process to create CAB and Enterprise Library. Discover how the p&p distributed teams work with contributors all over the world, and the techniques used to stay together as an “agile team”. You will hear about the lessons learned, what works best, and what not to do.

Build your own Enterprise Library - Peter Provost & Brian Button

Organizations typically need to create their own enterprise application framework. This session describes how to build this framework using the latest Enterprise Library. You will learn how to how to customize EntLib, how to “factor out” functionality you don’t require, how to integrate your own code and existing framework, how to package it to work well together, and how to version manage it going forward.

I’m really looking forward to these talks. I always have fun presenting with both of these guys.

For more information, registration information, presenter bios, schedules, etc. please see the patterns & practices Summit web site.

Hope to see you there!

Pandora Is the Coolest Thing EVER!

Wow.

Seriously.

Wow.

I was reading blogs, playing online poker, waiting for my DNS stuff to work itself out when I found this post by Keith Brown:

If you’ve not checked out Pandora, you should. I was just thinking the other day that I’d like to expand my music collection, and this is an excellent way to find other music that you like. But even better, once you’ve taught it your preferences, you can just minimize it and have a commercial-free radio feed with sounds that you enjoy, and it’s not all the same stuff you’ve been listening to for the last 10 years. The Music Genome Project behind is such a natural thing that it’s brilliant. Kudos to the folks behind it!

Oh, and you can listen to stations that your friends create, if you know their email address.

Sounds pretty interesting, eh? Not sure what to expect, I surfed on over to Pandora to see what was going on.

It begins by asking me to enter an artist or a song name to get started. I said Tool. (I love all of Maynard’s work.)

And it started pumping out music.&nbsp_place_holder;I “educated” it a bit, telling it that I also like Porcupine Tree, AC/DC, Soundgarden, Pelican, Kyuss and a few others. As it threw amazing tunes at me, I could give them thumbs up or thumbs down, just like with TiVo.

And in less than an hour, this thing had me dialed. Here is a sampling of some of the music it picked for me that I had never heard of before:

  • “Resurface” by Tides
  • “Last Nanosecond” by Zeni Geneva
  • “Best Case Scenario” by Mortal Treason
  • “Wall of Shame” by Course of Nature
  • “Song for Turner” by The&nbsp_place_holder;Major Stars
  • “Godzilla vs. Space Godzilla” by Collapsar
  • “Aquachimp” by Suzukiton
  • “Phantom #1” by The Major Stars

You can also do really cool things like click on a song and make a whole new station that is inspired by just that one song. At one point I selected the “Why did you play this song?” menu item. It said something like this:

Based on what you’ve told us so far, were playing this track because it features hard-rock roots, a subtle use of vocal harmony, mild rhythmic syncopation, a vocal-centric aesthetic and minor key tonality.

Another time, during a nice instrumental hard-rock/metal tune, I asked again and it said:

Based on what you’ve told us so far, we’re playing this track because it features hard rock roots, the use of experimental sounds, mild rhythmic syncopation, repetitive melodic phrasing and extensive vamping.

As I said at the beginning. Wow. I don’t know if I need anything else anymore. This combined with my new Etymotic ER-6i earbuds and I’m golden.

Yippee!! The Blog Is Back Up!

Whew. That was harder than it should have been.

It turns out that the half dozen sites I run on my WebHost4Life $9.95/month account were getting a little more traffic than I was really due for that level of service, so they encouraged me to upgrade. No biggie, I make a few bucks in ads here and there, so I can afford it.

Everything was going swimmingly until I accidentally fat-fingered the DNS entries for provost.org and peterprovost.org. Oops. Very bad.

Now, about 24 hours later, it seems to be mostly fixed.

I sure wish I could forcibly “expire” a DNS entry. Oh well. Live and learn. Thanks for your patience!

Jason Hogg Blogs!

I just wanted to let everyone know that our resident Web Services and Security guy, Jason Hogg, has started blogging.

He’s started out with a three part post titled, “Introduction, Integration and Securing Web Services” (Part 1, Part 2, Part 3) that lays out the roadmap for his upcoming work. Must read if you do anything in the integration/web-services space.

Let It Snow Let It Snow Let It Snow...

So my last post was about sunshine, but today’s post is about snow.

Today here in Seattle it snowed. And everyone is freaking out. People are cancelling meetings left and right and running home “in case the snow gets bad.”

Coming from Colorado, “snow gets bad” means more than a foot or so during the day. Anything less than that and you keep right on working.

But here, apparently, even the sight of snow send the locals into a panic. I’ve been told there are no snow-plows (I had to explain to someone today what one is), there are no sand/salt trucks. Nothing. So everyone just runs home.

Hilarious.