问:
Fatal Python error: (pygame parachute) Segmentation Fault Error
i have been wotkin in this but when I run the code it does not work and and keep getting this error.

I dont know what wrong in the code thank you!

```<code>### Server
import socket
from threading import *
import socket
import pygame
import pygame.camera
from pygame.locals import *

def server():
    try:
        print("\nServer started at " + str(socket.gethostbyname(socket.gethostname())) + " at port " + str(90))
        port = 90
        serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        serversocket.bind(("",port))
        serversocket.listen(10)
        pygame.camera.init()
        cam = pygame.camera.Camera(0,(640,480),"RGB")
        cam.start()
        img = pygame.Surface((640,480))
        while True:
            connection, address = serversocket.accept()
            print("GOT_CONNECTION")
            cam.get_image(img)
            data = pygame.image.tostring(img,"RGB")
            connection.sendall(data)
            connection.close()
    except:
        pass

server()
</code>```

result:

pygame 2.1.2 (SDL 2.0.18, Python 3.8.3)
Hello from the pygame community. https://www.pygame.org/contribute.html

Server started at 192.168.1.11 at port 90
Fatal Python error: (pygame parachute) Segmentation Fault
Python runtime state: initialized

Thread 0x000067dc (most recent call first):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 306 in wait
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 558 in wait
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydevd.py", line 261 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Thread 0x00006ef0 (most recent call first):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 306 in wait
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 558 in wait
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydevd.py", line 215 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Thread 0x00005284 (most recent call first):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 302 in wait
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 558 in wait
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_timeout.py", line 43 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Thread 0x00001768 (most recent call first):
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 204 in _read_line
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 222 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Thread 0x00002168 (most recent call first):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 306 in wait
File "C:\Program Files (x86)\Python38-32\lib\queue.py", line 179 in get
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 367 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Current thread 0x00007660 (most recent call first):
File "c:\Users\Denzel\source\repos\videoStream\server.py", line 18 in server
File "c:\Users\Denzel\source\repos\videoStream\server.py", line 31 in <module>
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 124 in _run_code
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 135 in _run_module_code
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 321 in run_path
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 284 in run_file
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430 in main
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy\_main_.py", line 39 in <module>
File "C:\Program Files (x86)\Python38-32\lib\runpy.py", line 87 in _run_code
File "C:\Program Files (x86)\Python38-32\lib\runpy.py", line 194 in _run_module_as_main
PS C:\Users\Denzel\source\repos\videoStream>  c:; cd 'c:\Users\Denzel\source\repos\videoStream'; & 'C:\Program Files (x86)\Python38-32\python.exe' 'c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '59292' '--' 'c:\Users\Denzel\source\repos\videoStream\server.py'
pygame 2.1.2 (SDL 2.0.18, Python 3.8.3)
Hello from the pygame community. https://www.pygame.org/contribute.html

Server started at 192.168.1.11 at port 90
Fatal Python error: (pygame parachute) Segmentation Fault
Python runtime state: initialized

Thread 0x00007068 (most recent call first):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 306 in wait
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 558 in wait
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydevd.py", line 261 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Thread 0x000071d4 (most recent call first):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 306 in wait
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 558 in wait
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydevd.py", line 215 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Thread 0x00007644 (most recent call first):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 302 in wait
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 558 in wait
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_timeout.py", line 43 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Thread 0x0000619c (most recent call first):
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 204 in _read_line
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 222 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Thread 0x00002c98 (most recent call first):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 306 in wait
File "C:\Program Files (x86)\Python38-32\lib\queue.py", line 179 in get
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 367 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Current thread 0x000077b4 (most recent call first):
File "c:\Users\Denzel\source\repos\videoStream\server.py", line 18 in server
File "c:\Users\Denzel\source\repos\videoStream\server.py", line 31 in <module>
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 124 in _run_code
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 135 in _run_module_code
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 321 in run_path
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 284 in run_file
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430 in main
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy\_main_.py", line 39 in <module>
File "C:\Program Files (x86)\Python38-32\lib\runpy.py", line 87 in _run_code
File "C:\Program Files (x86)\Python38-32\lib\runpy.py", line 194 in _run_module_as_main

Body:
i have been wotkin in this but when I run the code it does not work and and keep getting this error.

I dont know what wrong in the code thank you!

### Server
import socket
from threading import *
import socket
import pygame
import pygame.camera
from pygame.locals import *

def server():
    try:
        print("\nServer started at " + str(socket.gethostbyname(socket.gethostname())) + " at port " + str(90))
        port = 90
        serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        serversocket.bind(("",port))
        serversocket.listen(10)
        pygame.camera.init()
        cam = pygame.camera.Camera(0,(640,480),"RGB")
        cam.start()
        img = pygame.Surface((640,480))
        while True:
            connection, address = serversocket.accept()
            print("GOT_CONNECTION")
            cam.get_image(img)
            data = pygame.image.tostring(img,"RGB")
            connection.sendall(data)
            connection.close()
    except:
        pass

server()

result:

pygame 2.1.2 (SDL 2.0.18, Python 3.8.3)
Hello from the pygame community. https://www.pygame.org/contribute.html

Server started at 192.168.1.11 at port 90
Fatal Python error: (pygame parachute) Segmentation Fault
Python runtime state: initialized

Thread 0x000067dc (most recent call first):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 306 in wait
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 558 in wait
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydevd.py", line 261 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Thread 0x00006ef0 (most recent call first):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 306 in wait
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 558 in wait
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydevd.py", line 215 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Thread 0x00005284 (most recent call first):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 302 in wait
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 558 in wait
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_timeout.py", line 43 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Thread 0x00001768 (most recent call first):
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 204 in _read_line
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 222 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Thread 0x00002168 (most recent call first):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 306 in wait
File "C:\Program Files (x86)\Python38-32\lib\queue.py", line 179 in get
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 367 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Current thread 0x00007660 (most recent call first):
File "c:\Users\Denzel\source\repos\videoStream\server.py", line 18 in server
File "c:\Users\Denzel\source\repos\videoStream\server.py", line 31 in <module>
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 124 in _run_code
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 135 in _run_module_code
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 321 in run_path
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 284 in run_file
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430 in main
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy\_main_.py", line 39 in <module>
File "C:\Program Files (x86)\Python38-32\lib\runpy.py", line 87 in _run_code
File "C:\Program Files (x86)\Python38-32\lib\runpy.py", line 194 in _run_module_as_main
PS C:\Users\Denzel\source\repos\videoStream>  c:; cd 'c:\Users\Denzel\source\repos\videoStream'; & 'C:\Program Files (x86)\Python38-32\python.exe' 'c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '59292' '--' 'c:\Users\Denzel\source\repos\videoStream\server.py'
pygame 2.1.2 (SDL 2.0.18, Python 3.8.3)
Hello from the pygame community. https://www.pygame.org/contribute.html

Server started at 192.168.1.11 at port 90
Fatal Python error: (pygame parachute) Segmentation Fault
Python runtime state: initialized

Thread 0x00007068 (most recent call first):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 306 in wait
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 558 in wait
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydevd.py", line 261 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Thread 0x000071d4 (most recent call first):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 306 in wait
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 558 in wait
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\pydevd.py", line 215 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Thread 0x00007644 (most recent call first):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 302 in wait
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 558 in wait
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_timeout.py", line 43 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Thread 0x0000619c (most recent call first):
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 204 in _read_line
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 222 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Thread 0x00002c98 (most recent call first):
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 306 in wait
File "C:\Program Files (x86)\Python38-32\lib\queue.py", line 179 in get
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 367 in _on_run
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Program Files (x86)\Python38-32\lib\threading.py", line 890 in _bootstrap

Current thread 0x000077b4 (most recent call first):
File "c:\Users\Denzel\source\repos\videoStream\server.py", line 18 in server
File "c:\Users\Denzel\source\repos\videoStream\server.py", line 31 in <module>
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 124 in _run_code
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 135 in _run_module_code
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 321 in run_path
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 284 in run_file
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430 in main
File "c:\Users\Denzel\.vscode\extensions\ms-python.python-2022.18.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy\_main_.py", line 39 in <module>
File "C:\Program Files (x86)\Python38-32\lib\runpy.py", line 87 in _run_code
File "C:\Program Files (x86)\Python38-32\lib\runpy.py", line 194 in _run_module_as_main


