Eduard Lebedyuk · Oct 7, 2019 go to post

Apache POI can write to Excel files, you can extend the current integration if you want.

Eduard Lebedyuk · Oct 3, 2019 go to post

Your old setup was users sshing into the system, no?

You can try force command a script which execs into a container and exists after that.

Or you can install sshd in your container and allow users to connect to it.

Eduard Lebedyuk · Oct 3, 2019 go to post

but that does not work

why?

docker exec -it <container name> iris session iris

should do the trick.

Eduard Lebedyuk · Oct 1, 2019 go to post

Have you unpacked the IAM-0.34-1-1.tar.gz?

Originally I was trying to import the whole archive, which failed.  After unpacking container it was imported successfully.

Eduard Lebedyuk · Oct 1, 2019 go to post

I have not heard about such plans, maybe when this technology becomes more stable and widely adopted.

Eduard Lebedyuk · Oct 1, 2019 go to post
Parameter User = "irisusr";

/// Get memory consumed by irisusr
/// w ##class().GetCurrentMemory()
ClassMethod GetCurrentMemory() As %Integer
{
    Set cmd = "smem"
    Set args = 8
    Set args(1) = "-u"
    Set args(2) = ..#User
    Set args(3) = "|"
    Set args(4) = "grep"
    Set args(5) = ..#User
    Set args(6) = "|"
    Set args(7) = "awk"
    Set args(8) = "'{print $6}'"
    Set sc = ..RunCommandViaZF(cmd,,.rss,,, .code, .args)
    If $$$ISOK(sc){
        Set rss = +rss
        Set ^rss($zdt($h, 3, 1)) = rss
    } Else {
        Set rss = ..#MemoryMax
    }
    Quit rss
}

