IBM Chatbot Assistant - Array with same values - ibm-cloud

I have this piece of code in JSON editor of Watson:
"context": {
"array": "<? entities['spare_part'].![literal] ?>",
"array_size": "<?$array.size() ?>"
When the input of the user, for example, is "Hello, I need a valve, and the part number of the valve is 1234", the size of the array ends up being 2 since the user mentions the word "valve" twice in his input. Some nodes are being executed depending on size of the array. For instance if the size of the array is 1, some nodes will be ignored because they are only executed only if the size of the array is 2.
I want the array to store only the inputs with different values, which is basically I don`t want the array to store the values of the same type, in my case 2 valves. If it is possible somehow please show me a way.

All that can be done, but the best approach depends on the overall system architecture. Remember that Watson Assistant is a conversation service, not a data processing platform...
You can process JSON in either Watson Assistant directly using the built-in methods and SpEL, see these links to get started:
- https://console.bluemix.net/docs/services/conversation/expression-language.html#expressions-for-accessing-objects
- http://docs.spring.io/spring/docs/current/spring-framework-reference/html/expressions.html
- https://console.bluemix.net/docs/services/conversation/dialog-methods.html#expression-language-methods
That would require some coding within the dialog nodes. It could be ok. What I would recommend is to either process in your app that drives the dialog (you need that app anyway) or to code up small server actions to transform data.

If it is the word you are looking for, you can use contextual entities to train for this.
As an example I created the following intent (along with general intents from catalog).
For each example I highlighted the "valve" word that is the one I am interested in, and added to the entity.
Now when I test it I get the following.
All this was done in a couple of minutes. For production level you may want to add more examples, or think about how you want to annotate.

Related

IBM i Access Client Solutions - Printer Output but using an API

I want to replicate the functionality of the IBM i Access Client Solutions "Printer Output" tool that is used to retrieve PDF's of spooled files from our IBM Db2 environment. Instead of a user interface, I want to replicate the functionality as an API.
I want to construct an API which takes inputs such as the filter parameters pictured below:
The output of the API would be PDF(s) of the printer output spooled files that match the parameters specified.
I figure that if I am able to access the i Access Printer Output tool, then I should be able to use my credentials to access the spool files using an API or something like that.
Where would I start in constructing something like this?
Also, are there any IBM guides that contain relevant information? I have looked but been unsuccessful. The Programmer's Toolkit is, also, not available with my version of i Access.
Also, I don't have developer roles, so if this is possible, it would need to be something that I can do with little authority within the IBM i servers and the Access client.
First off, IBM ACS is Java based. Thus everything it does can be found in the IBM Toolbox for Java, aka JTOpen aka JT400.
http://jt400.sourceforge.net/
Documentation https://www.ibm.com/docs/en/i/7.4?topic=java-toolbox
You're going to want to look at the reading a transformed spool file example
The transformation actually happens on the IBM i side, by specifying the appropriate workstation customization object, QCTXPDF in this case rather than the examples original QWPTIFFG4
// The following examples demonstrate how to set up a PrintParameterList to
// obtain different transformations when reading spooled file data. In the code
// segments that follow, assume a spooled file already exists on a server, and
// the createSpooledFile() method creates an instance of the SpooledFile class
// representing the spooled file.
// Create a spooled file
SpooledFile splF = createSpooledFile();
// Set up print parameter list
PrintParameterList printParms = new PrintParameterList();
printParms.setParameter(PrintObject.ATTR_WORKSTATION_CUST_OBJECT, "/QSYS.LIB/QCTXPDF.WSCST");
printParms.setParameter(PrintObject.ATTR_MFGTYPE, "*WSCST");
// Create a transformed input stream from the spooled file
PrintObjectTransformedInputStream is = splF.getTransformedInputStream(printParms);

How do I get the event tags for a Coverity issue?

If I am looking at an issue in the Coverity user interface, how do I get the event tag or tags? I need to know a tag in order to suppress the finding using code annotations, as described in the question "How can I disable coverity checking using code annotation?" but I'm not seeing it or maybe don't know where to look.
The event tag is the first identifier-like word in each line of commentary that makes up the issue report.
For example, on Github, RcppCore/Rcpp issue 760 contains a screenshot that I have reproduced at half-size resolution with some annotations:
Zooming in on the code panel:
There are three events here:
alloc_fn: Storage is returned from allocation function operator new.
noescape: Resource new Rcpp::Rostream<true>::Buffer is not freed or pointed-to in basic_ostream. ...
leaked_storage: Failing to save or free storage allocated by new Rcpp::Rostream<true>::Buffer leaks it.
The event tags are "alloc_fn", "noescape", and "leaked_storage".
In this instance, all of them are associated with the same line of code (line 49), but in general they may appear on different lines and spread across multiple files.
To navigate to all of the events, use the Occurrences panel:
The Occurrences panel shows all of the events, organized into a tree, where child nodes are events in callee functions. The entire list is generally ordered in program execution order, although some events may be chronologically disconnected, for example if the finding involves multiple execution paths.
Each entry in the Occurrences panel has an event number (again, nominally chronological), the event tag, and the file name and line number. Clicking on an entry navigates to that event in the code panel.
Here are a couple related Synopsys support articles:
how to add code annotation? I do not know which name should exist with //coverity[]
Is there a document that lists all defect 'events' with their name and descriptions?

How to trigger Azure function with flutter

I created an azure function in c # and set up an HTTP trigger. I'm interested in how to call this function from the flutter application. I don't need to transfer any special data because everything is already in the link I use to call the function.I’ve created a simplified view of the function to demonstrate what I want.
https://functionapp220220124204147.azurewebsites.net/api/Quercus?status=Off
When it calls this function all it needs to do is change the value of the variable from on to off
I know this is not the correct way to make a function and I should not have such variables, but this is just a simplified version
Here is a workaround given by Vikash Kumar in the Medium article regarding How to call Azure Functions API through Flutter App Code:
Created Wordle Website which has a list of legit words and allows you to input a word only from that list where we validate if an input word is a legit English word.
First, he created the Azure Cosmos DB > container in it > added a few dates, word pairs like:
Created the Azure Functions which has input binding with the Cosmos DB and gets a list of stored words on every request.
This functionality is broken into 3 segments:
Validate the input word (not null, same length, convert to uppercase both)
Check if both words are the same
Status of each letter in the input word.
The deployed function app API will be in this format: https://wordle-api.azurewebsites.net/api/CheckWord?word=
Also created the flutter in the composition of the word_field component which creates an input widget that accepts a 5 letter word in 5 boxes (1 each) which is similar to the OTP field.
And the home component builds a scaffold and puts together a page to accept 6 attempts for words.
The _checkWord handler calls the wordle-api, gets the color code, and updates the components accordingly.
Calling the Function API in the above handler and writing the code about response status and the user-defined message to the response.
var uri = Uri.https('wordle-api.azurewebsites.net', '/api/CheckWord', params);
For Complete Code, Please refer this article.

Problems with GitHub rendering my README.rst incorrectly..?

I've got a GitHub repo/branch where I'm attempting to update the README.rst, but it's not formatting the way I expect when it comes to the bullet lists I'm including.
Everything seems ok except for my Usage section, in which I have the following:
*****
Usage
*****
- Open the template file that corresponds to the API call you'd like to make.
* Example: If we want to make a call to the RefundTransaction API we open up /templates/RefundTransaction.php
- You may leave the file here, or save this file to the location on your web server where you'd like this call to be made.
* I like to save the files to a separate location and keep the ones included with the library as empty templates.
* Note that you can also copy/paste the template code into your own file(s).
- Each template file includes PHP arrays for every parameter available to that particular API. Simply fill in the array parameters with your own dynamic (or static) data. This data may come from:
* Session Variables
* General Variables
* Database Recordsets
* Static Values
* Etc.
- When you run the file you will get a $PayPalResult array that consists of all the response parameters from PayPal, original request parameters sent to PayPal, and raw request/response info for troubleshooting.
* You may refer to the `PayPal API Reference Guide <https://developer.paypal.com/webapps/developer/docs/classic/api/>`_ for details about what response parameters you can expect to get back from any successful API request.
+ Example: When working with RefundTransaction, I can see that PayPal will return a REFUNDTRANSACTIONID, FEEREFUNDAMT, etc. As such, I know that those values will be included in $PayPalResult['REFUNDTRANSACTIONID'] and $PayPalResult['FEEREFUNDAMT'] respectively.
- If errors occur they will be available in $PayPalResult['ERRORS']
You may refer to this `overview video <http://www.angelleye.com/overview-of-php-class-library-for-paypal/>`_ of how to use the library,
and there are also samples provided in the /samples directory as well as blank templates ready to use under /templates.
You may `contact me directly <http://www.angelleye.com/contact-us/>`_ if you need additional help getting started. I offer 30 min of free training for using this library,
which is generally plenty to get you up-and-running.
For some reason, though, when you look at that on GitHub the first line of the bullet lists is coming up bold and italics and I have no idea why. Also, the sub-list where it shows Session Variables, General Variables, etc. is supposed to be all the same sub-list. I'm not sure why it's dropping into another sub when it sees General Variables.
Any information on what I've done wrong here would be greatly appreciated. Thanks!
Switch from .rst to .md and then use '#' for your headings.
## Usage
- Open the template file that corresponds to the API call you'd like to make.
* Example

Sending MMS on iPhone using CoreTelephony

I am interested in sending an MMS within a private application on the iPhone. A lot of the information I need is proprietary, and therefore I can't find it anywhere. Basically, I'm looking for the proper way to construct a CTMessage and encode it for MMS, and then sending it via one of the overloaded sendMMS functions. Thanks in advance.
For those interested: here is what I managed to dig up (&/OR piece together myself).
For every MMS, a CTMessage is allocated & initialized. addRecipient/setRecipient is called to do just that.
For each data/text section a CTMessagePart is built with its data and corresponding datatype, and then added to the CTMessage's items array. The first item in each MMS items array is always a CTMessagePart containing a SMIL-formatted layout that the recipient interprets to display the message. Each CTMessagePart following the first is in the order that it is referenced from the SMIL data.
Each (unmodifiied) iPhone has an instance of CTMessageCenter running, with the id sharedMessageCenter. Calling sharedMessageCenter's sendMMS, giving the id of the CTMessage you just created will automate the rest of the process. Essentially, the CTMessage is encoded using the CTMmsEncoder into an MMS-PDU hex string. (Not to sure of the correct name for it, hah). Anyways, sharedMessageCenter's send method will then send the (encoded) MMS to your provider's MMSC.
That pretty much sums it up, and should give anyone looking to head down that path a good place to start depending on what they're doing. I can do my best to answer any questions.