问:
taosd is active, but dnodes is offline
Bug Description
tdengine 3.0.2.2 :Unexpected restart when querying TDengine database.

To Reproduce
Steps to reproduce the behavior:
select * from database.stable limit 10000,1000

Expected Behavior

RD [root@tdengine01 ~]# coredumpctl list

```<code>TIME PID UID GID SIG COREFILE EXE
Sat 2023-01-07 21:02:43 CST 195171 0 0 6 present /usr/local/taos/bin/taosd
Sun 2023-01-08 01:00:38 CST 251379 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 02:40:36 CST 503716 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 03:11:36 CST 88591 0 0 6 present /usr/local/taos/bin/taosd
Sun 2023-01-08 06:57:07 CST 122152 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 10:10:07 CST 362836 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 10:39:07 CST 45410 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 11:08:07 CST 76783 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 12:38:06 CST 107478 0 0 6 truncated /usr/local/taos/bin/taosd
PRD [root@tdengine01 ~]#
Cannot access memory at address 0x7f75ece70128
Cannot access memory at address 0x7f75ece70120
Failed to read a valid object file image from memory.
Core was generated by `/usr/bin/taosd'.
Program terminated with signal SIGABRT, Aborted.

Screenshots
If applicable, add screenshots to help explain your problem.
image

Environment (please complete the following information):

OS:CentOS Linux release 8.2.2004 (Core)

Memory, CPU, current Disk Space
PRD [root@tdengine01 ~]# free -g
total used free shared buff/cache available
Mem: 15 1 3 0 10 13
Swap: 9 0 9
PRD [root@tdengine01 ~]#
PRD [root@tdengine01 ~]# lscpu |grep CPU
CPU op-mode(s): 32-bit, 64-bit
CPU(s): 8

TDengine Version [e.g. 3.0.2.2]
1/07 18:09:54.189952 00068047 UTL apoll url not load
01/07 18:09:54.190014 00068047 UTL load from cfg file /etc/taos//taos.cfg success
01/07 18:09:54.190019 00068047 UTL env file:.env not load
01/07 18:09:54.190024 00068047 UTL load from env variables cfg success
01/07 18:09:54.190058 00068047 UTL global config
01/07 18:09:54.190060 00068047 UTL =================================================================
01/07 18:09:54.190062 00068047 UTL cfg_file firstEp tdengine01:6030
01/07 18:09:54.190064 00068047 UTL default secondEp tdengine01:6030
01/07 18:09:54.190066 00068047 UTL cfg_file fqdn tdengine01
01/07 18:09:54.190068 00068047 UTL default serverPort 6030
01/07 18:09:54.190070 00068047 UTL default tempDir /tmp/
01/07 18:09:54.190072 00068047 UTL default minimalTmpDirGB 1.00
01/07 18:09:54.190076 00068047 UTL default shellActivityTimer 3
01/07 18:09:54.190077 00068047 UTL default compressMsgSize -1
01/07 18:09:54.190079 00068047 UTL default compressColData -1
01/07 18:09:54.190080 00068047 UTL default queryPolicy 1
01/07 18:09:54.190082 00068047 UTL default querySmaOptimize 0
01/07 18:09:54.190084 00068047 UTL default queryPlannerTrace 0
01/07 18:09:54.190085 00068047 UTL default queryNodeChunkSize 32768
01/07 18:09:54.190087 00068047 UTL default queryUseNodeAllocator 1
01/07 18:09:54.190088 00068047 UTL default keepColumnName 0
01/07 18:09:54.190090 00068047 UTL default smlChildTableName
01/07 18:09:54.190091 00068047 UTL default smlTagName _tag_null
01/07 18:09:54.190093 00068047 UTL default smlDataFormat 0
01/07 18:09:54.190094 00068047 UTL default smlBatchSize 10000
01/07 18:09:54.190096 00068047 UTL default maxMemUsedByInsert 1024
01/07 18:09:54.190097 00068047 UTL default useAdapter 0
01/07 18:09:54.190099 00068047 UTL default configDir /etc/taos/
01/07 18:09:54.190100 00068047 UTL default scriptDir /etc/taos/
01/07 18:09:54.190102 00068047 UTL cfg_file logDir /app/log/taos
01/07 18:09:54.190103 00068047 UTL default minimalLogDirGB 1.00
01/07 18:09:54.190105 00068047 UTL default numOfLogLines 10000000
01/07 18:09:54.190107 00068047 UTL default asyncLog 1
01/07 18:09:54.190108 00068047 UTL default logKeepDays 0
01/07 18:09:54.190110 00068047 UTL default debugFlag 0
01/07 18:09:54.190111 00068047 UTL default simDebugFlag 143
01/07 18:09:54.190112 00068047 UTL default tmrDebugFlag 131
01/07 18:09:54.190114 00068047 UTL default uDebugFlag 131
01/07 18:09:54.190115 00068047 UTL default rpcDebugFlag 131
01/07 18:09:54.190116 00068047 UTL default jniDebugFlag 131
01/07 18:09:54.190118 00068047 UTL default qDebugFlag 131
01/07 18:09:54.190119 00068047 UTL default cDebugFlag 131
01/07 18:09:54.190120 00068047 UTL default timezone Asia/Shanghai (CST, +0800)
01/07 18:09:54.190122 00068047 UTL default locale en_US.UTF-8
01/07 18:09:54.190123 00068047 UTL default charset UTF-8
01/07 18:09:54.190125 00068047 UTL default assert 1
01/07 18:09:54.190126 00068047 UTL default enableCoreFile 1
01/07 18:09:54.190128 00068047 UTL default numOfCores 8.00
01/07 18:09:54.190130 00068047 UTL default openMax 524288
01/07 18:09:54.190132 00068047 UTL default streamMax 16
01/07 18:09:54.190133 00068047 UTL default pageSizeKB 4
01/07 18:09:54.190135 00068047 UTL default totalMemoryKB 16267956
01/07 18:09:54.190136 00068047 UTL default os sysname Linux
01/07 18:09:54.190140 00068047 UTL default os nodename tdengine01
01/07 18:09:54.190141 00068047 UTL default os release 4.18.0-193.el8.x86_64
01/07 18:09:54.190143 00068047 UTL default os version Update README.md #1 SMP Fri May 8 10:59:10 UTC 2020
01/07 18:09:54.190144 00068047 UTL default os machine x86_64
01/07 18:09:54.190146 00068047 UTL default version 3.0.2.2
01/07 18:09:54.190147 00068047 UTL default compatible_version 3.0.0.0
01/07 18:09:54.190149 00068047 UTL default gitinfo c09602b
01/07 18:09:54.190150 00068047 UTL default buildinfo Built at 2022-12-28 15:17
Additional Context
Add any other context about the problem here.

RD [root@tdengine01 ~]# coredumpctl list
TIME PID UID GID SIG COREFILE EXE
Sat 2023-01-07 21:02:43 CST 195171 0 0 6 present /usr/local/taos/bin/taosd
Sun 2023-01-08 01:00:38 CST 251379 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 02:40:36 CST 503716 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 03:11:36 CST 88591 0 0 6 present /usr/local/taos/bin/taosd
Sun 2023-01-08 06:57:07 CST 122152 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 10:10:07 CST 362836 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 10:39:07 CST 45410 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 11:08:07 CST 76783 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 12:38:06 CST 107478 0 0 6 truncated /usr/local/taos/bin/taosd
PRD [root@tdengine01 ~]#

RD [root@tdengine01 ~]# coredumpctl info 107478
PID: 107478 (taosd)
UID: 0 (root)
GID: 0 (root)
Signal: 6 (ABRT)
Timestamp: Sun 2023-01-08 12:38:00 CST (5h 35min ago)
Command Line: /usr/bin/taosd
Executable: /usr/local/taos/bin/taosd
Control Group: /
Slice: -.slice
Boot ID: 2a2d62239b2e4d7782d4e82db53edc91
Machine ID: fc7b99c55f466e3dbf411011f4695719
Hostname: tdengine01
Storage: /var/lib/systemd/coredump/core.taosd.0.2a2d62239b2e4d7782d4e82db53edc91.107478.1673152680000000.lz4 (truncated)
Message: Process 107478 (taosd) of user 0 dumped core.

            Stack trace of thread 107542:
            #0  0x00007f75ebf0c70f n/a (n/a)
PRD [root@tdengine01 ~]#

RD [root@tdengine01 ~]# coredumpctl gdb 107478
PID: 107478 (taosd)
UID: 0 (root)
GID: 0 (root)
Signal: 6 (ABRT)
Timestamp: Sun 2023-01-08 12:38:00 CST (5h 35min ago)
Command Line: /usr/bin/taosd
Executable: /usr/local/taos/bin/taosd
Control Group: /
Slice: -.slice
Boot ID: 2a2d62239b2e4d7782d4e82db53edc91
Machine ID: fc7b99c55f466e3dbf411011f4695719
Hostname: tdengine01
Storage: /var/lib/systemd/coredump/core.taosd.0.2a2d62239b2e4d7782d4e82db53edc91.107478.1673152680000000.lz4 (truncated)
Message: Process 107478 (taosd) of user 0 dumped core.

            Stack trace of thread 107542:
            #0  0x00007f75ebf0c70f n/a (n/a)
GNU gdb (GDB) Red Hat Enterprise Linux 8.2-11.el8
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/taos/bin/taosd...done.
BFD: warning: /var/tmp/coredump-ePvRzI is truncated: expected core file size >= 2273423360, found: 2147483648
[New LWP 107542]
[New LWP 107494]
[New LWP 107482]
[New LWP 107505]
[New LWP 107478]
[New LWP 107486]
[New LWP 107488]
[New LWP 107566]
[New LWP 107500]
[New LWP 107570]
[New LWP 107540]
[New LWP 107569]
[New LWP 107562]
[New LWP 107561]
[New LWP 107498]
[New LWP 107563]
[New LWP 107544]
[New LWP 107553]
[New LWP 107510]
[New LWP 107531]
[New LWP 107554]
[New LWP 107534]
[New LWP 107550]
[New LWP 107549]
[New LWP 107508]
[New LWP 107504]
[New LWP 107523]
[New LWP 107511]
[New LWP 107529]
[New LWP 107532]
[New LWP 107499]
[New LWP 107490]
[New LWP 107527]
[New LWP 107509]
[New LWP 107539]
[New LWP 107502]
[New LWP 107528]
[New LWP 107481]
[New LWP 107533]
[New LWP 107501]
[New LWP 107506]
[New LWP 107530]
[New LWP 107524]
[New LWP 107503]
[New LWP 107564]
[New LWP 107489]
[New LWP 107521]
[New LWP 107522]
[New LWP 107512]
[New LWP 107556]
[New LWP 107571]
[New LWP 107520]
[New LWP 107541]
[New LWP 107526]
[New LWP 107604]
[New LWP 107552]
[New LWP 107507]
[New LWP 107525]
[New LWP 107487]
[New LWP 107538]
[New LWP 107517]
[New LWP 107568]
[New LWP 107518]
[New LWP 107572]
[New LWP 107567]
[New LWP 107551]
[New LWP 107479]
[New LWP 107483]
[New LWP 107543]
[New LWP 107558]
[New LWP 107537]
[New LWP 107559]
[New LWP 107480]
[New LWP 107557]
[New LWP 107535]
[New LWP 108521]
[New LWP 107565]
[New LWP 107560]
[New LWP 107548]
[New LWP 107546]
[New LWP 107547]
[New LWP 107519]
[New LWP 107492]
[New LWP 107493]
[New LWP 107484]
[New LWP 107485]
[New LWP 107555]
[New LWP 107536]
[New LWP 107545]
Cannot access memory at address 0x7f75ece70128
</code>```

Cannot access memory at address 0x7f75ece70120
Failed to read a valid object file image from memory.
Core was generated by `/usr/bin/taosd'.
Program terminated with signal SIGABRT, Aborted.
#0 0x00007f75ebf0c70f in ?? ()
[Current thread is 1 (LWP 107542)]
(gdb)

