问:
DataProc - SparkException: Failed to register classes with Kryo - java.lang.ClassNotFoundException
I am receiving ClassNotFoundExceptions when trying to use KryoSerializer for a dataframe on DataProc for a class that is part of the main JAR of sent to spark-submit. This only happens when using spark:spark.submit.deployMode "cluster" and a master setting of "yarn". It does not happen if I just a master setting like "local[*]" which lends me to believe that the JAR class path of the executors is missing or something.

I've tried experimenting with the following by adding the MAIN_JAR to classpath, but keep coming up short to the same ClassNotFoundException conclusion. Everything I read suggests this shouldn't be necessary however.

```<code>"spark:spark.executor.extraClassPath"
"spark:spark.driver.extraClassPath"
"spark:spark.driver.userClassPathFirst"
"spark:spark.executor.userClassPathFirst"
"spark:spark.yarn.dist.jars"
"spark:spark.yarn.jars"
"spark:spark.jars"
</code>```

I'm using the latest 2.1 DataProc image. I'm getting this very frustrating "ClassNotFoundException" for trying to Kyro serialize my dataframe. The thing is the class exists in the main jar submitted on submit-spark.

Here is the Java code for the main jar that sends spark-submit, the JAR is on GCS and using the GCS Cloud Storage Connector, but I know this works since this is only happening in cluster mode:

```<code>SparkJob sparkJob = SparkJob.newBuilder().setMainJarFileUri(MAIN_JAR)
</code>```

The specific image URI of the DataProc image i'm using. This is the explicit image URI, but i've also tried some of the other existing 2.1 images as well like debian.

```<code>https://www.googleapis.com/compute/v1/projects/cloud-dataproc/global/images/dataproc-2-1-ubu20-20221201-035100-rc01
</code>```

Here's the gcloud image list command for 2.1 I'm using to get the image URI of the stable 2.1 images available for reference:

```<code>gcloud compute images list --uri --project cloud-dataproc --filter "labels.goog-dataproc-version ~ ^2.1.0" --sort-by=~creationTimestamp
</code>```

Here's some of the stacktrace:

```<code>22/12/21 03:57:18 WARN TaskSetManager: Lost task 0.0 in stage 0.0 (TID 0) (<GCP project resource details redacted> executor 1): java.io.IOException: org.apache.spark.SparkException: Failed to register classes with Kryo
    at org.apache.spark.util.Utils$.tryOrIOException(Utils.scala:1477)
    at org.apache.spark.broadcast.TorrentBroadcast.readBroadcastBlock(TorrentBroadcast.scala:228)
    at org.apache.spark.broadcast.TorrentBroadcast.getValue(TorrentBroadcast.scala:105)
    at org.apache.spark.broadcast.Broadcast.value(Broadcast.scala:70)
    at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:84)
    at org.apache.spark.scheduler.Task.run(Task.scala:136)
    at org.apache.spark.executor.Executor$TaskRunner.$anonfun$run$3(Executor.scala:548)
    at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1504)
    at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:551)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.apache.spark.SparkException: Failed to register classes with Kryo
    at org.apache.spark.serializer.KryoSerializer.$anonfun$newKryo$5(KryoSerializer.scala:183)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at org.apache.spark.util.Utils$.withContextClassLoader(Utils.scala:233)
    at org.apache.spark.serializer.KryoSerializer.newKryo(KryoSerializer.scala:171)
    at org.apache.spark.serializer.KryoSerializer$$anon$1.create(KryoSerializer.scala:102)
    at com.esotericsoftware.kryo.pool.KryoPoolQueueImpl.borrow(KryoPoolQueueImpl.java:48)
    at org.apache.spark.serializer.KryoSerializer$PoolWrapper.borrow(KryoSerializer.scala:109)
    at org.apache.spark.serializer.KryoSerializerInstance.borrowKryo(KryoSerializer.scala:346)
    at org.apache.spark.serializer.KryoDeserializationStream.<init>(KryoSerializer.scala:302)
    at org.apache.spark.serializer.KryoSerializerInstance.deserializeStream(KryoSerializer.scala:436)
    at org.apache.spark.broadcast.TorrentBroadcast$.unBlockifyObject(TorrentBroadcast.scala:336)
    at org.apache.spark.broadcast.TorrentBroadcast.$anonfun$readBroadcastBlock$4(TorrentBroadcast.scala:259)
    at scala.Option.getOrElse(Option.scala:189)
    at org.apache.spark.broadcast.TorrentBroadcast.$anonfun$readBroadcastBlock$2(TorrentBroadcast.scala:233)
    at org.apache.spark.util.KeyLock.withLock(KeyLock.scala:64)
    at org.apache.spark.broadcast.TorrentBroadcast.$anonfun$readBroadcastBlock$1(TorrentBroadcast.scala:228)
    at org.apache.spark.util.Utils$.tryOrIOException(Utils.scala:1470)
    ... 11 more
Caused by: java.lang.ClassNotFoundException: <<redacted>.MyClass In the Main JAR sent to spark-submit>
    at java.base/java.lang.ClassLoader.findClass(ClassLoader.java:719)
    at org.apache.spark.util.ParentClassLoader.findClass(ParentClassLoader.java:35)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
    at org.apache.spark.util.ParentClassLoader.loadClass(ParentClassLoader.java:40)
    at org.apache.spark.util.ChildFirstURLClassLoader.loadClass(ChildFirstURLClassLoader.java:48)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:398)
    at org.apache.spark.util.Utils$.classForName(Utils.scala:220)
    at org.apache.spark.serializer.KryoSerializer.$anonfun$newKryo$6(KryoSerializer.scala:174)
    at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62)
    at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49)
    at org.apache.spark.serializer.KryoSerializer.$anonfun$newKryo$5(KryoSerializer.scala:173)
    ... 27 more
</code>```

Also to make note, this is my pom.xml. I use provided for all the libraries already installed on the cluster:

```<code>        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-core_2.12</artifactId>
            <version>3.3.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-sql_2.12</artifactId>
            <version>3.3.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.cloud.spark</groupId>
            <artifactId>spark-bigquery-with-dependencies_2.12</artifactId>
            <version>0.27.1</version>
            <scope>provided</scope>
        </dependency>
</code>```

I also tried experimenting with initialization actions to copy the JAR with gsutil to the class path of executors manually, but that seems unnecessary and yields the same result anyway.

Body:
I am receiving ClassNotFoundExceptions when trying to use KryoSerializer for a dataframe on DataProc for a class that is part of the main JAR of sent to spark-submit. This only happens when using spark:spark.submit.deployMode "cluster" and a master setting of "yarn". It does not happen if I just a master setting like "local[*]" which lends me to believe that the JAR class path of the executors is missing or something.

I've tried experimenting with the following by adding the MAIN_JAR to classpath, but keep coming up short to the same ClassNotFoundException conclusion. Everything I read suggests this shouldn't be necessary however.

"spark:spark.executor.extraClassPath"
"spark:spark.driver.extraClassPath"
"spark:spark.driver.userClassPathFirst"
"spark:spark.executor.userClassPathFirst"
"spark:spark.yarn.dist.jars"
"spark:spark.yarn.jars"
"spark:spark.jars"

I'm using the latest 2.1 DataProc image. I'm getting this very frustrating "ClassNotFoundException" for trying to Kyro serialize my dataframe. The thing is the class exists in the main jar submitted on submit-spark.

Here is the Java code for the main jar that sends spark-submit, the JAR is on GCS and using the GCS Cloud Storage Connector, but I know this works since this is only happening in cluster mode:

SparkJob sparkJob = SparkJob.newBuilder().setMainJarFileUri(MAIN_JAR)

The specific image URI of the DataProc image i'm using. This is the explicit image URI, but i've also tried some of the other existing 2.1 images as well like debian.

https://www.googleapis.com/compute/v1/projects/cloud-dataproc/global/images/dataproc-2-1-ubu20-20221201-035100-rc01

Here's the gcloud image list command for 2.1 I'm using to get the image URI of the stable 2.1 images available for reference:

gcloud compute images list --uri --project cloud-dataproc --filter "labels.goog-dataproc-version ~ ^2.1.0" --sort-by=~creationTimestamp

Here's some of the stacktrace:

22/12/21 03:57:18 WARN TaskSetManager: Lost task 0.0 in stage 0.0 (TID 0) (<GCP project resource details redacted> executor 1): java.io.IOException: org.apache.spark.SparkException: Failed to register classes with Kryo
    at org.apache.spark.util.Utils$.tryOrIOException(Utils.scala:1477)
    at org.apache.spark.broadcast.TorrentBroadcast.readBroadcastBlock(TorrentBroadcast.scala:228)
    at org.apache.spark.broadcast.TorrentBroadcast.getValue(TorrentBroadcast.scala:105)
    at org.apache.spark.broadcast.Broadcast.value(Broadcast.scala:70)
    at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:84)
    at org.apache.spark.scheduler.Task.run(Task.scala:136)
    at org.apache.spark.executor.Executor$TaskRunner.$anonfun$run$3(Executor.scala:548)
    at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1504)
    at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:551)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.apache.spark.SparkException: Failed to register classes with Kryo
    at org.apache.spark.serializer.KryoSerializer.$anonfun$newKryo$5(KryoSerializer.scala:183)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at org.apache.spark.util.Utils$.withContextClassLoader(Utils.scala:233)
    at org.apache.spark.serializer.KryoSerializer.newKryo(KryoSerializer.scala:171)
    at org.apache.spark.serializer.KryoSerializer$$anon$1.create(KryoSerializer.scala:102)
    at com.esotericsoftware.kryo.pool.KryoPoolQueueImpl.borrow(KryoPoolQueueImpl.java:48)
    at org.apache.spark.serializer.KryoSerializer$PoolWrapper.borrow(KryoSerializer.scala:109)
    at org.apache.spark.serializer.KryoSerializerInstance.borrowKryo(KryoSerializer.scala:346)
    at org.apache.spark.serializer.KryoDeserializationStream.<init>(KryoSerializer.scala:302)
    at org.apache.spark.serializer.KryoSerializerInstance.deserializeStream(KryoSerializer.scala:436)
    at org.apache.spark.broadcast.TorrentBroadcast$.unBlockifyObject(TorrentBroadcast.scala:336)
    at org.apache.spark.broadcast.TorrentBroadcast.$anonfun$readBroadcastBlock$4(TorrentBroadcast.scala:259)
    at scala.Option.getOrElse(Option.scala:189)
    at org.apache.spark.broadcast.TorrentBroadcast.$anonfun$readBroadcastBlock$2(TorrentBroadcast.scala:233)
    at org.apache.spark.util.KeyLock.withLock(KeyLock.scala:64)
    at org.apache.spark.broadcast.TorrentBroadcast.$anonfun$readBroadcastBlock$1(TorrentBroadcast.scala:228)
    at org.apache.spark.util.Utils$.tryOrIOException(Utils.scala:1470)
    ... 11 more
