问:
TopicSubscriber receive() not working Spring JMS - consumer closed
I am trying to receive messages using a TopicSubscriber created using execute method of JMSTemplate in Spring JMS. The objective is to test receiving of messages from a topic both synchronously and asynchronously. However, when trying to receive message from a durable topic subscriber, I get an error saying Consumer is closed.

I am new to Spring JMS. Can someone specify how to configure a JMSListener inside the test class? I have created two JMSListeners but they do not seem to work.

Here is my Test Class Code:

```<code>@SpringBootTest
class AqJmsExampleApplicationTests {

    private ConnectionFactory connectionFactory;
    private JmsTemplate jmsTemplate;

    @BeforeEach
    void setUp() {
        // initialize jmstemplate with connectionFactory
        //  ......
    }

    @Test
    void test() {
        this.jmsTemplate.setExplicitQosEnabled(true);
        this.jmsTemplate.setPubSubDomain(true);
        TopicSubscriber tSub = this.jmsTemplate.execute(s -> {
            return s.createDurableSubscriber(
                (Topic)this.jmsTemplate
                    .getDestinationResolver()
                    .resolveDestinationName(s,
                            "testTopic4", true), "tSub");
        }, true);
        this.jmsTemplate.setPriority(7);
        this.jmsTemplate.send("testTopic4", s -> {
            return s.createTextMessage("hi this is first topic message");
        });

        try {
            Message msg = tSub.receive(20000);
            System.out.println("The message received is: " +
                ((TextMessage)msg).getText());
        } catch (JMSException e) {
            System.out.println("Got exception: " + e);
            e.printStackTrace();
        }
    }

    static class MyTestBean {
        @JmsListener(destination = "testTopic4",
                id = "top41",
                subscription = "testTopic4"
        )
        public void receiveMessageTopic41(Message msg) throws JMSException{
            System.out.println("Received for async subscriber 1<" +
                ((TextMessage)msg).getText() + ">");
        }

        @JmsListener(destination = "testTopic4",
                id = "top42",
                subscription = "testTopic4"
        )
        public void receiveMessageTopic42(Message msg) throws JMSException{
            System.out.println("Received for async subscriber 2<" +
                ((TextMessage)msg).getText() + ">");
        }
}

</code>```

The error received is the following:

```<code>Got exception: javax.jms.IllegalStateException: JMS-115: Consumer is closed
</code>```

Any help would be appreciated. Thanks!

Body:
I am trying to receive messages using a TopicSubscriber created using execute method of JMSTemplate in Spring JMS. The objective is to test receiving of messages from a topic both synchronously and asynchronously. However, when trying to receive message from a durable topic subscriber, I get an error saying Consumer is closed.

I am new to Spring JMS. Can someone specify how to configure a JMSListener inside the test class? I have created two JMSListeners but they do not seem to work.

Here is my Test Class Code:

@SpringBootTest
class AqJmsExampleApplicationTests {

    private ConnectionFactory connectionFactory;
    private JmsTemplate jmsTemplate;

    @BeforeEach
    void setUp() {
        // initialize jmstemplate with connectionFactory
        //  ......
    }

    @Test
    void test() {
        this.jmsTemplate.setExplicitQosEnabled(true);
        this.jmsTemplate.setPubSubDomain(true);
        TopicSubscriber tSub = this.jmsTemplate.execute(s -> {
            return s.createDurableSubscriber(
                (Topic)this.jmsTemplate
                    .getDestinationResolver()
                    .resolveDestinationName(s,
                            "testTopic4", true), "tSub");
        }, true);
        this.jmsTemplate.setPriority(7);
        this.jmsTemplate.send("testTopic4", s -> {
            return s.createTextMessage("hi this is first topic message");
        });

        try {
            Message msg = tSub.receive(20000);
            System.out.println("The message received is: " +
                ((TextMessage)msg).getText());
        } catch (JMSException e) {
            System.out.println("Got exception: " + e);
            e.printStackTrace();
        }
    }

    static class MyTestBean {
        @JmsListener(destination = "testTopic4",
                id = "top41",
                subscription = "testTopic4"
        )
        public void receiveMessageTopic41(Message msg) throws JMSException{
            System.out.println("Received for async subscriber 1<" +
                ((TextMessage)msg).getText() + ">");
        }

        @JmsListener(destination = "testTopic4",
                id = "top42",
                subscription = "testTopic4"
        )
        public void receiveMessageTopic42(Message msg) throws JMSException{
            System.out.println("Received for async subscriber 2<" +
                ((TextMessage)msg).getText() + ">");
        }
}

The error received is the following:

Got exception: javax.jms.IllegalStateException: JMS-115: Consumer is closed

Any help would be appreciated. Thanks!


来源: stackexchange

问:
Handling unnamed docker images in AWS Elastic Beanstalk
My service is up and running in docker platform. When I list docker images in my instance, I see the following images including unnamed.

```<code>> docker images -aq

REPOSITORY      TAG             IMAGE ID       CREATED             SIZE
current_nginx   latest          a3e8b5ae7751   48 minutes ago      23.5MB
<none>          <none>          320523ba019f   48 minutes ago      1.52GB
current_nuxt2   latest          5b744629e956   48 minutes ago      1.52GB
<none>          <none>          ff41ec719b95   48 minutes ago      1.52GB
<none>          <none>          5ed2e390be4e   50 minutes ago      1.5GB
<none>          <none>          a2c4118d3f34   52 minutes ago      643MB
<none>          <none>          0ee04fa44ba2   54 minutes ago      23.5MB
<none>          <none>          266e831b549f   About an hour ago   406MB
<none>          <none>          7e3618333973   About an hour ago   406MB
<none>          <none>          f071bfd32b76   About an hour ago   406MB
node            16-alpine       610c0494e820   7 days ago          118MB
nginx           1.23.2-alpine   19dd4d73108a   5 weeks ago         23.5MB
</code>```

Can someone please explain why I got these unnamed images? I only run 2 containers.

Plus I've already tried to remove one of unnamed images, and I got this error.

```<code>> docker rmi 320523ba019f

Error response from daemon: conflict: unable to delete 320523ba019f (cannot be forced) - image has dependent child images
</code>```

ContentLicense: CC BY-SA 4.0

Body:
My service is up and running in docker platform. When I list docker images in my instance, I see the following images including unnamed.

> docker images -aq

REPOSITORY      TAG             IMAGE ID       CREATED             SIZE
current_nginx   latest          a3e8b5ae7751   48 minutes ago      23.5MB
<none>          <none>          320523ba019f   48 minutes ago      1.52GB
current_nuxt2   latest          5b744629e956   48 minutes ago      1.52GB
<none>          <none>          ff41ec719b95   48 minutes ago      1.52GB
<none>          <none>          5ed2e390be4e   50 minutes ago      1.5GB
<none>          <none>          a2c4118d3f34   52 minutes ago      643MB
<none>          <none>          0ee04fa44ba2   54 minutes ago      23.5MB
<none>          <none>          266e831b549f   About an hour ago   406MB
<none>          <none>          7e3618333973   About an hour ago   406MB
<none>          <none>          f071bfd32b76   About an hour ago   406MB
node            16-alpine       610c0494e820   7 days ago          118MB
nginx           1.23.2-alpine   19dd4d73108a   5 weeks ago         23.5MB

Can someone please explain why I got these unnamed images? I only run 2 containers.

Plus I've already tried to remove one of unnamed images, and I got this error.

> docker rmi 320523ba019f

Error response from daemon: conflict: unable to delete 320523ba019f (cannot be forced) - image has dependent child images


问:
Why yarn visit yarnpkg everytime?
My Project use yarn, when I add an local package,yarn visit yarnpkg.com website..

Who can explain this,why yarn will visit yarnpkg.com when after installed?

Title: Why yarn visit yarnpkg everytime?


问:
How to globally configure Json deserialization from snake case to camel case
I have to deserialize http response like this:

```<code>{
    "result": [
        "......"
    ],
    "plugins_versions": {
        "age": "agegender.AgeDetector",
        "gender": "agegender.GenderDetector",
        "detector": "facenet.FaceDetector",
        "calculator": "facenet.Calculator"
    }
}
</code>```

I have the test snippet to simulate the deserialization process :

```<code>using System.Text.Json;
using System.Text.Json.Serialization;

var jsonOptions = new JsonSerializerOptions()
{
    PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
};

var jsonString = "{\"plugins_versions\": {\"age\": \"agegender.AgeDetector\"}}";
Console.WriteLine(jsonString);
var parsedText = JsonSerializer.Deserialize<Response>(jsonString, options: jsonOptions);

Console.WriteLine(parsedText.PluginsVersions.Age);

class Response
{
    public PluginVersion PluginsVersions { get; set; }
}

class PluginVersion
{
    public string Age { get; set; }
}
</code>```

although the PropertyNamingPolicy is CamelCase, JsonSerializer cannot deserialize "plugins_versions" field, but If I use this:

```<code>
    [JsonPropertyName("plugins_versions")]
    public PluginVersion PluginsVersions { get; set; }
</code>```

JsonSerializer can deserialize json successfully. Is there a way to configure snake case to camel case (serialization)/deserialization in one place instead of specifying [JsonPropertyName("field_name")] manually ?

I tried to create custom naming policy like this:

```<code>using System.Text.Json;

namespace Test;

public class SnakeCaseToCamelCaseNamingPolicy : JsonNamingPolicy
{
    public override string ConvertName(string name)
    {
        return name
            .Split(new [] {"_"}, StringSplitOptions.RemoveEmptyEntries)
            .Select(s => char.ToUpperInvariant(s[0]) + s.Substring(1, s.Length - 1))
            .Aggregate(string.Empty, (s1, s2) => s1 + s2); // this will convert snake case to camel case
    }
}
</code>```

but it did not worked at all

Body:
I have to deserialize http response like this:

{
    "result": [
        "......"
    ],
    "plugins_versions": {
        "age": "agegender.AgeDetector",
        "gender": "agegender.GenderDetector",
        "detector": "facenet.FaceDetector",
        "calculator": "facenet.Calculator"
    }
}

I have the test snippet to simulate the deserialization process :

using System.Text.Json;
using System.Text.Json.Serialization;

var jsonOptions = new JsonSerializerOptions()
{
    PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
};

var jsonString = "{\"plugins_versions\": {\"age\": \"agegender.AgeDetector\"}}";
Console.WriteLine(jsonString);
var parsedText = JsonSerializer.Deserialize<Response>(jsonString, options: jsonOptions);

Console.WriteLine(parsedText.PluginsVersions.Age);

class Response
{
    public PluginVersion PluginsVersions { get; set; }
}

class PluginVersion
{
    public string Age { get; set; }
}

although the PropertyNamingPolicy is CamelCase, JsonSerializer cannot deserialize "plugins_versions" field, but If I use this:

