问:
Django post nested serializer by javascript FormData
I have these classes:

```<code>class LetterModel(models.Model):
    user = models.ForeignKey(UserModel, on_delete=models.CASCADE, db_column='user', null=True,
                             blank=True)
    part = models.ForeignKey(OrganisationChartModel, on_delete=models.CASCADE, db_column='part', null=True,
                             blank=True)
    title = models.CharField(max_length=256)
    text = models.TextField()
    letter_type = models.CharField(max_length=256)
    priority = models.CharField(max_length=256)
    confidentiality = models.CharField(max_length=256)
    signer = models.ForeignKey(UserModel, on_delete=models.CASCADE, db_column='signer', related_name='signer',
                               null=True, blank=True)
    signer_description = models.CharField(max_length=512, null=True, blank=True)
    created = models.DateTimeField(auto_now=True)

class LetterReceiverModel(models.Model):
    letter = models.ForeignKey(LetterModel, related_name='receivers', on_delete=models.CASCADE,
                               db_column='letter', null=True,
                               blank=True)
    user = models.ForeignKey(UserModel, on_delete=models.CASCADE, db_column='user', null=True,
                             blank=True)
    part = models.ForeignKey(OrganisationChartModel, on_delete=models.CASCADE, db_column='part', null=True,
                             blank=True)

    type = models.CharField(max_length=256)
    comment = models.CharField(max_length=256, null=True, blank=True)
    deadline = models.DateField(null=True, blank=True)
    seen = models.BooleanField(default=False)
    external_full_name = models.CharField(max_length=512, null=True, blank=True)
    external_part_name = models.CharField(max_length=512, null=True, blank=True)
</code>```

And serializers:

```<code>class LetterReceiverSerializer(serializers.ModelSerializer):
    id = serializers.IntegerField(allow_null=True, default=None, read_only=True)

    class Meta:
        model = LetterReceiverModel
        fields = '__all__'
        read_only_fields = ['letter']

class LetterDetailsSerializer(serializers.ModelSerializer):
    receivers = LetterReceiverSerializer(many=True)

    class Meta:
        model = LetterModel
        fields = '__all__'

    def create(self, validated_data):
        return SerializerFunctions.create(validated_data, LetterModel, 'receivers')

    def update(self, instance, validated_data):
        return SerializerFunctions.update(validated_data, instance, 'receivers')
</code>```

It works well by the postman and this submitted JSON :

```<code>{
    "receivers": [
        {
            "id": 1,
            "type": "receiver",
            "comment": ".",
            "deadline": "1401-09-16",
            "seen": false,
            "external_full_name": null,
            "external_part_name": null,
            "user": 3,
            "part": 1
        },
        {
            "id": 2,
            "type": "receiver",
            "comment": "......",
            "deadline": null,
            "seen": false,
            "external_full_name": null,
            "external_part_name": null,
            "user": 3,
            "part": 2
        }
    ],
    "title": "test",
    "text": ".........",
    "letter_type": "...",
    "priority": ".......",
    "confidentiality": "........",
    "signer_description": "........",
    "created": "2022-11-24T05:53:15.690934Z",
    "user": 3,
    "part": 1,
    "signer": 3
}
</code>```

I tried to send data by javascript FormData and I append the nested values like this:

```<code>formData.append('receivers',JSON.stringify(this.receivers))
</code>```

But Django didn't detect receivers and give this error:

receivers: [ "This field is required." ]

How I can add nested objects to FormData?

Body:
I have these classes:

class LetterModel(models.Model):
    user = models.ForeignKey(UserModel, on_delete=models.CASCADE, db_column='user', null=True,
                             blank=True)
    part = models.ForeignKey(OrganisationChartModel, on_delete=models.CASCADE, db_column='part', null=True,
                             blank=True)
    title = models.CharField(max_length=256)
    text = models.TextField()
    letter_type = models.CharField(max_length=256)
    priority = models.CharField(max_length=256)
    confidentiality = models.CharField(max_length=256)
    signer = models.ForeignKey(UserModel, on_delete=models.CASCADE, db_column='signer', related_name='signer',
                               null=True, blank=True)
    signer_description = models.CharField(max_length=512, null=True, blank=True)
    created = models.DateTimeField(auto_now=True)

class LetterReceiverModel(models.Model):
    letter = models.ForeignKey(LetterModel, related_name='receivers', on_delete=models.CASCADE,
                               db_column='letter', null=True,
                               blank=True)
    user = models.ForeignKey(UserModel, on_delete=models.CASCADE, db_column='user', null=True,
                             blank=True)
    part = models.ForeignKey(OrganisationChartModel, on_delete=models.CASCADE, db_column='part', null=True,
                             blank=True)

    type = models.CharField(max_length=256)
    comment = models.CharField(max_length=256, null=True, blank=True)
    deadline = models.DateField(null=True, blank=True)
    seen = models.BooleanField(default=False)
    external_full_name = models.CharField(max_length=512, null=True, blank=True)
    external_part_name = models.CharField(max_length=512, null=True, blank=True)

And serializers:

class LetterReceiverSerializer(serializers.ModelSerializer):
    id = serializers.IntegerField(allow_null=True, default=None, read_only=True)

    class Meta:
        model = LetterReceiverModel
        fields = '__all__'
        read_only_fields = ['letter']

class LetterDetailsSerializer(serializers.ModelSerializer):
    receivers = LetterReceiverSerializer(many=True)

    class Meta:
        model = LetterModel
        fields = '__all__'

    def create(self, validated_data):
        return SerializerFunctions.create(validated_data, LetterModel, 'receivers')

    def update(self, instance, validated_data):
        return SerializerFunctions.update(validated_data, instance, 'receivers')

It works well by the postman and this submitted JSON :

{
    "receivers": [
        {
            "id": 1,
            "type": "receiver",
            "comment": ".",
            "deadline": "1401-09-16",
            "seen": false,
            "external_full_name": null,
            "external_part_name": null,
            "user": 3,
            "part": 1
        },
        {
            "id": 2,
            "type": "receiver",
            "comment": "......",
            "deadline": null,
            "seen": false,
            "external_full_name": null,
            "external_part_name": null,
            "user": 3,
            "part": 2
        }
    ],
    "title": "test",
    "text": ".........",
    "letter_type": "...",
    "priority": ".......",
    "confidentiality": "........",
    "signer_description": "........",
    "created": "2022-11-24T05:53:15.690934Z",
    "user": 3,
    "part": 1,
    "signer": 3
}

I tried to send data by javascript FormData and I append the nested values like this:

formData.append('receivers',JSON.stringify(this.receivers))

But Django didn't detect receivers and give this error:

receivers: [ "This field is required." ]

How I can add nested objects to FormData?


来源: stackexchange