I want to know the reason and fix it.

Title: taosd is active, but dnodes is offline

Body:
Bug Description
tdengine 3.0.2.2 :Unexpected restart when querying TDengine database.

To Reproduce
Steps to reproduce the behavior:
select * from database.stable limit 10000,1000

Expected Behavior

RD [root@tdengine01 ~]# coredumpctl list

TIME PID UID GID SIG COREFILE EXE
Sat 2023-01-07 21:02:43 CST 195171 0 0 6 present /usr/local/taos/bin/taosd
Sun 2023-01-08 01:00:38 CST 251379 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 02:40:36 CST 503716 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 03:11:36 CST 88591 0 0 6 present /usr/local/taos/bin/taosd
Sun 2023-01-08 06:57:07 CST 122152 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 10:10:07 CST 362836 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 10:39:07 CST 45410 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 11:08:07 CST 76783 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 12:38:06 CST 107478 0 0 6 truncated /usr/local/taos/bin/taosd
PRD [root@tdengine01 ~]#
Cannot access memory at address 0x7f75ece70128
Cannot access memory at address 0x7f75ece70120
Failed to read a valid object file image from memory.
Core was generated by `/usr/bin/taosd'.
Program terminated with signal SIGABRT, Aborted.

Screenshots
If applicable, add screenshots to help explain your problem.
image

Environment (please complete the following information):

OS:CentOS Linux release 8.2.2004 (Core)

Memory, CPU, current Disk Space
PRD [root@tdengine01 ~]# free -g
total used free shared buff/cache available
Mem: 15 1 3 0 10 13
Swap: 9 0 9
PRD [root@tdengine01 ~]#
PRD [root@tdengine01 ~]# lscpu |grep CPU
CPU op-mode(s): 32-bit, 64-bit
CPU(s): 8

TDengine Version [e.g. 3.0.2.2]
1/07 18:09:54.189952 00068047 UTL apoll url not load
01/07 18:09:54.190014 00068047 UTL load from cfg file /etc/taos//taos.cfg success
01/07 18:09:54.190019 00068047 UTL env file:.env not load
01/07 18:09:54.190024 00068047 UTL load from env variables cfg success
01/07 18:09:54.190058 00068047 UTL global config
01/07 18:09:54.190060 00068047 UTL =================================================================
01/07 18:09:54.190062 00068047 UTL cfg_file firstEp tdengine01:6030
01/07 18:09:54.190064 00068047 UTL default secondEp tdengine01:6030
01/07 18:09:54.190066 00068047 UTL cfg_file fqdn tdengine01
01/07 18:09:54.190068 00068047 UTL default serverPort 6030
01/07 18:09:54.190070 00068047 UTL default tempDir /tmp/
01/07 18:09:54.190072 00068047 UTL default minimalTmpDirGB 1.00
01/07 18:09:54.190076 00068047 UTL default shellActivityTimer 3
01/07 18:09:54.190077 00068047 UTL default compressMsgSize -1
01/07 18:09:54.190079 00068047 UTL default compressColData -1
01/07 18:09:54.190080 00068047 UTL default queryPolicy 1
01/07 18:09:54.190082 00068047 UTL default querySmaOptimize 0
01/07 18:09:54.190084 00068047 UTL default queryPlannerTrace 0
01/07 18:09:54.190085 00068047 UTL default queryNodeChunkSize 32768
01/07 18:09:54.190087 00068047 UTL default queryUseNodeAllocator 1
01/07 18:09:54.190088 00068047 UTL default keepColumnName 0
01/07 18:09:54.190090 00068047 UTL default smlChildTableName
01/07 18:09:54.190091 00068047 UTL default smlTagName _tag_null
01/07 18:09:54.190093 00068047 UTL default smlDataFormat 0
01/07 18:09:54.190094 00068047 UTL default smlBatchSize 10000
01/07 18:09:54.190096 00068047 UTL default maxMemUsedByInsert 1024
01/07 18:09:54.190097 00068047 UTL default useAdapter 0
01/07 18:09:54.190099 00068047 UTL default configDir /etc/taos/
01/07 18:09:54.190100 00068047 UTL default scriptDir /etc/taos/
01/07 18:09:54.190102 00068047 UTL cfg_file logDir /app/log/taos
01/07 18:09:54.190103 00068047 UTL default minimalLogDirGB 1.00
01/07 18:09:54.190105 00068047 UTL default numOfLogLines 10000000
01/07 18:09:54.190107 00068047 UTL default asyncLog 1
01/07 18:09:54.190108 00068047 UTL default logKeepDays 0
01/07 18:09:54.190110 00068047 UTL default debugFlag 0
01/07 18:09:54.190111 00068047 UTL default simDebugFlag 143
01/07 18:09:54.190112 00068047 UTL default tmrDebugFlag 131
01/07 18:09:54.190114 00068047 UTL default uDebugFlag 131
01/07 18:09:54.190115 00068047 UTL default rpcDebugFlag 131
01/07 18:09:54.190116 00068047 UTL default jniDebugFlag 131
01/07 18:09:54.190118 00068047 UTL default qDebugFlag 131
01/07 18:09:54.190119 00068047 UTL default cDebugFlag 131
01/07 18:09:54.190120 00068047 UTL default timezone Asia/Shanghai (CST, +0800)
01/07 18:09:54.190122 00068047 UTL default locale en_US.UTF-8
01/07 18:09:54.190123 00068047 UTL default charset UTF-8
01/07 18:09:54.190125 00068047 UTL default assert 1
01/07 18:09:54.190126 00068047 UTL default enableCoreFile 1
01/07 18:09:54.190128 00068047 UTL default numOfCores 8.00
01/07 18:09:54.190130 00068047 UTL default openMax 524288
01/07 18:09:54.190132 00068047 UTL default streamMax 16
01/07 18:09:54.190133 00068047 UTL default pageSizeKB 4
01/07 18:09:54.190135 00068047 UTL default totalMemoryKB 16267956
01/07 18:09:54.190136 00068047 UTL default os sysname Linux
01/07 18:09:54.190140 00068047 UTL default os nodename tdengine01
01/07 18:09:54.190141 00068047 UTL default os release 4.18.0-193.el8.x86_64
01/07 18:09:54.190143 00068047 UTL default os version Update README.md #1 SMP Fri May 8 10:59:10 UTC 2020
01/07 18:09:54.190144 00068047 UTL default os machine x86_64
01/07 18:09:54.190146 00068047 UTL default version 3.0.2.2
01/07 18:09:54.190147 00068047 UTL default compatible_version 3.0.0.0
01/07 18:09:54.190149 00068047 UTL default gitinfo c09602b
01/07 18:09:54.190150 00068047 UTL default buildinfo Built at 2022-12-28 15:17
Additional Context
Add any other context about the problem here.

RD [root@tdengine01 ~]# coredumpctl list
TIME PID UID GID SIG COREFILE EXE
Sat 2023-01-07 21:02:43 CST 195171 0 0 6 present /usr/local/taos/bin/taosd
Sun 2023-01-08 01:00:38 CST 251379 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 02:40:36 CST 503716 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 03:11:36 CST 88591 0 0 6 present /usr/local/taos/bin/taosd
Sun 2023-01-08 06:57:07 CST 122152 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 10:10:07 CST 362836 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 10:39:07 CST 45410 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 11:08:07 CST 76783 0 0 6 truncated /usr/local/taos/bin/taosd
Sun 2023-01-08 12:38:06 CST 107478 0 0 6 truncated /usr/local/taos/bin/taosd
PRD [root@tdengine01 ~]#

RD [root@tdengine01 ~]# coredumpctl info 107478
PID: 107478 (taosd)
UID: 0 (root)
GID: 0 (root)
Signal: 6 (ABRT)
Timestamp: Sun 2023-01-08 12:38:00 CST (5h 35min ago)
Command Line: /usr/bin/taosd
Executable: /usr/local/taos/bin/taosd
Control Group: /
Slice: -.slice
Boot ID: 2a2d62239b2e4d7782d4e82db53edc91
Machine ID: fc7b99c55f466e3dbf411011f4695719
Hostname: tdengine01
Storage: /var/lib/systemd/coredump/core.taosd.0.2a2d62239b2e4d7782d4e82db53edc91.107478.1673152680000000.lz4 (truncated)
Message: Process 107478 (taosd) of user 0 dumped core.

            Stack trace of thread 107542:
            #0  0x00007f75ebf0c70f n/a (n/a)
PRD [root@tdengine01 ~]#

RD [root@tdengine01 ~]# coredumpctl gdb 107478
PID: 107478 (taosd)
UID: 0 (root)
GID: 0 (root)
Signal: 6 (ABRT)
Timestamp: Sun 2023-01-08 12:38:00 CST (5h 35min ago)
Command Line: /usr/bin/taosd
Executable: /usr/local/taos/bin/taosd
Control Group: /
Slice: -.slice
Boot ID: 2a2d62239b2e4d7782d4e82db53edc91
Machine ID: fc7b99c55f466e3dbf411011f4695719
Hostname: tdengine01
Storage: /var/lib/systemd/coredump/core.taosd.0.2a2d62239b2e4d7782d4e82db53edc91.107478.1673152680000000.lz4 (truncated)
Message: Process 107478 (taosd) of user 0 dumped core.

            Stack trace of thread 107542:
            #0  0x00007f75ebf0c70f n/a (n/a)
GNU gdb (GDB) Red Hat Enterprise Linux 8.2-11.el8
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/taos/bin/taosd...done.
BFD: warning: /var/tmp/coredump-ePvRzI is truncated: expected core file size >= 2273423360, found: 2147483648
[New LWP 107542]
[New LWP 107494]
[New LWP 107482]
[New LWP 107505]
[New LWP 107478]
[New LWP 107486]
[New LWP 107488]
[New LWP 107566]
[New LWP 107500]
[New LWP 107570]
[New LWP 107540]
[New LWP 107569]
[New LWP 107562]
[New LWP 107561]
[New LWP 107498]
[New LWP 107563]
[New LWP 107544]
[New LWP 107553]
[New LWP 107510]
[New LWP 107531]
[New LWP 107554]
[New LWP 107534]
[New LWP 107550]
[New LWP 107549]
[New LWP 107508]
[New LWP 107504]
[New LWP 107523]
[New LWP 107511]
[New LWP 107529]
[New LWP 107532]
[New LWP 107499]
[New LWP 107490]
[New LWP 107527]
[New LWP 107509]
[New LWP 107539]
[New LWP 107502]
[New LWP 107528]
[New LWP 107481]
[New LWP 107533]
[New LWP 107501]
[New LWP 107506]
[New LWP 107530]
[New LWP 107524]
[New LWP 107503]
[New LWP 107564]
[New LWP 107489]
[New LWP 107521]
[New LWP 107522]
[New LWP 107512]
[New LWP 107556]
[New LWP 107571]
[New LWP 107520]
[New LWP 107541]
[New LWP 107526]
[New LWP 107604]
[New LWP 107552]
[New LWP 107507]
[New LWP 107525]
[New LWP 107487]
[New LWP 107538]
[New LWP 107517]
[New LWP 107568]
[New LWP 107518]
[New LWP 107572]
[New LWP 107567]
[New LWP 107551]
[New LWP 107479]
[New LWP 107483]
[New LWP 107543]
[New LWP 107558]
[New LWP 107537]
[New LWP 107559]
[New LWP 107480]
[New LWP 107557]
[New LWP 107535]
[New LWP 108521]
[New LWP 107565]
[New LWP 107560]
[New LWP 107548]
[New LWP 107546]
[New LWP 107547]
[New LWP 107519]
[New LWP 107492]
[New LWP 107493]
[New LWP 107484]
[New LWP 107485]
[New LWP 107555]
[New LWP 107536]
[New LWP 107545]
Cannot access memory at address 0x7f75ece70128

Cannot access memory at address 0x7f75ece70120
Failed to read a valid object file image from memory.
Core was generated by `/usr/bin/taosd'.
Program terminated with signal SIGABRT, Aborted.
#0 0x00007f75ebf0c70f in ?? ()
[Current thread is 1 (LWP 107542)]
(gdb)

