问:
Docker desktop (WSL2 engine) fails to start after switching to windows containers on Windows 11 Home
I am on Windows 11 Home Edition (21H2). Installed docker desktop 4.15.0 from https://docs.docker.com/desktop/install/windows-install/. After installation everything seemed to work fine. I was able to run docker run hello-world from powershell. But then I wanted to build a Dockerfile that used the microsoft image mcr.microsoft.com/windows/servercore:ltsc2019

```<code>> docker build .
[...]
 => ERROR [internal] load metadata for mcr.microsoft.com/windows/servercore:ltsc2019                                            0.2s
------
 > [internal] load metadata for mcr.microsoft.com/windows/servercore:ltsc2019:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:058c8482946efa0b44b57e5ecebd7857b4df37a1365acdde32736628747ad9e1: not found
</code>```

I searched documentation, see https://docs.docker.com/desktop/faqs/windowsfaqs/#how-do-i-switch-between-windows-and-linux-containers :

From the Docker Desktop menu, you can toggle which daemon (Linux or Windows) the Docker CLI talks to. Select Switch to Windows containers to use Windows containers, [...]

I followed this instruction to switch to Windows containers:

But after selecting "Switch" button (see screenshot above), docker desktop just says "Docker  desktop starting..." and nothing happens.

I checked the documentation again: https://docs.docker.com/desktop/troubleshoot/overview/ and ran the diagnostic tool:

```<code>> 'C:\Program Files\Docker\Docker\resources\com.docker.diagnose.exe' check
[2022-12-19T00:09:41.668707400Z][com.docker.diagnose.exe][I] set path configuration to OnHost
Starting diagnostics

[PASS] DD0027: is there available disk space on the host?
[PASS] DD0028: is there available VM disk space?
[PASS] DD0002: does the bootloader have virtualization enabled?
[SKIP] DD0018: does the host support virtualization?
[PASS] DD0001: is the application running?
[PASS] DD0017: can a VM be started?
[PASS] DD0016: is the LinuxKit VM running?
[FAIL] DD0011: are the LinuxKit services running? failed to ping VM diagnosticsd with error: Get "http://ipc/ping": open \\.\pipe\dockerDiagnosticd: The system cannot find the file specified.
[2022-12-19T00:09:43.462307800Z][com.docker.diagnose.exe][I] ipc.NewClient: 5abd4d00-diagnose -> \\.\pipe\dockerDiagnosticd diagnosticsd
[common/pkg/diagkit/gather/diagnose.glob..func14()
[       common/pkg/diagkit/gather/diagnose/linuxkit.go:18 +0x8b
[common/pkg/diagkit/gather/diagnose.(*test).GetResult(0x10140c0)
[       common/pkg/diagkit/gather/diagnose/test.go:46 +0x43
[common/pkg/diagkit/gather/diagnose.Run.func1(0x10140c0)
[       common/pkg/diagkit/gather/diagnose/run.go:17 +0x5a
[common/pkg/diagkit/gather/diagnose.walkOnce.func1(0x4?, 0x10140c0)
[       common/pkg/diagkit/gather/diagnose/run.go:142 +0x77
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x3, 0x10140c0, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:151 +0x87
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x2, 0x1014140, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:148 +0x52
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x1, 0x10141c0, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:148 +0x52
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x0, 0x1014940, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:148 +0x52
[common/pkg/diagkit/gather/diagnose.walkOnce(0x9b2c80?, 0xc00026f890)
[       common/pkg/diagkit/gather/diagnose/run.go:137 +0xcc
[common/pkg/diagkit/gather/diagnose.Run(0x1014940, 0x3a35893600000010?, {0xc00026fb20, 0x1, 0x1})
[       common/pkg/diagkit/gather/diagnose/run.go:16 +0x1d4
[main.checkCmd({0xc0000703d0?, 0xc0000703d0?, 0x4?}, {0x0, 0x0})
[       common/cmd/com.docker.diagnose/main.go:133 +0x105
[main.main()
[       common/cmd/com.docker.diagnose/main.go:99 +0x287
[2022-12-19T00:09:43.462865700Z][com.docker.diagnose.exe][I] (d1ae4863) 5abd4d00-diagnose C->S diagnosticsd GET /ping
[2022-12-19T00:09:43.463587400Z][com.docker.diagnose.exe][W] (d1ae4863) 5abd4d00-diagnose C<-S NoResponse GET /ping (548.7µs): Get "http://ipc/ping": open \\.\pipe\dockerDiagnosticd: The system cannot find the file specified.

[FAIL] DD0023: is the Containers Windows Feature enabled? required Windows Feature not installed: Containers
[2022-12-19T00:09:43.465829700Z][com.docker.diagnose.exe][I] ipc.NewClient: b5ee5ef6-com.docker.diagnose -> \\.\pipe\dockerBackendV2 com.docker.service.exe
[common/pkg/windows/serviceclient.NewClientForPath(...)
[       common/pkg/windows/serviceclient/service.go:49
[common/pkg/windows/serviceclient.NewClient({0xa768bf, 0x13}, {0x0, 0x0, 0x0})
[       common/pkg/windows/serviceclient/service.go:38 +0xc5
[common/pkg/diagkit/gather/diagnose.checkWindowsFeature({{0xa6e7d9?, 0x1?}, {0xa6e7d9?, 0x8d?}})
[       common/pkg/diagkit/gather/diagnose/features_windows.go:11 +0x51
[common/pkg/diagkit/gather/diagnose.glob..func6()
[       common/pkg/diagkit/gather/diagnose/dockerd_windows.go:11 +0x35
[common/pkg/diagkit/gather/diagnose.(*test).GetResult(0x10142c0)
[       common/pkg/diagkit/gather/diagnose/test.go:46 +0x43
[common/pkg/diagkit/gather/diagnose.Run.func1(0x10142c0)
[       common/pkg/diagkit/gather/diagnose/run.go:17 +0x5a
[common/pkg/diagkit/gather/diagnose.walkOnce.func1(0x4?, 0x10142c0)
[       common/pkg/diagkit/gather/diagnose/run.go:142 +0x77
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x3, 0x10142c0, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:151 +0x87
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x2, 0x1014140, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:148 +0x52
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x1, 0x10141c0, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:148 +0x52
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x0, 0x1014940, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:148 +0x52
[common/pkg/diagkit/gather/diagnose.walkOnce(0x9b2c80?, 0xc00026f890)
[       common/pkg/diagkit/gather/diagnose/run.go:137 +0xcc
[common/pkg/diagkit/gather/diagnose.Run(0x1014940, 0x3a35893600000010?, {0xc00026fb20, 0x1, 0x1})
[       common/pkg/diagkit/gather/diagnose/run.go:16 +0x1d4
[main.checkCmd({0xc0000703d0?, 0xc0000703d0?, 0x4?}, {0x0, 0x0})
[       common/cmd/com.docker.diagnose/main.go:133 +0x105
[main.main()
[       common/cmd/com.docker.diagnose/main.go:99 +0x287
[2022-12-19T00:09:43.465829700Z][com.docker.diagnose.exe][I] (d93b6fc4) b5ee5ef6-com.docker.diagnose C->S com.docker.service.exe POST /windowsfeatures/check: [Containers (Containers)]
[2022-12-19T00:09:43.939061900Z][com.docker.diagnose.exe][I] (d93b6fc4) b5ee5ef6-com.docker.diagnose C<-S 5523a302-ServiceAPI POST /windowsfeatures/check (473.2322ms): {"NotAvailable":[{"Description":"Containers","Name":"Containers"}],"NotEnabled":[]}

[FAIL] DD0004: is the Docker engine running? Get "http://ipc/docker": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:43.940262800Z][com.docker.diagnose.exe][I] ipc.NewClient: a1bc4120-com.docker.diagnose -> \\.\pipe\dockerLifecycleServer VMDockerdAPI
[linuxkit/pkg/desktop-host-tools/pkg/client.NewClientForPath(...)
[       linuxkit/pkg/desktop-host-tools/pkg/client/client.go:61
[linuxkit/pkg/desktop-host-tools/pkg/client.NewClient({0xa768bf, 0x13})
[       linuxkit/pkg/desktop-host-tools/pkg/client/client.go:55 +0x99
[common/pkg/diagkit/gather/diagnose.isDockerEngineRunning()
[       common/pkg/diagkit/gather/diagnose/dockerd.go:21 +0x29
[common/pkg/diagkit/gather/diagnose.(*test).GetResult(0x1014140)
[       common/pkg/diagkit/gather/diagnose/test.go:46 +0x43
[common/pkg/diagkit/gather/diagnose.Run.func1(0x1014140)
[       common/pkg/diagkit/gather/diagnose/run.go:17 +0x5a
[common/pkg/diagkit/gather/diagnose.walkOnce.func1(0x3?, 0x1014140)
[       common/pkg/diagkit/gather/diagnose/run.go:142 +0x77
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x2, 0x1014140, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:151 +0x87
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x1, 0x10141c0, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:148 +0x52
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x0, 0x1014940, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:148 +0x52
[common/pkg/diagkit/gather/diagnose.walkOnce(0x9b2c80?, 0xc00026f890)
[       common/pkg/diagkit/gather/diagnose/run.go:137 +0xcc
[common/pkg/diagkit/gather/diagnose.Run(0x1014940, 0x3a35893600000010?, {0xc00026fb20, 0x1, 0x1})
[       common/pkg/diagkit/gather/diagnose/run.go:16 +0x1d4
[main.checkCmd({0xc0000703d0?, 0xc0000703d0?, 0x4?}, {0x0, 0x0})
[       common/cmd/com.docker.diagnose/main.go:133 +0x105
[main.main()
[       common/cmd/com.docker.diagnose/main.go:99 +0x287
[2022-12-19T00:09:43.940869400Z][com.docker.diagnose.exe][I] (0277e282) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /docker
[2022-12-19T00:09:43.941441100Z][com.docker.diagnose.exe][W] (0277e282) a1bc4120-com.docker.diagnose C<-S NoResponse GET /docker (571.7µs): Get "http://ipc/docker": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:43.942116600Z][com.docker.diagnose.exe][I] (0277e282-1) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /ping
[2022-12-19T00:09:43.942116600Z][com.docker.diagnose.exe][W] (0277e282-1) a1bc4120-com.docker.diagnose C<-S NoResponse GET /ping (0s): Get "http://ipc/ping": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:44.951299700Z][com.docker.diagnose.exe][I] (0277e282-2) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /ping
[2022-12-19T00:09:44.952368100Z][com.docker.diagnose.exe][W] (0277e282-2) a1bc4120-com.docker.diagnose C<-S NoResponse GET /ping (1.0684ms): Get "http://ipc/ping": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:45.966443900Z][com.docker.diagnose.exe][I] (0277e282-3) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /ping
[2022-12-19T00:09:45.967076400Z][com.docker.diagnose.exe][W] (0277e282-3) a1bc4120-com.docker.diagnose C<-S NoResponse GET /ping (632.5µs): Get "http://ipc/ping": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:46.978045300Z][com.docker.diagnose.exe][I] (0277e282-4) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /ping
[2022-12-19T00:09:46.979132400Z][com.docker.diagnose.exe][W] (0277e282-4) a1bc4120-com.docker.diagnose C<-S NoResponse GET /ping (1.2815ms): Get "http://ipc/ping": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:47.984015000Z][com.docker.diagnose.exe][I] (0277e282-5) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /ping
[2022-12-19T00:09:47.985051200Z][com.docker.diagnose.exe][W] (0277e282-5) a1bc4120-com.docker.diagnose C<-S NoResponse GET /ping (1.0362ms): Get "http://ipc/ping": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:48.991994000Z][com.docker.diagnose.exe][I] (0277e282-6) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /ping
[2022-12-19T00:09:48.993515900Z][com.docker.diagnose.exe][W] (0277e282-6) a1bc4120-com.docker.diagnose C<-S NoResponse GET /ping (1.0491ms): Get "http://ipc/ping": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:49.999431800Z][com.docker.diagnose.exe][I] (0277e282-7) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /ping
[2022-12-19T00:09:50.000430100Z][com.docker.diagnose.exe][W] (0277e282-7) a1bc4120-com.docker.diagnose C<-S NoResponse GET /ping (998.3µs): Get "http://ipc/ping": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:51.020341400Z][com.docker.diagnose.exe][I] (0277e282-8) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /ping
[2022-12-19T00:09:51.021623100Z][com.docker.diagnose.exe][W] (0277e282-8) a1bc4120-com.docker.diagnose C<-S NoResponse GET /ping (1.2817ms): Get "http://ipc/ping": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.

[PASS] DD0015: are the binary symlinks installed?
[FAIL] DD0031: does the Docker API work? error during connect: This error may indicate that the docker daemon is not running.: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine_linux/v1.24/containers/json?limit=0": open //./pipe/docker_engine_linux: The system cannot find the file specified.
[PASS] DD0013: is the $PATH ok?
error during connect: This error may indicate that the docker daemon is not running.: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json": open //./pipe/docker_engine: The system cannot find the file specified.
[FAIL] DD0003: is the Docker CLI working? exit status 1
[PASS] DD0005: is the user in the docker-users group?
2022/12/19 01:09:51 exit status 0xffffffff
</code>```

