Sending off Pastor Tim

One of the pastors of our church (Jordan Presbyterian in West Jordan, Utah) recently received and accepted a call to become the pastor at Grace Church in Layton, Utah. Yesterday Pastor Tim preached at our church for the last time and the congregation fellowshipped afterward with a fried chicken and potluck meal to celebrate his ministry to us and give him a proper send off.

While we were eating, a microphone was passed around to give people a chance to say a little something about Pastor Tim. I didn’t volunteer then, but I want to take the opportunity here to collect the various tweets I’ve posted over the past couple years quoting things he’s said in his sermons or sharing pictures of him.

We love you Pastor Tim. If you’re half the blessing to Grace Church as you’ve been to us they’ll be blessed indeed. Godspeed in all your future endeavors, friend.

Get GlideDuration value in millseconds

Curiously, ServiceNow’s GlideDuration object gives you a way to set the duration in milliseconds (i.e. passing in the millisecond value when constructing a new instance) but there’s no simple way to get back that duration expressed in milliseconds. You can get it back expressed in days, hours, minutes, and seconds in just about any format you might need, but not in total milliseconds. I recently had a use case for expressing a duration in total hours, where being able to get back a millisecond value would have been very convenient. But instead I had to get creative with string manipulation to convert the duration display value back into milliseconds. If you need to do this too, do yourself a favor and put it in a Script Include so it’s reusable.

Here’s my Script Include, which you are welcome to copy verbatim or use as inspiration for your own (at the very least, I recommend replacing “ACME” with your company’s name or initials, or just name it according to whatever convention you would normally follow at your organization):

var ACMEDurationHelper = Class.create();
ACMEDurationHelper.prototype = {
    initialize: function() {
    },
	
	// Accepts a GlideDuration object, passes back total milliseconds of the duration.
	getTotalMS: function(dur) {
		var durVal = dur.getDurationValue();

		// Parse the duration value into days and time
		var durValArr = durVal.split(' ');
		var days = 0;
		if (durValArr.length == 2) {
			var days = parseInt(durValArr.shift(), 10);
		}
		var time = durValArr.shift();

		// Parse the time into hours, minutes, and seconds
		var timeArr = time.split(':');
		var hours = parseInt(timeArr[0], 10);
		var minutes = parseInt(timeArr[1], 10);
		var seconds = parseInt(timeArr[2], 10);

		// Calculate and return total milliseconds
		return days * 86400000 + hours * 3600000 + minutes * 60000 + seconds * 1000;
	},
	
	getTotalSecs: function(dur) {
		return this.getTotalMS(dur) / 1000;
	},
	
	getTotalMins: function(dur) {
		return this.getTotalMS(dur) / 60000;
	},
	
	getTotalHrs: function(dur) {
		return this.getTotalMS(dur) / 3600000;
	},

	getTotalDays: function(dur) {
		return this.getTotalMS(dur) / 86400000;
	},

	type: 'ACMEDurationHelper'
};

If this is useful to you, drop me a comment to let me know. Cheers! 

Metric for Updated By

Defining a ServiceNow Metric to track every update to any record in a table

A friend recently asked how he could create a ServiceNow Metric that would track who makes each and every update to records in a given table. Sounds easy enough, right?

Well, it turns out the only fields that would make sense to trigger such a metric are system fields like sys_updated_on or sys_updated_by, and the tricky thing is those fields don’t get monitored by default for calculating metrics. I searched the ServiceNow Community and found a way to do it, and below I am providing an off-the-shelf Metric Definition and Business Rule that will track every time a record is updated on a table.

The Metric Definition

I’ve defined this for the Task table (which works for any tables extended from Task), but you’re of course welcome to make it more specific as your needs require.

Name: Task Updated By
Table: Task [task]
Field: Updated by
Type: Script calculation

Script:

createMetric(current.sys_updated_by.toString());

function createMetric(value) {
	var mi = new MetricInstance(definition, current);
	var gr = mi.getNewRecord();
	gr.field_value = value;
	gr.calculation_complete = true;
	gr.insert();
}

The Business Rule

This is the secret sauce. Since fields like sys_updated_by aren’t monitored for metric calculations, we need to explicitly declare that we want it monitored by setting up a Business Rule to fire the same event that would normally be fired for non-system fields.

Name: Metric Event for Updated By
Table: Task [task]
Advanced: true
When: after
Insert: true
Update: true

Script:

function onAfter(current, previous) {
   gs.eventQueue('metric.update', current, '[sys_updated_by]', 1, 'metric_update');
}

That’s all there is to it. Now any time someone inserts or updates any Task (or records in whatever table you specified instead) you’ll get a new Metric Instance with a value containing that User’s user name. 

Integrating ServiceNow with HipChat

My tutorial on integrating ServiceNow with Slack turned out to be one of my most popular articles ever. Justin Meader recently asked me on Twitter how easy it would be to integrate Service­Now with HipChat instead.