Caused by: java.lang.ClassNotFoundException: <<redacted>.MyClass In the Main JAR sent to spark-submit>
    at java.base/java.lang.ClassLoader.findClass(ClassLoader.java:719)
    at org.apache.spark.util.ParentClassLoader.findClass(ParentClassLoader.java:35)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
    at org.apache.spark.util.ParentClassLoader.loadClass(ParentClassLoader.java:40)
    at org.apache.spark.util.ChildFirstURLClassLoader.loadClass(ChildFirstURLClassLoader.java:48)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:398)
    at org.apache.spark.util.Utils$.classForName(Utils.scala:220)
    at org.apache.spark.serializer.KryoSerializer.$anonfun$newKryo$6(KryoSerializer.scala:174)
    at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62)
    at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49)
    at org.apache.spark.serializer.KryoSerializer.$anonfun$newKryo$5(KryoSerializer.scala:173)
    ... 27 more

Also to make note, this is my pom.xml. I use provided for all the libraries already installed on the cluster:

        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-core_2.12</artifactId>
            <version>3.3.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-sql_2.12</artifactId>
            <version>3.3.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.cloud.spark</groupId>
            <artifactId>spark-bigquery-with-dependencies_2.12</artifactId>
            <version>0.27.1</version>
            <scope>provided</scope>
        </dependency>

I also tried experimenting with initialization actions to copy the JAR with gsutil to the class path of executors manually, but that seems unnecessary and yields the same result anyway.


来源: stackexchange

问:
Edit a QstandardItem model exposed to treeview
I want to edit the model contents when clicked.
I am able to see the contents but when clicked i want to edit it.

I also want to view the clicked index.
Is there any way ?

Is there any way ?
Or is there any other method to introduce a tree model and make it's content editable?

```<code>h file
==========
class TreeView : public QStandardItemModel
{
    Q_OBJECT

public:
    TreeView(QObject *parent = nullptr);

    Q_INVOKABLE void add_header_row();

};

cpp file
===========

QStandardItem *rootItem = new QStandardItem;
QStandardItem *group1 = new QStandardItem;
QStandardItem *group2 = new QStandardItem;
setColumnCount(1);
rootItem = invisibleRootItem();
group1->setText("Heading");
group2->setText("Sub Heading");
group1->appendRow(group2);
rootItem->appendRow(group1);

main cpp file
=========
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

    QGuiApplication app(argc, argv);

    QQmlApplicationEngine engine;

    TreeView myModel;
    engine.rootContext()->setContextProperty("myModel", &myModel);

    const QUrl url(QStringLiteral("qrc:/main.qml"));
    QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                     &app, [url](QObject *obj, const QUrl &objUrl) {
        if (!obj && url == objUrl)
            QCoreApplication::exit(-1);
    }, Qt::QueuedConnection);
    engine.load(url);

    return app.exec();

qml file
==========

TreeView{
        id: application_view
        width: mainWindow.width / 2
        height: mainWindow.height
        model: myModel
        backgroundVisible: true
        headerVisible: false
        selectionMode: SelectionMode.SingleSelection

        TableViewColumn{
            role: "display"
        }
    }
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I want to edit the model contents when clicked.
I am able to see the contents but when clicked i want to edit it.

I also want to view the clicked index.
Is there any way ?

Is there any way ?
Or is there any other method to introduce a tree model and make it's content editable?

h file
==========
class TreeView : public QStandardItemModel
{
    Q_OBJECT

public:
    TreeView(QObject *parent = nullptr);

    Q_INVOKABLE void add_header_row();

};

cpp file
===========

QStandardItem *rootItem = new QStandardItem;
QStandardItem *group1 = new QStandardItem;
QStandardItem *group2 = new QStandardItem;
setColumnCount(1);
rootItem = invisibleRootItem();
group1->setText("Heading");
group2->setText("Sub Heading");
group1->appendRow(group2);
rootItem->appendRow(group1);

main cpp file
=========
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

    QGuiApplication app(argc, argv);

    QQmlApplicationEngine engine;

    TreeView myModel;
    engine.rootContext()->setContextProperty("myModel", &myModel);

    const QUrl url(QStringLiteral("qrc:/main.qml"));
    QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                     &app, [url](QObject *obj, const QUrl &objUrl) {
        if (!obj && url == objUrl)
            QCoreApplication::exit(-1);
    }, Qt::QueuedConnection);
    engine.load(url);

    return app.exec();

qml file
==========

TreeView{
        id: application_view
        width: mainWindow.width / 2
        height: mainWindow.height
        model: myModel
        backgroundVisible: true
        headerVisible: false
        selectionMode: SelectionMode.SingleSelection

        TableViewColumn{
            role: "display"
        }
    }


问:
Dynamic conditional statement in DAX
Is there a way in which I can write a dynamic conditional statement. For example, I want to see that my data can be grouped by 50 or 100 by just tipping the value 50 or 100.

```<code>table = generate(1,9000000, 0.01)
</code>```

Here there is an example, when I want to group the data by 50

```<code>= Table.AddColumn(one_pm_test_lm_5_sek_xyl_1_Table, "XLenght bin", each if
 [XLength] >= 500 then "500 and above"
else if [XLength] >= 450 then "450 - 500"
 else if [XLength] >= 400 then "400 - 450"
 else if [XLength] >= 350 then "350 - 400"
 else if [XLength] >= 300 then "300 - 350"
 else if [XLength] >= 250 then "250 - 300"
else if [XLength] >= 200 then "200 - 250"
else if [XLength] >= 150 then "150 - 200"
else if [XLength] >= 100 then "100 - 150"
 else if [XLength] >= 50 then "50 - 100"
else "50 or below")

</code>```

I try to create a dynamic function or something like that which makes posible that I group the data for example in 50. Until now, I make it manually. I would like to know if there is another way to do it in order to enter the values manually.

```<code>XLength Group = SWITCH(TRUE(),
[XLength] < 50, "<50",
[XLength] <= 100, "50-100",
[XLength] <= 150, "100-150",
[XLength] <= 200, "150-200",
[XLength] <= 250, "200-250",
[XLength] <= 300, "250-300",
[XLength] <= 350, "300-350",
[XLength] <= 400, "350-400",
[XLength] <= 450, "400-450",
[XLength] <= 500, "450-500",
[XLength] > 500, "500+")
</code>```

Title: Dynamic conditional statement in DAX

Body:
Is there a way in which I can write a dynamic conditional statement. For example, I want to see that my data can be grouped by 50 or 100 by just tipping the value 50 or 100.

table = generate(1,9000000, 0.01)

Here there is an example, when I want to group the data by 50

= Table.AddColumn(one_pm_test_lm_5_sek_xyl_1_Table, "XLenght bin", each if
 [XLength] >= 500 then "500 and above"
else if [XLength] >= 450 then "450 - 500"
 else if [XLength] >= 400 then "400 - 450"
 else if [XLength] >= 350 then "350 - 400"
 else if [XLength] >= 300 then "300 - 350"
 else if [XLength] >= 250 then "250 - 300"
else if [XLength] >= 200 then "200 - 250"
else if [XLength] >= 150 then "150 - 200"
else if [XLength] >= 100 then "100 - 150"
 else if [XLength] >= 50 then "50 - 100"
else "50 or below")

I try to create a dynamic function or something like that which makes posible that I group the data for example in 50. Until now, I make it manually. I would like to know if there is another way to do it in order to enter the values manually.

XLength Group = SWITCH(TRUE(),
[XLength] < 50, "<50",
[XLength] <= 100, "50-100",
[XLength] <= 150, "100-150",
[XLength] <= 200, "150-200",
[XLength] <= 250, "200-250",
[XLength] <= 300, "250-300",
[XLength] <= 350, "300-350",
[XLength] <= 400, "350-400",
[XLength] <= 450, "400-450",
[XLength] <= 500, "450-500",
[XLength] > 500, "500+")


问:
AWS Lambda Python - How to construct Dockerfile with mulitple source packages
I need to construct a Docker container for my python project so I can deploy it to AWS ECR and trigger the container job based on the day of the week. I am struggling with properly copying the source files into the docker container since I have several source packages.

Here is the project structure:

```<code>Dockerfile
requirements.txt
src/
    Package1/
         src1.py
    Package2/
        src2.py
    Package3/
        src3.py
    Runner/
        mainRunner.py
</code>```

Where mainRunner.py contains my handler method.

mainRunner.py contents example:

```<code>from Package1 import src1
def handler(event, context):
    src1.main()
</code>```

Here are the Dockerfile contents:

```<code>FROM public.ecr.aws/lambda/python:3.9
RUN mkdir /src
ADD src /src/
ADD requirements.txt .
RUN pip3 cache purge && pip3 install -U pip wheel setuptools && pip3 install -r requirements.txt
WORKDIR src/Runner/
ENV PYTHONPATH /src
CMD ["mainRunner.handler"]
</code>```

When I run the docker container locally, I receive the following error:

Traceback (most recent call last): Unable to import module 'mainRunner': No module named 'mainRunner'

I tried to exec in the container locally and I cannot find the source code files. I was able to use this same Dockerfile with a python base image perfectly fine (FROM python:3.9) - except the CMD was different for the python base image - CMD python3 mainRunner.py. What am I doing wrong here?

Body:
I need to construct a Docker container for my python project so I can deploy it to AWS ECR and trigger the container job based on the day of the week. I am struggling with properly copying the source files into the docker container since I have several source packages.

Here is the project structure:

Dockerfile
requirements.txt
src/
    Package1/
         src1.py
    Package2/
        src2.py
    Package3/
        src3.py
    Runner/
        mainRunner.py

Where mainRunner.py contains my handler method.

mainRunner.py contents example:

from Package1 import src1
def handler(event, context):
    src1.main()

Here are the Dockerfile contents:

FROM public.ecr.aws/lambda/python:3.9
RUN mkdir /src
ADD src /src/
ADD requirements.txt .
RUN pip3 cache purge && pip3 install -U pip wheel setuptools && pip3 install -r requirements.txt
WORKDIR src/Runner/
ENV PYTHONPATH /src
CMD ["mainRunner.handler"]

When I run the docker container locally, I receive the following error:

Traceback (most recent call last): Unable to import module 'mainRunner': No module named 'mainRunner'

I tried to exec in the container locally and I cannot find the source code files. I was able to use this same Dockerfile with a python base image perfectly fine (FROM python:3.9) - except the CMD was different for the python base image - CMD python3 mainRunner.py. What am I doing wrong here?


问:
Having two custom widget in one form in Django
First let me tell I am new to Django, CSS and all web (front, back) stuff.

I am using 2 custom widget in my form

```<code>from tempus_dominus.widgets import DatePicker, TimePicker
from mapwidgets.widgets import GooglePointFieldWidget
</code>```

both of them need to add below line in header of html file.

```<code>{{ form.media }}
</code>```

when I just have Date picker and Time picker they are working just fine. but when I add map widget to the form only map is working. I don't know what is this and how I can solve this. if you need more information let me know.

my model class:

```<code>from django.contrib.gis.db import models
from django.contrib.gis.geos import Point

