Scott Hanselman

Six Months in the Inside - Am I evil yet?

March 3, '08 Comments [58] Posted in Microsoft | Musings
Sponsored By

imageYikes, I got an email from HR today that said "Congratulations on your 6th month anniversary at Microsoft!" Has it been that long? Apparently so, although it feels like maybe three months, tops.

I learned a lot about the culture in the first three weeks. There is a lot of groupthink and echo-chamber type behaviors from folks that have been there a long time, but most people I've interacted directly with are always re-asserting their independence and catching themselves thinking old-style thoughts, which is comforting to me.

It's one thing to exhibit an undesirable behavior, but it's much worse to be ignorant of that behavior. I think Microsoft's biggest problem right now is answers like "We've always done it that way," whether it's naming, versioning, documentation, conferences, whatever. I like to keep things a little more agile and tighten up the feedback loop. I think a process of continual improvement and self examination is so important.

What is my job?

I get this a lot. Seems like an obvious question. I took the title "Developer Division Community Liaison" because it was very broad. Phil likes to say I'm paid to be Scott Hanselman, but I don't like that very much because it implies some kind of punditry. If I ever start sounding Dvorak-esque, please let me know.

When my dad or the public (read: non-computer person) asks what my job is, I tell them "I'm writing a book that will never end (blog) and create training materials like videos and tutorials for Microsoft." When a technical person asks, I say the same thing with more detail. Also, if ScottGu coughs, I get him lozenges. Ahem. Yessir!

My boss runs http://www.asp.net, http://www.silverlight.net, http://www.windowsclient.net, etc, but our team is very small, only four FTE (Microsoft-speak for Full Time Employees). But, we're growing. At Microsoft we're graded on our ability to "meet our commitments" and my commitments (which were written up in a formal meeting) are mostly metrics like "write n number of significantly technical blog posts, write such-and-such book, give x number of presentations." Commitments are supposed to be a stretch, and I've got 7 different significant commitments so I've had some really late nights. The "liaison" portion of the job is also becoming more formalized in the next month, so I may take over some specific MVP-type groups.

