问:
Laravel websocket on subdomain. WebSocket is closed before the connection is established
I am trying to setup laravel websocket on aws hosting (ubuntu based) with SSL

When I go to page laravel-websockets and press connect it waits few seconds and then show me warning in console: WebSocket connection to 'wss://socket.mydomain.com:6001/app/workspace?protocol=7&client=js&version=4.3.1&flash=false' failed: WebSocket is closed before the connection is established.

It works fine on my localhost without HTTPS, but when I try setup it on my server it doesn't work.

My .env file

```<code>BROADCAST_DRIVER=pusher
PUSHER_APP_ID=workspace
PUSHER_APP_KEY=workspace
PUSHER_APP_SECRET=workspace
PUSHER_APP_CLUSTER=mt1
LARAVEL_WEBSOCKETS_HOST=socket.mydomain.com
LARAVEL_WEBSOCKETS_PORT=6001 // here I tried 433 and 6001
LARAVEL_WEBSOCKETS_HTTPS=1
LARAVEL_WEBSOCKETS_ENABLE_STATISTICS=false
LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT=/etc/letsencrypt/live/socket.mydomain.com/fullchain.pem
LARAVEL_WEBSOCKETS_SSL_LOCAL_PK=/etc/letsencrypt/live/socket.mydomain.com/privkey.pem
</code>```

config/websockets.php

```<code>'dashboard' => [
        'host' => env('LARAVEL_WEBSOCKETS_HOST'),
        'port' => env('LARAVEL_WEBSOCKETS_PORT', 6001)
    ],
    'apps' => [
        [
            'host' => env('LARAVEL_WEBSOCKETS_HOST'),
            'port' => env('LARAVEL_WEBSOCKETS_PORT'),
            'id' => env('PUSHER_APP_ID'),
            'name' => env('APP_NAME'),
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'path' => env('PUSHER_APP_PATH'),
            'capacity' => null,
            'enable_client_messages' => false,
            'enable_statistics' => env('LARAVEL_WEBSOCKETS_ENABLE_STATISTICS', true),
            'encrypted' => true
        ],
    ],
     'ssl' => [
        'local_cert' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT', null),
        'local_pk' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_PK', null),
        'passphrase' => env('LARAVEL_WEBSOCKETS_SSL_PASSPHRASE', null),
        'verify_peer' => false,
        'verify_peer_name' => false
    ],
</code>```

config/broadcasting.php

```<code>'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'cluster' => env('PUSHER_APP_CLUSTER'),
                'host' => env('LARAVEL_WEBSOCKETS_HOST'),
                'port' => env('LARAVEL_WEBSOCKETS_PORT'),
                'useTLS' => true,
        'encrypted' => true,
                'scheme' => 'https', // env('LARAVEL_WEBSOCKETS_HTTPS') ? 'https' : 'http',
                'curl_options' => [
                    CURLOPT_SSL_VERIFYHOST => 0,
                    CURLOPT_SSL_VERIFYPEER => 0
                ]
            ],
        ],
</code>```

and my nginx configuration for subdomain

```<code>server {
  server_name socket.mydomain.com;

  location / {
    proxy_pass             http://127.0.0.1:6001;
    #proxy_pass https://dev-api.alsoworkspace.com;
    proxy_read_timeout     60;
    proxy_connect_timeout  60;
    proxy_redirect         off;

    # Allow the use of websockets
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
  }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/socket.mydomain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/socket.mydomain.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
    if ($host = socket.mydomain.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

  listen 80;

  server_name socket.mydomain.com;
    return 404; # managed by Certbot
}
</code>```

Supervisor config:

```<code>[program:websockets]
command=/usr/bin/php /var/www/backend/artisan websockets:serve
numprocs=1
autostart=true
autorestart=true
user=ubuntu
redirect_stderr=true
</code>```

Can anyone help please? I spent whole day and didn't find why it doesn't work

Body:
I am trying to setup laravel websocket on aws hosting (ubuntu based) with SSL

When I go to page laravel-websockets and press connect it waits few seconds and then show me warning in console: WebSocket connection to 'wss://socket.mydomain.com:6001/app/workspace?protocol=7&client=js&version=4.3.1&flash=false' failed: WebSocket is closed before the connection is established.

It works fine on my localhost without HTTPS, but when I try setup it on my server it doesn't work.

My .env file

BROADCAST_DRIVER=pusher
PUSHER_APP_ID=workspace
PUSHER_APP_KEY=workspace
PUSHER_APP_SECRET=workspace
PUSHER_APP_CLUSTER=mt1
LARAVEL_WEBSOCKETS_HOST=socket.mydomain.com
LARAVEL_WEBSOCKETS_PORT=6001 // here I tried 433 and 6001
LARAVEL_WEBSOCKETS_HTTPS=1
LARAVEL_WEBSOCKETS_ENABLE_STATISTICS=false
LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT=/etc/letsencrypt/live/socket.mydomain.com/fullchain.pem
LARAVEL_WEBSOCKETS_SSL_LOCAL_PK=/etc/letsencrypt/live/socket.mydomain.com/privkey.pem

config/websockets.php

'dashboard' => [
        'host' => env('LARAVEL_WEBSOCKETS_HOST'),
        'port' => env('LARAVEL_WEBSOCKETS_PORT', 6001)
    ],
    'apps' => [
        [
            'host' => env('LARAVEL_WEBSOCKETS_HOST'),
            'port' => env('LARAVEL_WEBSOCKETS_PORT'),
            'id' => env('PUSHER_APP_ID'),
            'name' => env('APP_NAME'),
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'path' => env('PUSHER_APP_PATH'),
            'capacity' => null,
            'enable_client_messages' => false,
            'enable_statistics' => env('LARAVEL_WEBSOCKETS_ENABLE_STATISTICS', true),
            'encrypted' => true
        ],
    ],
     'ssl' => [
        'local_cert' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT', null),
        'local_pk' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_PK', null),
        'passphrase' => env('LARAVEL_WEBSOCKETS_SSL_PASSPHRASE', null),
        'verify_peer' => false,
        'verify_peer_name' => false
    ],

config/broadcasting.php

'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'cluster' => env('PUSHER_APP_CLUSTER'),
                'host' => env('LARAVEL_WEBSOCKETS_HOST'),
                'port' => env('LARAVEL_WEBSOCKETS_PORT'),
                'useTLS' => true,
        'encrypted' => true,
                'scheme' => 'https', // env('LARAVEL_WEBSOCKETS_HTTPS') ? 'https' : 'http',
                'curl_options' => [
                    CURLOPT_SSL_VERIFYHOST => 0,
                    CURLOPT_SSL_VERIFYPEER => 0
                ]
            ],
        ],

and my nginx configuration for subdomain

