问:
Dagger hilt get scope object in injected object
How get scope object (like ViewModel, Fragment etc where I inject) in injected object?

I finded only @ActivityContext annotation that give you activity but i need ViewModel

```<code>@HiltViewModel
class SomeViewModel @Inject constructor(
    savedStateHandle: SavedStateHandle
) : ViewModel() {
   @Inject lateinit var someObj: SomeInjectedObject
  //some code
}

class SomeInjectedObject @Inject constructor(){
// how can i get here view model link ?
}
</code>```

I can just set it in init block but it looks like incorrect decision

```<code>@HiltViewModel
class SomeViewModel @Inject constructor(
    savedStateHandle: SavedStateHandle,
    var someObj: SomeInjectedObject
) : ViewModel() {
  init{
     someObj.vm = this
  }
  //some code
}

class SomeInjectedObject @Inject constructor(){
   var vm: ViewModel
}
</code>```

Body:
How get scope object (like ViewModel, Fragment etc where I inject) in injected object?

I finded only @ActivityContext annotation that give you activity but i need ViewModel

@HiltViewModel
class SomeViewModel @Inject constructor(
    savedStateHandle: SavedStateHandle
) : ViewModel() {
   @Inject lateinit var someObj: SomeInjectedObject
  //some code
}

class SomeInjectedObject @Inject constructor(){
// how can i get here view model link ?
}

I can just set it in init block but it looks like incorrect decision

@HiltViewModel
class SomeViewModel @Inject constructor(
    savedStateHandle: SavedStateHandle,
    var someObj: SomeInjectedObject
) : ViewModel() {
  init{
     someObj.vm = this
  }
  //some code
}

class SomeInjectedObject @Inject constructor(){
   var vm: ViewModel
}


来源: stackexchange

