How to trigger Azure function with flutter - 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.

Related

Google Sheets not automatically creating hyperlinks when multiple files are uploaded on Google forms

Background:
I have a Google Form that asks clients to upload files. The form is attached to a Google Sheet where I want the files to be accessible to processing staff. A problem occurs when multiple files are uploaded. The Google sheet seems to not be able to create hyperlinks for the all the individual files.
There is a question about this already that has been resolved here:
https://stackoverflow.com/questions/70799922/google-app-script-to-convert-a-comma-seperated-list-of-urls-to-hyperlinks-in-she?answertab=modifieddesc#tab-top
The answer poses a custom function using Google App Script:
function onFormSubmit(e) {
// Get a Range reference to the cell containing the urls, possibly by using the event object passed in the form submit trigger:
var cell = e.range.getCell(1, urlColumn); // where urlColumn is the index of the column that contains the urls in question
var text = cell.getValue();
var richTextValueBuilder= SpreadsheetApp.newRichTextValue()
richTextValueBuilder.setText(text);
var urls = text.split(', ')
urls.forEach(function(url){
var startIndex = text.indexOf(url)
var endIndex = startIndex + url.length;
richTextValueBuilder.setLinkUrl(startIndex,endIndex,url)
})
cell.setRichTextValue(richTextValueBuilder.build())
}
My question is on how to use this as I have not had success.
First, when I run this script in the editor, I receive this:
TypeError: Cannot read property 'range' of undefined onFormSubmit # Code.gs:3
I'm pretty unfamiliar with java and have a working knowledge of python and am sure alot is missed in the details of how this script works.
As I understand it this error occurs if the script is run in the app script test function due to the formula being activated on an event which I believe is the submission of the form from the client.
I'm assuming that the custom function is to be set in a blank column that references the original results of the Google form links and converts them into the rich text links.
I've tested the script on the sheet on a blank column referencing the link information in the form results column and submitted a new form with the same result:
Link addresses appear as text and do not pull the documents.
Can anyone give me some clarity?

how to pass a variable value from one flutter page to another

suppose, I have a file body1.dart where I created a variable "hello" which was initially empty!
String hello = "";
Now, in the same file, I have created a loop which will set and update the value of hello after every iteration!
Now the thing is whenever the value of "hello" get changed, I want to display that inside a Text Field which is in a different file body2.dart. I want to retrieve the real-time value at that exact moment! (Not the final outcome at the end of the loop)
Can you provide code snippet for this? So that we can best assist you.
Otherwise the best option would be to use a stream. You can have multiple dart classes subscribed to the same stream.
Streams provide an asynchronous sequence of data. Data sequences include user-generated events and data read from files. You can process a stream using either await for or listen() from the Stream API
Checkout official documentation from dart.dev

IBM Chatbot Assistant - Array with same values

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.

Refresh or Clear GUI (Apps Script Gadget Embedded in Google Site)

I have a small form that my colleagues and I often fill out that can be seen here, with source code (view-only) here. The spreadsheet that this form posts to can be seen (view-only) here.
Basically, the apps script is solely for preventing my coworkers from having to scroll through thousands of rows of a spreadsheet (this is also used for our film collection) to check in/out inventory. It will also, soon, post detailed history of the checkout in an audit spreadsheet.
I have attempted, with no success, to clear the values of the text fields after the data has been posted to the spreadsheet. What I essentially want to do is restart the GUI so that the fields are once again blank.
I have tried accessing the text fields by id but the return type is a Generic widget, which I of course can't do anything with. And since control is passed to the handler functions, the text fields can't be accessed, or at least I can't figure out how (and I looked through the documentation and online solutions for hours last night).
So the question: how can I erase/clear the values of the text fields in the GUI after values have been posted to the spreadsheet? (return from handler function to access text fields again, or restart the GUI?
I can accomplish restarting the script runs on a spreadsheet, but I have not been able to do this when it is embedded in a Google site.
The getElementById('xxxxx').setText('') approach was the right way to do it. but the way you tried to test it doesn't work... the new value would only be available in the next handler call.
/*
This function only has the desired effect if it is called within the handler
function (not within a nested function in the handler function).
*/
function restartGUI() {
var gui = UiApp.getActiveApplication();
gui.getElementById('equipmentIDField1').setText('');
gui.getElementById('equipmentIDField2').setText('');
gui.getElementById('equipmentIDField3').setText('');
gui.getElementById('studentLastNameField').setText('');
gui.getElementById('labasstLastNameField').setText('');
return gui;
}

2 legged oauth and spreadsheet updating

I am using the google api to update some spreadsheets (using 2 legged oauth as explained here, except that I check the Two legged access control box ).
Creating the spreadsheets work fine, creating new worksheets inside a spreadsheet also works fine. But I can not seem to interact with the data on the spreadsheet....
I get either:
using listFeed
We're sorry, a server error occurred. Please wait a bit and try reloading your spreadsheet.
or
using CellFeed
com.google.gdata.util.AuthenticationException
Any ideas ?
Thanks
I ran into both of these errors when learning the Google spreadsheets API. I wish Google did a better job documenting these.
My issue with the listFeed method was that I was using upper case letters and spaces in my GDataSpreadsheetCustomElement names. Google doesn't like this. Here is what I posted on a similar question: Add row in spreadsheet (List-based feed) but it not works
"This very misleading error can occur if the GDataEntrySpreadsheetList you're trying to insert contains no GDataSpreadsheetCustomElements that are relevant to the worksheet.
When creating a GDataSpreadsheetCustomElement, the string you use for "name" must match the value in the first row of the spreadsheet for the column you're interested in, EXCEPT that it must be converted to all lower-case and have all spaces removed."
My issue with authentication using CellFeed was that I was using the wrong FeedURL. The feedURL you want when updating cells is [[worksheet cellsLink] URL]; where worksheet is the GDataEntryWorksheet object for the worksheet you're editing.