Scott Hanselman

This Developer's Life 1.0.9 - Management

December 4, '10 Comments [5] Posted in Podcast
Sponsored By

dilbert-boss In this episode of This Developer's Life 1.0.9, Rob and I talk to technical folks who have moved on up to Management - and what it means to them.

  • Mark Freedman shares his story about clawing his way out of a successful career as a manager at a rather large, growing company. A good job, lots of respect, and he hates it.
  • Bertrand LeRoy talks about charting his own path right at Microsoft after graduating with a PhD in Physics and how he maintains a career right down in the middle of manager and coder.
  • Todd Baesen talks about moving from Chemical Engineer to Nuclear Engineer on the USS Enterprise (literally), and then to senior management at a big engineering firm in the SF Bay Area.

You can download the MP3 here (58 minutes) and visit our site at http://thisdeveloperslife.com.

Please consider subscribing with iTunes, or Zune. Or if you have a BitTorrent client and would like to help save us bandwidth money, as well as the bragging rights of downloading legal torrents via RSS, get our Torrent Feed at ClearBits.

The bandwidth and other costs for this week's show were picked up by Twilio:

Need SMS or Voice call capabilities for your application? Check out Twilio.

… and SublimeSVN

sublime

Easy Subversion Management for Windows

See you next time!

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 243 - Knockout JavaScript with Steve Sanderson

December 4, '10 Comments [1] Posted in ASP.NET | ASP.NET MVC | Javascript | Open Source | Podcast
Sponsored By

homepage-exampleSteve Sanderson has created an interesting MVVM JavaScript library for ASP.NET MVC called Knockout. Yes, you read that right! MVVM on the client, MVC on the server, living together happily may make a more enjoyable development experience. All this plus HTML, data binding, jQuery, text boxes over data, ASP.NET and more.

Download: MP3 Full Show

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

Also, please do take a moment and review the show on iTunes.

Subscribe: Subscribe to Hanselminutes or Subscribe to my Podcast in iTunes or Zune

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 Forms and WPF. Enjoy developer tools like .NET Reporting, ORM, Automated Testing Tools, Agile Project Management Tools, and Content Management Solution. And now you can increase your productivity with JustCode, Telerik’s new productivity tool for code analysis and refactoring. 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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselminutes Podcast 242 - The Plight of the Remote Worker with Pete Brown

December 3, '10 Comments [6] Posted in Podcast | Remote Work
Sponsored By

LiveMeeting with a Panorama viewScott and Pete have both worked for Microsoft for a while now as remote workers. What works, what doesn't? Why is Scott obsessed with video portals and cameras and does it help? Pete shares his thoughts and tips on the remote life.

Download: MP3 Full Show

Links from the Show

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

Also, please do take a moment and review the show on iTunes.

Subscribe: Subscribe to Hanselminutes or Subscribe to my Podcast in iTunes or Zune

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 Forms and WPF. Enjoy developer tools like .NET Reporting, ORM, Automated Testing Tools, Agile Project Management Tools, and Content Management Solution. And now you can increase your productivity with JustCode, Telerik’s new productivity tool for code analysis and refactoring. 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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

BIN Deploying ASP.NET MVC 3 with Razor to a Windows Server without MVC installed

November 24, '10 Comments [39] Posted in ASP.NET | ASP.NET MVC
Sponsored By

If someone says "just bin Deploy it" they mean "deploy the application with the dependencies copied into the application's /bin folder, rather than running an MSI that installs the dependencies into the Global Assembly Cache (GAC)."

You may not have administrative control over your Web Server and your host may not want you running installers when new stuff like ASP.NET MVC 3 and Razor comes out. You'll want to "bin deploy" these new technologies.

Here's two ways. The simple way and The Awesome Way.

The Manual Way to BIN Deploy ASP.NET MVC 3 with Razor

On your development machine that has ASP.NET MVC 3 installed you have a C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 3 folder and a C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages folder. In those folders are "Assemblies" folders.

Windows Explorer showing the Assemblies that ASP.NET MVC and Web Pages needs for BIN Deployment

ASP.NET MVC itself references these additional assemblies.

  • System.Web.Mvc (well, we ARE this assembly, actually)
  • Microsoft.Web.Infrastructure
  • System.Web.Razor
  • System.Web.WebPages
  • System.Web.WebPages.Razor

And the default Web.config for projects also expects:

  • System.Web.Helpers

After you deploy your ASP.NET MVC 3 Razor application, you'll need to manually copy these five assemblies to the \bin folder of your deployed application.

NOTE: It's possible to just reference these assemblies directly from your application, then click properties on each one and set copyLocal=true. Then they'd get automatically copied to the bin folder. However, I have a problem with that philosophically. Your app doesn't need a reference to these assemblies. It's assemblies your app depends on. A depends on B that depends on C. Why should A manually set a dependency on C just to get better deployment? More on this, well, now.

