问:
Python: "self" in inheritance
A basic question on inheritance and "self" here.

Good code with no error:
(Correction: Turns out this is NOT GOOD, either. Please refer to MisterMiyagi's answers below.)

```<code>class A:
  def __init__(self, a):
    self.a = 10
    self.b = { 'a': 10, 'b': 20 }
    self.c = [ 1, 2, 3 ]

class B(A):
  def __init__(self):
    super().__init__(self)
    print(self.a)
    print(self.b)
    print(self.c)

i = B()
</code>```

Bad code with errors:

```<code>class A:
  def __init__(self, a, b, c):
    self.a = 10
    self.b = { 'a': 10, 'b': 20 }
    self.c = [ 1, 2, 3 ]

class B(A):
  def __init__(self):
    super().__init__(self)
    print(self.a)
    print(self.b)
    print(self.c)

i = B()
</code>```

ERROR:

```<code>Traceback (most recent call last):
  File "./o", line 16, in <module>
    i = B()
  File "./o", line 11, in __init__
    super().__init__(self)
TypeError: __init__() missing 2 required positional arguments: 'b' and 'c'
</code>```

Could you please explain why it has to be:

```<code>class A:
  def __init__(self, a):
</code>```

but neither

```<code>class A:
  def __init__(self):
</code>```

nor

```<code>class A:
  def __init__(self, a, b, c):
</code>```

?

Thank you!

答:
Calling a method on super() already passes on the first argument (self or cls) properly. Do not pass along self explicitly.

```<code>class A:
  def __init__(self):  # receive implicit self
    self.a = 10
    self.b = { 'a': 10, 'b': 20 }
    self.c = [ 1, 2, 3 ]

class B(A):
  def __init__(self):
    super().__init__()  # pass self implicitly
    print(self.a)
    print(self.b)
    print(self.c)

i = B()
</code>```

A call such as super().__init__(self) passes self to the method twice. Thus, the method must take two parameters, e.g. def __init__(self, a). Use just super().__init__() and def __init__(self) to pass along self once instead.

Title: Python: "self" in inheritance

Body:
A basic question on inheritance and "self" here.

Good code with no error:
(Correction: Turns out this is NOT GOOD, either. Please refer to MisterMiyagi's answers below.)

class A:
  def __init__(self, a):
    self.a = 10
    self.b = { 'a': 10, 'b': 20 }
    self.c = [ 1, 2, 3 ]

class B(A):
  def __init__(self):
    super().__init__(self)
    print(self.a)
    print(self.b)
    print(self.c)

i = B()

Bad code with errors:

class A:
  def __init__(self, a, b, c):
    self.a = 10
    self.b = { 'a': 10, 'b': 20 }
    self.c = [ 1, 2, 3 ]

class B(A):
  def __init__(self):
    super().__init__(self)
    print(self.a)
    print(self.b)
    print(self.c)

i = B()

ERROR:

Traceback (most recent call last):
  File "./o", line 16, in <module>
    i = B()
  File "./o", line 11, in __init__
    super().__init__(self)
TypeError: __init__() missing 2 required positional arguments: 'b' and 'c'

Could you please explain why it has to be:

class A:
  def __init__(self, a):

but neither

class A:
  def __init__(self):

nor

class A:
  def __init__(self, a, b, c):

?

Thank you!

Body:
Calling a method on super() already passes on the first argument (self or cls) properly. Do not pass along self explicitly.

class A:
  def __init__(self):  # receive implicit self
    self.a = 10
    self.b = { 'a': 10, 'b': 20 }
    self.c = [ 1, 2, 3 ]

class B(A):
  def __init__(self):
    super().__init__()  # pass self implicitly
    print(self.a)
    print(self.b)
    print(self.c)

i = B()

A call such as super().__init__(self) passes self to the method twice. Thus, the method must take two parameters, e.g. def __init__(self, a). Use just super().__init__() and def __init__(self) to pass along self once instead.


来源: stackexchange

问:
Looping thorught array from JSON Swift

This is the structure i made to decode the data i get from JSON

This the main code where i call the array result and tap into the tile and print out the title.
So my question is that result is array and it contain 14 items and in that 14 item there are 10 additional thing and title is one of them, so i want to print the title using FOR loop .

This the JSON file i am trying to parse

答:
One way you could iterate over each of your items is using the for X in Y pattern.

```<code>for movie in decodeData.results {
  print(movie.title)
  print(movie.poster_path)
}
</code>```

This pattern will iterate through each result in your array and assign it to the variable name you specify in the for statement.

You can learn more here: Swift Control Flow

ContentLicense: CC BY-SA 4.0

Title: Looping thorught array from JSON Swift

Body:
One way you could iterate over each of your items is using the for X in Y pattern.

for movie in decodeData.results {
  print(movie.title)
  print(movie.poster_path)
}

This pattern will iterate through each result in your array and assign it to the variable name you specify in the for statement.

You can learn more here: Swift Control Flow


问:
Why code not working for configuring while loop
Why my code not working

a “game” where, through input, enter the number of players who will play the game, how to make so many inputs (for player nicknames) be displayed, how many players are playing? and how to do something to add all the nicknames to the array later?
For example: the host introduced what 5 people play, how to output 5 inputs and then add all the nicknames to the array?

```<code>print("Add players!")
plam = int(input("How many players will be? \n"))

playersNames = []
i = len(playersNames)
while i < plam:
    writePlayerName = input("Write player's nickname:   " + Fore.GREEN)
    print(Fore.WHITE)
    playersNames.append(writePlayerName)
    print(playersNames)
    break;
</code>```

Problem statement

player names can be entered endlessly, but I here restricted that there will be 5 players

答:
You can use a for loop:</p>

```<code>for i in range(plam):
    writePlayerName = input("Write player's nickname:   " + Fore.GREEN)
    print(Fore.WHITE)
    playersNames.append(writePlayerName)
print(playersNames)
</code>```

Body:
Why my code not working

a “game” where, through input, enter the number of players who will play the game, how to make so many inputs (for player nicknames) be displayed, how many players are playing? and how to do something to add all the nicknames to the array later?
For example: the host introduced what 5 people play, how to output 5 inputs and then add all the nicknames to the array?

print("Add players!")
plam = int(input("How many players will be? \n"))

playersNames = []
i = len(playersNames)
while i < plam:
    writePlayerName = input("Write player's nickname:   " + Fore.GREEN)
    print(Fore.WHITE)
    playersNames.append(writePlayerName)
    print(playersNames)
    break;

Problem statement

player names can be entered endlessly, but I here restricted that there will be 5 players

Body:
You can use a for loop:

for i in range(plam):
    writePlayerName = input("Write player's nickname:   " + Fore.GREEN)
    print(Fore.WHITE)
    playersNames.append(writePlayerName)
print(playersNames)


问:
RuleEditor.GetClientSettings() throws NRE on generic Method after upgrading to v5.0.19.4 from v5.0.14.6
After I upgraded CodeEffects.Rule.Editor.Web.Core nuget from v5.0.14.6 to v5.0.19.4, I'm getting the following NullReferenceException when calling RuleEditor.GetClientSettings():

```<code> Message:
    System.NullReferenceException : Object reference not set to an instance of an object.
  Stack Trace:
    Encoder.GetHashToken(MethodInfo m, String sourceTypeFullName)
    SourceLoader.GetTokenByMethod(XmlNode source, Type type, Type sourceObject, String methodName, XmlNodeList parameters, Boolean isMethod)
    SourceLoader.GetTokenBySourceMethodNode(XmlNode source, XmlNode method, Type sourceObject)
    Settings.Load(IControl control, ICollection`1 contextMenuRules, XmlDocument sourceXml, ICollection`1 dataSourceHolders, Boolean plainSourceXml)
    RuleEditor.GetConditions()
    RuleEditor.GetClientSettings()
</code>```

Through elimination I zeroed in to the following method, which seems to be causing the error (this worked in v5.0.14.6):

[Method("IsSingle")]
public bool IsSingle<T>([Parameter(ValueInputType.Fields, Description = "array")] IEnumerable<T> array)
{
   return array != null && array.Distinct().SingleOrDefault() != null;
}
```

答: The latest version 5.0.20.6 released today fixes this issue. Note that you can't have generic methods with generic params if you use the SourceXML as your source object(s). Switch to plain .Net class(es) or the new FlexSource technology if you do. See this and this documentation articles for details.</p>

Body:
After I upgraded CodeEffects.Rule.Editor.Web.Core nuget from v5.0.14.6 to v5.0.19.4, I'm getting the following NullReferenceException when calling RuleEditor.GetClientSettings():

 Message:
    System.NullReferenceException : Object reference not set to an instance of an object.
  Stack Trace:
    Encoder.GetHashToken(MethodInfo m, String sourceTypeFullName)
    SourceLoader.GetTokenByMethod(XmlNode source, Type type, Type sourceObject, String methodName, XmlNodeList parameters, Boolean isMethod)
    SourceLoader.GetTokenBySourceMethodNode(XmlNode source, XmlNode method, Type sourceObject)
    Settings.Load(IControl control, ICollection`1 contextMenuRules, XmlDocument sourceXml, ICollection`1 dataSourceHolders, Boolean plainSourceXml)
    RuleEditor.GetConditions()
    RuleEditor.GetClientSettings()

Through elimination I zeroed in to the following method, which seems to be causing the error (this worked in v5.0.14.6):

[Method("IsSingle")]
public bool IsSingle<T>([Parameter(ValueInputType.Fields, Description = "array")] IEnumerable<T> array)
{
   return array != null && array.Distinct().SingleOrDefault() != null;
}


问:
How can I import data from a CSV file to a Postgres database in a transaction with ASP.NET Core?
I have a web app, in which a user can upload a CSV file with some data. I'd like to insert the data to the database, but as a transaction; either the whole CSV data gets inserted or non at all. </p>

答:
There is a possibilty that application call the PostgreSQL client API (libpq) to use the SQL COPY command but I don't know if this is possible with ASP.NET Core.

See COPY command https://www.postgresql.org/docs/12/sql-copy.html
and COPY functions in libpq https://www.postgresql.org/docs/12/libpq-copy.html


问:
Wildfly: web service deployed but unavailable

Problem description:

I want to deploy a web service through Wildfly and it gets deployed, but I cannot access it through a web browser.

This is what I do:

I run standalone.sh

I deploy the project using mvn clean package wildfly:deploy

Then I try to access my webservice through a web browser at http://localhost:8080/lab-ear/Hello?wsdl but I get only: "404 - Not Found"

Fragment of maven logs while deploying.

Here are logs from Wildfly server when it gets initialized.

And here Wildfly logs during deploy.

Other details:

I've done another project where the web service worked, but there were other problems, so I started everything from scratch.

This image is the comparison of structures of these two projects. On the left the old project and on the right the new project.

The important thing is that in the new project I don't get the web directory.

Maybe related problem:

Wildfly : application deployed but not running

Also, is it required to use Intellij IDEA in such projects?

EDIT

In my EJB module I have a class Hello in package pl.edu.agh.soa

I tried to change from this:

```<code>@Stateless
@WebService
public class Hello {
...
</code>```

to:

```<code>@Stateless(name = "Hello")
@WebService(name = "HelloService")
public class Hello {
...
</code>```

But it also doesn't work.

答:
I was able to get a simple "HelloWorld" type JAX-WS service running with just the code:

```<code>import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;

@WebService
@SOAPBinding(style = SOAPBinding.Style.RPC)
@Stateless
public class HelloWorld {

    @WebMethod
    public String sayHello( String name ) {
        return "Hello " + name;
    }
}
</code>```

From this I'm able to access the URL http://localhost:8080/<web-app-name>/HelloWorld?wsdl.  This is in Wildfly 18.

The issue is that you don't specify a @WebMethod.  While the class is marked correctly there isn't anything to "run" in it.

Additionally, while it does work with the @Stateless EJB annotation that isn't required for JAX-WS but may be required for your code.

Body:
Problem description:

I want to deploy a web service through Wildfly and it gets deployed, but I cannot access it through a web browser.

This is what I do:

I run standalone.sh

I deploy the project using mvn clean package wildfly:deploy

Then I try to access my webservice through a web browser at http://localhost:8080/lab-ear/Hello?wsdl but I get only: "404 - Not Found"

Fragment of maven logs while deploying.

Here are logs from Wildfly server when it gets initialized.

And here Wildfly logs during deploy.

Other details:

I've done another project where the web service worked, but there were other problems, so I started everything from scratch.

This image is the comparison of structures of these two projects. On the left the old project and on the right the new project.

The important thing is that in the new project I don't get the web directory.

Maybe related problem:

Wildfly : application deployed but not running

Also, is it required to use Intellij IDEA in such projects?

EDIT

In my EJB module I have a class Hello in package pl.edu.agh.soa

I tried to change from this:

@Stateless
@WebService
public class Hello {
...

to:

@Stateless(name = "Hello")
@WebService(name = "HelloService")
public class Hello {
...

But it also doesn't work.

Body:
I was able to get a simple "HelloWorld" type JAX-WS service running with just the code:

import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;

@WebService
@SOAPBinding(style = SOAPBinding.Style.RPC)
@Stateless
public class HelloWorld {

    @WebMethod
    public String sayHello( String name ) {
        return "Hello " + name;
    }
}

From this I'm able to access the URL http://localhost:8080/<web-app-name>/HelloWorld?wsdl.  This is in Wildfly 18.

The issue is that you don't specify a @WebMethod.  While the class is marked correctly there isn't anything to "run" in it.

Additionally, while it does work with the @Stateless EJB annotation that isn't required for JAX-WS but may be required for your code.


问:
Best way to go about creating in-house analytics for my Rails 3 app?
I have a Rails 3 app that I'm looking to create in-house analytics for. The items I need to track are impressions (and unique impressions), clicks that come from those impressions, and conversions that come from those clicks. And these are all user-specific so each user can see how many impressions, clicks, and conversions they've received.

What is the best way to go about this? Should I create a separate rails app and call it with pixels? Or should I include all the analytics code in the same app?

Also, are there any analytics platforms already out there that I can customize to meet my needs?

Thanks!

Tim

答:
Depending on how you are going to associate Google Analytics data with a specific user then you might need to double-check the privacy implications. Google doesn't allow their data to be associated with any identifying information about the users being tracked.

If there is a problem then you could try out Piwik as it's open source and you can do what you like with it. It's written in PHP, not Ruby so that might be an issue. As @d11wtq mentions, tracking systems can have performance issues if not built in the right way so you'd be better off starting from something that's already proven to work if possible.

ContentLicense: CC BY-SA 3.0


问:
DMN decision model that zip inputs with MID
I have below DMN model that zips input and calculate discount. I am able to run it thru simulator in signavio.

```<code><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions namespace="http://www.signavio.com/dmn/1.1/diagram/8462cb232d98419493d4ef846516a070.xml" exporterVersion="13.3.2" name="MID Example" id="id-f1fe73d348e342d2a6f0435b38ce14e6" sigExt:revisionId="9f563b074ba844d4b9d1fcd6bead7580" sigExt:revisionNumber="1" xmlns="http://www.omg.org/spec/DMN/20151101/dmn.xsd" xmlns:sig="http://www.signavio.com/dmn/1.1/diagram/8462cb232d98419493d4ef846516a070.xml" xmlns:sigExt="http://www.signavio.com/schema/dmn/1.1/" xmlns:feel="http://www.omg.org/spec/FEEL/20140401">
<extensionElements/>
<itemDefinition isCollection="false" name="calculatePriceAfterDiscount" id="id-f8c81ba73d98a8a51216f4583ed31dc9" label="Calculate Price After Discount">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="calculatePrice" id="id-e13d8570789c69dec9515bd8b9159f2d" label="Calculate Price ">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="determineDiscount" id="id-99dded75dc910f4c4b3e2f1d3471cd10" label="Determine Discount %">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="discount" id="id-e41b37d9d6d86919af6290e062ee6bbe" label="Discount">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="collateOrder2" id="id-a4abe03e2f888a7830f15614f50bc45a" label="Collate Order">
    <itemComponent isCollection="false" name="itemName" id="id-a4abe03e2f888a7830f15614f50bc45a-relation-ItemName" label="Item Name" sigExt:slotId="Item Name">
        <typeRef>feel:string</typeRef>
    </itemComponent>
    <itemComponent isCollection="false" name="itemPrice" id="id-a4abe03e2f888a7830f15614f50bc45a-relation-ItemPrice" label="Item Price" sigExt:slotId="Item Price">
        <typeRef>feel:number</typeRef>
    </itemComponent>
    <itemComponent isCollection="false" name="itemQuantity" id="id-a4abe03e2f888a7830f15614f50bc45a-relation-ItemQuantity" label="Item Quantity" sigExt:slotId="Item Quantity">
        <typeRef>feel:number</typeRef>
    </itemComponent>
</itemDefinition>
<itemDefinition isCollection="false" name="calculateTotalPrice" id="id-753285786a1cec905c139529a673b0fe" label="Calculate Total Price">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="itemPrice" id="id-1a281dc9cb860f8ffd0c4cef9485f6a0" label="Item Price ">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="true" name="collateOrder" id="id-8cbabc9f5673d5e84b524b68155dcb45" label="Collate Order">
    <itemComponent isCollection="false" name="itemName" id="id-8cbabc9f5673d5e84b524b68155dcb45-relation-ItemName" label="Item Name" sigExt:slotId="Item Name">
        <typeRef>feel:string</typeRef>
    </itemComponent>
    <itemComponent isCollection="false" name="itemPrice" id="id-8cbabc9f5673d5e84b524b68155dcb45-relation-ItemPrice" label="Item Price" sigExt:slotId="Item Price">
        <typeRef>feel:number</typeRef>
    </itemComponent>
    <itemComponent isCollection="false" name="itemQuantity" id="id-8cbabc9f5673d5e84b524b68155dcb45-relation-ItemQuantity" label="Item Quantity" sigExt:slotId="Item Quantity">
        <typeRef>feel:number</typeRef>
    </itemComponent>
</itemDefinition>
<itemDefinition isCollection="false" name="order" id="id-4cc8046b78214ad11657d5b06436db21" label="Order ">
    <itemComponent isCollection="true" name="price" id="id-4cc8046b78214ad11657d5b06436db21-relation-0" label="Price" sigExt:slotId="0">
        <typeRef>feel:number</typeRef>
    </itemComponent>
    <itemComponent isCollection="true" name="quantity" id="id-4cc8046b78214ad11657d5b06436db21-relation-1" label="Quantity" sigExt:slotId="1">
        <typeRef>feel:number</typeRef>
    </itemComponent>
    <itemComponent isCollection="true" name="itemName" id="id-4cc8046b78214ad11657d5b06436db21-relation-2" label="Item Name" sigExt:slotId="2">
        <typeRef>feel:string</typeRef>
    </itemComponent>
</itemDefinition>
<inputData name="collateOrder_iterator" id="id-4835f35ebd354e9d65c600afb02d9d3c" label="Collate Order" sigExt:shapeId="sid-139D76F2-2029-4058-B488-9472C5BBEBC6" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:collateOrder2" name="collateOrder_iterator" id="id-4835f35ebd354e9d65c600afb02d9d3c_variable"/>
</inputData>
<inputData name="order" id="id-a47f651b80111a121d93cf07939b20dc" label="Order " sigExt:shapeId="sid-8352CBF9-98EA-4018-9EAC-F17A5F936551" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:order" name="order" id="id-a47f651b80111a121d93cf07939b20dc_variable"/>
</inputData>
<decision name="calculatePriceAfterDiscount" id="id-567eb0877fe31a6d84a53c3917e4eee0" label="Calculate Price After Discount" sigExt:shapeId="sid-5F8D6179-84FD-47B9-BA88-0E3CB4305014" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:calculatePriceAfterDiscount" name="calculatePriceAfterDiscount" id="id-567eb0877fe31a6d84a53c3917e4eee0_variable"/>
    <informationRequirement>
        <requiredDecision href="#id-bc493858d94a5f245b95febc081cb0c7"/>
    </informationRequirement>
    <informationRequirement>
        <requiredDecision href="#id-d045696f950f3769011d375f7a1afd78"/>
    </informationRequirement>
    <literalExpression expressionLanguage="http://www.omg.org/spec/FEEL/20140401">
        <text>(calculatePrice-((determineDiscount/100)*calculatePrice))</text>
    </literalExpression>
</decision>
<decision name="calculateTotalPrice" id="id-be5d8465feb66b570cf75aeee595bf21" label="Calculate Total Price" sigExt:shapeId="sid-EA841422-3493-491C-9CE6-59F5EA9CE261" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:calculateTotalPrice" name="calculateTotalPrice" id="id-be5d8465feb66b570cf75aeee595bf21_variable"/>
    <informationRequirement>
        <requiredInput href="#id-4835f35ebd354e9d65c600afb02d9d3c"/>
    </informationRequirement>
    <decisionTable hitPolicy="UNIQUE">
        <input id="id-137491756d969eac658224df41ae34d3" label="Price">
            <inputExpression>
                <text>collateOrder_iterator.itemPrice</text>
            </inputExpression>
        </input>
        <input id="id-cad45b775d319f14f2cc11d5d3b758fd" label="Quantity">
            <inputExpression>
                <text>collateOrder_iterator.itemQuantity</text>
            </inputExpression>
        </input>
        <output name="calculateTotalPrice" typeRef="sig:itemPrice" id="id-99e0fdb7f0d56dbc7bb88ae025be147c" label="Calculate Total Price"/>
        <rule id="id-2fff85d2331aa1e369d698392addb0a8">
            <description>string(-)</description>
            <inputEntry>
                <text>not(null)</text>
            </inputEntry>
            <inputEntry>
                <text>not(null)</text>
            </inputEntry>
            <outputEntry>
                <text>(collateOrder_iterator.itemPrice*collateOrder_iterator.itemQuantity)</text>
            </outputEntry>
        </rule>
    </decisionTable>
</decision>
<decision name="determineDiscount" id="id-bc493858d94a5f245b95febc081cb0c7" label="Determine Discount %" sigExt:shapeId="sid-6824DDAF-771A-4773-973E-1477F70EC90B" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:determineDiscount" name="determineDiscount" id="id-bc493858d94a5f245b95febc081cb0c7_variable"/>
    <informationRequirement>
        <requiredDecision href="#id-d045696f950f3769011d375f7a1afd78"/>
    </informationRequirement>
    <decisionTable hitPolicy="UNIQUE">
        <input id="id-8a61ecb31c82e81d0b067a63f8a10b25" label="Calculate Price ">
            <inputExpression>
                <text>calculatePrice</text>
            </inputExpression>
        </input>
        <output name="determineDiscount" typeRef="sig:discount" id="id-cd2468e782346733c82b544eae541110" label="Determine Discount %"/>
        <rule id="id-8ce83be6aaf7113a136fadb09f2de83b">
            <description>string(-)</description>
            <inputEntry>
                <text>[0..500)</text>
            </inputEntry>
            <outputEntry>
                <text>1</text>
            </outputEntry>
        </rule>
        <rule id="id-ba19200060db4a933658db98400f5019">
            <description>string(-)</description>
            <inputEntry>
                <text>[500..1000)</text>
            </inputEntry>
            <outputEntry>
                <text>5</text>
            </outputEntry>
        </rule>
        <rule id="id-23a4b91a413530151413d2230f41e010">
            <description>string(-)</description>
            <inputEntry>
                <text>[1000..5000)</text>
            </inputEntry>
            <outputEntry>
                <text>10</text>
            </outputEntry>
        </rule>
        <rule id="id-9b4dbf30626d219d5e7937c1322b33fe">
            <description>string(-)</description>
            <inputEntry>
                <text>[5000..10000]</text>
            </inputEntry>
            <outputEntry>
                <text>20</text>
            </outputEntry>
        </rule>
        <rule id="id-37139385183b4a6ee481738ccccc02f4">
            <description>string(-)</description>
            <inputEntry>
                <text>> 10000</text>
            </inputEntry>
            <outputEntry>
                <text>25</text>
            </outputEntry>
        </rule>
        <rule id="id-7d86977d4be287545686b09f982b55a9">
            <description>string(-)</description>
            <inputEntry>
                <text>< 0</text>
            </inputEntry>
            <outputEntry>
                <text>0</text>
            </outputEntry>
        </rule>
    </decisionTable>
</decision>
<decision name="calculatePrice" id="id-d045696f950f3769011d375f7a1afd78" label="Calculate Price " sigExt:shapeId="sid-E3A6C7E0-BEE6-47C9-97EC-1C5A95EE2DB4" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements>
        <sigExt:MultiInstanceDecisionLogic>
            <sigExt:iterationExpression>collateOrder</sigExt:iterationExpression>
            <sigExt:iteratorShapeId>id-4835f35ebd354e9d65c600afb02d9d3c</sigExt:iteratorShapeId>
            <sigExt:aggregationFunction>SUM</sigExt:aggregationFunction>
            <sigExt:topLevelDecisionId>id-be5d8465feb66b570cf75aeee595bf21</sigExt:topLevelDecisionId>
        </sigExt:MultiInstanceDecisionLogic>
    </extensionElements>
    <variable typeRef="sig:calculatePrice" name="calculatePrice" id="id-d045696f950f3769011d375f7a1afd78_variable"/>
    <informationRequirement>
        <requiredDecision href="#id-85c7398c9bc186c1e2396c4625ebbcc1"/>
    </informationRequirement>
</decision>
<decision name="collateOrder" id="id-85c7398c9bc186c1e2396c4625ebbcc1" label="Collate Order" sigExt:shapeId="sid-C47674E0-8CDE-4A4A-84E8-3DD179DCF72C" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:collateOrder" name="collateOrder" id="id-85c7398c9bc186c1e2396c4625ebbcc1_variable"/>
    <informationRequirement>
        <requiredInput href="#id-a47f651b80111a121d93cf07939b20dc"/>
    </informationRequirement>
    <literalExpression expressionLanguage="http://www.omg.org/spec/FEEL/20140401">
        <text>zip(["Item Name", "Item Price", "Item Quantity"], [order.itemName, order.price, order.quantity])</text>
    </literalExpression>
</decision>
</code>```

I have tried to change the zip as below

zip(["Item Name", "Item Price", "Item Quantity"],order.itemName, order.price, order.quantity)

When i run it thru my java code, i am getting below error message

19:40:43.251 [main] ERROR org.kie.dmn.feel.runtime.functions.DTInvokerFunction - Error invoking decision table 'determineDiscount': ClassCastException
java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.math.BigDecimal (java.util.ArrayList and java.math.BigDecimal are in module java.base of loader 'bootstrap')

My java code will be like this

```<code>    final KieServices ks = KieServices.Factory.get();
    final KieFileSystem kfs = ks.newKieFileSystem();
    KieModuleModel kmm = ks.newKieModuleModel();
    kmm.setConfigurationProperty("org.kie.dmn.profiles.signavio", "org.kie.dmn.signavio.KieDMNSignavioProfile");
    kfs.writeKModuleXML(kmm.toXML());
    kfs.write(ks.getResources().newClassPathResource("MID Example (2).dmn", this.getClass()));
    KieBuilder kieBuilder = ks.newKieBuilder(kfs).buildAll();
    Results results = kieBuilder.getResults();
    logger.info("buildAll() completed.");
    results.getMessages(Message.Level.WARNING).forEach(e -> logger.warn("{}", e));
    final KieContainer kieContainer = ks.newKieContainer(ks.getRepository().getDefaultReleaseId());
    DMNRuntime runtime = kieContainer.newKieSession().getKieRuntime(DMNRuntime.class);
    DMNModel model0 = runtime.getModels().get(0);
    DMNContext context = runtime.newContext();
    Map<String, Object> item1 = new HashMap<>();
    item1.put("itemName", "item1");
    item1.put("price", 1000);
    item1.put("quantity", 100);
    Map<String, Object> item2 = new HashMap<>();
    item2.put("itemName", "item2");
    item2.put("price", 200);
    item2.put("quantity", 20);
    Map<String, Object> item3 = new HashMap<>();
    item3.put("itemName", "item3");
    item3.put("price", 3000);
    item3.put("quantity", 300);
    context.set("order", Arrays.asList(item1, item2, item3));
    DMNResult evaluateAll = runtime.evaluateAll(model0, context);
    evaluateAll.getMessages().forEach(System.out::println);
    List<DMNDecisionResult> decResutls = evaluateAll.getDecisionResults();
    printDecisionResults(decResutls);
</code>```

Appreciate any pointers.

答:
Thank you for providing all required assets/code to reproduce the issue in full.
I believe there are several problems which I will describe below, and provide a complete fixed/working example bottom.

Problem: respecting the Order type definition.

Based on your full DMN model definition, the Order (input data node value) must be a singleton composite object of "itemName", "price", "quantity" properties; each of this property is a collection.

So the input should be something like:

```<code>    order: {
        itemName: [item1, item2, item3]
        quantity: [100, 20, 300]
        price: [1000, 200, 3000]
    }
</code>```

Problem: respecting the zip function consistent with Order type definition

Based on your full DMN model definition, the correct definition for the zip function shall be:

```<code>zip(["Item Name", "Item Price", "Item Quantity"], order.itemName, order.price, order.quantity)
</code>```

as I assume what you want to do, based on the full DMN model definition, is transform the data into the following structure

```<code>collateOrder: [
   {
      Item Name=item1,
      Item Quantity=100,
      Item Price=1000
   },
   {
      Item Name=item2,
      Item Quantity=20,
      Item Price=200
   },
   {
      Item Name=item3,
      Item Quantity=300,
      Item Price=3000
   }
]
</code>```

Problem: MID aggregation function

I believe I found a bug in the Signavio extension implementation; thank you for reporting this will be investigated further.

However you can do the required business logic by using the much simpler standard DMN literal expression, without having to rely on any extension beyond what defined only in the DMN specification itself:

```<code>sum( for order in collateOrder return ( order.Item Price * order.Item Quantity ) )
</code>```

this does not require any (Signavio) extension, and it's valid DMN.

To recap.

Java test code snippet:

        DMNContext context = runtime.newContext();
        List<String> itemList = Arrays.asList("item1", "item2", "item3");
        List<BigDecimal> priceList = Arrays.asList(new BigDecimal(1000), new BigDecimal(200), new BigDecimal(3000));
        List<Integer> qtyList = Arrays.asList(100, 20, 300);
        Map<String, Object> order = new HashMap<>();
        order.put("itemName", itemList);
        order.put("price", priceList);
        order.put("quantity", qtyList);
        context.set("order", order);
        DMNResult evaluateAll = runtime.evaluateAll(model0, context);
```
<p>fixed DMN model, without requiring any special extension:</p>
<pre class="lang-xml prettyprint-override"><code><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions namespace="http://www.signavio.com/dmn/1.1/diagram/8462cb232d98419493d4ef846516a070.xml" exporterVersion="13.3.2" name="MID Example" id="id-f1fe73d348e342d2a6f0435b38ce14e6" sigExt:revisionId="9f563b074ba844d4b9d1fcd6bead7580" sigExt:revisionNumber="1" xmlns="http://www.omg.org/spec/DMN/20151101/dmn.xsd" xmlns:sig="http://www.signavio.com/dmn/1.1/diagram/8462cb232d98419493d4ef846516a070.xml" xmlns:sigExt="http://www.signavio.com/schema/dmn/1.1/" xmlns:feel="http://www.omg.org/spec/FEEL/20140401">
<extensionElements/>
<itemDefinition isCollection="false" name="calculatePriceAfterDiscount" id="id-f8c81ba73d98a8a51216f4583ed31dc9" label="Calculate Price After Discount">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="calculatePrice" id="id-e13d8570789c69dec9515bd8b9159f2d" label="Calculate Price ">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="determineDiscount" id="id-99dded75dc910f4c4b3e2f1d3471cd10" label="Determine Discount %">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="discount" id="id-e41b37d9d6d86919af6290e062ee6bbe" label="Discount">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="collateOrder2" id="id-a4abe03e2f888a7830f15614f50bc45a" label="Collate Order">
    <itemComponent isCollection="false" name="itemName" id="id-a4abe03e2f888a7830f15614f50bc45a-relation-ItemName" label="Item Name" sigExt:slotId="Item Name">
        <typeRef>feel:string</typeRef>
    </itemComponent>
    <itemComponent isCollection="false" name="itemPrice" id="id-a4abe03e2f888a7830f15614f50bc45a-relation-ItemPrice" label="Item Price" sigExt:slotId="Item Price">
        <typeRef>feel:number</typeRef>
    </itemComponent>
    <itemComponent isCollection="false" name="itemQuantity" id="id-a4abe03e2f888a7830f15614f50bc45a-relation-ItemQuantity" label="Item Quantity" sigExt:slotId="Item Quantity">
        <typeRef>feel:number</typeRef>
    </itemComponent>
</itemDefinition>
<itemDefinition isCollection="false" name="calculateTotalPrice" id="id-753285786a1cec905c139529a673b0fe" label="Calculate Total Price">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="itemPrice" id="id-1a281dc9cb860f8ffd0c4cef9485f6a0" label="Item Price ">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="true" name="collateOrder" id="id-8cbabc9f5673d5e84b524b68155dcb45" label="Collate Order">
    <itemComponent isCollection="false" name="itemName" id="id-8cbabc9f5673d5e84b524b68155dcb45-relation-ItemName" label="Item Name" sigExt:slotId="Item Name">
        <typeRef>feel:string</typeRef>
    </itemComponent>
    <itemComponent isCollection="false" name="itemPrice" id="id-8cbabc9f5673d5e84b524b68155dcb45-relation-ItemPrice" label="Item Price" sigExt:slotId="Item Price">
        <typeRef>feel:number</typeRef>
    </itemComponent>
    <itemComponent isCollection="false" name="itemQuantity" id="id-8cbabc9f5673d5e84b524b68155dcb45-relation-ItemQuantity" label="Item Quantity" sigExt:slotId="Item Quantity">
        <typeRef>feel:number</typeRef>
    </itemComponent>
</itemDefinition>
<itemDefinition isCollection="false" name="order" id="id-4cc8046b78214ad11657d5b06436db21" label="Order ">
    <itemComponent isCollection="true" name="price" id="id-4cc8046b78214ad11657d5b06436db21-relation-0" label="Price" sigExt:slotId="0">
        <typeRef>feel:number</typeRef>
    </itemComponent>
    <itemComponent isCollection="true" name="quantity" id="id-4cc8046b78214ad11657d5b06436db21-relation-1" label="Quantity" sigExt:slotId="1">
        <typeRef>feel:number</typeRef>
    </itemComponent>
    <itemComponent isCollection="true" name="itemName" id="id-4cc8046b78214ad11657d5b06436db21-relation-2" label="Item Name" sigExt:slotId="2">
        <typeRef>feel:string</typeRef>
    </itemComponent>
</itemDefinition>
<inputData name="order" id="id-a47f651b80111a121d93cf07939b20dc" label="Order " sigExt:shapeId="sid-8352CBF9-98EA-4018-9EAC-F17A5F936551" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:order" name="order" id="id-a47f651b80111a121d93cf07939b20dc_variable"/>
</inputData>
<decision name="calculatePriceAfterDiscount" id="id-567eb0877fe31a6d84a53c3917e4eee0" label="Calculate Price After Discount" sigExt:shapeId="sid-5F8D6179-84FD-47B9-BA88-0E3CB4305014" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:calculatePriceAfterDiscount" name="calculatePriceAfterDiscount" id="id-567eb0877fe31a6d84a53c3917e4eee0_variable"/>
    <informationRequirement>
        <requiredDecision href="#id-bc493858d94a5f245b95febc081cb0c7"/>
    </informationRequirement>
    <informationRequirement>
        <requiredDecision href="#id-d045696f950f3769011d375f7a1afd78"/>
    </informationRequirement>
    <literalExpression expressionLanguage="http://www.omg.org/spec/FEEL/20140401">
        <text>(calculatePrice-((determineDiscount/100)*calculatePrice))</text>
    </literalExpression>
</decision>
<decision name="determineDiscount" id="id-bc493858d94a5f245b95febc081cb0c7" label="Determine Discount %" sigExt:shapeId="sid-6824DDAF-771A-4773-973E-1477F70EC90B" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:determineDiscount" name="determineDiscount" id="id-bc493858d94a5f245b95febc081cb0c7_variable"/>
    <informationRequirement>
        <requiredDecision href="#id-d045696f950f3769011d375f7a1afd78"/>
    </informationRequirement>
    <decisionTable hitPolicy="UNIQUE">
        <input id="id-8a61ecb31c82e81d0b067a63f8a10b25" label="Calculate Price ">
            <inputExpression>
                <text>calculatePrice</text>
            </inputExpression>
        </input>
        <output name="determineDiscount" typeRef="sig:discount" id="id-cd2468e782346733c82b544eae541110" label="Determine Discount %"/>
        <rule id="id-8ce83be6aaf7113a136fadb09f2de83b">
            <description>string(-)</description>
            <inputEntry>
                <text>[0..500)</text>
            </inputEntry>
            <outputEntry>
                <text>1</text>
            </outputEntry>
        </rule>
        <rule id="id-ba19200060db4a933658db98400f5019">
            <description>string(-)</description>
            <inputEntry>
                <text>[500..1000)</text>
            </inputEntry>
            <outputEntry>
                <text>5</text>
            </outputEntry>
        </rule>
        <rule id="id-23a4b91a413530151413d2230f41e010">
            <description>string(-)</description>
            <inputEntry>
                <text>[1000..5000)</text>
            </inputEntry>
            <outputEntry>
                <text>10</text>
            </outputEntry>
        </rule>
        <rule id="id-9b4dbf30626d219d5e7937c1322b33fe">
            <description>string(-)</description>
            <inputEntry>
                <text>[5000..10000]</text>
            </inputEntry>
            <outputEntry>
                <text>20</text>
            </outputEntry>
        </rule>
        <rule id="id-37139385183b4a6ee481738ccccc02f4">
            <description>string(-)</description>
            <inputEntry>
                <text>> 10000</text>
            </inputEntry>
            <outputEntry>
                <text>25</text>
            </outputEntry>
        </rule>
        <rule id="id-7d86977d4be287545686b09f982b55a9">
            <description>string(-)</description>
            <inputEntry>
                <text>< 0</text>
            </inputEntry>
            <outputEntry>
                <text>0</text>
            </outputEntry>
        </rule>
    </decisionTable>
</decision>
<decision name="calculatePrice" id="id-d045696f950f3769011d375f7a1afd78" label="Calculate Price " sigExt:shapeId="sid-E3A6C7E0-BEE6-47C9-97EC-1C5A95EE2DB4" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <literalExpression expressionLanguage="http://www.omg.org/spec/FEEL/20140401">
        <text>sum( for order in collateOrder return ( order.Item Price * order.Item Quantity ) )</text>
    </literalExpression>
    <variable typeRef="sig:calculatePrice" name="calculatePrice" id="id-d045696f950f3769011d375f7a1afd78_variable"/>
    <informationRequirement>
        <requiredDecision href="#id-85c7398c9bc186c1e2396c4625ebbcc1"/>
    </informationRequirement>
</decision>
<decision name="collateOrder" id="id-85c7398c9bc186c1e2396c4625ebbcc1" label="Collate Order" sigExt:shapeId="sid-C47674E0-8CDE-4A4A-84E8-3DD179DCF72C" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:collateOrder" name="collateOrder" id="id-85c7398c9bc186c1e2396c4625ebbcc1_variable"/>
    <informationRequirement>
        <requiredInput href="#id-a47f651b80111a121d93cf07939b20dc"/>
    </informationRequirement>
    <literalExpression expressionLanguage="http://www.omg.org/spec/FEEL/20140401">
        <text>zip(["Item Name", "Item Price", "Item Quantity"], order.itemName, order.price, order.quantity)</text>
    </literalExpression>
</decision>
</definitions>
</code>```

Results:

```<code>    order: {
        itemName: [item1, item2, item3]
        quantity: [100, 20, 300]
        price: [1000, 200, 3000]
    }
    collateOrder: [{Item Name=item1, Item Quantity=100, Item Price=1000}, {Item Name=item2, Item Quantity=20, Item Price=200}, {Item Name=item3, Item Quantity=300, Item Price=3000}]
    calculatePrice: 1004000
    determineDiscount: 25
    calculatePriceAfterDiscount: 753000.00
</code>```

Thanks again for reporting the issue with the MID, we will investigate the issue within the Signavio extension.

Body:
I have below DMN model that zips input and calculate discount. I am able to run it thru simulator in signavio.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions namespace="http://www.signavio.com/dmn/1.1/diagram/8462cb232d98419493d4ef846516a070.xml" exporterVersion="13.3.2" name="MID Example" id="id-f1fe73d348e342d2a6f0435b38ce14e6" sigExt:revisionId="9f563b074ba844d4b9d1fcd6bead7580" sigExt:revisionNumber="1" xmlns="http://www.omg.org/spec/DMN/20151101/dmn.xsd" xmlns:sig="http://www.signavio.com/dmn/1.1/diagram/8462cb232d98419493d4ef846516a070.xml" xmlns:sigExt="http://www.signavio.com/schema/dmn/1.1/" xmlns:feel="http://www.omg.org/spec/FEEL/20140401">
<extensionElements/>
<itemDefinition isCollection="false" name="calculatePriceAfterDiscount" id="id-f8c81ba73d98a8a51216f4583ed31dc9" label="Calculate Price After Discount">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="calculatePrice" id="id-e13d8570789c69dec9515bd8b9159f2d" label="Calculate Price ">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="determineDiscount" id="id-99dded75dc910f4c4b3e2f1d3471cd10" label="Determine Discount %">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="discount" id="id-e41b37d9d6d86919af6290e062ee6bbe" label="Discount">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="collateOrder2" id="id-a4abe03e2f888a7830f15614f50bc45a" label="Collate Order">
    <itemComponent isCollection="false" name="itemName" id="id-a4abe03e2f888a7830f15614f50bc45a-relation-ItemName" label="Item Name" sigExt:slotId="Item Name">
        <typeRef>feel:string</typeRef>
    </itemComponent>
    <itemComponent isCollection="false" name="itemPrice" id="id-a4abe03e2f888a7830f15614f50bc45a-relation-ItemPrice" label="Item Price" sigExt:slotId="Item Price">
        <typeRef>feel:number</typeRef>
    </itemComponent>
    <itemComponent isCollection="false" name="itemQuantity" id="id-a4abe03e2f888a7830f15614f50bc45a-relation-ItemQuantity" label="Item Quantity" sigExt:slotId="Item Quantity">
        <typeRef>feel:number</typeRef>
    </itemComponent>
</itemDefinition>
<itemDefinition isCollection="false" name="calculateTotalPrice" id="id-753285786a1cec905c139529a673b0fe" label="Calculate Total Price">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="itemPrice" id="id-1a281dc9cb860f8ffd0c4cef9485f6a0" label="Item Price ">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="true" name="collateOrder" id="id-8cbabc9f5673d5e84b524b68155dcb45" label="Collate Order">
    <itemComponent isCollection="false" name="itemName" id="id-8cbabc9f5673d5e84b524b68155dcb45-relation-ItemName" label="Item Name" sigExt:slotId="Item Name">
        <typeRef>feel:string</typeRef>
    </itemComponent>
    <itemComponent isCollection="false" name="itemPrice" id="id-8cbabc9f5673d5e84b524b68155dcb45-relation-ItemPrice" label="Item Price" sigExt:slotId="Item Price">
        <typeRef>feel:number</typeRef>
    </itemComponent>
    <itemComponent isCollection="false" name="itemQuantity" id="id-8cbabc9f5673d5e84b524b68155dcb45-relation-ItemQuantity" label="Item Quantity" sigExt:slotId="Item Quantity">
        <typeRef>feel:number</typeRef>
    </itemComponent>
</itemDefinition>
<itemDefinition isCollection="false" name="order" id="id-4cc8046b78214ad11657d5b06436db21" label="Order ">
    <itemComponent isCollection="true" name="price" id="id-4cc8046b78214ad11657d5b06436db21-relation-0" label="Price" sigExt:slotId="0">
        <typeRef>feel:number</typeRef>
    </itemComponent>
    <itemComponent isCollection="true" name="quantity" id="id-4cc8046b78214ad11657d5b06436db21-relation-1" label="Quantity" sigExt:slotId="1">
        <typeRef>feel:number</typeRef>
    </itemComponent>
    <itemComponent isCollection="true" name="itemName" id="id-4cc8046b78214ad11657d5b06436db21-relation-2" label="Item Name" sigExt:slotId="2">
        <typeRef>feel:string</typeRef>
    </itemComponent>
</itemDefinition>
<inputData name="collateOrder_iterator" id="id-4835f35ebd354e9d65c600afb02d9d3c" label="Collate Order" sigExt:shapeId="sid-139D76F2-2029-4058-B488-9472C5BBEBC6" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:collateOrder2" name="collateOrder_iterator" id="id-4835f35ebd354e9d65c600afb02d9d3c_variable"/>
</inputData>
<inputData name="order" id="id-a47f651b80111a121d93cf07939b20dc" label="Order " sigExt:shapeId="sid-8352CBF9-98EA-4018-9EAC-F17A5F936551" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:order" name="order" id="id-a47f651b80111a121d93cf07939b20dc_variable"/>
</inputData>
<decision name="calculatePriceAfterDiscount" id="id-567eb0877fe31a6d84a53c3917e4eee0" label="Calculate Price After Discount" sigExt:shapeId="sid-5F8D6179-84FD-47B9-BA88-0E3CB4305014" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:calculatePriceAfterDiscount" name="calculatePriceAfterDiscount" id="id-567eb0877fe31a6d84a53c3917e4eee0_variable"/>
    <informationRequirement>
        <requiredDecision href="#id-bc493858d94a5f245b95febc081cb0c7"/>
    </informationRequirement>
    <informationRequirement>
        <requiredDecision href="#id-d045696f950f3769011d375f7a1afd78"/>
    </informationRequirement>
    <literalExpression expressionLanguage="http://www.omg.org/spec/FEEL/20140401">
        <text>(calculatePrice-((determineDiscount/100)*calculatePrice))</text>
    </literalExpression>
</decision>
<decision name="calculateTotalPrice" id="id-be5d8465feb66b570cf75aeee595bf21" label="Calculate Total Price" sigExt:shapeId="sid-EA841422-3493-491C-9CE6-59F5EA9CE261" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:calculateTotalPrice" name="calculateTotalPrice" id="id-be5d8465feb66b570cf75aeee595bf21_variable"/>
    <informationRequirement>
        <requiredInput href="#id-4835f35ebd354e9d65c600afb02d9d3c"/>
    </informationRequirement>
    <decisionTable hitPolicy="UNIQUE">
        <input id="id-137491756d969eac658224df41ae34d3" label="Price">
            <inputExpression>
                <text>collateOrder_iterator.itemPrice</text>
            </inputExpression>
        </input>
        <input id="id-cad45b775d319f14f2cc11d5d3b758fd" label="Quantity">
            <inputExpression>
                <text>collateOrder_iterator.itemQuantity</text>
            </inputExpression>
        </input>
        <output name="calculateTotalPrice" typeRef="sig:itemPrice" id="id-99e0fdb7f0d56dbc7bb88ae025be147c" label="Calculate Total Price"/>
        <rule id="id-2fff85d2331aa1e369d698392addb0a8">
            <description>string(-)</description>
            <inputEntry>
                <text>not(null)</text>
            </inputEntry>
            <inputEntry>
                <text>not(null)</text>
            </inputEntry>
            <outputEntry>
                <text>(collateOrder_iterator.itemPrice*collateOrder_iterator.itemQuantity)</text>
            </outputEntry>
        </rule>
    </decisionTable>
</decision>
<decision name="determineDiscount" id="id-bc493858d94a5f245b95febc081cb0c7" label="Determine Discount %" sigExt:shapeId="sid-6824DDAF-771A-4773-973E-1477F70EC90B" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:determineDiscount" name="determineDiscount" id="id-bc493858d94a5f245b95febc081cb0c7_variable"/>
    <informationRequirement>
        <requiredDecision href="#id-d045696f950f3769011d375f7a1afd78"/>
    </informationRequirement>
    <decisionTable hitPolicy="UNIQUE">
        <input id="id-8a61ecb31c82e81d0b067a63f8a10b25" label="Calculate Price ">
            <inputExpression>
                <text>calculatePrice</text>
            </inputExpression>
        </input>
        <output name="determineDiscount" typeRef="sig:discount" id="id-cd2468e782346733c82b544eae541110" label="Determine Discount %"/>
        <rule id="id-8ce83be6aaf7113a136fadb09f2de83b">
            <description>string(-)</description>
            <inputEntry>
                <text>[0..500)</text>
            </inputEntry>
            <outputEntry>
                <text>1</text>
            </outputEntry>
        </rule>
        <rule id="id-ba19200060db4a933658db98400f5019">
            <description>string(-)</description>
            <inputEntry>
                <text>[500..1000)</text>
            </inputEntry>
            <outputEntry>
                <text>5</text>
            </outputEntry>
        </rule>
        <rule id="id-23a4b91a413530151413d2230f41e010">
            <description>string(-)</description>
            <inputEntry>
                <text>[1000..5000)</text>
            </inputEntry>
            <outputEntry>
                <text>10</text>
            </outputEntry>
        </rule>
        <rule id="id-9b4dbf30626d219d5e7937c1322b33fe">
            <description>string(-)</description>
            <inputEntry>
                <text>[5000..10000]</text>
            </inputEntry>
            <outputEntry>
                <text>20</text>
            </outputEntry>
        </rule>
        <rule id="id-37139385183b4a6ee481738ccccc02f4">
            <description>string(-)</description>
            <inputEntry>
                <text>> 10000</text>
            </inputEntry>
            <outputEntry>
                <text>25</text>
            </outputEntry>
        </rule>
        <rule id="id-7d86977d4be287545686b09f982b55a9">
            <description>string(-)</description>
            <inputEntry>
                <text>< 0</text>
            </inputEntry>
            <outputEntry>
                <text>0</text>
            </outputEntry>
        </rule>
    </decisionTable>
</decision>
<decision name="calculatePrice" id="id-d045696f950f3769011d375f7a1afd78" label="Calculate Price " sigExt:shapeId="sid-E3A6C7E0-BEE6-47C9-97EC-1C5A95EE2DB4" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements>
        <sigExt:MultiInstanceDecisionLogic>
            <sigExt:iterationExpression>collateOrder</sigExt:iterationExpression>
            <sigExt:iteratorShapeId>id-4835f35ebd354e9d65c600afb02d9d3c</sigExt:iteratorShapeId>
            <sigExt:aggregationFunction>SUM</sigExt:aggregationFunction>
            <sigExt:topLevelDecisionId>id-be5d8465feb66b570cf75aeee595bf21</sigExt:topLevelDecisionId>
        </sigExt:MultiInstanceDecisionLogic>
    </extensionElements>
    <variable typeRef="sig:calculatePrice" name="calculatePrice" id="id-d045696f950f3769011d375f7a1afd78_variable"/>
    <informationRequirement>
        <requiredDecision href="#id-85c7398c9bc186c1e2396c4625ebbcc1"/>
    </informationRequirement>
</decision>
<decision name="collateOrder" id="id-85c7398c9bc186c1e2396c4625ebbcc1" label="Collate Order" sigExt:shapeId="sid-C47674E0-8CDE-4A4A-84E8-3DD179DCF72C" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:collateOrder" name="collateOrder" id="id-85c7398c9bc186c1e2396c4625ebbcc1_variable"/>
    <informationRequirement>
        <requiredInput href="#id-a47f651b80111a121d93cf07939b20dc"/>
    </informationRequirement>
    <literalExpression expressionLanguage="http://www.omg.org/spec/FEEL/20140401">
        <text>zip(["Item Name", "Item Price", "Item Quantity"], [order.itemName, order.price, order.quantity])</text>
    </literalExpression>
</decision>

I have tried to change the zip as below

zip(["Item Name", "Item Price", "Item Quantity"],order.itemName, order.price, order.quantity)

When i run it thru my java code, i am getting below error message

19:40:43.251 [main] ERROR org.kie.dmn.feel.runtime.functions.DTInvokerFunction - Error invoking decision table 'determineDiscount': ClassCastException
java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.math.BigDecimal (java.util.ArrayList and java.math.BigDecimal are in module java.base of loader 'bootstrap')

My java code will be like this

    final KieServices ks = KieServices.Factory.get();
    final KieFileSystem kfs = ks.newKieFileSystem();
    KieModuleModel kmm = ks.newKieModuleModel();
    kmm.setConfigurationProperty("org.kie.dmn.profiles.signavio", "org.kie.dmn.signavio.KieDMNSignavioProfile");
    kfs.writeKModuleXML(kmm.toXML());
    kfs.write(ks.getResources().newClassPathResource("MID Example (2).dmn", this.getClass()));
    KieBuilder kieBuilder = ks.newKieBuilder(kfs).buildAll();
    Results results = kieBuilder.getResults();
    logger.info("buildAll() completed.");
    results.getMessages(Message.Level.WARNING).forEach(e -> logger.warn("{}", e));
    final KieContainer kieContainer = ks.newKieContainer(ks.getRepository().getDefaultReleaseId());
    DMNRuntime runtime = kieContainer.newKieSession().getKieRuntime(DMNRuntime.class);
    DMNModel model0 = runtime.getModels().get(0);
    DMNContext context = runtime.newContext();
    Map<String, Object> item1 = new HashMap<>();
    item1.put("itemName", "item1");
    item1.put("price", 1000);
    item1.put("quantity", 100);
    Map<String, Object> item2 = new HashMap<>();
    item2.put("itemName", "item2");
    item2.put("price", 200);
    item2.put("quantity", 20);
    Map<String, Object> item3 = new HashMap<>();
    item3.put("itemName", "item3");
    item3.put("price", 3000);
    item3.put("quantity", 300);
    context.set("order", Arrays.asList(item1, item2, item3));
    DMNResult evaluateAll = runtime.evaluateAll(model0, context);
    evaluateAll.getMessages().forEach(System.out::println);
    List<DMNDecisionResult> decResutls = evaluateAll.getDecisionResults();
    printDecisionResults(decResutls);

Appreciate any pointers.

Body:
Thank you for providing all required assets/code to reproduce the issue in full.
I believe there are several problems which I will describe below, and provide a complete fixed/working example bottom.

Problem: respecting the Order type definition.

Based on your full DMN model definition, the Order (input data node value) must be a singleton composite object of "itemName", "price", "quantity" properties; each of this property is a collection.

So the input should be something like:

    order: {
        itemName: [item1, item2, item3]
        quantity: [100, 20, 300]
        price: [1000, 200, 3000]
    }

Problem: respecting the zip function consistent with Order type definition

Based on your full DMN model definition, the correct definition for the zip function shall be:

zip(["Item Name", "Item Price", "Item Quantity"], order.itemName, order.price, order.quantity)

as I assume what you want to do, based on the full DMN model definition, is transform the data into the following structure

collateOrder: [
   {
      Item Name=item1,
      Item Quantity=100,
      Item Price=1000
   },
   {
      Item Name=item2,
      Item Quantity=20,
      Item Price=200
   },
   {
      Item Name=item3,
      Item Quantity=300,
      Item Price=3000
   }
]

Problem: MID aggregation function

I believe I found a bug in the Signavio extension implementation; thank you for reporting this will be investigated further.

However you can do the required business logic by using the much simpler standard DMN literal expression, without having to rely on any extension beyond what defined only in the DMN specification itself:

sum( for order in collateOrder return ( order.Item Price * order.Item Quantity ) )

this does not require any (Signavio) extension, and it's valid DMN.

To recap.

Java test code snippet:

        DMNContext context = runtime.newContext();
        List<String> itemList = Arrays.asList("item1", "item2", "item3");
        List<BigDecimal> priceList = Arrays.asList(new BigDecimal(1000), new BigDecimal(200), new BigDecimal(3000));
        List<Integer> qtyList = Arrays.asList(100, 20, 300);
        Map<String, Object> order = new HashMap<>();
        order.put("itemName", itemList);
        order.put("price", priceList);
        order.put("quantity", qtyList);
        context.set("order", order);
        DMNResult evaluateAll = runtime.evaluateAll(model0, context);

fixed DMN model, without requiring any special extension:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions namespace="http://www.signavio.com/dmn/1.1/diagram/8462cb232d98419493d4ef846516a070.xml" exporterVersion="13.3.2" name="MID Example" id="id-f1fe73d348e342d2a6f0435b38ce14e6" sigExt:revisionId="9f563b074ba844d4b9d1fcd6bead7580" sigExt:revisionNumber="1" xmlns="http://www.omg.org/spec/DMN/20151101/dmn.xsd" xmlns:sig="http://www.signavio.com/dmn/1.1/diagram/8462cb232d98419493d4ef846516a070.xml" xmlns:sigExt="http://www.signavio.com/schema/dmn/1.1/" xmlns:feel="http://www.omg.org/spec/FEEL/20140401">
<extensionElements/>
<itemDefinition isCollection="false" name="calculatePriceAfterDiscount" id="id-f8c81ba73d98a8a51216f4583ed31dc9" label="Calculate Price After Discount">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="calculatePrice" id="id-e13d8570789c69dec9515bd8b9159f2d" label="Calculate Price ">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="determineDiscount" id="id-99dded75dc910f4c4b3e2f1d3471cd10" label="Determine Discount %">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="discount" id="id-e41b37d9d6d86919af6290e062ee6bbe" label="Discount">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="collateOrder2" id="id-a4abe03e2f888a7830f15614f50bc45a" label="Collate Order">
    <itemComponent isCollection="false" name="itemName" id="id-a4abe03e2f888a7830f15614f50bc45a-relation-ItemName" label="Item Name" sigExt:slotId="Item Name">
        <typeRef>feel:string</typeRef>
    </itemComponent>
    <itemComponent isCollection="false" name="itemPrice" id="id-a4abe03e2f888a7830f15614f50bc45a-relation-ItemPrice" label="Item Price" sigExt:slotId="Item Price">
        <typeRef>feel:number</typeRef>
    </itemComponent>
    <itemComponent isCollection="false" name="itemQuantity" id="id-a4abe03e2f888a7830f15614f50bc45a-relation-ItemQuantity" label="Item Quantity" sigExt:slotId="Item Quantity">
        <typeRef>feel:number</typeRef>
    </itemComponent>
</itemDefinition>
<itemDefinition isCollection="false" name="calculateTotalPrice" id="id-753285786a1cec905c139529a673b0fe" label="Calculate Total Price">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="false" name="itemPrice" id="id-1a281dc9cb860f8ffd0c4cef9485f6a0" label="Item Price ">
    <typeRef>feel:number</typeRef>
</itemDefinition>
<itemDefinition isCollection="true" name="collateOrder" id="id-8cbabc9f5673d5e84b524b68155dcb45" label="Collate Order">
    <itemComponent isCollection="false" name="itemName" id="id-8cbabc9f5673d5e84b524b68155dcb45-relation-ItemName" label="Item Name" sigExt:slotId="Item Name">
        <typeRef>feel:string</typeRef>
    </itemComponent>
    <itemComponent isCollection="false" name="itemPrice" id="id-8cbabc9f5673d5e84b524b68155dcb45-relation-ItemPrice" label="Item Price" sigExt:slotId="Item Price">
        <typeRef>feel:number</typeRef>
    </itemComponent>
    <itemComponent isCollection="false" name="itemQuantity" id="id-8cbabc9f5673d5e84b524b68155dcb45-relation-ItemQuantity" label="Item Quantity" sigExt:slotId="Item Quantity">
        <typeRef>feel:number</typeRef>
    </itemComponent>
</itemDefinition>
<itemDefinition isCollection="false" name="order" id="id-4cc8046b78214ad11657d5b06436db21" label="Order ">
    <itemComponent isCollection="true" name="price" id="id-4cc8046b78214ad11657d5b06436db21-relation-0" label="Price" sigExt:slotId="0">
        <typeRef>feel:number</typeRef>
    </itemComponent>
    <itemComponent isCollection="true" name="quantity" id="id-4cc8046b78214ad11657d5b06436db21-relation-1" label="Quantity" sigExt:slotId="1">
        <typeRef>feel:number</typeRef>
    </itemComponent>
    <itemComponent isCollection="true" name="itemName" id="id-4cc8046b78214ad11657d5b06436db21-relation-2" label="Item Name" sigExt:slotId="2">
        <typeRef>feel:string</typeRef>
    </itemComponent>
</itemDefinition>
<inputData name="order" id="id-a47f651b80111a121d93cf07939b20dc" label="Order " sigExt:shapeId="sid-8352CBF9-98EA-4018-9EAC-F17A5F936551" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:order" name="order" id="id-a47f651b80111a121d93cf07939b20dc_variable"/>
</inputData>
<decision name="calculatePriceAfterDiscount" id="id-567eb0877fe31a6d84a53c3917e4eee0" label="Calculate Price After Discount" sigExt:shapeId="sid-5F8D6179-84FD-47B9-BA88-0E3CB4305014" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:calculatePriceAfterDiscount" name="calculatePriceAfterDiscount" id="id-567eb0877fe31a6d84a53c3917e4eee0_variable"/>
    <informationRequirement>
        <requiredDecision href="#id-bc493858d94a5f245b95febc081cb0c7"/>
    </informationRequirement>
    <informationRequirement>
        <requiredDecision href="#id-d045696f950f3769011d375f7a1afd78"/>
    </informationRequirement>
    <literalExpression expressionLanguage="http://www.omg.org/spec/FEEL/20140401">
        <text>(calculatePrice-((determineDiscount/100)*calculatePrice))</text>
    </literalExpression>
</decision>
<decision name="determineDiscount" id="id-bc493858d94a5f245b95febc081cb0c7" label="Determine Discount %" sigExt:shapeId="sid-6824DDAF-771A-4773-973E-1477F70EC90B" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:determineDiscount" name="determineDiscount" id="id-bc493858d94a5f245b95febc081cb0c7_variable"/>
    <informationRequirement>
        <requiredDecision href="#id-d045696f950f3769011d375f7a1afd78"/>
    </informationRequirement>
    <decisionTable hitPolicy="UNIQUE">
        <input id="id-8a61ecb31c82e81d0b067a63f8a10b25" label="Calculate Price ">
            <inputExpression>
                <text>calculatePrice</text>
            </inputExpression>
        </input>
        <output name="determineDiscount" typeRef="sig:discount" id="id-cd2468e782346733c82b544eae541110" label="Determine Discount %"/>
        <rule id="id-8ce83be6aaf7113a136fadb09f2de83b">
            <description>string(-)</description>
            <inputEntry>
                <text>[0..500)</text>
            </inputEntry>
            <outputEntry>
                <text>1</text>
            </outputEntry>
        </rule>
        <rule id="id-ba19200060db4a933658db98400f5019">
            <description>string(-)</description>
            <inputEntry>
                <text>[500..1000)</text>
            </inputEntry>
            <outputEntry>
                <text>5</text>
            </outputEntry>
        </rule>
        <rule id="id-23a4b91a413530151413d2230f41e010">
            <description>string(-)</description>
            <inputEntry>
                <text>[1000..5000)</text>
            </inputEntry>
            <outputEntry>
                <text>10</text>
            </outputEntry>
        </rule>
        <rule id="id-9b4dbf30626d219d5e7937c1322b33fe">
            <description>string(-)</description>
            <inputEntry>
                <text>[5000..10000]</text>
            </inputEntry>
            <outputEntry>
                <text>20</text>
            </outputEntry>
        </rule>
        <rule id="id-37139385183b4a6ee481738ccccc02f4">
            <description>string(-)</description>
            <inputEntry>
                <text>&gt; 10000</text>
            </inputEntry>
            <outputEntry>
                <text>25</text>
            </outputEntry>
        </rule>
        <rule id="id-7d86977d4be287545686b09f982b55a9">
            <description>string(-)</description>
            <inputEntry>
                <text>&lt; 0</text>
            </inputEntry>
            <outputEntry>
                <text>0</text>
            </outputEntry>
        </rule>
    </decisionTable>
</decision>
<decision name="calculatePrice" id="id-d045696f950f3769011d375f7a1afd78" label="Calculate Price " sigExt:shapeId="sid-E3A6C7E0-BEE6-47C9-97EC-1C5A95EE2DB4" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <literalExpression expressionLanguage="http://www.omg.org/spec/FEEL/20140401">
        <text>sum( for order in collateOrder return ( order.Item Price * order.Item Quantity ) )</text>
    </literalExpression>
    <variable typeRef="sig:calculatePrice" name="calculatePrice" id="id-d045696f950f3769011d375f7a1afd78_variable"/>
    <informationRequirement>
        <requiredDecision href="#id-85c7398c9bc186c1e2396c4625ebbcc1"/>
    </informationRequirement>
</decision>
<decision name="collateOrder" id="id-85c7398c9bc186c1e2396c4625ebbcc1" label="Collate Order" sigExt:shapeId="sid-C47674E0-8CDE-4A4A-84E8-3DD179DCF72C" sigExt:diagramId="8462cb232d98419493d4ef846516a070">
    <extensionElements/>
    <variable typeRef="sig:collateOrder" name="collateOrder" id="id-85c7398c9bc186c1e2396c4625ebbcc1_variable"/>
    <informationRequirement>
        <requiredInput href="#id-a47f651b80111a121d93cf07939b20dc"/>
    </informationRequirement>
    <literalExpression expressionLanguage="http://www.omg.org/spec/FEEL/20140401">
        <text>zip(["Item Name", "Item Price", "Item Quantity"], order.itemName, order.price, order.quantity)</text>
    </literalExpression>
</decision>
</definitions>

Results:

    order: {
        itemName: [item1, item2, item3]
        quantity: [100, 20, 300]
        price: [1000, 200, 3000]
    }
    collateOrder: [{Item Name=item1, Item Quantity=100, Item Price=1000}, {Item Name=item2, Item Quantity=20, Item Price=200}, {Item Name=item3, Item Quantity=300, Item Price=3000}]
    calculatePrice: 1004000
    determineDiscount: 25
    calculatePriceAfterDiscount: 753000.00

Thanks again for reporting the issue with the MID, we will investigate the issue within the Signavio extension.


问:
JSX template literals for an inline style
I'm trying to add an inline style on an element which includes variables.

Hard-coding the values works:

```<code><circle style={{ strokeDasharray: "75, 25" }} ></circle>
</code>```

But I need a way for both of the numbers in this style to pull from variables.

I've tried a variety of curly braces and backticks - I think I need template literals, but am not sure how the syntax works for them inside of the double curly braces that this inline style seems to require.

This one

```<code><circle style={`{strokeDasharray: "${ percent }, 25"}`} ></circle>
</code>```

fails with message: The style prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.

This one

```<code><circle style={{`strokeDasharray: "${ percent }, 25"`}} ></circle>
</code>```

causes the build to fail completely.

This one

```<code><circle style={{strokeDasharray: "`${ percent }`, 25"}} ></circle>
</code>```

builds, but no inline style is added at all.

In addition to using the percent variable for the first numeric value, I need to calculate the second numeric value - it will always be 100 minus the percent variable.

答:
The key thing here is that the code within the outer {} is pure JavaScript code (specifically, an expression [not a statement]). With the style property, you specify an object:

```<code><circle style={yourObjectHere} />
</code>```

In your case, you're specifying an object literal, just like any other object literal in JavaScript. So you have the property name, a colon, and the property value. Since part of the value is from a variable, you use the usual ways of creating a concatenated string:

```<code><circle style={{strokeDasharray: percent + ", 25"}} />
</code>```

or

```<code><circle style={{strokeDasharray: `${percent}, 25`}} />
</code>```

etc.

(If you're wondering why I used /> instead of ></circle>, it's because even non-void elements are typically self-closed in JSX. JSX isn't quite SVG or HTML or even XHTML, it's its own beast.)

You probably  want to calculate the second number as well, as Михаил Мишин shows, so with the above that's:

```<code><circle style={{strokeDasharray: percent + ", " + (100 - percent)}} />
</code>```

or

```<code><circle style={{strokeDasharray: `${percent}, ${100 - percent}`}} />
</code>```

Body:
I'm trying to add an inline style on an element which includes variables.

Hard-coding the values works:

<circle style={{ strokeDasharray: "75, 25" }} ></circle>

But I need a way for both of the numbers in this style to pull from variables.

I've tried a variety of curly braces and backticks - I think I need template literals, but am not sure how the syntax works for them inside of the double curly braces that this inline style seems to require.

This one

<circle style={`{strokeDasharray: "${ percent }, 25"}`} ></circle>

fails with message: The style prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.

This one

<circle style={{`strokeDasharray: "${ percent }, 25"`}} ></circle>

causes the build to fail completely.

This one

<circle style={{strokeDasharray: "`${ percent }`, 25"}} ></circle>

builds, but no inline style is added at all.

In addition to using the percent variable for the first numeric value, I need to calculate the second numeric value - it will always be 100 minus the percent variable.

Body:
The key thing here is that the code within the outer {} is pure JavaScript code (specifically, an expression [not a statement]). With the style property, you specify an object:

<circle style={yourObjectHere} />

In your case, you're specifying an object literal, just like any other object literal in JavaScript. So you have the property name, a colon, and the property value. Since part of the value is from a variable, you use the usual ways of creating a concatenated string:

<circle style={{strokeDasharray: percent + ", 25"}} />

or

<circle style={{strokeDasharray: `${percent}, 25`}} />

etc.

(If you're wondering why I used /> instead of ></circle>, it's because even non-void elements are typically self-closed in JSX. JSX isn't quite SVG or HTML or even XHTML, it's its own beast.)

You probably  want to calculate the second number as well, as Михаил Мишин shows, so with the above that's:

<circle style={{strokeDasharray: percent + ", " + (100 - percent)}} />

or

<circle style={{strokeDasharray: `${percent}, ${100 - percent}`}} />


问:
xampp change location of htdocs
Installed xampp-windows-x64-7.4.6-0-VC15 on a reinstalled Windows 10.

Used the default install folder : C:\xampp

I need to point to a different htdocs folder. Instead of C:\xampp\htdocs I need to have my site located in C:\Users\gadib\Dropbox\GADI\xampp\htdocs.

Searched the entire internet (YES, I did!) and all relevant entries suggest that I need to edit 2 lines in C:\xampp\apache\conf\httpd.conf :

```<code>Define SRVROOT "C:/xampp/htdocs"
ServerRoot "C:/xampp/htdocs"
</code>```

and replace C:/xampp/htdocs with the path to the desired folder.

BUT... the 2 lines I have in this file are :

```<code>Define SRVROOT "C:/xampp/apache"
ServerRoot "C:/xampp/apache"
</code>```

Note that these end with apache and not with htdocs !!!

I tried anyway :

```<code>Define SRVROOT "C:\Users\gadib\Dropbox\GADI\xampp\htdocs"
ServerRoot "C:\Users\gadib\Dropbox\GADI\xampp\htdocs"
</code>```

and when starting Apache (via the xampp control panel) it failed with :

```<code>Error: Apache shutdown unexpectedly.   etc...
</code>```

Any idea/hint/suggestion would be very much appreciated.

答:
Update:
Sorry if I get you wrong... But if you are talking about the ServerRoot it is very normal to be "C:/xampp/apache" since it is for everyone like that. ServerRoot is the top of the directory tree under which the server's configuration, error, and log files are kept... However the DOCUMENTROOT must be C:/xampp/htdocs For example: DocumentRoot "C:/xampp/htdocs" I hope this will help you out :)</p>

Title: xampp change location of htdocs

Body:
Installed xampp-windows-x64-7.4.6-0-VC15 on a reinstalled Windows 10.

Used the default install folder : C:\xampp

I need to point to a different htdocs folder. Instead of C:\xampp\htdocs I need to have my site located in C:\Users\gadib\Dropbox\GADI\xampp\htdocs.

Searched the entire internet (YES, I did!) and all relevant entries suggest that I need to edit 2 lines in C:\xampp\apache\conf\httpd.conf :

Define SRVROOT "C:/xampp/htdocs"
ServerRoot "C:/xampp/htdocs"

and replace C:/xampp/htdocs with the path to the desired folder.

BUT... the 2 lines I have in this file are :

Define SRVROOT "C:/xampp/apache"
ServerRoot "C:/xampp/apache"

Note that these end with apache and not with htdocs !!!

I tried anyway :

Define SRVROOT "C:\Users\gadib\Dropbox\GADI\xampp\htdocs"
ServerRoot "C:\Users\gadib\Dropbox\GADI\xampp\htdocs"

and when starting Apache (via the xampp control panel) it failed with :

Error: Apache shutdown unexpectedly.   etc...

Any idea/hint/suggestion would be very much appreciated.


问:
TTFB much longer in browser than tested by curl
I am trying to optimise performance of Angular application. I found that the most blocking operation is waiting for API response TTFB.

Result from Chrome network tab:

test of the same endpoint by curl:

curl -o /dev/null -w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n" http://api-endpoint.com/api/xyz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   897    0   897    0     0   2385      0 --:--:-- --:--:-- --:--:--  2385
Connect: 0.005503 TTFB: 0.376242 Total time: 0.376443
```

I am really confused. Should I look for further optimisation in Angular application or blame backend?

Angular 9
Backend is written in Symfony

答:
you are right, ask backend devs to investigate the issue.

in angular you can check that you don't spam backend with requests. If amount of requests the app sends is reasonable, then nothing to do here, only backend.

If you see duplicates, or redundant requests - try to avoid them.

Body:
I am trying to optimise performance of Angular application. I found that the most blocking operation is waiting for API response TTFB.

Result from Chrome network tab:

test of the same endpoint by curl:

curl -o /dev/null -w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n" http://api-endpoint.com/api/xyz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   897    0   897    0     0   2385      0 --:--:-- --:--:-- --:--:--  2385
Connect: 0.005503 TTFB: 0.376242 Total time: 0.376443

I am really confused. Should I look for further optimisation in Angular application or blame backend?

Angular 9
Backend is written in Symfony


问:
plotting on the y-axis in Mathematica
I have another question about Wolfram Mathematica. Is there someone that knows how I can plot a graphic on the y axis?

I hope that the figure helps.

答:
Just for fun:

ContourPlot is another alternative.
Using Thies function:

```<code>ContourPlot[-y*Exp[-y^2/2] - x == 0,
            {x, -2, 2}, {y, 0, 4},
            Axes -> True, Frame -> None]
</code>```

RegionPlot is another

```<code>RegionPlot[-y*Exp[-y^2/2] > x,
           {x, -2.1, 2.1}, {y, -.1, 4.1},
           Axes -> True, Frame -> None, PlotStyle -> White,
           PlotRange -> {{-2, 2}, {0, 4}}]
</code>```

And finally, a REALLY convoluted way using ListCurvePathPlot and Solve:

```<code>Off[Solve::ifun, FindMaxValue::fmgz];

ListCurvePathPlot[
 Join @@
  Table[
        {x, y} /. Solve[-y*Exp[-y^2/2] == x, y],
   {x, FindMaxValue[-y*Exp[-y^2/2], y], 0, .01}],
 PlotRange -> {{-2, 2}, {0, 4}}]

On[Solve::ifun, FindMaxValue::fmgz];
</code>```

Off Topic

Answer to Sjoerd's None of the answers given thus far can work with Plot's Filling  option.

Reply: Not necessary

```<code>f={.5 Sin[2 y],Sin[y]};
RegionPlot[Min@f<=x<=Max@f,{x,-1,1},{y,-0.1,2.1 Pi},
  Axes->True,Frame->None,
  PlotRange->{{-2,2},{0,2 Pi}},
  PlotPoints->500]
</code>```

Title: plotting on the y-axis in Mathematica

Body:
Just for fun:

ContourPlot is another alternative.
Using Thies function:

ContourPlot[-y*Exp[-y^2/2] - x == 0,
            {x, -2, 2}, {y, 0, 4},
            Axes -> True, Frame -> None]

RegionPlot is another

RegionPlot[-y*Exp[-y^2/2] > x,
           {x, -2.1, 2.1}, {y, -.1, 4.1},
           Axes -> True, Frame -> None, PlotStyle -> White,
           PlotRange -> {{-2, 2}, {0, 4}}]

And finally, a REALLY convoluted way using ListCurvePathPlot and Solve:

Off[Solve::ifun, FindMaxValue::fmgz];

ListCurvePathPlot[
 Join @@
  Table[
        {x, y} /. Solve[-y*Exp[-y^2/2] == x, y],
   {x, FindMaxValue[-y*Exp[-y^2/2], y], 0, .01}],
 PlotRange -> {{-2, 2}, {0, 4}}]

On[Solve::ifun, FindMaxValue::fmgz];

Off Topic

Answer to Sjoerd's None of the answers given thus far can work with Plot's Filling  option.

Reply: Not necessary

f={.5 Sin[2 y],Sin[y]};
RegionPlot[Min@f<=x<=Max@f,{x,-1,1},{y,-0.1,2.1 Pi},
  Axes->True,Frame->None,
  PlotRange->{{-2,2},{0,2 Pi}},
  PlotPoints->500]


问:
fabric js as ES6 import in Chrome doesn't work
On my website I don't want to bundle but instead use ES6 modules directly (works for the audience)

I try importing fabric.js by

import {fabric} from "../node_modules/fabric/dist/fabric.js"; like I do when I bundle (for bundles it works fine).

however when starting the website I get

"Uncaught SyntaxError: The requested module
  '../node_modules/fabric/dist/fabric.js' does not provide an export
  named 'fabric'"

if I change the above to
import * as FAB from "../node_modules/fabric/dist/fabric.js";
I get

Uncaught TypeError: Cannot read property 'fabric' of undefined
      at fabric.js:3224

Any ideas on how to use fabric directly as ES6 module without bundling?
Needless to say I do not have this issue with other modules I import when using Chrome 76.0.3809.132

Upgraded to fabric 3.4 with no avail. Let me paste my entire code here: The html

```<code><!DOCTYPE html>
<html>
   <head>
      <meta charset="utf-8">
      <script type="module" src="./start.js"></script>
   </head>

   <body>

   </body>
</html>
</code>```

and the JS from which I removed everything else

import fabric from '../node_modules/fabric/dist/fabric.min.js';

Still same Error

Uncaught SyntaxError: The requested module
  '../node_modules/fabric/dist/fabric.min.js' does not provide an export
  named 'default'

答:
importing in this way works for me </p>

```<code> import { fabric } from "fabric"
</code>```

Body:
On my website I don't want to bundle but instead use ES6 modules directly (works for the audience)

I try importing fabric.js by

import {fabric} from "../node_modules/fabric/dist/fabric.js"; like I do when I bundle (for bundles it works fine).

however when starting the website I get

"Uncaught SyntaxError: The requested module
  '../node_modules/fabric/dist/fabric.js' does not provide an export
  named 'fabric'"

if I change the above to
import * as FAB from "../node_modules/fabric/dist/fabric.js";
I get

Uncaught TypeError: Cannot read property 'fabric' of undefined
      at fabric.js:3224

Any ideas on how to use fabric directly as ES6 module without bundling?
Needless to say I do not have this issue with other modules I import when using Chrome 76.0.3809.132

Upgraded to fabric 3.4 with no avail. Let me paste my entire code here: The html

<!DOCTYPE html>

      <meta charset="utf-8">

and the JS from which I removed everything else

import fabric from '../node_modules/fabric/dist/fabric.min.js';

Still same Error

Uncaught SyntaxError: The requested module
  '../node_modules/fabric/dist/fabric.min.js' does not provide an export
  named 'default'

Body:
importing in this way works for me

 import { fabric } from "fabric"


问:
1006 Connection closed abnormally error with python 3.7 websockets
I'm having the same problem as this github issue with python websockets:
https://github.com/aaugustin/websockets/issues/367

The proposed solution isn't working for me though. The error I'm getting is:

websockets.exceptions.ConnectionClosed: WebSocket connection is closed: code = 1006 (connection closed abnormally [internal]), no reason

This is my code:

```<code>async def get_order_book(symbol):
    with open('test.csv', 'a+') as csvfile:
        csvw = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL)
        DT = Data(data=data, last_OB_id=ob_id, last_TR_id=tr_id, sz=10, csvw=csvw)

        while True:
            if not websocket.open:
                print('Reconnecting')
                websocket = await websockets.connect(ws_url)
            else:
                resp = await websocket.recv()
                update = ujson.loads(resp)
                DT.update_data(update)

async def get_order_books():
    r = requests.get(url='https://api.binance.com/api/v1/ticker/24hr')
    await asyncio.gather(*[get_order_book(data['symbol']) for data in r.json()])

if __name__ == '__main__':
    asyncio.run(get_order_books())
</code>```

The way I've been testing it is by closing my internet connection, but after a ten second delay it still returns the 1006 error.

I'm running Python 3.7 and Websockets 7.0.

Let me know what your thoughts are, thanks!

答:
I ran in to this same issue. The solution by shinola worked for awhile, but I would still get errors sometimes.

To handle this I put the connection into a while True: loop and added two separate try except blocks. The consumer variable is a function that processes the messages received from the websocket connection.

async def websocketConnect(uri, payload, consumer):
    websocket = await websockets.connect(uri, ssl=True)
    await websocket.send(json.dumps(payload))
    while True:
        if not websocket.open:
            try:
                print('Websocket is NOT connected. Reconnecting...')
                websocket = await websockets.connect(uri, ssl=True)
                await websocket.send(json.dumps(payload))
            except:
                print('Unable to reconnect, trying again.')
        try:
            async for message in websocket:
                if message is not None:
                    consumer(json.loads(message))
        except:
            print('Error receiving message from websocket.')

```

<p>I start the connection using:</p>

<pre class="lang-py prettyprint-override"><code>def startWebsocket(uri, payload, consumer):
    asyncio.run(websocketConnect(uri, payload, consumer))
</code>```

Body:
I'm having the same problem as this github issue with python websockets:
https://github.com/aaugustin/websockets/issues/367

The proposed solution isn't working for me though. The error I'm getting is:

websockets.exceptions.ConnectionClosed: WebSocket connection is closed: code = 1006 (connection closed abnormally [internal]), no reason

This is my code:

async def get_order_book(symbol):
    with open('test.csv', 'a+') as csvfile:
        csvw = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL)
        DT = Data(data=data, last_OB_id=ob_id, last_TR_id=tr_id, sz=10, csvw=csvw)

        while True:
            if not websocket.open:
                print('Reconnecting')
                websocket = await websockets.connect(ws_url)
            else:
                resp = await websocket.recv()
                update = ujson.loads(resp)
                DT.update_data(update)

async def get_order_books():
    r = requests.get(url='https://api.binance.com/api/v1/ticker/24hr')
    await asyncio.gather(*[get_order_book(data['symbol']) for data in r.json()])

if __name__ == '__main__':
    asyncio.run(get_order_books())

The way I've been testing it is by closing my internet connection, but after a ten second delay it still returns the 1006 error.

I'm running Python 3.7 and Websockets 7.0.

Let me know what your thoughts are, thanks!

Body:
I ran in to this same issue. The solution by shinola worked for awhile, but I would still get errors sometimes.

To handle this I put the connection into a while True: loop and added two separate try except blocks. The consumer variable is a function that processes the messages received from the websocket connection.

async def websocketConnect(uri, payload, consumer):
    websocket = await websockets.connect(uri, ssl=True)
    await websocket.send(json.dumps(payload))
    while True:
        if not websocket.open:
            try:
                print('Websocket is NOT connected. Reconnecting...')
                websocket = await websockets.connect(uri, ssl=True)
                await websocket.send(json.dumps(payload))
            except:
                print('Unable to reconnect, trying again.')
        try:
            async for message in websocket:
                if message is not None:
                    consumer(json.loads(message))
        except:
            print('Error receiving message from websocket.')

I start the connection using:

def startWebsocket(uri, payload, consumer):
    asyncio.run(websocketConnect(uri, payload, consumer))


问:
Why does the output keep returning a 'None' value at the last?
```<code>def range_test(start, end):
    while start <= end:
        print(start)
        start+=1

print(range_test(1,5))
</code>```

Output:

```<code>1
2
3
4
5
None

Process finished with exit code 0
</code>```

答:
The None at the end is the None returned by range_test.  Change it to:

```<code>def range_test(start, end):
    while start <= end:
        print(start)
        start+=1

range_test(1,5)  # this function already prints, no need to print its return
</code>```

or if you prefer to have range_test return something you can print (rather than doing the printing itself and returning nothing), do:

```<code>def range_test(start, end):
    to_print = ""
    while start <= end:
        to_print += f"{start}\n"
        start+=1
    return to_print

print(range_test(1,5))
</code>```

Body:
def range_test(start, end):
    while start <= end:
        print(start)
        start+=1

print(range_test(1,5))

Output:

1
2
3
4
5
None

Process finished with exit code 0

Body:
The None at the end is the None returned by range_test.  Change it to:

def range_test(start, end):
    while start <= end:
        print(start)
        start+=1

range_test(1,5)  # this function already prints, no need to print its return

or if you prefer to have range_test return something you can print (rather than doing the printing itself and returning nothing), do:

def range_test(start, end):
    to_print = ""
    while start <= end:
        to_print += f"{start}\n"
        start+=1
    return to_print

print(range_test(1,5))


问:
I need to Add debit card from my APP to Google pay progmatically
I am a little bit new in Google pay integration. I need to add a debit card into google pay from my android app. but I am not finding any API for that. Anyone can help me how I can add debit card programmatically from my android app to google pay directly.</p>

答:
This isn't generally possible to do with Google Pay. It is up to the user to add a card directly to their Google Account.

One exception is if you happen to be the card issuer. If you are the card issuer, you can sign up for the Android Push Provisioning API.

See my previous answer for more information.


问:
Cannot install Yii 1.x using Composer
It seems that Yii is popular nowadays, and so does using composer (instead of installing your PHP libs manually), so I decide to give them a try.

Anyway, these are my steps:

mkdir "yii-dev" in /var/www/html (my box runs Debian 7 64)

mkdir -p yii-dev/protected/config

create a composer.json in /yii-dev/protected/config:

```<code>{ "repositories": [
    {
        "type":"composer",
        "url": "http://packages.phundament.com"
    }
],
"require": {
    "php": "5.6.5",
    "yiisoft/yii": "1.1.6",
    "yiiext/migrate-command": "0.7.2"
},
"config": {
    "bin-dir": "bin/"
},
"autoload": {
    "psr-0": {
        "config": "./"
    }
},
"scripts": {
    "pre-install-cmd": "config\\ComposerCallback::preInstall",
    "post-install-cmd": "config\\ComposerCallback::postInstall",
    "pre-update-cmd": "config\\ComposerCallback::preUpdate",
    "post-update-cmd": "config\\ComposerCallback::postUpdate",
    "post-package-install": ["config\\ComposerCallback::postPackageInstall"],
    "post-package-update": ["config\\ComposerCallback::postPackageUpdate"]
} }
</code>```

Then I add console.php in yii-dev/config:

```<code><?php
return array(
    'aliases' => array(
        'vendor' => 'application.vendor',
    ),
    'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR .'..',
    'name' => 'My Awesome Yii Site',
    'components' => array(
        'db' => array(
            // PostgreSQL
            'connectionString' => 'pgsql:host=localhost;dbname=yii_dev',
            'emulatePrepare' => true,
            'username' => 'yii',
            'password' => 'yii123',
            'charset' => 'utf8',
        ),
    ),
    'params' => array(
        'composer.callbacks' => array(
            // args for Yii command runner
            'yiisoft/yii-install' => array('yiic', 'webapp', dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'),
            'post-update' => array('yiic', 'migrate'),
            'post-install' => array('yiic', 'migrate'),
        ),
    ),
);
</code>```

And finally, ComposerCallback.php in yii-dev/protected/config. The content is a bit long so I don't put it here. Instead, it can be found at http://www.shanedowling.com/yii-with-composer/

Then when I run "composer install", I get this:

$ composer install

Phundament 3 Installernn * download packages specified in composer.json

trigger composer callbacksnnStart Installation? [yes|no] yes

PHP Fatal error:  Class 'config\Yii' not found in
  /var/www/html/yii-dev/protected/config/ComposerCallback.php on line
  182

Fatal error: Class 'config\Yii' not found in
  /var/www/html/yii-dev/protected/config/ComposerCallback.php on line
  182

How to fix this?

答:
This might be quite old question. But still I had to face the same issue today to config composer to one of our existing old system which is using Yii1.1. This is what I did and it's working.

My project structure is:

```<code>project_dir/website/protected/
project_dir/website/index.php
</code>```

So, I installed the composer within /website/ directory.

Install composer locally

```<code>$ cd website/
/website$ curl -sS https://getcomposer.org/installer | php
/website$ php composer.phar -h
</code>```

To update the system to require autoload.php, add following to the website/protected/config/main.php

```<code>require_once( dirname(__FILE__) . '/../../vendor/autoload.php');
</code>```

Add following to .htaccess within website/

```<code>RewriteEngine on
RewriteCond %{REQUEST_FILENAME} vendor/ [OR]
RewriteCond %{REQUEST_FILENAME} composer.phar [OR]
RewriteCond %{REQUEST_FILENAME} composer.json [OR]
RewriteCond %{REQUEST_FILENAME} composer.lock
RewriteRule . index.php
</code>```

All done. Just install what you want

```<code>composer require packegeName
</code>```

Ref: https://devreadwrite.com/posts/add-the-composer-to-the-application-on-yii

Title: Cannot install Yii 1.x using Composer

Body:
It seems that Yii is popular nowadays, and so does using composer (instead of installing your PHP libs manually), so I decide to give them a try.

Anyway, these are my steps:

mkdir "yii-dev" in /var/www/html (my box runs Debian 7 64)

mkdir -p yii-dev/protected/config

create a composer.json in /yii-dev/protected/config:

{ "repositories": [
    {
        "type":"composer",
        "url": "http://packages.phundament.com"
    }
],
"require": {
    "php": "5.6.5",
    "yiisoft/yii": "1.1.6",
    "yiiext/migrate-command": "0.7.2"
},
"config": {
    "bin-dir": "bin/"
},
"autoload": {
    "psr-0": {
        "config": "./"
    }
},
"scripts": {
    "pre-install-cmd": "config\\ComposerCallback::preInstall",
    "post-install-cmd": "config\\ComposerCallback::postInstall",
    "pre-update-cmd": "config\\ComposerCallback::preUpdate",
    "post-update-cmd": "config\\ComposerCallback::postUpdate",
    "post-package-install": ["config\\ComposerCallback::postPackageInstall"],
    "post-package-update": ["config\\ComposerCallback::postPackageUpdate"]
} }

Then I add console.php in yii-dev/config:

<?php
return array(
    'aliases' => array(
        'vendor' => 'application.vendor',
    ),
    'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR .'..',
    'name' => 'My Awesome Yii Site',
    'components' => array(
        'db' => array(
            // PostgreSQL
            'connectionString' => 'pgsql:host=localhost;dbname=yii_dev',
            'emulatePrepare' => true,
            'username' => 'yii',
            'password' => 'yii123',
            'charset' => 'utf8',
        ),
    ),
    'params' => array(
        'composer.callbacks' => array(
            // args for Yii command runner
            'yiisoft/yii-install' => array('yiic', 'webapp', dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'),
            'post-update' => array('yiic', 'migrate'),
            'post-install' => array('yiic', 'migrate'),
        ),
    ),
);

And finally, ComposerCallback.php in yii-dev/protected/config. The content is a bit long so I don't put it here. Instead, it can be found at http://www.shanedowling.com/yii-with-composer/

Then when I run "composer install", I get this:

$ composer install

Phundament 3 Installernn * download packages specified in composer.json

trigger composer callbacksnnStart Installation? [yes|no] yes

PHP Fatal error:  Class 'config\Yii' not found in
  /var/www/html/yii-dev/protected/config/ComposerCallback.php on line
  182

Fatal error: Class 'config\Yii' not found in
  /var/www/html/yii-dev/protected/config/ComposerCallback.php on line
  182

How to fix this?

Body:
This might be quite old question. But still I had to face the same issue today to config composer to one of our existing old system which is using Yii1.1. This is what I did and it's working.

My project structure is:

project_dir/website/protected/
project_dir/website/index.php

So, I installed the composer within /website/ directory.

Install composer locally

$ cd website/
/website$ curl -sS https://getcomposer.org/installer | php
/website$ php composer.phar -h

To update the system to require autoload.php, add following to the website/protected/config/main.php

require_once( dirname(__FILE__) . '/../../vendor/autoload.php');

Add following to .htaccess within website/

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} vendor/ [OR]
RewriteCond %{REQUEST_FILENAME} composer.phar [OR]
RewriteCond %{REQUEST_FILENAME} composer.json [OR]
RewriteCond %{REQUEST_FILENAME} composer.lock
RewriteRule . index.php

All done. Just install what you want

composer require packegeName

Ref: https://devreadwrite.com/posts/add-the-composer-to-the-application-on-yii