Eduard Lebedyuk · Jan 24, 2019 go to post

Validation process is unable to process the message in 2 seconds. Probably because of the queue.

There are several ways to remedy that:

1. Increase timeout.

2. Make the call ASYNC.

3. Increase pool size for Validation process

4. Make validation process work faster.

Eduard Lebedyuk · Jan 24, 2019 go to post

File selection dialog sorts by file type (extension).

I agree that by Name would be better probably.

Eduard Lebedyuk · Jan 24, 2019 go to post

Nice feature to have.

One note about the code: if you have a BO that accepts only one type of messages, you can (I myself prefer to - as it immediately notifies the reader that this BO works with only one  type of messages, and not just a small BO in development) remove Message map altogether and define an OnRequest method, which would process these messages. Pull request.

Eduard Lebedyuk · Jan 22, 2019 go to post

You use 8bit Caché. Maybe you need to convert GraphQL.xml into your local encoding.

Or use Unicode Caché.

Eduard Lebedyuk · Jan 21, 2019 go to post

If you want, you can pass current IP as a header or inside the message body.

Do you want it for logging purposes, such as what actions were performed from which IP?

Eduard Lebedyuk · Jan 21, 2019 go to post

My go-to https redirect:

RewriteEngine on
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
Eduard Lebedyuk · Jan 21, 2019 go to post

Strange, as that should not be hit for AbstractREST at all.

Does you class looks the same as in repo?

Just compiled successfully on:

Cache for Windows (x86-64) 2017.2 (Build 744U) Fri Sep 29 2017 10:58:27 EDT
Eduard Lebedyuk · Jan 21, 2019 go to post

Looks like NAT. Cloud server only sees external address (214.17.17) as it should.

Why do you want to get internal address?

Eduard Lebedyuk · Jan 20, 2019 go to post

Try installing httpd from the package manager for your OS..

Add http to https redirect.

Maybe plugins go to https first, so redirect all traffic to https. Good for various cached links, etc.

Eduard Lebedyuk · Jan 18, 2019 go to post

If someone is interested, here's the same code but as a class:

/// Utility to match input against comma-separated string of masks.
Class util.Matcher
{

/// Returns $$$YES if input matches at least one element from the list
/// input - string to match
/// list - comma separated list of masks containig * and ?
/// write ##class(util.Matcher).MatchOr()
ClassMethod MatchOr(input As %String, list As %String) As %Boolean
{
    set ok = $$$NO
    for pie=1:1:$L(list,",") {
        set mask=$P(list,",",pie)
        if mask'="",..Match(input,mask) {
            set ok = $$$YES
        }
    }
    quit ok
}

/// Returns $$$YES if input matches all elements from the list
/// input - string to match
/// list - comma separated list of masks containig * and ?
/// write ##class(util.Matcher).MatchAnd()
ClassMethod MatchAnd(input As %String, list As %String) As %Boolean
{
    set ok = $$$YES
    for pie=1:1:$L(list,",") {
        set mask=$P(list,",",pie)
        if mask'="",'..Match(input,mask) {
            set ok = $$$NO
        }
    }
     quit ok
}

/// Returns $$$YES if input matches the mask
/// write ##class(util.Matcher).Match()
ClassMethod Match(input As %String, mask As %String) As %Boolean [ CodeMode = expression ]
{
input?@..MaskToPattern(mask)
}

/// Translate mask into a pattern
/// write ##class(util.Matcher).MaskToPattern()
ClassMethod MaskToPattern(mask As %String) As %String
{
    set pattern = ""
    set char = ""
    for pos = 1:1:$length(mask) {
        set curChar = $extract(mask, pos)
        if curChar = "*" {
            set pattern = pattern _ $select(char="":"", 1:"1"""_char_"""") _ ".E"
            set char = ""
        } elseif curChar = "?" {
            set pattern = pattern _ $select(char="":"", 1:"1"""_char_"""") _ "1E"
            set char = ""
        } else {
            set char = char _ curChar
        }
    }
    set pattern = pattern _ $select(char="":"", 1:"1"""_char_"""")
    quit pattern
}

}
Eduard Lebedyuk · Jan 18, 2019 go to post

You can store salt in the same table, it should just be unique (autogenerated) for each password.

There's a good explanation why that's enough, here.

Eduard Lebedyuk · Jan 16, 2019 go to post

Do not store passwords.

Store password hashes + Unique salt. When entered hash

Check $system.Encryption class for various hashing algorithms.

The only case where you need to store passwords is when they are used to authenticate Cache server against external systems.

In that case use the same $system.Encryption class to encrypt them for storage.

we're talking of 200-300+ passwords here.

Per user?

Eduard Lebedyuk · Jan 16, 2019 go to post

Is the "bi login" hosted on the same Cache server?

If so you'll need to add /dsw and /mdx2json to the same group/same cookie path as your app and you should be all set.

Eduard Lebedyuk · Jan 12, 2019 go to post

You could (and probably should) separate these parts of routines as separate methods or at least subroutines.

Eduard Lebedyuk · Jan 12, 2019 go to post

And if you don't have labels, adding them wouldn't break existing code.

For example you have this routine:

TEST
    write 1
    write 2
    write 3
    quit

It, when called would output

>do ^TEST
123

If you then add a label somewhere:

TEST
    write 1

MYLABEL
    write 2
    write 3
    quit

The routine would wok the same on previous calls:

>do ^TEST
123

But you'll also be able to call only the label:

>do MYLABEL^TEST
23
Eduard Lebedyuk · Jan 11, 2019 go to post

Can you ballpark the workload?

If it's not too big, I think the easiest solution would be just writing ObjectScript method that calculates what you need.

Eduard Lebedyuk · Jan 10, 2019 go to post

tFullValue should be always equal to tNumber regardless of tNumber value.

write $l(2.1)

>3
Eduard Lebedyuk · Jan 10, 2019 go to post

I'm curious about this

set tFullValue = $EXTRACT(tNumber,1,$length(tNumber))

in what cases tFullValue is not equal to tNumber?

Also after 2014 you can use * to denote last char like this:

set tFullValue = $EXTRACT(tNumber,1,*)
Eduard Lebedyuk · Jan 9, 2019 go to post

There's no default function to do it, but you can easily develop your own custom function. There's $IsValidNum ObjectScript function, which could be used to check that variable is a number. So something like this should work:

/// Functions to use in rule definitions.
Class Custom.Functions Extends Ens.Rule.FunctionSet
{

/// Returns 1 if a string is a number, 0 otherwise
ClassMethod IsValidNumber(string As %String) As %Boolean [ CodeMode = expression, Final ]
{
$ISVALIDNUM(string)
}

}
Eduard Lebedyuk · Jan 9, 2019 go to post

SendRequestAsync is available in all Ensemble Hosts (Services, Operations, Processes).

For Operations and Services the signature is:

Method SendRequestAsync(pTargetDispatchName As %String, pRequest As %Library.Persistent, pDescription As %String = "") As %Status

And for Processes the signature is:

Method SendRequestAsync(pTargetDispatchName As %String, pRequest As Request, pResponseRequired As %Boolean = 1, pCompletionKey As %String = "", pDescription As %String = "") As %Status