Another Programmers Are Human Moment

I wrote a PHP script that takes the details of an HL7 interface stored as XML and presents it in a nice neat HTML table.

The formatting is customized so most XML to HTML table tools won’t work for this.

As I parse the details out of the XML structure, I write them to the string $output.

I had everything working except for the parameters.

I gather the parameters by storing the XQuery paths into an array and iterate through that adding the details to the html table.

That bit wasn’t working.

I added some code to ensure that I was stepping through the array, and that the information was correct.

It took me about 20 minutes to see it….can you see the problem?


$output .= '<tr class="mdiparms">';

foreach($nxqArr as $nxq) {
         $ouput .= '<td>'.getNodeValue($nxq).'</td>';
}

$outout .= '</tr></table>';

Definitely an end of the day /facepalm moment!

Advertisements

You know you should take a break from coding when…

Recently,  I was trying to get something in our Mirth Integration Engine working.  A project that was behind for a variety of reasons.

I was exhausted,  and stressed when co-workers heard me exclaim:

WTF do you mean its undeclared!   Its declared right there you stupid machine!!!

I waved my fist at the monitor in a threatening manner,  yet this infernal contraption kept telling me “variable mytpe undeclared in line 936″

I thought of EVERYTHING!   I checked to see if scope was the issue,  I was pretty sure it wasn’t.  I thought maybe its a datatype thing,  which made no sense at all…

Finally, in a fit of frustrated rage I walked away, grabbed a coffee, and paced around for a bit before going back to it.

I then took another look at the code


var mtype = msg['MSH']['MSH.10']['MSH.10.1'].toString();

if (mytpe.indexOf('D') > -1) {

}

I checked everything except spelling!

There’s a few minutes of my life I’ll never get back.

Unintentionally Creepy Declarations #1

When we’re in the zone,  sometimes we don’t really think about our variable names,  so long as they’re meaningful.

I just typed out a table declaration for a new Table Value Function in SQL Server.

After I coded that bit I kept thinking,  there’s something wrong with that…

Then I saw why it was creeping me out…


DECLARE @table as TABLE (

DICTSECONDS varchar(30) NULL,
DRAFTSECONDS varchar(30) NULL,
FINALSECONDS varchar(30) NULL, -- do you see it?
SIGNEDSECONDS varchar(30) NULL
)