Now, you likely remember that "If you're using XCOPY for deployment, you're doing it wrong" so you're likely wondering how to make this deployment process less manual and more awesome.

The Alpha-Geek Show-Off Fancy-Pants Future-Proofed Way to BIN Deploy ASP.NET MVC 3 with Razor

I created a custom Windows 7 Virtual Machine that had only IIS7 and .NET 4 installed, plus Web Deploy, and nothing else in order to test this scenario. This machine has never seen ASP.NET MVC 3 or Razor and we're not installing anything on it. It's our pretend "shared host."

My custom Virtual Machine without ASP.NET MVC installed

In my ASP.NET MVC Application, I'm going to create a folder called "_bin_deployableAssemblies." Yes, that's a underscore in the front. IIS will not serve from folders whose first character is an underscore. You can thanks FrontPage for that feature. In fact, this guarantees that even if you accidentally copy this folder up (don't) it won't be served. Apparently I got bad info on this from the IIS team. I'm looking into this statement as it's incorrect.

  • Create a _bin_deployableAssemblies folder.
  • Copy the assemblies we want bin deployed into this _bin_deployableAssemblies folder.
  • Select them all, right click and hit properties. Set their Build Action to "None."
  • You are expected to check these into source control as well.

Here's my Solution so far:

My Solution Folder View

Here comes the secret awesome sauce.

NOTE: You're reading this on some random dude's blog, so lower your expectation of support now. No, lower. Bit lower. There. Yes, that's zero support. If this accidentally formats your harddrive or deletes your source code, kick yourself hard so you'll wake up to the previous level of Inception, specifically the one where the skinny kid from Third Rock From The Sun is walking on the ceiling. Be careful. Make backups.

Get ready, because we are going into the belly of the beast. This is for VS2010, to be clear. Also, your Program Files folder will vary depending on your x86/x64 version of Windows.

  • Go into C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications and make a copy of this folder. Put it somewhere safe.
  • Go  into C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web and make a copy of this folder. Put it somewhere safe.
  • Download this file and unzip it somewhere: FancyAndTotallyUnsupportedMSBuildFilesForBinDeployableAssemblies.zip
  • Inside is:
    • "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets"
    • "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.OnlyFilesToRunTheApp.targets"
  • Copy these new files OVER your existing ones (remember, the ones you backed up?)

Now when you build your Web Application, all the files that are in _bin_deployableAssemblies will automatically get copied into your /bin folder.

This is better than a simple Post Build Step Batch File because it works specifically with publishing. Now, you can right click on your Web Project and "Publish..." an the bin folder contain your project's build output PLUS the _bin_deployableAssemblies folder.

Build Deployment Package

I could publish directly to my Shared Host, or I can Build Deployment Package and get a ZIP file with all the things my app needs.

For me, as I have a VM (remember that I put Web Deploy on it?) and from IIS Manager just "Import Application." Some hosters have a control panel for this, but you'll likely use Web Deploy or Publish via FTP.

Import Application from inside IIS7 with WebDeploy

This is a nice, clean, self-contained way to bin deploy an ASP.NET MVC 3 application with Razor views to a host that doesn't have any of these bits installed.

INTERESTING NOTE: In a "future update to Visual Studio 2010" (that's marketing code for SP1, which I'm not allowed to say) this feature will be built in. Because with this hack we've only messed with our built-in build targets, those files we've modified will be torched (replaced) with the new Visual Studio updated files, effectively undoing what we've done here. It's a "future-proofed hack."

Enjoy!

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 57 -Controlling an Eagletron TrackerPod with C# 4, ASP.NET MVC and jQuery

November 22, '10 Comments [12] Posted in Channel9 | Hardware | Open Source | Remote Work | Source Code | VS2010
Sponsored By

LifeCam mounted to an Eagletron TrackerPod I have a 42" HDTV in Seattle that's hooked up all the time as an "Embodied Social Proxy." It's a portal between the Microsoft Redmond campus and my house here in Oregon. I've blogged about Embodied Social Proxies before as well as shot video of one for Channel 9. It's called the "HanselCart" around work, although recently it's stopped being a cart and now it's a whole office that folks in Building 42 can drop by and see me, er, the Virtual Me.

One of the things that hasn't been 100% smooth is that while the LifeCam Cinema HD 720p is a nice camera, I can't MOVE it. I have to ask folks to move it for me, which is a slight irritant.

I'm getting ready to head up to Seattle for a meeting. While I was packing I found this TrackerPod motorized WebCam pan/tilt/zoom in my junk closet. I must have purchased it a long time ago and forgotten. I drilled a hole into the metal base of the LifeCam Cinema HD and superglued it while half-threading it on the TrackerPod's standard tripod-style male screw.

It's late, but I figured it I was going up to Seattle tomorrow, maybe I could hack something together quickly with this device and take it with me. There's a Custom Programming API page on the TrackerPod site with a TrackerPod COM Client.

This is what I built in action:

Here's how I did it in 40 minutes. First, I made a new ASP.NET MVC 3 web project, keeping the default template. This is quick and dirty, right?

Yes, I used a <TABLE>, sue me.

image

Here's the complete Razor View. I knew that I'd want a bunch of buttons to move the camera, and I assumed I would use jQuery to make an AJAX to the server side running ASP.NET MVC. I'm using the latest jQuery 1.4.4 and I'm getting it from the updated Microsoft cookieless CDN (Content Delivery Network.)

Rather than making a complex switch statement for the different buttons or different event handlers, I decided to use arbitrary HTML5 data attributes. Each INPUT Button has attributes like data-xvalue and data-yvalue.

There's one Click() handler hooked up to all Buttons. It gets the values of those data attributes, then POSTs the data to the Move method of the Home Controller.

@{
View.Title = "Home Page";
}
<script src="•http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.min.js"
type="text/javascript"></script>
<table border="0">
<tr>
<td></td><td>
<input type="button" value=" up " name="up"
data-xvalue="0" data-yvalue="-10" data-method="0" />
</td><td></td>
</tr>
<tr>
<td>
<input type="button" value="left" name="left"
data-xvalue="10" data-yvalue="0" data-method="0" />
</td>
<td>
<input type="button" value="home" name="home"
data-xvalue="0" data-yvalue="0" data-method="1" />
</td>
<td>
<input type="button" value="right" name="right"
data-xvalue="-10" data-yvalue="0"
data-method="0" />
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="button" value="down" name="down"
data-xvalue="0" data-yvalue="10" data-method="0" />
</td>
<td>
</td>
</tr>
</table>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function () {
$('input').click(function (event) {
var target = event.target;
x = $(target).data('xvalue');
y = $(target).data('yvalue');
m = $(target).data('method');
$.post("/Home/Move", { x: x, y: y, method: m });
}
);
});
//]]>
</script>

