问:
How do I access data in "int20_t"?
I got a lot of memory pieces in 512 bits. I need to write numbers in 20 bits.

For example:

```<code>// a piece of 512 bits memory
void *p = malloc(64);

struct Coords {
  int20_t x, y;
};

// usage
Coords *pcoord = (Coords *)p;

for (int i = 0; i < 512 / 40/*sizeof(Coords)*/; ++i) {
  pcoord[i].x = i;
  pcoord[i].y = 2 * i;
}
</code>```

How to implement int20_t ?

I need exactly 20 bits for an integer. The numbers must be continuous.
( [0]  to [19] for the first Coords.x;
[20] to [39] for the first Coords.y;
...
There are 12 pairs of Coords with 480 bits and 32 bits for the pad.)

答:
The type int20_t is only available on very specific hardware with 20 bit registers. You do not need this type to handle your data, you can either use plain int to store the coordinates or possibly use bit-fields but it does not seems necessary.

The main issue is the conversion from the external representation (12 packed pairs of 20 bit values in a 512 bit block) to a more manageable in memory representation as an array of structures, and possibly the other way around.

To handle this conversion, you must specify precisely how the bits are packed in the 64 byte block. Each value will be split in 3 parts, the order of these bytes and bits inside the last byte bytes must be specified.

Here is an example where values are stored in big endian format with the third byte containing the low order bits of x in its high order bits and the high order bits of y in its low order bits:

```<code>struct Coords {
    int x, y;
};

void load_coords(struct Coords *a, const unsigned char *p) {
    for (int i = 0; i < 20; i++) {
        a->x = (p[0] << 12) + (p[1] << 4) + (p[2] >> 4);
        a->y = ((p[2] & 15) << 16) + (p[3] << 8) + p[4];
        p += 5;
        a++;
    }
}

void store_coords(unsigned char *p, const struct Coords *a) {
    for (int i = 0; i < 20; i++) {
        p[0] = a->x >> 12;
        p[1] = a->x >> 4;
        p[2] = (a->x << 4) | ((a->y >> 16) & 15);
        p[3] = a->y >> 8;
        p[4] = a->y;
        p += 5;
        a++;
    }
}
</code>```

Title: How do I access data in "int20_t"?

Body:
I got a lot of memory pieces in 512 bits. I need to write numbers in 20 bits.

For example:

// a piece of 512 bits memory
void *p = malloc(64);

struct Coords {
  int20_t x, y;
};

// usage
Coords *pcoord = (Coords *)p;

for (int i = 0; i < 512 / 40/*sizeof(Coords)*/; ++i) {
  pcoord[i].x = i;
  pcoord[i].y = 2 * i;
}

How to implement int20_t ?

I need exactly 20 bits for an integer. The numbers must be continuous.
( [0]  to [19] for the first Coords.x;
[20] to [39] for the first Coords.y;
...
There are 12 pairs of Coords with 480 bits and 32 bits for the pad.)

Body:
The type int20_t is only available on very specific hardware with 20 bit registers. You do not need this type to handle your data, you can either use plain int to store the coordinates or possibly use bit-fields but it does not seems necessary.

The main issue is the conversion from the external representation (12 packed pairs of 20 bit values in a 512 bit block) to a more manageable in memory representation as an array of structures, and possibly the other way around.

To handle this conversion, you must specify precisely how the bits are packed in the 64 byte block. Each value will be split in 3 parts, the order of these bytes and bits inside the last byte bytes must be specified.

Here is an example where values are stored in big endian format with the third byte containing the low order bits of x in its high order bits and the high order bits of y in its low order bits:

struct Coords {
    int x, y;
};

void load_coords(struct Coords *a, const unsigned char *p) {
    for (int i = 0; i < 20; i++) {
        a->x = (p[0] << 12) + (p[1] << 4) + (p[2] >> 4);
        a->y = ((p[2] & 15) << 16) + (p[3] << 8) + p[4];
        p += 5;
        a++;
    }
}

void store_coords(unsigned char *p, const struct Coords *a) {
    for (int i = 0; i < 20; i++) {
        p[0] = a->x >> 12;
        p[1] = a->x >> 4;
        p[2] = (a->x << 4) | ((a->y >> 16) & 15);
        p[3] = a->y >> 8;
        p[4] = a->y;
        p += 5;
        a++;
    }
}


来源: stackexchange

问:
Variable not working when an integer works fine in Gravity Forms GFAPI::get_entries filter
I am trying to understand why a variable that contains an integer cannot but used to replace the integer in GFAPI::get_entries field_filters value.
This works:

```<code>$search_criteria = array(
'status'        => 'active',
'field_filters' => array(
'mode' => 'any',
    array(
        'key'   => 'gpnf_entry_parent',
        'value' => '72'
    )
)
);
</code>```

This does not work:

```<code>$child_entry_ID = "{entry_id}";
</code>```

where $child_entry_ID is 72. Of course

```<code>echo $child_entry_ID . "<br />";
</code>```

prints "72"

```<code>$search_criteria = array(
'status'        => 'active',
'field_filters' => array(
    'mode' => 'any',
    array(
        'key'   => 'gpnf_entry_parent',
        'value' => $child_entry_ID
    )
)
);
</code>```

I use it like this

```<code>$entry2 = GFAPI::get_entries(33, $search_criteria);
print_r($entry2);
</code>```

In the case that works, my arrays print correctly, in the case that doesn't work, I get "Array().

答:
I know this is old, but shouldn't

```<code>$child_entry_ID = "{entry_id}";
</code>```

Actually be:

```<code>$child_entry_ID = "{$entry_id}";
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am trying to understand why a variable that contains an integer cannot but used to replace the integer in GFAPI::get_entries field_filters value.
This works:

$search_criteria = array(
'status'        => 'active',
'field_filters' => array(
'mode' => 'any',
    array(
        'key'   => 'gpnf_entry_parent',
        'value' => '72'
    )
)
);

This does not work:

$child_entry_ID = "{entry_id}";

where $child_entry_ID is 72. Of course

echo $child_entry_ID . "
";

prints "72"

$search_criteria = array(
'status'        => 'active',
'field_filters' => array(
    'mode' => 'any',
    array(
        'key'   => 'gpnf_entry_parent',
        'value' => $child_entry_ID
    )
)
);

I use it like this

$entry2 = GFAPI::get_entries(33, $search_criteria);
print_r($entry2);

In the case that works, my arrays print correctly, in the case that doesn't work, I get "Array().

Body:
I know this is old, but shouldn't

$child_entry_ID = "{entry_id}";

Actually be:

$child_entry_ID = "{$entry_id}";


问:
Eclipse giving error while building project - java.lang.IllegalArgumentException: Malformed \uxxxx encoding
error message while building project

Getting below error in eclipse 2021-12 while building project

```<code>Errors occurred during the build.
    Errors running builder 'Java Builder' on project 'xxx'.
    Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @536d97f8
    Errors running builder 'Maven Project Builder' on project 'xxx'.
    java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
</code>```

I am using JDK 1.8

I tried deleting project, restarting eclipse and also re-installing JDK.

I tried adding below VM arguments but not worked

enter image description here

EDIT:

I see lombok is causing this issue

-(Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @536d97f8
Errors running builder 'Maven Project Builder' on project 'xxx'.)

After installing lombok to eclipse IDE the issue got resolved.

But still I am getting below error while building - java.lang.IllegalArgumentException: Malformed \uxxxx encoding.

enter image description here

I see answers for same error but its the issue with Ant and its giving error for maven.
I don't see any path where "\" is used in project/POM.
Ant: Malformed \uxxxx encoding in propertyfile task

EDIT 2:

```<code>java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
</code>```

Above issue resolved after following below solution (it has step to step guide to fix the error)
Solution

Body:
error message while building project

Getting below error in eclipse 2021-12 while building project

Errors occurred during the build.
    Errors running builder 'Java Builder' on project 'xxx'.
    Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @536d97f8
    Errors running builder 'Maven Project Builder' on project 'xxx'.
    java.lang.IllegalArgumentException: Malformed \uxxxx encoding.

I am using JDK 1.8

I tried deleting project, restarting eclipse and also re-installing JDK.

I tried adding below VM arguments but not worked

enter image description here

EDIT:

I see lombok is causing this issue

-(Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @536d97f8
Errors running builder 'Maven Project Builder' on project 'xxx'.)

After installing lombok to eclipse IDE the issue got resolved.

But still I am getting below error while building - java.lang.IllegalArgumentException: Malformed \uxxxx encoding.

enter image description here

I see answers for same error but its the issue with Ant and its giving error for maven.
I don't see any path where "\" is used in project/POM.
Ant: Malformed \uxxxx encoding in propertyfile task

EDIT 2:

java.lang.IllegalArgumentException: Malformed \uxxxx encoding.

Above issue resolved after following below solution (it has step to step guide to fix the error)
Solution


问:
Enable systemd service in Yocto
I am trying to enable a systemd service automatically after successful boot of my STM32MP1 based Avnger96 board. I am using Yocto Project as build system with Ubuntu 20.04. My image recipe to enable systemd service is example-systemd.bb:

```<code>.
.
inherit systemd

SRC_URI = "file://example.sh \
           file://example.service \
          "

S = "${WORKDIR}"

SYSTEMD_AUTO_ENABLE_${PN} = "enable"
SYSTEMD_PACKAGES = "${PN}"

SYSTEMD_SERVICE_${PN} = "example.service"

do_install_append() {

    install -d 644 ${D}${sysconfdir}/init.d
    install -m 0755 ${WORKDIR}/example.sh ${D}${sysconfdir}/init.d

    install -d ${D}${systemd_system_unitdir}
    install -m 0644 ${WORKDIR}/example.service ${D}${systemd_system_unitdir}
}

FILES_${PN} += "${sysconfdir}/init.d"
FILES_${PN} += "${systemd_system_unitdir}/example.service"

