问:
Can I set um a MINIMUM number of lines (forcing a line break in small texts) using only CSS?
I keep getting designs from agencies with texts breaking in different widths for the same templates, so I was wondering if there is a way using only CSS to force a text to break in at least N number of lines no matter it's size. Something similar to a
 added to the middle of the sentence, but without using br so it ajusts accordingly on multiple screens.

A text like "lorem ipsum dolor sit amet consectetur adipiscing elit" forced to use 2 lines would look like this (assuming the width available is much larger):

```<code>lorem ipsum dolor sit amet
consectetur adipiscing elit
</code>```

And a text like "lorem ipsum" would look like this:

```<code>lorem
ipsum
</code>```

Of course a single word would use only a single line, and large enough texts would use more than 2 lines.

I'm experienced enough to do this using JS and it feels like dirty work. I was wondering if I'm missing some CSS property like "minimum-lines".

Body:
I keep getting designs from agencies with texts breaking in different widths for the same templates, so I was wondering if there is a way using only CSS to force a text to break in at least N number of lines no matter it's size. Something similar to a
 added to the middle of the sentence, but without using br so it ajusts accordingly on multiple screens.

A text like "lorem ipsum dolor sit amet consectetur adipiscing elit" forced to use 2 lines would look like this (assuming the width available is much larger):

lorem ipsum dolor sit amet
consectetur adipiscing elit

And a text like "lorem ipsum" would look like this:

lorem
ipsum

Of course a single word would use only a single line, and large enough texts would use more than 2 lines.

I'm experienced enough to do this using JS and it feels like dirty work. I was wondering if I'm missing some CSS property like "minimum-lines".


来源: stackexchange

问:
Hazelcast deployment on Kubernetes without Cluster Roles
I have spring boot application with embedded hazelcast that I am trying to deploy on a shared Kubernetes platform. I want to use kubernetes API strategy for auto discovery. Can I do this without creating Cluster Roles and Cluster Role Bindings and have just Role and Role Binding created under my namespace. If yes, what would the rbac.yaml look like ?

Tried creating the following roles and role bindings but no auto discovery so far.

```<code>apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: hazelcast-role
  namespace: dev
rules:
  - apiGroups:
      - ""
    resources:
      - endpoints
      - pods
      - nodes
      - services
    verbs:
      - get
      - list

---

apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: hazelcast-role-binding
  namespace: dev
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: hazelcast-role
subjects:
  - kind: ServiceAccount
    name: default
    namespace: dev
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I have spring boot application with embedded hazelcast that I am trying to deploy on a shared Kubernetes platform. I want to use kubernetes API strategy for auto discovery. Can I do this without creating Cluster Roles and Cluster Role Bindings and have just Role and Role Binding created under my namespace. If yes, what would the rbac.yaml look like ?

Tried creating the following roles and role bindings but no auto discovery so far.

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: hazelcast-role
  namespace: dev
rules:
  - apiGroups:
      - ""
    resources:
      - endpoints
      - pods
      - nodes
      - services
    verbs:
      - get
      - list

---

apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: hazelcast-role-binding
  namespace: dev
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: hazelcast-role
subjects:
  - kind: ServiceAccount
    name: default
    namespace: dev


问:
Liquibase migrations from custom spring-boot-starter
I am developing a custom spring-boot-starter that can be included in any project. For it work it need to create a couple of tables in the database in the main application. For this I use liquibase migrations which are described in the spring-boot-starter module. Also in the starter in the application.properties file I describe the properties

```<code>spring.datasource.url=jdbc:postgresql://localhost:5432/message

spring.liquibase.change-log=classpath:liquibase/changelog.xml
</code>```

When starting the main application, which contains my starter in dependencies, I get an exception:

```<code>Description:

Liquibase failed to start because no changelog could be found at 'classpath:/db/changelog/db.changelog-master.yaml'.

Action:

Make sure a Liquibase changelog is present at the configured path.
</code>```

The application looks for a path to migrations and migrations inside the project, but does not look for them inside the starter scope.

Please tell me what needs to be done so that when the application starts, the migrations described in the starter are also pulled up?

How to set up liquibase? Or maybe there is some other way to run sql scripts if the required tables are missing?

Body:
I am developing a custom spring-boot-starter that can be included in any project. For it work it need to create a couple of tables in the database in the main application. For this I use liquibase migrations which are described in the spring-boot-starter module. Also in the starter in the application.properties file I describe the properties

spring.datasource.url=jdbc:postgresql://localhost:5432/message

spring.liquibase.change-log=classpath:liquibase/changelog.xml

When starting the main application, which contains my starter in dependencies, I get an exception:

Description:

Liquibase failed to start because no changelog could be found at 'classpath:/db/changelog/db.changelog-master.yaml'.

Action:

Make sure a Liquibase changelog is present at the configured path.

The application looks for a path to migrations and migrations inside the project, but does not look for them inside the starter scope.

Please tell me what needs to be done so that when the application starts, the migrations described in the starter are also pulled up?

How to set up liquibase? Or maybe there is some other way to run sql scripts if the required tables are missing?


问:
Is there a way to get a spotify embed autoplay track on my website?
I would like to get a spotify embed autoplay track on my website but I don't find a way to autoplay it and also the problem is that I get only an extract of the track.

He is the code I got from spotify:


问:
problem parsing a file and then executing 2 commands in pipe
I am making a program in which I need to read from a file and execute the command in pipe. The command could be something like "ps -lu user | sort", and I should execute the first command and then the second, in different processes (using fork and exec). The problem comes when I do the exec and it doesn't work correctly.
What I have so far is the following:

```<code>
</code>```
```<code>`int main(int argc, char* argv[]){
  int file = open(argv[1], O_RDONLY);
  int fd[2]; int pid;
  char s[8192];
  int nBytes = read(file, &s, 8192);
  char* s2 =malloc(8192); char* s3 = malloc(8192);
  char* comando1[8192]; char* comando2[8192];
  s2 = strtok(s, "|");
  s3 = strtok(NULL, "\n");
  comando1[0] = strtok(s2, " ");
  int i;
  if(s2 != NULL)
    for(i = 1; comando1[i] = strtok(NULL, " \t"); i++);
  comando2[0] = strtok(s3, " ");
  if(s3 != NULL)
    for(i = 1; comando2[i] = strtok(NULL, " \t"); i++);
  pid = fork();
  if(pid == 0){//
    pipe(fd);
    int pid2 = fork();
    if (pid2 > 0){
      printf("%s\n", comando1[0]);
      close(1);
       close(fd[0]); //cerramos stdout y extremo de lectura
      dup(fd[1]); close(fd[1]); //redireccionamos salida estándar a la pipe
      execvp(comando1[0], &comando1[0]); //ejecutamos el comando 1 con salida pipe
      perror("Error");
      write(2, "Error en el exec1", 17);
    }
    else if(pid == 0){
      close(fd[1]); close(0); //cerramos extremo de escritura y stdin
      dup(fd[0]); close(fd[0]); //redirección entrada estándar a la pipe
      printf("%s\n", comando2[0]);
      execvp(comando2[0], &comando2[0]); //ejecutamos el comando 1 con salida pipe
      perror("Error");
      write(2, "Error en el exec2", 17);
    }
  }

}
</code>```
```<code>`
</code>```

Which does not work as expected. For a file "file.txt" with the following command: "ps -lu user | sort -n -r", it says:

```<code>
</code>```
```<code> sort:
illegal option --
usage: sort [-cmu] [-o output] [-T directory] [-S mem] [-z recsz] [-dfiMnr] [-ddfiMnr] [-sdmem] [-sdm] [-z recsz
        [-dfiMnr] [-b] [-t char] [-k keydef] [+pos1 [-pos2]] files....
</code>```
```<code>
</code>```

However, if I manually add the parameters keeping everything the same (change execlp to execvp and pass (execlp("ps", "ps", "-lu", "user", 0) and execlp("sort", "sort", 0); the result is as expected (but it is not correct since I am not reading from the file). what could it be due to?

Body:
I am making a program in which I need to read from a file and execute the command in pipe. The command could be something like "ps -lu user | sort", and I should execute the first command and then the second, in different processes (using fork and exec). The problem comes when I do the exec and it doesn't work correctly.
What I have so far is the following:

`int main(int argc, char* argv[]){
  int file = open(argv[1], O_RDONLY);
  int fd[2]; int pid;
  char s[8192];
  int nBytes = read(file, &s, 8192);
  char* s2 =malloc(8192); char* s3 = malloc(8192);
  char* comando1[8192]; char* comando2[8192];
  s2 = strtok(s, "|");
  s3 = strtok(NULL, "\n");
  comando1[0] = strtok(s2, " ");
  int i;
  if(s2 != NULL)
    for(i = 1; comando1[i] = strtok(NULL, " \t"); i++);
  comando2[0] = strtok(s3, " ");
  if(s3 != NULL)
    for(i = 1; comando2[i] = strtok(NULL, " \t"); i++);
  pid = fork();
  if(pid == 0){//
    pipe(fd);
    int pid2 = fork();
    if (pid2 > 0){
      printf("%s\n", comando1[0]);
      close(1);
       close(fd[0]); //cerramos stdout y extremo de lectura
      dup(fd[1]); close(fd[1]); //redireccionamos salida estándar a la pipe
      execvp(comando1[0], &comando1[0]); //ejecutamos el comando 1 con salida pipe
      perror("Error");
      write(2, "Error en el exec1", 17);
    }
    else if(pid == 0){
      close(fd[1]); close(0); //cerramos extremo de escritura y stdin
      dup(fd[0]); close(fd[0]); //redirección entrada estándar a la pipe
      printf("%s\n", comando2[0]);
      execvp(comando2[0], &comando2[0]); //ejecutamos el comando 1 con salida pipe
      perror("Error");
      write(2, "Error en el exec2", 17);
    }
  }

}

`

Which does not work as expected. For a file "file.txt" with the following command: "ps -lu user | sort -n -r", it says:

 sort:
illegal option --
usage: sort [-cmu] [-o output] [-T directory] [-S mem] [-z recsz] [-dfiMnr] [-ddfiMnr] [-sdmem] [-sdm] [-z recsz
        [-dfiMnr] [-b] [-t char] [-k keydef] [+pos1 [-pos2]] files....

However, if I manually add the parameters keeping everything the same (change execlp to execvp and pass (execlp("ps", "ps", "-lu", "user", 0) and execlp("sort", "sort", 0); the result is as expected (but it is not correct since I am not reading from the file). what could it be due to?


Title: Adjust my one liner script - convert date/time string to [datetime] in powershell

Body:
I have this one liner:

Select-String -Path "C:\temp\TrackerLog.log" -Pattern "Program exited successfully" | Foreach-Object Line | Foreach {$_ -replace "\["} | %{ $line = $_.Split(' ') ; write-host $line[0] $line[1]}

The output is:

14.03.2022 08:12:38

21.03.2022 12:36:36

29.03.2022 19:39:59

04.04.2022 11:05:44

11.04.2022 13:08:49

18.04.2022 09:48:50

27.04.2022 06:18:45

02.05.2022 10:41:26

10.05.2022 04:25:48

18.05.2022 04:56:44

26.05.2022 03:32:25

28.05.2022 10:18:00

04.06.2022 22:49:16

07.06.2022 02:31:08

I would like to convert this string output to [datetime] with above one liner for further purpose. Could you please help me? Thank you very much.

Im now stucked, how to do it now.


问:
How to apply style to all elements on the same level?
I have a table and I need to change the background color of the row after I click on it (as if it was selected). The problem is that I can't change the html, and currently I can change the background color of any .td using .td:focus, but not .tr.

So as a workaround - can I make it so that when selecting one .td:focus I also apply the same style to all .td elements at the same level (child elements of the same parent .tr element)? How can I achieve this?


问:
nginx copy custom header
i have this config on first host

```<code>location / {
        proxy_pass https://my_remote_host;
        proxy_set_header X-MY_VAR 1;
</code>```

in host https://my_remote_host;

I have nginx and have

```<code>location / {
        proxy_pass http://my_container;
        proxy_set_header X-MY_VAR push value from first request;
</code>```

can I forward all custom headers ?

Title: nginx copy custom header

Body:
i have this config on first host

location / {
        proxy_pass https://my_remote_host;
        proxy_set_header X-MY_VAR 1;

in host https://my_remote_host;

I have nginx and have

location / {
        proxy_pass http://my_container;
        proxy_set_header X-MY_VAR push value from first request;

can I forward all custom headers ?


问:
error when I am trying to install pyaudio on Mac OS Ventura
I know this questions was asked couple of times, but all the answers do not work for me.
I get this error when I try to install PyAudio:

```<code>Building wheels for collected packages: pyaudio
  WARNING: Ignoring --global-option when building pyaudio using PEP 517
  Building wheel for pyaudio (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pyaudio (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-x86_64-cpython-39
      copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-cpython-39
      running build_ext
      building '_portaudio' extension
      creating build/temp.macosx-10.9-x86_64-cpython-39
      creating build/temp.macosx-10.9-x86_64-cpython-39/src
      gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/usr/local/include -I/usr/include -I/Users/myname/PycharmProjects/a/venv/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-cpython-39/src/_portaudiomodule.o
      src/_portaudiomodule.c:31:10: fatal error: 'portaudio.h' file not found
      #include "portaudio.h"
               ^~~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyaudio
Failed to build pyaudio
ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects
</code>```

From what I can tell, it's ignoring the global portaudio and looking for another one ?
I removed and installed already portaudio with brew, I update everything, I installed command line for Xcode, I tried with anaconda in notebook, same error there as well. I already tried to installed wheel and said its fulfilled.
Where to put this portaudio file so it see it ?
Any suggestions to fix this error ?
Thanks

Body:
I know this questions was asked couple of times, but all the answers do not work for me.
I get this error when I try to install PyAudio:

Building wheels for collected packages: pyaudio
  WARNING: Ignoring --global-option when building pyaudio using PEP 517
  Building wheel for pyaudio (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pyaudio (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-x86_64-cpython-39
      copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-cpython-39
      running build_ext
      building '_portaudio' extension
      creating build/temp.macosx-10.9-x86_64-cpython-39
      creating build/temp.macosx-10.9-x86_64-cpython-39/src
      gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/usr/local/include -I/usr/include -I/Users/myname/PycharmProjects/a/venv/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-cpython-39/src/_portaudiomodule.o
      src/_portaudiomodule.c:31:10: fatal error: 'portaudio.h' file not found
      #include "portaudio.h"
               ^~~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyaudio
Failed to build pyaudio
ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects

From what I can tell, it's ignoring the global portaudio and looking for another one ?
I removed and installed already portaudio with brew, I update everything, I installed command line for Xcode, I tried with anaconda in notebook, same error there as well. I already tried to installed wheel and said its fulfilled.
Where to put this portaudio file so it see it ?
Any suggestions to fix this error ?
Thanks


问:
conditionally rendaring with vee-validate and zod
I am using zod for scema validation with vee-validate in a vue 3 project.
In the requirement I need to show a text field according to a checkbox is the checkbox enabled the field will show and it will be required and will apply all the zod validations. But in this case if I use the zod.optional() the validation is not showing.
Is there any other option to use zod validation conditionally?

`

```<code>allergies: zod.string().nonempty('this field is required'),
</code>```

I need if the field isAlergies` enabled the rules will apply.

Body:
I am using zod for scema validation with vee-validate in a vue 3 project.
In the requirement I need to show a text field according to a checkbox is the checkbox enabled the field will show and it will be required and will apply all the zod validations. But in this case if I use the zod.optional() the validation is not showing.
Is there any other option to use zod validation conditionally?

`

allergies: zod.string().nonempty('this field is required'),

I need if the field isAlergies` enabled the rules will apply.


问:
Is there an Android operating system for smartwatches (not WearOS)
Is there an android smartwatch base operating system (not WearOS) for the purpose of being customized and installed on a generic smartwatch from an OEM? I'm looking to connect via bluetooth from an app, but do not want any of the extras WearOS provides.

I would like to purchase a low cost device and install android on this. Has anybody done this before?


问:
Setting up Visual Studio Code for WordPress PHP 8.1.4 on Windows 10
I need help... I have looked all over and maybe it's just a rookie mistake somewhere, however I feel I have looked and re-looked at every aspect of install on configuration.

Error in Visual Studio Code (1.74.0)
phpcs: The "WordPress" coding standard is not installed. Please review your configuration an try again.

What am I doing wrong that when I load my site folder into VS and open a .PHP I get this error.

System Build:

```<code>OS Name Microsoft Windows 10 Pro
Version 10.0.19044 Build 19044
System Type x64-based PC
Processor   11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz, 2803 Mhz, 4 Core(s), 8 Logical Processor(s)
BIOS Version/Date   Dell Inc. 1.9.0, 12/8/2021
Windows Directory   C:\Windows
</code>```

Memory:

```<code>Installed Physical Memory (RAM) 16.0 GB
Total Physical Memory   15.7 GB
Available Physical Memory   6.27 GB
Total Virtual Memory    27.4 GB
Available Virtual Memory    13.2 GB
Page File Space 11.7 GB
</code>```

User Environment Variables:

```<code>C:\Users\towle\AppData\Local\Microsoft\WindowsApps
C:\Users\towle\AppData\Local\GitHubDesktop\bin
C:\Users\towle\AppData\Local\atom\bin
C:\Program Files (x86)\Nmap
C:\Users\towle\AppData\Local\Programs\Microsoft VS Code\bin
C:\Users\towle\AppData\Roaming\Composer\vendor\bin
</code>```

System Environment Variables:

```<code>C:\Program Files\Common Files\Oracle\Java\javapath
C:\Program Files\Eclipse Adoptium\jdk-17.0.2.8-hotspot\bin
C:\Program Files\Eclipse Adoptium\jdk-11.0.13.8-hotspot\bin
%INTEL_DEV_REDIST%redist\intel64_win\compiler
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Windows\System32\OpenSSH\
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Program Files\dotnet\
C:\Program Files\Microsoft SQL Server\120\Tools\Binn\
C:\Program Files\Common Files\Autodesk Shared\
C:\Program Files\Git\cmd
C:\Program Files\MySQL\MySQL Utilities 1.6\
C:\xampp\php
C:\composer
C:\PHP7
</code>```

Composer Install Path:

C:\composer

\vendor\bin

\vendor\composer

\vendor\dealerdirect

\vendor\phpcompatibility

\vendor\squizlabs

\vendor\squizlabs\php_codesniffer

WordPress Coding Standards Path:

C:\composer\Tools\wpcs

Local Wordpress Dev Site Path:

C:\xampp\htdocs\vhdev

```<code>PS C:\composer> phpcs -i
The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend, WordPress, WordPress-Core, WordPress-Docs and WordPress-Extra
</code>```
```<code>PS C:\composer> php --version
PHP 8.1.4 (cli) (built: Mar 16 2022 09:33:31) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.1.4, Copyright (c) Zend Technologies
</code>```
```<code>PS C:\composer> phpcs --version
PHP_CodeSniffer version 3.7.1 (stable) by Squiz (http://www.squiz.net)
</code>```
```<code>PS C:\composer> phpcbf --version
PHP_CodeSniffer version 3.7.1 (stable) by Squiz (http://www.squiz.net)
</code>```

MY Visual Studio JSON

```<code>{
    "workbench.settings.editor": "json",
    "workbench.colorTheme": "Cobalt2",
    "phpcs.executablePath": "C:\\composer\\Tools\\wpcs\\vendor\\bin\\phpcs.bat",
    "phpcs.enable": true,
    "phpcs.standard": "WordPress",
    "editor.fontSize": 16,
    "editor.lineHeight": 20,
    "editor.fontVariations": false,
    "editor.fontLigatures": false,
    "editor.fontWeight": "normal",
    "editor.fontFamily": "Times New Roman",
    "atomKeymap.promptV3Features": true,
    "editor.multiCursorModifier": "ctrlCmd",
    "editor.formatOnPaste": true,
    "phpcbf.enable": true,
    "phpcbf.executablePath": "C:\\composer\\Tools\\wpcs\\vendor\\bin\\phpcbf.bat",
    "phpcbf.documentFormattingProvider": true,
    "phpcbf.onsave": true,
    "phpcbf.standard": "WordPress",
    "php.version": "8.1.4",
    "php.suggest.basic": true,
    "php.validate.enable": true,
}
</code>```
```<code>PS C:\xampp\htdocs\vhdev> composer global require squizlabs/php_codesniffer wp-coding-standards
/wpcs
Changed current directory to C:/Users/towle/AppData/Roaming/Composer
Using version ^3.7 for squizlabs/php_codesniffer
Using version ^2.3 for wp-coding-standards/wpcs
squizlabs/php_codesniffer is currently present in the require-dev key and you ran the command w
ithout the --dev flag, which will move it to the require key.
Do you want to move this requirement? [no]? no
Do you want to re-run the command with --dev? [yes]? yes
./composer.json has been updated
Running composer update squizlabs/php_codesniffer wp-coding-standards/wpcs
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Downloading wp-coding-standards/wpcs (2.3.0)
  - Installing wp-coding-standards/wpcs (2.3.0): Extracting archive
1 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
No security vulnerability advisories found

</code>```
```<code>PS C:\xampp\htdocs\vhdev> phpcs -i
The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz and Zend
</code>```
```<code>PS C:\xampp\htdocs\vhdev> composer global require squizlabs/php_codesniffer wp-coding-standards
/wpcs
Changed current directory to C:/Users/towle/AppData/Roaming/Composer
Using version ^3.7 for squizlabs/php_codesniffer
Using version ^2.3 for wp-coding-standards/wpcs
squizlabs/php_codesniffer is currently present in the require-dev key and you ran the command w
ithout the --dev flag, which will move it to the require key.
wp-coding-standards/wpcs is currently present in the require-dev key and you ran the command wi
Do you want to move these requirements? [no]? yes
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Writing lock file
Nothing to install, update or remove
Generating autoload files
</code>```
```<code>PS C:\xampp\htdocs\vhdev> phpcs -i
The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz and Zend
</code>```
```<code>PS C:\xampp\htdocs\vhdev> phpcs --config-set installed_paths ~/.composer/vendor/wp-coding-stand
ards/wpcs
Using config file: C:\Users\towle\AppData\Roaming\Composer\vendor\squizlabs\php_codesniffer\Cod
eSniffer.conf

Config value "installed_paths" added successfully
</code>```

Eventually I got phpcs to see the WordPress Standards, but when I load PHP file, I get the "WordPress coing standard not installed message"

```<code>PS C:\xampp\htdocs\vhdev> phpcs -i
The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend, WordPress, WordPress-Core, WordPress-Docs and WordPress-Extra
</code>```

Body:
I need help... I have looked all over and maybe it's just a rookie mistake somewhere, however I feel I have looked and re-looked at every aspect of install on configuration.

Error in Visual Studio Code (1.74.0)
phpcs: The "WordPress" coding standard is not installed. Please review your configuration an try again.

What am I doing wrong that when I load my site folder into VS and open a .PHP I get this error.

System Build:

OS Name Microsoft Windows 10 Pro
Version 10.0.19044 Build 19044
System Type x64-based PC
Processor   11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz, 2803 Mhz, 4 Core(s), 8 Logical Processor(s)
BIOS Version/Date   Dell Inc. 1.9.0, 12/8/2021
Windows Directory   C:\Windows

Memory:

Installed Physical Memory (RAM) 16.0 GB
Total Physical Memory   15.7 GB
Available Physical Memory   6.27 GB
Total Virtual Memory    27.4 GB
Available Virtual Memory    13.2 GB
Page File Space 11.7 GB

User Environment Variables:

C:\Users\towle\AppData\Local\Microsoft\WindowsApps
C:\Users\towle\AppData\Local\GitHubDesktop\bin
C:\Users\towle\AppData\Local\atom\bin
C:\Program Files (x86)\Nmap
C:\Users\towle\AppData\Local\Programs\Microsoft VS Code\bin
C:\Users\towle\AppData\Roaming\Composer\vendor\bin

System Environment Variables:

C:\Program Files\Common Files\Oracle\Java\javapath
C:\Program Files\Eclipse Adoptium\jdk-17.0.2.8-hotspot\bin
C:\Program Files\Eclipse Adoptium\jdk-11.0.13.8-hotspot\bin
%INTEL_DEV_REDIST%redist\intel64_win\compiler
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Windows\System32\OpenSSH\
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Program Files\dotnet\
C:\Program Files\Microsoft SQL Server\120\Tools\Binn\
C:\Program Files\Common Files\Autodesk Shared\
C:\Program Files\Git\cmd
C:\Program Files\MySQL\MySQL Utilities 1.6\
C:\xampp\php
C:\composer
C:\PHP7

Composer Install Path:

C:\composer

\vendor\bin

\vendor\composer

\vendor\dealerdirect

\vendor\phpcompatibility

\vendor\squizlabs

\vendor\squizlabs\php_codesniffer

WordPress Coding Standards Path:

C:\composer\Tools\wpcs

Local Wordpress Dev Site Path:

C:\xampp\htdocs\vhdev

PS C:\composer> phpcs -i
The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend, WordPress, WordPress-Core, WordPress-Docs and WordPress-Extra

PS C:\composer> php --version
PHP 8.1.4 (cli) (built: Mar 16 2022 09:33:31) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.1.4, Copyright (c) Zend Technologies

PS C:\composer> phpcs --version
PHP_CodeSniffer version 3.7.1 (stable) by Squiz (http://www.squiz.net)

PS C:\composer> phpcbf --version
PHP_CodeSniffer version 3.7.1 (stable) by Squiz (http://www.squiz.net)

MY Visual Studio JSON

{
    "workbench.settings.editor": "json",
    "workbench.colorTheme": "Cobalt2",
    "phpcs.executablePath": "C:\\composer\\Tools\\wpcs\\vendor\\bin\\phpcs.bat",
    "phpcs.enable": true,
    "phpcs.standard": "WordPress",
    "editor.fontSize": 16,
    "editor.lineHeight": 20,
    "editor.fontVariations": false,
    "editor.fontLigatures": false,
    "editor.fontWeight": "normal",
    "editor.fontFamily": "Times New Roman",
    "atomKeymap.promptV3Features": true,
    "editor.multiCursorModifier": "ctrlCmd",
    "editor.formatOnPaste": true,
    "phpcbf.enable": true,
    "phpcbf.executablePath": "C:\\composer\\Tools\\wpcs\\vendor\\bin\\phpcbf.bat",
    "phpcbf.documentFormattingProvider": true,
    "phpcbf.onsave": true,
    "phpcbf.standard": "WordPress",
    "php.version": "8.1.4",
    "php.suggest.basic": true,
    "php.validate.enable": true,
}

PS C:\xampp\htdocs\vhdev> composer global require squizlabs/php_codesniffer wp-coding-standards
/wpcs
Changed current directory to C:/Users/towle/AppData/Roaming/Composer
Using version ^3.7 for squizlabs/php_codesniffer
Using version ^2.3 for wp-coding-standards/wpcs
squizlabs/php_codesniffer is currently present in the require-dev key and you ran the command w
ithout the --dev flag, which will move it to the require key.
Do you want to move this requirement? [no]? no
Do you want to re-run the command with --dev? [yes]? yes
./composer.json has been updated
Running composer update squizlabs/php_codesniffer wp-coding-standards/wpcs
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Downloading wp-coding-standards/wpcs (2.3.0)
  - Installing wp-coding-standards/wpcs (2.3.0): Extracting archive
1 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
No security vulnerability advisories found

PS C:\xampp\htdocs\vhdev> phpcs -i
The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz and Zend

PS C:\xampp\htdocs\vhdev> composer global require squizlabs/php_codesniffer wp-coding-standards
/wpcs
Changed current directory to C:/Users/towle/AppData/Roaming/Composer
Using version ^3.7 for squizlabs/php_codesniffer
Using version ^2.3 for wp-coding-standards/wpcs
squizlabs/php_codesniffer is currently present in the require-dev key and you ran the command w
ithout the --dev flag, which will move it to the require key.
wp-coding-standards/wpcs is currently present in the require-dev key and you ran the command wi
Do you want to move these requirements? [no]? yes
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Writing lock file
Nothing to install, update or remove
Generating autoload files

PS C:\xampp\htdocs\vhdev> phpcs -i
The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz and Zend

PS C:\xampp\htdocs\vhdev> phpcs --config-set installed_paths ~/.composer/vendor/wp-coding-stand
ards/wpcs
Using config file: C:\Users\towle\AppData\Roaming\Composer\vendor\squizlabs\php_codesniffer\Cod
eSniffer.conf

Config value "installed_paths" added successfully

Eventually I got phpcs to see the WordPress Standards, but when I load PHP file, I get the "WordPress coing standard not installed message"

PS C:\xampp\htdocs\vhdev> phpcs -i
The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend, WordPress, WordPress-Core, WordPress-Docs and WordPress-Extra


问:
#Rails How to retrieve data item from ActiveStorage::Blobs table?
I need retrieve names of the files stored in blobs table of ActiveStorage. I cannot find a working way to do so.

FloorPlan.rd model file :

```<code>class FloorPlan < ApplicationRecord
  belongs_to :unit
  has_many_attached :floor_image, dependent: :destroy
  validates :name, presence:true
  validates :floor_image, presence:true
end
</code>```

And here is the snippet from schema.rb

```<code>  create_table "floor_plans", force: :cascade do |t|
    t.string "name", null: false
    t.bigint "unit_id", null: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["unit_id"], name: "index_floor_plans_on_unit_id"
  end
</code>```

A part of Unit.rb model file :

```<code>class Unit < ApplicationRecord

  has_many :floor_plans, dependent: :delete_all

</code>```

Need to print the name of :floor_image file. Like if the name is floor.png then output should be this name.

Here is the image showing floor_plans table

Here is attachments table

Here is the blobs table from where I want print the filename for eg. "sample.jpg1".

I tried to implement from this answer
But no help in a data entry getting returned :(

Body:
I need retrieve names of the files stored in blobs table of ActiveStorage. I cannot find a working way to do so.

FloorPlan.rd model file :

class FloorPlan < ApplicationRecord
  belongs_to :unit
  has_many_attached :floor_image, dependent: :destroy
  validates :name, presence:true
  validates :floor_image, presence:true
end

And here is the snippet from schema.rb

  create_table "floor_plans", force: :cascade do |t|
    t.string "name", null: false
    t.bigint "unit_id", null: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["unit_id"], name: "index_floor_plans_on_unit_id"
  end

A part of Unit.rb model file :

class Unit < ApplicationRecord

  has_many :floor_plans, dependent: :delete_all

Need to print the name of :floor_image file. Like if the name is floor.png then output should be this name.

Here is the image showing floor_plans table

Here is attachments table

Here is the blobs table from where I want print the filename for eg. "sample.jpg1".

I tried to implement from this answer
But no help in a data entry getting returned :(


问:
AggregatingMergeTree order by column not in the sorting key
What are some options to have AggregatingMergeTree merge by a column but ordered by a column that's not in the sorting key?

My application is similar to Zendesk tickets. A ticket has a category, status, and ID. The application emits ticket status change events to CH and I'm calculating statistics on the time it took to close since it was created given some time range R group by some time period P.

For example, events look like this

```<code>{
    "ticket": "A",
    "event_time": 2022-12-08T15:00:00Z,
    "category": "bug",
    "status": "created"
},
{
    "ticket": "A",
    "event_time": 2022-12-08T15:30:00Z,
    "category": "bug",
    "status": "reviewing"
},
{
    "ticket": "A",
    "event_time": 2022-12-08T16:00:00Z,
    "category": "bug",
    "status": "reviewed"
}
</code>```

My AggregatingMergeTree (more specifically, it's replicated) has a sorting key on the ticket ID to aggregate two states into one.

```<code>CREATE TABLE ticket_created_to_reviewed
(
    `ticket` String,
    `created_ticket_event_id` SimpleAggregateFunction(max, String),
    `created_ticket_event_time` SimpleAggregateFunction(max, DateTime64(9)),
    `created_ticket_category` SimpleAggregateFunction(max, String),
    `close_ticket_event_id` SimpleAggregateFunction(max, String),
    `close_ticket_event_time` SimpleAggregateFunction(max, DateTime64(9)),
    `close_ticket_category` SimpleAggregateFunction(max, String),
)
ENGINE = ReplicatedAggregatingMergeTree('<path>', '{replica}')
PARTITION BY toYYYYMM(close_ticket_event_time)
PRIMARY KEY ticket
ORDER BY ticket
TTL date_trunc('second', if(close_ticket_event_time > created_ticket_event_time,
    close_ticket_event_time, created_ticket_event_time)) + toIntervalMonth(12)
SETTINGS index_granularity = 8192
</code>```

Two MVs SELECT on the raw events and inserts to the ticket_created_to_reviewed. One for WHERE status = 'created' and another for WHERE status = 'reviewed'

So far the data populates correctly, although I have to exclude rows that only have one of the status events populated. Getting hourly p99 of ticket time to close past 1 day for each category looks something like this

```<code>SELECT
    quantile(0.9)(date_diff('second', created_ticket_event_time, close_ticket_event_time)),
    date_trunc('hour', close_ticket_event_time) as t,
    close_ticket_category as category
FROM
(
    SELECT
        ticket,
        max(created_ticket_event_id) AS created_ticket_event_id,
        max(created_ticket_event_time) AS created_ticket_event_time,
        max(created_ticket_category) AS created_ticket_category,
        max(close_ticket_event_id) AS close_ticket_event_id,
        max(close_ticket_event_time) AS close_ticket_event_time,
        max(close_ticket_category) AS close_ticket_category
    FROM ticket_unreviewed_to_reviewed
    GROUP BY ticket
)
WHERE close_ticket_event_id != '' AND created_ticket_event_id != '' AND
    close_ticket_event_time > addDays(now(), -1)
GROUP BY t, category
</code>```

The problem is close_ticket_event_time is not in the sorting key so the query scans the full table, but I can't also include that column in the sorting key because the table wouldn't then aggregate by the ticket ID.

Any suggestions?

Things tried:

Adding an index and/or projection that orders by close_ticket_event_time. However, I think the main problem is that the sorting key is on ticket ID so the data is not ordered by time to efficiently find the matching time range, but at the same time adding close_ticket_event_time breaks the aggregation behavior in AggregatingMergeTree

MV that joins created ticket and closed ticket, and a different destination table with close_ticket_event_time as the sorting key. The destination table doesn't contain all the data if the right side of the JOIN isn't available at the time MV was triggered (i.e. left side). This can happen if events are ingested out of order.

Ideally, what I'm looking for is something like this in AggregatingMergeTree, but it appears this isn't possible due to the nature of how the data is stored.

```<code>PRIMARY KEY ticket
ORDER BY close_ticket_event_time
</code>```

Thanks in advance

Body:
What are some options to have AggregatingMergeTree merge by a column but ordered by a column that's not in the sorting key?

My application is similar to Zendesk tickets. A ticket has a category, status, and ID. The application emits ticket status change events to CH and I'm calculating statistics on the time it took to close since it was created given some time range R group by some time period P.

For example, events look like this

{
    "ticket": "A",
    "event_time": 2022-12-08T15:00:00Z,
    "category": "bug",
    "status": "created"
},
{
    "ticket": "A",
    "event_time": 2022-12-08T15:30:00Z,
    "category": "bug",
    "status": "reviewing"
},
{
    "ticket": "A",
    "event_time": 2022-12-08T16:00:00Z,
    "category": "bug",
    "status": "reviewed"
}

My AggregatingMergeTree (more specifically, it's replicated) has a sorting key on the ticket ID to aggregate two states into one.

CREATE TABLE ticket_created_to_reviewed
(
    `ticket` String,
    `created_ticket_event_id` SimpleAggregateFunction(max, String),
    `created_ticket_event_time` SimpleAggregateFunction(max, DateTime64(9)),
    `created_ticket_category` SimpleAggregateFunction(max, String),
    `close_ticket_event_id` SimpleAggregateFunction(max, String),
    `close_ticket_event_time` SimpleAggregateFunction(max, DateTime64(9)),
    `close_ticket_category` SimpleAggregateFunction(max, String),
)
ENGINE = ReplicatedAggregatingMergeTree('<path>', '{replica}')
PARTITION BY toYYYYMM(close_ticket_event_time)
PRIMARY KEY ticket
ORDER BY ticket
TTL date_trunc('second', if(close_ticket_event_time > created_ticket_event_time,
    close_ticket_event_time, created_ticket_event_time)) + toIntervalMonth(12)
SETTINGS index_granularity = 8192

Two MVs SELECT on the raw events and inserts to the ticket_created_to_reviewed. One for WHERE status = 'created' and another for WHERE status = 'reviewed'

So far the data populates correctly, although I have to exclude rows that only have one of the status events populated. Getting hourly p99 of ticket time to close past 1 day for each category looks something like this

SELECT
    quantile(0.9)(date_diff('second', created_ticket_event_time, close_ticket_event_time)),
    date_trunc('hour', close_ticket_event_time) as t,
    close_ticket_category as category
FROM
(
    SELECT
        ticket,
        max(created_ticket_event_id) AS created_ticket_event_id,
        max(created_ticket_event_time) AS created_ticket_event_time,
        max(created_ticket_category) AS created_ticket_category,
        max(close_ticket_event_id) AS close_ticket_event_id,
        max(close_ticket_event_time) AS close_ticket_event_time,
        max(close_ticket_category) AS close_ticket_category
    FROM ticket_unreviewed_to_reviewed
    GROUP BY ticket
)
WHERE close_ticket_event_id != '' AND created_ticket_event_id != '' AND
    close_ticket_event_time > addDays(now(), -1)
GROUP BY t, category

The problem is close_ticket_event_time is not in the sorting key so the query scans the full table, but I can't also include that column in the sorting key because the table wouldn't then aggregate by the ticket ID.

Any suggestions?

Things tried:

Adding an index and/or projection that orders by close_ticket_event_time. However, I think the main problem is that the sorting key is on ticket ID so the data is not ordered by time to efficiently find the matching time range, but at the same time adding close_ticket_event_time breaks the aggregation behavior in AggregatingMergeTree

MV that joins created ticket and closed ticket, and a different destination table with close_ticket_event_time as the sorting key. The destination table doesn't contain all the data if the right side of the JOIN isn't available at the time MV was triggered (i.e. left side). This can happen if events are ingested out of order.

Ideally, what I'm looking for is something like this in AggregatingMergeTree, but it appears this isn't possible due to the nature of how the data is stored.

PRIMARY KEY ticket
ORDER BY close_ticket_event_time

Thanks in advance


问:
Why I can't get the results out of my textDidChange method?
edit: I solved the problem by uncommenting searchBar delegate in viewDidLoad. Thank you

I'm working on a project on using realm. But my problem is when i search the items with this code below it doesn't make any filter and all i see is all the items not the ones i search.

```<code>func loadItems() {

    todoItems = selectedCategory?.items.sorted(byKeyPath: "title", ascending: true)

    tableView.reloadData()
  }

  }
//MARK: - Search Bar Methods

extension ToDoListViewController: UISearchBarDelegate {

  func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {

    if searchBar.text == "" {

      loadItems()

      DispatchQueue.main.async {
        searchBar.resignFirstResponder()
      }

      }else{

      todoItems = todoItems?.filter("title CONTAINS[cd] %@", searchBar.text!).sorted(byKeyPath: "dateCreated", ascending: true)
        tableView.reloadData()

    }

    }
  }
</code>```

Body:
edit: I solved the problem by uncommenting searchBar delegate in viewDidLoad. Thank you

I'm working on a project on using realm. But my problem is when i search the items with this code below it doesn't make any filter and all i see is all the items not the ones i search.

func loadItems() {

    todoItems = selectedCategory?.items.sorted(byKeyPath: "title", ascending: true)

    tableView.reloadData()
  }

  }
//MARK: - Search Bar Methods

extension ToDoListViewController: UISearchBarDelegate {

  func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {

    if searchBar.text == "" {

      loadItems()

      DispatchQueue.main.async {
        searchBar.resignFirstResponder()
      }

      }else{

      todoItems = todoItems?.filter("title CONTAINS[cd] %@", searchBar.text!).sorted(byKeyPath: "dateCreated", ascending: true)
        tableView.reloadData()

    }

    }
  }


问:
MirrorList Issue : Failed to download metadata for repo 'epel'
Error: Failed to download metadata for repo 'epel': Cannot download repmd.xml: Empty mirrorlist specified.

The firewall has port 80, 22, 69, http, all configured.

Systemctl enabled the firewall and httpd service.

I'm not sure if it is GPG keys that are messing me up. I have a different template of another working Rhel 8 repo. It doesn't seem to make the /etc/yum.repo.d/ very important. I've matched the configuration.

However orginially instead of pointing to a local GPG file in /etc/pki

It would look to an http address that I can confirm is up and running from my repo server.

Any known fixes or places I can look to fix this. Am I better off just rebuilding all of the repos?


问:
CubeTextureLoader in ThreeJs not loading the background
```<code>
//textures
let loader=new THREE.TextureLoader()
let stars = loader.load("./../static/textures/stars3.jpg");

//BACKGROUND
scene.background = new THREE.CubeTextureLoader()
  .load([
    "./../static/textures/stars2.jpg",
    "./../static/textures/stars3.jpg",
    "./../static/textures/stars2.jpg",
    "./../static/textures/stars3.jpg",
    "./../static/textures/stars2.jpg",
    "./../static/textures/stars3.jpg",

  ]);

// scene.background = loader.load(
//   "./../static/textures/stars3.jpg"
// );

</code>```

the stars image are not showing as 3d background. When I use simple textureloader to load just one static image it works as the background but not cubetextureloader.
I don't get any errors just 3 warnings

"GL_INVALID_VALUE: Each cubemap face must have equal width and height.",

"GL_INVALID_OPERATION: Level of detail outside of range.", * 6

"GL_INVALID_OPERATION: Texture format does not support mipmap generation."

All I get is a black background.

Body:
//textures
let loader=new THREE.TextureLoader()
let stars = loader.load("./../static/textures/stars3.jpg");

//BACKGROUND
scene.background = new THREE.CubeTextureLoader()
  .load([
    "./../static/textures/stars2.jpg",
    "./../static/textures/stars3.jpg",
    "./../static/textures/stars2.jpg",
    "./../static/textures/stars3.jpg",
    "./../static/textures/stars2.jpg",
    "./../static/textures/stars3.jpg",

  ]);

// scene.background = loader.load(
//   "./../static/textures/stars3.jpg"
// );

the stars image are not showing as 3d background. When I use simple textureloader to load just one static image it works as the background but not cubetextureloader.
I don't get any errors just 3 warnings

"GL_INVALID_VALUE: Each cubemap face must have equal width and height.",

"GL_INVALID_OPERATION: Level of detail outside of range.", * 6

"GL_INVALID_OPERATION: Texture format does not support mipmap generation."

All I get is a black background.


问:
TransformerAction is not triggered on dependency resolution
I would like to transform some dependencies when Gradle resolves them.

I have followed the 'Transforming dependency artifacts on resolution' documentation, but my TransformAction is not triggered.

I have

created a custom configuration, gitHub

created custom attributes, and both

applied them to the gitHub configuration,

and registered them in the dependencies {} block)

created and registered a custom TransformAction.

created a task, resolveGitHubDependencies, that will resolve the gitHub configuration.

I have tried a few different adjustments, but nothing seems to have an impact.

What am I missing? Or is this a bug?

Here's the code I've created. It can be tested by running ./gradlew resolveGitHubDependencies. I expect that MyTransformer will print some log statements, but it doesn't print anything.

import org.slf4j.LoggerFactory

plugins {
  base
}

repositories {
  ivy("https://github.com/") {
    name = "GitHub"

    patternLayout {
      artifact("/[organisation]/[module]/archive/[revision].[ext]")
      artifact("/[organisation]/[module]/releases/download/[revision]/[module](-[revision]).[ext]")
    }
    metadataSources { artifact() }
  }
}

// from https://github.com/gradle/gradle/issues/19707
val transformed = Attribute.of("my-library.transformed", Boolean::class.javaObjectType)
val dependencySource = Attribute.of("dependency source", String::class.java)

// my custom configuration - I want to transform all dependencies from this configuration
val gitHub by configurations.creating {
  isCanBeConsumed = false
  isCanBeResolved = true
  attributes {
    attribute(dependencySource, "gitHub")
    attribute(transformed, false)
  }
}

// this is the transformer that I expect to be triggered on dependency resolution
abstract class MyTransformer : TransformAction<MyTransformer.Parameters> {

  private val logger = LoggerFactory.getLogger(this::class.java)

  interface Parameters : TransformParameters {
    @get:Input
    val sourceAttributes: MapProperty<Attribute<*>, Any?>
  }

  @get:PathSensitive(PathSensitivity.NAME_ONLY)
  @get:InputArtifact
  abstract val inputArtifact: Provider<FileSystemLocation>

  override fun transform(outputs: TransformOutputs) {
    val sourceAttributes = parameters.sourceAttributes.get()
    logger.error("sourceAttributes: $sourceAttributes")
    logger.error("sourceAttributes: ${sourceAttributes.keys}")
    logger.error("sourceAttributes: ${sourceAttributes.values.joinToString { it.toString() }}")

    val input = inputArtifact.get().asFile
    outputs.file(input)
  }
}

dependencies {
  // this is the dependency I want to transform
  gitHub("emcrisostomo:fswatch:1.17.1@tar.gz")

  attributesSchema {
    attribute(dependencySource)
    attribute(transformed)
  }

//  artifactTypes.configureEach {
//    attributes.attribute(transformed, false)
//  }

  registerTransform(MyTransformer::class) {

//    from.attributes.attribute(dependencySource, "gitHub")
//    to.attributes.attribute(dependencySource, "gitHub")
    from.attributes.attribute(dependencySource, "gitHub").attribute(transformed, false)
    to.attributes.attribute(dependencySource, "gitHub").attribute(transformed, true)

    parameters {
      sourceAttributes.set(
        from.attributes.keySet().associateWith { key ->
          from.attributes.getAttribute(key)
        }
      )
    }
  }
}

val resolveGitHubDependencies by tasks.registering(Sync::class) {
  group = "gh transform"
  from(gitHub)
  into(temporaryDir)
}
```

Gradle version: 7.6

Body:
I would like to transform some dependencies when Gradle resolves them.

I have followed the 'Transforming dependency artifacts on resolution' documentation, but my TransformAction is not triggered.

I have

created a custom configuration, gitHub

created custom attributes, and both

applied them to the gitHub configuration,

and registered them in the dependencies {} block)

created and registered a custom TransformAction.

created a task, resolveGitHubDependencies, that will resolve the gitHub configuration.

I have tried a few different adjustments, but nothing seems to have an impact.

What am I missing? Or is this a bug?

Here's the code I've created. It can be tested by running ./gradlew resolveGitHubDependencies. I expect that MyTransformer will print some log statements, but it doesn't print anything.

import org.slf4j.LoggerFactory

plugins {
  base
}

repositories {
  ivy("https://github.com/") {
    name = "GitHub"

    patternLayout {
      artifact("/[organisation]/[module]/archive/[revision].[ext]")
      artifact("/[organisation]/[module]/releases/download/[revision]/[module](-[revision]).[ext]")
    }
    metadataSources { artifact() }
  }
}

// from https://github.com/gradle/gradle/issues/19707
val transformed = Attribute.of("my-library.transformed", Boolean::class.javaObjectType)
val dependencySource = Attribute.of("dependency source", String::class.java)

// my custom configuration - I want to transform all dependencies from this configuration
val gitHub by configurations.creating {
  isCanBeConsumed = false
  isCanBeResolved = true
  attributes {
    attribute(dependencySource, "gitHub")
    attribute(transformed, false)
  }
}

// this is the transformer that I expect to be triggered on dependency resolution
abstract class MyTransformer : TransformAction<MyTransformer.Parameters> {

  private val logger = LoggerFactory.getLogger(this::class.java)

  interface Parameters : TransformParameters {
    @get:Input
    val sourceAttributes: MapProperty<Attribute<*>, Any?>
  }

  @get:PathSensitive(PathSensitivity.NAME_ONLY)
  @get:InputArtifact
  abstract val inputArtifact: Provider<FileSystemLocation>

  override fun transform(outputs: TransformOutputs) {
    val sourceAttributes = parameters.sourceAttributes.get()
    logger.error("sourceAttributes: $sourceAttributes")
    logger.error("sourceAttributes: ${sourceAttributes.keys}")
    logger.error("sourceAttributes: ${sourceAttributes.values.joinToString { it.toString() }}")

    val input = inputArtifact.get().asFile
    outputs.file(input)
  }
}

dependencies {
  // this is the dependency I want to transform
  gitHub("emcrisostomo:fswatch:1.17.1@tar.gz")

  attributesSchema {
    attribute(dependencySource)
    attribute(transformed)
  }

//  artifactTypes.configureEach {
//    attributes.attribute(transformed, false)
//  }

  registerTransform(MyTransformer::class) {

//    from.attributes.attribute(dependencySource, "gitHub")
//    to.attributes.attribute(dependencySource, "gitHub")
    from.attributes.attribute(dependencySource, "gitHub").attribute(transformed, false)
    to.attributes.attribute(dependencySource, "gitHub").attribute(transformed, true)

    parameters {
      sourceAttributes.set(
        from.attributes.keySet().associateWith { key ->
          from.attributes.getAttribute(key)
        }
      )
    }
  }
}

val resolveGitHubDependencies by tasks.registering(Sync::class) {
  group = "gh transform"
  from(gitHub)
  into(temporaryDir)
}

Gradle version: 7.6


问:
Python script to change dictionary content of another python script
I have a Python script to create a 'mock ultrasound' machine. It runs on a Raspberry Pi, with a long USB cable at the end with an RFID reader.
The user 'scans' a mannequin with RFID chips under the skin. When it scans a chip, it displays a gif associated with the tag's string. That information is contained in 2 dictionaries. (one dictionary is 'pre-intervention' and the other is 'post intervention'. The script switches which dictionary is in use by pressing a button onscreen. The idea is that a medical learner finds a problem with their first scan, they do something to fix the problem, and then they check to see if it's been fixed.

I want to make a simple way to change which gif is associate with the tags. Something simple so my colleagues who do not know anything about coding could do on their own without me.

Either as a GUI form, or prompt for each dictionary entry (although that would not be preferable as there will eventually be a lot of dictionary entries).

Sorry if this isn't the right place.

```<code>#!/usr/bin/python3.7
import sys
import os

from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import *
from PyQt5.QtGui import QMovie, QPixmap
from PyQt5.QtWidgets import *

WINDOW_STYLE = '''
background-color:black;
color:white;
'''

class Ui_Widget(QWidget):

    # You need to change this
    CARD_DICT = {
        # PIN:  IMAGE_PATH
        #### PRE INTERVENTION IMAGES ####
        #### Charlie ####
        #left appex
        '13603414011682': 'images/no-sliding.gif',
        #right appex
        '1360739520482': 'images/Normal-lung-sliding.gif',
        #heart
        '136010319878103': 'images/heart.gif',
        #mid clavicular
        '136073122213110': 'images/placeholder.gif',
        #sub xyphoid
        '136034217194177': 'images/subxiphoid.gif',
        #diaphragm
        '1360352372244': 'images/placeholder.gif',
        #supra umbilicus
        '1360739715155': 'images/placeholder.gif',
        #right lateral
        '136034163207198': 'images/NEGATIVE-FAST-LUQ.gif',
        #left lateral
        '1360738615152': 'images/NEGATIVE-FAST-LUQ.gif',
        # bladder
        '136072188183203': 'images/bladder.gif',

        #### Hagrid ####
        #top heart
        '13607295230121': 'images/---.gif',
        # left of the heart
        '13607311243154': 'images/---.gif',2

        #middle heart
        '13603452226124': 'images/---.gif',
        # sub xiphoid
        '136010456116172': 'images/---.gif',
        #mid clavicular
        '1360739618627': 'images/---.gif',
        # Right appex
        '136034130156180': 'images/---.gif',
        # left appex
        '136034163154147': 'images/---.gif',
        # right lateral
        '1360721779716': 'images/---.gif',
        # left lateral
        '136035225193139': 'images/---.gif',
        # bladder
        '1360341692724': 'images/---.gif'

    }
    # Change this too
    ### POST INTERVENTION IMAGES ###
    CARD_DICT_2 = {
        # PIN:  IMAGE_PATH
        #### Charlie ####
        #left appex
        '13603414011682': 'images/Normal-lung-sliding.gif',
        #right appex
        '1360739520482': 'images/Normal-lung-sliding.gif',
        #heart
        '136010319878103': 'images/heart.gif',
        #mid clavicular
        '136073122213110': 'images/placeholder.gif',
        #sub xyphoid
        '136034217194177': 'images/subxiphoid.gif',
        #diaphragm
        '1360352372244': 'images/placeholder.gif',
        #supra umbilicus
        '1360739715155': 'images/placeholder.gif',
        #right lateral
        '136034163207198': 'images/NEGATIVE-FAST-LUQ.gif',
        #left lateral
        '1360738615152': 'images/NEGATIVE-FAST-LUQ.gif',
        # bladder
        '136072188183203': 'images/bladder.gif',

        #### Hagrid ####
        #top heart
        '13607295230121': 'images/---.gif',
        # left of the heart
        '13607311243154': 'images/---.gif',
        #middle heart
        '13603452226124': 'images/---.gif',
        # sub xiphoid
        '136010456116172': 'images/---.gif',
        #mid clavicular
        '1360739618627': 'images/---.gif',
        # Right appex
        '136034130156180': 'images/---.gif',
        # left appex
        '136034163154147': 'images/---.gif',
        # right lateral
        '1360721779716': 'images/---.gif',
        # left lateral
        '136035225193139': 'images/---.gif',
        # bladder
        '1360341692724': 'images/---.gif',
        '136073148128213': 'images/placeholder.gif'
    }
    step = 1

    def __init__(self):
        super(Ui_Widget, self).__init__()
        self.setWindowTitle('Simulated Ultrasound')
        # Full screen
        self.setWindowState(Qt.WindowMaximized)
        # No close, minimize and miximaze window button
        self.setWindowFlag(Qt.FramelessWindowHint)
        self.setAttribute(QtCore.Qt.WA_StyledBackground, True)
        self.setStyleSheet(WINDOW_STYLE)
        self.setupUi(self)

    def setupUi(self, Widget):
        Widget.setObjectName("Widget")
        Widget.resize(800, 600)

        self.verticalLayout_2 = QtWidgets.QVBoxLayout(Widget)
        self.verticalLayout_2.setObjectName("verticalLayout_2")

        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
        self.gridLayout.setObjectName("gridLayout")

        self.label = QtWidgets.QLabel(Widget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
        self.label.setSizePolicy(sizePolicy)

        font = QtGui.QFont()
        font.setPointSize(50)

        self.label.setFont(font)
        self.label.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)

        self.verticalLayout_2.addLayout(self.gridLayout)

        self.lineEdit = QtWidgets.QLineEdit(Widget)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred
        )
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.lineEdit.sizePolicy().hasHeightForWidth())
        self.lineEdit.setSizePolicy(sizePolicy)
        self.lineEdit.setMinimumSize(QtCore.QSize(780, 0))
        self.lineEdit.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit.setObjectName("lineEdit")
        self.verticalLayout_2.addWidget(self.lineEdit)

        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize)
        self.horizontalLayout.setSpacing(10)
        self.horizontalLayout.setObjectName("horizontalLayout")

        self.label_2 = QtWidgets.QLabel(Widget)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum
        )
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
        self.label_2.setSizePolicy(sizePolicy)
        self.label_2.setMinimumSize(QtCore.QSize(0, 10))
        self.label_2.setObjectName("label_2")
        self.horizontalLayout.addWidget(self.label_2)

        spacerItem = QtWidgets.QSpacerItem(
            40, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum
        )
        self.horizontalLayout.addItem(spacerItem)

        self.pushButton = QtWidgets.QPushButton(Widget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.pushButton.sizePolicy().hasHeightForWidth())
        self.pushButton.setSizePolicy(sizePolicy)
        self.pushButton.setMinimumSize(QtCore.QSize(100, 50))
        self.pushButton.setObjectName("pushButton")
        self.horizontalLayout.addWidget(self.pushButton)

        self.verticalLayout_2.addLayout(self.horizontalLayout)

        self.retranslateUi(Widget)
        QtCore.QMetaObject.connectSlotsByName(Widget)

        self._widget = Widget
        self.pushButton.pressed.connect(self.reset) # type: ignore
        # Check every time the text line input changed
        self.lineEdit.textChanged.connect(self.submit_pass) # type: ignore

    def retranslateUi(self, Widget):
        _translate = QtCore.QCoreApplication.translate

        Widget.setWindowTitle(_translate("Widget", "Widget"))
        self.label.setText(_translate("Widget", "Simulated Ultrasound"))
        self.lineEdit.setPlaceholderText(_translate("Widget", "PIN Phrase"))
        self.label_2.setText(_translate("Widget", "Type your PIN Phrase. Then press ENTER to submit"))
        self.pushButton.setText(_translate("Widget", "Reset"))
        selt.pushButton.setStyleSheet("color = black;")

    def submit_pass_str(self, input_str):
        """here the application accept user input"""
        if input_str in self.CARD_DICT:
            if self.step == 1:
                self.display_image(self.CARD_DICT[input_str])
            else:
                self.display_image(self.CARD_DICT_2[input_str])
            self.label_2.setText('')
        else:
            self.label_2.setText(f'Invalid: {input_str}')

    def display_image(self, path):
        name, ext = os.path.splitext(path)
        if ext and ext.lower() == '.gif':
            movie = QMovie(path)
            self.label.setMovie(movie)
            movie.start()
        else:
            image = QPixmap(path)
            self.label.setPixmap(image)
        self.label.setMinimumSize(1, 1)

    def submit_pass(self):
        """Usage example using PIN Phrase input form"""
        self.submit_pass_str(self.lineEdit.text())

    def reset(self):
        _translate = QtCore.QCoreApplication.translate

        if self.step == 1:
            self.pushButton.setText(_translate("Widget", "Close"))

        self.pushButton.pressed.connect(self._widget.close) # type: ignore
        self.label.setText(_translate("Widget", "Simulated Ultrasound"))
        self.step += 1
        self.lineEdit.setFocus(True)

app = QApplication(sys.argv)
window = Ui_Widget()
window.show()
sys.exit(app.exec_())
</code>```

Body:
I have a Python script to create a 'mock ultrasound' machine. It runs on a Raspberry Pi, with a long USB cable at the end with an RFID reader.
The user 'scans' a mannequin with RFID chips under the skin. When it scans a chip, it displays a gif associated with the tag's string. That information is contained in 2 dictionaries. (one dictionary is 'pre-intervention' and the other is 'post intervention'. The script switches which dictionary is in use by pressing a button onscreen. The idea is that a medical learner finds a problem with their first scan, they do something to fix the problem, and then they check to see if it's been fixed.

I want to make a simple way to change which gif is associate with the tags. Something simple so my colleagues who do not know anything about coding could do on their own without me.

Either as a GUI form, or prompt for each dictionary entry (although that would not be preferable as there will eventually be a lot of dictionary entries).

Sorry if this isn't the right place.

#!/usr/bin/python3.7
import sys
import os

from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import *
from PyQt5.QtGui import QMovie, QPixmap
from PyQt5.QtWidgets import *

WINDOW_STYLE = '''
background-color:black;
color:white;
'''

class Ui_Widget(QWidget):

    # You need to change this
    CARD_DICT = {
        # PIN:  IMAGE_PATH
        #### PRE INTERVENTION IMAGES ####
        #### Charlie ####
        #left appex
        '13603414011682': 'images/no-sliding.gif',
        #right appex
        '1360739520482': 'images/Normal-lung-sliding.gif',
        #heart
        '136010319878103': 'images/heart.gif',
        #mid clavicular
        '136073122213110': 'images/placeholder.gif',
        #sub xyphoid
        '136034217194177': 'images/subxiphoid.gif',
        #diaphragm
        '1360352372244': 'images/placeholder.gif',
        #supra umbilicus
        '1360739715155': 'images/placeholder.gif',
        #right lateral
        '136034163207198': 'images/NEGATIVE-FAST-LUQ.gif',
        #left lateral
        '1360738615152': 'images/NEGATIVE-FAST-LUQ.gif',
        # bladder
        '136072188183203': 'images/bladder.gif',

        #### Hagrid ####
        #top heart
        '13607295230121': 'images/---.gif',
        # left of the heart
        '13607311243154': 'images/---.gif',2

        #middle heart
        '13603452226124': 'images/---.gif',
        # sub xiphoid
        '136010456116172': 'images/---.gif',
        #mid clavicular
        '1360739618627': 'images/---.gif',
        # Right appex
        '136034130156180': 'images/---.gif',
        # left appex
        '136034163154147': 'images/---.gif',
        # right lateral
        '1360721779716': 'images/---.gif',
        # left lateral
        '136035225193139': 'images/---.gif',
        # bladder
        '1360341692724': 'images/---.gif'

    }
    # Change this too
    ### POST INTERVENTION IMAGES ###
    CARD_DICT_2 = {
        # PIN:  IMAGE_PATH
        #### Charlie ####
        #left appex
        '13603414011682': 'images/Normal-lung-sliding.gif',
        #right appex
        '1360739520482': 'images/Normal-lung-sliding.gif',
        #heart
        '136010319878103': 'images/heart.gif',
        #mid clavicular
        '136073122213110': 'images/placeholder.gif',
        #sub xyphoid
        '136034217194177': 'images/subxiphoid.gif',
        #diaphragm
        '1360352372244': 'images/placeholder.gif',
        #supra umbilicus
        '1360739715155': 'images/placeholder.gif',
        #right lateral
        '136034163207198': 'images/NEGATIVE-FAST-LUQ.gif',
        #left lateral
        '1360738615152': 'images/NEGATIVE-FAST-LUQ.gif',
        # bladder
        '136072188183203': 'images/bladder.gif',

        #### Hagrid ####
        #top heart
        '13607295230121': 'images/---.gif',
        # left of the heart
        '13607311243154': 'images/---.gif',
        #middle heart
        '13603452226124': 'images/---.gif',
        # sub xiphoid
        '136010456116172': 'images/---.gif',
        #mid clavicular
        '1360739618627': 'images/---.gif',
        # Right appex
        '136034130156180': 'images/---.gif',
        # left appex
        '136034163154147': 'images/---.gif',
        # right lateral
        '1360721779716': 'images/---.gif',
        # left lateral
        '136035225193139': 'images/---.gif',
        # bladder
        '1360341692724': 'images/---.gif',
        '136073148128213': 'images/placeholder.gif'
    }
    step = 1

    def __init__(self):
        super(Ui_Widget, self).__init__()
        self.setWindowTitle('Simulated Ultrasound')
        # Full screen
        self.setWindowState(Qt.WindowMaximized)
        # No close, minimize and miximaze window button
        self.setWindowFlag(Qt.FramelessWindowHint)
        self.setAttribute(QtCore.Qt.WA_StyledBackground, True)
        self.setStyleSheet(WINDOW_STYLE)
        self.setupUi(self)

    def setupUi(self, Widget):
        Widget.setObjectName("Widget")
        Widget.resize(800, 600)

        self.verticalLayout_2 = QtWidgets.QVBoxLayout(Widget)
        self.verticalLayout_2.setObjectName("verticalLayout_2")

        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
        self.gridLayout.setObjectName("gridLayout")

        self.label = QtWidgets.QLabel(Widget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
        self.label.setSizePolicy(sizePolicy)

        font = QtGui.QFont()
        font.setPointSize(50)

        self.label.setFont(font)
        self.label.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)

        self.verticalLayout_2.addLayout(self.gridLayout)

        self.lineEdit = QtWidgets.QLineEdit(Widget)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred
        )
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.lineEdit.sizePolicy().hasHeightForWidth())
        self.lineEdit.setSizePolicy(sizePolicy)
        self.lineEdit.setMinimumSize(QtCore.QSize(780, 0))
        self.lineEdit.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit.setObjectName("lineEdit")
        self.verticalLayout_2.addWidget(self.lineEdit)

        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize)
        self.horizontalLayout.setSpacing(10)
        self.horizontalLayout.setObjectName("horizontalLayout")

        self.label_2 = QtWidgets.QLabel(Widget)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum
        )
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
        self.label_2.setSizePolicy(sizePolicy)
        self.label_2.setMinimumSize(QtCore.QSize(0, 10))
        self.label_2.setObjectName("label_2")
        self.horizontalLayout.addWidget(self.label_2)

        spacerItem = QtWidgets.QSpacerItem(
            40, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum
        )
        self.horizontalLayout.addItem(spacerItem)

        self.pushButton = QtWidgets.QPushButton(Widget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.pushButton.sizePolicy().hasHeightForWidth())
        self.pushButton.setSizePolicy(sizePolicy)
        self.pushButton.setMinimumSize(QtCore.QSize(100, 50))
        self.pushButton.setObjectName("pushButton")
        self.horizontalLayout.addWidget(self.pushButton)

        self.verticalLayout_2.addLayout(self.horizontalLayout)

        self.retranslateUi(Widget)
        QtCore.QMetaObject.connectSlotsByName(Widget)

        self._widget = Widget
        self.pushButton.pressed.connect(self.reset) # type: ignore
        # Check every time the text line input changed
        self.lineEdit.textChanged.connect(self.submit_pass) # type: ignore

    def retranslateUi(self, Widget):
        _translate = QtCore.QCoreApplication.translate

        Widget.setWindowTitle(_translate("Widget", "Widget"))
        self.label.setText(_translate("Widget", "Simulated Ultrasound"))
        self.lineEdit.setPlaceholderText(_translate("Widget", "PIN Phrase"))
        self.label_2.setText(_translate("Widget", "Type your PIN Phrase. Then press ENTER to submit"))
        self.pushButton.setText(_translate("Widget", "Reset"))
        selt.pushButton.setStyleSheet("color = black;")

    def submit_pass_str(self, input_str):
        """here the application accept user input"""
        if input_str in self.CARD_DICT:
            if self.step == 1:
                self.display_image(self.CARD_DICT[input_str])
            else:
                self.display_image(self.CARD_DICT_2[input_str])
            self.label_2.setText('')
        else:
            self.label_2.setText(f'Invalid: {input_str}')

    def display_image(self, path):
        name, ext = os.path.splitext(path)
        if ext and ext.lower() == '.gif':
            movie = QMovie(path)
            self.label.setMovie(movie)
            movie.start()
        else:
            image = QPixmap(path)
            self.label.setPixmap(image)
        self.label.setMinimumSize(1, 1)

    def submit_pass(self):
        """Usage example using PIN Phrase input form"""
        self.submit_pass_str(self.lineEdit.text())

    def reset(self):
        _translate = QtCore.QCoreApplication.translate

        if self.step == 1:
            self.pushButton.setText(_translate("Widget", "Close"))

        self.pushButton.pressed.connect(self._widget.close) # type: ignore
        self.label.setText(_translate("Widget", "Simulated Ultrasound"))
        self.step += 1
        self.lineEdit.setFocus(True)

app = QApplication(sys.argv)
window = Ui_Widget()
window.show()
sys.exit(app.exec_())


问:
html2canvas adding "border" in divs with linear-gradient
I have an issue with importing a div as an image with html2canvas.

I'm trying to download this div :

As an image and I'm getting this result :

And I don't know why, there is some kind of "border" that appears around the div that containt the linear-gradient, am I missing a property, or it is just a bug ?

Note: This things don't happends when I remove the linear-gradient !


问:
Combine graph with different axis?
I have data from a CSV file number 1. I have one list with the year the data was logged and one list with the data. I use plt.plot(list(a), list(b)) to show the graph. I also have CSV file number 2 with data. I also have a list with the year logged and the data. My problem occurs when I try to combine the graphs. There is missing years in both lists, but there is missing less years in csv file number 2.

How can I fix a problem like this? I would rather show blank on the years csv file number 1 don't have values. Exceptionally use regression.

Title: Combine graph with different axis?


问:
Approach to a non-redundant and robust alert system?
My team has a script on a cronjob schedule that checks for the presence of certain files in a directory, and if they are there, includes them in a report that is sent daily to our team's emails.

However, most days that report is empty, which is redundant and clutters my inbox. I suggested to my team to modify the script to only send out the report as an alert if there is at least one of these files. But they explained that if the script encounters some error, we won't know because the emails aren't sending - a false negative. A daily email report hence eliminates this concern.

I still don't think this is scaleable - e.g., if there are 10 independent alert systems this would make for a messy inbox. What is the best way to implement a more robust version of my approach - to send an alert only if a criterion is met - without the threat of false negatives?


问:
sidekiq - runaway FIFO pipes created with large job
We are using Sidekiq to process a number of backend jobs. One in particular is used very heavily. All I can really say about it is that it sends emails. It doesn't do the email creation (that's a separate job), it just sends them. We spin up a new worker for each email that needs to be sent.