来源: stackexchange

问:
How can I get bluetooth data of surrounding devices with pyscript on web (Client - Side)
We are developing a web project in which we need to get the bluetooth data of the surrounding devices (ibeacons) with Python. Actually, we tried to do this on the client side with the google web bluetooth api, but we couldn't because the modules were not working. We want to receive the data we can get with the Python Bleak library on the client side and save it in the session. We think we can do this with the best pyscript. However, our problem is: "The Bleak Library does not work with the pyscript library".
How can I solve this problem? Could you please add the Bleak library among the libraries that can work integrated with pyscript?
Or does anyone have a different suggestion?
Where can I find the list of libraries that work integrated with Pyscript?</p>

ContentLicense: CC BY-SA 4.0


问:
Create new log file each application run in IntelliJ
I know how to create a log with IntelliJ for run configurations, but is it possible to have the name of the file change dynamically each run? The documentation links to Apache Ant for patterns, but as far as I can tell, this is only used to determine which files should be watched and output to the log file.

What I would like is something like:

Save console output to file: /path/to/log/location/logForProject_${current-time}.log


问:
Uploading images in React Native using FormData on Android
I have been working on a mobile app for the past year, and are preparing to deploy to production. Our app is used for sending applications for a certain license, and some users may be required to upload images in their application.

This feature has been implemented and working for many months, and given us no issues. However, now the Android version of the app is causing problems. When we submit the application, the fetch request to the endpoint is initiated, but never actually hits (only if images are included in the application).

Here is the code where the images are handled:

```<code>const xhr = new XMLHttpRequest()
xhr.responseType = 'blob'
xhr.onload = () => {
  const file = xhr.response
  const extension = file.type.split('image/').pop()
  const fileName = `${field.identifier}-${docCounter}.${extension}`

  if (Platform.OS === 'web') {
    formData.append('filesToUpload', file, fileName)
  } else {
    formData.append('filesToUpload', {
      uri: fileInfo.uri,
      type: `image/${extension}`,
      name: fileName,
    })
  }
 //Other unrelated code
}
xhr.open('GET', url)
xhr.send()
</code>```

Then the request:

```<code>const task = await fetch(
    new Request(`${Constants?.manifest?.extra?.hostname}/ext/tasks`, {
        method: 'POST',
      }),
      {
        body: formData,
        headers,
      }
)
</code>```

The headers just includes an authorisation token related to the user submitting the application.

So yeah, on web and iOS, this processes with no issue, but on Android, it starts the request, but never hits the endpoint.

Any help would be appreciated.

EDIT

I have been doing some debugging, and I think the issue is that the the file is not giving me a type from the blob, so in my formData type: 'image/${extension}', the extension does not exist.

So I logged the file object on both Android and iOS, and this is what I got.

iOS

```<code>{"_data": {"__collector": {}, "blobId": "1B56DE00-DDE9-494A-B57A-343040B6D12B", "name": "users_zw3GBtId4O0m0FAtpc94AUgBchPU_mutable_b293b904-6711-4384-a1c2-e540f5d6c1f8.png", "offset": 0, "size": 455495, "type": "image/png"}}
</code>```

Android

```<code>{"_data": {"__collector": {}, "blobId": "11a2875e-903c-4f87-a997-7e31c7013cfb", "offset": 0, "size": 179757}}
</code>```

So as yo can see, the iOS app is giving me more data, and also the extension of the file.

I still don't know why this is the case.

Body:
I have been working on a mobile app for the past year, and are preparing to deploy to production. Our app is used for sending applications for a certain license, and some users may be required to upload images in their application.

This feature has been implemented and working for many months, and given us no issues. However, now the Android version of the app is causing problems. When we submit the application, the fetch request to the endpoint is initiated, but never actually hits (only if images are included in the application).

Here is the code where the images are handled:

const xhr = new XMLHttpRequest()
xhr.responseType = 'blob'
xhr.onload = () => {
  const file = xhr.response
  const extension = file.type.split('image/').pop()
  const fileName = `${field.identifier}-${docCounter}.${extension}`

  if (Platform.OS === 'web') {
    formData.append('filesToUpload', file, fileName)
  } else {
    formData.append('filesToUpload', {
      uri: fileInfo.uri,
      type: `image/${extension}`,
      name: fileName,
    })
  }
 //Other unrelated code
}
xhr.open('GET', url)
xhr.send()

Then the request:

const task = await fetch(
    new Request(`${Constants?.manifest?.extra?.hostname}/ext/tasks`, {
        method: 'POST',
      }),
      {
        body: formData,
        headers,
      }
)

The headers just includes an authorisation token related to the user submitting the application.

So yeah, on web and iOS, this processes with no issue, but on Android, it starts the request, but never hits the endpoint.

Any help would be appreciated.

EDIT

I have been doing some debugging, and I think the issue is that the the file is not giving me a type from the blob, so in my formData type: 'image/${extension}', the extension does not exist.

So I logged the file object on both Android and iOS, and this is what I got.

iOS

{"_data": {"__collector": {}, "blobId": "1B56DE00-DDE9-494A-B57A-343040B6D12B", "name": "users_zw3GBtId4O0m0FAtpc94AUgBchPU_mutable_b293b904-6711-4384-a1c2-e540f5d6c1f8.png", "offset": 0, "size": 455495, "type": "image/png"}}

Android

{"_data": {"__collector": {}, "blobId": "11a2875e-903c-4f87-a997-7e31c7013cfb", "offset": 0, "size": 179757}}

So as yo can see, the iOS app is giving me more data, and also the extension of the file.

I still don't know why this is the case.


问:
Why does my compiler in swift jump around in the function?
I copied a Swift-func last week out of the internet Link. The function should convert 2 CLLocationDegrees (latitude and longitude) into an address. From the address I only need the postal code. The postal code gets saved in var plz: String. Then if everything works out my function should return plz. Somehow it doesn't and compiles the function code weirdly.

Even with getter and setter methods or local variables, I couldn't get my postal code to be returned at the right time. Is it possible to force a wait or something?

Code:

```<code>import Foundation
import CoreLocation

class GeoCodeLocation{

    func reverseGeocoding(latitude: CLLocationDegrees, longitude: CLLocationDegrees) -> String{
            var plz:String?
            let geocoder = CLGeocoder()
            let location = CLLocation(latitude: latitude, longitude: longitude)
            geocoder.reverseGeocodeLocation(location, completionHandler: {(placemarks, error) -> Void in
                if error != nil {
                    print("Failed to retrieve address")
                    return
                }

                if let placemarks = placemarks, let placemark = placemarks.first {
                    print("DEBUG: placemark.plz! ->\(placemark.plz!)")
                    plz = placemark.plz!
                    print("DEBUG: plz after initialising \(String(describing: plz))")
                }
                else
                {
                    print("No Matching Address Found")
                }

            })
        print("DEBUG: Postalcode before return \(String(describing: plz))")
        if let plz = plz{
            return plz
        }
        return ""
        }

}

</code>```

This is the order of the print statements:

DEBUG: Postalcode before return nil

DEBUG: placemark.plz! ->1220

DEBUG: plz after initialising Optional("1220")

How do I return the postal code at the right time?

Body:
I copied a Swift-func last week out of the internet Link. The function should convert 2 CLLocationDegrees (latitude and longitude) into an address. From the address I only need the postal code. The postal code gets saved in var plz: String. Then if everything works out my function should return plz. Somehow it doesn't and compiles the function code weirdly.

Even with getter and setter methods or local variables, I couldn't get my postal code to be returned at the right time. Is it possible to force a wait or something?

Code:

import Foundation
import CoreLocation

class GeoCodeLocation{

    func reverseGeocoding(latitude: CLLocationDegrees, longitude: CLLocationDegrees) -> String{
            var plz:String?
            let geocoder = CLGeocoder()
            let location = CLLocation(latitude: latitude, longitude: longitude)
            geocoder.reverseGeocodeLocation(location, completionHandler: {(placemarks, error) -> Void in
                if error != nil {
                    print("Failed to retrieve address")
                    return
                }

                if let placemarks = placemarks, let placemark = placemarks.first {
                    print("DEBUG: placemark.plz! ->\(placemark.plz!)")
                    plz = placemark.plz!
                    print("DEBUG: plz after initialising \(String(describing: plz))")
                }
                else
                {
                    print("No Matching Address Found")
                }

            })
        print("DEBUG: Postalcode before return \(String(describing: plz))")
        if let plz = plz{
            return plz
        }
        return ""
        }

}