    [JsonPropertyName("plugins_versions")]
    public PluginVersion PluginsVersions { get; set; }

JsonSerializer can deserialize json successfully. Is there a way to configure snake case to camel case (serialization)/deserialization in one place instead of specifying [JsonPropertyName("field_name")] manually ?

I tried to create custom naming policy like this:

using System.Text.Json;

namespace Test;

public class SnakeCaseToCamelCaseNamingPolicy : JsonNamingPolicy
{
    public override string ConvertName(string name)
    {
        return name
            .Split(new [] {"_"}, StringSplitOptions.RemoveEmptyEntries)
            .Select(s => char.ToUpperInvariant(s[0]) + s.Substring(1, s.Length - 1))
            .Aggregate(string.Empty, (s1, s2) => s1 + s2); // this will convert snake case to camel case
    }
}

but it did not worked at all


问:
JSViews - failed to load data after setTimeout
I referred to the sample code stated in here and I have amended the following code

```<code>  data = {items: [
    {showItem:true, name:"Johnny Depp2"},
    {showItem:false, name:"Henry Best"}
  ]}

</code>```

to

```<code>data = {},

helpers = {
    updateItem: function(ev) {
        $.observable(this).setProperty("showItem", !this.showItem);
    }
};

setTimeout(function () {
  data = {items: [
    {showItem:true, name:"Johnny Depp2"},
    {showItem:false, name:"Henry Best"}
  ]}
}, 1000);

</code>```

but I found the initial data could not be loaded, could anyone teach me how to do this? I am simulating the Ajax page load, thanks very much.

Body:
I referred to the sample code stated in here and I have amended the following code

  data = {items: [
    {showItem:true, name:"Johnny Depp2"},
    {showItem:false, name:"Henry Best"}
  ]}

to

data = {},

helpers = {
    updateItem: function(ev) {
        $.observable(this).setProperty("showItem", !this.showItem);
    }
};

setTimeout(function () {
  data = {items: [
    {showItem:true, name:"Johnny Depp2"},
    {showItem:false, name:"Henry Best"}
  ]}
}, 1000);

but I found the initial data could not be loaded, could anyone teach me how to do this? I am simulating the Ajax page load, thanks very much.


问:
Comparing 2 dataframes and set the value of the dataframe if not exists
I have two dataframes. Examples:

```<code>df1:
    Age
0   2.0
1   NaN
2  20.0
df2:
    Age
0  10.0
1  15.0
2   NaN
</code>```

Both dataframes have the same structure.
What I want to do is compare each row in 2 dataframes and set the value for df1 by the value of the df2 if the value of the df1 does not exist

Any pointers would be welcome

My expected output would be:

```<code>df1:
    Age
0   2.0
1   15.0
2  20.0
</code>```

Body:
I have two dataframes. Examples:

df1:
    Age
0   2.0
1   NaN
2  20.0
df2:
    Age
0  10.0
1  15.0
2   NaN

Both dataframes have the same structure.
What I want to do is compare each row in 2 dataframes and set the value for df1 by the value of the df2 if the value of the df1 does not exist

Any pointers would be welcome

My expected output would be:

df1:
    Age
0   2.0
1   15.0
2  20.0


问:
Git clone did not run successfully , exit code 128
I'm working on an ubuntu server and i want to install packages places inside a file txt.:

```<code>loguru~=0.5.3
pandas~=1.2.4
datasets~=1.15.1
git+git://github.com/guyrosin/transformers.git@fillmask_pipeline_fix#egg=transformers
tokenizers~=0.10.3
python-dotenv~=0.15.0
typeguard~=2.11.1
scipy~=1.7.1
scikit-learn~=1.0
natsort~=7.1.1
textsearch~=0.0.21
jsonpickle~=2.0.0
arrow~=1.2.0
</code>```

When the system has to run the git clone command, i get this error:

```<code> Cloning git://github.com/guyrosin/transformers.git (to revision fillmask_pipeline_fix) to /tmp/pip-install-8xu4e81w/transformers_b1f5176ea2074e93b7729f4fb8df1071
  Running command git clone --filter=blob:none --quiet git://github.com/guyrosin/transformers.git /tmp/pip-install-8xu4e81w/transformers_b1f5176ea2074e93b7729f4fb8df1071
  fatal: impossibile collegarsi a github.com:
  github.com[0: 140.82.121.4]: errno=Connessione scaduta

  error: subprocess-exited-with-error

  × git clone --filter=blob:none --quiet git://github.com/guyrosin/transformers.git /tmp/pip-install-8xu4e81w/transformers_b1f5176ea2074e93b7729f4fb8df1071 did not run successfully.
  │ exit code: 128
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× git clone --filter=blob:none --quiet git://github.com/guyrosin/transformers.git /tmp/pip-install-8xu4e81w/transformers_b1f5176ea2074e93b7729f4fb8df1071 did not run successfully.
│ exit code: 128
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
</code>```

Does anyone know how to fix this problem? I'm not the administrator of this server , my professor gave me only credentials to log in and this account user is not a sudo user

I tried everything i saw in other posts, but nothing worked for me.

Body:
I'm working on an ubuntu server and i want to install packages places inside a file txt.:

loguru~=0.5.3
pandas~=1.2.4
datasets~=1.15.1
git+git://github.com/guyrosin/transformers.git@fillmask_pipeline_fix#egg=transformers
tokenizers~=0.10.3
python-dotenv~=0.15.0
typeguard~=2.11.1
scipy~=1.7.1
scikit-learn~=1.0
natsort~=7.1.1
textsearch~=0.0.21
jsonpickle~=2.0.0
arrow~=1.2.0

When the system has to run the git clone command, i get this error:

 Cloning git://github.com/guyrosin/transformers.git (to revision fillmask_pipeline_fix) to /tmp/pip-install-8xu4e81w/transformers_b1f5176ea2074e93b7729f4fb8df1071
  Running command git clone --filter=blob:none --quiet git://github.com/guyrosin/transformers.git /tmp/pip-install-8xu4e81w/transformers_b1f5176ea2074e93b7729f4fb8df1071
  fatal: impossibile collegarsi a github.com:
  github.com[0: 140.82.121.4]: errno=Connessione scaduta

  error: subprocess-exited-with-error