问:
"udevadm info" command is not showing ID_BUS data
I am working on an embedded board having ARM cortex-a53.
To add support of "udevadm" on this board, I have downloaded "buildroot-2022.02" (https://buildroot.org/downloads/buildroot-2022.02.tar.gz) and cross-compile for my platform.

When I run udevadm command on board I am getting the following output.

```<code>root@root:~$ udevadm info /dev/sda
P: /devices/platform/2f0b80000.sata/ata1/host0/target0:0:0/0:0:0:0/block/sda
N: sda
E: DEVNAME=/dev/sda
E: DEVPATH=/devices/platform/2f0b80000.sata/ata1/host0/target0:0:0/0:0:0:0/block/sda
E: DEVTYPE=disk
E: ID_PART_TABLE_TYPE=gpt
E: ID_PART_TABLE_UUID=c3723b53-1411-48bc-8eb4-7481fb489854
E: MAJOR=8
E: MINOR=0
E: SUBSYSTEM=block
E: USEC_INITIALIZED=6485105
</code>```

I didn't get the value of the "ID_BUS" parameter.

Does anyone know the reason, Why I am not getting the "ID_BUS" value?

I have narrowed down this.

When I run "udevadm test /sys/class/block/sda" command I am getting the following o/p

```<code>root@root:~$ udevadm test /sys/class/block/sda
calling: test
version 3.2.11
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

/etc/udev/hwdb.bin does not exist, please run udevadm hwdb --update
Load module index
timestamp of '/etc/udev/rules.d' changed
timestamp of '/run/udev/rules.d' changed
Reading rules file: /lib/udev/rules.d/50-udev-default.rules
specified group 'tty' unknown
specified group 'dialout' unknown
specified group 'kmem' unknown
specified group 'input' unknown
specified group 'video' unknown
specified group 'audio' unknown
specified group 'lp' unknown
specified group 'disk' unknown
specified group 'cdrom' unknown
specified group 'tape' unknown
specified group 'kvm' unknown
Reading rules file: /lib/udev/rules.d/60-block.rules
Reading rules file: /lib/udev/rules.d/60-cdrom_id.rules
Reading rules file: /lib/udev/rules.d/60-drm.rules
Reading rules file: /lib/udev/rules.d/60-evdev.rules
Reading rules file: /lib/udev/rules.d/60-input-id.rules
Reading rules file: /lib/udev/rules.d/60-persistent-alsa.rules
Reading rules file: /lib/udev/rules.d/60-persistent-input.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage-tape.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage.rules
Reading rules file: /lib/udev/rules.d/60-persistent-v4l.rules
Reading rules file: /lib/udev/rules.d/60-sensor.rules
Reading rules file: /lib/udev/rules.d/60-serial.rules
Reading rules file: /lib/udev/rules.d/64-btrfs.rules
Reading rules file: /lib/udev/rules.d/70-joystick.rules
Reading rules file: /lib/udev/rules.d/70-mouse.rules
Reading rules file: /lib/udev/rules.d/70-touchpad.rules
Reading rules file: /lib/udev/rules.d/75-net-description.rules
Reading rules file: /lib/udev/rules.d/75-probe_mtd.rules
Reading rules file: /lib/udev/rules.d/78-sound-card.rules
Reading rules file: /lib/udev/rules.d/80-drivers.rules
Reading rules file: /lib/udev/rules.d/80-net-name-slot.rules
Reading rules file: /etc/udev/rules.d/udev.rules
rules contain 24576 bytes tokens (2048 * 12 bytes), 8335 bytes strings
1096 strings (14316 bytes), 690 de-duplicated (6388 bytes), 407 trie nodes used
GROUP 0 /lib/udev/rules.d/50-udev-default.rules:59
IMPORT 'ata_id --export /dev/sda' /lib/udev/rules.d/60-persistent-storage.rules:38
starting 'ata_id --export /dev/sda'
'ata_id --export /dev/sda'(err) '/lib/udev/ata_id: error while loading shared libraries: libblkid.so.1: cannot open shared object file: No such file or directory'
'ata_id --export /dev/sda' [1728] exit with return code 127
IMPORT 'scsi_id --export --whitelisted -d /dev/sda' /lib/udev/rules.d/60-persistent-storage.rules:50
starting 'scsi_id --export --whitelisted -d /dev/sda'
'scsi_id --export --whitelisted -d /dev/sda'(err) '/lib/udev/scsi_id: error while loading shared libraries: libblkid.so.1: cannot open shared object file: No such file or direc
tory'
'scsi_id --export --whitelisted -d /dev/sda' [1729] exit with return code 127
IMPORT builtin 'path_id' /lib/udev/rules.d/60-persistent-storage.rules:73
IMPORT builtin 'path_id' returned non-zero
IMPORT builtin 'blkid' /lib/udev/rules.d/60-persistent-storage.rules:90
probe /dev/sda raid offset=0
handling device node '/dev/sda', devnum=b8:0, mode=0600, uid=0, gid=0
preserve permissions /dev/sda, 060600, uid=0, gid=0
preserve already existing symlink '/dev/block/8:0' to '../sda'
created db file '/run/udev/data/b8:0' for '/devices/platform/2f0b90000.sata/ata2/host1/target1:0:0/1:0:0:0/block/sda'
ACTION=add
DEVNAME=/dev/sda
DEVPATH=/devices/platform/2f0b90000.sata/ata2/host1/target1:0:0/1:0:0:0/block/sda
DEVTYPE=disk
ID_PART_TABLE_TYPE=gpt
ID_PART_TABLE_UUID=c54841fb-8cb1-424c-a579-900948226b73
MAJOR=8
MINOR=0
SUBSYSTEM=block
USEC_INITIALIZED=6649798
Unload module index
root@root:~$
</code>```

The summary of the above o/p is, The following rule is trying to execute "ata_id --export /dev/sda" command from "/lib/udev/rules.d/60-persistent-storage.rules" file, and getting an error.

```<code>KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $devnode"
</code>```

The error I am getting is

```<code>starting 'ata_id --export /dev/sda'
'ata_id --export /dev/sda'(err) '/lib/udev/ata_id: error while loading shared libraries: libblkid.so.1: cannot open shared object file: No such file or directory'
'ata_id --export /dev/sda' [1728] exit with return code 127
</code>```

But when I run "ata_id --export /dev/sda" command from the terminal I am getting the following o/p. It didn't show an error

```<code>root@root:~$ ata_id --export /dev/sda
ID_ATA=1
ID_TYPE=disk
ID_BUS=ata
ID_MODEL=ST1000NM0011
ID_MODEL_ENC=ST1000NM0011\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2 0\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_REVISION=PA07
ID_SERIAL=ST1000NM0011_Z1N2YF10
ID_SERIAL_SHORT=Z1N2YF10
ID_ATA_WRITE_CACHE=1
ID_ATA_WRITE_CACHE_ENABLED=1
ID_ATA_FEATURE_SET_HPA=1
ID_ATA_FEATURE_SET_HPA_ENABLED=1
ID_ATA_FEATURE_SET_PM=1
ID_ATA_FEATURE_SET_PM_ENABLED=1
ID_ATA_FEATURE_SET_SECURITY=1
ID_ATA_FEATURE_SET_SECURITY_ENABLED=0
ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=150
ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=150
ID_ATA_FEATURE_SET_SMART=1
ID_ATA_FEATURE_SET_SMART_ENABLED=1
ID_ATA_DOWNLOAD_MICROCODE=1
ID_ATA_SATA=1
ID_ATA_SATA_SIGNAL_RATE_GEN2=1
ID_ATA_SATA_SIGNAL_RATE_GEN1=1
ID_ATA_ROTATION_RATE_RPM=7200
ID_WWN=0x5000c5004ecabf57
ID_WWN_WITH_EXTENSION=0x5000c5004ecabf57
root@root:~$
</code>```

When I run ldd command on ata_id, it didn't know any linking problem.

```<code>root@root:~$ ldd /lib/udev/ata_id
linux-vdso.so.1 (0x0000007fbd357000)
libblkid.so.1 => /lib/libblkid.so.1 (0x0000007fbd2a5000)
libkmod.so.2 => /lib/libkmod.so.2 (0x0000007fbd281000)
libc.so.6 => /lib/libc.so.6 (0x0000007fbd117000)
/lib/ld-linux-aarch64.so.1 (0x0000007fbd329000)
root@root:~$ ls -l /lib/libblkid.so.1*
lrwxrwxrwx 1 root root 17 Sep 30 05:19 /lib/libblkid.so.1 -> libblkid.so.1.1.0
-rwxr-xr-x 1 root root 316112 Nov 29 12:01 /lib/libblkid.so.1.1.0
root@root:~$
</code>```

So my question is, Why does udev rule throw an error?

ContentLicense: CC BY-SA 4.0

Body:
I am working on an embedded board having ARM cortex-a53.
To add support of "udevadm" on this board, I have downloaded "buildroot-2022.02" (https://buildroot.org/downloads/buildroot-2022.02.tar.gz) and cross-compile for my platform.

When I run udevadm command on board I am getting the following output.

root@root:~$ udevadm info /dev/sda
P: /devices/platform/2f0b80000.sata/ata1/host0/target0:0:0/0:0:0:0/block/sda
N: sda
E: DEVNAME=/dev/sda
E: DEVPATH=/devices/platform/2f0b80000.sata/ata1/host0/target0:0:0/0:0:0:0/block/sda
E: DEVTYPE=disk
E: ID_PART_TABLE_TYPE=gpt
E: ID_PART_TABLE_UUID=c3723b53-1411-48bc-8eb4-7481fb489854
E: MAJOR=8
E: MINOR=0
E: SUBSYSTEM=block
E: USEC_INITIALIZED=6485105

I didn't get the value of the "ID_BUS" parameter.

Does anyone know the reason, Why I am not getting the "ID_BUS" value?

I have narrowed down this.

When I run "udevadm test /sys/class/block/sda" command I am getting the following o/p

root@root:~$ udevadm test /sys/class/block/sda
calling: test
version 3.2.11
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

/etc/udev/hwdb.bin does not exist, please run udevadm hwdb --update
Load module index
timestamp of '/etc/udev/rules.d' changed
timestamp of '/run/udev/rules.d' changed
Reading rules file: /lib/udev/rules.d/50-udev-default.rules
specified group 'tty' unknown
specified group 'dialout' unknown
specified group 'kmem' unknown
specified group 'input' unknown
specified group 'video' unknown
specified group 'audio' unknown
specified group 'lp' unknown
specified group 'disk' unknown
specified group 'cdrom' unknown
specified group 'tape' unknown
specified group 'kvm' unknown
Reading rules file: /lib/udev/rules.d/60-block.rules
Reading rules file: /lib/udev/rules.d/60-cdrom_id.rules
Reading rules file: /lib/udev/rules.d/60-drm.rules
Reading rules file: /lib/udev/rules.d/60-evdev.rules
Reading rules file: /lib/udev/rules.d/60-input-id.rules
Reading rules file: /lib/udev/rules.d/60-persistent-alsa.rules
Reading rules file: /lib/udev/rules.d/60-persistent-input.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage-tape.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage.rules
Reading rules file: /lib/udev/rules.d/60-persistent-v4l.rules
Reading rules file: /lib/udev/rules.d/60-sensor.rules
Reading rules file: /lib/udev/rules.d/60-serial.rules
Reading rules file: /lib/udev/rules.d/64-btrfs.rules
Reading rules file: /lib/udev/rules.d/70-joystick.rules
Reading rules file: /lib/udev/rules.d/70-mouse.rules
Reading rules file: /lib/udev/rules.d/70-touchpad.rules
Reading rules file: /lib/udev/rules.d/75-net-description.rules
Reading rules file: /lib/udev/rules.d/75-probe_mtd.rules
Reading rules file: /lib/udev/rules.d/78-sound-card.rules
Reading rules file: /lib/udev/rules.d/80-drivers.rules
Reading rules file: /lib/udev/rules.d/80-net-name-slot.rules
Reading rules file: /etc/udev/rules.d/udev.rules
rules contain 24576 bytes tokens (2048 * 12 bytes), 8335 bytes strings
1096 strings (14316 bytes), 690 de-duplicated (6388 bytes), 407 trie nodes used
GROUP 0 /lib/udev/rules.d/50-udev-default.rules:59
IMPORT 'ata_id --export /dev/sda' /lib/udev/rules.d/60-persistent-storage.rules:38
starting 'ata_id --export /dev/sda'
'ata_id --export /dev/sda'(err) '/lib/udev/ata_id: error while loading shared libraries: libblkid.so.1: cannot open shared object file: No such file or directory'
'ata_id --export /dev/sda' [1728] exit with return code 127
IMPORT 'scsi_id --export --whitelisted -d /dev/sda' /lib/udev/rules.d/60-persistent-storage.rules:50
starting 'scsi_id --export --whitelisted -d /dev/sda'
'scsi_id --export --whitelisted -d /dev/sda'(err) '/lib/udev/scsi_id: error while loading shared libraries: libblkid.so.1: cannot open shared object file: No such file or direc
tory'
'scsi_id --export --whitelisted -d /dev/sda' [1729] exit with return code 127
IMPORT builtin 'path_id' /lib/udev/rules.d/60-persistent-storage.rules:73
IMPORT builtin 'path_id' returned non-zero
IMPORT builtin 'blkid' /lib/udev/rules.d/60-persistent-storage.rules:90
probe /dev/sda raid offset=0
handling device node '/dev/sda', devnum=b8:0, mode=0600, uid=0, gid=0
preserve permissions /dev/sda, 060600, uid=0, gid=0
preserve already existing symlink '/dev/block/8:0' to '../sda'
created db file '/run/udev/data/b8:0' for '/devices/platform/2f0b90000.sata/ata2/host1/target1:0:0/1:0:0:0/block/sda'
ACTION=add
DEVNAME=/dev/sda
DEVPATH=/devices/platform/2f0b90000.sata/ata2/host1/target1:0:0/1:0:0:0/block/sda
DEVTYPE=disk
ID_PART_TABLE_TYPE=gpt
ID_PART_TABLE_UUID=c54841fb-8cb1-424c-a579-900948226b73
MAJOR=8
MINOR=0
SUBSYSTEM=block
USEC_INITIALIZED=6649798
Unload module index
root@root:~$

The summary of the above o/p is, The following rule is trying to execute "ata_id --export /dev/sda" command from "/lib/udev/rules.d/60-persistent-storage.rules" file, and getting an error.

KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $devnode"

The error I am getting is

starting 'ata_id --export /dev/sda'
'ata_id --export /dev/sda'(err) '/lib/udev/ata_id: error while loading shared libraries: libblkid.so.1: cannot open shared object file: No such file or directory'
'ata_id --export /dev/sda' [1728] exit with return code 127

But when I run "ata_id --export /dev/sda" command from the terminal I am getting the following o/p. It didn't show an error

root@root:~$ ata_id --export /dev/sda
ID_ATA=1
ID_TYPE=disk
ID_BUS=ata
ID_MODEL=ST1000NM0011
ID_MODEL_ENC=ST1000NM0011\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2 0\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_REVISION=PA07
ID_SERIAL=ST1000NM0011_Z1N2YF10
ID_SERIAL_SHORT=Z1N2YF10
ID_ATA_WRITE_CACHE=1
ID_ATA_WRITE_CACHE_ENABLED=1
ID_ATA_FEATURE_SET_HPA=1
ID_ATA_FEATURE_SET_HPA_ENABLED=1
ID_ATA_FEATURE_SET_PM=1
ID_ATA_FEATURE_SET_PM_ENABLED=1
ID_ATA_FEATURE_SET_SECURITY=1
ID_ATA_FEATURE_SET_SECURITY_ENABLED=0
ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=150
ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=150
ID_ATA_FEATURE_SET_SMART=1
ID_ATA_FEATURE_SET_SMART_ENABLED=1
ID_ATA_DOWNLOAD_MICROCODE=1
ID_ATA_SATA=1
ID_ATA_SATA_SIGNAL_RATE_GEN2=1
ID_ATA_SATA_SIGNAL_RATE_GEN1=1
ID_ATA_ROTATION_RATE_RPM=7200
ID_WWN=0x5000c5004ecabf57
ID_WWN_WITH_EXTENSION=0x5000c5004ecabf57
root@root:~$

When I run ldd command on ata_id, it didn't know any linking problem.

root@root:~$ ldd /lib/udev/ata_id
linux-vdso.so.1 (0x0000007fbd357000)
libblkid.so.1 => /lib/libblkid.so.1 (0x0000007fbd2a5000)
libkmod.so.2 => /lib/libkmod.so.2 (0x0000007fbd281000)
libc.so.6 => /lib/libc.so.6 (0x0000007fbd117000)
/lib/ld-linux-aarch64.so.1 (0x0000007fbd329000)
root@root:~$ ls -l /lib/libblkid.so.1*
lrwxrwxrwx 1 root root 17 Sep 30 05:19 /lib/libblkid.so.1 -> libblkid.so.1.1.0
-rwxr-xr-x 1 root root 316112 Nov 29 12:01 /lib/libblkid.so.1.1.0
root@root:~$

So my question is, Why does udev rule throw an error?


问:
Pivoting DB2 data on multiple conditions
I'm trying to get a query together that selects products based on a combination of data (body type, materials and colors,etc.) and I've gotten close but I'm still missing a step to get exactly what I want. I've been looking more at pivoting data and I've tinkered with this query but I'm still left with this issue.

Basically, I have multiple products that only have one material and color attributed to them and they each have a unique stock keeping ID, but some of the body types will have 2 materials and colors per stock keeping unit.

My current results in this db fiddle https://www.db-fiddle.com/f/u4zKAdw3H4hFLbfnzEeZS2/1
are as shown:

For the most part the results are there but BodB has the same color for both materials and should be one single row like BoDB | Fabric | Black | Leather | Black

So if one body code is attached to 2 different materials but the same color with sequence 1 and 2, it should be a single row effectively grouped by the body and the color (the materials wouldn't be the same, only the color. And there will only ever be up to 2 materials and colors on a given stock keeping unit

The fiddle is ready to go with these results, any help is much appreciated


问:
Error 'make failed' when installing redis
I run 'pnpm install' on a project on wsl2 Ubuntu 20.04 and then it throws this error. Anyone knows the root cause and how I can fix it? Thanks.


问:
how to make a python script to generate a DSDplus.frequencies file?
I was wondering if anyone knew if it was possible to make a python script to generate the DSDplus.frequencies file? The basic idea is the script would first prompt you to enter:

protocol

networkID

siteNumber

OTAchannelNumber

TXfrequency

RXfrequency

sortOrder

once entered, it would insert it into a line in the DSDplus.frequencies file, starting at line 8. it would then ask you if you wish to add another entry. if you said yes, it would increment the line number by 1, and then repeat the prompts. if you said no, it would write the file as DSDplus.frequencies

this is an example of a complete DSDplus.frequencies file

```<code>
; DSD+ frequency file
;
; line format:
;
;  protocol, network ID, site number, OTA channel number, TX frequency, RX frequency, sort order

; Casino Rama

Con+, 114, 1, 1, 859.025, 0.0, 0
Con+, 114, 1, 3, 858.775, 0.0, 0
Con+, 114, 1, 5, 858.525, 0.0, 0
Con+, 114, 1, 7, 858.275, 0.0, 0
Con+, 114, 1, 9, 858.025, 0.0, 0

; TURBO CONNECT Site 12, Toronto

Con+, 158, 12, 1, 451.5125, 0.0, 0
Con+, 158, 12, 3, 454.1625, 0.0, 0
Con+, 158, 12, 5, 462.7375, 0.0, 0

Con+, 158, 12, 7, 411.5875, 0.0, 0
Con+, 158, 12, 9, 421.3000, 0.0, 0
Con+, 158, 12, 11, 452.2375, 0.0, 0

; GOTURBO Site 7, Toronto

Con+, 202, 7, 1, 451.2375, 0.0, 0
Con+, 202, 7, 3, 452.3125, 0.0, 0
Con+, 202, 7, 5, 452.4875, 0.0, 0
Con+, 202, 7, 7, 453.3625, 0.0, 0
Con+, 202, 7, 9, 453.8125, 0.0, 0

; MBC Toronto

NEXEDGE96, 2000, 1, 1, 451.0375, 0.0, 0
NEXEDGE96, 2000, 1, 2, 452.3125, 0.0, 0
NEXEDGE96, 2000, 1, 3, 453.3625, 0.0, 0   ; CC
NEXEDGE96, 2000, 1, 4, 454.4625, 0.0, 0
NEXEDGE96, 2000, 1, 5, 463.1875, 0.0, 0
NEXEDGE96, 2000, 1, 6, 463.9125, 0.0, 0

; OnQue Site 1, Toronto (CN Tower)
;
; Neighbours: 2 3 4 6 7 8 16 29

NEXEDGE48, 202, 1, 35, 422.20625, 0.0, 1
NEXEDGE48, 202, 1, 46, 422.30625, 0.0, 2
NEXEDGE48, 202, 1, 56, 422.40625, 0.0, 3
NEXEDGE48, 202, 1, 67, 422.50625, 0.0, 4
NEXEDGE48, 202, 1, 77, 422.60625, 0.0, 5
NEXEDGE48, 202, 1, 34, 422.20000, 0.0, 6   ; CC
NEXEDGE48, 202, 1, 45, 422.30000, 0.0, 7   ; CC
NEXEDGE48, 202, 1, 55, 422.40000, 0.0, 8
NEXEDGE48, 202, 1, 66, 422.50000, 0.0, 9
NEXEDGE48, 202, 1, 76, 422.60000, 0.0, 10
NEXEDGE48, 202, 1, 40, 422.23750, 0.0, 11
NEXEDGE48, 202, 1, 50, 422.33750, 0.0, 12
NEXEDGE48, 202, 1, 61, 422.43750, 0.0, 13
NEXEDGE48, 202, 1, 71, 422.53750, 0.0, 14
NEXEDGE48, 202, 1, 82, 422.63750, 0.0, 15   ; CC
NEXEDGE48, 202, 1, 36, 422.21250, 0.0, 16
NEXEDGE48, 202, 1, 47, 422.31250, 0.0, 17
NEXEDGE48, 202, 1, 57, 422.41250, 0.0, 18
NEXEDGE48, 202, 1, 68, 422.51250, 0.0, 19
NEXEDGE48, 202, 1, 78, 422.61250, 0.0, 20

; OnQue Site 2, Barrie (33 Beacon Road)
;
; Neighbours: 1 6 8 18 19 28 31

NEXEDGE48, 202, 2, 38, 422.22500, 0.0, 0
NEXEDGE48, 202, 2, 59, 422.42500, 0.0, 0   ; CC
NEXEDGE48, 202, 2, 183, 422.32500, 0.0, 0
NEXEDGE48, 202, 2, 193, 422.52500, 0.0, 0   ; CC

etc...

</code>```

Body:
I was wondering if anyone knew if it was possible to make a python script to generate the DSDplus.frequencies file? The basic idea is the script would first prompt you to enter:

protocol

networkID

siteNumber

OTAchannelNumber

TXfrequency

RXfrequency

sortOrder

once entered, it would insert it into a line in the DSDplus.frequencies file, starting at line 8. it would then ask you if you wish to add another entry. if you said yes, it would increment the line number by 1, and then repeat the prompts. if you said no, it would write the file as DSDplus.frequencies

this is an example of a complete DSDplus.frequencies file

; DSD+ frequency file
;
; line format:
;
;  protocol, network ID, site number, OTA channel number, TX frequency, RX frequency, sort order

; Casino Rama

Con+, 114, 1, 1, 859.025, 0.0, 0
Con+, 114, 1, 3, 858.775, 0.0, 0
Con+, 114, 1, 5, 858.525, 0.0, 0
Con+, 114, 1, 7, 858.275, 0.0, 0
Con+, 114, 1, 9, 858.025, 0.0, 0

; TURBO CONNECT Site 12, Toronto

Con+, 158, 12, 1, 451.5125, 0.0, 0
Con+, 158, 12, 3, 454.1625, 0.0, 0
Con+, 158, 12, 5, 462.7375, 0.0, 0

Con+, 158, 12, 7, 411.5875, 0.0, 0
Con+, 158, 12, 9, 421.3000, 0.0, 0
Con+, 158, 12, 11, 452.2375, 0.0, 0

; GOTURBO Site 7, Toronto

Con+, 202, 7, 1, 451.2375, 0.0, 0
Con+, 202, 7, 3, 452.3125, 0.0, 0
Con+, 202, 7, 5, 452.4875, 0.0, 0
Con+, 202, 7, 7, 453.3625, 0.0, 0
Con+, 202, 7, 9, 453.8125, 0.0, 0

; MBC Toronto

NEXEDGE96, 2000, 1, 1, 451.0375, 0.0, 0
NEXEDGE96, 2000, 1, 2, 452.3125, 0.0, 0
NEXEDGE96, 2000, 1, 3, 453.3625, 0.0, 0   ; CC
NEXEDGE96, 2000, 1, 4, 454.4625, 0.0, 0
NEXEDGE96, 2000, 1, 5, 463.1875, 0.0, 0
NEXEDGE96, 2000, 1, 6, 463.9125, 0.0, 0

; OnQue Site 1, Toronto (CN Tower)
;
; Neighbours: 2 3 4 6 7 8 16 29

NEXEDGE48, 202, 1, 35, 422.20625, 0.0, 1
NEXEDGE48, 202, 1, 46, 422.30625, 0.0, 2
NEXEDGE48, 202, 1, 56, 422.40625, 0.0, 3
NEXEDGE48, 202, 1, 67, 422.50625, 0.0, 4
NEXEDGE48, 202, 1, 77, 422.60625, 0.0, 5
NEXEDGE48, 202, 1, 34, 422.20000, 0.0, 6   ; CC
NEXEDGE48, 202, 1, 45, 422.30000, 0.0, 7   ; CC
NEXEDGE48, 202, 1, 55, 422.40000, 0.0, 8
NEXEDGE48, 202, 1, 66, 422.50000, 0.0, 9
NEXEDGE48, 202, 1, 76, 422.60000, 0.0, 10
NEXEDGE48, 202, 1, 40, 422.23750, 0.0, 11
NEXEDGE48, 202, 1, 50, 422.33750, 0.0, 12
NEXEDGE48, 202, 1, 61, 422.43750, 0.0, 13
NEXEDGE48, 202, 1, 71, 422.53750, 0.0, 14
NEXEDGE48, 202, 1, 82, 422.63750, 0.0, 15   ; CC
NEXEDGE48, 202, 1, 36, 422.21250, 0.0, 16
NEXEDGE48, 202, 1, 47, 422.31250, 0.0, 17
NEXEDGE48, 202, 1, 57, 422.41250, 0.0, 18
NEXEDGE48, 202, 1, 68, 422.51250, 0.0, 19
NEXEDGE48, 202, 1, 78, 422.61250, 0.0, 20

; OnQue Site 2, Barrie (33 Beacon Road)
;
; Neighbours: 1 6 8 18 19 28 31

NEXEDGE48, 202, 2, 38, 422.22500, 0.0, 0
NEXEDGE48, 202, 2, 59, 422.42500, 0.0, 0   ; CC
NEXEDGE48, 202, 2, 183, 422.32500, 0.0, 0
NEXEDGE48, 202, 2, 193, 422.52500, 0.0, 0   ; CC

etc...


问:
How to use GetGeoCoding in delphi
The idea is to get the coordinates of an address and be able to use these coordinates in the code that follows. This should all happen in one function. Now, converting the address to coordinates is not the problem. this just works. Only when I assign the longitude and latitude to a variable it does not give any values when I call the variables later in the function. TTMSFNCGeoCoding is used for this.

```<code>    Function TestFunction:Boolean;
    var
    ALongitude,ALatitude : string;
    FstartAdres : TTMSFNCMapsCoordinateRec;
    begin

    TMSFNCGeocoding1.GetGeocoding('New York',
    procedure(const ARequest : TTMSFNCGeocodingRequest;
     const ARequestResult : TTMSFNCCloudBaseRequestResult)
     begin
     FStartAdres := ARequest.Items[0].Coordinate.ToRec;
     ALongitude := FloatToStr(FstartAdres.Longitude);
     ALatitude := FloatToStr(FStartAdres.Latitude);
     end);

//for example i want to show the data
    showmessage(ALongitude); //message is empty
    showmessage(ALatitude);//message is empty
    end;
</code>```

if I have forgotten important information let me know

Title: How to use GetGeoCoding in delphi

Body:
The idea is to get the coordinates of an address and be able to use these coordinates in the code that follows. This should all happen in one function. Now, converting the address to coordinates is not the problem. this just works. Only when I assign the longitude and latitude to a variable it does not give any values when I call the variables later in the function. TTMSFNCGeoCoding is used for this.

    Function TestFunction:Boolean;
    var
    ALongitude,ALatitude : string;
    FstartAdres : TTMSFNCMapsCoordinateRec;
    begin

    TMSFNCGeocoding1.GetGeocoding('New York',
    procedure(const ARequest : TTMSFNCGeocodingRequest;
     const ARequestResult : TTMSFNCCloudBaseRequestResult)
     begin
     FStartAdres := ARequest.Items[0].Coordinate.ToRec;
     ALongitude := FloatToStr(FstartAdres.Longitude);
     ALatitude := FloatToStr(FStartAdres.Latitude);
     end);

//for example i want to show the data
    showmessage(ALongitude); //message is empty
    showmessage(ALatitude);//message is empty
    end;

if I have forgotten important information let me know


问:
Unable to solve a LP Problem in python using docplex
```<code>from docplex.mp.model import Model

m = Model(name="LP_Problem")
x1 = m.continuous_var(name="x1")
x2 = m.continuous_var(name="x2")
c11 = m.add_constraint( x1 + x2 <=  722)
c12 = m.add_constraint( 25 * x1 + x2 <= 685)
c13 = m.add_constraint( 48 * x1 + x2 <= 678.05)
c14 = m.add_constraint( x1 + x2 >= 705)
c15 = m.add_constraint( 25 * x1 + x2 >= 658.25)
c16 = m.add_constraint( 48 * x1 + x2 >= 650)
m.minimize(2085.05 - 74 * x1 - 3 * x2)
m.print_information()
s = m.solve()
m.print_solution()
</code>```

OUTPUT

```<code>(venv) C:\Usears\goram\Code_files>python C:\Users\goram\Code_files\exp.py
Model: LP_Problem
 - number of variables: 2
   - binary=0, integer=0, continuous=2
 - number of constraints: 6
   - linear=6
 - parameters: defaults
 - objective: minimize
 - problem type is: LP
Traceback (most recent call last):
  File "C:\Users\goram\Code_files\exp.py", line 15, in <module>
    m.print_solution()
  File "C:\Users\goram\Code_files\venv\lib\site-packages\docplex\mp\model.py", line 6071, in print_solution
    self._check_has_solution()
  File "C:\Users\goram\Code_files\venv\lib\site-packages\docplex\mp\model.py", line 5189, in _check_has_solution
    self.fatal("Model<{0}> did not solve successfully", self.name)
  File "C:\Users\goram\Code_files\venv\lib\site-packages\docplex\mp\model.py", line 1080, in fatal
    self._error_handler.fatal(msg, args)
  File "C:\Users\goram\Code_files\venv\lib\site-packages\docplex\mp\error_handler.py", line 210, in fatal
    raise DOcplexException(resolved_message)
docplex.mp.utils.DOcplexException: Model<LP_Problem>
did not solve successfully
</code>```

Body:
from docplex.mp.model import Model

m = Model(name="LP_Problem")
x1 = m.continuous_var(name="x1")
x2 = m.continuous_var(name="x2")
c11 = m.add_constraint( x1 + x2 <=  722)
c12 = m.add_constraint( 25 * x1 + x2 <= 685)
c13 = m.add_constraint( 48 * x1 + x2 <= 678.05)
c14 = m.add_constraint( x1 + x2 >= 705)
c15 = m.add_constraint( 25 * x1 + x2 >= 658.25)
c16 = m.add_constraint( 48 * x1 + x2 >= 650)
m.minimize(2085.05 - 74 * x1 - 3 * x2)
m.print_information()
s = m.solve()
m.print_solution()

OUTPUT

(venv) C:\Usears\goram\Code_files>python C:\Users\goram\Code_files\exp.py
Model: LP_Problem
 - number of variables: 2
   - binary=0, integer=0, continuous=2
 - number of constraints: 6
   - linear=6
 - parameters: defaults
 - objective: minimize
 - problem type is: LP
Traceback (most recent call last):
  File "C:\Users\goram\Code_files\exp.py", line 15, in <module>
    m.print_solution()
  File "C:\Users\goram\Code_files\venv\lib\site-packages\docplex\mp\model.py", line 6071, in print_solution
    self._check_has_solution()
  File "C:\Users\goram\Code_files\venv\lib\site-packages\docplex\mp\model.py", line 5189, in _check_has_solution
    self.fatal("Model<{0}> did not solve successfully", self.name)
  File "C:\Users\goram\Code_files\venv\lib\site-packages\docplex\mp\model.py", line 1080, in fatal
    self._error_handler.fatal(msg, args)
  File "C:\Users\goram\Code_files\venv\lib\site-packages\docplex\mp\error_handler.py", line 210, in fatal
    raise DOcplexException(resolved_message)
docplex.mp.utils.DOcplexException: Model<LP_Problem>
did not solve successfully


问:
Stock Market Simulator Tech Stack Question and integrating with firebase
I am making a stock market simulator website for an event. It will be an event where about 200-300 people will participate as investors.

There will be 3 databases, one for all available stock (Industry, Company, Price etc.), one for all investors (Name, Stocks Owned etc.) and one to store all trades that happened. It also needs to run fast as transaction related calculations need to happen quickly to avoid any conflict with other investors.

I have the website written in React, but I'm not sure about what to use for the backend. I was going to use a python framework with firebase, but I think this would be too slow as it is an app that needs to be working live. Also, any pointer towards a good architecture to use would be nice too! I was thinking a basic microservices architecture (without actual RestAPI's but just file calls as this increases hosting cost), but I'm not sure if this would be the best for my use case.

Any help is appreciated!


问:
Vetiver Error when connecting to board: Error in order(results$name) : argument 1 is not a vector
Summary/Context
I am attempting to deploy a model from R to Google Cloud.

I am following these steps/tutorial from the vetiver GitHub.

I am using the sample data provided in the tutorial except I am attempting to deploy the model to Google Cloud, see code & error below:

```<code>library(parsnip)
library(workflows)
library(vetiver)
library(pins)
data(Sacramento, package = "modeldata")

rf_spec <- rand_forest(mode = "regression")
rf_form <- price ~ type + sqft + beds + baths

rf_fit <-
  workflow(rf_form, rf_spec) %>%
  fit(Sacramento)

v <- vetiver_model(rf_fit, "sacramento_rf")
v

model_board <- board_register_gcloud( name = "lead-time-model"
                                     ,bucket = "pro_lead_time_prediction_bucket" )

model_board
</code>```

The error I get when I run model_board is:

```<code>Error in order(results$name) : argument 1 is not a vector
</code>```

Part of my confusion is that my vetiver model object ran without issue:

```<code>v
-- sacramento_rf - <bundled_workflow> model for deployment
    A ranger regression modeling workflow using 4 features
</code>```

Other error:

```<code>model_board %>% pin(v)
Error in path_tidy(.Call(fs_path_, lapply(args, function(x) enc2utf8(as.character(x))),  :
  Total path length must be less than PATH_MAX: 260
</code>```

Could the problem stem from authenticating or not connecting correctly to gcloud? I have SDK installed and authenticated as well.

Body:
Summary/Context
I am attempting to deploy a model from R to Google Cloud.

I am following these steps/tutorial from the vetiver GitHub.

I am using the sample data provided in the tutorial except I am attempting to deploy the model to Google Cloud, see code & error below:

library(parsnip)
library(workflows)
library(vetiver)
library(pins)
data(Sacramento, package = "modeldata")

rf_spec <- rand_forest(mode = "regression")
rf_form <- price ~ type + sqft + beds + baths

rf_fit <-
  workflow(rf_form, rf_spec) %>%
  fit(Sacramento)

v <- vetiver_model(rf_fit, "sacramento_rf")
v

model_board <- board_register_gcloud( name = "lead-time-model"
                                     ,bucket = "pro_lead_time_prediction_bucket" )

model_board

The error I get when I run model_board is:

Error in order(results$name) : argument 1 is not a vector

Part of my confusion is that my vetiver model object ran without issue:

v
-- sacramento_rf - <bundled_workflow> model for deployment
    A ranger regression modeling workflow using 4 features

Other error:

model_board %>% pin(v)
Error in path_tidy(.Call(fs_path_, lapply(args, function(x) enc2utf8(as.character(x))),  :
  Total path length must be less than PATH_MAX: 260

Could the problem stem from authenticating or not connecting correctly to gcloud? I have SDK installed and authenticated as well.


问:
How to overlay the entire activity with cuts?
I have created

new view, which is added to activity.xml

class, which operate this view -> in this class I create overlay for entire screen and cut in one place rounder place, but I do not why it does not want to be cut further than a fragment creates own elements (look at the screen)

```<code>class TutorialView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0
) : View(context, attrs, defStyleAttr) {

    override fun onDraw(canvas: Canvas?) {
        super.onDraw(canvas)
        drawTransparentLayout(canvas)
    }

fun drawTransparentLayout(canvas: Canvas?) {
from xml it is color ->     <color name="tutorial_background">#BF000000</color>

        val mPath = Path()
        mPath.fillType = Path.FillType.WINDING
        mPath.addRect(0F, 0F, widthView, heightView, Path.Direction.CW)
        mPath.addRoundRect(20F, 130F, widthMenu, heightMenu, 50F, 50F, Path.Direction.CCW)
        val mPaintHole = Paint(Paint.ANTI_ALIAS_FLAG)
        mPaintHole.style = Paint.Style.FILL
        mPaintHole.color = backGroundTransparentBlack
        if (canvas != null)
            canvas!!.drawPath(mPath, mPaintHole)
}
</code>```

In screen you can see it only fills with half of the rectangle, because tabs is fragment element. A little another the wait space it starts.

Body:
I have created

new view, which is added to activity.xml

class, which operate this view -> in this class I create overlay for entire screen and cut in one place rounder place, but I do not why it does not want to be cut further than a fragment creates own elements (look at the screen)

class TutorialView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0
) : View(context, attrs, defStyleAttr) {

    override fun onDraw(canvas: Canvas?) {
        super.onDraw(canvas)
        drawTransparentLayout(canvas)
    }

fun drawTransparentLayout(canvas: Canvas?) {
from xml it is color ->     <color name="tutorial_background">#BF000000</color>

        val mPath = Path()
        mPath.fillType = Path.FillType.WINDING
        mPath.addRect(0F, 0F, widthView, heightView, Path.Direction.CW)
        mPath.addRoundRect(20F, 130F, widthMenu, heightMenu, 50F, 50F, Path.Direction.CCW)
        val mPaintHole = Paint(Paint.ANTI_ALIAS_FLAG)
        mPaintHole.style = Paint.Style.FILL
        mPaintHole.color = backGroundTransparentBlack
        if (canvas != null)
            canvas!!.drawPath(mPath, mPaintHole)
}

In screen you can see it only fills with half of the rectangle, because tabs is fragment element. A little another the wait space it starts.


问:
Error when I using SwiftUI with CoreData and 2 SQLite database files with same database structure
I created SwiftUI project with coredata.
I duplicated PersistenceController to be PersistenceController2 that for handle 2nd SQLite file.

Here is code of PersistenceController

```<code>import CoreData

class PersistenceController {
    static let shared = PersistenceController()
    let container: NSPersistentContainer

func urlApplicationSupportDirectory() -> URL {
    let paths = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask)
    let documentsDirectory = paths[0]
    return documentsDirectory
}

func sqliteURL() -> URL {
    let url = urlApplicationSupportDirectory().appendingPathComponent("MM1.SQLite")
    return url
}

init(inMemory: Bool = false) {
    container = NSPersistentContainer(name: "testCoreData")

    if inMemory {
        container.persistentStoreDescriptions.first!.url = URL(fileURLWithPath: "/dev/null")
    }

    let url = sqliteURL()
    print(url.absoluteString)

    let description = NSPersistentStoreDescription(url: url)
    description.shouldMigrateStoreAutomatically = true
    description.shouldInferMappingModelAutomatically = true
    container.persistentStoreDescriptions = [description]

    container.viewContext.automaticallyMergesChangesFromParent = true
    container.loadPersistentStores(completionHandler: { (storeDescription, error) in
        if let error = error as NSError? {
            fatalError("Unresolved error \(error), \(error.userInfo)")
        }
    })
}
</code>```

}

PersistenceController2 is difference at filename only "MM1.SQLite" to be "MM2.SQLite"

Then I create TabBarView like this code.

```<code>import SwiftUI

struct TabBarView: View {

    var body: some View {
        TabView {
            ContentView()
                .tabItem {
                    Text("1")
                    //Image("TabIcon"+"Account")
                    Image(systemName: "list.bullet.rectangle.portrait")
                }
                .environment(\.managedObjectContext, PersistenceController.shared.container.viewContext)

            ContentView()
                .tabItem {
                    Text("2")
                    //Image("TabIcon"+"Account")
                    Image(systemName: "list.bullet.rectangle.portrait")
                }
                .environment(\.managedObjectContext, PersistenceController2.shared.container.viewContext)
        }
    }
}
</code>```

When I comment 1st TabView and run only 2nd TabView, It can run correctly MM2.SQLite can store data normally.
When I command 2nd TabView and run only 1st TabView, It can run correctly MM1.SQLite can store data normally.

But the problem is ... When I opened comment and run both TabView, it cannot run and show message error like this below.

```<code>2022-12-07 21:06:41.411772+0700 testCoreData[38345:1010632] [error] warning: Multiple NSEntityDescriptions claim the NSManagedObject subclass 'Item' so +entity is unable to disambiguate.
CoreData: warning: Multiple NSEntityDescriptions claim the NSManagedObject subclass 'Item' so +entity is unable to disambiguate.
2022-12-07 21:06:41.412037+0700 testCoreData[38345:1010632] [error] warning:     'Item' (0x60000083c630) from NSManagedObjectModel (0x600001c169e0) claims 'Item'.
CoreData: warning:       'Item' (0x60000083c630) from NSManagedObjectModel (0x600001c169e0) claims 'Item'.
2022-12-07 21:06:41.412175+0700 testCoreData[38345:1010632] [error] warning:     'Item' (0x6000008306e0) from NSManagedObjectModel (0x600001c105a0) claims 'Item'.
CoreData: warning:       'Item' (0x6000008306e0) from NSManagedObjectModel (0x600001c105a0) claims 'Item'.
2022-12-07 21:06:41.412302+0700 testCoreData[38345:1010632] [error] error: +[Item entity] Failed to find a unique match for an NSEntityDescription to a managed object subclass
CoreData: error: +[Item entity] Failed to find a unique match for an NSEntityDescription to a managed object subclass
2022-12-07 21:06:41.557326+0700 testCoreData[38345:1010632] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'executeFetchRequest:error: A fetch request must have an entity.'
</code>```

May you help me for some suggestion to solved this error?

[Edit/Add more information]
Actually, I have an experience with multiple containers without SwiftUI. Please see below sample project that can run 2 containers with 2 database files "MM1.SQLite" and "MM2.SQLite". So if you all have some suggestions how to implement 2 container core data with SwiftUI, please help to suggest me.

Body:
I created SwiftUI project with coredata.
I duplicated PersistenceController to be PersistenceController2 that for handle 2nd SQLite file.

Here is code of PersistenceController

import CoreData

class PersistenceController {
    static let shared = PersistenceController()
    let container: NSPersistentContainer

func urlApplicationSupportDirectory() -> URL {
    let paths = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask)
    let documentsDirectory = paths[0]
    return documentsDirectory
}

func sqliteURL() -> URL {
    let url = urlApplicationSupportDirectory().appendingPathComponent("MM1.SQLite")
    return url
}

init(inMemory: Bool = false) {
    container = NSPersistentContainer(name: "testCoreData")

    if inMemory {
        container.persistentStoreDescriptions.first!.url = URL(fileURLWithPath: "/dev/null")
    }

    let url = sqliteURL()
    print(url.absoluteString)

    let description = NSPersistentStoreDescription(url: url)
    description.shouldMigrateStoreAutomatically = true
    description.shouldInferMappingModelAutomatically = true
    container.persistentStoreDescriptions = [description]

    container.viewContext.automaticallyMergesChangesFromParent = true
    container.loadPersistentStores(completionHandler: { (storeDescription, error) in
        if let error = error as NSError? {
            fatalError("Unresolved error \(error), \(error.userInfo)")
        }
    })
}

}

PersistenceController2 is difference at filename only "MM1.SQLite" to be "MM2.SQLite"

Then I create TabBarView like this code.

import SwiftUI

struct TabBarView: View {

    var body: some View {
        TabView {
            ContentView()
                .tabItem {
                    Text("1")
                    //Image("TabIcon"+"Account")
                    Image(systemName: "list.bullet.rectangle.portrait")
                }
                .environment(\.managedObjectContext, PersistenceController.shared.container.viewContext)

            ContentView()
                .tabItem {
                    Text("2")
                    //Image("TabIcon"+"Account")
                    Image(systemName: "list.bullet.rectangle.portrait")
                }
                .environment(\.managedObjectContext, PersistenceController2.shared.container.viewContext)
        }
    }
}

When I comment 1st TabView and run only 2nd TabView, It can run correctly MM2.SQLite can store data normally.
When I command 2nd TabView and run only 1st TabView, It can run correctly MM1.SQLite can store data normally.

But the problem is ... When I opened comment and run both TabView, it cannot run and show message error like this below.

2022-12-07 21:06:41.411772+0700 testCoreData[38345:1010632] [error] warning: Multiple NSEntityDescriptions claim the NSManagedObject subclass 'Item' so +entity is unable to disambiguate.
CoreData: warning: Multiple NSEntityDescriptions claim the NSManagedObject subclass 'Item' so +entity is unable to disambiguate.
2022-12-07 21:06:41.412037+0700 testCoreData[38345:1010632] [error] warning:     'Item' (0x60000083c630) from NSManagedObjectModel (0x600001c169e0) claims 'Item'.
CoreData: warning:       'Item' (0x60000083c630) from NSManagedObjectModel (0x600001c169e0) claims 'Item'.
2022-12-07 21:06:41.412175+0700 testCoreData[38345:1010632] [error] warning:     'Item' (0x6000008306e0) from NSManagedObjectModel (0x600001c105a0) claims 'Item'.
CoreData: warning:       'Item' (0x6000008306e0) from NSManagedObjectModel (0x600001c105a0) claims 'Item'.
2022-12-07 21:06:41.412302+0700 testCoreData[38345:1010632] [error] error: +[Item entity] Failed to find a unique match for an NSEntityDescription to a managed object subclass
CoreData: error: +[Item entity] Failed to find a unique match for an NSEntityDescription to a managed object subclass
2022-12-07 21:06:41.557326+0700 testCoreData[38345:1010632] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'executeFetchRequest:error: A fetch request must have an entity.'

May you help me for some suggestion to solved this error?

[Edit/Add more information]
Actually, I have an experience with multiple containers without SwiftUI. Please see below sample project that can run 2 containers with 2 database files "MM1.SQLite" and "MM2.SQLite". So if you all have some suggestions how to implement 2 container core data with SwiftUI, please help to suggest me.


问:
Is there a way to extract text with comments from PDF?
There are lots of ways to extract text from pdfs, and to extract comments from pdfs. But are there any ways to extract the text+comments together from pdf files? So that the comment associated with each segment of text is clear.

So far, I have been able to do this using google docs: Export Google Docs comments into Google Sheets, along with highlighted text?
but not using pdfs. Converting the pdf to a docx messes up the formatting very badly, so it doesnt seem to be a viable option.


问:
Use one mod_auth_openidc in Apache for two applications
I currently have an app running on apache and using the mod_auth_openidc. I now want to add a second application under a different URL. I assume I need to add a second "Location" to my httpd.conf e.g:

```<code><Location /application_ONE.html>
  AuthType openid-connect
  Require valid-user
</Location>

#new application

<Location /application_TWO.html>
  AuthType openid-connect
  Require valid-user
</Location>
</code>```

How can I add a second "OIDCRedirectURI" to the mod_auth_openid? Is it possible to do this?

I have been looking online but can seem to find anything. I may have found a source saying that it was not possible but wanted to confirm.

Body:
I currently have an app running on apache and using the mod_auth_openidc. I now want to add a second application under a different URL. I assume I need to add a second "Location" to my httpd.conf e.g:

<Location /application_ONE.html>
  AuthType openid-connect
  Require valid-user
</Location>

#new application

<Location /application_TWO.html>
  AuthType openid-connect
  Require valid-user
</Location>

How can I add a second "OIDCRedirectURI" to the mod_auth_openid? Is it possible to do this?

I have been looking online but can seem to find anything. I may have found a source saying that it was not possible but wanted to confirm.


问:
Defining custom layer for tensorflow model
I'm trying to build a model in tensorflow that should take a number of points with n dimensions and find a set of hyperplanes that form a hull around one set of points while including as little of another set of points.

To do this I would input a Matrix of size [n,np] with n denoting dimensions and np denoting the number of points each defined in n dimensions. Like:

```<code>[[ 0.04370488 -0.09842589 -0.01787493]
 [ 0.1415032   0.05342565  0.63025913]
 [-0.84298323 -0.91433908 -0.9716289 ]
 [ 0.19159608 -0.68356499  0.55441537]
 [ 0.34797942  0.55592542 -0.74667198]]
</code>```

As a last layer I would like to have n+1 hyperplanes that are each defined by two vectors, one of them pointing to a point on the hyperplane, the other being the normal vector of the hyperplane. In three dimensions this would give me 4 hyperplanes each defined by 2 vectors with 3 dimensions. So I guess this would be a 4x2x3 matrix or 24 values. Like:

```<code>[[0, 0, 0] [1, 0, 0]]
[[0, 0, 0] [0, 1, 0]]
[[0, 0, 0] [0, 0, 1]]
[[5, 5, 5] [-1, -1, -1]]
</code>```

I was thinking this layer to either be the output of the model OR
to be used in calculating whether a point is on the in- or outside of the hull. Which could just be encoded as 0 or 1

For now I have a barebones model where I managed to input a Matrix with the correct size but couldn't yet manage to write a loss function or custom layer that makes it possible to evaluate whether a point is in or outside of the hull

The ys array is a 800,1 array containing labels for each point saying it is either a point that should be in the hull or outside the hull.

```<code>from tensorflow import keras

def in_convex_hull(point, plane_point, plane_normal):
    if np.dot(plane, (point - a)) == 1:
        return true
    return false

def custom_loss(actual, pred):
    loss = 0
    return loss
def custom_layer():
    return

model = keras.Sequential([keras.layers.Dense(units=1, input_shape=[800,3])])
model.add(keras.layers.Dense(1000))
model.add(keras.layers.Dense(24))
model.compile(optimizer='Adam', loss='BinaryCrossentropy', metrics = ["accuracy"])

xs = np.array([np.random.rand(800,3) for i in range(1)])
ys = np.array([np.eye(1)[np.random.choice(1, 800)]])

history = model.fit(xs, ys, epochs=10, batch_size=1, verbose = 1)

</code>```

Any pointers on how this setup could be achieved is greatly appreciated

Body:
I'm trying to build a model in tensorflow that should take a number of points with n dimensions and find a set of hyperplanes that form a hull around one set of points while including as little of another set of points.

To do this I would input a Matrix of size [n,np] with n denoting dimensions and np denoting the number of points each defined in n dimensions. Like:

[[ 0.04370488 -0.09842589 -0.01787493]
 [ 0.1415032   0.05342565  0.63025913]
 [-0.84298323 -0.91433908 -0.9716289 ]
 [ 0.19159608 -0.68356499  0.55441537]
 [ 0.34797942  0.55592542 -0.74667198]]

As a last layer I would like to have n+1 hyperplanes that are each defined by two vectors, one of them pointing to a point on the hyperplane, the other being the normal vector of the hyperplane. In three dimensions this would give me 4 hyperplanes each defined by 2 vectors with 3 dimensions. So I guess this would be a 4x2x3 matrix or 24 values. Like:

[[0, 0, 0] [1, 0, 0]]
[[0, 0, 0] [0, 1, 0]]
[[0, 0, 0] [0, 0, 1]]
[[5, 5, 5] [-1, -1, -1]]

I was thinking this layer to either be the output of the model OR
to be used in calculating whether a point is on the in- or outside of the hull. Which could just be encoded as 0 or 1

For now I have a barebones model where I managed to input a Matrix with the correct size but couldn't yet manage to write a loss function or custom layer that makes it possible to evaluate whether a point is in or outside of the hull

The ys array is a 800,1 array containing labels for each point saying it is either a point that should be in the hull or outside the hull.

from tensorflow import keras

def in_convex_hull(point, plane_point, plane_normal):
    if np.dot(plane, (point - a)) == 1:
        return true
    return false

def custom_loss(actual, pred):
    loss = 0
    return loss
def custom_layer():
    return

model = keras.Sequential([keras.layers.Dense(units=1, input_shape=[800,3])])
model.add(keras.layers.Dense(1000))
model.add(keras.layers.Dense(24))
model.compile(optimizer='Adam', loss='BinaryCrossentropy', metrics = ["accuracy"])

xs = np.array([np.random.rand(800,3) for i in range(1)])
ys = np.array([np.eye(1)[np.random.choice(1, 800)]])

history = model.fit(xs, ys, epochs=10, batch_size=1, verbose = 1)

Any pointers on how this setup could be achieved is greatly appreciated


问:
Laravel 9. Why does specifying a column limit for a related table not work?
I need get specify columns of the relationship. But both recomended in documentation way don't work for me.
I can do this by specifying the desired columns in the model, but I don't want to do it: maybe in the future I will need this relationship elsewhere with more (or fewer) columns.

Data base: table Author (id, name) and Article (id, title, author_id)

The author_id column is foreign key for id column of Author table.

Controller:

```<code>//it display all columns
$pack = Author::with(['Article' => function ($query) {
                $query->select('id', 'title');
            }])
  ->where('id', $id)
  ->get();

//also it display all columns
$pack = Author::query()
        ->with(['Article' => function ($query) {
            $query->select('id', 'title');
        }])
  ->where('id', $id)
  ->get()

//also it display all columns
$pack = Author::with(['Article:id,title'])
  ->where('id', $id)
  ->get();
</code>```

Model:

```<code>class Author extends Model
{
    protected $guarded = [];
    public function Article()
    {
        return $this->hasMany('App\Models\Article')
            //->select('id', 'title'); //If uncommented, then specifying columns works
            ;
    }
}
</code>```

Why doesn't specifying columns in the controller work for me?

Body:
I need get specify columns of the relationship. But both recomended in documentation way don't work for me.
I can do this by specifying the desired columns in the model, but I don't want to do it: maybe in the future I will need this relationship elsewhere with more (or fewer) columns.

Data base: table Author (id, name) and Article (id, title, author_id)

The author_id column is foreign key for id column of Author table.

Controller:

//it display all columns
$pack = Author::with(['Article' => function ($query) {
                $query->select('id', 'title');
            }])
  ->where('id', $id)
  ->get();

//also it display all columns
$pack = Author::query()
        ->with(['Article' => function ($query) {
            $query->select('id', 'title');
        }])
  ->where('id', $id)
  ->get()

//also it display all columns
$pack = Author::with(['Article:id,title'])
  ->where('id', $id)
  ->get();

Model:

class Author extends Model
{
    protected $guarded = [];
    public function Article()
    {
        return $this->hasMany('App\Models\Article')
            //->select('id', 'title'); //If uncommented, then specifying columns works
            ;
    }
}

Why doesn't specifying columns in the controller work for me?


问:
Kafka JMX missing data
I have two kafka cluster each one exporting metrics via JMX and prometheus. Some data are missing from one of the deployment. I add that both configuration for JMX or for Logging looks the same, and my test clients are also the same. I can't attach image so I'll try to describe what I see in Jconsole:

When I'm connected directly to the JMX port I have:

on the left :

kafka.server

Fetch

Attributes

queue-siez

FETCH

Attributes

byte-rate

trhottle-time

Produce

Attributes

queue-siez

PRODUCE

Attributes

byte-rate

trhottle-time

On the right:

kafka.server

Fetch

Attributes

queue-siez

CN%3Dbroker-connect

attributes

byte-rate

trhottle-time

perf-user

attributes

byte-rate

trhottle-time

Produce

Attributes

queue-siez

CN%3Dbroker-connect

attributes

byte-rate

trhottle-time

perf-user

attributes

byte-rate

trhottle-time

So in the right JMX we can see that we have the detail for each of my connected clients (MTLS or OAUTH clients) but on the left nothing. I guess that I can see the global value of byte-rate for all produce request but I can't see each clients. Does someone have a clue on what can cause that difference ?

Title: Kafka JMX missing data


问:
Search bar with different queries
I'm trying to create a search bar on my website. If the searchbar is not set/NULL/empty the site should display all the records (so without the WHERE clause), if it's filled in, it should display the same records but with the WHERE clause (filtering it).

So, I thought since there 2 different searches (one with and one without WHERE), I should also create 2 different queries.

Problem I have is: if I test it and put a dump of both queries, both the variables are filled with the same query.

```<code><?php

require_once 'somefile.php';

$user = new user();
if(isset($_POST['btnSearch'])){
  $searchTerm = $_POST['txtSearch'];
  $items2 = DB::getInstance()->get('items', array('Name', 'LIKE', '%['.$searchTerm.']%'));
  //should be: "SELECT * FROM items WHERE Name LIKE '%[my_search_term]%'
  //is: "SELECT * FROM items WHERE Id > 0"; --> not correct

  $items = DB::getInstance()->get('items', array('id', '>', '0'));
  //is: "SELECT * FROM items WHERE id > 0" --> correct
}
?>
</code>```

html:

```<code><form method="POST" action="#" class="ftco-section">
<div class="row">
      <input type="text" name="txtSearch" id="txtSearch" placeholder="Search..." />
      <button type="submit" name="btnSearch"><img name="imgSearch" id="imgSearch"
src="images/search.png" /></button>
    </div>
</form>
...table to display the results
</code>```

Any idea how this could come?

Edit: Found what was wrong, the 2nd query was in the wrong place, it was before the first one, so the 1st one always overwrote the 2nd one. Changed the place and now it works as it should.

Title: Search bar with different queries

Body:
I'm trying to create a search bar on my website. If the searchbar is not set/NULL/empty the site should display all the records (so without the WHERE clause), if it's filled in, it should display the same records but with the WHERE clause (filtering it).

So, I thought since there 2 different searches (one with and one without WHERE), I should also create 2 different queries.

Problem I have is: if I test it and put a dump of both queries, both the variables are filled with the same query.

<?php

require_once 'somefile.php';

$user = new user();
if(isset($_POST['btnSearch'])){
  $searchTerm = $_POST['txtSearch'];
  $items2 = DB::getInstance()->get('items', array('Name', 'LIKE', '%['.$searchTerm.']%'));
  //should be: "SELECT * FROM items WHERE Name LIKE '%[my_search_term]%'
  //is: "SELECT * FROM items WHERE Id > 0"; --> not correct

  $items = DB::getInstance()->get('items', array('id', '>', '0'));
  //is: "SELECT * FROM items WHERE id > 0" --> correct
}
?>

html:

<form method="POST" action="#" class="ftco-section">

      <input type="text" name="txtSearch" id="txtSearch" placeholder="Search..." />
      <button type="submit" name="btnSearch"></button>

</form>
...table to display the results

Any idea how this could come?

Edit: Found what was wrong, the 2nd query was in the wrong place, it was before the first one, so the 1st one always overwrote the 2nd one. Changed the place and now it works as it should.


问:
Webscraping missing tags from a webpage using selenium
I'm trying to scrape the details of the trending repositories on GitHub and their descriptions.

The number of tags containing the names is 25 and the description of the repository is present in
 tag.

There are only 22
 tags in the webpage.

How to handle this?.

The tag
 is missing

How to overcome this and scrape the data?


问:
How can I move the database parts of my matomo installation to another database?
I have several VMs in which the developers have access to one specific database they need for their project. (Mostly as a backend for Typo3). Now, some of them have installed Matomo in the Typo3-Database. This is not a clean solution - if they had asked me I would have created a separate database just for Matomo. The problem is that Matomo installations grow and with it the automysqlbackups until the complete filesystem is filled with Matomo-Backups.

I want to move all tables beginning with matomo to another existing but empty database which is called Matomo. I have tried the userfriendly way with Dbeaver and other tools but I guess that my solution is simply a line of SQL from someone with more database experience then me. After that the Matomo data would be dumped to a separate database and I could limit the number of stored backups with some simple housekeeping scripts without affecting long-term storage for the typo3-backend.
FYI: I am doing this on Debian Bullseye 11 which comes with MariaDB 10.5

Bye
Stefan


问:
Authenticating exactly one, known client
I'm calling HTTP endpoints from another server. I control both servers. There could be more instances later, but I will control them, too. I want to authenticate the server calling the other one so that I know the requests are coming from a legit source.

My idea was that I would set the same secret environment variable to both servers. Each call would then include an Authentication header with:

```<code>timestamp,
salt,
HMACSHA256(
    timestamp,
    salt,
    secret
)
</code>```

which the receiving server would verify and dismiss the request if the timestamp is older than 10 seconds or if the HMAC does not match.

What would be the standard way of doing this and what are the pitfalls of my approach?

Body:
I'm calling HTTP endpoints from another server. I control both servers. There could be more instances later, but I will control them, too. I want to authenticate the server calling the other one so that I know the requests are coming from a legit source.

My idea was that I would set the same secret environment variable to both servers. Each call would then include an Authentication header with:

timestamp,
salt,
HMACSHA256(
    timestamp,
    salt,
    secret
)

which the receiving server would verify and dismiss the request if the timestamp is older than 10 seconds or if the HMAC does not match.

What would be the standard way of doing this and what are the pitfalls of my approach?


问:
An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar
I have encountered problems while trying to run sonarqube on my application. When I execute the command it throws me an error which doesn't say much to me. Does anyone know where is the problem here?

The Error looks like this:

```<code>[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  9.257 s
[INFO] Finished at: 2022-12-07T15:10:39+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project TeamTracker: Execution default-cli of goal org.sonarsource.sca
nner.maven:sonar-maven-plugin:3.9.1.2184:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar: java.la
ng.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.codehaus.mojo:sonar-maven-plugin:3.9.1.2184
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/A113408609/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.9.1.2184/sonar-maven-plugin-3.9.1.2184.jar
[ERROR] urls[1] = file:/C:/Users/A113408609/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[2] = file:/C:/Users/A113408609/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[3] = file:/C:/Users/A113408609/.m2/repository/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar
[ERROR] urls[4] = file:/C:/Users/A113408609/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.16.2.588/sonar-scanner-api-2.16.2.588.jar
[ERROR] urls[5] = file:/C:/Users/A113408609/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security
.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @26f204a4
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
'cmd' is not recognized as an internal or external command,
operable program or batch file.

</code>```

This is a command I execute:

```<code>mvn sonar:sonar -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_AUTH_TOKEN -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.projectName=$CI_PROJECT_PATH_SLUG
</code>```

I have gone through documentations but I still really can't see what is the problem here :/

When I try to run mvn clean install the build is succesfull.

I am using Java 11, Maven 3.6.3 and Sonar Community Edition Version 8.9.10

Body:
I have encountered problems while trying to run sonarqube on my application. When I execute the command it throws me an error which doesn't say much to me. Does anyone know where is the problem here?

The Error looks like this:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  9.257 s
[INFO] Finished at: 2022-12-07T15:10:39+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project TeamTracker: Execution default-cli of goal org.sonarsource.sca
nner.maven:sonar-maven-plugin:3.9.1.2184:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar: java.la
ng.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.codehaus.mojo:sonar-maven-plugin:3.9.1.2184
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/A113408609/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.9.1.2184/sonar-maven-plugin-3.9.1.2184.jar
[ERROR] urls[1] = file:/C:/Users/A113408609/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[2] = file:/C:/Users/A113408609/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[3] = file:/C:/Users/A113408609/.m2/repository/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar
[ERROR] urls[4] = file:/C:/Users/A113408609/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.16.2.588/sonar-scanner-api-2.16.2.588.jar
[ERROR] urls[5] = file:/C:/Users/A113408609/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security
.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @26f204a4
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
'cmd' is not recognized as an internal or external command,
operable program or batch file.

This is a command I execute:

mvn sonar:sonar -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_AUTH_TOKEN -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.projectName=$CI_PROJECT_PATH_SLUG

I have gone through documentations but I still really can't see what is the problem here :/

When I try to run mvn clean install the build is succesfull.

I am using Java 11, Maven 3.6.3 and Sonar Community Edition Version 8.9.10


问:
Error in fix.by(by.x, x) : 'by' must specify a uniquely valid column problem
```<code>Error in fix.by(by.x, x) : 'by' must specify a uniquely valid column
</code>```

This error shows up on run, what possible fix can I do? Im using R Language

code:

```<code>library(dplyr)
library(readxl)

# read in data files
Salesman <- read_excel("Salesman.xlsx", skip=1)

names(Salesman)

names(Salesman) <- make.names(names(Salesman))
names(Salesman)

#combine data sets
  combined <- merge(SalesmanName,TotalSales,Commission, by.x="SalesmanNumber", by.y="SalesmanNumber.Temp")

# save as csv
write.csv(combined, file="Temporary.xlsx", row.names=FALSE)
</code>```

Solution to the merging problem

Body:
Error in fix.by(by.x, x) : 'by' must specify a uniquely valid column

This error shows up on run, what possible fix can I do? Im using R Language

code:

library(dplyr)
library(readxl)

# read in data files
Salesman <- read_excel("Salesman.xlsx", skip=1)

names(Salesman)

names(Salesman) <- make.names(names(Salesman))
names(Salesman)

#combine data sets
  combined <- merge(SalesmanName,TotalSales,Commission, by.x="SalesmanNumber", by.y="SalesmanNumber.Temp")

# save as csv
write.csv(combined, file="Temporary.xlsx", row.names=FALSE)

Solution to the merging problem


问:
Importing a function in one ipynb into the same ipynb (when called from elsewhere)
There are a tonne of Q&As on importing the contents of one .ipynb into another.

NOTE! This is not one of them!

The different methods are in various states of repair. The fact that there are so many answers and solutions is telling in itself :\ The one I got to work was:

```<code>## NOTE! If this fails, try switching and/or restarting kernels!
from importnb import Notebook
with Notebook(only_defs=True):
    import other_notebook
</code>```

Now I call the first function,

```<code>result = other_notebook.func_a()
</code>```

Now I call another function, func_b, which relies on func_c in other_notebook,

```<code>result2 = other_notebook.func_b()

</code>```

This throws a NameError,

```<code>NameError: name 'func_c' is not defined.
</code>```

Of course it's there, in other_notebook, because when I call func_b from within other_notebook it's in scope and executes just fine.

Please help!

I am of course open to other ideas on a robust and current way to achieve the same thing.....

Body:
There are a tonne of Q&As on importing the contents of one .ipynb into another.

NOTE! This is not one of them!

The different methods are in various states of repair. The fact that there are so many answers and solutions is telling in itself :\ The one I got to work was:

## NOTE! If this fails, try switching and/or restarting kernels!
from importnb import Notebook
with Notebook(only_defs=True):
    import other_notebook

Now I call the first function,

result = other_notebook.func_a()

Now I call another function, func_b, which relies on func_c in other_notebook,

result2 = other_notebook.func_b()

This throws a NameError,

NameError: name 'func_c' is not defined.

Of course it's there, in other_notebook, because when I call func_b from within other_notebook it's in scope and executes just fine.

Please help!

I am of course open to other ideas on a robust and current way to achieve the same thing.....


问:
How to update input file before actual DITA OT processing begins
I want to update topicref element values dynamically before DITA OT preprocessing starts.

I have created an xsl file with a template which match the ditamap element and update the node values. That xsl file I have added in a target and that target I have added in the preprocessing target(<target name="preprocess" depends="preprocess.init,updatemap,.../>). But this did not help me to update the map.

Please guide me the steps which I need to follow to update the map.

DIT OT version 3.7.1
plugin xhtml


问:
Not finding automatic modules when compiling Java Application
I have a large multi module (100s) Java project and have been experimenting with adopting java module support. This is using Java 17 (temurin), gradle 7.6, and IntelliJ 2022.3.

I have hit a couple of stubborn errors with java modules where the module cannot be found.

I have one project which has some java code that uses plexus ie:

```<code>import org.codehaus.plexus.util.Base64;

...
byte[] encodedAuthorizationString = Base64.encodeBase64(authorizationString.getBytes(StandardCharsets.US_ASCII));

</code>```

It has a gradle dependency

```<code>implementation 'org.codehaus.plexus:plexus-utils'

</code>```

This has a version constraint in our main build.gradle (just salient lines included):

```<code>plexusVersion = '3.5.0'
implementation("org.codehaus.plexus:plexus-utils:${plexusVersion}")

</code>```

Prior to adding module support this is working fine.

Now, with a module-info.java:

```<code>module egeria.open.metadata.implementation.adapters.open.connectors.rest.client.connectors.spring.rest.client.connector.main {
    requires egeria.open.metadata.implementation.adapters.authentication.plugins.http.helper.main;
    requires egeria.open.metadata.implementation.adapters.open.connectors.rest.client.connectors.rest.client.connectors.api.main;
    //requires egeria.open.metadata.implementation.adapters.open.connectors.rest.client.connectors.rest.client.factory.main;
    requires egeria.open.metadata.implementation.frameworks.open.connector.framework.main;
    requires plexus.utils;
    requires org.slf4j;
    requires spring.core;
    requires spring.web;

    exports org.odpi.openmetadata.adapters.connectors.restclients.spring;
}

</code>```

I am getting a compile error

```<code>Task ':open-metadata-implementation:adapters:open-connectors:rest-client-connectors:spring-rest-client-connector:compileJava' is not up-to-date because:
  Task has failed previously.
The input changes require a full rebuild for incremental task ':open-metadata-implementation:adapters:open-connectors:rest-client-connectors:spring-rest-client-connector:compileJava'.
Full recompilation is required because no incremental change information is available. This is usually caused by clean builds or changing compiler arguments.
Compiling with toolchain '/Library/Java/JavaVirtualMachines/temurin-19.jdk/Contents/Home'.
Compiling with JDK Java compiler API.
/Users/jonesn/IdeaProjects/egeria/v4/open-metadata-implementation/adapters/open-connectors/rest-client-connectors/spring-rest-client-connector/src/main/java/module-info.java:6: error: module not found: plexus.utils
    requires plexus.utils;
                   ^
1 error

</code>```

This is despite the fact, that having downloaded the jar file, the automatic module name looks to be what I am using ie:

```<code>jar --file=/Users/jonesn/Downloads/plexus-utils-3.5.0.jar --describe-module
No module descriptor found. Derived automatic module.

plexus.utils@3.5.0 automatic
requires java.base mandated
contains org.codehaus.plexus.util
contains org.codehaus.plexus.util.cli
contains org.codehaus.plexus.util.cli.shell
contains org.codehaus.plexus.util.dag
contains org.codehaus.plexus.util.introspection
contains org.codehaus.plexus.util.io
contains org.codehaus.plexus.util.reflection
contains org.codehaus.plexus.util.xml
contains org.codehaus.plexus.util.xml.pull
</code>```

I am seeing the same error with kafka-clients

For most other code, including those libraries without full module support, all is good....

tried various compilers, such as openjdk 17 & temurin 19

built at cli & within IntelliJ

I was expecting this module to resolve ok

I have also reviewed Java 9 automatic modules not found but note that other automatic modules (including org.slf4j) are working just fine

I should add that I could refactor this code to use java.util.Base64 (probably makes sense)... but I'm still confused as to why the module error, which I also see in another project with 'kafka.clients'

Body:
I have a large multi module (100s) Java project and have been experimenting with adopting java module support. This is using Java 17 (temurin), gradle 7.6, and IntelliJ 2022.3.

I have hit a couple of stubborn errors with java modules where the module cannot be found.

I have one project which has some java code that uses plexus ie:

import org.codehaus.plexus.util.Base64;

...
byte[] encodedAuthorizationString = Base64.encodeBase64(authorizationString.getBytes(StandardCharsets.US_ASCII));

It has a gradle dependency

implementation 'org.codehaus.plexus:plexus-utils'

This has a version constraint in our main build.gradle (just salient lines included):

plexusVersion = '3.5.0'
implementation("org.codehaus.plexus:plexus-utils:${plexusVersion}")

Prior to adding module support this is working fine.

Now, with a module-info.java:

module egeria.open.metadata.implementation.adapters.open.connectors.rest.client.connectors.spring.rest.client.connector.main {
    requires egeria.open.metadata.implementation.adapters.authentication.plugins.http.helper.main;
    requires egeria.open.metadata.implementation.adapters.open.connectors.rest.client.connectors.rest.client.connectors.api.main;
    //requires egeria.open.metadata.implementation.adapters.open.connectors.rest.client.connectors.rest.client.factory.main;
    requires egeria.open.metadata.implementation.frameworks.open.connector.framework.main;
    requires plexus.utils;
    requires org.slf4j;
    requires spring.core;
    requires spring.web;

    exports org.odpi.openmetadata.adapters.connectors.restclients.spring;
}

I am getting a compile error

Task ':open-metadata-implementation:adapters:open-connectors:rest-client-connectors:spring-rest-client-connector:compileJava' is not up-to-date because:
  Task has failed previously.
The input changes require a full rebuild for incremental task ':open-metadata-implementation:adapters:open-connectors:rest-client-connectors:spring-rest-client-connector:compileJava'.
Full recompilation is required because no incremental change information is available. This is usually caused by clean builds or changing compiler arguments.
Compiling with toolchain '/Library/Java/JavaVirtualMachines/temurin-19.jdk/Contents/Home'.
Compiling with JDK Java compiler API.
/Users/jonesn/IdeaProjects/egeria/v4/open-metadata-implementation/adapters/open-connectors/rest-client-connectors/spring-rest-client-connector/src/main/java/module-info.java:6: error: module not found: plexus.utils
    requires plexus.utils;
                   ^
1 error

This is despite the fact, that having downloaded the jar file, the automatic module name looks to be what I am using ie:

jar --file=/Users/jonesn/Downloads/plexus-utils-3.5.0.jar --describe-module
No module descriptor found. Derived automatic module.

plexus.utils@3.5.0 automatic
requires java.base mandated
contains org.codehaus.plexus.util
contains org.codehaus.plexus.util.cli
contains org.codehaus.plexus.util.cli.shell
contains org.codehaus.plexus.util.dag
contains org.codehaus.plexus.util.introspection
contains org.codehaus.plexus.util.io
contains org.codehaus.plexus.util.reflection
contains org.codehaus.plexus.util.xml
contains org.codehaus.plexus.util.xml.pull

I am seeing the same error with kafka-clients

For most other code, including those libraries without full module support, all is good....

tried various compilers, such as openjdk 17 & temurin 19

built at cli & within IntelliJ

I was expecting this module to resolve ok

I have also reviewed Java 9 automatic modules not found but note that other automatic modules (including org.slf4j) are working just fine

I should add that I could refactor this code to use java.util.Base64 (probably makes sense)... but I'm still confused as to why the module error, which I also see in another project with 'kafka.clients'


问:
Choose multiple values from dropdown
I'm thinking about how to change the code so that I can choose multiple values from dropdown.

I think my problem is in const handleChange = () => {} (if I delete handleChange, then I am able to select multiple values but on save method is undefined.

Any suggestion ?

Here is my code ->

```<code>import * as React from 'react';
import * as PropTypes from 'prop-types';
import { Dropdown } from 'office-ui-fabric-react/lib/Dropdown';

const DropdownChoice = ({props, onValueChange}) =>{

const handleChange = (event: any, selectedOption: { key: any; }) => {
    onValueChange(selectedOption);
};
return <Dropdown
            multiSelect={props.multiSelect == undefined ? true : props.multiSelect}
            className={props.class ? props.class : ""}
            selectedKey={props.selected == undefined || props.selected.key == undefined ? undefined : props.selected.key}
            onChange={handleChange}
            errorMessage={props.error ? props.error : ""}
            options={props.options ? props.options : []}
            styles={props.styles ? props.styles : { dropdown: { width: 900 } }}
            label={props.label}
            placeholder={props.placeholder ? props.placeholder : ""}
            disabled={props.disabled == undefined ? false : props.disabled}
            required={props.required == undefined ? false : props.required}
        />;
            };
            DropdownChoice.propTypes = {
props: PropTypes.shape({
    class: PropTypes.string,
    error: PropTypes.string,
    label: PropTypes.string.isRequired,
    required: PropTypes.bool,
    name: PropTypes.string,
    selected: PropTypes.shape({
        key:  PropTypes.oneOfType([
            PropTypes.string,
            PropTypes.number
        ]),
        text: PropTypes.string
    }),
    styles: PropTypes.object,
    options: PropTypes.object,
    disabled: PropTypes.bool,
    placeholder: PropTypes.string,
    multiSelect: PropTypes.bool
  }),
onValueChange: PropTypes.func.isRequired
  };

     export default DropdownChoice;
</code>```

Title: Choose multiple values from dropdown

Body:
I'm thinking about how to change the code so that I can choose multiple values from dropdown.

I think my problem is in const handleChange = () => {} (if I delete handleChange, then I am able to select multiple values but on save method is undefined.

Any suggestion ?

Here is my code ->

import * as React from 'react';
import * as PropTypes from 'prop-types';
import { Dropdown } from 'office-ui-fabric-react/lib/Dropdown';

const DropdownChoice = ({props, onValueChange}) =>{

const handleChange = (event: any, selectedOption: { key: any; }) => {
    onValueChange(selectedOption);
};
return <Dropdown
            multiSelect={props.multiSelect == undefined ? true : props.multiSelect}
            className={props.class ? props.class : ""}
            selectedKey={props.selected == undefined || props.selected.key == undefined ? undefined : props.selected.key}
            onChange={handleChange}
            errorMessage={props.error ? props.error : ""}
            options={props.options ? props.options : []}
            styles={props.styles ? props.styles : { dropdown: { width: 900 } }}
            label={props.label}
            placeholder={props.placeholder ? props.placeholder : ""}
            disabled={props.disabled == undefined ? false : props.disabled}
            required={props.required == undefined ? false : props.required}
        />;
            };
            DropdownChoice.propTypes = {
props: PropTypes.shape({
    class: PropTypes.string,
    error: PropTypes.string,
    label: PropTypes.string.isRequired,
    required: PropTypes.bool,
    name: PropTypes.string,
    selected: PropTypes.shape({
        key:  PropTypes.oneOfType([
            PropTypes.string,
            PropTypes.number
        ]),
        text: PropTypes.string
    }),
    styles: PropTypes.object,
    options: PropTypes.object,
    disabled: PropTypes.bool,
    placeholder: PropTypes.string,
    multiSelect: PropTypes.bool
  }),
onValueChange: PropTypes.func.isRequired
  };

     export default DropdownChoice;


问:
AttributeError: 'Player' Object has no attribute (attributes)
So i was writing my game and i occured an problem while creating class. The script looks like this:

```<code>class Player:
    def __int__(self):
        self.x = 0
        self.y = 0
        self.width = 0
        self.height = 0
        self.image = pygame.image.load("Stickman.png")

    def tick(self):
        pass

    def draw(self):
        window.blit(self.image, (self.x, self.y))
</code>```

But when i start the program it says AttributeError: 'Player' Object has no attribute 'image' or AttributeError: 'Player' Object has no attribute 'x' and ect. Does anyone know how to repair it?

I wanted to make class  player that shows image, but it just doesn't work. I am pretty new in coding so please help

Body:
So i was writing my game and i occured an problem while creating class. The script looks like this:

class Player:
    def __int__(self):
        self.x = 0
        self.y = 0
        self.width = 0
        self.height = 0
        self.image = pygame.image.load("Stickman.png")

    def tick(self):
        pass

    def draw(self):
        window.blit(self.image, (self.x, self.y))

But when i start the program it says AttributeError: 'Player' Object has no attribute 'image' or AttributeError: 'Player' Object has no attribute 'x' and ect. Does anyone know how to repair it?

I wanted to make class  player that shows image, but it just doesn't work. I am pretty new in coding so please help


问:
VueJS in Server
I used VueJS component inside blade file. My Blade file code is like below.

```<code>@extends('layouts.admin.app')

@section('title', 'Time')

@push('css_or_js')
@endpush

@section('content')
    <div>
        <time-component />
    </div>
@endsection
</code>```

I added app.js file like below.

```<code><script src="{{ asset('js/app.js') }}" defer></script>
    </body>
</html>
</code>```

It is working perfectly in localhost. I ran npm run prod command. After that I uploaded all files in Server. But I am getting error Loading failed for the

Title: VueJS in Server

Body:
I used VueJS component inside blade file. My Blade file code is like below.

@extends('layouts.admin.app')

@section('title', 'Time')

@push('css_or_js')
@endpush

@section('content')

        <time-component />

@endsection

I added app.js file like below.

It is working perfectly in localhost. I ran npm run prod command. After that I uploaded all files in Server. But I am getting error Loading failed for the


问:
Open remote folder in editor (macOS)
I am using Cyberduck in a MacBook to access a remote server under the SFTP protocol. In Linux, I just right-clicked and clicked "Open with" and, selected my editor of choice. I cannot do the same on Cyberduck. The "Edit with" option seems to work only with files, but I wanted to open the whole folder (in my case, in VS Code).
Do you know how to achieve this behaviour, or suggest any other free software to do so? Thanks in advance for any help you can provide.</p>

Title: Open remote folder in editor (macOS)


问:
Figma API to HTML/CSS
Trying to write a converter from Figma design to HTML/cSS. What I've followed so far:

Fetch the data for a particular Figma file by hitting a GET request using the FIGMA_TOKEN and FILE_ID

Parse the file to find children/components and extract the style properties to eventually convert it into CSS

Where I'm stuck and not able to figure out is how to structure the UI elements in proper HTML. For eg., the hierarchy and the tags to create a usable HTML code

In the UI here, I've like the following HTMl to be generated:

```<code><div class='container'>
   <h3>Template List Activities</h3>
   <div class='content__wrapper'>
      <h6>Account Name</h6>
      <div class='meta'>
         <ul>
            <li>Activity Type</li>
            <li>Yesterday</li>
         </ul>
      </div>
   </div>
</div>
</code>```

Just need some guidance on how to approach this

Title: Figma API to HTML/CSS

Body:
Trying to write a converter from Figma design to HTML/cSS. What I've followed so far:

Fetch the data for a particular Figma file by hitting a GET request using the FIGMA_TOKEN and FILE_ID

Parse the file to find children/components and extract the style properties to eventually convert it into CSS

Where I'm stuck and not able to figure out is how to structure the UI elements in proper HTML. For eg., the hierarchy and the tags to create a usable HTML code

In the UI here, I've like the following HTMl to be generated:

Template List Activities

Account Name

Activity Type

Yesterday

Just need some guidance on how to approach this


问:
Puppeteer: how to download a m3u8 / HLS video?
I am trying to download a HLS video once I am loggedon (cookies)

HLS videos are made of .m3u8 file and squeces of 00001.ts, 00002.ts ... files

I tried 2 methods

I download the files using the downloader

```<code> const client = await page.target().createCDPSession();
 await client.send('Page.setDownloadBehavior', {
     behavior: 'allow',
     downloadPath: '/',
 });
 await page.evaluate((link) => {
     location.href = link;
 }, link);
</code>```

This works for the .m3u8 file, however, it does not work for 00001.ts : because the browser opens these files and does not download them.
I have no idea how to force the downloading of .ts files and not opening them

I tried another way (from https://help.apify.com/en/articles/1929322-handling-file-download-with-puppeteer)

But this did not work either

```<code>    await page.setRequestInterception(true);
await page.goto('https://eedols.com/m3u8/20221205130402-SiBOhsUsJbTdZLP-DfqGGLn5cF-6-l.m3u8');
const xRequest = await new Promise(resolve => {
    page.on('request', interceptedRequest => {
        interceptedRequest.abort();     //stop intercepting requests
        resolve(interceptedRequest);
    });
});
const options = {
    encoding: null,
    method: xRequest._method,
    uri: xRequest._url,
    body: xRequest._postData,
    headers: xRequest._headers
}

/* add the cookies */
const cookies = await page.cookies();
options.headers.Cookie = cookies.map(ck => ck.name + '=' + ck.value).join(';');

/* resend the request */
const response = await request(options);
</code>```

It is stuck.
Any idea on that ?

Body:
I am trying to download a HLS video once I am loggedon (cookies)

HLS videos are made of .m3u8 file and squeces of 00001.ts, 00002.ts ... files

I tried 2 methods

I download the files using the downloader

 const client = await page.target().createCDPSession();
 await client.send('Page.setDownloadBehavior', {
     behavior: 'allow',
     downloadPath: '/',
 });
 await page.evaluate((link) => {
     location.href = link;
 }, link);

This works for the .m3u8 file, however, it does not work for 00001.ts : because the browser opens these files and does not download them.
I have no idea how to force the downloading of .ts files and not opening them

I tried another way (from https://help.apify.com/en/articles/1929322-handling-file-download-with-puppeteer)

But this did not work either

    await page.setRequestInterception(true);
await page.goto('https://eedols.com/m3u8/20221205130402-SiBOhsUsJbTdZLP-DfqGGLn5cF-6-l.m3u8');
const xRequest = await new Promise(resolve => {
    page.on('request', interceptedRequest => {
        interceptedRequest.abort();     //stop intercepting requests
        resolve(interceptedRequest);
    });
});
const options = {
    encoding: null,
    method: xRequest._method,
    uri: xRequest._url,
    body: xRequest._postData,
    headers: xRequest._headers
}

/* add the cookies */
const cookies = await page.cookies();
options.headers.Cookie = cookies.map(ck => ck.name + '=' + ck.value).join(';');

/* resend the request */
const response = await request(options);

It is stuck.
Any idea on that ?


问:
Randint() missing 1 required positional argument: 'b' . code works if I want to use specific numbers but not if i want to add randomness
```<code>import random

list_of_names = []
length_of_list = int(input("give the number of people in your secret santa. make it even"))
if length_of_list % 2 != 0:
    print("that is not even")
    exit()
else:
    pass

for i in range(length_of_list):
    name = input("give a name")
    list_of_names.append(name)

print(list_of_names)

random_thing = random.randint(len(list_of_names))
print(list_of_names[random_thing],"will have to buy a present for",list_of_names[random_thing])
</code>```

the error comes up for the last line (23) and i don't understand why. I am aware that the code is not finished yet but i do not understand as to why it is giving me this error

it works if for example i do list_of_names[0] and list_of_names[1] but when i try and add randomness to the question it doesn't like it.

At first i tried putting the random function in the last line in the [] but outputted the same problem

Body:
import random

list_of_names = []
length_of_list = int(input("give the number of people in your secret santa. make it even"))
if length_of_list % 2 != 0:
    print("that is not even")
    exit()
else:
    pass

for i in range(length_of_list):
    name = input("give a name")
    list_of_names.append(name)

print(list_of_names)

random_thing = random.randint(len(list_of_names))
print(list_of_names[random_thing],"will have to buy a present for",list_of_names[random_thing])

the error comes up for the last line (23) and i don't understand why. I am aware that the code is not finished yet but i do not understand as to why it is giving me this error

it works if for example i do list_of_names[0] and list_of_names[1] but when i try and add randomness to the question it doesn't like it.

At first i tried putting the random function in the last line in the [] but outputted the same problem