This is the order of the print statements:

DEBUG: Postalcode before return nil

DEBUG: placemark.plz! ->1220

DEBUG: plz after initialising Optional("1220")

How do I return the postal code at the right time?


Title: <style> vs filename.css - How do I set margin of class rightly?

Body:
enter image description here

I have one problem that I can't set the margin-bottom in the class.
To sum up, I have one tsx file and it imports css file. And in the css file, I mentioned

.Form-formTitle-0-2-22 {
    margin-bottom: 0.5rem;
}

But it doesn't be applied. Does anyone happen to know how to fix this? and I am curious what's  as well.

Thank you.


问:
Getting "invalid list filter" when filtering GCP Workflows using Python
I have a process where I need to list off failed workflows in Google cloud platform so they can be highlighted to be fixed. I have managed to do this quite simply writing a gcloud command and calling it in a shell script, but I need to transfer this to Python.

I have the following shell command as an example where I am able to filter on a specific workflow to pull back any failures using the --filter flag.

gcloud workflows executions list --project test-project "projects/test-project/locations/europe-west4/workflows/test-workflow"  --location europe-west4 --filter STATE:FAILED
```
<p>In the documentation for filtering it not possible to do this on the executions but on the list workflows instead, which is fine. You can see within the code snippet below I am trying to filter on <code>STATE:FAILED</code> like in the gcloud command.</p>
<p>The example below doesn't work and there are no examples within the Google cloud documents. I have checked in the following webpage:</p>
<p>https://cloud.google.com/python/docs/reference/workflows/latest/google.cloud.workflows_v1.types.ListWorkflowsRequest</p>
```from google.cloud import workflows_v1
from google.cloud.workflows import executions_v1

# Create a client
workflow_client = workflows_v1.WorkflowsClient()
execution_client = executions_v1.ExecutionsClient()
project = "test-project"
location = "europe-west4"
# Initialize request argument(s)
request = workflows_v1.ListWorkflowsRequest(
    parent=f"projects/{project}/locations/{location}",
    filter="STATE:FAILED"
)
# Make the request
workflow_page_result = workflow_client.list_workflows(request=request)
# Handle the response
with open("./workflows.txt", "w") as workflow_file:
    for workflow_response in workflow_page_result:
        name = workflow_response.name
        request = executions_v1.ListExecutionsRequest(
            parent=name,
        )
        execution_page_result = execution_client.list_executions(request=request)
        # Handle the response
        for execution_response in execution_page_result:
            print(execution_response)
        workflow_file.write(name)
```
<p>What is the correct syntax for filtering on the failed state within the Python code? Where would I look to find this information in the Google documentation?</p>
<p>I get the following error message:</p>
<pre class="lang-none prettyprint-override"><code>/Users/richard.drury/code/gcp/git/service-level-monitoring/venv/bin/python /Users/richard.drury/code/gcp/git/service-level-monitoring/daily_checks/sensor_checks/workflows.py
Traceback (most recent call last):
  File "/Users/richard.drury/code/gcp/git/service-level-monitoring/venv/lib/python3.10/site-packages/google/api_core/grpc_helpers.py", line 50, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "/Users/richard.drury/code/gcp/git/service-level-monitoring/venv/lib/python3.10/site-packages/grpc/_channel.py", line 946, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/Users/richard.drury/code/gcp/git/service-level-monitoring/venv/lib/python3.10/site-packages/grpc/_channel.py", line 849, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
    status = StatusCode.INVALID_ARGUMENT
    details = "The request was invalid: invalid list filter: Field 'STATE' not found in 'resource'."
    debug_error_string = "{"created":"@1670416298.880340000","description":"Error received from peer ipv4:216.58.213.10:443","file":"src/core/lib/surface/call.cc","file_line":967,"grpc_message":"The request was invalid: invalid list filter: Field 'STATE' not found in 'resource'.","grpc_status":3}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/richard.drury/code/gcp/git/service-level-monitoring/daily_checks/sensor_checks/workflows.py", line 15, in <module>
    workflow_page_result = workflow_client.list_workflows(request=request)
  File "/Users/richard.drury/code/gcp/git/service-level-monitoring/venv/lib/python3.10/site-packages/google/cloud/workflows_v1/services/workflows/client.py", line 537, in list_workflows
    response = rpc(
  File "/Users/richard.drury/code/gcp/git/service-level-monitoring/venv/lib/python3.10/site-packages/google/api_core/gapic_v1/method.py", line 154, in __call__
    return wrapped_func(*args, **kwargs)
  File "/Users/richard.drury/code/gcp/git/service-level-monitoring/venv/lib/python3.10/site-packages/google/api_core/grpc_helpers.py", line 52, in error_remapped_callable
    raise exceptions.from_grpc_error(exc) from exc
google.api_core.exceptions.InvalidArgument: 400 The request was invalid: invalid list filter: Field 'STATE' not found in 'resource'. [field_violations {
  field: "filter"
  description: "invalid list filter: Field \'STATE\' not found in \'resource\'."
}
]

Process finished with exit code 1
</code>```

Body:
I have a process where I need to list off failed workflows in Google cloud platform so they can be highlighted to be fixed. I have managed to do this quite simply writing a gcloud command and calling it in a shell script, but I need to transfer this to Python.

I have the following shell command as an example where I am able to filter on a specific workflow to pull back any failures using the --filter flag.

gcloud workflows executions list --project test-project "projects/test-project/locations/europe-west4/workflows/test-workflow"  --location europe-west4 --filter STATE:FAILED

In the documentation for filtering it not possible to do this on the executions but on the list workflows instead, which is fine. You can see within the code snippet below I am trying to filter on STATE:FAILED like in the gcloud command.

The example below doesn't work and there are no examples within the Google cloud documents. I have checked in the following webpage:

https://cloud.google.com/python/docs/reference/workflows/latest/google.cloud.workflows_v1.types.ListWorkflowsRequest

from google.cloud import workflows_v1
from google.cloud.workflows import executions_v1

# Create a client
workflow_client = workflows_v1.WorkflowsClient()
execution_client = executions_v1.ExecutionsClient()
project = "test-project"
location = "europe-west4"
# Initialize request argument(s)
request = workflows_v1.ListWorkflowsRequest(
    parent=f"projects/{project}/locations/{location}",
    filter="STATE:FAILED"
)
# Make the request
workflow_page_result = workflow_client.list_workflows(request=request)
# Handle the response
with open("./workflows.txt", "w") as workflow_file:
    for workflow_response in workflow_page_result:
        name = workflow_response.name
        request = executions_v1.ListExecutionsRequest(
            parent=name,
        )
        execution_page_result = execution_client.list_executions(request=request)
        # Handle the response
        for execution_response in execution_page_result:
            print(execution_response)
        workflow_file.write(name)

What is the correct syntax for filtering on the failed state within the Python code? Where would I look to find this information in the Google documentation?

I get the following error message:

/Users/richard.drury/code/gcp/git/service-level-monitoring/venv/bin/python /Users/richard.drury/code/gcp/git/service-level-monitoring/daily_checks/sensor_checks/workflows.py
Traceback (most recent call last):
  File "/Users/richard.drury/code/gcp/git/service-level-monitoring/venv/lib/python3.10/site-packages/google/api_core/grpc_helpers.py", line 50, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "/Users/richard.drury/code/gcp/git/service-level-monitoring/venv/lib/python3.10/site-packages/grpc/_channel.py", line 946, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/Users/richard.drury/code/gcp/git/service-level-monitoring/venv/lib/python3.10/site-packages/grpc/_channel.py", line 849, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
    status = StatusCode.INVALID_ARGUMENT
    details = "The request was invalid: invalid list filter: Field 'STATE' not found in 'resource'."
    debug_error_string = "{"created":"@1670416298.880340000","description":"Error received from peer ipv4:216.58.213.10:443","file":"src/core/lib/surface/call.cc","file_line":967,"grpc_message":"The request was invalid: invalid list filter: Field 'STATE' not found in 'resource'.","grpc_status":3}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/richard.drury/code/gcp/git/service-level-monitoring/daily_checks/sensor_checks/workflows.py", line 15, in <module>
    workflow_page_result = workflow_client.list_workflows(request=request)
  File "/Users/richard.drury/code/gcp/git/service-level-monitoring/venv/lib/python3.10/site-packages/google/cloud/workflows_v1/services/workflows/client.py", line 537, in list_workflows
    response = rpc(
  File "/Users/richard.drury/code/gcp/git/service-level-monitoring/venv/lib/python3.10/site-packages/google/api_core/gapic_v1/method.py", line 154, in __call__
    return wrapped_func(*args, **kwargs)
  File "/Users/richard.drury/code/gcp/git/service-level-monitoring/venv/lib/python3.10/site-packages/google/api_core/grpc_helpers.py", line 52, in error_remapped_callable
    raise exceptions.from_grpc_error(exc) from exc
google.api_core.exceptions.InvalidArgument: 400 The request was invalid: invalid list filter: Field 'STATE' not found in 'resource'. [field_violations {
  field: "filter"
  description: "invalid list filter: Field \'STATE\' not found in \'resource\'."
}
]

Process finished with exit code 1


问:
Posts are not display if I have sticky post in loop Wordpress
If I select post on frontend in WP other posts not display in loop. If not selected sticky post all post is normally display.

`

```<code><?php

  $sticky = get_option( 'sticky_posts' );

  $args = array (
    'post_type' => 'post',
    'post__in' => $sticky,
    'post_status' => 'publish',
    'posts_per_page' => 8,
   );

   $the_query = new WP_Query($args);

  ?>

  <?php if ($the_query->have_posts()) : ?>
  <?php while ($the_query->have_posts()) : $the_query->the_post(); ?>

      <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>

  <?php endwhile; ?>

  <?php wp_reset_postdata(); ?>

  <?php else : ?>

  <p><?php __('Not found'); ?></p>

  <?php endif; ?>
</code>```

`

Body:
If I select post on frontend in WP other posts not display in loop. If not selected sticky post all post is normally display.

`

<?php

  $sticky = get_option( 'sticky_posts' );

  $args = array (
    'post_type' => 'post',
    'post__in' => $sticky,
    'post_status' => 'publish',
    'posts_per_page' => 8,
   );

   $the_query = new WP_Query($args);

  ?>

  <?php if ($the_query->have_posts()) : ?>
  <?php while ($the_query->have_posts()) : $the_query->the_post(); ?>

      <a href="<?php the_permalink(); ?>"><?php the_title(); ?>

  <?php endwhile; ?>

  <?php wp_reset_postdata(); ?>

  <?php else : ?>

<?php __('Not found'); ?>

  <?php endif; ?>

`


问:
Extract p-values from Ridge regression - statsmodels
I am using statsmodel to run a RidgeRegression, with an added intercept.
However, when using fit_regularized, the result object does not support to print out statistics of the fit.
How can I extract p-values alongside coefficients for each variable using fit_regularized?</p>
```<code>sm.add_constant(X, prepend=True)
ridge = sm.OLS(y, X).fit_regularized(L1_wt=0)
</code>```

Body:
I am using statsmodel to run a RidgeRegression, with an added intercept.
However, when using fit_regularized, the result object does not support to print out statistics of the fit.
How can I extract p-values alongside coefficients for each variable using fit_regularized?

sm.add_constant(X, prepend=True)
ridge = sm.OLS(y, X).fit_regularized(L1_wt=0)


问:
AutoMapper.Map overload with IMappingOperations missing from ResolutionContext.Mapper
I have a TypeConverter in which I'm using context.Mapper.Map() to map two subproperties.

The properties are the same Type and use the same (another) TypeConverter. However in one the properties I need to pass some IMappingOperationsOptions.

It looks like this (simplified):

public class MyTypeConverter : ITypeConverter
{
    public B Convert(A, B, ResolutionContext context)
    {
        var subProp1 = context.Mapper.Map<C>(B.SomeProp);
        var subProp2 = context.Mapper.Map<C>(B.SomeOtherProp, ops => ops.Items["someOption"] = "someValue");

        return new B
        {
            SubProp1 = subProp1,
            SubProp2 = subProp2
        };
    }
}
```
<p>This was working fine in <code>AutoMapper 8.0.0</code> but I'm upgrading to <code>AutoMapper 10.1.1</code> (last version with .NET framework support).
In this newer version of AutoMapper the overload method to pass <code>IMappingOperationsOptions</code> does not exist anymore.</p>
<p>I could (theoretically) solve this by injecting <code>IMapper</code> in the constructor of the <code>TypeResolver</code> and use that instead of the <code>ResolutionContext</code>'s <code>Mapper</code> but that doesn't feel right.</p>
<p>At the moment I solved the issue by temporarily updating the <code>ResolutionContext</code> options, but that also doesn't really feel right.</p>
<pre class="lang-cs prettyprint-override"><code>var subProp1 = context.Mapper.Map<C>(B.SomeProp);

context.Options.Items["someOption"] = "someValue";
var subProp2 = context.Mapper.Map<C>(B.SomeOtherProp);
context.Options.Remove("someOption");
</code>```

Casting ((IMapper)context.Mapper).Map() crashes so that's not an option either. Is there a more elegant way to achieve this?

Body:
I have a TypeConverter in which I'm using context.Mapper.Map() to map two subproperties.

The properties are the same Type and use the same (another) TypeConverter. However in one the properties I need to pass some IMappingOperationsOptions.

It looks like this (simplified):

public class MyTypeConverter : ITypeConverter
{
    public B Convert(A, B, ResolutionContext context)
    {
        var subProp1 = context.Mapper.Map<C>(B.SomeProp);
        var subProp2 = context.Mapper.Map<C>(B.SomeOtherProp, ops => ops.Items["someOption"] = "someValue");

        return new B
        {
            SubProp1 = subProp1,
            SubProp2 = subProp2
        };
    }
}

This was working fine in AutoMapper 8.0.0 but I'm upgrading to AutoMapper 10.1.1 (last version with .NET framework support).
In this newer version of AutoMapper the overload method to pass IMappingOperationsOptions does not exist anymore.

I could (theoretically) solve this by injecting IMapper in the constructor of the TypeResolver and use that instead of the ResolutionContext's Mapper but that doesn't feel right.

At the moment I solved the issue by temporarily updating the ResolutionContext options, but that also doesn't really feel right.

var subProp1 = context.Mapper.Map<C>(B.SomeProp);

context.Options.Items["someOption"] = "someValue";
var subProp2 = context.Mapper.Map<C>(B.SomeOtherProp);
context.Options.Remove("someOption");

Casting ((IMapper)context.Mapper).Map() crashes so that's not an option either. Is there a more elegant way to achieve this?


问:
Laravel 9 project through "page is not working, http 500 error on Hostinger."
I created a project on laravel 9 and uploaded it on hostinger server on subdomain .
the root of my file is : public_html/gymsoftware.folder of laravel project

i have moved all file from public folder to gymsoftware, updated index.php and configure .env file

**index.php file **

```<code><?php

use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;

define('LARAVEL_START', microtime(true));

/*
|--------------------------------------------------------------------------
| Check If The Application Is Under Maintenance
|--------------------------------------------------------------------------
|
| If the application is in maintenance / demo mode via the "down" command
| we will load this file so that any pre-rendered content can be shown
| instead of starting the framework, which could cause an exception.
|
*/

if (file_exists($maintenance = __DIR__.'/storage/framework/maintenance.php')) {
    require $maintenance;
}

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.
|
*/

require __DIR__.'/vendor/autoload.php';

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/

$app = require_once __DIR__.'/bootstrap/app.php';

$kernel = $app->make(Kernel::class);

$response = $kernel->handle(
    $request = Request::capture()
)->send();

$kernel->terminate($request, $response);

</code>```

**.htaccess file **

```<code><IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

</code>```

error

error on subdomain

i already updated index file , env file and reuploading.

Body:
I created a project on laravel 9 and uploaded it on hostinger server on subdomain .
the root of my file is : public_html/gymsoftware.folder of laravel project

i have moved all file from public folder to gymsoftware, updated index.php and configure .env file

**index.php file **

<?php

use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;

define('LARAVEL_START', microtime(true));

/*
|--------------------------------------------------------------------------
| Check If The Application Is Under Maintenance
|--------------------------------------------------------------------------
|
| If the application is in maintenance / demo mode via the "down" command
| we will load this file so that any pre-rendered content can be shown
| instead of starting the framework, which could cause an exception.
|
*/

if (file_exists($maintenance = __DIR__.'/storage/framework/maintenance.php')) {
    require $maintenance;
}

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.
|
*/

require __DIR__.'/vendor/autoload.php';

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/

$app = require_once __DIR__.'/bootstrap/app.php';

$kernel = $app->make(Kernel::class);

$response = $kernel->handle(
    $request = Request::capture()
)->send();

$kernel->terminate($request, $response);

**.htaccess file **

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

error

error on subdomain

i already updated index file , env file and reuploading.


问:
Selenium stand-alone drag and drop not working as expected
I am testing a website via selenium chrome stand-alone docker, running on aws ec2 ubunto, and performing drag and drop of an image. All work right except that the image is not dropped at the target (I examine it with a screenshot).

When I try it from my local machine it works fine (even in headless mode, which s the mode I use in the cloud).

I also tried seletools solution - same thing.

Any ideas?

Tnx

Tried on a local windows machine and it worked as expected. In the cloud I also didnt see any errors. Just the image not dropping at target


问:
TRUNC TIME ON ORACLE APEX
I have been faced a problem on APEX. When I go to forms and try to schedule a hour with minutes, ex 09:15, it appers that APEX TRUNC minutes, and send email at trunced hours, ex 09:00, doesn't mind hours I set time... If I schedule to 11:37, it will be sent at 11:00 o'clock! Any idea what can be causing such problem? Thanks a lot!</p>

Title: TRUNC TIME ON ORACLE APEX


问:
send array data in input values using Javascript or JQuery and AspNet Core MVC To Controller function and insert MsSQL?
I using AspNet Core MVC,
I want design dynamic system.
User enter sql query and save to database.
I can get this sql queries, delete 'select' and 'from....' and getting column names.
and slice column names with ','. and adding to an array.
but how can send this array values to Controller.
I don't using Model because I don't know how many column so I don't know how many declare variable in Model.

My Code:
`

```<code><script>
        $(document).ready(function(){
            var k = [];
            var input = document.getElementsByName('SqlQuery[]');
            var input1 = document.getElementsByName('ReportId[]');
            var input2 = document.getElementsByName('FolderId[]');
            var testRE = new Array();
            var columnArray = new Array();
            for (var i = 0; i < input.length; i++) {
                var a = input[i];
                var b = input1[i];
                var c = input2[i];
                k.push([[a.value],[b.value],[c.value]]);
            }
            for(var i=0;i<k.length;i++){
                var fString = 'select';
                var sString = 'from';
                var regExString = new RegExp("(?:" + fString + ")((.[\\s\\S]*))(?:" + sString + ")", "ig");
                testRE.push(regExString.exec(k[i][0]) + " , " + k[i][1] + " , " + k[i][2]);
            }

            for(var i=0;i<testRE.length;i++){
                columnArray.push([testRE[i].trim().replace(/10,/g, '10.').split(",")]);
                var Degerler = {
                val""+i = columnArray[i];
                }
                console.log(columnArray[i]);
                $.ajax({
                    type:'POST',
                    url: '/Graphic/InsertColumns',
                    dataType: 'text/javascript',
                    data:{
                        columnArray : ValidityState""+i
                    },success:function(){

                    },error:function(){

                    }
                });
            }

        });
    </script>
</code>```

`

`

```<code><script>
        $(document).ready(function(){
            var k = [];
            var input = document.getElementsByName('SqlQuery[]');
            var input1 = document.getElementsByName('ReportId[]');
            var input2 = document.getElementsByName('FolderId[]');
            var testRE = new Array();
            var columnArray = new Array();
            for (var i = 0; i < input.length; i++) {
                var a = input[i];
                var b = input1[i];
                var c = input2[i];
                k.push([[a.value],[b.value],[c.value]]);
            }
            for(var i=0;i<k.length;i++){
                var fString = 'select';
                var sString = 'from';
                var regExString = new RegExp("(?:" + fString + ")((.[\\s\\S]*))(?:" + sString + ")", "ig");
                testRE.push(regExString.exec(k[i][0]) + " , " + k[i][1] + " , " + k[i][2]);
            }

            for(var i=0;i<testRE.length;i++){
                columnArray.push([testRE[i].trim().replace(/10,/g, '10.').split(",")]);
                var Degerler = {
                val""+i = columnArray[i];
                }
                console.log(columnArray[i]);
                $.ajax({
                    type:'POST',
                    url: '/Graphic/InsertColumns',
                    dataType: 'text/javascript',
                    data:{
                        columnArray : ValidityState""+i
                    },success:function(){

                    },error:function(){

                    }
                });
            }

        });
    </script>
</code>```

`

Body:
I using AspNet Core MVC,
I want design dynamic system.
User enter sql query and save to database.
I can get this sql queries, delete 'select' and 'from....' and getting column names.
and slice column names with ','. and adding to an array.
but how can send this array values to Controller.
I don't using Model because I don't know how many column so I don't know how many declare variable in Model.

My Code:
`

`

`

`


问:
Need seventeen HTML colors that can be differentiated, on the light side
I need to tag words with their Universal Part of Speech tags. There are 17 different tags.

I am doing this by trial and error but it's not easy to identify easily discernible colors which are on the light side (the name of the tag is written in black inside them).

Is there an algorithmic way or other means to generate such palette?

Hereunder a small sample of what I'm attempting (which of course does not show all 17 parts of speech)

Thanks


问:
Caculating % Change Measure in Power BI
I have a table with 3 fields: Date, Name, and Index Value. I am trying to create a measure which will calculate the % change in Index Value over a filtered period per Name.

So if when I create a chart and adjust the time period (date period) the measure will adjust the calculation to find the % change in index value over that time period.

Here is a screenshot of some example data (which matches my dataset):

And here is a the data as text:

Date,Name,Index Value
30/09/2022,Company A,100
01/10/2022,Company A,101
02/10/2022,Company A,103
03/10/2022,Company A,101
04/10/2022,Company A,100
05/10/2022,Company A,101
06/10/2022,Company A,103
07/10/2022,Company A,101
08/10/2022,Company A,102.5
09/10/2022,Company A,103
10/10/2022,Company A,103.5
30/09/2022,Company B,104
01/10/2022,Company B,104.5
02/10/2022,Company B,105
03/10/2022,Company B,105.5
04/10/2022,Company B,106
05/10/2022,Company B,106.5
06/10/2022,Company B,107
07/10/2022,Company B,107.5
08/10/2022,Company B,108
09/10/2022,Company B,108.5
10/10/2022,Company B,109

So in this example the measure would calculate the % change for Company A and Company B over any time period, but for example it could be between 30/09/2022 to 08/10/2022

I have tried to calculate a measure - here's the code (although it's incomplete but hopefully will give you an idea of where I was trying (and failing) to go)