REQUIRED_DISTRO_FEATURES= " systemd"
</code>```

And included in my main image in local.conf with IMAGE_INSTALL_append = " example-systemd"

After building the image, bitbake -e (YOUR_IMAGE) | grep ^DISTRO_FEATURES= shows systemd.

But in my rootfs I can't find systemd/system directory with above service file. And also when I run systemctl status example I get the error -sh: systemctl: command not found.

Update

After including DISTRO_FEATURES_append= " systemd" in the example-service.bb, in the rootfs etc/systemd/system/multi-user.target.wants/ is created and it contains example.service file. But doing cat example.service results in cat: example.service: No such file or directory. Is this expected?

Can anyone please let me know how to run this service with systemd and how to check if service is installed and executed from linux user space?

And also I have one more doubt: Can both Systemd and Sysvinit exist together and some services are run by systemd and others by sysvinit?

Your help will be much appreciated.

Thanks in advance.

P.S: Please let me know if any info is missing here

答:
Your project might still use systemv or something else as init manager instead of systemd.

You can enable systemd by adding these lines to your local.conf:

```<code>DISTRO_FEATURES_append = " systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
VIRTUAL-RUNTIME_init_manager = "systemd"
VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
</code>```

Title: Enable systemd service in Yocto

Body:
I am trying to enable a systemd service automatically after successful boot of my STM32MP1 based Avnger96 board. I am using Yocto Project as build system with Ubuntu 20.04. My image recipe to enable systemd service is example-systemd.bb:

.
.
inherit systemd

SRC_URI = "file://example.sh \
           file://example.service \
          "

S = "${WORKDIR}"

SYSTEMD_AUTO_ENABLE_${PN} = "enable"
SYSTEMD_PACKAGES = "${PN}"

SYSTEMD_SERVICE_${PN} = "example.service"

do_install_append() {

    install -d 644 ${D}${sysconfdir}/init.d
    install -m 0755 ${WORKDIR}/example.sh ${D}${sysconfdir}/init.d

    install -d ${D}${systemd_system_unitdir}
    install -m 0644 ${WORKDIR}/example.service ${D}${systemd_system_unitdir}
}

FILES_${PN} += "${sysconfdir}/init.d"
FILES_${PN} += "${systemd_system_unitdir}/example.service"

REQUIRED_DISTRO_FEATURES= " systemd"

And included in my main image in local.conf with IMAGE_INSTALL_append = " example-systemd"

After building the image, bitbake -e (YOUR_IMAGE) | grep ^DISTRO_FEATURES= shows systemd.

But in my rootfs I can't find systemd/system directory with above service file. And also when I run systemctl status example I get the error -sh: systemctl: command not found.

Update

After including DISTRO_FEATURES_append= " systemd" in the example-service.bb, in the rootfs etc/systemd/system/multi-user.target.wants/ is created and it contains example.service file. But doing cat example.service results in cat: example.service: No such file or directory. Is this expected?

Can anyone please let me know how to run this service with systemd and how to check if service is installed and executed from linux user space?

And also I have one more doubt: Can both Systemd and Sysvinit exist together and some services are run by systemd and others by sysvinit?

Your help will be much appreciated.

Thanks in advance.

P.S: Please let me know if any info is missing here

Body:
Your project might still use systemv or something else as init manager instead of systemd.

You can enable systemd by adding these lines to your local.conf:

DISTRO_FEATURES_append = " systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
VIRTUAL-RUNTIME_init_manager = "systemd"
VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"


问:
TextInputLayout hint not working when using databinding
I am using databinding together with the TextInputLayout/TextInputEditText combo as shown in the xml.

```<code><com.google.android.material.textfield.TextInputLayout
                android:id="@+id/lastname_input_layout"
                style="@style/TextInputLayout"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:endIconMode="clear_text"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/firstname_input_layout"
                app:visible="@{viewModel.showFields}">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/lastname_input"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/lastname"
                    android:inputType="textCapWords"
                    android:text="@={viewModel.lastName}"
                    android:textAppearance="@style/TextAppearance.Input" />

            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/email_input_layout"
                style="@style/TextInputLayout"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:endIconMode="clear_text"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/lastname_input_layout"
                app:visible="@{viewModel.showFields}">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/email_input"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@{viewModel.watchMediaTextHint}"
                    android:inputType="@{viewModel.watchMediaInputType}"
                    android:text="@={viewModel.mediaText}"
                    android:textAppearance="@style/TextAppearance.Input" />

            </com.google.android.material.textfield.TextInputLayout>
</code>```

As you can see, both fields are theoretically the same, the only difference is that one of them has the hint text given with a string resource, the other one with a databinding. Both have the same style, text appearance and so on, yet, the hint on the TextInputEditText using the databinding has different color. Also, when the view gets focus, the label doesn't animate up, as it does with the first field.

Setting the hint with a string resource gets this behavior to go back to normal, any ideas on why is this anomaly happening? I would prefer to solve this with a databinding rather than a programmatic solution.

Thanks.

答:
The hint attribute only works in combination with databinding, if it is set to <TextInputLayout> instead of <TextInputEditText>.

The <TextInputEditText>s hint attribute is only applied once during inflation and thereby will not be updated/applied when used in combination with databinding.

Heads up for @Mike M.'s comment. I converted it as an answer, in order to be found more easily by others.

Body:
I am using databinding together with the TextInputLayout/TextInputEditText combo as shown in the xml.

<com.google.android.material.textfield.TextInputLayout
                android:id="@+id/lastname_input_layout"
                style="@style/TextInputLayout"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:endIconMode="clear_text"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/firstname_input_layout"
                app:visible="@{viewModel.showFields}">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/lastname_input"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/lastname"
                    android:inputType="textCapWords"
                    android:text="@={viewModel.lastName}"
                    android:textAppearance="@style/TextAppearance.Input" />

            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/email_input_layout"
                style="@style/TextInputLayout"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:endIconMode="clear_text"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/lastname_input_layout"
                app:visible="@{viewModel.showFields}">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/email_input"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@{viewModel.watchMediaTextHint}"
                    android:inputType="@{viewModel.watchMediaInputType}"
                    android:text="@={viewModel.mediaText}"
                    android:textAppearance="@style/TextAppearance.Input" />

            </com.google.android.material.textfield.TextInputLayout>

As you can see, both fields are theoretically the same, the only difference is that one of them has the hint text given with a string resource, the other one with a databinding. Both have the same style, text appearance and so on, yet, the hint on the TextInputEditText using the databinding has different color. Also, when the view gets focus, the label doesn't animate up, as it does with the first field.

Setting the hint with a string resource gets this behavior to go back to normal, any ideas on why is this anomaly happening? I would prefer to solve this with a databinding rather than a programmatic solution.

Thanks.


问:
How to use external javascript and CSS library in Angular13 project
I have just used Angular 13 and I want to use my external CSS and javascript library but I tried all the way, like => write path and active that in the angular.json but it doesn't work for me.
I just want to know what should I do to use my libraries.</p>

答:
I find the best way to include styles in multi-components.
In your component, you just need to change the styleUrls to what you want...
for example, I have a style.css file in my assets folder...

So I want to use style.css in my app.component, So I change the  styleUrls: ['./app.component.scss'] value like this styleUrls: ['../assets/Css/style.css'].

Note: .. make your position file to downer E.g: your component in src/app/home/home.component.cs and you want to connect with your assets file so you need to use the file path like this ../../assets/Css/style.css.

If you active your style.css (which you want to use in one of your components) in angular.json, the style.css active for all your components and make their style change!


问:
CSS z-index issue
Here is the fiddle: http://jsfiddle.net/6Lk4s/

```<code><div class="box">
    <div class="c1"></div>
    <div class="c2"></div>
</div>
</code>```

I try to display .c1 and .c2 behind .box (so box has a higher z-index and all three classes have position:relative set), but I can't get it to show up this way.

What is my error?

答:
Your problem is that .box is the parent element to .c2

If you still wanted to go with having that .box area to restrict .c2 positioning, you could do it like this.

http://jsfiddle.net/6Lk4s/2/

http://jsfiddle.net/6Lk4s/3/ - Another example to show that .c2 positioning is restricted by the outer box rather than document.

HTML:

```<code><div class="outerbox">

    <div class="box">
        <div class="c1"> </div>
    </div>
        <div class="c2"> </div>

</div>
</code>```

Added CSS:

```<code>.outerbox { position: relative; float: left; }
</code>```

ContentLicense: CC BY-SA 3.0

Title: CSS z-index issue

Body:
Here is the fiddle: http://jsfiddle.net/6Lk4s/

I try to display .c1 and .c2 behind .box (so box has a higher z-index and all three classes have position:relative set), but I can't get it to show up this way.

What is my error?

Body:
Your problem is that .box is the parent element to .c2

If you still wanted to go with having that .box area to restrict .c2 positioning, you could do it like this.

http://jsfiddle.net/6Lk4s/2/

http://jsfiddle.net/6Lk4s/3/ - Another example to show that .c2 positioning is restricted by the outer box rather than document.

HTML:

<div class="outerbox">

    <div class="box">
        <div class="c1"> </div>
    </div>
        <div class="c2"> </div>

</div>

Added CSS:

.outerbox { position: relative; float: left; }


问:
ModuleNotFoundError: No module named 'copier'
Goal: to run program with copier dependency.

pip install copier:

```<code>me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager/pwmf/cli$ pip install copier
cd .Defaulting to user installation because normal site-packages is not writeable
.Requirement already satisfied: copier in /home/me/.local/lib/python3.8/site-packages (5.1.0)
/Requirement already satisfied: colorama<0.5.0,>=0.4.3 in /usr/lib/python3/dist-packages (from copier) (0.4.3)
Requirement already satisfied: plumbum<2.0.0,>=1.6.9 in /home/me/.local/lib/python3.8/site-packages (from copier) (1.7.2)
Requirement already satisfied: pyyaml<6.0.0,>=5.3.1 in /usr/lib/python3/dist-packages (from copier) (5.3.1)
Requirement already satisfied: regex<2021.0.0,>=2020.6.8 in /home/me/.local/lib/python3.8/site-packages (from copier) (2020.11.13)
Requirement already satisfied: pydantic<2.0.0,>=1.5.1 in /home/me/.local/lib/python3.8/site-packages (from copier) (1.9.0)
Requirement already satisfied: jinja2<3.0.0,>=2.11.2 in /home/me/.local/lib/python3.8/site-packages (from copier) (2.11.3)
Requirement already satisfied: pathspec<0.9.0,>=0.8.0 in /home/me/.local/lib/python3.8/site-packages (from copier) (0.8.1)
Requirement already satisfied: pyyaml-include<2.0,>=1.2 in /home/me/.local/lib/python3.8/site-packages (from copier) (1.2.post2)
Requirement already satisfied: packaging<21.0,>=20.4 in /home/me/.local/lib/python3.8/site-packages (from copier) (20.9)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/lib/python3/dist-packages (from jinja2<3.0.0,>=2.11.2->copier) (1.1.0)
Requirement already satisfied: pyparsing>=2.0.2 in /home/me/.local/lib/python3.8/site-packages (from packaging<21.0,>=20.4->copier) (2.4.7)
Requirement already satisfied: typing-extensions>=3.7.4.3 in /home/me/.local/lib/python3.8/site-packages (from pydantic<2.0.0,>=1.5.1->copier) (4.0.1)
..WARNING: You are using pip version 21.3.1; however, version 22.0.3 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager/pwmf/cli$ cd ../../
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager$ poetry run python pwmf/cli/cli.py  new-worker -n experiment_worker -o ../../workers-python/workers/ -t basic_worker
Traceback (most recent call last):
  File "pwmf/cli/cli.py", line 8, in <module>
    from copier import copy
ModuleNotFoundError: No module named 'copier'
</code>```

poetry add copier:

```<code>me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager$ poetry add copier
The following packages are already present in the pyproject.toml and will be skipped:

  • copier

If you want to update it to the latest compatible version, you can use `poetry update package`.
If you prefer to upgrade it to the latest available version, you can use `poetry add package@latest`.

Nothing to add.
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager$ poetry run python pwmf/cli/cli.py  new-worker -n experiment_worker -o ../../workers-python/workers/ -t basic_worker
Traceback (most recent call last):
  File "pwmf/cli/cli.py", line 8, in <module>
    from copier import copy
ModuleNotFoundError: No module named 'copier'
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager$
</code>```

poetry update copier:

```<code>me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager$ poetry update copier
Updating dependencies
Resolving dependencies... (1.6s)

  SSLError

  HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /pypi/dagster-aws/0.9.22.post0/json (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)')))

  at ~/.poetry/lib/poetry/_vendor/py3.8/requests/adapters.py:514 in send
      510│                 raise ProxyError(e, request=request)
      511│
      512│             if isinstance(e.reason, _SSLError):
      513│                 # This branch is for urllib3 v1.22 and later.
    → 514│                 raise SSLError(e, request=request)
      515│
      516│             raise ConnectionError(e, request=request)
      517│
      518│         except ClosedPoolError as e:
</code>```

poetry add copier@latest:

```<code>me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager$ poetry add copier@latest
Using version ^5.1.0 for copier

Updating dependencies
Resolving dependencies... (1241.3s)

Writing lock file

