Is there a function in AnyLogic to display an alert message during model run? - anylogic

I would like to display some text in an alert box similar to what the error() and errorInModel() methods create, but not as an error, just a simple message. I searched for a built-in method in the Help, but couldn't find anything.
It's not intended for an end user, just for myself as an alternative to printing to console during debugging.

No, but you can create an agent type with a visual warning msg.
Embed the agent in Main as myAgent.
When you have your issue, you jump into the agent using ((Main)getRootAgent()).myAgent._origin_VA.navigateTo();
this will visually jump into the agent.
It is up to you to change the msg in that agent using a text object, obviously.

Related

Sending a message from an event to a transition?

I'm trying to send a message to activate the transition in the second pic attached. I've used this command line
deliver("nuovo epicentro")
but it doesn't work. The transition is not in the main section, but in the agent Tir, while the event is in the main environment. How can i fix it?
Thank you.
enter image description here
enter image description here
You need to specify which 'tir' agent you want to send it to, how would AnyLogic know?
So you could write 'tirs.get(0).deliver...'. This will send it to the first agent in the population of 'tirs'. Note that it will throw an error if there is no agent in that population
On a broader note: you need to start understanding model hierarchy and how to navigate it. Do all the tutorials in the help, they show this quite a bit.

How to show message from custom function w/o using task pane or return value?

