问:
error while implementing multiple wordpress sites via docker compose using nginx as reverse proxy and letsencrypt
Background:
i want to host 2 wordpress domain on server using docker-compose, nginx as reverse proxy and letsencrypt.

Error msg:

```<code>"/var/www/html/.well-known/acme-challenge/UeDp_W5Er5ZjEzn7vV-n69O0L2r6NFhzzs3J9CXtasM" failed (2: No such file or directory), client: 23.178.112.106, server: "
</code>```

currently my docker-compose file looks as follows:

```<code>services:

  db:
    image: mysql:5.7
    container_name: db
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: "db"
      MYSQL_USER: "user"
      MYSQL_PASSWORD: "password"
      MYSQL_RANDOM_ROOT_PASSWORD: "1"
    volumes:
      - ./db:/var/lib/mysql
      - ./schema/blooms_sg/:/docker-entrypoint-initdb.d
    command: '--default-authentication-plugin=mysql_native_password'
    networks:
      - app-network

// this is the first wordpress container whose database will be 'db container above'
  wordpress_abc_sg:
    depends_on:
      - db
    image: wordpress
    container_name: wordpress
    ports:
      - 9000:80
    expose:
      - "9000"
    restart: unless-stopped
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: "user"
      WORDPRESS_DB_PASSWORD: "password"
      WORDPRESS_DB_NAME: "db"
    volumes:
      - ./wordpress_abc_sg:/var/www/html
    networks:
      - app-network

// this is second database for another domain
  db_my:
    image: mysql:5.7
    container_name: db_my
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: "db_my"
      MYSQL_USER: "user"
      MYSQL_PASSWORD: "password"
      MYSQL_RANDOM_ROOT_PASSWORD: "1"
    volumes:
      - ./db_my:/var/lib/mysql
      - ./schema/blooms_my/:/docker-entrypoint-initdb.d
    command: '--default-authentication-plugin=mysql_native_password'
    networks:
      - app-network

//this is second wordpress site and its database is above container "db_my"
  wordpress_abc_my:
    depends_on:
      - db_my
    image: wordpress
    container_name: wordpress_abc_my
    ports:
      - 9001:80
    expose:
      - "9001"
    restart: unless-stopped
    environment:
      WORDPRESS_DB_HOST: db_my
      WORDPRESS_DB_USER: "user"
      WORDPRESS_DB_PASSWORD: "password"
      WORDPRESS_DB_NAME: "db_my"
    volumes:
      - ./wordpress_abc_my:/var/www/html
    networks:
      - app-network

  nginx-proxy:
    depends_on:
      - wordpress_abc_my
      - wordpress_abc_sg
    image: nginx:1.15.12-alpine
    container_name: nginx-proxy
    restart: unless-stopped
    ports:
      - "80:80"
    volumes:
      - ./wordpress_abc_sg:/var/www/html/wordpress_abc_sg
      - ./wordpress_abc_my:/var/www/html/wordpress_abc_my
      - ./nginx-conf:/etc/nginx/conf.d
      - certbot-etc:/etc/letsencrypt
    networks:
      - app-network

  certbot:
    depends_on:
      - nginx-proxy
    image: certbot/certbot
    container_name: certbot
    volumes:
      - certbot-etc:/etc/letsencrypt
      - ./wordpress_abc_sg:/var/www/html/wordpress_abc_sg
      - ./wordpress_abc_my:/var/www/html/wordpress_abc_my
    command: certonly --webroot --webroot-path=/var/www/html --email app.team@abc.sg --agree-tos --no-eff-email --staging -d abc.my -d www.abc.my -d abc.sg -d www.abc.sg

volumes:
  certbot-etc:
  wordpress_abc_my:
  wordpress_abc_sg:
  db:
  db_my:

networks:
  app-network:
    driver: bridge
</code>```

My nginx.conf looks like following:

```<code>server {
        listen 80;
        listen [::]:80;

        server_name blooms.sg www.blooms.sg;

        index index.php index.html index.htm;

        root /var/www/html/wordpress_abc_sg;

        location ~ /.well-known/acme-challenge {
                allow all;
                root /var/www/html/wordpress_abc_sg;
        }

        location / {
                try_files $uri $uri/ /index.php$is_args$args;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass wordpress_abc_sg:9000;
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param PATH_INFO $fastcgi_path_info;
        }

        location ~ /\.ht {
                deny all;
        }

        location = /favicon.ico {
                log_not_found off; access_log off;
        }
        location = /robots.txt {
                log_not_found off; access_log off; allow all;
        }
        location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
                expires max;
                log_not_found off;
        }
}

server {
        listen 80;
        listen [::]:80;

        server_name blooms.my www.blooms.my;

        index index.php index.html index.htm;

        root /var/www/html/wordpress_abc_my;

        location ~ /.well-known/acme-challenge {
                allow all;
                root /var/www/html/wordpress_abc_my;
        }

        location / {
                try_files $uri $uri/ /index.php$is_args$args;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass wordpress_abc_my:9001;
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param PATH_INFO $fastcgi_path_info;
        }

        location ~ /\.ht {
                deny all;
        }

        location = /favicon.ico {
                log_not_found off; access_log off;
        }
        location = /robots.txt {
                log_not_found off; access_log off; allow all;
        }
        location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
                expires max;
                log_not_found off;
        }
}
</code>```

Body:
Background:
i want to host 2 wordpress domain on server using docker-compose, nginx as reverse proxy and letsencrypt.

Error msg:

"/var/www/html/.well-known/acme-challenge/UeDp_W5Er5ZjEzn7vV-n69O0L2r6NFhzzs3J9CXtasM" failed (2: No such file or directory), client: 23.178.112.106, server: "

currently my docker-compose file looks as follows:

services:

  db:
    image: mysql:5.7
    container_name: db
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: "db"
      MYSQL_USER: "user"
      MYSQL_PASSWORD: "password"
      MYSQL_RANDOM_ROOT_PASSWORD: "1"
    volumes:
      - ./db:/var/lib/mysql
      - ./schema/blooms_sg/:/docker-entrypoint-initdb.d
    command: '--default-authentication-plugin=mysql_native_password'
    networks:
      - app-network

// this is the first wordpress container whose database will be 'db container above'
  wordpress_abc_sg:
    depends_on:
      - db
    image: wordpress
    container_name: wordpress
    ports:
      - 9000:80
    expose:
      - "9000"
    restart: unless-stopped
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: "user"
      WORDPRESS_DB_PASSWORD: "password"
      WORDPRESS_DB_NAME: "db"
    volumes:
      - ./wordpress_abc_sg:/var/www/html
    networks:
      - app-network

// this is second database for another domain
  db_my:
    image: mysql:5.7
    container_name: db_my
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: "db_my"
      MYSQL_USER: "user"
      MYSQL_PASSWORD: "password"
      MYSQL_RANDOM_ROOT_PASSWORD: "1"
    volumes:
      - ./db_my:/var/lib/mysql
      - ./schema/blooms_my/:/docker-entrypoint-initdb.d
    command: '--default-authentication-plugin=mysql_native_password'
    networks:
      - app-network

//this is second wordpress site and its database is above container "db_my"
  wordpress_abc_my:
    depends_on:
      - db_my
    image: wordpress
    container_name: wordpress_abc_my
    ports:
      - 9001:80
    expose:
      - "9001"
    restart: unless-stopped
    environment:
      WORDPRESS_DB_HOST: db_my
      WORDPRESS_DB_USER: "user"
      WORDPRESS_DB_PASSWORD: "password"
      WORDPRESS_DB_NAME: "db_my"
    volumes:
      - ./wordpress_abc_my:/var/www/html
    networks:
      - app-network

  nginx-proxy:
    depends_on:
      - wordpress_abc_my
      - wordpress_abc_sg
    image: nginx:1.15.12-alpine
    container_name: nginx-proxy
    restart: unless-stopped
    ports:
      - "80:80"
    volumes:
      - ./wordpress_abc_sg:/var/www/html/wordpress_abc_sg
      - ./wordpress_abc_my:/var/www/html/wordpress_abc_my
      - ./nginx-conf:/etc/nginx/conf.d
      - certbot-etc:/etc/letsencrypt
    networks:
      - app-network

  certbot:
    depends_on:
      - nginx-proxy
    image: certbot/certbot
    container_name: certbot
    volumes:
      - certbot-etc:/etc/letsencrypt
      - ./wordpress_abc_sg:/var/www/html/wordpress_abc_sg
      - ./wordpress_abc_my:/var/www/html/wordpress_abc_my
    command: certonly --webroot --webroot-path=/var/www/html --email app.team@abc.sg --agree-tos --no-eff-email --staging -d abc.my -d www.abc.my -d abc.sg -d www.abc.sg

volumes:
  certbot-etc:
  wordpress_abc_my:
  wordpress_abc_sg:
  db:
  db_my:

networks:
  app-network:
    driver: bridge

My nginx.conf looks like following:

server {
        listen 80;
        listen [::]:80;

        server_name blooms.sg www.blooms.sg;

        index index.php index.html index.htm;

        root /var/www/html/wordpress_abc_sg;

        location ~ /.well-known/acme-challenge {
                allow all;
                root /var/www/html/wordpress_abc_sg;
        }

        location / {
                try_files $uri $uri/ /index.php$is_args$args;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass wordpress_abc_sg:9000;
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param PATH_INFO $fastcgi_path_info;
        }

        location ~ /\.ht {
                deny all;
        }

        location = /favicon.ico {
                log_not_found off; access_log off;
        }
        location = /robots.txt {
                log_not_found off; access_log off; allow all;
        }
        location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
                expires max;
                log_not_found off;
        }
}

server {
        listen 80;
        listen [::]:80;

        server_name blooms.my www.blooms.my;

        index index.php index.html index.htm;

        root /var/www/html/wordpress_abc_my;

        location ~ /.well-known/acme-challenge {
                allow all;
                root /var/www/html/wordpress_abc_my;
        }

        location / {
                try_files $uri $uri/ /index.php$is_args$args;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass wordpress_abc_my:9001;
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param PATH_INFO $fastcgi_path_info;
        }

        location ~ /\.ht {
                deny all;
        }

        location = /favicon.ico {
                log_not_found off; access_log off;
        }
        location = /robots.txt {
                log_not_found off; access_log off; allow all;
        }
        location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
                expires max;
                log_not_found off;
        }
}


来源: stackexchange

问:
Creating python tests for api gateway endpoints
I am looking into ways to automate the testing of api gateway endpoints using python.

We have a custom domain name associated with it.

This is the code I have run:

```<code>import requests
from aws_requests_auth.aws_auth import AWSRequestsAuth
import boto3

api_ep = "<custom domain>.com"

session = boto3.Session()
credentials = session.get_credentials()

auth = AWSRequestsAuth( aws_access_key = credentials.access_key,
                        aws_secret_access_key = credentials.secret_key,
                        aws_host = api_ep,
                        aws_region = "<region>",
                        aws_service = "execute-api")

response = requests.get("https://" + api_ep + "/health", auth=auth)

print(response.content)
</code>```