问:
OCPP 2.0 How does the central system male a request to the charging station?
The information I inquired is only that the charging station sends a request to the central system. In OCPP v2.0.1, How the central system makes a request to the charging station and how does the charging station respond?
[I am using the below mentioned type of code for this:]
(https://github.com/mobilityhouse/ocpp)

I want the central system to be able to make a request to the charging station and get a response from the charging station.

ContentLicense: CC BY-SA 4.0


问:
Inserting text into UITextField on tvOS in a Xcode Cloud UI-Test
I am running a UI-Test on Xcode Cloud for a tvOS application (Apple TV), and part of the test includes a text insertion. Since Xcode Cloud automatically provides me with screenshots for every user interaction I can observe that nothing is inserted into the UITextField and this is my issue.
The functions that I use are:

```<code>// repeated for completing a string sequence
XCUIRemote.shared.press(.right) // left, up and down
..
..
XCUIRemote.shared.press(.select)
</code>```

The screenshots capture focus movement between keys on the keyboard but executing the select action does not seem to work. This UI-test works locally on Xcode on my Macbook but this does not work in Xcode Cloud.

Body:
I am running a UI-Test on Xcode Cloud for a tvOS application (Apple TV), and part of the test includes a text insertion. Since Xcode Cloud automatically provides me with screenshots for every user interaction I can observe that nothing is inserted into the UITextField and this is my issue.
The functions that I use are:

// repeated for completing a string sequence
XCUIRemote.shared.press(.right) // left, up and down
..
..
XCUIRemote.shared.press(.select)

The screenshots capture focus movement between keys on the keyboard but executing the select action does not seem to work. This UI-test works locally on Xcode on my Macbook but this does not work in Xcode Cloud.


问:
gradle - A new daemon was started but could not be connected to
whenever I try to run gradle I get this error:

`Starting a Gradle Daemon, 3 stopped Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

What went wrong:
A new daemon was started but could not be connected to: pid=DaemonInfo{pid=15005, address=[0afc2481-e15f-4c14-ad0a-ab04bb464abe port:46235, addresses:[/127.0.0.1]], state=Busy, lastBusy=1673266156479, context=DefaultDaemonContext[uid=c8f84860-9dea-4853-8963-824fa63d8e54,javaHome=/usr/lib/jvm/java-17-openjdk-armhf,daemonRegistryDir=/home/pi/.gradle/daemon,pid=15005,idleTimeout=10800000,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=GB,-Duser.language=en,-Duser.variant]}, address= [0afc2481-e15f-4c14-ad0a-ab04bb464abe port:46235, addresses:[/127.0.0.1]]. See https://docs.gradle.org/7.5.1/userguide/troubleshooting.html#network_connection for more details.`

Everything was working fine until it suddenly broke without me making any changes in between.

I have tried the gradle troubleshooting guide, removing every gradle related file and reinstalling, different gradle versions, searching on the web also didnt give me any useful advice.

Any suggestions/ideas what might be causing this?


问:
Using "ERC20" and interfaces names as variable (in functions)
I'm having problems wrapping my head around ERC20 and interfaces passed as variables.

Examples:

```<code>function foo(ERC20 _project) external { //some code }

function fuu(IERC4626 _project) external { ERC20(_project.asset()) }
</code>```

What does this exactly do and how do we use it?

Haven't been able to find any explanation next to: Using interface name as Variable type. A link to the explanation is also fine.

My guesses:

Example 1: we input an address type which simply refers to an ERC20 contract, which we can use then as:

```<code>Project project = _project;

project.withdraw();
</code>```

If above is true, why don't we simply take in an address type in the function instead of "ERC20" type?

Example 2: Calls an ERC20 contract which implements the IERC4626 interface? If so, how is that checked? tbh I have no idea.

Body:
I'm having problems wrapping my head around ERC20 and interfaces passed as variables.

Examples:

function foo(ERC20 _project) external { //some code }

function fuu(IERC4626 _project) external { ERC20(_project.asset()) }

What does this exactly do and how do we use it?

Haven't been able to find any explanation next to: Using interface name as Variable type. A link to the explanation is also fine.

My guesses:

Example 1: we input an address type which simply refers to an ERC20 contract, which we can use then as:

Project project = _project;

project.withdraw();

If above is true, why don't we simply take in an address type in the function instead of "ERC20" type?

Example 2: Calls an ERC20 contract which implements the IERC4626 interface? If so, how is that checked? tbh I have no idea.


问:
SQL Anywhere 17 & PHP 8.x.y on Linux
I want to install PHP SQL Anywhere 17 module for PHP 8.1 version.

I am using the PHP 8.0.0 module provided in the SAP documentation (https://wiki.scn.sap.com/wiki/display/SQLANY/The+SAP+SQL+Anywhere+PHP+Module).
The driver is installed correctly.

However, when I fill in the module path in my apache2/php.ini config like this: extension=/opt/sqlanywhere17/lib64/php-8.0.0_sqlanywhere_r.so the extension does not load.

I also added the environment variable in /etc/apache2/envvars:

```<code>LD_LIBRARY_PATH="/opt/sqlanywhere17/lib64:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH
</code>```

That's all I can find in the SAP documentation.

This is what PHP returns to me:

```<code>PHP Warning:  PHP Startup: sqlanywhere: Unable to initialize module
</code>```

Is there anything else to define? Is the SQL Anywhere version for PHP 8.0.0 compatible with a PHP version 8.1.y or even 8.2.y?

I am using a Debian 11.

I tried to initialize the PHP module of SQL Anywhere in the php.ini configuration, I expected to be able to use this module afterwards.

Title: SQL Anywhere 17 & PHP 8.x.y on Linux

Body:
I want to install PHP SQL Anywhere 17 module for PHP 8.1 version.

I am using the PHP 8.0.0 module provided in the SAP documentation (https://wiki.scn.sap.com/wiki/display/SQLANY/The+SAP+SQL+Anywhere+PHP+Module).
The driver is installed correctly.

However, when I fill in the module path in my apache2/php.ini config like this: extension=/opt/sqlanywhere17/lib64/php-8.0.0_sqlanywhere_r.so the extension does not load.

I also added the environment variable in /etc/apache2/envvars:

LD_LIBRARY_PATH="/opt/sqlanywhere17/lib64:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH

That's all I can find in the SAP documentation.

This is what PHP returns to me:

PHP Warning:  PHP Startup: sqlanywhere: Unable to initialize module

Is there anything else to define? Is the SQL Anywhere version for PHP 8.0.0 compatible with a PHP version 8.1.y or even 8.2.y?

I am using a Debian 11.

I tried to initialize the PHP module of SQL Anywhere in the php.ini configuration, I expected to be able to use this module afterwards.


问:
New Angular poject in a devcontainer: Access Denied
I am developing in Visual Studio Code (Windows) using the .devcontainer. I am doing some testing using django and angular frameworks. Everything is working perfectly but when inside the container I run the command ng new angular-14-crud-example I have some problems: if after this I restart for any reason Visual Studio Code, the devcontainer does not restart anymore and returns the following error:

failed to solve: error from sender: open C:\Users\user\project\angular-14-crud-example\node_modules\make-fetch-hap
pen\node_modules\mkdirp: Access denied.

Below are the details:

Django_Dockerfile:

```<code>FROM mcr.microsoft.com/devcontainers/anaconda:0-3

COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/

RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
    && rm -rf /tmp/conda-tmp

RUN pip install --upgrade pip

RUN mkdir /workspace
WORKDIR /workspace

COPY requirements.txt /workspace/
RUN pip install -r requirements.txt
COPY . /workspace/

</code>```

docker-compose.yml

```<code>version: '3.8'

services:
  app:
    build:
      context: ..
      dockerfile: .devcontainer/Django_Dockerfile
    env_file:
        - .env

    volumes:
      - ../..:/workspaces:cached

    # Overrides default command so things don't shut down after the process ends.
    command: sleep infinity

    # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
    network_mode: service:db

  db:
    image: postgres:latest
    restart: unless-stopped
    volumes:
      - postgres-data:/var/lib/postgresql/data
    env_file:
        - .env

volumes:
  postgres-data:
</code>```

devcontainer.json:

```<code>{
    "name": "Anaconda (Python 3) & PostgreSQL",
    "dockerComposeFile": "docker-compose.yml",
    "service": "app",
    "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
    "features": {
        "ghcr.io/devcontainers-contrib/features/angular-cli:1": {}
    },

}
</code>```

Some deteailed error Log

```<code>[2023-01-02T13:39:52.218Z] Dev Containers 0.266.1 in VS Code 1.74.2 (e8a3071ea4344d9d48ef8a4df2c097372b0c5161).
[2023-01-02T13:39:52.218Z] Start: Resolving Remote
[2023-01-02T13:39:52.268Z] Setting up container for folder or workspace: c:\Users\user\project
[2023-01-02T13:39:52.288Z] Start: Check Docker is running
[2023-01-02T13:39:52.290Z] Start: Run: docker version --format {{.Server.APIVersion}}
[2023-01-02T13:39:53.819Z] Stop (1529 ms): Run: docker version --format {{.Server.APIVersion}}
[2023-01-02T13:39:53.820Z] Server API version: 1.41
[2023-01-02T13:39:53.823Z] Stop (1535 ms): Check Docker is running
[2023-01-02T13:39:53.825Z] Start: Run: docker volume ls -q
[2023-01-02T13:39:54.907Z] Stop (1082 ms): Run: docker volume ls -q
[2023-01-02T13:39:55.293Z] Start: Run: docker ps -q -a --filter label=vsch.local.folder=c:\Users\user\project --filter label=vsch.quality=stable
[2023-01-02T13:39:56.247Z] Stop (954 ms): Run: docker ps -q -a --filter label=vsch.local.folder=c:\Users\user\project --filter label=vsch.quality=stable
[2023-01-02T13:39:56.248Z] Start: Run: C:\Users\user\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\user\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --workspace-folder c:\Users\user\project --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\Users\user\project --log-level debug --log-format json --config c:\Users\user\project\.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2023-01-02T13:39:57.189Z] (node:18596) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[2023-01-02T13:39:57.190Z] (Use `Code --trace-deprecation ...` to show where the warning was created)
[2023-01-02T13:39:57.194Z] @devcontainers/cli 0.25.2. Node.js v16.14.2. win32 10.0.19044 x64.
[2023-01-02T13:39:57.194Z] Start: Run: docker buildx version
[2023-01-02T13:39:59.057Z] Stop (1863 ms): Run: docker buildx version
[2023-01-02T13:39:59.058Z] github.com/docker/buildx v0.9.1 ed00243a0ce2a0aee75311b06e32d33b44729689
[2023-01-02T13:39:59.058Z]
[2023-01-02T13:39:59.059Z] Start: Resolving Remote
[2023-01-02T13:39:59.072Z] Start: Run: docker-compose version --short
[2023-01-02T13:40:01.002Z] Stop (1930 ms): Run: docker-compose version --short
[2023-01-02T13:40:01.003Z] Docker Compose version: 2.12.0
[2023-01-02T13:40:01.006Z] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=mydemo_devcontainer --filter label=com.docker.compose.service=app
[2023-01-02T13:40:02.023Z] Stop (1017 ms): Run: docker ps -q -a --filter label=com.docker.compose.project=mydemo_devcontainer --filter label=com.docker.compose.service=app
[2023-01-02T13:40:02.026Z] Start: Run: docker-compose -f c:\Users\user\project\.devcontainer\docker-compose.yml --profile * config
[2023-01-02T13:40:03.955Z] Stop (1929 ms): Run: docker-compose -f c:\Users\user\project\.devcontainer\docker-compose.yml --profile * config
[2023-01-02T13:40:03.955Z] name: devcontainer
services:
  app:
    build:
      context: c:\Users\user\project
      dockerfile: .devcontainer/Django_Dockerfile
    command:
    - sleep
    - infinity
    environment:
      POSTGRES_DB: postgres
      POSTGRES_HOST: localhost
      POSTGRES_PASSWORD: postgres
      POSTGRES_USER: postgres
    network_mode: service:db
    volumes:
    - type: bind
      source: c:\Users\user\project
      target: /workspaces
      bind:
        create_host_path: true
  db:
    environment:
      POSTGRES_DB: postgres
      POSTGRES_HOST: localhost
      POSTGRES_PASSWORD: postgres
      POSTGRES_USER: postgres
    image: postgres:latest
    networks:
      default: null
    restart: unless-stopped
    volumes:
    - type: volume
      source: postgres-data
      target: /var/lib/postgresql/data
      volume: {}
networks:
  default:
    name: devcontainer_default
volumes:
  postgres-data:
    name: devcontainer_postgres-data
[2023-01-02T13:40:03.969Z] Start: Run: docker events --format {{json .}} --filter event=start
[2023-01-02T13:40:04.315Z] PersistedPath=c:\Users\user\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data, ContainerHasLabels=false
[2023-01-02T13:40:04.320Z] Start: Run: docker-compose -f c:\Users\user\project\.devcontainer\docker-compose.yml --profile * config
[2023-01-02T13:40:06.248Z] Stop (1928 ms): Run: docker-compose -f c:\Users\user\project\.devcontainer\docker-compose.yml --profile * config
[2023-01-02T13:40:06.248Z] name: devcontainer
services:
  app:
    build:
      context: c:\Users\user\project
      dockerfile: .devcontainer/Django_Dockerfile
    command:
    - sleep
    - infinity
    environment:
      POSTGRES_DB: postgres
      POSTGRES_HOST: localhost
      POSTGRES_PASSWORD: postgres
      POSTGRES_USER: postgres
    network_mode: service:db
    volumes:
    - type: bind
      source: c:\Users\user\project
      target: /workspaces
      bind:
        create_host_path: true
  db:
    environment:
      POSTGRES_DB: postgres
      POSTGRES_HOST: localhost
      POSTGRES_PASSWORD: postgres
      POSTGRES_USER: postgres
    image: postgres:latest
    networks:
      default: null
    restart: unless-stopped
    volumes:
    - type: volume
      source: postgres-data
      target: /var/lib/postgresql/data
      volume: {}
networks:
  default:
    name: devcontainer_default
volumes:
  postgres-data:
    name: devcontainer_postgres-data
[2023-01-02T13:40:06.257Z] Start: Run: docker inspect --type image mcr.microsoft.com/devcontainers/anaconda:0-3
[2023-01-02T13:40:07.211Z] Stop (954 ms): Run: docker inspect --type image mcr.microsoft.com/devcontainers/anaconda:0-3
[2023-01-02T13:40:07.881Z] local container features stored at: c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\node_modules\vscode-dev-containers\container-features
[2023-01-02T13:40:07.887Z] Start: Run: tar --no-same-owner -x -f -
[2023-01-02T13:40:08.644Z] Stop (757 ms): Run: tar --no-same-owner -x -f -
[2023-01-02T13:40:08.661Z] * Processing feature: ghcr.io/devcontainers-contrib/features/angular-cli:1
[2023-01-02T13:40:09.393Z] * Fetching feature: angular-cli_1_oci
[2023-01-02T13:40:10.457Z] Start: Run: docker build -t dev_container_feature_content_temp -f C:\Users\D525C~1.SAN\AppData\Local\Temp\devcontainercli\container-features\0.25.2-1672666807879\Dockerfile.buildContent C:\Users\D525C~1.SAN\AppData\Local\Temp\devcontainercli\container-features\0.25.2-1672666807879
[2023-01-02T13:40:11.323Z]
[2023-01-02T13:40:12.053Z]
[...]
[2023-01-02T13:41:36.506Z]
[+] Building 78.3s (7/22)
 => [internal] load build definition from Dockerfile-with-features         0.1s
 => => transferring dockerfile: 3.36kB                                     0.0s
 => [internal] load .dockerignore                                          0.1s
 => => transferring context: 2B                                            0.0s
 => [internal] load metadata for docker.io/library/dev_container_feature_  0.0s
 => [internal] load metadata for mcr.microsoft.com/devcontainers/anaconda  0.4s
 => [dev_containers_feature_content_source 1/1] FROM docker.io/library/de  0.0s
 => [dev_container_auto_added_stage_label  1/11] FROM mcr.microsoft.com/d  0.0s
 => ERROR [internal] load build context                                   77.6s
 => => transferring context: 265.86MB                                     77.5s
------
 > [internal] load build context:
------
failed to solve: error from sender: open C:\Users\user\project\angular-14-crud-example\node_modules\make-fetch-hap
pen\node_modules\mkdirp: Accesso negato.
[2023-01-02T13:41:36.669Z] Stop (81610 ms): Run: docker-compose --project-name mydemo_devcontainer -f c:\Users\user\project\.devcontainer\docker-compose.yml -f c:\Users\user\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data\docker-compose\docker-compose.devcontainer.build-1672666815049.yml build
[2023-01-02T13:41:36.671Z] Error: Command failed: docker-compose --project-name mydemo_devcontainer -f c:\Users\user\project\.devcontainer\docker-compose.yml -f c:\Users\user\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data\docker-compose\docker-compose.devcontainer.build-1672666815049.yml build
[2023-01-02T13:41:36.671Z]     at pF (c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1850:431)
[2023-01-02T13:41:36.671Z]     at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[2023-01-02T13:41:36.672Z]     at async foe (c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1850:2457)
[2023-01-02T13:41:36.672Z]     at async loe (c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1832:2396)
[2023-01-02T13:41:36.672Z]     at async Poe (c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1899:2301)
[2023-01-02T13:41:36.672Z]     at async Zf (c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1899:3278)
[2023-01-02T13:41:36.673Z]     at async aue (c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:2020:15276)
[2023-01-02T13:41:36.673Z]     at async oue (c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:2020:15030)
[2023-01-02T13:41:36.707Z] Stop (100459 ms): Run: C:\Users\user\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\user\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --workspace-folder c:\Users\user\project --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\Users\user\project --log-level debug --log-format json --config c:\Users\user\project\.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2023-01-02T13:41:36.708Z] Exit code 1
[2023-01-02T13:41:36.716Z] Command failed: C:\Users\user\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\user\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --workspace-folder c:\Users\user\project --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\Users\user\project --log-level debug --log-format json --config c:\Users\user\project\.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2023-01-02T13:41:36.716Z] Exit code 1

</code>```

Body:
I am developing in Visual Studio Code (Windows) using the .devcontainer. I am doing some testing using django and angular frameworks. Everything is working perfectly but when inside the container I run the command ng new angular-14-crud-example I have some problems: if after this I restart for any reason Visual Studio Code, the devcontainer does not restart anymore and returns the following error:

failed to solve: error from sender: open C:\Users\user\project\angular-14-crud-example\node_modules\make-fetch-hap
pen\node_modules\mkdirp: Access denied.

Below are the details:

Django_Dockerfile:

FROM mcr.microsoft.com/devcontainers/anaconda:0-3

COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/

RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
    && rm -rf /tmp/conda-tmp

RUN pip install --upgrade pip

RUN mkdir /workspace
WORKDIR /workspace

COPY requirements.txt /workspace/
RUN pip install -r requirements.txt
COPY . /workspace/

docker-compose.yml

version: '3.8'

services:
  app:
    build:
      context: ..
      dockerfile: .devcontainer/Django_Dockerfile
    env_file:
        - .env

    volumes:
      - ../..:/workspaces:cached

    # Overrides default command so things don't shut down after the process ends.
    command: sleep infinity

    # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
    network_mode: service:db

  db:
    image: postgres:latest
    restart: unless-stopped
    volumes:
      - postgres-data:/var/lib/postgresql/data
    env_file:
        - .env

volumes:
  postgres-data:

devcontainer.json:

{
    "name": "Anaconda (Python 3) & PostgreSQL",
    "dockerComposeFile": "docker-compose.yml",
    "service": "app",
    "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
    "features": {
        "ghcr.io/devcontainers-contrib/features/angular-cli:1": {}
    },

}

Some deteailed error Log

[2023-01-02T13:39:52.218Z] Dev Containers 0.266.1 in VS Code 1.74.2 (e8a3071ea4344d9d48ef8a4df2c097372b0c5161).
[2023-01-02T13:39:52.218Z] Start: Resolving Remote
[2023-01-02T13:39:52.268Z] Setting up container for folder or workspace: c:\Users\user\project
[2023-01-02T13:39:52.288Z] Start: Check Docker is running
[2023-01-02T13:39:52.290Z] Start: Run: docker version --format {{.Server.APIVersion}}
[2023-01-02T13:39:53.819Z] Stop (1529 ms): Run: docker version --format {{.Server.APIVersion}}
[2023-01-02T13:39:53.820Z] Server API version: 1.41
[2023-01-02T13:39:53.823Z] Stop (1535 ms): Check Docker is running
[2023-01-02T13:39:53.825Z] Start: Run: docker volume ls -q
[2023-01-02T13:39:54.907Z] Stop (1082 ms): Run: docker volume ls -q
[2023-01-02T13:39:55.293Z] Start: Run: docker ps -q -a --filter label=vsch.local.folder=c:\Users\user\project --filter label=vsch.quality=stable
[2023-01-02T13:39:56.247Z] Stop (954 ms): Run: docker ps -q -a --filter label=vsch.local.folder=c:\Users\user\project --filter label=vsch.quality=stable
[2023-01-02T13:39:56.248Z] Start: Run: C:\Users\user\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\user\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --workspace-folder c:\Users\user\project --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\Users\user\project --log-level debug --log-format json --config c:\Users\user\project\.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2023-01-02T13:39:57.189Z] (node:18596) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[2023-01-02T13:39:57.190Z] (Use `Code --trace-deprecation ...` to show where the warning was created)
[2023-01-02T13:39:57.194Z] @devcontainers/cli 0.25.2. Node.js v16.14.2. win32 10.0.19044 x64.
[2023-01-02T13:39:57.194Z] Start: Run: docker buildx version
[2023-01-02T13:39:59.057Z] Stop (1863 ms): Run: docker buildx version
[2023-01-02T13:39:59.058Z] github.com/docker/buildx v0.9.1 ed00243a0ce2a0aee75311b06e32d33b44729689
[2023-01-02T13:39:59.058Z]
[2023-01-02T13:39:59.059Z] Start: Resolving Remote
[2023-01-02T13:39:59.072Z] Start: Run: docker-compose version --short
[2023-01-02T13:40:01.002Z] Stop (1930 ms): Run: docker-compose version --short
[2023-01-02T13:40:01.003Z] Docker Compose version: 2.12.0
[2023-01-02T13:40:01.006Z] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=mydemo_devcontainer --filter label=com.docker.compose.service=app
[2023-01-02T13:40:02.023Z] Stop (1017 ms): Run: docker ps -q -a --filter label=com.docker.compose.project=mydemo_devcontainer --filter label=com.docker.compose.service=app
[2023-01-02T13:40:02.026Z] Start: Run: docker-compose -f c:\Users\user\project\.devcontainer\docker-compose.yml --profile * config
[2023-01-02T13:40:03.955Z] Stop (1929 ms): Run: docker-compose -f c:\Users\user\project\.devcontainer\docker-compose.yml --profile * config
[2023-01-02T13:40:03.955Z] name: devcontainer
services:
  app:
    build:
      context: c:\Users\user\project
      dockerfile: .devcontainer/Django_Dockerfile
    command:
    - sleep
    - infinity
    environment:
      POSTGRES_DB: postgres
      POSTGRES_HOST: localhost
      POSTGRES_PASSWORD: postgres
      POSTGRES_USER: postgres
    network_mode: service:db
    volumes:
    - type: bind
      source: c:\Users\user\project
      target: /workspaces
      bind:
        create_host_path: true
  db:
    environment:
      POSTGRES_DB: postgres
      POSTGRES_HOST: localhost
      POSTGRES_PASSWORD: postgres
      POSTGRES_USER: postgres
    image: postgres:latest
    networks:
      default: null
    restart: unless-stopped
    volumes:
    - type: volume
      source: postgres-data
      target: /var/lib/postgresql/data
      volume: {}
networks:
  default:
    name: devcontainer_default
volumes:
  postgres-data:
    name: devcontainer_postgres-data
[2023-01-02T13:40:03.969Z] Start: Run: docker events --format {{json .}} --filter event=start
[2023-01-02T13:40:04.315Z] PersistedPath=c:\Users\user\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data, ContainerHasLabels=false
[2023-01-02T13:40:04.320Z] Start: Run: docker-compose -f c:\Users\user\project\.devcontainer\docker-compose.yml --profile * config
[2023-01-02T13:40:06.248Z] Stop (1928 ms): Run: docker-compose -f c:\Users\user\project\.devcontainer\docker-compose.yml --profile * config
[2023-01-02T13:40:06.248Z] name: devcontainer
services:
  app:
    build:
      context: c:\Users\user\project
      dockerfile: .devcontainer/Django_Dockerfile
    command:
    - sleep
    - infinity
    environment:
      POSTGRES_DB: postgres
      POSTGRES_HOST: localhost
      POSTGRES_PASSWORD: postgres
      POSTGRES_USER: postgres
    network_mode: service:db
    volumes:
    - type: bind
      source: c:\Users\user\project
      target: /workspaces
      bind:
        create_host_path: true
  db:
    environment:
      POSTGRES_DB: postgres
      POSTGRES_HOST: localhost
      POSTGRES_PASSWORD: postgres
      POSTGRES_USER: postgres
    image: postgres:latest
    networks:
      default: null
    restart: unless-stopped
    volumes:
    - type: volume
      source: postgres-data
      target: /var/lib/postgresql/data
      volume: {}
networks:
  default:
    name: devcontainer_default
volumes:
  postgres-data:
    name: devcontainer_postgres-data
[2023-01-02T13:40:06.257Z] Start: Run: docker inspect --type image mcr.microsoft.com/devcontainers/anaconda:0-3
[2023-01-02T13:40:07.211Z] Stop (954 ms): Run: docker inspect --type image mcr.microsoft.com/devcontainers/anaconda:0-3
[2023-01-02T13:40:07.881Z] local container features stored at: c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\node_modules\vscode-dev-containers\container-features
[2023-01-02T13:40:07.887Z] Start: Run: tar --no-same-owner -x -f -
[2023-01-02T13:40:08.644Z] Stop (757 ms): Run: tar --no-same-owner -x -f -
[2023-01-02T13:40:08.661Z] * Processing feature: ghcr.io/devcontainers-contrib/features/angular-cli:1
[2023-01-02T13:40:09.393Z] * Fetching feature: angular-cli_1_oci
[2023-01-02T13:40:10.457Z] Start: Run: docker build -t dev_container_feature_content_temp -f C:\Users\D525C~1.SAN\AppData\Local\Temp\devcontainercli\container-features\0.25.2-1672666807879\Dockerfile.buildContent C:\Users\D525C~1.SAN\AppData\Local\Temp\devcontainercli\container-features\0.25.2-1672666807879
[2023-01-02T13:40:11.323Z]
[2023-01-02T13:40:12.053Z]
[...]
[2023-01-02T13:41:36.506Z]
[+] Building 78.3s (7/22)
 => [internal] load build definition from Dockerfile-with-features         0.1s
 => => transferring dockerfile: 3.36kB                                     0.0s
 => [internal] load .dockerignore                                          0.1s
 => => transferring context: 2B                                            0.0s
 => [internal] load metadata for docker.io/library/dev_container_feature_  0.0s
 => [internal] load metadata for mcr.microsoft.com/devcontainers/anaconda  0.4s
 => [dev_containers_feature_content_source 1/1] FROM docker.io/library/de  0.0s
 => [dev_container_auto_added_stage_label  1/11] FROM mcr.microsoft.com/d  0.0s
 => ERROR [internal] load build context                                   77.6s
 => => transferring context: 265.86MB                                     77.5s
------
 > [internal] load build context:
------
failed to solve: error from sender: open C:\Users\user\project\angular-14-crud-example\node_modules\make-fetch-hap
pen\node_modules\mkdirp: Accesso negato.
[2023-01-02T13:41:36.669Z] Stop (81610 ms): Run: docker-compose --project-name mydemo_devcontainer -f c:\Users\user\project\.devcontainer\docker-compose.yml -f c:\Users\user\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data\docker-compose\docker-compose.devcontainer.build-1672666815049.yml build
[2023-01-02T13:41:36.671Z] Error: Command failed: docker-compose --project-name mydemo_devcontainer -f c:\Users\user\project\.devcontainer\docker-compose.yml -f c:\Users\user\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data\docker-compose\docker-compose.devcontainer.build-1672666815049.yml build
[2023-01-02T13:41:36.671Z]     at pF (c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1850:431)
[2023-01-02T13:41:36.671Z]     at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[2023-01-02T13:41:36.672Z]     at async foe (c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1850:2457)
[2023-01-02T13:41:36.672Z]     at async loe (c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1832:2396)
[2023-01-02T13:41:36.672Z]     at async Poe (c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1899:2301)
[2023-01-02T13:41:36.672Z]     at async Zf (c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1899:3278)
[2023-01-02T13:41:36.673Z]     at async aue (c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:2020:15276)
[2023-01-02T13:41:36.673Z]     at async oue (c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:2020:15030)
[2023-01-02T13:41:36.707Z] Stop (100459 ms): Run: C:\Users\user\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\user\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --workspace-folder c:\Users\user\project --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\Users\user\project --log-level debug --log-format json --config c:\Users\user\project\.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2023-01-02T13:41:36.708Z] Exit code 1
[2023-01-02T13:41:36.716Z] Command failed: C:\Users\user\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\user\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\user\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --workspace-folder c:\Users\user\project --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\Users\user\project --log-level debug --log-format json --config c:\Users\user\project\.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2023-01-02T13:41:36.716Z] Exit code 1


问:
How to go n levels up from a web address
I have some urls, How to go up n levels the web "address". with a n variable. for example if I have http://www.example.com/the/multi/part/path/file.ext and n=3 it gives: http://www.example.com/the/multi ?</p>


问:
Why do I need to do exposeHeaders when i see the values in the response?
I ran into an issue in which I could not get the value in my response header from a cross origin request. I figured out the answer, which was to configure my server to expose the header i needed (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers).

My question is why do I need to do that in order to have access to it in scripts, if I can actually see the value in the response in the network tab?


问:
Can't access Nginx server from local network (LAN)
I just installed Nginx and a service on port 8069. I able to access to my service from outside by using odoo.domain.com. But the problem is I can't access from local network (LAN).
If I try to access Nginx's IP then I can see Nginx default page but if I add ip:8069, it still not working.
Below is my Nginx config.</p>
```<code>server {
    server_name odoo.domain.com;
    listen 80;
    access_log /var/log/nginx/testing-access.log;
    error_log /var/log/nginx/testing-error.log;
#return 301 https://$host$request_uri;
listen 443 ssl http2;
#rewrite ^(.*) https://$host$1 permanent;
ssl_certificate /etc/letsencrypt/live/odoo.domain.com/fullchain.pem;
 ssl_certificate_key /etc/letsencrypt/live/odoo.domain.com/privkey.pem;
 ssl_session_timeout 1d;
 ssl_session_cache shared:MozSSL:10m;  # about 40000 sessions
 ssl_session_tickets off;
 ssl_protocols TLSv1.2 TLSv1.3;
# ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
# ssl_prefer_server_ciphers off;

    location /longpolling {
        proxy_connect_timeout   3600;
        proxy_read_timeout      3600;
        proxy_send_timeout      3600;
        send_timeout            3600;
        proxy_pass http://127.0.0.1:8072;
}
    location / {
        proxy_connect_timeout   3600;
        proxy_read_timeout      3600;
        proxy_send_timeout      3600;
        send_timeout            3600;
        proxy_pass http://127.0.0.1:8069/;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    gzip on;
    gzip_min_length 1000;
}
upstream odoo {
server 127.0.0.1:8069 weight=1 fail_timeout=0;
}
upstream odoo-im {
server 127.0.0.1:8072 weight=1 fail_timeout=0;
}
</code>```

Body:
I just installed Nginx and a service on port 8069. I able to access to my service from outside by using odoo.domain.com. But the problem is I can't access from local network (LAN).
If I try to access Nginx's IP then I can see Nginx default page but if I add ip:8069, it still not working.
Below is my Nginx config.

server {
    server_name odoo.domain.com;
    listen 80;
    access_log /var/log/nginx/testing-access.log;
    error_log /var/log/nginx/testing-error.log;
#return 301 https://$host$request_uri;
listen 443 ssl http2;
#rewrite ^(.*) https://$host$1 permanent;
ssl_certificate /etc/letsencrypt/live/odoo.domain.com/fullchain.pem;
 ssl_certificate_key /etc/letsencrypt/live/odoo.domain.com/privkey.pem;
 ssl_session_timeout 1d;
 ssl_session_cache shared:MozSSL:10m;  # about 40000 sessions
 ssl_session_tickets off;
 ssl_protocols TLSv1.2 TLSv1.3;
# ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
# ssl_prefer_server_ciphers off;

    location /longpolling {
        proxy_connect_timeout   3600;
        proxy_read_timeout      3600;
        proxy_send_timeout      3600;
        send_timeout            3600;
        proxy_pass http://127.0.0.1:8072;
}
    location / {
        proxy_connect_timeout   3600;
        proxy_read_timeout      3600;
        proxy_send_timeout      3600;
        send_timeout            3600;
        proxy_pass http://127.0.0.1:8069/;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    gzip on;
    gzip_min_length 1000;
}
upstream odoo {
server 127.0.0.1:8069 weight=1 fail_timeout=0;
}
upstream odoo-im {
server 127.0.0.1:8072 weight=1 fail_timeout=0;
}


问:
Access Data class property while using Generic Type parameter <T> in runtime [Kotlin]
I'm trying to return a property/value from Data class by checking type parameter

Data Class :

```<code>data class SystemConfiguration(
    val systemName: String,
    val fields: List<String>
)
</code>```

Abstract class :

```<code>abstract class ConfigurationLoader<out T> {
    abstract val clazz: Class<out T>

    private fun getAssociateAttribute(file: T): String{
        return when(clazz){
            SystemConfiguration::class.java -> file.systemName // Line causing error
            // If its another Data class, I should return value from that data class
            else -> ""
        }
    }

    open fun loadConfigurations(): Map<String, T>{

        val map = Paths.get(configurationFolderPath, filePath).toFile().walkTopDown().filter { it.isFile }.map {
            val x = ionSystem.loader.load(it)[0]
            ionValueMapper.readValue<List<T>>(x.toString())
        }.flatten().associateBy { getAssociateAttribute(it) }
    }
}

inline fun <reified T: Any> javaClasstype(): Class<T> {
    return T::class.java
}

</code>```

Sub class

```<code>class ServiceConfigurationLoader (
    override val clazz: Class<SystemConfiguration> = javaClasstype()

): ConfigurationLoader<SystemConfiguration>()
</code>```

I'm getting an exception "e: Unresolved reference: systemName". Not able to access values inside data class while we use type parameter

If i use like this(directly mentioning data class name), I'm able to access the values

```<code>private fun getAssociateAttribute(file: SystemConfiguration): String{
        return when(clazz){
            SystemConfiguration::class.java -> file.systemName
            else -> ""
        }
    }
</code>```

Could someone help me out here to access the value using Type paramater in Kotlin?

Thanks in Advance !!

I have tried using reified keyword as well. Still getting the same issue. I'm expecting to access the value using Type paramater

Body:
I'm trying to return a property/value from Data class by checking type parameter

Data Class :

data class SystemConfiguration(
    val systemName: String,
    val fields: List<String>
)

Abstract class :

abstract class ConfigurationLoader<out T> {
    abstract val clazz: Class<out T>

    private fun getAssociateAttribute(file: T): String{
        return when(clazz){
            SystemConfiguration::class.java -> file.systemName // Line causing error
            // If its another Data class, I should return value from that data class
            else -> ""
        }
    }

    open fun loadConfigurations(): Map<String, T>{

        val map = Paths.get(configurationFolderPath, filePath).toFile().walkTopDown().filter { it.isFile }.map {
            val x = ionSystem.loader.load(it)[0]
            ionValueMapper.readValue<List<T>>(x.toString())
        }.flatten().associateBy { getAssociateAttribute(it) }
    }
}

inline fun <reified T: Any> javaClasstype(): Class<T> {
    return T::class.java
}

Sub class

class ServiceConfigurationLoader (
    override val clazz: Class<SystemConfiguration> = javaClasstype()

): ConfigurationLoader<SystemConfiguration>()

I'm getting an exception "e: Unresolved reference: systemName". Not able to access values inside data class while we use type parameter

If i use like this(directly mentioning data class name), I'm able to access the values

private fun getAssociateAttribute(file: SystemConfiguration): String{
        return when(clazz){
            SystemConfiguration::class.java -> file.systemName
            else -> ""
        }
    }

Could someone help me out here to access the value using Type paramater in Kotlin?

Thanks in Advance !!

I have tried using reified keyword as well. Still getting the same issue. I'm expecting to access the value using Type paramater


问:
Google Apps Script copies spreadsheet every time I run the script
I'm trying to write a script that executes a function every time I open the spreadsheet the script is linked to.

But now every time I run the function, a copy of the spreadsheet is created and that definitely shouldn't happen.

I'm not sure if it might have to do with the triggers or type of deployment I set. I put a screenshot of the trigger here.

As the type of deployment I put web app.

The code in the script is pretty simple because I didn't want to go forward yet when the error is still happening. It looks like this:

function mediaplan() {

  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s_week = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Quick view - Week");
  var s_month = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Quick view - Month");
  var test = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Test");

  var currentWeek = Utilities.formatDate(new Date(), "GMT", "w");
  console.log(currentWeek);

}```

It would be great if someone could tell me what I did wrong or if it's an error by Google.

Thanks in advance!

Body:
I'm trying to write a script that executes a function every time I open the spreadsheet the script is linked to.

But now every time I run the function, a copy of the spreadsheet is created and that definitely shouldn't happen.

I'm not sure if it might have to do with the triggers or type of deployment I set. I put a screenshot of the trigger here.

As the type of deployment I put web app.

The code in the script is pretty simple because I didn't want to go forward yet when the error is still happening. It looks like this:

function mediaplan() {

  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s_week = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Quick view - Week");
  var s_month = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Quick view - Month");
  var test = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Test");

  var currentWeek = Utilities.formatDate(new Date(), "GMT", "w");
  console.log(currentWeek);

}

It would be great if someone could tell me what I did wrong or if it's an error by Google.

Thanks in advance!


问:
How to use an image retrieved from mongodb in Vue.js?
I'm just beginning my journey with mongodb.

I have stored a file in user.avatar field, I retrieve it and I don't know what to do with it, how to display it in vue.js.

I'm not using GridFs, because I'm ok with 16mb size limit

This is how I upload the file:

front:

```<code>socket.emit('upload', file, (status) => {
  // the file is as I get it from input type 'file'
  console.log(status);
})
</code>```

back (mongoose):

```<code>socket.on('upload', async (file) => {
  const user = await User.findById(socket.userId)
  user.avatar = file
  await user.save()
})
</code>```

After retrieving the file has type of string and it looks like this:

```<code>������JFIF�������������6Photoshop 3.0�8BIM����������g��Kb4QPpUVYjP2ntpNi0f5����C�����������������

���
�
�����������������) �� )/'%'/9339GDG]]}���C�����������������

���
�
�����������������) �� )/'%'/9339GDG]]}��������f����������������������������������������������������������������������������������]�����H������� ��R�D(��T(���������������
܀���D ���)
�R�R�$�B�
�!a$�������T���!@���,���
�����@�����������   �)
@R��H
@���*� ���������    �������;u��S����r �J�@�� ���������B�HR��Q@������    ��������������������������  �����
��)��
 �������@���$(����@m�������������Mp�    ��*B�����������������@����@��������@�������@����������� �@�����������T�B���������@�d (�aHU��?����~]Y���]J����
@
@�������Y�� *������ ������(�����
������������� �J������P�
@�� R��(�������(���
$� E��xY�R�-�X,�P�P����� ����������$(����    ��� ����P���!H��� ����������V�H������������(��B����P� �$,����!D�@���,ͬ�D�0�J؉�P�%a"�
�������A����������!`�����!@��@R�
@�����������R   ������@��!@���������@���������� �Lt�)�]+2,D�d��0�IR����t���}��[�����R���…
</code>```

Body:
I'm just beginning my journey with mongodb.

I have stored a file in user.avatar field, I retrieve it and I don't know what to do with it, how to display it in vue.js.

I'm not using GridFs, because I'm ok with 16mb size limit

This is how I upload the file:

front:

socket.emit('upload', file, (status) => {
  // the file is as I get it from input type 'file'
  console.log(status);
})

back (mongoose):

socket.on('upload', async (file) => {
  const user = await User.findById(socket.userId)
  user.avatar = file
  await user.save()
})

After retrieving the file has type of string and it looks like this:

������JFIF�������������6Photoshop 3.0�8BIM����������g��Kb4QPpUVYjP2ntpNi0f5����C�����������������

���
�
�����������������) �� )/'%'/9339GDG]]}���C�����������������

���
�
�����������������) �� )/'%'/9339GDG]]}��������f����������������������������������������������������������������������������������]�����H������� ��R�D(��T(���������������
܀���D ���)
�R�R�$�B�
�!a$�������T���!@���,���
�����@�����������   �)
@R��H
@���*� ���������    �������;u��S����r �J�@�� ���������B�HR��Q@������    ��������������������������  �����
��)��
 �������@���$(����@m�������������Mp�    ��*B�����������������@����@��������@�������@����������� �@�����������T�B���������@�d (�aHU��?����~]Y���]J����
@
@�������Y�� *������ ������(�����
������������� �J������P�
@�� R��(�������(���
$� E��xY�R�-�X,�P�P����� ����������$(����    ��� ����P���!H��� ����������V�H������������(��B����P� �$,����!D�@���,ͬ�D�0�J؉�P�%a"�
�������A����������!`�����!@��@R�
@�����������R   ������@��!@���������@���������� �Lt�)�]+2,D�d��0�IR����t���}��[�����R���…


问:
Gradle terminology: project vs build script
Trying to systematize my knowledge and reading Gradle documentation.
It states that "Projects contain a build script..." and "A single build can contain one or more projects and each project can contain their own subprojects".
So, Project contains a build script, or build script contains projects (and subprojects)?</p>


问:
Two Slick Slider: Make them move opposite directions
I'm using a slick slider as a vertical slider, I have created one and updated the second one by just changing the ID, and now both are working fine but running in equal directions.

My Scripts are below

```<code>// init slider
const slick_2 = $(".slides");
  slick_2.slick({
  dots: true,
  vertical: true,
  slidesToShow: 9,
  slidesToScroll:9,
  verticalSwiping: true,
  swipeToSlide: true,
  arrows: false,
  draggable: true,
  autoplay: true,
  autoplaySpeed: 2000,
  infinite: true,
  touchThreshold: 1000,responsive: [
      {
        breakpoint: 700,
        settings: {
        slidesToShow:4,
        slidesToScroll: 4,
        }
      }
    ]
});

// init slider
const slick_21 = $(".slides1");
slick_21.slick({
  dots: true,
  vertical: true,
  slidesToShow: 9,
  slidesToScroll:9,
  verticalSwiping: true,
  swipeToSlide: true,
  arrows: false,
  draggable: true,
  autoplay: true,
  autoplaySpeed: 2000,
  infinite: true,

  touchThreshold: 1000,  touchThreshold: 1000,responsive: [
      {
        breakpoint: 700,
        settings: {
        slidesToShow: 5,
        slidesToScroll: 5,
        }
      }
    ]
});
</code>```

both of these scripts are running vertically fine I want one to remain as it is and the other works in reverse order.

Body:
I'm using a slick slider as a vertical slider, I have created one and updated the second one by just changing the ID, and now both are working fine but running in equal directions.

My Scripts are below

// init slider
const slick_2 = $(".slides");
  slick_2.slick({
  dots: true,
  vertical: true,
  slidesToShow: 9,
  slidesToScroll:9,
  verticalSwiping: true,
  swipeToSlide: true,
  arrows: false,
  draggable: true,
  autoplay: true,
  autoplaySpeed: 2000,
  infinite: true,
  touchThreshold: 1000,responsive: [
      {
        breakpoint: 700,
        settings: {
        slidesToShow:4,
        slidesToScroll: 4,
        }
      }
    ]
});

// init slider
const slick_21 = $(".slides1");
slick_21.slick({
  dots: true,
  vertical: true,
  slidesToShow: 9,
  slidesToScroll:9,
  verticalSwiping: true,
  swipeToSlide: true,
  arrows: false,
  draggable: true,
  autoplay: true,
  autoplaySpeed: 2000,
  infinite: true,

  touchThreshold: 1000,  touchThreshold: 1000,responsive: [
      {
        breakpoint: 700,
        settings: {
        slidesToShow: 5,
        slidesToScroll: 5,
        }
      }
    ]
});

both of these scripts are running vertically fine I want one to remain as it is and the other works in reverse order.


问:
How to handle sever side user selection or select all in spring boot with ag-grid with user based?
i have scenario server side row model where by selecting the select all checkbox i have to select all rows(not on view port or displayed) i.e all 10K rows, that also want to  maintain as logged in user based,
so that each user row selection not interfere other user selection.
i am not rendering the all Data in ag-grid only 50 per page so to maintain in client browser is not  work for me. Backend i am using spring boot-mongoDb.</p>


问:
Image captioning of videogame screenshots using deep learning
I am looking for a way to caption screenshots from fantasy videogames like Genshin Impact. Does anyone have suggestions on which model I should use? In the case below, ClipCap gives as result digital art selected for the #.


问:
Draw a circle in paint in power-automate
I'm exploring PowerAutomate and am stuck with a relatively simple issue;

I want to click-and-drag to draw a yellow circle in Ms paint.

Currently, my flow looks like this:

start Paint ( Run application )

Select Yellow ( Click UI Element in Window)

Click mouse

Drag?

The last two points are not working / don't know how to do.

What is the best approach?


问:
About intellij idea config
Is it possible to somehow configure the intellij idea so that it warns when there are more than 100 characters on one line?
I would like to speed up my work in the editor, and I would like to decide such things in advance.</p>

Title: About intellij idea config


问:
firebase login and signup help in kivy Python code
i have it so when entering the info into the signup input boxes and hitting the submit button.. it saves into the realtimedb in firebase auth.. the problem comes when i want to authenticate a user and then if the user isn't in the db i need to display a message
basically my code is...

loginsignup.py

```<code>from kivy.core.text import LabelBase
from kivy.core.window import Window
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen,ScreenManager
from kivymd.app import MDApp

firebase = pyrebase.initialize_app(config)
auth = firebase.auth()

class MyFirebaseSignup:
    def sign_up(self, username, email, password, login_message=None):
        try:
            user = auth.create_user_with_email_and_password(email, password)
            data = {"email": email, "password": password, "idToken": True}
            info = auth.get_account_info(user["idToken"])
            auth.send_email_verification(user["idToken"])
            password = data.get("password")
            print("Successfully created account")
            #Go to login.kv page
        except:
            print("Invalid")
            #Display Error message from firebase id: signup_message (signup.kv)
    pass

class MyFirebaseLogin():
    def Login(self, email, password):
        try:
            login = auth.sign_in_with_email_and_password(email, password)
            info = auth.get_account_info(login["idToken"])
            print("The data of text field is : ",self.root.ids.data.login)
            print("Successfully Logged in")
            #Go to profile.kv page
        except:
            print("Invalid")
            #Display Error message from firebase id: login_message (login.kv)
    pass

.....
    def build(self):
        screen_manager = ScreenManager()
        screen_manager.add_widget(Builder.load_file("main.kv"))
        screen_manager.add_widget(Builder.load_file("signup.kv"))
        screen_manager.add_widget(Builder.load_file("login.kv"))
        screen_manager.add_widget(Builder.load_file("forgotpassword.kv"))
        screen_manager.add_widget(Builder.load_file("profile.kv"))
        self.my_firebasesignup = MyFirebaseSignup()
        self.my_firebaselogin = MyFirebaseLogin()
        #self.firebaseForgotPassword = MyFirebaseForgotPassword()
        return screen_manager

if __name__ == "__main__":
    LoginSignup().run()
</code>```

signup.kv

```<code><SignupScreen>:
MDScreen:
    name: "signup"
    id: signup
    MDFloatLayout:
            text: "Create a new account"
        MDLabel:
            id: signup_message
            color: (1,0,0,1)
        MDFloatLayout:
            TextInput:
                id: login_username
                hint_text: "Username"
                multiline: False
        MDFloatLayout:
            TextInput:
                id: login_email
                hint_text: "Email"
                multiline: False
        MDFloatLayout:
            TextInput:
                id: login_password
                hint_text: "Password"
                multiline: False
                password: True
        Button:
            text: "SIGNUP"
            on_release:
                print("Sign up", login_email.text, login_password.text)
                app.my_firebasesignup.sign_up(login_username.text,login_email.text,login_password.text)

        MDLabel:
            text: "Already have an account?"
        MDTextButton:
            text: "Sign in"
            on_release:
                root.manager.transition.direction = "left"
                root.manager.current = "login"
</code>```

login.kv

```<code><LoginScreen>:
MDScreen:
    name: "login"
    id: login
    MDFloatLayout:
        MDLabel:
            text: "Sign in to continue"
        MDLabel:
            id: login_message
            color: (1,0,0,1)
            TextInput:
                id: login_email
                hint_text: "Email"
                multiline: False
        MDFloatLayout:
            TextInput:
                id: login_password
                hint_text: "Password"
                multiline: False
                password: True
        Button:
            text: "LOGIN"
            on_release:
                print("Sign in", login_email.text, login_password.text)
                app.my_firebaselogin.Login(login_email.text,login_password.text)
        MDTextButton:
            text: "Forgot Password?"
            on_release:
                root.manager.transition.direction = "left"
                #root.manager.current = "forgotpassword"
        MDLabel:
            text: "Don't have an account?"
        MDTextButton:
            text: "Sign up"
            on_release:
                root.manager.transition.direction = "left"
                root.manager.current = "signup"
</code>```

i cant find in any of the tutorials online how to display the errors using a label or if successful to move forward to a new page

Basically how do i:

Once signed up successfully, then go to login.kv page ... if my other buttons on other screens to go on release, root.manager.current = "login"

If there is an error in the Signup details, display those details in the signup_message on the signup.kv page?

I took out the formatting, etc... and im sure it is so simple.. but i cant figure it out
once i know how to do it once... il be able to do it on the others, etc

Body:
i have it so when entering the info into the signup input boxes and hitting the submit button.. it saves into the realtimedb in firebase auth.. the problem comes when i want to authenticate a user and then if the user isn't in the db i need to display a message
basically my code is...

loginsignup.py

from kivy.core.text import LabelBase
from kivy.core.window import Window
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen,ScreenManager
from kivymd.app import MDApp

firebase = pyrebase.initialize_app(config)
auth = firebase.auth()

class MyFirebaseSignup:
    def sign_up(self, username, email, password, login_message=None):
        try:
            user = auth.create_user_with_email_and_password(email, password)
            data = {"email": email, "password": password, "idToken": True}
            info = auth.get_account_info(user["idToken"])
            auth.send_email_verification(user["idToken"])
            password = data.get("password")
            print("Successfully created account")
            #Go to login.kv page
        except:
            print("Invalid")
            #Display Error message from firebase id: signup_message (signup.kv)
    pass

class MyFirebaseLogin():
    def Login(self, email, password):
        try:
            login = auth.sign_in_with_email_and_password(email, password)
            info = auth.get_account_info(login["idToken"])
            print("The data of text field is : ",self.root.ids.data.login)
            print("Successfully Logged in")
            #Go to profile.kv page
        except:
            print("Invalid")
            #Display Error message from firebase id: login_message (login.kv)
    pass

.....
    def build(self):
        screen_manager = ScreenManager()
        screen_manager.add_widget(Builder.load_file("main.kv"))
        screen_manager.add_widget(Builder.load_file("signup.kv"))
        screen_manager.add_widget(Builder.load_file("login.kv"))
        screen_manager.add_widget(Builder.load_file("forgotpassword.kv"))
        screen_manager.add_widget(Builder.load_file("profile.kv"))
        self.my_firebasesignup = MyFirebaseSignup()
        self.my_firebaselogin = MyFirebaseLogin()
        #self.firebaseForgotPassword = MyFirebaseForgotPassword()
        return screen_manager

if __name__ == "__main__":
    LoginSignup().run()

signup.kv

<SignupScreen>:
MDScreen:
    name: "signup"
    id: signup
    MDFloatLayout:
            text: "Create a new account"
        MDLabel:
            id: signup_message
            color: (1,0,0,1)
        MDFloatLayout:
            TextInput:
                id: login_username
                hint_text: "Username"
                multiline: False
        MDFloatLayout:
            TextInput:
                id: login_email
                hint_text: "Email"
                multiline: False
        MDFloatLayout:
            TextInput:
                id: login_password
                hint_text: "Password"
                multiline: False
                password: True
        Button:
            text: "SIGNUP"
            on_release:
                print("Sign up", login_email.text, login_password.text)
                app.my_firebasesignup.sign_up(login_username.text,login_email.text,login_password.text)

        MDLabel:
            text: "Already have an account?"
        MDTextButton:
            text: "Sign in"
            on_release:
                root.manager.transition.direction = "left"
                root.manager.current = "login"

login.kv

<LoginScreen>:
MDScreen:
    name: "login"
    id: login
    MDFloatLayout:
        MDLabel:
            text: "Sign in to continue"
        MDLabel:
            id: login_message
            color: (1,0,0,1)
            TextInput:
                id: login_email
                hint_text: "Email"
                multiline: False
        MDFloatLayout:
            TextInput:
                id: login_password
                hint_text: "Password"
                multiline: False
                password: True
        Button:
            text: "LOGIN"
            on_release:
                print("Sign in", login_email.text, login_password.text)
                app.my_firebaselogin.Login(login_email.text,login_password.text)
        MDTextButton:
            text: "Forgot Password?"
            on_release:
                root.manager.transition.direction = "left"
                #root.manager.current = "forgotpassword"
        MDLabel:
            text: "Don't have an account?"
        MDTextButton:
            text: "Sign up"
            on_release:
                root.manager.transition.direction = "left"
                root.manager.current = "signup"

i cant find in any of the tutorials online how to display the errors using a label or if successful to move forward to a new page

Basically how do i:

Once signed up successfully, then go to login.kv page ... if my other buttons on other screens to go on release, root.manager.current = "login"

If there is an error in the Signup details, display those details in the signup_message on the signup.kv page?

I took out the formatting, etc... and im sure it is so simple.. but i cant figure it out
once i know how to do it once... il be able to do it on the others, etc


问:
Getting override error while setting up react-native-push-notification
I am getting override error when I set package in MainApplication.java. I am getting this error that i should use canOverrideExistingModule=true but i don't know how to set that up.

NOTE: I don't need firebase. I just need to setup local and scheduled notifications.

react-native: '0.70.5'
react-native-push-notification: "^8.1.1",

I have tried removing package from MainApplication.java but that doesn't work either.


问:
Chart in MVC application for date wise punch In-Out time
I am using visual studio 2019 and developing a MVC application. I want to render a chart between in-time (on Y-Axis) and attendance date (on X-Axis) for employee attendance date wise. I am getting all those data of the employee as an object list. Please refer screenshots. Attendance Date Object List

Punch In-Time Object List

I am using Chart.js (V 3.7.1) in MVC application. I have googled a lot but can't find the solution. I am new to this platform, please help me out to find out the solution to do that? Thanks in advance.

Here is my code of Action Method:

[HttpGet]

```<code>    public ActionResult BarChart()
    {
        try
        {
            List<object> iData = new List<object>();
            DataTable dt = new DataTable();
            using (OracleConnection con = new OracleConnection(AppSetting.OraConnectionString()))
            {
                string str = @"SELECT to_char(cast(EAE_DATE as date),'dd-MON-yy') AS EAE_DATE ,to_char(cast(IN_TIME as date),'hh24:mi:ss') AS IN_TIME,to_char(cast(OUT_TIME as date),'hh24:mi:ss') AS OUT_TIME FROM EMPLOYEE_DAILY_ATTENDANCE_EXL WHERE EAE_EM_ID = 904 AND EAE_YEAR=2022 AND EAE_MONTH=11 ORDER BY EAE_DATE";

                OracleDataAdapter da = new OracleDataAdapter(str, con);
                da.Fill(dt);
                foreach (DataColumn dc in dt.Columns)
                {
                    List<object> x = new List<object>();
                    x = (from DataRow drr in dt.Rows select drr[dc.ColumnName]).ToList();
                    iData.Add(x);
                }
                ViewBag.Date_List = iData[0];
                ViewBag.InTime_List = iData[1];
                ViewBag.OutTime_List = iData[2];

            }

            return View();
        }
        catch (Exception)
        {
            throw;
        }
    }
</code>```

And View code is:

@{
    ViewBag.Title = "BarChart";
}

    <canvas id="barcanvas"></canvas>

<meta name="viewport" content="width=device-width" />
<title>Attendance Punctuality</title>
@* I have installed Chart.js from ManageNugetPackages so not using the cdn *@

```

Body:
I am using visual studio 2019 and developing a MVC application. I want to render a chart between in-time (on Y-Axis) and attendance date (on X-Axis) for employee attendance date wise. I am getting all those data of the employee as an object list. Please refer screenshots. Attendance Date Object List

Punch In-Time Object List

I am using Chart.js (V 3.7.1) in MVC application. I have googled a lot but can't find the solution. I am new to this platform, please help me out to find out the solution to do that? Thanks in advance.

Here is my code of Action Method:

[HttpGet]

    public ActionResult BarChart()
    {
        try
        {
            List<object> iData = new List<object>();
            DataTable dt = new DataTable();
            using (OracleConnection con = new OracleConnection(AppSetting.OraConnectionString()))
            {
                string str = @"SELECT to_char(cast(EAE_DATE as date),'dd-MON-yy') AS EAE_DATE ,to_char(cast(IN_TIME as date),'hh24:mi:ss') AS IN_TIME,to_char(cast(OUT_TIME as date),'hh24:mi:ss') AS OUT_TIME FROM EMPLOYEE_DAILY_ATTENDANCE_EXL WHERE EAE_EM_ID = 904 AND EAE_YEAR=2022 AND EAE_MONTH=11 ORDER BY EAE_DATE";

                OracleDataAdapter da = new OracleDataAdapter(str, con);
                da.Fill(dt);
                foreach (DataColumn dc in dt.Columns)
                {
                    List<object> x = new List<object>();
                    x = (from DataRow drr in dt.Rows select drr[dc.ColumnName]).ToList();
                    iData.Add(x);
                }
                ViewBag.Date_List = iData[0];
                ViewBag.InTime_List = iData[1];
                ViewBag.OutTime_List = iData[2];

            }

            return View();
        }
        catch (Exception)
        {
            throw;
        }
    }

And View code is:

@{
    ViewBag.Title = "BarChart";
}

    <canvas id="barcanvas"></canvas>

<meta name="viewport" content="width=device-width" />
<title>Attendance Punctuality</title>
@* I have installed Chart.js from ManageNugetPackages so not using the cdn *@


问:
Sending message from content script to a single extension frame
I'm trying to send a message from the content script to the injected react app extension (MV3) in same singe tab.

I've tried to use chrome.runtime.sendMessage() but I saw that it triggers the eventListener in all of the tabs, therefore in each of the extension instances. I also saw that is mentioned in the docs -https://developer.chrome.com/docs/extensions/reference/tabs/#method-sendMessage

Is there an alternative for sending a message from the content script to the single tab?


问:
Can't call social media with vps
I buy a server from Hertzner and connected to the server with ssh protocol.
But I can't make a WhatsApp call or video call, what is the reason? Can someone help me please?</p>

Title: Can't call social media with vps


问:
How to navigate through code in Visual Studio Code in a .Net project like in Visual Studio?
How can you navigate through code in Visual Studio Code in a .Net project like in Visual Studio? What I mean is in Visual Studio I can see the active link to the source i.e. some interface, class, etc. In Visual Studio Code I only see the patch.  I know I can go to it with F12, but if there is a way to do it with mouse clicking?

Tried to serch some extensions but never found one.


问:
JS: Using dataset vs using (adhoc) properties
I need to store data (a string) on a certain HTML node.

This can be done via the dataset object

document.body.dataset.foo = 'bar';

Given the nature of JS however, node instances are also (just) objects, and thus you can also simply define a new property implicitly on the fly like so:

document.body.bar = 'foo';

Both methods fulfill the requirement of storing and then retrieving data of simple types.

I'm aware of the following differences:

dataset writes the the information as attribute on the node (data-{key}="{value}")

by using the subobject (dataset) you are less likely to overwrite an existing property

In my case, I would prefer not to have the information written as data-attribute, so I lean towards the property approach. Most sources on the internet however want you to use the dataset method.

Am I missing something here? Are there any other particularities to consider?


问:
Create pdf in memory or launch Byte[] as pdf to browser
Im currently working in a rather old system where we have already implemented functions for getting the filepath to a pdf which we launch to view in a browser. My current task is to implement functionality for us to also launch a pdf in our new storage (azure blob) which i will recieve as a Byte[]. I have a functioning version where i create a temporary pdf which i launch the same way as the older implementation and storage, but it is preferable if i could implement functionality where i do not have to create a physical copy of the pdf.

I have not gotten this to work sadly, does anyone have any idea if it is possible to save a pdf in memory without creating a physicla pdf file, or directly launch a byte[] as a pdf to the browser?

I would love for it to work similar to this where i have a local pdf document, but without creating the document itself.

string app = @"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";

string temp = "pdf as base64";

byte\[\] bytes = Convert.FromBase64String(temp);

System.IO.File.WriteAllBytes("newTest.pdf", bytes);

string path = Path.GetFullPath("newTest.pdf");

// whatever condition to launch
System.Diagnostics.Process.Start(app, path);
```


问:
Flappy bird game with AI - Genetics algorithm doesn't work properly
I have a flappy bird game built with p5.js, every bird in my game is a neural network with 4 inputs, 4 hidden nodes, and 1 output.
if the output is bigger than 0.5, the bird should jump.

I use the genetics algorithm to improve the neural network, and I mostly select the neural networks(birds) with the best weights and biases, which are determined by the fitness score, crossover the parents, mutate by a low rate, and pass the offspring on to the next generation.

So for total of 10 birds, in the next generation, there should be 10 offspring that are somewhat better than the last 10 birds' generation.

After printing the fitness scores of my birds, seems like even after 300 generations, there is no improvement in the fitness score of each individual bird.
The way I calculate fitness is by the score itself, the score is incrementing every frame for each bird, and the longer the bird stays alive, the higher the score is.

My first approach was to look for anything that could overwrite the next generation with a brand new array of birds, but I couldn't spot anything that does it.

nextGeneration():

```<code> const nextGeneration = () => {
  calculateFitness();
  for (let i = 0; i < TOTAL; i++) {
    // Select the most fit bird
    let bird1 = rouletteWheelSelection();
    print("Bird 1: " + bird1.fitness)
    // Select another most fit bird
    let bird2 = rouletteWheelSelection();
    print("Bird 2: " + bird2.fitness)
    // Use the crossover function to create an offspring from bird1 and bird2
    let offspringBrain = crossOver(bird1, bird2);
    // Mutate the offspring's brain with a small probability
    offspringBrain.mutate(0.1);
    // Add the offspring to the new population of birds
    birds[i] = new Bird(offspringBrain);
  }
  // Clear the saved birds for the next generation
  savedBirds = [];
}
</code>```

rouletteWheelSelection():

```<code>const rouletteWheelSelection = () => {
  //Sum of total fitness
  let totalFitness = 0
  savedBirds.forEach( element => {
      totalFitness += element.fitness
  });

  // Generate a random number between 0 and the total fitness
  const rand = Math.random() * totalFitness;

  // Select the chromosome with the corresponding fitness
  let fitnessSum = 0;
  for (let i = 0; i < savedBirds.length; i++) {
    fitnessSum += savedBirds[i].fitness;
      if (fitnessSum >= rand) return savedBirds[i];
  }
}
</code>```

crossOver():

```<code>const crossOver = (bird1, bird2) => {
  // Create a new NeuralNetwork by cloning bird1's brain
  let offspring = bird1.brain.copy()

  // Select a random point to split the weights and biases
  let splitPoint = Math.floor(Math.random() * offspring.weights_ih.data.length);

  // Cross over the weights and biases of bird1 and bird2 at the split point
  for (let i = splitPoint; i < offspring.weights_ih.data.length; i++) {
    offspring.weights_ih.data[i] = bird2.brain.weights_ih.data[i];
    offspring.weights_ho.data[i] = bird2.brain.weights_ho.data[i];
    offspring.bias_h.data[i] = bird2.brain.bias_h.data[i];
    offspring.bias_o.data[i] = bird2.brain.bias_o.data[i];
  }

  return offspring;
}
</code>```

draw() in the main sketch.js file:

```<code>function draw() {
  if (counter % 150 == 0) {
  pipes.push(new Pipe());
  }
  counter++;
  for (var i = pipes.length - 1; i >= 0; i--) {
    pipes[i].update();

    for (let j = birds.length - 1; j >= 0; j--) {

      if (pipes[i].hits(birds[j])) {
        savedBirds.push(birds.splice(j, 1)[0]);
      }

      if (pipes[i].offscreen()) {
        pipes.splice(i, 1);
      }
    }
  }
  for (let bird of birds) {
    bird.think(pipes);
    bird.update();
  }
  if (birds.length == 0 ) {
    counter = 0;
    nextGeneration();
    pipes = [];
  }
  background(bgImg);
  for (let bird of birds) {
    bird.show();
  }
  for (let pipe of pipes) {
    pipe.show();
  }
}
</code>```

Another approach I had in mind, was to look at the game side itself, and see if there's any issue in the way that the birds try to predict the output, but it does seem like the input nodes are correct.

think() in Bird.js:

```<code>   think(pipes) {
    //Find closest pipe
    let closest = null;
    let closestD = Infinity;
    for (let i = 0; i < pipes.length; i++) {
        let d = pipes[i].x - this.x;
        if (d < closestD && d > 0) {
         closest = pipes[i];
         closestD = d;
        }
    }
    let inputs = [];
    inputs[0] = this.y / height; // bird's y
    inputs[1] = closest.top / height; // top pipe's y
    inputs[2] = closest.bottom / height; // bottom pipe's y
    inputs[3] = closest.x / width;  // pipes' x
    let output = this.brain.predict(inputs); // predict if bird should jump
    if (output[0] > 0.5) {
      this.up()
    }
  }
</code>```

What am I missing?

Body:
I have a flappy bird game built with p5.js, every bird in my game is a neural network with 4 inputs, 4 hidden nodes, and 1 output.
if the output is bigger than 0.5, the bird should jump.

I use the genetics algorithm to improve the neural network, and I mostly select the neural networks(birds) with the best weights and biases, which are determined by the fitness score, crossover the parents, mutate by a low rate, and pass the offspring on to the next generation.

So for total of 10 birds, in the next generation, there should be 10 offspring that are somewhat better than the last 10 birds' generation.

After printing the fitness scores of my birds, seems like even after 300 generations, there is no improvement in the fitness score of each individual bird.
The way I calculate fitness is by the score itself, the score is incrementing every frame for each bird, and the longer the bird stays alive, the higher the score is.

My first approach was to look for anything that could overwrite the next generation with a brand new array of birds, but I couldn't spot anything that does it.

nextGeneration():

 const nextGeneration = () => {
  calculateFitness();
  for (let i = 0; i < TOTAL; i++) {
    // Select the most fit bird
    let bird1 = rouletteWheelSelection();
    print("Bird 1: " + bird1.fitness)
    // Select another most fit bird
    let bird2 = rouletteWheelSelection();
    print("Bird 2: " + bird2.fitness)
    // Use the crossover function to create an offspring from bird1 and bird2
    let offspringBrain = crossOver(bird1, bird2);
    // Mutate the offspring's brain with a small probability
    offspringBrain.mutate(0.1);
    // Add the offspring to the new population of birds
    birds[i] = new Bird(offspringBrain);
  }
  // Clear the saved birds for the next generation
  savedBirds = [];
}

rouletteWheelSelection():

const rouletteWheelSelection = () => {
  //Sum of total fitness
  let totalFitness = 0
  savedBirds.forEach( element => {
      totalFitness += element.fitness
  });

  // Generate a random number between 0 and the total fitness
  const rand = Math.random() * totalFitness;

  // Select the chromosome with the corresponding fitness
  let fitnessSum = 0;
  for (let i = 0; i < savedBirds.length; i++) {
    fitnessSum += savedBirds[i].fitness;
      if (fitnessSum >= rand) return savedBirds[i];
  }
}

crossOver():

const crossOver = (bird1, bird2) => {
  // Create a new NeuralNetwork by cloning bird1's brain
  let offspring = bird1.brain.copy()

  // Select a random point to split the weights and biases
  let splitPoint = Math.floor(Math.random() * offspring.weights_ih.data.length);

  // Cross over the weights and biases of bird1 and bird2 at the split point
  for (let i = splitPoint; i < offspring.weights_ih.data.length; i++) {
    offspring.weights_ih.data[i] = bird2.brain.weights_ih.data[i];
    offspring.weights_ho.data[i] = bird2.brain.weights_ho.data[i];
    offspring.bias_h.data[i] = bird2.brain.bias_h.data[i];
    offspring.bias_o.data[i] = bird2.brain.bias_o.data[i];
  }

  return offspring;
}

draw() in the main sketch.js file:

function draw() {
  if (counter % 150 == 0) {
  pipes.push(new Pipe());
  }
  counter++;
  for (var i = pipes.length - 1; i >= 0; i--) {
    pipes[i].update();

    for (let j = birds.length - 1; j >= 0; j--) {

      if (pipes[i].hits(birds[j])) {
        savedBirds.push(birds.splice(j, 1)[0]);
      }

      if (pipes[i].offscreen()) {
        pipes.splice(i, 1);
      }
    }
  }
  for (let bird of birds) {
    bird.think(pipes);
    bird.update();
  }
  if (birds.length == 0 ) {
    counter = 0;
    nextGeneration();
    pipes = [];
  }
  background(bgImg);
  for (let bird of birds) {
    bird.show();
  }
  for (let pipe of pipes) {
    pipe.show();
  }
}

Another approach I had in mind, was to look at the game side itself, and see if there's any issue in the way that the birds try to predict the output, but it does seem like the input nodes are correct.

think() in Bird.js:

   think(pipes) {
    //Find closest pipe
    let closest = null;
    let closestD = Infinity;
    for (let i = 0; i < pipes.length; i++) {
        let d = pipes[i].x - this.x;
        if (d < closestD && d > 0) {
         closest = pipes[i];
         closestD = d;
        }
    }
    let inputs = [];
    inputs[0] = this.y / height; // bird's y
    inputs[1] = closest.top / height; // top pipe's y
    inputs[2] = closest.bottom / height; // bottom pipe's y
    inputs[3] = closest.x / width;  // pipes' x
    let output = this.brain.predict(inputs); // predict if bird should jump
    if (output[0] > 0.5) {
      this.up()
    }
  }

What am I missing?


问:
add members of team to SfCalendar
i am  SfCalendar package, to show all the meeting base on date, which is like

but now i have a list of members attached to the Meeting which i want to show at the bottom of the time.

here is my sample code

```<code>class _AllShiftState extends State<AllShift> {
  List<Meeting> _getDataSource() {
    final List<Meeting> meetings = <Meeting>[];
    final DateTime today = DateTime.now();
    final DateTime startTime = DateTime(today.year, today.month, today.day, 9);
    final DateTime endTime = startTime.add(const Duration(hours: 2));
    meetings.add(
      Meeting('Conference', startTime, endTime, const Color(0xFF0F8644), false,
          [""]),
    );
    return meetings;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SfCalendar(
        onTap: (va) {},
        view: CalendarView.schedule,
        appointmentTextStyle: const TextStyle(
          fontSize: 14,
        ),
        dataSource: MeetingDataSource(_getDataSource()),
        monthViewSettings: const MonthViewSettings(
          appointmentDisplayMode: MonthAppointmentDisplayMode.appointment,
        ),
      ),
    );
  }
}
</code>```

here is the class that extend the CalendarDataSource

```<code>class MeetingDataSource extends CalendarDataSource {
  /// Creates a meeting data source, which used to set the appointment
  /// collection to the calendar
  MeetingDataSource(List<Meeting> source) {
    appointments = source;
  }

  @override
  DateTime getStartTime(int index) {
    return _getMeetingData(index).from;
  }

  @override
  DateTime getEndTime(int index) {
    return _getMeetingData(index).to;
  }

  @override
  String getSubject(int index) {
    return _getMeetingData(index).eventName;
  }

  @override
  Color getColor(int index) {
    return _getMeetingData(index).background;
  }

  List<String> getMembers(int index) {
    return _getMeetingData(index).members;
  }

  @override
  bool isAllDay(int index) {
    return _getMeetingData(index).isAllDay;
  }

  Meeting _getMeetingData(int index) {
    final dynamic meeting = appointments![index];
    late final Meeting meetingData;
    if (meeting is Meeting) {
      meetingData = meeting;
    }

    return meetingData;
  }
}
</code>```

Title: add members of team to SfCalendar

Body:
i am  SfCalendar package, to show all the meeting base on date, which is like

but now i have a list of members attached to the Meeting which i want to show at the bottom of the time.

here is my sample code

class _AllShiftState extends State<AllShift> {
  List<Meeting> _getDataSource() {
    final List<Meeting> meetings = <Meeting>[];
    final DateTime today = DateTime.now();
    final DateTime startTime = DateTime(today.year, today.month, today.day, 9);
    final DateTime endTime = startTime.add(const Duration(hours: 2));
    meetings.add(
      Meeting('Conference', startTime, endTime, const Color(0xFF0F8644), false,
          [""]),
    );
    return meetings;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SfCalendar(
        onTap: (va) {},
        view: CalendarView.schedule,
        appointmentTextStyle: const TextStyle(
          fontSize: 14,
        ),
        dataSource: MeetingDataSource(_getDataSource()),
        monthViewSettings: const MonthViewSettings(
          appointmentDisplayMode: MonthAppointmentDisplayMode.appointment,
        ),
      ),
    );
  }
}

here is the class that extend the CalendarDataSource

class MeetingDataSource extends CalendarDataSource {
  /// Creates a meeting data source, which used to set the appointment
  /// collection to the calendar
  MeetingDataSource(List<Meeting> source) {
    appointments = source;
  }

  @override
  DateTime getStartTime(int index) {
    return _getMeetingData(index).from;
  }

  @override
  DateTime getEndTime(int index) {
    return _getMeetingData(index).to;
  }

  @override
  String getSubject(int index) {
    return _getMeetingData(index).eventName;
  }

  @override
  Color getColor(int index) {
    return _getMeetingData(index).background;
  }

  List<String> getMembers(int index) {
    return _getMeetingData(index).members;
  }

  @override
  bool isAllDay(int index) {
    return _getMeetingData(index).isAllDay;
  }

  Meeting _getMeetingData(int index) {
    final dynamic meeting = appointments![index];
    late final Meeting meetingData;
    if (meeting is Meeting) {
      meetingData = meeting;
    }

    return meetingData;
  }
}


问:
App icon not showing after playstore publishing
Iam having an issue, My app is fully ready and good to go, I have published the app on playstore and it's successfully got listed aswell. Know iam seeing that app icon is by default Android icon not my desired our wanted logo. If anyone know how to fix this please consider replying my question. I have attached a picture of it.

I tried to change app icon in launcher image assets in apk mode it's working fine. when iam generating signed bundle for play store publishing aab file is it's the issue.


问:
Border colors of button:active not working as set out
I have styled a button which switches colors of its' borders depending on if its clicked or not (button:focus, button:active). The issue is that the colors do not change on button:focus, only on button:active. Other changes (such as adjusting background picture) of the state of button:focus works just fine.

Here's the CSS:

```<code>    .buttonrod {
      background:url(https://i.imgur.com/MtHnHtP.png) no-repeat;
      background-position: 0px -30px;
      position:relative;
      background-size:cover;
      width: 150px;
      height: 150px;
      text-decoration: none;
      display: inline-block;
      margin-left: 120px;
      font-size: 12px;
      cursor: pointer;
    font-weight: bold;
    border-color:transparent;
        color: #E4B018;
      text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
      border-color: #757575 #2a2a2a #2a2a2a #757575;
    }
    .buttonrod:focus {
      border-color: #2a2a2a #757575 #757575 #2a2a2a;
      background-position: 0px -29px;
      outline: none;
    }
    .buttonrod:active {
      border-color: #2a2a2a #757575 #757575 #2a2a2a;
      background-position: 0px -29px;
      outline: none;
    }
</code>```

For some reason, the color of the border in the :focus state defaults to a light grey all around, instead of the different shadings I have attached. It's driving me insane. I added the line to adjust the image to create the illusion of a pressed button, and that worked both for focus and active. I am clueless, and any help is appreciated.

Body:
I have styled a button which switches colors of its' borders depending on if its clicked or not (button:focus, button:active). The issue is that the colors do not change on button:focus, only on button:active. Other changes (such as adjusting background picture) of the state of button:focus works just fine.

Here's the CSS:

    .buttonrod {
      background:url(https://i.imgur.com/MtHnHtP.png) no-repeat;
      background-position: 0px -30px;
      position:relative;
      background-size:cover;
      width: 150px;
      height: 150px;
      text-decoration: none;
      display: inline-block;
      margin-left: 120px;
      font-size: 12px;
      cursor: pointer;
    font-weight: bold;
    border-color:transparent;
        color: #E4B018;
      text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
      border-color: #757575 #2a2a2a #2a2a2a #757575;
    }
    .buttonrod:focus {
      border-color: #2a2a2a #757575 #757575 #2a2a2a;
      background-position: 0px -29px;
      outline: none;
    }
    .buttonrod:active {
      border-color: #2a2a2a #757575 #757575 #2a2a2a;
      background-position: 0px -29px;
      outline: none;
    }

For some reason, the color of the border in the :focus state defaults to a light grey all around, instead of the different shadings I have attached. It's driving me insane. I added the line to adjust the image to create the illusion of a pressed button, and that worked both for focus and active. I am clueless, and any help is appreciated.


问:
Assembly Code Behaves Funny / Unexpected - ASM x86-64 Bit (AT&T, GAS)

My setup

OS: ------------------ Linux

Architecture: ------ x86-64

Syntax: ------------ AT&T

Compiler: --------- GAS

My code

(explanation below)

.section .text
.globl _start
print:
  movq $1, %rax
  movq $1, %rdi
  movq %rsp, %rsi
  popq %rbx
  popq %rdx

  # Useless Instructions...
  xor %rcx, %rcx    # 36
  xor %rcx, %rcx    # 39
  xor %rcx, %rcx    # 42
  xor %rcx, %rcx    # 45
  xor %rcx, %rcx    # 48
  xor %rcx, %rcx    # 51
  xor %rcx, %rcx    # 54
  xor %rcx, %rcx    # 57
  xor %rcx, %rcx    # 60
  xor %rcx, %rcx    # 63
  xor %rcx, %rcx    # 66

  syscall
  jmp end
  ret

_start:
  pushq $66
  pushq $1
  call print
end:
  movq $60, %rax
  xor %rdi, %rdi
  syscall
```

Output: "B"

Explanation

Okay here comes the thing. As you see, I want to:

Push $66 ($'B') to the stack

Call the print function

Mov the $66 into the %rsi register

Write to STDOUT with the linux syscall 1, which is the linux _write syscall

Jmp to the end label, otherwise the Error: segmentation fault (core dumped) gets raised

What's wrong

I expect it to output "B", which it does. So where is the problem you may ask? You probably already saw that bunch of xor %rcx, %rcx's.

Let me explain what they do:

For some reason it starts at 33 ("!")

For every instruction I add to this code, it adds 3 to this number

So I added 11 instructions, and the 33 became 66 (33 + 11*3 = 66), which is "B" in ASCII

Without the 11 xor-instructions, it prints "!" which has the ASCII value of 33.

Note: xor %rcx, %rcx is just some instruction. It can be every instruction and every instruction has the value of 3.

That means

I can add as many instructions as I want, to print every ASCII value over 33.

Example:

If I want to echo an "H", all I have to do is to add 2 more xor %rcx, %rcx instructions.

Calculation: 66 ("B") + 3 (1 instruction) + 3 (1 instruction) = 72 ("H")

Final Question

Why? Just why? I just started with x86 ASM, so I am completely new to it. There are clearly some obvious things I am missing here... I just played around a bit and stumbled across this.

Can you help me answer these questions?

How does it work?

How can it affect the output / RSI register?

Why does it start at 33?

Any ideas on how to fix this?

My guess is, it has to do something with the Instruction Pointer, but I have no clue...

Thank you for your help :)

Body:
My setup

OS: ------------------ Linux

Architecture: ------ x86-64

Syntax: ------------ AT&T

Compiler: --------- GAS

My code

(explanation below)

.section .text
.globl _start
print:
  movq $1, %rax
  movq $1, %rdi
  movq %rsp, %rsi
  popq %rbx
  popq %rdx

  # Useless Instructions...
  xor %rcx, %rcx    # 36
  xor %rcx, %rcx    # 39
  xor %rcx, %rcx    # 42
  xor %rcx, %rcx    # 45
  xor %rcx, %rcx    # 48
  xor %rcx, %rcx    # 51
  xor %rcx, %rcx    # 54
  xor %rcx, %rcx    # 57
  xor %rcx, %rcx    # 60
  xor %rcx, %rcx    # 63
  xor %rcx, %rcx    # 66

  syscall
  jmp end
  ret

_start:
  pushq $66
  pushq $1
  call print
end:
  movq $60, %rax
  xor %rdi, %rdi
  syscall

Output: "B"

Explanation

Okay here comes the thing. As you see, I want to:

Push $66 ($'B') to the stack

Call the print function

Mov the $66 into the %rsi register

Write to STDOUT with the linux syscall 1, which is the linux _write syscall

Jmp to the end label, otherwise the Error: segmentation fault (core dumped) gets raised

What's wrong

I expect it to output "B", which it does. So where is the problem you may ask? You probably already saw that bunch of xor %rcx, %rcx's.

Let me explain what they do:

For some reason it starts at 33 ("!")

For every instruction I add to this code, it adds 3 to this number

So I added 11 instructions, and the 33 became 66 (33 + 11*3 = 66), which is "B" in ASCII

Without the 11 xor-instructions, it prints "!" which has the ASCII value of 33.

Note: xor %rcx, %rcx is just some instruction. It can be every instruction and every instruction has the value of 3.

That means

I can add as many instructions as I want, to print every ASCII value over 33.

Example:

If I want to echo an "H", all I have to do is to add 2 more xor %rcx, %rcx instructions.

Calculation: 66 ("B") + 3 (1 instruction) + 3 (1 instruction) = 72 ("H")

Final Question

Why? Just why? I just started with x86 ASM, so I am completely new to it. There are clearly some obvious things I am missing here... I just played around a bit and stumbled across this.

Can you help me answer these questions?

How does it work?

How can it affect the output / RSI register?

Why does it start at 33?

Any ideas on how to fix this?

My guess is, it has to do something with the Instruction Pointer, but I have no clue...

Thank you for your help :)


问:
Serverside validation of a timer-value send from the frontend
I have the following problem:

in my frontend, there is a timer a user can start and stop with the push of a button.
The Timer- value then is send to the backend where it should be stored in a database.
Now, i want to make sure that the timer- value hasnt been altered by the user.

The timer must run in the frontend to be as accurate as possible.

i can imagine this being a problem in online games, do you know of any methods to validate the timer?

"Solutions" i have already thought of:
use a Hash to encrypt the timer value before sending it to the backend.
this isnt secure enough.

When starting and ending the timer, store the start and end date in the backend to then compare it to the timervalue.
this doesnt work, because a user would only try to make the timer-value smaller. if i would compare the timer value to dates i saved in the backend, it would only be an upper bound, but not a lower bound.