We are trying to upgrade to Ruby 3 and having problems, though. Ruby 2.6.8 has no issues; in 3 (as well as 2.7.3 IIRC), if there is a large number of queued workers, it will get through maybe 20K of them, then it will start hemorrhaging FIFO pipes, on the order of 300-1000 ever 5 seconds or so. Eventually it gets to the ulimit on the system (currently set at 64K) and all sockets/connections fail due to insufficient resources.

In trying to debug this issue I did a run with 90% of what the email worker does entirely commented out, so it does basically nothing except make a couple database queries and do some string templating. I thought I was getting somewhere with that approach, as one run (of 50K+ emails) succeeded without the pipe explosion. However, the next run (identical parameters) did wind up with the runaway pipes.

Profiling with rbspy and ruby-prof did not help much, as they primarily focus on the Sidekiq infrastructure, not the workers themselves.

Looking through our code, I did see that nothing we wrote is ever using IO.* (e.g. IO.popen, IO.select, etc), so I don't see what could be causing the FIFO pipes.

I did see https://github.com/mperham/sidekiq/wiki/Batches#huge-batches, which is not necessarily what we're doing. If you look at the code snippet below, we're basically creating one large batch. I'm not sure whether pushing jobs in bulk as per the link will help with the problem we're having, but I'm about to give it a try once I rework things a bit.

