Lovin’ JavaScript

I’ve dabbled for years and even built a few simple jquery apps, but never really sat down and immersed myself in JavaScript (as the rest of the world seems to be doing).  I’ve been living and breathing in classical languages… seeing the possibilities of functional dynamic languages is blowing me away.  Drink this in this sample.

Give this simple markup:

<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <div id="console" />
</body>
</html>

 

Now imagine this script:

// utility for writing a message to the screen
var write = function(msg){
  $('#console').append(msg += '<br/>');
};

// utility for write all properties of an object to the screen
var dump = function(obj){
  for(var key in obj){
    write(key + ': ' + obj[key]);
  }
};

// define an object
var obj = {
  foo: 'abc',
  bar: 'def'
};

// define another object
var obj2 = {
  baz: 'ghi'
};

// write out the first object
write('obj:');
dump(obj);

// dynamically alter the first object by merging it with the first object
$.extend(obj, obj2);

write('<br/>obj:');
dump(obj);

 

The output:

obj:
foo: abc
bar: def

obj:
foo: abc
bar: def
baz: ghi

 

Wicked

EPC Error – Communication with the underlying transaction manager has failed

If you’re getting this in PC, first check this:  EPC Error – Enabling Network Access for DTC.

Next, ensure you have the proper DNS suffixes for CSG added to your NIC.

After much pain, I realized I didn’t do the second thing on my new laptop.  Save yourself some pain and don’t forget.

MSBuild.exe–SystemError api-ms-win-core-heap-l1-2-0.dll and CSLA.NET

I installed CSLA.NET from their downloads page over the weekend… I haven’t looked at it in years and after it came up in some discussions at work, I decided I needed to refresh my familiarity.  Not long after installing it, my nant scripts that I use for local automation started failing on the MSBuild tasks with this error:

image

This is mentioned on the CSLA.NET forums:  WebDev.WebServer40.exe – can’t start because api-ms-win-core-heap-l1-2-0.dll is missing.  It appears the installer has registered some kind of custom MSBuild task that requires this component.  That’s just a guess as I’m getting this not from Visual Studio, but MSBuild invoked via a scripting engine.  I don’t really care what the cause is because I’ve gleaned what I need to know and will be uninstall CSLA.NET shortly.  However, according to that forum thread it appears you can get the CSLA nuget and no occurrences of this issue have been reported via that channel.  The installer delivers the samples source, which I’m not sure is delivered over nuget, but the samples source should be available for direct download as a zip from their downloads page.

Bottom line:  if you want CSLA.NET, I recommend getting it from nuget and stay way from the installer download.

Bootable USB Thumb Drive Cheat Sheet

I find myself hunting for this all the time… lots of info on the net of varying quality.  Here’s my own cheatsheet.

  • Download the Windows ISO locally
  • Get yourself an ISO mounting utility – I like VirtualCloneDrive
  • Mount the Windows ISO so you can copy files from it.  (For this post, let’s call it drive letter W: )
  • Insert your USB Thumb Drive (For this post, let’s call it drive letter T: )

Do the following to your thumb drive:

  • Go to Computer Management and format the thumb drive
  • Open the command property and do the following:

c:\>diskpart

diskpart>list disk

diskpart>select disk #disknumber#

diskpart>list partition

diskpart>select partition #partitionnmber#

EXIT

c:\>W:

w:\>cd boot

w:\>bootsect /nt60 T:

  • Copy the contents of the Windows disk (mounted) to the thumb drive
  • Reboot and instruct your BIOS to book from USB
  • Follow the Windows installation sequence

Drive Swaps with WHS – no restore disks

My hard drive has been making noise lately and I need more space to boot, so I find myself in a familiar place – I have a WHS full of backups, a working machine, a new hard disk, and I want to cut over the working machine to use the new disk.  This is where WHS sings.

In the past I’ve done this with burning a restore CD, etc. and battled missing drivers and such.  It wasn’t the most pleasant experience.

This morning I found an easier way to do the above and it actually fits better into my primary use cases (i.e. I’m usually just changing hardware – not recovering from a disaster) and I can avoid burning CD’s and what not.  Here’s what that forum post outlines:

Attach the new hard drive to the machine that’s running on the old hard drive

For me, I’m using a drive bay adapter in my DVD bay running a second hard drive.  For this process, I swap out my 2nd drive w/ the drive I want to restore to.

