Is is possible to use variable in dialog prompt in LUIS? - azure-language-understanding

In LUIS if you require some parameters for an action, and add a prompt question, if the parameter is missing, it will send the prompt as a dialog option in the answer.
In my case I have 2 required parameters, and if the 2nd one is missing (the quantity) I'd like the prompt asking for clarification to use the value of the other parameter's value.
For example:
query: I would like to buy tickets to toronto.
dialog prompt should
be: How many tickets to toronto?
I tried setting the prompt to something like "how many tickets to {location}" but obviously this doesn't work.
I haven't found any information on this so I think it's just not possible but I'd like confirmation.

I don't think this is possible out of the box. However, I believe it could be done if you start overriding things here and there.
The main problem is that the LuisActionDialog (the dialog that prompts for parameters) is not receiving the original LuisResult model (which makes sense since it's not serializable).
So, I think that to start looking into this, you will have to:
Override the MessageReceived method from the LuisDialog class, in order to create a new dialog that handles the parameters. Please note that overriding the MakeLuisActionDialog method won't be enough, per what I explained before about not receiving the original LuisResult.
Create a new dialog similar to the LuisActionDialog, that will do what the current dialog does but also performs the prompts manipulation that you are looking to have.

Related

InstallShield: Get the organization name during installation

I'm creating an installation with instalshield.
In the "Installation Interview", (which is part of the "Project Assistant") I set the option "to prompt users to enter their Company Name".
My question is: how can I interact with the value they entered? I mean how can I get it? I need to take this value and insert it to my app config file , during the installation process.
In a more general way, I would love to know how can I add text fields of my own and interact with the values the customers insert?
Thank you,
Noam
Look at the installation Wizard Noam. Anywhere you see an edit control, you will notice that it has a property associated with it. The property is a 'variable' that will have a value assigned to it. You can use the property to populate a registry, an XML file, etc.
I would look through the help documentation for InstallShield relating to Properties.
http://helpnet.flexerasoftware.com/isxhelp19/helplibrary/IHelpISXPropertiesUse.htm
The link above goes over the difference between Public and Private properties and how you can use them.
Ok, so I sort of solved it, I didn't use any built in dialog boxes, but simply created my own public property and dialog, then added an event to dialog and finally read the property value with powershell script, in more details (for future noobies) :
Create new property in Property Manager (under "Behavior and Logic"), give it a name and default value.
Create new dialog (under "User Interface").
At the behavior section of your dialog go to "Next" control (for example).
Add event (by pressing the tiny green plus sign at the line of the "Events")
Choose "SetProperty"
At the SetProperty line you can specify a condition, for example ApplicationUsers = "AllUsers"
At the "Property" field enter the property name (from first instruction)
At the "Value" field enter the value you wish for.
For getting the property value from powershell, create powershell script with the following: $value = Get-Property -Name PROPERTY_NAME
That's it.
This is not exactly what I asked for in the question but I believe this answer is more general and so also contains the answer to my original question.

Record without adding to repository?

Imagine creating a new QTP project. You hit record to get your first bit of code in place. By default, you'll get something like:
Browser("MyApp").Page("MyPage").WebEdit("MyLogin").Set "Bob"
And you'll get the Browser, Page, and WebEdit objects automatically added to the repository. What I would like to be able to do, as one of those QTP bods that prefers descriptive programming, is hit record, and get something like:
Browser("name:=MyApp").Page("name:=MyPage").WebEdit("name:=MyLogin").Set "Bob"
And have no objects added to the repository. Is there a setting / option to do this somewhere?
(Obviously there are arguments for not wanting to do this, which I acknowledge and appreciate - but for those of us that prefer DP, this could help expedite test creation).
From what i understood is that you want to hit 'Record' button and you will get the script in descriptive type rather than the usual. But that is not possible.
For descriptive programming, you have to explicitly write the code by identifying the properties of each object for that (you can use Tools > Object Spy).
For above example:
Go to Object Spy > Select "the pointing hand symbol button" and click on the WebEdit for which you want to set the text "Bob"
Now, from Object Hierarchy select each object Top to Bottom and write properties of those object in the script. Like 1st Browser, then Page, then WebEdit. Try adding as more properties as you can.
You just can not get descriptive script by hitting Record button.

Oracle Forms Builder - change to window in another form

We have two forms so far, and need to switch from window1 in from1 (which is login screen) to windowX in formX using button (trigger code below):
begin
show_window('windowX');
go_block('some_block_in_formX');
end;
This gives error FRM-41052: Cannot find Window: invalid ID
So question is, should I add formX into show_window parameter in certain way or is there another approach? Thank you.
Please note, that forms are in different files.
that forms are in different files.
If the forms are different files, you need to call the other form using open form/call form/newform - whatever suits your needs.
show_window/go_block sequence can be used only when you're moving to different windows/blocks of the same form - and the error message
error FRM-41052: Cannot find Window: invalid ID
is complaining that it can't go to that Window because it's in a different form.
Each form effectively has a private namespace for all its windows, blocks, items, etc - and your code always runs within the context of a single form.
To solve this, you'll need a form parameter, plus some code in the other form, e.g.:
in formX, add a parameter ACTION
in form1, pass the value 'XYZ' to ACTION
in formX, in the WHEN-NEW-FORM-INSTANCE trigger, check if :PARAMETER.ACTION = 'XYZ', and if so, do your show_window and go_block. Copy the same code to your WHEN-WINDOW-ACTIVATED trigger.
Of course, you'll need to think about the name of the parameter (e.g. ACTION) and value ('XYZ') that will make sense to people maintaining your forms in the future.

Get a list of Active Directory Users along with their Full Name and Email

I need to retrieve a list of Active Directory users and their attributes using Delphi 2010.
I've seen a few similar questions on SO (e.g. Delphi - Find primary email address for an Active Directory user), but they all seem to require the user name before any additional information can be retrieved.
I had written an article for [The Delphi Magazine] way back when..... if you have access to a backlog of those magazines, it's in issue no. 62 (October 2000) - unfortunately, it seems those back issues aren't available for purchase anymore :-(
It's too long of an article and a code sample to post here.... basically it's about wrapping the IDirectorySearch interface in a nicer Delphi-like shell. You pass in a base container where to search, you define an LDAP filter, and you define a set of attributes you're interested in - then you search and get back basically an enumerator for the results, which you can get one by one.
In the end, I discovered TJvObjectPickerDialog, part of JVCL. It wraps the Windows Select Object dialog and does everything I need with very little coding. Just set the required properties and call execute. The selected user objects are returned along with the attributes that you set in the 'Attributes' property.

Avoiding duplicate code in input validation

Suppose you have a subsystem that does some kind of work. It could be anything. Obviously, at the entry point(s) to this subsystem there will be certain restrictions on the input. Suppose this subsystem is primarily called by a GUI. The subsystem needs to check all the input it recieves to make sure it's valid. We wouldn't want to FireTheMissles() if there was invalid input. The UI is also interested in the validation though, because it needs to report what went wrong. Maybe the user forgot to specify a target or targetted the missles at the launchpad itself. Of course, you can just return a null value or throw an exception, but that doesn't tell the user SPECIFICALLY what went wrong (unless, of course, you write a separate exception class for each error, which I'm fine with if that's the best practice).
Of course, even with exceptions, you have a problem. The user might want to know if input is valid BEFORE clicking the "Fire Missles!" button. You could write a separate validation function (of course IsValid() doesn't really help much because it doesn't tell you what went wrong), but then you'll be calling it from the button click handler and again from the FireTheMissles() function (I really don't know how this changed from a vague subsystem to a missle-firing program). Certainly, this isn't the end of the world, but it seems silly to call the same validation function twice in a row without anything having changed, especially if this validation function requires, say, computing the hash of a 1gb file.
If the preconditions of the function are clear, the GUI can do its own input validation, but then we're just duplicating the input validation logic, and a change in one might not be reflected in the other. Sure, we may add a check to the GUI to make sure the missle target is not within an allied nation, but then if we forget to copy it to the FireTheMissles() routine, we'll accidentally blow up our allies when we switch to a console interface.
So, in short, how do you achieve the following:
Input validation that tells you not just that something went wrong, but what specifically went wrong.
The ability to run this input validation without calling the function which relies on it.
No double validation.
No duplicate code.
Also, and I just thought of this, but error messages should not be written in the FireTheMissles() method. The GUI is responsible for picking appropriate error messages, not the code the GUI is calling.
"The subsystem needs to check all the input it receives to make sure it's valid"
Think of the inputs not so much as a list of arguments, but as a message, it gets easier after that.
The message class has an IsValid member function, it remembers if IsValid was called and what the result was. It also remembers its state, if the state changes then it needs to be re validated. This message class also keeps a list of validation errors.
Now, the UI builds a TargetMissiles message, and the UI can validate it, or pass it directly to the MissileFiring subsystem, it checks to see if the message was validated, if not it validates it, and proceeds / fails depending.
The UI gets the message back, with the list of validations already populated.
The messages with their validation sit in a separate library. No code is duplicated.
This sound OK?
This is what Model-View-Controller is all about.
You build up a model (a launch which is composed of coordinates, missile types and number of missiles) and the model has a validate method which returns a list of errors/warnings. When you update the model (on key-up, <ENTER>, button-press) you call the validate method and show the user any warnings, errors, etc. (Eclipse has a little area just under the tools bar in a dialog that does this, you might want to look at that.)
When the model is valid, you activate the launch missiles button so that the user knows that they can launch the missiles. If you have an update event that is called particularly frequently or a part of the validation that is particularly costly, you can have a validate_light method on the model that you use for validating only the parts that are easy to do.
When you switch to a console based UI you build up the model from the command line arguments, call the same validate method (and report errors to stderr) and then launch the missiles.
Double the validation. In many case the validation is trebled (FKs and not null fields in the DB for example). Depending on your platform it may be possible to code the validation rules once. For example your front end and backend code could share C# business classes. Alternatively you could store the validation rule as metadata that both the backend and front end can access an apply.
In reality the fact that you need different responses to a validation problem (for example the Fire Missile button shouldn't even be enabled until the other inputs are valid) there will be different code associated with the same rule.
I'd suggest an input validation class, which takes the input type (an enumeration) in its' constructor, and provides a public IsValid method.
The IsValid method should return a boolean TRUE for valid and FALSE for invalid. It should also have an OUT parameter that takes a string and assigns a status message to that string. The caller will be free to ignore that message if it wants to, or report it up to the GUI if that's appropriate for the context.
So, in pseudocode (forgive the Delphi-like syntax, but it should be readable to anybody):
//different types of data we might want to validate
TValidationType = (vtMissileLaunchCodes, vtFirstName,
vtLastName, vtSSN);
TInputValidator = class
public
//call the constructor with the validation type
constructor Create(ValidationType: TValidationType);
//this should probably be ABSTRACT, implemented by descendants
//if you took that approach, then you'd have 1 descendant class
//for each validation type, instead of an enumeration
function IsValid(InputData: string; var msg: string): boolean;
And then to use it, you'd do something like this:
procedure ValidateForm;
var
validator: TInputValidator;
begin
validator := TInputValidator.Create(vtSSN);
if validator.IsValid(edtSSN.Text,labelErrorMsg.Text) then
SaveData; //it's valid, so save it!
//if it wasn't valid, then the error msg is in the GUI in "labelErrorMsg".
end;
Each piece of data has its own meta data (type, format, unit, mask, range etc.). Unfortunately this is not always specified.
The GUI controlls need to check the input with the metadata and give warnings/errors if the data is invalid.
Example: a number has a range. The range is provided by the metadata, but the range check is provided by the control.

Resources