Is it possible to show a message (just a warning the user can dismiss) from code in a custom function without using a task pane? (And without making it the return value of the function.) Something that shows up in the status bar, or a popup, etc.?
And obviously, if so, how do you do it?
(Office.context.ui.displayDialogAsync isn't available from the custom functions context, not even in the shared runtime.)
Thank you for reaching us. So far we don't support it. I'd recommend going to Microsoft 365 Developer Platform Ideas Forum and see if this feature has already been requested or if request a new feature. Thanks for your support!

How to count LanguageServer completion requests that have occurred from within a VSCode extension?

We have a request to count the number of 'completion' events that have occurred from our LanguageServer in the vscode-python extension. (After a number of these completion events, we want to raise a popup and ask the user for some feedback).
I've not found a way to do this without asking for a change from the LanguageServer itself (have it raise an event that I can hook into). I am wondering if there is such a facility already available though, within VSCode?
I have found the BaseLanguageClient.onNotification from within the vscode-languageclient library. I am not entirely sure what method to hook into with this though, or even if there is an event relevant to my need.
Anyone have any tips for this?
You can inject middleware into your LanguageClient in order to capture events such as these. See here for an example:
https://github.com/Microsoft/vscode-go/blob/e0f8fc2540fecfe964807b97b1e4276c6b6c7a21/src/goMain.ts#L113

IBM Watson Conversation : Intent is not triggering the dialog, all user inputs lead to anything_else

I'm a complete newb in this field, so started with the tutorial in the documentation. This is the page where I'm having problem.
I'm able to create the welcome dialog, and changes in the anything_else dialog are reflecting fine. But when I create a new dialog and set the trigger to the intent, it does not work. I've tried typing in the name, copy pasting it, clicking on (create new condition) and not. Tried different browsers and restarted project too.
There is a dropdown on the text that I type in the bot panel that says choose intent name and gives the list of two intents I've made. When I try clicking on the intent it's supposed to be in, I get this error :
Unable to change the intent. Error: Unique Violation: The value "good morning" already exists
I don't know what I'm doing wrong and googling it gives no result! Comment sections on different websites too seem to be having no problem with it as well.
Any help is appreciated!
Edit : JSON as downloaded from the project menu:
{"name":"Car tutorial","created":"2017-04-30T16:42:55.215Z","intents":[{"intent":"greeting","created":"2017-04-30T17:50:08.575Z","updated":"2017-04-30T17:50:08.575Z","examples":[{"text":"Good afternoon","created":"2017-04-30T17:50:08.575Z","updated":"2017-04-30T17:50:08.575Z"},{"text":"Good evening","created":"2017-04-30T17:50:08.575Z","updated":"2017-04-30T17:50:08.575Z"},{"text":"Good morning","created":"2017-04-30T17:50:08.575Z","updated":"2017-04-30T17:50:08.575Z"},{"text":"Hello","created":"2017-04-30T17:50:08.575Z","updated":"2017-04-30T17:50:08.575Z"},{"text":"Hi","created":"2017-04-30T17:50:08.575Z","updated":"2017-04-30T17:50:08.575Z"}],"description":null},{"intent":"turn_on","created":"2017-04-30T17:49:26.312Z","updated":"2017-04-30T17:49:26.312Z","examples":[{"text":"Air on please","created":"2017-04-30T17:49:26.312Z","updated":"2017-04-30T17:49:26.312Z"},{"text":"I need lights","created":"2017-04-30T17:49:26.312Z","updated":"2017-04-30T17:49:26.312Z"},{"text":"Listen to some music","created":"2017-04-30T17:49:26.312Z","updated":"2017-04-30T17:49:26.312Z"},{"text":"Play some tunes","created":"2017-04-30T17:49:26.312Z","updated":"2017-04-30T17:49:26.312Z"},{"text":"Turn on the headlights","created":"2017-04-30T17:49:26.312Z","updated":"2017-04-30T17:49:26.312Z"}],"description":null}],"updated":"2017-04-30T17:56:05.345Z","entities":[{"entity":"appliance","values":[{"value":"air conditioning","created":"2017-04-30T17:51:41.232Z","updated":"2017-04-30T17:51:41.232Z","metadata":null,"synonyms":["air"]},{"value":"headlights","created":"2017-04-30T17:51:41.232Z","updated":"2017-04-30T17:51:41.232Z","metadata":null,"synonyms":["lights"]},{"value":"music","created":"2017-04-30T17:51:41.232Z","updated":"2017-04-30T17:51:41.232Z","metadata":null,"synonyms":["radio"]}],"created":"2017-04-30T17:51:41.232Z","updated":"2017-04-30T17:51:41.232Z","metadata":null,"description":null},{"entity":"genre","values":[{"value":"classical","created":"2017-04-30T17:52:56.711Z","updated":"2017-04-30T17:52:56.711Z","metadata":null,"synonyms":["symphonic"]},{"value":"rhythm and blues","created":"2017-04-30T17:52:56.711Z","updated":"2017-04-30T17:52:56.711Z","metadata":null,"synonyms":["r&b"]},{"value":"rock","created":"2017-04-30T17:52:56.711Z","updated":"2017-04-30T17:52:56.711Z","metadata":null,"synonyms":["pop"]}],"created":"2017-04-30T17:52:56.711Z","updated":"2017-04-30T17:52:56.711Z","metadata":null,"description":null}],"language":"en","metadata":null,"description":"","dialog_nodes":[{"go_to":null,"output":{"text":{"values":["Hi! What can I do for you?"],"selection_policy":"sequential"}},"parent":null,"context":null,"created":"2017-04-30T17:55:24.851Z","updated":"2017-04-30T17:55:48.868Z","metadata":null,"conditions":"#greeting","description":null,"dialog_node":"node_3_1493574922154","previous_sibling":"node_1_1493574794528"},{"go_to":null,"output":{"text":{"values":["I'm sorry, I don't understand. Please try again."],"selection_policy":"sequential"}},"parent":null,"context":null,"created":"2017-04-30T17:53:39.404Z","updated":"2017-04-30T17:56:05.345Z","metadata":null,"conditions":"anything_else","description":null,"dialog_node":"node_5_1493574962852","previous_sibling":"node_3_1493574922154"},{"go_to":null,"output":{"text":{"values":["Welcome to the car demo!"],"selection_policy":"sequential"}},"parent":null,"context":null,"created":"2017-04-30T17:53:17.084Z","updated":"2017-04-30T17:53:57.004Z","metadata":null,"conditions":"welcome","description":null,"dialog_node":"node_1_1493574794528","previous_sibling":null}],"workspace_id":"2b6d0fdd-c04f-40e0-9310-0bba1ad38cef","counterexamples":[]}
Based on attached JSON, your problem is that Watson conversation is stuck in the training process (if the pink message is showing a long time, that means he stuck).
I cannot explain why it happened. But I know the solution, just use "conversation_start" instead of "welcome" trigger
Most probably, you placed "anything_else" node above your intent node.
Anything_else should be the latest node, because watson is executing it sequentional, once he will find match, it will go into.
Be sure, that you have the same order:

Persistent error dialog in Matlab

I was wondering if there is a way to prevent an error dialog (errordlg) to appear when an existing error dialog hasn't been attended yet. I'm developing a GUI in matlab and I can easily make 50 error dialogs to appear and collapse my task manager as it is shown in the picture.
On the other hand, I have seen warning or error dialogs that don't let the user to operate the GUI until he attends them. Is there anyway to do that?
Thanks in advance!
Charlie
If the same callback is creating the error dialog, you can prevent callback re-entrancy by inspecting dbstack for multiple calls to the responsible callback. See the isMultipleCall function on this blog.
There is no sense to plagiarizing Yair Altman's function here, but the usage would involve putting the following line at the top of the callback that creates the errordialog:
if isMultipleCall(); return; end
Then that callback cannot run again until you have addressed the errordialog, allowing the first call to terminate.
However, you can create your error dialog with the 'WindowStyle' called 'modal', which will prevent interaction with any other MATLAB window until the dialog is closed.
errordlg has a third argument createmode. One possible value is 'replace' for which all previously open error dialogs with the same title are closed. This can be useful in your case if the 50 or so error dialogs are the same.