No matter what I do I can't seem to figure out the following:

What is making these pipes? Why are they being created?
What is the condition by which the pipes start getting made exponentially? There are two FIFO pipes that open when we start Sidekiq, but until enough work has been done, we don't see more than 2-6 pipes open generally.
Any advice is appreciated, even along the lines of where to look next, as I'm a bit stumped.

Initializer:

```<code>require_relative 'logger'
require_relative 'configuration'
require 'sidekiq-pro'
require "sidekiq-ent"

module Proprietary
  unless const_defined?(:ENVIRONMENT)
    ENVIRONMENT = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
  end
  # Sidekiq.client_middleware.add Sidekiq::Middleware::Client::Batch
  REDIS_URL = if ENV["REDIS_URL"].present?
                ENV["REDIS_URL"]
              else
                "redis://#{ENV["REDIS_SERVER"]}:#{ENV["REDIS_PORT"]}"
              end

  METRICS = Statsd.new "10.0.9.215", 8125

  Sidekiq::Enterprise.unique! unless Proprietary::ENVIRONMENT == "test"
  Sidekiq.configure_server do |config|
    # require 'sidekiq/pro/reliable_fetch'
    config.average_scheduled_poll_interval = 2
    config.redis = {
      namespace: Proprietary.config.SIDEKIQ_NAMESPACE,
      url: Proprietary::REDIS_URL
    }
    config.server_middleware do |chain|
      require 'sidekiq/middleware/server/statsd'
      chain.add Sidekiq::Middleware::Server::Statsd, :client => METRICS
    end
    config.error_handlers << Proc.new do |ex,ctx_hash|
      Proprietary.report_exception(ex, "Sidekiq", ctx_hash)
    end
    config.super_fetch!
    config.reliable_scheduler!
  end

  Sidekiq.configure_client do |config|
    config.redis = {
      namespace: Proprietary.config.SIDEKIQ_NAMESPACE,
      url: Proprietary::REDIS_URL,
      size: 15,
      network_timeout: 5
    }
  end
end
</code>```

