I want to be able to store context variables into a text file.
Im using this code:
"context" : {
"number_extract" : "<? input.text.extract('[\\d]+',0) ?>"
}
to extract variables into and store in context variable. But now i want to be able to extract it from Watson Assistant for e.g. store it into a text file or any other format. Is this possible or is there another way?
Yes, you can store the context from variables in text files or in a database. Watson Assistant allows to make programmatic calls from within a dialog. The code that is invoked would then take care of writing the extracted information to the file or database.
I wrote a tutorial that uses the extracted information to store it in a database or to search in that database with extracted search terms. The code is on GitHub, so you can see how it is done.
Related
I wanna build external editor for scripts stored in crm.
I have API which exposes script engine returning list of scripts containing ,script id, script name, content...
Editor will be Visual Studio Code plus my extension. Manage to build extension and get data, store scripts on in the folder and give them name from the response. Problem is in update, to send data back to the server i need to use id not the name.
Question: is there any kind of container in workspace where i can store all data related to every script such as Id?
Something like settings for every script containing scriptName:id, date, owner...
Maybe https://code.visualstudio.com/api/extension-capabilities/common-capabilities#data-storage can help? You can store data either locally, in the workspace, or globally, in the user' storage space. Can be simple key/value pairs, or your own format.
I am using CloverETL Designer for ETL operations and I want to load some csv files from GCS to my Clover graph. I used FlatFileReader and tried to get file using remote File URL but it is not working. Can someone please detail the entire process here??
The path for file in GCS is
https://storage.cloud.google.com/PATH/Write_to_a_file.csv
And I need to get this csv file into the FlatFileReader in CloverETL Designer
You should use the Google Cloud Storage API to GET the file; Clover's HTTPConnector component will allow you to pass in the appropriate parameters to make a GET request (you will presumably have to do an OAuth2 authentication first to get a token), and send the output to a local destination specified in "Output File URL." Then you can use a FlatFileReader to read from that local file.
GCS has several different ways to download files from your buckets. You can use the console and the Cloud Storage browser. Steps: open the storage browser, navigate to the object you want to download, right click, and save to your chosen local folder. If you use Chrome the save appears as “Save Link As…”.
To use the GS Utility, use this command:
`gsutil cp gs://[BucketName]/[ObjectName] [ObjectDestination]`.
Or you can use client libraries or the REST APIs to download files. With these last options you could work with a number of files or create a job to download them. Once they are in a location known to Clover ETL the process is straightforward.
Within Clover designer, under the navigation pane you can right click a folder and choose import. Pick the one in which you placed your GCS file. Once the file is imported then you can use data from it like any other datafile in Clover. Since this is a .csv file, remember to edit your metadata (right click the component, choose extract metadata then edit inside the Metadata Editor -- for data types, labels and such.) Assign metadata to the edges of your components so they know what is coming in/going out of that step. Depending on your file, this process may be repeated many times.
Even with an ETL tool, getting the data and data types correct can be tricky. If you have questions about how to configure data types or your edges in an ETL project, a wiki may help. The web has additional resources may help you get the end analysis you’re looking for.
I decided to raise the issue here. I use mysql as the database as a storage and would like to add draft-js into the web page I am building now. What is the correct way of getting and saving data into the database? Any working examples would be great!
You should use convertToRaw and convertFromRaw methods. Extracts from documentation:
convertFromRaw(rawState: RawDraftContentState): ContentState
Given a raw state, convert it to a ContentState. This is useful when
restoring contents to use within a Draft editor.
convertToRaw(contentState: ContentState): RawDraftContentState
Given a ContentState object, convert it to a raw JS structure. This is
useful when saving an editor state for storage, conversion to other formats, or other usage within an application.
I forked this pen for demonstration how these methods work. Open my pen. First, let's consider a saving editor state. I added "Log editor state" button. If you open console and click on the button, you can see current representation of editor state as JavaScript object. You can convert this object to JSON and save this JSON in your database using the appropriate API endpoint.
click to image for full size
The case when you need to show your editor on the page not empty, with a predefined content which you had previously saved in database or, for example, localstorage. Here, you should use createWithContent method and mentioned above convertFromRaw method. In my example I stored JSON string in the variable editorStateAsJSONString, for a real-world case you should request API endpoint, which returned JSON, and, after it, render the editor component as described.
I am trying to create a new visualization (sheet) in a tableau online workbook via javascript API or by another language. Not by using Tableau Desktop or "manual" interaction into Tableau Online.
I know that the JS API allows me to control (filter, display, etc.) existing visualizations, and the SDK can extract data and publish, but my need is to "create" a new visualization into an existing workbook.
Is there a way to do this?
The only methods of creating Tableau content that I'm aware of is using Tableau Desktop or Web authoring of something that is already published.
I explain how to do what you're asking on the blog post linked below. You can use Python with Jinja2.
The basics ...
Create a template of your XML.
Put in the necessary Jinja2 templating language code into your template as placeholders for the data and XML that needs to be rendered by Jinja2. You can render data conditionally as well.
Create a CSV file that specifies what the Python program needs to know to create your workbooks.
Run your Python application to generate a TWB file based on your template and input file. You can also easily create TWBX by zipping the TWB and data together.
The link gives code examples and an example CSV file for specifying your input.
https://www.linkedin.com/pulse/create-tableau-visualizations-programmatically-allan-thompson
I have this problem:
I want to make an interface where the user can drag and drop file uploads. Filepicker.io provides an easy solution to this in the form of filepicker.makeDropPane. However, this feature does not support parallel uploads without the callbacks getting confused.
So I would like to write my own drag/drop interface using standard html5 listeners, and make a direct api upload call to filepicker.io with the actual file data in string form. This way I can write the management of parallel uploads on my own.
Does filepicker.io have an api call that would allow me to do this? I only see these two things:
1) File selection modal
2) Auto drag-drop features
I don't see a way to simply upload a file directly from file data.
What can I do?
You should make use of the filepicker.store() command, which accepts a DOM file object. For example:
var input = document.getElementById("store-input");
filepicker.store(input, function(FPFile){/*your code here*/});
More details available at https://developers.filepicker.io/docs/web/#store