ForbiddenException in AssistantSimpleExample, with java-SDK - watson-assistant

I tried the first example in https://cloud.ibm.com/docs/services/assistant?topic=assistant-api-client, but whatever assistantID I used, it show me the same exception:
Exception in thread "main"
com.ibm.cloud.sdk.core.service.exception.ForbiddenException: Forbidden
at
com.ibm.cloud.sdk.core.service.BaseService.processServiceCall(BaseService.java:371)
at
com.ibm.cloud.sdk.core.service.BaseService$WatsonServiceCall.execute(BaseService.java:419)
at AssistantSimpleExample.main(AssistantSimpleExample.java:31)
What can I do for that?

I need to add this:
service.setServiceUrl("https://gateway-syd.watsonplatform.net/assistant/api");
Then it solved.

Related

how can i fix image src

When I use this code, it's right :
img(src="http://localhost:3030/uploads/customerimages/42.jpg", alt="image")
but this code gives 404 error :
img(src="./uploads/customerimages/42.jpg", alt="image").
The second one output is http://localhost:3050/information/edit/uploads/customerimages/42.jpg
but need http://localhost:3030/uploads/customerimages/42.jpg.
http://localhost:3050/information/edit is current route.
How can i solve this?
Just remove dot before url
Use like
img(src="/uploads/customerimages/42.jpg", alt="image")

VS code Error : settings.json property expected (bug)

enter image description here
When I use VS Code, a problem notice likes that(in the above image) is printed.
Although I want to fix it and really don't want to see it, I can't find any way to fix.
I am very painful about just seeing that error message all the time.
Please give me some helps.
You opened a { parenthesis at line 2784 and didn't close it. You should close it. --> }
Also, you have an extra comma , at 2793 that you have to remove.
Not use {}, because you may already mess your settings.json before.
so my suggestion as follows:
// in/your/settings.json/file
...
setting0_name:[setting0.0, setting0.1],
seting1_name : settings,
...

Polymer paper-card failed to construct CustomElement

I've got an application that seems to work fine when I put all my elements inside a <dom-bind> element. When I remove that dom-bind (no longer needed), most of the elements carry on working, but paper-card stops and throws an error:
"Uncaught DOMException: Failed to construct 'CustomElement': The result must not have attributes"
The error is thrown from polymer/lib/legacy/lib/class.html if that helps. Anyone got any ideas?
I had the same error, and find out angular create an empty element (), then bind stuffs to it.
This fail according to spec:
4.13.2 Requirements for custom element constructors
The element must not gain any attributes or children
https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-conformance
I fix my problem by assigning in connectedCallback()

Polymer remove parent

When trying to remove a the parent element I have been able to use this line for most cases:
Polymer.dom(Polymer.dom(this).node.domHost.parentNode).removeChild(Polymer.dom(this).node.domHost);
Yet in some cases I get this error:
Uncaught Error: The node to be removed is not a child of this node: [object HTMLElement]
I have verified the child is there and the objects look correct, but I think I am probably missing a Polymer.dom() somewhere?
I have been able to solve it for all cases that I need by doing this:
var thisNode = Polymer.dom(this).node;
Polymer.dom(Polymer.dom(thisNode.domHost).parentNode).removeChild(thisNode.domHost);

Is there a way to highlight element with Watir?

I keep getting errors doing this:
puts browser.table(:after? => span(:text => "Asmeniniai duomenys") )[2][2].text
basically saying:
undefined method `span' for main:Object (NoMethodError)
or
undefined method `table' for main:Object (NoMethodError) etc...
so I decided that the table was not found. I tried if/else, but it's the first time I used ruby, I did not understand if it worked or not.
So I thought that the simplest way would be to find out how to highlight something.
Could anyone suggest how can I highlight elements or how to fix this problem?
I assume you mean to highlight the element so you can determine if the right element is being found.
You can use the Element#flash method. This method will change the background of the element a couple of times, which should help you figure out what element was found.
For example:
browser.table.flash