Code snippet (sanitized)

```<code>  def add_targets_to_batch
    @target_count  = targets.count
    queue_counter = 0
    batch.jobs do
      targets.shuffle.each do |target|
        send(campaign_target)
        queue_counter += 1
      end
    end
  end

  def send(campaign_target)
    TargetEmailWorker.perform_async(target[:id],
                                            guid,
                                            is_draft ? target[:email_address] : nil)
      begin
        Target.where(id: target[:id]).update(send_at: Time.now.utc)
      rescue Exception => ex

        Proprietary.report_exception(ex, self.class.name, { target_id: target[:id], guid: guid })
      end
    end
  end
</code>```

First I tried auditing our external connections for connection pooling, etc. That did not help the issue. Eventually I got to the point where I disabled all external connections and let the job run doing virtually nothing outside of a database query and some logging. This allowed one run to complete without issue, but on the second one, the FIFO pipes still grew exponentially after a certain (variable) amount of work was done.

Body:
We are using Sidekiq to process a number of backend jobs. One in particular is used very heavily. All I can really say about it is that it sends emails. It doesn't do the email creation (that's a separate job), it just sends them. We spin up a new worker for each email that needs to be sent.

We are trying to upgrade to Ruby 3 and having problems, though. Ruby 2.6.8 has no issues; in 3 (as well as 2.7.3 IIRC), if there is a large number of queued workers, it will get through maybe 20K of them, then it will start hemorrhaging FIFO pipes, on the order of 300-1000 ever 5 seconds or so. Eventually it gets to the ulimit on the system (currently set at 64K) and all sockets/connections fail due to insufficient resources.