This paragraph added for clarity (see comments): No, my job isn't to blog, although the blog is a good place to point to stuff I do. Folks originally wanted me to make a blog at msdn.com but I thought that was silly. For my day job, I do screencasts, tutorials, presentations, community outreach, books, articles for MSDN, internal presentations, advocate for the customer (this takes up more time than you'd think), provide direct feedback to the product groups, route your feedback (you know this if you've ever emailed me with a problem) and troubleshoot obscure bugs, as well as working on technical strategy with certain wonks at Microsoft. As I said in the Blue Badge post, the podcast is still belongs solely to Carl and me and I pick the guests with tips from the audience.

When I write, there's no editorialization, meaning that no-one reads my posts before I send them, although I often check with product groups to make sure I'm not completely wrong on some technical detail. Microsoft is pretty mellow and says "blog smart." That said, I'm sure I could get fired if I wrote something truly bogus, but otherwise there's no ghost writing. (Yes, ScottGu still writes his own posts...so far).

Sometimes ScottGu will email me with a one line note like this one yesterday about IIS7 and FTP7 "This might be a cool blog post to cover.  It has a ton of new features (including integration with membership/roles), new admin tool and a bunch of cool new features."

However, I already had FTP7 on my list of cool things since I've been talking to the IIS7 team and that'll hopefully be done today or tomorrow. It's funny we usually think about the same general things and I'm mostly either a day ahead or a day behind whatever cool thing is going on.

Am I Evil yet?

P0000259 I haven't been invited to any evil (or eeeveeel) meetings and haven't found the evil mailing list. As far as I can see Microsoft is less evil as it is unorganized. Within groups, communication is pretty good, but between divisions is trickier because there's always a doppleganger out there, like Evil Spock who is working on the same thing you're working on. I guess that means there's a Scott Hanselman out there without a goatee writing a similar post as this?

That pic is me in my early twenties. If Chins Could Kill...I'm trying to find a non-bearded pic but that's the best I can do! That guy doesn't look evil, right?

Working Remotely

0900aecd8054e6ca_null_null_null_10_09_06-2 The Remote Office thing is still lonely, but I'm making up for it with regular lunches and LOTS of video conferencing thanks to ooVoo. My master plan to make a robot out of a Roomba has fizzled due to lack of a battery (and my lack of a mechanical engineering degree) that could last a full day. My new "Plan B" is get a 42" LCD (as seen at right) and make a Portal into my house.

What have I done well?

I thought the first practice videos turned out well, and I have taken all the feedback you've given and applied it to a new four-part tutorial on MVC that will be coming soon, hopefully formalizing those best practices.

I think the Wiki (beta) is turning out pretty cool. I seeded it, but there's already contributors who have exceeded the number of posts I've added and greatly improved it.  I think there's a lot of work we can do to make the administration better for moderators, but it's looking nice regardless, so far.

I've had a lot of fun speaking lately. When I spoke while I was working at Corillian, I usually had to take vacation days or do it on the sly side, although for large conferences my boss at the time was exceedingly cool about it.

What have I done poorly?

I am not managing my time very well and since we've got a 3 month old and an enthusiastic 2 year old and I'm working from home I feel like days are very fragmented. It's good to be home, but my wife thinks I'm actually around less which is definitely a not good thing to feel. I need to do a better job of getting up earlier and banging out work. I like being informed, but I think I may need to go on an info-diet to find more time to get things done.

Have you started a new job in the last year? How is going for you?

Related Posts

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 attach MP3 sound effects to PowerPoint animation elements

February 29, '08 Comments [6] Posted in Musings | Tools
Sponsored By

imageI'm working on a presentation for the DE (Developer Evangelists) the day before Mix. Since so many MSFT folks are getting together in one place, we usually take advantage and do some side meetings, etc.

I'm doing this cool slide (at least I think so) and I added a small animation as picture comes in from off screen.

I wanted to add an MP3 to that effect so that it'd play as the animation happened. I wandered around the UI for a white, trying to figure this out.

It's a little counter-intuitive, but each Effect Element can have its own sound attached, so you have to Right Click on the Element in the Custom Animation Pane, as seen at right.

Click Effect Options and you'll see this dialog:

image

When you select Other Sound... you'll get a File Dialog prompting you for a WAV file. Here's where I got stuck for a moment. It ONLY allows WAV files and I wanted to play an MP3. Well, I could have converted the MP3 to a WAV, but not only would it have made the file a lot bigger, but I would have had to go looking for a converter.

It turns out that the WAV format can support MP3-compressed audio as long as the WAV header (wrapper) is correct. So, rather than "uncompressing" my MP3 into a fat WAV (using RAW PCM Audio), I can just run this little command line app "MP3 Decoder" and it will create a .WAV file with the MP3 inside.

Run the little app by Niklas Beisert and you're on your way. The file will be roughly the same size (still small!). Attach the "now WAV" to your animation and you've just successfully attached an MP3 to an animation in PowerPoint.

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 102 - Mike Pizzo on the ADO.NET Entity Framework

February 29, '08 Comments [13] Posted in ASP.NET | Learning .NET | LINQ | Podcast | Tools
Sponsored By

figure1 My one-hundred-and-second podcast is up. In this episode, I sit down with Michael Pizzo, the Principal Architect of the ADO.NET Entity Framework. He gets technically down and dirty pretty fast and I get answers to all the hard questions like "Are LINQ to SQL and LINQ to Entities competing?" and "Which one should I use?" A very cool guy and a fun interview that finally set my head straight about the data stack.

Subscribe: Subscribe to Hanselminutes Subscribe to my Podcast in iTunes

If you have trouble downloading, or your download is slow, do try the torrent with µtorrent or another BitTorrent Downloader.

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.

Check out their UI Suite of controls for ASP.NET. It's very hardcore stuff. One of the things I appreciate about Telerik is their commitment to completeness. For example, they have a page about their Right-to-Left support while some vendors have zero support, or don't bother testing. They also are committed to XHTML compliance and publish their roadmap. It's nice when your controls vendor is very transparent.

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

The Weekly Source Code 17 - ASP.NET MVC Community Code Edition

February 27, '08 Comments [15] Posted in ASP.NET | ASP.NET MVC | Source Code
Sponsored By

I've been working on new Videos for ASP.NET MVC and the Mix conference, and I wanted to read some code that folks have created using the December CTP of ASP.NET MVC. There's a lot of good changes coming in the next Preview release and that feedback comes from active community members, so it's always good to read real source of real apps to see what folks are doing.

And so, Dear Reader, I present to you seventeenth in a infinite number of posts of "The Weekly Source Code." Here's some source I was reading this week.


CodeCampServer (source)

This application is a free open-source Code Camp management application, so if you're thinking of running a Code Camp, start here. As of this writing, it's build on the December drop of ASP.NET MVC and also uses StructureMap, IESI Collections, MVC Contrib, log4net, RhinoMocks, NUnit and NHibernate. Aaron Lerch and others have been working on this app for the Indy Code Camp, so if you're around Indianapolis check them out.

Better Things

One thing that's fun to see when reading code is when folks name classes something like "BetterMousetrap," where the class name advertises that it's superior to something specific. This project has "BetterMvcHandler:"

public class BetterMvcHandler : MvcHandler
{
	protected override void ProcessRequest(IHttpContext httpContext)
	{
		try
		{
			base.ProcessRequest(httpContext);
		}
		catch (Exception ex)
		{
			throw new Exception("Route used:" + RequestContext.RouteData.Route.Url, ex);
		}
	}
}

All they are doing is catching all exceptions, showing the current URL via the route, and pushing the original exception down a level. Smells a little iffy to me, but the valuable thing for the MVC Team to notice about this is that people need more insight into what is happening with Routes while debugging.

Here they use RhinoMocks so they can test their controllers without firing up ASP.NET/IIS. This will change some in the next drop, but this is totally the right idea. I've got a full 20 minute video coming showing just how to do this very thing:

namespace CodeCampServer.UnitTests
{
    public static class Extensions
    {
        public static IHttpContext DynamicIHttpContext(this MockRepository mocks, string url)
        {
            IHttpContext context = mocks.DynamicMock();
            IHttpRequest request = mocks.DynamicMock();
            IHttpResponse response = mocks.DynamicMock();

            SetupResult.For(context.Request).Return(request);
            SetupResult.For(context.Response).Return(response);
            SetupResult.For(request.AppRelativeCurrentExecutionFilePath).Return(url);
            SetupResult.For(request.PathInfo).Return(string.Empty);            

            return context;
        }
    }
}

Law of Demeter

When creating lots of Domain Objects, like in this application, on of the things that comes up a lot is the validity (or not) of the Law of Demeter. Basically this law is a design guideline that says your object should avoid reaching deeply into other objects.

For example, in this application, there's an Attendee object. It has a Contact object, which has things like FirstName, LastName, Email, etc. If you see something like this:

[Test]
public void ShouldGetProperName()
{
	Attendee attendee = new Attendee();
	attendee.Contact.FirstName = "Homey";
	attendee.Contact.LastName = "Simpsoy";
	Assert.That(attendee.GetName(), Is.EqualTo("Homey Simpsoy"));
}

You might want to ask yourself if reaching "two steps" in in order to get the FirstName and LastName is a good idea as now you're coupling the caller not only to Attendee, but also Contact, not to mention you're assuming that Contact isn't null. If you follow this rule religiously (and I'm not saying you should) the downside is that you end up with a bunch of wrapper methods like GetFirstName, etc. on your top level object. It's something to think about. Perhaps it's less valid in the context of a Domain Model where all these objects find themselves intertwined, but if you find yourself writing a.b().c().d.something, your sense of code smell really should kick in.