DEFAULT_LOCATION_POINT = Point(-104.9903, 39.7392)

class Event(models.Model):
    latlng = models.CharField(max_length=255)
    location = models.PointField(help_text="Use map widget for point the house location")
    description = models.CharField(max_length=255)
    date = models.DateField()
    time = models.TimeField()
    title = models.CharField(max_length=255)

    def __str__(self):
        return self.latlng
</code>```

My form class:

```<code>from django import forms
from tempus_dominus.widgets import DatePicker, TimePicker
from mapwidgets.widgets import GooglePointFieldWidget
from . import models

class EventForm(forms.ModelForm):
    class Meta:
        model = models.Event
        fields = ("location", "latlng", "date", "time", "title", "description")

        widgets = {
            'location': GooglePointFieldWidget,
            'latlng': forms.TextInput(attrs={'class': 'form-control', 'placeholder': "LatLng"}),
            'date': DatePicker(attrs={'class': 'form-control', 'placeholder': "Date"}),
            'time': TimePicker(attrs={'class': 'form-control', 'placeholder': "Time"}),
            'title': forms.TextInput(attrs={'class': 'form-control', 'placeholder': "Title"}),
            'description': forms.TextInput(attrs={'class': 'form-control', 'placeholder': "Description"}),
        }

</code>```

I have no idea what to try.

Body:
First let me tell I am new to Django, CSS and all web (front, back) stuff.

I am using 2 custom widget in my form

from tempus_dominus.widgets import DatePicker, TimePicker
from mapwidgets.widgets import GooglePointFieldWidget

both of them need to add below line in header of html file.

{{ form.media }}

when I just have Date picker and Time picker they are working just fine. but when I add map widget to the form only map is working. I don't know what is this and how I can solve this. if you need more information let me know.

my model class:

from django.contrib.gis.db import models
from django.contrib.gis.geos import Point

DEFAULT_LOCATION_POINT = Point(-104.9903, 39.7392)

class Event(models.Model):
    latlng = models.CharField(max_length=255)
    location = models.PointField(help_text="Use map widget for point the house location")
    description = models.CharField(max_length=255)
    date = models.DateField()
    time = models.TimeField()
    title = models.CharField(max_length=255)

    def __str__(self):
        return self.latlng

My form class:

from django import forms
from tempus_dominus.widgets import DatePicker, TimePicker
from mapwidgets.widgets import GooglePointFieldWidget
from . import models

class EventForm(forms.ModelForm):
    class Meta:
        model = models.Event
        fields = ("location", "latlng", "date", "time", "title", "description")

        widgets = {
            'location': GooglePointFieldWidget,
            'latlng': forms.TextInput(attrs={'class': 'form-control', 'placeholder': "LatLng"}),
            'date': DatePicker(attrs={'class': 'form-control', 'placeholder': "Date"}),
            'time': TimePicker(attrs={'class': 'form-control', 'placeholder': "Time"}),
            'title': forms.TextInput(attrs={'class': 'form-control', 'placeholder': "Title"}),
            'description': forms.TextInput(attrs={'class': 'form-control', 'placeholder': "Description"}),
        }

I have no idea what to try.


问:
Flutter Appstore rejected app by Guideline 5.2.3 - Legal - Intellectual Property
Guideline 5.2.3 - Legal

Your app provides potentially unauthorized access to third-party audio streaming services without providing the necessary authorization.

Next Steps

Please attach documentary evidence in the App Review Information section in App Store Connect evidencing that you have all necessary rights or permissions to the third-party audio content.

Guideline 5.2.3 - Legal - Intellectual Property

Additionally, your app declares that it includes the ability to allows users to download music for free without authorization from the relevant third-party sources.

My app not contain third party api but App Store rejected app review. How I can solve this problem?


问:
What's wrong with my function when calculating the matrix mutiply?
So I have a pointer in my function but fail to pass the result of the matrix to the main function. Hope to get your help! Here's what I have got. I mainly wrote a programme to read a PGMB file and put it into a 2D array. Then do some transform to the array to it. And then do a matrix multiply with 2 matrix

```<code>#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void Matrix(float matA,float matB, float *matC);
int main(int argc, char* argv[])
{
    char filename[100];
    float A[28][28];
    FILE *fp;
    printf("please input filenames: ");
    scanf("%s",filename);
    fp = fopen(filename,"rb");
    if(fp == NULL)
        printf("invalid file.\n");
    char skip[50],ch1;
    int i,j;
    fgets(skip,5,fp);
    while((ch1 = fgetc(fp)) != EOF){
        for(i = 0;i < 28;i++){
            for(j = 0;j < 28;j++)
                A[28][28] = ch1;
        }
    }
    for(i = 0;i <28;i++){
        for(j = 0;j < 28;j++)
            A[28][28] = A[28][2] / 255.0;
    }
    float B[784];
    int k = 0;
    for(i = 0;i < 28;i++){
        for(j = 0;j < 28;j++){
            B[k] = A[i][j];
            k++;
        }
    }
    FILE *W;
    W = fopen("W1.txt","rb");
    float C[784][128];
    char ch2;
    while((ch2 = fgetc(W)) != EOF){
        for(i = 0;i < 784;i++){
            for(j = 0;j < 128;j++)
                C[784][128] = ch2;
        }
    }
    float D[128];
    D[128] = Matrix(B[784], C[784][128], D[128]);
    FILE *B1;
    B1 = fopen("B1.txt","r");
    char ch3;
    float E[128];
    while((ch3 = fgetc(B1)) != EOF){
        for(i = 0;i < 128;i++)
            E[128] = ch3;
    }
    float F[128];
    for(i = 0;i < 128;i++){
        F[i] = D[i] + E[i];
    }

}

void Matrix(float matA, float matB, float *matC)
{
    int count = 0,a,b,c,i,j;
    float sum = 0;
    double matA[a][b],matB[b][c],matC[a][c];
    while(count < a*c){
        for(i = 0;i < a;i++){
            for(j = 0;j < b;j++)
                matC[i][j] += matA[i][j] * matB[i][j];
        }
    }
}
</code>```

So I have been stuck by the question for a long time. I am not sure if the 2D array can be input like my programme do.

Body:
So I have a pointer in my function but fail to pass the result of the matrix to the main function. Hope to get your help! Here's what I have got. I mainly wrote a programme to read a PGMB file and put it into a 2D array. Then do some transform to the array to it. And then do a matrix multiply with 2 matrix

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void Matrix(float matA,float matB, float *matC);
int main(int argc, char* argv[])
{
    char filename[100];
    float A[28][28];
    FILE *fp;
    printf("please input filenames: ");
    scanf("%s",filename);
    fp = fopen(filename,"rb");
    if(fp == NULL)
        printf("invalid file.\n");
    char skip[50],ch1;
    int i,j;
    fgets(skip,5,fp);
    while((ch1 = fgetc(fp)) != EOF){
        for(i = 0;i < 28;i++){
            for(j = 0;j < 28;j++)
                A[28][28] = ch1;
        }
    }
    for(i = 0;i <28;i++){
        for(j = 0;j < 28;j++)
            A[28][28] = A[28][2] / 255.0;
    }
    float B[784];
    int k = 0;
    for(i = 0;i < 28;i++){
        for(j = 0;j < 28;j++){
            B[k] = A[i][j];
            k++;
        }
    }
    FILE *W;
    W = fopen("W1.txt","rb");
    float C[784][128];
    char ch2;
    while((ch2 = fgetc(W)) != EOF){
        for(i = 0;i < 784;i++){
            for(j = 0;j < 128;j++)
                C[784][128] = ch2;
        }
    }
    float D[128];
    D[128] = Matrix(B[784], C[784][128], D[128]);
    FILE *B1;
    B1 = fopen("B1.txt","r");
    char ch3;
    float E[128];
    while((ch3 = fgetc(B1)) != EOF){
        for(i = 0;i < 128;i++)
            E[128] = ch3;
    }
    float F[128];
    for(i = 0;i < 128;i++){
        F[i] = D[i] + E[i];
    }

}

void Matrix(float matA, float matB, float *matC)
{
    int count = 0,a,b,c,i,j;
    float sum = 0;
    double matA[a][b],matB[b][c],matC[a][c];
    while(count < a*c){
        for(i = 0;i < a;i++){
            for(j = 0;j < b;j++)
                matC[i][j] += matA[i][j] * matB[i][j];
        }
    }
}

So I have been stuck by the question for a long time. I am not sure if the 2D array can be input like my programme do.


问:
Idempotent Producer
How do I set 'enable.idempotence=True'?
I have tried setting this property in the code, but its giving me syntax error.

```<code>producer = KafkaProducer(bootstrap_servers=['localhost:9092'], acks='all', 'enable.idempotence'=True)
</code>```

When I try to set it as a property in the Producer config file, it does not work.
enable.idempotence=true

My Kafka version is 3.2.0. I am using Python.

Title: Idempotent Producer

Body:
How do I set 'enable.idempotence=True'?
I have tried setting this property in the code, but its giving me syntax error.

producer = KafkaProducer(bootstrap_servers=['localhost:9092'], acks='all', 'enable.idempotence'=True)

When I try to set it as a property in the Producer config file, it does not work.
enable.idempotence=true

My Kafka version is 3.2.0. I am using Python.


问:
Visual Studio - Breakpoints not being hit with Array.map
In the code below ( which is part of a function with = task{ )

Breakpoint 3 is being hit - and breakpoint 1 and 2 are not. the code is working ( i.e. the code is running in the Array.map and produces 29 rows but I can no longer debug that part of the code ). They were breakking and then they just stopped all of a sudden.  Tried resetting settings, rebooting machine etc.  Any ideas?  All the builds are debug / Any CPU

```<code>                let rows =
                    data.Rows
                    |> Seq.toArray
                    |> Array.map(fun row ->
                        let transactionDateString = row[0] + " " + row[1] //Breakpoint 1
                        let ttt = TimeZoneInfo.ConvertTime(DateTime.Parse(transactionDateString, CultureInfo.CreateSpecificCulture("en-AU")),TimeZoneInfo.FindSystemTimeZoneById("E. Australia Standard Time"),TimeZoneInfo.Local)
                        let transactionDateTime = DateTime.ParseExact(transactionDateString, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture).AddHours(2)
                        let ttt2 = ttt.ToLocalTime()
                        let transactionNumber = row.Columns[2].ToString() // [ "TRXN Reference-Eway"]
                        let t2 = int transactionNumber  // Breakpoint 2

                        let transactionType = row[3].ToString()
                        let transactionCurrency = currency

                        let csvData: EwayCSVData = {
                            transactionDateTime = transactionDateTime
                            transactionNumber = transactionNumber
                            transactionType = transactionType
                            currency = transactionCurrency
                        }
                        csvData)

                do! EwayTransactions.saveTransactions(rows,sTransCollection, httpClient) // Breakpoint 3