I am getting multiple [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate.

When using the api gateway domain name it returns the correct response (403).

I was trying to invoke the api gateway using a python script in order to create a set of tests, but I am failing somewhere when it comes to the authentication.

ContentLicense: CC BY-SA 4.0

Body:
I am looking into ways to automate the testing of api gateway endpoints using python.

We have a custom domain name associated with it.

This is the code I have run:

import requests
from aws_requests_auth.aws_auth import AWSRequestsAuth
import boto3

api_ep = "<custom domain>.com"

session = boto3.Session()
credentials = session.get_credentials()

auth = AWSRequestsAuth( aws_access_key = credentials.access_key,
                        aws_secret_access_key = credentials.secret_key,
                        aws_host = api_ep,
                        aws_region = "<region>",
                        aws_service = "execute-api")

response = requests.get("https://" + api_ep + "/health", auth=auth)

print(response.content)

I am getting multiple [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate.

When using the api gateway domain name it returns the correct response (403).

I was trying to invoke the api gateway using a python script in order to create a set of tests, but I am failing somewhere when it comes to the authentication.


问:
How to mongo db function I can use in .Net Core 6.0?
I have created a javascript function in mongodb which increment the sequence value of a single row collection.

How I can call it in .NET Core code?

Thanks in advance

I have tried to call it but shows runtime error

```<code>var cmd = new JsonCommand<BsonDocument>("{ eval: \"increment_value('guid')\" }");
var result = mongoDatabase.RunCommand(cmd);
var intResult = result["retval"].ToInt32();
</code>```

Body:
I have created a javascript function in mongodb which increment the sequence value of a single row collection.

How I can call it in .NET Core code?

Thanks in advance

I have tried to call it but shows runtime error

var cmd = new JsonCommand<BsonDocument>("{ eval: \"increment_value('guid')\" }");
var result = mongoDatabase.RunCommand(cmd);
var intResult = result["retval"].ToInt32();


问:
MP3 file become silent when time changed in Firefox with audio API
I have some problem but I need to give you some context :

I have a production environment with large audio mp3 files. Everything is working perfectly but files are too heavy. I used ffmpeg to reduce their Bitrates from 320kbit/s to 190kbit/s to free space in my disk.

My script worked well and I saved almost 50% of space, but before to put it in production I wanted to test it on pre-production and there is some problem with Firefox...

When I play the audio everything is working good, if I listen to it normally everything is working BUT, when I click on the range to change the time and navigate into the audio, it becomes silent. Nothing happens, I can stop, start again, change the time, nothing works, but the audio is still playing...

I don't have any errors in my console, nothing so the only solution is to reload the page and play again the audio without changing the time.

I tried in chrome and it works like a charm, but in Firefox no. I also tried without any extensions and still the same...

Do you have any idea what is happening?

Thanks a lot!

--- EDIT 14/12/2022 ---

Ok, I have tried a lot of different solutions and I finally found one, it seems firefox doesn't support VBR (variable bitrate) so I've compressed my file in CBR and it seems to finally work ...


问:
Segmentation Fault in EVP_DigestFinal_ex -> SHA256_Final due to NULL algctx
using Linux (ubuntu 20.04) machine, openssl 3.0.7 is installed , running a sample code for signing.

we followed below procedure for signing. getting segmentation fault in EVP_DigestFinal_ex.
segmentation fault is happening due to mdctx->algctx=0x0. while debugging the code mdctx->algctx is updated in EVP_DigestInit_ex but latter it was freed in EVP_DigestSignInit. not sure what we are missing and how to update mdctx->algctx to avoid the crash.

```<code>#include <stdio.h>
#include <string.h>
#include <openssl/evp.h>
#include <openssl/provider.h>

EVP_PKEY *pkey = NULL;

generate_key(){
      EVP_PKEY_CTX *ctx=NULL;
      pkey=EVP_PKEY_new();
      ctx=EVP_PKEY_CTX_new(pkey,NULL);

      ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL);
      if (!ctx)
          printf(" key gen failed");

     if (EVP_PKEY_keygen_init(ctx) <= 0)
          printf(" key gen failed");

     if (EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, 512) <= 0)
          printf(" key gen failed");

     /* Generate key */
      if (EVP_PKEY_keygen(ctx, &pkey) <= 0)
          printf(" key gen failed");
}

 int main(int argc, char *argv[])
 {
     EVP_MD_CTX *mdctx;
     const EVP_MD *m_md;
     const EVP_MD *md;
     EVP_PKEY     *m_key;
     EVP_PKEY *ed_pkey = NULL;
     EVP_PKEY_CTX *ed_pctx = NULL;
//   OSSL_PROVIDER *default;

     size_t sign_len = 0;

     u_int8_t  m_sign_buf[2048];
     int ret = 0;

     char mess1[] = "Test Message\n";
     char mess2[] = "Hello World\n";

     unsigned char *outdigest = NULL;
     unsigned int md_len = 0, i;

    printf("args : %s\n",argv[1]);
    //default = OSSL_PROVIDE_load(NULL, "default");
    //md = EVP_get_digestbyname("SHA256");
    //md = EVP_sha256();

    md = EVP_MD_fetch(NULL, "SHA256", NULL); //;

    if (md == NULL) {
        printf("Unknown message digest %s\n", argv[1]);
         exit(1);
    }

   generate_key();

    printf("value of md %s\n",md);
    mdctx = EVP_MD_CTX_new();

    if((EVP_DigestInit_ex(mdctx, md, NULL)) != 1)
        printf("EVP_DigestInit_ex failed \n");

    if((EVP_DigestSignInit(mdctx, NULL, md, NULL, pkey)) != 1)
        printf("EVP_DigestSignInit failed \n");

    if((EVP_DigestSignUpdate(mdctx, mess1, strlen(mess1))) != 1)
        printf("EVP_DigestSignUpdate failed \n");

    //EVP_DigestUpdate(mdctx, mess2, strlen(mess2));
    if((EVP_DigestSignFinal(mdctx, (u_int8_t*)NULL, &sign_len)) != 1)
        printf("EVP_DigestSignFinal failed \n");

    if((EVP_DigestSignFinal(mdctx, m_sign_buf, &sign_len)) != 1)
        printf("EVP_DigestSignFinal 2 failed \n");

    /* Allocate the output buffer */
    outdigest = OPENSSL_malloc(EVP_MD_get_size(md));
    if (outdigest == NULL)
        printf("outdigest  failed \n");

    if((EVP_DigestFinal_ex(mdctx, outdigest, &md_len)) != 1)
        printf("EVP_DigestFinal_ex failed \n");

     EVP_MD_CTX_free(mdctx);

     /* Print out the digest result */
    BIO_dump_fp(stdout, outdigest, &md_len);

     exit(0);
 }
`

```

Thanks,

while debugging the code mdctx->algctx is updated in EVP_DigestInit_ex but latter it was freed in EVP_DigestSignInit. not sure what we are missing and how to update mdctx->algctx to avoid the crash.

CRASH Info:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7d99422 in SHA256_Final (md=0x5555555a88d0 "\250UUU\005", c=0x0)
    at ../openssl-3.0.7/include/crypto/md32_common.h:194
194         size_t n = c->num;
(gdb) bt
#0  0x00007ffff7d99422 in SHA256_Final (md=0x5555555a88d0 "\250UUU\005", c=0x0)
    at ../openssl-3.0.7/include/crypto/md32_common.h:194
#1  0x00007ffff7e2628c in sha256_internal_final (ctx=0x0, out=0x5555555a88d0 "\250UUU\005", outl=0x7fffffffda98,
    outsz=32) at ../openssl-3.0.7/providers/implementations/digests/sha2_prov.c:72
#2  0x00007ffff7cbadf6 in EVP_DigestFinal_ex (ctx=0x555555580d80, md=0x5555555a88d0 "\250UUU\005",
    isize=0x7fffffffdad8) at ../openssl-3.0.7/crypto/evp/digest.c:446
#3  0x000055555555575f in main (argc=1, argv=0x7fffffffe458) at test2.c:90

```

Body:
using Linux (ubuntu 20.04) machine, openssl 3.0.7 is installed , running a sample code for signing.

we followed below procedure for signing. getting segmentation fault in EVP_DigestFinal_ex.
segmentation fault is happening due to mdctx->algctx=0x0. while debugging the code mdctx->algctx is updated in EVP_DigestInit_ex but latter it was freed in EVP_DigestSignInit. not sure what we are missing and how to update mdctx->algctx to avoid the crash.

#include <stdio.h>
#include <string.h>
#include <openssl/evp.h>
#include <openssl/provider.h>

EVP_PKEY *pkey = NULL;

generate_key(){
      EVP_PKEY_CTX *ctx=NULL;
      pkey=EVP_PKEY_new();
      ctx=EVP_PKEY_CTX_new(pkey,NULL);

      ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL);
      if (!ctx)
          printf(" key gen failed");

     if (EVP_PKEY_keygen_init(ctx) <= 0)
          printf(" key gen failed");

     if (EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, 512) <= 0)
          printf(" key gen failed");

     /* Generate key */
      if (EVP_PKEY_keygen(ctx, &pkey) <= 0)
          printf(" key gen failed");
}

 int main(int argc, char *argv[])
 {
     EVP_MD_CTX *mdctx;
     const EVP_MD *m_md;
     const EVP_MD *md;
     EVP_PKEY     *m_key;
     EVP_PKEY *ed_pkey = NULL;
     EVP_PKEY_CTX *ed_pctx = NULL;
//   OSSL_PROVIDER *default;

     size_t sign_len = 0;

     u_int8_t  m_sign_buf[2048];
     int ret = 0;

     char mess1[] = "Test Message\n";
     char mess2[] = "Hello World\n";

     unsigned char *outdigest = NULL;
     unsigned int md_len = 0, i;

    printf("args : %s\n",argv[1]);
    //default = OSSL_PROVIDE_load(NULL, "default");
    //md = EVP_get_digestbyname("SHA256");
    //md = EVP_sha256();

    md = EVP_MD_fetch(NULL, "SHA256", NULL); //;

    if (md == NULL) {
        printf("Unknown message digest %s\n", argv[1]);
         exit(1);
    }

   generate_key();

    printf("value of md %s\n",md);
    mdctx = EVP_MD_CTX_new();

    if((EVP_DigestInit_ex(mdctx, md, NULL)) != 1)
        printf("EVP_DigestInit_ex failed \n");

    if((EVP_DigestSignInit(mdctx, NULL, md, NULL, pkey)) != 1)
        printf("EVP_DigestSignInit failed \n");

    if((EVP_DigestSignUpdate(mdctx, mess1, strlen(mess1))) != 1)
        printf("EVP_DigestSignUpdate failed \n");

    //EVP_DigestUpdate(mdctx, mess2, strlen(mess2));
    if((EVP_DigestSignFinal(mdctx, (u_int8_t*)NULL, &sign_len)) != 1)
        printf("EVP_DigestSignFinal failed \n");

    if((EVP_DigestSignFinal(mdctx, m_sign_buf, &sign_len)) != 1)
        printf("EVP_DigestSignFinal 2 failed \n");

    /* Allocate the output buffer */
    outdigest = OPENSSL_malloc(EVP_MD_get_size(md));
    if (outdigest == NULL)
        printf("outdigest  failed \n");

    if((EVP_DigestFinal_ex(mdctx, outdigest, &md_len)) != 1)
        printf("EVP_DigestFinal_ex failed \n");

     EVP_MD_CTX_free(mdctx);

     /* Print out the digest result */
    BIO_dump_fp(stdout, outdigest, &md_len);

     exit(0);
 }
`

```

Thanks,

while debugging the code mdctx->algctx is updated in EVP_DigestInit_ex but latter it was freed in EVP_DigestSignInit. not sure what we are missing and how to update mdctx->algctx to avoid the crash.

CRASH Info:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7d99422 in SHA256_Final (md=0x5555555a88d0 "\250UUU\005", c=0x0)
    at ../openssl-3.0.7/include/crypto/md32_common.h:194
194         size_t n = c->num;
(gdb) bt
#0  0x00007ffff7d99422 in SHA256_Final (md=0x5555555a88d0 "\250UUU\005", c=0x0)
    at ../openssl-3.0.7/include/crypto/md32_common.h:194
