I am new to VS code (1.21.1) with HIE 0.1.0.0 - installed using stack. I have been able to define a task for testing:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "test",
"type": "shell",
"command": "stack build --test",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
I checked the documentation mentioned but did not understand much.
This task works only on the project I specified it for; how to make it usable for any project I happen to have open in the editor? How to further automate the selection of tasks?
I assume that there is somewhere a collection of tasks to run stack with HIE - could somebody point me to it?
I'm not sure if this is the problem you run into, but Visual Studio Code gives you the ability to edit settings per work-space/project in addition to overall settings:
Make sure that you're editing the USER SETTINGS tab instead of the WORKSPACE SETTINGS tab, if you want the settings to all projects.
Apologies if this is a trivial answer, and the problem is something completely different.
Related
I have a set of Azure functions running in the Azure running over a year already shoveling a huge amounts of data and everything has been fine so far. Last code update was about 3 weeks old and since then again it's processed a lot of data. 2 days ago we suddenly noticed it just stopped working and the Azure function does not start at all. On my dev PC obviously everything works like charm.
Error message #1
I'm using DI in Azure function, I load assembly during function startup and register it to the IoC. The error message is, that the type is not assignable to the interface. Which was clearly nonsense as
a. It is
b. It's been working this way since forerer. Since I got really desperate I decided to do an experiment and I modified the code (essentially removing the interface), that would prevent the function runtime to throw this particular error and it was replaced by another.
Error message #2
So the Azure function runtime stopped complaining about object inheritance, but now it is displaying a different error message.
Microsoft.Azure.WebJobs.Extensions.DurableTask: Value cannot be null. (Parameter 'hostConfiguration').
I googled it like crazy, went through DurableTask documentation, but still no ideas. I can restart function, redeploy it, but nothing helps.
My host.json is:
{
"version": "2.0",
"functionTimeout": "00:15:00",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"maxTelemetryItemsPerSecond": 20,
"excludedTypes": "Request"
}
},
"console": {
"isEnabled": true
}
},
"extensions": {
"http": {
"routePrefix": ""
},
"durableTask": {
"hubName": "IngressFunctionHubVS"
}
}
}
Literally any idea why perfectly running Azure function (it literally ran for ~18 month and processed tenths of GBs of data) can suddenly stop working without any our intervention ( I checked the logs - no one touched it) will be highly appreciated.
This is my first time been asked to write a documentation and my choice of way to do it is by using jsdoc.
This following is the sample jsdoc.json config file for my jsdoc. It read just a single README.md file.
{
"source": {
"include": "./client/src",
"includePattern": ".js$",
"excludePattern": "(node_modules/|docs)"
},
"plugins": ["plugins/markdown"],
"templates": {
"cleverLinks": true,
"monospaceLinks": true,
},
"opts": {
"recurse": true,
"destination": "./docs/",
"readme": "./README.md"
}
}
How can I make it to read multiple .md file like if I have index.md and content.md?
I just wanted to do the same functionality, and the approach that I found is not perfect, but it works good enough.
In JSDOC there is an functionality called "tutorials".
What I have done, is created on the root of my project folder "Tutorials" and added to the "opts" section in my config file the following:
"opts": {
"tutorials": "./Tutorials",
}
In the tutorials folder you create as many .md files you need, keeping in mind that every tutorial needs to have unique name.
Every time you want to connect something with specific tutorial (for example tutorial called "content.md") you need to put
{#tutorial content}
This works in both Readme.md and any js file you have documentation. Also you can connect one tutorial with another.
you can learn more about the feature here:
https://jsdoc.app/about-tutorials.html
https://jsdoc.app/tags-inline-tutorial.html
my answer is a bit late, but I hope this can at least help you for future projects :)
I'm trying to configure my VUI to repeat a sentence in Dialogflow when it is prompted for this. Little back story, I am helping develop a social robot for elderly so repeating a sentence is a much needed feature. I just started on this project and the previous developer responsible for this is gone and not reachable, also, I have no experience in Node.js.
I am looking to use the multivocal for this. These are the steps I have done so far:
Created an intent called 'Repeat'.
Added training phrases for the intent
Added 'multivocal.repeat' as an action
Enabled webhook call for this intent
In Node.js added 'intentMap.set('Repeat', repeat);' to my existing intentMap
// Run the proper function handler based on the matched Dialogflow intent name
let intentMap = new Map();
intentMap.set('Game_Rock_Paper_Scissors - Result', game_stone_paper_scissors);
intentMap.set('Game_Rock_Paper_Scissors - Result - yes', game_stone_paper_scissors_again);
intentMap.set('Conversation tree', conversation_tree);
intentMap.set('Question date', question_date);
intentMap.set('Question time', question_time);
intentMap.set('Music', music);
intentMap.set('Repeat', repeat);
Next, under the 'Fulfillment' tab, I want to enter the function inside the Inline Editor 'index.js' tab and make sure in the 'package.json' that the multivocal library is installed and usable. So far, there are a few things in my package.json
"name": "dialogflowFirebaseFulfillment",
"description": "This is the default fulfillment for a Dialogflow agents using Cloud Functions for Firebase",
"version": "0.0.1",
"private": true,
"license": "Apache Version 2.0",
"author": "Google Inc.",
"engines": {
"node": "8"
},
"scripts": {
"start": "firebase serve --only functions:dialogflowFirebaseFulfillment",
"deploy": "firebase deploy --only functions:dialogflowFirebaseFulfillment"
},
"dependencies": {
"actions-on-google": "^2.2.0",
"firebase-admin": "^5.13.1",
"firebase-functions": "^2.0.2",
"dialogflow": "^0.6.0",
"dialogflow-fulfillment": "^0.5.0"
}
}
So, how do I install the library? In the Read.me is says 'You can install it using npm install --save multivocal.' But where would I install this? Do I put this somewhere in the index.js or packages.js?
Also, in this example it shows the index.js code to be:
const Color = require('./color.js');
Color.init();
const Multivocal = require('multivocal');
exports.webhook = Multivocal.processFirebaseWebhook;
Should I just add this to the end of my index.js? Or should it be wrapped in a function? Sorry to be so not experienced in this but I hope I explained it clearly.
Some answers for using multivocal using the Dialogflow Inline Editor:
How do I include this in the package.json file?
The directions for using npm are if you're writing the fulfillment locally and not using the Editor.
You need to add this line in the dependencies section:
"multivocal": "^0.14.0"
and Dialogflow / Firebase Cloud Functions will take care of importing the library. You won't need the "actions-on-google", "dialogflow", or "dialogflow-fulfillment" libraries, so the section can look something like this:
"dependencies": {
"firebase-admin": "^5.13.1",
"firebase-functions": "^2.0.2",
"multivocal": "^0.14.0"
}
How do I write my index.js?
The simple example assumes that you can put your configuration and code in a separate file ("color.js" in the example). Since you can't do that with the Inline Editor, the general boilerplate of your code will be something like this:
// Import the library on the first line, so you can call methods on it to setup your configuration
const Multivocal = require('multivocal');
// Your configuration and code go here
// Setup the webhook as the final line
exports.dialogflowFirebaseFulfillment = Multivocal.processFirebaseWebhook;
Where do the Intent Handler registration and functions go?
Unlike the dialogflow-fulfillment library, multivocal doesn't use an explicit intentMap. It maintains one itself, so to register an Intent Handler function you would use something like
Multivocal.addIntentHandler( intentName, handlerFunction );
BUT keep in mind that handler functions are also a little different.
What? How are they different?
Multivocal has a lot of things handled through configuration, rather than code. So there is no direct counterpart to the agent.add() function call that you'd have with dialogflow-fulfillment or the actions-on-google library.
Instead, your Intent Handler function should perform any logic, database calls, or whatever to get values that will be used in responses and save them in the Environment. Every Handler should return a Promise that contains the Environment.
You should also set configuration for your Intent - the most common of which is to set the possible "Response" templates. The most simple response templates just include text, and where to insert values from the environment. It is also best practice to prompt the user for what they can do next, so we might setup a "Suffix" template to use by default, or one to use for specific Intents, Actions, or Outents.
So if you had an Intent named "color.favorite", and had a value in the environment called "color" (that your handler may have loaded from a database), the configuration for this response in English may look something like this. It also includes a default suffix to prompt the user what they can do next.
const config = {
Local: {
en: {
Response: {
"Intent.color.favorite": [
"{{color}} is one of my favorite colors as well.",
"Oh yes, {{color}} can be quite striking.",
"I can certainly understand why you like {{color}}."
]
},
Suffix: {
Default: [
"What other color do you like?"
"Tell me another color."
]
}
}
}
}
and you would register this configuration with
new Multivocal.Config.Simple( config );
You can (and are expected to) register multiple configurations, although you can combine them in one object. So the Response section above could contain response sections for each of your Intents, by name.
Ok, but how do I handle a "repeat" Intent?
All you need to do is provide an Intent that has its "Action" set to "multivocal.repeat" in the Dialogflow UI and that has the webhook enabled. So something like this would work:
Multivocal already has registered a handler and configuration based on this.
If you want to change the possible responses, you can add configuration for the "multivocal.repeat" Action. Which may look something like this:
const enRepeat = [
"Sorry about that, let me try again.",
"I said:"
];
const config = {
Local: {
en: {
Response: {
"Action.multivocal.repeat": enRepeat
}
}
}
}
and then either combine this configuration with other configurations you've written, or load it as above.
To emphasize - there is no need for you to write any code for this, just some optional configuration.
so I built a script in node.js which supposed to take csv files, parse them and enter them to DB.
Sometimes, when I debug my code, it stops on like an invisible breakpoint found in async_hooks.js file, on the first line of the "emitHookFactory" function (line 163).
The call stack states only one call- "emitBeforeNative" on the same file.
I noticed a few things on my trials:
I have 3 types of files I need to parse and put in the DB. It happens only on one of the file types, which is extremely large (3.1m~ lines on csv, while the others have 50~200K lines). I tried to load it partially- only the starting 20K lines (copied them to a new file, no changes in code) and it didn't break. which means the size has to do with the debugger stopping?
I tried to reproduce it with other means but no success. Also, it doesn't happen always (even when ran on the same file)- but like 80-85% of the times.
My script goes like this: query DB and AWS to find a new file > download file to local > stream the file from local > on line event- parse line and perform data manipulations > on end event - loop through all manipulated data, build queries and query the DB to insert it. I've put a few breakpoints on key places and found out the breakpoint SEEMS to happen somewhere in the middle of emitting the line events. The callback function is a normal function, not async, and there are no async operations inside. In fact, there are only array and string manipulations operations inside- not even 3rd party operation or anything unusual.
I tried to look at the internet for solution. Didn't find any clear way to comletely get rid of it, only workaround which I didn't really understand (kinda new to JS environments so I could not get the concepts of how can I disable or ignore it...)
Thanks for the help in advanced.
Based on https://github.com/nodejs/node/issues/15464
There's a way to ignore stepping into Node guts. In your launch.json add the following skipFiles directive:
"skipFiles": [
"<node_internals>/**"
]
or you can ignore particularly /internal/async_hooks with this:
"skipFiles": [
"<node_internals>/internal/async_hooks.js",
"<node_internals>/internal/inspector_async_hook.js"
]
After all, your config may look like this:
{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Debug",
"runtimeExecutable": "<your executable path>",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}",
"timeout": 30000,
"skipFiles": [
"<node_internals>/**"
]
}
]
}
This also might be related to a known NodeJS bug: https://github.com/nodejs/node/issues/36022
Could you please try whether our new JavaScript debugger still has this problem. For details see the release notes of VS Code 1.42: https://code.visualstudio.com/updates/v1_42#_new-javascript-debugger.
I'm using Sublime Text 3, and SublimeLinter just upgraded itself to version 4.0.1.
I've read the docs but can't work out how to get it working properly. I have tried copying the default settings into user settings and changing them but it has made no difference (this is via Preferences > Package Settings > Sublime Linter > Settings).
The gutter icons are all just white; I've tried setting it to:
"gutter_theme": "Default",
I've also tried changing the icon in styles:
"styles": [
{
"mark_style": "outline",
"priority": 1,
"scope": "region.yellowish markup.changed.sublime_linter markup.warning.sublime_linter",
"icon": "warning",
"types": [
"warning"
]
},
{
"mark_style": "outline",
"priority": 1,
"scope": "region.redish markup.deleted.sublime_linter markup.error.sublime_linter",
"icon": "error",
"types": [
"error"
]
}
],
The outline around error text is now incredibly faint and I can barely see it; previously it was clear and bright.
Anybody know how to configure the new version to highlight errors clearly and show different icons for warnings, errors? Thanks for any help!
(How I wish this hadn't updated itself. The docs say you can manually install an older version but that looks like another project in itself, I just want to get on with some work!)
Edit: more fiddling around and setting "mark_style": "fill", in "styles" has at least made the errors visible on the page. But I can't figure out how to get the gutter icons to be different.
It's not you, there's an open issue on GitHub. See here.