Package operations: 72 installs, 0 updates, 0 removals

  • Installing pymongo (3.12.0): Failed

  RuntimeError

  Invalid hashes (sha256:44a15fadb9c3f35c8d2af0acea375c7c4c45877c137934a8667d82f900951e36) for pymongo (3.12.0) using archive pymongo-3.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl. Expected one of sha256:02dc0b0f48ed3cd06c13b7e31b066bf91e00dac5f8147b0a0a45f9009bfab857, sha256:053b4ebf91c7395d1fcd2ce6a9edff0024575b7b2de6781554a4114448a8adc9, sha256:070a4ef689c9438a999ec3830e69b208ff0d12251846e064d947f97d819d1d05, sha256:072ba7cb65c8aa4d5c5659bf6722ee85781c9d7816dc00679b8b6f3dff1ddafc, sha256:0b6055e0ef451ff73c93d0348d122a0750dddf323b9361de5835dac2f6cf7fc1, sha256:11f9e0cfc84ade088a38df2708d0b958bb76360181df1b2e1e1a41beaa57952b, sha256:18290649759f9db660972442aa606f845c368db9b08c4c73770f6da14113569b, sha256:186104a94d39b8412f8e3de385acd990a628346a4402d4f3a288a82b8660bd22, sha256:1970cfe2aec1bf74b40cf30c130ad10cd968941694630386db33e1d044c22a2e, sha256:19d4bd0fc29aa405bb1781456c9cfff9fceabb68543741eb17234952dbc2bbb0, sha256:1bab889ae7640eba739f67fcbf8eff252dddc60d4495e6ddd3a87cd9a95fdb52, sha256:1bc6fe7279ff40c6818db002bf5284aa03ec181ea1b1ceaeee33c289d412afa7, sha256:208debdcf76ed39ebf24f38509f50dc1c100e31e8653817fedb8e1f867850a13, sha256:2399a85b54f68008e483b2871f4a458b4c980469c7fe921595ede073e4844f1e, sha256:246ec420e4c8744fceb4e259f906211b9c198e1f345e6158dcd7cbad3737e11e, sha256:24f8aeec4d6b894a6128844e50ff423dd02462ee83addf503c598ee3a80ddf3d, sha256:255a35bf29185f44b412e31a927d9dcedda7c2c380127ecc4fbf2f61b72fa978, sha256:2dbfbbded947a83a3dffc2bd1ec4750c17e40904692186e2c55a3ad314ca0222, sha256:2e92aa32300a0b5e4175caec7769f482b292769807024a86d674b3f19b8e3755, sha256:316c1b8723afa9870567cd6dff35d440b2afeda53aa13da6c5ab85f98ed6f5ca, sha256:333bfad77aa9cd11711febfb75eed0bb537a1d022e1c252714dad38993590240, sha256:39dafa2eaf577d1969f289dc9a44501859a1897eb45bd589e93ce843fc610800, sha256:3ce83f17f641a62a4dfb0ba1b8a3c1ced7c842f511b5450d90c030c7828e3693, sha256:46d5ec90276f71af3a29917b30f2aec2315a2759b5f8d45b3b63a07ca8a070a3, sha256:48d5bc80ab0af6b60c4163c5617f5cd23f2f880d7600940870ea5055816af024, sha256:4ba0def4abef058c0e5101e05e3d5266e6fffb9795bbf8be0fe912a7361a0209, sha256:5af390fa9faf56c93252dab09ea57cd020c9123aa921b63a0ed51832fdb492e7, sha256:5e574664f1468872cd40f74e4811e22b1aa4de9399d6bcfdf1ee6ea94c017fcf, sha256:625befa3bc9b40746a749115cc6a15bf20b9bd7597ca55d646205b479a2c99c7, sha256:6261bee7c5abadeac7497f8f1c43e521da78dd13b0a2439f526a7b0fc3788824, sha256:657ad80de8ec9ed656f28844efc801a0802961e8c6a85038d97ff6f555ef4919, sha256:6b89dc51206e4971c5568c797991eaaef5dc2a6118d67165858ad11752dba055, sha256:6e66780f14c2efaf989cd3ac613b03ee6a8e3a0ba7b96c0bb14adca71a427e55, sha256:6fb3f85870ae26896bb44e67db94045f2ebf00c5d41e6b66cdcbb5afd644fc18, sha256:701e08457183da70ed96b35a6b43e6ba1df0b47c837b063cde39a1fbe1aeda81, sha256:70761fd3c576b027eec882b43ee0a8e5b22ff9c20cdf4d0400e104bc29e53e34, sha256:73b400fdc22de84bae0dbf1a22613928a41612ec0a3d6ed47caf7ad4d3d0f2ff, sha256:7412a36798966624dc4c57d64aa43c2d1100b348abd98daaac8e99e57d87e1d7, sha256:78ecb8d42f50d393af912bfb1fb1dcc9aabe9967973efb49ee577e8f1cea494c, sha256:7c6a9948916a7bbcc6d3a9f6fb75db1acb5546078023bfb3db6efabcd5a67527, sha256:7c72d08acdf573455b2b9d2b75b8237654841d63a48bc2327dc102c6ee89b75a, sha256:7d98ce3c42921bb91566121b658e0d9d59a9082a9bd6f473190607ff25ab637f, sha256:845a8b83798b2fb11b09928413cb32692866bfbc28830a433d9fa4c8c3720dd0, sha256:94d38eba4d1b5eb3e6bfece0651b855a35c44f32fd91f512ab4ba41b8c0d3e66, sha256:9a13661681d17e43009bb3e85e837aa1ec5feeea1e3654682a01b8821940f8b3, sha256:a0e5dff6701fa615f165306e642709e1c1550d5b237c5a7a6ea299886828bd50, sha256:a2239556ff7241584ce57be1facf25081669bb457a9e5cbe68cce4aae6567aa1, sha256:a325600c83e61e3c9cebc0c2b1c8c4140fa887f789085075e8f44c8ff2547eb9, sha256:a3566acfbcde46911c52810374ecc0354fdb841284a3efef6ff7105bc007e9a8, sha256:a634a4730ce0b0934ed75e45beba730968e12b4dafbb22f69b3b2f616d9e644e, sha256:a6d055f01b83b1a4df8bb0c61983d3bdffa913764488910af3620e5c2450bf83, sha256:a752ecd1a26000a6d67be7c9a2e93801994a8b3f866ac95b672fbc00225ca91a, sha256:a9ba2a63777027b06b116e1ea8248e66fd1bedc2c644f93124b81a91ddbf6d88, sha256:aaa038eafb7186a4abbb311fcf20724be9363645882bbce540bef4797e812a7a, sha256:af586e85144023686fb0af09c8cdf672484ea182f352e7ceead3d832de381e1b, sha256:b0a0cf39f589e52d801fdef418305562bc030cdf8929217463c8433c65fd5c2f, sha256:b1c4874331ab960429caca81acb9d2932170d66d6d6f87e65dc4507a85aca152, sha256:b3b5b3cbc3fdf4fcfa292529df2a85b5d9c7053913a739d3069af1e12e12219f, sha256:b542d56ed1b8d5cf3bb36326f814bd2fbe8812dfd2582b80a15689ea433c0e35, sha256:b6ea08758b6673610b3c5bdf47189286cf9c58b1077558706a2f6f8744922527, sha256:b754240daafecd9d5fce426b0fbaaed03f4ebb130745c8a4ae9231fffb8d75e5, sha256:b772bab31cbd9cb911e41e1a611ebc9497f9a32a7348e2747c38210f75c00f41, sha256:b88d1742159bc93a078733f9789f563cef26f5e370eba810476a71aa98e5fbc2, sha256:b8bf42d3b32f586f4c9e37541769993783a534ad35531ce8a4379f6fa664fba9, sha256:bc9ac81e73573516070d24ce15da91281922811f385645df32bd3c8a45ab4684, sha256:c188db6cf9e14dbbb42f5254292be96f05374a35e7dfa087cc2140f0ff4f10f6, sha256:c55782a55f4a013a78ac5b6ee4b8731a192dea7ab09f1b6b3044c96d5128edd4, sha256:c5cab230e7cabdae9ff23c12271231283efefb944c1b79bed79a91beb65ba547, sha256:cbf8672edeb7b7128c4a939274801f0e32bbf5159987815e3d1eace625264a46, sha256:cc2894fe91f31a513860238ede69fe47fada21f9e7ddfe73f7f9fef93a971e41, sha256:cda9e628b1315beec8341e8c04aac9a0b910650b05e0751e42e399d5694aeacb, sha256:ceae3ab9e11a27aaab42878f1d203600dfd24f0e43678b47298219a0f10c0d30, sha256:ced944dcdd561476deef7cb7bfd4987c69fffbfeff6d02ca4d5d4fd592d559b7, sha256:d04ca462cb99077e6c059e97c072957caf2918e6e4191e3161c01c439e0193de, sha256:d1131562ddc2ea8a446f66c2648d7dabec2b3816fc818528eb978a75a6d23b2e, sha256:d1740776b70367277323fafb76bcf09753a5cc9824f5d705bac22a34ff3668ea, sha256:d6e11ffd43184d529d6752d6dcb62b994f903038a17ea2168ef1910c96324d26, sha256:d73e10772152605f6648ba4410318594f1043bbfe36d2fadee7c4b8912eff7c5, sha256:da8288bc4a7807c6715416deed1c57d94d5e03e93537889e002bf985be503f1a, sha256:db93608a246da44d728842b8fa9e45aa9782db76955f634a707739a8d53ff544, sha256:dcd3d0009fbb6e454d729f8b22d0063bd9171c31a55e0f0271119bd4f2700023, sha256:dd1f49f949a658c4e8f81ed73f9aad25fcc7d4f62f767f591e749e30038c4e1d, sha256:dd6ff2192f34bd622883c745a56f492b1c9ccd44e14953e8051c33024a2947d5, sha256:e018a4921657c2d3f89c720b7b90b9182e277178a04a7e9542cc79d7d787ca51, sha256:e2b7670c0c8c6b501464150dd49dd0d6be6cb7f049e064124911cec5514fa19e, sha256:e7a33322e08021c37e89cae8ff06327503e8a1719e97c69f32c31cbf6c30d72c, sha256:e8a82e35d52ad6f867e88096a1a2b9bdc7ec4d5e65c7b4976a248bf2d1a32a93, sha256:e9faf8d4712d5ea301d74abfcf6dafe4b7f4af7936e91f283b0ad7bf69ed3e3a, sha256:ec5ca7c0007ce268048bbe0ffc6846ed1616cf3d8628b136e81d5e64ff3f52a2, sha256:eee42a1cc06565f6b21caa1f504ec15e07de7ebfd520ab57f8cb3308bc118e22, sha256:f2acf9bbcd514e901f82c4ca6926bbd2ae61716728f110b4343eb0a69612d018, sha256:f55c1ddcc1f6050b07d468ce594f55dbf6107b459e16f735d26818d7be1e9538, sha256:f6977a520bd96e097c8a37a8cbb9faa1ea99d21bf84190195056e25f688af73d, sha256:f94c7d22fb36b184734dded7345a04ec5f95130421c775b8b0c65044ef073f34, sha256:fa8957e9a1b202cb45e6b839c241cd986c897be1e722b81d2f32e9c6aeee80b0, sha256:fd3854148005c808c485c754a184c71116372263709958b42aefbef2e5dd373a, sha256:fe5872ce6f9627deac8314bdffd3862624227c3de4c17ef0cc78bbf0402999eb, sha256:ffbae429ba9e42d0582d3ac63fdb410338892468a2107d8ff68228ec9a39a0ed.

  at ~/.poetry/lib/poetry/installation/executor.py:627 in _download_link
      623│                     )
      624│                 )
      625│
      626│             if archive_hashes.isdisjoint(hashes):
    → 627│                 raise RuntimeError(
      628│                     "Invalid hashes ({}) for {} using archive {}. Expected one of {}.".format(
      629│                         ", ".join(sorted(archive_hashes)),
      630│                         package,
      631│                         archive_path.name,

Failed to add packages, reverting the pyproject.toml file to its original content.
</code>```

poetry install copier:

```<code>me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager$ poetry install copier
Too many arguments.
</code>```

答:
You have installed to your systems python instead of the one associated with your venve that poetry run probably uses. Since you are using poetry, you should try installing with

```<code> poetry add copier
</code>```

Body:
Goal: to run program with copier dependency.

pip install copier:

me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager/pwmf/cli$ pip install copier
cd .Defaulting to user installation because normal site-packages is not writeable
.Requirement already satisfied: copier in /home/me/.local/lib/python3.8/site-packages (5.1.0)
/Requirement already satisfied: colorama<0.5.0,>=0.4.3 in /usr/lib/python3/dist-packages (from copier) (0.4.3)
Requirement already satisfied: plumbum<2.0.0,>=1.6.9 in /home/me/.local/lib/python3.8/site-packages (from copier) (1.7.2)
Requirement already satisfied: pyyaml<6.0.0,>=5.3.1 in /usr/lib/python3/dist-packages (from copier) (5.3.1)
Requirement already satisfied: regex<2021.0.0,>=2020.6.8 in /home/me/.local/lib/python3.8/site-packages (from copier) (2020.11.13)
Requirement already satisfied: pydantic<2.0.0,>=1.5.1 in /home/me/.local/lib/python3.8/site-packages (from copier) (1.9.0)
Requirement already satisfied: jinja2<3.0.0,>=2.11.2 in /home/me/.local/lib/python3.8/site-packages (from copier) (2.11.3)
Requirement already satisfied: pathspec<0.9.0,>=0.8.0 in /home/me/.local/lib/python3.8/site-packages (from copier) (0.8.1)
Requirement already satisfied: pyyaml-include<2.0,>=1.2 in /home/me/.local/lib/python3.8/site-packages (from copier) (1.2.post2)
Requirement already satisfied: packaging<21.0,>=20.4 in /home/me/.local/lib/python3.8/site-packages (from copier) (20.9)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/lib/python3/dist-packages (from jinja2<3.0.0,>=2.11.2->copier) (1.1.0)
Requirement already satisfied: pyparsing>=2.0.2 in /home/me/.local/lib/python3.8/site-packages (from packaging<21.0,>=20.4->copier) (2.4.7)
Requirement already satisfied: typing-extensions>=3.7.4.3 in /home/me/.local/lib/python3.8/site-packages (from pydantic<2.0.0,>=1.5.1->copier) (4.0.1)
..WARNING: You are using pip version 21.3.1; however, version 22.0.3 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager/pwmf/cli$ cd ../../
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager$ poetry run python pwmf/cli/cli.py  new-worker -n experiment_worker -o ../../workers-python/workers/ -t basic_worker
Traceback (most recent call last):
  File "pwmf/cli/cli.py", line 8, in <module>
    from copier import copy
ModuleNotFoundError: No module named 'copier'

poetry add copier:

me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager$ poetry add copier
The following packages are already present in the pyproject.toml and will be skipped:

  • copier

If you want to update it to the latest compatible version, you can use `poetry update package`.
If you prefer to upgrade it to the latest available version, you can use `poetry add package@latest`.

Nothing to add.
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager$ poetry run python pwmf/cli/cli.py  new-worker -n experiment_worker -o ../../workers-python/workers/ -t basic_worker
Traceback (most recent call last):
  File "pwmf/cli/cli.py", line 8, in <module>
    from copier import copy
ModuleNotFoundError: No module named 'copier'
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager$

poetry update copier:

me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager$ poetry update copier
Updating dependencies
Resolving dependencies... (1.6s)

  SSLError

  HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /pypi/dagster-aws/0.9.22.post0/json (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)')))

  at ~/.poetry/lib/poetry/_vendor/py3.8/requests/adapters.py:514 in send
      510│                 raise ProxyError(e, request=request)
      511│
      512│             if isinstance(e.reason, _SSLError):
      513│                 # This branch is for urllib3 v1.22 and later.
    → 514│                 raise SSLError(e, request=request)
      515│
      516│             raise ConnectionError(e, request=request)
      517│
      518│         except ClosedPoolError as e:

poetry add copier@latest:

me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager$ poetry add copier@latest
Using version ^5.1.0 for copier

Updating dependencies
Resolving dependencies... (1241.3s)

Writing lock file

Package operations: 72 installs, 0 updates, 0 removals

  • Installing pymongo (3.12.0): Failed

  RuntimeError

  Invalid hashes (sha256:44a15fadb9c3f35c8d2af0acea375c7c4c45877c137934a8667d82f900951e36) for pymongo (3.12.0) using archive pymongo-3.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl. Expected one of sha256:02dc0b0f48ed3cd06c13b7e31b066bf91e00dac5f8147b0a0a45f9009bfab857, sha256:053b4ebf91c7395d1fcd2ce6a9edff0024575b7b2de6781554a4114448a8adc9, sha256:070a4ef689c9438a999ec3830e69b208ff0d12251846e064d947f97d819d1d05, sha256:072ba7cb65c8aa4d5c5659bf6722ee85781c9d7816dc00679b8b6f3dff1ddafc, sha256:0b6055e0ef451ff73c93d0348d122a0750dddf323b9361de5835dac2f6cf7fc1, sha256:11f9e0cfc84ade088a38df2708d0b958bb76360181df1b2e1e1a41beaa57952b, sha256:18290649759f9db660972442aa606f845c368db9b08c4c73770f6da14113569b, sha256:186104a94d39b8412f8e3de385acd990a628346a4402d4f3a288a82b8660bd22, sha256:1970cfe2aec1bf74b40cf30c130ad10cd968941694630386db33e1d044c22a2e, sha256:19d4bd0fc29aa405bb1781456c9cfff9fceabb68543741eb17234952dbc2bbb0, sha256:1bab889ae7640eba739f67fcbf8eff252dddc60d4495e6ddd3a87cd9a95fdb52, sha256:1bc6fe7279ff40c6818db002bf5284aa03ec181ea1b1ceaeee33c289d412afa7, sha256:208debdcf76ed39ebf24f38509f50dc1c100e31e8653817fedb8e1f867850a13, sha256:2399a85b54f68008e483b2871f4a458b4c980469c7fe921595ede073e4844f1e, sha256:246ec420e4c8744fceb4e259f906211b9c198e1f345e6158dcd7cbad3737e11e, sha256:24f8aeec4d6b894a6128844e50ff423dd02462ee83addf503c598ee3a80ddf3d, sha256:255a35bf29185f44b412e31a927d9dcedda7c2c380127ecc4fbf2f61b72fa978, sha256:2dbfbbded947a83a3dffc2bd1ec4750c17e40904692186e2c55a3ad314ca0222, sha256:2e92aa32300a0b5e4175caec7769f482b292769807024a86d674b3f19b8e3755, sha256:316c1b8723afa9870567cd6dff35d440b2afeda53aa13da6c5ab85f98ed6f5ca, sha256:333bfad77aa9cd11711febfb75eed0bb537a1d022e1c252714dad38993590240, sha256:39dafa2eaf577d1969f289dc9a44501859a1897eb45bd589e93ce843fc610800, sha256:3ce83f17f641a62a4dfb0ba1b8a3c1ced7c842f511b5450d90c030c7828e3693, sha256:46d5ec90276f71af3a29917b30f2aec2315a2759b5f8d45b3b63a07ca8a070a3, sha256:48d5bc80ab0af6b60c4163c5617f5cd23f2f880d7600940870ea5055816af024, sha256:4ba0def4abef058c0e5101e05e3d5266e6fffb9795bbf8be0fe912a7361a0209, sha256:5af390fa9faf56c93252dab09ea57cd020c9123aa921b63a0ed51832fdb492e7, sha256:5e574664f1468872cd40f74e4811e22b1aa4de9399d6bcfdf1ee6ea94c017fcf, sha256:625befa3bc9b40746a749115cc6a15bf20b9bd7597ca55d646205b479a2c99c7, sha256:6261bee7c5abadeac7497f8f1c43e521da78dd13b0a2439f526a7b0fc3788824, sha256:657ad80de8ec9ed656f28844efc801a0802961e8c6a85038d97ff6f555ef4919, sha256:6b89dc51206e4971c5568c797991eaaef5dc2a6118d67165858ad11752dba055, sha256:6e66780f14c2efaf989cd3ac613b03ee6a8e3a0ba7b96c0bb14adca71a427e55, sha256:6fb3f85870ae26896bb44e67db94045f2ebf00c5d41e6b66cdcbb5afd644fc18, sha256:701e08457183da70ed96b35a6b43e6ba1df0b47c837b063cde39a1fbe1aeda81, sha256:70761fd3c576b027eec882b43ee0a8e5b22ff9c20cdf4d0400e104bc29e53e34, sha256:73b400fdc22de84bae0dbf1a22613928a41612ec0a3d6ed47caf7ad4d3d0f2ff, sha256:7412a36798966624dc4c57d64aa43c2d1100b348abd98daaac8e99e57d87e1d7, sha256:78ecb8d42f50d393af912bfb1fb1dcc9aabe9967973efb49ee577e8f1cea494c, sha256:7c6a9948916a7bbcc6d3a9f6fb75db1acb5546078023bfb3db6efabcd5a67527, sha256:7c72d08acdf573455b2b9d2b75b8237654841d63a48bc2327dc102c6ee89b75a, sha256:7d98ce3c42921bb91566121b658e0d9d59a9082a9bd6f473190607ff25ab637f, sha256:845a8b83798b2fb11b09928413cb32692866bfbc28830a433d9fa4c8c3720dd0, sha256:94d38eba4d1b5eb3e6bfece0651b855a35c44f32fd91f512ab4ba41b8c0d3e66, sha256:9a13661681d17e43009bb3e85e837aa1ec5feeea1e3654682a01b8821940f8b3, sha256:a0e5dff6701fa615f165306e642709e1c1550d5b237c5a7a6ea299886828bd50, sha256:a2239556ff7241584ce57be1facf25081669bb457a9e5cbe68cce4aae6567aa1, sha256:a325600c83e61e3c9cebc0c2b1c8c4140fa887f789085075e8f44c8ff2547eb9, sha256:a3566acfbcde46911c52810374ecc0354fdb841284a3efef6ff7105bc007e9a8, sha256:a634a4730ce0b0934ed75e45beba730968e12b4dafbb22f69b3b2f616d9e644e, sha256:a6d055f01b83b1a4df8bb0c61983d3bdffa913764488910af3620e5c2450bf83, sha256:a752ecd1a26000a6d67be7c9a2e93801994a8b3f866ac95b672fbc00225ca91a, sha256:a9ba2a63777027b06b116e1ea8248e66fd1bedc2c644f93124b81a91ddbf6d88, sha256:aaa038eafb7186a4abbb311fcf20724be9363645882bbce540bef4797e812a7a, sha256:af586e85144023686fb0af09c8cdf672484ea182f352e7ceead3d832de381e1b, sha256:b0a0cf39f589e52d801fdef418305562bc030cdf8929217463c8433c65fd5c2f, sha256:b1c4874331ab960429caca81acb9d2932170d66d6d6f87e65dc4507a85aca152, sha256:b3b5b3cbc3fdf4fcfa292529df2a85b5d9c7053913a739d3069af1e12e12219f, sha256:b542d56ed1b8d5cf3bb36326f814bd2fbe8812dfd2582b80a15689ea433c0e35, sha256:b6ea08758b6673610b3c5bdf47189286cf9c58b1077558706a2f6f8744922527, sha256:b754240daafecd9d5fce426b0fbaaed03f4ebb130745c8a4ae9231fffb8d75e5, sha256:b772bab31cbd9cb911e41e1a611ebc9497f9a32a7348e2747c38210f75c00f41, sha256:b88d1742159bc93a078733f9789f563cef26f5e370eba810476a71aa98e5fbc2, sha256:b8bf42d3b32f586f4c9e37541769993783a534ad35531ce8a4379f6fa664fba9, sha256:bc9ac81e73573516070d24ce15da91281922811f385645df32bd3c8a45ab4684, sha256:c188db6cf9e14dbbb42f5254292be96f05374a35e7dfa087cc2140f0ff4f10f6, sha256:c55782a55f4a013a78ac5b6ee4b8731a192dea7ab09f1b6b3044c96d5128edd4, sha256:c5cab230e7cabdae9ff23c12271231283efefb944c1b79bed79a91beb65ba547, sha256:cbf8672edeb7b7128c4a939274801f0e32bbf5159987815e3d1eace625264a46, sha256:cc2894fe91f31a513860238ede69fe47fada21f9e7ddfe73f7f9fef93a971e41, sha256:cda9e628b1315beec8341e8c04aac9a0b910650b05e0751e42e399d5694aeacb, sha256:ceae3ab9e11a27aaab42878f1d203600dfd24f0e43678b47298219a0f10c0d30, sha256:ced944dcdd561476deef7cb7bfd4987c69fffbfeff6d02ca4d5d4fd592d559b7, sha256:d04ca462cb99077e6c059e97c072957caf2918e6e4191e3161c01c439e0193de, sha256:d1131562ddc2ea8a446f66c2648d7dabec2b3816fc818528eb978a75a6d23b2e, sha256:d1740776b70367277323fafb76bcf09753a5cc9824f5d705bac22a34ff3668ea, sha256:d6e11ffd43184d529d6752d6dcb62b994f903038a17ea2168ef1910c96324d26, sha256:d73e10772152605f6648ba4410318594f1043bbfe36d2fadee7c4b8912eff7c5, sha256:da8288bc4a7807c6715416deed1c57d94d5e03e93537889e002bf985be503f1a, sha256:db93608a246da44d728842b8fa9e45aa9782db76955f634a707739a8d53ff544, sha256:dcd3d0009fbb6e454d729f8b22d0063bd9171c31a55e0f0271119bd4f2700023, sha256:dd1f49f949a658c4e8f81ed73f9aad25fcc7d4f62f767f591e749e30038c4e1d, sha256:dd6ff2192f34bd622883c745a56f492b1c9ccd44e14953e8051c33024a2947d5, sha256:e018a4921657c2d3f89c720b7b90b9182e277178a04a7e9542cc79d7d787ca51, sha256:e2b7670c0c8c6b501464150dd49dd0d6be6cb7f049e064124911cec5514fa19e, sha256:e7a33322e08021c37e89cae8ff06327503e8a1719e97c69f32c31cbf6c30d72c, sha256:e8a82e35d52ad6f867e88096a1a2b9bdc7ec4d5e65c7b4976a248bf2d1a32a93, sha256:e9faf8d4712d5ea301d74abfcf6dafe4b7f4af7936e91f283b0ad7bf69ed3e3a, sha256:ec5ca7c0007ce268048bbe0ffc6846ed1616cf3d8628b136e81d5e64ff3f52a2, sha256:eee42a1cc06565f6b21caa1f504ec15e07de7ebfd520ab57f8cb3308bc118e22, sha256:f2acf9bbcd514e901f82c4ca6926bbd2ae61716728f110b4343eb0a69612d018, sha256:f55c1ddcc1f6050b07d468ce594f55dbf6107b459e16f735d26818d7be1e9538, sha256:f6977a520bd96e097c8a37a8cbb9faa1ea99d21bf84190195056e25f688af73d, sha256:f94c7d22fb36b184734dded7345a04ec5f95130421c775b8b0c65044ef073f34, sha256:fa8957e9a1b202cb45e6b839c241cd986c897be1e722b81d2f32e9c6aeee80b0, sha256:fd3854148005c808c485c754a184c71116372263709958b42aefbef2e5dd373a, sha256:fe5872ce6f9627deac8314bdffd3862624227c3de4c17ef0cc78bbf0402999eb, sha256:ffbae429ba9e42d0582d3ac63fdb410338892468a2107d8ff68228ec9a39a0ed.

  at ~/.poetry/lib/poetry/installation/executor.py:627 in _download_link
      623│                     )
      624│                 )
      625│
      626│             if archive_hashes.isdisjoint(hashes):
    → 627│                 raise RuntimeError(
      628│                     "Invalid hashes ({}) for {} using archive {}. Expected one of {}.".format(
      629│                         ", ".join(sorted(archive_hashes)),
      630│                         package,
      631│                         archive_path.name,

Failed to add packages, reverting the pyproject.toml file to its original content.

poetry install copier:

me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python-framework/workers_manager$ poetry install copier
Too many arguments.

Body:
You have installed to your systems python instead of the one associated with your venve that poetry run probably uses. Since you are using poetry, you should try installing with

 poetry add copier


问:
using ant design switch inside Forms
What's the correct way to use ant design switch inside, I could not get much from the official documentation.
Switch-Ant Design

Here's how I am using it.

```<code><Form form={form} layout="vertical">
  <Form.Item
    label="Description"
    name="description"
    rules={[{ required: true, message: 'Enter a description' }]}
  >
    <Input placeholder="Enter Description" />
  </Form.Item>

  <Form.Item name="switch" noStyle valuePropName="checked">
    <Switch checkedChildren="Yes" unCheckedChildren="No" />
    <span>Chargable</span>
  </Form.Item>

  <Button
    onClick={() => {
      form
        .validateFields()
        .then((values) => {
          form.resetFields()
          onCreate(values)
        })
        .catch((info) => {
          console.log('Validate Failed:', info)
        })
    }}
  >
    Save
  </Button>
</Form>
</code>```

onCreate does no take the value from the switch, It does take it from the description

```<code>const onCreate = (values) => {}
</code>```

答: This is because you must only have one child inside a Form.Item component. Remove the span besides your Switch component and it will work.

Title: using ant design switch inside Forms

Body:
What's the correct way to use ant design switch inside, I could not get much from the official documentation.
Switch-Ant Design

Here's how I am using it.

<Form form={form} layout="vertical">
  <Form.Item
    label="Description"
    name="description"
    rules={[{ required: true, message: 'Enter a description' }]}
  >
    <Input placeholder="Enter Description" />
  </Form.Item>

  <Form.Item name="switch" noStyle valuePropName="checked">
    <Switch checkedChildren="Yes" unCheckedChildren="No" />
    Chargable
  </Form.Item>

  <Button
    onClick={() => {
      form
        .validateFields()
        .then((values) => {
          form.resetFields()
          onCreate(values)
        })
        .catch((info) => {
          console.log('Validate Failed:', info)
        })
    }}
  >
    Save
  </Button>
</Form>

onCreate does no take the value from the switch, It does take it from the description

const onCreate = (values) => {}


问:
I was trying to design an algorithm that sort a generic array with respect to a specific criteria, but every ways I thought are not efficient
I need to separate even numbers from odd numbers this way:

even numbers must be in the first half of the array.

odd numbers must be in the second half of the array.

note: I can't use a second array.

I've tried this algorithm:

if the first element is odd, then swap this element with the next element.

go to the next element.

if the second element is odd (and I know this is odd, because it's the element I've swapped), then swap again the same way. and repeat.

the problem is that it doesn't work. I think it's because I should have checked another elements. meaning, let x be the current element, x1 is the next element, and x2 is "x1 + 1". I need to check if x is odd, if x1 is odd, and if x2 is odd as well. if x2 is even, then I swap x with x2. then I increment counter by 1. repeat.

But I feel this is not an efficient algorithm, because it could be a source of confusion, and a source of errors too. To solve this, I thought of another way.

It consists of going at the middle of the array, and comparing the current element with the first element. if the current element is even and the first element is odd, then swap them together. if it's not the case, don't do anything else and increment counter by 1. repeat until the end of the array is reached (note: it's not a string, hence it's not a zero-terminated array). This could work, but there's still another problem, what have I to do if the first element and the current element are odd? there's a solution, but it'd add an extra layer of complexity. Therefore, I think I should avoid this way.

答:
This problem is similar to partitioning in a quick sort algorithm. One of the easiest solutions (both to understand and to implement) is the Hoare partition scheme, which works as follows:

Start with an index to the first element of the array (i), and another index to the last element of the array (j).

Increment i until you find an odd number.

Decrement j until you find an even number.

Swap array[i] with array[j].

Repeat until j <= i.


问:
gsap Flip.fit svg element not moving to expected coordinates because of { duration: x }
I am confused with gsap's  Flip.fit moving to coordinates.

I have a game board with 182 tiles and 182 playing tiles.

The goal

When the user clicks the bag, a random playing tile is selected and is "supposed" to move over the tile on the board.

If you change

```<code>Flip.fit(PTILE[tileArray], TILE[tileArray], {duration: 1 , scale: true});
</code>```

when changing { duration: 0, ... }  the move works as expected, however no animation. When duration is above zero, the final location is very random.

codepen

答:
Ok, I found out that Inkscape stores the SVG with inline transforms that threw the animation off. I tried saving in plain or optimised, but still had no luck.

So there are two solutions.

Use SVGOMG an online SVG cleaner.

Use Affinity Designer application which can export and flatten transforms.

The key to rule out other factors is to use relative coordinates and flatten transforms.

I have included a screenshot of Affinity exporting options.
Affinity Export screenshot

Body:
I am confused with gsap's  Flip.fit moving to coordinates.

I have a game board with 182 tiles and 182 playing tiles.

The goal

When the user clicks the bag, a random playing tile is selected and is "supposed" to move over the tile on the board.

If you change

Flip.fit(PTILE[tileArray], TILE[tileArray], {duration: 1 , scale: true});

when changing { duration: 0, ... }  the move works as expected, however no animation. When duration is above zero, the final location is very random.

codepen


问:
Displaying website visitors on a map in real-time
I want to develop a webpage (in ASP.NET, C#) with a world map which can display pop-up bubbles whenever someone visits and logs in to our company's website. The bubbles should appear in real-time, and it should display the user's name and location.
Whenever the user logs in to our website, we have name and other personal information available in our database for that user.

Please suggest ways to implement this.

Thanks!

Updated:

By real-time update I mean a page with the map which gets refreshed as soon as any general public visits the home page, or one of our clients logs in to our website. These clients have login IDs provided by us to login to our website and they can be anywhere in the world.

Is there any way I can get to know when someone logs in to our website, and display the user's location on the map? Is it possible to do this without entering the login information in the database?

答:
I hope you want to show like this http://forums.digitalpoint.com/usermap.php.

My suggestion is :-
use some web service like getting Geo-location using users IP address. which will return Latitude and Longitude
Check this URL using freegeoip.appspot.com http://shareourideas.com/2009/08/27/iplocation/

Using that lat and long positions you can add pin on map with bubble.
check with this URL to add pin
http://code.google.com/apis/maps/documentation/javascript/overlays.html#InfoWindows


问:
Oracle SQL Count orders by customers in the last 10 days based on order id
In Oracle SQL my goal is to receive the total number of orders made by a customer in the last 10 days but shown by the order id and not the customer id.

The following situation is given:

My desired outcome is:

How can I facilitate this in the most efficient way?

答:
You do not need a self-join and can simply use the COUNT analytic function with a RANGE window:

SELECT customer_id,
       order_no,
       order_date,
       COUNT(*) OVER (
         PARTITION BY customer_id
         ORDER BY order_date
         RANGE BETWEEN INTERVAL '10' DAY PRECEDING AND INTERVAL '0' DAY FOLLOWING
       ) AS numer_orders
FROM   table_name
ORDER BY order_no
```
<p>Which, for the sample data:</p>
<pre class="lang-sql prettyprint-override"><code>CREATE TABLE table_name (customer_id, order_no, order_date) AS
SELECT 100,  1, DATE '2021-01-01' FROM DUAL UNION ALL
SELECT 200,  2, DATE '2021-01-02' FROM DUAL UNION ALL
SELECT 300,  3, DATE '2021-01-05' FROM DUAL UNION ALL
SELECT 100,  4, DATE '2021-01-09' FROM DUAL UNION ALL
SELECT 100,  5, DATE '2021-01-15' FROM DUAL UNION ALL
SELECT 200,  6, DATE '2021-01-18' FROM DUAL UNION ALL
SELECT 700,  7, DATE '2021-01-20' FROM DUAL UNION ALL
SELECT 800,  8, DATE '2021-01-25' FROM DUAL UNION ALL
SELECT 800,  9, DATE '2021-01-25' FROM DUAL UNION ALL
SELECT 800, 10, DATE '2021-01-28' FROM DUAL;
</code>```

Outputs:

CUSTOMER_ID
ORDER_NO
ORDER_DATE
NUMER_ORDERS

100
1
01-JAN-21
1

200
2
02-JAN-21
1

300
3
05-JAN-21
1

100
4
09-JAN-21
2

100
5
15-JAN-21
2

200
6
18-JAN-21
1

700
7
20-JAN-21
1

800
8
25-JAN-21
2

800
9
25-JAN-21
2

800
10
28-JAN-21
3

db<>fiddle here

Body:
You do not need a self-join and can simply use the COUNT analytic function with a RANGE window:

SELECT customer_id,
       order_no,
       order_date,
       COUNT(*) OVER (
         PARTITION BY customer_id
         ORDER BY order_date
         RANGE BETWEEN INTERVAL '10' DAY PRECEDING AND INTERVAL '0' DAY FOLLOWING
       ) AS numer_orders
FROM   table_name
ORDER BY order_no

Which, for the sample data:

CREATE TABLE table_name (customer_id, order_no, order_date) AS
SELECT 100,  1, DATE '2021-01-01' FROM DUAL UNION ALL
SELECT 200,  2, DATE '2021-01-02' FROM DUAL UNION ALL
SELECT 300,  3, DATE '2021-01-05' FROM DUAL UNION ALL
SELECT 100,  4, DATE '2021-01-09' FROM DUAL UNION ALL
SELECT 100,  5, DATE '2021-01-15' FROM DUAL UNION ALL
SELECT 200,  6, DATE '2021-01-18' FROM DUAL UNION ALL
SELECT 700,  7, DATE '2021-01-20' FROM DUAL UNION ALL
SELECT 800,  8, DATE '2021-01-25' FROM DUAL UNION ALL
SELECT 800,  9, DATE '2021-01-25' FROM DUAL UNION ALL
SELECT 800, 10, DATE '2021-01-28' FROM DUAL;

Outputs:

CUSTOMER_ID
ORDER_NO
ORDER_DATE
NUMER_ORDERS

100
1
01-JAN-21
1

200
2
02-JAN-21
1

300
3
05-JAN-21
1

100
4
09-JAN-21
2

100
5
15-JAN-21
2

200
6
18-JAN-21
1

700
7
20-JAN-21
1

800
8
25-JAN-21
2

800
9
25-JAN-21
2

800
10
28-JAN-21
3

db<>fiddle here


问:
access ActiveRecord Has Many associations
I have a model which has a lot of associations. What I need to do is to check whether one of those associations is not present or all of them are set correctly.

To do so, I created an array which includes all of those needs-to-be-checked fields. And created a loop through each element, but the case is that I can not access has_many related attributes with read_attribute method. It basically returns nil whenever I try to access has many associated fields.

What I am trying to do, I can access all related objects via car.drivers but I can not access the same object with car.read_attribute(:drivers) (because some of them are attributes and some are relations)

I think it's the behavior of read_attribute, so what should I use to access any (attribute or relation) on ActiveRecord object?

Regarding to the comments, it looks like no one understand what I am trying to do. I want to access the relations of one ActiveRecord object such like;

```<code>RELATIONS.each do |relation|
   puts "#{relation} exists" if @object.relation.present?
end
</code>```

What I do not know about this, is there any method that I can access the related objects with their string typed name. Similar to, @object.read_attribute(:attribute_name) In that way I can create a for loop, but for relations not for the attributes

答:
To do so, I used dynamical method call. Below is an example of showing it</p>
```<code>RELATIONS.each do |relation|
   puts "#{relation} exists" unless @object.send('relation').nil?
end
</code>```

Body:
I have a model which has a lot of associations. What I need to do is to check whether one of those associations is not present or all of them are set correctly.

To do so, I created an array which includes all of those needs-to-be-checked fields. And created a loop through each element, but the case is that I can not access has_many related attributes with read_attribute method. It basically returns nil whenever I try to access has many associated fields.

What I am trying to do, I can access all related objects via car.drivers but I can not access the same object with car.read_attribute(:drivers) (because some of them are attributes and some are relations)

I think it's the behavior of read_attribute, so what should I use to access any (attribute or relation) on ActiveRecord object?

Regarding to the comments, it looks like no one understand what I am trying to do. I want to access the relations of one ActiveRecord object such like;

RELATIONS.each do |relation|
   puts "#{relation} exists" if @object.relation.present?
end

What I do not know about this, is there any method that I can access the related objects with their string typed name. Similar to, @object.read_attribute(:attribute_name) In that way I can create a for loop, but for relations not for the attributes

Body:
To do so, I used dynamical method call. Below is an example of showing it

RELATIONS.each do |relation|
   puts "#{relation} exists" unless @object.send('relation').nil?
end


问:
What is the best way to access elements of parent control from a child control?
I have a parent control (main form) and a child control (user control). The child control has some code, which determines what functions the application can perform (e.g. save files, write logs etc.). I need to show/hide, enable/disable main menu items of the main form according to the functionality. As I can't just write MainMenu.MenuItem1.Visible = false; (the main menu is not visible from the child control), I fire an event in the child control and handle this event on the main form. The problem is I need to pass what elements of the menu need to be shown/hidden. To do this I created an enum, showing what to do with the item

```<code>public enum ItemMode
{
    TRUE, FALSE, NONE
}
</code>```

Then I created my eventargs which have 6 parameters of type ItemMode (there are 6 menu items I need to manage). So any time I need to show the 1st item, hide the 2nd and do nothing with the rest I have to write something like this

```<code>e = new ItemModeEventArgs(ItemMode.TRUE, ItemMode.FALSE, ItemMode.NONE, ItemMode.NONE, ItemMode.NONE, ItemMode.NONE);
FireMyEvent(e);
</code>```

This seems like too much code to me and what's more, what if I need to manage 10 items in future? Then I will have to rewrite all the constructors just to add 4 more NONEs.

I believe there's a better way of doing this, but I just can't figure out what it is.

答:
If you want to handle all changes from the user control: you could inherit your own user control class and add a reference to the form/collection of menu entries you want to be able to modify. You would pass this reference to its constructor and then you'll be able to easily modify the menu from inside your user control

If, on the other hand, you would like to manage this on an event basis in your form, you could implement your own EventArgs class, but I would do it like this:

```<code>
class ItemModeEventArgs
{
    MenuItemClass target;
    EnumType change;
}
</code>```

So basically for each menu item a separate event is risen. Every event args knows about what item menu is changing and how it is changing. Ofc, if you only have two states for the menu items, the 'change' field is kinda useless.
This way you don't have to hardcode functions with n parameters where n is the number of menu items.

Body:
I have a parent control (main form) and a child control (user control). The child control has some code, which determines what functions the application can perform (e.g. save files, write logs etc.). I need to show/hide, enable/disable main menu items of the main form according to the functionality. As I can't just write MainMenu.MenuItem1.Visible = false; (the main menu is not visible from the child control), I fire an event in the child control and handle this event on the main form. The problem is I need to pass what elements of the menu need to be shown/hidden. To do this I created an enum, showing what to do with the item

public enum ItemMode
{
    TRUE, FALSE, NONE
}

Then I created my eventargs which have 6 parameters of type ItemMode (there are 6 menu items I need to manage). So any time I need to show the 1st item, hide the 2nd and do nothing with the rest I have to write something like this

e = new ItemModeEventArgs(ItemMode.TRUE, ItemMode.FALSE, ItemMode.NONE, ItemMode.NONE, ItemMode.NONE, ItemMode.NONE);
FireMyEvent(e);

This seems like too much code to me and what's more, what if I need to manage 10 items in future? Then I will have to rewrite all the constructors just to add 4 more NONEs.

I believe there's a better way of doing this, but I just can't figure out what it is.

Body:
If you want to handle all changes from the user control: you could inherit your own user control class and add a reference to the form/collection of menu entries you want to be able to modify. You would pass this reference to its constructor and then you'll be able to easily modify the menu from inside your user control

If, on the other hand, you would like to manage this on an event basis in your form, you could implement your own EventArgs class, but I would do it like this:

class ItemModeEventArgs
{
    MenuItemClass target;
    EnumType change;
}

So basically for each menu item a separate event is risen. Every event args knows about what item menu is changing and how it is changing. Ofc, if you only have two states for the menu items, the 'change' field is kinda useless.
This way you don't have to hardcode functions with n parameters where n is the number of menu items.


问:
Filter to identify outliers in Python
I'm trying to remove outliers falling in 2 ranges, but keep receiving errors. I've tried with the Boolean & and | characters, np.logical_or and np.logical_and, with a .any(), or .all() as well, to no avail. Could someone please advise what I'm doing wrong here? This is the boxplot that shows the outliers:

and here's the code I'm trying to use to filter out the outliers:

Thanks in advance for feedback.

答:
As pointed out by the comments, you can compute the bitmask rm_filter like so:

```<code>rm_filter = (df['RM'] >=7.75) | (df['RM'] <=4.75)
</code>```

and should be able to remove those records like:

```<code>df_rm_outlier_rem = df[~rm_filter]
</code>```

where the tilde ~ negates the filter.

Title: Filter to identify outliers in Python

Body:
As pointed out by the comments, you can compute the bitmask rm_filter like so:

rm_filter = (df['RM'] >=7.75) | (df['RM'] <=4.75)

and should be able to remove those records like:

df_rm_outlier_rem = df[~rm_filter]

where the tilde ~ negates the filter.


问:
How do you load Components dynamically in Angular 13?
I was tasked to update an Angular library from 7 to 13. This Library used Compiler and ComponentFactory to dynamically load Components. But those classes are now deprecated, and I found no real guide on how to do this without using these classes.
Here's the code in question:

dynamic-content.component.ts:

```<code>...
   private createCompiledTemplateFactory = (template: string, extensionType: string): ComponentFactory<any> | undefined => {
        const metadata = {
            selector: `dynamic-extended-component-${extensionType}`,
            template: template
        };

        const extType = ClassInjector.get(extensionType);
        if (!extType) {
            throw new Error('Type not found: ' + extensionType);
        }

        return this.createComponentFactorySync(metadata, null, extType);
    }

    private createComponentFactorySync = (metadata: Component, componentClass: any, extensionType: Type<any>)
        : ComponentFactory<any> | undefined => {
        const cmpClass = componentClass || class RuntimeComponent extends extensionType { };
        const decoratedCmp = Component(metadata)(cmpClass);
        const externalImports = this.externalImports;

        @NgModule({
            imports: [
                CommonModule,
                FormsModule,
                DynamicGridModule.forChild(),
                DxButtonModule,
                DxSwitchModule,
                TranslateModule,
                RouterModule,
                externalImports,
                DynamicPageCommonComponentsModule
            ],
            declarations: [decoratedCmp]
        })
        class RuntimeComponentModule { }

        const module: ModuleWithComponentFactories<any> = this.compiler.compileModuleAndAllComponentsSync(RuntimeComponentModule);
        return module.componentFactories.find(f => f.componentType === decoratedCmp);
    }
...
</code>```

class-injector.ts

```<code>export class ClassInjector {
    private static registry: { [key: string]: Type<any> } = {};

    static register(key: string, value: Type<any>) {
        const registered = ClassInjector.registry[key];
        if (registered) {
            throw new Error(`Error: ${key} is already registered.`);
        }

        ClassInjector.registry[key] = value;
    }

    static get(key: string): Type<any> {
        const registered = ClassInjector.registry[key];
        if (registered) {
            return registered;
        } else {
            throw new Error(`Error: ${key} was not registered.`);
        }
    }
}

export function RegisterActionHandler(name: string) {
    return (target: Type<any>) => ClassInjector.register(name, target);
}
</code>```

I would appreciate it if anyone could guide me in the right direction.

答:
You can use cdkPortalOutlet from here ,

Here is a demo code to play around with as well.

You can also listen to events of rendering as below

```<code><ng-template [cdkPortalOutlet]="portal" (attached)="onComponentRendering($event)"></ng-template>
</code>```

in the component

```<code>this.portal = new ComponentPortal(SomeComponent);

</code>```

and listen to onComponentRendering to do more

Body:
I was tasked to update an Angular library from 7 to 13. This Library used Compiler and ComponentFactory to dynamically load Components. But those classes are now deprecated, and I found no real guide on how to do this without using these classes.
Here's the code in question:

dynamic-content.component.ts:

...
   private createCompiledTemplateFactory = (template: string, extensionType: string): ComponentFactory<any> | undefined => {
        const metadata = {
            selector: `dynamic-extended-component-${extensionType}`,
            template: template
        };

        const extType = ClassInjector.get(extensionType);
        if (!extType) {
            throw new Error('Type not found: ' + extensionType);
        }

        return this.createComponentFactorySync(metadata, null, extType);
    }

    private createComponentFactorySync = (metadata: Component, componentClass: any, extensionType: Type<any>)
        : ComponentFactory<any> | undefined => {
        const cmpClass = componentClass || class RuntimeComponent extends extensionType { };
        const decoratedCmp = Component(metadata)(cmpClass);
        const externalImports = this.externalImports;

        @NgModule({
            imports: [
                CommonModule,
                FormsModule,
                DynamicGridModule.forChild(),
                DxButtonModule,
                DxSwitchModule,
                TranslateModule,
                RouterModule,
                externalImports,
                DynamicPageCommonComponentsModule
            ],
            declarations: [decoratedCmp]
        })
        class RuntimeComponentModule { }

        const module: ModuleWithComponentFactories<any> = this.compiler.compileModuleAndAllComponentsSync(RuntimeComponentModule);
        return module.componentFactories.find(f => f.componentType === decoratedCmp);
    }
...

class-injector.ts

export class ClassInjector {
    private static registry: { [key: string]: Type<any> } = {};

    static register(key: string, value: Type<any>) {
        const registered = ClassInjector.registry[key];
        if (registered) {
            throw new Error(`Error: ${key} is already registered.`);
        }

        ClassInjector.registry[key] = value;
    }

    static get(key: string): Type<any> {
        const registered = ClassInjector.registry[key];
        if (registered) {
            return registered;
        } else {
            throw new Error(`Error: ${key} was not registered.`);
        }
    }
}

export function RegisterActionHandler(name: string) {
    return (target: Type<any>) => ClassInjector.register(name, target);
}

I would appreciate it if anyone could guide me in the right direction.

Body:
You can use cdkPortalOutlet from here ,

Here is a demo code to play around with as well.

You can also listen to events of rendering as below

<ng-template [cdkPortalOutlet]="portal" (attached)="onComponentRendering($event)"></ng-template>

in the component

this.portal = new ComponentPortal(SomeComponent);

and listen to onComponentRendering to do more


问:
Table name is not showing for the Database data Block in Oracle Apps Custom Form FMB
I have a Oracle Apps Custom Form. In that Form I want to know from which table the database block getting data for form.

So I right click the DATA BLOCK-->property palette-->Database Block. In the database Block =yes/Query data source is Null. No table name is Showing. How can I find the table name?

答:
There's a binary logic for determining the data source. The table name in the Data Source part has priority in case Database Block option set to Yes as you already checked for.

Otherwise(in case Data Source is null), the Block Name will be considered as the data source name, eg. a table or view name within the currently connected schema, provided again that the Database Block option set to Yes

Another case that you might have a query , presumably within a trigger of forms, populating the fields under that block.


问:
Why do you divide by two when checking prime numbers in Java?
I was looking over this on YouTube and saw some code. I got most of it but didn't understand at all the reason why you the value n divide by two. Could someone please explain it?</p>
```<code>import java.util.ArrayList;

public class Primes {

    public static void main(String[] args) {

        System.out.println(findPrimes(1, 100));

    }

    public static ArrayList<Integer> findPrimes(int start, int end) {

        ArrayList<Integer> primes = new ArrayList<Integer>();

        for(int n = start; n < end; n++) {
            boolean prime = true;

            int i = 2;
            while(i <= n/2) {
                if(n % i == 0) {
                    prime = false;
                    break;
                }
                i++;
            }

            if(prime) {
                primes.add(n);
            }
        }

        return primes;
    }

}
</code>```

答:
It's an attempt to improve the efficiency of the solution by stopping the loop at a point where the algorithm will no longer find any more prime factors.

However, it's suboptimal. If n == a * b and a <= b, a can be no higher than the square root of n. Therefore, checking for i <= Math.sqrt(n) would eliminate many more unnecessary iterations of the loop for large values of n.

A further improvement could be made by iterating over known values of primes instead of incremental values of i, since once you've established that a number isn't divisible by 3 there's no point checking 6, 9, 12 and so on.

Body:
I was looking over this on YouTube and saw some code. I got most of it but didn't understand at all the reason why you the value n divide by two. Could someone please explain it?

import java.util.ArrayList;

public class Primes {

    public static void main(String[] args) {

        System.out.println(findPrimes(1, 100));

    }

    public static ArrayList<Integer> findPrimes(int start, int end) {

        ArrayList<Integer> primes = new ArrayList<Integer>();

        for(int n = start; n < end; n++) {
            boolean prime = true;

            int i = 2;
            while(i <= n/2) {
                if(n % i == 0) {
                    prime = false;
                    break;
                }
                i++;
            }

            if(prime) {
                primes.add(n);
            }
        }

        return primes;
    }

}


问:
AWS Lambda: upload code from amazon S3 location
I have configured AWS pipeline to deploy my latest nodeJS code as zip file to S3.
Instead of going to AWS Lambda and choosing the "upload from Amazon S3 location" option,
is there a way to make my lambda service to take the latest code once it is written to S3, so that it will automatically update its function code when you update the zip file?</p>

答:
Using Lambda triggers, you can create a trigger than is fired whenever a new object is written to the S3 location. This tutorial specifies how you can set this up.

Then, using the AWS SDK, you can update your function's code programatically.

Take a look at the aptly named Update Function Code documentation.

The Python SDK documentation is here. Here is an example of the code from the documentation:

```<code>response = client.update_function_code(
    FunctionName='string',
    ZipFile=b'bytes',
    S3Bucket='string',
    S3Key='string',
    S3ObjectVersion='string',
    ImageUri='string',
    Publish=True|False,
    DryRun=True|False,
    RevisionId='string',
    Architectures=[
        'x86_64'|'arm64',
    ]
)
</code>```

I found this after posting the above, there appears to be an automated solution within CodePipeline itself.

https://docs.aws.amazon.com/lambda/latest/dg/services-codepipeline.html

I imagine this would be a cleaner solution to your problem.

Body:
Using Lambda triggers, you can create a trigger than is fired whenever a new object is written to the S3 location. This tutorial specifies how you can set this up.

Then, using the AWS SDK, you can update your function's code programatically.

Take a look at the aptly named Update Function Code documentation.

The Python SDK documentation is here. Here is an example of the code from the documentation:

response = client.update_function_code(
    FunctionName='string',
    ZipFile=b'bytes',
    S3Bucket='string',
    S3Key='string',
    S3ObjectVersion='string',
    ImageUri='string',
    Publish=True|False,
    DryRun=True|False,
    RevisionId='string',
    Architectures=[
        'x86_64'|'arm64',
    ]
)

I found this after posting the above, there appears to be an automated solution within CodePipeline itself.

https://docs.aws.amazon.com/lambda/latest/dg/services-codepipeline.html

I imagine this would be a cleaner solution to your problem.


问:
CSS Flex item spanning two rows without fixed height
I am trying to create a flex container layout whereby one of the flex items should span two rows. See image below for a better explanation:

Here is my markup:

```<code><div class="container">
    <div class="item item-1">ITEM 1</div>
    <div class="item item-2">ITEM 2</div>
    <div class="item item-3">ITEM 3</div>
</div>
</code>```

I cannot seem to achieve this, I have tried using flex-wrap and different combinations of the flex property.

I was able to achieve this by putting ITEM 1 & ITEM 2 in a separate
, but this presents a problem on a smaller screen, whereby ITEM 3 needs to appear BETWEEN ITEM 1 & ITEM 2. So I would rather keep the markup as is and use the order property to move things around as necessary.

答:
You can use display: contents on your extra div to achieve what you want:

* {
  box-sizing: border-box;
}

.container {
  display: flex;
  width: 100%;
}

.holder {
  width: 67%;
}

.item {
  border: 1px solid black;
}

.item-1 {
  margin-bottom: 40px;
}

.item-3 {
  width: 33%;
}

@media screen and (max-width: 700px) {
  .container {
    flex-direction: column;
  }
  .item {
    margin-bottom: 20px;
  }
  .item-1 {
    order: 1;
  }
  .item-2 {
    order: 3;
  }
  .item-3 {
    order: 2;
    width: 100%;
  }
  .holder {
    width: 100%;
    display: contents;
  }
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="container">
  <div class="holder">
    <div class="item item-1">ITEM 1</div>
    <div class="item item-2">ITEM 2</div>
  </div>
  <div class="item item-3">ITEM 3</div>
</div></code>```

Body:
I am trying to create a flex container layout whereby one of the flex items should span two rows. See image below for a better explanation:

Here is my markup:

ITEM 1

ITEM 2

ITEM 3

I cannot seem to achieve this, I have tried using flex-wrap and different combinations of the flex property.

I was able to achieve this by putting ITEM 1 & ITEM 2 in a separate
, but this presents a problem on a smaller screen, whereby ITEM 3 needs to appear BETWEEN ITEM 1 & ITEM 2. So I would rather keep the markup as is and use the order property to move things around as necessary.

Body:
You can use display: contents on your extra div to achieve what you want:

* {
  box-sizing: border-box;
}

.container {
  display: flex;
  width: 100%;
}

.holder {
  width: 67%;
}

.item {
  border: 1px solid black;
}

.item-1 {
  margin-bottom: 40px;
}

.item-3 {
  width: 33%;
}

@media screen and (max-width: 700px) {
  .container {
    flex-direction: column;
  }
  .item {
    margin-bottom: 20px;
  }
  .item-1 {
    order: 1;
  }
  .item-2 {
    order: 3;
  }
  .item-3 {
    order: 2;
    width: 100%;
  }
  .holder {
    width: 100%;
    display: contents;
  }
}

<div class="container">
  <div class="holder">
    <div class="item item-1">ITEM 1</div>
    <div class="item item-2">ITEM 2</div>
  </div>
  <div class="item item-3">ITEM 3</div>
</div>


问:
how to enter data with send.keys to 2 fields with same xpath in selenium python
i'm trying to submit password field and a confirm password field. they both dont have ID and have same xpath, the only difference is that first field with label Enter password xpath have [1] and the second field with label Confirm password xpath have [2].

here is the first one:

```<code>/html/body/div[1]/div/div[2]/div/div[2]/div/div[1]/label/input
</code>```

and here is the second one:

```<code>/html/body/div[1]/div/div[2]/div/div[2]/div/div[2]/label/input
</code>```

Xpath helper chrome plugin also give the same.

From the first one:

```<code>/html/body/div[@class='app']/div[@class='layout']/div[@class='router-
view']/div[@class='signup-form']/div[@class='onboarding password-
form']/div/div[@class='password-form__input-pass'][1]/label[@class='cs-
input']/input[@class='cs-textstyle-input-text cs-input__input cs-input__input--
medium']
</code>```

and from the second one:

```<code>/html/body/div[@class='app']/div[@class='layout']/div[@class='router-
view']/div[@class='signup-form']/div[@class='onboarding password-
form']/div/div[@class='password-form__input-pass'][2]/label[@class='cs-
input']/input[@class='cs-textstyle-input-text cs-input__input cs-input__input--
medium']
</code>```

so for now i have this code which submit the first field (Enter password):

```<code>password = driver.find_element(By.XPATH, "//input[@class='cs-textstyle-input-text cs-
input__input cs-input__input--medium']")

password.send_keys("ewra5RT#T6")
</code>```

how can i do for the second field to confirm the password?

I suppose it should be something like:

```<code>password_confirm = driver.find_element(By.XPATH, "//input[@class='cs-textstyle-input-
text cs-input__input cs-input__input--medium'][2]")
</code>```

but I can not figure out the right syntax...?

Please help and thanks.

HTML for both fields are also the same, here:

for the first one:

```<code><input data-v-6484adb0="" type="password" required="required"
class="cs-textstyle-input-text cs-input__input cs-input__input--
medium">
</code>```

and second:

```<code><input data-v-6484adb0="" type="password" required="required"
class="cs-textstyle-input-text cs-input__input cs-input__input--
medium">
</code>```

答:
maybe I'm missing something, but why you don't use the full xpaths you mentioned above?
or xpath axis and those label elements you mentioned?

but if you still want to use your approach, then simply replace

```<code>[2]
</code>```

with

```<code>position() = 2
</code>```

in appropriate manner

Body:
i'm trying to submit password field and a confirm password field. they both dont have ID and have same xpath, the only difference is that first field with label Enter password xpath have [1] and the second field with label Confirm password xpath have [2].

here is the first one:

/html/body/div[1]/div/div[2]/div/div[2]/div/div[1]/label/input

and here is the second one:

/html/body/div[1]/div/div[2]/div/div[2]/div/div[2]/label/input

Xpath helper chrome plugin also give the same.

From the first one:

/html/body/div[@class='app']/div[@class='layout']/div[@class='router-
view']/div[@class='signup-form']/div[@class='onboarding password-
form']/div/div[@class='password-form__input-pass'][1]/label[@class='cs-
input']/input[@class='cs-textstyle-input-text cs-input__input cs-input__input--
medium']

and from the second one:

/html/body/div[@class='app']/div[@class='layout']/div[@class='router-
view']/div[@class='signup-form']/div[@class='onboarding password-
form']/div/div[@class='password-form__input-pass'][2]/label[@class='cs-
input']/input[@class='cs-textstyle-input-text cs-input__input cs-input__input--
medium']

so for now i have this code which submit the first field (Enter password):

password = driver.find_element(By.XPATH, "//input[@class='cs-textstyle-input-text cs-
input__input cs-input__input--medium']")

password.send_keys("ewra5RT#T6")

how can i do for the second field to confirm the password?

I suppose it should be something like:

password_confirm = driver.find_element(By.XPATH, "//input[@class='cs-textstyle-input-
text cs-input__input cs-input__input--medium'][2]")

but I can not figure out the right syntax...?

Please help and thanks.

HTML for both fields are also the same, here:

for the first one:

<input data-v-6484adb0="" type="password" required="required"
class="cs-textstyle-input-text cs-input__input cs-input__input--
medium">

and second:

<input data-v-6484adb0="" type="password" required="required"
class="cs-textstyle-input-text cs-input__input cs-input__input--
medium">

Body:
maybe I'm missing something, but why you don't use the full xpaths you mentioned above?
or xpath axis and those label elements you mentioned?

but if you still want to use your approach, then simply replace

[2]

with

position() = 2

in appropriate manner


问:
modify docker daemon configuration in Rancher Desktop VM
Is there a way to modify docker daemon configuration in Rancher Desktop VM, e.g. adding insecure registries, etc...?

After such modification, I'd like to restart docker daemon for changes to apply. Is there a way to connect to Rancher Desktop VM?

Haven't found anything relevant in https://docs.rancherdesktop.io/faq

答:
Based on this answer :

Log into Lima VM:

```<code>LIMA_HOME="$HOME/Library/Application Support/rancher-desktop/lima" "/Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/lima/bin/limactl" shell 0
</code>```

Add insecure registry to DOCKER_OPTS at /etc/conf.d/docker file.

So it would look like below:

```<code>lima-rancher-desktop:~# tail -1 /etc/conf.d/docker
DOCKER_OPTS="--insecure-registry=insecure.home:80"
</code>```

Restart docker service inside LimaVM or restart Rancher Desktop.

Body:
Based on this answer :

Log into Lima VM:

LIMA_HOME="$HOME/Library/Application Support/rancher-desktop/lima" "/Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/lima/bin/limactl" shell 0

Add insecure registry to DOCKER_OPTS at /etc/conf.d/docker file.

So it would look like below:

lima-rancher-desktop:~# tail -1 /etc/conf.d/docker
DOCKER_OPTS="--insecure-registry=insecure.home:80"

Restart docker service inside LimaVM or restart Rancher Desktop.


问:
Close a batch launched in VBScript with intWindowStyle 0
I have a scheduled task that launches a VBScript with parameters which launches a hidden bat.

This bat executes a routine in a endless loop.
The only way to be sure the bat is still running is from the TaskManager

If I want to close the batch I have to look for it there and kill the process.

Is there any other way to check if that batch is running or set a name to that process so I can look for it.

My Script code:

```<code>Set WshShell = CreateObject("WScript.Shell")
WshShell.Run """Path to bat"" " & WScript.Arguments.Item(0) & " """ & WScript.Arguments.Item(1) & """", 0
Set WshShell = Nothing
</code>```

答:
set a title in the batch file:

```<code>title Test
</code>```

Create another batch-file, let's call it killer.cmd:

```<code>@echo off
setlocal enabledelayedexpansion
tasklist /FI "WINDOWTITLE eq Test" | findstr "cmd.exe"
if "%errorlevel%" equ "0" (
    Choice /c YN /M "kill process?"
    if "!errorlevel!" equ "1" taskkill /FI "WINDOWTITLE eq Test"
) else (
    echo Window Title does not exist.
)
</code>```

To see if the process exists (by title) run killer.cmd which will list the title and if found, it will prompt if you want to kill it by using choice

Body:
I have a scheduled task that launches a VBScript with parameters which launches a hidden bat.

This bat executes a routine in a endless loop.
The only way to be sure the bat is still running is from the TaskManager

If I want to close the batch I have to look for it there and kill the process.

Is there any other way to check if that batch is running or set a name to that process so I can look for it.

My Script code:

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run """Path to bat"" " & WScript.Arguments.Item(0) & " """ & WScript.Arguments.Item(1) & """", 0
Set WshShell = Nothing

Body:
set a title in the batch file:

title Test

Create another batch-file, let's call it killer.cmd:

@echo off
setlocal enabledelayedexpansion
tasklist /FI "WINDOWTITLE eq Test" | findstr "cmd.exe"
if "%errorlevel%" equ "0" (
    Choice /c YN /M "kill process?"
    if "!errorlevel!" equ "1" taskkill /FI "WINDOWTITLE eq Test"
) else (
    echo Window Title does not exist.
)

To see if the process exists (by title) run killer.cmd which will list the title and if found, it will prompt if you want to kill it by using choice


问:
How can i send data from Smartwatch to Flutter/companion app
I am trying to develop a system that consists of a smartwatch and a companion app. Companion app will be developed in Flutter. Do you know any way to send the smartwatch data(Heart rate, stress level, steps, locations, etc.) to the Flutter application?</p>

答:
Depending on the smartwatch, I think you have to tap into the native API.
Either that or you need to create a app for the smart device, see flutter wear, that connects to the companion app

Worst case you can try and read from the health app on the phone with the health package health


问:
Visual Studio Code is not taking input from keyboard when I use C++ or Java
While taking input from the user using C++/Java, program is running successful and Visual Studio Code does asks user to input, but when I try to enter anything like a number or a character, it takes no input.

答:
Your program is running in Output tab, therefore it is not possible to take input. Just enable Run in terminal in Visual Studio Code Settings.

Settings (ctrl+,) -> Search settings, look for code runner: run in terminal (check)

Note: It is supposed that you have Code Runner extension installed.


问:
How to get next text node with cheerio

address

http://www.website.com

phone number

Contact email

```
<p>I'm trying to get "address", "http://www.website.com" and "phone number".</p>
<pre class="lang-js prettyprint-override"><code>const address = $("i.icon-home").next();
const website = $("i.icon-website").next();
const phoneNumber = $("i.icon-tel").next();
</code>```

Using next() gives me the next
 element. How can I get the next text element?

答:
The various jQuery-ish methods of Cheerio focus on Element nodes, but you're looking for the content of Text nodes.

The easiest way given the HTML you've shown is to use the underlying DOM(like) element's nextSibling to access its next sibling (which will be the Text node) and get the text from that via nodeValue:

```<code>const address = $("i.icon-home")[0].nextSibling.nodeValue;
const website = $("i.icon-website")[0].nextSibling.nodeValue;
const phoneNumber = $("i.icon-tel")[0].nextSibling.nodeValue;
</code>```

([0] accesses the first matching DOM(ish) element inside the Cheerio collection.)

A couple of notes on that:

You may want to trim whitespace off (by calling trim()), as the whitespace at the beginning and end of the Text nodes is preserved.

If you're unsure whether there will be a Text node (or indeed any node) following the image, you might want to be more defensive:

```<code>const getNextText = (element) => {
    if (!element.nodeName) { // If it's a Cheerio object...
        element = element[0];
    }
    const next = element.nextSibling;
    return next?.nodeType === 3 ? next.nodeValue.trim() : "";
};
</code>```

Then

```<code>const address = getNextText($("i.icon-home"));
const website = getNextText($("i.icon-website"));
const phoneNumber = getNextText($("i.icon-tel"));
</code>```

Title: How to get next text node with cheerio

Body:
address

http://www.website.com

phone number

Contact email

I'm trying to get "address", "http://www.website.com" and "phone number".

const address = $("i.icon-home").next();
const website = $("i.icon-website").next();
const phoneNumber = $("i.icon-tel").next();

Using next() gives me the next
 element. How can I get the next text element?

Body:
The various jQuery-ish methods of Cheerio focus on Element nodes, but you're looking for the content of Text nodes.

The easiest way given the HTML you've shown is to use the underlying DOM(like) element's nextSibling to access its next sibling (which will be the Text node) and get the text from that via nodeValue:

const address = $("i.icon-home")[0].nextSibling.nodeValue;
const website = $("i.icon-website")[0].nextSibling.nodeValue;
const phoneNumber = $("i.icon-tel")[0].nextSibling.nodeValue;

([0] accesses the first matching DOM(ish) element inside the Cheerio collection.)

A couple of notes on that:

You may want to trim whitespace off (by calling trim()), as the whitespace at the beginning and end of the Text nodes is preserved.

If you're unsure whether there will be a Text node (or indeed any node) following the image, you might want to be more defensive:

const getNextText = (element) => {
    if (!element.nodeName) { // If it's a Cheerio object...
        element = element[0];
    }
    const next = element.nextSibling;
    return next?.nodeType === 3 ? next.nodeValue.trim() : "";
};

Then

const address = getNextText($("i.icon-home"));
const website = getNextText($("i.icon-website"));
const phoneNumber = getNextText($("i.icon-tel"));


问:
Full image is not showing in the background
I have a image which I want to completely show as background image .

As you can see in the below image , the girl & the dog is not completely shown:

original image

Is there any css property to completely so the image as the background ? or I have to resize the image ?

Here's my css:

```<code>*{
      margin: 0;
      padding: 0;
}
body{
      background-image: url('../public/images/bg0.jpg');
      height: 100vh;
      background-repeat: no-repeat;
      background-size: cover;
      object-fit: contain;
      transition: background-image 1.5s linear;
}
#__next{
      height: 100%;
}
</code>```

答:
You are using  background-size: cover; so the image will try to fit itself to the element.
You may change properties to  background-repeat:no-repeat; background-size:contain;.

or

using background-position: bottom.

I hope this solve your problem.

Check this W3 out background-size background-image

Body:
I have a image which I want to completely show as background image .

As you can see in the below image , the girl & the dog is not completely shown:

original image

Is there any css property to completely so the image as the background ? or I have to resize the image ?

Here's my css:

*{
      margin: 0;
      padding: 0;
}
body{
      background-image: url('../public/images/bg0.jpg');
      height: 100vh;
      background-repeat: no-repeat;
      background-size: cover;
      object-fit: contain;
      transition: background-image 1.5s linear;
}
#__next{
      height: 100%;
}