I want to know the reason and fix it.


来源: stackexchange

问:
Realm object not up to date
I have a singleton TimeManager that permanently listens to changes in my Session to perform backoffice stuff.

In the code below, I'm adding a TimeInterval object to the timeIntervals RealmList of my Session object after deleting the existing ones, each time a Session changes.

On a first change triggered by the UI, everything is fine and my Session has one TimeIntervalobject.

On a second change triggered by the UI, what's going wrong is that nothing is deleted when I do session.timeIntervals.deleteAllFromRealm() as session.timeIntervals is empty, as the Timber log shows.

So it looks like the timeIntervals RealmList is not up to date, but calling realm.refresh() does not solve the issue. If I restart my app between the two changes, everything is fine.

I've tried to add an onSuccess listener just to see if it was called and it does. There is pretty much no lag as I'm doing this on an empty Realm.

Here is the code:

```<code>object TimeManager {

    var sessions: RealmResults<Session>? = null

    private val sessionIdsToProcess = mutableSetOf<String>()

    fun configure() {} // launch init

    fun sessionChanged(session: Session) {
        this.sessionIdsToProcess.add(session.id)
    }

    init {

        val realm = Realm.getDefaultInstance()

        sessions = realm.where(Session::class.java).findAllAsync()
        sessions?.addChangeListener { _, _ ->

            if (sessionIdsToProcess.isNotEmpty()) {

                realm.executeTransactionAsync({ asyncRealm ->

                Timber.d("in asyncRealm {")

                val sessions = sessionIdsToProcess.mapNotNull { asyncRealm.findById(Session::class.java, it) }
                sessionIdsToProcess.clear()

                for (session in sessions) {
                    Timber.d("   Session id = ${session.id}")
                    Timber.d("   Session time intervals count = ${session.timeIntervals.size}")
                    session.timeIntervals.deleteAllFromRealm()
                    val fti = TimeInterval()
                    session.timeIntervals.add(fti)
                    asyncRealm.insertOrUpdate(session)
                }
                Timber.d("}")

                }, {
                    Timber.d("executeTransactionAsync onSuccess listener...")
                    val timeIntervals = realm.where(TimeInterval::class.java).findAll()
                    Timber.d("Total timeIntervals count = ${timeIntervals.size}")

                    timeIntervals.forEach {
                        Timber.d(">>> Time interval session count = ${it.sessions?.size}, session id = ${it.sessions?.firstOrNull()?.id}")
                    }

                }, {})
            }
        }
    }
}

class MainActivity : AppCompatActivity() {

    [...]

    // action triggered by a button
    private fun updateSession() {

        Timber.d("Update session")

        session.size = Random.nextInt()
        TimeManager.sessionChanged(session)

        realm.executeTransactionAsync {
            it.insertOrUpdate(this.session)
        }

    }

}

open class Session : RealmObject() {

    @PrimaryKey
    var id = UUID.randomUUID().toString()

    var size: Int? = null

    var timeIntervals: RealmList<TimeInterval> = RealmList()

}

open class TimeInterval : RealmObject() {

    @PrimaryKey
    var id = UUID.randomUUID().toString()

    @LinkingObjects("timeIntervals")
    val sessions: RealmResults<Session>? = null

}
</code>```

Here are the Timber logs:

First change:

D/MainActivity: Update session

D/TimeManager: in asyncRealm {

D/TimeManager:    Session id = 0e6e4eab-61a6-4848-bcb4-ce805b41de16

D/TimeManager:    Session time intervals count = 0

D/TimeManager: }

D/TimeManager: executeTransactionAsync onSuccess listener...

D/TimeManager: Total timeIntervals count = 1

D/TimeManager: >>> Time interval session count = 1, session id = 0e6e4eab-61a6-4848-bcb4-ce805b41de16

Second change:

D/MainActivity: Update session

D/TimeManager: in asyncRealm {

D/TimeManager:    Session id = 0e6e4eab-61a6-4848-bcb4-ce805b41de16

D/TimeManager:    Session time intervals count = 0

D/TimeManager: }

D/TimeManager: executeTransactionAsync onSuccess listener...

D/TimeManager: Total timeIntervals count = 2

D/TimeManager: >>> Time interval session count = 0, session id = null

D/TimeManager: >>> Time interval session count = 1, session id = 0e6e4eab-61a6-4848-bcb4-ce805b41de16

Now if I stop my app after the first change and launch it again, here are the logs I get for the second change (the id changes because I started from scratch):

TimeManager: Session id = 534e9294-6462-4efa-aaf9-834d085aa2ba
TimeManager: Session time intervals count = 1

TimeManager: executeTransactionAsync onSuccess listener...

TimeManager: Total timeIntervals count = 1

TimeManager: >>> Time interval session count = 1, session id = 534e9294-6462-4efa-aaf9-834d085aa2ba

How to make sure that session.timeIntervals is up to date?

ContentLicense: CC BY-SA 4.0

Title: Realm object not up to date

Body:
I have a singleton TimeManager that permanently listens to changes in my Session to perform backoffice stuff.

In the code below, I'm adding a TimeInterval object to the timeIntervals RealmList of my Session object after deleting the existing ones, each time a Session changes.

On a first change triggered by the UI, everything is fine and my Session has one TimeIntervalobject.

On a second change triggered by the UI, what's going wrong is that nothing is deleted when I do session.timeIntervals.deleteAllFromRealm() as session.timeIntervals is empty, as the Timber log shows.

So it looks like the timeIntervals RealmList is not up to date, but calling realm.refresh() does not solve the issue. If I restart my app between the two changes, everything is fine.

I've tried to add an onSuccess listener just to see if it was called and it does. There is pretty much no lag as I'm doing this on an empty Realm.

Here is the code:

object TimeManager {

    var sessions: RealmResults<Session>? = null

    private val sessionIdsToProcess = mutableSetOf<String>()

    fun configure() {} // launch init

    fun sessionChanged(session: Session) {
        this.sessionIdsToProcess.add(session.id)
    }

    init {

        val realm = Realm.getDefaultInstance()

        sessions = realm.where(Session::class.java).findAllAsync()
        sessions?.addChangeListener { _, _ ->

            if (sessionIdsToProcess.isNotEmpty()) {

                realm.executeTransactionAsync({ asyncRealm ->

                Timber.d("in asyncRealm {")

                val sessions = sessionIdsToProcess.mapNotNull { asyncRealm.findById(Session::class.java, it) }
                sessionIdsToProcess.clear()

                for (session in sessions) {
                    Timber.d("   Session id = ${session.id}")
                    Timber.d("   Session time intervals count = ${session.timeIntervals.size}")
                    session.timeIntervals.deleteAllFromRealm()
                    val fti = TimeInterval()
                    session.timeIntervals.add(fti)
                    asyncRealm.insertOrUpdate(session)
                }
                Timber.d("}")

                }, {
                    Timber.d("executeTransactionAsync onSuccess listener...")
                    val timeIntervals = realm.where(TimeInterval::class.java).findAll()
                    Timber.d("Total timeIntervals count = ${timeIntervals.size}")

                    timeIntervals.forEach {
                        Timber.d(">>> Time interval session count = ${it.sessions?.size}, session id = ${it.sessions?.firstOrNull()?.id}")
                    }

                }, {})
            }
        }
    }
}

class MainActivity : AppCompatActivity() {

    [...]

    // action triggered by a button
    private fun updateSession() {

        Timber.d("Update session")

        session.size = Random.nextInt()
        TimeManager.sessionChanged(session)

        realm.executeTransactionAsync {
            it.insertOrUpdate(this.session)
        }

    }

}

open class Session : RealmObject() {

    @PrimaryKey
    var id = UUID.randomUUID().toString()

    var size: Int? = null

    var timeIntervals: RealmList<TimeInterval> = RealmList()

}

open class TimeInterval : RealmObject() {

    @PrimaryKey
    var id = UUID.randomUUID().toString()

    @LinkingObjects("timeIntervals")
    val sessions: RealmResults<Session>? = null

}

Here are the Timber logs:

First change:

D/MainActivity: Update session

D/TimeManager: in asyncRealm {

D/TimeManager:    Session id = 0e6e4eab-61a6-4848-bcb4-ce805b41de16

D/TimeManager:    Session time intervals count = 0

D/TimeManager: }

D/TimeManager: executeTransactionAsync onSuccess listener...

D/TimeManager: Total timeIntervals count = 1

D/TimeManager: >>> Time interval session count = 1, session id = 0e6e4eab-61a6-4848-bcb4-ce805b41de16

Second change:

D/MainActivity: Update session

D/TimeManager: in asyncRealm {

D/TimeManager:    Session id = 0e6e4eab-61a6-4848-bcb4-ce805b41de16

D/TimeManager:    Session time intervals count = 0

D/TimeManager: }

D/TimeManager: executeTransactionAsync onSuccess listener...

D/TimeManager: Total timeIntervals count = 2

D/TimeManager: >>> Time interval session count = 0, session id = null

D/TimeManager: >>> Time interval session count = 1, session id = 0e6e4eab-61a6-4848-bcb4-ce805b41de16

Now if I stop my app after the first change and launch it again, here are the logs I get for the second change (the id changes because I started from scratch):

TimeManager: Session id = 534e9294-6462-4efa-aaf9-834d085aa2ba
TimeManager: Session time intervals count = 1

TimeManager: executeTransactionAsync onSuccess listener...

TimeManager: Total timeIntervals count = 1

TimeManager: >>> Time interval session count = 1, session id = 534e9294-6462-4efa-aaf9-834d085aa2ba

How to make sure that session.timeIntervals is up to date?


问:
Error with the path of the poppler folder
I am getting the following when using a script with a poppler path :

```<code>pdf2image.exceptions.PDFInfoNotInstalledError: Unable to get page count. Is poppler installed and in PATH?
</code>```

But poppler is correctly installed on my computer. The code I am using is the following :

```<code>import os

path = os.path.abspath("Project/Poppler/Release-22.12.0-0/poppler-22.12.0/Library/bin")

poppler_path = path
</code>```

