I'm new to SAP SCPI Development and been learning about it for weeks now, and today my exercise is all about message mapping and becoming familiar with the message mapping environment. However, I am stuck figuring out how use the "substring" expression during my development.
The requirement is to turn emails from "abcd.12345#company.com" to just "abcd.12345". I would have to remove the "#" and the domain.
I just asked this question to my instructor but I am having trouble how to do it. He mentioned to use the "substring" expression to shorten the email. But my problem is that there are too many records on my source .xsd file and the length of emails vary.
I am unsure on what to input on the message mapping and making a custom groovyscript function so I came to Stack Overflow to ask for help.
Message Mapping Substring
I am open to read and understand your takes on this. Many thanks!
Related
Intro: (Feel free to skip it).
I`ve dealt in a casual way with elastic stack almost daily for the last couple of years as the two companies I worked for use it to aggregate logs. The problem is that in neither of those companies we had an "expert" in elastic stack so any time I need to search through logs I am by myself with little help from google.
Usually, I have a trace id field I can search for so I don't have to deal with queries; but when I need to search strings or other things inside other fields everything seems like an overwhelming struggle.
The problem is probably me, but after an insane amount of grind and googling i feel like I am missing something.
Main Issue:
We usually have some logging entries with the format: "methodName, inputOfTheMethod" or "methodName, outputOfTheMethod" or "methodName, errorMessage", or we need to find specific ids for people, customers or account numbers like "0042342672101" inside the logs or certain keywords like "Account Opening"
So, I have a couple of objectives I am currently wasting hours every time i have to do some serious debugging:
Search for the equivalent of "LIKE %methodName, %" in SQL for the "message" field on kibana.
Search for all the entries that have the string "0042342672101" in any position of the "message" field
Search for all the entries that have the literal string "Account Opening" in any position of the "message" field. It seems to be specially difficult to search for literal strings with spaces on it.
I did a lot of googling on these issues but i usually end in the official documentation that brings little help outside the generic examples or with similar questions on forums with no answers.
I would really love to solve these specific issues or even deeper insight on how to approach them or why this wouldn`t work and what are the alternatives to achieve this.
I am using Microsoft Bot Framework to develop chatbot and my questions is that how can I handle incorrect responses from a user.
Suppose bot asks for name of user and he or she replies "don't know".
I have seen in boiler plate code of bot framework that it handles minimum length validation, but how can I handle this logical checking.
Thanks in advance.
I am assuming you are using the v4 C# SDK, let me know if this is not correct and I can update my answer for node or v3 for you.
This Sample Does exactly what you are trying to do It has a validator that checks the length of the user's input and reprompts if the length is too short. You can see this in this method
In general name validation is fairly difficult because names can be very diverse and contain special characters like "-", "'", and others. Using a prompt with a custom validator should give you the opportunity to at least add some validation like length and numerical character checking.
An expected answer normally has a known format. If bot is asking a name then the name would not have numbers and special characters.. You can do a quick check if the words returned by user are part of standard english words (there are plenty libraries having this list of words). You can even pass the returned sentence to LUIS and see if you get a known intent, and then you can disqualify the answer.
I was reading the template documentation of rsyslog to find better properties and I stumble upon this one:
spifno1stsp - expert options for RFC3164 template processing
However, as you can see, the documentation is quite vague. Moreover, I have not been able to find a longer explanation anywhere. The only mentions found with Google are always about the same snippet or the same very short description.
Indeed, there is no explanation of this property:
on the entire rsyslog.com website,
or in the RFC3164,
or anywhere else actually.
It is like everybody copy & paste the same snippet here and there but it is very difficult to understand what it is actually doing.
Any idea ?
Think of it as somewhat like an if statement. If a space is present, don't do anything. Otherwise, if a space is not present, add a space.
It is useful for ensuring that just one space is added to the output, often between two strings.
For any cases like this that you find where the docs can be improved please feel free to open an issue with a request for clarification in the official GitHub rsyslog documentation project. The documentation team is understaffed, but team members will assist where they can.
If you're looking for general help, the rsyslog-users mailing list is also a good resource. I've learned a lot over the years by going over the archives and reading prior threads.
Back to your question about the spifno1stsp option:
While you will get a few hits on that option, what you'll probably find more results on is searching for the older string template option, sp-if-no-1st-sp. Here is an example of its use from the documentation page you linked to:
template(name="forwardFormat" type="string"
string="<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogtag:1:32%%msg:::sp-if-no-1st-sp%%msg%"
)
Here is the specific portion that is relevant here:
`%msg:::sp-if-no-1st-sp%%msg%`
From the Property Replacer documentation:
sp-if-no-1st-sp
This option looks scary and should probably not be used by a user. For
any field given, it returns either a single space character or no
character at all. Field content is never returned. A space is returned
if (and only if) the first character of the field’s content is NOT a
space. This option is kind of a hack to solve a problem rooted in RFC
3164: 3164 specifies no delimiter between the syslog tag sequence and
the actual message text. Almost all implementation in fact delimit the
two by a space. As of RFC 3164, this space is part of the message text
itself. This leads to a problem when building the message (e.g. when
writing to disk or forwarding). Should a delimiting space be included
if the message does not start with one? If not, the tag is immediately
followed by another non-space character, which can lead some log
parsers to misinterpret what is the tag and what the message. The
problem finally surfaced when the klog module was restructured and the
tag correctly written. It exists with other message sources, too. The
solution was the introduction of this special property replacer
option. Now, the default template can contain a conditional space,
which exists only if the message does not start with one. While this
does not solve all issues, it should work good enough in the far
majority of all cases. If you read this text and have no idea of what
it is talking about - relax: this is a good indication you will never
need this option. Simply forget about it ;)
In short, sp-if-no-1st-sp (string template option) is analogous to spifno1stsp (standard template option).
Hope that helps.
I just wanted to know if anything changed on geocode API from 21 st February because before 21st it was validating zip code 9 digits but from yesterday it is giving an error on 9 digits zip code and now it only validating 5 digits zip code.
More information in your question would be helpful.
I haven't noticed any change, but I thought I'd take a look at the GeoCoder Documentation FAQ for you.
Yes, based on that date, I'd say something changed recently.
Perhaps this is what you're referring to, but that's only a speculation since you didn't provide any detail or examples.
Troubleshooting
I’m getting more queries that return ZERO_RESULTS with the new geocoder. What’s going on?
In the new geocoder, ambiguous, incomplete and badly formatted queries, such as misspelled or nonexistent addresses, are prone to produce ZERO_RESULTS. These queries would typically produce incorrect results in the old geocoder, such as returning the suburb if the address could not be found. We believe that returning ZERO_RESULTS is actually a more correct response in such situations.
If your application deals with user input of addresses, the Place Autocomplete feature in the Places API may produce better quality results. Place Autocomplete allows users to select from a set of results based on what they’ve typed, which allows users to choose between similarly named results, and to adjust their query if they misspell an address.
If you have an application dealing with ambiguous or incomplete queries or queries that may contain errors, we recommend you use the Place Autocomplete feature in the Places API rather than the forward geocoder available in the Geocoding API. For more details, see Best Practices When Geocoding Addresses and the Address Geocoding in the Google Maps APIs blog post.
More Information:
Documentation FAQ
Related Issue Tracker
I'm an absolute knob when it comes to programming, so I ask of your help.
Essentially I'm trying to use the api.ai interface to create a character counter (in slack) where when a user says something like "hi" the bot will respond with "2".
So far I understand that I'm supposed to use an entity in order to achieve this transformation, and I have tried mapping reference words like "hi" with the synonym "2". However, the entity transformation ends up having the bot spew out exactly what the user initially said (ex. "hi"), instead of my desired outcome ("2").
Am I going about this wrong, or am I supposed to use an already existing entity to in my new entity? I apologize in advance as I literally picked this thing up yesterday, so I don't know much about it.
Any help is appreciated!
You cannot write logic in api.ai, meaning you cannot write a function that takes as input a message and returns the number of characters.
What you would need, I believe, is to integrate the api.ai with an external web service where you can write your business logic.
Have a look at Slack + Webhook Integration Example https://docs.api.ai/docs/slack-webhook-integration-guideline
However, if you just want to count the number of chars in a message, I do not see the need for api.ai.