Eduard Lebedyuk · Sep 7, 2018 go to post

To create one property call:

http://127.0.0.1:52773/api/docdb/v1/NamespaceName/db/DBName/propertyName?type=propertyType&path=propertyPath&unique=propertyUnique

You'll need one call per property.

For your property Ergebniszuf, url would be:

http://127.0.0.1:52773/api/docdb/v1/NamespaceName/db/DBName/Ergebniszuf?type=%String&path=Ergebniszuf&unique=0
Eduard Lebedyuk · Sep 7, 2018 go to post

Interesting. Check this article - I think you'll need either HTTP Debugging proxy (probably) or Packet analyzer (maybe) to debug this further.

As you have reference implementation (Postman) you can start by comparing Postman request/response and Ensemble request/response using HTTP Debugging proxy.

Eduard Lebedyuk · Sep 7, 2018 go to post

When you get sc=1 , what about:

set resp=httpRequest.HttpResponse
zw resp
do resp.Data.OutputToDevice()
Eduard Lebedyuk · Sep 7, 2018 go to post

Compare output of

Set sc = httpRequest.Post("/sample/", 1)

with what Postman sends.

Also, what does

Set sc = httpRequest.Post("/sample/")
zw sc

show?

Eduard Lebedyuk · Sep 6, 2018 go to post

Continuous Delivery - what tools do you use to automate building, testing and deploying your applications?  Do you integrate issue tools/messaging/planning and CD tools?

Eduard Lebedyuk · Sep 6, 2018 go to post

Just add empty string as is:

ClassMethod Test(val = "")
{
 Set t = ##class(Forerun.Test).%New()
 Do t.ReviewedBy.Insert(val)
 $$$THROWONERROR(tSC, t.%Save())
 Set id = t.%Id()
 Set user = "me"
 &SQL(UPDATE Test.Test
            SET ReviewedBy = ReviewedBy||$ListBuild(:user)
            WHERE ID=:id
            )
 If SQLCODE<0 Write "Problem",! Quit
}
Eduard Lebedyuk · Sep 6, 2018 go to post

Usually response does contain status information in StatusCode and StatusLine properties.

You need to change this line

Set httpResponse = httpRequest.Post("/sample/", 2)

to

#dim sc As %Status = $$$OK
Set sc = httpRequest.Post("/sample/", 2)
Write $System.Status.GetErrorText(sc)

As Post method returns status.

After debugging you can use

write $$$ISERR(sc)

macro to check if result of some operation is an error.

Eduard Lebedyuk · Sep 6, 2018 go to post

The easiest solution would be

set net.SSLCheckServerIdentity=0

that disables server cert checking. Not very secure obviously.

Eduard Lebedyuk · Sep 5, 2018 go to post

Do you want to change ROWSPEC depending on passed argument?

ROWSPEC can be changed on compilation only and it's rather static. At least xDBC clients depend on declared schema/query info and so it cannot be changed dynamically.

Eduard Lebedyuk · Sep 5, 2018 go to post

it causes error messages as something in the class is not correct,

What error messages?

Also try calling

zwrite %objlasterror

it may contain additional information.

Eduard Lebedyuk · Sep 4, 2018 go to post

You can use methods of %Activate.TLEnumerator class to load libraries programmatically.

Eduard Lebedyuk · Sep 4, 2018 go to post

I think you'll need a full fledged orchestrator for that. Docker run always starts one container, bit several volumes could be mounted, some of them RW, some RO. I'm not sure about mounting the same folder into several containers (again, orchestration).

You can also use volumes_from argument to mount directory from one container to another.

Eduard Lebedyuk · Sep 3, 2018 go to post

Redefine HTTP adapter like this:

Class Production.Adapter.HTTPOutboundAdapter Extends EnsLib.HTTP.OutboundAdapter
{

/// Send a POST to the configured Server, Port and URL, sending form data to the named form variables.
Method Post(Output pHttpResponse As %Net.HttpResponse, pFormVarNames As %String, pData...) As %Status
{

    quit ..SendFormDataArray(.pHttpResponse, "POST", ..GetRequest(), .pFormVarNames, .pData)
}

ClassMethod GetRequest() As %Net.HttpRequest
{
    set request = ##class(%Net.HttpRequest).%New()
    set request.ContentType = "application/json"
    quit request
}

}

And use it instead of default adapter.

Eduard Lebedyuk · Aug 31, 2018 go to post

Similar script is used in InterSystems IRIS docker image to scramble passwords on startup.

Eduard Lebedyuk · Aug 31, 2018 go to post

Try this:

1. Write stream to string

2. Use $zcvt on string $zcvt(string,"O","UTF8")

3. Send this stream to XSLT

Eduard Lebedyuk · Aug 29, 2018 go to post

Speed comparison:

Class POI.Test
{

/// do ##class(POI.Test).main()
ClassMethod main(rounds As %Integer = 1000, size As %Integer = 10, nullPercent As %Integer = 20)
{
    set list = ..getList(size, nullPercent)
    
    write !,"Rounds: ", rounds
    write !,"Size: ", size
    write !,"NullPercent: ", nullPercent
    write !,"List: "
    zwrite list
        
    set ways = $lb("listnext", "listfind", "lfs", "base")
    for i=1:1:$ll(ways) {
        set way = $lg(ways, i)
        set start = $zh
        
        set list2 = $classmethod(,way, rounds, list)
        
        set end = $zh
        
        set time = end - start
        
        write !,"Way: ", way
        write !,"Time: ", time
        write !,"List: "
        zwrite list2
        write !
    }
}

ClassMethod base(rounds As %Integer = 1000, list As %List) As %List
{
    for i=1:1:rounds {
        set origList = list
    }
    quit origList
}

ClassMethod listfind(rounds As %Integer = 1000, list As %List)
{
    for i=1:1:rounds {
        set origList = list
        set ptr=0
        for  set ptr=$LISTFIND(origList, $c(0), ptr) quit:'ptr  set $LIST(origList, ptr, ptr)=$lb()
    }
    quit origList
}

ClassMethod listnext(rounds As %Integer = 1000, list As %List)
{
    for i=1:1:rounds {
        set list2 = ""
        set ptr = 0
        while $listnext(list, ptr, elem) {
            if elem'=$C(0) {
                set list2 = list2 _ $LB(elem)
            } else {
                set list2 = list2 _ $LB()
            }
        }
    }
    quit list2
}

ClassMethod lfs(rounds As %Integer = 1000, list As %List)
{
    for i=1:1:rounds {
        set str = $lts(list)
        set str = $tr(str, $c(0))
        set list2 = $lfs(str)    
    }
    quit list2
}

ClassMethod getList(size As %Integer = 10, nullPercent As %Integer = 20) As %List
{
    set list = ""
    for i=1:1:size {
        set list = list _ $lb($select($random(101)<=nullPercent:$c(0),1:$random(50)))
    }
    quit list
}

Results:

POI>do ##class(POI.Test).main(1000000)
 
Rounds: 1000000
Size: 10
NullPercent: 20
List: list=$lb(25,20,$c(0),$c(0),4,42,$c(0),28,44,3)
 
Way: listnext
Time: .944814
List: list2=$lb(25,20,,,4,42,,28,44,3)
 
 
Way: listfind
Time: .610244
List: list2=$lb(25,20,,,4,42,,28,44,3)
 
 
Way: lfs
Time: .430088
List: list2=$lb("25","20","","","4","42","","28","44","3")
 
 
Way: base
Time: .032151
List: list2=$lb(25,20,$c(0),$c(0),4,42,$c(0),28,44,3)

listfind solution seems optimal.