</code>```

Body:
In the code below ( which is part of a function with = task{ )

Breakpoint 3 is being hit - and breakpoint 1 and 2 are not. the code is working ( i.e. the code is running in the Array.map and produces 29 rows but I can no longer debug that part of the code ). They were breakking and then they just stopped all of a sudden.  Tried resetting settings, rebooting machine etc.  Any ideas?  All the builds are debug / Any CPU

                let rows =
                    data.Rows
                    |> Seq.toArray
                    |> Array.map(fun row ->
                        let transactionDateString = row[0] + " " + row[1] //Breakpoint 1
                        let ttt = TimeZoneInfo.ConvertTime(DateTime.Parse(transactionDateString, CultureInfo.CreateSpecificCulture("en-AU")),TimeZoneInfo.FindSystemTimeZoneById("E. Australia Standard Time"),TimeZoneInfo.Local)
                        let transactionDateTime = DateTime.ParseExact(transactionDateString, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture).AddHours(2)
                        let ttt2 = ttt.ToLocalTime()
                        let transactionNumber = row.Columns[2].ToString() // [ "TRXN Reference-Eway"]
                        let t2 = int transactionNumber  // Breakpoint 2

                        let transactionType = row[3].ToString()
                        let transactionCurrency = currency

                        let csvData: EwayCSVData = {
                            transactionDateTime = transactionDateTime
                            transactionNumber = transactionNumber
                            transactionType = transactionType
                            currency = transactionCurrency
                        }
                        csvData)

                do! EwayTransactions.saveTransactions(rows,sTransCollection, httpClient) // Breakpoint 3


问:
Tensorflow could not load dynamic libraries
I've installed tensorflow in a remote machine, then connected it via remote VSCode.
I've also installed tensorflow following the installation guide that I have the conda environment with the name atnwf in the remote machine.
I also learned that jupyter notebook does not keep environment variables so that I set the proper LD_LIBRARY_PATH using %env in my notebook.

%env LD_LIBRARY_PATH=/home/grad/tomandjerry/anaconda3/envs/atnwf/lib/
```
<p>However still the tensorflow warning message says</p>
```2022-12-21 13:46:29.064619: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/grad/tomandjerry/anaconda3/envs/atnwf/lib/
```
<p>I've already checked that the library was installed in the corresponding path. Moreover, I verified the basic installation.</p>
```(atnwf) [lib]$ python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
2022-12-21 14:02:34.992430: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-12-21 14:02:36.382350: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/lib/:/home/grad/tomandjerry/anaconda3/envs/atnwf/lib/:/home/grad/tomandjerry/anaconda3/envs/atnwf/lib/:/home/grad/tomandjerry/anaconda3/envs/atnwf/lib/
2022-12-21 14:02:36.382611: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/lib/:/home/grad/tomandjerry/anaconda3/envs/atnwf/lib/:/home/grad/tomandjerry/anaconda3/envs/atnwf/lib/:/home/grad/tomandjerry/anaconda3/envs/atnwf/lib/
2022-12-21 14:02:36.382633: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU'), PhysicalDevice(name='/physical_device:GPU:1', device_type='GPU')]
```

How can I resolve the "not found" issue correctly?

I tried re-installing all the packages in the conda environment by resetting a new environment with another name. I've also tried the method editing kernelspec stated in How to set env variable in Jupyter notebook.

Body:
I've installed tensorflow in a remote machine, then connected it via remote VSCode.
I've also installed tensorflow following the installation guide that I have the conda environment with the name atnwf in the remote machine.
I also learned that jupyter notebook does not keep environment variables so that I set the proper LD_LIBRARY_PATH using %env in my notebook.

%env LD_LIBRARY_PATH=/home/grad/tomandjerry/anaconda3/envs/atnwf/lib/

However still the tensorflow warning message says

2022-12-21 13:46:29.064619: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/grad/tomandjerry/anaconda3/envs/atnwf/lib/

I've already checked that the library was installed in the corresponding path. Moreover, I verified the basic installation.

(atnwf) [lib]$ python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
2022-12-21 14:02:34.992430: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-12-21 14:02:36.382350: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/lib/:/home/grad/tomandjerry/anaconda3/envs/atnwf/lib/:/home/grad/tomandjerry/anaconda3/envs/atnwf/lib/:/home/grad/tomandjerry/anaconda3/envs/atnwf/lib/
2022-12-21 14:02:36.382611: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/lib/:/home/grad/tomandjerry/anaconda3/envs/atnwf/lib/:/home/grad/tomandjerry/anaconda3/envs/atnwf/lib/:/home/grad/tomandjerry/anaconda3/envs/atnwf/lib/
2022-12-21 14:02:36.382633: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU'), PhysicalDevice(name='/physical_device:GPU:1', device_type='GPU')]

How can I resolve the "not found" issue correctly?

I tried re-installing all the packages in the conda environment by resetting a new environment with another name. I've also tried the method editing kernelspec stated in How to set env variable in Jupyter notebook.


问:
Refresh engines/indices in Elastic App search
Want to refresh engines/indices once we add/update any document in Elastic App Search engine. There is refresh API in elastic search but I did not find similar thing in Elastic App Search. Does anyone know how to refresh engines in elastic app search?

Elastic App Search Documentation - https://www.elastic.co/guide/en/app-search/current/documents.html

Reference for elastic search refresh API - https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-refresh.html#:~:text=Wait%20for%20the%20changes%20made,which%20defaults%20to%20one%20second.


问:
How to convert IIS URL rewrite rules to tomcat URL rewrite?
I am converting the IIS rewrite rules for URL to their equivalent in Tomcat9

```<code>        <rule name="MyRule1" stopProcessing="true">
            <match url="one/two/three(.*)" />
            <serverVariables>
                <set name="HTTP_X_FORWARDED_HOST" value="my-hostname" />
                <set name="HTTP_X_FORWARDED_PORT" value="80" />
            </serverVariables>
            <action type="Rewrite" url="http://localhost:9091/one/two/three{R:1}" />
        </rule>

</code>```

I am referring to tomcat rewrite valve here

```<code>https://tomcat.apache.org/tomcat-9.0-doc/rewrite.html

</code>```

I don't see any equivalent of HTTP_X_FORWARDED_HOST and HTTP_X_FORWARDED_PORT.

Can anyone suggest what to use and how will the equivalent rewrite rule of my example will look like in Tomcat9?

Body:
I am converting the IIS rewrite rules for URL to their equivalent in Tomcat9

        <rule name="MyRule1" stopProcessing="true">
            <match url="one/two/three(.*)" />
            <serverVariables>
                <set name="HTTP_X_FORWARDED_HOST" value="my-hostname" />
                <set name="HTTP_X_FORWARDED_PORT" value="80" />
            </serverVariables>
            <action type="Rewrite" url="http://localhost:9091/one/two/three{R:1}" />
        </rule>

I am referring to tomcat rewrite valve here

https://tomcat.apache.org/tomcat-9.0-doc/rewrite.html

I don't see any equivalent of HTTP_X_FORWARDED_HOST and HTTP_X_FORWARDED_PORT.

Can anyone suggest what to use and how will the equivalent rewrite rule of my example will look like in Tomcat9?


问:
getting error on creating reactive forms module in angular 15
The error i am getting:

I am new on angular. now getting this error when i am binding form with the property.

here is the code of my app

```<code>import { Component, OnInit } from "@angular/core";
import { FormBuilder, FormGroup,FormsModule} from "@angular/forms";
@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})

export class LoginComponent implements OnInit{

  loginVal:FormGroup;

  constructor(private fb : FormBuilder ){

    this.formBinding();
  }

  ngOnInit(): void { };

  formBinding(){
    this.loginVal = this.fb.group({
      username:["testuser"],
      userpass:[""],
    });
  }

  display(){
    console.log(this.loginVal.value);
  }

}
</code>```

here is the html

```<code><form [formGroup]="loginVal" class="form-group" (ngSubmit)="display()">
    <label for="">User Name:</label>
    <input formControlName="username" class="form-control">
    <label for="">Password:</label>
    <input formControlName="userpass" class="form-control">

    <button type="submit">Submit</button>

  </form>
</code>```

imports on appmodule.ts

```<code>imports: [
    BrowserModule,
    AppRoutingModule,
    MatSidenavModule,
    FormsModule,
    ReactiveFormsModule,
    HttpClientModule

  ],
</code>```

tried in many ways but failed to bind the property

Update Note: this Problem is solved using "!" (Null assertion) operator

Body:
The error i am getting:

I am new on angular. now getting this error when i am binding form with the property.

here is the code of my app

import { Component, OnInit } from "@angular/core";
import { FormBuilder, FormGroup,FormsModule} from "@angular/forms";
@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})

export class LoginComponent implements OnInit{

  loginVal:FormGroup;

  constructor(private fb : FormBuilder ){

    this.formBinding();
  }

  ngOnInit(): void { };

  formBinding(){
    this.loginVal = this.fb.group({
      username:["testuser"],
      userpass:[""],
    });
  }

  display(){
    console.log(this.loginVal.value);
  }

}

here is the html

<form [formGroup]="loginVal" class="form-group" (ngSubmit)="display()">
    User Name:
    <input formControlName="username" class="form-control">
    Password:
    <input formControlName="userpass" class="form-control">

    <button type="submit">Submit</button>

  </form>

imports on appmodule.ts

imports: [
    BrowserModule,
    AppRoutingModule,
    MatSidenavModule,
    FormsModule,
    ReactiveFormsModule,
    HttpClientModule

  ],

tried in many ways but failed to bind the property

Update Note: this Problem is solved using "!" (Null assertion) operator


问:
Delete record in mysql update trigger | MySQL
i'm tiring to delete a record from a table when the active flag is 0 but the the update changes should be added to the history table before deleting.

here is my trigger:

```<code>CREATE TRIGGER customer_history_update
    BEFORE UPDATE on customer_table
    FOR EACH ROW
    BEGIN
    SET @config_item_id = NEW.id;
    SET @change_type = 'UPDATE';
    SET @changed_by = NEW.last_modified_by;
    SET @changed_date_time = NEW.last_modified_date_time;
    IF NEW.is_active = 0 THEN
       set @active_flag = 0;
    ELSE
       set @active_flag = 1;
    END IF;

    IF NEW.name <> OLD.name THEN
        INSERT INTO customer_history_table (change_type,
        attribute_name, old_value, new_value, changed_by, changed_date_time)
        VALUES ( @change_type, 'name', OLD.name, NEW.name,
        @changed_by, @changed_date_time);
    END IF;

    IF NEW.is_active <> OLD.is_active THEN
        INSERT INTO customer_history_table (change_type,
        attribute_name, old_value, new_value, changed_by, changed_date_time)
        VALUES ( @change_type, 'is_active', OLD.is_active, NEW.is_active,
        @changed_by, @changed_date_time);
    END IF;

    IF @active_flag = 0 THEN
    DELETE from customer_table where id = @config_item_id;
    END IF;
    END;;
</code>```

