Monday, June 22, 2015

Running tests in a CI system for SailsJS

I recently started working with SailsJS. I am enjoying some of the libraries and how easy and fast it is to get things up and running. But I do miss some of the built in tools that come with Grails. A good example of this is the "grails test" tool. This made it easy to run unit level tests, integration or functional tests from the command line with the same command line for all of my projects.

grails test-app 

This made it very easy to integrate into a CI tool like TeamCity. I didn't need any special scripts, relative paths or some dark art of getting environment variables right. Things just worked out of the box.

Since SailsJS lets you plug in any testing you want. AKA it does not come built into the framework. I had to figure out how to run the tests in my IDE (Intellij in this case), and in my CI system (TeamCity). As you can see I am trying to keep the tool set in the same family.

I decided to use Mocha as the test framework. It seemed to have everything that I wanted and was the closest to what I was familiar with in the grails framework. But the commands to get it running were a little more than just typing "sailjs test" in my application directory. But I found a cool little trick to make it easy. Using npm and my package.json file. I can use the same command for both CI and IDE.

By simply adding a line to the package.json file in the root directory of the application source I can then call

npm test

Here is an example of my package.json file.

...
  "sails-mongo": "^0.11.1"},
"scripts": {
  "start": "node app.js",
  "test": "node ./node_modules/mocha/bin/_mocha --recursive --ui bdd ./test",
  "debug": "node debug app.js"},
"main": "app.js",
...


The test script calls the node command with the proper mocha script to run my tests. Notice that the path to the mocha script is relative to the application root directory. It is important in the IDE and CI that you set the working directory to the application root. Which should be the default for both. Now I can simply call:

npm test

from the command line, in the IDE, or in the CI system.

DWP

Sunday, June 21, 2015

Father's Day Poem.

My genius daughter wrote me a poem for Father's day. Here it is in all of it glory. Of course I could not read it all the way through without crying which my kids think is very funny to watch me cry.

To my Father

From infancy you held me,
From infancy you clothed me,
You are the one who helped me see
Who I truly was going to be.
In confusion you help me understand,
In sickness your hand were on my head.
You are my teacher, leader, provider, and friend.
I know you will help me to the end.
No matter how much I must learn
No matter how much my life will turn
You will be my teach,leader, provider and friend
And your fatherhood will have no end.

Julianne Pulsipher

Sunday, November 10, 2013

Characteristics of Hate

This last week I began teaching the history of Zeniff and his people in the book of Mosiah in the Book of Mormon. One of the interesting comparisons between the Nephites and the Lamanites is the profound hate that the Lamanites have toward the Nephites. The hate was so strong that it was passed down from generation to generation. So I asked my seminary kids how could so much hate be passed down for so many years. We came up with some interesting characteristics. 

First we saw that the Lamanites were "Quick to take offence". It was almost like they were looking for reasons to be take offense. We see the same sorts of things today in our society. Some of the kids mentioned many racial tension can point to this one characteristic. Easy to take offense. The kid that pointed this out happen to be multiracial. He was frustrated with people from both of his races that took offense to everything. Then one of the girls in class mentioned that they have fallen into this satanic trap as well. When they took offense from a friend when no offense was meant. Destroying their friendship.

Second we saw that the Lamanites "held on to anger". They wanted to be angry at the Nephites and they held on to that anger for over 500 years. Sound familiar to the world today. Just think about the middle east. Thousands of years of anger. To the point that they want thrive on anger and hate.

Third, the Lamanites blamed the Nephites for everything. Check out Mosiah 10:12-18. The Lamanites were "wroth" (intensely angry) with the Nephites about everything. Even good things that happen to the Lamanites, they still found a reason to hate them. Reading through the reasons it is almost comical. In today's venacular we call it being a victim. When we become victims and blame everyone else for what is going wrong in our lives we fall into this characteristic. It fuels anger and hatred, and slowly destroys our spirit.

Lastly, the Lamanites refused to forgive. You can see something in someone's countenance when they carry a grudge with people. They have a demeanor of anger. We all recognize it in other people all of the time. We sometimes miss it in ourselves.

So how do we avoid these characteristics Elder Halstrom said in an article in the Ensign 
“If you feel you have been wronged—by anyone (a family member, a friend, another member of the Church, a Church leader, a business associate) or by anything (the death of a loved one, health problems, a financial reversal, abuse, addictions)—deal with the matter directly and with all the strength you have. … And, without delay, turn to the Lord. Exercise all of the faith you have in Him. Let Him share your burden. Allow His grace to lighten your load. … Never let an earthly circumstance disable you spiritually” (“Turn to the Lord,” Ensign or Liahona, May 2010, 80).
Something I think we all need to watch out for in our individual lives.

DWP


Tuesday, October 29, 2013

Christmas Gift ideas


Shameless plug for my wife's etsy store. Christmas is coming get your orders in fast.

Tuesday, October 15, 2013

Nephi's last words

