vania-janet/multiturn-rag-retrieval-data huggingface dataset:
* The buildpack was updated to download the latest 1.x [MariaDB Connector/J JDBC driver](https://mariadb.com/kb/en/about-mariadb-connector-j/) when performing [auto-configuration for MySQL type of services](https://cloud.ibm.com/docs/cloud-foundry-public?topic=cloud-foundry-public-auto_config).



Updated Node.js buildpack v3.0-20160125-1224
: This release is fully synchronized with the [Cloud Foundry community Node.js](https://github.com/cloudfoundry/nodejs-buildpack) buildpack. In addition to community changes, modifications were made to certain defaults, along with optimizations to reduce staging time and updates to the App Management feature.



* Buildpack updates:



* Node.js v4.2.4 (IBM SDK for Node.js Version 4) is now the default runtime on IBM Cloud, replacing v0.12.9. This change might cause your app to behave differently if a particular version is not specified for your app. To learn how to specify a version of Node.js for your IBM Cloud app, see [Node.js runtime](https://cloud.ibm.com/docs/cloud-foundry-public?topic=cloud-foundry-public-nodejs_runtime) documentation.
* NODE_ENV is now set to production by default. This change will cause some node dependencies to behave differently. For example, the Express framework will no longer return stack traces in the web browser for faulty endpoints, but instead displays Internal Server Error. When NPM_CONFIG_PRODUCTION is set to true, NPM will set NODE_ENV to production for subshell scripts in the NPM install phase only. This function allows users to set NODE_ENV to another value like development for app runtime. For clarity, NPM scripts will see the message NODE_ENV=production.
* A Bug-fix to the Monitoring and Analytics service is included.



* Caching updates:
The POST URI used to create a resource SHOULD be the same as the GET URI for listing resources of the same kind.

[4]For example, if GET /users lists all users, and users can be created by a client, then POST /users SHOULD create a user.

The response to a POST request which successfully and synchronously creates a resource MUST have the status code 201 Created and a Location header with the URI of the newly-created resource

[5]and SHOULD include the created resource in the response body. If including the resource is expensive (in terms of bandwidth or computation), [preference headers](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-headerspreference-headers) SHOULD be supported to give the client control over whether the resource is included.

Fields which are not mutable or not recognized MUST result in a 400 status code and appropriate error response model.





 Other uses 

Since POST requests are the only avenue for handling unsafe, non-idempotent, or safe and body-bearing

[6]operations that don't fit into another category, a POST request MAY invoke such an operation, even if it does not result in the explicit creation of a resource.

In this case, the request body MAY be permitted to be absent or have a format unrelated to any resource which can be retrieved using a GET request. When such a request is successful, it SHOULD return a 200 OK status (for a response including a description of the result) or a 204 No Content status.

[7]







 PUT 

A successful PUT request SHOULD replace an existing resource or, in specific cases, create a new resource.

The resource impacted by a PUT request MUST be located at the URI used in the request.

[8]For example, if PUT /users/bob updates a user, GET /users/bob MUST retrieve the same user.

When a PUT request is successfully and synchronously used to replace an existing resource, a status of 200 OK MUST be returned.

[9]

Fields which are not mutable or not recognized MUST result in a 400 status code and appropriate error response model.
* Replace <app_enroll_id> with the application enroll ID provided by your network operator.
* Replace <app_enroll_secret> with the application enroll secret provided by your network operator.
* Replace <msp_id> with the MSP ID of your organization. You can find your MSP ID under the "organizations" section of your connection profile.



4. Navigate to enrollUser.js using a terminal and run node enrollUser.js. If the command runs successfully, you should see the following output:

Successfully enrolled client "user1" and imported it into the wallet

The SDK will create and store your certificates inside the wallet/user1/ directory that is created by the command. This directory is the file system wallet that is used submit future transactions.



The wallets that are used by the Fabric SDKs are different from the wallet in the IBM Blockchain Platform console. The identities that are stored in your console wallet cannot be directly used by the SDK.





 Invoking a smart contract by using the SDK 

After you generate the application signing certificate and private key and store them in a wallet, you are ready to submit a transaction. You need to know the name of the smart contract and the name of the channel it was deployed on. You can use the following steps to invoke a smart contract with the [Fabric SDK for Node.js](https://hyperledger.github.io/fabric-sdk-node/release-2.2/index.html).



1. Save the following text on your local machine as invoke.js in the same directory as enrollUser.js.

'use strict';

const { FileSystemWallet, Gateway } = require('fabric-network');
const fs = require('fs');
const path = require('path');

async function main() {
try {

// Parse the connection profile. This would be the path to the file downloaded
// from the IBM Blockchain Platform operational console.
from_='<TWILIO_NUMBER>',
to='<YOUR_DESTINATION_NUMBER>'
)

return {"result": "Message status " + message.status}
Show more

Where:



* YOUR_ACCOUNT_SID is your Twilio SID that can be found at [twilio.com/console](http://www.twilio.com/console).
* YOUR_AUTH_TOKEN is your Twilio Auth token that can be found at [twilio.com/console](http://www.twilio.com/console).
* TWILIO_NUMBER is the Twilio trial phone number assigned to you in the second step.
* YOUR_DESTINATION_NUMBER is the number where the SMS message is to be sent.



7. Create a ZIP file with the code and the information required to run. Your ZIP file must contain your __main__.py file and all the files created in your twilio directory.
8. Create an IBM Cloud function to run your code using the following command.

ibmcloud fn action create sms-twilio twilio.zip --kind python:3.7 --main twilio

See [Packaging Python code with a local virtual environment in a compressed file](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-prepprep_python_local_virtenv) for more information on the process to deploy a function written in Python.
9. Get your IBM Cloud API key by running the following command. The API key will be required to integrate IBM Cloud Monitoring with your IBM Cloud function.

ibmcloud iam api-key-create ibm-cloud
10. [Access the IBM Cloud Monitoring console.](https://cloud.ibm.com/docs/monitoring?topic=monitoring-launchlaunch_step2).
11. [Configure an IBM Cloud Monitoring notification channel that will send the desired alerts to IBM Cloud® Functions.]
* Enter this command into the terminal: curl https://us-east.planning-analytics.cloud.ibm.com/api/4WBG0PXNT6U0F/v0/tm1/Servers -H "Authorization: Bearer $ACCESS_TOKEN" -sf | jq -C.
* Replace the instance ID used above (4WBG0PXNT6U0F) with the instance ID for the server you want to access.



2. The server will return a list of all active databases.







 Retrieving cubes from a database 

In this section, you will retrive the cubes from a database.



1. Retrieve the cubes from a database:



* Enter this command into the terminal: curl https://us-east.planning-analytics.cloud.ibm.com/api/4WBG0PXNT6U0F/v0/tm1/IssueReports/Cubes -H "Authorization: Bearer $ACCESS_TOKEN" -sf | jq -C.
* Replace the database used above (IssueReports) with the database you wish to retrive cubes from.



2. The server will return a list of cubes that are within the database.
Logging with Windows VPC server instances 

Use the IBM® Log Analysis service to monitor and manage logs from a Windows VPC server instance in a centralized logging system on the IBM Cloud.

You can collect and monitor system and application logs.

NXLog is used to provide log files to IBM® Log Analysis.

To configure NXLog, you must enable a port to send logs via syslog to your logging instance. If you are using (a) the classic syslog protocol, (b) a custom port in syslog-ng, or (c) a custom port in rsyslog, there is no authentication available and anyone with knowledge of the endpoint can submit logs to your instance. As a result, depending on your environment, your use of the classic syslog protocol or custom port configurations with syslog-ng or rsyslog may present a significant security risk. Use these configurations at your organization's own risk. Validate with your compliance and security teams whether this security risk is acceptable to your organization.

By default, NXLog monitors log files in the C:\ProgramData\logs directory.

On the IBM Cloud, configure an Windows server to forward logs to an IBM Log Analysis instance by completing the following steps:



1. Provision a VPC running Windows.
2. Provision an instance of the IBM Log Analysis service.
3. Configure NXLog on the Windows server.
4. Optionally, add additional directories to be monitored by the agent.



Zoom

![Component overview on the IBM Cloud](https://cloud.ibm.com/docs-content/v1/content/f61dbc5d84bf0c89e477a05cab04c72f429e1b7a/log-analysis/images/Log-Analysis-04-Windows.svg)

Figure 1. Component overview

In this tutorial, you will learn how to configure a Windows server to forward logs to an IBM Log Analysis instance.

In this tutorial you will configure a Windows VPC server.
On an object HEAD or GET request, [the If-Modified-Since header](https://tools.ietf.org/html/rfc7232section-3.3) will check to see if the object's Last-Modified value (for example Sat, 14 March 2020 19:43:31 GMT) is newer than a provided value. If the object has been modified, the operation will proceed. If the object has not been modified, the system will return a 304 Not Modified.

> If-Modified-Since is typically used for two distinct purposes: 1) to allow efficient updates of a cached representation that does not have an entity-tag and 2) to limit the scope of a web traversal to resources that have recently changed.





 Using If-Unmodified-Since 

On an object PUT, HEAD, or GET request, [the If-Unmodified-Since header](https://tools.ietf.org/html/rfc7232section-3.3) will check to see if the object's Last-Modified value (for example Sat, 14 March 2020 19:43:31 GMT) is equal to or earlier than a provided value. If the object has not been modified, the operation will proceed. If the Last-Modified value is more recent, the system will return a 412 Precondition Failed error on a PUT and a 304 Not Modified on GET or HEAD.

> If-Unmodified-Since is most often used with state-changing methods (e.g., POST, PUT, DELETE) to prevent accidental overwrites when multiple user agents might be acting in parallel on a resource that does not supply entity-tags with its representations (i.e., to prevent the "lost update" problem). It can also be used with safe methods to abort a request if the selected representation does not match one already stored (or partially stored) from a prior request.
The metadata could be as simple as the name of the asset, the name of the owner of the asset and the date of creation of the asset, or it could be something more complex, such as extracted speech from a video (subtitles). In any Digital Asset Management system, there can be any number of users and these users can have the ability to perform various actions on the asset in the system based on the permissions they have.

When you have completed this code pattern, you will understand how to:



* Package a blockchain smart contract using the IBM Blockchain Platform Extension for VS Code.
* Set up a Hyperledger Fabric network on IBM Blockchain Platform.
* Install and instantiate a smart contract package through IBM Blockchain Platform.
* Set up an instance of the IBM Cloud Object Storage service and connect it with the Node.js application.
* Test the blockchain network by executing a Node.js application with the Hyperledger Fabric SDK to interact with the deployed network by issuing transactions.







 Watch the video - Introduction and Demo 

Note: Click on the image below to view the video on YouTube. For Google Chrome, press the Ctrl key + the left mouse button and say Open link.

[![72086129-6eb48000-32d4-11ea-8869-d6362dd7556a.png](https://user-images.githubusercontent.com/8854447/72086129-6eb48000-32d4-11ea-8869-d6362dd7556a.png)](https://youtu.be/tfnRfDFWHUc)

The code pattern is seperated into these sections:



1. [Clone the repo](https://github.com/ibm-workshop/bda1-clone-the-repo)
2. [Package the smart contract](https://github.com/ibm-workshop/bda2-package-the-smart-contract)
3.
4. Retrieve the access token.



* Enter this command into the terminal : echo $ $ACCESS_TOKEN.









 Retrieve server ID's 

In this section, you will access the OData API, and retrieve a list of all instances in a data center, and their accompanying ID's. To gain direct access to a specific instance, you will require the service unique id.



1. Retrieve the server ID's.



* Enter this command into the terminal: curl https://us-east.planning-analytics.cloud.ibm.com/api/v0/tm1/Servers -H "Authorization: Bearer $ACCESS_TOKEN" -sf | jq -C.
* The planning analytics URL will vary depending on the data centre you provisioned your service at. The URL used above is for the Washington DC data Centre. If you are not certain of the URL you should use, you can retrieve it from your service launch page.



2. The server will return a list of all instances that can you can access.







 Retrieving active databases 

In this section, you will retrieve a list of active databases.



1. Retrieve a list of active databases.



* Enter this command into the terminal: curl https://us-east.planning-analytics.cloud.ibm.com/api/4WBG0PXNT6U0F/v0/tm1/Servers -H "Authorization: Bearer $ACCESS_TOKEN" -sf | jq -C.
* Replace the instance ID used above (4WBG0PXNT6U0F) with the instance ID for the server you want to access.



2. The server will return a list of all active databases.







 Retrieving cubes from a database 

In this section, you will retrive the cubes from a database.



1. Retrieve the cubes from a database:
Logging from a Windows client 

Use the IBM® Log Analysis service to monitor and manage logs from Windows client systems.

You will use NXLog to add your Windows logs into IBM Log Analysis.

To configure NXLog, you must enable a port to send logs via syslog to your logging instance. If you are using (a) the classic syslog protocol, (b) a custom port in syslog-ng, or (c) a custom port in rsyslog, there is no authentication available and anyone with knowledge of the endpoint can submit logs to your instance. As a result, depending on your environment, your use of the classic syslog protocol or custom port configurations with syslog-ng or rsyslog may present a significant security risk. Use these configurations at your organization's own risk. Validate with your compliance and security teams whether this security risk is acceptable to your organization.

NXLog is used to provide log files to IBM® Log Analysis.

By default, NXLog monitors log files in the C:\ProgramData\logs directory.

On the IBM Cloud, configure your Windows client to forward logs to an IBM Log Analysis instance by completing the following steps:



1. Provision an instance of the IBM Log Analysis service.
2. Configure NXLog on the Windows system.
3. Optionally, add additional directories to be monitored by the agent.



Zoom

![Component overview on the IBM Cloud](https://cloud.ibm.com/docs-content/v1/content/f61dbc5d84bf0c89e477a05cab04c72f429e1b7a/log-analysis/images/Log-Analysis-04-Windows.svg)

Figure 1. Component overview

In this tutorial, you will learn how to configure a Windows client system to forward logs to an IBM Log Analysis instance.



 Before you begin 

Before you begin, make sure you have an IBM Log Analysis instance configured.



 Make sure you have an ID with the proper permissions
function cancelMultiPartUpload(bucketName, itemName, uploadID) {
return cos.abortMultipartUpload({
Bucket: bucketName,
Key: itemName,
UploadId: uploadID
}).promise()
.then(() => {
console.log(Multi-part upload aborted for ${itemName});
})
.catch((e)=>{
console.error(ERROR: ${e.code} - ${e.message}n);
});
}
Show more

SDK References



* [abortMultipartUpload](https://ibm.github.io/ibm-cos-sdk-js/AWS/S3.htmlabortMultipartUpload-property)
* [completeMultipartUpload](https://ibm.github.io/ibm-cos-sdk-js/AWS/S3.htmlcompleteMultipartUpload-property)
* [createMultipartUpload](https://ibm.github.io/ibm-cos-sdk-js/AWS/S3.htmlcreateMultipartUpload-property)
* [uploadPart](https://ibm.github.io/ibm-cos-sdk-js/AWS/S3.htmluploadPart-property)









 Using Key Protect 

Key Protect can be added to a storage bucket to manage encryption keys. All data is encrypted in IBM COS, but Key Protect provides a service for generating, rotating, and controlling access to encryption keys using a centralized service.



 Before You Begin 

The following items are necessary in order to create a bucket with Key-Protect enabled:



* A Key Protect service [provisioned](https://cloud.ibm.com/docs/services/key-protect?topic=key-protect-provisionprovision)
: By default, actions accept only POST requests, but web actions can be invoked through any of these HTTP methods: GET, POST, PUT, PATCH, and DELETE, as well as HEAD and OPTIONS.

Trigger a web action from anywhere
: When you create an IBM Cloud® Functions web action, you generate a URL to invoke that action from any web-based app. Actions that are not web actions require authentication and must respond with a JSON object. To get the URL of a web action, you can run the [action get](https://cloud.ibm.com/docs/openwhisk?topic=cloud-functions-cli-plugin-functions-clicli_action_get) command and include the --url flag. For example, ibmcloud fn action get <action_name> --url.
: A web action API path can be used with cURL, wget, or even be entered directly in your browser. A web action can be invoked by using a URL that is structured as follows, https://<apihost>/api/v1/web/<namespace_ID>/<packageName>/<actionName>.<ext>.

Create fewer Cloud Functions entities
: Because you can invoke a web action from anywhere, you are not required to create other Cloud Functions entities like triggers or rules.

Allows non-2xx return codes
: Cloud Functions web actions can return non-2xx codes, allowing your code to be more flexible and allow for retries.





 How do web actions work? 

Web actions can be invoked without authentication and can be used to implement HTTP handlers that respond with headers, statusCode, and body content of different types.

Web actions must return a JSON object. However, the controller treats a web action differently if its result includes one or more of the properties as top-level [JSON properties](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-actions_webweb_action_properties).





 Packaging code for web actions
Response metadata 

The IBM Watson® Speech to Text service can return three types of metadata about its transcription results. You can request maximum alternatives to see multiple possible final transcription results. You can also request word confident and word timestamps to receive confidence measures and timestamps for each word of the audio.



 Maximum alternatives 

The max_alternatives parameter accepts an integer value that tells the service to return the n-best alternative hypotheses for the results. By default, the service returns only a single transcription result, which is equivalent to setting the parameter to 1. By setting max_alternatives to a number greater than 1, you ask the service to return that number of the best alternative transcriptions. (If you specify a value of 0, the service uses the default value of 1.)

The service reports a confidence score only for the best alternative that it returns. In most cases, that is the alternative to choose.

Internal changes and improvements to the service can affect transcripts and confidence scores. For example, speech recognition may be improved to return more precise transcription results. Similarly, transcript and word confidence scores might change slightly as a result of improved speech recognition. Such changes are expected to be modest, but do not expect transcripts and confidence scores to remain unchanged over time.



 Maximum alternatives example 

The following example request sets the max_alternatives parameter to 3:

IBM Cloud

curl -X POST -u "apikey:{apikey}" --header "Content-Type: audio/flac" --data-binary @{path}audio-file.flac "{url}/v1/recognize?max_alternatives=3"

IBM Cloud Pak for Data

curl -X POST --header "Authorization: Bearer {token}" --header "Content-Type: audio/flac" --data-binary @{path}audio-file.flac "{url}/v1/recognize?max_alternatives=3"

The service reports a confidence only for the most likely of the three alternatives:

{
"result_index": 0,
"results": [
{
"alternatives":
{
"confidence": 0.96,
fmt.Printf("n Unable to get Events:n - %sn", err)
return
}
printAsJsonFormat(result)
}

/
Shows the Event Logs User Types.
/
func getEventUserTypes() {
var service = services.GetEventLogService(sess)
result, err := service.GetAllUserTypes()
if err != nil {
fmt.Printf("n Unable to get User types:n - %sn", err)
return
}
printAsJsonFormat(result)
}

/
Gets a date offset in days determined by offsetDays value.
It returns a string date with SL API date filtering format.
/
func getDateString(offsetDays int) (resp string) {
years:=0
months:=0
days:= offsetDays
offsetTime:=time.Now().AddDate(years,months,days)
return fmt.Sprintf(
"%d-%02d-%02dT00:00:00.0000-06:00",
offsetTime.Year(),
offsetTime.Month(),
offsetTime.Day())
}

/
Prints the data as format JSON.
/
func printAsJsonFormat(data interface{}){
jsonData, jsonErr := json.MarshalIndent(data, "", " ")
if jsonErr != nil {
fmt.Println(jsonErr)
return
}
println(string(jsonData))
}

/
Prints the Event Logs.
/
func printLogs(logs []datatypes.Event_Log){
fmt.Printf("| %35s | %25s |%10s |n","Event Name","Event Create Date","User Type")
Although support for Fabric 2.0 networks was added to the platform, you can still run your existing smart contracts on your peers that run a v1.4 image on a channel with an application capability level of 1.4 or lower. Should you later decide to upgrade your peer to a v2.x image and update your channel application capability level to 2.0, you may need to update your existing smart contract. However, after you upgrade your peer image to v2.x and channel application capability v2.x, there is no longer a way to update the original smart contract. Instead, when an update is required, you need to repackage the smart contract in the new .tar.gz or .tgz format using v2 of the VS Code extension and then propose the definition to the channel using the new smart contract lifecycle process.

Review the following considerations:

Node

If your smart contract was written in Node, then you might need to update it. By default, a Fabric v1.4 peer will create a Node v8 runtime, and a Fabric v2.x peer creates a Node v12 runtime. In order for a smart contract to work with Node v12 runtime, the fabric-contract-api and fabric-shim node modules must be at v1.4.5 or greater. If you are using a smart contract that was originally written to work with Fabric 1.4, update the Node modules by running the following command before deploying the smart contract on a Fabric v2.x peer. See [Support and compatibility for fabric-chaincode-node](https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md) for more information.

npm install --save fabric-contract-api@latest-1.4 fabric-shim@latest-1.4

Go

Because Fabric v2.x peers do not have a "shim" (the external dependencies that allowed smart contracts to run on earlier versions of Fabric), you need to vendor the shim and then repackage any smart contracts written in Golang (Go) that use the [Go SDK](https://github.com/hyperledger/fabric-sdk-go).