I'm getting below error:

```<code>Can't update table 'customer_table' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
</code>```

can someone help? is it possible to do delete in a trigger?

Body:
i'm tiring to delete a record from a table when the active flag is 0 but the the update changes should be added to the history table before deleting.

here is my trigger:

CREATE TRIGGER customer_history_update
    BEFORE UPDATE on customer_table
    FOR EACH ROW
    BEGIN
    SET @config_item_id = NEW.id;
    SET @change_type = 'UPDATE';
    SET @changed_by = NEW.last_modified_by;
    SET @changed_date_time = NEW.last_modified_date_time;
    IF NEW.is_active = 0 THEN
       set @active_flag = 0;
    ELSE
       set @active_flag = 1;
    END IF;

    IF NEW.name <> OLD.name THEN
        INSERT INTO customer_history_table (change_type,
        attribute_name, old_value, new_value, changed_by, changed_date_time)
        VALUES ( @change_type, 'name', OLD.name, NEW.name,
        @changed_by, @changed_date_time);
    END IF;

    IF NEW.is_active <> OLD.is_active THEN
        INSERT INTO customer_history_table (change_type,
        attribute_name, old_value, new_value, changed_by, changed_date_time)
        VALUES ( @change_type, 'is_active', OLD.is_active, NEW.is_active,
        @changed_by, @changed_date_time);
    END IF;

    IF @active_flag = 0 THEN
    DELETE from customer_table where id = @config_item_id;
    END IF;
    END;;

I'm getting below error:

Can't update table 'customer_table' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.

can someone help? is it possible to do delete in a trigger?


问:
Default Compose accessibility focus for Talkback on Android tablet
On the phone, the top left back button is always announced first by Talkback however this doesn't seem to be the case on the tablet. Does anyone know what is the default first focus on the tablet as it looks like it might be different?

Adding a call to Modifier.focusRequester and focusable on the back button doesn't do anything.

The screen is Compose view within fragment container.


问:
How can we setup OpenRTB in my project to read user data
I have a project in which we collects user data (Cookies, Search History, location etc..) on their permission.
We need to sell all data to buyers by using OpenRTB, as www.iab.com provide a mechanism to done this job.
But I'm not sure how to do this job and how can we sell our data to different buyers.
I'm try to do this job using Google AdSence but I'm not sure that it will works well.

Where ads running on google will provide data details and same will be copied in server object from where data will get read.


问:
How to get Notes & Attachments Record using SOQL
I am not found Notes & Attachments Record in Custom Object</p>
```<code>select Id, Name,(SELECT Id, Name FROM Attachments),(SELECT Id, Title FROM Notes) from Student__c
</code>```

Body:
I am not found Notes & Attachments Record in Custom Object

select Id, Name,(SELECT Id, Name FROM Attachments),(SELECT Id, Title FROM Notes) from Student__c


问:
Amazon ECR Image is not downloaded when launching an EC2 task on ECS
I am pretty new to AWS. I have created a private repository in ECR, and uploaded an image to it. I defined a task definition in ECS that uses that image. I have a cluster defined using an autoscale group from EC2, and a service that should run the task with the ECR image. When I scale the autoscale group to 1 instance and in turn go to run my task from my service, the service shows the task starting (status in progress), but it seems that the image is never downloaded.

I have verified that by looking at the summary on the repository, which doesn't show a download for this image but shows downloads for other repositories when they are run, and when I ssh to the instance and poke around on the logs in /var/log I never see any logs where the image is being downloaded or fails to download, etc. Docker only shows the images for the ecs-agent and something else, not the image that I am trying to run. When I use the aws cli to describe the task after it inevitably fails later, the output includes this for the reason the task is stopped:

```<code>"stopCode": "TaskFailedToStart",
"stoppedAt": "2022-12-20T07:44:46.292000-08:00",
"stoppedReason": "Task failed to start",
"stoppingAt": "2022-12-20T07:44:46.292000-08:00",
</code>```

I have run a different container on this cluster successfully. In this fail case there are no logs that make it to the logstream, no events other than the task starting, I am baffled. Any help would be greatly appreciated.

Body:
I am pretty new to AWS. I have created a private repository in ECR, and uploaded an image to it. I defined a task definition in ECS that uses that image. I have a cluster defined using an autoscale group from EC2, and a service that should run the task with the ECR image. When I scale the autoscale group to 1 instance and in turn go to run my task from my service, the service shows the task starting (status in progress), but it seems that the image is never downloaded.

I have verified that by looking at the summary on the repository, which doesn't show a download for this image but shows downloads for other repositories when they are run, and when I ssh to the instance and poke around on the logs in /var/log I never see any logs where the image is being downloaded or fails to download, etc. Docker only shows the images for the ecs-agent and something else, not the image that I am trying to run. When I use the aws cli to describe the task after it inevitably fails later, the output includes this for the reason the task is stopped:

"stopCode": "TaskFailedToStart",
"stoppedAt": "2022-12-20T07:44:46.292000-08:00",
"stoppedReason": "Task failed to start",
"stoppingAt": "2022-12-20T07:44:46.292000-08:00",

I have run a different container on this cluster successfully. In this fail case there are no logs that make it to the logstream, no events other than the task starting, I am baffled. Any help would be greatly appreciated.


问:
Python not recognizing websockets.broadcast()
I'm trying to run the following code for a simple chat server:

```<code>import asyncio
import websockets

async def chat(websocket, debug):
    print(debug, type(debug))
    while True:
        message = await websocket.recv()
        await websockets.broadcast(message)

async def main():
    async with websockets.serve(chat, "localhost", 8008):
        await asyncio.sleep(1)
        await asyncio.Future()

if (__name__ == "__main__"):
    print(websockets.__file__)
    asyncio.run(main())

</code>```

However when I do this I get the following error:
AttributeError: module 'websockets' has no attribute 'broadcast'

I tried going through the code of the module imported and made sure I had no files named websockets.py. Not sure why this is as this should be the latest version of websockets as well.

Body:
I'm trying to run the following code for a simple chat server:

import asyncio
import websockets

async def chat(websocket, debug):
    print(debug, type(debug))
    while True:
        message = await websocket.recv()
        await websockets.broadcast(message)

async def main():
    async with websockets.serve(chat, "localhost", 8008):
        await asyncio.sleep(1)
        await asyncio.Future()

if (__name__ == "__main__"):
    print(websockets.__file__)
    asyncio.run(main())

However when I do this I get the following error:
AttributeError: module 'websockets' has no attribute 'broadcast'

I tried going through the code of the module imported and made sure I had no files named websockets.py. Not sure why this is as this should be the latest version of websockets as well.


问:
How to create search engine in localhost
What is best for backend language and UI Design Framework.

Python or others?
Angular or others?

Need best Suggestion for backend language and UI Design Framework.


问:
EDITED Trying to deploy a react-app on gh-pages and new pages links are giving a 404 error. No error messages. Deploys locally fine
[UPDATED AFTER RECOMMENDATION TO USE GH-PAGES]
I am running into issues depoloy a react-app to gh-pages with pathing/pages rendering. I'm using react-router-dom to create actual links to pages so that I can share the direct link to a specific page. I've set up all the Router, Routes, Route and Link tags and everything is working fine locally. But when it's deployed, those links are giving 404 errors and I cannot track down why.

Package.json

```<code>"homepage": "https://cpm-128.github.io/portfolio-react-router",
</code>```

App.js

```<code>import React from 'react';
import PortfolioContainer from './components/PortfolioContainer';

// vdom rendering
function App() {
  return (
    <div>
      <PortfolioContainer />
    </div>
  );
}

export default App;
</code>```

Portfolio Container

```<code>import React, { useState } from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';

import NavTabs from './NavTabs';
import Header from './Header';
import Footer from './Footer';

import About from './pages/About';
import Portfolio from './pages/Portfolio';
import Contact from './pages/Contact';
import Resume from './pages/Resume';
import Cycling from './pages/Cycling';

function PortfolioContainer() {

    return (
        // the basename will keep the entire homepage url, even with slugs
        <Router basename={process.env.PUBLIC_URL}>
            <div className='portfolio-container d-flex flex-column min-vh-100'>
                <NavTabs />
                <Header />

                <Routes>
                    {/* index */}
                    <Route
                        exact path='/'
                        element={<About />}
                    />
                    {/* repo name
                    <Route
                        exact path='/portfolio-react-router'
                        element={<About />}
                    /> */}
                    {/* About */}
                    <Route
                        path='/about'
                        element={<About />}
                    />
                    {/* Portfolio */}
                    <Route
                        path='/portfolio'
                        element={<Portfolio />}
                    />
                    {/* Contact */}
                    <Route
                        path='/contact'
                        element={<Contact />}
                    />
                    {/* Resume */}
                    <Route
                        path='/resume'
                        element={<Resume />}
                    />
                    {/* Cycling */}
                    <Route
                        path='/cycling'
                        element={<Cycling />}
                    />
                </Routes>

                <Footer />
            </div>
        </Router>
    )

};

export default PortfolioContainer;
</code>```

NavTabs

```<code>import React from 'react';
import { Link } from 'react-router-dom';

function NavTabs({ currentPage, handlePageChange }) {
    return (
        <nav>

        <ul className='nav nav-tabs bg-color-primary'>

            {/* ABOUT */}
            <li className='nav-item'>
                <Link to='/about'
                    onClick={() => handlePageChange('About')}
                    className={currentPage === 'About'
                        ? 'nav-link active'
                        : 'nav-link'
                    }
                >
                    About
                </Link>
            </li>

            {/* PORTFOLIO */}
            <li className='nav-item'>
                <Link to='/portfolio'
                    onClick={() => handlePageChange('Portfolio')}
                    className={currentPage === 'Portfolio'
                        ? 'nav-link active'
                        : 'nav-link'
                    }
                >
                    Portfolio
                </Link>
            </li>

            {/* CONTACT */}
            <li className='nav-item'>
                <Link to='/contact'
                    onClick={() => handlePageChange('Contact')}
                    className={currentPage === 'Contact'
                        ? 'nav-link active'
                        : 'nav-link'
                    }
                >
                    Contact
                </Link>
            </li>

            {/* RESUME */}
            <li className='nav-item'>
                <Link to='/resume'
                    onClick={() => handlePageChange('Resume')}
                    className={currentPage === 'Resume'
                        ? 'nav-link active'
                        : 'nav-link'
                    }
                >
                    Resume
                </Link>
            </li>

            {/* CYCLING */}
            <li className='nav-item'>
                <Link to='/cycling'
                    onClick={() => handlePageChange('Cycling')}
                    className={currentPage === 'Cycling'
                        ? 'nav-link active'
                        : 'nav-link'
                    }
                >
                    Cycling
                </Link>
            </li>

        </ul>

        </nav>
    )
};

export default NavTabs;
</code>```