server {
  server_name socket.mydomain.com;

  location / {
    proxy_pass             http://127.0.0.1:6001;
    #proxy_pass https://dev-api.alsoworkspace.com;
    proxy_read_timeout     60;
    proxy_connect_timeout  60;
    proxy_redirect         off;

    # Allow the use of websockets
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
  }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/socket.mydomain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/socket.mydomain.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
    if ($host = socket.mydomain.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

  listen 80;

  server_name socket.mydomain.com;
    return 404; # managed by Certbot
}

Supervisor config:

[program:websockets]
command=/usr/bin/php /var/www/backend/artisan websockets:serve
numprocs=1
autostart=true
autorestart=true
user=ubuntu
redirect_stderr=true

Can anyone help please? I spent whole day and didn't find why it doesn't work


来源: stackexchange

问:
Uncaught Error: Returned error: sender account not recognized
I am trying to run a test against my initializer. My test is below. But i get the above error message.
I am synced with ganache (ports,network etc) and have my accounts set up in ganache.

My command is "npx truffle test --network development".

Why am i getting this error message?

```<code>
const { expect } = require('chai');
const { accounts, web3 } = require ('@openzeppelin/test-environment');

const ComNFT = artifacts.require('ComNFT');

describe('ComNFT', () => {
  let comNFT;

  beforeEach(async (done) => {
    comNFT = await ComNFT.new({ from: accounts[0] });
    done();
  });

  it('should be correctly initialized', async () => {
    const owner = await comNFT.owner();
    expect(owner).to.equal(accounts[0]);
    const name = await comNFT.name();
    expect(name).to.equal('ComNFT');
    const symbol = await comNFT.symbol();
    expect(symbol).to.equal('CMT');
  });
});
</code>```

I have tried to run it with just "truffle test" but getting the same error

ContentLicense: CC BY-SA 4.0

Body:
I am trying to run a test against my initializer. My test is below. But i get the above error message.
I am synced with ganache (ports,network etc) and have my accounts set up in ganache.

My command is "npx truffle test --network development".

Why am i getting this error message?

const { expect } = require('chai');
const { accounts, web3 } = require ('@openzeppelin/test-environment');

const ComNFT = artifacts.require('ComNFT');

describe('ComNFT', () => {
  let comNFT;

  beforeEach(async (done) => {
    comNFT = await ComNFT.new({ from: accounts[0] });
    done();
  });

  it('should be correctly initialized', async () => {
    const owner = await comNFT.owner();
    expect(owner).to.equal(accounts[0]);
    const name = await comNFT.name();
    expect(name).to.equal('ComNFT');
    const symbol = await comNFT.symbol();
    expect(symbol).to.equal('CMT');
  });
});

I have tried to run it with just "truffle test" but getting the same error


问:
python scipy - problem with cmake and ninja
I tried to install scipy but it says I have to install ninja first and when I try to install ninja it says to install cmake but this doen't solve the problem

Hey everyone, I'm tryin to install scipy on a surface pro X (arm64 based processor). When i try to install scipy, it says that I need to install ninja for building ninja wheels

```<code>C:\Users\nikwh>pip install scipy
Collecting scipy
  Using cached scipy-1.9.3.tar.gz (42.1 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install backend dependencies did not run successfully.
  │ exit code: 1
  ╰─> [34 lines of output]
      Collecting ninja>=1.8.2
        Using cached ninja-1.11.1.tar.gz (27 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Building wheels for collected packages: ninja
        Building wheel for ninja (pyproject.toml): started
        Building wheel for ninja (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error

        Building wheel for ninja (pyproject.toml) did not run successfully.
        exit code: 1

        [11 lines of output]
        Traceback (most recent call last):
          File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-hzxk1h47\overlay\Lib\site-packages\skbuild\setuptools_wrap.py", line 612, in setup
            cmkr = cmaker.CMaker(cmake_executable)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-hzxk1h47\overlay\Lib\site-packages\skbuild\cmaker.py", line 149, in __init__
            self.cmake_version = get_cmake_version(self.cmake_executable)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-hzxk1h47\overlay\Lib\site-packages\skbuild\cmaker.py", line 104, in get_cmake_version
            raise SKBuildError(

        Problem with the CMake installation, aborting build. CMake executable is cmake
        [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for ninja
      Failed to build ninja
      ERROR: Could not build wheels for ninja, which is required to install pyproject.toml-based projects
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install backend dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
</code>```

When I try to install ninja, it tells me that I have a problem with my cmake installation

```<code>C:\Users\nikwh>pip install ninja
Collecting ninja
  Using cached ninja-1.11.1.tar.gz (27 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: ninja
  Building wheel for ninja (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for ninja (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      Traceback (most recent call last):
        File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-vexb5afg\overlay\Lib\site-packages\skbuild\setuptools_wrap.py", line 612, in setup
          cmkr = cmaker.CMaker(cmake_executable)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-vexb5afg\overlay\Lib\site-packages\skbuild\cmaker.py", line 149, in __init__
          self.cmake_version = get_cmake_version(self.cmake_executable)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-vexb5afg\overlay\Lib\site-packages\skbuild\cmaker.py", line 104, in get_cmake_version
          raise SKBuildError(

      Problem with the CMake installation, aborting build. CMake executable is cmake
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for ninja
Failed to build ninja
ERROR: Could not build wheels for ninja, which is required to install pyproject.toml-based projects

</code>```

I already tried to install it via "pip install cmake" and already downloaded the cmake version from the web for arm64 architecture

when I try to install cmake, I run into the same error as before

```<code>
`
    C:\Users\nikwh>pip install cmake
    Collecting cmake
    Using cached cmake-3.25.0.tar.gz (33 kB)
    Installing build dependencies ... done
    Getting requirements to build wheel ... done
    Preparing metadata (pyproject.toml) ... done
    Building wheels for collected packages: cmake
  Building wheel for cmake (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for cmake (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [34 lines of output]
      Traceback (most recent call last):
        File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-qk01yen3\overlay\Lib\site-packages\skbuild\setuptools_wrap.py", line 612, in setup
          cmkr = cmaker.CMaker(cmake_executable)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-qk01yen3\overlay\Lib\site-packages\skbuild\cmaker.py", line 149, in __init__
          self.cmake_version = get_cmake_version(self.cmake_executable)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-qk01yen3\overlay\Lib\site-  p`your text`ackages\skbuild\cmaker.py", line 104, in get_cmake_version
          raise SKBuildError(

          =============================DEBUG ASSISTANCE=============================
          If you are seeing a compilation error please try the following steps to
          successfully install cmake:
          1) Upgrade to the latest pip and try again. This will fix errors for most
             users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
          2) If on Linux, with glibc < 2.12, you can set PIP_ONLY_BINARY=cmake in
             order to retrieve the last manylinux1 compatible wheel.
          3) If on Linux, with glibc < 2.12, you can cap "cmake<3.23" in your
             requirements in order to retrieve the last manylinux1 compatible wheel.
          4) Open an issue with the debug information that follows at
             https://github.com/scikit-build/cmake-python-distributions/issues

          Python: 3.11.1
          platform: Windows-10-10.0.22621-SP0
          machine: ARM64
          bits: 64
          pip: n/a
          setuptools: 65.6.3
          scikit-build: 0.16.4
          PEP517_BUILD_BACKEND=setuptools.build_meta
          =============================DEBUG ASSISTANCE=============================

      Problem with the CMake installation, aborting build. CMake executable is cmake
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cmake
Failed to build cmake
ERROR: Could not build wheels for cmake, which is required to install pyproject.toml-based projects
</code>```

I already have tried to upgrade pip but it's the last version

Would be nice if someone could help me out :)

```<code></code>```

Body:
I tried to install scipy but it says I have to install ninja first and when I try to install ninja it says to install cmake but this doen't solve the problem

Hey everyone, I'm tryin to install scipy on a surface pro X (arm64 based processor). When i try to install scipy, it says that I need to install ninja for building ninja wheels

C:\Users\nikwh>pip install scipy
Collecting scipy
  Using cached scipy-1.9.3.tar.gz (42.1 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install backend dependencies did not run successfully.
  │ exit code: 1
  ╰─> [34 lines of output]
      Collecting ninja>=1.8.2
        Using cached ninja-1.11.1.tar.gz (27 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Building wheels for collected packages: ninja
        Building wheel for ninja (pyproject.toml): started
        Building wheel for ninja (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error

        Building wheel for ninja (pyproject.toml) did not run successfully.
        exit code: 1

        [11 lines of output]
        Traceback (most recent call last):
          File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-hzxk1h47\overlay\Lib\site-packages\skbuild\setuptools_wrap.py", line 612, in setup
            cmkr = cmaker.CMaker(cmake_executable)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-hzxk1h47\overlay\Lib\site-packages\skbuild\cmaker.py", line 149, in __init__
            self.cmake_version = get_cmake_version(self.cmake_executable)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-hzxk1h47\overlay\Lib\site-packages\skbuild\cmaker.py", line 104, in get_cmake_version
            raise SKBuildError(

        Problem with the CMake installation, aborting build. CMake executable is cmake
        [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for ninja
      Failed to build ninja
      ERROR: Could not build wheels for ninja, which is required to install pyproject.toml-based projects
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install backend dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

When I try to install ninja, it tells me that I have a problem with my cmake installation

C:\Users\nikwh>pip install ninja
Collecting ninja
  Using cached ninja-1.11.1.tar.gz (27 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: ninja
  Building wheel for ninja (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for ninja (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      Traceback (most recent call last):
        File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-vexb5afg\overlay\Lib\site-packages\skbuild\setuptools_wrap.py", line 612, in setup
          cmkr = cmaker.CMaker(cmake_executable)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-vexb5afg\overlay\Lib\site-packages\skbuild\cmaker.py", line 149, in __init__
          self.cmake_version = get_cmake_version(self.cmake_executable)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-vexb5afg\overlay\Lib\site-packages\skbuild\cmaker.py", line 104, in get_cmake_version
          raise SKBuildError(

      Problem with the CMake installation, aborting build. CMake executable is cmake
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for ninja
Failed to build ninja
ERROR: Could not build wheels for ninja, which is required to install pyproject.toml-based projects

I already tried to install it via "pip install cmake" and already downloaded the cmake version from the web for arm64 architecture

when I try to install cmake, I run into the same error as before

`
    C:\Users\nikwh>pip install cmake
    Collecting cmake
    Using cached cmake-3.25.0.tar.gz (33 kB)
    Installing build dependencies ... done
    Getting requirements to build wheel ... done
    Preparing metadata (pyproject.toml) ... done
    Building wheels for collected packages: cmake
  Building wheel for cmake (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for cmake (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [34 lines of output]
      Traceback (most recent call last):
        File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-qk01yen3\overlay\Lib\site-packages\skbuild\setuptools_wrap.py", line 612, in setup
          cmkr = cmaker.CMaker(cmake_executable)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-qk01yen3\overlay\Lib\site-packages\skbuild\cmaker.py", line 149, in __init__
          self.cmake_version = get_cmake_version(self.cmake_executable)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         File "C:\Users\nikwh\AppData\Local\Temp\pip-build-env-qk01yen3\overlay\Lib\site-  p`your text`ackages\skbuild\cmaker.py", line 104, in get_cmake_version
          raise SKBuildError(

          =============================DEBUG ASSISTANCE=============================
          If you are seeing a compilation error please try the following steps to
          successfully install cmake:
          1) Upgrade to the latest pip and try again. This will fix errors for most
             users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
          2) If on Linux, with glibc < 2.12, you can set PIP_ONLY_BINARY=cmake in
             order to retrieve the last manylinux1 compatible wheel.
          3) If on Linux, with glibc < 2.12, you can cap "cmake<3.23" in your
             requirements in order to retrieve the last manylinux1 compatible wheel.
          4) Open an issue with the debug information that follows at
             https://github.com/scikit-build/cmake-python-distributions/issues

          Python: 3.11.1
          platform: Windows-10-10.0.22621-SP0
          machine: ARM64
          bits: 64
          pip: n/a
          setuptools: 65.6.3
          scikit-build: 0.16.4
          PEP517_BUILD_BACKEND=setuptools.build_meta
          =============================DEBUG ASSISTANCE=============================

      Problem with the CMake installation, aborting build. CMake executable is cmake
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cmake
Failed to build cmake
ERROR: Could not build wheels for cmake, which is required to install pyproject.toml-based projects

I already have tried to upgrade pip but it's the last version

Would be nice if someone could help me out :)


