Thursday, May 23, 2013

Intersystems Ensemble Useful Tricks

Clearing All the Message Queues in a Namespace from Command Line

NAMESPACE>do ##class(Ens.Director).CleanProduction()

This is useful when creating a new copy of an existing namespace and for other maintenance and testing purposes. Do Not use this on any Production Systems.

Get segment count in Objectscript for HL7 message
/// To be Used in rules to get the count of segments by segment name
/// pSegment is the name of the segment example "OBR"
ClassMethod GetSegmentCount(HL7 As EnsLib.HL7.Message, pSegment As %String) As %String
{
Set tIndex = ""
Set tSegCount = 0
#Dim tSegment As EnsLib.HL7.Segment
try {
Set tSegment = HL7.FindSegment(pSegment,.tIndex,.tStatus)
While (tIndex '="") {
Set tSegCount = tSegCount+1
Set tSegment = HL7.FindSegment(pSegment,.tIndex,.tStatus)
}
}
catch err {
Set tErrorText = "Error in GetSegmentCount: "_ tStatus _ ":" _ $ZError
$$$LOGERROR(tErrorText)
}
///$$$LOGERROR(tSegCount)
Quit tSegCount
}
This is useful when the number of segments needs to counted using objectscript.

Get segment count in DTL for HL7 message
<assign value='source.{PIDgrpgrp(1).ORCgrp(k1).OBXgrp("*")}' property='tMaxOBXCountInCurrentORCGroup' action='set' />

Value needs to point to the path the segment to be counted as per schema. Property is a variable to assign the count to. The variable can be used in assignments or conditions for further processing

Updating production from Command line
NAMESPACE>do ##class(Ens.Director).UpdateProduction()
This is useful when portal freezes or shows lck err when update button is used from the management portal.

Getting Globals Size from the command line
NAMESPACE>do ^%GSIZE
This routine provides detailed global size information. Depending on the size of the Cache.dat it can run a few hours to days.

Getting the size of cache and the free count
NAMESPACE>do ^%FREECNT
This routine provides the cache size and free space available very very quickly

This will be a work in progress and I will keep adding content to this blog

Thursday, May 16, 2013

Love Story of Romancing Twin Primes

I am a Natural Number, or atleast that was the group I belonged to. It did not take me very long to realize that I belonged to the group alright but I was different more to say I was Unique. Only the creator of natural numbers and in a way everything else "The ONE" and myself knew how unique and Gifted I was.

I started on a quest to find others like me. Initially I found quite a bunch of them 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97... They were different alright but not very social. The more I searched the more difficult they were to find(the distance between consecutive primes increases as we move towards infinity).  I went as far as 2,003,663,613 × 2195,000 - 1 when it hit me that may be I was not unique but rather weird. I was staring to feel the solitude and felt sad. I even blamed the creator.

Thats when the magic happened, I saw a beautiful girl as unique and weird as me yet different in her own way. She was happy cheerful full of bliss and non complaining unlike me about everything. I introduced myself and an unknown feeling strike me. She was the one I was looking for. She was soul mate. My "TWIN PRIME"

P.S
May be Geeky, but if one is passionate about something(Maths in this case), There is beauty and romance is it :)