#1  0x00007ffff7e2628c in sha256_internal_final (ctx=0x0, out=0x5555555a88d0 "\250UUU\005", outl=0x7fffffffda98,
    outsz=32) at ../openssl-3.0.7/providers/implementations/digests/sha2_prov.c:72
#2  0x00007ffff7cbadf6 in EVP_DigestFinal_ex (ctx=0x555555580d80, md=0x5555555a88d0 "\250UUU\005",
    isize=0x7fffffffdad8) at ../openssl-3.0.7/crypto/evp/digest.c:446
#3  0x000055555555575f in main (argc=1, argv=0x7fffffffe458) at test2.c:90


问:
Going crazy cause I can't set up a DKIM
Hope to find a solution here.

I use lemlist to send automated e-mail, and it requires me to set up a DKIM, DMARC and SPF. My e-mail provider is 1and1.com (Ionos).

I did set up a DMARC and SPF record, but still can't make a DKIM, although I followed every guideline I could find on internet.

To sum it up : I created a public key and added a TXT record with the public key in it. DMARCLY can easily find the key and everything, but every time I refresh the DNS on lemlist, lemlist doesn't detect the DKIM, or should I say, there is no DKIM signature in my mails.

On some resources, I see a CNAME records, and it's not said to do so on the lemlist guideline.

Can anyone help me with that please ?

I tried possibly everything: TXT records, CNAME records, but none seems to work.

Title: Going crazy cause I can't set up a DKIM


问:
bug(material): Can't find stylesheet to import(@use '@angular/cdk';)
Getting below material error after migrating angular from v13 to v14.The project also consist of storybook v6.5.12.The project also consist of Angular library.

The error occurs while running the build library command for our project.

```<code>[10:37:14] erro: There is an error in your styles:
[10:37:14] erro: Can't find stylesheet to import.
[10:37:14] erro: ╷
[10:37:14] erro: 1 │ @use '@angular/cdk';
[10:37:14] erro: │ ^^^^^^^^^^^^^^^^^^^
[10:37:14] erro: ╵
[10:37:14] erro: node_modules@angular\material\core\style_menu-common.scss 1:1 @forward
[10:37:14] erro: node_modules@angular\material_index.scss 33:1 @use
[10:37:14] erro: stdin 7:1 root stylesheet on line (1, 1)
</code>```

Package.json

```<code>"dependencies": {
"@angular/animations": "^14.2.12",
"@angular/cdk": "^14.2.7",
"@angular/common": "^14.2.12",
"@angular/compiler": "14.2.12",
"@angular/core": "^14.2.12",
"@angular/flex-layout": "^9.0.0-beta.31",
"@angular/forms": "14.2.12",
"@angular/localize": "^14.2.12",
"@angular/material": "^14.2.7",
"@angular/platform-browser": "14.2.12",
"@angular/platform-browser-dynamic": "^14.2.12",
"@angular/router": "^14.2.12",
"core-js": "^3.6.5",
"ngx-mask": "^10.0.1",
"rxjs": "^6.6.2",
"scss-bundle": "^3.1.2",
"ts-jest": "^29.0.3",
"tslib": "^2.0.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/architect": "^0.1402.10",
"@angular-devkit/build-angular": "^14.2.10",
"@angular-devkit/core": "^14.2.10",
"@angular-eslint/eslint-plugin": "0.0.1-alpha.32",
"@angular/cli": "^14.2.10",
"@angular/compiler-cli": "14.2.12",
"@angular/language-service": "^14.2.12",
"@babel/core": "^7.11.1",
"@storybook/addon-a11y": "^6.5.12",
"@storybook/addon-actions": "^6.5.12",
"@storybook/addon-backgrounds": "^6.5.12",
"@storybook/addon-centered": "^5.3.21",
"@storybook/addon-cssresources": "^6.2.9",
"@storybook/addon-docs": "^6.5.12",
"@storybook/addon-jest": "^6.5.12",
"@storybook/addon-knobs": "^6.0.10",
"@storybook/addon-links": "^6.5.12",
"@storybook/addon-notes": "^5.3.21",
"@storybook/addon-storysource": "^6.5.12",
"@storybook/addon-viewport": "^6.5.12",
"@storybook/addons": "^6.5.12",
"@storybook/angular": "^6.5.12",
"@storybook/builder-webpack5": "^6.5.12",
"@storybook/manager-webpack5": "^6.5.12",
"@storybook/theming": "^6.5.12",
"@testing-library/angular": "^9.2.2",
"@testing-library/jest-dom": "^5.11.3",
"@types/jest": "^29.2.3",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "^3.9.1",
"@typescript-eslint/eslint-plugin-tslint": "^3.9.1",
"@typescript-eslint/parser": "^3.9.1",
"babel-loader": "^8.1.0",
"codelyzer": "^6.0.0",
"copyfiles": "^2.3.0",
"eslint": "^7.7.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsdoc": "^28.7.0",
"eslint-plugin-prefer-arrow": "^1.2.2",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"jest-preset-angular": "^12.2.3",
"jest-sonar": "^0.2.10",
"ng-packagr": "^14.2.2",
"protractor": "~7.0.0",
"storybook-addon-themes": "^6.1.0",
"storybook-dark-mode": "^1.1.2",
"ts-node": "^8.9.0",
"tslint": "~6.1.0",
"typescript": "4.6.4"
}
</code>```

I tried upgrading the cdk and material to v14.0.0 but it didn't work.

Body:
Getting below material error after migrating angular from v13 to v14.The project also consist of storybook v6.5.12.The project also consist of Angular library.

The error occurs while running the build library command for our project.

[10:37:14] erro: There is an error in your styles:
[10:37:14] erro: Can't find stylesheet to import.
[10:37:14] erro: ╷
[10:37:14] erro: 1 │ @use '@angular/cdk';
[10:37:14] erro: │ ^^^^^^^^^^^^^^^^^^^
[10:37:14] erro: ╵
[10:37:14] erro: node_modules@angular\material\core\style_menu-common.scss 1:1 @forward
[10:37:14] erro: node_modules@angular\material_index.scss 33:1 @use
[10:37:14] erro: stdin 7:1 root stylesheet on line (1, 1)

Package.json

"dependencies": {
"@angular/animations": "^14.2.12",
"@angular/cdk": "^14.2.7",
"@angular/common": "^14.2.12",
"@angular/compiler": "14.2.12",
"@angular/core": "^14.2.12",
"@angular/flex-layout": "^9.0.0-beta.31",
"@angular/forms": "14.2.12",
"@angular/localize": "^14.2.12",
"@angular/material": "^14.2.7",
"@angular/platform-browser": "14.2.12",
"@angular/platform-browser-dynamic": "^14.2.12",
"@angular/router": "^14.2.12",
"core-js": "^3.6.5",
"ngx-mask": "^10.0.1",
"rxjs": "^6.6.2",
"scss-bundle": "^3.1.2",
"ts-jest": "^29.0.3",
"tslib": "^2.0.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/architect": "^0.1402.10",
"@angular-devkit/build-angular": "^14.2.10",
"@angular-devkit/core": "^14.2.10",
"@angular-eslint/eslint-plugin": "0.0.1-alpha.32",
"@angular/cli": "^14.2.10",
"@angular/compiler-cli": "14.2.12",
"@angular/language-service": "^14.2.12",
"@babel/core": "^7.11.1",
"@storybook/addon-a11y": "^6.5.12",
"@storybook/addon-actions": "^6.5.12",
"@storybook/addon-backgrounds": "^6.5.12",
"@storybook/addon-centered": "^5.3.21",
"@storybook/addon-cssresources": "^6.2.9",
"@storybook/addon-docs": "^6.5.12",
"@storybook/addon-jest": "^6.5.12",
"@storybook/addon-knobs": "^6.0.10",
"@storybook/addon-links": "^6.5.12",
"@storybook/addon-notes": "^5.3.21",
"@storybook/addon-storysource": "^6.5.12",
"@storybook/addon-viewport": "^6.5.12",
"@storybook/addons": "^6.5.12",
"@storybook/angular": "^6.5.12",
"@storybook/builder-webpack5": "^6.5.12",
"@storybook/manager-webpack5": "^6.5.12",
"@storybook/theming": "^6.5.12",
"@testing-library/angular": "^9.2.2",
"@testing-library/jest-dom": "^5.11.3",
"@types/jest": "^29.2.3",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "^3.9.1",
"@typescript-eslint/eslint-plugin-tslint": "^3.9.1",
"@typescript-eslint/parser": "^3.9.1",
"babel-loader": "^8.1.0",
"codelyzer": "^6.0.0",
"copyfiles": "^2.3.0",
"eslint": "^7.7.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsdoc": "^28.7.0",
"eslint-plugin-prefer-arrow": "^1.2.2",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"jest-preset-angular": "^12.2.3",
"jest-sonar": "^0.2.10",
"ng-packagr": "^14.2.2",
"protractor": "~7.0.0",
"storybook-addon-themes": "^6.1.0",
"storybook-dark-mode": "^1.1.2",
"ts-node": "^8.9.0",
"tslint": "~6.1.0",
"typescript": "4.6.4"
}

I tried upgrading the cdk and material to v14.0.0 but it didn't work.


问:
Page not refreshing/updating on EC2 via Selenium
I am currently running a sports betting model on my Amazon EC2 Instance. The code (using the selenium library) refreshes the sports betting page every 2 minutes.

When I have the Instance open the code works completely fine, but when I close the instance and let the code run I cannot interact with the webpage https://duelbits.com/sportsbook/live/soccer.

I am specifically having trouble with this code (it just simply gets the list of matches available to bet on the website live soccer page):

```<code>WebDriverWait(driver, 3).until(EC.element_to_be_clickable(
    (By.XPATH,'(//div[contains(@class,"styled__Event")])')))
</code>```

It seems the website realises that it is not a real user using the website, is there anyway I can bypass this?

Body:
I am currently running a sports betting model on my Amazon EC2 Instance. The code (using the selenium library) refreshes the sports betting page every 2 minutes.

When I have the Instance open the code works completely fine, but when I close the instance and let the code run I cannot interact with the webpage https://duelbits.com/sportsbook/live/soccer.

I am specifically having trouble with this code (it just simply gets the list of matches available to bet on the website live soccer page):

WebDriverWait(driver, 3).until(EC.element_to_be_clickable(
    (By.XPATH,'(//div[contains(@class,"styled__Event")])')))

It seems the website realises that it is not a real user using the website, is there anyway I can bypass this?


问:
Chart JS Cannot read properties of undefined (reading 'skip')
every time I move my mouse over a view-chart.js data streaming curve I get this error:

Uncaught TypeError TypeError: Cannot read properties of undefined (reading 'skip')

It is located in this function in the chart.js module:

```<code> * Helper function to traverse all of the visible elements in the chart
 * @param {Chart} chart - the chart
 * @param {function} handler - the callback to execute for each visible item
 */
function parseVisibleItems(chart, handler) {
    var metasets = chart._getSortedVisibleDatasetMetas();
    var metadata, i, j, ilen, jlen, element;

    for (i = 0, ilen = metasets.length; i < ilen; ++i) {
        metadata = metasets[i].data;
        for (j = 0, jlen = metadata.length; j < jlen; ++j) {
            element = metadata[j];
            if (!element._view.skip) {
                handler(element);
            }
        }
    }
}
</code>```

I'm using

```<code>"chartjs-plugin-streaming": "^1.9.0"
"chart.js": "2.9.4",
"vue-chartjs": "3.5.1",
</code>```

Body:
every time I move my mouse over a view-chart.js data streaming curve I get this error:

Uncaught TypeError TypeError: Cannot read properties of undefined (reading 'skip')