```<code>    % Change = DIVIDE(CALCULATE(SUM(Returns[Index]),filter(ALLSELECTED(Returns),
Returns[Name] = earlier(Returns[Name]) && Returns[date] =
MAX(Returns[date] , ))))
</code>```

So what I am trying to do here is divide the index value at the maximum date associated with each Name in the dataset by the index value associated with the same name at the minimum date. This will give in effect an 'end value' and a 'start value' per name and the % change is simply end_value/start_value - 1.

Title: Caculating % Change Measure in Power BI

Body:
I have a table with 3 fields: Date, Name, and Index Value. I am trying to create a measure which will calculate the % change in Index Value over a filtered period per Name.

So if when I create a chart and adjust the time period (date period) the measure will adjust the calculation to find the % change in index value over that time period.

Here is a screenshot of some example data (which matches my dataset):

And here is a the data as text:

Date,Name,Index Value
30/09/2022,Company A,100
01/10/2022,Company A,101
02/10/2022,Company A,103
03/10/2022,Company A,101
04/10/2022,Company A,100
05/10/2022,Company A,101
06/10/2022,Company A,103
07/10/2022,Company A,101
08/10/2022,Company A,102.5
09/10/2022,Company A,103
10/10/2022,Company A,103.5
30/09/2022,Company B,104
01/10/2022,Company B,104.5
02/10/2022,Company B,105
03/10/2022,Company B,105.5
04/10/2022,Company B,106
05/10/2022,Company B,106.5
06/10/2022,Company B,107
07/10/2022,Company B,107.5
08/10/2022,Company B,108
09/10/2022,Company B,108.5
10/10/2022,Company B,109