Launch the Client Restore Wizard

Assuming the machine you are using has the Windows Home Server Connector installed (all my machine’s do), navigate to the following path and launch the executable:

C:\Program Files\Windows Home Server\ClientRestoreWizard.exe

This will launch the restore wizard that you would normally see if booting off the CD, but without the complexity of setting up the drivers, etc.

Select the volumes to restore

be careful here…. make sure you’re pushing the restore to the correct disks and volumes.

Let’er Fly

Let it run through…

image

… and when done, swap the drives back and you should be good to go.

Returning my HTC Titan for a Samsung Focus S

I love my HTC Titan, but sadly… yet another smartphone that’s can’t make phone calls.  Well, this one is hit or miss, but it’s enough of an issue where my wife is demand that I replace it.  There are wide spread reports of defective microphones on the Titan:

AT&T Wireless Forums: HTC Titan – Microphone Problem?

WPCentral.com Forums: HTC > Titan > Call Voice quality issues

HTC Forums: Terrible Call Quality

To be clear, Windows Phone is AMAZING.  After two iPhones and three Android devices, I can say with confidence Windows Phone is the best mobile OS I’ve ever used.  And it’s getting raving press:  The Critics Rave … for Microsoft?I love it, I just have issues with this device.  Other than this mic problem, I would say this is the best device I’ve had as well.  I wish I didn’t have to return it, but this is a deal breaker.

I’ve decided I’m going to take a break from my HTC loyal for a while.  This is my 5th HTC device in the last 9 years… and the last two have had significant manufacturing issues.  I’m going with the Samsung Focus S.  I’m on the phone ordering it from AT&T as I type.

XCOPY Reminder

I can never remember the exact args for XCOPY and I use this in VS POST-BUILD events more than you would think.  Here’s my reminder so I never have to Google for this or read the XCOPY usage again.

    <PostBuildEvent>XCOPY "$(ProjectDir)\Foo\Bar.config" "$(ProjectDir)..\..\Bin\$(ConfigurationName)" /Y</PostBuildEvent>

Hello 2012

Forgive me, but this is my cheesy new year post.

I’m jazzed up about a number of cool things ahead.  Below is a few of the one I’m most pumped about.

Hello Baby Girl #2

My wife and I had our second girl on December 4th, 2011.  Having two in diapers is a challenge, but she’s an angel and I can’t imagine life before her.  Watching our first daughter go from zero to one year old was fascinating.  I’m looking forward to doing that again with another special little gal.

Return to Chicago (kinda)

A reorganization by my employer and end of year promotion will mean I’ll be traveling to Chicago mostly in 2012 instead of Omaha.  I’ll still be working primarily from home in Michigan, but I should be able to regularly return to the great city of Chicago and spend time with some great friends and coworkers in our Chicago office.

No diss to Omaha, but it’s just too hard for me to get there and Chicago will always be home to me.  Thanks for a fun 2011.

Fresh Material

This year appears to have many new technical challenges ahead.  With my new role I’ll be in a position to evangelize to a wider and more interested audience.  I’m hoping to share a lot of the lessons I’ve learned in 2010 and 2011 in terms of architecture and design to help teams delivery more with less.  I’ll be preaching a lot of NHibernate and test automation.

2012 looks like it will be saturated with JavaScript development.  I spent 2010 neck deep in Silverlight, and 2012 looks like it will be a return to the traditional web.  I’ve been reading JavaScript The Good Parts, JavaScript Patterns, and REST in Practice.  I’m looking forward to working heavily with JQuery, KnockoutJS, BackboneJS, Wijmo, KendoUI, ASP.NET MVC, and Web API.

Interesting Year for the Mothership

I think 2012 is going to be a interesting and pivotal year for Microsoft.

Windows Phone

I received the HTC Titan for Christmas and LOVE it.  I was skeptical, but am no more.  This is a phenomenal OS and I think the rest of the world is going to realize it in 2012.  I think it’s well positioned to have a big year.  It will be interesting to see how that plays out, but I think a Jobs’less Apple and Android in version hell as well as the Android Developer Community fed up with building apps they can’t charge money for will make room for strong growth by WP7.  The Windows Phone Marketplace is growing steadily, and if Microsoft knows how to do something well it’s make a comfy developer ecosystem.

