Installing Node on Windows

This is the first in a series of getting up to speed on Node.js for .Net Developers.

0.  If you haven’t installed Chocolatey yet, do that first.

From their About page:

Chocolatey is a package manager for Windows (like apt-get or yum but for Windows). It was designed to be a decentralized framework for quickly installing applications and tools that you need. It is built on the NuGet infrastructure currently using PowerShell as its focus for delivering packages from the distros to your door, err computer.

1.  Install NoDist from the command line:

cinst nodist -Pre

NoDist is a Node version manager.  It allows you to configure different versions

2.  From the command line, run Nodist and you are good to go


3. Install the Node tools for Visual Studio


Fire up Visual Studio and you are good to go!

Are you really burnt out?

Are you really burnt out?
Kings and Pawns

The harder I work, the sooner I get to be king!

I recently read John Sonmez’s post on The Hacker News Generation.  I find articles like this interesting.  As I read it, the same thought comes screaming through:  WHY?

I wrote to John privately asking him this:  Why write an article like that?  What is the intention?

Regardless if you agree or not, I find articles like this either confirm or infuriate your point of view.  For me, it’s the same as arguments for Gun Control.  Both sides can argue all the reasons to (increase / decrease / whatever) guns, but who’s opinion are you trying to convert?

How many times have you seen a person walk away from a discussion saying “Wow!  I never thought of it that way, you are right!  We really should _______”.

It just doesn’t happen.


For me, the real problem with discussions like this is that they can be taken the wrong way.  Take this comment.  The author’s point is that burn out is real.  And his proof is a link to an articles of horrible consequences.

In John’s article, Iris Classon posted a response with a similar point of view.  I don’t have a science background, and I accept that “burn out” is a condition.  But when I read comments such as:

After two devastating meetings with potential partners, I remember coming home one day, climbing to bed. And not getting up for 6 months.


I am blatantly paraphrasing, in the preceding paragraphs Iris describes she is in a career that she is passionate about, but there isn’t enough work.

But I have to push back – two devastating meetings?  Two?

Then she continues:

But without my background in therapy, both as a patient and medical professional, I wouldn’t have made it out alive from the burnout- and found the dream I am leaving today. That I am 100% sure of. And my hat goes off to those that also dared to follow their heart and passion, even if failing miserable once or twice. I believe in choosing to make something a part of your life, without it being your whole life, and loving what you do and the people involved as much as you can allow yourself to do. For some people it’s what they do that is most important (in software development the task itself is considered the number one motivation, with social aspect being second), for others it’s purely the human interaction. And some just want to work 8-17 and go home. The second group is at a significant higher risk of being burned out, when intrinsic and extrinsic factors are there.

The choice is theirs. Ours.

And we shouldn’t judge people on those choices, because:

1. We do not have all the facts

2.One day you will be standing there

3.Generally I don’t recommend giving people a push when they might be standing on the edge


Failing miserably once or twice?

But here’s the real problem with her argument:  We shouldn’t judge because we don’t have all the facts.

Fair point, but:

  • You’ve put yourself out there (you wrote the article)
  • You have said we don’t have all the facts – but again, it’s your article.  Why not give us all the facts?
  • Maybe we shouldn’t judge, but people do.  That’s reality


Where is the personal responsibility?  There’s plenty of examples of many many “miserable” fails.


What Iris didn’t mention (and I’d love to know!):

  • Why did you choose to work in the dietetics industry in the first place?
  • I’m sure you felt “burnt out”.   But at what point in time did you notice things weren’t working out the way you had hoped?  Was it really after the second devastating meeting?  Was there really no warning signs earlier?


To be fair, and answer my own question – why write this?

  • Accountability is very important to me.  I don’t care what you say you will do, but once you’ve said it, you need an fantastic excuse / reason for not doing it.
  • The discussion to date feels awfully one sided.  I’m suggesting an alternative.

But that’s just me.  What do you think?

Setting Entity State in Dynamics CRM 2011

Setting Entity State in Dynamics CRM 2011
I had an interesting challenge recently.

As part of a Credit Card Payment Solution we are working on, I was trying to set the Invoice State.

According to the MSDN documentation, all you need to do is set the Status Code = 100001 and the State Code = 2.


Guid invoiceID = new Guid("Existing Invoice Guid");
IOrganizationService orgService = OrgServiceFactory.GetInstance();