So in this example the measure would calculate the % change for Company A and Company B over any time period, but for example it could be between 30/09/2022 to 08/10/2022

I have tried to calculate a measure - here's the code (although it's incomplete but hopefully will give you an idea of where I was trying (and failing) to go)

    % Change = DIVIDE(CALCULATE(SUM(Returns[Index]),filter(ALLSELECTED(Returns),
Returns[Name] = earlier(Returns[Name]) && Returns[date] =
MAX(Returns[date] , ))))

So what I am trying to do here is divide the index value at the maximum date associated with each Name in the dataset by the index value associated with the same name at the minimum date. This will give in effect an 'end value' and a 'start value' per name and the % change is simply end_value/start_value - 1.


问:
PyQt6 - Display HTML inside of Table Widget
Is this the correct way to display html inside of a Qt Table Widget?
I made a working sample with a small 3x3 table of html formatted text to display inside a Qt Widget.

I have used the QStyledItemDelegate to display html rendered text inside of a QTableWidget but I am not sure if this is the most effective way to convert a Qt Widget to show HTML instead of plain text.

```<code>import sys

from PyQt6.QtWidgets import QApplication, QTableWidget, QTableWidgetItem, QStyledItemDelegate, QStyle
from PyQt6.QtGui import QTextDocument
from PyQt6.QtCore import QRectF, QSize

data = {'col1': ['<h1>Big Title</h1>', '<a href="https://www.stackoverflow.com">I love stackoverflow</a>', 'just normal plain text'],
        'col2': ['<p style="color:red">cool</p>', 'car', '<p>😀</p>'],
        'col3': ['<p style="background-color:powderblue;">123</p>', '<b>truck</b>', '<p style="color:green">pizza</p>']}

class TableView(QTableWidget):
    def __init__(self, data, *args):
        QTableWidget.__init__(self, *args)
        self.data = data
        self.setData()
        self.resizeColumnsToContents()
        self.resizeRowsToContents()

    def setData(self):
        horHeaders = []
        for n, key in enumerate(sorted(self.data.keys())):
            horHeaders.append(key)
            for m, item in enumerate(self.data[key]):
                newitem = QTableWidgetItem(item)
                self.setItem(m, n, newitem)
        self.setHorizontalHeaderLabels(horHeaders)

class HTMLDelegate(QStyledItemDelegate):
    def paint(self, painter, option, index):
        self.initStyleOption(option,index)
        painter.save()
        doc = QTextDocument()
        doc.setHtml(option.text)
        option.text = ''
        option.widget.style().drawControl(QStyle.ControlElement.CE_ItemViewItem, option, painter)
        painter.translate(option.rect.left(), option.rect.top())
        clip = QRectF(0, 0, option.rect.width(), option.rect.height())
        doc.drawContents(painter, clip)
        painter.restore()

    def sizeHint(self, option, index):
        self.initStyleOption(option, index)
        doc = QTextDocument()
        doc.setHtml(option.text)
        doc.setTextWidth(option.rect.width())
        return QSize(doc.idealWidth(), doc.size().height())

def main(args):
    app = QApplication(args)
    table = TableView(data, 3, 3)
    table.setItemDelegate(HTMLDelegate())
    table.resizeColumnsToContents()
    table.show()
    sys.exit(app.exec())

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

Also a second example where I have removed the option settings and def SizeHint from my delegate it seems to show the same results

```<code>import sys

from PyQt6.QtWidgets import QApplication, QTableWidget, QTableWidgetItem, QStyledItemDelegate, QStyle
from PyQt6.QtGui import QTextDocument
from PyQt6.QtCore import QRectF, QSize

data = {'col1': ['<h1>Big Title</h1>', '<a href="https://www.stackoverflow.com">I love stackoverflow</a>', 'just normal plain text'],
        'col2': ['<p style="color:red">cool</p>', 'car', '<p>😀</p>'],
        'col3': ['<p style="background-color:powderblue;">123</p>', '<b>truck</b>', '<p style="color:green">pizza</p>']}

class TableView(QTableWidget):
    def __init__(self, data, *args):
        QTableWidget.__init__(self, *args)
        self.data = data
        self.setData()
        self.resizeColumnsToContents()
        self.resizeRowsToContents()

    def setData(self):
        horHeaders = []
        for n, key in enumerate(sorted(self.data.keys())):
            horHeaders.append(key)
            for m, item in enumerate(self.data[key]):
                newitem = QTableWidgetItem(item)
                self.setItem(m, n, newitem)
        self.setHorizontalHeaderLabels(horHeaders)

class HTMLDelegate(QStyledItemDelegate):
    def paint(self, painter, option, index):
        self.initStyleOption(option,index)
        painter.save()
        doc = QTextDocument()
        doc.setHtml(option.text)
        #option.text = ''
        #option.widget.style().drawControl(QStyle.ControlElement.CE_ItemViewItem, option, painter)
        painter.translate(option.rect.left(), option.rect.top())
        clip = QRectF(0, 0, option.rect.width(), option.rect.height())
        doc.drawContents(painter, clip)
        painter.restore()

def main(args):
    app = QApplication(args)
    table = TableView(data, 3, 3)
    table.setItemDelegate(HTMLDelegate())
    table.resizeColumnsToContents()
    table.show()
    sys.exit(app.exec())

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

Body:
Is this the correct way to display html inside of a Qt Table Widget?
I made a working sample with a small 3x3 table of html formatted text to display inside a Qt Widget.

I have used the QStyledItemDelegate to display html rendered text inside of a QTableWidget but I am not sure if this is the most effective way to convert a Qt Widget to show HTML instead of plain text.

import sys

from PyQt6.QtWidgets import QApplication, QTableWidget, QTableWidgetItem, QStyledItemDelegate, QStyle
from PyQt6.QtGui import QTextDocument
from PyQt6.QtCore import QRectF, QSize