  × git clone --filter=blob:none --quiet git://github.com/guyrosin/transformers.git /tmp/pip-install-8xu4e81w/transformers_b1f5176ea2074e93b7729f4fb8df1071 did not run successfully.
  │ exit code: 128
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× git clone --filter=blob:none --quiet git://github.com/guyrosin/transformers.git /tmp/pip-install-8xu4e81w/transformers_b1f5176ea2074e93b7729f4fb8df1071 did not run successfully.
│ exit code: 128
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Does anyone know how to fix this problem? I'm not the administrator of this server , my professor gave me only credentials to log in and this account user is not a sudo user

I tried everything i saw in other posts, but nothing worked for me.


问:
How to use the same clicked.connect function for multiple buttons?
I am working on a GUI in pyqt5, that using a database (sqlite3). First, I'm uploading the entire data into a QTableWidget. Then, depending on the user filter parameters (2 comboboxes and 2 free text lineEdits which are signaled by 1 button), the filtering function is called and the data is filtered. The user may do another filter afterwards, and the table will be filtered again according to the new request.

The filter function is called upon one of three conditions:

The first combobox text changed ("comboType")

The second combobox text changed ("comboMaterial")

The button "Filter Ac/AL" clicked ("pbFilter ALAc")

The question: the filtering is always initializes when the "comboType" text is changed only (since it's the first signal). When the user wants to filter according to the second or third conditions, the function can not be called and the filtering can not be conducted. The script is stuck until the first condition will occur (call the comboType.currentTextChanged.connect).

Is there any way to "jump" to the second or third condition when clicked?

```<code>### Apply first filter when ComboBox changed###

            self.uiCoresDBWin.comboType.currentTextChanged.connect(lambda: updateCoresTable())
            self.uiCoresDBWin.comboMaterial.currentTextChanged.connect(lambda: updateCoresTable())
            self.uiCoresDBWin.pbFilterALAc.clicked.connect(lambda: updateCoresTable())
`your text`
        def updateCoresTable():
            db = sqlite3.connect("ferrite_cores_db.db")
            cursor = db.cursor()
            typeIndex = self.uiCoresDBWin.comboType.currentIndex()+1
            typeData = self.uiCoresDBWin.comboType.currentText()
            materialIndex = self.uiCoresDBWin.comboMaterial.currentIndex()
            materialData = self.uiCoresDBWin.comboMaterial.currentText()
            typedAc = self.uiCoresDBWin.leAe.text()
            typedAL = self.uiCoresDBWin.leAL.text()
            if typeIndex == 0 and materialIndex == 0 and typedAc == '' and typedAL == '':
                result = cursor.execute("SELECT * from ferrite_cores")
            elif typeIndex == 0 and materialIndex == 0 and typedAc == '' and typedAL != '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE AL >=?", (typedAL,))
            elif typeIndex == 0 and materialIndex == 0 and typedAc != '' and typedAL == '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Aef >=?", (typedAc,))
            elif typeIndex == 0 and materialIndex != 0 and typedAc != '' and typedAL != '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Aef >=? and AL >=?", (typedAc, typedAL))
            elif typeIndex == 0 and materialIndex != 0 and typedAc == '' and typedAL == '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Material ==?", (materialData,))
            elif typeIndex == 0 and materialIndex != 0 and typedAc == '' and typedAL != '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Material ==? and AL >=?", (materialData, typedAL))
            elif typeIndex == 0 and materialIndex != 0 and typedAc != '' and typedAL == '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Material ==? and Aef >=?", (materialData, typedAc))
            elif typeIndex == 0 and materialIndex != 0 and typedAc != '' and typedAL != '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Material ==? and Aef >=? and AL >=?", (materialData, typedAc, typedAL))
            elif typeIndex != 0 and materialIndex == 0 and typedAc == '' and typedAL == '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Type == ?", (typeData,))
            elif typeIndex != 0 and materialIndex == 0 and typedAc == '' and typedAL != '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Type ==? and AL >=?", (typeData, typedAL))
            elif typeIndex != 0 and materialIndex == 0 and typedAc != '' and typedAL == '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Type ==? and Aef >=?", (typeData, typedAc))
            elif typeIndex != 0 and materialIndex == 0 and typedAc != '' and typedAL != '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Type ==? and AL >=? and Aef >=?", (typeData, typedAL, typedAc))
            elif typeIndex != 0 and materialIndex != 0 and typedAc == '' and typedAL == '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Type ==? and Material ==?", (typeData, materialData))
            elif typeIndex != 0 and materialIndex != 0 and typedAc == '' and typedAL != '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Type ==? and Material ==? and AL >=?", (typeData, materialData, typedAL))
            elif typeIndex != 0 and materialIndex != 0 and typedAc != '' and typedAL == '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Type ==? and Material ==? and Aef >=?", (typeData, materialData, typedAc))
            elif typeIndex != 0 and materialIndex != 0 and typedAc != '' and typedAL != '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Type ==? and Material ==? and Aef >=? and AL >=?", (typeData, materialData, typedAc, typedAL))
            self.uiCoresDBWin.CoresTab.setRowCount(0)
            for row_number, row_data in enumerate(result):
                self.uiCoresDBWin.CoresTab.insertRow(row_number)
                for column_number, data in enumerate(row_data):
                    self.uiCoresDBWin.CoresTab.setItem(row_number, column_number, QtWidgets.Q
</code>```

Body:
I am working on a GUI in pyqt5, that using a database (sqlite3). First, I'm uploading the entire data into a QTableWidget. Then, depending on the user filter parameters (2 comboboxes and 2 free text lineEdits which are signaled by 1 button), the filtering function is called and the data is filtered. The user may do another filter afterwards, and the table will be filtered again according to the new request.

The filter function is called upon one of three conditions:

The first combobox text changed ("comboType")

The second combobox text changed ("comboMaterial")

The button "Filter Ac/AL" clicked ("pbFilter ALAc")

The question: the filtering is always initializes when the "comboType" text is changed only (since it's the first signal). When the user wants to filter according to the second or third conditions, the function can not be called and the filtering can not be conducted. The script is stuck until the first condition will occur (call the comboType.currentTextChanged.connect).

Is there any way to "jump" to the second or third condition when clicked?

### Apply first filter when ComboBox changed###

            self.uiCoresDBWin.comboType.currentTextChanged.connect(lambda: updateCoresTable())
            self.uiCoresDBWin.comboMaterial.currentTextChanged.connect(lambda: updateCoresTable())
            self.uiCoresDBWin.pbFilterALAc.clicked.connect(lambda: updateCoresTable())
`your text`
        def updateCoresTable():
            db = sqlite3.connect("ferrite_cores_db.db")
            cursor = db.cursor()
            typeIndex = self.uiCoresDBWin.comboType.currentIndex()+1
            typeData = self.uiCoresDBWin.comboType.currentText()
            materialIndex = self.uiCoresDBWin.comboMaterial.currentIndex()
            materialData = self.uiCoresDBWin.comboMaterial.currentText()
            typedAc = self.uiCoresDBWin.leAe.text()
            typedAL = self.uiCoresDBWin.leAL.text()
            if typeIndex == 0 and materialIndex == 0 and typedAc == '' and typedAL == '':
                result = cursor.execute("SELECT * from ferrite_cores")
            elif typeIndex == 0 and materialIndex == 0 and typedAc == '' and typedAL != '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE AL >=?", (typedAL,))
            elif typeIndex == 0 and materialIndex == 0 and typedAc != '' and typedAL == '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Aef >=?", (typedAc,))
            elif typeIndex == 0 and materialIndex != 0 and typedAc != '' and typedAL != '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Aef >=? and AL >=?", (typedAc, typedAL))
            elif typeIndex == 0 and materialIndex != 0 and typedAc == '' and typedAL == '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Material ==?", (materialData,))
            elif typeIndex == 0 and materialIndex != 0 and typedAc == '' and typedAL != '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Material ==? and AL >=?", (materialData, typedAL))
            elif typeIndex == 0 and materialIndex != 0 and typedAc != '' and typedAL == '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Material ==? and Aef >=?", (materialData, typedAc))
            elif typeIndex == 0 and materialIndex != 0 and typedAc != '' and typedAL != '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Material ==? and Aef >=? and AL >=?", (materialData, typedAc, typedAL))
            elif typeIndex != 0 and materialIndex == 0 and typedAc == '' and typedAL == '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Type == ?", (typeData,))
            elif typeIndex != 0 and materialIndex == 0 and typedAc == '' and typedAL != '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Type ==? and AL >=?", (typeData, typedAL))
            elif typeIndex != 0 and materialIndex == 0 and typedAc != '' and typedAL == '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Type ==? and Aef >=?", (typeData, typedAc))
            elif typeIndex != 0 and materialIndex == 0 and typedAc != '' and typedAL != '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Type ==? and AL >=? and Aef >=?", (typeData, typedAL, typedAc))
            elif typeIndex != 0 and materialIndex != 0 and typedAc == '' and typedAL == '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Type ==? and Material ==?", (typeData, materialData))
            elif typeIndex != 0 and materialIndex != 0 and typedAc == '' and typedAL != '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Type ==? and Material ==? and AL >=?", (typeData, materialData, typedAL))
            elif typeIndex != 0 and materialIndex != 0 and typedAc != '' and typedAL == '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Type ==? and Material ==? and Aef >=?", (typeData, materialData, typedAc))
            elif typeIndex != 0 and materialIndex != 0 and typedAc != '' and typedAL != '':
                result = cursor.execute("SELECT * from ferrite_cores WHERE Type ==? and Material ==? and Aef >=? and AL >=?", (typeData, materialData, typedAc, typedAL))
            self.uiCoresDBWin.CoresTab.setRowCount(0)
            for row_number, row_data in enumerate(result):
                self.uiCoresDBWin.CoresTab.insertRow(row_number)
                for column_number, data in enumerate(row_data):
                    self.uiCoresDBWin.CoresTab.setItem(row_number, column_number, QtWidgets.Q


问:
<Unity> IsPointerOverGameobject mobile not working
I'm making a game in the srpg genre.
I wanted to prevent the game screen from being pressed while the screen is covered.
IsPointerOverGameobject function doesn't work on mobile.

```<code>    private void Update()
    {
        if (EventSystem.current.IsPointerOverGameObjet())
            return;
        if (Input.GetMouseButtonDown(0))
            Select();
    }
</code>```

I tried to prevent clicking using IsPointerOverGameObjet() .
It works in the editor and PC build, but strangely doesn't work in Android build.

Body:
I'm making a game in the srpg genre.
I wanted to prevent the game screen from being pressed while the screen is covered.
IsPointerOverGameobject function doesn't work on mobile.

    private void Update()
    {
        if (EventSystem.current.IsPointerOverGameObjet())
            return;
        if (Input.GetMouseButtonDown(0))
            Select();
    }

I tried to prevent clicking using IsPointerOverGameObjet() .
It works in the editor and PC build, but strangely doesn't work in Android build.


问:
Ionic6 Android FTP Connect Error : android.os.NetworkOnMainThreadException
I am developing a hybrid app using ionic6.
However, the following error occurred during FTP Connect test by creating an Android apk file.
'android.os.NetworkOnMainThreadException'
After searching for various information, it seems that FTP should not be used as Java's main thread after Android version 3.

But I don't use Java(Android source code), I just use vueJS and build it with ionic6 to make apk files.
So I don't know how to solve the problem.

Please help me.

The following is the process of creating an apk file that I proceeded with.

ionic build -> ionic cap add android -> ionic cap open android -> android studio -> build apk file.

My env = Ionic v6 / Vue3 / my tablet android version 11

The following is the contents of the setup file:

package.json

"dependencies": {
    "@awesome-cordova-plugins/bluetooth-le": "^6.2.0",
    "@awesome-cordova-plugins/ftp": "^6.2.0",
    "@capacitor/android": "4.0.1",
    "@capacitor/app": "4.0.1",
    "@capacitor/core": "4.0.1",
    "@capacitor/haptics": "4.0.1",
    "@capacitor/keyboard": "4.0.1",
    "@capacitor/status-bar": "4.0.1",
    "@ionic-native/ble": "^5.36.0",
    "@ionic-native/ftp": "^5.36.0",
    "@ionic/vue": "^5.0.0",
    "@ionic/vue-router": "^5.2.0",
    "buffer": "^6.0.3",
    "cordova-plugin-ble-central": "^1.6.1",
    "cordova-plugin-bluetoothle": "^6.7.0",
    "cordova-plugin-ftp": "^1.2.1",
    "core-js": "^3.6.5",
    "hangul-js": "^0.2.6",
    "sass": "^1.53.0",
    "sass-loader": "^13.0.2",
    "vue": "^3.2.21",
    "vue-axios": "^3.4.1",
    "vue-i18n": "^9.1.10",
    "vue-marquee-text-component": "^2.0.1",
    "vue-router": "^4.0.12",
    "vuex": "^4.0.2"
  },
  "devDependencies": {
    "@capacitor/cli": "4.0.1",
    "@types/jest": "^27.0.2",
    "@typescript-eslint/eslint-plugin": "^5.6.0",
    "@typescript-eslint/parser": "^5.6.0",
    "@vue/cli-plugin-babel": "~5.0.0-rc.1",
    "@vue/cli-plugin-e2e-cypress": "~5.0.0-rc.1",
    "@vue/cli-plugin-eslint": "~5.0.0-rc.1",
    "@vue/cli-plugin-router": "~5.0.0-rc.1",
    "@vue/cli-plugin-typescript": "~5.0.0-rc.1",
    "@vue/cli-plugin-unit-jest": "~5.0.0-rc.1",
    "@vue/cli-service": "5.0.8",
    "@vue/eslint-config-typescript": "^9.1.0",
    "@vue/test-utils": "^2.0.0-rc.16",
    "@vue/vue3-jest": "^27.0.0-alpha.3",
    "babel-jest": "^27.3.1",
    "cypress": "^8.7.0",
    "eslint": "^8.4.1",
    "eslint-plugin-vue": "^8.2.0",
    "jest": "^27.3.1",
    "ts-jest": "^27.0.7",
    "typescript": "^4.3.5"
  },
```
<p>AndroidManifest.xml</p>
```<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="io.ionic.starter">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:usesCleartextTraffic="true">

        <activity
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
            android:name="io.ionic.starter.MainActivity"
            android:label="@string/title_activity_main"
            android:theme="@style/AppTheme.NoActionBarLaunch"
            android:launchMode="singleTask"
            android:exported="true"
            android:screenOrientation="landscape">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths"></meta-data>
        </provider>
    </application>

    <uses-permission android:name="android.permission.INTERNET" />
</manifest>
```
<p>FTP Call page</p>
```import { FTP as FTP2 } from '@awesome-cordova-plugins/ftp';
import { FTP } from '@ionic-native/ftp';

....

FTP.connect('192.168.0.5', 'id', 'password')
        .then((res: any) => alert('Login successful : ' + res))
        .catch((error: any) => alert('error : ' + error));

FTP2.connect('ftp_server_address', 'id', 'password')
        .then((res: any) => alert('Login successful : ' + res))
        .catch((error: any) => alert('error : ' + error));

```

Body:
I am developing a hybrid app using ionic6.
However, the following error occurred during FTP Connect test by creating an Android apk file.
'android.os.NetworkOnMainThreadException'
After searching for various information, it seems that FTP should not be used as Java's main thread after Android version 3.

But I don't use Java(Android source code), I just use vueJS and build it with ionic6 to make apk files.
So I don't know how to solve the problem.

Please help me.

The following is the process of creating an apk file that I proceeded with.

ionic build -> ionic cap add android -> ionic cap open android -> android studio -> build apk file.

My env = Ionic v6 / Vue3 / my tablet android version 11

The following is the contents of the setup file:

package.json

"dependencies": {
    "@awesome-cordova-plugins/bluetooth-le": "^6.2.0",
    "@awesome-cordova-plugins/ftp": "^6.2.0",
    "@capacitor/android": "4.0.1",
    "@capacitor/app": "4.0.1",
    "@capacitor/core": "4.0.1",
    "@capacitor/haptics": "4.0.1",
    "@capacitor/keyboard": "4.0.1",
    "@capacitor/status-bar": "4.0.1",
    "@ionic-native/ble": "^5.36.0",
    "@ionic-native/ftp": "^5.36.0",
    "@ionic/vue": "^5.0.0",
    "@ionic/vue-router": "^5.2.0",
    "buffer": "^6.0.3",
    "cordova-plugin-ble-central": "^1.6.1",
    "cordova-plugin-bluetoothle": "^6.7.0",
    "cordova-plugin-ftp": "^1.2.1",
    "core-js": "^3.6.5",
    "hangul-js": "^0.2.6",
    "sass": "^1.53.0",
    "sass-loader": "^13.0.2",
    "vue": "^3.2.21",
    "vue-axios": "^3.4.1",
    "vue-i18n": "^9.1.10",
    "vue-marquee-text-component": "^2.0.1",
    "vue-router": "^4.0.12",
    "vuex": "^4.0.2"
  },
  "devDependencies": {
    "@capacitor/cli": "4.0.1",
    "@types/jest": "^27.0.2",
    "@typescript-eslint/eslint-plugin": "^5.6.0",
    "@typescript-eslint/parser": "^5.6.0",
    "@vue/cli-plugin-babel": "~5.0.0-rc.1",
    "@vue/cli-plugin-e2e-cypress": "~5.0.0-rc.1",
    "@vue/cli-plugin-eslint": "~5.0.0-rc.1",
    "@vue/cli-plugin-router": "~5.0.0-rc.1",
    "@vue/cli-plugin-typescript": "~5.0.0-rc.1",
    "@vue/cli-plugin-unit-jest": "~5.0.0-rc.1",
    "@vue/cli-service": "5.0.8",
    "@vue/eslint-config-typescript": "^9.1.0",
    "@vue/test-utils": "^2.0.0-rc.16",
    "@vue/vue3-jest": "^27.0.0-alpha.3",
    "babel-jest": "^27.3.1",
    "cypress": "^8.7.0",
    "eslint": "^8.4.1",
    "eslint-plugin-vue": "^8.2.0",
    "jest": "^27.3.1",
    "ts-jest": "^27.0.7",
    "typescript": "^4.3.5"
  },

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="io.ionic.starter">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:usesCleartextTraffic="true">

        <activity
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
            android:name="io.ionic.starter.MainActivity"
            android:label="@string/title_activity_main"
            android:theme="@style/AppTheme.NoActionBarLaunch"
            android:launchMode="singleTask"
            android:exported="true"
            android:screenOrientation="landscape">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths"></meta-data>
        </provider>
    </application>

    <uses-permission android:name="android.permission.INTERNET" />
</manifest>

FTP Call page

import { FTP as FTP2 } from '@awesome-cordova-plugins/ftp';
import { FTP } from '@ionic-native/ftp';

....

FTP.connect('192.168.0.5', 'id', 'password')
        .then((res: any) => alert('Login successful : ' + res))
        .catch((error: any) => alert('error : ' + error));

FTP2.connect('ftp_server_address', 'id', 'password')
        .then((res: any) => alert('Login successful : ' + res))
        .catch((error: any) => alert('error : ' + error));


问:
Crossed or nested random effects in lme
I have doubts about how to specify the random effects structure in my mixed models.

My experimental design consists of 12 independent enclosures (Encl) with populations of lizards (Subject*_ID).* We applied 2 crossed treatments (Lag: 3 levels and Var: 2 levels). And we repeated the experiment two years (Year), so individuals that survived the first year, were measured again the next year. We analyse the snout vent length (SVL) in mm. Sex (males and females). Individuals were redistributed to different enclosures and treatments the second year, so I include the interaction of Encl:Year in a new column (Encl_Year).

This was my model:

```<code>ctrl <- lmeControl(maxIter=200, msMaxIter=200, msVervose=TRUE, opt="optim")

    options (contrast=c(factor="contr.sum", ordered="contr.poly"))

    model.SVL <- lme(SVL~Lag*Var*Sex*Year, random=list(~1|Subject_ID, ~1|Encl_Year), weight=varIdent(form=~1|Lag*Var*Sex), control=ctrl, data=data)
</code>```

But I don't know how it would be correct to define random effects. Since it would not be a cross random effect model, because not all levels (Subject_ID) are replicated in the enclosures (Encl:Year), but it is not nested either, because there are repeated individuals in different enclosures. What would be the most correct way to write the model?

Depending on the order:

```<code>random=list(~1|Subject_ID, ~1|Encl_Year)
</code>```

or

```<code>random=list(~1|Encl_Year, ~1|Subject_ID)
</code>```

, the results change quite a lot. I also tried a cross random effect model:

```<code>data$Dummy <- factor(1)

data <- groupedData(SVL ~ 1 | Dummy, data)

model.SVL <- lme(SVL~Lag*Var*Sex*Year, random=pdBlocked(list(pdIdent(~ 0 + Subject_ID), pdIdent(~ 0 + Encl_Year))) control=ctrl, weight=varIdent(form=~1|Lag*Var*Sex), data=data)
</code>```

I should add, that I use the lme function, because there is heteroscedasticity in the residuals that I have corrected with the varident function.

Title: Crossed or nested random effects in lme

Body:
I have doubts about how to specify the random effects structure in my mixed models.

My experimental design consists of 12 independent enclosures (Encl) with populations of lizards (Subject*_ID).* We applied 2 crossed treatments (Lag: 3 levels and Var: 2 levels). And we repeated the experiment two years (Year), so individuals that survived the first year, were measured again the next year. We analyse the snout vent length (SVL) in mm. Sex (males and females). Individuals were redistributed to different enclosures and treatments the second year, so I include the interaction of Encl:Year in a new column (Encl_Year).

This was my model:

ctrl <- lmeControl(maxIter=200, msMaxIter=200, msVervose=TRUE, opt="optim")

    options (contrast=c(factor="contr.sum", ordered="contr.poly"))

    model.SVL <- lme(SVL~Lag*Var*Sex*Year, random=list(~1|Subject_ID, ~1|Encl_Year), weight=varIdent(form=~1|Lag*Var*Sex), control=ctrl, data=data)

But I don't know how it would be correct to define random effects. Since it would not be a cross random effect model, because not all levels (Subject_ID) are replicated in the enclosures (Encl:Year), but it is not nested either, because there are repeated individuals in different enclosures. What would be the most correct way to write the model?

Depending on the order:

random=list(~1|Subject_ID, ~1|Encl_Year)

or

random=list(~1|Encl_Year, ~1|Subject_ID)

, the results change quite a lot. I also tried a cross random effect model:

data$Dummy <- factor(1)

data <- groupedData(SVL ~ 1 | Dummy, data)

model.SVL <- lme(SVL~Lag*Var*Sex*Year, random=pdBlocked(list(pdIdent(~ 0 + Subject_ID), pdIdent(~ 0 + Encl_Year))) control=ctrl, weight=varIdent(form=~1|Lag*Var*Sex), data=data)

I should add, that I use the lme function, because there is heteroscedasticity in the residuals that I have corrected with the varident function.


问:
How to resolve Invalid Uri Exception in Excel?
I am using OfficeOpenXml for reading the excel file in C#. But when I am trying to open and reading some sheet from it, it's throwing exception as below:

```<code>   at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
   at System.Uri..ctor(String uriString, UriKind uriKind)
   at MS.Internal.IO.Packaging.InternalRelationshipCollection.ProcessRelationshipAttributes(XmlCompatibilityReader reader)
   at MS.Internal.IO.Packaging.InternalRelationshipCollection.ParseRelationshipPart(PackagePart part)
   at MS.Internal.IO.Packaging.InternalRelationshipCollection..ctor(Package package, PackagePart part)
   at System.IO.Packaging.PackagePart.EnsureRelationships()
   at System.IO.Packaging.PackagePart.GetRelationshipHelper(String id)
   at System.IO.Packaging.PackagePart.GetRelationship(String id)
   at OfficeOpenXml.ExcelWorkbook.GetExternalReferences()
   at OfficeOpenXml.ExcelPackage.get_Workbook()
   at ServiceHandlerUNIC.UploadTuningFile() in d:\Srusti\Projects\WECSWebConfigurator\07_SourceCode\WECSWebConfigurator\App_Code\ServiceHandlerUNIC.cs:line 56392
</code>```

How can I identify this thing? Because it's working with one excel file while another excel file is throwing an error. My code is :

```<code>ExcelPackage ep = new ExcelPackage(new FileInfo(fileFUllPath));
ExcelWorksheet ws = ep.Workbook.Worksheets["Configuration"];
</code>```

Body:
I am using OfficeOpenXml for reading the excel file in C#. But when I am trying to open and reading some sheet from it, it's throwing exception as below:

   at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
   at System.Uri..ctor(String uriString, UriKind uriKind)
   at MS.Internal.IO.Packaging.InternalRelationshipCollection.ProcessRelationshipAttributes(XmlCompatibilityReader reader)
   at MS.Internal.IO.Packaging.InternalRelationshipCollection.ParseRelationshipPart(PackagePart part)
   at MS.Internal.IO.Packaging.InternalRelationshipCollection..ctor(Package package, PackagePart part)
   at System.IO.Packaging.PackagePart.EnsureRelationships()
   at System.IO.Packaging.PackagePart.GetRelationshipHelper(String id)
   at System.IO.Packaging.PackagePart.GetRelationship(String id)
   at OfficeOpenXml.ExcelWorkbook.GetExternalReferences()
   at OfficeOpenXml.ExcelPackage.get_Workbook()
   at ServiceHandlerUNIC.UploadTuningFile() in d:\Srusti\Projects\WECSWebConfigurator\07_SourceCode\WECSWebConfigurator\App_Code\ServiceHandlerUNIC.cs:line 56392

How can I identify this thing? Because it's working with one excel file while another excel file is throwing an error. My code is :

ExcelPackage ep = new ExcelPackage(new FileInfo(fileFUllPath));
ExcelWorksheet ws = ep.Workbook.Worksheets["Configuration"];


问:
Curl failed: Failed to connect to xxx.xxx.xxx.xx port 5000 after 1002 ms: Couldn't connect to server
i have this code, its works very fine from localserver to online server, but from online server to online server gives me this
Curl failed: Failed to connect to xxx.xxx.xxx.xx port 5000 after 1002 ms: Couldn't connect to server
any Advice please
Thanks in advance</p>
```<code><?php
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
// require_once('relay.class.php');
// $relay = new relay();

$url = "http://xxx.xxx.xx.xxx:5000/api/table/sfuse1";
// $url = "http://xxx.xxx.xx.xxx:5000/api/table/sfuse1";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$headers = array(
   "Accept: application/json",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

$resp = curl_exec($curl);
if ($resp === FALSE) {
    die("Curl failed: " . curl_error($curl));
}
// var_dump($resp);
curl_close($curl);
$result = json_decode($resp, true);
// // var_dump($result['Content']);
// foreach($result['Content'] as $v){
//    if($v['code'] == 'MX-MASTER3'){
//       var_dump($v);
//       exit;
//    }
// }
// if($result['Content'])

var_dump($result['Content']);

// foreach($result['Content'] as $row){
//     $name_en = $row['code'];
//     $name_fr =  $row['code'];
//     // $color_code =  $row['code'];
//     $relay->AddColors($name_en,$name_fr,'NULL');
// }

// echo "<script> window.location.href='../../relay.php'</script>"; ?>

code ```
**bold**
*italic*
>quote

any advice please
thanks
</code>```

Body:
i have this code, its works very fine from localserver to online server, but from online server to online server gives me this
Curl failed: Failed to connect to xxx.xxx.xxx.xx port 5000 after 1002 ms: Couldn't connect to server
any Advice please
Thanks in advance

<?php
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
// require_once('relay.class.php');
// $relay = new relay();

$url = "http://xxx.xxx.xx.xxx:5000/api/table/sfuse1";
// $url = "http://xxx.xxx.xx.xxx:5000/api/table/sfuse1";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$headers = array(
   "Accept: application/json",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

$resp = curl_exec($curl);
if ($resp === FALSE) {
    die("Curl failed: " . curl_error($curl));
}
// var_dump($resp);
curl_close($curl);
$result = json_decode($resp, true);
// // var_dump($result['Content']);
// foreach($result['Content'] as $v){
//    if($v['code'] == 'MX-MASTER3'){
//       var_dump($v);
//       exit;
//    }
// }
// if($result['Content'])

var_dump($result['Content']);

// foreach($result['Content'] as $row){
//     $name_en = $row['code'];
//     $name_fr =  $row['code'];
//     // $color_code =  $row['code'];
//     $relay->AddColors($name_en,$name_fr,'NULL');
// }

// echo ""; ?>

code ```
**bold**
*italic*
>quote

any advice please
thanks


问:
Adding package as class in Turbo repo?
I just start to learn turbo repo and I would like to seperate class (including method in it) as package, so I can import it to app and use those classes, but I got @You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders in terminal. How can I declear it ?

I tried creating package, folder and classes. I expected I can use those classes, but can't.

Title: Adding package as class in Turbo repo?


问:
Not able to see Marathi copied text properly in text editor Ubuntu
I am using ubuntu and I want to copy some Marathi text from pdf to text editor in Ubuntu,
Below is the text from pdf

enter image description here

If I try to paste this text in text editor it looks like this

enter image description here

Is there any way to get text properly in text editor.

I am using ubuntu 22.04

If I am copying content from other websites to text editor it is working fine.


问:
How to identify swipe up/down in ViewPager 2 using Kotlin
I am trying to get notified if the user swipes up or down on the viewpager. View Pager is showing a list of data coming from an API.

I have been through few answers here on SO including this but they seems a little complex and have very little explanation or are outdated. I am trying to understand are there any other ways to solve this in current scenario using Kotlin.

Would like to know if there are any pre defined methods in ViewPager or what should be my approach to tackle this.


问:
iOS UITableViewController offset pull to refresh stop during return to top
I have a UITableViewController and I want to add the feature pull to refresh.

This is easy to add in the code, the problem is that I want to add a extra space during the load time and when this time over return to top and I found the next problem:

If I touch the screen while the view is moving to top, the scroll stop and don't return to top.

I have a example code to reproduce the problem

```<code>@IBAction func refreshControlValueChanged(_ sender: UIRefreshControl) {
    let elementsCount = numbersElements.count
    let offset = self.tableView.contentOffset.y - (self.refreshControl?.frame.height)!
    self.tableView.setContentOffset(CGPoint(x: 0, y: offset), animated: false)

    DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) {
        self.numbersElements.append(String(elementsCount + 1))
        self.tableView.reloadData()
        sender.endRefreshing()
    }
}
</code>```

I see that I can disable user iteration but I think that is not good fix...

Is there a solution I can use to fix this problem?

Regards and Thanks!

A.

Body:
I have a UITableViewController and I want to add the feature pull to refresh.

This is easy to add in the code, the problem is that I want to add a extra space during the load time and when this time over return to top and I found the next problem:

If I touch the screen while the view is moving to top, the scroll stop and don't return to top.

I have a example code to reproduce the problem

@IBAction func refreshControlValueChanged(_ sender: UIRefreshControl) {
    let elementsCount = numbersElements.count
    let offset = self.tableView.contentOffset.y - (self.refreshControl?.frame.height)!
    self.tableView.setContentOffset(CGPoint(x: 0, y: offset), animated: false)

    DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) {
        self.numbersElements.append(String(elementsCount + 1))
        self.tableView.reloadData()
        sender.endRefreshing()
    }
}

I see that I can disable user iteration but I think that is not good fix...

Is there a solution I can use to fix this problem?

Regards and Thanks!

A.


问:
Azure dashboard with value provider api
My goal is to make an api call and process the returned response and reflect it to the azure dashboard.

The reason for my need is to present some special analysis values in the database on the azure dahsboard to the team.

In order to do this, I searched for azure devops extensions, but I couldn't find a useful extension.I want to know if such an extension already exists.

For example, by sending a get request to www.mycustomerananalysis.com/3, I want to present the " {result : "order" : 3} " order information in the azure dashboard.

Title: Azure dashboard with value provider api


问:
cannot print component in array in javascript
i'm just a newbie on javascript , please help me this

```<code>var arr = [{"student-name":"Harry Potter","discipline":"Magic"}] ;
</code>```

how can i get "Harry Potter" in this array , thanks for helping

Body:
i'm just a newbie on javascript , please help me this

var arr = [{"student-name":"Harry Potter","discipline":"Magic"}] ;

how can i get "Harry Potter" in this array , thanks for helping


问:
In Angular, on using On Push strategy for Change Detection, if the changes are made in child component then how to prevent parent from rerendering
I am trying to understand the change detection strategy, with on push selected in it. In it the reaction of parent when child components face changes.

I tried adding

```<code>changeDetection: ChangeDetectionStrategy.OnPush,
</code>```

in parent-component.ts file but its's not preventing the rerender on changes made in child.

Body:
I am trying to understand the change detection strategy, with on push selected in it. In it the reaction of parent when child components face changes.

I tried adding

changeDetection: ChangeDetectionStrategy.OnPush,

in parent-component.ts file but its's not preventing the rerender on changes made in child.


问:
Having trouble setting up push notifications for conversation messages
I am having some trouble setting up push notifications for conversations.

I followed this guide to setup push notifications to web, and I integrated with firebase but it looks like it's not sending the notifications to firebase?

I can see in the push notifications section in twilio console that it's creating the notifications but when I check the push notification reports in firebase I do not see it there. I have confirmed that firebase was integrated correctly because I can send test push notifications from the firebase console but when I send messages in twilio it does not send the push notifications through to firebase.

Feel free to ask for more info that you might need to help me solve this issue :)


问:
Calculating the kernel, stride and padding size in a Conv3D
I have a 5D input tensor and I also know what 5D tensor I need as the output. How can I find out if I would need padding or not? Also, how can I calculate the kernel size and stride size? There are some formulations but stride size and kernel sizes would contain 3 elements like (a, b, c). When it comes to calculate these multiple elements, solving those equations would be more complicated. How can I compute thos elements?

For example, if I have a tensor of size [16,1024,16,14,14], how can I calculate the stride and kernel sizes in a conv3d if I want an output with the size of [16,32,16,3,5]? How can I know that if padding is needed?

Is there any website that automatically can calculate these parameters?


问:
How to create a window in Android Native Code?
I want to create a new window in an Android native application. I know that I can create a window with

```<code>ANativeWindow_fromSurface(env, surface)
</code>```

if I have reference to the jni env. I want to know if there is a different way to create a window in an Android native app without having reference to the jni env?

Body:
I want to create a new window in an Android native application. I know that I can create a window with

ANativeWindow_fromSurface(env, surface)

if I have reference to the jni env. I want to know if there is a different way to create a window in an Android native app without having reference to the jni env?


问:
Dialogflow CX return partial response
I have a Dialogflow CX V3 chatbot built with the Google Dialogflow console. I send it text chat using the REST API.

```<code>      const response = await sessionsClient.detectIntent(request);
</code>```

And that works fine. But some routes in my Dialogflow agent have to call out to a webhook that may take time to respond. I want to use the Return Partial Response feature to present a message to the user before the webhook is called. It doesn't make sense for that to use the REST API, because that only has the sessionsClient.detectIntent call, and that waits until the whole fulfillment is over before returning. It does have the option to return a PARTIAL result but that never seems to happen, and I cannot see how I might obtain any final result after a partial one.

I went to the RPC API which supports long running operations, hoping to find a variant of detectIntent that returns an operation so I can query the operation multiple times. But I only found

```<code>rpc DetectIntent(DetectIntentRequest) returns (DetectIntentResponse)
</code>```

and DetectIntentResponse is not an operation. Again, it includes a flag responseType which may take the value PARTIAL. However, if I see a partial response, I'm at a loss as to how to get any further output from my API call.

rpc streamingDetectIntent returns a response which can come in multiple pieces. But that seems only applicable to audio chat.

Can anyone please tell me how to use Return Partial Response with a text-based Dialogflow CX chatbot, please?

Title: Dialogflow CX return partial response

Body:
I have a Dialogflow CX V3 chatbot built with the Google Dialogflow console. I send it text chat using the REST API.

      const response = await sessionsClient.detectIntent(request);

And that works fine. But some routes in my Dialogflow agent have to call out to a webhook that may take time to respond. I want to use the Return Partial Response feature to present a message to the user before the webhook is called. It doesn't make sense for that to use the REST API, because that only has the sessionsClient.detectIntent call, and that waits until the whole fulfillment is over before returning. It does have the option to return a PARTIAL result but that never seems to happen, and I cannot see how I might obtain any final result after a partial one.

I went to the RPC API which supports long running operations, hoping to find a variant of detectIntent that returns an operation so I can query the operation multiple times. But I only found

rpc DetectIntent(DetectIntentRequest) returns (DetectIntentResponse)

and DetectIntentResponse is not an operation. Again, it includes a flag responseType which may take the value PARTIAL. However, if I see a partial response, I'm at a loss as to how to get any further output from my API call.

rpc streamingDetectIntent returns a response which can come in multiple pieces. But that seems only applicable to audio chat.

Can anyone please tell me how to use Return Partial Response with a text-based Dialogflow CX chatbot, please?


问:
Why can't I add a sum to the field in Power BI Report Builder?
I found the following documentation on Microsofts Website. The field I am right-clicking is of type numeric, yet the "Add Total" is greyed out. Any Ideas?


问:
Pickling Error - Unable to Decrypt the Column
I am using AWS Encryption SDK for decrypting the incoming encrypted JSON from source system.
The JSON looks like this

```<code>{
id:"uuid"
data:{cipherText:"ASHFLASHLhjhkjGKgkgl"}
}
</code>```

At source we are doing first encryption and then doing encoding-64 for that specific data-key payload.

So in order to Decrypt it first we need to Decode it and then we can decrypt.

```<code>def decrypt_string(encrypted_line):
    # Here I am extracting the Cipertext
    encrypted_payload = encrypted_line["ciphertext"]
return encrypted_payload

def decryption_data(decoded_payload):
    # Here I am passing the Decoded Row to decrypt function
    decrypted_data, decrypted_header = client.decrypt(
        source=decoded_payload, key_provider=master_key_provider)
    return decrypted_data

spark_udf = udf(decrypt_string)

df = df.withColumn("cipertext_value", spark_udf("data"))
df = df.withColumn("decoded_base64_value", unbase64(df.cipertext_value))

spark_udf_decrpt = udf(decryption_data)
df = df.withColumn("decrypted_value", spark_udf_decrpt("decoded_base64_value"))
df.printSchema()
</code>```

So I am able to extract the Cipertext value from the column and then also able to decode it using unbase64 but while trying to decrypt it I am getting below error.

PicklingError: Could not serialize object: TypeError: can't pickle SSLContext objects

Body:
I am using AWS Encryption SDK for decrypting the incoming encrypted JSON from source system.
The JSON looks like this

{
id:"uuid"
data:{cipherText:"ASHFLASHLhjhkjGKgkgl"}
}

At source we are doing first encryption and then doing encoding-64 for that specific data-key payload.

So in order to Decrypt it first we need to Decode it and then we can decrypt.

def decrypt_string(encrypted_line):
    # Here I am extracting the Cipertext
    encrypted_payload = encrypted_line["ciphertext"]
return encrypted_payload

def decryption_data(decoded_payload):
    # Here I am passing the Decoded Row to decrypt function
    decrypted_data, decrypted_header = client.decrypt(
        source=decoded_payload, key_provider=master_key_provider)
    return decrypted_data

spark_udf = udf(decrypt_string)

df = df.withColumn("cipertext_value", spark_udf("data"))
df = df.withColumn("decoded_base64_value", unbase64(df.cipertext_value))

spark_udf_decrpt = udf(decryption_data)
df = df.withColumn("decrypted_value", spark_udf_decrpt("decoded_base64_value"))
df.printSchema()

So I am able to extract the Cipertext value from the column and then also able to decode it using unbase64 but while trying to decrypt it I am getting below error.

PicklingError: Could not serialize object: TypeError: can't pickle SSLContext objects


问:
Entity Framework With .Net Core is inserting duplicated records
i am using .net core 5 webApp (on IIS) with EF . when user is adding new record, from time to time duplicated records will inserted to the table every few seconds (like session is stuck... it want stop untill i restart the application pool). not happening every time, but indeed every few records.

my db is sql.

my code below:

```<code>    [HttpPost]
    [ValidateAntiForgeryToken]
    public async Task<IActionResult> Create([Bind("ProductId,Name,Category,Color,UnitPrice,AvailableQuantity")] Products products)
    {
        if (ModelState.IsValid)
        {
            _context.Add(products);
            await _context.SaveChangesAsync();

            return RedirectToAction(nameof(Index));
        }

        return View(products);
    }
</code>```

Body:
i am using .net core 5 webApp (on IIS) with EF . when user is adding new record, from time to time duplicated records will inserted to the table every few seconds (like session is stuck... it want stop untill i restart the application pool). not happening every time, but indeed every few records.

my db is sql.

my code below:

    [HttpPost]
    [ValidateAntiForgeryToken]
    public async Task<IActionResult> Create([Bind("ProductId,Name,Category,Color,UnitPrice,AvailableQuantity")] Products products)
    {
        if (ModelState.IsValid)
        {
            _context.Add(products);
            await _context.SaveChangesAsync();

            return RedirectToAction(nameof(Index));
        }

        return View(products);
    }


问:
How to enable/disable different types of notifications from iPhone settings for an iOS application?
I've an iOS application with push notifications enabled. There are 3 different scenarios in which we will be presenting 3 different push notifications to the user. Out of 3, 1 is minor and can be ignored if the user is not interested to receive it. Is it possible to list down these 3 types of notification in device settings and allow the user to enable/disable the types of notifications based on his/her interest?</p>


问:
loss.back() error on MPS mac for LSTM (works on CPU)
Python version: 3.10.6
pytorch version: 1.12.1 (nightly build)

I'm trying to run a LSTM network on a macbook pro M1. The code runs perfectly on CPU but when I change my device to GPU (mps), loss.backward() throws the following error:

RuntimeError: Expected a proper Tensor but got None (or an undefined Tensor in C++) for argument #0 'grad_y'

Tbh I don't know how to debug this and what the problem might be. Probably a grad issue since error is for argument grad_y. But why does it work on the CPU?

My code:

```<code>class ShallowRegressionLSTM(nn.Module):
    def __init__(self, num_sensors, hidden_units, num_layers=1, out_features=1):
        super(ShallowRegressionLSTM, self).__init__()
        self.num_sensors = num_sensors  # this is the number of features
        self.hidden_units = hidden_units
        self.num_layers = num_layers
        self.out_features = out_features

        self.lstm = nn.LSTM(
            input_size=num_sensors,
            hidden_size=hidden_units,
            batch_first=True,
            num_layers=self.num_layers
        )

        self.linear = nn.Linear(in_features=self.hidden_units, out_features=self.out_features)

    def forward(self, x):
        batch_size = x.shape[0]
        h0 = torch.zeros(self.num_layers, batch_size, self.hidden_units, requires_grad=True, device=device)
        c0 = torch.zeros(self.num_layers, batch_size, self.hidden_units, requires_grad=True, device=device)

        _, (hn, _) = self.lstm(x, (h0, c0)) #Outputs: output, (h_n, c_n)
        out = self.linear(hn[-1]).flatten()  # First dim of Hn is number layers
        return out
</code>```
```<code>def train_model(data_loader, model, loss_function, optimizer):
    num_batches = len(data_loader)
    total_loss = 0
    model.train()

    for X, y in data_loader:
        X = X.to(device)
        y = y.to(device)
        output = model(X)

        loss = loss_function(output, y)
        optimizer.zero_grad()
        loss.backward()
        optimizer.step()

        total_loss += loss.item()

    avg_loss = total_loss / num_batches
    print(f"Train loss: {avg_loss}")
    train_loss.append(avg_loss)
</code>```

tried loss on gpu too.

```<code>model = ShallowRegressionLSTM(num_sensors=len(features), hidden_units=num_hidden_units, num_layers=num_layers).to(device)
#loss_function = nn.MSELoss().to(device)
loss_function = nn.MSELoss()
optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate)
</code>```
```<code>for epoch in range(epochs):
    train_model(train_loader, model, loss_function, optimizer=optimizer)
</code>```

Only post around this issue i've found:
https://discuss.pytorch.org/t/loss-backward-error-when-using-m1-gpu-mps-device/152306

I've tried the following:

loss on gpu and cpu

retain_grad

tried to push output and label to cpu before loss

to fix: #0 'grad_y'.

Body:
Python version: 3.10.6
pytorch version: 1.12.1 (nightly build)

I'm trying to run a LSTM network on a macbook pro M1. The code runs perfectly on CPU but when I change my device to GPU (mps), loss.backward() throws the following error:

RuntimeError: Expected a proper Tensor but got None (or an undefined Tensor in C++) for argument #0 'grad_y'

Tbh I don't know how to debug this and what the problem might be. Probably a grad issue since error is for argument grad_y. But why does it work on the CPU?

My code:

class ShallowRegressionLSTM(nn.Module):
    def __init__(self, num_sensors, hidden_units, num_layers=1, out_features=1):
        super(ShallowRegressionLSTM, self).__init__()
        self.num_sensors = num_sensors  # this is the number of features
        self.hidden_units = hidden_units
        self.num_layers = num_layers
        self.out_features = out_features

        self.lstm = nn.LSTM(
            input_size=num_sensors,
            hidden_size=hidden_units,
            batch_first=True,
            num_layers=self.num_layers
        )

        self.linear = nn.Linear(in_features=self.hidden_units, out_features=self.out_features)

    def forward(self, x):
        batch_size = x.shape[0]
        h0 = torch.zeros(self.num_layers, batch_size, self.hidden_units, requires_grad=True, device=device)
        c0 = torch.zeros(self.num_layers, batch_size, self.hidden_units, requires_grad=True, device=device)

        _, (hn, _) = self.lstm(x, (h0, c0)) #Outputs: output, (h_n, c_n)
        out = self.linear(hn[-1]).flatten()  # First dim of Hn is number layers
        return out

def train_model(data_loader, model, loss_function, optimizer):
    num_batches = len(data_loader)
    total_loss = 0
    model.train()

    for X, y in data_loader:
        X = X.to(device)
        y = y.to(device)
        output = model(X)

        loss = loss_function(output, y)
        optimizer.zero_grad()
        loss.backward()
        optimizer.step()

        total_loss += loss.item()

    avg_loss = total_loss / num_batches
    print(f"Train loss: {avg_loss}")
    train_loss.append(avg_loss)

tried loss on gpu too.

model = ShallowRegressionLSTM(num_sensors=len(features), hidden_units=num_hidden_units, num_layers=num_layers).to(device)
#loss_function = nn.MSELoss().to(device)
loss_function = nn.MSELoss()
optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate)

for epoch in range(epochs):
    train_model(train_loader, model, loss_function, optimizer=optimizer)

Only post around this issue i've found:
https://discuss.pytorch.org/t/loss-backward-error-when-using-m1-gpu-mps-device/152306

I've tried the following:

loss on gpu and cpu

retain_grad

tried to push output and label to cpu before loss

to fix: #0 'grad_y'.


问:
Gradient slider not working in react-native
I am trying to make a gradient slider for my app in react-native, but I keep getting the message' requireNativeComponent : "BVLinearGradient" was not found in the UIManager' when I run my code.

I tried adding different libraries and other methos that poeple used to fix the same problem. But nothing works.

```<code>import React, { useState, useEffect} from "react";
import {AppRegistry, StyleSheet, Text, View, TouchableOpacity,
SafeAreaView, Image, useWindowDimensions, onPress, TextInput,
Animated} from 'react-native';
import { useNavigation, getStateFromPath } from '@react-
navigation/native';
import Slider from '@react-native-community/slider'
import { firebase } from '../config'
import Logo from '../assets/temporaryLogoApp.png'
import MultiSlider from '@ptomasroos/react-native-multi-slider'
import LinearGradient from 'react-native-linear-gradient';

const SliderScreen = () => {
const [value, setValue] = useState(0);

return(
    <View>

    <Text style={styles.hoi}>
        hoi
    </Text>

    <View
      style={{
        width: 100,
        height: 100,
        backgroundColor: value === 2 ? 'green' : 'grey',
      }}
    />
  </View> */}
  <View style={styles.container}>
  <LinearGradient
    colors={['#ff0000', '#00ff00', '#0000ff']}
    start={{ x: 0, y: 0 }}
    end={{ x: 1, y: 0 }}
    style={styles.gradient}
  >
    <Slider
      minimumValue={0}
      maximumValue={1}
      value={value}
      onValueChange={setValue}
      style={styles.slider}
      thumbTintColor="#fff"
      minimumTrackTintColor="#transparent"
      maximumTrackTintColor="#transparent"
    />
  </LinearGradient>
  <Text>Value: {value}</Text>
</View>
</View>
)
}

export default SliderScreen

const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
gradient: {
height: 40,
width: '100%',
borderRadius: 20,
overflow: 'hidden',
},
slider: {
transform: [
  {
    translateX: -20,
  },
],
},
});
</code>```

Body:
I am trying to make a gradient slider for my app in react-native, but I keep getting the message' requireNativeComponent : "BVLinearGradient" was not found in the UIManager' when I run my code.

I tried adding different libraries and other methos that poeple used to fix the same problem. But nothing works.

import React, { useState, useEffect} from "react";
import {AppRegistry, StyleSheet, Text, View, TouchableOpacity,
SafeAreaView, Image, useWindowDimensions, onPress, TextInput,
Animated} from 'react-native';
import { useNavigation, getStateFromPath } from '@react-
navigation/native';
import Slider from '@react-native-community/slider'
import { firebase } from '../config'
import Logo from '../assets/temporaryLogoApp.png'
import MultiSlider from '@ptomasroos/react-native-multi-slider'
import LinearGradient from 'react-native-linear-gradient';

const SliderScreen = () => {
const [value, setValue] = useState(0);

return(
    <View>

    <Text style={styles.hoi}>
        hoi
    </Text>

    <View
      style={{
        width: 100,
        height: 100,
        backgroundColor: value === 2 ? 'green' : 'grey',
      }}
    />
  </View> */}
  <View style={styles.container}>
  <LinearGradient
    colors={['#ff0000', '#00ff00', '#0000ff']}
    start={{ x: 0, y: 0 }}
    end={{ x: 1, y: 0 }}
    style={styles.gradient}
  >
    <Slider
      minimumValue={0}
      maximumValue={1}
      value={value}
      onValueChange={setValue}
      style={styles.slider}
      thumbTintColor="#fff"
      minimumTrackTintColor="#transparent"
      maximumTrackTintColor="#transparent"
    />
  </LinearGradient>
  <Text>Value: {value}</Text>
</View>
</View>
)
}

export default SliderScreen

const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
gradient: {
height: 40,
width: '100%',
borderRadius: 20,
overflow: 'hidden',
},
slider: {
transform: [
  {
    translateX: -20,
  },
],
},
});


问:
Standard way of computing a single ECDSA signature hex string from its tuple form
I implemented ECDSA manually in rust, where the output is signature in the form of a tuple (r,s). I wanted to test my implementation, and therefore I was looking for functions in python or rust for verifying the signature (r,s) given the public key, message and the curve details. The Wiki article also shows the output signature in tuple form.

But, everywhere I looked, the signature is inputted as a single hex string or a byte array. Can someone please share any way of converting (r,s) pair to the hex string. I tried concatenation but got wrong result in my algo.

If it is helpful, I tried using the crate secp256k1 in rust for verification.


问:
How to list all the targets in CMake's default (`all`) targets?
Is there a way to display all the targets that are included in CMake's default target?

I tried browsing all the CMakeLists.txt of my project by hand, but it is very tedious as there are many of them.


问:
Multi target framework issue -> Found conflicts between different versions of "System.Runtime" that could not be resolved
I have a Visual Studio 2022 solution that is based on netcore 3.1 (some dll, some WPF apps) that is working properly . I decided to try to make it target also net48 to be able in some particular cases to use some third party API currently not compatible with netcore.

I changed my projects to files with the following line

 <TargetFrameworks>netcoreapp3.1;net48</TargetFrameworks>
```
<p>I changed all the c#8 code parts.</p>
<p>And I put one application for test in net48 to see if everything goes ok.</p>
<p>When I launch my application, it crashes instantly complaining about System.Runtime version 4.2.2.0 not being found.</p>
```FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified
```
<p>If I look in the output log of the build I have some warning about conflicts in resolution of System.Runtime (4.1.2.0 vs 4.2.2.0)</p>
<p>For exemple :</p>
```Severity    Code    Description Project File    Line    Suppression State
Warning MSB3277 Found conflicts between different versions of "System.Runtime" that could not be resolved.
There was a conflict between "System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
    "System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not.
    References which depend on "System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\Facades\System.Runtime.dll].
        C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\Facades\System.Runtime.dll
          Project file item includes which caused reference "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\Facades\System.Runtime.dll".
            System.Runtime
    References which depend on "System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [].
        C:\Users\alex\.nuget\packages\system.io.pipelines\4.5.1\ref\netstandard1.3\System.IO.Pipelines.dll
          Project file item includes which caused reference "C:\Users\alex\.nuget\packages\system.io.pipelines\4.5.1\ref\netstandard1.3\System.IO.Pipelines.dll".
            C:\Users\alex\.nuget\packages\system.io.pipelines\4.5.1\ref\netstandard1.3\System.IO.Pipelines.dll
            C:\Users\alex\.nuget\packages\fubardev.ftpserver\3.1.2\lib\net47\FubarDev.FtpServer.dll
            C:\Dev\csharp\Demo1\InfrastructureCore\bin\Debug\net48\InfrastructureCore.dll
            C:\Dev\csharp\Demo1\InfrastructureAutomation\bin\Debug\net48\InfrastructureAutomation.dll
            C:\Dev\csharp\Demo1\InfrastructureVision\bin\Debug\net48\InfrastructureVision.dll
            C:\Dev\csharp\Demo1\ModuleBase\bin\Debug\net48\ModuleBase.dll
            C:\Dev\csharp\Demo1\ModuleDefinitionsManagement\bin\Debug\net48\ModuleDefinitionsManagement.dll
            C:\Dev\csharp\Demo1\ModuleLogger\bin\Debug\net48\ModuleLogger.dll
            C:\Dev\csharp\Demo1\ModuleLogin\bin\Debug\net48\ModuleLogin.dll
            C:\Dev\csharp\Demo1\ModuleNavigation\bin\Debug\net48\ModuleNavigation.dll
            C:\Dev\csharp\Demo1\BaseClassesFw\bin\Debug\net48\BaseClassesFw.dll
        C:\Dev\csharp\Demo1\InfrastructureCore\bin\Debug\net48\Syncfusion.Themes.MaterialDarkFW.WPF.dll
          Project file item includes which caused reference "C:\Dev\csharp\Demo1\InfrastructureCore\bin\Debug\net48\Syncfusion.Themes.MaterialDarkFW.WPF.dll".
            C:\Dev\csharp\Demo1\InfrastructureCore\bin\Debug\net48\InfrastructureCore.dll
            C:\Dev\csharp\Demo1\InfrastructureAutomation\bin\Debug\net48\InfrastructureAutomation.dll
            C:\Dev\csharp\Demo1\InfrastructureVision\bin\Debug\net48\InfrastructureVision.dll
            C:\Dev\csharp\Demo1\ModuleBase\bin\Debug\net48\ModuleBase.dll
            C:\Dev\csharp\Demo1\ModuleDefinitionsManagement\bin\Debug\net48\ModuleDefinitionsManagement.dll
            C:\Dev\csharp\Demo1\ModuleLogger\bin\Debug\net48\ModuleLogger.dll
            C:\Dev\csharp\Demo1\ModuleLogin\bin\Debug\net48\ModuleLogin.dll
            C:\Dev\csharp\Demo1\ModuleNavigation\bin\Debug\net48\ModuleNavigation.dll
            C:\Dev\csharp\Demo1\BaseClassesFw\bin\Debug\net48\BaseClassesFw.dll
        C:\Dev\csharp\Demo1\InfrastructureCore\bin\Debug\net48\Syncfusion.Themes.MaterialLightFW.WPF.dll
          Project file item includes which caused reference "C:\Dev\csharp\Demo1\InfrastructureCore\bin\Debug\net48\Syncfusion.Themes.MaterialLightFW.WPF.dll".
            C:\Dev\csharp\Demo1\InfrastructureCore\bin\Debug\net48\InfrastructureCore.dll
            C:\Dev\csharp\Demo1\InfrastructureAutomation\bin\Debug\net48\InfrastructureAutomation.dll
            C:\Dev\csharp\Demo1\InfrastructureVision\bin\Debug\net48\InfrastructureVision.dll
            C:\Dev\csharp\Demo1\ModuleBase\bin\Debug\net48\ModuleBase.dll
            C:\Dev\csharp\Demo1\ModuleDefinitionsManagement\bin\Debug\net48\ModuleDefinitionsManagement.dll
            C:\Dev\csharp\Demo1\ModuleLogger\bin\Debug\net48\ModuleLogger.dll
            C:\Dev\csharp\Demo1\ModuleLogin\bin\Debug\net48\ModuleLogin.dll
            C:\Dev\csharp\Demo1\ModuleNavigation\bin\Debug\net48\ModuleNavigation.dll
            C:\Dev\csharp\Demo1\BaseClassesFw\bin\Debug\net48\BaseClassesFw.dll BaseClasses C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets   2302

```
<p>After doing some research I have tried :</p>
<ul>
<li>To install a more recent version of System.Runtime nuget package in all my projects ( I cannot found System.Runtime 4.2.2.0 by the way)</li>
<li>To modify the app.config of my test app with some binding redirection</li>
</ul>
```<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
              <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
              <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="4.1.2.0"/>
        </dependentAssembly>
</assemblyBinding>
```