orgService.BeginRetrieve("invoice", invoiceID, new ColumnSet(new string[] { "invoiceid", "statecode", "statuscode" }), (result) =>
    var fetchResp = orgService.EndRetrieve(result);

    var statecodeAttrib = fetchResp.Attributes.Single(a => a.Key == "statecode");
    OptionSetValue statecode = (OptionSetValue)statecodeAttrib.Value;
    statecode.Value = 2; 

    var statuscodeAttrib = fetchResp.Attributes.Single(a => a.Key == "statuscode");
    OptionSetValue statuscode = (OptionSetValue)statuscodeAttrib.Value;
    statuscode.Value = 100001;

    orgService.BeginUpdate(fetchResp, (updateResult) =>
        /* Web Exception thrown here */
    }, orgService);

}, orgService);

When I did this, I was getting a “NotFound” exception.

So I asked this on Stackoverflow.  Turns out in CRM 2011, you need to use the SetState message.

Digging a little further, the SDK has a good example of how to take an Opportunity to a Won Order, to a Sales Order to an Invoice.

Illustration courtesy of Jon Watson.

Retrieving the Text of an OptionSet in Silverlight

I’ve been pulling my hair out over this.


If you look at the Dynamics CRM 2011 SDK, you can see how to get an Entity using FetchXML:

Using FetchXML, you can get to an entity like this:

string fetchXML = "<fetch mapping='logical'>";
fetchXML += "<entity name='account'><all-attributes/>";
fetchXML += "</entity></fetch>";

IOrganizationService orgService = OrgServiceFactory.GetInstance();
orgService.BeginRetrieveMultiple(new FetchExpression() { Query = fetchXML }, EntityGet_callback, orgService);

And the callback:

public void EntityGet_callback(IAsyncResult ar)
   IOrganizationService orgservice = ar.AsyncState as IOrganizationService;
   var fetchResp = orgservice.EndRetrieveMultiple(ar);
    var entities = fetchResp.Entities;
    foreach (var entity in entities)
        var email = helper.GetValue(entity, "email");


Nothing fancy in the helper method:

public static object GetValue(Entity entity, string name)
    if (entity.Attributes.ContainsKey(name))
        return entity.GetAttributeValue
    return null;


If I wanted to get the Address 1 Type, I would use:

helper.GetValue(entity, "address1_addresstypecode");

Unfortunately this returns the value (0, 1, 2…) Not the string.

The answer is the Entity.FormattedValues.



With thanks to a post on Sayantan Samanta’s blog.

The problem with Tekpub…

The problem with Tekpub…

I like Rob Conery. But he is the sort of guy who just seems to go out of his way to cause trouble…

A good example is a post I wrote a couple of years ago.

What’s funny is that Rob even commented on the post. But unfortunately he missed the point. Rob is a classic “Ready, Fire, AIM!” type of person.

Case in point, I recently purchased a 12 month Tekpub subscription. (Tekpub is an online technical education resource).

Now a 12 month subscription for a little under $300 is good value. It’s competitors are either Youtube videos or companies like Plural Sight.

Last week, Rob posted this tweet:

Awesome! So why did I pay full price?

But that’s ok, Rob’s a good bloke! So I pinged him, asked if I could get a 29% extension, sent my Order Number (twice), followed him up…

And then? Well not much!

I don’t know what to make of it. Maybe he has updated my subscription? Maybe he hasn’t. Funny thing is that Tekpub doesn’t show when your subscription ends, just when you signed up.

I’ll keep you posted…

Home Theater PC

Home Theater PC

Recently Jeff Atwood of Coding Horror fame, updated his Home Theater PC. I had been thinking of doing the same, so below is my experience.

CPU Intel Core i3-2100
Motherboard MSi H67MA-E45
Memory Kingston 4GB DDR3

Standard case + power supply. I also added a 2TB hard drive + a Blueray writer.

Total damage: $800

Originally I installed Windows 7 Home Premium but had a few driver problems.

So I started again with Windows 7 Home Premium N and no problems.

How does it rate next to Jeffs’? 4.6 Windows Experience Index
Jeff managed a 5.1 – but I agree, take out the Aero desktop support and you have a 5.8 machine!

Interesting, Jeff got me all inspired when he started to talk about power consumption. He has been writing about this for sometime now. When I tested this machine, it was just under 40 watts.
Media PC Power Consumption
I have no idea how Jeff pulled off 22 watts, but he did say that he recycled old parts from a previous build.

I’m not too worried since a) this machine will be either in stand-by or turned off when not in use and b) a low power consumption device is going to increase the cost significantly.

For well under $AUD1,000 I’m only annoyed I didn’t do this sooner!