In trying to debug this issue I did a run with 90% of what the email worker does entirely commented out, so it does basically nothing except make a couple database queries and do some string templating. I thought I was getting somewhere with that approach, as one run (of 50K+ emails) succeeded without the pipe explosion. However, the next run (identical parameters) did wind up with the runaway pipes.

Profiling with rbspy and ruby-prof did not help much, as they primarily focus on the Sidekiq infrastructure, not the workers themselves.

Looking through our code, I did see that nothing we wrote is ever using IO.* (e.g. IO.popen, IO.select, etc), so I don't see what could be causing the FIFO pipes.

I did see https://github.com/mperham/sidekiq/wiki/Batches#huge-batches, which is not necessarily what we're doing. If you look at the code snippet below, we're basically creating one large batch. I'm not sure whether pushing jobs in bulk as per the link will help with the problem we're having, but I'm about to give it a try once I rework things a bit.

No matter what I do I can't seem to figure out the following:

What is making these pipes? Why are they being created?
What is the condition by which the pipes start getting made exponentially? There are two FIFO pipes that open when we start Sidekiq, but until enough work has been done, we don't see more than 2-6 pipes open generally.
Any advice is appreciated, even along the lines of where to look next, as I'm a bit stumped.

Initializer:

require_relative 'logger'
require_relative 'configuration'
require 'sidekiq-pro'
require "sidekiq-ent"