BTW, If you happen to be one of those turd throwing I-hate-everything-Microsoft monkeys and feel like leaving some bile on my comments… I’d rather you not.  If you haven’t used a WP device for at least an entire day as your primary phone, I’m probably not interested in your opinions.

Windows 8

Windows 7 was great.  I think they finally get it in terms of what users want from the OS.  I expect Windows 8 will be very successful and will firmly establish MetroUI.  Having it on tablet form factors should come in 2012.

HTML5/JavaScript Tooling vNext

If you look and what Microsoft has done in support for the HTML5/JavaScript movement in WinRT, it feels like something big is brewing on this front.  They seem to have unofficial ties CoffeeScript and Script#.  I’m hoping to see a Google Web Toolkit (GWT) like offering from Microsoft this year.

 

Learn, Learn, Learn

With two kids in diapers I have less personal time than I’ve ever had in my life, but I have renewed vigor to make this another year of learning.  I intend to be a JavaScript guru by this time new year.  I have an annual subscription of TekPub and I intend to watch at least half of the productions available in their catalog.  At a minimum:  GitHub, Mastering Mercurial, Linux for Softies, Mastering JQuery, Mastering LINQ, and Mastering Windows Phone 7.

Strengths Finder 2.0

A friend gave me a copy of this book and I took the test…

image

The Clifton StrengthsFinder

As you may know, the Clifton StrengthsFinder measures the presence of talent in 34 categories called “themes.” These themes were determined by Gallup as those that most consistently predict outstanding performance. The greater the presence of a theme of talent within a person, the more likely that person is to spontaneously exhibit those talents in day-to-day behaviors.Focusing on naturally powerful talents helps people use them as the foundation of strengths and enjoy personal, academic, and career success through consistent, near-perfect performance.

Below are my top five themes of talent, ranked in the order revealed by my responses to the Clifton StrengthsFinder.

How well do you think these themes describe me?

Achiever

People who are especially talented in the Achiever theme have a great deal of stamina and work hard. They take great satisfaction from being busy and productive.

Focus

People who are especially talented in the Focus theme can take a direction, follow through, and make the corrections necessary to stay on track. They prioritize, then act.

Context

People who are especially talented in the Context theme enjoy thinking about the past. They understand the present by researching its history.

Learner

People who are especially talented in the Learner theme have a great desire to learn and want to continuously improve. In particular, the process of learning, rather than the outcome, excites them.

Discipline

People who are especially talented in the Discipline theme enjoy routine and structure. Their world is best described by the order they create.

To learn more about the Clifton StrengthsFinder and how you can discover your top five themes, visit http://strengths.gallup.com

T4 Debugging in VS2010 – Crashing IDE

In VS2008, it would common to put a System.Diagnostic.Debugger.Break() statement in your T4 template file and have the debugger prompt pop up and let you attach to your code.  In VS2010 on Windows 7, it crashes the IDE.  I think it’s specific to Windows 7, but I’m not sure about that.  The issue report is here:  http://connect.microsoft.com/VisualStudio/feedback/details/535479/vs2010-crashes-debugging-t4-templates

From reading the issue, it seems to be a policy difference in Windows 7.  I’ve heard of hack to the registry to change the default, but a cleaner solution is provided in the work-around’s tab.

Simply call Debugger.Launch() before calling Debugger.Break().  Like so:

<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ output extension=".cs" #>
<#@ assembly name="System.Xml.dll" #>
<#@ import namespace="System.Xml" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections" #>
<#@ import namespace="System.Collections.Generic" #>
<# 
    Model model = null;

    try
    {
        XmlDocument document = new XmlDocument();
        document.Load(this.Host.ResolvePath("Model.xml"));

        XmlNode modelNode = document.SelectSingleNode("//model");

        if ( modelNode != null )
        {
            model = new Model(modelNode);
            
            System.Diagnostics.Debugger.Launch();
            System.Diagnostics.Debugger.Break();
            
            model.Load();
        }
    }
    catch ( Exception ex )
    {
        #>
        // ******************** UNHANDLED EXCEPTION DURING MODEL GENERATION **********************
        // Message: <#= ex.Message#>
        // Exception Type: <#= ex.GetType().FullName#>
        // ***************************************************************************************
        <#
    }
#>

 

Hopefully this helps someone else out there – this has been killing me for almost a year and I never thought to look for a workaround.

←Older