So, I gave it a whirl. In this article I’ll show you how you can post Service­Now notifications right into HipChat using their API. Just like in the previous tutorial, I’ll give you a ready-made Service­Now Script Include and instructions and examples for how you can call that Script Include from any scripted Business Rule.

Continue reading

Integrating ServiceNow with Slack

Slack + ServiceNow One of our teams at work recently started using Slack for all their team communication and approached me about possibly having ServiceNow shoot Incident assignment notifications into one of their Slack channels. As it turns out, integrating ServiceNow and Slack is really easy. In this article I’ll show you how to enable the necessary Slack “Incoming Webhooks” integration service as well as give you a ready-to-go ServiceNow Script Include you can use to post messages to Slack from any scripted ServiceNow Business Rule. Finally, I include some examples and ideas for how to use and re-use the Script Include in your own Business Rules.

Continue reading

Two Covenants

Are the two major divisions of the Bible really “testaments” or “covenants”?

In what way are the major divisions of the Bible “testaments” or “covenants”? Are “Old Testament” and “New Testament” just arbitrary titles, or are we really to understand them as somehow actually being covenants?

The other day I wrote about the biblical warrant for calling our two major divisions of Scripture the Old and New Testaments. I explained that 2 Corinthians 3:6, 14 is a solid basis for calling them what we do, either formally or at least informally. Today I want to peel back the onion one more layer. I want to get deeper into why we can and should call them covenants, beyond simply that the Bible itself calls them that.

Michael Kruger’s “Canon Revisited”
Michael Kruger’s “Canon Revisited”
For this I have to lean on a book I recently read, Michael Kruger’s Canon Revisited: Establishing the Origins and Authority of the New Testament Books. In a chapter on the apostolic origins of the New Testament canon, Kruger tackles exactly this question, concluding that canon is itself derived from redemption and covenant.

If you think about it, what are the most important sections of our two testaments? For the Old Testament, the important section is the Torah, the Pentateuch, the five Books of Moses, which tell of God establishing the old covenant with his people Israel through Moses as mediator. The important section of the New Testament is the four Gospels, which tell of a new covenant God has established with his people through Christ as mediator.

What about the rest of Scripture? Everything else in the Old Testament took place and was written in the context of the old covenant, and everything else in the New Testament was written in the context of the new covenant. Kruger explains, taking a cue from other scholars such as Meredith Kline, that the prophetic books of the Old Testament and the epistles of the New Testament function as “covenant lawsuits”, bringing charges against God’s covenant people for various offenses against the covenant. So these secondary documents even function as an important part of the written form of each covenant.

So our two collections of Scripture are certainly about covenants, but in what sense can we call them covenants or testaments in and of themselves? Here, Kruger helpfully explains that every covenant in the ancient near east included certain elements. One important element was the depositing of a written copy of the covenant to be kept by both parties in a safe place. A notable example of this custom is the ten commandments, written by God himself on stone tablets, being deposited in the Ark of the Covenant and kept in the tabernacle and later the temple in Jerusalem. Kruger argues, and I agree, what we have in our Old and New Testaments is nothing less than the written deposit of God’s covenants with man.

Given this function of these written texts, it is right not only to say they are about covenants, but to call them covenants in and of themselves. And isn’t this what we saw in my previous article? Paul considered the written text of the Old Testament synonymous with the old covenant when he said in 2 Corinthians 3:14: “when they read the old covenant”. 

Two Testaments

Where do we find biblical warrant for the terms “New Testament” and “Old Testament”?

Bible by Adam Dimmick
Photo credit: Bible by Adam Dimmick
Where do the terms “Old Testament” and “New Testament” come from? What do they mean? Is it right for us to name the two divisions of our Bible this way?

Melito of Sardis is widely regarded as the person who coined the terms “Old Testament” and “New Testament”. His is the earliest known canon (list of books) of the Old Testament (circa 180 CE). But I discovered recently that the New Testament itself spoke of the Old and New Testaments a century before Melito.

In 2 Corinthians 3:14, Paul refers to the “old covenant” as a written document (“when they read the old covenant”). It’s important to explain here that the word for “covenant” in this passage is the Greek διαθήκη (diathēkē), which variously means “testament” or “covenant”. Look at this same passage in the King James and you’ll find the word “testament” there in place of “covenant”. When Melito of Sardis coined the terms, he was writing in Greek and used exactly this word διαθήκη.

What’s remarkable is that just 8 verses back, in 2 Corinthians 3:6, Paul states that God has made him and the other apostles “ministers of a new covenant” (same word διαθήκη, and if you look at the KJV you’ll find “new testament” here). It’s hard to escape the implication that Paul knew he was contributing to a new collection of Scripture which he would at least informally have referred to as the “new covenant” just as he referred to the Jewish Scriptures as the “old covenant”.

It’s impossible to know for certain if this is where Melito got his terms for the Old and New Testaments, but I think it’s a remarkable coincidence if not. I think perhaps it would be better for us to call them the Old and New Covenants, but Testament is a valid translation of διαθήκη and it’s rather late to change our conventional English wording now. Whether we call them Covenants or Testaments, though, I see 2 Corinthians 3:6, 14 as a solid biblical basis for naming our two collections of Scripture as we do. 