I get the opportunity to teach seminary in the morings for my church. This week we are finishing up the 2nd book of Nephi in the Book of Mormon. Theses are the prophet Nephi's last words he writes to his children, decendents and us. Every time I read Nephi's last words to us in 2 Nephi 33, I begin tear up and wonder what my last words would be to my wife, my children, and my friends. He mentions four things

  1. I pray continually for ...
  2. I know ...
  3. I glory ...
  4. I have ...
After reading this again. I figure I need to answer these blanks for my self. I guess that is one of the things we need to figure out in life. 

Darren

Thursday, October 18, 2012

Escape Velocity of Change in an Organization

I was recently measuring how long it took for an idea to move through our organization. I compared several ideas over the last 3 years. I Looked at why some seemed to hit some critical mass and then just take off, while others required constant care and feeding and took a long time to be adopted. Reviewing the changes with my boss, he said there seems to be some escape velocity for ideas in the organization. Of course this made me want to investigate this more. At the suggestion of my boss Bradley Mitchell, I opened up wikipedia and took a look at the definition of escape velocity. This is what I found out:

  1. Escape velocity changes depending how far away from the surface you are.
  2. Escape velocity decreases with altitude.
  3. It is the speed at which an object will not fall back to earth.
  4. An object at any speed as long as it has propulsion, can escape the earth’s gravity.
  5. If propulsion is removed on an object that is below escape velocity it will fall back to earth.
  6. If an object is at or above escape velocity it has enough kinetic energy to “escape.”


There is also a formula that allows us to measure the escape velocity of any object.


G = gravitational constant
M = the mass of the planet or star
r = the distance from center of gravity.

So if we apply this to organizational change we get some interesting observations that seem to be true.
G = Change Constant
M = the size of the organization
r = how close to core values that change are.

So if the organization is large (large M) it will take more velocity to get the organization to change. If the change is far from the changing fundamentally core values of the organization then the escape velocity is smaller than if it profoundly affects core values. This seems to make some sense. I also think we can play with the Change Constant and say that it is not constant but corresponds to how old the organization is. The older an organization the harder it is to change and therefore the escape change velocity is higher.

Let’s look at these principles and see how they might apply to change in an organization. So how can I use escape velocity observations for escape change velocity?

  1. The further you are from a profound change to core values the easier the change.
  2. Change is easier for smaller changes.
  3. To make a change permanent you must achieve the escape change velocity or it will fall back to earth.
  4. Adding constant pressure to a change, will eventually make it stick.
  5. If a change is launched without enough velocity to escape, it will revert back to its current situation.
  6. If a change has enough velocity at launch, it will not need constant pressure to succeed.

As you can see the engineering side of me wants to put an equation to describe how I can help an organization change. But it is never that easy. Human beings are unpredictable and in a large organization with hundreds of individuals it is closer to chaos. The key is to try and determine what things can help control the chaos during the change. Finding the perfect velocity of change for the organization is a combination of the amount of change and the size of the organization.

DWP

Wednesday, September 19, 2012

Someone to Watch over Me

In my work as well as at home it is always nice to have someone help me get my todo list done. Whether it is a honey do list or a work breakdown structured list from work, it is nice when I have the chance to have another set of eyes to make sure I did everything. Of course I didn’t think this applied to my honey do list, but my 6 year old son taught me something interesting this last week. I have been trying to fix our trash compactor for the last month or so. The problem is it is just hard to open the door. First thing I did was pull all of the garbage that fell behind the trash bin. That seemed to help some, but it was still really hard to open the door. Next I took the bin out and made sure all of the tracks were working fine. Then I started taking apart the wheel assembly. Putting it back together and tightening all of the screws. It was better but still hard. I was very frustrated and out of patience with this appliance from the underworld. Then my 6 year old son flipped the red switch that said,  “locked” to “unlocked,” and everything worked fine.

So, like a typical engineer I was looking for a hard problem to solve instead of looking for something obvious. This tends to be the case not just at home with household appliances, but at work as well. This could not just be for us engineers either. In the software engineering world there is a big movement to perform something called Pair Programming. Basically two people sit down to one computer and write code together. One person typing the other making sure the program is working, typed in correctly ,etc...

Can you imagine someone looking over your shoulder making sure you are typing correctly? Sounds annoying and it can be at first. But the results are huge according to some research that there can be up to 50% decrease in the number of mistakes (bugs) made in the code. Two people tend to consider more design alternatives, find bugs faster, and fix problems right the first time. I have used pair programming a couple of times in my career and in every case I have seen great improvement in hitting timelines, with higher quality.

However, I have also seen engineers not wanting to work nicely together. Maybe it goes back to elementary school when we are graded individually. Not as a group or team often. It is kind of funny. We teach kids in kindergarten to play together. By 3rd grade you are not allowed to share answers with your classmates, that is cheating. In fact one of the largest complaints about pair programming is who gets the credit. Especially when annual reviews come around. Somehow we have to overcome the social barriers that have been ingrained in us to not share or work together.

As I learned with my trash compactor, pair programming helps find solutions that would be otherwise overlooked. Even a 6 year old can see the obvious things that years of my domestic appliance repair was overlooking.