To play with the AutoGenerateBindingRedirects option

But the error is still the same. Note that if I roll back the test app to netcore everything is working fine.

Do I need to try to find another version of the packages that gives the warning (and hope that I can find one that fits) or is there another way to "force" my app to use a given version ?

Body:
I have a Visual Studio 2022 solution that is based on netcore 3.1 (some dll, some WPF apps) that is working properly . I decided to try to make it target also net48 to be able in some particular cases to use some third party API currently not compatible with netcore.

I changed my projects to files with the following line

 <TargetFrameworks>netcoreapp3.1;net48</TargetFrameworks>

I changed all the c#8 code parts.

And I put one application for test in net48 to see if everything goes ok.

When I launch my application, it crashes instantly complaining about System.Runtime version 4.2.2.0 not being found.

FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified

If I look in the output log of the build I have some warning about conflicts in resolution of System.Runtime (4.1.2.0 vs 4.2.2.0)

For exemple :

Severity    Code    Description Project File    Line    Suppression State
Warning MSB3277 Found conflicts between different versions of "System.Runtime" that could not be resolved.
There was a conflict between "System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
    "System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not.
    References which depend on "System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\Facades\System.Runtime.dll].
        C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\Facades\System.Runtime.dll
          Project file item includes which caused reference "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\Facades\System.Runtime.dll".
            System.Runtime
    References which depend on "System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [].
        C:\Users\alex\.nuget\packages\system.io.pipelines\4.5.1\ref\netstandard1.3\System.IO.Pipelines.dll
          Project file item includes which caused reference "C:\Users\alex\.nuget\packages\system.io.pipelines\4.5.1\ref\netstandard1.3\System.IO.Pipelines.dll".
            C:\Users\alex\.nuget\packages\system.io.pipelines\4.5.1\ref\netstandard1.3\System.IO.Pipelines.dll
            C:\Users\alex\.nuget\packages\fubardev.ftpserver\3.1.2\lib\net47\FubarDev.FtpServer.dll
            C:\Dev\csharp\Demo1\InfrastructureCore\bin\Debug\net48\InfrastructureCore.dll
            C:\Dev\csharp\Demo1\InfrastructureAutomation\bin\Debug\net48\InfrastructureAutomation.dll
            C:\Dev\csharp\Demo1\InfrastructureVision\bin\Debug\net48\InfrastructureVision.dll
            C:\Dev\csharp\Demo1\ModuleBase\bin\Debug\net48\ModuleBase.dll
            C:\Dev\csharp\Demo1\ModuleDefinitionsManagement\bin\Debug\net48\ModuleDefinitionsManagement.dll
            C:\Dev\csharp\Demo1\ModuleLogger\bin\Debug\net48\ModuleLogger.dll
            C:\Dev\csharp\Demo1\ModuleLogin\bin\Debug\net48\ModuleLogin.dll
            C:\Dev\csharp\Demo1\ModuleNavigation\bin\Debug\net48\ModuleNavigation.dll
            C:\Dev\csharp\Demo1\BaseClassesFw\bin\Debug\net48\BaseClassesFw.dll
        C:\Dev\csharp\Demo1\InfrastructureCore\bin\Debug\net48\Syncfusion.Themes.MaterialDarkFW.WPF.dll
          Project file item includes which caused reference "C:\Dev\csharp\Demo1\InfrastructureCore\bin\Debug\net48\Syncfusion.Themes.MaterialDarkFW.WPF.dll".
            C:\Dev\csharp\Demo1\InfrastructureCore\bin\Debug\net48\InfrastructureCore.dll
            C:\Dev\csharp\Demo1\InfrastructureAutomation\bin\Debug\net48\InfrastructureAutomation.dll
            C:\Dev\csharp\Demo1\InfrastructureVision\bin\Debug\net48\InfrastructureVision.dll
            C:\Dev\csharp\Demo1\ModuleBase\bin\Debug\net48\ModuleBase.dll
            C:\Dev\csharp\Demo1\ModuleDefinitionsManagement\bin\Debug\net48\ModuleDefinitionsManagement.dll
            C:\Dev\csharp\Demo1\ModuleLogger\bin\Debug\net48\ModuleLogger.dll
            C:\Dev\csharp\Demo1\ModuleLogin\bin\Debug\net48\ModuleLogin.dll
            C:\Dev\csharp\Demo1\ModuleNavigation\bin\Debug\net48\ModuleNavigation.dll
            C:\Dev\csharp\Demo1\BaseClassesFw\bin\Debug\net48\BaseClassesFw.dll
        C:\Dev\csharp\Demo1\InfrastructureCore\bin\Debug\net48\Syncfusion.Themes.MaterialLightFW.WPF.dll
          Project file item includes which caused reference "C:\Dev\csharp\Demo1\InfrastructureCore\bin\Debug\net48\Syncfusion.Themes.MaterialLightFW.WPF.dll".
            C:\Dev\csharp\Demo1\InfrastructureCore\bin\Debug\net48\InfrastructureCore.dll
            C:\Dev\csharp\Demo1\InfrastructureAutomation\bin\Debug\net48\InfrastructureAutomation.dll
            C:\Dev\csharp\Demo1\InfrastructureVision\bin\Debug\net48\InfrastructureVision.dll
            C:\Dev\csharp\Demo1\ModuleBase\bin\Debug\net48\ModuleBase.dll
            C:\Dev\csharp\Demo1\ModuleDefinitionsManagement\bin\Debug\net48\ModuleDefinitionsManagement.dll
            C:\Dev\csharp\Demo1\ModuleLogger\bin\Debug\net48\ModuleLogger.dll
            C:\Dev\csharp\Demo1\ModuleLogin\bin\Debug\net48\ModuleLogin.dll
            C:\Dev\csharp\Demo1\ModuleNavigation\bin\Debug\net48\ModuleNavigation.dll
            C:\Dev\csharp\Demo1\BaseClassesFw\bin\Debug\net48\BaseClassesFw.dll BaseClasses C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets   2302

