Archive for the ‘whutnot’ Category

OK, so this post is a variation from the normal (which around here, is silence, ironically enough). Because I wanted to share with those that care a handy pattern that I came up with which dramatically improved my life as a Microsoft Dynamics CRM developer. If you’ve done custom plugin development, you’ve probably come across this horrible monster:

 public void Execute(IServiceProvider serviceProvider) {
    var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
    var factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
    var service = factory.CreateOrganizationService(context.UserId); 

    if (context.InputParameters).Containst("Target") && context.InputParameters["Target"] is Entity
    {
        //Do things
    }

Which is a horrible, ugly, messy pattern. It is bad and you should feel bad for using it. Now of course, you can’t have static member variables in a plugin, but don’t let that turn you to the dark side. Instead, I introduced a class called PluginHelper.

 public void Execute(IServiceProvider serviceProvider) {
    var p = new PluginHelper(serviceProvider);

The PluginHelper uses the ServiceProvider in its constructor to populate its member variables, which include the Context, Factory, Service, TracingService, all that good stuff. You can also stop repeating yourself and write common functions as methods on the PluginHelper class, so that A) You can stop all that dang typing, and B) your plugin development will become more efficient in time – If you find yourself repeating a function in multiple plugins, move that function to a method on the PluginHelper!

Even better, most of the time, you can just pass the PluginHelper to your methods, making your signatures much cleaner.

Some of the things that I’ve done include…

//BEFORE:
if (context.InputParameters).Containst("Target") && context.InputParameters["Target"] is Entity
    {
        //Do things
    }
//AFTER:
var target = p.GetTargetEntity();
if (target!=null)
{
    //Do things
}
//BEFORE:
if (target.Contains("AttributeName") && target["AttributeName"]!=null)
    {
        //UGH THIS IS THE WORST AND YOU REPEAT IT A MILLION TIMES
    }
//AFTER:
if (p.HasValue(target, "AttributeName")
{
    //I feel like I just brushed my teeth in the shower!
}

And one of my favorites, because you see it so dang often:

//BEFORE:
if (target.Contains("AttributeName") && target["AttributeName"]!=null)
    {
        otherEntity["OtherAttributeName"] = target["AttributeName];
        //Ok, this is just compounding your mistakes...
    }
    else
    {
        otherEntity["OtherAttributeName"] = null;
    }
//AFTER:
p.SetAttributeValue(target, "AttributeName", otherEntity, "OtherAttributeName", true);

In case you were curious, the signature of SetAttributeValue is:

 public bool SetAttributeValue(Entity sourceEntity, string sourceAttributeName, Entity destinationEntity, string destinationAttributeName, bool nullIfNotProvided)

I’ve listed some other methods/members within the PluginHelper below, but I won’t go into detail on them unless you ask real nice. You can probably guess what they do.

  • GetPreImage
  • AllowTracing
  • PrimaryEntityName
  • MessageName
  • TraceEntity
  • HasAttribute
  • GetCompositeEntity

Anyway, I hope this helps SOMEONE out there make more sense of their custom plugin code. I know that it’s saved my sanity multiple times.

She had legs.

Posted: January 14, 2016 in whutnot

She had legs that went all the way down. That is, she wasn’t floating or anything. There wasn’t like a weird supernatural gap between her ankles and her legs. Nope, they just kept going, hip to ankle. All the way down.

All the way up, too, like some kind of biological creature evolved over the ages to ambulate in an upright, bipedal fashion. She walked as though she was born that way.

From the way she carried herself I could tell that she had a spine, some kind of interconnected network of bones that held her rib cage in place, protecting what must have been some kind of cranium, since her eyes took in the room, denoting intelligent (or at least organized) thought.

She opened her mouth to speak, parting perfect lips – They were red, as though the flesh was kept constantly moist by some kind of saliva or other lubricant. I knew her type – She would use her teeth to separate out little pieces of organic material, crushing them between bone masses embedded in her jaw. Yeah, I’d dealt with her kind before. It was only a matter of time before she would need to feed again, breaking down that organic material with some kind of enzymatic and microbial stew in a series of fleshy sacks within her body.

When she spoke, the sound was like air being pushed from a million tiny flesh-balloons, vibrating carefully controlled muscles somewhere in the column of meat that supported her head.

It gave me chills.

I’d never been so aroused.

2015 Updates!

Posted: January 18, 2015 in whutnot

What’s new with me? Well, I did design for The Reformers‘ “The Turn”, an original adaptation of The Turn of the Screw, just opened Sidekicks with Action Adventure, and am currently in early design/creation meetings for an original show with the Reformers. May possibly have news about new music projects this year, but I’ll hold off until there’s more tangible news.

If you’re reading this, why haven’t you downloaded my stuff yet? It’s free! I mean, I won’t stop you from donating, but still. Click that MUSIC link in the upper right, why dontcha?

Maleficia and the Drammy Awards!

Posted: May 30, 2014 in whutnot

I’m ALSO super-duper-stoked that String House Theatre‘s devised piece Maleficia is a finalist for a Drammy Award for Devised Work! Bursting with gratitude to have worked on such cool projects. Listen to the album of all original music composed for the show by yours truly! Available FREE, or name your own price!!!

maleficia_cover_lg

Revenants and the Drammy Awards!

Posted: May 30, 2014 in whutnot

I’m super-duper-stoked to announce that I’ve been nominated for a Sound Design Drammy Award for The Revenants, which ran last year, put on by The Reformers. A complete honor just to be nominated in the presence of other great finalists. Go Portland theater!! Want to hear what the buzz is about? YOU CAN! Download for free (or donate) here:

Revenants_Cover[1]

The Reformers!

Posted: May 30, 2014 in whutnot

I’m pleased to announce (albeit a bit late) that I’m now a company member of The Reformers, with my compatriots Sean Doran and Charmian Creagle.

The Reformers

Keep your eye out for more great shows (as long as we don’t screw them up).

Domain! Store!

Posted: February 25, 2014 in whutnot

Hey everybody! Just a quick update to say thanks for all the support for Maleficia, the show went great and I’m really proud of the work that we all did.

TO CELEBRATE, I got a domain! Anyway, I’m now at richardemoore.com, which is pretty cool, and I have a STORE page here, too! I’ve posted a bunch of albums on Gumroad, so that you can download them for FREE, or give me a little something-something if you want! Hooray!

The Revenants

Posted: September 25, 2013 in whutnot
Tags: , ,

hey everybody! currently working on sound design and composition for the things, this one first: The Revenants. Zombies. In a garage. Some cool practical effects and of course my sound! Check it out:http://thereformerspdx.com/

And we’re seeking some funding via indiegogo – come be part of making this cool thing happen! http://www.indiegogo.com/projects/the-revenants-by-scott-t-barsotti

revenants

Ah,  also, i’ll point out that I’m not going to be posting the music from this show for free on Google Play in the foreseeable future – the only way to get the download on this one is from the Indiegogo campaign! And there are some cool songs in this show, in my humble opinion!