The Real Reason Why Many Programmers Don’t Have Social Lives

I often have difficulty speaking to other humans.

After hours buried in code,  when I’m forced to communicate with other humans I have difficulty in switching to the rather arbitrary syntax and structure of Conversation.

Many people believe this is why I don’t have much of a social life,  but that isn’t the real reason.   Like most full-stack programmers I only need a few minutes to get comfortable with the current language/platform.

Here’s what happens to many of us when we’re planning on going out…

As we’re leaving we realize we left something important, like our phone, keys etc near our computer.

When we approach the computer,  we think about something we’re working on,  or we remember that we wanted to try something,  or had an idea to fix a problem…

So we think:

I’ll just take a minute and try that…

What follows are thoughts like

Well, that didn’t work!  Maybe if I….


now where was that chunk of code I used before??

then, finally..

Wait, why am I hungry?


OMG, Why is it so dark out??!!!

Then when you look out and see that its not an alien invasion with ships so big they blot out the sun, but rather that its late at night and life has once again passed you by.


Mirth: Making sure that dev/test code doesn’t get into LIVE (Is this lazy, or just accommodating reality?)

In a perfect world database connections and other things that must be changed when you migrate code between environments are neatly stored in one place where they can be easily changed.

With Mirth you can do this using global maps,  however when you do that,  they are exposed to anyone who has appropriate access to Connect.

I get around this by declaring variables at the top of the filters or transformers where I make database calls.

One of the things with my position is that I wear many hats and am the organization’s ‘go to’ for a great many things.  This means that interruptions are frequent.

This means that I when I’m doing something like preparing an interface to move from TEST to PRODUCTION that I can miss things.

Some of you might scoff,  but that is the reality of my world,  and almost 50 years on this planet has taught me that reality is often very far from ideal,   so you plan for reality.

I’m working on a project where I reach out to a couple of databases to pull data that isn’t included in the HL7 message.

Some of the transformations are complex,  and things were complicated by very tight deadlines,  and a situation where the spec “needed clarification”.  (as in I built my end to spec but they wanted a change).

Those of you familiar with this reality thing will know that this often leads to kludged together solutions.

After spending several hours making sure that our iPeople Echo downloads were moving the correct data from our test environment and copying/altering stored procedures and SQL functions I finally got to combing through my Mirth interface to make the changes there.

To give you an idea of the complexity,  I have 13 transformers in my source connector.

I realized that when I moved this to Live that there were too many potential failure points and wanted to prevent them.

So I added this code to my source filter:

var channelName = ChannelUtil.getDeployedChannelName(channelId);

if (channelName.indexOf('LIVE') > -1) {

logger.error('******************** CHECK ' + channelName + ' FOR DEV/TEST SETTINGS! ****************');
 return false;

return true;

/* Changes for Live
-remove anonymizer
-change db settings in source PID, PV1, OBR and ZDR
-change db settings in destination MR PID transformer


Hey look…a checklist of sorts!

My thinking is that if I forgot to make this very basic change that I’ll look and wonder why all my messages are being filtered!

But then I got to thinking of how many times I’ve been interrupted today and what would happen if I missed a single change…

So I wrote this:

function envcheck(sql,strTest,strLive) {

 var channelName = ChannelUtil.getDeployedChannelName(channelId);

 if (channelName.indexOf('LIVE') > -1) {

 logger.error(channelName + ' **** CHANGE SQL STATEMENT FOR LIVE ' + sql);

 sql = sql.replace(strTest,strLive);

 return sql;

Mirth: Monitor and Send Alerts every X hours


This is a very quick post as I want to link the code to someone asking a question on LinkedIn.

Any one who has dealt with Mirth alerts knows that you can get flooded by messages when there is a problem.

I wrote this channel to alert us every 3 hours if a problem occurred in a fairly important channel.

You can see in this code how I use the ChannelUtil class to collect data.

You can also use this class to control the channel and connectors.  Here’s the documentation.

Here’s the code that is in a javascript writer destination.

var olissr = '91d05f9d-6020-4ecc-b9fb-5301c77a1e0f'; //this is the target channel

var cstate = ChannelUtil.getChannelState(olissr).toString(); //declares the channel as a channel util object

//get the stats

var cQ = ChannelUtil.getQueuedCount(olissr);
var cE = ChannelUtil.getErrorCount(olissr);
var cS = ChannelUtil.getSentCount(olissr);

//get the previous stats from the globalChannelMap for comparison purposes.
var tq = globalChannelMap.get('tq');
var te = globalChannelMap.get('te');
var ts = globalChannelMap.get('ts');
var lt = globalChannelMap.get('curtime');
var ltms = globalChannelMap.get('timelastmsgsent');
var ltas = globalChannelMap.get('activitylastalert');
var ltaserror = globalChannelMap.get('errorlastalert');
var curtime = java.util.Calendar.getInstance().getTimeInMillis();
//puts the variables into the channelMap in case they're needed by the mailer.

var timediff = curtime - lt;




var errordiff = cE - te;
if (errordiff > 0) {

var leralert = ((curtime - ltaserror)/1000)/60;

if (leralert > 15) {

channelMap.put('AlertSubject','Errors on OLIS-SR Channel!');

var body = "There are errors on the OLIS-SR Channel!\nErrorCount: " + te + "\nDifference in error count since last check: " + errordiff + "\n";


ics = parseInt(cS);
its = parseInt(ts);

var ds = cS - ts;

if (ds != 0) {

ltms = curtime;

} else {
var timelag = ((curtime - ltms)/1000) / 60;

if (timelag > 60) {
var alertlag = ((curtime - ltas)/1000) / 60;

if (alertlag > 120) {


channelMap.put('AlertSubject','Inactivity on OLIS-SR Channel!');
channelMap.put('AlertBody','There has been no activity on the OLIS-SR Channel for ' + timelag + ' minutes!');