It is located in this function in the chart.js module:

 * Helper function to traverse all of the visible elements in the chart
 * @param {Chart} chart - the chart
 * @param {function} handler - the callback to execute for each visible item
 */
function parseVisibleItems(chart, handler) {
    var metasets = chart._getSortedVisibleDatasetMetas();
    var metadata, i, j, ilen, jlen, element;

    for (i = 0, ilen = metasets.length; i < ilen; ++i) {
        metadata = metasets[i].data;
        for (j = 0, jlen = metadata.length; j < jlen; ++j) {
            element = metadata[j];
            if (!element._view.skip) {
                handler(element);
            }
        }
    }
}

I'm using

"chartjs-plugin-streaming": "^1.9.0"
"chart.js": "2.9.4",
"vue-chartjs": "3.5.1",


问:
How do you efficiently match a list of ranges to another list of ranges?
I am working on a mailbox routing problem.

I want to route messages to queues according to multiple hierarchical ranges. Each one of the following groups of 3 lines represents one mailbox which is a thread handling data transfer for a particular user, on a particular socket and on a particular thread. The problem I have is efficiently deciding which ringbuffer to send data to.

```<code>server1.container1.process1.sendthread1
socket1
user1

server1.container1.process1.recvthread1
socket1
user1

server1.container1.process1.sendthread2
socket1
user2

server1.container1.process1.recvthread2
socket1
user2

server1.container1.process1.sendthread2
socket1
user3
</code>```

Given a message that looks like this:

```<code>server1.container1.process1.sendthread2
socket1
user3
</code>```

How do I efficiently search the list of mailboxes to find the right one? I want to do a search for multiple lists, I could sort and hash the list and do a hash lookup, but that requires the data be in memory.

I could store every mailbox in memory as a list and do a search but I feel this wouldn't be efficient.

You may notice that my mailboxes follow a pattern. There is ranges of items associated with the same mailbox.

I envision myself setting up ranges for certain things whereas others such as threads and sockets and mappings are maintained dynamically at runtime.

```<code>users 1-5000 server1
users 5001-10000 server2
socket1 thread1
socket2 thread1
socket3 thread1
socket4 thread1
</code>```

Body:
I am working on a mailbox routing problem.

I want to route messages to queues according to multiple hierarchical ranges. Each one of the following groups of 3 lines represents one mailbox which is a thread handling data transfer for a particular user, on a particular socket and on a particular thread. The problem I have is efficiently deciding which ringbuffer to send data to.

server1.container1.process1.sendthread1
socket1
user1

server1.container1.process1.recvthread1
socket1
user1

server1.container1.process1.sendthread2
socket1
user2

server1.container1.process1.recvthread2
socket1
user2

server1.container1.process1.sendthread2
socket1
user3

Given a message that looks like this:

server1.container1.process1.sendthread2
socket1
user3

How do I efficiently search the list of mailboxes to find the right one? I want to do a search for multiple lists, I could sort and hash the list and do a hash lookup, but that requires the data be in memory.

I could store every mailbox in memory as a list and do a search but I feel this wouldn't be efficient.

You may notice that my mailboxes follow a pattern. There is ranges of items associated with the same mailbox.

I envision myself setting up ranges for certain things whereas others such as threads and sockets and mappings are maintained dynamically at runtime.

users 1-5000 server1
users 5001-10000 server2
socket1 thread1
socket2 thread1
socket3 thread1
socket4 thread1


问:
BigQuery Loading a table from uri
I have a .csv file in a bucket, I want to load this file into a BQ table where the CSV headers match the table's columns.

I'm using the google-cloud-bigquery client library and the load_table_from_uri with a LoadJobConfig. This used to work fine, however supposedly randomly I am getting an error that the csv values are floats, the BQ table columns are integers.

However, upon checking the csv columns they are all integers. This is the code being used to load a CSV file now based on a trigger.

```<code># dataset, table and bucket_name are defined before this code is being executed and work as intended.
job_config = bigquery.LoadJobConfig()
job_config.autodetect = True
job_config.schema_update_options = [
    bigquery.SchemaUpdateOption.ALLOW_FIELD_ADDITION
]
job_config.write_disposition = bigquery.WriteDisposition.WRITE_APPEND

try:
    storage_client = storage.Client()
    bigquery_client = bigquery.Client()
    dataset_ref = bigquery_client.dataset(dataset)

except Exception as e:
    print(f"Something went wrong configuring the Google clients")
    raise e

def main(event, ctx):
    file_name = event["name"]
    file_uri = f"gs://{bucket_name}/{file_name}"
    if file_name.lower().endswith(".csv"):
        job_config.source_format = bigquery.SourceFormat.CSV
    else:
        print("Input file is not a CSV file!")
        return

    job = bigquery_client.load_table_from_uri(file_uri, dataset_ref.table(table), job_config=job_config)

    try:
        job.result()
        print(f"CSV file {file_name} loaded into {dataset}.{table} successfully!")

    except Exception as e:
        print(f"Something went wrong loading the CSV file: {e}")
        raise e
</code>```

This results in

Field AMOUNT has changed type from INTEGER to FLOAT

I've checked the CSV file and the AMOUNT column has no rows/values which could be considered integers. They are all natural numbers.

Tried setting job_config.schema to the table's schema, resulted in:

400 error while reading data, error message: CSV table encountered too many erorrs. giving up. Rows: 0, errors: 2001. Please look into the errors[] collection for more details

I'm not quite sure where to look for the errors list/collection.

Here is a sample of the CSV file I'm trying to load into BQ:

```<code>APPLICATIONSTATE,APPLY_DATETIME,STATE_DATETIME,REQUESTEDAMOUNT,CONTRACTAMOUNT
INCOMPLETE,20220712 20:32:19.573,20221207 09:04:59.593,,
CANCELLED,20221012 08:41:12.669,20221208 09:24:21.596,23000,
CANCELLED,20221014 16:58:41.857,20221210 14:00:05.457,37000,,
</code>```

[Some columns are redacted, the original CSV file's headers matches the table's schema.]

Title: BigQuery Loading a table from uri

Body:
I have a .csv file in a bucket, I want to load this file into a BQ table where the CSV headers match the table's columns.

I'm using the google-cloud-bigquery client library and the load_table_from_uri with a LoadJobConfig. This used to work fine, however supposedly randomly I am getting an error that the csv values are floats, the BQ table columns are integers.

However, upon checking the csv columns they are all integers. This is the code being used to load a CSV file now based on a trigger.

# dataset, table and bucket_name are defined before this code is being executed and work as intended.
job_config = bigquery.LoadJobConfig()
job_config.autodetect = True
job_config.schema_update_options = [
    bigquery.SchemaUpdateOption.ALLOW_FIELD_ADDITION
]
job_config.write_disposition = bigquery.WriteDisposition.WRITE_APPEND

try:
    storage_client = storage.Client()
    bigquery_client = bigquery.Client()
    dataset_ref = bigquery_client.dataset(dataset)

except Exception as e:
    print(f"Something went wrong configuring the Google clients")
    raise e

def main(event, ctx):
    file_name = event["name"]
    file_uri = f"gs://{bucket_name}/{file_name}"
    if file_name.lower().endswith(".csv"):
        job_config.source_format = bigquery.SourceFormat.CSV
    else:
        print("Input file is not a CSV file!")
        return

    job = bigquery_client.load_table_from_uri(file_uri, dataset_ref.table(table), job_config=job_config)

    try:
        job.result()
        print(f"CSV file {file_name} loaded into {dataset}.{table} successfully!")

    except Exception as e:
        print(f"Something went wrong loading the CSV file: {e}")
        raise e

This results in

Field AMOUNT has changed type from INTEGER to FLOAT

I've checked the CSV file and the AMOUNT column has no rows/values which could be considered integers. They are all natural numbers.

Tried setting job_config.schema to the table's schema, resulted in:

400 error while reading data, error message: CSV table encountered too many erorrs. giving up. Rows: 0, errors: 2001. Please look into the errors[] collection for more details

I'm not quite sure where to look for the errors list/collection.

Here is a sample of the CSV file I'm trying to load into BQ:

APPLICATIONSTATE,APPLY_DATETIME,STATE_DATETIME,REQUESTEDAMOUNT,CONTRACTAMOUNT
INCOMPLETE,20220712 20:32:19.573,20221207 09:04:59.593,,
CANCELLED,20221012 08:41:12.669,20221208 09:24:21.596,23000,
CANCELLED,20221014 16:58:41.857,20221210 14:00:05.457,37000,,

[Some columns are redacted, the original CSV file's headers matches the table's schema.]


问:
Calculate vertical position of annotated text based on text size in a Seaborn Box-Plot
In that Box-Plot you see two annotations located relative to the median line of each box. The text in the blue box is located directly in the middle of the median line. The text in the organg box is located top of that line.

The point here is that I moved the text in the orange box explicite via an y_offset=3.

The problem here is that the unit of this offset depends on the values in the y axis. It is not points, pixel or something like this. If the range of the values in the based dataframe are changed that offset has to change.

I would like to make this more flexible. I want to move the text half of its height up.

This is the figure generating code.

```<code>#!/usr/bin/env python3
import seaborn as sns

df = sns.load_dataset('Titanic')

plot = sns.catplot(kind='box', data=df, y='fare', x='sex', showfliers=False)

ax = plot.axes[0][0]

# first box
line = ax.get_lines()[4]
x, y = (data.mean() for data in line.get_data())
ax.text(s=y, x=x, y=y, ha='center', va='center', color='white')

# second box
y_offset = 3
line = ax.get_lines()[9]
x, y = (data.mean() for data in line.get_data())
ax.text(s=y, x=x, y=y+y_offset, ha='center', va='center', color='white')

plot.figure.show()
</code>```

Body:
In that Box-Plot you see two annotations located relative to the median line of each box. The text in the blue box is located directly in the middle of the median line. The text in the organg box is located top of that line.

The point here is that I moved the text in the orange box explicite via an y_offset=3.

The problem here is that the unit of this offset depends on the values in the y axis. It is not points, pixel or something like this. If the range of the values in the based dataframe are changed that offset has to change.

I would like to make this more flexible. I want to move the text half of its height up.

This is the figure generating code.

#!/usr/bin/env python3
import seaborn as sns

df = sns.load_dataset('Titanic')

plot = sns.catplot(kind='box', data=df, y='fare', x='sex', showfliers=False)

ax = plot.axes[0][0]

# first box
line = ax.get_lines()[4]
x, y = (data.mean() for data in line.get_data())
ax.text(s=y, x=x, y=y, ha='center', va='center', color='white')

# second box
y_offset = 3
line = ax.get_lines()[9]
x, y = (data.mean() for data in line.get_data())
ax.text(s=y, x=x, y=y+y_offset, ha='center', va='center', color='white')

plot.figure.show()


问:
Soft Floating Point Calculation Errors of Mono Runtime for MIPS
As we have been facing some issues with Mono project pertaining to the MIPS architecture, I wanted to ask a question.

We have Mediatek MT7628AN  mipsel-24kec processor(32 bit), and the example program written in C#  is to check the preciseness of floating-point calculations on target(MIPS)(no HFPU). The generated output by mcs is working fine on the host(x86), meaning that the floating point calculations are precise enough(2 pow 0=1...).

However, for the case of MIPS, the output is rather strange(2 pow 0=0 ...). After tracing the program execution in MIPS, the problem is two-sided. The first is math.pow(a,b) is always returning the power(b) instead of a^b. The second issue is about Console.WriteLine for double. This method cannot even print a double or float value properly. Instead, it is printing some random different numbers.

According to the tracing the program execution on the target(MIPS32 el),    System.OutOfMemoryException. Even after changing the cross toolchain option for MIPS(enable-decimal-float), the first issue has not been addressed.