Helper Things

Another thing to look for when reading code that uses a framework you've worked on is methods or classes named "Helper." This is another clue that maybe your framework isn't meeting the downstream developer's needs, especially if they have a large number of helpers to get-around issues with your framework.

 public static class LinkHelpers
 {
     public static bool IsActive(this ViewPage thePage, string controller, string action)
     {
         return thePage.ViewContext.RouteData.Values["controller"].ToString() == controller &&
                thePage.ViewContext.RouteData.Values["action"].ToString() == action;            
     }
     
     public static bool IsActive(this ViewMasterPage thePage, string controller, string action)
     {
         return thePage.ViewContext.RouteData.Values["controller"].ToString() == controller &&
                thePage.ViewContext.RouteData.Values["action"].ToString() == action;            
     }
...

There are a number of extension methods in this project where the developers have spot-welded new methods onto ViewPage and ViewMasterPage as mix-ins or extension methods. Interestingly though, they never ended up using the Helpers! I usually create helpers after things really start to hurt and I've moved into the Refactoring stage. It's usually a good idea to get a holistic perspective on the project first, rather than creating a number of Helpers and associated overloads in anticipation of future pain.

Again, I'm not picking on this project, rather just using it as a jumping off point for discussion. It's certainly easy to read code and throw stones. As Linus likes to say, "talk is cheap, show me the code."


Kigg - Digg clone in ASP.NET MVC (Live Demo)

There's a good writeup on how Kazi Manzur Rashid and Sonu wrote this Digg Clone. They are doing a couple of interesting things in their application.

JSON and Ajax

They are using the new DataContractJsonSerializer that was added in .NET 3.5 and lives in System.Runtime.Serialization.Json and lets you serialize your objects to and from Javascript Object Notation (JSON). They created a json.aspx file that takes the current ViewData and serializes it to JSON:

    Response.Clear();
    Response.ContentType = "application/json";
    Response.Write(ViewData.ToJson());

Simple and it works. Whenever a controller wants to make JSON, they just ReviewView("Json", result). Personally, I would have made a JsonViewEngine and had the controller set its ViewEngine when neeeded, but suppose that would have rendered (ahem) the first parameter of RenderView moot.

They make good use of LINQ. Reading a nice clean LINQ query always makes me smile.

public TagItem[] GetTags(int top)
{
   return Tags.Select (
                  t => new TagItem {
                      ID = t.ID,
                      Name = t.Name,
                      Count = t.StoryTags.Count()
                  }
               )
               .OrderByDescending(t => t.Count)
               .ThenBy(t => t.Name)
               .Take(top)
               .ToArray();
}

Complex Views and ViewData

The main pages are fairly complex and include data from a number of different places, listing stories, tag clouds and categories. There's also multiple forms (remember the days when you could have multiple forms) on a page, like for the search box as an example. They've created a abstract BaseViewData class that others derive from, adding extra bits of data for their specific view.

For example, the Story Detail Page adds to the standard ViewData:

    public class StoryDetailData : BaseViewData
    {
        public StoryDetailItem Story
        {
            get;
            set;
        }
    }

And then the StoryController has this clever method that gets ViewData only if the type T is a BaseViewData and has a public parameterless constructor (that's the new() at the end):

private T GetViewData<T>() where T : BaseViewData, new()
{
    T viewData = new T();

    viewData.IsAuthenticated = IsUserAuthenticated;
    viewData.UserName = CurrentUserName;
    viewData.Categories = DataContext.GetCategories();
    viewData.Tags = DataContext.GetTags(_topTags);

    return viewData;
}

It populates the methods shared by the base class and returns the derived type. I wouldn't have come up with this on my own without some thought.

Each of these projects have different styles but each is a good place to start looking when writing a new ASP.NET MVC Application.


Related Posts and Links to Read

Technorati Tags: ,,

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

Amazon Kindle

February 26, '08 Comments [40] Posted in Reviews
Sponsored By

DSC_0031UPDATE TWO MONTHS LATER: Now that I've had the Kindle for two months, I still think it's horribly ugly, but I use it EVERY DAY. I subscribe to the NYTimes, to Newsweek and a few blogs. I've purchased 12 books so far and converted/downloaded 20 free ones. The battery life is very good as long as you only turn on the Wireless when you need it. Additionally, I've started using the Kindle as my primary Audible audiobook device and love it. I just slapped a 2gig SD card in and I've got 50+ hours of audio. It's the only device I need for long plane rides.

A year ago I had a Sony Reader for a month and reveled in its awesome screen. It's true, in case you haven't heard, e-ink looks like paper. At least, as close to paper as anything that's not paper can look.

I finally broke down and got an Amazon Kindle for my birthday.

If you are already bored with this post and want to stop here, here's the conclusion. I love it.

Why?

The Good Stuff

This device exists for one reason and one brilliant reason only, for Amazon to more easily extract money from my wallet. It's an entire device built around the concept of "One Click" ordering. You do get a second chance if you accidentally order a book, but it's designed for the impulse buyer. If I hear about a book on NPR or The Daily Show, I can get it immediately. If I read a nice book cover at the Airport bookstore on a long layover, I can buy it.

Once you realize its purpose and accept it and are OK with it, you'll like this as well. I like the "any book in the world in one minute or less" (and Bezos is not kidding, the books show up FAST) that I'm disappointed when a book isn't available.

The screen interface is clean, if slow to redraw (because of the e-ink), with just a few obvious usability things that I'm sure they'll fix with regular updates.

DSC_0032I was also thrilled to see that it integrates with Audible, so I popped a two gig SD card in and grabbed a gig and a half of books (about 2 weeks of audio) from my Audible subscription. Why not use a MP3 player? I have had a love/hate relationship with my iPod and consequently have faded away from using it. I find myself listening to XM Radio more often, or using a Zune with the All You Can Listen To Zune Pass, so my iPod has kind of laid fallow. At this point, I just really like the idea of all my books, audio or otherwise, on this one device. It also has a surprisingly loud speaker so I can listen to books without headphones which surprised me.

DSC_0034The Kindle also has an experimental mobile web browser. I say Mobile, because you should consider the Kindle like a really slow Mobile Phone with a slow to redraw grayscale screen. My blog recognizes the Kindle as a mobile device and renders nicely, even with pictures.

This discovery was just an added benefit. I can also check email (painfully) with Gmail's mobile interface. This alone justified, to me, the Kindle's keyboard that I'd previously written off as silly. The Kindle has the potential to be quite the handheld computer if Amazon allows it. For now, I'll just bookmark my new Mobile Home Page http://cantoni.mobi and be happy.

It works great with PRC Mobile eBooks (a standard) and as such the whole Baen Free Library (and many other similar ones) are available to me.

The Kindle has its own email address so I can send myself PDFs for 10cents and they'll show up pretty nicely. No, I haven't done PDFs with big images or code, but I can tell you that technical books looked lousy and hard to read on the Sony Reader, and I have no reason to think that the Kindle would be better.

There's a collection of newspapers available, so I got a trial subscription to the NYTimes. I love it. It shows up every day and it's got pictures and everything. Reading the newspaper has naturally fit into my day much more cleanly now, and I'm not in front of a browser for 30 minutes reading. It's more linear in that respect and I prefer it.

It's also got blogs, but they cost a buck or two and I'm not in there so phooey on them. ;)

When you're in an EVDO coverage area, the wireless is surprisingly fast.

The "Meh" Stuff

The Next Page buttons run almost the length of both sides of the thing so I keep accidentally turning pages. Also, I've fallen asleep holding the buttons at least twice and found myself with a dead battery and on the last page.

It's ugly. From a design perspective, it's just not sexy. That said, the Sony Reader wasn't exactly clever either. If I were Amazon I would have gotten the iPod designers on board to help. I will say that it's design is more thoughtful than the Sony Reader's and after a few days I stopped caring. It just works.

The screen is paperback book sized, and I wish it were about 30% larger. There's just too much bezel framing it.

It's still $150 more than I'd like it to be, but I bought it anyway because I KNOW I'll use it. I use it every day to read the newspaper, which was also a surprise. (see above)

DSC_0034 DSC_0033 DSC_0032 DSC_0031

Do be warned, there isn't coast-to-coast coverage. If you live outside the US, or outside a decent-sized city, you won't have coverage. That said, I still live an hour outside of Portland and I have coverage and I likely will have coverage everywhere in the US that I'd visit on a business trip.Be sure to check the Kindle Coverage Tool.

Conclusion

I'm thrilled with the purchase, overall. The wireless ability is the key. I didn't want YET another device to dock to my machine. I am so sick of syncing things and looking for tiny USB cables. I even think I could get a device like this for an elder relative and they'd be able to use it without trouble. I suspect that the Kindle will have me reading more often (and I already read a lot). Recommended.

Related Posts

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.