elasticsearch pipeline doesn't match paths - elasticsearch

i'm trying to catch the paths that contains a specified path like
path/to/my/url/variablePart,
in the pipeline condition i put
ctx.url.path == 'path/to/my/url/' but unfortunately it takes only the logs that have path/to/my/url/ without considering the other ones with a variable part,
there is a wildcard that can help me to catch every path that start with 'path/to/my/url/'??
I have already tried to do ctx.url.path == 'path/to/my/url/*' but without effect.
thanks for the help!

You have two options:
A. use a regular expression match:
"if": "ctx.url.path =~ /^path\\\/to\\\/my\\\/url\\\//",
B. use the String.indexOf() function
"if": "ctx.url.path.indexOf('path\/to\/my\/url\/') == 0",

this is a peculiar situation, the path must be something like this, but instead set 'ctx.url.path == 'path/to/my/url/*' i would suggest you to use the percentage % in order to be:
'ctx.url.path == 'path/to/my/url/%' this should select all the sub paths in the directory.
If it still gets errors or doesn't respond you correctly, let me know..

Related

OR condition not working in Dialogflow CX

I have an intent that contains several parameters. I established a route that should be activated when the first parameter OR the second one is not empty:
$intent.params.tipo3.resolved : "" OR $intent.params.valutarapporti.resolved : ""
If either one of the parameter is not empty, then the agent should transit to another page.
The problem is that is only works when the first parameter is not empty; if the first one is empty but the second one is not, the transition does not happen. It seems like the condition "OR" is misfunctioning.
Note that the parameter is correctly recognized: the user says something that matches the correct intent, the parameter "valutarapporti" is recognized but then no transition happens.
If I separate the two conditions in two different routes, obviously it works, but I'd like to have a single route for such a simple thing. I tried setting them as session parameters, but the results does not change (and that's not really the issue: like I said, the parameter is recognized, the problem is with the transition).
To define a condition when only one intent parameter is set, but not both, you can use the following:
$intent.params.tipo3.resolved = null OR $intent.params.valutarapporti.resolved = null
In this case, you may need to define a separate condition for a situation when both parameters are set.
To define a condition when either one of the two intent parameters is set or both parameters are set, you can use the following:
$intent.params.tipo3.resolved != null OR $intent.params.valutarapporti.resolved != null
The answer posted by Svetlana solved my problem; I'll add that I also tried to define the condition as
$intent.params.tipo3.resolved != "" OR
$intent.params.valutarapporti.resolved != ""
and that solved my immediate problem. However, it meant that the route with this condition was always valid and the other routes were never even evaluated.

Sort a property in HCL Block

I would like to move name property to the top of the block like this.
There are many resouce block in a file.
Before
resource "datadog_monitor" "A" {
enable_logs_sample = "true"
name = "name"
tags = ["env:dev"]
}
resource "datadog_monitor" "B" {
enable_logs_sample = "true"
name = "name"
tags = ["env:dev"]
}
After
resource "datadog_monitor" "A" {
name = "name"
enable_logs_sample = "true"
tags = ["env:dev"]
}
resource "datadog_monitor" "B" {
name = "name"
enable_logs_sample = "true"
tags = ["env:dev"]
}
OK, I think :help :global and the range/address mechanism is one of Vim's best and most underrated feature so it might deserve a detailed run down.
The core editing pattern is the same as in the commands I suggested in my previous answer to a similar question of yours:
on each line matching a specific regular expression pattern,
do something.
Note that it is a "pattern", not a one-off trick. You are not supposed to "learn" this answer by heart, or commit it to "muscle memory", or bookmark it for the next time you have the exact same problem. Instead, you are supposed to grok the logic behind it in a way that allows you to:
recognize a situation where it might come handy,
apply it without too much thinking.
So, in order to implement the editing pattern described above, we use the :global command, which works like this:
:[range]global/<pattern>/[range]<command>
where:
in range (optional, default is %),
mark each line matching <pattern>,
then execute <command> on range (optional, default is .).
Like lots of things in Vim, :global is conceptually cool but not necessarily useful on its own. The more familiar you are with ranges/addresses and the more Ex commands you know, the more useful it is.
In this specific case, ranges don't matter much but addresses and Ex commands do… and their sum makes problems like these solvable in, IMO, a pretty intuitive way.
Now, let's go back to our problem:
move every "name" line to the top of the block
and express it in terms that match our editing pattern:
mark every line matching name,
then move it below the closest line above matching resource.
Which is a simple:
:g/name/m?resource?
Of course, the exact regular expression patterns to use are context-dependent.
The trick is to internalize the patterns so that you already know how to use any new building block you might come upon.
There is really nothing even remotely god-like, here.

Uipath string null

Does anyone know how to check for an unassigned string in uipath? Uipath seems to crash when an if statement looks for a null string. Not sure how to handle that. String.empty doesn't seem to work, and if the string is unassigned uipath stops logging and nothing happens.
There are many different approaches and ideas, but – according to me – what you can do is:
Always make sure before to define any variable by default, initialize it with empty strings(""). So it will be easy to check it with equal operator as well.
The Other approaches you can take in Uipath is based on .Net So u can use it's Is Nothing.
You can also use .Net String.IsNullOrEmpty Method (String) Method.
To check if a string variable is Null, you need to use either an If or Decision activity. The condition of those should be:
a is Nothing
This will return true if variable a is null and false otherwise
Best way to check string has value or not -->
These are some of the ways it can be checked.
1.
String.IsNullOrEmpty(yourString)
2.
yourString.Equals("")
3.
yourString.Equals(Nothing)
4.
yourString is Nothing
5.
String.IsNullOrWhiteSpace(yourString)
There are logical OR, AND and NOT to combine the different checks and they can clubbed together to check the best way to find out blank, null and whitespace string.
You can compare the string using:
Convert.ToString(DBNULL.Value)
We can check whether String is null with the following Syntax
String.IsNullOrWhiteSpace("Name_of_the_variable")
It will return boolean value
My suggestion is using the following method in UiPath
An If/Decision activity with the condition string.IsNullOrEmpty() making use of the IsNullOrEmpty() method
The best and easiest way will be the following:
String.IsNullOrWhiteSpace(stringVariableName)

VBA:Compare string with find function value

How to compare with case sensitive in find function?
Like
stringtxt = Range("A1:A10").Find(What:=stringtxt , Lookat:=xlWhole,MatchCase:=False)
Here suppose stringtxt="ABCD (abcd)"
AND in range one of the cells may have value like "ABCD (ABCD)"
I have to compare this with contents in range specified.
I tried adding like "UCase".Didn`t work.MatchCase i tried with both true and false values.Didnt work though.
Suggest me some better answers to compare.
One of the parameters to the Find method is a MatchCase parameter, as follows:
Think that should help you solve this problem.

Ruby regular expression for asterisks/underscore to strong/em?

As part of a chat app I'm writing, I need to use regular expressions to match asterisks and underscores in chat messages and turn them into <strong> and <em> tags. Since I'm terrible with regex, I'm really stuck here. Ideally, we would have it set up such that:
One to three words, but not more, can be marked for strong/em.
Patterns such as "un*believ*able" would be matched.
Only one or the other (strong OR em) work within one line.
The above parameters are in order of importance, with only #1 being utterly necessary - the others are just prettiness. The closest I came to anything that worked was:
text = text.sub(/\*([(0-9a-zA-Z).*])\*/,'<b>\1<\/b>')
text = text.sub(/_([(0-9a-zA-Z).*])_/,'<i>\1<\/i>')
But it obviously doesn't work with any of our params.
It's odd that there's not an example of something similar already out there, given the popularity of using asterisks for bold and whatnot. If there is, I couldn't find it outside of plugins/gems (which won't work for this instance, as I really only need it in in one place in my model). Any help would be appreciated.
This should help you finish what you are doing:
sub(/\*(.*)\*/,'<b>\1</b>')
sub(/_(.*)_/,'<i>\1</i>')
Firstly, your criteria are a little strange, but, okay...
It seems that a possible algorithm for this would be to find the number of matches in a message, count them to see if there are less than 4, and then try to perform one set of substitutions.
strong_regexp = /\*([^\*]*)\*/
em_regexp = /_([^_]*)_/
def process(input)
if input ~= strong_regexp && input.match(strong_regexp).size < 4
input.sub strong_regexp, "<b>\1<\b>"
elsif input ~= em_regexp && intput.match(em_regexp).size < 4
input.sub em_regexp, "<i>\1<\i>"
end
end
Your specifications aren't entirely clear, but if you understand this, you can tweak it yourself.

Resources