Best way of structure data in properties file - data-structures

I am developing a web application and I need some parameters from properties files. These parameters have the following structure:
parameter1.field = Field 1
parameter1.value = Value 1
parameter2.field = Field 2
parameter2.value = Value 2
...
I personally don't like this data structure, and I'd like to organize them in a more simple way, like this:
parameter1 = Field1,Value 1
parameter2 = Field2,Value 2
...
My question is if there is any other way to organize information in a properties file for data like these, for example, in an array structure or something similar.
Thank you very much in advance

You can use a JSON file instead, which allows you for a more complicated structure.
There is no standard way to represent non-flat structures in a properties file, and everything that you do would be a custom solution.

Related

Data access in Jmeter using CSV file

I have a .csv data file with data like:
Row-1: A
Row-2: B
Row-3: C
When I run the script with 1 user 3 iterations, it is taking the same value A for all 3 iterations. What do I need to do if I would like to use value A for iteration-1 and value B for iteration-2 & etc.? It did not make any difference between placing the data file inside the thread group or outside the thread group.
Please could someone help?
Thanks,
N
In current form your question cannot be answered comprehensively, the missing bits are:
What test element/function do you use for reading the values from the CSV file. The recommended option is CSV Data Set Config
What controller is used for creating the "iterations"
CSV Data Set Config needs to be placed inside that controller
Sharing mode of the CSV Data Set Config needs to be set to "All Threads"

i18n nesting in SAPUI5

I have a lot of repeating texts inside of my SAPUI5-App. Hence I have the same value with different keys in i18n.
I don't want to merge them into one key because of readability.
one example:
PROFILE_CHAPTER_A=Details
GREET_MESSAGE=Greetings
[...]
WIZARDSTEP_A=Something
WIZARDSTEP_B=Different
WIZARDSTEP_C=In
WIZARDSTEP_D=These
WIZARDSTEP_E=Ones
WIZARDSTEP_F=Details
[...]
#I wish for something like this
GREETING_FORUM={GREET_MESSAGE} {0}, Hello in our Forum!
GREETING_ WEBSOP={GREET_MESSAGE} {0}, Welcome to our Webshop!
You see that PROFILE_CHAPTER_A and WIZARDSTEP_F have the sam value.
In this case I don't want to reference to only one of them because if I'm inside of the view I want a clear naming of the i18n. But if I mean the exact same thing I want to change it only once and not in 5 different keys.
An example of what I imagine should be possible. Maybe I just want to change the "Greetings" to "What's up" or something else and then I just want to reference the first word and have it used by everything else.
Is this i18n-nesting possible in (SAP)UI5? And if not, can it be added?
We use the namespace concept for i18n files:
# Global used
core.detail = Detail
core.button.ok = Ok
# Assuming there is a view with namespace: my.great.app.detail
detail.title = title
# Assuming there are dialog in my.great.app.detail
detail.dialog.confirm.title = Done, saving?
detail.dialog.delete.message = Really?
# another (sub) view: my.great.app.detail.specialParts
detail.specialParts.title = very special
Works also flawless for multi component apps, if you prefix component name.

Possible to set file name for h2o.save_model() (rather then simply use the model_id value)?

Trying to save an h2o model with some specific name that differs from the model's model_id field, but trying something like...
h2o.save_model(model=model,
path='/some/path/then/filename',
force=False)
just creates a dir/file structure like
some
|__path
|__then
|__filename
|__<model_id>
as opposed to
some
|__path
|__then
|__filename
Is this possible to do from the save_model method?
I can't / hesitate to simply change the model_id before calling the save method because the model names have timestamps appended to them to avoid name collisions with other models that may be on the h2o cluster (am trying to remove these timestamps when saving on disk and simplifying the name on the cluster before saving creates a time where naming collision can occur if other processes are also attempting to save such a model (of, say, a different timestamp)).
Any way to get this behavior or other common alternatives / workarounds?
This is currently not possible, however I created a feature request here. There is a related question here which shows a solution for R (could be adapted to Python). The work-around is just to rename the file manually using a few lines of R/Python code.

How does one read the data value from a Function outside FunctionCallbackInfo?

When I create a function like this:
v8::Function::New(<Isolate>, <C_Function>, <Data_Value>);
The Data_Value that I supply is useful for many things and I can access that when the function is called, with something like FunctionCallbackInfo->GetData().
But I have found no way to get back this data in a different scenario. Let's say I store that Function in a Persistent object, and then I would like to read which data is currently bound to it. Any ideas?
I don't think it's exposed via the API.
But there's an alternative:
manually construct a v8::FunctionTemplate
set its ->InstanceTemplate()->SetInternalFieldCount(num_fields)
get the v8::Function from the template with template->GetFunction(context),
now you should have function->InternalFieldCount() == num_fields
you can use function->SetInternalField(index, value) and function->GetInternalField(index) to store any data you want.
For complete examples, search for "SetInternalFieldCount" in V8's test-api.cc.

jMeter CSV_Data_Set config and XML dynamic binding

I am primarily using JMeter -CSV_Data_Config element to bind csv data with a XML template as shown below.
This works beautifully when the data in the excel cells are static ie.. know set of columns. eg. 6 cols in csv file bind to 6 variables in XML file.
Lets say end user decides to have 15 cells of data in the csv file. Can i make the jMeter script dynamic to add new XML elements eg.Item with new attributes based on the number of cells in the csv file ?
I think a beanShell script might help if not ? not sure how .. any help -much appreciated !
Personally I would use the following approach for getting data from CSV file with unknown number of columns:
User Defined Variables (defined variable N with the value of 0)
While Controller
Counter (Start: 1, Increment: 1, Reference Name: N)
Samplers with data-driven logic
and use the following line as condition for the While Controller
${__javaScript("${__CSVRead(/path/to/your/file.csv,${N})}"!="",)}
See __CSVRead() function documentation for more details.

Resources