module Proprietary
  unless const_defined?(:ENVIRONMENT)
    ENVIRONMENT = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
  end
  # Sidekiq.client_middleware.add Sidekiq::Middleware::Client::Batch
  REDIS_URL = if ENV["REDIS_URL"].present?
                ENV["REDIS_URL"]
              else
                "redis://#{ENV["REDIS_SERVER"]}:#{ENV["REDIS_PORT"]}"
              end

  METRICS = Statsd.new "10.0.9.215", 8125

  Sidekiq::Enterprise.unique! unless Proprietary::ENVIRONMENT == "test"
  Sidekiq.configure_server do |config|
    # require 'sidekiq/pro/reliable_fetch'
    config.average_scheduled_poll_interval = 2
    config.redis = {
      namespace: Proprietary.config.SIDEKIQ_NAMESPACE,
      url: Proprietary::REDIS_URL
    }
    config.server_middleware do |chain|
      require 'sidekiq/middleware/server/statsd'
      chain.add Sidekiq::Middleware::Server::Statsd, :client => METRICS
    end
    config.error_handlers << Proc.new do |ex,ctx_hash|
      Proprietary.report_exception(ex, "Sidekiq", ctx_hash)
    end
    config.super_fetch!
    config.reliable_scheduler!
  end

  Sidekiq.configure_client do |config|
    config.redis = {
      namespace: Proprietary.config.SIDEKIQ_NAMESPACE,
      url: Proprietary::REDIS_URL,
      size: 15,
      network_timeout: 5
    }
  end
end

Code snippet (sanitized)

  def add_targets_to_batch
    @target_count  = targets.count
    queue_counter = 0
    batch.jobs do
      targets.shuffle.each do |target|
        send(campaign_target)
        queue_counter += 1
      end
    end
  end

  def send(campaign_target)
    TargetEmailWorker.perform_async(target[:id],
                                            guid,
                                            is_draft ? target[:email_address] : nil)
      begin
        Target.where(id: target[:id]).update(send_at: Time.now.utc)
      rescue Exception => ex

        Proprietary.report_exception(ex, self.class.name, { target_id: target[:id], guid: guid })
      end
    end
  end