/// w ##class().GetTotalMemory()
ClassMethod GetTotalMemory() As %Integer
{
    Set cmd = "free"
    Set args = 6
    Set args(1) = "|"
    Set args(2) = "grep"
    Set args(3) = "Mem"
    Set args(4) = "|"
    Set args(5) = "awk"
    Set args(6) = "'{print $2}'"
    Set sc = ..RunCommandViaZF(cmd,,.total,,, .code, .args)
    If $$$ISOK(sc){
        Set total = +total
    } Else {
        Set total = 0
    }
    Quit total
}
/// Run a command using $ZF(-100) and an external temporary file to store the command output. <br>
/// If <var>pDeleteTempFile</var> is 0 (false), the temporary file is not deleted; in this case, it is up to the caller to delete it when done with it.
ClassMethod RunCommandViaZF(pCmd As %String, Output pTempFileName As %String, Output pOutput As %String, pOpenTimeout As %Integer = 5, pDeleteTempFile As %Boolean = 1, Output pRetCode As %String, ByRef pCmdArgs, pAsynchronous As %Boolean = 0) As %Status
{
    Set tSC = $$$OK
    Set pOutput = ""
    Set pRetCode = ""
    Set IO = $IO
    Set ZEOFMode = $ZU(68,40,1)
    Set pTempFileName = ""
    Try {
        Set (tFile,pTempFileName) = ##class(%File).TempFilename("txt")
        If tFile="" Set tSC = $$$ERROR($$$ObjectScriptError, "Failed to obtain a temporary file name") Quit
        Set cmdFlags = "/SHELL /NOQUOTE " _ $Select(pAsynchronous:"/ASYNC",1:"") _"/STDOUT="""_tFile_"""/STDERR="""_tFile_""""
        Set pRetCode = $ZF(-100,cmdFlags,pCmd,.pCmdArgs)
        Close tFile Open tFile:("RS"):pOpenTimeout
        If '$T Set tSC = $$$ERROR($$$ObjectScriptError, "Failed to open temporary file '"_tFile_"'") Quit
        Set TooMuch = 0
        Use tFile
        For {
            // Keep reading through end of file; save only first 32,000 characters
            Set tLine = "" Read tLine:1
            If '$T && (tLine=$C(-1)) Quit  // Exit by timeout
            If 'TooMuch {
                Set:pOutput'="" pOutput = pOutput_$C(13,10)
                If $L(pOutput)+$l(tLine)<32000 {
                    Set pOutput = pOutput_tLine
                }
                Else {
                    Set pOutput = pOutput_$E(tLine,1,32000-$L(pOutput))_" (more...)"
                    Set TooMuch = 1
                }
            }
            If ($ZEOF=-1) Quit  // Exit by EOF
        }
    }
    Catch (ex) {
        Set tSC = ex.AsStatus()
    }
    Try {
        If pDeleteTempFile {
            Close tFile:"D"
        }
        Else {
            Close tFile
        }
    } Catch (ex) {
        // don't overwrite the error status if it's already populated
        Set:$$$ISOK(tSC) tSC = ex.AsStatus()
    }
    If 'ZEOFMode Do $ZU(68,40,0) // Restore ZEOF mode
    Use IO
    Quit tSC
}
Eduard Lebedyuk · Sep 17, 2019 go to post

1. You have whitespaces after commas. It should be:

Parameter SETTINGS = "-DeleteFromServer,-ArchivePath,RemoteArchive,TargetConfigNames";

Also I think you're defining your settings in Operation? I'm not sure it would work. I think you need to redefine adapter settings in adapter, like so:

Class App.FTP.InboundAdapter Extends EnsLib.FTP.InboundAdapter {

Parameter SETTINGS = "-DeleteFromServer,-ArchivePath";

}

Not sure why you're including RemoteArchive in your settings, as it's already there in ancestors. I removed it.

After that use your new adapter in your operation.

2. What does $classname(..Adapter.FTP) return?

Eduard Lebedyuk · Sep 14, 2019 go to post

Use published container.

docker run -d \
  -p 52773:52773 \
  --name irispy \
  intersystemscommunity/irispy:latest
Eduard Lebedyuk · Sep 14, 2019 go to post

I've been thinking about it but I think there are more letter characters. Unicode is a big place.

Eduard Lebedyuk · Sep 13, 2019 go to post

InitGlobals process Avg. Duration would be the time between [2] and [16]. So all other processes are "included" in that time.

Eduard Lebedyuk · Sep 12, 2019 go to post

Pool Size setting is shown on Production Configuration page.

i think you have several process jobs.

Finally, can you show Visual Trace with the first process?

Eduard Lebedyuk · Sep 11, 2019 go to post

Interesting.

for i=1,5,7,31,32,33,34,35,36,37,40,41,42,43,44,45,46,51,52,53,54 write $j(i,2),"  ",$C(27)_"["_i_"m"_"Hello"_$C(27)_"[0m",!
Eduard Lebedyuk · Sep 11, 2019 go to post

Probably not the answer you're searching for but here's an idea:

set i = 0
set text = "Hello World!"
set fill = $justify("", $length(text))
for {
  set i = i+1
  write $char(13) _ $case(i#2, 1:text, 0:fill)
  hang 1
}
Eduard Lebedyuk · Sep 9, 2019 go to post

Thank you.  That's it.

I wanted to move calculation into $PIECE which was the root of my troubles.

Interestingly, when I pass empty path value ("") it is recognized as NULL on SQL side and

CASE :path
WHEN NULL 

does not work (never gets hit probably because it compares using equals and not is).

So it's either:

SELECT DISTINCT
    CASE nvl(:path,'')
    WHEN '' THEN $PIECE(Name, '.')
    ELSE $PIECE(Name, '.', 1, $LENGTH(:path, '.') + 1) END Name
FROM %Dictionary.ClassDefinitionQuery_SubclassOf('Ens.BusinessProcessBPL')
WHERE Name %STARTSWITH :path

or:

SELECT DISTINCT
    CASE
    WHEN :path IS NULL THEN $PIECE(Name, '.')
    ELSE $PIECE(Name, '.', 1, $LENGTH(:path, '.') + 1) END Name
FROM %Dictionary.ClassDefinitionQuery_SubclassOf('Ens.BusinessProcessBPL')
WHERE Name %STARTSWITH :path

It raises the question of how to pass empty string to SQL and avoid it being recognized as NULL, but it's irrelevant for my original inquiry.