Sunday, March 18, 2012

JsTrace 1.3 Released

Get it while it's hot!

I just added a few features to the JsTrace code:
  • New passthrough methods on the Trace object for the following: assert, clear, count, dir, dirxml, exception, group, groupCollapsed, groupEnd, profile, profileEnd, table, time, timeEnd, trace
    • Note that the Trace script does nothing but pass these through if they exist
  • Ability to get/set the default trace level with the Trace.defaultTraceLevel method
  • Ability to reset some or all of the currently configured trace levels to the defaults by calling the Trace.resetToDefault method.
  • New Jasmine tests to make sure it works (mostly)
On the MVC side, I added a feature to the JsTrace.MVC package:
  • The ability to force logging to the server to be synchronous in order to preserve the order of messages coming back to the server.
    • It was either that or adding message numbers, and this was quicker.
NuGet packages are updated:

Or browse the code here: http://jstrace.codeplex.com/

Happy debugging!

Saturday, March 17, 2012

Disable Minification with MVC 4 Bundles

I decided to play around with a bunch of new technologies to dive in and learn today. I decided to write a basic blog app (yeah, boring, I know) using the following tools:
    (TL;DR? Click Here)

Thursday, March 15, 2012

How To: Download Azure Publish Settings File

So, as of Azure SDK 1.6 (I think), Microsoft added the ability to import your publishing settings for Azure into Visual Studio to make deployments easier
image
This then launches your browser and has you login to your Live account.
Then, it downloads the file automatically and imports it, saving you time.
I installed Azure Diagnostics Manager Version 2 and it has a neat feature to allow you to import a Publish Settings File.  So, off I went to try to download it.  I found NO documentation on how to get it.
By some spelunking through browser history, I found this magical link:
https://windows.azure.com/download/publishprofile.aspx
This will allow you to download the file and do whatever you want with it, including import it into ADM.
WARNING: This has sensitive information in it to allow you to publish to your Azure account.  I recommend you delete this file after you import it into ADM

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