问:
Redis database gets randomly wiped
I'm having a strange Redis issue that causes my redis db0 to get completely wiped periodically for no obvious reason.

I'm using redis with Bull queue for NestJS and inserting volatile keys with 7 days duration.
Everything is hosted on Google Cloud Kubernetes.

As you can see from the logs, queue fills up steadily and all of a sudden its wiped to 0.

```<code>1:M 14 Dec 2022 18:02:53.786 - Accepted 10.132.15.228:46851
1:M 14 Dec 2022 18:02:55.818 * DB saved on disk
1:M 14 Dec 2022 18:02:55.836 - DB 0: 6539 keys (1179 volatil

...skipping 1 line
1:M 14 Dec 2022 18:02:55.836 . 25 clients connected (0 repli
cas), 10264320 bytes in use
1:M 14 Dec 2022 18:02:56.338 * DB saved on disk
1:M 14 Dec 2022 18:02:57.975 * DB saved on disk
1:M 14 Dec 2022 18:02:58.444 * DB saved on disk
1:M 14 Dec 2022 18:02:58.687 * DB saved on disk
1:M 14 Dec 2022 18:03:00.863 - DB 0: 10 keys (3 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:00.863 . 25 clients connected (0 repli
cas), 3440672 bytes in use
1:M 14 Dec 2022 18:03:01.056 * DB saved on disk
</code>```

This part is out of time, like 2 threads are writing to same output:

```<code> 1:M 14 Dec 2022 18:03:10.900 - DB 0: 12 keys (5 volatile) in ...back 1 page
 1:M 14 Dec 2022 18:02:40.773 - DB 0: 6542 keys (1174 volatile) in 8192 slots HT.
</code>```

Any insights would be greatly appreciated.

Server info:

```<code>redis_version:7.0.6
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:68a9a9d6a665b45c
redis_mode:standalone
os:Linux 5.10.133+ x86_64
arch_bits:64
monotonic_clock:POSIX clock_gettime
multiplexing_api:epoll
atomicvar_api:c11-builtin
gcc_version:10.2.1
process_id:1
process_supervised:no
run_id:ca394137bd91b23622a8facfb97ae86ba2325a01
tcp_port:6379
server_time_usec:1671042411041619
uptime_in_seconds:1752
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:10098026
executable:/data/redis-server
config_file:/redis-config/redis.conf
io_threads_active:0

# Clients
connected_clients:25
cluster_connections:0
</code>```

Redis config:

```<code>save 60 1000
loglevel debug
notify-keyspace-events Ex
dbfilename dump.rdb
dir /data
logfile /data/redis.log
</code>```

Debug log:

```<code>...skipping 1 line
1:M 14 Dec 2022 17:59:55.106 . 24 clients connected (0 repli
cas), 8023104 bytes in use
1:M 14 Dec 2022 18:00:00.125 - DB 0: 5552 keys (1125 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:00.126 . 24 clients connected (0 repli
cas), 7959688 bytes in use
1:M 14 Dec 2022 18:00:05.146 - DB 0: 5552 keys (1128 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:05.146 . 24 clients connected (0 repli
cas), 8038576 bytes in use
1:M 14 Dec 2022 18:00:10.166 - DB 0: 5553 keys (1128 volatil

...skipping 1 line
1:M 14 Dec 2022 18:00:10.166 . 24 clients connected (0 repli
cas), 7977384 bytes in use
1:M 14 Dec 2022 18:00:14.281 * 1000 changes in 60 seconds. S
aving...
1:M 14 Dec 2022 18:00:14.282 * Background saving started by
pid 26
26:C 14 Dec 2022 18:00:14.284 - Fork CoW for RDB: current 0
MB, peak 0 MB, average 0 MB
26:C 14 Dec 2022 18:00:14.378 * DB saved on disk
26:C 14 Dec 2022 18:00:14.378 * Fork CoW for RDB: current 0
MB, peak 0 MB, average 0 MB

...skipping 1 line
1:M 14 Dec 2022 18:00:15.187 - DB 0: 6081 keys (1128 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:15.187 . 24 clients connected (0 repli
cas), 9276960 bytes in use
1:M 14 Dec 2022 18:00:17.755 - Accepted 10.8.1.1:36758
1:M 14 Dec 2022 18:00:20.208 - DB 0: 6570 keys (1131 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:20.208 . 24 clients connected (0 repli
cas), 10252224 bytes in use
1:M 14 Dec 2022 18:00:25.227 - DB 0: 6570 keys (1133 volatil
e) in 8192 slots HT.

...skipping 1 line
1:M 14 Dec 2022 18:00:30.247 - DB 0: 6568 keys (1134 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:30.247 . 24 clients connected (0 repli
cas), 10266176 bytes in use
1:M 14 Dec 2022 18:00:35.267 - DB 0: 6568 keys (1137 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:35.267 . 24 clients connected (0 repli
cas), 10345096 bytes in use
1:M 14 Dec 2022 18:00:40.285 - DB 0: 6569 keys (1137 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:40.285 . 24 clients connected (0 repli

...skipping 1 line
1:M 14 Dec 2022 18:00:45.304 - DB 0: 6563 keys (1140 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:45.304 . 24 clients connected (0 repli
cas), 10315776 bytes in use
1:M 14 Dec 2022 18:00:50.325 - DB 0: 6563 keys (1140 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:50.325 . 24 clients connected (0 repli
cas), 10254504 bytes in use
1:M 14 Dec 2022 18:00:55.342 - DB 0: 6562 keys (1143 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:55.342 . 24 clients connected (0 repli

...skipping 1 line
1:M 14 Dec 2022 18:01:00.360 - DB 0: 6562 keys (1143 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:00.360 . 24 clients connected (0 repli
cas), 10209512 bytes in use
1:M 14 Dec 2022 18:01:05.381 - DB 0: 6562 keys (1146 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:05.381 . 24 clients connected (0 repli
cas), 10309016 bytes in use
1:M 14 Dec 2022 18:01:10.399 - DB 0: 6563 keys (1146 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:10.399 . 24 clients connected (0 repli

...skipping 1 line
1:M 14 Dec 2022 18:01:15.019 * 1000 changes in 60 seconds. S
aving...
1:M 14 Dec 2022 18:01:15.020 * Background saving started by
pid 27
27:C 14 Dec 2022 18:01:15.022 - Fork CoW for RDB: current 0
MB, peak 0 MB, average 0 MB
27:C 14 Dec 2022 18:01:15.085 * DB saved on disk
27:C 14 Dec 2022 18:01:15.086 * Fork CoW for RDB: current 0
MB, peak 0 MB, average 0 MB
1:M 14 Dec 2022 18:01:15.120 * Background saving terminated
with success

...skipping 1 line
1:M 14 Dec 2022 18:01:15.421 . 24 clients connected (0 repli
cas), 10212776 bytes in use
1:M 14 Dec 2022 18:01:20.441 - DB 0: 6553 keys (1149 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:20.441 . 24 clients connected (0 repli
cas), 10192304 bytes in use
1:M 14 Dec 2022 18:01:25.460 - DB 0: 6553 keys (1152 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:25.460 . 24 clients connected (0 repli
cas), 10189448 bytes in use
1:M 14 Dec 2022 18:01:30.479 - DB 0: 6553 keys (1152 volatil

...skipping 1 line
1:M 14 Dec 2022 18:01:30.479 . 24 clients connected (0 repli
cas), 10189448 bytes in use
1:M 14 Dec 2022 18:01:35.503 - DB 0: 6553 keys (1155 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:35.503 . 24 clients connected (0 repli
cas), 10186592 bytes in use
1:M 14 Dec 2022 18:01:40.523 - DB 0: 6553 keys (1155 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:40.523 . 24 clients connected (0 repli
cas), 10207064 bytes in use
1:M 14 Dec 2022 18:01:45.543 - DB 0: 6551 keys (1157 volatil

...skipping 1 line
1:M 14 Dec 2022 18:01:45.543 . 24 clients connected (0 repli
cas), 10202824 bytes in use
1:M 14 Dec 2022 18:01:50.561 - DB 0: 6551 keys (1157 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:50.561 . 24 clients connected (0 repli
cas), 10202824 bytes in use
1:M 14 Dec 2022 18:01:55.582 - DB 0: 6546 keys (1160 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:55.582 . 24 clients connected (0 repli
cas), 10173504 bytes in use
1:M 14 Dec 2022 18:02:00.603 - DB 0: 6546 keys (1161 volatil

...skipping 1 line
1:M 14 Dec 2022 18:02:00.603 . 24 clients connected (0 repli
cas), 10192880 bytes in use
1:M 14 Dec 2022 18:02:05.622 - DB 0: 6545 keys (1163 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:05.622 . 24 clients connected (0 repli
cas), 10169456 bytes in use
1:M 14 Dec 2022 18:02:10.645 - DB 0: 6546 keys (1167 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:10.645 . 24 clients connected (0 repli
cas), 10290056 bytes in use
1:M 14 Dec 2022 18:02:15.667 - DB 0: 6546 keys (1167 volatil

...skipping 1 line
1:M 14 Dec 2022 18:02:15.667 . 24 clients connected (0 repli
cas), 10208312 bytes in use
1:M 14 Dec 2022 18:02:20.690 - DB 0: 6546 keys (1167 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:20.690 . 24 clients connected (0 repli
cas), 10208312 bytes in use
1:M 14 Dec 2022 18:02:25.713 - DB 0: 6546 keys (1170 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:25.713 . 24 clients connected (0 repli
cas), 10184984 bytes in use
1:M 14 Dec 2022 18:02:30.731 - DB 0: 6545 keys (1171 volatil

...skipping 1 line
1:M 14 Dec 2022 18:02:30.731 . 24 clients connected (0 repli
cas), 10223352 bytes in use
1:M 14 Dec 2022 18:02:35.750 - DB 0: 6541 keys (1173 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:35.750 . 24 clients connected (0 repli
cas), 10154896 bytes in use
1:M 14 Dec 2022 18:02:40.773 - DB 0: 6542 keys (1174 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:40.773 . 24 clients connected (0 repli
cas), 10194824 bytes in use
1:M 14 Dec 2022 18:02:44.425 - Accepted 10.132.15.230:61177

...skipping 1 line
1:M 14 Dec 2022 18:02:45.793 - DB 0: 6541 keys (1176 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:45.793 . 24 clients connected (0 repli
cas), 10172512 bytes in use
1:M 14 Dec 2022 18:02:50.817 - DB 0: 6540 keys (1179 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:50.817 . 24 clients connected (0 repli
cas), 10250272 bytes in use
1:M 14 Dec 2022 18:02:53.786 - Accepted 10.132.15.228:46851
1:M 14 Dec 2022 18:02:55.818 * DB saved on disk
1:M 14 Dec 2022 18:02:55.836 - DB 0: 6539 keys (1179 volatil

...skipping 1 line
1:M 14 Dec 2022 18:02:55.836 . 25 clients connected (0 repli
cas), 10264320 bytes in use
1:M 14 Dec 2022 18:02:56.338 * DB saved on disk
1:M 14 Dec 2022 18:02:57.975 * DB saved on disk
1:M 14 Dec 2022 18:02:58.444 * DB saved on disk
1:M 14 Dec 2022 18:02:58.687 * DB saved on disk
1:M 14 Dec 2022 18:03:00.863 - DB 0: 10 keys (3 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:00.863 . 25 clients connected (0 repli
cas), 3440672 bytes in use
1:M 14 Dec 2022 18:03:01.056 * DB saved on disk

...skipping 1 line
1:M 14 Dec 2022 18:03:01.989 - Client closed connection id=2
9 addr=10.132.15.228:46851 laddr=10.8.1.41:6379 fd=32 name=
age=8 idle=0 flags=N db=0 sub=0 psub=0 ssub=0 multi=-1 qbuf=
0 qbuf-free=20474 argv-mem=0 multi-mem=0 rbs=1024 rbp=97 obl
=0 oll=0 omem=0 tot-mem=22272 events=r cmd=save user=default
 redir=-1 resp=2
1:M 14 Dec 2022 18:03:05.882 - DB 0: 10 keys (3 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:05.882 . 24 clients connected (0 repli
cas), 3418912 bytes in use
1:M 14 Dec 2022 18:03:10.900 - DB 0: 12 keys (5 volatile) in
...back 1 page
1:M 14 Dec 2022 18:02:40.773 - DB 0: 6542 keys (1174 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:40.773 . 24 clients connected (0 repli
cas), 10194824 bytes in use
1:M 14 Dec 2022 18:02:44.425 - Accepted 10.132.15.230:61177
1:M 14 Dec 2022 18:02:44.639 - Reading from client: Connecti
on reset by peer
1:M 14 Dec 2022 18:02:45.793 - DB 0: 6541 keys (1176 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:45.793 . 24 clients connected (0 repli
cas), 10172512 bytes in use

...skipping 1 line
1:M 14 Dec 2022 18:02:50.817 . 24 clients connected (0 repli
cas), 10250272 bytes in use
1:M 14 Dec 2022 18:02:53.786 - Accepted 10.132.15.228:46851
1:M 14 Dec 2022 18:02:55.818 * DB saved on disk
1:M 14 Dec 2022 18:02:55.836 - DB 0: 6539 keys (1179 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:55.836 . 25 clients connected (0 repli
cas), 10264320 bytes in use
1:M 14 Dec 2022 18:02:56.338 * DB saved on disk
1:M 14 Dec 2022 18:02:57.975 * DB saved on disk
1:M 14 Dec 2022 18:02:58.444 * DB saved on disk

...skipping 1 line
1:M 14 Dec 2022 18:03:00.863 - DB 0: 10 keys (3 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:00.863 . 25 clients connected (0 repli
cas), 3440672 bytes in use
1:M 14 Dec 2022 18:03:01.056 * DB saved on disk
1:M 14 Dec 2022 18:03:01.756 * DB saved on disk
1:M 14 Dec 2022 18:03:01.989 - Client closed connection id=2
9 addr=10.132.15.228:46851 laddr=10.8.1.41:6379 fd=32 name=
age=8 idle=0 flags=N db=0 sub=0 psub=0 ssub=0 multi=-1 qbuf=
0 qbuf-free=20474 argv-mem=0 multi-mem=0 rbs=1024 rbp=97 obl
=0 oll=0 omem=0 tot-mem=22272 events=r cmd=save user=default

...skipping 1 line
1:M 14 Dec 2022 18:03:05.882 - DB 0: 10 keys (3 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:05.882 . 24 clients connected (0 repli
cas), 3418912 bytes in use
1:M 14 Dec 2022 18:03:10.900 - DB 0: 12 keys (5 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:10.900 . 24 clients connected (0 repli
cas), 3378320 bytes in use
1:M 14 Dec 2022 18:03:15.917 - DB 0: 12 keys (5 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:15.917 . 24 clients connected (0 repli
cas), 3378336 bytes in use
1:M 14 Dec 2022 18:03:20.936 - DB 0: 12 keys (5 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:20.936 . 24 clients connected (0 repli
cas), 3419296 bytes in use
1:M 14 Dec 2022 18:03:25.954 - DB 0: 12 keys (5 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:25.954 . 24 clients connected (0 repli
cas), 3378304 bytes in use
</code>```