Has someone tackled either issue or known smth related to it, that would be nice to share.


问:
Can't protoc with relative paths from a script
Been wrestling with this for a while. I have a protoc command that runs fine in terminal, but fails in a script. The issue seems to be with the recursive protos.

The folder structure is:

```<code>ledger-models % ls
Cargo.lock      README.md       gen.rs          ledger-models-protos    target
Cargo.toml      compile.sh      ledger-models-java  ledger-models-rust
</code>```

in ledger-models-protos there are several folders with protos:

```<code>ledger-models-protos % ls
models              requests            services
</code>```

In the root directory I can sucessfully run the protoc command interactively:

```<code>ledger-models % protoc --java_out=ledger-models-java/generated-src --proto_path=ledger-models-protos **/*.proto
</code>```

However when I run the same line in the script it fails:

```<code>echo "generating java protos"
rm -rf ledger-models-java/generated-src
mkdir  ledger-models-java/generated-src
protoc --java_out=ledger-models-java/generated-src --proto_path=ledger-models-protos **/*.proto
</code>```
```<code>ledger-models % ./compile.sh
working directory
/Users/davidjdoherty/Dev/ledger-models
generating java protos
Could not make proto path relative: **/*.proto: No such file or directory
</code>```

I am stumped as to why I'm getting the error **Could not make proto path relative: /*.proto: No such file or directory.

This is an open source project so the code is: https://github.com/FinTekkers/ledger-models/blob/main/compile.sh

Body:
Been wrestling with this for a while. I have a protoc command that runs fine in terminal, but fails in a script. The issue seems to be with the recursive protos.

The folder structure is:

ledger-models % ls
Cargo.lock      README.md       gen.rs          ledger-models-protos    target
Cargo.toml      compile.sh      ledger-models-java  ledger-models-rust

in ledger-models-protos there are several folders with protos:

ledger-models-protos % ls
models              requests            services

In the root directory I can sucessfully run the protoc command interactively:

ledger-models % protoc --java_out=ledger-models-java/generated-src --proto_path=ledger-models-protos **/*.proto

However when I run the same line in the script it fails:

echo "generating java protos"
rm -rf ledger-models-java/generated-src
mkdir  ledger-models-java/generated-src
protoc --java_out=ledger-models-java/generated-src --proto_path=ledger-models-protos **/*.proto

ledger-models % ./compile.sh
working directory
/Users/davidjdoherty/Dev/ledger-models
generating java protos
Could not make proto path relative: **/*.proto: No such file or directory

I am stumped as to why I'm getting the error **Could not make proto path relative: /*.proto: No such file or directory.

This is an open source project so the code is: https://github.com/FinTekkers/ledger-models/blob/main/compile.sh


问:
Returning Pythagorean triples
my code is not returning all of the pythagorean triples up to a limit.

limit with n =100 should return length of list being 50 however I get 36.

what is wrong here.

```<code>def pyth_list(num):
    pyth_list = []
    for n in range(1, num+1):
        for m in range(n+1, num+1):
            if n**2 + m**2 >= num:
                break
            else:
                x, y, z = mergesort([m**2-n**2, 2*m*n, n**2+m**2])
            pyth_list.append([x, y, z])
    return pyth_list

</code>```

Title: Returning Pythagorean triples

Body:
my code is not returning all of the pythagorean triples up to a limit.

limit with n =100 should return length of list being 50 however I get 36.

what is wrong here.

def pyth_list(num):
    pyth_list = []
    for n in range(1, num+1):
        for m in range(n+1, num+1):
            if n**2 + m**2 >= num:
                break
            else:
                x, y, z = mergesort([m**2-n**2, 2*m*n, n**2+m**2])
            pyth_list.append([x, y, z])
    return pyth_list


问:
Restricting mouse dragging to a certain area in Map-box-gl-js
Hey guys so I am displaying a map and I want to limit the user mouse dragging to a specific area. For example I want to limit user within New York city. The user can use mouse dragging within the area that covers the city but if the user wants move to see Las Vegas the user should be trapped within the limits of New York.

My map component is currently looking like this.

```<code><Map
        mapboxAccessToken={TOKEN}
        // onResize=""
        initialViewState={{
          longitude: -73.935242,
          latitude: 40.730610,
          zoom: 8,
        }}
        style={{
          width: "100%",
          height: "100%",
        }}
        mapStyle="mapbox://styles/mapbox/dark-v9"
        minZoom={8}
        // dragPan={false}
      >

        <FullscreenControl position="top-right" />
        <NavigationControl position="top-right" />

<Map/>
</code>```

When I disable dragPan it disables all mouse dragging but I just want to disable mouse dragging if the user tries to gets out of New York boundaries.

Body:
Hey guys so I am displaying a map and I want to limit the user mouse dragging to a specific area. For example I want to limit user within New York city. The user can use mouse dragging within the area that covers the city but if the user wants move to see Las Vegas the user should be trapped within the limits of New York.

My map component is currently looking like this.

<Map
        mapboxAccessToken={TOKEN}
        // onResize=""
        initialViewState={{
          longitude: -73.935242,
          latitude: 40.730610,
          zoom: 8,
        }}
        style={{
          width: "100%",
          height: "100%",
        }}
        mapStyle="mapbox://styles/mapbox/dark-v9"
        minZoom={8}
        // dragPan={false}
      >

        <FullscreenControl position="top-right" />
        <NavigationControl position="top-right" />

<Map/>

When I disable dragPan it disables all mouse dragging but I just want to disable mouse dragging if the user tries to gets out of New York boundaries.


问:
how to send Uint8List data in Dio flutter
I want to send the Uint8List in the flutter dio, but I am getting this error : "Stream type must be Stream<List>, but _MultiStream is found."

```<code>Future<void> uploadImageUrl() async {
  Options options = Options(headers: {
    'Accept': "*/*",
    'Content-Length': imageUrlPath!.length,
    'Connection': 'keep-alive',
    'User-Agent': 'ClinicPlush'
  });

  await Dio().put(imageUrlPath!,
      data: Stream.fromIterable(profileImage.map((e) => [e])),
      options: options);
}
</code>```

I have tried in this way where profileImage is Uint8List image format

Body:
I want to send the Uint8List in the flutter dio, but I am getting this error : "Stream type must be Stream<List>, but _MultiStream is found."

Future<void> uploadImageUrl() async {
  Options options = Options(headers: {
    'Accept': "*/*",
    'Content-Length': imageUrlPath!.length,
    'Connection': 'keep-alive',
    'User-Agent': 'ClinicPlush'
  });

  await Dio().put(imageUrlPath!,
      data: Stream.fromIterable(profileImage.map((e) => [e])),
      options: options);
}

I have tried in this way where profileImage is Uint8List image format


问:
AVAudioRecorder stops the record at the end of an AVAudioSession.interruptionNotification
I am implementing a recorder in my application using an AVAudioRecorder, but I’m encountering a strange behavior when an interruption is triggered by the system.

Indeed, when an interrupt is caught thanks to the AVAudioSession.interruptionNotification, I call the following function:

@objc private func handleInterruption(notification: Foundation.Notification) {
    guard let interruptionTypeValue = notification.userInfo?[AVAudioSessionInterruptionTypeKey] as? UInt,
          let interruptionType = AVAudioSession.InterruptionType(rawValue: interruptionTypeValue)
    else { return }

    switch interruptionType {
    case .began:
      pause()
    case .ended:
      guard let optionsValue = notification.userInfo?[AVAudioSessionInterruptionOptionKey] as? UInt else { return }
      let options = AVAudioSession.InterruptionOptions(rawValue: optionsValue)
      if options.contains(.shouldResume) {
        resume()
      } else {
        // TODO:
      }
    @unknown default:
      break
    }
  }
```

At the beginning of the interruption, I pause the recorder and at the end of it resume the recorder if needed.

However when I resume the recorder after the interruption, it restart the record, deleting the file previously created since I receive a callback from audioRecorderDidFinishRecording(_ recorder: AVAudioRecorder, successfully flag: Bool).

How to get around this problem?

Thanks

Body:
I am implementing a recorder in my application using an AVAudioRecorder, but I’m encountering a strange behavior when an interruption is triggered by the system.

Indeed, when an interrupt is caught thanks to the AVAudioSession.interruptionNotification, I call the following function:

@objc private func handleInterruption(notification: Foundation.Notification) {
    guard let interruptionTypeValue = notification.userInfo?[AVAudioSessionInterruptionTypeKey] as? UInt,
          let interruptionType = AVAudioSession.InterruptionType(rawValue: interruptionTypeValue)
    else { return }

    switch interruptionType {
    case .began:
      pause()
    case .ended:
      guard let optionsValue = notification.userInfo?[AVAudioSessionInterruptionOptionKey] as? UInt else { return }
      let options = AVAudioSession.InterruptionOptions(rawValue: optionsValue)
      if options.contains(.shouldResume) {
        resume()
      } else {
        // TODO:
      }
    @unknown default:
      break
    }
  }

At the beginning of the interruption, I pause the recorder and at the end of it resume the recorder if needed.

However when I resume the recorder after the interruption, it restart the record, deleting the file previously created since I receive a callback from audioRecorderDidFinishRecording(_ recorder: AVAudioRecorder, successfully flag: Bool).

How to get around this problem?

Thanks


问:
Windows Power Automate: how to rename image files in a folder by size in a sequential numbering?
I just want to automate this simple task, but I dont know how because I just started using Power Automate:

```<code>*Get image files in folder
</code>```

```<code>    If the files have 600px width (or higher) rename to banner0x , where "x" being sequential numbering (banner01, banner02, banner03, etc)
</code>```

```<code>            If the files are less than 600px wide rename to card0x , where "x" being sequential numbering (card01, card02, card03, etc)*
</code>```

That´s it. Can anyone help me? Thanks a bunch!

Body:
I just want to automate this simple task, but I dont know how because I just started using Power Automate:

*Get image files in folder

    If the files have 600px width (or higher) rename to banner0x , where "x" being sequential numbering (banner01, banner02, banner03, etc)

            If the files are less than 600px wide rename to card0x , where "x" being sequential numbering (card01, card02, card03, etc)*

That´s it. Can anyone help me? Thanks a bunch!


问:
Pushing to GitHub in VS Code causes error "Authentication failed" with unknown user name
I'm using VS Code 1.74.0 to push changes to my GitHub repository. When I click on Sync changes, VS Code asks me for the password for a user named 22298273@github.com.

This "user" is unknown to me and I don't know where that number (22298273) originates from. When I press ESC when the dialog is shown, I get the following error message in the git output:

```<code>2022-12-13 14:00:55.675 [info] > git push origin master:master [1546ms]
2022-12-13 14:00:55.676 [info] remote: Invalid username or password.
    fatal: Authentication failed for 'https://github.com/some-user-name/my-first-app.git/'
</code>```

This does make sense, even though I don't know the user shown above. However, when I repeatedly press Sync changes again and always press ESC when the dialog for entering the password comes up, the sync finally succeeds after a couple of times (without entering anything as a password):

```<code>2022-12-13 14:00:58.138 [info] > git push origin master:master [1051ms]
2022-12-13 14:00:58.138 [info] To https://github.com/some-user-name/my-first-app.git
    b098c51..16d459f  master -> master
</code>```

Alternatively, when I enter my valid access token from GitHub into the password field, the sync works straight away, but my question remains: Where does that user number (22298273) come from? And why does the sync work without entering anything into the password field after a couple of attempts?

Update

After following some of the advices given in the comment, I still have the same behaviour:

```<code>    >>> I performed a change, added a file via "Commit" and then pressed "Sync Changes" <<<

2022-12-15 14:54:21.810 [info] > git log --oneline --cherry master...master@{upstream} -- [1ms]
2022-12-15 14:54:22.351 [info] > git pull --tags -r origin master [537ms]
2022-12-15 14:54:22.351 [info] From https://github.com/gorgsenegger/my-first-app
 * branch            master     -> FETCH_HEAD
2022-12-15 14:54:23.522 [info] > git ls-files --stage -- /home/johndoe/projects/my-first-app/src/app/servers/servers.component.html [0ms]
2022-12-15 14:54:23.528 [info] > git cat-file -s 573c25317a9597ab31b651934d4d309c74105cec [1ms]
2022-12-15 14:54:23.587 [info] > git show --textconv :src/app/servers/servers.component.html [0ms]

    >>> Here VS Code asks for the password for my user id <<<
    >>> I just pressed ESC <<<

2022-12-15 14:54:31.348 [info] > git push origin master:master [9530ms]
2022-12-15 14:54:31.348 [info] remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/gorgsenegger/my-first-app.git/'

    >>> Now I pressed "Sync Changes" again, VS Code asks for the password for my user id <<<
    >>> I just pressed ESC again <<<

2022-12-15 14:54:41.412 [info] > git log --oneline --cherry master...master@{upstream} -- [0ms]
2022-12-15 14:54:42.411 [info] > git push origin master:master [991ms]

    >>> Despite NOT having entered anything into the password field, not my commit is pushed <<<

2022-12-15 14:54:42.412 [info] To https://github.com/gorgsenegger/my-first-app.git
   0b0ca9a..319c84d  master -> master
2022-12-15 14:54:42.421 [info] > git config --get commit.template [2ms]
2022-12-15 14:54:42.426 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/master refs/remotes/master [1ms]
2022-12-15 14:54:42.435 [info] > git status -z -uall [6ms]
2022-12-15 14:54:42.436 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [2ms]
2022-12-15 14:54:43.575 [info] > git config --get commit.template [1ms]
2022-12-15 14:54:43.580 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/master refs/remotes/master [2ms]
2022-12-15 14:54:43.588 [info] > git status -z -uall [5ms]
2022-12-15 14:54:43.588 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [1ms]
2022-12-15 14:54:43.682 [info] > git ls-files --stage -- /home/johndoe/projects/my-first-app/src/app/servers/servers.component.html [1ms]
2022-12-15 14:54:43.688 [info] > git cat-file -s 573c25317a9597ab31b651934d4d309c74105cec [1ms]
2022-12-15 14:54:43.740 [info] > git show --textconv :src/app/servers/servers.component.html [1ms]
2022-12-15 14:54:49.575 [info] > git pull --tags -r origin master [8159ms]
2022-12-15 14:54:49.575 [info] remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/gorgsenegger/my-first-app.git/'
</code>```

I signed out of my GitHub account within VS Code and also first updated the VS Code entry in the Windows Credential Manager. When this didn't work I deleted the entry and tried again, to no avail.

I can enter my personal access token when the dialog comes up in VS Code and it works, but I have to do it every time when I click on Sync Changes. And I still don't understand why I can click ESC (multiple times) and eventually the sync is performed without entering any password/access token.

Body:
I'm using VS Code 1.74.0 to push changes to my GitHub repository. When I click on Sync changes, VS Code asks me for the password for a user named 22298273@github.com.

This "user" is unknown to me and I don't know where that number (22298273) originates from. When I press ESC when the dialog is shown, I get the following error message in the git output:

2022-12-13 14:00:55.675 [info] > git push origin master:master [1546ms]
2022-12-13 14:00:55.676 [info] remote: Invalid username or password.
    fatal: Authentication failed for 'https://github.com/some-user-name/my-first-app.git/'

This does make sense, even though I don't know the user shown above. However, when I repeatedly press Sync changes again and always press ESC when the dialog for entering the password comes up, the sync finally succeeds after a couple of times (without entering anything as a password):

2022-12-13 14:00:58.138 [info] > git push origin master:master [1051ms]
2022-12-13 14:00:58.138 [info] To https://github.com/some-user-name/my-first-app.git
    b098c51..16d459f  master -> master

Alternatively, when I enter my valid access token from GitHub into the password field, the sync works straight away, but my question remains: Where does that user number (22298273) come from? And why does the sync work without entering anything into the password field after a couple of attempts?

Update

After following some of the advices given in the comment, I still have the same behaviour:

    >>> I performed a change, added a file via "Commit" and then pressed "Sync Changes" <<<

2022-12-15 14:54:21.810 [info] > git log --oneline --cherry master...master@{upstream} -- [1ms]
2022-12-15 14:54:22.351 [info] > git pull --tags -r origin master [537ms]
2022-12-15 14:54:22.351 [info] From https://github.com/gorgsenegger/my-first-app
 * branch            master     -> FETCH_HEAD
2022-12-15 14:54:23.522 [info] > git ls-files --stage -- /home/johndoe/projects/my-first-app/src/app/servers/servers.component.html [0ms]
2022-12-15 14:54:23.528 [info] > git cat-file -s 573c25317a9597ab31b651934d4d309c74105cec [1ms]
2022-12-15 14:54:23.587 [info] > git show --textconv :src/app/servers/servers.component.html [0ms]

    >>> Here VS Code asks for the password for my user id <<<
    >>> I just pressed ESC <<<

2022-12-15 14:54:31.348 [info] > git push origin master:master [9530ms]
2022-12-15 14:54:31.348 [info] remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/gorgsenegger/my-first-app.git/'

    >>> Now I pressed "Sync Changes" again, VS Code asks for the password for my user id <<<
    >>> I just pressed ESC again <<<

2022-12-15 14:54:41.412 [info] > git log --oneline --cherry master...master@{upstream} -- [0ms]
2022-12-15 14:54:42.411 [info] > git push origin master:master [991ms]

    >>> Despite NOT having entered anything into the password field, not my commit is pushed <<<

2022-12-15 14:54:42.412 [info] To https://github.com/gorgsenegger/my-first-app.git
   0b0ca9a..319c84d  master -> master
2022-12-15 14:54:42.421 [info] > git config --get commit.template [2ms]
2022-12-15 14:54:42.426 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/master refs/remotes/master [1ms]
2022-12-15 14:54:42.435 [info] > git status -z -uall [6ms]
2022-12-15 14:54:42.436 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [2ms]
2022-12-15 14:54:43.575 [info] > git config --get commit.template [1ms]
2022-12-15 14:54:43.580 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/master refs/remotes/master [2ms]
2022-12-15 14:54:43.588 [info] > git status -z -uall [5ms]
2022-12-15 14:54:43.588 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [1ms]
2022-12-15 14:54:43.682 [info] > git ls-files --stage -- /home/johndoe/projects/my-first-app/src/app/servers/servers.component.html [1ms]
2022-12-15 14:54:43.688 [info] > git cat-file -s 573c25317a9597ab31b651934d4d309c74105cec [1ms]
2022-12-15 14:54:43.740 [info] > git show --textconv :src/app/servers/servers.component.html [1ms]
2022-12-15 14:54:49.575 [info] > git pull --tags -r origin master [8159ms]
2022-12-15 14:54:49.575 [info] remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/gorgsenegger/my-first-app.git/'

I signed out of my GitHub account within VS Code and also first updated the VS Code entry in the Windows Credential Manager. When this didn't work I deleted the entry and tried again, to no avail.

I can enter my personal access token when the dialog comes up in VS Code and it works, but I have to do it every time when I click on Sync Changes. And I still don't understand why I can click ESC (multiple times) and eventually the sync is performed without entering any password/access token.


问:
Is there a way to adjust letter spacing for text in Tkinter?
I wanted to adjust the letter spacing in Tkinter like how it is possible in a document editor but couldn't find anything to change the font style to a more condensed form.

I used Poppins font for some heading, but now I feel like the space between letters is a bit too much.

I couldn't find a font that is similar to Poppins but condensed and also I really don't want to change the font. So, are there any workarounds for this?


问:
M2M authentication
I have an important question regarding M2M case -
We give our partners ClientID and secret according to generate token, right?
And these credentials can be related to ONE application, right?
So, if for example we have 2 partners (2 machines)  - and we want that each one of them will have access to different projects and will have different roles and can get access to different information in our side, how can we do it using M2M tokens?
Can I generate different token including the client credentials for each partner ,and each token will contain somehow different access to project and contain roles?
Or we can’t do it because in M2M case we can only generate token by using client credentials and those who use this token can get access to same information in our application?

I tried to generate token by using client credentials but I have got that each partner who use this token will have the same access as everyone who use it, so I wondering if it can be differently

Title: M2M authentication


问:
I can I increse the space between YAxis label in re-charts?
```<code>    <ResponsiveContainer width="100%" height="100%">
      <BarChart
        data={data}
        layout="vertical"
        margin={{
          top: 40, right: 40, bottom: 20, left: 100
        }}

      >
        <CartesianGrid strokeDasharray="1 1" />
        <XAxis interval={0} type="number" dataKey="race" />
        <YAxis offset={100} type="category" dataKey="name" style={{ fontSize: '12px' }} />
        <Tooltip />
        <Legend />
        <Bar dataKey="race" fill="#4246e7" barSize={100} />
      </BarChart>
    </ResponsiveContainer>
</code>```

I want to add some space between races in the left part, but it doesn't work.

i tried with margin but the CSS doesn't apply

enter image description here

Body:
    <ResponsiveContainer width="100%" height="100%">
      <BarChart
        data={data}
        layout="vertical"
        margin={{
          top: 40, right: 40, bottom: 20, left: 100
        }}

      >
        <CartesianGrid strokeDasharray="1 1" />
        <XAxis interval={0} type="number" dataKey="race" />
        <YAxis offset={100} type="category" dataKey="name" style={{ fontSize: '12px' }} />
        <Tooltip />
        <Legend />
        <Bar dataKey="race" fill="#4246e7" barSize={100} />
      </BarChart>
    </ResponsiveContainer>

I want to add some space between races in the left part, but it doesn't work.

i tried with margin but the CSS doesn't apply

enter image description here


问:
SQLAlchemy with MySQL on AWS Lambda is taking long time to truncate table
On creating all tables using alembic for migrations and then truncate any empty table gets completed quickly, BUT once lambda function is triggered to insert some data in a table through SQLAlchemy ORM Session query (as given below) and then truncate the table takes very much time. Where is the problem?

```<code>from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

engine = create_engine("mysql+pymysql://....")
Session = sessionmaker(bind=engine)

def add_user():
    session = Session()
    session.add(User(**{'user_id': 1, 'name': 'user name'}))
    session.commit()
    session.close()
    session.bind.dispose()  # also tried without dispose
</code>```

Although I am closing sqlalchemy session and diposing engine connection, then also after inserting data in a table, it is taking long time to truncate the table.

Body:
On creating all tables using alembic for migrations and then truncate any empty table gets completed quickly, BUT once lambda function is triggered to insert some data in a table through SQLAlchemy ORM Session query (as given below) and then truncate the table takes very much time. Where is the problem?

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

engine = create_engine("mysql+pymysql://....")
Session = sessionmaker(bind=engine)

def add_user():
    session = Session()
    session.add(User(**{'user_id': 1, 'name': 'user name'}))
    session.commit()
    session.close()
    session.bind.dispose()  # also tried without dispose

Although I am closing sqlalchemy session and diposing engine connection, then also after inserting data in a table, it is taking long time to truncate the table.


问:
Apply Filter on raster - ArcGIS webapp builder
I am trying to apply a filter widget on the date of multiple raster images uploaded. I tried using different methods to upload the raster including uploading as an image collection, single image, or as a mosaic image. However, when applying the filter widget it doesn't recognize the rasters as a layer giving the below error message:

Updated Error
Please support.

