Sunday, March 11, 2012

Quick Tip: VirtualBox Win 8 Custom Resolution

1680x1050, 1600x1200, 1280x1024, 1152x864, 1024x768, 800x600

I'm not sure what the true root cause of the problem is, but, when running Windows 8 Customer Preview in VirtualBox, the set of allowed resolutions is pretty pathetic.

I don't even know where / why anyone would buy a 4:3 ratio monitor anymore, so I don't know why there aren't a bunch of supported 16:9 options in here.

In order to get around this, there's a command that, though simple, needs to be done from the command line (after shutting down your virtual machine)

So, if you go to your Virtual Box Folder (usually C:\Program Files\Oracle\VirtualBox) and run the following command, you should be OK:

image

Then, when you go back into your machine, you should see the new resolution listed for use.

I'm not sure how to make this resolution available in every subsequent virtual machine, but I'm glad it's available in this one.

Thanks to Dustin over at http://mstechpages.com for what amounts to all this information in this articleSmile

T

Sunday, March 4, 2012

Released: JsTrace.MVC

I just released the JsTrace add-on JsTrace.MVC as a NuGet package.

What is it?  It's a way to automatically proxy JsTrace messages from client-side JavaScript to your MVC application.

Basically, when you add this package, you get the following Area added to your ASP.NET MVC project:

Capture
The JsTraceController has a single "Index" method that receives a JsTraceMessage object.  All that contains is the module, level and message sent from the JavaScript side.
Given the following javascript:
var tracer = new Trace('TestModule');
tracer.error('testing: error message');
The default implementation just outputs to the console using Debug.WriteLine:
   JsTrace >> [error] Module 'TestModule' : testing: error message
All you need to do is use the included HtmlHelper extension method like this, depending on your syntax:
<%: Html.RenderJsTraceProxy() %>
or
@Html.RenderJsTraceProxy()

By default, the rendered script will proxy only messages that pass the “switch test”. If you pass “true” in the RenderJsTraceProxy(), it will send all of them, which might be a bit crazy in production.

The script uses the jQuery $.ajax() method to post a JSON object to the server asynchronously -- ignoring success or error as well.

I may have a follow up version that has more options for the Proxy, like being able to pass a predicate-style (returns boolean) method to determine whether or not to send the message to the server.  This way you could customize the logic yourself.

Check it out, and let me know what you think!

T

Monday, February 27, 2012

JsTrace 1.1.1 released

So, I released a new version of the JsTrace project.

This version basically includes rewriting things to be a little more "proper" in the JavaScript side of things. 

  1. I removed things like the "with" keyword (reimplemented just using basic closure technique)
  2. Turned on/Fixed a lot of JSHint restrictions (though I still don't dig the "use one var statement" thing, so I don't follow that – it's totally unnecessary in my opinion).
  3. Updated the Intellisense comments so that we have as much info in client code as possible
  4. Updated source code to have a test project and the NuGet package generation in it.

So, if you're using the NuGet package, you'll just get the update automatically, otherwise, go snag it on Codeplex: http://jstrace.codeplex.com

Happy Debugging!

Tom

Saturday, February 18, 2012

Released: JsTrace - My JavaScript Diagnostics Module (NuGet Package too!)

I've been planning on this for a while, but, after my original post post about JsTrace, I wanted to make it easier for people to get to and use.

So, first of all, I added JsTrace to CodePlex.

Then, I wrote some pretty decent documentation for it.

Finally, I published it as a NuGet Package.

Use it at will and spread the word!

Wednesday, February 8, 2012

Just Published: TFS Solution Info - Visual Studio Extension

The Problem

I deal with Team Foundation Server (TFS) a lot day to day, so I occasionally find myself wondering which Branch and/or Workspace I happen to have open on my project at any given time.  For some people, this is not a problem, since they work on one particular branch, do their work and then check in.  For me, though, it’s different.
I do parallel development on my project.  Sometimes I’m working on a great new feature for 2.0 while switching over to a HotFix branch to do a quick patch for the 1.5 version that’s in Production.
I also use a separate workspace in TFS to Merge and deploy code.  Throw in the “Experimental” Workspace I use to play around in various versions of the code, and you can see why I frequently get lost.

The Solution

(no pun intended! -- OK, I confess: It was totally intended!)
Banking on the theory that I’m not alone in this – and, based on my coworker feedback, I’m not – I decided to publish the Visual Studio plugin I created.
For lack of a better name, I called it “TFS Solution Info”
Here’s what it looks like

ScreenShot

It’s pretty simple.  Using the Visual Studio SDK, I connected up to Solution events and TFS-related information to display information about the currently loaded Solution.

I can’t believe how useful this has been for me.  I hope it’s useful for you too!

Get TFS Solution Info from the Visual Studio Gallery!

Or, you can just search for “TFS Solution Info” in the Visual Studio Extension Manager.  The code will be posted up on Codeplex very soon.

Let me know what you would like to see this do.

[Update: just updated the formatting]

Friday, February 3, 2012

Pro Tip: Code Analysis, IoC and Excessive Class Coupling

This is a quick tip:

If you’re using Visual Studio's Code Analysis to make your code better (and who isn’t?), you’ll obviously have a bit of a problem with any IoC bootstrapping because you’re most likely wiring up a LOT of interfaces and classes together in your bootstrapping logic.

This will result in the CA1506 "Avoid Excessive Class Coupling" warning

SuppressMessage to the rescue!

Just decorate your IoC bootstrapper class or method with this:
[SuppressMessage("Microsoft.Maintainability",
   "CA1506:AvoidExcessiveClassCoupling")]
public static class IoC
...
Problem Solved!

Sunday, January 29, 2012

Debug.Assert() – So, what about Release Mode?

Sometimes, as a developer, you create some little nifty tool to make life easier and you forget that other people may not have come up with that idea/solution and are still struggling with a problem you solved ages ago. 
I was having a Skype conversation with Pete Brown and he said “Why don't you blog this stuff, or set up a GitHub project or something with these things?”.  I told him, “well, actually, I just started blogging!”  
That conversation gave me a figurative kick in the tuchus, so I decided to share a small nugget.

Defensive Development


If you know me you know that I am a big fan of code instrumentation and “defensive development”. I think it’s the best way to protect yourself.  To me, developing defensively means that you are doing the following in your code:
Generally, you’re trying to “bullet-proof” your code.
Given that I think like this, I tend to use debug assertions a lot.