Is it possible to create custom simulation functions in KepServerEx? - kepserverex

We were using in-built simulator function ("USER()") in the "KepServerEx (v6.9)" program to generate values for the tags.
We now want to generate a values in a certain pattern using our own custom logic to meet the purpose. We found that we cannot use any of the in-built simulator functions that could generate the values in the pattern we need.
Is it possible to create a custom simulator function and write the programming logic we need to generate the values, in the KepServerEx?

We do this by creating a second programme to write custom values to the (advanced) simulator tags.
I'd be curious to know, too, if it is possible to link a custom valued function directly into the simulator tags.

Related

Create order during integration testing

For my custom integration test, I need some dummy order (I want to update the tracking number later, as per my module).
Until now the best was I found is to copy
\Shopware\Core\Checkout\Test\Order\Listener\OrderStateChangeEventListenerTest::createOrder to my test class. Is there a more convenient method, with less copy & paste?
There is a trait for getting valid OrderData. Then you can modify the data to your needs and create it with the OrderRepository.
You can find it here: src/Core/Checkout/Test/Customer/Rule/OrderFixture.php

Is it possible to reuse API Platform/Symfony generated model definitions through #groups?

Currently on mine API Platform service, I've created several endpoints for same entity and I am using #Groups to filter the attributes to be returned.
I noticed that Swagger documentation is being automatically generated based on this #Groups definitions and it is creating one model for each endpoint - or each group combination.
The problem raises when I convert the Swagger definition to TypeScript interfaces, because it is generating a lot of similar interfaces.
I'd like to know if it possible to reuse the same model definition among the several endpoints, and flag which attribute is required or not to each one of them.
Thanks in advance, guys
Answer: There is no way to define which interface you want to generate / filter, that seems like a feature to add to the generator.
BTW, I think you are missunderstanding the purpouse of Groups.
You can use a Filter that applies a Group to filter attributes instead of having multiple endpoints. Ex: GET products?groups[]=READ&groups[]=GROUP_ADMIN&groups[]=CLIENT
https://api-platform.com/docs/core/filters/#group-filter

Kotlin KFunction reflection - get parameter values

In order to create a simple annotation that logs function calls, I'm trying to grab the following attributes from a function that has said annotation:
Function name
Parameter names
Parameter values
What I have so far uses KCallable as a value, which makes grabbing the name and names from the list of KParameter fairly simple. However, I cannot figure out how to get the values of said parameters to make the log statement more contextual.
Does anyone have ideas on grabbing these parameters values within the annotation? It doesn't need to use KCallable, that just seemed like the most intuitive receiver.
You will need a different approach. Annotations and parameter type are a compile time features while values are a runtime feature.
What you will have to do is use a bytecode processing framework like ASM or google "aspect oriented programming". That allows you to examine the generated bytecode and modify if before the JVM tries to execute it.
The other approach is to write a Kotlin compiler plugin which generates the necessary code (google "Writing Your First Kotlin Compiler Plugin")
This blog post contains an example for Java and Spring using the AOP approach: https://solocoding.dev/blog/eng_spring_centrlize_logging_with_aop
I recommend the compiler plugin because the other approach is much more complicated, brittle and badly documented. Use AOP only if you find a framework which already contains all the features you need.

What is the use of DataLayer in Google Tag Manager

I am using Google Tag Manger; here I can pass dynamic values using “Javascript Vaiables”. Can anybody explain where will be the use of “dataLayer” ? I think, all of those dynamic value requirements can be done by using “Javascript variable” itself.
Thanks!
At least two things come to mind:
The Google Analytics transaction tracking requires a prefined dataLayer; that way you can use a simple tag template provided by Google instead of having to parse your own variable structure into something suitable
it largely avoids variable naming collisions with other scripts; you only need to check if another script or global variable also uses the variable name "dataLayer". With lots of 'simple' variables you'd have to check with each one if them for collisions
So yes, you do not have to use the dataLayer variable, but it's much more convenient and simpler to debug.
Further to Eike's answer, the dataLayer is a javascript variable :-)
The main point as I see it is that some of the user interface bits and pieces are designed to work with a "dataLayer" variable to make your life easier.
For example with some tags/tag templates you can just tell GTM to use values from the dataLayer directly; if you used javascript variables you'd need to manually define macros for each variable and manually assign them to a tag rather than just use the data directly from the data layer.

How to build an iterative user-defined action in Visual Build Professional?

In VBP its possible to define user defined actions by creating a custom COM component or a custom script.
I need to create an user defined action which is iterative, which means it has to call child steps in an iterative manner like the "process files" built in action does.
I can't figure out how to do this and Google isn't helpful either.
Found the answer myself on the kinook forums:
Its not possible to define an iterative user-defined action, but its possible to use a workaround by defining a conditional build rule in the loop controlling step.

Resources