Title: Redis database gets randomly wiped

Body:
I'm having a strange Redis issue that causes my redis db0 to get completely wiped periodically for no obvious reason.

I'm using redis with Bull queue for NestJS and inserting volatile keys with 7 days duration.
Everything is hosted on Google Cloud Kubernetes.

As you can see from the logs, queue fills up steadily and all of a sudden its wiped to 0.

1:M 14 Dec 2022 18:02:53.786 - Accepted 10.132.15.228:46851
1:M 14 Dec 2022 18:02:55.818 * DB saved on disk
1:M 14 Dec 2022 18:02:55.836 - DB 0: 6539 keys (1179 volatil

...skipping 1 line
1:M 14 Dec 2022 18:02:55.836 . 25 clients connected (0 repli
cas), 10264320 bytes in use
1:M 14 Dec 2022 18:02:56.338 * DB saved on disk
1:M 14 Dec 2022 18:02:57.975 * DB saved on disk
1:M 14 Dec 2022 18:02:58.444 * DB saved on disk
1:M 14 Dec 2022 18:02:58.687 * DB saved on disk
1:M 14 Dec 2022 18:03:00.863 - DB 0: 10 keys (3 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:00.863 . 25 clients connected (0 repli
cas), 3440672 bytes in use
1:M 14 Dec 2022 18:03:01.056 * DB saved on disk

This part is out of time, like 2 threads are writing to same output:

 1:M 14 Dec 2022 18:03:10.900 - DB 0: 12 keys (5 volatile) in ...back 1 page
 1:M 14 Dec 2022 18:02:40.773 - DB 0: 6542 keys (1174 volatile) in 8192 slots HT.

Any insights would be greatly appreciated.

Server info:

redis_version:7.0.6
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:68a9a9d6a665b45c
redis_mode:standalone
os:Linux 5.10.133+ x86_64
arch_bits:64
monotonic_clock:POSIX clock_gettime
multiplexing_api:epoll
atomicvar_api:c11-builtin
gcc_version:10.2.1
process_id:1
process_supervised:no
run_id:ca394137bd91b23622a8facfb97ae86ba2325a01
tcp_port:6379
server_time_usec:1671042411041619
uptime_in_seconds:1752
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:10098026
executable:/data/redis-server
config_file:/redis-config/redis.conf
io_threads_active:0

# Clients
connected_clients:25
cluster_connections:0

Redis config:

save 60 1000
loglevel debug
notify-keyspace-events Ex
dbfilename dump.rdb
dir /data
logfile /data/redis.log

Debug log:

...skipping 1 line
1:M 14 Dec 2022 17:59:55.106 . 24 clients connected (0 repli
cas), 8023104 bytes in use
1:M 14 Dec 2022 18:00:00.125 - DB 0: 5552 keys (1125 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:00.126 . 24 clients connected (0 repli
cas), 7959688 bytes in use
1:M 14 Dec 2022 18:00:05.146 - DB 0: 5552 keys (1128 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:05.146 . 24 clients connected (0 repli
cas), 8038576 bytes in use
1:M 14 Dec 2022 18:00:10.166 - DB 0: 5553 keys (1128 volatil

...skipping 1 line
1:M 14 Dec 2022 18:00:10.166 . 24 clients connected (0 repli
cas), 7977384 bytes in use
1:M 14 Dec 2022 18:00:14.281 * 1000 changes in 60 seconds. S
aving...
1:M 14 Dec 2022 18:00:14.282 * Background saving started by
pid 26
26:C 14 Dec 2022 18:00:14.284 - Fork CoW for RDB: current 0
MB, peak 0 MB, average 0 MB
26:C 14 Dec 2022 18:00:14.378 * DB saved on disk
26:C 14 Dec 2022 18:00:14.378 * Fork CoW for RDB: current 0
MB, peak 0 MB, average 0 MB

...skipping 1 line
1:M 14 Dec 2022 18:00:15.187 - DB 0: 6081 keys (1128 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:15.187 . 24 clients connected (0 repli
cas), 9276960 bytes in use
1:M 14 Dec 2022 18:00:17.755 - Accepted 10.8.1.1:36758
1:M 14 Dec 2022 18:00:20.208 - DB 0: 6570 keys (1131 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:20.208 . 24 clients connected (0 repli
cas), 10252224 bytes in use
1:M 14 Dec 2022 18:00:25.227 - DB 0: 6570 keys (1133 volatil
e) in 8192 slots HT.

...skipping 1 line
1:M 14 Dec 2022 18:00:30.247 - DB 0: 6568 keys (1134 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:30.247 . 24 clients connected (0 repli
cas), 10266176 bytes in use
1:M 14 Dec 2022 18:00:35.267 - DB 0: 6568 keys (1137 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:35.267 . 24 clients connected (0 repli
cas), 10345096 bytes in use
1:M 14 Dec 2022 18:00:40.285 - DB 0: 6569 keys (1137 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:40.285 . 24 clients connected (0 repli

...skipping 1 line
1:M 14 Dec 2022 18:00:45.304 - DB 0: 6563 keys (1140 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:45.304 . 24 clients connected (0 repli
cas), 10315776 bytes in use
1:M 14 Dec 2022 18:00:50.325 - DB 0: 6563 keys (1140 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:50.325 . 24 clients connected (0 repli
cas), 10254504 bytes in use
1:M 14 Dec 2022 18:00:55.342 - DB 0: 6562 keys (1143 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:00:55.342 . 24 clients connected (0 repli

...skipping 1 line
1:M 14 Dec 2022 18:01:00.360 - DB 0: 6562 keys (1143 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:00.360 . 24 clients connected (0 repli
cas), 10209512 bytes in use
1:M 14 Dec 2022 18:01:05.381 - DB 0: 6562 keys (1146 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:05.381 . 24 clients connected (0 repli
cas), 10309016 bytes in use
1:M 14 Dec 2022 18:01:10.399 - DB 0: 6563 keys (1146 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:10.399 . 24 clients connected (0 repli

...skipping 1 line
1:M 14 Dec 2022 18:01:15.019 * 1000 changes in 60 seconds. S
aving...
1:M 14 Dec 2022 18:01:15.020 * Background saving started by
pid 27
27:C 14 Dec 2022 18:01:15.022 - Fork CoW for RDB: current 0
MB, peak 0 MB, average 0 MB
27:C 14 Dec 2022 18:01:15.085 * DB saved on disk
27:C 14 Dec 2022 18:01:15.086 * Fork CoW for RDB: current 0
MB, peak 0 MB, average 0 MB
1:M 14 Dec 2022 18:01:15.120 * Background saving terminated
with success

...skipping 1 line
1:M 14 Dec 2022 18:01:15.421 . 24 clients connected (0 repli
cas), 10212776 bytes in use
1:M 14 Dec 2022 18:01:20.441 - DB 0: 6553 keys (1149 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:20.441 . 24 clients connected (0 repli
cas), 10192304 bytes in use
1:M 14 Dec 2022 18:01:25.460 - DB 0: 6553 keys (1152 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:25.460 . 24 clients connected (0 repli
cas), 10189448 bytes in use
1:M 14 Dec 2022 18:01:30.479 - DB 0: 6553 keys (1152 volatil

...skipping 1 line
1:M 14 Dec 2022 18:01:30.479 . 24 clients connected (0 repli
cas), 10189448 bytes in use
1:M 14 Dec 2022 18:01:35.503 - DB 0: 6553 keys (1155 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:35.503 . 24 clients connected (0 repli
cas), 10186592 bytes in use
1:M 14 Dec 2022 18:01:40.523 - DB 0: 6553 keys (1155 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:40.523 . 24 clients connected (0 repli
cas), 10207064 bytes in use
1:M 14 Dec 2022 18:01:45.543 - DB 0: 6551 keys (1157 volatil

...skipping 1 line
1:M 14 Dec 2022 18:01:45.543 . 24 clients connected (0 repli
cas), 10202824 bytes in use
1:M 14 Dec 2022 18:01:50.561 - DB 0: 6551 keys (1157 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:50.561 . 24 clients connected (0 repli
cas), 10202824 bytes in use
1:M 14 Dec 2022 18:01:55.582 - DB 0: 6546 keys (1160 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:01:55.582 . 24 clients connected (0 repli
cas), 10173504 bytes in use
1:M 14 Dec 2022 18:02:00.603 - DB 0: 6546 keys (1161 volatil

...skipping 1 line
1:M 14 Dec 2022 18:02:00.603 . 24 clients connected (0 repli
cas), 10192880 bytes in use
1:M 14 Dec 2022 18:02:05.622 - DB 0: 6545 keys (1163 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:05.622 . 24 clients connected (0 repli
cas), 10169456 bytes in use
1:M 14 Dec 2022 18:02:10.645 - DB 0: 6546 keys (1167 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:10.645 . 24 clients connected (0 repli
cas), 10290056 bytes in use
1:M 14 Dec 2022 18:02:15.667 - DB 0: 6546 keys (1167 volatil

...skipping 1 line
1:M 14 Dec 2022 18:02:15.667 . 24 clients connected (0 repli
cas), 10208312 bytes in use
1:M 14 Dec 2022 18:02:20.690 - DB 0: 6546 keys (1167 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:20.690 . 24 clients connected (0 repli
cas), 10208312 bytes in use
1:M 14 Dec 2022 18:02:25.713 - DB 0: 6546 keys (1170 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:25.713 . 24 clients connected (0 repli
cas), 10184984 bytes in use
1:M 14 Dec 2022 18:02:30.731 - DB 0: 6545 keys (1171 volatil

...skipping 1 line
1:M 14 Dec 2022 18:02:30.731 . 24 clients connected (0 repli
cas), 10223352 bytes in use
1:M 14 Dec 2022 18:02:35.750 - DB 0: 6541 keys (1173 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:35.750 . 24 clients connected (0 repli
cas), 10154896 bytes in use
1:M 14 Dec 2022 18:02:40.773 - DB 0: 6542 keys (1174 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:40.773 . 24 clients connected (0 repli
cas), 10194824 bytes in use
1:M 14 Dec 2022 18:02:44.425 - Accepted 10.132.15.230:61177

...skipping 1 line
1:M 14 Dec 2022 18:02:45.793 - DB 0: 6541 keys (1176 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:45.793 . 24 clients connected (0 repli
cas), 10172512 bytes in use
1:M 14 Dec 2022 18:02:50.817 - DB 0: 6540 keys (1179 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:50.817 . 24 clients connected (0 repli
cas), 10250272 bytes in use
1:M 14 Dec 2022 18:02:53.786 - Accepted 10.132.15.228:46851
1:M 14 Dec 2022 18:02:55.818 * DB saved on disk
1:M 14 Dec 2022 18:02:55.836 - DB 0: 6539 keys (1179 volatil

...skipping 1 line
1:M 14 Dec 2022 18:02:55.836 . 25 clients connected (0 repli
cas), 10264320 bytes in use
1:M 14 Dec 2022 18:02:56.338 * DB saved on disk
1:M 14 Dec 2022 18:02:57.975 * DB saved on disk
1:M 14 Dec 2022 18:02:58.444 * DB saved on disk
1:M 14 Dec 2022 18:02:58.687 * DB saved on disk
1:M 14 Dec 2022 18:03:00.863 - DB 0: 10 keys (3 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:00.863 . 25 clients connected (0 repli
cas), 3440672 bytes in use
1:M 14 Dec 2022 18:03:01.056 * DB saved on disk

...skipping 1 line
1:M 14 Dec 2022 18:03:01.989 - Client closed connection id=2
9 addr=10.132.15.228:46851 laddr=10.8.1.41:6379 fd=32 name=
age=8 idle=0 flags=N db=0 sub=0 psub=0 ssub=0 multi=-1 qbuf=
0 qbuf-free=20474 argv-mem=0 multi-mem=0 rbs=1024 rbp=97 obl
=0 oll=0 omem=0 tot-mem=22272 events=r cmd=save user=default
 redir=-1 resp=2
1:M 14 Dec 2022 18:03:05.882 - DB 0: 10 keys (3 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:05.882 . 24 clients connected (0 repli
cas), 3418912 bytes in use
1:M 14 Dec 2022 18:03:10.900 - DB 0: 12 keys (5 volatile) in
...back 1 page
1:M 14 Dec 2022 18:02:40.773 - DB 0: 6542 keys (1174 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:40.773 . 24 clients connected (0 repli
cas), 10194824 bytes in use
1:M 14 Dec 2022 18:02:44.425 - Accepted 10.132.15.230:61177
1:M 14 Dec 2022 18:02:44.639 - Reading from client: Connecti
on reset by peer
1:M 14 Dec 2022 18:02:45.793 - DB 0: 6541 keys (1176 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:45.793 . 24 clients connected (0 repli
cas), 10172512 bytes in use

...skipping 1 line
1:M 14 Dec 2022 18:02:50.817 . 24 clients connected (0 repli
cas), 10250272 bytes in use
1:M 14 Dec 2022 18:02:53.786 - Accepted 10.132.15.228:46851
1:M 14 Dec 2022 18:02:55.818 * DB saved on disk
1:M 14 Dec 2022 18:02:55.836 - DB 0: 6539 keys (1179 volatil
e) in 8192 slots HT.
1:M 14 Dec 2022 18:02:55.836 . 25 clients connected (0 repli
cas), 10264320 bytes in use
1:M 14 Dec 2022 18:02:56.338 * DB saved on disk
1:M 14 Dec 2022 18:02:57.975 * DB saved on disk
1:M 14 Dec 2022 18:02:58.444 * DB saved on disk

...skipping 1 line
1:M 14 Dec 2022 18:03:00.863 - DB 0: 10 keys (3 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:00.863 . 25 clients connected (0 repli
cas), 3440672 bytes in use
1:M 14 Dec 2022 18:03:01.056 * DB saved on disk
1:M 14 Dec 2022 18:03:01.756 * DB saved on disk
1:M 14 Dec 2022 18:03:01.989 - Client closed connection id=2
9 addr=10.132.15.228:46851 laddr=10.8.1.41:6379 fd=32 name=
age=8 idle=0 flags=N db=0 sub=0 psub=0 ssub=0 multi=-1 qbuf=
0 qbuf-free=20474 argv-mem=0 multi-mem=0 rbs=1024 rbp=97 obl
=0 oll=0 omem=0 tot-mem=22272 events=r cmd=save user=default

...skipping 1 line
1:M 14 Dec 2022 18:03:05.882 - DB 0: 10 keys (3 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:05.882 . 24 clients connected (0 repli
cas), 3418912 bytes in use
1:M 14 Dec 2022 18:03:10.900 - DB 0: 12 keys (5 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:10.900 . 24 clients connected (0 repli
cas), 3378320 bytes in use
1:M 14 Dec 2022 18:03:15.917 - DB 0: 12 keys (5 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:15.917 . 24 clients connected (0 repli
cas), 3378336 bytes in use
1:M 14 Dec 2022 18:03:20.936 - DB 0: 12 keys (5 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:20.936 . 24 clients connected (0 repli
cas), 3419296 bytes in use
1:M 14 Dec 2022 18:03:25.954 - DB 0: 12 keys (5 volatile) in
 16 slots HT.
1:M 14 Dec 2022 18:03:25.954 . 24 clients connected (0 repli
cas), 3378304 bytes in use


来源: stackexchange

问:
Have CMAKE delete old coverage data
I am using CMAKE to for building and testing. I have it running code coverage. However, when I change the test source, it needs to clear the coverage data for the file being tested, but not other files.

For example, I touch TEST_Outputs.c but not Outputs.c. This causes TEST_Outputs.exe to be built.
This causes add_custom_command to execute TEST_Outputs.exe. A new TEST_Outputs.c.gcda is created. However, since Outputs.c was not rebuild, Outputs.c.gcda is not changed and accumulates coverage data from both the old set of tests and the new set of tests. I want to clear Outputs.c.gcda but not say Inputs.c.gcda.

My build folder has the following tree where the offending gcda are located in the .CMakeFiles/TEST_Outputs.dir/--/src/Outputs folder.

```<code>└───CMakeFiles
    ├───Test_LogicIn_Init.dir
    │   ├───mocks
    │   └───__
    │       └───src
    │           └───LogicIn
    ├───TEST_Outputs.dir
    │   ├───mocks
    │   └───__
    │       └───src
    │           └───Outputs
    └───TEST_SysStatus.dir
        ├───mocks
        └───__
            └───src
                └───System
</code>```

CMakeLists.txt

```<code>set(CMAKE_BUILD_TYPE Debug)

SET(CMAKE_C_COMPILER C:/MinGW/bin/gcc.exe)

#set(CMAKE_VERBOSE_MAKEFILE ON)

# These arguments to gcc.exe are required in order to generate code coverage data
set(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage")
add_definitions(${GCC_COVERAGE_COMPILE_FLAGS})

include(${CMAKE_CURRENT_SOURCE_DIR}/cmocka-bin/AddCmocka.cmake)

#Add list of tests and their flags

#TEST_LogicIn test
LIST(APPEND tests_names "Test_LogicIn_Init")
LIST(APPEND tests_filename "TEST_LogicIn.c")
LIST(APPEND tests_flags "-Wl,--wrap=x_in_init,--wrap=x_in_get_value")
LIST(APPEND tests_mocks "mocks/mock_LogicIn.c")
LIST(APPEND tests_srcdir "../src/LogicIn/Logicin.c")

#TEST_SysStatus test
LIST(APPEND tests_names "TEST_SysStatus")
LIST(APPEND tests_filename "TEST_SysStatus.c")
LIST(APPEND tests_flags "-Wl,--wrap=x_sys_get_ignition")
LIST(APPEND tests_mocks "mocks/mock_SysStatus.c")
LIST(APPEND tests_srcdir "../src/System/SysStatus.c")

#TEST_Outputs test
LIST(APPEND tests_names "TEST_Outputs")
LIST(APPEND tests_filename "TEST_Outputs.c")
LIST(APPEND tests_flags "-Wl,--wrap=x_out_init,--wrap=x_out_set_value,--wrap=x_out_relay_set")
LIST(APPEND tests_mocks "mocks/mock_Outputs.c")
LIST(APPEND tests_srcdir "../src/Outputs/Outputs.c")

# Declare all tests targets
LIST(LENGTH tests_names count)
MATH(EXPR count "${count} - 1")
FOREACH(i RANGE ${count})
    LIST(GET tests_names ${i} test_name)
    LIST(GET tests_filename ${i} test_filename)
    LIST(GET tests_flags ${i} test_flags)
    LIST(GET tests_mocks ${i} test_mocks)
    LIST(GET tests_srcdir ${i} test_srcdir)
    ADD_EXECUTABLE(${test_name} ${test_filename} ${test_mocks} ${CMAKE_CURRENT_SOURCE_DIR}/${test_srcdir})
    TARGET_LINK_LIBRARIES(
        ${test_name}
        PRIVATE
        cmocka
        ${CMAKE_PROJECT_NAME}
        gcov
    )
    set_target_properties(
        ${test_name}
        PROPERTIES
        LINK_FLAGS ${test_flags}
        )

    ADD_CMOCKA_TEST(${test_name} ${test_srcdir})
ENDFOREACH()
</code>```

AddCmocka.cmake

```<code>set(CMAKE_BUILD_TYPE Debug)

add_library(cmocka SHARED IMPORTED GLOBAL)

target_include_directories(cmocka INTERFACE ${CMAKE_CURRENT_LIST_DIR})

set_target_properties(cmocka
                      PROPERTIES
                      IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/cmocka.dll"
                      IMPORTED_IMPLIB "${CMAKE_CURRENT_LIST_DIR}/libcmocka.dll.a"
                     )

file(COPY        "${CMAKE_CURRENT_LIST_DIR}/cmocka.dll"
     DESTINATION "${CMAKE_CURRENT_BINARY_DIR}"
    )

# Macro for adding and creating the test
MACRO(add_cmocka_test executable_name source)

add_test(NAME RunCTest${executable_name}
         COMMAND ${executable_name}
         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
        )

add_custom_command(TARGET ${executable_name}
    #I want to delete old src.c.gcda here
    COMMAND ${executable_name}
    )

ENDMACRO()

</code>```

The way I see it I can,

Add SourceFile.c.gcda to the list of targets somehow so that it is rebuild when the test executable is build. How would I do this?

Use CMake to delete the old *.gcda file. How do I get a reference to the subdirectory?

ContentLicense: CC BY-SA 4.0

Title: Have CMAKE delete old coverage data

Body:
I am using CMAKE to for building and testing. I have it running code coverage. However, when I change the test source, it needs to clear the coverage data for the file being tested, but not other files.

For example, I touch TEST_Outputs.c but not Outputs.c. This causes TEST_Outputs.exe to be built.
This causes add_custom_command to execute TEST_Outputs.exe. A new TEST_Outputs.c.gcda is created. However, since Outputs.c was not rebuild, Outputs.c.gcda is not changed and accumulates coverage data from both the old set of tests and the new set of tests. I want to clear Outputs.c.gcda but not say Inputs.c.gcda.

My build folder has the following tree where the offending gcda are located in the .CMakeFiles/TEST_Outputs.dir/--/src/Outputs folder.

└───CMakeFiles
    ├───Test_LogicIn_Init.dir
    │   ├───mocks
    │   └───__
    │       └───src
    │           └───LogicIn
    ├───TEST_Outputs.dir
    │   ├───mocks
    │   └───__
    │       └───src
    │           └───Outputs
    └───TEST_SysStatus.dir
        ├───mocks
        └───__
            └───src
                └───System

CMakeLists.txt

set(CMAKE_BUILD_TYPE Debug)

SET(CMAKE_C_COMPILER C:/MinGW/bin/gcc.exe)

#set(CMAKE_VERBOSE_MAKEFILE ON)

# These arguments to gcc.exe are required in order to generate code coverage data
set(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage")
add_definitions(${GCC_COVERAGE_COMPILE_FLAGS})

include(${CMAKE_CURRENT_SOURCE_DIR}/cmocka-bin/AddCmocka.cmake)

#Add list of tests and their flags

#TEST_LogicIn test
LIST(APPEND tests_names "Test_LogicIn_Init")
LIST(APPEND tests_filename "TEST_LogicIn.c")
LIST(APPEND tests_flags "-Wl,--wrap=x_in_init,--wrap=x_in_get_value")
LIST(APPEND tests_mocks "mocks/mock_LogicIn.c")
LIST(APPEND tests_srcdir "../src/LogicIn/Logicin.c")

#TEST_SysStatus test
LIST(APPEND tests_names "TEST_SysStatus")
LIST(APPEND tests_filename "TEST_SysStatus.c")
LIST(APPEND tests_flags "-Wl,--wrap=x_sys_get_ignition")
LIST(APPEND tests_mocks "mocks/mock_SysStatus.c")
LIST(APPEND tests_srcdir "../src/System/SysStatus.c")

#TEST_Outputs test
LIST(APPEND tests_names "TEST_Outputs")
LIST(APPEND tests_filename "TEST_Outputs.c")
LIST(APPEND tests_flags "-Wl,--wrap=x_out_init,--wrap=x_out_set_value,--wrap=x_out_relay_set")
LIST(APPEND tests_mocks "mocks/mock_Outputs.c")
LIST(APPEND tests_srcdir "../src/Outputs/Outputs.c")

# Declare all tests targets
LIST(LENGTH tests_names count)
MATH(EXPR count "${count} - 1")
FOREACH(i RANGE ${count})
    LIST(GET tests_names ${i} test_name)
    LIST(GET tests_filename ${i} test_filename)
    LIST(GET tests_flags ${i} test_flags)
    LIST(GET tests_mocks ${i} test_mocks)
    LIST(GET tests_srcdir ${i} test_srcdir)
    ADD_EXECUTABLE(${test_name} ${test_filename} ${test_mocks} ${CMAKE_CURRENT_SOURCE_DIR}/${test_srcdir})
    TARGET_LINK_LIBRARIES(
        ${test_name}
        PRIVATE
        cmocka
        ${CMAKE_PROJECT_NAME}
        gcov
    )
    set_target_properties(
        ${test_name}
        PROPERTIES
        LINK_FLAGS ${test_flags}
        )

    ADD_CMOCKA_TEST(${test_name} ${test_srcdir})
ENDFOREACH()

AddCmocka.cmake

set(CMAKE_BUILD_TYPE Debug)

add_library(cmocka SHARED IMPORTED GLOBAL)

target_include_directories(cmocka INTERFACE ${CMAKE_CURRENT_LIST_DIR})

set_target_properties(cmocka
                      PROPERTIES
                      IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/cmocka.dll"
                      IMPORTED_IMPLIB "${CMAKE_CURRENT_LIST_DIR}/libcmocka.dll.a"
                     )

file(COPY        "${CMAKE_CURRENT_LIST_DIR}/cmocka.dll"
     DESTINATION "${CMAKE_CURRENT_BINARY_DIR}"
    )

# Macro for adding and creating the test
MACRO(add_cmocka_test executable_name source)

add_test(NAME RunCTest${executable_name}
         COMMAND ${executable_name}
         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
        )

add_custom_command(TARGET ${executable_name}
    #I want to delete old src.c.gcda here
    COMMAND ${executable_name}
    )

ENDMACRO()

The way I see it I can,

Add SourceFile.c.gcda to the list of targets somehow so that it is rebuild when the test executable is build. How would I do this?

Use CMake to delete the old *.gcda file. How do I get a reference to the subdirectory?


问:
BizTalk WCF Service and Common Schema Application
I created a BizTalk WCF Service in BizTalk that uses a common schema. The issue is when I send a request to the service, I receive a security error. The site is anonymous authentication.

I removed the reference to the common schema and added the schema files to the BizTalk WCF service project and redeployed. I didn't receive any errors. I would think that since the BizTalk application that is transformed into a web service, has a reference to a common schema, it would be able to access it.

Does anyone know how to work around this?


问:
How to change multiple html elements with php (preg_replace?)
I'm using wordpress and I want to change the logo on some pages. Since the theme I'm using (flatsome) doesn't support this I thought using php would be a good idea. I'm not sure how to do it though.

I tried this:

```<code><?php
function change_logo_on_single($html) {

   if(is_single( array(1441, 1425, 1501, 1494, 1498, 1503))){
      $html = preg_replace('<a(.*?)><img(.*?)><img(.*?)></a>',
'<a href="https://example.com/" title="" rel="home">
        <img width="146" height="150" src="https://example.com/wp-content/uploads/2021/02/Logo.png" class="header_logo header-logo" alt="">
        <img width="146" height="150" src="https://example.com/wp-content/uploads/2021/02/Logo.png" class="header-logo-dark" alt="">
</a>', $html);
   }

   return $html;
}

add_filter('get_custom_logo','change_logo_on_single');
?>
</code>```

I think I used the wrong pattern in preg_replace. Can someone suggest a way to do it?

Body:
I'm using wordpress and I want to change the logo on some pages. Since the theme I'm using (flatsome) doesn't support this I thought using php would be a good idea. I'm not sure how to do it though.

I tried this:

<?php
function change_logo_on_single($html) {

   if(is_single( array(1441, 1425, 1501, 1494, 1498, 1503))){
      $html = preg_replace('',
'

', $html);
   }

   return $html;
}

add_filter('get_custom_logo','change_logo_on_single');
?>

I think I used the wrong pattern in preg_replace. Can someone suggest a way to do it?


问:
Boolean algebra formula conversion to RPN (reverse polish notation or postfix form)
You need to enter a Boolean algebra formula, for example X v Y, convert it into a postfix form - XYv and calculate the result. The X and Y values (1 or 0) are set by the user.
I made an algorithm that converts simple expressions like X v Y, X ^ Y (v, ^ - disjunction, conjunction). But there is a need for an algorithm that can transform a more complex expression, for example: ~X v Y -> Y.</p>
```<code>let temp = "XvY"
let X = 0
let Y = 0
function first(){
     let form = ""
     form += temp[0]
     form += temp[2]
     form += temp[1]
     console.log(form)
 }
first()
</code>```

Body:
You need to enter a Boolean algebra formula, for example X v Y, convert it into a postfix form - XYv and calculate the result. The X and Y values (1 or 0) are set by the user.
I made an algorithm that converts simple expressions like X v Y, X ^ Y (v, ^ - disjunction, conjunction). But there is a need for an algorithm that can transform a more complex expression, for example: ~X v Y -> Y.

let temp = "XvY"
let X = 0
let Y = 0
function first(){
     let form = ""
     form += temp[0]
     form += temp[2]
     form += temp[1]
     console.log(form)
 }
first()


问:
How to fix the relative positions of a subset of vertices in a network/graph in ggraph R package?
I'm graphing several directed networks in R using the packages igraph and ggraph and need to be able to fix the relative positions of 4-6 vertices, depending on the network being graphed. The rest of the vertices (100+) will essentially form star graphs around these fixed vertices.

Here is an example of the type of graph that I would like to end up with:

What's important to me is that vertices A to D are arranged in the order shown in the photo and that the positions of vertices v1 to v7 are arranged to minimize crossing arcs.

I know that you can manually specify the positions of each vertex in ggraph using create_layout() and modifying the x and y values in the dataframe that is returned by create_layout(). (This is how I created the graph in the photo above and the code for it is below).

But manually specifying the vertex positions is time-consuming, so I'm looking for an alternative solution.

For example, is it possible to first manually specify the positions of vertices A-D and then somehow use an algorithm to determine the positions of the other vertices?

Phrased another way, how can I get from graph to  customGraph (or something similar; see code below) without having to manually specify all vertex coordinates?

Here's reproducible code with the example network I've been referring to:

```<code>
# Create dataframe -------------------------------------------------------------

arcList <- data.frame(from = c('A', 'A', 'B', 'B', 'C', 'v1', 'v2', 'v3', 'v3',
                               'v4', 'v5', 'v6', 'v7'),
                      to   = c('B', 'C', 'C', 'D', 'D', 'A',   'A', 'A', 'B',
                               'B', 'C', 'D', 'D'))

# Create network ---------------------------------------------------------------

network <- arcList %>%
  graph_from_data_frame(directed = TRUE)

# Graph network ----------------------------------------------------------------

# plot network with a preset layout (ex. kamada-kawai)
graph <- ggraph(network, layout = 'kk') +
  geom_edge_fan(arrow = arrow(length = unit(2, 'mm'))) +
  geom_node_point() +
  geom_node_text(aes(label = name), repel = TRUE)
graph

# create layout with a preset layout (ex. kamada-kawai; x, y positions correspond
#                                         to the vertex positions in `graph`)
customLayout <- create_layout(network, layout = 'kk')

# manually change node positions
customLayout$x <- c(-1, 0, 0, -1.4, -1.4, -1.3, 0.5, -0.5, 1.4, 1.4, 1)
customLayout$y <- c(0,  1, -1, 0.5, -0.5, 1,   0.9, -0.9, 0.5, -0.5, 0)

# plot network with custom layout
customGraph <- ggraph(customLayout) +
  geom_edge_fan(arrow = arrow(length = unit(2, 'mm'))) +
  geom_node_point() +
  geom_node_text(aes(label = name), repel = TRUE)
customGraph

</code>```

Body:
I'm graphing several directed networks in R using the packages igraph and ggraph and need to be able to fix the relative positions of 4-6 vertices, depending on the network being graphed. The rest of the vertices (100+) will essentially form star graphs around these fixed vertices.

Here is an example of the type of graph that I would like to end up with:

What's important to me is that vertices A to D are arranged in the order shown in the photo and that the positions of vertices v1 to v7 are arranged to minimize crossing arcs.

I know that you can manually specify the positions of each vertex in ggraph using create_layout() and modifying the x and y values in the dataframe that is returned by create_layout(). (This is how I created the graph in the photo above and the code for it is below).

But manually specifying the vertex positions is time-consuming, so I'm looking for an alternative solution.

For example, is it possible to first manually specify the positions of vertices A-D and then somehow use an algorithm to determine the positions of the other vertices?

Phrased another way, how can I get from graph to  customGraph (or something similar; see code below) without having to manually specify all vertex coordinates?

Here's reproducible code with the example network I've been referring to:

# Create dataframe -------------------------------------------------------------

arcList <- data.frame(from = c('A', 'A', 'B', 'B', 'C', 'v1', 'v2', 'v3', 'v3',
                               'v4', 'v5', 'v6', 'v7'),
                      to   = c('B', 'C', 'C', 'D', 'D', 'A',   'A', 'A', 'B',
                               'B', 'C', 'D', 'D'))

# Create network ---------------------------------------------------------------

network <- arcList %>%
  graph_from_data_frame(directed = TRUE)

# Graph network ----------------------------------------------------------------

# plot network with a preset layout (ex. kamada-kawai)
graph <- ggraph(network, layout = 'kk') +
  geom_edge_fan(arrow = arrow(length = unit(2, 'mm'))) +
  geom_node_point() +
  geom_node_text(aes(label = name), repel = TRUE)
graph

# create layout with a preset layout (ex. kamada-kawai; x, y positions correspond
#                                         to the vertex positions in `graph`)
customLayout <- create_layout(network, layout = 'kk')

# manually change node positions
customLayout$x <- c(-1, 0, 0, -1.4, -1.4, -1.3, 0.5, -0.5, 1.4, 1.4, 1)
customLayout$y <- c(0,  1, -1, 0.5, -0.5, 1,   0.9, -0.9, 0.5, -0.5, 0)

# plot network with custom layout
customGraph <- ggraph(customLayout) +
  geom_edge_fan(arrow = arrow(length = unit(2, 'mm'))) +
  geom_node_point() +
  geom_node_text(aes(label = name), repel = TRUE)
customGraph


问:
QT Creator: Set QDoubespinbox LaTeX or mathematical symbol as suffix
I am creating a GUI with QTCreator and want to have p.E. h^-1 as a suffix for my QDoubleSpinBox.

QDoubleSpinBox with suffix

wanted suffix for QDoubleSpinBox

Im using QTCreator for qt5

Thanks in advance!

I tried it with  "h -1" but it doesnt recognize it.


问:
EhCache 3 Configuration not working with simple configuration of springboot
Below is my Simple Config Class

```<code>package com.mcd.restaurantmanager.product.config;

import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Configuration;

@EnableCaching
@Configuration
public class CacheConfig {
}
</code>```

Below is my ehcache.xml

```<code><config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://www.ehcache.org/v3"
        xmlns:jsr107="http://www.ehcache.org/v3/jsr107"
        xsi:schemaLocation="
            http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.0.xsd
            http://www.ehcache.org/v3/jsr107 http://www.ehcache.org/schema/ehcache-107-ext-3.0.xsd">

    <cache alias="hierarchyLevelByRestaurantGroupId">
        <key-type>java.math.BigDecimal</key-type>
        <value-type>java.lang.String</value-type>
        <expiry>
            <ttl unit="seconds">30</ttl>
        </expiry>

        <listeners>
            <listener>
                <class>com.mcd.restaurantmanager.product.service.CustomCacheEventLogger</class>
                <event-firing-mode>ASYNCHRONOUS</event-firing-mode>
                <event-ordering-mode>UNORDERED</event-ordering-mode>
                <events-to-fire-on>CREATED</events-to-fire-on>
                <events-to-fire-on>EXPIRED</events-to-fire-on>
            </listener>
        </listeners>

        <resources>
            <heap unit="entries">2</heap>
            <offheap unit="MB">10</offheap>
        </resources>
    </cache>

    <cache-template name="default">
        <expiry>
            <ttl unit="seconds">30</ttl>
        </expiry>
        <listeners>
            <listener>
                <class>guru.springframework.ehcache.config.CacheLogger</class>
                <event-firing-mode>ASYNCHRONOUS</event-firing-mode>
                <event-ordering-mode>UNORDERED</event-ordering-mode>
                <events-to-fire-on>CREATED</events-to-fire-on>
                <events-to-fire-on>EXPIRED</events-to-fire-on>
                <events-to-fire-on>EVICTED</events-to-fire-on>
            </listener>
        </listeners>
        <resources>
            <heap>1000</heap>
            <offheap unit="MB">10</offheap>
            <disk persistent="true" unit="MB">20</disk>
        </resources>
    </cache-template>

</config>
</code>```

Below is how I am using caching with methods

```<code>  @Cacheable(value = "id", key = "#restaurantGroupId")
    public String getLevel(BigDecimal id, String somRandom) {
        return getGroups(somRandom).stream()
                .filter(restaurantGroup -> restaurantGroup.getId().equals(id))
                .map(restaurantGroup -> restaurantGroup.getLevel().getValue())
                .findFirst()
                .orElse(null);
    }
</code>```

This is my listener

```<code>package com.mcd.restaurantmanager.product.service;

import lombok.extern.slf4j.Slf4j;
import org.ehcache.event.CacheEvent;
import org.ehcache.event.CacheEventListener;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class CustomCacheEventLogger implements CacheEventListener<Object, Object> {
    @Override
    public void onEvent(CacheEvent<?, ?> event) {
        log.info("Cache event = {}, Key = {},  Old value = {}, New value = {}",
                event.getType(),
                event.getKey(),
                event.getOldValue(),
                event.getNewValue());
    }
}
</code>```

I am not sure if I missed something, but I am getting below error

A component required a bean of type 'org.springframework.cache.CacheManager' that could not be found.

Please let me know what I am missing, I am using ehcache 3.

Body:
Below is my Simple Config Class

package com.mcd.restaurantmanager.product.config;

import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Configuration;

@EnableCaching
@Configuration
public class CacheConfig {
}

Below is my ehcache.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://www.ehcache.org/v3"
        xmlns:jsr107="http://www.ehcache.org/v3/jsr107"
        xsi:schemaLocation="
            http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.0.xsd
            http://www.ehcache.org/v3/jsr107 http://www.ehcache.org/schema/ehcache-107-ext-3.0.xsd">

    <cache alias="hierarchyLevelByRestaurantGroupId">
        <key-type>java.math.BigDecimal</key-type>
        <value-type>java.lang.String</value-type>
        <expiry>
            <ttl unit="seconds">30</ttl>
        </expiry>

        <listeners>
            <listener>
                <class>com.mcd.restaurantmanager.product.service.CustomCacheEventLogger</class>
                <event-firing-mode>ASYNCHRONOUS</event-firing-mode>
                <event-ordering-mode>UNORDERED</event-ordering-mode>
                <events-to-fire-on>CREATED</events-to-fire-on>
                <events-to-fire-on>EXPIRED</events-to-fire-on>
            </listener>
        </listeners>

        <resources>
            <heap unit="entries">2</heap>
            <offheap unit="MB">10</offheap>
        </resources>
    </cache>

    <cache-template name="default">
        <expiry>
            <ttl unit="seconds">30</ttl>
        </expiry>
        <listeners>
            <listener>
                <class>guru.springframework.ehcache.config.CacheLogger</class>
                <event-firing-mode>ASYNCHRONOUS</event-firing-mode>
                <event-ordering-mode>UNORDERED</event-ordering-mode>
                <events-to-fire-on>CREATED</events-to-fire-on>
                <events-to-fire-on>EXPIRED</events-to-fire-on>
                <events-to-fire-on>EVICTED</events-to-fire-on>
            </listener>
        </listeners>
        <resources>
            <heap>1000</heap>
            <offheap unit="MB">10</offheap>
            <disk persistent="true" unit="MB">20</disk>
        </resources>
    </cache-template>

</config>

Below is how I am using caching with methods

  @Cacheable(value = "id", key = "#restaurantGroupId")
    public String getLevel(BigDecimal id, String somRandom) {
        return getGroups(somRandom).stream()
                .filter(restaurantGroup -> restaurantGroup.getId().equals(id))
                .map(restaurantGroup -> restaurantGroup.getLevel().getValue())
                .findFirst()
                .orElse(null);
    }

This is my listener

package com.mcd.restaurantmanager.product.service;

import lombok.extern.slf4j.Slf4j;
import org.ehcache.event.CacheEvent;
import org.ehcache.event.CacheEventListener;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class CustomCacheEventLogger implements CacheEventListener<Object, Object> {
    @Override
    public void onEvent(CacheEvent<?, ?> event) {
        log.info("Cache event = {}, Key = {},  Old value = {}, New value = {}",
                event.getType(),
                event.getKey(),
                event.getOldValue(),
                event.getNewValue());
    }
}

I am not sure if I missed something, but I am getting below error

A component required a bean of type 'org.springframework.cache.CacheManager' that could not be found.

Please let me know what I am missing, I am using ehcache 3.


问:
filter multiple vectors in a Struct of Arrays with rayon
I have a Struct of Vectors that I'm trying to filter based off precomputed indices of out-of-scope particles for a particle-in-cell program.

each index will be filtered as a group, so each resulting array will be exactly the same length (self.len()-off_grid.len())

the results will be stored back in the original struct, and since there isn't a parallel retain function, I was attempting this by creating temporary vectors for the results

I'm trying to avoid cloning before iterating because each of these will have thousands of elements

ExtendTuple3 is a helper struct for extending multiple vectors

however, each method I come up with for filter followed by overwrite, comes afoul of the borrow checker.
this is the particles struct:

#[derive(Debug)]
pub struct Particles {
    pub velocities: Vec<na::Vector3<f64>>,
    pub positions: Vec<na::Vector3<f64>>,
    pub types: Vec<ParticleType>,
}
```
<p>this is the function</p>
<pre class="lang-rust prettyprint-override"><code>pub(crate) fn filter_out_of_scope(&mut self, off_grid: &Vec<usize>) {
    let Particles {
        velocities,
        positions,
        types,
    } = self;

    let mut keep: Vec<bool> = vec![true; velocities.len()];
    for i in off_grid.iter() {
        keep[*i] = false;
    }
    let mut tmp_vel = Vec::with_capacity(velocities.len());
    let mut tmp_pos = Vec::with_capacity(velocities.len());
    let mut tmp_typ = Vec::with_capacity(velocities.len());

    ExtendTuple3::new((&mut tmp_vel, &mut tmp_pos, &mut tmp_typ)).par_extend(
        (velocities, positions, types, keep)
            .into_par_iter()
            .filter_map(
                |(vel, pos, typ, keep)| {
                    if keep {
                        Some((*vel, *pos, *typ))
                    } else {
                        None
                    }
                },
            ),
    );
    std::mem::replace(velocities, tmp_vel); // * velocities = tmp_vel;
    *positions = tmp_pos;
    *types = tmp_typ;
}
</code>```

What I've tried

dereference and assign, like *positions = tmp_pos and std::mem::replace(current,tmp), both of these complain that the vectors are borrowed after move

deference in the original iterator, however type is a vector of enums, and I'm having trouble derefencing it, and deref seems to not be implemented for Vector3

create a new vector of structs and overwrite *self, but this is a keyword thus can't be overwritten

what's the best way to handle this particular situation?

Body:
I have a Struct of Vectors that I'm trying to filter based off precomputed indices of out-of-scope particles for a particle-in-cell program.

each index will be filtered as a group, so each resulting array will be exactly the same length (self.len()-off_grid.len())

the results will be stored back in the original struct, and since there isn't a parallel retain function, I was attempting this by creating temporary vectors for the results

I'm trying to avoid cloning before iterating because each of these will have thousands of elements

ExtendTuple3 is a helper struct for extending multiple vectors

however, each method I come up with for filter followed by overwrite, comes afoul of the borrow checker.
this is the particles struct:

#[derive(Debug)]
pub struct Particles {
    pub velocities: Vec<na::Vector3<f64>>,
    pub positions: Vec<na::Vector3<f64>>,
    pub types: Vec<ParticleType>,
}

this is the function

pub(crate) fn filter_out_of_scope(&mut self, off_grid: &Vec<usize>) {
    let Particles {
        velocities,
        positions,
        types,
    } = self;

    let mut keep: Vec<bool> = vec![true; velocities.len()];
    for i in off_grid.iter() {
        keep[*i] = false;
    }
    let mut tmp_vel = Vec::with_capacity(velocities.len());
    let mut tmp_pos = Vec::with_capacity(velocities.len());
    let mut tmp_typ = Vec::with_capacity(velocities.len());

    ExtendTuple3::new((&mut tmp_vel, &mut tmp_pos, &mut tmp_typ)).par_extend(
        (velocities, positions, types, keep)
            .into_par_iter()
            .filter_map(
                |(vel, pos, typ, keep)| {
                    if keep {
                        Some((*vel, *pos, *typ))
                    } else {
                        None
                    }
                },
            ),
    );
    std::mem::replace(velocities, tmp_vel); // * velocities = tmp_vel;
    *positions = tmp_pos;
    *types = tmp_typ;
}

What I've tried

dereference and assign, like *positions = tmp_pos and std::mem::replace(current,tmp), both of these complain that the vectors are borrowed after move

deference in the original iterator, however type is a vector of enums, and I'm having trouble derefencing it, and deref seems to not be implemented for Vector3

create a new vector of structs and overwrite *self, but this is a keyword thus can't be overwritten

what's the best way to handle this particular situation?


问:
Radio button selections not visible to user in Windows High Contrast Mode
So I'm working on an issue with Salesforce Lightning Web Components Radio Buttons. This issue is when enabling a Contrast Theme on Windows, any radio button selection is no longer visible to the user. So far I have tried changing the border and fill color of the radio buttons in hopes that when selecting the contrast theme, the inverted colors would be visible but no luck. I also tried using the "forced-colors" css style but no luck with that either.

Has anyone else dealt with this issue?


问:
Python Diff script with ignoring order(sorting)
I've two directories with files that i need to compare with each other. the file names are exactly the same. I've written a script to check the diff but the sorting of the content is different, en can also be different. Is there a way to ignore the sorting of the data inside the txt files?

I've tried to work with DeepDiff but coulndt figure it out. I've written this simple script :

```<code>import os.path
import difflib

klanten = ["4minutes",
           "6point",
           "24indoor"
           ]

for klant in klanten:
    old = os.path.join("C://Users//user//Desktop//pars//old//", klant + ".txt")
    new = os.path.join("C://Users//user//Desktop//pars//new//", klant + ".txt")
    with open(old, encoding='UTF-8') as file_1:
        file_1_text = file_1.readlines()
    with open(new, encoding='UTF-8') as file_2:
        file_2_text = file_2.readlines()
    for line in difflib.unified_diff(
        file_1_text, file_2_text, fromfile=old,
        tofile=new, lineterm=''):
        with open("differences.txt", "a", encoding='UTF-8') as dt:
            dt.write(line)
</code>```

Body:
I've two directories with files that i need to compare with each other. the file names are exactly the same. I've written a script to check the diff but the sorting of the content is different, en can also be different. Is there a way to ignore the sorting of the data inside the txt files?

I've tried to work with DeepDiff but coulndt figure it out. I've written this simple script :

import os.path
import difflib

klanten = ["4minutes",
           "6point",
           "24indoor"
           ]

for klant in klanten:
    old = os.path.join("C://Users//user//Desktop//pars//old//", klant + ".txt")
    new = os.path.join("C://Users//user//Desktop//pars//new//", klant + ".txt")
    with open(old, encoding='UTF-8') as file_1:
        file_1_text = file_1.readlines()
    with open(new, encoding='UTF-8') as file_2:
        file_2_text = file_2.readlines()
    for line in difflib.unified_diff(
        file_1_text, file_2_text, fromfile=old,
        tofile=new, lineterm=''):
        with open("differences.txt", "a", encoding='UTF-8') as dt:
            dt.write(line)


问:
Delete/Squash old commits while keeping the changes that they introduced
I'm trying to delete/squash a bunch of old commits that I don't want on my git history which were just made to put together code from multiple locations that were not using git (local folders from other programmers)

This is how the actual git history looks:

Git history

What I want is to keep from A to N (newest) and either delete everything else or squash it into A.

I've tried two things

git rebase -i --root -xtheirs

and then mark from the root to 'A' to squash, but it ended changing some parts of code, which from what i've understood while researching is because of the old merge commits trying to re-do the merge commits.

I've also tried to use the param --rebase-merges but ended with wrong code too.

The other thing that I tried is to just do

git rebase -i --root

and delete everything between 'A' and root. But it also deleted all the code that were introduced in those commits.

As you might have guessed I'm pretty new to this kind of git commands so any explanation would be appreciated.

Other approaches are also welcome!

Edit: As @TTT noted in the comments, this is a duplicate of How to remove all but last n commits from git history to save space, which has a good answer.


问:
Javascript button onclick not working on Mobile browser
Button onclick using mobile browser does not work. It works fine on laptop browser.

Here is my Javascript code:

```<code><button class="btn btn-info" id="button1" style="margin:5px" onClick="myupdate()">Check Services</button>

function myupdate(event) {
        socket.emit("my_event", function(msg) {
       });
}
</code>```

Body:
Button onclick using mobile browser does not work. It works fine on laptop browser.

Here is my Javascript code:

<button class="btn btn-info" id="button1" style="margin:5px" onClick="myupdate()">Check Services</button>

function myupdate(event) {
        socket.emit("my_event", function(msg) {
       });
}


问:
Extracted my directory files as txt and need to convert to dataframe or csv

I have a set of files that I need to use their modified date as an identifier with Rstudio. I was able to extract the directory as a txt file successfully. Now, I need to convert this .txt to .csv. I tried most of the codes but I still have the problem. I need to sparse it into rows and columns ending with a .csv file.

I tried to use different codes but all of them with warnings.

my text file:

```<code>Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---l        11/30/2022   4:08 PM          13823 TT3 - 2022-11-30 16-08-36.PL3
-a---l        11/30/2022   4:08 PM          13823 TT3  - 2022-11-30 16-08-46.PL3
-a---l        11/30/2022   4:08 PM          13823 TT3  - 2022-11-30 16-08-55.PL3
-a---l        11/30/2022   4:09 PM          13823 TTT3 - 2022-11-30 16-09-04.PL3
</code>```

this is an example of my needed column names and its data:

```<code>Mode   -a---l
Date   11/30/2022
Time   4:08 PM
Length 13823
Name   TT3 - 2022-11-30 16-08-36.PL3
</code>```

Body:
I have a set of files that I need to use their modified date as an identifier with Rstudio. I was able to extract the directory as a txt file successfully. Now, I need to convert this .txt to .csv. I tried most of the codes but I still have the problem. I need to sparse it into rows and columns ending with a .csv file.

I tried to use different codes but all of them with warnings.

my text file:

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---l        11/30/2022   4:08 PM          13823 TT3 - 2022-11-30 16-08-36.PL3
-a---l        11/30/2022   4:08 PM          13823 TT3  - 2022-11-30 16-08-46.PL3
-a---l        11/30/2022   4:08 PM          13823 TT3  - 2022-11-30 16-08-55.PL3
-a---l        11/30/2022   4:09 PM          13823 TTT3 - 2022-11-30 16-09-04.PL3

this is an example of my needed column names and its data:

Mode   -a---l
Date   11/30/2022
Time   4:08 PM
Length 13823
Name   TT3 - 2022-11-30 16-08-36.PL3


问:
Optimizing using Cython for Python Objects with hidden class implementation
Let's say I have a class as below:

```<code>class A():
    def __init__(self,python_object):
        self.my_python_object = python_object

    def my_function(self):
        for item in self.my_python_object.getItems():
            item.do_something()
</code>```

In the above class, the implementation/class of the initial "python_object" instance is unknown, and I get this object via an API. Most of my code revolves around calling methods from this API's object. The cython implementation I have created is like below,

```<code>cdef class A():
    cdef public object my_python_object
    def __init__(self,python_object):
        self.my_python_object = python_object

    cdef void my_function(self):
        cdef object item
        for item in self.my_python_object.getItems():
            item.do_something()
</code>```

Since it is not a primitive type, the cython/c optimization does not work as it should(I think because defining a variable as an "object" type is the same as not defining it at all in the context of performance improvement) and a lot of Python/C API calls are made reducing the overall performance of the program.

Is there a way to let cython know or define some sort of dummy structure which specifies that the "python_object" has only said functions which return said type of values without actually knowing the original class structure of "python_object". I am thinking by doing this, cython can reduce the Python/C API calls.

Body:
Let's say I have a class as below:

class A():
    def __init__(self,python_object):
        self.my_python_object = python_object

    def my_function(self):
        for item in self.my_python_object.getItems():
            item.do_something()

In the above class, the implementation/class of the initial "python_object" instance is unknown, and I get this object via an API. Most of my code revolves around calling methods from this API's object. The cython implementation I have created is like below,

cdef class A():
    cdef public object my_python_object
    def __init__(self,python_object):
        self.my_python_object = python_object

    cdef void my_function(self):
        cdef object item
        for item in self.my_python_object.getItems():
            item.do_something()

Since it is not a primitive type, the cython/c optimization does not work as it should(I think because defining a variable as an "object" type is the same as not defining it at all in the context of performance improvement) and a lot of Python/C API calls are made reducing the overall performance of the program.

Is there a way to let cython know or define some sort of dummy structure which specifies that the "python_object" has only said functions which return said type of values without actually knowing the original class structure of "python_object". I am thinking by doing this, cython can reduce the Python/C API calls.


问:
Stripe PaymentElement intermittently not displaying
I'm having a problem with Stripe's PaymentElement react component.  It displays correctly but only sometimes.  After doing multiple reloads/restarts of the entire react app, and multiple CTRL+F5, the form intermittently doesn't display.  There doesn't seem to be any pattern to the times when it displays correctly nor the times when it fails to display.

When the modal displays, correct display of the payment form including PaymentElement component looks like this:

When the PaymentElement fails to display, there are two possible appearances.  Either it shows the form fields with nothing in them:

Or the entire iFrame is empty, no fields or labels or any HTML content within the body.

I followed this documentation to integrate the Elements and PaymentElements components into my react app.

Initially I was developing using public and secret keys issued to a free trial account.  It was hoped that switching to paid might make a difference, but now that I'm using paid keys I'm getting the same intermittent results with the PaymentElement sometimes not displaying.

I keep comparing my code to the docs and can't find what I've missed.  As per the docs, the stripe promise is instantiated outside the component's rendering.

```<code>import { useState, useEffect, useRef } from 'react';
import './App.css';
import DynamicTextArea from './components/DynamicTextArea';
import MultiSelect from "./components/MultiSelect";
import CheckoutForm from './components/CheckoutForm';
import ReCAPTCHA from "react-google-recaptcha";

import { loadStripe } from "@stripe/stripe-js";
import { Elements } from "@stripe/react-stripe-js";

const stripePromise = loadStripe("pk_test_xxxxxxxx");

function App() {
</code>```

Payment intent is created with useEffect and an emtpy array so it triggers after page load.  This react app is backed by a REST API (.NET6) which handles the calls to Stripe and returns the client secret.

```<code>const createPaymentIntent = () => {
    // Create PaymentIntent as soon as the page loads
    fetch("/payments/create-payment-intent", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ items: [{ id: "product001" }] }),
    })
        .then((res) => res.json())
        .then((data) => setClientSecret(data.clientSecret));
}

const showPaymentForm = async () => {
    setPaymentModalOptions({...paymentModalOptions, visible: true});
}

useEffect(() => {
    createPaymentIntent();
}, []);
</code>```

Options to pass to the PaymentElement component, which is wrapped in a CheckoutForm component as per the docs:

```<code>const options = {
    clientSecret: clientSecret,
    appearance: {
        theme: 'stripe',
    }
};
</code>```

The Stripe Elements component is wrapped in a bootstrap modal.  To be clear, the modal always displays correctly, but intermittently the PaymentElement within the modal does not display.

```<code>    <div id="payment-modal" className={`modal ${paymentModalOptions.visible ? 'modal-show' : ''}`} role="dialog">
        <div className="modal-dialog" role="document">
            <div className="modal-content">
                <div className="modal-body">
                    {clientSecret && (
                        <Elements options={options} stripe={stripePromise}>
                            <CheckoutForm onPaymentSucceeded={handlePaymentSucceeded} onCancelPayment={handlePaymentCancelled}/>
                        </Elements>
                    )}
                </div>
            </div>
        </div>
    </div>
</code>```

Lastly, the CheckouForm component where the PaymentElement actually resides.

```<code>import { useEffect, useState } from "react";
import {
  PaymentElement,
  useStripe,
  useElements
} from "@stripe/react-stripe-js";

import './CheckoutForm.css';

export default function CheckoutForm(props) {
  const stripe = useStripe();
  const elements = useElements();
  const [message, setMessage] = useState(null);
  const [paymentIsLoading, setPaymentIsLoading] = useState(false);

  const paymentElementOptions = {
    layout: "tabs"
  }

  const delay = async (ms) => new Promise(res => setTimeout(res, ms));

  const handleSubmit = async (evt) => {
    evt.preventDefault();

    if (!stripe || !elements) {
      // Stripe.js has not yet loaded.
      // Make sure to disable form submission until Stripe.js has loaded.
      return;
    }

    setPaymentIsLoading(true);

    const paymentResult = await stripe.confirmPayment({
      elements,
      confirmParams: {
        // Make sure to change this to your payment completion page
        return_url: "http://localhost:44472",
      },
      redirect: 'if_required'
    });

    if (paymentResult.paymentIntent.status === 'succeeded') {
      setMessage("Payment successful!");

      // wait two seconds, then close the payment modal
      await delay(2000);
      props.onPaymentSucceeded();

    } else {
      setMessage("Payment unsuccessful");
    }

    setPaymentIsLoading(false);
  }

  return (
    <form id="payment-form" onSubmit={handleSubmit}>
        <PaymentElement id="payment-element" options={paymentElementOptions} />
          <div id="payment-buttons-wrapper">
              <div className="payment-button-group">
                  {paymentIsLoading ?
                      <div className="spinner-border text-secondary" id="payment-spinner" role="status"></div>
                      : <button disabled={paymentIsLoading || !stripe || !elements} id="submit" className="btn btn-light border">
                          <span id="button-text">Pay now</span>
                        </button>
                  }
              </div>

              <button onClick={props.onCancelPayment} className="btn btn-light border">Cancel</button>
          </div>

      {/* Show any error or success messages */}
      {message && <div id="payment-message">{message}</div>}
    </form>
  );
}
</code>```

I've seen intermittent rendering problems in React before and its often caused because of a pending response to an async call, or failing to use useEffect() correctly (I've done it multiple times).  In this case I don't see where I'm going wrong.  Thanks for your help.

UPDATE:
This error appears in the console intermittently.  The error sometimes appears even when the PaymentElement displays correctly.  Other times the error doesn't appear even though the Payment Element fails to display.  I'm not convinced they are connected.

UPDATE: I have reached out to Stripe support on this.  In the meantime I'm sharing an additional screenshot.  Sometimes when the form fails to display, there's an iFrame present in the page that contains the full payment form, but apparently the iFrame has opacity: 0.  This is not a full explanation for the problems I'm having because sometimes the iFrame's body tag is literally empty, so it wouldn't matter whether it was invisible or not.  But in this example, the iFrame is fully loaded with the Stripe Payment form, it's just invisible due to the opacity.  I some point in the loading process I'm guessing the Stripe components are responsible for changing this property so the form displays, and that process is being interrupted before it gets there.  Cause is still unknown.

The other failure state results in an empty root div within the iFrame's html body.  In this failure state, as with the previous one shown above, there are no errors in the console.

Body:
I'm having a problem with Stripe's PaymentElement react component.  It displays correctly but only sometimes.  After doing multiple reloads/restarts of the entire react app, and multiple CTRL+F5, the form intermittently doesn't display.  There doesn't seem to be any pattern to the times when it displays correctly nor the times when it fails to display.

When the modal displays, correct display of the payment form including PaymentElement component looks like this:

When the PaymentElement fails to display, there are two possible appearances.  Either it shows the form fields with nothing in them:

Or the entire iFrame is empty, no fields or labels or any HTML content within the body.

I followed this documentation to integrate the Elements and PaymentElements components into my react app.

Initially I was developing using public and secret keys issued to a free trial account.  It was hoped that switching to paid might make a difference, but now that I'm using paid keys I'm getting the same intermittent results with the PaymentElement sometimes not displaying.

I keep comparing my code to the docs and can't find what I've missed.  As per the docs, the stripe promise is instantiated outside the component's rendering.

import { useState, useEffect, useRef } from 'react';
import './App.css';
import DynamicTextArea from './components/DynamicTextArea';
import MultiSelect from "./components/MultiSelect";
import CheckoutForm from './components/CheckoutForm';
import ReCAPTCHA from "react-google-recaptcha";

import { loadStripe } from "@stripe/stripe-js";
import { Elements } from "@stripe/react-stripe-js";

const stripePromise = loadStripe("pk_test_xxxxxxxx");

function App() {

Payment intent is created with useEffect and an emtpy array so it triggers after page load.  This react app is backed by a REST API (.NET6) which handles the calls to Stripe and returns the client secret.

const createPaymentIntent = () => {
    // Create PaymentIntent as soon as the page loads
    fetch("/payments/create-payment-intent", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ items: [{ id: "product001" }] }),
    })
        .then((res) => res.json())
        .then((data) => setClientSecret(data.clientSecret));
}

const showPaymentForm = async () => {
    setPaymentModalOptions({...paymentModalOptions, visible: true});
}

useEffect(() => {
    createPaymentIntent();
}, []);

Options to pass to the PaymentElement component, which is wrapped in a CheckoutForm component as per the docs:

const options = {
    clientSecret: clientSecret,
    appearance: {
        theme: 'stripe',
    }
};

The Stripe Elements component is wrapped in a bootstrap modal.  To be clear, the modal always displays correctly, but intermittently the PaymentElement within the modal does not display.

    <div id="payment-modal" className={`modal ${paymentModalOptions.visible ? 'modal-show' : ''}`} role="dialog">

                    {clientSecret && (
                        <Elements options={options} stripe={stripePromise}>
                            <CheckoutForm onPaymentSucceeded={handlePaymentSucceeded} onCancelPayment={handlePaymentCancelled}/>
                        </Elements>
                    )}

Lastly, the CheckouForm component where the PaymentElement actually resides.

import { useEffect, useState } from "react";
import {
  PaymentElement,
  useStripe,
  useElements
} from "@stripe/react-stripe-js";

import './CheckoutForm.css';

export default function CheckoutForm(props) {
  const stripe = useStripe();
  const elements = useElements();
  const [message, setMessage] = useState(null);
  const [paymentIsLoading, setPaymentIsLoading] = useState(false);

  const paymentElementOptions = {
    layout: "tabs"
  }

  const delay = async (ms) => new Promise(res => setTimeout(res, ms));

  const handleSubmit = async (evt) => {
    evt.preventDefault();

    if (!stripe || !elements) {
      // Stripe.js has not yet loaded.
      // Make sure to disable form submission until Stripe.js has loaded.
      return;
    }

    setPaymentIsLoading(true);

    const paymentResult = await stripe.confirmPayment({
      elements,
      confirmParams: {
        // Make sure to change this to your payment completion page
        return_url: "http://localhost:44472",
      },
      redirect: 'if_required'
    });

    if (paymentResult.paymentIntent.status === 'succeeded') {
      setMessage("Payment successful!");

      // wait two seconds, then close the payment modal
      await delay(2000);
      props.onPaymentSucceeded();

    } else {
      setMessage("Payment unsuccessful");
    }

    setPaymentIsLoading(false);
  }

  return (
    <form id="payment-form" onSubmit={handleSubmit}>
        <PaymentElement id="payment-element" options={paymentElementOptions} />

                  {paymentIsLoading ?

                      : <button disabled={paymentIsLoading || !stripe || !elements} id="submit" className="btn btn-light border">
                          Pay now
                        </button>
                  }

              <button onClick={props.onCancelPayment} className="btn btn-light border">Cancel</button>

      {/* Show any error or success messages */}
      {message &&
{message}
}
    </form>
  );
}

I've seen intermittent rendering problems in React before and its often caused because of a pending response to an async call, or failing to use useEffect() correctly (I've done it multiple times).  In this case I don't see where I'm going wrong.  Thanks for your help.

UPDATE:
This error appears in the console intermittently.  The error sometimes appears even when the PaymentElement displays correctly.  Other times the error doesn't appear even though the Payment Element fails to display.  I'm not convinced they are connected.

UPDATE: I have reached out to Stripe support on this.  In the meantime I'm sharing an additional screenshot.  Sometimes when the form fails to display, there's an iFrame present in the page that contains the full payment form, but apparently the iFrame has opacity: 0.  This is not a full explanation for the problems I'm having because sometimes the iFrame's body tag is literally empty, so it wouldn't matter whether it was invisible or not.  But in this example, the iFrame is fully loaded with the Stripe Payment form, it's just invisible due to the opacity.  I some point in the loading process I'm guessing the Stripe components are responsible for changing this property so the form displays, and that process is being interrupted before it gets there.  Cause is still unknown.

The other failure state results in an empty root div within the iFrame's html body.  In this failure state, as with the previous one shown above, there are no errors in the console.


问:
Cosmos: Convert pubkey to consensus address
I need to do a conversion using the cosmrs library, but I couldn't do it. Can anyone who has experience with this help with a sample code?
Also I have a note to complete it:

Take the address from the pubkey and bech32 encode it using the correct HRP prefix

Cosmrs lib: https://docs.rs/cosmrs/latest/cosmrs/crypto/struct.PublicKey.html

Basically, a prefix should be determined and the relevant conversion process should be performed in this way. this seems a bit over my head. but for the example below, the prefix to use is cosmosvalcons

Example pubkey:

```<code>"consensus_pubkey".
{
    "consensus_pubkey": {
      "@type": "/cosmos.crypto.ed25519.PubKey",
      "key": "bDO9bUrbyg0f1pTpmjjZU5cgsweCWdwL6HUVnsKJi7k="
    }
}
</code>```

I need to get an address with cosmosvalcons... prefixed from pubkey, but all I get is nothing.

Body:
I need to do a conversion using the cosmrs library, but I couldn't do it. Can anyone who has experience with this help with a sample code?
Also I have a note to complete it:

Take the address from the pubkey and bech32 encode it using the correct HRP prefix

Cosmrs lib: https://docs.rs/cosmrs/latest/cosmrs/crypto/struct.PublicKey.html

Basically, a prefix should be determined and the relevant conversion process should be performed in this way. this seems a bit over my head. but for the example below, the prefix to use is cosmosvalcons

Example pubkey:

"consensus_pubkey".
{
    "consensus_pubkey": {
      "@type": "/cosmos.crypto.ed25519.PubKey",
      "key": "bDO9bUrbyg0f1pTpmjjZU5cgsweCWdwL6HUVnsKJi7k="
    }
}

I need to get an address with cosmosvalcons... prefixed from pubkey, but all I get is nothing.


问:
How can I manipulate certain server side responses? Specifically Ajax Responses? XXE Attack? Hybrid DNS Resolution?
I would like to be able to switch back and forth between the real DNS and maybe setting a local DNS entry so I can manipulate AJAX responses for code security checks.

For instance if the server responds with Ajax on page 1 that page 2 is not authorized. I want to manipulate this to return my desired response to make sure when the java script executes as intended there is still correct policy and security measures in place on the server side to prevent unauthorized access by hackers.

I know this can be done in theory but I don't know what is the best way. I don't want to have to go and compile some custom browser.

When I ask questions like this on here I usually get really bad answers. Like there is something wrong with I want to do or it can't be done. I assure you I know what I am talking about and if you don't have a solution or have never actually hacked a website, preformed an LFI or CSRF attack in your life please refrain from answering.

I basically am trying to hack a website that I have been paid to assess without access to the server side code. I want to make sure they don't rely on javascript logic for security.


问:
SAT collision detection: how to convert minimum-translation-vector into an "upwards vector"?
I use the SAT algorithm to determine the minimum-translation-vector in order to undo a collision with convex hulls. This is working great. But sometimes, if a slope is too steep, the player object will slow down too much because the translation-vector is pointing mostly in the front/back or left/right direction instead of the "up" direction.

Now, I was wondering if it is possible to get an "always up translation vector" from the originally calculated translation vector (mtv).

I do have the MTV and thus I also have the collider slope normal. What I am looking for is the green vector in my drawing.

My first idea was to just use the slope normal that is the most upright for this in a seperate test. But if the convex hull consists of many of these "mostly upright" normals, chances are high that I test against the wrong one.

My second idea was to take the object's center and shoot a ray downwards until it hits the slope's plane and then move the player object up to that contact point. But this gave me some very high translation vectors if the slope is very steep - especially if the object's hitbox is very large.

My third idea was to calculate the volume of the intersection (I already have a function that does this for any two convex hulls) and use the center point of this volume as a better starting point for my ray in idea #2. But calculating the volume is quite expensive.

Do you guys have any ideas how I could go about this?


问:
How can I change editor's background and syntax as default of a extention theme in VS code?
I am using VS code and I want to keep Cobalt2 theme except editor and it's syntax .I want editor's color and syntax as default. Please ,someone suggest me ,how to do that only. I don't want to fully customize whole theme.

I tried Youtube videos and and those are really confusing .