I need to create an array for "Forms" to be called randomly - arrays

I have 4 forms (beside the main form) that I would like to store in an array and called randomly. The forms contain web pages with YouTube video clips that autoplay. When I use them individually in the code they work as expected. I am having trouble getting them to play from an array.

Consider the following approaches:
If the four forms are identical except for the specific YouTube URL, consider consolidating them to a single form. You can send the URL to the new form via the constructor. An array of strings is much easier to create.
You could generate a random integer (between 1 and 4). Use as Select myRandomInteger statement with a Case to initialize and show the form for that integer value (index).
Finally, if you post the non working code, perhaps someone will have a more specific solution for you.

Related

Selecting values from a fixed set at random in JMeter

The problem I'm trying to solve is how to go about randomizing HTTP requests with multiple available values of parameters one would manually select via a drop-down list. I'm doing this in JMeter so AFAIK I cannot just declare an array containing values of parameters that said drop-down list options refer to and then use random indices for values.
For the sake of simplifying the problem - let's say I'm writing a test plan where a thread searches for a book title in an e-bookstore and goes to 'view' a found item. I want to start a buch of threads but don't want them all to search for the same book. I do know all titles available but do not know how to make each thread search for a different one.
I could try defining a varable per value and use __RandomFromMultipleVar() with all variables as its parameters but that would be quite a chunky piece of code if I wanted to select from more than just a few values.
If there's a way of defining multivalue variables, it would realy come in handy.
You can add User defined Variables under Http Request with name and value
Example:
Name= option_1;option_2; option_3 and different Values for each option.
User Defined Values Example
In Http request body add below code in place where you enter value.
"${__V(option_${__Random(1,3,)})}"

How to get the number (length) of slot values for Alexa skill

I am trying to generate a random response for my Alexa Skill. I have set it up as:
Intent = myIntent
Slot = mySlot
Slot Type = mySlotType
Slot Values = {A,B,C,D} //the ids are unique numbers 1 - 4
when the user says a word such as A it uses this to create a response. Now I want to add a case for 'random'.
So Slot Values = {random,A,B,C,D}. //ID for random is 0
When the user says random, I want to randomly choose from the other Slot Values and use this to create a response.
Can Slot Value ID be used to return the Slot Value value?
Anybody know a good way to do this? I am a novice so excuse any obvious oversights.
This might be a workaround for your problem. You can get the JSON structure of your interaction model and use it as a constant in your lambda index.js file. I usually use this official tool for generating backend code for my skill
:
https://s3.amazonaws.com/webappvui/skillcode/v2/index.html.
When you'll generate the code through this tool, you'll see that the code generated also has the whole interaction model used as constant. Since you will have the whole JSON schema of the interaction model at your disposal, you can perform any action on it.
Note: If you don't know where to get JSON schema of your interaction model, scroll down on the build tab of your skill on the developer console, you'll find a menu of JSON editor on the left navigation. It will give you the JSON schema of your interaction model.
You can use mySlot as optional value in the intent description. For example you can add few utterances without slot inside them. And on the backend side you can check is the slot filled. If it is not filled you can generate random answer.

Post form values, process with c# in Composite C1

This is probably easy to do but I've spent hours searching Composite C1 knowledge base and google but nothing.
I simply want to create an html form, then when the user submits it, be able to process the form fields in C#. I don't mind if this uses web forms, MVC or some other mechanism.
I have got inline functions working but it's not clear how to pass in the form fields.
thx.
The Form Submit Handler is a simple addon that accepts all the values posted to the page and saves it to files on the server.
It can be a good starting point to see how to work with Forms withing C1. The code for it is available on GitHub.
I am a composite c1 noob myself, but one thing that I did and it seemed fairly straight forward was to understand how the contact form that comes with the Venus starter site works.
The Venus template contact form is driven by the function found in Functions > Razor > Composite > Form > Contact Form.
You can edit that function and you can see how it's implemented. Inside that function you have access to the form data and you can do pretty much whatever you want with it, since it's C# and Razor.
Additionally, you can create a custom Global Datatype and optionally an associated Page Datafolder to save your data, or have access to it outside the form function. These will have to be bound to the form function.
You can get the data submitted from the form using the automatically generated functions (should be located under Functions > All Functions > YourNamespace > YourDatatype). I've used the GetMyDataTypeXml function for what I was needing and it worked without issues.
You can read more about data functions here: http://docs.composite.net/Data/Data-Centric-Functions
Some examples of using the GetMyDatatypeXml function can be found here: http://docs.composite.net/Data/Data-Centric-Functions/Getting-Data-as-XML
HTH!

Nested stores in Extjs4

I was just wondering if we can have a nested stores, similar to nested models in Extjs4.
i am thinking this just because, i have a 10 drop downs and 10 grids which uses the same model. hence i have 10 stores for drop down and 10 stores for grid.
among 10 drop down stores, 2 dropdown will make a ajax call to retrieve the data from server and other stores will use the response data of above 2 and load their independent store using the response. similar applies to grid also.
So is this the right approach.? and any disadvantage of having multiple stores(about 20 :O) on the same page.
Kindly suggest. :)
Small Update to Clear my question.
i am not referring as nested stores because it is reffering to same model. in Extjs4 we can have a single ABCModel.js and define many components which exted Model. Hence to clear my question again, I have 10 stores(ie.,, 10 .js files) and 10 grids (again 10.js files for stores). So is this the right approach or can we push all these under single .js file.
Thanks
Punith
It's not really "nested" stores... The fact that they are using same model has nothing to do with nested.
I would not worry about number of stores on the page more then I would worry about number of grids for example. Stores in your case would just play role of arrays for data.
Load two (or four) stores from the server, and then create local copies for other controls. You won't be able to use same store object for different controls if they show different set of data. What you need to do is to filter one store and create a clone of result in the other store object. And since you basically need only one or two fields in these local stores - you might want to create a simple model ([id, name] or something like that).

How can I map elements of one enum to another?

I'm using C. I have to large enums, one of menu ID's and one of window ID's. At the moment they're mapped to each other by an array, so the elements have to be put into the array perfectly and as soon as something changes work has to be done to put them all back into the right place. What would be a better way of mapping the menus to the windows? Thanks
Are you explicitly assigning values to the members of each enum? How do menu IDs map to window IDs? Can you post part of the enums as an example?
If the enums are lengthy, this might be a good candidate for a code-generating script. Store your IDs in (for example) a CSV file that lists matching pairs of Window IDs and Menu IDs. Then, write a script that parses the CSV file and generates a header containing the appropriate enum definitions. If you are building your project using makefiles (or similar), it should be fairly straightforward to integrate this type of auto-generated header into your build system.

Resources