After doing some research I have tried :

To install a more recent version of System.Runtime nuget package in all my projects ( I cannot found System.Runtime 4.2.2.0 by the way)

To modify the app.config of my test app with some binding redirection

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
              <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
              <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="4.1.2.0"/>
        </dependentAssembly>
</assemblyBinding>

To play with the AutoGenerateBindingRedirects option

But the error is still the same. Note that if I roll back the test app to netcore everything is working fine.

Do I need to try to find another version of the packages that gives the warning (and hope that I can find one that fits) or is there another way to "force" my app to use a given version ?


问:
how to store detected emotion value of the faceapi into a variable
I am currently writing a prototype where If video plays then I would like to store user's emotion while watching the video. I am using the faceapi.js with the predefined models.
below is my code

index.html

        <title>Video detecting and emotion storing in database</title>

            <video
                id="myvideo"
                src="laravel.mp4"
                controls
                height="400"
                width="600"
            ></video>

            <video id="livecam" autoplay muted height="240" width="320"></video>

```
<p>Script.js</p>
<pre class="lang-js prettyprint-override"><code>var video = document.getElementById("myvideo");
const liveview = document.getElementById("livecam");
var modeloadedstatus = null;
let canvas;

//loading the all models
Promise.all([
    faceapi.nets.tinyFaceDetector.loadFromUri("/models"),
    faceapi.nets.faceLandmark68Net.loadFromUri("/models"),
    faceapi.nets.faceRecognitionNet.loadFromUri("/models"),
    faceapi.nets.faceExpressionNet.loadFromUri("/models"),
]).then(function () {
    modeloadedstatus = true;
});

//enable the camera and check also all models are loaded or not
video.onplaying = function () {
    if (modeloadedstatus) {
        enablewebcam();
    } else {
        alert("Error in model loading");
    }
};

//video pause and disbale the camera
video.onpause = function () {
    disablecam();
};

//enable the camera
function enablewebcam() {
    navigator.mediaDevices
        .getUserMedia({ video: { width: 600, height: 400 }, audio: false })
        .then((stream) => {
            liveview.srcObject = stream;
        });
}

//disbale camera function
function disablecam() {
    liveview.srcObject = null;
}

liveview.addEventListener("play", () => {
    const canvas = faceapi.createCanvasFromMedia(liveview);
    document.body.append(canvas);
    const displaySize = { width: liveview.width, height: liveview.height };
    faceapi.matchDimensions(canvas, displaySize);
    setInterval(async () => {
        const detections = await faceapi
            .detectAllFaces(liveview, new faceapi.TinyFaceDetectorOptions())
            .withFaceExpressions();
        if (detections.length == 1) {
            console.log(detections[0].expressions);
        } else {
            console.log("No face found");
        }
        const resizeddetections = faceapi.resizeResults(
            detections,
            displaySize
        );
        canvas.getContext("2d").clearRect(0, 0, canvas.width, canvas.height);
        faceapi.draw.drawDetections(canvas, resizeddetections);
        faceapi.draw.drawFaceExpressions(canvas, resizeddetections);
    }, 100);
});
</code>```