[ORIGINAL]
I'm trying to deploy a multipage React app to Heroku. After spending hours trying to work with GitHub pages for this, I realized gh-pages may be unable to render the components, so I moved to Heroku. The app works locally, but nothing is displaying on the Heroku app.

I set the Heroku remote

Node.js buildpack

heroku buildpacks:set mars/create-react-app for a buildpack for React app that some internet resources suggested

The Heroku app is using eco dynos

What am I missing? Nothing is rendering. I get no error messages, just that the deploy was successful.

Body:
[UPDATED AFTER RECOMMENDATION TO USE GH-PAGES]
I am running into issues depoloy a react-app to gh-pages with pathing/pages rendering. I'm using react-router-dom to create actual links to pages so that I can share the direct link to a specific page. I've set up all the Router, Routes, Route and Link tags and everything is working fine locally. But when it's deployed, those links are giving 404 errors and I cannot track down why.

Package.json

"homepage": "https://cpm-128.github.io/portfolio-react-router",

App.js

import React from 'react';
import PortfolioContainer from './components/PortfolioContainer';

// vdom rendering
function App() {
  return (

      <PortfolioContainer />

  );
}

export default App;

Portfolio Container

import React, { useState } from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';

import NavTabs from './NavTabs';
import Header from './Header';
import Footer from './Footer';

import About from './pages/About';
import Portfolio from './pages/Portfolio';
import Contact from './pages/Contact';
import Resume from './pages/Resume';
import Cycling from './pages/Cycling';

function PortfolioContainer() {

    return (
        // the basename will keep the entire homepage url, even with slugs
        <Router basename={process.env.PUBLIC_URL}>

                <NavTabs />

                <Routes>
                    {/* index */}
                    <Route
                        exact path='/'
                        element={<About />}
                    />
                    {/* repo name
                    <Route
                        exact path='/portfolio-react-router'
                        element={<About />}
                    /> */}
                    {/* About */}
                    <Route
                        path='/about'
                        element={<About />}
                    />
                    {/* Portfolio */}
                    <Route
                        path='/portfolio'
                        element={<Portfolio />}
                    />
                    {/* Contact */}
                    <Route
                        path='/contact'
                        element={<Contact />}
                    />
                    {/* Resume */}
                    <Route
                        path='/resume'
                        element={<Resume />}
                    />
                    {/* Cycling */}
                    <Route
                        path='/cycling'
                        element={<Cycling />}
                    />
                </Routes>

        </Router>
    )

};

export default PortfolioContainer;

NavTabs

import React from 'react';
import { Link } from 'react-router-dom';

function NavTabs({ currentPage, handlePageChange }) {
    return (

            {/* ABOUT */}

                <Link to='/about'
                    onClick={() => handlePageChange('About')}
                    className={currentPage === 'About'
                        ? 'nav-link active'
                        : 'nav-link'
                    }
                >
                    About
                </Link>

            {/* PORTFOLIO */}

                <Link to='/portfolio'
                    onClick={() => handlePageChange('Portfolio')}
                    className={currentPage === 'Portfolio'
                        ? 'nav-link active'
                        : 'nav-link'
                    }
                >
                    Portfolio
                </Link>

            {/* CONTACT */}

                <Link to='/contact'
                    onClick={() => handlePageChange('Contact')}
                    className={currentPage === 'Contact'
                        ? 'nav-link active'
                        : 'nav-link'
                    }
                >
                    Contact
                </Link>

            {/* RESUME */}

                <Link to='/resume'
                    onClick={() => handlePageChange('Resume')}
                    className={currentPage === 'Resume'
                        ? 'nav-link active'
                        : 'nav-link'
                    }
                >
                    Resume
                </Link>

            {/* CYCLING */}

                <Link to='/cycling'
                    onClick={() => handlePageChange('Cycling')}
                    className={currentPage === 'Cycling'
                        ? 'nav-link active'
                        : 'nav-link'
                    }
                >
                    Cycling
                </Link>

    )
};

export default NavTabs;

[ORIGINAL]
I'm trying to deploy a multipage React app to Heroku. After spending hours trying to work with GitHub pages for this, I realized gh-pages may be unable to render the components, so I moved to Heroku. The app works locally, but nothing is displaying on the Heroku app.

I set the Heroku remote

Node.js buildpack

heroku buildpacks:set mars/create-react-app for a buildpack for React app that some internet resources suggested

The Heroku app is using eco dynos

What am I missing? Nothing is rendering. I get no error messages, just that the deploy was successful.


问:
JQuery Get Second Group of Select Options to Save in localStorage and print to another page
It's currently printing the value of either var selectedValue or var selectedValue2 but cannot distinguish between the two. can anyone help solve this? It's printing the specified value and saving in localStorage, but I need to find a way for the code to differentiate between the two different select options. If I specify selectedValue where I call it from localStorage, whatever is selected (3/8 oz or 1/2 oz) will print even if I'm selecting 5/8 oz, 3/4 oz, or 1 oz. I've tried multiple ways of going about this with no luck. I have a GitHub repository if anyone wants to take a look. I'm beside myself right now and truly do not know how to fix this.</p>
```<code><div class="product-bottom text-center">
                <select id="selectSize" onchange="setSize()">
                    <option value="3/8 oz">3/8 oz</option>
                    <option value="1/2 oz">1/2 oz</option>
                </select>
        <div class="product-bottom text-center">
                <select id="selectSize2" onchange="setSize()">
                    <option value="5/8 oz">5/8 oz</option>
                    <option value="3/4 oz">3/4 oz</option>
                    <option value="1 oz">1 oz</option>
                </select>

  setSize: function() {
                var selectedValue = $('#selectSize').val();                                  this.storage.setItem('selectedValue', selectedValue);
                var selectedValue2 = $('#selectSize2').val();                               this.storage.setItem('selectedValue2', selectedValue2);
                var retrievedValue = this.storage.getItem('selectedValue');
                var retrievedValue2 = this.storage.getItem('selectedValue2');

                $('#selectSize').change(function() {
                  selectedValue = $(this).find(":selected").val();
                  selectedValue2 = $(this).find(":selected").val();
                 retrievedValue = selectedValue;
                 retrievedValue2 = selectedValue2;
                 selectedValue = selectedValue2
                });
        },

</code>```

Body:
It's currently printing the value of either var selectedValue or var selectedValue2 but cannot distinguish between the two. can anyone help solve this? It's printing the specified value and saving in localStorage, but I need to find a way for the code to differentiate between the two different select options. If I specify selectedValue where I call it from localStorage, whatever is selected (3/8 oz or 1/2 oz) will print even if I'm selecting 5/8 oz, 3/4 oz, or 1 oz. I've tried multiple ways of going about this with no luck. I have a GitHub repository if anyone wants to take a look. I'm beside myself right now and truly do not know how to fix this.

                <select id="selectSize" onchange="setSize()">
                    <option value="3/8 oz">3/8 oz</option>
                    <option value="1/2 oz">1/2 oz</option>
                </select>

                <select id="selectSize2" onchange="setSize()">
                    <option value="5/8 oz">5/8 oz</option>
                    <option value="3/4 oz">3/4 oz</option>
                    <option value="1 oz">1 oz</option>
                </select>

  setSize: function() {
                var selectedValue = $('#selectSize').val();                                  this.storage.setItem('selectedValue', selectedValue);
                var selectedValue2 = $('#selectSize2').val();                               this.storage.setItem('selectedValue2', selectedValue2);
                var retrievedValue = this.storage.getItem('selectedValue');
                var retrievedValue2 = this.storage.getItem('selectedValue2');

                $('#selectSize').change(function() {
                  selectedValue = $(this).find(":selected").val();
                  selectedValue2 = $(this).find(":selected").val();
                 retrievedValue = selectedValue;
                 retrievedValue2 = selectedValue2;
                 selectedValue = selectedValue2
                });
        },


问:
While migrating Angular project to Angular 13 getting error: NG0203 at runtime after making build
```<code>Error: NG0203
    at injectInjectorOnly (/var/www/frontend/dist/server.js:50241:360)
    at ɵɵinject (/var/www/frontend/dist/server.js:50241:704)
    at Object.ApplicationModule_Factory [as factory] (/var/www/frontend/dist/server.js:60232:117)
    at R3Injector.hydrate (/var/www/frontend/dist/server/main.js:305923:35)
    at R3Injector.get (/var/www/frontend/dist/server/main.js:305742:33)
    at /var/www/frontend/dist/server/main.js:305780:55
    at Set.forEach (<anonymous>)
    at R3Injector._resolveInjectorDefTypes (/var/www/frontend/dist/server/main.js:305780:31)
    at new NgModuleRef (/var/www/frontend/dist/server/main.js:316310:26)
    at NgModuleFactory.create (/var/www/frontend/dist/server/main.js:316364:16)
</code>```

I build the app with build:ssr which makes the build and app runs fine.
But when i select Googlebot from Network Conditions and refresh page the app crashes with the error mentioned.

I have tried almost all the solutions on the internet but that didn't solve my problem.

Body:
Error: NG0203
    at injectInjectorOnly (/var/www/frontend/dist/server.js:50241:360)
    at ɵɵinject (/var/www/frontend/dist/server.js:50241:704)
    at Object.ApplicationModule_Factory [as factory] (/var/www/frontend/dist/server.js:60232:117)
    at R3Injector.hydrate (/var/www/frontend/dist/server/main.js:305923:35)
    at R3Injector.get (/var/www/frontend/dist/server/main.js:305742:33)
    at /var/www/frontend/dist/server/main.js:305780:55
    at Set.forEach (<anonymous>)
    at R3Injector._resolveInjectorDefTypes (/var/www/frontend/dist/server/main.js:305780:31)
    at new NgModuleRef (/var/www/frontend/dist/server/main.js:316310:26)
    at NgModuleFactory.create (/var/www/frontend/dist/server/main.js:316364:16)

I build the app with build:ssr which makes the build and app runs fine.
But when i select Googlebot from Network Conditions and refresh page the app crashes with the error mentioned.

I have tried almost all the solutions on the internet but that didn't solve my problem.


问:
Instrument testing with Jetpack compose and Kotlin room
I'm testing several behaviours including:

FAB is hidden when table (Kotlin room) is empty

FAB navigates to a page when table (Kotlin room) is not empty

My approach is based on instrumented testing of jetpack but I'm unsure as to how to amend the database to simulate an empty/non-empty table needed to test the above behaviour.

But I'm not entirely sure if this is an ideal approach, and like to get your thoughts