If I try like I am getting the error but if I put the path into the variable poppler_path directly like this (I do this to get the full absolute path of the folder, if I try with the relative path it doesn't work anyway) :

```<code>poppler_path = r"C:\Users\Clement\Desktop\Project\Poppler\Release-22.12.0-0\poppler-22.12.0\Library\bin"
</code>```

By doing this I don't get the error when executing my script.

How can I fix this ?

Body:
I am getting the following when using a script with a poppler path :

pdf2image.exceptions.PDFInfoNotInstalledError: Unable to get page count. Is poppler installed and in PATH?

But poppler is correctly installed on my computer. The code I am using is the following :

import os

path = os.path.abspath("Project/Poppler/Release-22.12.0-0/poppler-22.12.0/Library/bin")

poppler_path = path

If I try like I am getting the error but if I put the path into the variable poppler_path directly like this (I do this to get the full absolute path of the folder, if I try with the relative path it doesn't work anyway) :

poppler_path = r"C:\Users\Clement\Desktop\Project\Poppler\Release-22.12.0-0\poppler-22.12.0\Library\bin"

By doing this I don't get the error when executing my script.

How can I fix this ?


问:
Why does bluetooth device watcher find not available devices?
I use deviceWatcher on windows 10 to find available bluetooth (BLE) devices. Available devices are corretly found. DeviceWatcher also find devices that were found in recent searching, but they are not available now (not powered and out of range). They are also found after restart of my application. Does someone know what may cause it?

Device watcher initialization:

```<code>    private List<DeviceInformation> Devices = new List<DeviceInformation>();
    private DeviceWatcher deviceWatcher;

    private void StartBleDeviceWatcher()
    {
        string[] requestedProperties = { "System.Devices.Aep.DeviceAddress", "System.Devices.Aep.IsConnected", "System.Devices.Aep.Bluetooth.Le.IsConnectable" };
        string aqsAllBluetoothLEDevices = "(System.Devices.Aep.ProtocolId:=\"{bb7bb05e-5972-42b5-94fc-76eaa7084d49}\")";

        deviceWatcher = DeviceInformation.CreateWatcher(aqsAllBluetoothLEDevices, requestedProperties, DeviceInformationKind.AssociationEndpoint);

        deviceWatcher.Added += DeviceWatcher_Added;
        deviceWatcher.Updated += DeviceWatcher_Updated;

        Devices.Clear();
        deviceWatcher.Start();
    }

    private void DeviceWatcher_Updated(DeviceWatcher sender, DeviceInformationUpdate deviceInfo)
    {

    }

    private void DeviceWatcher_Added(DeviceWatcher sender, DeviceInformation deviceInfo)
    {
        Devices.Add(deviceInfo);
        comboBox_AddItem(comboBox_devices, " MAC: " + deviceInfo.Id.Substring(44) + " | Name: " + deviceInfo.Name);
    }
</code>```

Body:
I use deviceWatcher on windows 10 to find available bluetooth (BLE) devices. Available devices are corretly found. DeviceWatcher also find devices that were found in recent searching, but they are not available now (not powered and out of range). They are also found after restart of my application. Does someone know what may cause it?

Device watcher initialization:

    private List<DeviceInformation> Devices = new List<DeviceInformation>();
    private DeviceWatcher deviceWatcher;

    private void StartBleDeviceWatcher()
    {
        string[] requestedProperties = { "System.Devices.Aep.DeviceAddress", "System.Devices.Aep.IsConnected", "System.Devices.Aep.Bluetooth.Le.IsConnectable" };
        string aqsAllBluetoothLEDevices = "(System.Devices.Aep.ProtocolId:=\"{bb7bb05e-5972-42b5-94fc-76eaa7084d49}\")";

        deviceWatcher = DeviceInformation.CreateWatcher(aqsAllBluetoothLEDevices, requestedProperties, DeviceInformationKind.AssociationEndpoint);

        deviceWatcher.Added += DeviceWatcher_Added;
        deviceWatcher.Updated += DeviceWatcher_Updated;

        Devices.Clear();
        deviceWatcher.Start();
    }

    private void DeviceWatcher_Updated(DeviceWatcher sender, DeviceInformationUpdate deviceInfo)
    {

    }

    private void DeviceWatcher_Added(DeviceWatcher sender, DeviceInformation deviceInfo)
    {
        Devices.Add(deviceInfo);
        comboBox_AddItem(comboBox_devices, " MAC: " + deviceInfo.Id.Substring(44) + " | Name: " + deviceInfo.Name);
    }


问:
Fail installing Streamlit in Professional Laptop
I am quite new using Python and Streamlit.
For a professional project, I need to use streamlit. The main problem is that in my personal laptop, I was able to install everything as it appears in the website (https://docs.streamlit.io/library/get-started/installation). The main problem is that in my professional laptop that it doesn't work.

When I apply the command "pip install streamlit" in my professional laptop, it appears this error:

"Collecting streamlit
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/streamlit/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/streamlit/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/streamlit/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/streamlit/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/streamlit/
Could not find a version that satisfies the requirement streamlit (from versions: )
No matching distribution found for streamlit"

Could someone recommend me what should I do? Again I am so sorry if I am doing a stupid mistake, I am quite new and I don't have anyone to ask. Thank you so much in advance.


问:
Question about Config in Perf with Intel PT
Like perf wiki says(https://perf.wiki.kernel.org/index.php/Perf_tools_support_for_Intel%C2%AE_Processor_Trace#Reducing_and_handling_the_massive_amount_of_trace_data)

The Intel PT kernel driver creates a new PMU for Intel PT. PMU
events are selected by providing the PMU name followed by the
"config" separated by slashes. An enhancement has been made to
allow default "config" e.g. the option
-e intel_pt//
will use a default config value. Currently that is the same as
-e intel_pt/tsc,noretcomp=0/
which is the same as
-e intel_pt/tsc=1,noretcomp=0/

In the source code,

```<code>static u64 intel_pt_default_config(struct perf_pmu *intel_pt_pmu) {
        char buf[256];
    int mtc, mtc_periods = 0, mtc_period;
    int psb_cyc, psb_periods, psb_period;
    int pos = 0;
    u64 config;
        ...
        return config;
}
</code>```

Which inital config for perf event.

Now I want to modify the config for my own code. How could I modify the config setting by knowing which bit means?
Like others'code

```<code>default config int perf_event_attr for Intel PT event*/
     static __u64 pt_default_config() {
    int mtc, mtc_periods = 0, mtc_period;
    int psb_cyc, psb_periods, psb_period;
    __u64 config = 0;
    char c;

    /* pt bit */
    config |= 1;
    /* tsc */
    config |= (1 << 10);
    /* disable ret compress */
    config |= (1 << 11);

</code>```

Does there has any mannual show the mapping like 1 << 10 means tsc enable?

Body:
Like perf wiki says(https://perf.wiki.kernel.org/index.php/Perf_tools_support_for_Intel%C2%AE_Processor_Trace#Reducing_and_handling_the_massive_amount_of_trace_data)

The Intel PT kernel driver creates a new PMU for Intel PT. PMU
events are selected by providing the PMU name followed by the
"config" separated by slashes. An enhancement has been made to
allow default "config" e.g. the option
-e intel_pt//
will use a default config value. Currently that is the same as
-e intel_pt/tsc,noretcomp=0/
which is the same as
-e intel_pt/tsc=1,noretcomp=0/

In the source code,

static u64 intel_pt_default_config(struct perf_pmu *intel_pt_pmu) {
        char buf[256];
    int mtc, mtc_periods = 0, mtc_period;
    int psb_cyc, psb_periods, psb_period;
    int pos = 0;
    u64 config;
        ...
        return config;
}

Which inital config for perf event.

Now I want to modify the config for my own code. How could I modify the config setting by knowing which bit means?
Like others'code

default config int perf_event_attr for Intel PT event*/
     static __u64 pt_default_config() {
    int mtc, mtc_periods = 0, mtc_period;
    int psb_cyc, psb_periods, psb_period;
    __u64 config = 0;
    char c;

    /* pt bit */
    config |= 1;
    /* tsc */
    config |= (1 << 10);
    /* disable ret compress */
    config |= (1 << 11);

Does there has any mannual show the mapping like 1 << 10 means tsc enable?


问:
Get Result From a Celery Task After Soft Time Limit Exceeded

Question

I have a celery task which takes a lot time to finish. Since I don't want my users wait, I set a soft_time_limit for that task so, I can inform them afterwards. There is also a hard time limit to kill processes which takes time.

Is there a way that I can get result of a celery task after sof_time_limit exceeded?

I tried catching SoftTimeLimitExceeded exception but it kills the process and I have to invoke another function with only hard_time_limit in this case and this is wasting resources.

What I tried:

```<code>@celery.task('time_limit' = 600)
def foo_hard(bar)
    result = do_something(bar)
    send_result(result)

@celery.task('soft_time_limit' = 50)
def foo(bar):
    try:
        result = do_something(bar)
    except SoftTimeLimitExceeded:
        foo_hard(bar)
    finally:
        return result
</code>```

How I call tasks:

```<code>res = foo.delay(bar)

while not res.ready():
    time.sleep(time_1)
result = res.get(propagate = True, interval = time_2)
</code>```

What I am looking for:

A way to send information that task is exceeded soft time limit but dont kill the process and send information with send_results which is only a post request.

Body:
Question

I have a celery task which takes a lot time to finish. Since I don't want my users wait, I set a soft_time_limit for that task so, I can inform them afterwards. There is also a hard time limit to kill processes which takes time.

Is there a way that I can get result of a celery task after sof_time_limit exceeded?

I tried catching SoftTimeLimitExceeded exception but it kills the process and I have to invoke another function with only hard_time_limit in this case and this is wasting resources.

What I tried:

@celery.task('time_limit' = 600)
def foo_hard(bar)
    result = do_something(bar)
    send_result(result)

@celery.task('soft_time_limit' = 50)
def foo(bar):
    try:
        result = do_something(bar)
    except SoftTimeLimitExceeded:
        foo_hard(bar)
    finally:
        return result

How I call tasks:

res = foo.delay(bar)

while not res.ready():
    time.sleep(time_1)
result = res.get(propagate = True, interval = time_2)

What I am looking for:

A way to send information that task is exceeded soft time limit but dont kill the process and send information with send_results which is only a post request.


问:
Replacing a keyword in a .txt file. Poweshell Scripting
I'm trying to replace a keyword in a .txt file, but nothing happens and the .txt file remains the same.
The keyword im trying to replace is "dataSource.password".

I'm trying to use -replace and Foreach-Object on replacing certain keywords
Here's the code:

```<code>$text = Get-Clipboard

$data = "dataSource.password="

$dt = $data + $text

$line1 = Get-content C:\Users\asd\Desktop\sample.txt | Select-String datasource.password | Select-Object -ExpandProperty Line

$content1 = Get-Content C:\Users\asd\Desktop\sample.txt

$content1 | ForEach-Object {$_ -replace $line1, $dt} | Set-Content C:\Users\asd\Desktop\sample.txt
</code>```

Body:
I'm trying to replace a keyword in a .txt file, but nothing happens and the .txt file remains the same.
The keyword im trying to replace is "dataSource.password".

I'm trying to use -replace and Foreach-Object on replacing certain keywords
Here's the code:

$text = Get-Clipboard

$data = "dataSource.password="

$dt = $data + $text

$line1 = Get-content C:\Users\asd\Desktop\sample.txt | Select-String datasource.password | Select-Object -ExpandProperty Line

$content1 = Get-Content C:\Users\asd\Desktop\sample.txt

$content1 | ForEach-Object {$_ -replace $line1, $dt} | Set-Content C:\Users\asd\Desktop\sample.txt


问:
Getting Firebase Data
I have two lists. One contains user keys and the other contains push keys.
I want to get the snapshot but my provider returns the history of one user.</p>
```<code>for(String key in myList){
  for(String keys in myPushList){
    print("$key, $keys");
    broadcastDatabaseReference.child(key).child(keys).once().then((DatabaseEvent event){
      if(event.snapshot.value != null){
        var broadcastHists = BroadcastHistory.fromSnapshot(dataSnapshot);
        Provider.of<AppData>(context, listen:false).updateBroadcastHistoryData(broadcastHists);
      }
    });
}
</code>```

Title: Getting Firebase Data

Body:
I have two lists. One contains user keys and the other contains push keys.
I want to get the snapshot but my provider returns the history of one user.

for(String key in myList){
  for(String keys in myPushList){
    print("$key, $keys");
    broadcastDatabaseReference.child(key).child(keys).once().then((DatabaseEvent event){
      if(event.snapshot.value != null){
        var broadcastHists = BroadcastHistory.fromSnapshot(dataSnapshot);
        Provider.of<AppData>(context, listen:false).updateBroadcastHistoryData(broadcastHists);
      }
    });
}


问:
How to represent a min and max value of multiple categories in x axis as a candle stick plot in python. need to have unique colours for each category
```<code># Create a list of dictionaries representing each row of the data
data = [
    {"Team": "CHENNAI SUPER KINGS", "min": 1525, "max": 1625, "Is_awarded": "Yes"},
    {"Team": "LUCKNOW SUPER GIANTS", "min": 700, "max": 1600, "Is_awarded": None},
    {"Team": "RAJASTHAN ROYALS", "min": 200, "max": 725, "Is_awarded": None},
    {"Team": "ROYAL CHALLENGERS BANGALORE", "min": 220, "max": 650, "Is_awarded": None},
    {"Team": "SUNRISERS HYDERABAD", "min": 775, "max": 1475, "Is_awarded": None},
]

# Create the dataframe from the list of dictionaries
df = pd.DataFrame(data)
</code>```

I want to plot a candle stick chart representing the team name in X axis and corresponding min max value. the colour of the candle stick should be unique with respect to the third column Is_awarded; if 'yes' then red & if 'NA' blue. is there a way?

I have tried plotly but I'm not able to colour code it.

Body:
# Create a list of dictionaries representing each row of the data
data = [
    {"Team": "CHENNAI SUPER KINGS", "min": 1525, "max": 1625, "Is_awarded": "Yes"},
    {"Team": "LUCKNOW SUPER GIANTS", "min": 700, "max": 1600, "Is_awarded": None},
    {"Team": "RAJASTHAN ROYALS", "min": 200, "max": 725, "Is_awarded": None},
    {"Team": "ROYAL CHALLENGERS BANGALORE", "min": 220, "max": 650, "Is_awarded": None},
    {"Team": "SUNRISERS HYDERABAD", "min": 775, "max": 1475, "Is_awarded": None},
]

# Create the dataframe from the list of dictionaries
df = pd.DataFrame(data)

I want to plot a candle stick chart representing the team name in X axis and corresponding min max value. the colour of the candle stick should be unique with respect to the third column Is_awarded; if 'yes' then red & if 'NA' blue. is there a way?

I have tried plotly but I'm not able to colour code it.


问:
Python egg file build and deploy
I have a project with tests in it. I am able to create the egg file using the below command in pycharm terminal.

```<code>python setup.py bdist_egg
</code>```

I am able to run the tests and generate report from pycharm terminal using below command.

```<code>  python -m pytest --cov --cov-report=html:reports/html_dir --cov-report=xml:reports/coverage.xml /path/to/tests
</code>```

I do not know how this would run through jenkins where I can build and create the egg file in a specified directory in unix system, and Also run tests to create the coverage report.

The egg file deployed will be used as is and requires no installation.

Title: Python egg file build and deploy

Body:
I have a project with tests in it. I am able to create the egg file using the below command in pycharm terminal.

python setup.py bdist_egg

I am able to run the tests and generate report from pycharm terminal using below command.

  python -m pytest --cov --cov-report=html:reports/html_dir --cov-report=xml:reports/coverage.xml /path/to/tests

I do not know how this would run through jenkins where I can build and create the egg file in a specified directory in unix system, and Also run tests to create the coverage report.

The egg file deployed will be used as is and requires no installation.


问:
Strange output of pwdLastSet
Some of AD accounts are inactive and their pwdLastSet is equal to 0.
However, when I'm trying to calculate password age for accounts, this inactive accounts gave me a last possible date 1601-01-01 00:00:00+00:00

Here is how it looks like:

```<code>
current_date = datetime.now(timezone.utc)
start_date = user_details[0].pwdLastSet.value
if  start_date == 0:
    password_age = 'NULL'
else:
    password_age = current_date - start_date
    print(password_age)
</code>```

Title: Strange output of pwdLastSet

Body:
Some of AD accounts are inactive and their pwdLastSet is equal to 0.
However, when I'm trying to calculate password age for accounts, this inactive accounts gave me a last possible date 1601-01-01 00:00:00+00:00

Here is how it looks like:

current_date = datetime.now(timezone.utc)
start_date = user_details[0].pwdLastSet.value
if  start_date == 0:
    password_age = 'NULL'
else:
    password_age = current_date - start_date
    print(password_age)


问:
Jest _stackUtils.default is not a constructor error in react native
Getting this error while trying to run jest test in react native.</p>
```<code>FAIL  src/utils/utils.test.ts

  ● Test suite failed to run

    TypeError: _stackUtils.default is not a constructor

      at Object.<anonymous> (node_modules/jest-message-util/build/index.js:72:20)
      at Object.<anonymous> (node_modules/expect/build/toThrowMatchers.js:9:24)
      at Object.<anonymous> (node_modules/expect/build/index.js:23:48)
      at _expect (node_modules/@jest/expect/build/index.js:8:16)
      at createJestExpect (node_modules/@jest/expect/build/index.js:29:3)
      at Object.<anonymous> (node_modules/@jest/expect/build/index.js:39:20)
      at tryCatch (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:72:17)
      at Generator._invoke (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:55:24)
      at Generator.next (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:97:21)
      at tryCatch (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:72:17)
      at invoke (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:103:20)
      at node_modules/@babel/runtime/helpers/regeneratorRuntime.js:123:11
      at callInvokeWithMethodAndArg (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:122:16)
      at AsyncIterator._invoke (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:126:129)
      at AsyncIterator.next (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:97:21)
      at Object.exports.async (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:198:63)
      at tryCatch (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:72:17)
      at Generator._invoke (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:55:24)
      at Generator.next (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:97:21)
      at tryCatch (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:72:17)
      at invoke (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:103:20)
      at node_modules/@babel/runtime/helpers/regeneratorRuntime.js:108:11
</code>```

Body:
Getting this error while trying to run jest test in react native.

FAIL  src/utils/utils.test.ts

  ● Test suite failed to run

    TypeError: _stackUtils.default is not a constructor

      at Object.<anonymous> (node_modules/jest-message-util/build/index.js:72:20)
      at Object.<anonymous> (node_modules/expect/build/toThrowMatchers.js:9:24)
      at Object.<anonymous> (node_modules/expect/build/index.js:23:48)
      at _expect (node_modules/@jest/expect/build/index.js:8:16)
      at createJestExpect (node_modules/@jest/expect/build/index.js:29:3)
      at Object.<anonymous> (node_modules/@jest/expect/build/index.js:39:20)
      at tryCatch (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:72:17)
      at Generator._invoke (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:55:24)
      at Generator.next (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:97:21)
      at tryCatch (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:72:17)
      at invoke (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:103:20)
      at node_modules/@babel/runtime/helpers/regeneratorRuntime.js:123:11
      at callInvokeWithMethodAndArg (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:122:16)
      at AsyncIterator._invoke (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:126:129)
      at AsyncIterator.next (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:97:21)
      at Object.exports.async (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:198:63)
      at tryCatch (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:72:17)
      at Generator._invoke (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:55:24)
      at Generator.next (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:97:21)
      at tryCatch (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:72:17)
      at invoke (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:103:20)
      at node_modules/@babel/runtime/helpers/regeneratorRuntime.js:108:11


问:
how to check for newline character in string input to an array in MIPS assembly
I am working on an assignment for MIPS assembly and this is my first time posting to stackoverflow and currently I am stuck on a part where I have to input string into an array and then terminate the input when I enter the newline character "\n". I am using memory mapped I/O and Polling.

```<code>.data
array: .word 0:10
.globl main
.text
main:
    la $s2,array
    li $t0, 0xffff0000 # Address of keyboard control register
    li $t1, 0 # Initialize wait_counter = 0
    li $s0,10
    li $s1,0
wait_keyboard:
    lw $t2, ($t0) # Read the keyboard control register
    andi $t2, $t2, 1 # Extract ready bit
    addiu $t1, $t1, 1 # wait_counter++ (counts iterations)
    beqz $t2, wait_keyboard # loop back while not ready
    lw $a0, 4($t0) # Get character from keyboard
    addi $s1,$s1,1
    li $v0,11
    syscall
    sw $a0,($s2)
    addi  $s2,$s2,4

    beq $a0,'\n',end
    bne $s1,$s0,wait_keyboard

end:

    #End Program
    li $v0,10
    syscall
</code>```

As you can see, I am checking for the newline character by using the beq $a0,'\n',end instruction which will end the loop after I enter the newline character .However this does not work as I enter the newline character for some reason. I would really appreciate it if you guys could tell me what I am doing wrong in this code.

I just need to know how exactly I can check for a newline character in input using memory mapped I/O and Polling.

Body:
I am working on an assignment for MIPS assembly and this is my first time posting to stackoverflow and currently I am stuck on a part where I have to input string into an array and then terminate the input when I enter the newline character "\n". I am using memory mapped I/O and Polling.

.data
array: .word 0:10
.globl main
.text
main:
    la $s2,array
    li $t0, 0xffff0000 # Address of keyboard control register
    li $t1, 0 # Initialize wait_counter = 0
    li $s0,10
    li $s1,0
wait_keyboard:
    lw $t2, ($t0) # Read the keyboard control register
    andi $t2, $t2, 1 # Extract ready bit
    addiu $t1, $t1, 1 # wait_counter++ (counts iterations)
    beqz $t2, wait_keyboard # loop back while not ready
    lw $a0, 4($t0) # Get character from keyboard
    addi $s1,$s1,1
    li $v0,11
    syscall
    sw $a0,($s2)
    addi  $s2,$s2,4

    beq $a0,'\n',end
    bne $s1,$s0,wait_keyboard

end:

    #End Program
    li $v0,10
    syscall

As you can see, I am checking for the newline character by using the beq $a0,'\n',end instruction which will end the loop after I enter the newline character .However this does not work as I enter the newline character for some reason. I would really appreciate it if you guys could tell me what I am doing wrong in this code.

I just need to know how exactly I can check for a newline character in input using memory mapped I/O and Polling.


问:
React and Tailwind CSS - switching sticky class on scroll
In my React page, there is an element, Block-2 positioned as sticky. When my scroll crosses the #block3 element, I would like to remove sticky class. When the user scrolls up and #block3 is visible in the scroll area again, the sticky class should be reapplied.

For Tailwind CSS, I'm not able to determine the correct way to do this, since the classnames fall under a direct element.

How can I handle this?

My React Page:

```<code>    // Dependencies
    import React from "react";

    // Styles
    import "./tailwind.output.css";

    const App = () => {
      const handleScroll = (event) => {
        //how to achieve the goal?
        console.log(event.currentTarget.scrollTop);
        console.log(event.currentTarget.offsetHeight);
      };

      return (
        <div
          onScroll={handleScroll}
          className="overflow-y-auto flex flex-wrap gap-4 h-screen border-solid border-4 border-indigo-600"
        >
          <div className="sticky bg-gray-500 top-0 z-30 h-[32rem] border-solid border-4 border-orange-600 ">
            Block-2
          </div>
          <div
            id="block3"
            className="h-[22rem] border-solid border-4 border-green-600 "
          >
            It is a long established fact that a reader will be distracted by the
            readable content of a page when looking at its layout. The point of
            using Lorem Ipsum is that it has a more-or-less normal distribution of
            letters, as opposed to using 'Content here, content here', making it
            look like readable English. Many desktop publishing packages and web
            page editors now use Lorem Ipsum as their default model text, and a
            search for 'lorem ipsum' will uncover many web sites still in their
            infancy. Various versions have evolved over the years, sometimes by
            accident, sometimes on purpose (injected humour and the like).
          </div>
          <div className="h-[32rem] grow border-solid border-4 border-gray-600 ">
            Block-3
          </div>
          <div>Last child</div>
        </div>
      );
    };

    export default App;
</code>```

Demo:

Code Sandbox

Body:
In my React page, there is an element, Block-2 positioned as sticky. When my scroll crosses the #block3 element, I would like to remove sticky class. When the user scrolls up and #block3 is visible in the scroll area again, the sticky class should be reapplied.

For Tailwind CSS, I'm not able to determine the correct way to do this, since the classnames fall under a direct element.

How can I handle this?

My React Page:

    // Dependencies
    import React from "react";

    // Styles
    import "./tailwind.output.css";

    const App = () => {
      const handleScroll = (event) => {
        //how to achieve the goal?
        console.log(event.currentTarget.scrollTop);
        console.log(event.currentTarget.offsetHeight);
      };

      return (

            Block-2

            It is a long established fact that a reader will be distracted by the
            readable content of a page when looking at its layout. The point of
            using Lorem Ipsum is that it has a more-or-less normal distribution of
            letters, as opposed to using 'Content here, content here', making it
            look like readable English. Many desktop publishing packages and web
            page editors now use Lorem Ipsum as their default model text, and a
            search for 'lorem ipsum' will uncover many web sites still in their
            infancy. Various versions have evolved over the years, sometimes by
            accident, sometimes on purpose (injected humour and the like).

            Block-3

Last child

      );
    };

    export default App;

Demo:

Code Sandbox


问:
is visibility also a reflection of reordering?about volatile,i think visibility and reordering are the same essentially
about volatile,i think visibility and reordering are the same essentially.
for example:

```<code>atomic<int> g_payLoad = {0};
atomic<int> g_guard = {0};

// thread 0
void foo1()
{
    g_payLoad.store(42, memory_order_relaxed);
    g_guard.store(1, memory_order_relaxed);
}

// thread 1
void foo2()
{
    int r = g_guard.load(memory_order_relaxed);
    if (r)
    {
       r = g_payLoad.load(memory_order_relaxed);
    }
}
</code>```

Since g_guard and g_payLoad are both read and written in a relaxed way, we may think that g_guard.load() and g_payLoad.load() in foo2() may be out of order (load from different addresses, cpu may speculate & prefetch, etc.),But from another point of view, the fact that g_payLoad is reordered to g_guard before (the same for other types of disorder) is equivalent to g_payLoad's changes in foo1 not being seen by foo2, two different perspectives on the same thing, that's all.

Do I understand it right?

Body:
about volatile,i think visibility and reordering are the same essentially.
for example:

atomic<int> g_payLoad = {0};
atomic<int> g_guard = {0};

// thread 0
void foo1()
{
    g_payLoad.store(42, memory_order_relaxed);
    g_guard.store(1, memory_order_relaxed);
}

// thread 1
void foo2()
{
    int r = g_guard.load(memory_order_relaxed);
    if (r)
    {
       r = g_payLoad.load(memory_order_relaxed);
    }
}

Since g_guard and g_payLoad are both read and written in a relaxed way, we may think that g_guard.load() and g_payLoad.load() in foo2() may be out of order (load from different addresses, cpu may speculate & prefetch, etc.),But from another point of view, the fact that g_payLoad is reordered to g_guard before (the same for other types of disorder) is equivalent to g_payLoad's changes in foo1 not being seen by foo2, two different perspectives on the same thing, that's all.

Do I understand it right?


问:
I have an esp8266 which pushes a timestamp up to firebase.How can i get it a readable format.?
/ To set and push data with timestamp, requires the JSON data with .sv placeholder
FirebaseJson json;

```<code>json.set("Data", "HelloConnel Good day");
// now we will set the timestamp value at Ts
json.set("Ts/.sv", "timestamp");    // .sv is the required place holder for sever value which currently supports only string "timestamp" as a value

// Set data with timestamp
Serial.printf("Set data with timestamp... %s\n", Firebase.setJSON(fbdo, "/test/set/data", json) ? fbdo.to<FirebaseJson>().raw() : fbdo.errorReason().c_str());

// Push data with timestamp
Serial.printf("Push data with timestamp... %s\n", Firebase.pushJSON(fbdo, "/test/push/data", json) ? "ok" : fbdo.errorReason().c_str());

// Get previous pushed data
Serial.printf("Get previous pushed data... %s\n", Firebase.getJSON(fbdo, "/test/push/data/" + fbdo.pushName()) ? fbdo.to<FirebaseJson>().raw() : fbdo.errorReason().c_str());
</code>```

}
}

All I want is the time in a readable format. I am not a programmer I am a hobbyist. Please tell  if there is a simple answer thanks

Body:
/ To set and push data with timestamp, requires the JSON data with .sv placeholder
FirebaseJson json;

json.set("Data", "HelloConnel Good day");
// now we will set the timestamp value at Ts
json.set("Ts/.sv", "timestamp");    // .sv is the required place holder for sever value which currently supports only string "timestamp" as a value

// Set data with timestamp
Serial.printf("Set data with timestamp... %s\n", Firebase.setJSON(fbdo, "/test/set/data", json) ? fbdo.to<FirebaseJson>().raw() : fbdo.errorReason().c_str());

// Push data with timestamp
Serial.printf("Push data with timestamp... %s\n", Firebase.pushJSON(fbdo, "/test/push/data", json) ? "ok" : fbdo.errorReason().c_str());

// Get previous pushed data
Serial.printf("Get previous pushed data... %s\n", Firebase.getJSON(fbdo, "/test/push/data/" + fbdo.pushName()) ? fbdo.to<FirebaseJson>().raw() : fbdo.errorReason().c_str());

}
}

All I want is the time in a readable format. I am not a programmer I am a hobbyist. Please tell  if there is a simple answer thanks


问:
If <preference name="scheme" value="app"/> plugin doesn't work
I found an issue when I have this line in config.xml because of iOS http requests the plugin doesn't load parameters from config.xml.

When I remove it, the plugin works fine. Is there any reason why it breaks the plugin?

Thanks so much.

see ref also in github for the original post from @zeroamps:
https://github.com/sampart/cordova-plugin-app-version/issues/135


问:
When i run my program i get this error in my terminal see the error i get down below
The code does not matter in my file i always get this code at the terminal and i dont know how fix it.

This is the code i get in the terminal.

ng : The term 'ng' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

ng serve

~~

CategoryInfo          : ObjectNotFound: (ng:String) [], CommandNotFoundException

FullyQualifiedErrorId : CommandNotFoundException

I tried to run some different commands on PowerShell but nothing seemed to fix it.


问:
How to add a point to the border of a surface in Gmsh?
I need to add a point to the boundary of an existing surface to refine the mesh in Gmsh.

The Python IDE has a function "gmsh.model.reparametrizeOnSurface(dim, tag, parametricCoord, surfaceTag, which=0)" which allows you to add points to a border without being bound to a surface. The "gmsh.model.mesh.embed(dim, tags, inDim, inTag)" function does not produce results, as it is not intended for objects on the boundary of a surface.enter image description here


问:
Applying same migrations to databases with different baselines using Flyway
Suppose we are at a point where we have multiple databases that have schemas that are at a 90% similarity (That's just a random number to say that they're very similar, but not fully)

The reasons for those differences are not important at this stage, but the ORM supposes that the databases are the same when accessing/modifying data.

I now want to start versioning these databases, except that it's impossible at this stage to align them (or at least, let's say it is impossible)

What would be the best way to do this with flyway (community version) ?

I thought of having 2 baseline scripts stored separately, baseline my databases with those respectively, and have all the migrations under a common directory where flyway will be looking to apply them.

And if a new dev database needs to be created, I'll base it upon the prod's baseline script.

Are there any best/recommended practices when it comes to doing this?

NOTE
All of this is done using the community CLI


问:
my player sprite got reversed on another client in my multiplayer game
I am trying to make a 2 player fighting game using pygame and sockets. Right now the two players are represented by two red rectangles, I am currently in the process of applying sprites to their positions, one a warrior character, the other a wizard character. However, once I applied the sprites I found that the sprite images get put in reverse for the second client, in one client window player 1 would be the warrior, while in the second client window player 1 is shown as the wizard.

The 2 code blocks show bits of code I used for the client and server. Right now I know if I wanted to give distant colors the the rectangles I could just add that property to the player object in the server class, but I can't seem to do this with sprites because of an issue with pickle not taking in surfaces, so right now I am stumped. How can I make sure the sprites stay consistent on both client screens?

```<code>import socket
import threading
import pickle
from player import Player
SERVER = "192.168.236.177" #socket.gethostbyname(socket.gethostname())
PORT = 5554
ADDRESS = (SERVER, PORT)

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(ADDRESS)
game_id = -1
after_a_game = [Player(1, 200, 310, False),
                Player(2, 700, 310, False)]
players = {-1: after_a_game.copy()}

...........................................
</code>```
```<code># client class
WARRIOR_SIZE = 162
WARRIOR_SCALE = 4
WARRIOR_OFFSET = [72, 56]
WARRIOR_DATA = [WARRIOR_SIZE, WARRIOR_SCALE, WARRIOR_OFFSET]
WIZARD_SIZE = 250
WIZARD_SCALE = 3
WIZARD_OFFSET = [112, 107]
WIZARD_DATA = [WIZARD_SIZE, WIZARD_SCALE, WIZARD_OFFSET]

# load sprite sheets
warrior_sheet = pygame.image.load("assets/images/warrior/Sprites/warrior.png").convert_alpha()
wizard_sheet = pygame.image.load("assets/images/wizard/Sprites/wizard.png").convert_alpha()

def player_draw(player):
    if player.id == 1:
        image1 = animation_list1[player1.action][player1.frame_index]
        screen.blit(image1, (player1.rect.x, player1.rect.y))
        pygame.draw.rect(screen, (255, 0, 0), player1.rect)
    elif player.id == 2:
        image2 = animation_list2[player2.action][player2.frame_index]
        screen.blit(image2, (player2.rect.x, player2.rect.y))
        pygame.draw.rect(screen, (255, 0, 0), player2.rect)

def load_images(sprite_sheet, animation_steps, data):
    # extract images from spritesheet
    animation_list = []
    for y, animation in enumerate(animation_steps):
        temp_img_list = []
        for x in range(animation):
            temp_img = sprite_sheet.subsurface(x * data[0], y * data[0], data[0], data[0])
            temp_img_list.append(temp_img)
        animation_list.append(temp_img_list)
    return animation_list

animation_list1 = load_images(warrior_sheet, WARRIOR_ANIMATION_STEPS, WARRIOR_DATA)
animation_list2 = load_images(wizard_sheet, WIZARD_ANIMATION_STEPS, WIZARD_DATA)

</code>```

Body:
I am trying to make a 2 player fighting game using pygame and sockets. Right now the two players are represented by two red rectangles, I am currently in the process of applying sprites to their positions, one a warrior character, the other a wizard character. However, once I applied the sprites I found that the sprite images get put in reverse for the second client, in one client window player 1 would be the warrior, while in the second client window player 1 is shown as the wizard.

The 2 code blocks show bits of code I used for the client and server. Right now I know if I wanted to give distant colors the the rectangles I could just add that property to the player object in the server class, but I can't seem to do this with sprites because of an issue with pickle not taking in surfaces, so right now I am stumped. How can I make sure the sprites stay consistent on both client screens?

import socket
import threading
import pickle
from player import Player
SERVER = "192.168.236.177" #socket.gethostbyname(socket.gethostname())
PORT = 5554
ADDRESS = (SERVER, PORT)

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(ADDRESS)
game_id = -1
after_a_game = [Player(1, 200, 310, False),
                Player(2, 700, 310, False)]
players = {-1: after_a_game.copy()}

...........................................

# client class
WARRIOR_SIZE = 162
WARRIOR_SCALE = 4
WARRIOR_OFFSET = [72, 56]
WARRIOR_DATA = [WARRIOR_SIZE, WARRIOR_SCALE, WARRIOR_OFFSET]
WIZARD_SIZE = 250
WIZARD_SCALE = 3
WIZARD_OFFSET = [112, 107]
WIZARD_DATA = [WIZARD_SIZE, WIZARD_SCALE, WIZARD_OFFSET]

# load sprite sheets
warrior_sheet = pygame.image.load("assets/images/warrior/Sprites/warrior.png").convert_alpha()
wizard_sheet = pygame.image.load("assets/images/wizard/Sprites/wizard.png").convert_alpha()

def player_draw(player):
    if player.id == 1:
        image1 = animation_list1[player1.action][player1.frame_index]
        screen.blit(image1, (player1.rect.x, player1.rect.y))
        pygame.draw.rect(screen, (255, 0, 0), player1.rect)
    elif player.id == 2:
        image2 = animation_list2[player2.action][player2.frame_index]
        screen.blit(image2, (player2.rect.x, player2.rect.y))
        pygame.draw.rect(screen, (255, 0, 0), player2.rect)

def load_images(sprite_sheet, animation_steps, data):
    # extract images from spritesheet
    animation_list = []
    for y, animation in enumerate(animation_steps):
        temp_img_list = []
        for x in range(animation):
            temp_img = sprite_sheet.subsurface(x * data[0], y * data[0], data[0], data[0])
            temp_img_list.append(temp_img)
        animation_list.append(temp_img_list)
    return animation_list

animation_list1 = load_images(warrior_sheet, WARRIOR_ANIMATION_STEPS, WARRIOR_DATA)
animation_list2 = load_images(wizard_sheet, WIZARD_ANIMATION_STEPS, WIZARD_DATA)


问:
Wordpress copy shortcodes from backend
I have been used a them where have added some shortcodes. But now i have migrated to new theme and want to clone all shortcodes, the problem is path. From old theme are too much paths for about images or other documents, also styles css. Is there any short way to clone all shortcodes from old theme to new?</p>

Title: Wordpress copy shortcodes from backend


问:
How to target array from get_ancestor function?
I'm getting undefined offset with my code.
I'm trying to pull out the top-level parent of a taxonomy of this archive page.
Then set different menus depends on their top-level parent taxonomy</p>
```<code><?php
    global $post;
    $parent = get_post_ancestors( $post->ID );

  if ($parent[0] == 3) {
    bellows( 'main' , array( 'menu' => 25 ) );
  } elseif ($parent[0] == 2) {
    bellows( 'main' , array( 'menu' => 51 ) );
  }
?>

</code>```

Body:
I'm getting undefined offset with my code.
I'm trying to pull out the top-level parent of a taxonomy of this archive page.
Then set different menus depends on their top-level parent taxonomy

<?php
    global $post;
    $parent = get_post_ancestors( $post->ID );

  if ($parent[0] == 3) {
    bellows( 'main' , array( 'menu' => 25 ) );
  } elseif ($parent[0] == 2) {
    bellows( 'main' , array( 'menu' => 51 ) );
  }
?>


问:
How do I update my data when calling a computed property from a method?
I used to have a huge template that consisted of multiple list items, each with their own conditions related to specific objects.
I decided it would be easier to store all the links in an array and move the conditions into methods instead.
The problem now is that some of the list items use computed properties which handles data from a prop, and when I used v-if these would change immediately when the data got updated, but now that I am using a method to call the computed property, the condition is not changed.

How do I make the component update without using v-if?

This is an example of how some of my code is written:

```<code>    <template v-for="(item, index) in rentalContract">
      <li :key="index" v-if="(index < 5 || showListItem) && item.function != null">
        <i :class="item.iconClass"></i>
        {{ item.name }}
        <strong class="ml-2"> {{ item.function }} </strong>
      </li>
    </template>

<script>
    props: {
      tenants: Array,
    },
data() {
      return {
        showListItem: false,
        rentalContract: [
          {
            iconClass: "fas fa-user fa-fw fa-lg icon-class ml-2 mr-2",
            name: this.$t('subtenantInUnit'),
            function: this.subtenantInUnit()
          }
        ]
      }
    },
    computed: {
      subtenantPresent() {
        return this.tenants.some(tenant => tenant.subtenant)
      }
    },
    methods: {
      subtenantInUnit(){
        if(this.subtenantPresent){
          return this.$t('yes')
        } else {
          return this.$t('no')
        }
      }
    }
</script>
</code>```

Even if the condition is True and the console shows "True", the function still returns False.
I tried to fix this by re-writing the function like this:

```<code>  subtenantInUnit(){
    if(this.tenants.some(tenant => tenant.subtenant)){
      return this.$t('yes')
    } else {
      return this.$t('no')
    }
  }
</code>```

This actually works, BUT it does not update automatically like it did when I used v-if="subtenant".
I need to refresh the page in order to see the changes.
Is there a way I can force the component to refresh when the condition is changed, or is there some other way to mimic v-if and only use the computed property?

Remember I cannot write a v-if for this in my template because there will be other list items which should not be affected by the conditions of this one item.

Body:
I used to have a huge template that consisted of multiple list items, each with their own conditions related to specific objects.
I decided it would be easier to store all the links in an array and move the conditions into methods instead.
The problem now is that some of the list items use computed properties which handles data from a prop, and when I used v-if these would change immediately when the data got updated, but now that I am using a method to call the computed property, the condition is not changed.

How do I make the component update without using v-if?

This is an example of how some of my code is written:

    <template v-for="(item, index) in rentalContract">
      <li :key="index" v-if="(index < 5 || showListItem) && item.function != null">

        {{ item.name }}
         {{ item.function }}

    </template>

Even if the condition is True and the console shows "True", the function still returns False.
I tried to fix this by re-writing the function like this:

  subtenantInUnit(){
    if(this.tenants.some(tenant => tenant.subtenant)){
      return this.$t('yes')
    } else {
      return this.$t('no')
    }
  }

This actually works, BUT it does not update automatically like it did when I used v-if="subtenant".
I need to refresh the page in order to see the changes.
Is there a way I can force the component to refresh when the condition is changed, or is there some other way to mimic v-if and only use the computed property?

Remember I cannot write a v-if for this in my template because there will be other list items which should not be affected by the conditions of this one item.


问:
Graphframes - Distance between vertices in the same connected component

Problem

I have a Graphframes graph, from which I've obtained the connected components. Now, I would like to find the distance from a source node to a target node, both pertaining to the same component.

id_src
id_dst
component

123
657
1

234
876
2

876
567
2

I would like to calculate the distance from id_src to id_dst for each row in this DataFrame, so the result would look like:

id_src
id_dst
component
distance

123
657
1
4

234
876
2
2

876
567
2
2

I know I need to use the BFS function from Graphframes, but can't find the way to make it parallel and provide the source and destination id for each row.

What I've tried

I've tried to do it through a UDF, with no luck.

from math import floor
from pyspark.sql.functions import udf
from pyspark.sql.types import *

@udf
def shortest_path(x):
    if x[1] is not None:
        path = g.bfs(f"id = '{x[0]}'", f"id = '{x[1]}'", maxPathLength=4)
        return floor((len(path.columns)-2)/2) + 1

result = vars.select(shortest_path(F.struct("id_src", "id_dst")))
```
<p>This results in the following exception, I understand it's because I can't parallelize an already parallel function:</p>
```Traceback (most recent call last):
  File "/databricks/spark/python/pyspark/serializers.py", line 476, in dumps
    return cloudpickle.dumps(obj, pickle_protocol)
  File "/databricks/spark/python/pyspark/cloudpickle/cloudpickle_fast.py", line 72, in dumps
    cp.dump(obj)
  File "/databricks/spark/python/pyspark/cloudpickle/cloudpickle_fast.py", line 540, in dump
    return Pickler.dump(self, obj)
TypeError: cannot pickle '_thread.RLock' object
```

I also thought about using a non-parallel library like networkx or igraph, creating a single graph from each connected component. The problem is I don't know how to generate these single graphs and then reference them from the udf.

Any ideas are appreciated, thank you

Body:
Problem

I have a Graphframes graph, from which I've obtained the connected components. Now, I would like to find the distance from a source node to a target node, both pertaining to the same component.

id_src
id_dst
component

123
657
1

234
876
2

876
567
2

I would like to calculate the distance from id_src to id_dst for each row in this DataFrame, so the result would look like:

id_src
id_dst
component
distance

123
657
1
4

234
876
2
2

876
567
2
2

I know I need to use the BFS function from Graphframes, but can't find the way to make it parallel and provide the source and destination id for each row.

What I've tried

I've tried to do it through a UDF, with no luck.

from math import floor
from pyspark.sql.functions import udf
from pyspark.sql.types import *

@udf
def shortest_path(x):
    if x[1] is not None:
        path = g.bfs(f"id = '{x[0]}'", f"id = '{x[1]}'", maxPathLength=4)
        return floor((len(path.columns)-2)/2) + 1

result = vars.select(shortest_path(F.struct("id_src", "id_dst")))

This results in the following exception, I understand it's because I can't parallelize an already parallel function:

Traceback (most recent call last):
  File "/databricks/spark/python/pyspark/serializers.py", line 476, in dumps
    return cloudpickle.dumps(obj, pickle_protocol)
  File "/databricks/spark/python/pyspark/cloudpickle/cloudpickle_fast.py", line 72, in dumps
    cp.dump(obj)
  File "/databricks/spark/python/pyspark/cloudpickle/cloudpickle_fast.py", line 540, in dump
    return Pickler.dump(self, obj)
TypeError: cannot pickle '_thread.RLock' object

I also thought about using a non-parallel library like networkx or igraph, creating a single graph from each connected component. The problem is I don't know how to generate these single graphs and then reference them from the udf.

Any ideas are appreciated, thank you


问:
react-cookie-consent is not working in IP? But it's working fine in Localhost
I have installed a react-cookies-consent and also I have customized it.
npm i react-cookie-consent
It's working fine in localhost but when I have moved my code to the development environment which server is running in IP. It's not working there why??

Could you please help me to come out?


问:
Assertions in Selenium Python
I am starting automation testing in selenium python .how we assert value java if java is available on the website or not .

I have added a pic of the website.

Website link: https://www.tutorialspoint.com/java/index.htm

```<code>class Test(unittest.TestCase):
    def testName(self):
        s =Service("C:\Program Files (x86)\chromedriver.exe")
        driver= webdriver.Chrome(service=s)
        driver.get("https://www.tutorialspoint.com/java/index.htm")

        actualString = driver.find_element(By.TAG_NAME, "a").text
        actualString.assertTrue(actualString.contains("java"));

if __name__ == "__main__":
    unittest.main()
</code>```

Title: Assertions in Selenium Python

Body:
I am starting automation testing in selenium python .how we assert value java if java is available on the website or not .

I have added a pic of the website.

Website link: https://www.tutorialspoint.com/java/index.htm

class Test(unittest.TestCase):
    def testName(self):
        s =Service("C:\Program Files (x86)\chromedriver.exe")
        driver= webdriver.Chrome(service=s)
        driver.get("https://www.tutorialspoint.com/java/index.htm")

        actualString = driver.find_element(By.TAG_NAME, "a").text
        actualString.assertTrue(actualString.contains("java"));

if __name__ == "__main__":
    unittest.main()


问:
how to configure npm artifactory authentication in package.json
I didn't find any way to configure jfrog artifactory login credentials in node project package.json
Here is a sample JSON way to configure for PHP composer.json

```<code>{
  "config": {
    "http-basic": {
      "artifacts.jfrog.io":{
        "username": "usernamexxxxxx",
        "password": "passwordxxxxxx"
      }
    }
  },
  "repositories":{
    "type": "composer"
    "url": "https://artifcts.jfrog.io/artifactory/api/composer/php-release-virtual"
  }
}
</code>```

Can we configure it like this for node project package.json

Body:
I didn't find any way to configure jfrog artifactory login credentials in node project package.json
Here is a sample JSON way to configure for PHP composer.json

{
  "config": {
    "http-basic": {
      "artifacts.jfrog.io":{
        "username": "usernamexxxxxx",
        "password": "passwordxxxxxx"
      }
    }
  },
  "repositories":{
    "type": "composer"
    "url": "https://artifcts.jfrog.io/artifactory/api/composer/php-release-virtual"
  }
}

Can we configure it like this for node project package.json


问:
Django + vue.js importing modules problem while using vue-simple-context-menu
How can I import modules for VueJS app in a template, rendered by Django. I'm trying to import module vueSimpleContextMenu.
for ref- https://www.npmjs.com/package/vue-simple-context-menu trying to use this library but it requires import statement which I am unable to use.

This is my situation:

archiveModal.html:

```<code><template id="archiveModal">
   <ul>
     <li
      v-for="item in items"
       @click.prevent.stop="handleClick($event, item)"
        class="item-wrapper__item"
     >
      {{item.name}}
     </li>
   </ul>
   <vue-simple-context-menu element-id="1" :options="options" ref="vueSimpleContextMenu"
          @option-clicked="optionClicked" />
<template>
</code>```

archiveModal.js

```<code>const archiveModal = {
  delimiters: ['[[', ']]'],
  template: '#archiveModal',
  data() {
    return {
      options: [
        {
          name: 'Duplicate',
          slug: 'duplicate',
        },
        {
          type: 'divider',
        },
        {
          name: 'Edit',
          slug: 'edit',
        },
        {
          name: '<em>Delete</em>',
          slug: 'delete',
        },
      ],
    };
  },
  methods: {
    handleClick(event, item) {
     this.$refs.vueSimpleContextMenu.showMenu(event, item)
   },
   optionClicked(event) {
     window.alert(JSON.stringify(event))
   },
  },
 component: {
   'vue-simple-context-menu': VueSimpleContextMenu,
 },
};
</code>```

On Github it requires

import VueSimpleContextMenu from 'vue-simple-context-menu';

import 'vue-simple-context-menu/dist/vue-simple-context-menu.css';

Is there a way to use that in django template and where am I doing the mistake?

Body:
How can I import modules for VueJS app in a template, rendered by Django. I'm trying to import module vueSimpleContextMenu.
for ref- https://www.npmjs.com/package/vue-simple-context-menu trying to use this library but it requires import statement which I am unable to use.

This is my situation:

archiveModal.html:

<template id="archiveModal">

      {{item.name}}

   <vue-simple-context-menu element-id="1" :options="options" ref="vueSimpleContextMenu"
          @option-clicked="optionClicked" />
<template>

archiveModal.js

const archiveModal = {
  delimiters: ['[[', ']]'],
  template: '#archiveModal',
  data() {
    return {
      options: [
        {
          name: 'Duplicate',
          slug: 'duplicate',
        },
        {
          type: 'divider',
        },
        {
          name: 'Edit',
          slug: 'edit',
        },
        {
          name: 'Delete',
          slug: 'delete',
        },
      ],
    };
  },
  methods: {
    handleClick(event, item) {
     this.$refs.vueSimpleContextMenu.showMenu(event, item)
   },
   optionClicked(event) {
     window.alert(JSON.stringify(event))
   },
  },
 component: {
   'vue-simple-context-menu': VueSimpleContextMenu,
 },
};

On Github it requires

import VueSimpleContextMenu from 'vue-simple-context-menu';

import 'vue-simple-context-menu/dist/vue-simple-context-menu.css';

Is there a way to use that in django template and where am I doing the mistake?


问:
What does logman query providers -pid really do?
Apparently, logman query providers -pid $pid allows us to see which providers the process $pid writes to.

But how does the process $pid open a handle to the providers? What's the API?


问:
Complexity of CNN models after applying transfer learning and fine-tuning
Is it possible to calculate the Complexities of CNN models after applying transfer learning and fine-tuning if so then how many ways are there to evaluate it?

So far I have searched about it but I couldn't get the answer to my question as I asked above. I wanna know if there are possible and easy ways to evaluate the compliexities of CNN Algorithms.


问:
how to deal with this problem when I am working to compile?
In ubuntu when I "make"
the terminal saids

```<code>rm -f *.d *.o lex.yy.c sysy.tab.c sysy.tab.h parser sysy.output
bison -d --report=all sysy.y
sysy.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
flex sysy.l
g++ sysy.tab.c lex.yy.c -o parser
/usr/bin/ld: /tmp/ccxyUpPX.o: in function `yyparse()':
sysy.tab.c:(.text+0xc0e): undefined reference to `node::node(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: sysy.tab.c:(.text+0xc9b): undefined referenc`your text`e to `node::push(std::initializer_list<node*>)'
/usr/bin/ld: sysy.tab.c:(.text+0xd2d): undefined reference to `node::node(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
</code>```

I have no idea about the problem

do me a favor please,I am totally a green hand,the method to solve the problem shall be as detailed as possible.

Body:
In ubuntu when I "make"
the terminal saids

rm -f *.d *.o lex.yy.c sysy.tab.c sysy.tab.h parser sysy.output
bison -d --report=all sysy.y
sysy.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
flex sysy.l
g++ sysy.tab.c lex.yy.c -o parser
/usr/bin/ld: /tmp/ccxyUpPX.o: in function `yyparse()':
sysy.tab.c:(.text+0xc0e): undefined reference to `node::node(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: sysy.tab.c:(.text+0xc9b): undefined referenc`your text`e to `node::push(std::initializer_list<node*>)'
/usr/bin/ld: sysy.tab.c:(.text+0xd2d): undefined reference to `node::node(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'

I have no idea about the problem

do me a favor please,I am totally a green hand,the method to solve the problem shall be as detailed as possible.


问:
react checkbox treeview correct icons not showing issue
I have follow below example. Its working fine. But my icons are not showing. Its showing as below.

this is my sample project.

https://codesandbox.io/s/sample-treeview-1zwd3w?file=/src/index.js


问:
How to share third party packages during runtime in Vue?
I have a container app with 4 different Vue apps. They all are using almost same third party packages. I want to share the packages in runtime (i.e., to cache them somewhere), so that any of my apps can use the packages without multiple time downloading and use them from that cache. Basically how can I share dependencies across multiple Vue apps in runtime?

I tried on it but I don't want to use MonoRepo, as that is more to do with build time reduction. I want to share the dependencies in runtime, as whenever an app runs do not have to download them several times


问:
How to populate collection in Strapi V3?
I'm trying to create custom controller for my Strapi (v3.6.10) model, but have a problem with populating one specific field. Here are my models:

Parent model:

```<code>{
  "kind": "collectionType",
  "collectionName": "clinic_pages",
  "info": {
    "name": "clinic-page",
  },
  "attributes": {
    "clinic": {
      "model": "clinic"
    },
    ...otherParentModelFields,
  }
}
</code>```

Clinic:

```<code>{
  "kind": "collectionType",
  "collectionName": "clinics",
  "attributes": {
    ...otherFields,
    "schedule": {
      "type": "component",
      "repeatable": true,
      "component": "clinic.schedule"
    },
  }
}
</code>```

Schedule:

```<code>{
  "collectionName": "components_clinic_schedules",
  "info": {
    "name": "schedule",
  },
  "attributes": {
    "time": {...},
    "day": {...}
  }
}
</code>```

I need to populate only few fields from parent model, including clinic. So I'm using this query:
await strapi.services[MODEL].findOne(ctx.query) and receiving full schedule data in response:

```<code>{
  ...otherFieldsOfModel,
  clinic: {
    id: 1,
    ...otherFields,
    schedule: [
      { id: 1, time: '9:00', day: 'monday' },
      { id: 2, time: '10:00', day: 'tuesday' }
    ]
  }
}
</code>```

That's fine, I see clinic and schedule, and all other fields in parent model. But then I wand to add populate to reduce size of those other fields and what I got?. Every time I'm getting anything instead of populated data for clinic.schedule even if I'm adding it to populate list. In all this cases:

```<code>await strapi.services[MODEL].findOne(ctx.query, {});
await strapi.services[MODEL].findOne(ctx.query, {clinic: true});
await strapi.services[MODEL].findOne(ctx.query, ['clinic']);
await strapi.services[MODEL].findOne(ctx.query, ['clinic', 'clinic.schedule', 'clinic.schedule.day', 'clinic.schedule.time']);
</code>```

and so on... I mean I tried any possible syntax variant and don't even got a schedule: null. This field not returning anymore in the response. How do I populate this collection?

P.S. Yes, I know that Strapi is v4 already, unfortunately I can't update it for now.

Body:
I'm trying to create custom controller for my Strapi (v3.6.10) model, but have a problem with populating one specific field. Here are my models:

Parent model:

{
  "kind": "collectionType",
  "collectionName": "clinic_pages",
  "info": {
    "name": "clinic-page",
  },
  "attributes": {
    "clinic": {
      "model": "clinic"
    },
    ...otherParentModelFields,
  }
}

Clinic:

{
  "kind": "collectionType",
  "collectionName": "clinics",
  "attributes": {
    ...otherFields,
    "schedule": {
      "type": "component",
      "repeatable": true,
      "component": "clinic.schedule"
    },
  }
}

Schedule:

{
  "collectionName": "components_clinic_schedules",
  "info": {
    "name": "schedule",
  },
  "attributes": {
    "time": {...},
    "day": {...}
  }
}

I need to populate only few fields from parent model, including clinic. So I'm using this query:
await strapi.services[MODEL].findOne(ctx.query) and receiving full schedule data in response:

{
  ...otherFieldsOfModel,
  clinic: {
    id: 1,
    ...otherFields,
    schedule: [
      { id: 1, time: '9:00', day: 'monday' },
      { id: 2, time: '10:00', day: 'tuesday' }
    ]
  }
}

That's fine, I see clinic and schedule, and all other fields in parent model. But then I wand to add populate to reduce size of those other fields and what I got?. Every time I'm getting anything instead of populated data for clinic.schedule even if I'm adding it to populate list. In all this cases:

await strapi.services[MODEL].findOne(ctx.query, {});
await strapi.services[MODEL].findOne(ctx.query, {clinic: true});
await strapi.services[MODEL].findOne(ctx.query, ['clinic']);
await strapi.services[MODEL].findOne(ctx.query, ['clinic', 'clinic.schedule', 'clinic.schedule.day', 'clinic.schedule.time']);

and so on... I mean I tried any possible syntax variant and don't even got a schedule: null. This field not returning anymore in the response. How do I populate this collection?

P.S. Yes, I know that Strapi is v4 already, unfortunately I can't update it for now.