data = {'col1': ['
Big Title
', 'I love stackoverflow', 'just normal plain text'],
        'col2': ['
cool
', 'car', '
😀
'],
        'col3': ['
123
', 'truck', '
pizza
']}

class TableView(QTableWidget):
    def __init__(self, data, *args):
        QTableWidget.__init__(self, *args)
        self.data = data
        self.setData()
        self.resizeColumnsToContents()
        self.resizeRowsToContents()

    def setData(self):
        horHeaders = []
        for n, key in enumerate(sorted(self.data.keys())):
            horHeaders.append(key)
            for m, item in enumerate(self.data[key]):
                newitem = QTableWidgetItem(item)
                self.setItem(m, n, newitem)
        self.setHorizontalHeaderLabels(horHeaders)

class HTMLDelegate(QStyledItemDelegate):
    def paint(self, painter, option, index):
        self.initStyleOption(option,index)
        painter.save()
        doc = QTextDocument()
        doc.setHtml(option.text)
        option.text = ''
        option.widget.style().drawControl(QStyle.ControlElement.CE_ItemViewItem, option, painter)
        painter.translate(option.rect.left(), option.rect.top())
        clip = QRectF(0, 0, option.rect.width(), option.rect.height())
        doc.drawContents(painter, clip)
        painter.restore()

    def sizeHint(self, option, index):
        self.initStyleOption(option, index)
        doc = QTextDocument()
        doc.setHtml(option.text)
        doc.setTextWidth(option.rect.width())
        return QSize(doc.idealWidth(), doc.size().height())

def main(args):
    app = QApplication(args)
    table = TableView(data, 3, 3)
    table.setItemDelegate(HTMLDelegate())
    table.resizeColumnsToContents()
    table.show()
    sys.exit(app.exec())

if __name__ == "__main__":
    main(sys.argv)

Also a second example where I have removed the option settings and def SizeHint from my delegate it seems to show the same results

import sys

from PyQt6.QtWidgets import QApplication, QTableWidget, QTableWidgetItem, QStyledItemDelegate, QStyle
from PyQt6.QtGui import QTextDocument
from PyQt6.QtCore import QRectF, QSize

data = {'col1': ['
Big Title
', 'I love stackoverflow', 'just normal plain text'],
        'col2': ['
cool
', 'car', '
😀
'],
        'col3': ['
123
', 'truck', '
pizza
']}

class TableView(QTableWidget):
    def __init__(self, data, *args):
        QTableWidget.__init__(self, *args)
        self.data = data
        self.setData()
        self.resizeColumnsToContents()
        self.resizeRowsToContents()

    def setData(self):
        horHeaders = []
        for n, key in enumerate(sorted(self.data.keys())):
            horHeaders.append(key)
            for m, item in enumerate(self.data[key]):
                newitem = QTableWidgetItem(item)
                self.setItem(m, n, newitem)
        self.setHorizontalHeaderLabels(horHeaders)

class HTMLDelegate(QStyledItemDelegate):
    def paint(self, painter, option, index):
        self.initStyleOption(option,index)
        painter.save()
        doc = QTextDocument()
        doc.setHtml(option.text)
        #option.text = ''
        #option.widget.style().drawControl(QStyle.ControlElement.CE_ItemViewItem, option, painter)
        painter.translate(option.rect.left(), option.rect.top())
        clip = QRectF(0, 0, option.rect.width(), option.rect.height())
        doc.drawContents(painter, clip)
        painter.restore()

def main(args):
    app = QApplication(args)
    table = TableView(data, 3, 3)
    table.setItemDelegate(HTMLDelegate())
    table.resizeColumnsToContents()
    table.show()
    sys.exit(app.exec())

if __name__ == "__main__":
    main(sys.argv)


问:
How to call a loop function within router in NodeJS
I would to have a route as trigger for fetching google.com content until new trigger is triggered and start fetching from google.com. but what i'm facing is once i hit the trigger route again the app start fetching twice instead of once

```<code>global.flag=false
app.post('/trigger', express.text(),function (req, res) {
       const live_data =  fetch('https://google.com')
        live_data.then((response) => {
              const jsonPromise = response.text();
              jsonPromise.then((data) => {
                var DB_Pairs = data
                if(flag == true){
                    flag = false
}
                fetch_every_2s(flag,DB_Pairs) ## to stop while loop
                flag = true
                fetch_every_2s(flag,DB_Pairs)
                res.send(data);
              });
            });

  }
    )
    async function fetch_every_2s(flag,DB_Pairs){
        while(flag){
                    console.log(DB_Pairs)
                }

    }
</code>```

`

Body:
I would to have a route as trigger for fetching google.com content until new trigger is triggered and start fetching from google.com. but what i'm facing is once i hit the trigger route again the app start fetching twice instead of once

global.flag=false
app.post('/trigger', express.text(),function (req, res) {
       const live_data =  fetch('https://google.com')
        live_data.then((response) => {
              const jsonPromise = response.text();
              jsonPromise.then((data) => {
                var DB_Pairs = data
                if(flag == true){
                    flag = false
}
                fetch_every_2s(flag,DB_Pairs) ## to stop while loop
                flag = true
                fetch_every_2s(flag,DB_Pairs)
                res.send(data);
              });
            });

  }
    )
    async function fetch_every_2s(flag,DB_Pairs){
        while(flag){
                    console.log(DB_Pairs)
                }

    }

`


问:
Problem by Passing variable between PHP, JS and HTML
In my code I send $id to Java Script section and it returns the same value inside

 and I can't get the value as integer inside $text variable.

```<code>        `while ($row = $result->fetch_assoc())
            {
            $id = $row["id"];
            $regname = $row["reg-name"];
            echo '<button class="btnicon btndel" type="button" name="answer" onclick="showDiv('.$id.')"><i class="fa fa-trash"></i>  '.$regname.'</button>';
            }
        } else {
            //header("Location: login.php?Msg=wrongPass"); }
        }

?>
</div>
        <div id="DelMessageDiv" style="display:none;" class="answer_list" >
            <form action="_modify.php" method="get">
                <div id="alerts">
                <?php

                $text = '<p id="retid"></p>';

                    echo $text.'-+-'.strip_tags($text,'<p>').'
                    Are you sure for delete?
                    <input name="id" type="hidden" value="'.strip_tags($text).'" />
                    <button class="btnicon btndel" type="submit" name="operation" value="0+regDelete">Yes Delete</button>
                    ';
                ?>
                </div>
            </form>
        </div>

</div>
<?php include '_footer.php'; ?>
<script src="js/extention/choices.js"></script>
<script>
    const choices = new Choices('[data-trigger]',
    {
      searchEnabled: false
    });

    function showDiv(x) {
        document.getElementById('DelMessageDiv').style.display = "block";
        document.getElementById('retid').innerHTML = x;
    }
</script>`
</code>```

Thanks for all helps.

Body:
In my code I send $id to Java Script section and it returns the same value inside

 and I can't get the value as integer inside $text variable.

        `while ($row = $result->fetch_assoc())
            {
            $id = $row["id"];
            $regname = $row["reg-name"];
            echo '<button class="btnicon btndel" type="button" name="answer" onclick="showDiv('.$id.')">  '.$regname.'</button>';
            }
        } else {
            //header("Location: login.php?Msg=wrongPass"); }
        }

?>

            <form action="_modify.php" method="get">

                <?php

                $text = '

';

                    echo $text.'-+-'.strip_tags($text,'
').'
                    Are you sure for delete?
                    <input name="id" type="hidden" value="'.strip_tags($text).'" />
                    <button class="btnicon btndel" type="submit" name="operation" value="0+regDelete">Yes Delete</button>
                    ';
                ?>

            </form>

<?php include '_footer.php'; ?>

`

Thanks for all helps.


问:
Running SSIS Package automate failed in SSIS jobs
Having SSIS package, the flow is Data moves from Hadoop to SQL and from SQL to Postgres. Placed it in GitLab for CI CD. Made the dtsx automate by creating a job in SSIS. When running manually the job got succeeded. In automation the job is failing as Hadoop has no permission from SQL server. In GitLab file taken source as SQL server. Please suggest how to do.</p>


问:
Error if try build app on apple silicon, m1
have problem with my project when trying to build my app on M1 Pro Mac. If I want to build it on simulator, It's works when I added arm64 x86-64 to Excluded arch in build settings to Debug. But sometimes I need to build app on my device iPhone. And it works only if I delete this strokes in build settings. Could someone help with it? I need some settings to work both on device and simulator without adding/deleting Excluded arch build settings every time when I need it.

Xcode shows errors something like that :
"Could not find module 'Moya' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator" and not only for Moya.


问:
How to make 2 fields as unique index together in Nestjs
this is my schema

```<code>export type OnSaleListDocument = OnSaleList & Document;
@Schema({ autoIndex: true })
export class OnSaleList {
  @Prop()
  id: number;

  @Prop()
  address: string;

  @Prop()
  quantity: number;

  @Prop()
  price: number;
}
const OnSaleListSchema = SchemaFactory.createForClass(OnSaleList);
OnSaleListSchema.index({ id: 1, address: 1 }, { unique: true });
export { OnSaleListSchema };
</code>```

I am not able to get the desired results.
It is taking id as the unique field.
I want both of them to act as a unique field together, not separately.

Body:
this is my schema

export type OnSaleListDocument = OnSaleList & Document;
@Schema({ autoIndex: true })
export class OnSaleList {
  @Prop()
  id: number;

  @Prop()
  address: string;

  @Prop()
  quantity: number;

  @Prop()
  price: number;
}
const OnSaleListSchema = SchemaFactory.createForClass(OnSaleList);
OnSaleListSchema.index({ id: 1, address: 1 }, { unique: true });
export { OnSaleListSchema };

I am not able to get the desired results.
It is taking id as the unique field.
I want both of them to act as a unique field together, not separately.


问:
How to bypass cloudflare bot verification Wordpress
enter image description hereThe problem is when I open the site through the octolooks parsing plugin. The resource issues protection for checking the bot. How can you bypass it? Can somehow fake Cookies?. sorry for my bad english(</p>


问:
RuntimeException: Module '' is not a Script module. Detected modules of the following types: 'Binary'
I'm trying to write unit test for binary cmdlets using Pester and got the following error:

```<code>RuntimeException: Module '' is not a Script module.  Detected modules of the following types: 'Binary'
Tests completed in 3.61s
Tests Passed: 0, Failed: 3, Skipped: 0 NotRun: 0
</code>```

The cmdlet is implemented in C# as follows:

```<code>cmdlet1{
   result = cmdlet2()
   do something with the result
}
</code>```

The test is implemented as follows:

```<code>It 'test something'{
    Mock cmdlet2 { return $mockValue } -ModuleName myBinaryModule
    $result =  cmdlet1
    $result.Count | Should be 5
}
</code>```

Is it possible to mock a binary cmdlet in pester or is there any other way to test such cmdlets?

Body:
I'm trying to write unit test for binary cmdlets using Pester and got the following error:

RuntimeException: Module '' is not a Script module.  Detected modules of the following types: 'Binary'
Tests completed in 3.61s
Tests Passed: 0, Failed: 3, Skipped: 0 NotRun: 0

The cmdlet is implemented in C# as follows:

cmdlet1{
   result = cmdlet2()
   do something with the result
}

The test is implemented as follows:

It 'test something'{
    Mock cmdlet2 { return $mockValue } -ModuleName myBinaryModule
    $result =  cmdlet1
    $result.Count | Should be 5
}

Is it possible to mock a binary cmdlet in pester or is there any other way to test such cmdlets?


问:
Validate checkout field in Woocommerce without blocking user from proceeding with the order
In Woocommerce I'm trying to do a validation check of the Address field in Woocommerce,
to warn customers in case they forgot to place their house or street numbers.

I am using the following snippet, which works for this exact validation and displays in real time a warning message below the field after the user clicks away from it, however there is an issue, as it forces the field to always have a number, and the point is simply to warn users but still allow them to progress with the order.

I am not sure how to proceed with this, as In my search I couldn't find anything related to "Not forcing" or making the validation check but still allowing customers to proceed with the order.

```<code>    /**
 * Add validation for street house adress: Verify if there is a number
 */

add_filter(
    'woocommerce_default_address_fields', function( $fields ) {
        unset( $fields['postcode']['custom_attributes']['data-parsley-length'] );
    $fields['address_1']['custom_attributes']['data-parsley-pattern']       = '/^(?=.*\d).+$/';
    $fields['address_1']['custom_attributes']['data-parsley-error-message'] = __( 'It seems your address has no street or door number', 'your-translation-domain' );

    return $fields;
},
100001  );
</code>```

Thank you in advance for the attention and advice.

Body:
In Woocommerce I'm trying to do a validation check of the Address field in Woocommerce,
to warn customers in case they forgot to place their house or street numbers.

I am using the following snippet, which works for this exact validation and displays in real time a warning message below the field after the user clicks away from it, however there is an issue, as it forces the field to always have a number, and the point is simply to warn users but still allow them to progress with the order.

I am not sure how to proceed with this, as In my search I couldn't find anything related to "Not forcing" or making the validation check but still allowing customers to proceed with the order.

    /**
 * Add validation for street house adress: Verify if there is a number
 */

add_filter(
    'woocommerce_default_address_fields', function( $fields ) {
        unset( $fields['postcode']['custom_attributes']['data-parsley-length'] );
    $fields['address_1']['custom_attributes']['data-parsley-pattern']       = '/^(?=.*\d).+$/';
    $fields['address_1']['custom_attributes']['data-parsley-error-message'] = __( 'It seems your address has no street or door number', 'your-translation-domain' );

    return $fields;
},
100001  );

Thank you in advance for the attention and advice.


问:
How to allow specific AWS lambda the ability to AssumeRole to a specific role
I am working on aws,
I have a role and 2 lambdas.

I want only those lambdas to run with the role, and the ability to assume role only from those lambdas.

I tried to add the lambdas in the trust relationship of the role and it is not working.

"AssumeRolePolicyDocument": {
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::111111:root",
        "Service": [
          "lambda.amazonaws.com"
        ]
      },
      "Action": "sts:AssumeRole",
      "Condition": {
        "StringLike": {
          "lambda:FunctionArn": "arn:aws:lambda:us-east-1:111111:function:service:function_name"
        }
      }
    }
  ]
}
```

I am getting: The role defined for the function cannot be assumed by Lambda.

Body:
I am working on aws,
I have a role and 2 lambdas.

I want only those lambdas to run with the role, and the ability to assume role only from those lambdas.

I tried to add the lambdas in the trust relationship of the role and it is not working.

"AssumeRolePolicyDocument": {
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::111111:root",
        "Service": [
          "lambda.amazonaws.com"
        ]
      },
      "Action": "sts:AssumeRole",
      "Condition": {
        "StringLike": {
          "lambda:FunctionArn": "arn:aws:lambda:us-east-1:111111:function:service:function_name"
        }
      }
    }
  ]
}

I am getting: The role defined for the function cannot be assumed by Lambda.


问:
Conditionning the relationship creation ON Neo4J
I have a question.
I would like to create relationship if a new intermediate node is created. In this code below, I would love to execute the last two MERGE if only i have a new node (:Consultation).
How can I do that please ?

```<code>MATCH
    (dp:DossierPatient{numDos:2}),
    (dr:Docteur{matricule:1}),
    (ord:Ordonnance{numOrd:1})

MERGE (cons:Consultation{numDos:dp.numDos, codeDocteur:dr.matricule, dateC:'24/11/2022'})
    ON CREATE SET cons.diagnostic='Allergies, tension anormale...'

//Create new relationships if new Consultation node is created
**
MERGE (dp) <-[:concerne]- (cons) -[:effectuee_par]-> (dr)
MERGE (cons) -[:possede]-> (ord);
**
</code>```

If possible, i would love to put those two MERGE in the same bloc as ON CREATE SET

Body:
I have a question.
I would like to create relationship if a new intermediate node is created. In this code below, I would love to execute the last two MERGE if only i have a new node (:Consultation).
How can I do that please ?

MATCH
    (dp:DossierPatient{numDos:2}),
    (dr:Docteur{matricule:1}),
    (ord:Ordonnance{numOrd:1})

MERGE (cons:Consultation{numDos:dp.numDos, codeDocteur:dr.matricule, dateC:'24/11/2022'})
    ON CREATE SET cons.diagnostic='Allergies, tension anormale...'

//Create new relationships if new Consultation node is created
**
MERGE (dp) <-[:concerne]- (cons) -[:effectuee_par]-> (dr)
MERGE (cons) -[:possede]-> (ord);
**

If possible, i would love to put those two MERGE in the same bloc as ON CREATE SET


问:
mat-select dropdown to show from top (the search box first) when it opens instead of selected value in the dropdown, angular8
I am using mat-select and if the value is already selected, as the dropdown opens it takes to that particular value in dropdown.
Just as the dropdown opens, I want to show from the top of the dropdown (my search box at the top) instead the value which was selected in the dropdown.

Is there any way I can achieve that?
I have seen the "get the scroll to the top when the dropdown opens" but it first opens at the bottom then it takes to the top and that wouldn't look good.
You can check that here

I am providing the code blocks below:

```<code><mat-form-field class="w-100">
        <mat-select #selectElement placeholder="Assign To" formControlName="hrspoc" panelClass="assigned-to-panel-class" disableOptionCentering>
          <input class="search-box" type="text" (input)="changeInput($event,'hr')" placeholder="Search">

          <mat-option *ngFor="let hr of hrspoc | filter:searchTextHrspoc" [value]="hr.HRSpocID">
            {{hr.hrspoc_display}}
          </mat-option>
        </mat-select>
 </mat-form-field>

</code>```

scss I used:

```<code>.search-box{
    width: 93%;
    margin: 5% 0% 3% 3%;
  }
.assigned-to-panel-class{
  margin-top: 30px !important;

}
</code>```

I am using angular version 8.

Body:
I am using mat-select and if the value is already selected, as the dropdown opens it takes to that particular value in dropdown.
Just as the dropdown opens, I want to show from the top of the dropdown (my search box at the top) instead the value which was selected in the dropdown.

Is there any way I can achieve that?
I have seen the "get the scroll to the top when the dropdown opens" but it first opens at the bottom then it takes to the top and that wouldn't look good.
You can check that here

I am providing the code blocks below:

<mat-form-field class="w-100">
        <mat-select #selectElement placeholder="Assign To" formControlName="hrspoc" panelClass="assigned-to-panel-class" disableOptionCentering>
          <input class="search-box" type="text" (input)="changeInput($event,'hr')" placeholder="Search">

          <mat-option *ngFor="let hr of hrspoc | filter:searchTextHrspoc" [value]="hr.HRSpocID">
            {{hr.hrspoc_display}}
          </mat-option>
        </mat-select>
 </mat-form-field>

scss I used:

.search-box{
    width: 93%;
    margin: 5% 0% 3% 3%;
  }
.assigned-to-panel-class{
  margin-top: 30px !important;

}

I am using angular version 8.