From the above output I see:

```<code>[FAIL] DD0023: is the Containers Windows Feature enabled? required Windows Feature not installed: Containers
</code>```

I tried to search the documentation for more information on this, but was not able to find any good advice. Any idea what is going on here?

Body:
I am on Windows 11 Home Edition (21H2). Installed docker desktop 4.15.0 from https://docs.docker.com/desktop/install/windows-install/. After installation everything seemed to work fine. I was able to run docker run hello-world from powershell. But then I wanted to build a Dockerfile that used the microsoft image mcr.microsoft.com/windows/servercore:ltsc2019

> docker build .
[...]
 => ERROR [internal] load metadata for mcr.microsoft.com/windows/servercore:ltsc2019                                            0.2s
------
 > [internal] load metadata for mcr.microsoft.com/windows/servercore:ltsc2019:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:058c8482946efa0b44b57e5ecebd7857b4df37a1365acdde32736628747ad9e1: not found

I searched documentation, see https://docs.docker.com/desktop/faqs/windowsfaqs/#how-do-i-switch-between-windows-and-linux-containers :

From the Docker Desktop menu, you can toggle which daemon (Linux or Windows) the Docker CLI talks to. Select Switch to Windows containers to use Windows containers, [...]

I followed this instruction to switch to Windows containers:

But after selecting "Switch" button (see screenshot above), docker desktop just says "Docker  desktop starting..." and nothing happens.

I checked the documentation again: https://docs.docker.com/desktop/troubleshoot/overview/ and ran the diagnostic tool:

> 'C:\Program Files\Docker\Docker\resources\com.docker.diagnose.exe' check
[2022-12-19T00:09:41.668707400Z][com.docker.diagnose.exe][I] set path configuration to OnHost
Starting diagnostics