问:
I have an issue with circle/ci and aws cloudformation , cleanup job in circle/ci doesn't remove the old stacks in aws
The cleanup job below , I was trying cleanup old cloudformation stacks but it gives me nothing to do and doesn't remove any old stacks</p>
```<code>cleanup :
    docker:
      - image: amazon/aws-cli
    steps:
      - checkout
      - run:
          name: Get old stack workflow id
          command: |
            export OldWorkflowID=$(aws cloudformation \
                    list-exports --query "Exports[?Name==\`WorkflowID\`].Value" \
                    --no-paginate --output text)
            echo OldWorkflowID: "${OldWorkflowID}"
            echo CIRCLE_WORKFLOW_ID "${CIRCLE_WORKFLOW_ID:0:7}"
            export STACKS=($(aws cloudformation list-stacks --query "StackSummaries[*].StackName" \
                    --stack-status-filter CREATE_COMPLETE --no-paginate --output text))
            echo Stack names: "${STACKS[@]}"
      - run:
          name: Remove old stacks and files
          command: |
               if [[ "${STACKS[@]}" =~ "${OldWorkflowID}" ]]
               then
                  echo "$OldWorkflowID!=$CurrentWorkflowID => will delete old version"
                  aws s3 rm "s3://${OldWorkflowID}" --recursive
                  aws cloudformation delete-stack --stack-name "udapeople-${OldWorkflowID}-fe"
                  aws cloudformation delete-stack --stack-name "udapeople-${OldWorkflowID}-be"

               fi
</code>```

Body:
The cleanup job below , I was trying cleanup old cloudformation stacks but it gives me nothing to do and doesn't remove any old stacks

cleanup :
    docker:
      - image: amazon/aws-cli
    steps:
      - checkout
      - run:
          name: Get old stack workflow id
          command: |
            export OldWorkflowID=$(aws cloudformation \
                    list-exports --query "Exports[?Name==\`WorkflowID\`].Value" \
                    --no-paginate --output text)
            echo OldWorkflowID: "${OldWorkflowID}"
            echo CIRCLE_WORKFLOW_ID "${CIRCLE_WORKFLOW_ID:0:7}"
            export STACKS=($(aws cloudformation list-stacks --query "StackSummaries[*].StackName" \
                    --stack-status-filter CREATE_COMPLETE --no-paginate --output text))
            echo Stack names: "${STACKS[@]}"
      - run:
          name: Remove old stacks and files
          command: |
               if [[ "${STACKS[@]}" =~ "${OldWorkflowID}" ]]
               then
                  echo "$OldWorkflowID!=$CurrentWorkflowID => will delete old version"
                  aws s3 rm "s3://${OldWorkflowID}" --recursive
                  aws cloudformation delete-stack --stack-name "udapeople-${OldWorkflowID}-fe"
                  aws cloudformation delete-stack --stack-name "udapeople-${OldWorkflowID}-be"

               fi


问:
Motion Detection on my Monitor with MouseClick on it
hi StackOverFlow Community,

i am try to code a Fast Motion Recognition of my Screen/Monitor.

Lets say: every hour(not specified time) a thing appears on my Screen for just One Second!, Python should recognize where it happens and make a MouseClick on it ... the region to Observer for Motion is "only" 1050 x 750 pixel ( screen area)

I have Coded a pyautogui PixelCheck programm , but its too slow for realtime and it detects only "large" Movements, but this is defently a bad idea/Code ( Code Below)

I found a lot about motion detection of Webcams and Videos , i need the same thing for a part of the Screen/Monitor and the detection should not take much time and if motion detection is it should Click on it
(next Code is for a WebCam). Could I use Screenshot( capture screenshot) - Frames for motion detection instead of Video file or Stream file

Please guys let me to figure this out

Code

from pyautogui import *               # MY PIXELCHECK TRYING :(
import pyautogui
import time
pyautogui.PAUSE = 0
def Search1():
        for x0 in range(550, 1600, 50):
         for y0 in range(300, 1050, 50):
            Opix = pyautogui.pixel(x0, y0)
            if pyautogui.pixelMatchesColor(x0, y0, Opix) :
                 pass
            else :
                pyautogui.click(x0, y0)
                print(f"Wrong and Clicked in x{x0} y={y0}")
# Main Programm  (not looped)
Search1()
```
<p>Code</p>
<pre class="lang-py prettyprint-override"><code>import cv2, time          # CODE EXAMPLE FROM SOMEONE OF THIS FORUM !

first_frame = None

video = cv2.VideoCapture(0)
# the camera has some lag time hence the starting of video.read outside loop and sleep
video.read()
time.sleep(2)

while True:
    check, frame = video.read()

    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    gray = cv2.GaussianBlur(gray, (21,21),0)

    if first_frame is None:
        first_frame=gray
        continue

    delta_frame = cv2.absdiff(first_frame,gray)
    thresh_frame = cv2.threshold(delta_frame, 30, 255, cv2.THRESH_BINARY)[1]
    thresh_frame = cv2.dilate(thresh_frame,None, iterations=2)

    (cnts,_) = cv2.findContours(thresh_frame.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

    for contour in cnts:
        if cv2.contourArea(contour) < 4000:
            continue

        (x,y, w, h)= cv2.boundingRect(contour)
        cv2.rectangle(frame, (x, y), (x + w, y + h),(0,225,0),3)

    cv2.imshow("Delta Frame",delta_frame)
    cv2.imshow("Capturing",gray)
    cv2.imshow("Threshold Frame",thresh_frame)
    cv2.imshow("Color Frame",frame)

    key = cv2.waitKey(5)

    if key==ord('q'):
        break

video.release()
cv2.destroyAllWindows()

</code>```

Please Help

Body:
hi StackOverFlow Community,

i am try to code a Fast Motion Recognition of my Screen/Monitor.

Lets say: every hour(not specified time) a thing appears on my Screen for just One Second!, Python should recognize where it happens and make a MouseClick on it ... the region to Observer for Motion is "only" 1050 x 750 pixel ( screen area)

I have Coded a pyautogui PixelCheck programm , but its too slow for realtime and it detects only "large" Movements, but this is defently a bad idea/Code ( Code Below)

I found a lot about motion detection of Webcams and Videos , i need the same thing for a part of the Screen/Monitor and the detection should not take much time and if motion detection is it should Click on it
(next Code is for a WebCam). Could I use Screenshot( capture screenshot) - Frames for motion detection instead of Video file or Stream file

Please guys let me to figure this out

Code

from pyautogui import *               # MY PIXELCHECK TRYING :(
import pyautogui
import time
pyautogui.PAUSE = 0
def Search1():
        for x0 in range(550, 1600, 50):
         for y0 in range(300, 1050, 50):
            Opix = pyautogui.pixel(x0, y0)
            if pyautogui.pixelMatchesColor(x0, y0, Opix) :
                 pass
            else :
                pyautogui.click(x0, y0)
                print(f"Wrong and Clicked in x{x0} y={y0}")
# Main Programm  (not looped)
Search1()

Code

import cv2, time          # CODE EXAMPLE FROM SOMEONE OF THIS FORUM !

first_frame = None

video = cv2.VideoCapture(0)
# the camera has some lag time hence the starting of video.read outside loop and sleep
video.read()
time.sleep(2)