I tried adding the raster in different ways as an image collection, single image, or as a mosaic image. However, the raster layer still doesn't show in the filter widget


问:
Getting NotOfficeXmlFileException while converting input stream (Multipart data) to Workbook POI
We have a process to uplod file which includes two steps-

get file content via multipart request from UI and save into database.
code from controller is given below-

```<code> public Response uploadCallbacks(
         @ApiParam(value = "A unique identifier", required = true) @PathParam("campaignId") Integer id,
         @ApiParam(value = "The file input stream data in chunks", required = true) @FormDataParam("file") InputStream inputStream,
         @ApiParam(value = "The content disposition of file", required = true) @FormDataParam("file") FormDataContentDisposition data,
         @Context SecurityContext securityContext) throws IOException
 { callbackUploadService.process(inputStream, data, id, u);
</code>```

Fetch stream from DB and read the input stream
But at first step if we are trying to convert this stream to POI WorkBook object

Workbook wb = StreamingReader.builder().sstCacheSize(100).open(uploadedInputStream);

then it is giving below error

```<code>Exception in thread "main" org.apache.poi.openxml4j.exceptions.NotOfficeXmlFileException: No valid entries or contents found, this is not a valid OOXML (Office Open XML) file`
</code>```

NOTE- THIS PIECE OF CODE IS WORKING FINE ON LOCAL MACHINE AS WELL AS IN SOME OTHER ENV , ISSUE IS WITH SOME ENVIRONMENTS ONLY WHEN EXCEL FILE CONTAINS 17 COLUMNS AND 25 ROWS IF NO OF ROWS DECREASES IT WORK FINE(ON LOCAL MACHINE EXCEL FILE WITH 17 ROWS AND 1000/2000 ROWS WORKING FINE).

Body:
We have a process to uplod file which includes two steps-

get file content via multipart request from UI and save into database.
code from controller is given below-

 public Response uploadCallbacks(
         @ApiParam(value = "A unique identifier", required = true) @PathParam("campaignId") Integer id,
         @ApiParam(value = "The file input stream data in chunks", required = true) @FormDataParam("file") InputStream inputStream,
         @ApiParam(value = "The content disposition of file", required = true) @FormDataParam("file") FormDataContentDisposition data,
         @Context SecurityContext securityContext) throws IOException
 { callbackUploadService.process(inputStream, data, id, u);

Fetch stream from DB and read the input stream
But at first step if we are trying to convert this stream to POI WorkBook object

Workbook wb = StreamingReader.builder().sstCacheSize(100).open(uploadedInputStream);

then it is giving below error

Exception in thread "main" org.apache.poi.openxml4j.exceptions.NotOfficeXmlFileException: No valid entries or contents found, this is not a valid OOXML (Office Open XML) file`

NOTE- THIS PIECE OF CODE IS WORKING FINE ON LOCAL MACHINE AS WELL AS IN SOME OTHER ENV , ISSUE IS WITH SOME ENVIRONMENTS ONLY WHEN EXCEL FILE CONTAINS 17 COLUMNS AND 25 ROWS IF NO OF ROWS DECREASES IT WORK FINE(ON LOCAL MACHINE EXCEL FILE WITH 17 ROWS AND 1000/2000 ROWS WORKING FINE).


问:
Build breaker for Angular application
We are using mix of Jenkins & TeamCity pipelines for our Angular projects.
We want to break the build if specific version of node is not used by a project, or specific version(range of version) a library is not used. We want to have precise controls on the versions being used by developers. How to implement such build breaker in the CI/CD pipelines?

We don't have a clue if this is possible. This problem arrived after log4j issue, our teams want to have compliance on versions being used

Title: Build breaker for Angular application


问:
Is it possible to check which dependencies use notifications in the application?
I try something like that  ./gradlew sinsay:dependencies  but this not solve my problem. i want to check what exacly registred a new channel notfication in my app. It is posible to see what using Third-party library ?</p>


问:
NG0203 error for deployed microfrontend project
I am working on microfrontend. using module federation. shell and the remote projects have different repositories and are deployed on different servers. below are the code

shell project : calling the remote project through routing

```<code>{
    path: 'analytics',
    loadChildren: () => loadRemoteModule({
      remoteEntry: `${environment.analyticsServerUrl}/remoteEntry.js`,
      type: 'module',
      exposedModule: './AnalyticsModule'    })
    .then(m => m.AppModule)
  },
</code>```

shell project : webpack.config.js

```<code>const webpack = require('webpack');
const ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin');

module.exports = {
  output: {
    publicPath: 'http://localhost:4200/',
    uniqueName: 'o360',
    scriptType: 'text/javascript',
  },
  optimization: {
    runtimeChunk: false,
  },
  plugins: [
    new ModuleFederationPlugin({
      remotes: {
        analytics: 'http://localhost:4201',
      },
      shared: {
        '@angular/core': {
          eager: true,
          singleton: true
        },
        '@angular/common': {
          eager: true,
          singleton: true
        },
        '@angular/router': {
          eager: true,
          singleton: true
        },
        '@ngxs/store': {
          singleton: true,
          eager: true
        },
        'social-login': {
          singleton: true,
          eager: true
        },
      },
    }),
  ],
};

</code>```

remote project :
webpack.config.js :

```<code>const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");
const mf = require("@angular-architects/module-federation/webpack");
const path = require("path");
const share = mf.share;

const sharedMappings = new mf.SharedMappings();
sharedMappings.register(
  path.join(__dirname, 'tsconfig.json'), [ /* mapped paths to share */ ]);

module.exports = {
  output: {
    uniqueName: "analytics",
    publicPath: 'http://localhost:4201/'
  },
  optimization: {
    runtimeChunk: false
  },
  resolve: {
    alias: {
      ...sharedMappings.getAliases(),
    }
  },
  experiments: {
    outputModule: true
  },
  plugins: [
    new ModuleFederationPlugin({
      library: {
        type: "module"
      },

      name: "analytics",
      filename: "remoteEntry.js",
      exposes: {
        './AnalyticsModule': './src/app/app.module.ts',
      },

      shared: share({
        "@angular/core": {
          singleton: true,
          eager: true
        },
        "@angular/common": {
          singleton: true,
          eager: true
        },
        "@angular/common/http": {
          singleton: true,
          eager: true
        },
        "@angular/router": {
          singleton: true,
          eager: true
        },
        "shared-lib": {
          singleton: true,
          eager: true
        },

        ...sharedMappings.getDescriptors()
      })

    }),
    sharedMappings.getPlugin()
  ],
};

</code>```

individually they are working fine after deployment to their respective servers but when I am trying to open the remote project through the shell project then below error is seen in the console.

```<code>Error: Uncaught (in promise): Error: NG0203
Error: NG0203
    at Fy (remoteEntry.js:1:109371)
    at Nt (remoteEntry.js:1:109522)
    at e.ɵfac [as factory] (remoteEntry.js:1:256984)
    at R1.hydrate (vendor.c5829c2ac166cc04.js:1:4138001)
    at R1.get (vendor.c5829c2ac166cc04.js:1:4135925)
    at vendor.c5829c2ac166cc04.js:1:4136752
    at Set.forEach (<anonymous>)
    at R1._resolveInjectorDefTypes (vendor.c5829c2ac166cc04.js:1:4136736)
    at new Fx (vendor.c5829c2ac166cc04.js:1:4174507)
    at db.create (vendor.c5829c2ac166cc04.js:1:4175218)
    at z (polyfills.b96b59aa4b290638.js:1:15990)
    at z (polyfills.b96b59aa4b290638.js:1:15525)
    at polyfills.b96b59aa4b290638.js:1:16838
    at v.invokeTask (polyfills.b96b59aa4b290638.js:1:7185)
    at Object.onInvokeTask (vendor.c5829c2ac166cc04.js:1:4191629)
    at v.invokeTask (polyfills.b96b59aa4b290638.js:1:7106)
    at M.runTask (polyfills.b96b59aa4b290638.js:1:2580)
    at _ (polyfills.b96b59aa4b290638.js:1:9200)
</code>```

as NG0203 is an error related inject() function which I am not using anywhere in both applications but still getting this error so seems something is getting injected post loading of the module. I was exposing specific module analyticsModule before but later exposed the root module appModule but still the same error. tried using preloading and other solutions give on the internet but still the same error.

Body:
I am working on microfrontend. using module federation. shell and the remote projects have different repositories and are deployed on different servers. below are the code

shell project : calling the remote project through routing

{
    path: 'analytics',
    loadChildren: () => loadRemoteModule({
      remoteEntry: `${environment.analyticsServerUrl}/remoteEntry.js`,
      type: 'module',
      exposedModule: './AnalyticsModule'    })
    .then(m => m.AppModule)
  },

shell project : webpack.config.js

const webpack = require('webpack');
const ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin');

module.exports = {
  output: {
    publicPath: 'http://localhost:4200/',
    uniqueName: 'o360',
    scriptType: 'text/javascript',
  },
  optimization: {
    runtimeChunk: false,
  },
  plugins: [
    new ModuleFederationPlugin({
      remotes: {
        analytics: 'http://localhost:4201',
      },
      shared: {
        '@angular/core': {
          eager: true,
          singleton: true
        },
        '@angular/common': {
          eager: true,
          singleton: true
        },
        '@angular/router': {
          eager: true,
          singleton: true
        },
        '@ngxs/store': {
          singleton: true,
          eager: true
        },
        'social-login': {
          singleton: true,
          eager: true
        },
      },
    }),
  ],
};

remote project :
webpack.config.js :

const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");
const mf = require("@angular-architects/module-federation/webpack");
const path = require("path");
const share = mf.share;

const sharedMappings = new mf.SharedMappings();
sharedMappings.register(
  path.join(__dirname, 'tsconfig.json'), [ /* mapped paths to share */ ]);

module.exports = {
  output: {
    uniqueName: "analytics",
    publicPath: 'http://localhost:4201/'
  },
  optimization: {
    runtimeChunk: false
  },
  resolve: {
    alias: {
      ...sharedMappings.getAliases(),
    }
  },
  experiments: {
    outputModule: true
  },
  plugins: [
    new ModuleFederationPlugin({
      library: {
        type: "module"
      },

      name: "analytics",
      filename: "remoteEntry.js",
      exposes: {
        './AnalyticsModule': './src/app/app.module.ts',
      },

      shared: share({
        "@angular/core": {
          singleton: true,
          eager: true
        },
        "@angular/common": {
          singleton: true,
          eager: true
        },
        "@angular/common/http": {
          singleton: true,
          eager: true
        },
        "@angular/router": {
          singleton: true,
          eager: true
        },
        "shared-lib": {
          singleton: true,
          eager: true
        },

        ...sharedMappings.getDescriptors()
      })

    }),
    sharedMappings.getPlugin()
  ],
};

individually they are working fine after deployment to their respective servers but when I am trying to open the remote project through the shell project then below error is seen in the console.

Error: Uncaught (in promise): Error: NG0203
Error: NG0203
    at Fy (remoteEntry.js:1:109371)
    at Nt (remoteEntry.js:1:109522)
    at e.ɵfac [as factory] (remoteEntry.js:1:256984)
    at R1.hydrate (vendor.c5829c2ac166cc04.js:1:4138001)
    at R1.get (vendor.c5829c2ac166cc04.js:1:4135925)
    at vendor.c5829c2ac166cc04.js:1:4136752
    at Set.forEach (<anonymous>)
    at R1._resolveInjectorDefTypes (vendor.c5829c2ac166cc04.js:1:4136736)
    at new Fx (vendor.c5829c2ac166cc04.js:1:4174507)
    at db.create (vendor.c5829c2ac166cc04.js:1:4175218)
    at z (polyfills.b96b59aa4b290638.js:1:15990)
    at z (polyfills.b96b59aa4b290638.js:1:15525)
    at polyfills.b96b59aa4b290638.js:1:16838
    at v.invokeTask (polyfills.b96b59aa4b290638.js:1:7185)
    at Object.onInvokeTask (vendor.c5829c2ac166cc04.js:1:4191629)
    at v.invokeTask (polyfills.b96b59aa4b290638.js:1:7106)
    at M.runTask (polyfills.b96b59aa4b290638.js:1:2580)
    at _ (polyfills.b96b59aa4b290638.js:1:9200)