```<code>@ExperimentalMaterial3Api
@HiltAndroidTest
@RunWith(AndroidJUnit4::class)
class HomeScreenTest {
    @get:Rule(order = 0)
    val hiltRule = HiltAndroidRule(this)

    @ExperimentalMaterial3Api
    @get:Rule(order = 1)
    val composeTestRule = createAndroidComposeRule<MainActivity>()

    @Inject
    lateinit var repoMoto: MotorcycleRepository
    lateinit var repoFix: FixRepository

    private lateinit var navController: NavHostController
    private lateinit var viewModel: ViewModel

    @ExperimentalMaterial3Api
    @Before
    fun setUp() {
        hiltRule.inject()
        composeTestRule.setContent {
            viewModel = hiltViewModel()
            navController = rememberNavController()
            MotoAkuTheme {
                BottomNavigation(
                    navController = navController,
                    vm = viewModel
                )
            }
        }
    }

    @Test
    fun When_noMotoInDb_expect_FABNotShown() {
        // TODO Simulate empty Motorcycle table

        // Verify FAB is not shown
        composeTestRule.onNodeWithTag(BOTTOMNAV_FAB).assertDoesNotExist()
    }

    @Test
    fun When_motoInDBAndfixFABPressed_expect_navigateToAddFixScreen() {
        // TODO Simulate a non empty moto list

        // Click fix FAB
        composeTestRule.onNodeWithTag(BOTTOMNAV_FAB).performClick()
        // Determine if route is navigated to Fix screen
        val route = navController.currentBackStackEntry?.destination?.route
        Assert.assertEquals(Screen.AddFix.name+"/?motoId={motoId}",route)
    }
}
</code>```

Usually, I approach my test as if I'd use the app physically. Hence, if I were to test behaviour that requires an empty/non-empty database, then I'd add then delete accordingly to simulate that.

Body:
I'm testing several behaviours including:

FAB is hidden when table (Kotlin room) is empty

FAB navigates to a page when table (Kotlin room) is not empty

My approach is based on instrumented testing of jetpack but I'm unsure as to how to amend the database to simulate an empty/non-empty table needed to test the above behaviour.

But I'm not entirely sure if this is an ideal approach, and like to get your thoughts

@ExperimentalMaterial3Api
@HiltAndroidTest
@RunWith(AndroidJUnit4::class)
class HomeScreenTest {
    @get:Rule(order = 0)
    val hiltRule = HiltAndroidRule(this)

    @ExperimentalMaterial3Api
    @get:Rule(order = 1)
    val composeTestRule = createAndroidComposeRule<MainActivity>()

    @Inject
    lateinit var repoMoto: MotorcycleRepository
    lateinit var repoFix: FixRepository

    private lateinit var navController: NavHostController
    private lateinit var viewModel: ViewModel

    @ExperimentalMaterial3Api
    @Before
    fun setUp() {
        hiltRule.inject()
        composeTestRule.setContent {
            viewModel = hiltViewModel()
            navController = rememberNavController()
            MotoAkuTheme {
                BottomNavigation(
                    navController = navController,
                    vm = viewModel
                )
            }
        }
    }

    @Test
    fun When_noMotoInDb_expect_FABNotShown() {
        // TODO Simulate empty Motorcycle table

        // Verify FAB is not shown
        composeTestRule.onNodeWithTag(BOTTOMNAV_FAB).assertDoesNotExist()
    }

    @Test
    fun When_motoInDBAndfixFABPressed_expect_navigateToAddFixScreen() {
        // TODO Simulate a non empty moto list

        // Click fix FAB
        composeTestRule.onNodeWithTag(BOTTOMNAV_FAB).performClick()
        // Determine if route is navigated to Fix screen
        val route = navController.currentBackStackEntry?.destination?.route
        Assert.assertEquals(Screen.AddFix.name+"/?motoId={motoId}",route)
    }
}

Usually, I approach my test as if I'd use the app physically. Hence, if I were to test behaviour that requires an empty/non-empty database, then I'd add then delete accordingly to simulate that.


问:
Algolia reverse filter by a keyword in a string
I am trying to create a system where users can reverse filter food products (hide the product from search results) by ingredients of their choice using Algolia.
For example, if a user wants to buy a pack of chips without a salt in it, they can type salt in to the filter section and the app will display all the chips without a salt in it.

The users can chose the filter option by typing it out in an input box, which could be multiple as well, and since this will cover all ingredients, I can not predict what the users will want to filter out therefore I can't set rules for each ingredients one by one in algolia.

Is there a way in algolia to just send in the array of ingredients that the users have selected and tell algolia to not to show products if the keywords are included in ingredients?

I am using react native to create this app.

Thank you


问:
Handling Nullable Json Response when using RESTFul Technical Profile
I am using the REST technical profile to retrieve data from a claims provider.

The JSON payload that is returned includes values that are optional for some users.

When the value is not set, it will be returned as the null literal

When the value is set, it will be returned as a string that contains an ISO 8601 formatted date time.

User Group 1 (well formed ISO 8601 string)

```<code>{
 "OptionalIso8601DateTime" : "2022-12-11T12:34:56Z"
}
</code>```

User Group 2 (null literal)

```<code>{
 "OptionalIso8601DateTime" : null
}
</code>```

AAD B2C appears to have two distinct behaviours when processing the JSON Payload of a REST endpoint (that are not configurable) which results the inability for a claims mapping to be defined that does not result in a server_error response being generated for one group of users.

Behaviours:

All strings that are determined to contain valid dateTime string literals are automatically cast to dateTime

as a result, a valid dateTime string literal can only be mapped to claims of type dateTime

The null literal value is automatically cast as a string - and populated with the empty string value

as a result, the null literal can only be mapped to claims of type string

I have attempted to define mappings using the string and dateTime data types, however neither is able to function for both user groups.

Observations:

AAD B2C Claim DataType
Payload Value
Result
Comment

string
null
""
null literal is converted to empty string

string
"2022-12-11T12:34:56Z"
AADB2C99072
dateTime cannot be converted to string

dateTime
null
AADB2C99072
string cannot be converted to dateTime

dateTime
"2022-12-11T12:34:56Z"
1670762096
value emitted as number (unix epoch) as per default OpenId Jwt Issuance Policy

I have no control over the format of the payload that is returned by the external system. Ideally, they would omit the claim in the event that there is no value, however returning the null literal is valid according to the Json specification.

I am looking for a mechanism to be able to map the data (specifically the case where the value is not null) as a valid dateTime so that it can be passed to downstream applications - that does not result in authentication failing with error AADB2C99072 for one set of users.

Ideally, if there were some way to configure AAD B2C to ignore null values (treat them as absent from the payload), or for the null to be preserved so that there is not an error when the empty string is set as the value of the dateTime claim.

Body:
I am using the REST technical profile to retrieve data from a claims provider.

The JSON payload that is returned includes values that are optional for some users.

When the value is not set, it will be returned as the null literal

When the value is set, it will be returned as a string that contains an ISO 8601 formatted date time.

User Group 1 (well formed ISO 8601 string)

{
 "OptionalIso8601DateTime" : "2022-12-11T12:34:56Z"
}

User Group 2 (null literal)

{
 "OptionalIso8601DateTime" : null
}

AAD B2C appears to have two distinct behaviours when processing the JSON Payload of a REST endpoint (that are not configurable) which results the inability for a claims mapping to be defined that does not result in a server_error response being generated for one group of users.

Behaviours:

All strings that are determined to contain valid dateTime string literals are automatically cast to dateTime

as a result, a valid dateTime string literal can only be mapped to claims of type dateTime

The null literal value is automatically cast as a string - and populated with the empty string value

as a result, the null literal can only be mapped to claims of type string

I have attempted to define mappings using the string and dateTime data types, however neither is able to function for both user groups.

Observations:

AAD B2C Claim DataType
Payload Value
Result
Comment

string
null
""
null literal is converted to empty string

string
"2022-12-11T12:34:56Z"
AADB2C99072
dateTime cannot be converted to string

dateTime
null
AADB2C99072
string cannot be converted to dateTime

dateTime
"2022-12-11T12:34:56Z"
1670762096
value emitted as number (unix epoch) as per default OpenId Jwt Issuance Policy

I have no control over the format of the payload that is returned by the external system. Ideally, they would omit the claim in the event that there is no value, however returning the null literal is valid according to the Json specification.

I am looking for a mechanism to be able to map the data (specifically the case where the value is not null) as a valid dateTime so that it can be passed to downstream applications - that does not result in authentication failing with error AADB2C99072 for one set of users.

Ideally, if there were some way to configure AAD B2C to ignore null values (treat them as absent from the payload), or for the null to be preserved so that there is not an error when the empty string is set as the value of the dateTime claim.


问:
I am not able to add drop shadow to elementor
I am adding drop shadow to a page on elementor. While editing the page drop shadow would show up, but when I update it the drop shadow disappears. This happens on the complete page. I tried adding custom css also.</p>
```<code>.box .elementor-widget-container
{
    box-shadow: 1px 4px 21px -5px rgba(0,0,0,0.75);
    z-index: 10;
    position: relative;
}
</code>```

Body:
I am adding drop shadow to a page on elementor. While editing the page drop shadow would show up, but when I update it the drop shadow disappears. This happens on the complete page. I tried adding custom css also.

.box .elementor-widget-container
{
    box-shadow: 1px 4px 21px -5px rgba(0,0,0,0.75);
    z-index: 10;
    position: relative;
}


问:
How to update a Type 2 Dimension using MERGE, a Snowflake Stream and a hash key?
I am attempting to create a Type 2 dimension using streams within snowflake.  I have a very wide table (800 columns [dont ask]), and do not need to track every change on the table as streams functionality does.  This table also doesn't capture last updated date correctly [don't ask], so a hash is needed to truly capture history without duplicate capture.

Is there a way to format the Snowflake Merge Statement to INSERT where the record does not exist and UPDATE the old record with a closed date based on the change key (hash).  But also to only perform an an UPDATE the current record in place where the Change Key (Hash) matches?

The following code throws an error when I try to update a field that is outside of the change key (hash).  I understand that there is a WHEN MATCHED collision on both, but I am trying to find an easy enough work around.

I find it hard to believe we can only track changes on an entire table, and not utilize a change key (hash) to control our updates.

```<code>

```
CREATE OR REPLACE TABLE customer_dim(
    cust_id NUMBER(38,0) NOT NULL
    , C_NAME VARCHAR(25)
    , C_PHONE VARCHAR(15)
    , C_ACTIVE VARCHAR(1)
    , CREATED_TS TIMESTAMP_LTZ DEFAULT CURRENT_TIMESTAMP
    , row_st_dt timestamp_ltz
    , row_end_dt timestamp_ltz
    , cur_row_ind varchar(1)
    , hashkey varchar()
);

