Eduard Lebedyuk · Jun 17, 2021 go to post

Use docker-ls:

PS D:\Cache\distr> .\docker-ls tags --registry https://containers.intersystems.com intersystems/iris-community
requesting list . done
repository: intersystems/iris-community
tags:
- 2020.1.1.408.0
- 2020.3.0.221.0
- 2020.4.0.547.0
- 2021.1.0.215.0
Eduard Lebedyuk · Jun 17, 2021 go to post

I'm running:

store/intersystems/iris-ml-community:2021.1.0.215.0

And $zv is:

IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2021.1 (Build 215U) Wed Jun 9 2021 12:37:06 EDT

Are $zv for ml and non ml builds the same? How can I distinguish if my app is running on ml or non ml build?

Eduard Lebedyuk · Jun 17, 2021 go to post

Thank you for the info Guillaume!

I would like to clarify that I'm not an author of Community R Gateway (although I do publish it).

Shiao-Bin Soong is the author of both Community R Gateway and R Gateway.

Eduard Lebedyuk · Jun 16, 2021 go to post

Thank you Benjamin!

But I see it does not mention R at all and there's no corresponding R method in $system.external:

set javaGate = $system.external.getJavaGateway()
set netGate = $system.external.getDotNetGateway()
set pyGate = $system.external.getPythonGateway()
Eduard Lebedyuk · Jun 16, 2021 go to post

It should be

http://localhost:52773/user/api/test

and not:

http://localhost:52773/user/api/test/

Also, do either:

  • In application settings set Password as Allowed Authentication Method and in your Postman request add Basic Auth
  • In application settings add %ALL role in Application Roles
Eduard Lebedyuk · Jun 16, 2021 go to post

Improved manageability for our External Language Servers, which now also cover R and Python.  

Are there any docs for that, especially R and Python?

Eduard Lebedyuk · Jun 8, 2021 go to post

There's a standard method for it:

write ##class(%PopulateUtils).Integer(min, max)

If you're okay with 0 as a first digit you can use:

write $tr($j($random(10000),4)," ", 0)

Note, that $random is preudo-random, if you require strictly random values you should use the GenCryptRand() method of the %SYSTEM.Encryption class.

Eduard Lebedyuk · Jun 8, 2021 go to post

I would like to know if I can move only user database or default databases as well??

All databases can be moved

what sort of permission do I need to change for new directory path

irisusr should have RW access to the folder. The easiest way is to check what access (owner, group, permissions) is set for existing files/folders and then recreate the same in a new location.

and what all files I need to copy at new location??

IRIS.DAT and stream subfolder if it exist.

Please suggest if modification in iris.cpf file can do this all operation  

Absolutely.

Eduard Lebedyuk · Jun 8, 2021 go to post

It's not IRIS related. %PrimaryRequestHeader is defined in Ens.BusinessProcess and so  not available for BO/BS.

Use %RequestHeader property, available in BS and BO.

Eduard Lebedyuk · Jun 5, 2021 go to post

1. Install InterSystems IRIS.

2. Shut it down.

3. Open <iris>/iris.cpf, there you will find:

[Databases]
USER=C:\InterSystems\IRIS\Mgr\user\

[Journal]
AlternateDirectory=C:\InterSystems\IRIS\Mgr\journal\
CurrentDirectory=C:\InterSystems\IRIS\Mgr\journal\

[config]
wijdir=C:\InterSystems\IRIS\Mgr\WIJ

4. Edit this file as you wish and move the corresponding directories.

5. Start InterSystems IRIS.

Eduard Lebedyuk · Jun 4, 2021 go to post

%CELL is exactly what I need:

SELECT
  NON EMPTY
  {
    [DateOfSale].[Actual].[YearSold].&[2016],
    [DateOfSale].[Actual].[YearSold].&[2017],
    %LABEL(%CELL(-1,0) / %CELL(-2,0), "YTY", "#%;")
  } ON 0,
  NON EMPTY [Product].[P1].[Product Name].Members ON 1
FROM [HOLEFOODS]

  

Eduard Lebedyuk · May 27, 2021 go to post

If you're talking about drawn connections:

They are defined in OnGetConnections method, check what does it do:

/// Return an array of connections for drawing lines on the config diagram
ClassMethod OnGetConnections(Output pArray As %String, pItem As Ens.Config.Item)
{
}

That said, the drawn connections and this method are just visual docs. Developers are expected to provide this method and keep it relevant but in no way are they beholden to do it.

The only way to know what does any BH do is to go through the code or visual trace.

Eduard Lebedyuk · May 21, 2021 go to post

What's your linefeed symbol?

Also you have a string, not a stream.

Anyway, try this:

set nl = $$$NL
set str = "2334" _ nl _ "3434" _ nl _ "5543" _ nl _ "4334"
for i = 1:1: $length(str, nl) {
    set value = $piece(str, nl, i)
    write value, !
}
Eduard Lebedyuk · May 19, 2021 go to post

%xsd.base64Binary is essentially a string so you can't write more than 3,5 mb there.

Change property definition to %Stream.GlobalCharacter instead.

Eduard Lebedyuk · May 19, 2021 go to post

Global buffers are one of the keys to performance.   

Yes, that's why if streams are to be stored in the db they should be stored in a separate db with distinct block size and separate global buffers.

Eduard Lebedyuk · May 18, 2021 go to post

There are a lot of considerations.

Questions:

  1. Can you describe what are you going to do with that streams (or files I guess)?
  2. Are they immutable?
  3. Are they text or binary?
  4. Are they already encrypted or zipped?
  5. Average stream size?
Eduard Lebedyuk · May 18, 2021 go to post

Replace:

do fileStream.Rewind()
while 'fileStream.AtEnd {
           set tsRequest.DocumentData = tsRequest.DocumentData_fileStream.Read(30000)
}

with

do tsRequest.DocumentData.CopyFrom(fileStream)

or even:

do tsRequest.DocumentData.CopyFrom(pRequest.Stream)
Eduard Lebedyuk · May 4, 2021 go to post

Some time ago I was working on the issue of a fast data generation for an arbitrary data model.

Data model was connected (object properties) and so to generation was going in stages from low-cardinality independent tables (i.e. product) to high-cardinality dependent tables (i.e. orders). Furthermore tables did not have continuous IDs, there were gaps (due to sharding in my case but even if there's no hard delete we might want to exclude soft deleted rows).

Here's the approach I used.

1. For a given class build a local with all ranges of IDs:

/// d ##class().Ranges()
ClassMethod Ranges(class As %Dictionary.Classname, Output ranges)
{
    kill ranges    

    set table = ##class(%CSP.UI.Portal.SQL.Home).Quoter2(##class(%DeepSee.Utils).%GetSQLTableName(class))
    
    set rs = ##class(%SQL.Statement).%ExecDirect(,"SELECT ID FROM " _ table _ " ORDER BY ID ASC")

    do rs.%Next()
    set start = rs.ID
    set end = rs.ID
    while rs.%Next() {
        if rs.ID - 1 = end {
            d $i(end)
        } else {
            set ranges($i(ranges)) = $lb(start, end-start)
            set start = rs.ID
            set end = rs.ID
        }
    }
    
    set ranges($i(ranges)) = $lb(start, end-start)
}

This method accepts class name and returns this structure:

ranges(num) = $lb(startID, length)

2. Call GetRandomInRanges method to get random ID from ranges local:

/// d ##class().GetRandomInRanges()
ClassMethod GetRandomInRanges(ByRef ranges)
{
    set sum = 0
    
    for i=1:1:ranges {
        set sum = sum + $lg(ranges(i),2)
    }
    
    set threshold = $random(sum) + 1
    
    set sum = 0
    for chunk=1:1:ranges {
        set sum = sum + $lg(ranges(chunk),2)
        quit:sum>=threshold
    }    
    
    set val = ranges(chunk)
    if $listvalid(val) {
        if $ll(val)=2 {
            set val = $lg(val, 1) + $random($lg(val, 2))
        } else {
            set:$listvalid(val) val = $lg(val, ($random($ll(val))+1))
        }
    }
    
    quit val
}

This method guarantees that returned IDs would conform to the normal distribution.

Ranges should be called once and GetRandomInRanges  can be called as often as needed.