as NG0203 is an error related inject() function which I am not using anywhere in both applications but still getting this error so seems something is getting injected post loading of the module. I was exposing specific module analyticsModule before but later exposed the root module appModule but still the same error. tried using preloading and other solutions give on the internet but still the same error.


问:
GUNICORN FastAPI Deployment with Proxy
I am currently setting up a FastAPI application to run on an AWS RockyLinux 8 instance with a gunicorn deployment. Most of the documentation that I have read recommends NGINX as a proxy server.

I currently have an Apache sever running on this instance and would rather not install another HTTP daemon if I can help it.

My question is: Why is a proxy HTTP server needed at all? gunicorn seems to run just fine without a proxy HTTP server simply by specifying a port other than 80. Is this a security recommendation or am I missing something?

Title: GUNICORN FastAPI Deployment with Proxy


问:
Symfony Mailer with SendinBlue configuration problem
I am trying do deploy my website, and i'm using a third party transport to dispatch my emails like : confirmation after subscription and reset password emails.

I am using SendinBlue. I followed Symfony documentation and run composer require symfony/sendinblue-mailer

Then i added MAILER_DSN=sendinblue+smtp://USERNAME:PASSWORD@default in my .env file. Username and password seems correct, i also encoded special characters in my username.

My website is hosted on OVH, i can connect by SSH and run php bin/console messenger:consume async

I have an error message saying : WARNING   [messenger] Error thrown while handling message Symfony\Component\Mailer\Messenger\SendEmailMessage. Sending for retry #1 using 1000 ms delay. Error: "Handling "Symfony\Component\Mailer\Messenger\SendEmailMessage" failed: Connection could not be established with host "ssl://smtp-relay.sendinblue.com:587": stream_socket_client(): unable to connect to ssl://smtp-relay.sendinblue.com:587 (Connection refused)"

I also tried to use the SendinBlue API key and got this message : WARNING   [messenger] Error thrown while handling message Symfony\Component\Mailer\Messenger\SendEmailMessage. Sending for retry #1 using 1000 ms delay. Error: "Handling "Symfony\Component\Mailer\Messenger\SendEmailMessage" failed: Could not reach the remote Sendinblue server."

I guess i missed something, it's the first time i build a symfony application and im a little lost. I spent all day on this and could not find a solution.

Does anyone have an idea what i did wrong ?


问:
How to redirect the user to the home page when he logs in successfully in react?
I'm fairly new to redux toolkit so I'm still having a few issues with it!

I'm stuck on this. I couldn't find what to do, how to follow a method. so i need your help.

My only request is to redirect the user to the home page when he logs in successfully, but I couldn't find what to check, where and how. I will share the code pages that I think will help you.

```<code>import { createAsyncThunk } from "@reduxjs/toolkit";
import axios from "axios";
import { TokenService } from "./token.service";

export const AuthService = {};
AuthService.userLogin = createAsyncThunk(
  "userSlice/userLogin",
  async ({ username, password }) => {
    console.log(username, password);
    try {
      const response = await axios.post(
        "https://localhost:7163/api/Login",
        { username, password },
        {
          headers: {
            "Content-Type": "application/json",
          },
          body: JSON.stringify({
            username: typeof username === "string" ? username.toString() : "",
            password: typeof password === "string" ? password.toString() : "",
          }),
        }
      );
      if (response.data.status) {
        const tokenResponse = { accessToken: response?.data?.data?.token };
        TokenService.setToken(tokenResponse);
      } else {
        console.log("false false false");
        return response.data.status;
      }

      return response.data;
    } catch (error) {
      console.error(error);
    }
  }
);
</code>```
```<code>import { createSlice } from "@reduxjs/toolkit";
import { AuthService } from "../../services/auth.service";

const userToken = localStorage.getItem("userToken")
  ? localStorage.getItem("userToken")
  : null;

const initialState = {
  userToken,
  isLoading: false,
  hasError: false,
  userinfo: null,
};

const userSlice = createSlice({
  name: "userSlice",
  initialState,
  reducers: {},
  extraReducers: (builder) => {
    builder
      .addCase(AuthService.userLogin.pending, (state, action) => {
        state.isLoading = true;
        state.hasError = false;
      })
      .addCase(AuthService.userLogin.fulfilled, (state, action) => {
        state.userToken = action.payload;
        state.isLoading = false;
        state.hasError = false;
      })
      .addCase(AuthService.userLogin.rejected, (state, action) => {
        state.isLoading = false;
        state.hasError = true;
      });
  },
});
export const selectUserToken = (state) => state.userSlice.userToken;
export const selectLoadingState = (state) => state.userSlice.isLoading;
export const selectErrorState = (state) => state.userSlice.hasError;
export default userSlice.reducer;
</code>```
```<code>export default function SignIn() {
  const navigate = useNavigate();
  const error = useSelector(selectErrorState);
  console.log(error);
  const [username, setName] = useState("");
  const [password, setPassword] = useState("");
  const dispatch = useDispatch();

  const data = {
    username: username,
    password: password,
  };

  const handleNameChange = (event) => {
    setName(event.target.value);
  };

  const handlePasswordChange = (event) => {
    setPassword(event.target.value);
  };

  const handleSubmit = (e) => {
    e.preventDefault();
    console.log(username, password);
    const response = dispatch(AuthService.userLogin(data))
      .unwrap()
      .then(() => {
        if (response.success) {
          navigate("/");
        }
      });
    console.log("RESPONSE", response);
    console.log(error);
  };
</code>```
```<code>//index.js
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
  <React.StrictMode>
    <Provider store={store}>
      <BrowserRouter>
        <Routes>
          <Route path="login" element={<Login />} />
          <Route path="register" element={<Register />} />
          <Route path="" element={<Home />} />
          <Route path="events" element={<Events />} />
        </Routes>
      </BrowserRouter>
    </Provider>
  </React.StrictMode>
);
</code>```

log

my result from API:

Does it make more sense to use the status property here?

```<code>{data: {…}, status: true, exception: null, code: 200, message: null}
code: 200
data: {token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfb…yMzl9.1P25An_PHA9n4dyQ9JRKOjwPWWtQShWgW9In-gqS7Ek'}
exception: null
message: null
status: true
[[Prototype]]: Object
</code>```

Even if I enter wrong information, the promise always seems to be fulfilled.

I think I need to use token in this process. The user will see his own information. I can get the token somehow, but I couldn't use it after I put it in localstorage.

While on the login page, it struggled with the data returned from the login meta, but I couldn't. I want to know what is the most logical method in such a situation. Thank you in advance for your answers.

Body:
I'm fairly new to redux toolkit so I'm still having a few issues with it!

I'm stuck on this. I couldn't find what to do, how to follow a method. so i need your help.

My only request is to redirect the user to the home page when he logs in successfully, but I couldn't find what to check, where and how. I will share the code pages that I think will help you.

import { createAsyncThunk } from "@reduxjs/toolkit";
import axios from "axios";
import { TokenService } from "./token.service";

export const AuthService = {};
AuthService.userLogin = createAsyncThunk(
  "userSlice/userLogin",
  async ({ username, password }) => {
    console.log(username, password);
    try {
      const response = await axios.post(
        "https://localhost:7163/api/Login",
        { username, password },
        {
          headers: {
            "Content-Type": "application/json",
          },
          body: JSON.stringify({
            username: typeof username === "string" ? username.toString() : "",
            password: typeof password === "string" ? password.toString() : "",
          }),
        }
      );
      if (response.data.status) {
        const tokenResponse = { accessToken: response?.data?.data?.token };
        TokenService.setToken(tokenResponse);
      } else {
        console.log("false false false");
        return response.data.status;
      }

      return response.data;
    } catch (error) {
      console.error(error);
    }
  }
);

import { createSlice } from "@reduxjs/toolkit";
import { AuthService } from "../../services/auth.service";

const userToken = localStorage.getItem("userToken")
  ? localStorage.getItem("userToken")
  : null;

const initialState = {
  userToken,
  isLoading: false,
  hasError: false,
  userinfo: null,
};

const userSlice = createSlice({
  name: "userSlice",
  initialState,
  reducers: {},
  extraReducers: (builder) => {
    builder
      .addCase(AuthService.userLogin.pending, (state, action) => {
        state.isLoading = true;
        state.hasError = false;
      })
      .addCase(AuthService.userLogin.fulfilled, (state, action) => {
        state.userToken = action.payload;
        state.isLoading = false;
        state.hasError = false;
      })
      .addCase(AuthService.userLogin.rejected, (state, action) => {
        state.isLoading = false;
        state.hasError = true;
      });
  },
});
export const selectUserToken = (state) => state.userSlice.userToken;
export const selectLoadingState = (state) => state.userSlice.isLoading;
export const selectErrorState = (state) => state.userSlice.hasError;
export default userSlice.reducer;

export default function SignIn() {
  const navigate = useNavigate();
  const error = useSelector(selectErrorState);
  console.log(error);
  const [username, setName] = useState("");
  const [password, setPassword] = useState("");
  const dispatch = useDispatch();

  const data = {
    username: username,
    password: password,
  };

  const handleNameChange = (event) => {
    setName(event.target.value);
  };

  const handlePasswordChange = (event) => {
    setPassword(event.target.value);
  };

  const handleSubmit = (e) => {
    e.preventDefault();
    console.log(username, password);
    const response = dispatch(AuthService.userLogin(data))
      .unwrap()
      .then(() => {
        if (response.success) {
          navigate("/");
        }
      });
    console.log("RESPONSE", response);
    console.log(error);
  };

//index.js
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
  <React.StrictMode>
    <Provider store={store}>
      <BrowserRouter>
        <Routes>
          <Route path="login" element={<Login />} />
          <Route path="register" element={<Register />} />
          <Route path="" element={<Home />} />
          <Route path="events" element={<Events />} />
        </Routes>
      </BrowserRouter>
    </Provider>
  </React.StrictMode>
);

log

my result from API:

Does it make more sense to use the status property here?

{data: {…}, status: true, exception: null, code: 200, message: null}
code: 200
data: {token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfb…yMzl9.1P25An_PHA9n4dyQ9JRKOjwPWWtQShWgW9In-gqS7Ek'}
exception: null
message: null
status: true
[[Prototype]]: Object

Even if I enter wrong information, the promise always seems to be fulfilled.

I think I need to use token in this process. The user will see his own information. I can get the token somehow, but I couldn't use it after I put it in localstorage.

While on the login page, it struggled with the data returned from the login meta, but I couldn't. I want to know what is the most logical method in such a situation. Thank you in advance for your answers.


问:
Firebase authentication not working in link opened from GMail
My application sends its users some e-mails with links inside.

The user is logged in the browser, in a persistent session that lasts even when the user closes the browser.

If the user CLICKS the link in the e-mail, it opens a not authenticated (in my application) new tab in the browser, as if the user hadn't logged in. Just as if the click from inside the e-mail cleared the browser cookies before opening the page.

If they COPY AND PASTE the link in their browser, it works just fine, with the link being opened in a authenticated session in my application.

I use Firebase to manage authentication in my platform.
This issue happens both on desktop and mobile.