MERGE INTO CUSTOMER_DIM C
    USING (SELECT * FROM CUSTOMER_RAW_STREAM_DIM) CS
    ON C.CUST_ID = CS.CUST_ID
        AND C.hashkey = CS.hashkey
        AND C.CUR_ROW_IND = 'Y'

    WHEN NOT MATCHED AND CS.METADATA$ACTION = 'INSERT'  THEN
        INSERT(CUST_ID, C_NAME, C_PHONE, ROW_ST_DT, ROW_END_DT, CUR_ROW_IND, C_ACTIVE)
        VALUES(CS.CUST_ID, CS.C_NAME, CS.C_PHONE, current_timestamp, CURRENT_TIMESTAMP, 'Y', CS.C_ACTIVE)

    WHEN MATCHED AND CS.METADATA$ACTION = 'DELETE'   THEN
        UPDATE
            SET CUR_ROW_IND = 'N'
            , ROW_END_DT = CURRENT_TIMESTAMP

        WHEN MATCHED AND CS.METADATA$ACTION = 'INSERT'   THEN
        UPDATE
            SET C_ACTIVE = CS.C_ACTIVE

```
`
</code>```

Body:
I am attempting to create a Type 2 dimension using streams within snowflake.  I have a very wide table (800 columns [dont ask]), and do not need to track every change on the table as streams functionality does.  This table also doesn't capture last updated date correctly [don't ask], so a hash is needed to truly capture history without duplicate capture.

Is there a way to format the Snowflake Merge Statement to INSERT where the record does not exist and UPDATE the old record with a closed date based on the change key (hash).  But also to only perform an an UPDATE the current record in place where the Change Key (Hash) matches?

The following code throws an error when I try to update a field that is outside of the change key (hash).  I understand that there is a WHEN MATCHED collision on both, but I am trying to find an easy enough work around.

I find it hard to believe we can only track changes on an entire table, and not utilize a change key (hash) to control our updates.

```
CREATE OR REPLACE TABLE customer_dim(
    cust_id NUMBER(38,0) NOT NULL
    , C_NAME VARCHAR(25)
    , C_PHONE VARCHAR(15)
    , C_ACTIVE VARCHAR(1)
    , CREATED_TS TIMESTAMP_LTZ DEFAULT CURRENT_TIMESTAMP
    , row_st_dt timestamp_ltz
    , row_end_dt timestamp_ltz
    , cur_row_ind varchar(1)
    , hashkey varchar()
);

MERGE INTO CUSTOMER_DIM C
    USING (SELECT * FROM CUSTOMER_RAW_STREAM_DIM) CS
    ON C.CUST_ID = CS.CUST_ID
        AND C.hashkey = CS.hashkey
        AND C.CUR_ROW_IND = 'Y'

    WHEN NOT MATCHED AND CS.METADATA$ACTION = 'INSERT'  THEN
        INSERT(CUST_ID, C_NAME, C_PHONE, ROW_ST_DT, ROW_END_DT, CUR_ROW_IND, C_ACTIVE)
        VALUES(CS.CUST_ID, CS.C_NAME, CS.C_PHONE, current_timestamp, CURRENT_TIMESTAMP, 'Y', CS.C_ACTIVE)

    WHEN MATCHED AND CS.METADATA$ACTION = 'DELETE'   THEN
        UPDATE
            SET CUR_ROW_IND = 'N'
            , ROW_END_DT = CURRENT_TIMESTAMP

        WHEN MATCHED AND CS.METADATA$ACTION = 'INSERT'   THEN
        UPDATE
            SET C_ACTIVE = CS.C_ACTIVE

```
`


问:
Locking selection in QTableView/QTreeView
Is it possible to "lock" selection in QAbstractView?

I have a form with:

A list of objects I can edit (QTableView).
Objects are stored in a database, the list shows their ID.

A New button, whose effect is to append an empty row I can edit to create a new ID and enable controls in the rest of the form.

An Edit button whose effect is to enable the edition of the rest of the form, but leaves the ID non editable.

Everything is driven by a state machine. There are parallel states but for the sake of this question, only transition between a Viewing state and an Editing state is relevant. Clicking either button enters the Editing state, which means testing if I am in the Editing state provides no information about whether I clicked on New or on Edit.

I am trying to lock the selection when entering the Editing state.

I cannot simply disable the view because I need to edit new IDs, I cannot connect a slot to the selectionChanged signal to restore the selection because of side effects (calls to the database + focus going all over the place), and if possible, I wish to avoid having to call QAbstractItemView::setSelectionModel (it is reset by QAbstractItemView::setModel, see below) and wish to drive this behavior thanks only to the Viewing and Editing states.

I have tried to use, but to no avail:

QAbstractItemModel::flags (the best I can do is prevent selecting another item but not clearing the selection.)

QAbstractItemView::selectionMode

QItemSelectionModel::select, with QItemSelectionModel::SelectionFlag::NoUpdate (The description of this enum value made me think it could block the next selection change but that is not the case).

Subclassing QItemSelectionModel (@chehrlic's comment below) to override all the virtual public slots.
While it does work (a property can be used to stop the selection from changing), it is a pain that QAbstractItemView::setModel creates a new model. It does work now but I do not see any easy way to prevent the code from breaking after accumulating code changes over the span of several years.

Did I miss any existing property to achieve this? And if I did not, how can I implement a property to lock the selection but no have any other effect on my view?

At this point, the last item in the above list of things I tried does do the job but it has a downside I am trying to avoid.

This is similar to this question except it was for a now old version of Qt and the answer is not very satisfying anyway.


问:
Is returning an integer literal by reference UB?
```<code>const int& foo() {
  return 42;
}

int main() {
  foo();
}
</code>```

Does this code have UB? Or I need to access the reference to trigger it?

Body:
const int& foo() {
  return 42;
}

int main() {
  foo();
}

Does this code have UB? Or I need to access the reference to trigger it?


问:
Eclipse Syntax Coloring : How to change the Query Parameter color with colon
As we all know we can customize the color for different Java aspects in Syxtax Coloring option in Eclipse.

What I am trying is to find out some way by which we can change the color of the Query Parameter inside the native query string.

For example :

```<code>@Query(nativeQuery = true, value = "SELECT * from Employee WHERE id = :empId;")
Employee fetchEmployeDetails(@Param("empId") empId)
</code>```

I can change the method parameter color, but unable to change it inside the blue query string. I want to know is there any way out to change the color for this part inside the query string : :empId

As everything is in blue for a String, I find it difficult to recognize what are my query parameters that I am passing dynamically, as I have very long query and multiple inputs.

Body:
As we all know we can customize the color for different Java aspects in Syxtax Coloring option in Eclipse.

What I am trying is to find out some way by which we can change the color of the Query Parameter inside the native query string.

For example :

@Query(nativeQuery = true, value = "SELECT * from Employee WHERE id = :empId;")
Employee fetchEmployeDetails(@Param("empId") empId)

I can change the method parameter color, but unable to change it inside the blue query string. I want to know is there any way out to change the color for this part inside the query string : :empId

As everything is in blue for a String, I find it difficult to recognize what are my query parameters that I am passing dynamically, as I have very long query and multiple inputs.


问:
terraform public key & private key adding error as well as file not upload in the instance
```<code>
resource "aws_instance" "dove-web" {
  ami                    = var.AMIS[var.REGION]
  instance_type          = "t2.micro"
  subnet_id              = aws_subnet.dove-pub-1.id
  key_name               = aws_key_pair.rsa.key_name
  vpc_security_group_ids = [aws_security_group.dove_stack_sg.id]
  tags = {
    Name = "cool"
  }

  provisioner "file" {
    source      = "web.sh"
    destination = "/home/ubuntu/web.sh"
  }
  provisioner "remote-exec" {

    inline = [
      "chmod +x /home/ubuntu/web.sh",
      "sudo /home/ubuntu/web.sh"
    ]
  }

  # privat key
  resource "tls_private_key" "rsa" {
    algorithm = "RSA"
    rsa_bits  = 4096
  }
  # public key
  resource "aws_key_pair" "rsa" {
    key_name   = var.PUB_key
    public_key = tls_private_key.rsa.public_key_openssh

    provisioner "local-exec" { # Generate "terraform-key-pair.pem" in current directory
      command = <<-EOT
      echo '${tls_private_key.rsa.private_key_pem}' > ./'${var.PUB_key}'.pem
      chmod 400 ./'${var.PUB_key}'.pem
    EOT
    }
  }

  # store key localy
  /*resource "local_file" "TF-key" {
    content  = tls_private_key.rsa.private_key_pem
    filename = "tfkey"
  }
 */
}

output "PublicIP" {
  value = aws_instance.dove-web.public_ip
}

</code>```
```<code>$ terraform validate
╷
│ Error: Reference to undeclared resource
│
│   on instance.tf line 6, in resource "aws_instance" "dove-web":
│    6:   key_name               = aws_key_pair.rsa.key_name
│
│ A managed resource "aws_key_pair" "rsa" has not been declared in the root module.
</code>```

Body:
resource "aws_instance" "dove-web" {
  ami                    = var.AMIS[var.REGION]
  instance_type          = "t2.micro"
  subnet_id              = aws_subnet.dove-pub-1.id
  key_name               = aws_key_pair.rsa.key_name
  vpc_security_group_ids = [aws_security_group.dove_stack_sg.id]
  tags = {
    Name = "cool"
  }

  provisioner "file" {
    source      = "web.sh"
    destination = "/home/ubuntu/web.sh"
  }
  provisioner "remote-exec" {

    inline = [
      "chmod +x /home/ubuntu/web.sh",
      "sudo /home/ubuntu/web.sh"
    ]
  }

  # privat key
  resource "tls_private_key" "rsa" {
    algorithm = "RSA"
    rsa_bits  = 4096
  }
  # public key
  resource "aws_key_pair" "rsa" {
    key_name   = var.PUB_key
    public_key = tls_private_key.rsa.public_key_openssh

    provisioner "local-exec" { # Generate "terraform-key-pair.pem" in current directory
      command = <<-EOT
      echo '${tls_private_key.rsa.private_key_pem}' > ./'${var.PUB_key}'.pem
      chmod 400 ./'${var.PUB_key}'.pem
    EOT
    }
  }

  # store key localy
  /*resource "local_file" "TF-key" {
    content  = tls_private_key.rsa.private_key_pem
    filename = "tfkey"
  }
 */
}

output "PublicIP" {
  value = aws_instance.dove-web.public_ip
}

$ terraform validate
╷
│ Error: Reference to undeclared resource
│
│   on instance.tf line 6, in resource "aws_instance" "dove-web":
│    6:   key_name               = aws_key_pair.rsa.key_name
│
│ A managed resource "aws_key_pair" "rsa" has not been declared in the root module.


问:
Unable to set gain in Mindvision camera
The Mindvision camera application shows gain can be set in float. When I try to set the gain programmatically, the function call only provides an option to set the gain in an integer.

The following call is available in the file CamerApi.h

MVSDK_API CameraSdkStatus __stdcall CameraSetGain(
CameraHandle    hCamera,
int             iRGain,
int             iGGain,
int             iBGain
);

I am using the VC++ examples to run the application.
Any option to set the gain in floating value?

Title: Unable to set gain in Mindvision camera