Treasure

Since I began studying covenant theology in the past couple years, I’ve become partial to verses of hymns that speak of God being our highest treasure, portion, or inheritance.

My new favorite verse of Be Thou My Vision is:

Riches I heed not nor man’s empty praise,
Thou mine inheritance now and always;
Thou and thou only first in my heart;
High king of heaven, my treasure thou art.

My new favorite verse of Amazing Grace is:

The Lord has promised good to me,
His word my hope secures;
He will my shield and portion be,
As long as life endures.

These hymn verses echo for me the promise of God reiterated in every progressive revelation of the covenant of grace that he will be God to us and we will be his people (Genesis 17:7; Leviticus 26:11–12; Jeremiah 31:33; Revelation 21:3). They remind me that God is indeed “the strength of my heart and my portion forever” (Psalm 73:26). 

Fantasy

I started playing a fun online game with some friends this week. It’s a sort of MMORPG called “Fantasy Basketball”. It’s a lot like Dungeons & Dragons or Risk or other games where there are battle systems with a good mix of strategy and chance.

Game mechanics

At the beginning of the several-months-long “season” you take turns picking from a long list of non-player characters. You choose these “players” based on various character attributes to build a “team”. There is a certain amount of narrative that can be crafted around the players, but the choices you make are largely based on numbers and statistics.

Each week your team gets matched up to go head-to-head with one other team in the “league” (my league has twelve teams in total, each managed by one of my friends). The strategy consists principally in choosing which of your players to put on your “roster” and which ones to “bench”. Then as the week progresses, random numbers are generated for each of your players, weighted toward their various attributes. These numbers ultimately determine the outcome of the match.

One of the attributes that affects the players’ numbers is the “position” they play. The positions have exotic-sounding names like “shooting guard” and “power forward”, and they complement each other much as warriors, wizards, clerics, and healers play off each other’s strengths and weaknesses in a typical fantasy RPG. To optimize your roster, as with any good party-building strategy, you need a balanced mix of the different player positions. You also have to pay careful attention to which players are “tired” or “injured” each week.

The chance element

Of course, in games like Dungeons & Dragons or Risk the chance element comes from random dice rolls. I’m not entirely certain where the randomness comes from in Fantasy Basketball, but I’m given to understand it comes from something in the real world.

It’s a little known fact that computers can’t actually produce truly random numbers. Computer algorithms can only achieve pseudo-randomness unless they’re fed some true random data to work with. For instance, I’ve used password generating programs that track the user’s mouse movements to build up entropy. Random.org uses atmospheric noise for entropy. A friend of mine today mentioned something he heard about where they’re using pedestrian foot-traffic patterns from London surveillance cameras for entropy.

Like I said, I don’t know where they get the entropy for Fantasy Basketball, but it seems they’re getting some high quality random numbers from somewhere.

Wish me luck!

I’m really enjoying the game so far. I think I’m well on my way to winning my first match. My “players” have a few more “games” this week and I’m crossing my fingers for some big random numbers. Wish me luck! 

My iPhone home screen

Back in August one of my favorite podcasters, Casey Liss, had his iPad home screen featured on MacSparky and I realized lots of people (tech celebs and pros) have had their iPhone and/or iPad home screens featured on either MacSparky or another site called The Sweet Setup.

I recently refactored my iPhone into a single home screen, and I’m quite proud of it, so I thought I’d show it off and hopefully introduce you to a few apps you’ve never heard of and may find useful.

My iPhone home screen
My iPhone home screen

The Single Screen

As I mentioned, I recently refactored to a single screen setup. I have everything roughly grouped into categories: reading on the top row, productivity on the second row, photography and entertainment on the middle row, web and social media on the fourth row, local and money on the bottom row. I keep my most-used apps in each of these categories out on the home screen, and the rest in folders.

Since a year ago with iOS 7, you can now keep an unlimited number of apps in folders. Many of my folders are three pages long and at least one is four pages long. The most used apps in each folder are on the first page of the folder, and my long tail of lesser-used apps is tucked away deep inside these folders. When I’m looking for one of these long-tail apps, I typically pull down Spotlight and launch it that way rather than go digging.

Having everything on the first page may seem cluttered, but it actually means fewer taps of the home button to get all the way back out. When I come out of an app that is in a folder, I can tap one more time to get to my home screen, whereas, if I were in a second- or third-screen folder, I might have to hit the home button two more times to get to the first screen. I’m nothing if not efficient (read: lazy).

The Apps

Apps I couldn’t live without: Kindle (books), Logos (Bible), OmniFocus (getting things done), and Overcast (podcasts).

Apps I love: ComiXology (comicbooks), Dark Sky (weather), Instapaper (read later service), Picturelife (cloud photo storage), Reeder (feed reader), Simple (banking), Soulver (calculator), Textastic (web development), and Tweetbot (Twitter client).

Questions about any other icons you see in the screenshot? Know an awesome app I’m missing? Drop me a line on Twitter or Facebook or toss in a comment below.