while True:
    check, frame = video.read()

    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    gray = cv2.GaussianBlur(gray, (21,21),0)

    if first_frame is None:
        first_frame=gray
        continue

    delta_frame = cv2.absdiff(first_frame,gray)
    thresh_frame = cv2.threshold(delta_frame, 30, 255, cv2.THRESH_BINARY)[1]
    thresh_frame = cv2.dilate(thresh_frame,None, iterations=2)

    (cnts,_) = cv2.findContours(thresh_frame.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

    for contour in cnts:
        if cv2.contourArea(contour) < 4000:
            continue

        (x,y, w, h)= cv2.boundingRect(contour)
        cv2.rectangle(frame, (x, y), (x + w, y + h),(0,225,0),3)

    cv2.imshow("Delta Frame",delta_frame)
    cv2.imshow("Capturing",gray)
    cv2.imshow("Threshold Frame",thresh_frame)
    cv2.imshow("Color Frame",frame)

    key = cv2.waitKey(5)

    if key==ord('q'):
        break

video.release()
cv2.destroyAllWindows()

Please Help


问:
I cannot connect to websocket with esp32 and node server
I got a nodejs api that create an express app then create a websocket server just like that :

const app = express();
const server = http.createServer(app);
const wss = new WebSocket.Server({ server: server });
```
<p>I first deploy it on heroku and it work fine but the free dynos on heroku stoped so I change to Render (https://dashboard.render.com/) but it stoped working with my esp32.
I also got a Flutter app that can connect to the websocket server with no probleme but the esp32 never been able to connect.
I'm using this lib to connect in arduino IDE : https://github.com/gilmaimon/ArduinoWebsockets</p>
<p>I got a void called in my setup to connect to websockets :</p>
```void connectToWebSocket() {
  bool connected = client.connect(websockets_server_host);
  while (!connected) {
    connected = client.connect(websockets_server_host);
    if (connected) {
      Serial.println("Connected!");

    } else {
      Serial.println("Not Connected");
      delay(1000);
    }
  }

  client.onEvent(onEventsCallback);
  client.onMessage(onMessageCallback);
}
```

I hope someone will be able to help me
Thanks anyway if you take time to look for something

Body:
I got a nodejs api that create an express app then create a websocket server just like that :

const app = express();
const server = http.createServer(app);
const wss = new WebSocket.Server({ server: server });

I first deploy it on heroku and it work fine but the free dynos on heroku stoped so I change to Render (https://dashboard.render.com/) but it stoped working with my esp32.
I also got a Flutter app that can connect to the websocket server with no probleme but the esp32 never been able to connect.
I'm using this lib to connect in arduino IDE : https://github.com/gilmaimon/ArduinoWebsockets

I got a void called in my setup to connect to websockets :

void connectToWebSocket() {
  bool connected = client.connect(websockets_server_host);
  while (!connected) {
    connected = client.connect(websockets_server_host);
    if (connected) {
      Serial.println("Connected!");

    } else {
      Serial.println("Not Connected");
      delay(1000);
    }
  }

  client.onEvent(onEventsCallback);
  client.onMessage(onMessageCallback);
}

I hope someone will be able to help me
Thanks anyway if you take time to look for something


问:
Vue.js how to access component state/variables but keep encapsulation/hide from template
Vue automatically exposes all methods to the template (using Options API) and all top-level variables (using Composition API).

If I need to access logic that is only internal to the script, but wants to hide/encapsulate that from the template, how can I achieve that?

In Angular for example, due to the OOP approach, you can just declare a method private, and Angular will not make that available to the HTML file.


问:
Configmap data is blank
I am creating a ConfigMap using this YAML file:

apiVersion: v1
kind: ConfigMap
metadata:
  name: "{{ .Values.configmapName}}-config"
  labels:
    app: "{{ .Values.configmapName}}"
data:
{{ (.Files.Glob "configmap/dev/*").AsConfig | indent 2 }}
```

The ConfigMap gets created but there is no data, the ConfigMap is blank.  I have multiple files under a configmap/dev/ directory located at the root level of my Helm chart.  I'm expecting to see the data from the files which are under this configmap/dev/ directory.

Title: Configmap data is blank

Body:
I am creating a ConfigMap using this YAML file:

apiVersion: v1
kind: ConfigMap
metadata:
  name: "{{ .Values.configmapName}}-config"
  labels:
    app: "{{ .Values.configmapName}}"
data:
{{ (.Files.Glob "configmap/dev/*").AsConfig | indent 2 }}

The ConfigMap gets created but there is no data, the ConfigMap is blank.  I have multiple files under a configmap/dev/ directory located at the root level of my Helm chart.  I'm expecting to see the data from the files which are under this configmap/dev/ directory.


问:
db2 cloud or ODBC connection to R
Here i tried to setup my database service instance in ibm cloud DB2  and Access service credentials.

```<code>library(RODBC)
dsn_driver <- "{IBM DB2 ODBC Driver}"
dsn_database <- "bludb"            # e.g. "bludb"
dsn_hostname <- "b1bc1829-6f45-4cd4-bef4-10cf081900bf.c1ogj3sd0tgtu0lqde00.databases.appdomain.cloud" # e.g "54a2f15b-5c0f-46df-8954-.databases.appdomain.cloud"
dsn_port <- "32304"   # e.g. "32733"
dsn_protocol <- "TCPIP"            # i.e. "TCPIP"
dsn_uid <- "xxxxxxxxx"        # e.g. "zjh17769"
dsn_pwd <- "xxxxxxxxxxxxxxxx"      # e.g. "zcwd4+8gbq9bm5k4"
dsn_security <- "ssl"
</code>```

Then i Create a database connection

Create a connection string and connect:

```<code>conn_path <- paste("DRIVER=",dsn_driver,
                     ";DATABASE=",dsn_database,
                     ";HOSTNAME=",dsn_hostname,
                     ";PORT=",dsn_port,
                     ";PROTOCOL=",dsn_protocol,
                     ";UID=",dsn_uid,
                     ";PWD=",dsn_pwd,
                     ";SECURITY=",dsn_security,
                     sep="")
conn <- odbcDriverConnect(conn_path)
</code>```

but here i got this warning msg that the connection is field:

```<code>Warning messages:
1: In odbcDriverConnect(conn_path) :
  [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
2: In odbcDriverConnect(conn_path) : ODBC connection failed
</code>```

as i took the credentials information from the same cloud server as the below pic:
enter image description here

thank you

Hello i have question , i struggled when i try to connect the database in DB2 cloud to local R server , so i am a beginner and i found the steps for this are very mixed up so i downloaded the data bases to the DB2 cloud then i need to connect these datasets to R to do the sql functions as it requested in my course for IBM,

Title: db2 cloud or ODBC connection to R

Body:
Here i tried to setup my database service instance in ibm cloud DB2  and Access service credentials.

library(RODBC)
dsn_driver <- "{IBM DB2 ODBC Driver}"
dsn_database <- "bludb"            # e.g. "bludb"
dsn_hostname <- "b1bc1829-6f45-4cd4-bef4-10cf081900bf.c1ogj3sd0tgtu0lqde00.databases.appdomain.cloud" # e.g "54a2f15b-5c0f-46df-8954-.databases.appdomain.cloud"
dsn_port <- "32304"   # e.g. "32733"
dsn_protocol <- "TCPIP"            # i.e. "TCPIP"
dsn_uid <- "xxxxxxxxx"        # e.g. "zjh17769"
dsn_pwd <- "xxxxxxxxxxxxxxxx"      # e.g. "zcwd4+8gbq9bm5k4"
dsn_security <- "ssl"

Then i Create a database connection

Create a connection string and connect:

conn_path <- paste("DRIVER=",dsn_driver,
                     ";DATABASE=",dsn_database,
                     ";HOSTNAME=",dsn_hostname,
                     ";PORT=",dsn_port,
                     ";PROTOCOL=",dsn_protocol,
                     ";UID=",dsn_uid,
                     ";PWD=",dsn_pwd,
                     ";SECURITY=",dsn_security,
                     sep="")
conn <- odbcDriverConnect(conn_path)

but here i got this warning msg that the connection is field:

Warning messages:
1: In odbcDriverConnect(conn_path) :
  [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
2: In odbcDriverConnect(conn_path) : ODBC connection failed

as i took the credentials information from the same cloud server as the below pic:
enter image description here

thank you

Hello i have question , i struggled when i try to connect the database in DB2 cloud to local R server , so i am a beginner and i found the steps for this are very mixed up so i downloaded the data bases to the DB2 cloud then i need to connect these datasets to R to do the sql functions as it requested in my course for IBM,


问:
Creating new SQLAlchemy project with possible future migration to Django in mind
I want to create a database with SQLAlchemy ORM. At this moment, no web server is needed, so this solution is ideal. However, it is likely, that in future, we will want to add some web server functionality (using Django).

Are there any recommendations that I should do (when creating SQLAlchemy project) so that the possible migration to Django will be as easy as possible? (for example some naming conventions, using of multi column primary keys, and so on)

I know that we can use Django with existing database, but my question is rather what are the steps I can do at the start of SQLAlchemy project to make the future transition easiest it can be.


问:
getElementById returning as undefined
I can't get my DOM element to connect with my javascript and grab a "test" value.

Client side

```<code><h1 id="redeem" value="test">Header 1</h1>
<script src="/javascripts/redeem.js"></script>
</code>```

Redeem.js

```<code>const guest = document.getElementById('redeem').value;
console.log("redeeem.js working");
console.log(guest);
</code>```

The redeem.js working text comes through but guest renders as undefined.

How do I get test to come through as my variable?

Title: getElementById returning as undefined

Body:
I can't get my DOM element to connect with my javascript and grab a "test" value.

Client side

Header 1

Redeem.js

const guest = document.getElementById('redeem').value;
console.log("redeeem.js working");
console.log(guest);

The redeem.js working text comes through but guest renders as undefined.

How do I get test to come through as my variable?


问:
GitLab CLI - fetch all repositories by organization
Is there any way to fecth all repos by organization using gitlab cli? As far as I see there are the following flags exist:

```<code>FLAGS
  -a, --all               List all projects on the instance
      --member            Only list projects which you are a member
  -m, --mine              Only list projects you own (default true)
  -o, --order string      Return repositories ordered by id, created_at, or other fields (default "last_activity_at")
  -p, --page int          Page number (default 1)
  -P, --per-page int      Number of items to list per page. (default 30)
  -R, --repo OWNER/REPO   Select another repository using the OWNER/REPO or `GROUP/NAMESPACE/REPO` format or full URL or git URL
  -s, --sort string       Return repositories sorted in asc or desc order
      --starred           Only list starred projects
</code>```

Folling that, -R looks like what I need, but /REPO argument also needed to be there, so it makes it almost useless for our case.

glab version: 1.24.1

Body:
Is there any way to fecth all repos by organization using gitlab cli? As far as I see there are the following flags exist:

FLAGS
  -a, --all               List all projects on the instance
      --member            Only list projects which you are a member
  -m, --mine              Only list projects you own (default true)
  -o, --order string      Return repositories ordered by id, created_at, or other fields (default "last_activity_at")
  -p, --page int          Page number (default 1)
  -P, --per-page int      Number of items to list per page. (default 30)
  -R, --repo OWNER/REPO   Select another repository using the OWNER/REPO or `GROUP/NAMESPACE/REPO` format or full URL or git URL
  -s, --sort string       Return repositories sorted in asc or desc order
      --starred           Only list starred projects

Folling that, -R looks like what I need, but /REPO argument also needed to be there, so it makes it almost useless for our case.

glab version: 1.24.1


问:
Send mail using GraphClient always goes to junk folder
I'm trying to send an email using Microsoft Graph API using following code spinet. It always end up in recipient's SPAM/JUNK folder.

```<code>try {
    val usernamePasswordCredential: UsernamePasswordCredential = UsernamePasswordCredentialBuilder()
            .clientId(clientId).username(username).password(password).build()

    val tokenCredentialAuthProvider = TokenCredentialAuthProvider(usernamePasswordCredential)
    val graphClient = GraphServiceClient.builder().authenticationProvider(tokenCredentialAuthProvider).buildClient()

    val bundle = ResourceBundle.getBundle("messages")
    val pattern = bundle.getString("email.body")

    val message = Message()
    message.subject = bundle.getString("email.subject")

    val body = ItemBody()
    body.contentType = BodyType.HTML

    val content = MessageFormat.format(pattern, voornamen, demoLink, USERNAME, pwd)
    body.content = content
    message.body = body

    val toEmail = EmailAddress()
    toEmail.address = email
    val recipient = Recipient()
    recipient.emailAddress = toEmail
    message.toRecipients = listOf(recipient)

    graphClient.me().sendMail(
            UserSendMailParameterSet
                    .newBuilder()
                    .withMessage(message)
                    .build()
    ).buildRequest().post()
} catch (e: Exception) {
    logger.error(e) {"Exception in sending email"}
    throw TenantCreationException("Email", "Failed with error message : ${e.localizedMessage}")
}
</code>```

When I'm trying to send same email content with same account using outlook.office365.com. It goes into inbox only.
Can anyone please suggest what am I missing here?

Body:
I'm trying to send an email using Microsoft Graph API using following code spinet. It always end up in recipient's SPAM/JUNK folder.

try {
    val usernamePasswordCredential: UsernamePasswordCredential = UsernamePasswordCredentialBuilder()
            .clientId(clientId).username(username).password(password).build()

    val tokenCredentialAuthProvider = TokenCredentialAuthProvider(usernamePasswordCredential)
    val graphClient = GraphServiceClient.builder().authenticationProvider(tokenCredentialAuthProvider).buildClient()

    val bundle = ResourceBundle.getBundle("messages")
    val pattern = bundle.getString("email.body")

    val message = Message()
    message.subject = bundle.getString("email.subject")

    val body = ItemBody()
    body.contentType = BodyType.HTML

    val content = MessageFormat.format(pattern, voornamen, demoLink, USERNAME, pwd)
    body.content = content
    message.body = body

    val toEmail = EmailAddress()
    toEmail.address = email
    val recipient = Recipient()
    recipient.emailAddress = toEmail
    message.toRecipients = listOf(recipient)

    graphClient.me().sendMail(
            UserSendMailParameterSet
                    .newBuilder()
                    .withMessage(message)
                    .build()
    ).buildRequest().post()
} catch (e: Exception) {
    logger.error(e) {"Exception in sending email"}
    throw TenantCreationException("Email", "Failed with error message : ${e.localizedMessage}")
}

When I'm trying to send same email content with same account using outlook.office365.com. It goes into inbox only.
Can anyone please suggest what am I missing here?


问:
On Gridview RowCommand button text is not getting changed in ASP.NET using C#
I want to update the text of the btn_Update which is inside the EditTemplate of gridview. For that I wrote the code shown here. But the text is still shown as Reject, even if I am trying to update the text to Approve.

Here's my markup and code:

```<code><asp:GridView ID="rptHotoIPDataInfo" runat="server" AutoGenerateColumns="False" CssClass="table table-bordered nowrap tblrptHotoIPDataInfo"
    AllowPaging="True" PageSize="20" OnPageIndexChanging="rptHotoIPDataInfo_PageIndexChanging"
    DataKeyNames="SAP_ID" OnRowEditing="rptHotoIPDataInfo_RowEditing" OnRowUpdating="rptHotoIPDataInfo_RowUpdating"
    OnRowCancelingEdit="rptHotoIPDataInfo_RowCancelingEdit" OnRowDataBound="rptHotoIPDataInfo_RowDataBound"
    OnRowCommand="rptHotoIPDataInfo_RowCommand">
    <Columns>
        <asp:TemplateField HeaderText="Approved / Reject" ItemStyle-Width="80px"> <%--"Accepted/Rejected (By default checked means approved)"--%>
            <ItemTemplate >
                <asp:CheckBox ID="chkRow" runat="server" Checked="true" Width="5px" OnCheckedChanged="chkRow_CheckedChanged"
                    AutoPostBack="true" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Action" ItemStyle-Width="120px">
            <ItemTemplate>
                <asp:Button ID="btn_Edit" runat="server" Text="Reject" CommandName="Edit" Enabled="false" CssClass="btn btn-blue"  CommandArgument="<%# Container.DataItemIndex %>" />
            </ItemTemplate>
            <EditItemTemplate>

                <asp:Button ID="btn_Update" runat="server" Text="Reject" CommandName="Update" CssClass="btn btn-blue" />
                <asp:Button ID="btn_Cancel" runat="server" Text="Cancel" CommandName="Cancel" CssClass="btn btn-blue" />
            </EditItemTemplate>
        </asp:TemplateField>
       <asp:TemplateField HeaderText="Rejected Remarks" ItemStyle-Width="150px">
            <ItemTemplate>
                <asp:Label ID="lblRemarks" runat="server" Text='<%#Eval("REJECT_REMARKS") %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="txtRemarks" runat="server" Text='<%#Eval("REJECT_REMARKS") %>' Width="150px" CssClass="form-control"></asp:TextBox>
            </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="ID" ItemStyle-Width="50px">
            <ItemTemplate>
                <asp:Label ID="lbl_ID" runat="server" Text='<%#Eval("ID") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="SAP_ID" HeaderText="SAP ID">
            <ItemStyle CssClass="labelbold" Width="100px" />
        </asp:BoundField>
        <asp:BoundField DataField="CR_NO" HeaderText="Description" Visible="False">
            <ItemStyle CssClass="labelbold" Width="100px" />
        </asp:BoundField>
        <asp:BoundField DataField="R4GSTATE_CODE" HeaderText="State Code">
            <ItemStyle CssClass="labelbold" Width="30px" />
        </asp:BoundField>
        <asp:BoundField DataField="HOTO_STATUS" HeaderText="Hoto Status">
            <ItemStyle CssClass="labelbold" Width="50px" />
        </asp:BoundField>
        <asp:BoundField DataField="CR_Justifications" HeaderText="CR Justifications">
            <ItemStyle CssClass="labelbold" Width="100px" />
        </asp:BoundField>
        <asp:BoundField DataField="APPROVE_REJECT" HeaderText="Status">
            <ItemStyle CssClass="labelbold" Width="10px" />
        </asp:BoundField>
        <asp:BoundField DataField="REJECTED_BY" HeaderText="Last Updated by">
            <ItemStyle CssClass="labelbold" Width="10px" />
        </asp:BoundField>
    </Columns>
</asp:GridView>
</code>```

And the code behind is:

```<code>protected void rptHotoIPDataInfo_RowCommand(object sender, GridViewCommandEventArgs e)
{
    if (e.CommandName == "Edit")
    {
        int rowIndex = Convert.ToInt32(e.CommandArgument);
        GridViewRow row = rptHotoIPDataInfo.Rows[rowIndex];

        string name = row.Cells[9].Text;

        var clickedButton = e.CommandSource as Button;

        var clickedRow = clickedButton.NamingContainer as GridViewRow;
        var clickedUserName = clickedRow.Cells[9].Text;

        if (clickedUserName == "Approved")
        {
            clickedButton.Text = "Reject";
        }
        else if (clickedUserName == "REJECTED")
        {
            clickedButton.Text = "Approve";  // this statement is not updating the text
        }
    }
}
</code>```

Body:
I want to update the text of the btn_Update which is inside the EditTemplate of gridview. For that I wrote the code shown here. But the text is still shown as Reject, even if I am trying to update the text to Approve.

Here's my markup and code:

<asp:GridView ID="rptHotoIPDataInfo" runat="server" AutoGenerateColumns="False" CssClass="table table-bordered nowrap tblrptHotoIPDataInfo"
    AllowPaging="True" PageSize="20" OnPageIndexChanging="rptHotoIPDataInfo_PageIndexChanging"
    DataKeyNames="SAP_ID" OnRowEditing="rptHotoIPDataInfo_RowEditing" OnRowUpdating="rptHotoIPDataInfo_RowUpdating"
    OnRowCancelingEdit="rptHotoIPDataInfo_RowCancelingEdit" OnRowDataBound="rptHotoIPDataInfo_RowDataBound"
    OnRowCommand="rptHotoIPDataInfo_RowCommand">
    <Columns>
        <asp:TemplateField HeaderText="Approved / Reject" ItemStyle-Width="80px"> <%--"Accepted/Rejected (By default checked means approved)"--%>
            <ItemTemplate >
                <asp:CheckBox ID="chkRow" runat="server" Checked="true" Width="5px" OnCheckedChanged="chkRow_CheckedChanged"
                    AutoPostBack="true" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Action" ItemStyle-Width="120px">
            <ItemTemplate>
                <asp:Button ID="btn_Edit" runat="server" Text="Reject" CommandName="Edit" Enabled="false" CssClass="btn btn-blue"  CommandArgument="<%# Container.DataItemIndex %>" />
            </ItemTemplate>
            <EditItemTemplate>

                <asp:Button ID="btn_Update" runat="server" Text="Reject" CommandName="Update" CssClass="btn btn-blue" />
                <asp:Button ID="btn_Cancel" runat="server" Text="Cancel" CommandName="Cancel" CssClass="btn btn-blue" />
            </EditItemTemplate>
        </asp:TemplateField>
       <asp:TemplateField HeaderText="Rejected Remarks" ItemStyle-Width="150px">
            <ItemTemplate>
                <asp:Label ID="lblRemarks" runat="server" Text='<%#Eval("REJECT_REMARKS") %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="txtRemarks" runat="server" Text='<%#Eval("REJECT_REMARKS") %>' Width="150px" CssClass="form-control"></asp:TextBox>
            </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="ID" ItemStyle-Width="50px">
            <ItemTemplate>
                <asp:Label ID="lbl_ID" runat="server" Text='<%#Eval("ID") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="SAP_ID" HeaderText="SAP ID">
            <ItemStyle CssClass="labelbold" Width="100px" />
        </asp:BoundField>
        <asp:BoundField DataField="CR_NO" HeaderText="Description" Visible="False">
            <ItemStyle CssClass="labelbold" Width="100px" />
        </asp:BoundField>
        <asp:BoundField DataField="R4GSTATE_CODE" HeaderText="State Code">
            <ItemStyle CssClass="labelbold" Width="30px" />
        </asp:BoundField>
        <asp:BoundField DataField="HOTO_STATUS" HeaderText="Hoto Status">
            <ItemStyle CssClass="labelbold" Width="50px" />
        </asp:BoundField>
        <asp:BoundField DataField="CR_Justifications" HeaderText="CR Justifications">
            <ItemStyle CssClass="labelbold" Width="100px" />
        </asp:BoundField>
        <asp:BoundField DataField="APPROVE_REJECT" HeaderText="Status">
            <ItemStyle CssClass="labelbold" Width="10px" />
        </asp:BoundField>
        <asp:BoundField DataField="REJECTED_BY" HeaderText="Last Updated by">
            <ItemStyle CssClass="labelbold" Width="10px" />
        </asp:BoundField>
    </Columns>
</asp:GridView>

And the code behind is:

protected void rptHotoIPDataInfo_RowCommand(object sender, GridViewCommandEventArgs e)
{
    if (e.CommandName == "Edit")
    {
        int rowIndex = Convert.ToInt32(e.CommandArgument);
        GridViewRow row = rptHotoIPDataInfo.Rows[rowIndex];

        string name = row.Cells[9].Text;

        var clickedButton = e.CommandSource as Button;

        var clickedRow = clickedButton.NamingContainer as GridViewRow;
        var clickedUserName = clickedRow.Cells[9].Text;

        if (clickedUserName == "Approved")
        {
            clickedButton.Text = "Reject";
        }
        else if (clickedUserName == "REJECTED")
        {
            clickedButton.Text = "Approve";  // this statement is not updating the text
        }
    }
}


问:
Spring Cloud Stream Kafka Custom Error Handler
I have Kafka Consumer using spring cloud stream

spring:
  cloud:
    stream:
      function:
        definition: myConsumer
      bindings:
        myConsumer-in-0:
          destination:myDest
          binder: kafka
          group: myGroup
          content-type: application/json
```
<p>I was able to catch errors through global error channel</p>
<pre class="lang-java prettyprint-override"><code>@ServiceActivator(inputChannel = IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME)
public void processError(Message<MessageHandlingException> message) {
  log.info("error had happend {}", message);
}
</code>```

Now I have two questions

How can we redirect the error to a specific internal channel by a consumer?

Will the message be acknowledged automatically even for the error scenario?

Body:
I have Kafka Consumer using spring cloud stream

spring:
  cloud:
    stream:
      function:
        definition: myConsumer
      bindings:
        myConsumer-in-0:
          destination:myDest
          binder: kafka
          group: myGroup
          content-type: application/json

I was able to catch errors through global error channel

@ServiceActivator(inputChannel = IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME)
public void processError(Message<MessageHandlingException> message) {
  log.info("error had happend {}", message);
}

Now I have two questions

How can we redirect the error to a specific internal channel by a consumer?

Will the message be acknowledged automatically even for the error scenario?


问:
ValueError at /signup/ Cannot assign "<User: prosenjit>": "Referral.parent" must be a "Referral" instance
After reading a lot of answers similar to this problem I got a specific error in every single case.
In the following, I have attached my mandatory code.

Models.py

```<code>import uuid
import enum
from django.db import models
from django.utils import timezone, translation
from django.conf import settings
from django.core.validators import MinValueValidator, MaxValueValidator
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation

from django_numerators.models import NumeratorMixin
from mptt.models import MPTTModel, TreeForeignKey, TreeManager

_ = translation.gettext_lazy
from .utils import generate_ref_code

class Referral(NumeratorMixin, MPTTModel, models.Model):
    class Meta:
        verbose_name = _('Referral')
        verbose_name_plural = _('Referral')
        unique_together = ('parent', 'account')

    limit = 3

    parent = TreeForeignKey(
        'self', null=True, blank=True,
        on_delete=models.SET_NULL,
        related_name='downlines',
        verbose_name=_('Up Line'))
    account = models.OneToOneField(
        get_user_model(),
        on_delete=models.CASCADE,
        verbose_name=_('account'))
    balance = models.DecimalField(
        default=0,
        max_digits=15,
        decimal_places=2,
        editable=False,
        verbose_name=_("Balance"))
    created_at = models.DateTimeField(
        default=timezone.now, editable=False)
    code = models.CharField(max_length=12, blank=True)

    def __str__(self):
        return (
            self.account.username
            if self.account.get_full_name() in ['', None]
            else self.account.get_full_name()
        )

    def update_balance(self, balance):
        self.balance = balance
        self.save()

    def get_referral_limit(self):
        return getattr(settings, 'REFERRAL_DOWNLINE_LIMIT', None) or self.limit

    def get_uplines(self):
        return self.get_ancestors(include_self=False, ascending=True)[:self.get_referral_limit()]

    def save(self, *args, **kwargs):
        if self.code == "":
            code = generate_ref_code()
            self.code = code
        super().save(*args, **kwargs)
</code>```

Everything is working well and 100% worked if I add foreignkey instead of TreeForeignKey in the parent field

```<code>parent = models.ForeignKey(User, on_delete=models.CASCADE, blank=True, null=True, related_name='ref_by')
</code>```

Instead Of

```<code>parent = TreeForeignKey(
            'self', null=True, blank=True,
            on_delete=models.SET_NULL,
            related_name='downlines',
            verbose_name=_('Up Line'))
</code>```

But I need TreeForeignKey because of my multilevel referral system.

utils.py

```<code>import uuid
import json
from django.core.serializers.json import DjangoJSONEncoder
from uuid import UUID
import random

def generate_ref_code():
    code = str(uuid.uuid4()).replace("-", "")[:12]

    return code
</code>```

signals.py

```<code>from .models import Referral
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver

@receiver(post_save, sender=User)
def post_save_create_profile(sender, instance, created, *args, **kwargs):
    if created:
        Referral.objects.create(account=instance)
</code>```

views.py

```<code>@csrf_protect
def signup_view(request):
    profile_id = request.session.get('ref_profile')
    print('profile_id', profile_id)
    form = SignupForm(request.POST or None)
    if form.is_valid():
        if profile_id is not None:
            recommended_by_profile = Referral.objects.get(id=profile_id)
            print("recommended_by_profile", recommended_by_profile)

            instance = form.save()
            print("instance saved", instance)
            registered_user = User.objects.get(id=instance.id)
            print("registered_user", registered_user)
            registered_profile = Referral.objects.get(account=registered_user)
            print("registered_profile", registered_profile)
            registered_profile.parent = recommended_by_profile.account
            print("registered_profile.parent", registered_profile.parent)
            # print("registered_profile.user", registered_profile.user)
            print("registered_profile.account", registered_profile.account)
            print("recommended_by_profile.parent", recommended_by_profile.parent)
            # print("recommended_by_profile.user", recommended_by_profile.user)
            print("recommended_by_profile.account", recommended_by_profile.account)
            registered_profile.save()
            print("registered_profile it's saved", registered_profile)
        else:
            print("Referral not working")
            form.save()
        username = form.cleaned_data.get('username')
        password = form.cleaned_data.get('password1')
        user = authenticate(username=username, password=password)
        login(request, user)
        return redirect('main_view')
    context = {
        'form': form
    }
    return render(request, 'signup.html', context)
</code>```

I have also attached the image of the error where you can see the specific one. Here is the main issues with a data type that is not passing on the "parent" field when using "TreeForeignKey".

Any kind of help or suggestion would be appreciated related the question.

Thanks

Body:
After reading a lot of answers similar to this problem I got a specific error in every single case.
In the following, I have attached my mandatory code.

Models.py

import uuid
import enum
from django.db import models
from django.utils import timezone, translation
from django.conf import settings
from django.core.validators import MinValueValidator, MaxValueValidator
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation

from django_numerators.models import NumeratorMixin
from mptt.models import MPTTModel, TreeForeignKey, TreeManager

_ = translation.gettext_lazy
from .utils import generate_ref_code

class Referral(NumeratorMixin, MPTTModel, models.Model):
    class Meta:
        verbose_name = _('Referral')
        verbose_name_plural = _('Referral')
        unique_together = ('parent', 'account')

    limit = 3

    parent = TreeForeignKey(
        'self', null=True, blank=True,
        on_delete=models.SET_NULL,
        related_name='downlines',
        verbose_name=_('Up Line'))
    account = models.OneToOneField(
        get_user_model(),
        on_delete=models.CASCADE,
        verbose_name=_('account'))
    balance = models.DecimalField(
        default=0,
        max_digits=15,
        decimal_places=2,
        editable=False,
        verbose_name=_("Balance"))
    created_at = models.DateTimeField(
        default=timezone.now, editable=False)
    code = models.CharField(max_length=12, blank=True)

    def __str__(self):
        return (
            self.account.username
            if self.account.get_full_name() in ['', None]
            else self.account.get_full_name()
        )

    def update_balance(self, balance):
        self.balance = balance
        self.save()

    def get_referral_limit(self):
        return getattr(settings, 'REFERRAL_DOWNLINE_LIMIT', None) or self.limit

    def get_uplines(self):
        return self.get_ancestors(include_self=False, ascending=True)[:self.get_referral_limit()]

    def save(self, *args, **kwargs):
        if self.code == "":
            code = generate_ref_code()
            self.code = code
        super().save(*args, **kwargs)

Everything is working well and 100% worked if I add foreignkey instead of TreeForeignKey in the parent field

parent = models.ForeignKey(User, on_delete=models.CASCADE, blank=True, null=True, related_name='ref_by')

Instead Of

parent = TreeForeignKey(
            'self', null=True, blank=True,
            on_delete=models.SET_NULL,
            related_name='downlines',
            verbose_name=_('Up Line'))

But I need TreeForeignKey because of my multilevel referral system.

utils.py

import uuid
import json
from django.core.serializers.json import DjangoJSONEncoder
from uuid import UUID
import random

def generate_ref_code():
    code = str(uuid.uuid4()).replace("-", "")[:12]

    return code

signals.py

from .models import Referral
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver

@receiver(post_save, sender=User)
def post_save_create_profile(sender, instance, created, *args, **kwargs):
    if created:
        Referral.objects.create(account=instance)

views.py

@csrf_protect
def signup_view(request):
    profile_id = request.session.get('ref_profile')
    print('profile_id', profile_id)
    form = SignupForm(request.POST or None)
    if form.is_valid():
        if profile_id is not None:
            recommended_by_profile = Referral.objects.get(id=profile_id)
            print("recommended_by_profile", recommended_by_profile)

            instance = form.save()
            print("instance saved", instance)
            registered_user = User.objects.get(id=instance.id)
            print("registered_user", registered_user)
            registered_profile = Referral.objects.get(account=registered_user)
            print("registered_profile", registered_profile)
            registered_profile.parent = recommended_by_profile.account
            print("registered_profile.parent", registered_profile.parent)
            # print("registered_profile.user", registered_profile.user)
            print("registered_profile.account", registered_profile.account)
            print("recommended_by_profile.parent", recommended_by_profile.parent)
            # print("recommended_by_profile.user", recommended_by_profile.user)
            print("recommended_by_profile.account", recommended_by_profile.account)
            registered_profile.save()
            print("registered_profile it's saved", registered_profile)
        else:
            print("Referral not working")
            form.save()
        username = form.cleaned_data.get('username')
        password = form.cleaned_data.get('password1')
        user = authenticate(username=username, password=password)
        login(request, user)
        return redirect('main_view')
    context = {
        'form': form
    }
    return render(request, 'signup.html', context)

I have also attached the image of the error where you can see the specific one. Here is the main issues with a data type that is not passing on the "parent" field when using "TreeForeignKey".

Any kind of help or suggestion would be appreciated related the question.

Thanks


问:
How can I detect similarity of names in the same columns
Guys I have a dataset like this:
`

```<code>df = pd.DataFrame(data = ['John','gal britt','mona','diana','molly','merry','mony','molla','johnathon','dina'],\
                  columns = ['Name'])
df
</code>```

`
it gives this output

```<code>Name
0   John
1   gal britt
2   mona
3   diana
4   molly
5   merry
6   mony
7   molla
8   johnathon
</code>```

so I imagine that to get all names across each other and detect the similarity I will use df.merge(df,how = "cross" )

The thing is the real data is 40000 rows and performing this will result in a very big dataset which I don't have the memory for.
any algorithm or idea would really help and I'll adjust the logic to my purposes

I tried working with vaex instead of pandas to work with this huge amount of data but still I run into the problem of insufficient memory allocation.
In short: I KNOW that this algorithm or way of thinking about such problem is wrong and inefficient.

Body:
Guys I have a dataset like this:
`

df = pd.DataFrame(data = ['John','gal britt','mona','diana','molly','merry','mony','molla','johnathon','dina'],\
                  columns = ['Name'])
df

`
it gives this output

Name
0   John
1   gal britt
2   mona
3   diana
4   molly
5   merry
6   mony
7   molla
8   johnathon

so I imagine that to get all names across each other and detect the similarity I will use df.merge(df,how = "cross" )

The thing is the real data is 40000 rows and performing this will result in a very big dataset which I don't have the memory for.
any algorithm or idea would really help and I'll adjust the logic to my purposes

I tried working with vaex instead of pandas to work with this huge amount of data but still I run into the problem of insufficient memory allocation.
In short: I KNOW that this algorithm or way of thinking about such problem is wrong and inefficient.


问:
How to mock FileSystemDatasetFactory Class
Iam using Junit and PowerMockito.How can i mock below FileSystemDatasetFactory method call?</p>
```<code>Schema getFileSchema(String uri,FileFormat format){
DatasetFactory factory = new FileSystemDatasetFactory(allocator,
                NativeMemoryPool.getDefault(), format, uri);
return factory.inspect();
}

@Test
Public void testGetFileSchema(){
FileSystemDatasetFactory fileSystemDatasetFactory =mock(FileSystemDatasetFactory.class);
PowerMockito.whenNew(FileSystemDatasetFactory.class).withAnyArguments().thenReturn(fileSystemDatasetFactory)
}
</code>```

Body:
Iam using Junit and PowerMockito.How can i mock below FileSystemDatasetFactory method call?

Schema getFileSchema(String uri,FileFormat format){
DatasetFactory factory = new FileSystemDatasetFactory(allocator,
                NativeMemoryPool.getDefault(), format, uri);
return factory.inspect();
}

@Test
Public void testGetFileSchema(){
FileSystemDatasetFactory fileSystemDatasetFactory =mock(FileSystemDatasetFactory.class);
PowerMockito.whenNew(FileSystemDatasetFactory.class).withAnyArguments().thenReturn(fileSystemDatasetFactory)
}


问:
How can I move my sprite in cocos2dx by holding the keyboard keys?
I've created this header which called KeyboardScene.h:

```<code>class KeyboardScene : public cocos2d::Layer
{
public:
    static cocos2d::Scene* createScene();
    virtual bool init();

    virtual bool onTouchBegan(cocos2d::Touch*, cocos2d::Event*);
    virtual void onTouchEnded(cocos2d::Touch*, cocos2d::Event*);
    virtual void onTouchMoved(cocos2d::Touch*, cocos2d::Event*);
    virtual void onTouchCancelled(cocos2d::Touch*, cocos2d::Event*);
    CREATE_FUNC(KeyboardScene);

private:
    cocos2d::Label* labelTouchInfo;
};
</code>```

I created a sprite called caractere then I used this to move it :

```<code>auto eventListener = EventListenerKeyboard::create();

        eventListener->onKeyPressed = [](EventKeyboard::KeyCode keyCode, Event* event) {

        Vec2 loc = event->getCurrentTarget()->getPosition();
        switch (keyCode) {
        case EventKeyboard::KeyCode::KEY_LEFT_ARROW:
        case EventKeyboard::KeyCode::KEY_A:
            event->getCurrentTarget()->setPosition(--loc.x, loc.y);
            break;
        case EventKeyboard::KeyCode::KEY_RIGHT_ARROW:
        case EventKeyboard::KeyCode::KEY_D:
            event->getCurrentTarget()->setPosition(++loc.x, loc.y);
            break;
        }
    };

    this->_eventDispatcher->addEventListenerWithSceneGraphPriority(eventListener, caractere);
</code>```

What am I supposed to change to make it move while holding the keys ?

```<code></code>```

Body:
I've created this header which called KeyboardScene.h:

class KeyboardScene : public cocos2d::Layer
{
public:
    static cocos2d::Scene* createScene();
    virtual bool init();

    virtual bool onTouchBegan(cocos2d::Touch*, cocos2d::Event*);
    virtual void onTouchEnded(cocos2d::Touch*, cocos2d::Event*);
    virtual void onTouchMoved(cocos2d::Touch*, cocos2d::Event*);
    virtual void onTouchCancelled(cocos2d::Touch*, cocos2d::Event*);
    CREATE_FUNC(KeyboardScene);

private:
    cocos2d::Label* labelTouchInfo;
};

I created a sprite called caractere then I used this to move it :

auto eventListener = EventListenerKeyboard::create();

        eventListener->onKeyPressed = [](EventKeyboard::KeyCode keyCode, Event* event) {

        Vec2 loc = event->getCurrentTarget()->getPosition();
        switch (keyCode) {
        case EventKeyboard::KeyCode::KEY_LEFT_ARROW:
        case EventKeyboard::KeyCode::KEY_A:
            event->getCurrentTarget()->setPosition(--loc.x, loc.y);
            break;
        case EventKeyboard::KeyCode::KEY_RIGHT_ARROW:
        case EventKeyboard::KeyCode::KEY_D:
            event->getCurrentTarget()->setPosition(++loc.x, loc.y);
            break;
        }
    };

    this->_eventDispatcher->addEventListenerWithSceneGraphPriority(eventListener, caractere);

What am I supposed to change to make it move while holding the keys ?


问:
Powershell Variables - Issue replacing parameter value when using AWS CLI for Cloudformation
I am currently trying to set up CloudFormation to use AWS Config and set up the AWS default rule for Public RDS checking.

I am trying to deploy this using powershell with variables, code below.

```<code># Variables
$default_region = 'eu-west-1'
$aws_profile = Read-Host -Prompt 'Input AWS CLI profile name'

if (!($aws_region = Read-Host "Enter Region [$default_region]")) { $aws_region = $default_region }
if (!($environment = Read-Host "Enter Environment Name [$aws_profile]")) { $environment = $aws_profile }
$topicname = "rds_instance_public_access_check_$($aws_region)"

$sns_message = "Public RDS Detected in $($environment) - $($aws_region)"

# Create the RDS Public Instance stack
aws cloudformation create-stack --stack-name rds-instance-public-access-check-rules --template-body file://config_public_rds.yml --parameters ParameterKey=ViolationMessage,ParameterValue=$sns_message ParameterKey=TopicName,ParameterValue=$topicname --profile $aws_profile --region $aws_region
</code>```

The CloudFormation template works as expected, if i hardcode the $topicName and $sns_message variable it creates the stack as expected.

The parameters being passed for creation are the $ variable values when checking the console.

If i Write out the parameters outside of the CLI they also work, only when using it like the above does it seem to ignore the parameter set.

The values being passed are also not the issue as I have tested this with simple string values and that also fails.

Tried to run the above code, expecting a CloudFormation stack to be created on the AWS profile passed in.

Permissions are tested and working.
CloudFormation template replaced with hard values tested and working.
Powershell replaced with hardcoded values tested and working.
Variables changed to simple strings, not working.

Thank you in advance.

Gavin

Body:
I am currently trying to set up CloudFormation to use AWS Config and set up the AWS default rule for Public RDS checking.

I am trying to deploy this using powershell with variables, code below.

# Variables
$default_region = 'eu-west-1'
$aws_profile = Read-Host -Prompt 'Input AWS CLI profile name'

if (!($aws_region = Read-Host "Enter Region [$default_region]")) { $aws_region = $default_region }
if (!($environment = Read-Host "Enter Environment Name [$aws_profile]")) { $environment = $aws_profile }
$topicname = "rds_instance_public_access_check_$($aws_region)"

$sns_message = "Public RDS Detected in $($environment) - $($aws_region)"

# Create the RDS Public Instance stack
aws cloudformation create-stack --stack-name rds-instance-public-access-check-rules --template-body file://config_public_rds.yml --parameters ParameterKey=ViolationMessage,ParameterValue=$sns_message ParameterKey=TopicName,ParameterValue=$topicname --profile $aws_profile --region $aws_region

The CloudFormation template works as expected, if i hardcode the $topicName and $sns_message variable it creates the stack as expected.

The parameters being passed for creation are the $ variable values when checking the console.

If i Write out the parameters outside of the CLI they also work, only when using it like the above does it seem to ignore the parameter set.

The values being passed are also not the issue as I have tested this with simple string values and that also fails.

Tried to run the above code, expecting a CloudFormation stack to be created on the AWS profile passed in.

Permissions are tested and working.
CloudFormation template replaced with hard values tested and working.
Powershell replaced with hardcoded values tested and working.
Variables changed to simple strings, not working.

Thank you in advance.

Gavin


问:
How do I ensure that JavaFX is using the platform-specific DirectoryChooser implementation
When I open a JavaFX DirectoryChooser (or FileChooser) on my Linux system and set the initial directory, the path I provide gets converted to canonical form.

The result is users getting exposed to details of the disk environment. The user expects to find their data in a directory like /home/user1/Documents/MyAppData but /home is on a small system disk and "user1" is a symlink to a location on a large data disk, so they actually see the underlying "real" path /MassiveDataDisk/users/user1/Documents/MyAppData in the DirectoryChooser dialog.

Worse still, if the user synchs their work to another machine (which is how I spotted this problem) then any paths set by calls to the DirctoryChooser do no necessarily work if the underlying config of the second machine is different, such as  "MassiveDataDisk" having been created as "MassiveDatadisk". Clearly machine configs can be corrected, but as the developer, I shouldn't need to know about symlinks in the directory structure like that, and don't want to expose the user to it.

So far as I can see, this happens in the CommonDialogs code under com.sun.glass.ui where a method called convertFolder uses the canonical form method on File before passing the result to the native DirectoryChooser. By deliberately causing an error I got a stack trace confirming that the CommonDialogs code is being used.

I can also see that there is a CommonDialogsGtk class which I assume should be the one used in a Linux environment, and that does not force that conversion to canonical form. I can't see how to make Java use that platform-specific code.

Does anyone know if there is some configuration detail that I'm missing? I expected the JavaFX environment to autodetect the right DirectoryChooser to use.


问:
how to print using cat and past
i want to have this output when print

```<code>Prime numbers : 89 107
Non-prime numbers : 597 [3 199]  931 [7 7 19] 1083 [3 19 19]
</code>```

But the result i get is revers
this is the result i have form my function

```<code> 89 107 Prime numbers :
 597 [3 199]  931 [7 7 19] 1083 [3 19 19] Non-prime numbers :
</code>```
```<code>paste(cat("Non-prime numbers :",IfNonPrime()," "))
paste(cat("Prime numbers :",IfPrime()," "))
</code>```

where the IfNonPrime() and IfPrime() are function return the prime and non_prime numbers form the vector of numbers

Title: how to print using cat and past

Body:
i want to have this output when print

Prime numbers : 89 107
Non-prime numbers : 597 [3 199]  931 [7 7 19] 1083 [3 19 19]

But the result i get is revers
this is the result i have form my function

 89 107 Prime numbers :
 597 [3 199]  931 [7 7 19] 1083 [3 19 19] Non-prime numbers :

paste(cat("Non-prime numbers :",IfNonPrime()," "))
paste(cat("Prime numbers :",IfPrime()," "))

where the IfNonPrime() and IfPrime() are function return the prime and non_prime numbers form the vector of numbers


问:
Favicon not showing in Google search results for my domain hosted on GoDaddy and linked to my Blogger blog
I bought a domain name with GoDaddy and linked it to my Blogger blog, but the favicon is not showing up in Google search results. You can test the issue by searching 'site:www.poissac.com' on Google or by visiting https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://poissac.com&size=16.

I tried to add it manually on blogger by editing the Html code of my theme but it didn't work.


问:
"adb root" gives "adb root cannot run in production builds" in Android Studio emulator
I am getting

adb root cannot run in production builds

while running adb root for my Android emulator in Android Studio with Android 10 (google_apis_playstore)

So I installed magisk with rootAVD.

Then

```<code>adb shell
su
</code>```

not giving any error and it works fine.
But adb root still giving the same error.

From Google tried rootAVD still not working.

My device details:

Body:
I am getting

adb root cannot run in production builds

while running adb root for my Android emulator in Android Studio with Android 10 (google_apis_playstore)

So I installed magisk with rootAVD.

Then

adb shell
su

not giving any error and it works fine.
But adb root still giving the same error.

From Google tried rootAVD still not working.

My device details:


问:
Prevent RabbitListener to execute before CommandLineRunner
I am having a problem with the RabbitListener crashing the application if the queue is not available. However, I am creating the queue in the CommandLineRunner. But I can't get it to execute before the RabbitListener.


问:
setInterval is increasing after the initial value is reseted
When I run the counter for first the seconds are counting correctly(1000miliseconds). However, when I reset the counter to 0 and start the counter again, I have notice that the counter speed is increased. It' doesn't make sense, since the interval is constant of 1000.

What can cause such behavior? Thank you in advance.

function StartCounter() {
  setInterval(IncreaseSeconds, 1000);
}

function IncreaseSeconds() {
  let seconds = parseInt(document.getElementById("setter-post-counter").innerText);
  document.getElementById("setter-post-counter").innerText = seconds + 1;
}

function Reset() {
  document.getElementById("setter-post-counter").innerText = 0;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="onerow">
  <p id="setter-post-counter">0</p><span>seconds</span></div>

<button onClick="StartCounter()">Start</button>
<button onClick="Reset()">Reset</button></code>```

Body:
When I run the counter for first the seconds are counting correctly(1000miliseconds). However, when I reset the counter to 0 and start the counter again, I have notice that the counter speed is increased. It' doesn't make sense, since the interval is constant of 1000.

What can cause such behavior? Thank you in advance.

function StartCounter() {
  setInterval(IncreaseSeconds, 1000);
}

function IncreaseSeconds() {
  let seconds = parseInt(document.getElementById("setter-post-counter").innerText);
  document.getElementById("setter-post-counter").innerText = seconds + 1;
}

function Reset() {
  document.getElementById("setter-post-counter").innerText = 0;
}

0
seconds

<button onClick="StartCounter()">Start</button>
<button onClick="Reset()">Reset</button>


问:
C# warning when creating Migrations - 'timeout'
I get an error when creating EF migrations in my C# ASP.NET MVC project:

An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: Specified argument was out of the range of valid values. (Parameter 'timeout')

I have installed the mentioned package (it wasn't installed originally) to the version in line with the other packages across the projects, which was 6.01, I have updated it to 7.0 and have updated the others. Has anyone else experienced this? I can't see anything else related to timeout online.

Edit:

This is a sample of the logs around the migration in the PMC

Finding Microsoft.Extensions.Hosting service provider...

Using environment 'Development'.

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'timeout')

at System.Threading.Tasks.Task.Wait(TimeSpan timeout)

at Microsoft.Extensions.Hosting.HostFactoryResolver.HostingListener.CreateHost()
at Microsoft.Extensions.Hosting.HostFactoryResolver.<>c__DisplayClass10_0.b__0(String[] args)
at Microsoft.Extensions.Hosting.HostFactoryResolver.<>c__DisplayClass13_0.b__3(String[] args)
at Microsoft.EntityFrameworkCore.Design.Internal.AppServiceProviderFactory.CreateFromHosting(String[] args)

An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: Specified argument was out of the range of valid values. (Parameter 'timeout')

No application service provider was found.

This is a copy of my appSettings.json file:

```<code>{
  "Version": "",
  "Vault": "",
  "ClientId": "",
  "ClientSecret": "",
  "CorsAllowedOrigins": "",
  "Logging": {
    "LogLevel": {
      "Default": "Warning",
      "System": "Warning",
      "Microsoft": "Warning"
    }
  },
  "ConnectionStrings": {
    "CommonDbContext": "Server=(localdb)\\mssqllocaldb;Database=database1;Trusted_Connection=True;MultipleActiveResultSets=true",
    "ApplicationDbContext": "Server=(localdb)\\mssqllocaldb;Database=database2;Trusted_Connection=True;MultipleActiveResultSets=true"
  },
  "API": "https://localhost:44383",
  "API": "https://localhost:44325",
  "API": "https://localhost:44317",
  "API": "https://localhost:44312",
  "API": "https://localhost:44311"
}
</code>```

Body:
I get an error when creating EF migrations in my C# ASP.NET MVC project:

An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: Specified argument was out of the range of valid values. (Parameter 'timeout')

I have installed the mentioned package (it wasn't installed originally) to the version in line with the other packages across the projects, which was 6.01, I have updated it to 7.0 and have updated the others. Has anyone else experienced this? I can't see anything else related to timeout online.

Edit:

This is a sample of the logs around the migration in the PMC

Finding Microsoft.Extensions.Hosting service provider...

Using environment 'Development'.

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'timeout')

at System.Threading.Tasks.Task.Wait(TimeSpan timeout)

at Microsoft.Extensions.Hosting.HostFactoryResolver.HostingListener.CreateHost()
at Microsoft.Extensions.Hosting.HostFactoryResolver.<>c__DisplayClass10_0.b__0(String[] args)
at Microsoft.Extensions.Hosting.HostFactoryResolver.<>c__DisplayClass13_0.b__3(String[] args)
at Microsoft.EntityFrameworkCore.Design.Internal.AppServiceProviderFactory.CreateFromHosting(String[] args)

An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: Specified argument was out of the range of valid values. (Parameter 'timeout')

No application service provider was found.

This is a copy of my appSettings.json file:

{
  "Version": "",
  "Vault": "",
  "ClientId": "",
  "ClientSecret": "",
  "CorsAllowedOrigins": "",
  "Logging": {
    "LogLevel": {
      "Default": "Warning",
      "System": "Warning",
      "Microsoft": "Warning"
    }
  },
  "ConnectionStrings": {
    "CommonDbContext": "Server=(localdb)\\mssqllocaldb;Database=database1;Trusted_Connection=True;MultipleActiveResultSets=true",
    "ApplicationDbContext": "Server=(localdb)\\mssqllocaldb;Database=database2;Trusted_Connection=True;MultipleActiveResultSets=true"
  },
  "API": "https://localhost:44383",
  "API": "https://localhost:44325",
  "API": "https://localhost:44317",
  "API": "https://localhost:44312",
  "API": "https://localhost:44311"
}