First I tried auditing our external connections for connection pooling, etc. That did not help the issue. Eventually I got to the point where I disabled all external connections and let the job run doing virtually nothing outside of a database query and some logging. This allowed one run to complete without issue, but on the second one, the FIFO pipes still grew exponentially after a certain (variable) amount of work was done.


问:
How to pass in environment when starting OpenAPISpec published gem?
in my configuration file for a gem I am publishing through OpenAPI, I have

```<code>[
        {
          url: "https://abc.def.{environment}.ghi.com",
          description: "No description provided",
          variables: {
            environment: {
                description: "No description provided",
                default_value: "staging",
                enum_values: [
                  "production",
                  "uat",
                  "staging"
                ]
              }
            }
        }
      ]
</code>```

How can I pass in a specific environment (the environment will be one of the enum_values when I am configuring the gem upon publishing? The configuration file does not have an environment variable out of the box. I want to be able to do something like
MyGem.configure { |c| c.environment = 'production' }

Body:
in my configuration file for a gem I am publishing through OpenAPI, I have

[
        {
          url: "https://abc.def.{environment}.ghi.com",
          description: "No description provided",
          variables: {
            environment: {
                description: "No description provided",
                default_value: "staging",
                enum_values: [
                  "production",
                  "uat",
                  "staging"
                ]
              }
            }
        }
      ]

How can I pass in a specific environment (the environment will be one of the enum_values when I am configuring the gem upon publishing? The configuration file does not have an environment variable out of the box. I want to be able to do something like
MyGem.configure { |c| c.environment = 'production' }


问:
Python autocompletion for methods created in a loop at class creation
I have a class, which has several methods created at class creation (not at instantiation) and want do have autocompletion for this class.
Here's an example:

class MyClass:
    def __init__(self) -> None:
        print("Hello")

for x in ["a", "b", "c"]:
    for i in range(3):
        name = f"{x}_{i}"

        def wrapper(_name):
            def func(self):
                print(_name)
            return func

        setattr(MyClass, name, wrapper(name))

my_class = MyClass()
my_class.a_1()
my_class.a_2()
```
<p>The code prints correctly, so the method creation itself works.</p>
```Hello
a_1
a_2
```

Is there a way, to get an autocompletion (and maybe even mypy support) for this type of methods? I know, this is not possible for dynamically created properties, but in this case, it's not really dynamic.

Body:
I have a class, which has several methods created at class creation (not at instantiation) and want do have autocompletion for this class.
Here's an example:

class MyClass:
    def __init__(self) -> None:
        print("Hello")

for x in ["a", "b", "c"]:
    for i in range(3):
        name = f"{x}_{i}"

        def wrapper(_name):
            def func(self):
                print(_name)
            return func

        setattr(MyClass, name, wrapper(name))

my_class = MyClass()
my_class.a_1()
my_class.a_2()

The code prints correctly, so the method creation itself works.

Hello
a_1
a_2

Is there a way, to get an autocompletion (and maybe even mypy support) for this type of methods? I know, this is not possible for dynamically created properties, but in this case, it's not really dynamic.


问:
Is it possible to create a custom authorizer for apigateway that will check either a jwt OR an apikey?
I would like to create a custom apigateway authorizer that will check for a specified apikey OR a jwt.

I have set up usage plans for specific apikeys.

I have created a lambda authorizer function that extracts the jwt token or the apikey from the incoming request. I have the jwt verification working, but I am stuck as to how to check the apikeys validity.

Resources / Info

I found that if you can require an apikey for just a specific method, and when this is set to true, apigateway ensures that the apikey passed in is one of the apikeys within your apigateway apikey store.  However, this won't work for my use case because when a jwt is passed in, I would like to authorize based on that

If you specify the apikey identity location it will enforce that the request must have the apikey (this also won't work since sometimes we won't have an apikey)
https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-apigateway.RequestAuthorizer.html#construct-props

Questions

Is it possible to make some sort of call / check within the custom authorizer lambda to see if the apikey is valid?

Is there any other way to check for either an apikey or a jwt token?


问:
Is there a way to wait for a Jframe to close before executing the rest of the code in a method?
I created a method that creates an object, and also I've made a JFrame to capture the data. The problem is that when I run the method it creates the JFrame but it ends the execution while the JFrame is still running, so I have no chance to get the info that I need to create the object successfully.

This is the part of the code of interest.
The JFrame ventanaHora updates its static attribute cal, which is nothing but a Calendar variable.
the problem is that the variable cal doesnt get the value of the static variable cal after being updated.
So the rest of the code from ventana.setVisible(true) is executed without waiting for the jFrame to update the value of cal. I know I'm not being very clear but I hope I have explained myself

```<code>        VentanaHora ventanaHora = new VentanaHora();
        ventanaHora.setVisible(true);
        Calendar cal = VentanaHora.cal;
</code>```

Body:
I created a method that creates an object, and also I've made a JFrame to capture the data. The problem is that when I run the method it creates the JFrame but it ends the execution while the JFrame is still running, so I have no chance to get the info that I need to create the object successfully.

This is the part of the code of interest.
The JFrame ventanaHora updates its static attribute cal, which is nothing but a Calendar variable.
the problem is that the variable cal doesnt get the value of the static variable cal after being updated.
So the rest of the code from ventana.setVisible(true) is executed without waiting for the jFrame to update the value of cal. I know I'm not being very clear but I hope I have explained myself

        VentanaHora ventanaHora = new VentanaHora();
        ventanaHora.setVisible(true);
        Calendar cal = VentanaHora.cal;


问:
Render v-html with v-for in Vuejs
I am using vuejs 2 and I´d like to render a v-html with v-for like below.

I have tried the next but no look. Is it possible?

```<code><template>
    <div v-html="mycontent"></div>
</template>
...
export default {
...
data:()=>({
mycontent: '',
datateste: ['aa', 'bb'],
})

mounted(){
  this.mycontent =
      "<template v-for='item in datateste'><p>{{ item }}</p></template>"
  }
}

</code>```

Title: Render v-html with v-for in Vuejs

Body:
I am using vuejs 2 and I´d like to render a v-html with v-for like below.

I have tried the next but no look. Is it possible?

<template>

</template>
...
export default {
...
data:()=>({
mycontent: '',
datateste: ['aa', 'bb'],
})

mounted(){
  this.mycontent =
      "<template v-for='item in datateste'>
{{ item }}
</template>"
  }
}


问:
Firebase admin Python SDK Access Token Question
Hi I am new to Firebase Admin SDK, How can I get the access token via the SDK to access the REST API? I am using Python.</p>


问:
How to convert a list of .tif image to .jpg using R?
Want to read 80 .tif files in a list and convert them into .jpg format using R</p>
```<code>library("jpeg")
library("tiff")

AET_files <-
  list.files("./disalexi_ETm_OK_2016_2022",
             full.names = T,
             pattern = ".tif")

output <- gsub("tif", "jpg", AET_files)

for (i in seq_along(AET_files)) {
  r <- raster(AET_files[i])
  writeRaster(r, output[i], format = "jpg")
}
</code>```

Body:
Want to read 80 .tif files in a list and convert them into .jpg format using R

library("jpeg")
library("tiff")

AET_files <-
  list.files("./disalexi_ETm_OK_2016_2022",
             full.names = T,
             pattern = ".tif")

output <- gsub("tif", "jpg", AET_files)

for (i in seq_along(AET_files)) {
  r <- raster(AET_files[i])
  writeRaster(r, output[i], format = "jpg")
}


问:
Is it possible to update a piece of data in a pre-existing table using the output of data from a CTE?
I need to correct a datapoint in a pre-existing table. I am using multiple CTEs to find the bad value and the corresponding good value. I am having trouble working out how to overwrite the value in the table using the output of the CTE. Here is what I am trying:

```<code>with [extra CTEs here]....
,CTE3 AS (
SELECT c1.FIELD_1, c1.FIELD_2 AS GOOD, c2.FIELD_3 AS BAD
FROM CTE1 c1
JOIN CTE2 c2 ON c1.FIELD_1 = c2.FIELD_1
)
update TABLE1
set TABLE1.FIELD_3 = CTE3.GOOD
from CTE3
INNER JOIN TABLE1 ON CTE3.BAD = TABLE1.FIELD_3
</code>```

Is it even possible to achieve this?

If so, how should I change my logic to get it to work?

Trying the above logic is throwing the following error:

```<code>SQL Error [42601]: An unexpected token "WITH CTE1 AS (  SELECT
FIELD_1" was found following "BEGIN-OF-STATEMENT".  Expected tokens
may include:  "<update>".. SQLCODE=-104, SQLSTATE=42601,
DRIVER=4.27.25
</code>```

Table designs and expected output:

Body:
I need to correct a datapoint in a pre-existing table. I am using multiple CTEs to find the bad value and the corresponding good value. I am having trouble working out how to overwrite the value in the table using the output of the CTE. Here is what I am trying:

with [extra CTEs here]....
,CTE3 AS (
SELECT c1.FIELD_1, c1.FIELD_2 AS GOOD, c2.FIELD_3 AS BAD
FROM CTE1 c1
JOIN CTE2 c2 ON c1.FIELD_1 = c2.FIELD_1
)
update TABLE1
set TABLE1.FIELD_3 = CTE3.GOOD
from CTE3
INNER JOIN TABLE1 ON CTE3.BAD = TABLE1.FIELD_3

Is it even possible to achieve this?

If so, how should I change my logic to get it to work?

Trying the above logic is throwing the following error:

SQL Error [42601]: An unexpected token "WITH CTE1 AS (  SELECT
FIELD_1" was found following "BEGIN-OF-STATEMENT".  Expected tokens
may include:  "<update>".. SQLCODE=-104, SQLSTATE=42601,
DRIVER=4.27.25

Table designs and expected output:


问:
Filtering out spikes in a signal in pandas
How can I remove the spikes of a signal with pandas? Or is there another quick method in Python?

This vector belongs to a dataframe, so I tried to apply some outlier filters to that dataframe (by means of quantiles: 0.25 & 0.75), but it did not work.

Is there a more straightforward way in pandas to remove such spikes?


问:
Prevent Login on more than one device
I'm developing an app in C#, in this program I want to prevent the user from being able to login on more than one device without first performing authorization on the old device or requesting a change of device via the registered email. I'm using Firebase as my database

So far I've seen something about DeviceID but I didn't get it right and I don't know if that's the way

Title: Prevent Login on more than one device


问:
install mangodb in cmd while creating path its showing error
C:\Program Files\MongoDB\bin>mongod --directoryperdb --dbpath C:\Program Files\MongoDB\data\db --logpath C:\Program Files\MongoDB\log\mongod.log --logappend --rest --install

Error parsing command line: unrecognised option '--rest' try 'mongod --help' for more information

C:\Program Files\MongoDB\bin>mongod --directoryperdb --dbpath C:\Program Files\MongoDB\data\db --logpath C:\Program Files\MongoDB\log\mongod.log --logappend --rest --install

tried to install monogodb in cmd and couldnt