In the Home Controller, there's a method called Move(int x, int y, int method) where method is the way to move the camera - relative is 0 or absolute is 1. That's part of the camera's calling convention.

using TRACKERPOD_DUAL_COMLib;

namespace TrackerPodWeb.Controllers
{
public class HomeController : Controller
{
private dynamic cam = MvcApplication.myCameraInstance;

[HttpPost]
public void Move(int x, int y, int method)
{
cam.x = x;
cam.y = y;
cam.move_method = method;
cam.move();
}

public ActionResult Index()
{
return View();
}
}
}

See that dynamic object? That was the part that blew me away. I'm so used to COM Interop being a freaking nightmare from .NET that I spent most of the time messing with COM Interfaces and Type Libraries and exceptions when I realized that C# 4 was supposed to fix all that.

Like I've been saying about Razor - "stop thinking about syntax and just use it." - the same applies to COM interop in .NET 4 (Remember that the Visual Basic guys have have this nice experience for years...that's why VB is such a popular business automation language.)

Just use the dynamic keyword and start calling COM methods. Seriously, it just worked. I was copy/pasting code from the TrackerCam's VB6 (yes Visual Basic 6) samples into C#4 and other than a few semicolons, it was working directly!

Here's my Web Application's startup code:

public static dynamic myCameraInstance { get; set; }

protected void Application_Start()
{
//snip the MVC init stuff...
myCameraInstance = new TrackerPod();
myCameraInstance.app_name = "hanselcam";
myCameraInstance.initialize();
}

Here I hang on to the COM object for the camera as a poor man's singleton for use elsewhere. I should probably put guard-code around this to make sure it doesn't disappear or something but it's working so far. It should be a proper singleton I think.

Then I use that instance in my HomeController and call the COM methods in Move(). ASP.NET MVC takes care of the binding from jQuery to the Action Method, and .NET 4, C# and the DLR take care of the call into the COM TrackerCam stuff.

HTML5+jQuery -> ASP.NET MVC -> C# 4 dynamic keyword -> DLR COM Binder -> COM Library = It just works.

There's some HTML5 attributes, five lines of JS here and basically four lines of COM interop on my Move() method.

Now I'll be able to control my Seattle WebCam from Oregon. I may make it so I can control it from the Office Communicator Lync chat client or something. It'd also be nice if someone wrapped up the TrackerPod as a nice C# library and put it on CodePlex.

I'll add that to my ToDo list, or perhaps you will, Dear Reader. ;)

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 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.