In my detections I am getting the object values

[
    {
        "detection": {
            "_imageDims": {
                "_width": 600,
                "_height": 400
            },
            "_score": 0.9888063469609896,
            "_classScore": 0.9888063469609896,
            "_className": "",
            "_box": {
                "_x": 151.11491276957094,
                "_y": 82.07477362841183,
                "_width": 211.3173156083444,
                "_height": 190.0989689704312
            }
        },
        "expressions": {
            "neutral": 0.998404860496521,
            "happy": 0.0006479635485447943,
            "sad": 6.173863198455365e-7,
            "angry": 0.0009338973904959857,
            "fearful": 5.859014162723497e-9,
            "disgusted": 7.676168252146454e-7,
            "surprised": 0.000011679761882987805
        }
    }
]
```

now all though The value of my expression is Neutral
how can i get the value of neutral because it will show the expression which is close to 1
So my problem is I want to store the emotion in a variable

All though if I WILL TRY THIS
detections[0].expression

I am getting all values of expression. but I want only that value which is predicted by model.

Body:
I am currently writing a prototype where If video plays then I would like to store user's emotion while watching the video. I am using the faceapi.js with the predefined models.
below is my code

index.html

        <title>Video detecting and emotion storing in database</title>

            <video
                id="myvideo"
                src="laravel.mp4"
                controls
                height="400"
                width="600"
            ></video>

            <video id="livecam" autoplay muted height="240" width="320"></video>

Script.js

var video = document.getElementById("myvideo");
const liveview = document.getElementById("livecam");
var modeloadedstatus = null;
let canvas;

//loading the all models
Promise.all([
    faceapi.nets.tinyFaceDetector.loadFromUri("/models"),
    faceapi.nets.faceLandmark68Net.loadFromUri("/models"),
    faceapi.nets.faceRecognitionNet.loadFromUri("/models"),
    faceapi.nets.faceExpressionNet.loadFromUri("/models"),
]).then(function () {
    modeloadedstatus = true;
});

//enable the camera and check also all models are loaded or not
video.onplaying = function () {
    if (modeloadedstatus) {
        enablewebcam();
    } else {
        alert("Error in model loading");
    }
};

//video pause and disbale the camera
video.onpause = function () {
    disablecam();
};

//enable the camera
function enablewebcam() {
    navigator.mediaDevices
        .getUserMedia({ video: { width: 600, height: 400 }, audio: false })
        .then((stream) => {
            liveview.srcObject = stream;
        });
}

//disbale camera function
function disablecam() {
    liveview.srcObject = null;
}

liveview.addEventListener("play", () => {
    const canvas = faceapi.createCanvasFromMedia(liveview);
    document.body.append(canvas);
    const displaySize = { width: liveview.width, height: liveview.height };
    faceapi.matchDimensions(canvas, displaySize);
    setInterval(async () => {
        const detections = await faceapi
            .detectAllFaces(liveview, new faceapi.TinyFaceDetectorOptions())
            .withFaceExpressions();
        if (detections.length == 1) {
            console.log(detections[0].expressions);
        } else {
            console.log("No face found");
        }
        const resizeddetections = faceapi.resizeResults(
            detections,
            displaySize
        );
        canvas.getContext("2d").clearRect(0, 0, canvas.width, canvas.height);
        faceapi.draw.drawDetections(canvas, resizeddetections);
        faceapi.draw.drawFaceExpressions(canvas, resizeddetections);
    }, 100);
});

In my detections I am getting the object values

[
    {
        "detection": {
            "_imageDims": {
                "_width": 600,
                "_height": 400
            },
            "_score": 0.9888063469609896,
            "_classScore": 0.9888063469609896,
            "_className": "",
            "_box": {
                "_x": 151.11491276957094,
                "_y": 82.07477362841183,
                "_width": 211.3173156083444,
                "_height": 190.0989689704312
            }
        },
        "expressions": {
            "neutral": 0.998404860496521,
            "happy": 0.0006479635485447943,
            "sad": 6.173863198455365e-7,
            "angry": 0.0009338973904959857,
            "fearful": 5.859014162723497e-9,
            "disgusted": 7.676168252146454e-7,
            "surprised": 0.000011679761882987805
        }
    }
]

now all though The value of my expression is Neutral
how can i get the value of neutral because it will show the expression which is close to 1
So my problem is I want to store the emotion in a variable

All though if I WILL TRY THIS
detections[0].expression

I am getting all values of expression. but I want only that value which is predicted by model.