[PASS] DD0027: is there available disk space on the host?
[PASS] DD0028: is there available VM disk space?
[PASS] DD0002: does the bootloader have virtualization enabled?
[SKIP] DD0018: does the host support virtualization?
[PASS] DD0001: is the application running?
[PASS] DD0017: can a VM be started?
[PASS] DD0016: is the LinuxKit VM running?
[FAIL] DD0011: are the LinuxKit services running? failed to ping VM diagnosticsd with error: Get "http://ipc/ping": open \\.\pipe\dockerDiagnosticd: The system cannot find the file specified.
[2022-12-19T00:09:43.462307800Z][com.docker.diagnose.exe][I] ipc.NewClient: 5abd4d00-diagnose -> \\.\pipe\dockerDiagnosticd diagnosticsd
[common/pkg/diagkit/gather/diagnose.glob..func14()
[       common/pkg/diagkit/gather/diagnose/linuxkit.go:18 +0x8b
[common/pkg/diagkit/gather/diagnose.(*test).GetResult(0x10140c0)
[       common/pkg/diagkit/gather/diagnose/test.go:46 +0x43
[common/pkg/diagkit/gather/diagnose.Run.func1(0x10140c0)
[       common/pkg/diagkit/gather/diagnose/run.go:17 +0x5a
[common/pkg/diagkit/gather/diagnose.walkOnce.func1(0x4?, 0x10140c0)
[       common/pkg/diagkit/gather/diagnose/run.go:142 +0x77
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x3, 0x10140c0, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:151 +0x87
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x2, 0x1014140, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:148 +0x52
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x1, 0x10141c0, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:148 +0x52
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x0, 0x1014940, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:148 +0x52
[common/pkg/diagkit/gather/diagnose.walkOnce(0x9b2c80?, 0xc00026f890)
[       common/pkg/diagkit/gather/diagnose/run.go:137 +0xcc
[common/pkg/diagkit/gather/diagnose.Run(0x1014940, 0x3a35893600000010?, {0xc00026fb20, 0x1, 0x1})
[       common/pkg/diagkit/gather/diagnose/run.go:16 +0x1d4
[main.checkCmd({0xc0000703d0?, 0xc0000703d0?, 0x4?}, {0x0, 0x0})
[       common/cmd/com.docker.diagnose/main.go:133 +0x105
[main.main()
[       common/cmd/com.docker.diagnose/main.go:99 +0x287
[2022-12-19T00:09:43.462865700Z][com.docker.diagnose.exe][I] (d1ae4863) 5abd4d00-diagnose C->S diagnosticsd GET /ping
[2022-12-19T00:09:43.463587400Z][com.docker.diagnose.exe][W] (d1ae4863) 5abd4d00-diagnose C<-S NoResponse GET /ping (548.7µs): Get "http://ipc/ping": open \\.\pipe\dockerDiagnosticd: The system cannot find the file specified.

[FAIL] DD0023: is the Containers Windows Feature enabled? required Windows Feature not installed: Containers
[2022-12-19T00:09:43.465829700Z][com.docker.diagnose.exe][I] ipc.NewClient: b5ee5ef6-com.docker.diagnose -> \\.\pipe\dockerBackendV2 com.docker.service.exe
[common/pkg/windows/serviceclient.NewClientForPath(...)
[       common/pkg/windows/serviceclient/service.go:49
[common/pkg/windows/serviceclient.NewClient({0xa768bf, 0x13}, {0x0, 0x0, 0x0})
[       common/pkg/windows/serviceclient/service.go:38 +0xc5
[common/pkg/diagkit/gather/diagnose.checkWindowsFeature({{0xa6e7d9?, 0x1?}, {0xa6e7d9?, 0x8d?}})
[       common/pkg/diagkit/gather/diagnose/features_windows.go:11 +0x51
[common/pkg/diagkit/gather/diagnose.glob..func6()
[       common/pkg/diagkit/gather/diagnose/dockerd_windows.go:11 +0x35
[common/pkg/diagkit/gather/diagnose.(*test).GetResult(0x10142c0)
[       common/pkg/diagkit/gather/diagnose/test.go:46 +0x43
[common/pkg/diagkit/gather/diagnose.Run.func1(0x10142c0)
[       common/pkg/diagkit/gather/diagnose/run.go:17 +0x5a
[common/pkg/diagkit/gather/diagnose.walkOnce.func1(0x4?, 0x10142c0)
[       common/pkg/diagkit/gather/diagnose/run.go:142 +0x77
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x3, 0x10142c0, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:151 +0x87
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x2, 0x1014140, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:148 +0x52
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x1, 0x10141c0, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:148 +0x52
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x0, 0x1014940, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:148 +0x52
[common/pkg/diagkit/gather/diagnose.walkOnce(0x9b2c80?, 0xc00026f890)
[       common/pkg/diagkit/gather/diagnose/run.go:137 +0xcc
[common/pkg/diagkit/gather/diagnose.Run(0x1014940, 0x3a35893600000010?, {0xc00026fb20, 0x1, 0x1})
[       common/pkg/diagkit/gather/diagnose/run.go:16 +0x1d4
[main.checkCmd({0xc0000703d0?, 0xc0000703d0?, 0x4?}, {0x0, 0x0})
[       common/cmd/com.docker.diagnose/main.go:133 +0x105
[main.main()
[       common/cmd/com.docker.diagnose/main.go:99 +0x287
[2022-12-19T00:09:43.465829700Z][com.docker.diagnose.exe][I] (d93b6fc4) b5ee5ef6-com.docker.diagnose C->S com.docker.service.exe POST /windowsfeatures/check: [Containers (Containers)]
[2022-12-19T00:09:43.939061900Z][com.docker.diagnose.exe][I] (d93b6fc4) b5ee5ef6-com.docker.diagnose C<-S 5523a302-ServiceAPI POST /windowsfeatures/check (473.2322ms): {"NotAvailable":[{"Description":"Containers","Name":"Containers"}],"NotEnabled":[]}

[FAIL] DD0004: is the Docker engine running? Get "http://ipc/docker": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:43.940262800Z][com.docker.diagnose.exe][I] ipc.NewClient: a1bc4120-com.docker.diagnose -> \\.\pipe\dockerLifecycleServer VMDockerdAPI
[linuxkit/pkg/desktop-host-tools/pkg/client.NewClientForPath(...)
[       linuxkit/pkg/desktop-host-tools/pkg/client/client.go:61
[linuxkit/pkg/desktop-host-tools/pkg/client.NewClient({0xa768bf, 0x13})
[       linuxkit/pkg/desktop-host-tools/pkg/client/client.go:55 +0x99
[common/pkg/diagkit/gather/diagnose.isDockerEngineRunning()
[       common/pkg/diagkit/gather/diagnose/dockerd.go:21 +0x29
[common/pkg/diagkit/gather/diagnose.(*test).GetResult(0x1014140)
[       common/pkg/diagkit/gather/diagnose/test.go:46 +0x43
[common/pkg/diagkit/gather/diagnose.Run.func1(0x1014140)
[       common/pkg/diagkit/gather/diagnose/run.go:17 +0x5a
[common/pkg/diagkit/gather/diagnose.walkOnce.func1(0x3?, 0x1014140)
[       common/pkg/diagkit/gather/diagnose/run.go:142 +0x77
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x2, 0x1014140, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:151 +0x87
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x1, 0x10141c0, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:148 +0x52
[common/pkg/diagkit/gather/diagnose.walkDepthFirst(0x0, 0x1014940, 0xc00061f728)
[       common/pkg/diagkit/gather/diagnose/run.go:148 +0x52
[common/pkg/diagkit/gather/diagnose.walkOnce(0x9b2c80?, 0xc00026f890)
[       common/pkg/diagkit/gather/diagnose/run.go:137 +0xcc
[common/pkg/diagkit/gather/diagnose.Run(0x1014940, 0x3a35893600000010?, {0xc00026fb20, 0x1, 0x1})
[       common/pkg/diagkit/gather/diagnose/run.go:16 +0x1d4
[main.checkCmd({0xc0000703d0?, 0xc0000703d0?, 0x4?}, {0x0, 0x0})
[       common/cmd/com.docker.diagnose/main.go:133 +0x105
[main.main()
[       common/cmd/com.docker.diagnose/main.go:99 +0x287
[2022-12-19T00:09:43.940869400Z][com.docker.diagnose.exe][I] (0277e282) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /docker
[2022-12-19T00:09:43.941441100Z][com.docker.diagnose.exe][W] (0277e282) a1bc4120-com.docker.diagnose C<-S NoResponse GET /docker (571.7µs): Get "http://ipc/docker": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:43.942116600Z][com.docker.diagnose.exe][I] (0277e282-1) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /ping
[2022-12-19T00:09:43.942116600Z][com.docker.diagnose.exe][W] (0277e282-1) a1bc4120-com.docker.diagnose C<-S NoResponse GET /ping (0s): Get "http://ipc/ping": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:44.951299700Z][com.docker.diagnose.exe][I] (0277e282-2) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /ping
[2022-12-19T00:09:44.952368100Z][com.docker.diagnose.exe][W] (0277e282-2) a1bc4120-com.docker.diagnose C<-S NoResponse GET /ping (1.0684ms): Get "http://ipc/ping": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:45.966443900Z][com.docker.diagnose.exe][I] (0277e282-3) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /ping
[2022-12-19T00:09:45.967076400Z][com.docker.diagnose.exe][W] (0277e282-3) a1bc4120-com.docker.diagnose C<-S NoResponse GET /ping (632.5µs): Get "http://ipc/ping": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:46.978045300Z][com.docker.diagnose.exe][I] (0277e282-4) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /ping
[2022-12-19T00:09:46.979132400Z][com.docker.diagnose.exe][W] (0277e282-4) a1bc4120-com.docker.diagnose C<-S NoResponse GET /ping (1.2815ms): Get "http://ipc/ping": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:47.984015000Z][com.docker.diagnose.exe][I] (0277e282-5) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /ping
[2022-12-19T00:09:47.985051200Z][com.docker.diagnose.exe][W] (0277e282-5) a1bc4120-com.docker.diagnose C<-S NoResponse GET /ping (1.0362ms): Get "http://ipc/ping": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:48.991994000Z][com.docker.diagnose.exe][I] (0277e282-6) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /ping
[2022-12-19T00:09:48.993515900Z][com.docker.diagnose.exe][W] (0277e282-6) a1bc4120-com.docker.diagnose C<-S NoResponse GET /ping (1.0491ms): Get "http://ipc/ping": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:49.999431800Z][com.docker.diagnose.exe][I] (0277e282-7) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /ping
[2022-12-19T00:09:50.000430100Z][com.docker.diagnose.exe][W] (0277e282-7) a1bc4120-com.docker.diagnose C<-S NoResponse GET /ping (998.3µs): Get "http://ipc/ping": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.
[2022-12-19T00:09:51.020341400Z][com.docker.diagnose.exe][I] (0277e282-8) a1bc4120-com.docker.diagnose C->S VMDockerdAPI GET /ping
[2022-12-19T00:09:51.021623100Z][com.docker.diagnose.exe][W] (0277e282-8) a1bc4120-com.docker.diagnose C<-S NoResponse GET /ping (1.2817ms): Get "http://ipc/ping": open \\.\pipe\dockerLifecycleServer: The system cannot find the file specified.

[PASS] DD0015: are the binary symlinks installed?
[FAIL] DD0031: does the Docker API work? error during connect: This error may indicate that the docker daemon is not running.: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine_linux/v1.24/containers/json?limit=0": open //./pipe/docker_engine_linux: The system cannot find the file specified.
[PASS] DD0013: is the $PATH ok?
error during connect: This error may indicate that the docker daemon is not running.: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json": open //./pipe/docker_engine: The system cannot find the file specified.
[FAIL] DD0003: is the Docker CLI working? exit status 1
[PASS] DD0005: is the user in the docker-users group?
2022/12/19 01:09:51 exit status 0xffffffff

From the above output I see:

[FAIL] DD0023: is the Containers Windows Feature enabled? required Windows Feature not installed: Containers

I tried to search the documentation for more information on this, but was not able to find any good advice. Any idea what is going on here?


来源: stackexchange

问:
Strange error on website Magento at checkout error Trustspot
I have a store on Magento
Strange error on website at checkout. When people checkout, it says “Order not sent to Trustspot”. Trustspot is the service we use for our reviews. It says error, but not sure why because the orders are all being sent over. Just a strange error which makes customers panic sometimes and think their order isn’t going through.

Has anyone had such a problem? Where to start solving this problem?
Thanks

ContentLicense: CC BY-SA 4.0


问:
Is there any apps script for auto delete rows with unique id's column from first sheet , when same unique id's column found in another sheet?
I have a google spreadsheet with two sheets "Customer Details" and " Deliveries". Daily rows updates with a unique id in the "Customer Details" sheet, I use this sheet's data and save in the "Deliveries" sheet with same unique id .

I want an apps script for automatically delete rows with unique id's column from first sheet , when same unique id's column found in another sheet .

please help.

I have no idea for this problem , please help.


问:
Could you help me with typing my own variant of Reduce function
I wrote down my own version of Array.prototype.reduce function. But works out of the global Array. The function signature looks like below. There are three cases of using this function

function reduce<T> (
  arr: T[],
  reduceFunction: (acc: T, item: T, index: number, arr: T[]) => T,
): T;

function reduce<T> (
  arr: T[],
  reduceFunction: (acc: T, item: T, index: number, arr: T[]) => T,
  initialValue: T,
): T;

function reduce<T, R> (
  arr: T[],
  reduceFunction: (acc: R, item: T, index: number, arr: T[]) => R,
  initialValue?: R
): R;
```
<p>But how I can conditionally type my <code>initialValue</code> and <code>acc</code> parameters so the prev variable will be accepted without an error</p>
<p><strong>Typescript Playground Link</strong></p>
<pre class="lang-js prettyprint-override"><code>function reduce<T> (
  arr: T[],
  reduceFunction: (acc: T, item: T, index: number, arr: T[]) => T,
): T;

function reduce<T> (
  arr: T[],
  reduceFunction: (acc: T, item: T, index: number, arr: T[]) => T,
  initialValue: T,
): T;

function reduce<T, R> (
  arr: T[],
  reduceFunction: (acc: R, item: T, index: number, arr: T[]) => R,
  initialValue?: R
): R;

function reduce<T, R> (
  arr: T[],
  reduceFunction: (acc: R | T, item: T, index: number, arr: T[]) => R | T,
  initialValue?: R | T
): R | T {
  if (initialValue === undefined) {
    let prev = arr[0]

    for (let i = 1; i < arr.length; i++) {
      const item = arr[i]
      // Type 'T | R' is not assignable to type 'T'.'T' could be instantiated with an arbitrary type which could be unrelated to 'T | R'.ts(2322)
      prev = reduceFunction(prev, item, i, arr)
    }

    return prev
  } else {
    let prev = initialValue as R

    for (let i = 0; i < arr.length; i++) {
      const item = arr[i]

// let prev: (T & ({} | null)) | (R & ({} | null))
// Type 'T | R' is not assignable to type '(T & ({} | null)) | (R & ({} | null))'.
// Type 'T' is not assignable to type '(T & ({} | null)) | (R & ({} | null))'.
// Type 'T' is not assignable to type 'T & null'.
// Type 'T' is not assignable to type 'null'.ts(2322)
      prev = reduceFunction(prev, item, i, arr) as R
    }

    return prev
  }
}

const result = reduce<User, UserWithFullname[]>(
  arr,
  (acc, item) => {
    return [...acc, { ...item, fullname: item.name + ' ' + item.surname }]
  },
  []
)

const total = reduce(
  products,
  (acc, item) => {
    return acc + item.capacity * item.price
  },
  0
)

console.log(result)
console.log(total)
</code>```

Body:
I wrote down my own version of Array.prototype.reduce function. But works out of the global Array. The function signature looks like below. There are three cases of using this function

function reduce<T> (
  arr: T[],
  reduceFunction: (acc: T, item: T, index: number, arr: T[]) => T,
): T;

function reduce<T> (
  arr: T[],
  reduceFunction: (acc: T, item: T, index: number, arr: T[]) => T,
  initialValue: T,
): T;

function reduce<T, R> (
  arr: T[],
  reduceFunction: (acc: R, item: T, index: number, arr: T[]) => R,
  initialValue?: R
): R;

But how I can conditionally type my initialValue and acc parameters so the prev variable will be accepted without an error

<a href="https://www.typescriptlang.org/play?#code/GYVwdgxgLglg9mABAJwKYBMQVQHgCoB8AFAFCLmICGyyAXIngNoC6ANGRWptgGLjTww9IpQgR6eVohhRUAWwlSYYdKgAe9MCDkAjVMinU6DFgEpEAXgIN2piSRKhIsBCgxZchUhSo0JLdh8uDz5nQWFRcRtpWQVo5VUNRC1dfUM-E2ZzKxsOcmUZGEoAGwA1EpBURRI7BgcnAVdg7HwpACViPN9jJjYu5tRQxqFEETF6NqVYxWkVdU1tPQNu-yzLa0mugtgS8uLKiZrDx34XJAHWxA7vCiNVwM53XlPw0ciJxAAfeOn4uaSUkt0j0zOsrl9cj5tkUyhVUAB%20D7fPBHcHIxAAby2wFG0N2cMsFgsiHAqmAygw5ixPh8xVQUEQAAc0AA3SzdRgABmYDhpFGAcGQozpDJg7IAjABuaSIHDdAB0dLAAHMoAALaUwADUWqpXT55AgCAAzqLYuyjIwYDyDTTmag2cSBkMzkR7SypvIlMDTPqKABfXkGtBQEDIJDurr%20xCoYrG1CYv3kEVM1nsvGw-aoIN8gVCogpsXEzma2UKpWqjXSHV620%20I1gU0xeQWmhWnlJu1pp1PQYvBBu1meuTe7q%2022BzshsMR1lRkj%20oA" rel="nofollow noreferrer">Typescript Playground Link

function reduce<T> (
  arr: T[],
  reduceFunction: (acc: T, item: T, index: number, arr: T[]) => T,
): T;

function reduce<T> (
  arr: T[],
  reduceFunction: (acc: T, item: T, index: number, arr: T[]) => T,
  initialValue: T,
): T;

function reduce<T, R> (
  arr: T[],
  reduceFunction: (acc: R, item: T, index: number, arr: T[]) => R,
  initialValue?: R
): R;

function reduce<T, R> (
  arr: T[],
  reduceFunction: (acc: R | T, item: T, index: number, arr: T[]) => R | T,
  initialValue?: R | T
): R | T {
  if (initialValue === undefined) {
    let prev = arr[0]

    for (let i = 1; i < arr.length; i++) {
      const item = arr[i]
      // Type 'T | R' is not assignable to type 'T'.'T' could be instantiated with an arbitrary type which could be unrelated to 'T | R'.ts(2322)
      prev = reduceFunction(prev, item, i, arr)
    }

    return prev
  } else {
    let prev = initialValue as R

    for (let i = 0; i < arr.length; i++) {
      const item = arr[i]

// let prev: (T & ({} | null)) | (R & ({} | null))
// Type 'T | R' is not assignable to type '(T & ({} | null)) | (R & ({} | null))'.
// Type 'T' is not assignable to type '(T & ({} | null)) | (R & ({} | null))'.
// Type 'T' is not assignable to type 'T & null'.
// Type 'T' is not assignable to type 'null'.ts(2322)
      prev = reduceFunction(prev, item, i, arr) as R
    }

    return prev
  }
}

const result = reduce<User, UserWithFullname[]>(
  arr,
  (acc, item) => {
    return [...acc, { ...item, fullname: item.name + ' ' + item.surname }]
  },
  []
)

const total = reduce(
  products,
  (acc, item) => {
    return acc + item.capacity * item.price
  },
  0
)

console.log(result)
console.log(total)


问:
ResolvePackageNotFound when trying to create conda environment (Conda Version 4.5.11)
I am trying to reproduce the experiments in the paper Cross Modal Focal Loss for RGBD Face Anti-Spoofing. I have downloaded the source codes from gitlab and moved it to my linux (ubuntu) remote server . I am following the installation steps as given in the gitlab repo . The link to the gitlab repo is as follows :https://gitlab.idiap.ch/bob/bob.paper.cross_modal_focal_loss_cvpr2021

I am getting an error (ResolvePackageNotFound) when I try to build the environment as mentioned on step 2 . It is worthy mentioning that the Bob package isn't installed because I see that it is contained in the 'environment.yml'. The 'environment.yml' file I used is the newest version.

Error result is here.

I hope anyone would be able to assist me in solving this issue. It is very important for me.

I hope anyone would be able to assist me in solving this issue. It is very important for me.


问:
invoke extension from our website to grap data from other website
I have a website and a chrome extension. The extension is scraping data from whatsapp. On website I want something like that if someone visit website there is a button to scrap data. When someone click on that button I want the data to be scraped from whatsapp and displayed on my website. How can I do that. Please answer that question.

I want to scrape data from whatsapp by clicking a button on my site


问:
populate a People/Group field which allow multiple selection using PnP Power shell for SharePoint Online
I have a SharePoint online field named "HRContacts" which allow multiple selection:-

and using PnP Power Shell i want to create a new list item and populate this field among with other fields. i have this Power Shell script, but i got the below error:-

```<code>PS C:\WINDOWS\system32> $HRCollabs = [System.Collections.ArrayList]@()
PS C:\WINDOWS\system32> $testuser  = Get-PnPAzureADUser -Filter  { Mail eq 'test@******.com'}
PS C:\WINDOWS\system32> $HRCollabs.Add($testuser)
PS C:\WINDOWS\system32> Add-PnPListItem -List "customlist" -Values @{HRContacts= $HRCollabs; Title = '123'}
Add-PnPListItem : The specified user  could not be found.
At line:1 char:1
+ Add-PnPListItem -List "customlist" -Values @{HRContacts= $HRCollabs; Titl ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Add-PnPListItem], PSInvalidOperationException
    + FullyQualifiedErrorId : InvalidOperation,PnP.PowerShell.Commands.Lists.AddListItem
</code>```

Any advice?
Thanks

Body:
I have a SharePoint online field named "HRContacts" which allow multiple selection:-

and using PnP Power Shell i want to create a new list item and populate this field among with other fields. i have this Power Shell script, but i got the below error:-

PS C:\WINDOWS\system32> $HRCollabs = [System.Collections.ArrayList]@()
PS C:\WINDOWS\system32> $testuser  = Get-PnPAzureADUser -Filter  { Mail eq 'test@******.com'}
PS C:\WINDOWS\system32> $HRCollabs.Add($testuser)
PS C:\WINDOWS\system32> Add-PnPListItem -List "customlist" -Values @{HRContacts= $HRCollabs; Title = '123'}
Add-PnPListItem : The specified user  could not be found.
At line:1 char:1
+ Add-PnPListItem -List "customlist" -Values @{HRContacts= $HRCollabs; Titl ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Add-PnPListItem], PSInvalidOperationException
    + FullyQualifiedErrorId : InvalidOperation,PnP.PowerShell.Commands.Lists.AddListItem

Any advice?
Thanks


问:
How do I access to session on the server?
everyone.
my sessions work correctly when I use it locally, but when in deploy on the server this error occurred :

Object reference not set to an instance of an object

I deploy very simply project but it does not work again

```<code>public ActionResult Index()
        {
            Session["name"] = "javad bayat";
            ViewBag.Message = Session["name"].ToString();
            return View();
        }

        public ActionResult About()
        {
            try
            {

            ViewBag.Message = Session["name"].ToString();
            }
            catch (Exception w)
            {

                ViewBag.Message = w.Message;
            }

            return View();
        }
</code>```

do I have to check the windows server or config my web.config to sth else?
thanks for your help

Body:
everyone.
my sessions work correctly when I use it locally, but when in deploy on the server this error occurred :

Object reference not set to an instance of an object

I deploy very simply project but it does not work again

public ActionResult Index()
        {
            Session["name"] = "javad bayat";
            ViewBag.Message = Session["name"].ToString();
            return View();
        }

        public ActionResult About()
        {
            try
            {

            ViewBag.Message = Session["name"].ToString();
            }
            catch (Exception w)
            {

                ViewBag.Message = w.Message;
            }

            return View();
        }

do I have to check the windows server or config my web.config to sth else?
thanks for your help


问:
How to run the test of angular on linux
karma.conf.js

process.env.CHROME_BIN = require('puppeteer').executablePath()

...
    browsers: ['Chrome'],
    customLaunchers: {
      ChromeHeadlessCI: {
        base: 'ChromeHeadless',
        flags: ['--no-sandbox']
      }
    },
...
```
<p>run</p>
<pre class="lang-bash prettyprint-override"><code>ng test --code-coverage --no-watch --no-progress --browsers=ChromeHeadlessCI
</code>```

emit error

```<code>Cannot start ChromeHeadless
/root/.cache/puppeteer/chrome/linux-1069273/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
</code>```

But I checked the directory and found that there were files.

cd /root/.cache/puppeteer/chrome/linux-1069273/chrome-linux/

ls

chrome
chrome_crashpad_handler
...more
```

Title: How to run the test of angular on linux

Body:
karma.conf.js

process.env.CHROME_BIN = require('puppeteer').executablePath()

...
    browsers: ['Chrome'],
    customLaunchers: {
      ChromeHeadlessCI: {
        base: 'ChromeHeadless',
        flags: ['--no-sandbox']
      }
    },
...

run

ng test --code-coverage --no-watch --no-progress --browsers=ChromeHeadlessCI

emit error

Cannot start ChromeHeadless
/root/.cache/puppeteer/chrome/linux-1069273/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

But I checked the directory and found that there were files.

cd /root/.cache/puppeteer/chrome/linux-1069273/chrome-linux/

ls

chrome
chrome_crashpad_handler
...more


问:
How do you check if an object is an instance of a generic type in JAVA?
so i need to write a method called frequency to calculate the number of occurances of an Object of type E in a collection ( i'm not even sure if the collection  should be a linked list like i did  or if i should've just called the constructor super(), i just thought that if i didn't make it a linkedlist then what's the point of naming the class linkedlistcollection) , this method takes a parameter of type Object , i can't change that cuz that's the contract, here is the code :

```<code>public class LinkedListCollection<E> extends AbstractCollection<E> {

      private int size;
      private Collection<? extends E > list;
     /**
     * @ensures isEmpty();
     */
    public LinkedListCollection() {
      list = new LinkedList<>();
      size = 0;
    }

    /**

     *
     * @param is the Collection of elements that should be placed in the list
     *
     * @requires c != null;
     * @requires !c.contains(null);
     * @ensures containsAll(c) && c.containsAll(this);
     * @ensures size() == c.size();
     *
     * @throws NullPointerException is the param collection is null or  contains null
     */
    public LinkedListCollection(Collection<? extends E> c) {
      if ((c == null) || (c.contains(null))  )
     {
        throw new NullPointerException();
     }
        list=new LinkedListCollection<>();
        size=c.size();
        list.addAll(c);

    }
</code>```

and then there's what i did in the frequency method

```<code>public int frequency(Object o) {
        E newob= (E) o;
        Iterator it = list.iterator();
        int frequency= 0;
        while(it.hasNext())
       {
         if (it.next().equals(newob))
         frequency++;
       }
       return frequency;

    }
</code>```

now to calculate the frequency i wanted to check if the object is an instance of E first, but isinstanceof doesn't work with generic types, so i just performed a cast like you can see above, i'm not convinced this is the right thing to do tho. What's the correct way of coding this method? are my constructors correct? and how do we check if object is an instance of a generic type ? ( i believe it's also needed to redefine equals)
thank you!

Body:
so i need to write a method called frequency to calculate the number of occurances of an Object of type E in a collection ( i'm not even sure if the collection  should be a linked list like i did  or if i should've just called the constructor super(), i just thought that if i didn't make it a linkedlist then what's the point of naming the class linkedlistcollection) , this method takes a parameter of type Object , i can't change that cuz that's the contract, here is the code :

public class LinkedListCollection<E> extends AbstractCollection<E> {

      private int size;
      private Collection<? extends E > list;
     /**
     * @ensures isEmpty();
     */
    public LinkedListCollection() {
      list = new LinkedList<>();
      size = 0;
    }

    /**

     *
     * @param is the Collection of elements that should be placed in the list
     *
     * @requires c != null;
     * @requires !c.contains(null);
     * @ensures containsAll(c) && c.containsAll(this);
     * @ensures size() == c.size();
     *
     * @throws NullPointerException is the param collection is null or  contains null
     */
    public LinkedListCollection(Collection<? extends E> c) {
      if ((c == null) || (c.contains(null))  )
     {
        throw new NullPointerException();
     }
        list=new LinkedListCollection<>();
        size=c.size();
        list.addAll(c);

    }

and then there's what i did in the frequency method

public int frequency(Object o) {
        E newob= (E) o;
        Iterator it = list.iterator();
        int frequency= 0;
        while(it.hasNext())
       {
         if (it.next().equals(newob))
         frequency++;
       }
       return frequency;

    }

now to calculate the frequency i wanted to check if the object is an instance of E first, but isinstanceof doesn't work with generic types, so i just performed a cast like you can see above, i'm not convinced this is the right thing to do tho. What's the correct way of coding this method? are my constructors correct? and how do we check if object is an instance of a generic type ? ( i believe it's also needed to redefine equals)
thank you!


问:
VLAN Trunk and VRFs on Ubuntu 22.04 Server
so i need the following setup:

i have a Ubuntu 22.04 Server with 2 interfaces.

ens160: Management

ens192: Data

What i need to do is run the same docker application 10 times on this server. Since this should be a lab environment, all IP addresses the client machines connect to should be the same.

So what i came up with, is to have 10 VLANS (301 - 310) on a trunk on interface ens192. Each of this vlan should be in its own VRF and have the same IP address ( 10.0.0.252 ).

I cant figure out what the best way it is to configure this setup. I tried netplan but couldnt get it to work.

Can someone help me out here waht the best way is to accomplish this and how?

Best regards


问:
Vue - rendering templates after Ajax call
I have a page which loads some information chunks at the beginning and it loads other ones when user scroll down. In this chunks I have also , for which I have a function written.
Simplified structure of the chunk looks like that:

```<code><div class="chunk_class">
  <div class="chunk_header">
    <div class="title"></div>
    <div class="subtitle"></div>
  </div>
   ....
  <div class="actions">
     <comparison-training-toggle training-id="70" init-comparison="0" icon="n-compare" class="v-comparison-toggle" title="Some title"></comparison-training-toggle>
     <div class="another_action"></div>
  </div>
</code>```

It works for the chunks that I load at page load, but it doesn't work for the other ones that I load through Ajax call. How can I make it work also for Ajax loaded ones? Do I need to install some other modules (I have now installed Vue, Vue-resource & Vue-router)?
Below part of the function that I wrote with comments what does and what doesn't work:

```<code>  $(document, context).once('vue__comparison_toggle_add').each(() => {
    Drupal.behaviors.vue__comparison_toggle.vueComponent(); //this works
  });
  $(document).ajaxComplete(function(e, xhr, settings){
    Drupal.behaviors.vue__comparison_toggle.vueComponent();//it enters the the ajaxComplete, but doesn't work, it still remains <comparison-training-toggle>...
  });
},
vueComponent: function () {
    Vue.component('comparison-training-toggle', {
      template: this.template,
      props: ['trainingId', 'icon', 'init-comparison'],
      data() {
        return {
          inComparison: false,
        }
      },
      computed: {
        toggleText() {
          return this.inComparison ? Drupal.t('Usuń z porównania') : Drupal.t('Dodaj do porównania')
        }
      },
      methods: {
        toggle() {
          ...
</code>```

Body:
I have a page which loads some information chunks at the beginning and it loads other ones when user scroll down. In this chunks I have also , for which I have a function written.
Simplified structure of the chunk looks like that:

   ....

     <comparison-training-toggle training-id="70" init-comparison="0" icon="n-compare" class="v-comparison-toggle" title="Some title"></comparison-training-toggle>

It works for the chunks that I load at page load, but it doesn't work for the other ones that I load through Ajax call. How can I make it work also for Ajax loaded ones? Do I need to install some other modules (I have now installed Vue, Vue-resource & Vue-router)?
Below part of the function that I wrote with comments what does and what doesn't work:

  $(document, context).once('vue__comparison_toggle_add').each(() => {
    Drupal.behaviors.vue__comparison_toggle.vueComponent(); //this works
  });
  $(document).ajaxComplete(function(e, xhr, settings){
    Drupal.behaviors.vue__comparison_toggle.vueComponent();//it enters the the ajaxComplete, but doesn't work, it still remains <comparison-training-toggle>...
  });
},
vueComponent: function () {
    Vue.component('comparison-training-toggle', {
      template: this.template,
      props: ['trainingId', 'icon', 'init-comparison'],
      data() {
        return {
          inComparison: false,
        }
      },
      computed: {
        toggleText() {
          return this.inComparison ? Drupal.t('Usuń z porównania') : Drupal.t('Dodaj do porównania')
        }
      },
      methods: {
        toggle() {
          ...


问:
How to customize product card on Dolibarr?
I'm trying to use dolibarr and I'm having some troubles with product's card. I would like to split some informations on the card. For now I have two tables on the card, but I would like to put some informations of the second table in a third one. I also would like to put some other information in another tab. I read the dolibarr documentation and watch some vids on youtube but I didn't found how to do that.

Do someone have any informations about how to do that ?

Thank you for your help !


问:
Mac OS Elementor button text not vertical align
Mac OS Safari & Chrome Elementor button text not vertical align https://joshuaj65.sg-host.com/

https://prnt.sc/Fh5I4SIGyGaR

https://watch.screencastify.com/v/BUQwmY3hxfCLEiS3Y585

```<code>.elementor-button span{
    max-height: 26px !important;
    display: flex !important;
  align-items: center !important;
}
</code>```

Body:
Mac OS Safari & Chrome Elementor button text not vertical align https://joshuaj65.sg-host.com/

https://prnt.sc/Fh5I4SIGyGaR

https://watch.screencastify.com/v/BUQwmY3hxfCLEiS3Y585

.elementor-button span{
    max-height: 26px !important;
    display: flex !important;
  align-items: center !important;
}


问:
Table content overlaps another table with float CSS property with Flying-saucer
I am trying to convert html to pdf using Flying-saucer.  But on some part of html flying-saucer works strange.

So I have a html looks like this:

Initial html
and got such pdf:
Resulting pdf

My html body:

     Text 1

     Text 2 -

     Text 3 -

1. Paragrath

     Table 2 text here

```

with no styles in html.

I am using flying-saucer vers. 9.1.22, downloaded from maven repository.

How can this be fixed?

Body:
I am trying to convert html to pdf using Flying-saucer.  But on some part of html flying-saucer works strange.

So I have a html looks like this:

Initial html
and got such pdf:
Resulting pdf

My html body:

     Text 1

     Text 2 -

     Text 3 -

1. Paragrath

     Table 2 text here

with no styles in html.

I am using flying-saucer vers. 9.1.22, downloaded from maven repository.

How can this be fixed?


问:
How can I raise a warning for optional argument in TypeScript in editor level
In VsCode when using Image component from next/image, If you don't provide an alt value to image it gives warning. But it is optional.

How can I achieve same thing with my custom Image component?

Here is the warning message:

Simple custom image component abstraction

```<code>type ImageProps = {
  src: string
  alt?: string
  width?: number
  height?: number
}

const CustomImage = ({src, alt, width, height} : ImageProps) => {
 return (...)
}
</code>```

Body:
In VsCode when using Image component from next/image, If you don't provide an alt value to image it gives warning. But it is optional.

How can I achieve same thing with my custom Image component?

Here is the warning message:

Simple custom image component abstraction

type ImageProps = {
  src: string
  alt?: string
  width?: number
  height?: number
}

const CustomImage = ({src, alt, width, height} : ImageProps) => {
 return (...)
}


问:
NgxPubSubModule for angular 14 typescript
I have implemented NgxPubSubModule in my project but it was not accepted by NgModule imports.

I am getting this error while I import NgxPubSubModule.

ngx-pub-sub.module.d.ts(1, 22): This likely means that the library (@pscoped/ngx-pub-sub) which declares NgxPubSubModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also, consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

What is the solution to this problem


问:
im4java: is possible create a final image using others different images?
My project give me 3 images:

track.jpg (background full size)

pilote.jpg (40% of full size, position left)

car.jpg (40% of full size, position right)

Basically I need to get these 3 images resize and reposition it, and finally create a new image.

My code so far:

`

```<code>ConvertCmd cmd = new ConvertCmd();
IMOperation op = new IMOperation();
op.addImage("E:/jpeg/background.jpg");
op.resize(800,600);
op.addImage("E:/jpeg/pilote.jpg");
op.addImage("E:/jpeg/car.jpg");

op.compress("JPEG");
op.addImage("E:/thumraca.jpg");
cmd.run(op);
</code>```

`

How can I position my two images left and right?

Body:
My project give me 3 images:

track.jpg (background full size)

pilote.jpg (40% of full size, position left)

car.jpg (40% of full size, position right)

Basically I need to get these 3 images resize and reposition it, and finally create a new image.

My code so far:

`

ConvertCmd cmd = new ConvertCmd();
IMOperation op = new IMOperation();
op.addImage("E:/jpeg/background.jpg");
op.resize(800,600);
op.addImage("E:/jpeg/pilote.jpg");
op.addImage("E:/jpeg/car.jpg");

op.compress("JPEG");
op.addImage("E:/thumraca.jpg");
cmd.run(op);

`

How can I position my two images left and right?


问:
pytesseract not showing text in terminal
enter image description hereI have the following code to convert char and numeric digits from an image

```<code>import cv2
import pytesseract

img=cv2.imread('/home/mubashir/jeh_Project/1.jpeg')
rgb_img=cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
print(pytesseract.image_to_string(rgb_img))
cv2.imshow('RGB_img',rgb_img)
cv2.waitKey(0)
</code>```

I can view the image but the text is not printing in the terminal.

Body:
enter image description hereI have the following code to convert char and numeric digits from an image

import cv2
import pytesseract

img=cv2.imread('/home/mubashir/jeh_Project/1.jpeg')
rgb_img=cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
print(pytesseract.image_to_string(rgb_img))
cv2.imshow('RGB_img',rgb_img)
cv2.waitKey(0)

I can view the image but the text is not printing in the terminal.


问:
React-router page transition animation
I am trying to create a transition effect between pages using react-router-dom. I am trying to delay the rendering of the routes component, but it doesn't seem to work.

I have the following code

```<code>   const App = () => {
      const location = useLocation();
      const [displayLocation, setDisplayLocation] = useState(location);
      const [transitionStage, setTransitionStage] = useState("slideIn");

      useEffect(() => {
        if (location !== displayLocation) setTransitionStage("slideOut");
      }, [location, displayLocation]);

      return (
        <>
          <Layout>
            <ScrollToTop />
            <TransitionAnimation
            transitionStage={transitionStage}
            onAnimationEnd={() => {
              if (transitionStage === "slideIn") {
                setTransitionStage("slideOut");
                setDisplayLocation(location);
              }
          }}>
            </TransitionAnimation>
            <Routes location={displayLocation}>
              <Route path="/" element={<Home />} />
              <Route path="/about" element={<About />} />
            </Routes>
          </Layout>
        </>
      );
    };

    export default App;

    const TransitionAnimation = styled.div`
      width: 0px;
      height: 100vh;
      background: #000000;
      position: fixed;
      top:0;
      left:0;
      bottom:0;
      right: 0;
      z-index: 0;
      animation: ${(props) => props.transitionStage} 1s linear;

      @keyframes slideIn {
        from {
          width: 0%;
        }
        to {
          width: 90%;
        }
      }

      @keyframes slideOut {
        from {
          right: 0%;
        }
        to {
          right: -10000px;
        }
      }

    `;
</code>```

I have tried the above code, but it doesn't change the component even if the route changes.
Please what better way can I achieve this.

Title: React-router page transition animation

Body:
I am trying to create a transition effect between pages using react-router-dom. I am trying to delay the rendering of the routes component, but it doesn't seem to work.

I have the following code

   const App = () => {
      const location = useLocation();
      const [displayLocation, setDisplayLocation] = useState(location);
      const [transitionStage, setTransitionStage] = useState("slideIn");

      useEffect(() => {
        if (location !== displayLocation) setTransitionStage("slideOut");
      }, [location, displayLocation]);

      return (
        <>
          <Layout>
            <ScrollToTop />
            <TransitionAnimation
            transitionStage={transitionStage}
            onAnimationEnd={() => {
              if (transitionStage === "slideIn") {
                setTransitionStage("slideOut");
                setDisplayLocation(location);
              }
          }}>
            </TransitionAnimation>
            <Routes location={displayLocation}>
              <Route path="/" element={<Home />} />
              <Route path="/about" element={<About />} />
            </Routes>
          </Layout>
        </>
      );
    };

    export default App;

    const TransitionAnimation = styled.div`
      width: 0px;
      height: 100vh;
      background: #000000;
      position: fixed;
      top:0;
      left:0;
      bottom:0;
      right: 0;
      z-index: 0;
      animation: ${(props) => props.transitionStage} 1s linear;

      @keyframes slideIn {
        from {
          width: 0%;
        }
        to {
          width: 90%;
        }
      }

      @keyframes slideOut {
        from {
          right: 0%;
        }
        to {
          right: -10000px;
        }
      }

    `;

I have tried the above code, but it doesn't change the component even if the route changes.
Please what better way can I achieve this.


问:
MySQL: Error 500, Spring-Boot, Java. "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version..."
I created a database with MySQL, thereafter I created Java Backend, MySQL database can be seen in the following screenshot:
MySQL Database
Everything worked until I tried to post a new book to books table using from postman using my backend. Books table is defined like this:
Books table.
As it failed time after time I decided to keep only the first attribute and go adding the next one and so on in order to check which one was failing, it worked until I got to "condition" attibute, then it was when I got again the 500 error. if you see my backend:

```<code>package com.castellar.carlos.picon;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

@Table(name ="books")
@Entity
public class Books {

    @Id
    //@GeneratedValue(strategy = GenerationType.AUTO)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int books_id;

    private String title;
    private int year;
    private float price;
    private String description;
    private String condition;
    /*private String plot;
    private String cover;
    private int language_id;*/

    @ManyToOne
    @JoinColumn(name ="language_id", insertable = false, updatable = false)
    private Language language;
    public Books(String title, int year ,float price, String description, String condition/*,
                 String plot, String cover,  int language_id*/){

        this.title = title;
        this.year = year;
        this.price = price;
        this.description = description;
        this.condition = condition;
        /*this.plot =plot;
        this.cover = cover;
        this.language_id = language_id;
         */

    }
    @ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
    @JoinTable(name = "books_has_author",
            joinColumns = {
                    @JoinColumn(name = "books_id", referencedColumnName = "books_id",
                            nullable = false, updatable = false)},
            inverseJoinColumns = {
                    @JoinColumn(name = "author_id", referencedColumnName = "author_id",
                            nullable = false, updatable = false)})
    private Set<Author> author = new HashSet<>();

    public Set<Author> getAuthor() {

        return author;
    }

    public void setAuthor(Set<Author> author) {
        this.author = author;
    }

    public int getBooks_id() {
        return books_id;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getTitle() {
        return title;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public int getYear() {
        return year;
    }

    public void setPrice(float price) {
       this.price = price;
   }

   public float getPrice() {
       return price;
   }
    public void setDescription(String description) {
        this.description = description;
    }
    public String getDescription() {
        return description;
    }
   public void setCondition(String condition) {
       this.condition = condition;
   }

   public String getCondition() {
       return condition;
   }

   /*public void setPlot(String plot) {
       this.plot = plot;
   }

   public String getPlot() {
       return plot;
   }
   public void setLanguage_id(int language_id) {
       this.language_id = language_id;
   }
   public int getLanguage_id() {
       return language_id;
   }

   public void setCover(String cover) {
       this.cover = cover;
   }
   public String getCover() {
       return cover;
   }

   public Language getLanguage() {
       return language;
   }

   public void setLanguage(Language language) {
       this.language = language;

   }*/
    public Books(){

    }
}

</code>```

condition is not different there than descripttion or title, which are also Strings, and in post method:

```<code>@PostMapping("/AddBooks")
public @ResponseBody
String addBook(@RequestParam  String title , int year, float price ,String description,
               String condition/*, String plot, String cover, int language_id*/){
    Books addBook = new Books(title, year, price, description, condition/*, plot, cover, language_id*/);
    booksRepository.save(addBook);
    return save;
}
</code>```

Everything seems to be evenly done according to other variables, I can not see why adding condition attribute is provoking the error.
this the error in console:

2022-12-21 11:35:57.319  WARN 7984 --- [nio-8090-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 1064, SQLState: 42000
2022-12-21 11:35:57.320 ERROR 7984 --- [nio-8090-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'condition, description, price, title, year) values ('Best book ever', 'Best book' at line 1
2022-12-21 11:35:57.341 ERROR 7984 --- [nio-8090-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute statement] with root cause

As I said, I was able to post a new book to database just adding title, year, price and description.

I was expecting to be able to post a new book after calling post method from postman

Body:
I created a database with MySQL, thereafter I created Java Backend, MySQL database can be seen in the following screenshot:
MySQL Database
Everything worked until I tried to post a new book to books table using from postman using my backend. Books table is defined like this:
Books table.
As it failed time after time I decided to keep only the first attribute and go adding the next one and so on in order to check which one was failing, it worked until I got to "condition" attibute, then it was when I got again the 500 error. if you see my backend:

package com.castellar.carlos.picon;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

@Table(name ="books")
@Entity
public class Books {

    @Id
    //@GeneratedValue(strategy = GenerationType.AUTO)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int books_id;

    private String title;
    private int year;
    private float price;
    private String description;
    private String condition;
    /*private String plot;
    private String cover;
    private int language_id;*/

    @ManyToOne
    @JoinColumn(name ="language_id", insertable = false, updatable = false)
    private Language language;
    public Books(String title, int year ,float price, String description, String condition/*,
                 String plot, String cover,  int language_id*/){

        this.title = title;
        this.year = year;
        this.price = price;
        this.description = description;
        this.condition = condition;
        /*this.plot =plot;
        this.cover = cover;
        this.language_id = language_id;
         */

    }
    @ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
    @JoinTable(name = "books_has_author",
            joinColumns = {
                    @JoinColumn(name = "books_id", referencedColumnName = "books_id",
                            nullable = false, updatable = false)},
            inverseJoinColumns = {
                    @JoinColumn(name = "author_id", referencedColumnName = "author_id",
                            nullable = false, updatable = false)})
    private Set<Author> author = new HashSet<>();

    public Set<Author> getAuthor() {

        return author;
    }

    public void setAuthor(Set<Author> author) {
        this.author = author;
    }

    public int getBooks_id() {
        return books_id;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getTitle() {
        return title;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public int getYear() {
        return year;
    }

    public void setPrice(float price) {
       this.price = price;
   }

   public float getPrice() {
       return price;
   }
    public void setDescription(String description) {
        this.description = description;
    }
    public String getDescription() {
        return description;
    }
   public void setCondition(String condition) {
       this.condition = condition;
   }

   public String getCondition() {
       return condition;
   }

   /*public void setPlot(String plot) {
       this.plot = plot;
   }

   public String getPlot() {
       return plot;
   }
   public void setLanguage_id(int language_id) {
       this.language_id = language_id;
   }
   public int getLanguage_id() {
       return language_id;
   }

   public void setCover(String cover) {
       this.cover = cover;
   }
   public String getCover() {
       return cover;
   }

   public Language getLanguage() {
       return language;
   }

   public void setLanguage(Language language) {
       this.language = language;

   }*/
    public Books(){

    }
}

condition is not different there than descripttion or title, which are also Strings, and in post method:

@PostMapping("/AddBooks")
public @ResponseBody
String addBook(@RequestParam  String title , int year, float price ,String description,
               String condition/*, String plot, String cover, int language_id*/){
    Books addBook = new Books(title, year, price, description, condition/*, plot, cover, language_id*/);
    booksRepository.save(addBook);
    return save;
}

Everything seems to be evenly done according to other variables, I can not see why adding condition attribute is provoking the error.
this the error in console:

2022-12-21 11:35:57.319  WARN 7984 --- [nio-8090-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 1064, SQLState: 42000
2022-12-21 11:35:57.320 ERROR 7984 --- [nio-8090-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'condition, description, price, title, year) values ('Best book ever', 'Best book' at line 1
2022-12-21 11:35:57.341 ERROR 7984 --- [nio-8090-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute statement] with root cause

As I said, I was able to post a new book to database just adding title, year, price and description.

I was expecting to be able to post a new book after calling post method from postman


问:
ESP8266Audio with multiple .wav file encoded in hex
I'm working on a script that will play multiple.wav encoded files in the ESP8266 using the ESP8266Audio library. I need to play multiple audio streams with different time stamps; that's why I am asking for it. Please do note that the hardware is ESP32-8266 and TIP 120 transistor.</p>
```<code>#include <Arduino.h>
#include "AudioFileSourcePROGMEM.h"
#include "AudioGeneratorWAV.h"
#include "AudioOutputI2SNoDAC.h"
#include <ESP8266WiFi.h>
#include <SPI.h>
#include <SD.h>

// VIOLA sample taken from https://ccrma.stanford.edu/~jos/pasp/Sound_Examples.html
#include "viola.h"
#include "viola02.h"

AudioGeneratorWAV *wav;
AudioFileSourcePROGMEM *file;

AudioOutputI2SNoDAC *out;
void setup()
{
  Serial.begin(115200);
  delay(1000);
  Serial.printf("WAV start\n");

  audioLogger = &Serial;
  out = new AudioOutputI2SNoDAC();
  //  out02 = new AudioOutputI2SNoDAC();
  //  out -> SetGain(0.08);
}

void Play(const void *data, uint32_t len) {
  file = new AudioFileSourcePROGMEM( data, len );
  wav = new AudioGeneratorWAV();
  wav->begin(file, out);
  delay(3000);
  while (true) {
    if (wav->isRunning()) {
      if (!wav->loop()) wav->stop();
    } else {
      Serial.printf("WAV done\n");
      delay(1000);
      break;
    }
  }
}

void loop()
{
 Play(viola,sizeof(viola));
  Play(viola02,sizeof(viola02));
}

[![enter image description here][1]][1]

  [1]: https://i.stack.imgur.com/yIKml.png
</code>```

Body:
I'm working on a script that will play multiple.wav encoded files in the ESP8266 using the ESP8266Audio library. I need to play multiple audio streams with different time stamps; that's why I am asking for it. Please do note that the hardware is ESP32-8266 and TIP 120 transistor.

#include <Arduino.h>
#include "AudioFileSourcePROGMEM.h"
#include "AudioGeneratorWAV.h"
#include "AudioOutputI2SNoDAC.h"
#include <ESP8266WiFi.h>
#include <SPI.h>
#include <SD.h>

// VIOLA sample taken from https://ccrma.stanford.edu/~jos/pasp/Sound_Examples.html
#include "viola.h"
#include "viola02.h"

AudioGeneratorWAV *wav;
AudioFileSourcePROGMEM *file;

AudioOutputI2SNoDAC *out;
void setup()
{
  Serial.begin(115200);
  delay(1000);
  Serial.printf("WAV start\n");

  audioLogger = &Serial;
  out = new AudioOutputI2SNoDAC();
  //  out02 = new AudioOutputI2SNoDAC();
  //  out -> SetGain(0.08);
}

void Play(const void *data, uint32_t len) {
  file = new AudioFileSourcePROGMEM( data, len );
  wav = new AudioGeneratorWAV();
  wav->begin(file, out);
  delay(3000);
  while (true) {
    if (wav->isRunning()) {
      if (!wav->loop()) wav->stop();
    } else {
      Serial.printf("WAV done\n");
      delay(1000);
      break;
    }
  }
}

void loop()
{
 Play(viola,sizeof(viola));
  Play(viola02,sizeof(viola02));
}

[![enter image description here][1]][1]

  [1]: https://i.stack.imgur.com/yIKml.png


问:
I don't understand how to choose a database in MySQL.(Error 1056)
```<code>CREATE TABLE User(
    id INT PRIMARY KEY,
    names VARCHAR(100),
    aling VARCHAR(30),
    eye VARCHAR(30),
    hair VARCHAR(30),
    gender VARCHAR(30),
    apperences INT,
    year INT,
    universal VARCHAR(10)
)
</code>```

everywhere I look, such an example is shown... and nowhere does it say how to choose a database. even with a direct request

21:42:26

```<code>CREATE TABLE User(
   id INT PRIMARY KEY,
   names VARCHAR(100),
   aling VARCHAR(30),
   eye VARCHAR(30),
   hair VARCHAR(30),
   gender VARCHAR(30),
   apperences INT,
   year INT,
   universal VARCHAR(10)
)
</code>```

Error Code: 1046. No database selected
Select the default DB to be used by double-clicking its name in the SCHEMAS list in the sidebar.   0.000 sec

I expected that I would just write and everything would work, but no

Body:
CREATE TABLE User(
    id INT PRIMARY KEY,
    names VARCHAR(100),
    aling VARCHAR(30),
    eye VARCHAR(30),
    hair VARCHAR(30),
    gender VARCHAR(30),
    apperences INT,
    year INT,
    universal VARCHAR(10)
)

everywhere I look, such an example is shown... and nowhere does it say how to choose a database. even with a direct request

21:42:26

CREATE TABLE User(
   id INT PRIMARY KEY,
   names VARCHAR(100),
   aling VARCHAR(30),
   eye VARCHAR(30),
   hair VARCHAR(30),
   gender VARCHAR(30),
   apperences INT,
   year INT,
   universal VARCHAR(10)
)

Error Code: 1046. No database selected
Select the default DB to be used by double-clicking its name in the SCHEMAS list in the sidebar.   0.000 sec

I expected that I would just write and everything would work, but no


问:
Using material ui data table in React, not able to access row data
I am using the material ui data table package in my React project.

Everything otherwise works as expected, but when I try to access the selected row(s) via its provided callback (Yep, I am using TypeScript):

```<code>import { MUIDataTableOptions } from "mui-datatables";
...
const options: MUIDataTableOptions = {
  onRowsDelete: (rows => {
      rows.data.map(r => console.log(JSON.stringify(r)));

  }),
  ...
}
</code>```

At runtime, when select rows and clicking the delete icon, this callback only gives two indexes of the selected table row. But I need to access the data showing on the row in order to delete via request to backend.

How can I get the data of the selected row using this library/package when deleting rows?

Body:
I am using the material ui data table package in my React project.

Everything otherwise works as expected, but when I try to access the selected row(s) via its provided callback (Yep, I am using TypeScript):

import { MUIDataTableOptions } from "mui-datatables";
...
const options: MUIDataTableOptions = {
  onRowsDelete: (rows => {
      rows.data.map(r => console.log(JSON.stringify(r)));

  }),
  ...
}

At runtime, when select rows and clicking the delete icon, this callback only gives two indexes of the selected table row. But I need to access the data showing on the row in order to delete via request to backend.

How can I get the data of the selected row using this library/package when deleting rows?


问:
Windows 10 python executable can´t run on Windows 7 Professional
I´m developing a tkinter GUI that will run another python script, using python 3.8 and Pycharm in Windows 10, but the goal is to create an executable to run in Windows 7 Professional, since I can´t install python in the other Windows 7 computer or even update its Windows system.

Once the executable is created, with pyinstaller 5.7.0, I have successfully managed to run it in the Windows 7 Professional computer, but once I push a button in it to run the python script, an error just pulls off saying:

"The "python" command is either misspelled or couldn't be found."

I must also say that the command that I am using to run the python script from the tkinter GUI is:

```<code>import os
os.system("python 'scriptname'.py")
</code>```

Do you have any idea why this problem is happening? Are there any solutions? What should I do?

I expect the windows 10 python executable to run on windows 7 professional, and the GUI to run another python script, all in an executable.

I have also tried different commands to open the python script, but its always followed by errors:

```<code>subprocess.call(['python', 'scriptname.py'])
# error: The system couldn´t find "subprocess.py" file

subprocess.call(['python', 'scriptname.py'], shell=True)
# error: "The "python" command is either misspelled or couldn't be found."

subprocess.run(['python', 'scriptname.py'], shell=True)
# error: "The "python" command is either misspelled or couldn't be found."
</code>```

Body:
I´m developing a tkinter GUI that will run another python script, using python 3.8 and Pycharm in Windows 10, but the goal is to create an executable to run in Windows 7 Professional, since I can´t install python in the other Windows 7 computer or even update its Windows system.

Once the executable is created, with pyinstaller 5.7.0, I have successfully managed to run it in the Windows 7 Professional computer, but once I push a button in it to run the python script, an error just pulls off saying:

"The "python" command is either misspelled or couldn't be found."

I must also say that the command that I am using to run the python script from the tkinter GUI is:

import os
os.system("python 'scriptname'.py")

Do you have any idea why this problem is happening? Are there any solutions? What should I do?

I expect the windows 10 python executable to run on windows 7 professional, and the GUI to run another python script, all in an executable.

I have also tried different commands to open the python script, but its always followed by errors:

subprocess.call(['python', 'scriptname.py'])
# error: The system couldn´t find "subprocess.py" file

subprocess.call(['python', 'scriptname.py'], shell=True)
# error: "The "python" command is either misspelled or couldn't be found."

subprocess.run(['python', 'scriptname.py'], shell=True)
# error: "The "python" command is either misspelled or couldn't be found."


问:
How to remove default response headers in website in case of AWS?
When i send the request able to see the default AWS Header which seem to sensetive.
The following headers is reflecting.

```<code>X-Amzn-Requestid: <Value>
X-Amz-Apigw-Id: <Value>
X-Amzn-Remapped-Server: <Value>
X-Amzn-Remapped-Date: <Value>
</code>```

is it possible to customize the header?

I came through some article but still i'm not sure about the resolution.

Body:
When i send the request able to see the default AWS Header which seem to sensetive.
The following headers is reflecting.

X-Amzn-Requestid: <Value>
X-Amz-Apigw-Id: <Value>
X-Amzn-Remapped-Server: <Value>
X-Amzn-Remapped-Date: <Value>

is it possible to customize the header?

I came through some article but still i'm not sure about the resolution.


问:
Component not working after come back from any page Reactjs
I am i working on Reactjs/nextjs and right no in my page there is video with audio "start/pause button",Component is working fine if i am coming first time in site/page, but whenever i click on another menu/page and then come back to "home page" then its not working, Where i am wrong ?
Here is my code in index.js file

```<code>export default function Home() {
const screenWidth = useWindowSize();
  const scrollHeight = useScrollHeight();

  const CustomAudioPlayer = dynamic(
    () => import("../components/CustomAudioPlayer"),
    { ssr: false }
  );
}
</code>```

And here is my code inside "components/index.js"

```<code>function handleAudio() {
    if (ref.current.paused) {
        setMuted(false);
        ref.current.play();
    } else {
        setMuted(true);
        ref.current.pause();
    }
}

<buton onClick={handleAudio} className="customAudioPlayerButton">
            {!muted ? (
              <svg
                xmlns="http://www.w3.org/2000/svg"
                width="30"
                height="30"
                fill="currentColor"
                className="bi bi-volume-down"
                viewBox="0 0 16 16"
              >
                <path d="M9 4a.5.5 0 0 0-.812-.39L5.825 5.5H3.5A.5.5 0 0 0 3 6v4a.5.5 0 0 0 .5.5h2.325l2.363 1.89A.5.5 0 0 0 9 12V4zM6.312 6.39 8 5.04v5.92L6.312 9.61A.5.5 0 0 0 6 9.5H4v-3h2a.5.5 0 0 0 .312-.11zM12.025 8a4.486 4.486 0 0 1-1.318 3.182L10 10.475A3.489 3.489 0 0 0 11.025 8 3.49 3.49 0 0 0 10 5.525l.707-.707A4.486 4.486 0 0 1 12.025 8z" />
              </svg>
            ) : (
              <svg
                xmlns="http://www.w3.org/2000/svg"
                width="30"
                height="30"
                fill="currentColor"
                className="bi bi-volume-mute"
                viewBox="0 0 16 16"
              >
                <path d="M6.717 3.55A.5.5 0 0 1 7 4v8a.5.5 0 0 1-.812.39L3.825 10.5H1.5A.5.5 0 0 1 1 10V6a.5.5 0 0 1 .5-.5h2.325l2.363-1.89a.5.5 0 0 1 .529-.06zM6 5.04 4.312 6.39A.5.5 0 0 1 4 6.5H2v3h2a.5.5 0 0 1 .312.11L6 10.96V5.04zm7.854.606a.5.5 0 0 1 0 .708L12.207 8l1.647 1.646a.5.5 0 0 1-.708.708L11.5 8.707l-1.646 1.647a.5.5 0 0 1-.708-.708L10.793 8 9.146 6.354a.5.5 0 1 1 .708-.708L11.5 7.293l1.646-1.647a.5.5 0 0 1 .708 0z" />
              </svg>
            )}
          </buton>
</code>```

Body:
I am i working on Reactjs/nextjs and right no in my page there is video with audio "start/pause button",Component is working fine if i am coming first time in site/page, but whenever i click on another menu/page and then come back to "home page" then its not working, Where i am wrong ?
Here is my code in index.js file

export default function Home() {
const screenWidth = useWindowSize();
  const scrollHeight = useScrollHeight();

  const CustomAudioPlayer = dynamic(
    () => import("../components/CustomAudioPlayer"),
    { ssr: false }
  );
}

And here is my code inside "components/index.js"

function handleAudio() {
    if (ref.current.paused) {
        setMuted(false);
        ref.current.play();
    } else {
        setMuted(true);
        ref.current.pause();
    }
}

<buton onClick={handleAudio} className="customAudioPlayerButton">
            {!muted ? (
              <svg
                xmlns="http://www.w3.org/2000/svg"
                width="30"
                height="30"
                fill="currentColor"
                className="bi bi-volume-down"
                viewBox="0 0 16 16"
              >
                <path d="M9 4a.5.5 0 0 0-.812-.39L5.825 5.5H3.5A.5.5 0 0 0 3 6v4a.5.5 0 0 0 .5.5h2.325l2.363 1.89A.5.5 0 0 0 9 12V4zM6.312 6.39 8 5.04v5.92L6.312 9.61A.5.5 0 0 0 6 9.5H4v-3h2a.5.5 0 0 0 .312-.11zM12.025 8a4.486 4.486 0 0 1-1.318 3.182L10 10.475A3.489 3.489 0 0 0 11.025 8 3.49 3.49 0 0 0 10 5.525l.707-.707A4.486 4.486 0 0 1 12.025 8z" />
              </svg>
            ) : (
              <svg
                xmlns="http://www.w3.org/2000/svg"
                width="30"
                height="30"
                fill="currentColor"
                className="bi bi-volume-mute"
                viewBox="0 0 16 16"
              >
                <path d="M6.717 3.55A.5.5 0 0 1 7 4v8a.5.5 0 0 1-.812.39L3.825 10.5H1.5A.5.5 0 0 1 1 10V6a.5.5 0 0 1 .5-.5h2.325l2.363-1.89a.5.5 0 0 1 .529-.06zM6 5.04 4.312 6.39A.5.5 0 0 1 4 6.5H2v3h2a.5.5 0 0 1 .312.11L6 10.96V5.04zm7.854.606a.5.5 0 0 1 0 .708L12.207 8l1.647 1.646a.5.5 0 0 1-.708.708L11.5 8.707l-1.646 1.647a.5.5 0 0 1-.708-.708L10.793 8 9.146 6.354a.5.5 0 1 1 .708-.708L11.5 7.293l1.646-1.647a.5.5 0 0 1 .708 0z" />
              </svg>
            )}
          </buton>


问:
Duplicate entries in migrations table 'typeorm'
Our backend uses Nestjs and typeorm ,We have some migrations setup, the migrations are run every-time we push changes to production and i can see lot of duplicate entries with same  in the "migrations" table.,some of them take some time which causes some downtime  in production,is this an expected behaviour or only the pending migrations which are not present in the migrations table only should be executed.

the config variable migrationsRun is set to true :

```<code>logging: ['error'],
type: 'postgres',
migrationsRun: true, ssl: false,
synchronize: ['development']. includes (parsedEnv?.ENV),
url: parsedEnv?.DATABASE_URL,
subscribers: [ConnectionsSubscriber),
</code>```

Body:
Our backend uses Nestjs and typeorm ,We have some migrations setup, the migrations are run every-time we push changes to production and i can see lot of duplicate entries with same  in the "migrations" table.,some of them take some time which causes some downtime  in production,is this an expected behaviour or only the pending migrations which are not present in the migrations table only should be executed.

the config variable migrationsRun is set to true :

logging: ['error'],
type: 'postgres',
migrationsRun: true, ssl: false,
synchronize: ['development']. includes (parsedEnv?.ENV),
url: parsedEnv?.DATABASE_URL,
subscribers: [ConnectionsSubscriber),


问:
horizontal scroll for table not working in react js
Thanks for the help in advance. I am developing the HTML of a website using react. In it, I used a simple table. I need to implement an x scroll for the table on mobile devices. But the scroll is not working.What I have tried

```<code><div className="cart-body">
      <table className="cart-table w-100">
        <thead>
          <tr>
            <th colSpan={2}>Item</th>
            <th className="price">Price</th>
            <th className="qty">Qty</th>
            <th className="subTotal">Subtotal</th>
          </tr>
        </thead>
        <tbody>
          <tr className="cart-item-info">
            <td>
              <a
                href="#!"
                title="French Pastel Herringbone Tweed"
                className="product-item-photo d-block"
              >
                <img src="/images/img_5562.png" alt="proimage-1" />
              </a>
            </td>
            <td>
              <a href="#!" className="item__name">
                French Pastel Herringbone Tweed
              </a>
            </td>
            <td>
              <span className="price">$27.00</span>
            </td>
            <td>
              <div className="qty">
                <input type="text" defaultValue="3" />
              </div>
            </td>
            <td>
              <span className="subtotal">$81.00</span>
            </td>
          </tr>
        </tbody>
        <tfoot>
          <tr>
            <td className="p-0">
              <div className="tblIcons">
                <a href="#!">
                  <FontAwesomeIcon icon={faPenToSquare} />
                </a>
                <a href="#!">
                  <FontAwesomeIcon icon={faTrash} />
                </a>
              </div>
            </td>
          </tr>
          <tr>
            <td colSpan={5}>
              <div className="Subtotal">
                Subtotal: <span>$81.00</span>
              </div>
            </td>
          </tr>
        </tfoot>
      </table>
    </div>
</code>```

CSS

```<code>.cart-body {
        overflow-x: auto;
        width: 600px;
}
</code>```

Can anyone help me to sort out the issue.Screenshot of the issue

Body:
Thanks for the help in advance. I am developing the HTML of a website using react. In it, I used a simple table. I need to implement an x scroll for the table on mobile devices. But the scroll is not working.What I have tried

            Item
            Price
            Qty
            Subtotal

                French Pastel Herringbone Tweed

              $27.00

                <input type="text" defaultValue="3" />

              $81.00

                  <FontAwesomeIcon icon={faPenToSquare} />

                  <FontAwesomeIcon icon={faTrash} />

                Subtotal: $81.00

CSS

.cart-body {
        overflow-x: auto;
        width: 600px;
}

Can anyone help me to sort out the issue.Screenshot of the issue


问:
TypeError when modifying tf.keras.Optimizer parameter
I have been trying to implement a (heavily-inspired) Gradient-Accumulation wrapper for my Adam optimizer, as shown below:

```<code>class AccumOptimizer(tf.keras.optimizers.Optimizer):

    def __init__(self, optimizer, steps_per_update=1, **kwargs):

        super(AccumOptimizer, self).__init__(name="AccumOptimizer", **kwargs)
        self.optimizer = optimizer
        self.steps_per_update = steps_per_update
        self.iterations = tf.Variable(0, dtype='int64', name='iterations')
        self.cond = tf.equal(self.iterations % self.steps_per_update, 0)
        self.lr = self.optimizer.learning_rate
        self.optimizer.learning_rate = tf.cond(self.cond,
                                               lambda: self.optimizer.learning_rate,
                                               lambda: tf.constant(0, tf.float32))
        ...
</code>```

But seem to butt into the following TypeError when I try to train:

```<code>TypeError: __array__() takes 1 positional argument but 2 were given
</code>```

which points to the part where self.optimizer.learning_rate is updated based on self.cond, although I'm sure that tf.condshould return a single value if the true/false function returns a singleton list.

I'm using Tensorflow 1.15.x (and constrained to this version, sadly).

Any ideas how this could be circumvented?

Body:
I have been trying to implement a (heavily-inspired) Gradient-Accumulation wrapper for my Adam optimizer, as shown below:

class AccumOptimizer(tf.keras.optimizers.Optimizer):

    def __init__(self, optimizer, steps_per_update=1, **kwargs):

        super(AccumOptimizer, self).__init__(name="AccumOptimizer", **kwargs)
        self.optimizer = optimizer
        self.steps_per_update = steps_per_update
        self.iterations = tf.Variable(0, dtype='int64', name='iterations')
        self.cond = tf.equal(self.iterations % self.steps_per_update, 0)
        self.lr = self.optimizer.learning_rate
        self.optimizer.learning_rate = tf.cond(self.cond,
                                               lambda: self.optimizer.learning_rate,
                                               lambda: tf.constant(0, tf.float32))
        ...

But seem to butt into the following TypeError when I try to train:

TypeError: __array__() takes 1 positional argument but 2 were given

which points to the part where self.optimizer.learning_rate is updated based on self.cond, although I'm sure that tf.condshould return a single value if the true/false function returns a singleton list.

I'm using Tensorflow 1.15.x (and constrained to this version, sadly).

Any ideas how this could be circumvented?


问:
Google API for Email, Contacts, Drive etc
I want to write some application and to allow my customers to get they Google Contacts, they Gmail emails etc.
I understand that I need to login to https://console.developers.google.com
and to enable API's, to get credentials etc. but does that need to do each customer who want to use my application?
I mean, it looks complicated for me as developer and I can not imagine that each customer need to do the same and to send me they client_id and secret?</p>