问:
can't build spring boot application using gradle and ipv6 network
I am trying to build a spring boot application in a VM with ipv6 network using Gradle, I seccedded to download the wrapper using this command :

```<code>sh gradlew -Djava.net.preferIPv6Addresses=true clean bootWar -Pstage
</code>```

But I got the following issue :

```<code>FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':buildSrc:runtimeClasspath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0.
  Required by:
      project :buildSrc
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0.
      > Could not get resource 'https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
         > Could not GET 'https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
            > Network is unreachable
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0.
      > Could not get resource 'https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
         > Could not GET 'https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
            > Network is unreachable
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0.
      > Could not get resource 'https://ipv6.repo1.maven.org/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
         > Could not GET 'https://ipv6.repo1.maven.org/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
            > Network is unreachable

</code>```

PS:

the spring-boot-gradle-plugin is able to be downloaded using the wget command

I tried also to set some flags in JAVA_OPT like -Djava.net.preferIPv6Addresses=true and -Djava.net.preferIPv4Stack=true but nothing is changed

Body:
I am trying to build a spring boot application in a VM with ipv6 network using Gradle, I seccedded to download the wrapper using this command :

sh gradlew -Djava.net.preferIPv6Addresses=true clean bootWar -Pstage

But I got the following issue :

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':buildSrc:runtimeClasspath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0.
  Required by:
      project :buildSrc
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0.
      > Could not get resource 'https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
         > Could not GET 'https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
            > Network is unreachable
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0.
      > Could not get resource 'https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
         > Could not GET 'https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
            > Network is unreachable
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0.
      > Could not get resource 'https://ipv6.repo1.maven.org/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
         > Could not GET 'https://ipv6.repo1.maven.org/org/springframework/boot/spring-boot-gradle-plugin/3.0.0/spring-boot-gradle-plugin-3.0.0.pom'.
            > Network is unreachable

PS:

the spring-boot-gradle-plugin is able to be downloaded using the wget command

I tried also to set some flags in JAVA_OPT like -Djava.net.preferIPv6Addresses=true and -Djava.net.preferIPv4Stack=true but nothing is changed


来源: stackexchange

问:
How to effectively document analytical events?
can you tell me how to effectively document analytical events (clicks on buttons, etc. for websites) for further easy updating and easy work of different teams on one product with the ability to change events and so on (because the design of the website changes often).

I currently use excel with event, description, additional parameters, and a screenshot of the place with the button.

I wonder how other people do it, maybe there are already good tools for such tasks. Share your ideas if you don't mind, I would be grateful.

ContentLicense: CC BY-SA 4.0


问:
Why cant I save a user with picture on Azure, while it works locally?
I have a create method which works fine in localhost. It looks like this:

```<code>
public PatientViewModel Create(PatientViewModel model)
{
    try
    {
        model.patient!.photoPath = (model.file != null) ? UploadFile(model.file) : "placeholder.png";
        model.patient.appUser = appuserAwhole(model);
        model.patient.appUser.user = (!model.mode) ? model.user : model.Users!.Where(r => r.userId == model.userid).First();
        _idb.patients.Add(model.patient);
        idbSaveChanges();
        Patientfile pf = new Patientfile();
        pf.patientMail = model.patient.emailAddress;
        _fdb.patientfiles.Add(pf);
        fdbSaveChanges();
    }
    catch (Exception e) {
        System.Diagnostics.Debug.WriteLine(e.Message);
    }
    return model;
}
</code>```

This is my UploadFile method:

```<code>private string UploadFile(IFormFile photo)
{
    string wwwPath = this._env.WebRootPath;
    string contentPath = this._env.ContentRootPath;

    string path = Path.Combine(wwwPath, "img\\PatientPhotos");
    if (!Directory.Exists(path))
    {
        Directory.CreateDirectory(path);
    }

    if (photo == null)
    {
        return "default.png";
    }
    string fileName = Path.GetFileName(photo.FileName);
    using (FileStream stream = new FileStream(Path.Combine(path, fileName), FileMode.Create))
    {
        photo.CopyTo(stream);
    }

    return fileName;
}
</code>```

I first get the wwwroot path and use this to save my image. If the image already exist, it uses the image thats already saved (i know this isnt ideal, but it works for me for now).

When I upload a file in localhost and submit, the patient gets saved and so does the image (in wwwroot). On Azure however, the patient and the image dont get saved.

When I dont upload a file, it automatically uses placeholder.png. Now the patient does get saved on Azure, but no image, since none was selected.

Im not getting any errors (probably because its in a production environment), it just returns to the Index page after submitting, without saving anything

In my controller you return to the Index page after creating the patient:

```<code>_db.Create(vm);
return RedirectToAction("Index");
</code>```

Is there any way to fix this problem?

Body:
I have a create method which works fine in localhost. It looks like this:

public PatientViewModel Create(PatientViewModel model)
{
    try
    {
        model.patient!.photoPath = (model.file != null) ? UploadFile(model.file) : "placeholder.png";
        model.patient.appUser = appuserAwhole(model);
        model.patient.appUser.user = (!model.mode) ? model.user : model.Users!.Where(r => r.userId == model.userid).First();
        _idb.patients.Add(model.patient);
        idbSaveChanges();
        Patientfile pf = new Patientfile();
        pf.patientMail = model.patient.emailAddress;
        _fdb.patientfiles.Add(pf);
        fdbSaveChanges();
    }
    catch (Exception e) {
        System.Diagnostics.Debug.WriteLine(e.Message);
    }
    return model;
}

This is my UploadFile method:

private string UploadFile(IFormFile photo)
{
    string wwwPath = this._env.WebRootPath;
    string contentPath = this._env.ContentRootPath;

    string path = Path.Combine(wwwPath, "img\\PatientPhotos");
    if (!Directory.Exists(path))
    {
        Directory.CreateDirectory(path);
    }

    if (photo == null)
    {
        return "default.png";
    }
    string fileName = Path.GetFileName(photo.FileName);
    using (FileStream stream = new FileStream(Path.Combine(path, fileName), FileMode.Create))
    {
        photo.CopyTo(stream);
    }

    return fileName;
}

I first get the wwwroot path and use this to save my image. If the image already exist, it uses the image thats already saved (i know this isnt ideal, but it works for me for now).

When I upload a file in localhost and submit, the patient gets saved and so does the image (in wwwroot). On Azure however, the patient and the image dont get saved.

When I dont upload a file, it automatically uses placeholder.png. Now the patient does get saved on Azure, but no image, since none was selected.

Im not getting any errors (probably because its in a production environment), it just returns to the Index page after submitting, without saving anything

In my controller you return to the Index page after creating the patient:

_db.Create(vm);
return RedirectToAction("Index");

Is there any way to fix this problem?


问:
TimeLine Object picking up only first element of the array
I am trying to create a timeline for the history part of the below json response.

```<code>{"type":"l",
"userId":"xxx",
....,
"history":[
   {
       "timeLogId":"123",
        "type":"l",
        "userId":"xxx",
        ...
    },
    {
        "timeLogId":"123",
        "type":"l",
        "userId":"xxx",
        ...
    }
    ],
    "id":"123",
    ...}
</code>```

In my list view xml, the table  is bound to tl as following:

```<code>id="mL"
class="sapFDynamicPageAlignContent"
growing="true"
growingThreshold="20"
growingScrollToLoad="true"
fixedLayout="false"
items="{path: '/TL',sorter: {path: 'sT',descending: true}}">
</code>```

Everytime I click on a particular row, it should take me to the detail page (which contains the timeline I am trying to create). My detail view is bound like this:

```<code>oView.bindElement({path: "/TL/" + encodeURL(sObjectId),
</code>```

where sObjectId is the id mentioned in the above JSON.

My history fragment is defined as below:

```<code><core:FragmentDefinition
        xmlns="sap.m"
        xmlns:core="sap.ui.core"
        xmlns:f="sap.ui.layout.form"
        xmlns:com="sap.suite.ui.commons">

    <VBox>
    <f:SimpleForm title="{i18n>tl.history.lbl}"></f:SimpleForm>
    <com:Timeline
            id="idHistoryBaseline"
            enableDoubleSided="false"
            axisOrientation="Horizontal"
            enableBackendFilter="true"
            lazyLoading="true"
            height="50px"
            sortOldestFirst="true"
            showFilterBar="false">
        <com:content height="100%">
            <com:TimelineItem
                    dateTime="{parameters: {select: 'history', expand: 'history'}, path: 'sT', targetType: 'any'}"
                    title="{parameters: {select: 'history', expand: 'history'}, path: 't', targetType: 'any'}"
                    text="{parameters: {select: 'history', expand: 'history'}, path: 'n', targetType: 'any'}"
                    userName="{parameters: {select: 'history', expand: 'history'}, path: 'id', targetType: 'any'}"/>
        </com:content>
    </com:Timeline>
    </VBox>
</core:FragmentDefinition>
</code>```

This picks up just the first element available in history. What else can I do here so that it picks up all indexes. Thank you

Edit: Was able to solve the problem as below.

```<code><core:FragmentDefinition
    xmlns="sap.m"
    xmlns:core="sap.ui.core"
    xmlns:f="sap.ui.layout.form"
    xmlns:com="sap.suite.ui.commons">
    <VBox>
        <f:SimpleForm title="{i18n>tl.history.lbl}"></f:SimpleForm>
        <HBox items="{history}">
            <com:Timeline
                id="idHistoryBaseline"
                enableDoubleSided="false"
                axisOrientation="Horizontal"
                enableBackendFilter="true"
                lazyLoading="true"
                height="50px"
                sortOldestFirst="true"
                showFilterBar="false">
                    <com:TimelineItem
                    dateTime="{path: 'sT', targetType: 'any'}"
                    title="{path: 't',  targetType: 'any'}"
                    text="{path: 'n', targetType: 'any'}"
                    userName="{path: 'Id', targetType: 'any'}"/>
            </com:Timeline>
        </HBox>
    </VBox>
</core:FragmentDefinition>
</code>```

Body:
I am trying to create a timeline for the history part of the below json response.

{"type":"l",
"userId":"xxx",
....,
"history":[
   {
       "timeLogId":"123",
        "type":"l",
        "userId":"xxx",
        ...
    },
    {
        "timeLogId":"123",
        "type":"l",
        "userId":"xxx",
        ...
    }
    ],
    "id":"123",
    ...}

In my list view xml, the table  is bound to tl as following:

id="mL"
class="sapFDynamicPageAlignContent"
growing="true"
growingThreshold="20"
growingScrollToLoad="true"
fixedLayout="false"
items="{path: '/TL',sorter: {path: 'sT',descending: true}}">

Everytime I click on a particular row, it should take me to the detail page (which contains the timeline I am trying to create). My detail view is bound like this:

oView.bindElement({path: "/TL/" + encodeURL(sObjectId),

where sObjectId is the id mentioned in the above JSON.

My history fragment is defined as below:

<core:FragmentDefinition
        xmlns="sap.m"
        xmlns:core="sap.ui.core"
        xmlns:f="sap.ui.layout.form"
        xmlns:com="sap.suite.ui.commons">

    <VBox>
    <f:SimpleForm title="{i18n>tl.history.lbl}"></f:SimpleForm>
    <com:Timeline
            id="idHistoryBaseline"
            enableDoubleSided="false"
            axisOrientation="Horizontal"
            enableBackendFilter="true"
            lazyLoading="true"
            height="50px"
            sortOldestFirst="true"
            showFilterBar="false">
        <com:content height="100%">
            <com:TimelineItem
                    dateTime="{parameters: {select: 'history', expand: 'history'}, path: 'sT', targetType: 'any'}"
                    title="{parameters: {select: 'history', expand: 'history'}, path: 't', targetType: 'any'}"
                    text="{parameters: {select: 'history', expand: 'history'}, path: 'n', targetType: 'any'}"
                    userName="{parameters: {select: 'history', expand: 'history'}, path: 'id', targetType: 'any'}"/>
        </com:content>
    </com:Timeline>
    </VBox>
</core:FragmentDefinition>

This picks up just the first element available in history. What else can I do here so that it picks up all indexes. Thank you

Edit: Was able to solve the problem as below.

<core:FragmentDefinition
    xmlns="sap.m"
    xmlns:core="sap.ui.core"
    xmlns:f="sap.ui.layout.form"
    xmlns:com="sap.suite.ui.commons">
    <VBox>
        <f:SimpleForm title="{i18n>tl.history.lbl}"></f:SimpleForm>
        <HBox items="{history}">
            <com:Timeline
                id="idHistoryBaseline"
                enableDoubleSided="false"
                axisOrientation="Horizontal"
                enableBackendFilter="true"
                lazyLoading="true"
                height="50px"
                sortOldestFirst="true"
                showFilterBar="false">
                    <com:TimelineItem
                    dateTime="{path: 'sT', targetType: 'any'}"
                    title="{path: 't',  targetType: 'any'}"
                    text="{path: 'n', targetType: 'any'}"
                    userName="{path: 'Id', targetType: 'any'}"/>
            </com:Timeline>
        </HBox>
    </VBox>
</core:FragmentDefinition>


问:
Site does not render correctly in Splash
I'm trying to click on one of the country tabs in this archived site. The mouse_click() method seems to be working but the content is not updated, I've tried clicking many things in this site and nothing works, I've tried everything! Please help.

My code in splash:

function main(splash, args)
splash.private_mode_enabled = false
url = args.url
assert(splash:go(url))
assert(splash:wait(1))
btn = assert(splash:select_all(".filterPanelItem___2z5Gb"))
btn[5]:mouse_click()
assert(splash:wait(5))
splash:set_viewport_full()
return splash:png()
end
```

I've tried everything listed here. And many other things I don't remember anymore, nothing seems to work.

Body:
I'm trying to click on one of the country tabs in this archived site. The mouse_click() method seems to be working but the content is not updated, I've tried clicking many things in this site and nothing works, I've tried everything! Please help.

My code in splash:

function main(splash, args)
splash.private_mode_enabled = false
url = args.url
assert(splash:go(url))
assert(splash:wait(1))
btn = assert(splash:select_all(".filterPanelItem___2z5Gb"))
btn[5]:mouse_click()
assert(splash:wait(5))
splash:set_viewport_full()
return splash:png()
end

I've tried everything listed here. And many other things I don't remember anymore, nothing seems to work.


问:
selenium remote hanging in docker
Same as here. docker-compose.yml

```<code>version: '3'

services:
  db:
    image: postgres
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=my_app
    ports:
      - '5432:5432'
  chrome:
    image: selenium/standalone-chrome
    hostname: chrome
    privileged: true
    shm_size: 2g
  web:
    build: .
    image: my-app
    ports:
      - "8000:8000"
    depends_on:
      - db
    command: sh -c "python manage.py migrate &&
             python manage.py runserver 0.0.0.0:8000"
    volumes:
      - .:/code
    environment:
      - DB_USER=postgres
      - DB_PASSWORD=postgres
      - DB_HOST=db
      - DB_NAME=my_app
</code>```

everything starts as expected

```<code>% docker compose build && docker compose up
[+] Building 3.4s (11/11) FINISHED
 => [internal] load build definition from Dockerfile                       0.1s
 => => transferring dockerfile: 189B                                       0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 34B                                           0.0s
 => [internal] load metadata for docker.io/library/python:3.11.1-bullseye  3.1s
 => [auth] library/python:pull token for registry-1.docker.io              0.0s
 => [internal] load build context                                          0.1s
 => => transferring context: 8.58kB                                        0.0s
 => [1/5] FROM docker.io/library/python:3.11.1-bullseye@sha256:cc4910af48  0.0s
 => CACHED [2/5] COPY requirements.txt requirements.txt                    0.0s
 => CACHED [3/5] RUN pip install -r requirements.txt                       0.0s
 => CACHED [4/5] COPY . /app                                               0.0s
 => CACHED [5/5] WORKDIR /app                                              0.0s
 => exporting to image                                                     0.0s
 => => exporting layers                                                    0.0s
 => => writing image sha256:10e58eeb73e4651e1e1aedb921fdde3b389cadc204787  0.0s
 => => naming to docker.io/library/my-app                    0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
[+] Running 3/3
 ⠿ Container my_app-db-1      Created                        0.0s
 ⠿ Container my_app-chrome-1  Created                        0.0s
 ⠿ Container my_app-web-1     Recreated                      0.2s
Attaching to my_app-chrome-1, my_app-db-1, my_app-web-1
my_app-db-1      |
my_app-db-1      | PostgreSQL Database directory appears to contain a database; Skipping initialization
my_app-db-1      |
my_app-db-1      | 2023-01-08 14:01:28.671 UTC [1] LOG:  starting PostgreSQL 15.1 (Debian 15.1-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
my_app-db-1      | 2023-01-08 14:01:28.672 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
my_app-db-1      | 2023-01-08 14:01:28.673 UTC [1] LOG:  listening on IPv6 address "::", port 5432
my_app-db-1      | 2023-01-08 14:01:28.688 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
my_app-db-1      | 2023-01-08 14:01:28.699 UTC [28] LOG:  database system was shut down at 2023-01-08 13:54:14 UTC
my_app-db-1      | 2023-01-08 14:01:28.720 UTC [1] LOG:  database system is ready to accept connections
my_app-chrome-1  | 2023-01-08 14:01:28,791 INFO Included extra file "/etc/supervisor/conf.d/selenium.conf" during parsing
my_app-chrome-1  | 2023-01-08 14:01:28,803 INFO RPC interface 'supervisor' initialized
my_app-chrome-1  | 2023-01-08 14:01:28,803 CRIT Server 'unix_http_server' running without any HTTP authentication checking
my_app-chrome-1  | 2023-01-08 14:01:28,808 INFO supervisord started with pid 8
my_app-chrome-1  | 2023-01-08 14:01:29,811 INFO spawned: 'xvfb' with pid 10
my_app-chrome-1  | 2023-01-08 14:01:29,819 INFO spawned: 'vnc' with pid 11
my_app-chrome-1  | 2023-01-08 14:01:29,833 INFO spawned: 'novnc' with pid 12
my_app-chrome-1  | 2023-01-08 14:01:29,849 INFO spawned: 'selenium-standalone' with pid 14
my_app-chrome-1  | Setting up SE_NODE_GRID_URL...
my_app-chrome-1  | 2023-01-08 14:01:29,911 INFO success: xvfb entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
my_app-chrome-1  | 2023-01-08 14:01:29,913 INFO success: vnc entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
my_app-chrome-1  | 2023-01-08 14:01:29,913 INFO success: novnc entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
my_app-chrome-1  | 2023-01-08 14:01:29,914 INFO success: selenium-standalone entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
my_app-chrome-1  | Selenium Grid Standalone configuration:
my_app-chrome-1  | [network]
my_app-chrome-1  | relax-checks = true
my_app-chrome-1  |
my_app-chrome-1  | [node]
my_app-chrome-1  | session-timeout = "300"
my_app-chrome-1  | override-max-sessions = false
my_app-chrome-1  | detect-drivers = false
my_app-chrome-1  | drain-after-session-count = 0
my_app-chrome-1  | max-sessions = 1
my_app-chrome-1  |
my_app-chrome-1  | [[node.driver-configuration]]
my_app-chrome-1  | display-name = "chrome"
my_app-chrome-1  | stereotype = '{"browserName": "chrome", "browserVersion": "108.0", "platformName": "Linux"}'
my_app-chrome-1  | max-sessions = 1
my_app-chrome-1  |
my_app-chrome-1  | Starting Selenium Grid Standalone...
my_app-chrome-1  | Tracing is disabled
my_app-web-1     | Operations to perform:
my_app-web-1     |   Apply all migrations: admin, auth, contenttypes, core, sessions
my_app-web-1     | Running migrations:
my_app-web-1     |   No migrations to apply.
my_app-web-1     | Watching for file changes with StatReloader
my_app-web-1     | Performing system checks...
my_app-web-1     |
my_app-web-1     | System check identified no issues (0 silenced).
my_app-web-1     | January 08, 2023 - 14:01:33
my_app-web-1     | Django version 4.1.5, using settings 'my_app.settings'
my_app-web-1     | Starting development server at http://0.0.0.0:8000/
my_app-web-1     | Quit the server with CONTROL-C.
my_app-chrome-1  | 14:01:33.430 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
my_app-chrome-1  | 14:01:33.453 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
my_app-chrome-1  | 14:01:35.487 INFO [NodeOptions.getSessionFactories] - Detected 2 available processors
my_app-chrome-1  | 14:01:35.608 INFO [NodeOptions.report] - Adding chrome for {"browserVersion": "108.0","se:noVncPort": 7900,"browserName": "chrome","platformName": "LINUX","se:vncEnabled": true} 1 times
my_app-chrome-1  | 14:01:35.649 INFO [Node.<init>] - Binding additional locator mechanisms: name, relative, id
my_app-chrome-1  | 14:01:35.709 INFO [GridModel.setAvailability] - Switching Node 9f76899f-6574-4e21-9413-d6141aa6c584 (uri: http://172.25.0.2:4444) from DOWN to UP
my_app-chrome-1  | 14:01:35.709 INFO [LocalDistributor.add] - Added node 9f76899f-6574-4e21-9413-d6141aa6c584 at http://172.25.0.2:4444. Health check every 120s
my_app-chrome-1  | 14:01:36.147 INFO [Standalone.execute] - Started Selenium Standalone 4.7.2 (revision 4d4020c3b7): http://172.25.0.2:4444
</code>```

The logs indicate selenium is currently available at http://172.25.0.2:4444, so I try:

```<code>>>> from selenium.webdriver import ChromeOptions, Remote
>>> options = ChromeOptions()
>>> options.add_argument('--headless')
>>> driver = Remote('http://172.25.0.2:4444')
</code>```

It keeps hanging forever and no special output / log messages / anything further happens, it just keeps hanging until ^c. So how exactly is this supposed to be used? Also for some reason, if the ip address is replaced with http://chrome:4444, the connection is refused.

Title: selenium remote hanging in docker

Body:
Same as here. docker-compose.yml

version: '3'

services:
  db:
    image: postgres
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=my_app
    ports:
      - '5432:5432'
  chrome:
    image: selenium/standalone-chrome
    hostname: chrome
    privileged: true
    shm_size: 2g
  web:
    build: .
    image: my-app
    ports:
      - "8000:8000"
    depends_on:
      - db
    command: sh -c "python manage.py migrate &&
             python manage.py runserver 0.0.0.0:8000"
    volumes:
      - .:/code
    environment:
      - DB_USER=postgres
      - DB_PASSWORD=postgres
      - DB_HOST=db
      - DB_NAME=my_app

everything starts as expected

% docker compose build && docker compose up
[+] Building 3.4s (11/11) FINISHED
 => [internal] load build definition from Dockerfile                       0.1s
 => => transferring dockerfile: 189B                                       0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 34B                                           0.0s
 => [internal] load metadata for docker.io/library/python:3.11.1-bullseye  3.1s
 => [auth] library/python:pull token for registry-1.docker.io              0.0s
 => [internal] load build context                                          0.1s
 => => transferring context: 8.58kB                                        0.0s
 => [1/5] FROM docker.io/library/python:3.11.1-bullseye@sha256:cc4910af48  0.0s
 => CACHED [2/5] COPY requirements.txt requirements.txt                    0.0s
 => CACHED [3/5] RUN pip install -r requirements.txt                       0.0s
 => CACHED [4/5] COPY . /app                                               0.0s
 => CACHED [5/5] WORKDIR /app                                              0.0s
 => exporting to image                                                     0.0s
 => => exporting layers                                                    0.0s
 => => writing image sha256:10e58eeb73e4651e1e1aedb921fdde3b389cadc204787  0.0s
 => => naming to docker.io/library/my-app                    0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
[+] Running 3/3
 ⠿ Container my_app-db-1      Created                        0.0s
 ⠿ Container my_app-chrome-1  Created                        0.0s
 ⠿ Container my_app-web-1     Recreated                      0.2s
Attaching to my_app-chrome-1, my_app-db-1, my_app-web-1
my_app-db-1      |
my_app-db-1      | PostgreSQL Database directory appears to contain a database; Skipping initialization
my_app-db-1      |
my_app-db-1      | 2023-01-08 14:01:28.671 UTC [1] LOG:  starting PostgreSQL 15.1 (Debian 15.1-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
my_app-db-1      | 2023-01-08 14:01:28.672 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
my_app-db-1      | 2023-01-08 14:01:28.673 UTC [1] LOG:  listening on IPv6 address "::", port 5432
my_app-db-1      | 2023-01-08 14:01:28.688 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
my_app-db-1      | 2023-01-08 14:01:28.699 UTC [28] LOG:  database system was shut down at 2023-01-08 13:54:14 UTC
my_app-db-1      | 2023-01-08 14:01:28.720 UTC [1] LOG:  database system is ready to accept connections
my_app-chrome-1  | 2023-01-08 14:01:28,791 INFO Included extra file "/etc/supervisor/conf.d/selenium.conf" during parsing
my_app-chrome-1  | 2023-01-08 14:01:28,803 INFO RPC interface 'supervisor' initialized
my_app-chrome-1  | 2023-01-08 14:01:28,803 CRIT Server 'unix_http_server' running without any HTTP authentication checking
my_app-chrome-1  | 2023-01-08 14:01:28,808 INFO supervisord started with pid 8
my_app-chrome-1  | 2023-01-08 14:01:29,811 INFO spawned: 'xvfb' with pid 10
my_app-chrome-1  | 2023-01-08 14:01:29,819 INFO spawned: 'vnc' with pid 11
my_app-chrome-1  | 2023-01-08 14:01:29,833 INFO spawned: 'novnc' with pid 12
my_app-chrome-1  | 2023-01-08 14:01:29,849 INFO spawned: 'selenium-standalone' with pid 14
my_app-chrome-1  | Setting up SE_NODE_GRID_URL...
my_app-chrome-1  | 2023-01-08 14:01:29,911 INFO success: xvfb entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
my_app-chrome-1  | 2023-01-08 14:01:29,913 INFO success: vnc entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
my_app-chrome-1  | 2023-01-08 14:01:29,913 INFO success: novnc entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
my_app-chrome-1  | 2023-01-08 14:01:29,914 INFO success: selenium-standalone entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
my_app-chrome-1  | Selenium Grid Standalone configuration:
my_app-chrome-1  | [network]
my_app-chrome-1  | relax-checks = true
my_app-chrome-1  |
my_app-chrome-1  | [node]
my_app-chrome-1  | session-timeout = "300"
my_app-chrome-1  | override-max-sessions = false
my_app-chrome-1  | detect-drivers = false
my_app-chrome-1  | drain-after-session-count = 0
my_app-chrome-1  | max-sessions = 1
my_app-chrome-1  |
my_app-chrome-1  | [[node.driver-configuration]]
my_app-chrome-1  | display-name = "chrome"
my_app-chrome-1  | stereotype = '{"browserName": "chrome", "browserVersion": "108.0", "platformName": "Linux"}'
my_app-chrome-1  | max-sessions = 1
my_app-chrome-1  |
my_app-chrome-1  | Starting Selenium Grid Standalone...
my_app-chrome-1  | Tracing is disabled
my_app-web-1     | Operations to perform:
my_app-web-1     |   Apply all migrations: admin, auth, contenttypes, core, sessions
my_app-web-1     | Running migrations:
my_app-web-1     |   No migrations to apply.
my_app-web-1     | Watching for file changes with StatReloader
my_app-web-1     | Performing system checks...
my_app-web-1     |
my_app-web-1     | System check identified no issues (0 silenced).
my_app-web-1     | January 08, 2023 - 14:01:33
my_app-web-1     | Django version 4.1.5, using settings 'my_app.settings'
my_app-web-1     | Starting development server at http://0.0.0.0:8000/
my_app-web-1     | Quit the server with CONTROL-C.
my_app-chrome-1  | 14:01:33.430 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
my_app-chrome-1  | 14:01:33.453 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
my_app-chrome-1  | 14:01:35.487 INFO [NodeOptions.getSessionFactories] - Detected 2 available processors
my_app-chrome-1  | 14:01:35.608 INFO [NodeOptions.report] - Adding chrome for {"browserVersion": "108.0","se:noVncPort": 7900,"browserName": "chrome","platformName": "LINUX","se:vncEnabled": true} 1 times
my_app-chrome-1  | 14:01:35.649 INFO [Node.<init>] - Binding additional locator mechanisms: name, relative, id
my_app-chrome-1  | 14:01:35.709 INFO [GridModel.setAvailability] - Switching Node 9f76899f-6574-4e21-9413-d6141aa6c584 (uri: http://172.25.0.2:4444) from DOWN to UP
my_app-chrome-1  | 14:01:35.709 INFO [LocalDistributor.add] - Added node 9f76899f-6574-4e21-9413-d6141aa6c584 at http://172.25.0.2:4444. Health check every 120s
my_app-chrome-1  | 14:01:36.147 INFO [Standalone.execute] - Started Selenium Standalone 4.7.2 (revision 4d4020c3b7): http://172.25.0.2:4444

The logs indicate selenium is currently available at http://172.25.0.2:4444, so I try:

>>> from selenium.webdriver import ChromeOptions, Remote
>>> options = ChromeOptions()
>>> options.add_argument('--headless')
>>> driver = Remote('http://172.25.0.2:4444')

It keeps hanging forever and no special output / log messages / anything further happens, it just keeps hanging until ^c. So how exactly is this supposed to be used? Also for some reason, if the ip address is replaced with http://chrome:4444, the connection is refused.


问:
how do I write a code that´s applying letters to numbers and prints names into a sum of numbers?
For example A = 1 , Z = 26 , Aron = 48

Non English-letter character like space or apostrophe can be ignored
Lowercase and uppercase letters are equal

I am new to programming and try some practices with java in order to learn from this.


问:
Rendering to different objects using different textures and different shaders
I'm programming a voxel game. I have implented procedurally generated terrain. Now I want to program a map that should show on the upper right corner of the screen and that shows the biomes that are nearby. To do this my idea was to create a separate shader program, vbo, and vao, and a texture and that I would write to as the player moved around.
Is there a better way to do this?

Here I create the map:

```<code>GLuint VAO, VBO, EBO;
    glGenVertexArrays(1, &VAO);
    glGenBuffers(1, &EBO);
    glGenBuffers(1, &VBO);
    float vertices[] = {
        -.5f, -.5f, 0,  0, 0,
        -.5f, .5f, 0,   0, 1,
        .5f, .5f, 0,    1, 1,
        .5f, -.5f, 0,   1, 0
    };
    /*float vertices[] = {
        -1, -.5f, 0,
        0, .5f, 0,
        .5f, -.5f, 0
    };*/
    unsigned int indices[] = {
        0, 1, 2,
        0, 2, 3
    };
    glBindVertexArray(VAO);
    // 2. copy our vertices array in a vertex buffer for OpenGL to use
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
    // 3. copy our index array in a element buffer for OpenGL to use
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
    // 4. then set the vertex attributes pointers
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3*sizeof(float)));
    glEnableVertexAttribArray(1);

    GLuint tbo;
    int apothem = 256;
    unsigned char pixels[apothem*apothem*3];
    for(size_t i = 0; i < apothem*apothem*3; i++) {
        pixels[i] = 1;
        //std::cout << "changed pixels[" << i << "]" << std::endl;
    }
    glGenTextures(1, &tbo);
    glActiveTexture(GL_TEXTURE0 + 1);
    glBindTexture(GL_TEXTURE_2D, tbo);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, apothem, apothem, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);
    //glTexSubImage2D(GL_TEXTURE_2D, 1, 0, 0, apothem, apothem, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
    // set the texture wrapping/filtering options (on the currently bound texture object)
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glGenerateMipmap(GL_TEXTURE_2D);
</code>```

And here's the rendering loop:

```<code>while (!glfwWindowShouldClose(window))
    {
        // Poll and handle events (inputs, window resize, etc.)
        // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
        // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application, or clear/overwrite your copy of the mouse data.
        // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application, or clear/overwrite your copy of the keyboard data.
        // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
        glfwPollEvents();

        // Start the Dear ImGui frame
        ImGui_ImplOpenGL3_NewFrame();
        ImGui_ImplGlfw_NewFrame();
        ImGui::NewFrame();

        static float scale[3] = {1, 1, 1};
        static float rotation[3] = {0, 0, 0};
        static float position[3] = {0, 0, 0};
        // 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
        {
            ImGui::Begin("Chunk settings");                          // Create a window called "Hello, world!" and append into it.

            ImGui::SliderFloat3("scale", scale, -5, 5);
            ImGui::SliderFloat3("rotation", rotation, -360, 360);
            ImGui::SliderFloat3("position", position, -5, 5);
            ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color

            ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
            ImGui::End();
        }

        {
            int x = mainPlayer.GetPos().x(), z = mainPlayer.GetPos().z();
            ImGui::Begin("World settings");

            float continentalness = voxelEngine::mainWorld.GetContinentalness(x, z);
            ImGui::Text("Continentalness: %.4f, Continentalness degree: %d", continentalness,
            voxelEngine::mainWorld.ContinentalnessDegree(continentalness));

            float erosion = voxelEngine::mainWorld.GetErosion(x, z);
            ImGui::Text("Erosion: %.4f, Erosion Degree: %d", erosion,
            voxelEngine::mainWorld.GetErosionDegree(erosion));

            float humidity = voxelEngine::mainWorld.GetHumidity(x, z);
            ImGui::Text("Humidity: %.4f, Humidity Degree: %d", humidity,
            voxelEngine::mainWorld.GetHumidityDegree(humidity));

            float temperature = voxelEngine::mainWorld.GetTemperature(x, z);
            ImGui::Text("Temperature: %.4f, Temperature Degree: %d", temperature,
            voxelEngine::mainWorld.GetTemperatureDegree(temperature));

            float elevation = voxelEngine::mainWorld.GetElevation(x, z);
            ImGui::Text("Elevation: %.4f, Elevation Degree: %d", elevation,
            voxelEngine::mainWorld.GetElevationDegree(elevation));

            ImGui::End();
        }

        static float n = .3, f = .5, speed, sensitivity, fov, pitch, yaw;
        static Eigen::Vector3f cam_pos;
        speed = voxelEngine::players->GetSpeed();
        sensitivity = voxelEngine::players->GetSensitivity();
        fov = voxelEngine::players->GetFOV();
        pitch = voxelEngine::players->GetPitch();
        yaw = voxelEngine::players->GetYaw();
        cam_pos = voxelEngine::players->GetPos();
        {
            ImGui::Begin("Camera settings");
            ImGui::SliderFloat("cam x", &cam_pos.x(), -10, 10);
            ImGui::SliderFloat("cam y", &cam_pos.y(), -10, 10);
            ImGui::SliderFloat("cam z", &cam_pos.z(), -10, 10);
            ImGui::SliderFloat("speed", &speed, 0, 1);
            ImGui::SliderFloat("sensitivity", &sensitivity, 0, 1);
            ImGui::SliderFloat("fov", &fov, 0, 90);
            ImGui::SliderFloat("pitch", &pitch, -360, 360);
            ImGui::SliderFloat("yaw", &yaw, -360, 360);
            ImGui::SliderFloat("near plane", &n, 0, 1);
            ImGui::SliderFloat("far plane", &f, 0, 1);
            ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
            ImGui::End();
        }
        voxelEngine::players->SetPos(cam_pos);
        voxelEngine::players->SetSpeed(speed);
        voxelEngine::players->SetSensitivity(sensitivity);
        voxelEngine::players->SetFOV(fov);
        voxelEngine::players->SetDirection(pitch, yaw);

        // Rendering
        ImGui::Render();
        int display_w, display_h;
        glfwGetFramebufferSize(window, &display_w, &display_h);
        glViewport(0, 0, display_w, display_h);
        glClearColor(clear_color.x * clear_color.w, clear_color.y * clear_color.w, clear_color.z * clear_color.w, clear_color.w);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        float projMat[16];
        float viewMat[16];
        //float modelMat[16];
        /*voxelEngine::genModelMatrix({scale[0], scale[1], scale[2]}, {rotation[0], rotation[1], rotation[2]},
            {position[0],
            position[1],
            position[2]}, modelMat);*/
        voxelEngine::players->genViewMatrix(viewMat);
        voxelEngine::genProjMatrix(n, f, (float)display_h/display_w, voxelEngine::players->GetFOV(), projMat);
        //glUniformMatrix4fv(glGetUniformLocation(voxelEngine::program, "modelMatrix"), 1, GL_FALSE, modelMat);
        glActiveTexture(GL_TEXTURE0);
        glBindTexture(GL_TEXTURE_2D, blockTextures);
        glUseProgram(worldProgram);
        glUniformMatrix4fv(glGetUniformLocation(worldProgram, "viewMatrix"), 1, GL_FALSE, viewMat);
        glUniformMatrix4fv(glGetUniformLocation(worldProgram, "projMatrix"), 1, GL_TRUE, projMat);
        mainPlayer.Render();

        float mapProj[16];
        float mapModel[16];
        voxelEngine::genModelMatrix(Eigen::Vector3f(.7, .7, .7), Eigen::Vector3f(0, 0, 0), Eigen::Vector3f(0, 0, 1), mapModel);
        voxelEngine::genProjMatrix(n, f, (float)display_h/display_w, 90, mapProj);

        glUseProgram(guiProgram);
        glUniform1i(glGetUniformLocation(guiProgram, "my_sampler"), 1);
        glActiveTexture(GL_TEXTURE0 + 1);
        glBindTexture(GL_TEXTURE_2D, tbo);
        //glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
        glUniformMatrix4fv(glGetUniformLocation(guiProgram, "projMat"), 1, GL_TRUE, mapProj);
        glUniformMatrix4fv(glGetUniformLocation(guiProgram, "modelMat"), 1, GL_FALSE, mapModel);
        glBindVertexArray(VAO);
        glBindBuffer(GL_ARRAY_BUFFER, VBO);
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);

        glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);
        glEnableVertexAttribArray(0);
        glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3*sizeof(float)));
        glEnableVertexAttribArray(1);

        //glTexImage2D(GL_TEXTURE_2D, 1, GL_RGB, apothem, apothem, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);
        //glTexSubImage2D(GL_TEXTURE_2D, 1, 0, 0, apothem, apothem, GL_RGB, GL_UNSIGNED_BYTE, pixels);
        glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
        /*voxelEngine::mainBiomeMap->Bind();
        voxelEngine::mainBiomeMap->Render();*/

        ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());

        // Update and Render additional Platform Windows
        // (Platform functions may change the current OpenGL context, so we save/restore it to make it easier to paste this code elsewhere.
        //  For this specific demo app we could also call glfwMakeContextCurrent(window) directly)
        if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
        {
            GLFWwindow* backup_current_context = glfwGetCurrentContext();
            ImGui::UpdatePlatformWindows();
            ImGui::RenderPlatformWindowsDefault();
            glfwMakeContextCurrent(backup_current_context);
        }

        glfwSwapBuffers(window);

    }
</code>```

Everything renders fine except the map which is just black.
This is where I render the map:

```<code>float mapProj[16];
        float mapModel[16];
        voxelEngine::genModelMatrix(Eigen::Vector3f(.7, .7, .7), Eigen::Vector3f(0, 0, 0), Eigen::Vector3f(0, 0, 1), mapModel);
        voxelEngine::genProjMatrix(n, f, (float)display_h/display_w, 90, mapProj);

        glUseProgram(guiProgram);
        glUniform1i(glGetUniformLocation(guiProgram, "my_sampler"), 1);
        glActiveTexture(GL_TEXTURE0 + 1);
        glBindTexture(GL_TEXTURE_2D, tbo);
        //glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
        glUniformMatrix4fv(glGetUniformLocation(guiProgram, "projMat"), 1, GL_TRUE, mapProj);
        glUniformMatrix4fv(glGetUniformLocation(guiProgram, "modelMat"), 1, GL_FALSE, mapModel);
        glBindVertexArray(VAO);
        glBindBuffer(GL_ARRAY_BUFFER, VBO);
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);

        glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);
        glEnableVertexAttribArray(0);
        glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3*sizeof(float)));
        glEnableVertexAttribArray(1);

        //glTexImage2D(GL_TEXTURE_2D, 1, GL_RGB, apothem, apothem, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);
        //glTexSubImage2D(GL_TEXTURE_2D, 1, 0, 0, apothem, apothem, GL_RGB, GL_UNSIGNED_BYTE, pixels);
        glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
</code>```

How can I get this to work?

Body:
I'm programming a voxel game. I have implented procedurally generated terrain. Now I want to program a map that should show on the upper right corner of the screen and that shows the biomes that are nearby. To do this my idea was to create a separate shader program, vbo, and vao, and a texture and that I would write to as the player moved around.
Is there a better way to do this?

Here I create the map:

GLuint VAO, VBO, EBO;
    glGenVertexArrays(1, &VAO);
    glGenBuffers(1, &EBO);
    glGenBuffers(1, &VBO);
    float vertices[] = {
        -.5f, -.5f, 0,  0, 0,
        -.5f, .5f, 0,   0, 1,
        .5f, .5f, 0,    1, 1,
        .5f, -.5f, 0,   1, 0
    };
    /*float vertices[] = {
        -1, -.5f, 0,
        0, .5f, 0,
        .5f, -.5f, 0
    };*/
    unsigned int indices[] = {
        0, 1, 2,
        0, 2, 3
    };
    glBindVertexArray(VAO);
    // 2. copy our vertices array in a vertex buffer for OpenGL to use
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
    // 3. copy our index array in a element buffer for OpenGL to use
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
    // 4. then set the vertex attributes pointers
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3*sizeof(float)));
    glEnableVertexAttribArray(1);

    GLuint tbo;
    int apothem = 256;
    unsigned char pixels[apothem*apothem*3];
    for(size_t i = 0; i < apothem*apothem*3; i++) {
        pixels[i] = 1;
        //std::cout << "changed pixels[" << i << "]" << std::endl;
    }
    glGenTextures(1, &tbo);
    glActiveTexture(GL_TEXTURE0 + 1);
    glBindTexture(GL_TEXTURE_2D, tbo);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, apothem, apothem, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);
    //glTexSubImage2D(GL_TEXTURE_2D, 1, 0, 0, apothem, apothem, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
    // set the texture wrapping/filtering options (on the currently bound texture object)
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glGenerateMipmap(GL_TEXTURE_2D);

And here's the rendering loop:

while (!glfwWindowShouldClose(window))
    {
        // Poll and handle events (inputs, window resize, etc.)
        // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
        // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application, or clear/overwrite your copy of the mouse data.
        // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application, or clear/overwrite your copy of the keyboard data.
        // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
        glfwPollEvents();

        // Start the Dear ImGui frame
        ImGui_ImplOpenGL3_NewFrame();
        ImGui_ImplGlfw_NewFrame();
        ImGui::NewFrame();

        static float scale[3] = {1, 1, 1};
        static float rotation[3] = {0, 0, 0};
        static float position[3] = {0, 0, 0};
        // 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
        {
            ImGui::Begin("Chunk settings");                          // Create a window called "Hello, world!" and append into it.

            ImGui::SliderFloat3("scale", scale, -5, 5);
            ImGui::SliderFloat3("rotation", rotation, -360, 360);
            ImGui::SliderFloat3("position", position, -5, 5);
            ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color

            ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
            ImGui::End();
        }

        {
            int x = mainPlayer.GetPos().x(), z = mainPlayer.GetPos().z();
            ImGui::Begin("World settings");

            float continentalness = voxelEngine::mainWorld.GetContinentalness(x, z);
            ImGui::Text("Continentalness: %.4f, Continentalness degree: %d", continentalness,
            voxelEngine::mainWorld.ContinentalnessDegree(continentalness));

            float erosion = voxelEngine::mainWorld.GetErosion(x, z);
            ImGui::Text("Erosion: %.4f, Erosion Degree: %d", erosion,
            voxelEngine::mainWorld.GetErosionDegree(erosion));

            float humidity = voxelEngine::mainWorld.GetHumidity(x, z);
            ImGui::Text("Humidity: %.4f, Humidity Degree: %d", humidity,
            voxelEngine::mainWorld.GetHumidityDegree(humidity));

            float temperature = voxelEngine::mainWorld.GetTemperature(x, z);
            ImGui::Text("Temperature: %.4f, Temperature Degree: %d", temperature,
            voxelEngine::mainWorld.GetTemperatureDegree(temperature));

            float elevation = voxelEngine::mainWorld.GetElevation(x, z);
            ImGui::Text("Elevation: %.4f, Elevation Degree: %d", elevation,
            voxelEngine::mainWorld.GetElevationDegree(elevation));

            ImGui::End();
        }

        static float n = .3, f = .5, speed, sensitivity, fov, pitch, yaw;
        static Eigen::Vector3f cam_pos;
        speed = voxelEngine::players->GetSpeed();
        sensitivity = voxelEngine::players->GetSensitivity();
        fov = voxelEngine::players->GetFOV();
        pitch = voxelEngine::players->GetPitch();
        yaw = voxelEngine::players->GetYaw();
        cam_pos = voxelEngine::players->GetPos();
        {
            ImGui::Begin("Camera settings");
            ImGui::SliderFloat("cam x", &cam_pos.x(), -10, 10);
            ImGui::SliderFloat("cam y", &cam_pos.y(), -10, 10);
            ImGui::SliderFloat("cam z", &cam_pos.z(), -10, 10);
            ImGui::SliderFloat("speed", &speed, 0, 1);
            ImGui::SliderFloat("sensitivity", &sensitivity, 0, 1);
            ImGui::SliderFloat("fov", &fov, 0, 90);
            ImGui::SliderFloat("pitch", &pitch, -360, 360);
            ImGui::SliderFloat("yaw", &yaw, -360, 360);
            ImGui::SliderFloat("near plane", &n, 0, 1);
            ImGui::SliderFloat("far plane", &f, 0, 1);
            ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
            ImGui::End();
        }
        voxelEngine::players->SetPos(cam_pos);
        voxelEngine::players->SetSpeed(speed);
        voxelEngine::players->SetSensitivity(sensitivity);
        voxelEngine::players->SetFOV(fov);
        voxelEngine::players->SetDirection(pitch, yaw);

        // Rendering
        ImGui::Render();
        int display_w, display_h;
        glfwGetFramebufferSize(window, &display_w, &display_h);
        glViewport(0, 0, display_w, display_h);
        glClearColor(clear_color.x * clear_color.w, clear_color.y * clear_color.w, clear_color.z * clear_color.w, clear_color.w);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        float projMat[16];
        float viewMat[16];
        //float modelMat[16];
        /*voxelEngine::genModelMatrix({scale[0], scale[1], scale[2]}, {rotation[0], rotation[1], rotation[2]},
            {position[0],
            position[1],
            position[2]}, modelMat);*/
        voxelEngine::players->genViewMatrix(viewMat);
        voxelEngine::genProjMatrix(n, f, (float)display_h/display_w, voxelEngine::players->GetFOV(), projMat);
        //glUniformMatrix4fv(glGetUniformLocation(voxelEngine::program, "modelMatrix"), 1, GL_FALSE, modelMat);
        glActiveTexture(GL_TEXTURE0);
        glBindTexture(GL_TEXTURE_2D, blockTextures);
        glUseProgram(worldProgram);
        glUniformMatrix4fv(glGetUniformLocation(worldProgram, "viewMatrix"), 1, GL_FALSE, viewMat);
        glUniformMatrix4fv(glGetUniformLocation(worldProgram, "projMatrix"), 1, GL_TRUE, projMat);
        mainPlayer.Render();

        float mapProj[16];
        float mapModel[16];
        voxelEngine::genModelMatrix(Eigen::Vector3f(.7, .7, .7), Eigen::Vector3f(0, 0, 0), Eigen::Vector3f(0, 0, 1), mapModel);
        voxelEngine::genProjMatrix(n, f, (float)display_h/display_w, 90, mapProj);

        glUseProgram(guiProgram);
        glUniform1i(glGetUniformLocation(guiProgram, "my_sampler"), 1);
        glActiveTexture(GL_TEXTURE0 + 1);
        glBindTexture(GL_TEXTURE_2D, tbo);
        //glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
        glUniformMatrix4fv(glGetUniformLocation(guiProgram, "projMat"), 1, GL_TRUE, mapProj);
        glUniformMatrix4fv(glGetUniformLocation(guiProgram, "modelMat"), 1, GL_FALSE, mapModel);
        glBindVertexArray(VAO);
        glBindBuffer(GL_ARRAY_BUFFER, VBO);
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);

        glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);
        glEnableVertexAttribArray(0);
        glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3*sizeof(float)));
        glEnableVertexAttribArray(1);

        //glTexImage2D(GL_TEXTURE_2D, 1, GL_RGB, apothem, apothem, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);
        //glTexSubImage2D(GL_TEXTURE_2D, 1, 0, 0, apothem, apothem, GL_RGB, GL_UNSIGNED_BYTE, pixels);
        glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
        /*voxelEngine::mainBiomeMap->Bind();
        voxelEngine::mainBiomeMap->Render();*/

        ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());

        // Update and Render additional Platform Windows
        // (Platform functions may change the current OpenGL context, so we save/restore it to make it easier to paste this code elsewhere.
        //  For this specific demo app we could also call glfwMakeContextCurrent(window) directly)
        if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
        {
            GLFWwindow* backup_current_context = glfwGetCurrentContext();
            ImGui::UpdatePlatformWindows();
            ImGui::RenderPlatformWindowsDefault();
            glfwMakeContextCurrent(backup_current_context);
        }

        glfwSwapBuffers(window);

    }

Everything renders fine except the map which is just black.
This is where I render the map:

float mapProj[16];
        float mapModel[16];
        voxelEngine::genModelMatrix(Eigen::Vector3f(.7, .7, .7), Eigen::Vector3f(0, 0, 0), Eigen::Vector3f(0, 0, 1), mapModel);
        voxelEngine::genProjMatrix(n, f, (float)display_h/display_w, 90, mapProj);

        glUseProgram(guiProgram);
        glUniform1i(glGetUniformLocation(guiProgram, "my_sampler"), 1);
        glActiveTexture(GL_TEXTURE0 + 1);
        glBindTexture(GL_TEXTURE_2D, tbo);
        //glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
        glUniformMatrix4fv(glGetUniformLocation(guiProgram, "projMat"), 1, GL_TRUE, mapProj);
        glUniformMatrix4fv(glGetUniformLocation(guiProgram, "modelMat"), 1, GL_FALSE, mapModel);
        glBindVertexArray(VAO);
        glBindBuffer(GL_ARRAY_BUFFER, VBO);
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);

        glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);
        glEnableVertexAttribArray(0);
        glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3*sizeof(float)));
        glEnableVertexAttribArray(1);

        //glTexImage2D(GL_TEXTURE_2D, 1, GL_RGB, apothem, apothem, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);
        //glTexSubImage2D(GL_TEXTURE_2D, 1, 0, 0, apothem, apothem, GL_RGB, GL_UNSIGNED_BYTE, pixels);
        glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);

How can I get this to work?


问:
How to save nested json to mySql datavbase using pojo class in spring boot
{
"firstName": "Vinod",
"lastName": "Pandey",
"gender": "Male",

"phone": 8740000312,
"email": "vinod@gmail.com",
"Address": {
"city" :"Bangalore",
"state":"Karnataka",
"country":"India",
"countryFlag":"https://upload.wikimedia.org/wikipedia/en/4/41/Flag_of_India.svg",
"pin": 560029
}
}

I want save it through entity class(pojo). There is a User class and its elements like below example, but there will be a address and its elements. but elements should be nested and mapped with User class and can save it into mySql database.
"firstName": " ",
"lastName": "  ",
"gender": " ",

"phone":  ,
"email": " ",
"Address": {
"city" :" ",
"state":" ",
"country":" ",
"countryFlag":"https://upload.wikimedia.org/wikipedia/en/4/41/Flag_of_India.svg",
"pin": 560029


问:
Why does explicit copy constructor cause error here?
I thought that when you do:

```<code>Foo f1;
Foo f2 = f1;
</code>```

The line Foo f2 = f1; calls the copy constructor of Foo and that it was equivalent to:

```<code>Foo f1;
Foo f2{f1};
</code>```

However this seems not to be the case:

```<code>class Foo
{public:
    Foo() {}
    explicit Foo(const Foo& other) {}
};

int main()
{

    Foo f1;
    //Foo f2 = f1; // DOESN'T WORK IF COPY CONSTRUCTOR MADE EXPLICIT
    Foo f2{ f1 }; // THIS WORKS WITH EXPLICIT
}
</code>```

Why is this if there's no conversion? 'f1' is a Foo object, there shouldn't be a conversion. Why does it fail? Also in the following:

```<code>Foo funcReturningFoo()
{
    Foo f;
    return f; /* NO SUITABLE COPY CONSTRUCTOR IF MADE EXPLICIT */
}
</code>```

Body:
I thought that when you do:

Foo f1;
Foo f2 = f1;

The line Foo f2 = f1; calls the copy constructor of Foo and that it was equivalent to:

Foo f1;
Foo f2{f1};

However this seems not to be the case:

class Foo
{public:
    Foo() {}
    explicit Foo(const Foo& other) {}
};

int main()
{

    Foo f1;
    //Foo f2 = f1; // DOESN'T WORK IF COPY CONSTRUCTOR MADE EXPLICIT
    Foo f2{ f1 }; // THIS WORKS WITH EXPLICIT
}

Why is this if there's no conversion? 'f1' is a Foo object, there shouldn't be a conversion. Why does it fail? Also in the following:

Foo funcReturningFoo()
{
    Foo f;
    return f; /* NO SUITABLE COPY CONSTRUCTOR IF MADE EXPLICIT */
}


问:
R osmdata package: opq() function downloads even out of the box
I have this code and I'm using RStudio

```<code>library(tidyverse)
library(osmdata)

q <- opq(bbox = c(2.34560,48.86015,2.35152,48.86145)) # around Rue Berger (Paris, France)

all_Data <- osmdata_sf(q)

ggplot() +
  geom_sf(
    data = all_Data$osm_lines,
    inherit.aes = FALSE,
    color = "black",
    size = .4,
    alpha = .8 )
</code>```

when I plot this I have this

but it should be around this photo

As you can see longitude and latitude (min and max) are out the indicated box.

I don't understand why the opq() function doesn't download only the date of the indicated box.

Where am I wrong?

Thanks in advance.

Body:
I have this code and I'm using RStudio

library(tidyverse)
library(osmdata)

q <- opq(bbox = c(2.34560,48.86015,2.35152,48.86145)) # around Rue Berger (Paris, France)

all_Data <- osmdata_sf(q)

ggplot() +
  geom_sf(
    data = all_Data$osm_lines,
    inherit.aes = FALSE,
    color = "black",
    size = .4,
    alpha = .8 )

when I plot this I have this

but it should be around this photo

As you can see longitude and latitude (min and max) are out the indicated box.

I don't understand why the opq() function doesn't download only the date of the indicated box.

Where am I wrong?

Thanks in advance.


问:
Error while trying to set custom AWSTraceHeader when sending a SQS message
My architecture is built like this:
I have a Lambda (let's call it l1), that sends messages to a SQS, and other lambda (let's call it l2) that listen to this queue.
I am trying to set a custom AWSTraceHeader when sending a SQS, using boto3.
The message contains the following attributes:

class SqsMessage(pydantic.BaseModel, ABC):
    Id: str
    MessageBody: str
    MessageAttributes: Optional[Dict[str, MessageAttributeValueTypeDef]]
    MessageSystemAttributes: Optional[Dict[str, MessageAttributeValueTypeDef]]
    MessageGroupId: Optional[str]
    MessageDeduplicationId: Optional[str]
```
<p>And in <code>MessageSystemAttributes</code> I put:</p>
<pre class="lang-py prettyprint-override"><code>MessageSystemAttributes={'AWSTraceHeader': 'Root=...'}
</code>```

When I send a custom message (via integration test) to l1 for the first time, then the message is fine. But when this message reaches from the SQS to l2, then there's an error:

```<code>An error occurred (InvalidParameterValue) when calling the SendMessageBatch operation: The message system attribute 'AWSTraceHeader' is reserved for AWS X-Ray trace header. Value '...' is invalid.
</code>```

<s>But when I send the same message for the second time, when the lambdas are running (and not in the cold start phase), then I don't get this error.</s>

I have already tried using AWS' guide to create the correct code, using this guide.

I have already tried to set the tracer head to the correct format using this guide, without any luck.
I have also tried sending it multiple times, but this error occurs only for the first run, when the lambda is cold.

EDIT:
It happens on every run, not only in the first run. It happened only in the first run because I accidentally added the wrong assertion in the integration test, that made me think that it worked correctly.

EDIT 2:
The message that received in the lambda (l1) is this: {..., "AWSTraceHeader":"Root=...;Sampled=1", and sending the message: self._queue.send_messages(Entries=messages_dict_list) where self._queue is:

sqs = boto3.resource('sqs')
self._queue = sqs.get_queue_by_name(QueueName=queue_name)
```

messages_dict_list is [message.dict(exclude_none=True for message in messages]. The messages are built the same way I wrote above - as SqsMessage.

Body:
My architecture is built like this:
I have a Lambda (let's call it l1), that sends messages to a SQS, and other lambda (let's call it l2) that listen to this queue.
I am trying to set a custom AWSTraceHeader when sending a SQS, using boto3.
The message contains the following attributes:

class SqsMessage(pydantic.BaseModel, ABC):
    Id: str
    MessageBody: str
    MessageAttributes: Optional[Dict[str, MessageAttributeValueTypeDef]]
    MessageSystemAttributes: Optional[Dict[str, MessageAttributeValueTypeDef]]
    MessageGroupId: Optional[str]
    MessageDeduplicationId: Optional[str]

And in MessageSystemAttributes I put:

MessageSystemAttributes={'AWSTraceHeader': 'Root=...'}

When I send a custom message (via integration test) to l1 for the first time, then the message is fine. But when this message reaches from the SQS to l2, then there's an error:

An error occurred (InvalidParameterValue) when calling the SendMessageBatch operation: The message system attribute 'AWSTraceHeader' is reserved for AWS X-Ray trace header. Value '...' is invalid.

<s>But when I send the same message for the second time, when the lambdas are running (and not in the cold start phase), then I don't get this error.</s>

I have already tried using AWS' guide to create the correct code, using this guide.

I have already tried to set the tracer head to the correct format using this guide, without any luck.
I have also tried sending it multiple times, but this error occurs only for the first run, when the lambda is cold.

EDIT:
It happens on every run, not only in the first run. It happened only in the first run because I accidentally added the wrong assertion in the integration test, that made me think that it worked correctly.

EDIT 2:
The message that received in the lambda (l1) is this: {..., "AWSTraceHeader":"Root=...;Sampled=1", and sending the message: self._queue.send_messages(Entries=messages_dict_list) where self._queue is:

sqs = boto3.resource('sqs')
self._queue = sqs.get_queue_by_name(QueueName=queue_name)

messages_dict_list is [message.dict(exclude_none=True for message in messages]. The messages are built the same way I wrote above - as SqsMessage.


问:
disabling digital crown scrolling in ScrollView when using .digitalCrownRotation() modifier
I'm working on a SwiftUI modifier (ZoomableModifier) that will be predominantly used for making images zoomable. I want this to work on both iOS and watchOS, but particularly on watchOS. I want it to be possible to use the digital crown to zoom in and out, and to achieve this I'm using the .digitalCrownRotation() modifier to read the rotation of the digital crown and use that to determine the scale factor.

Here's the code for the modifier:

//
//  ZoomableModifier.swift
//
//  Created by jasu on 2022/01/26.
//  Modified by Toni Sucic on 2023/01/08.
//  Copyright (c) 2022 jasu All rights reserved.
//
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is furnished
//  to do so, subject to the following conditions:
//
//  The above copyright notice and this permission notice shall be included in all
//  copies or substantial portions of the Software.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
//  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
//  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
//  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
//  CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
//  OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

import SwiftUI

public struct ZoomableModifier: ViewModifier {

    private enum ZoomState {
        case inactive
        case active(scale: CGFloat)

        var scale: CGFloat {
            switch self {
            case .active(let scale):
                return scale
            default:
                return 1.0
            }
        }
    }

    /// The content size of the views.
    let contentSize: CGSize
    /// The minimum value that can be zoom out.
    let min: CGFloat
    /// The maximum value that can be zoom in.
    let max: CGFloat
    /// A value that indicates whether the scroll view displays the scrollable component of the content offset, in a way that’s suitable for the platform.
    let showsIndicators: Bool

#if os(iOS)
    @GestureState private var zoomState = ZoomState.inactive
#endif
    @State private var currentScale: CGFloat = 1.0

    var scale: CGFloat {
#if os(iOS)
        currentScale * zoomState.scale
#elseif os(watchOS)
        currentScale
#endif
    }

#if os(iOS)
    var zoomGesture: some Gesture {
        MagnificationGesture()
            .updating($zoomState) { value, state, transaction in
                state = .active(scale: value)
            }
            .onEnded { value in
                var new = currentScale * value
                if new <= min { new = min }
                if new >= max { new = max }
                currentScale = new
            }
    }
#endif

    var doubleTapGesture: some Gesture {
        TapGesture(count: 2).onEnded {
            if scale <= min { currentScale = max } else
            if scale >= max { currentScale = min } else {
                currentScale = ((max - min) * 0.5 + min) < scale ? max : min
            }
        }
    }

    public func body(content: Content) -> some View {
        ScrollView([.vertical, .horizontal], showsIndicators: showsIndicators) {
            content
                .frame(width: contentSize.width * scale, height: contentSize.height * scale, alignment: .center)
                .scaleEffect(scale, anchor: .center)
#if os(watchOS)
                .focusable(true)
                .digitalCrownRotation(detent: $currentScale,
                                      from: min,
                                      through: max,
                                      by: 0.1,
                                      sensitivity: .low,
                                      isContinuous: false,
                                      isHapticFeedbackEnabled: true)
#endif
        }
#if os(iOS)
        .gesture(ExclusiveGesture(zoomGesture, doubleTapGesture))
#elseif os(watchOS)
        .gesture(doubleTapGesture)
#endif
        .animation(.easeInOut, value: scale)
    }
}

extension View {
    func zoomable(contentSize: CGSize,
                  min: CGFloat = 1.0,
                  max: CGFloat = 3.0,
                  showsIndicators: Bool = false) -> some View {
        modifier(ZoomableModifier(contentSize: contentSize, min: min, max: max, showsIndicators: showsIndicators))
    }
}
```
<p>I'm using the modifier in this view:</p>
<pre class="lang-swift prettyprint-override"><code>struct FullscreenImage: View {
    let imageURL: URL

    @Environment(\.dismiss) var dismiss

    var body: some View {
        GeometryReader { proxy in
            AsyncImage(url: imageURL) { imagePhase in
                Group {
                    switch imagePhase {
                    case .success(let image):
                        image
                            .resizable()
                            .aspectRatio(contentMode: .fit)
                            .frame(width: proxy.size.width, height: proxy.size.height)
                            .zoomable(contentSize: proxy.size)
                    case .failure(let error):
                        Text(error.localizedDescription)
                            .font(.caption)
                            .padding()
                    default:
                        Rectangle()
                            .fill(Color.white.opacity(0.2))
                    }
                }
                .animation(.easeInOut, value: imagePhase)
            }
        }
    }
}
</code>```

I would expect there to be a way to disable digital crown scrolling for the scroll view when using the .digitalCrownRotation() modifier, but I haven't found one. Thus, when I rotate the digital crown, it tries to scroll the scroll view instead of changing the scale factor to get the zoom effect I'm looking for.

Body:
I'm working on a SwiftUI modifier (ZoomableModifier) that will be predominantly used for making images zoomable. I want this to work on both iOS and watchOS, but particularly on watchOS. I want it to be possible to use the digital crown to zoom in and out, and to achieve this I'm using the .digitalCrownRotation() modifier to read the rotation of the digital crown and use that to determine the scale factor.

Here's the code for the modifier:

//
//  ZoomableModifier.swift
//
//  Created by jasu on 2022/01/26.
//  Modified by Toni Sucic on 2023/01/08.
//  Copyright (c) 2022 jasu All rights reserved.
//
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is furnished
//  to do so, subject to the following conditions:
//
//  The above copyright notice and this permission notice shall be included in all
//  copies or substantial portions of the Software.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
//  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
//  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
//  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
//  CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
//  OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

import SwiftUI

public struct ZoomableModifier: ViewModifier {

    private enum ZoomState {
        case inactive
        case active(scale: CGFloat)

        var scale: CGFloat {
            switch self {
            case .active(let scale):
                return scale
            default:
                return 1.0
            }
        }
    }

    /// The content size of the views.
    let contentSize: CGSize
    /// The minimum value that can be zoom out.
    let min: CGFloat
    /// The maximum value that can be zoom in.
    let max: CGFloat
    /// A value that indicates whether the scroll view displays the scrollable component of the content offset, in a way that’s suitable for the platform.
    let showsIndicators: Bool

#if os(iOS)
    @GestureState private var zoomState = ZoomState.inactive
#endif
    @State private var currentScale: CGFloat = 1.0

    var scale: CGFloat {
#if os(iOS)
        currentScale * zoomState.scale
#elseif os(watchOS)
        currentScale
#endif
    }

#if os(iOS)
    var zoomGesture: some Gesture {
        MagnificationGesture()
            .updating($zoomState) { value, state, transaction in
                state = .active(scale: value)
            }
            .onEnded { value in
                var new = currentScale * value
                if new <= min { new = min }
                if new >= max { new = max }
                currentScale = new
            }
    }
#endif

    var doubleTapGesture: some Gesture {
        TapGesture(count: 2).onEnded {
            if scale <= min { currentScale = max } else
            if scale >= max { currentScale = min } else {
                currentScale = ((max - min) * 0.5 + min) < scale ? max : min
            }
        }
    }

    public func body(content: Content) -> some View {
        ScrollView([.vertical, .horizontal], showsIndicators: showsIndicators) {
            content
                .frame(width: contentSize.width * scale, height: contentSize.height * scale, alignment: .center)
                .scaleEffect(scale, anchor: .center)
#if os(watchOS)
                .focusable(true)
                .digitalCrownRotation(detent: $currentScale,
                                      from: min,
                                      through: max,
                                      by: 0.1,
                                      sensitivity: .low,
                                      isContinuous: false,
                                      isHapticFeedbackEnabled: true)
#endif
        }
#if os(iOS)
        .gesture(ExclusiveGesture(zoomGesture, doubleTapGesture))
#elseif os(watchOS)
        .gesture(doubleTapGesture)
#endif
        .animation(.easeInOut, value: scale)
    }
}

extension View {
    func zoomable(contentSize: CGSize,
                  min: CGFloat = 1.0,
                  max: CGFloat = 3.0,
                  showsIndicators: Bool = false) -> some View {
        modifier(ZoomableModifier(contentSize: contentSize, min: min, max: max, showsIndicators: showsIndicators))
    }
}

I'm using the modifier in this view:

struct FullscreenImage: View {
    let imageURL: URL

    @Environment(\.dismiss) var dismiss

    var body: some View {
        GeometryReader { proxy in
            AsyncImage(url: imageURL) { imagePhase in
                Group {
                    switch imagePhase {
                    case .success(let image):
                        image
                            .resizable()
                            .aspectRatio(contentMode: .fit)
                            .frame(width: proxy.size.width, height: proxy.size.height)
                            .zoomable(contentSize: proxy.size)
                    case .failure(let error):
                        Text(error.localizedDescription)
                            .font(.caption)
                            .padding()
                    default:
                        Rectangle()
                            .fill(Color.white.opacity(0.2))
                    }
                }
                .animation(.easeInOut, value: imagePhase)
            }
        }
    }
}

I would expect there to be a way to disable digital crown scrolling for the scroll view when using the .digitalCrownRotation() modifier, but I haven't found one. Thus, when I rotate the digital crown, it tries to scroll the scroll view instead of changing the scale factor to get the zoom effect I'm looking for.


问:
getting this Error: "You don't have permission to access that port" for all the ports I have tried
Getting this Error: "You don't have permission to access that port" for every solution I have tried to run the server

python3 manage.py runserver

enter image description here

sudo python3 manage.py runserver 80

enter image description here

python manage.py runserver localhost:18080

enter image description here

python3 manage.py runserver --insecure 0.0.0.0:80

enter image description here

I have used several cmds to run django server but for all these I am getting the same error


问:
how can I get habit count by user in django orm
I would like to get num of habitlog by owner. so, coding api

this is my models.py

```<code>
#Models.py
class MakingHabit(SoftDeleteModelMixin, TimestampMixin):
    owner = models.ForeignKey(
        User, on_delete=models.CASCADE, related_name="making_habits"
    )
    title = models.CharField(_("title"), max_length=255)
    method = models.CharField(_("method for recording"), max_length=255)

class HabitLog(SoftDeleteModelMixin, TimestampMixin):
    habit = models.ForeignKey(
        MakingHabit, on_delete=models.CASCADE, related_name="logs"
    )
    date = models.DateField(default=date.today)
    image = models.FileField(_("evidence image"), null=True, blank=True)
</code>```

this is viewsets.py

```<code>@action(methods=["GET"], detail=False, url_path="habitrank", url_name="habitrank")
    def habitrank(self, request, *args, **kwargs):
        logs = HabitLog.objects.values('habit__owner').annotate(habit_count=Count('date'))
        for log in logs:
            print(log)
</code>```

this print

enter image description here

it's not working what i want.

so, I coding different

```<code>@action(methods=["GET"], detail=False, url_path="habitrank", url_name="habitrank")
    def habitrank(self, request, *args, **kwargs):
        logs = HabitLog.objects.values('date').annotate(habit_count=Count('habit__owner'))
        for log in logs:
            print(log)
</code>```

it work what i want
this print

enter image description here

why the first query not working?

Body:
I would like to get num of habitlog by owner. so, coding api

this is my models.py

#Models.py
class MakingHabit(SoftDeleteModelMixin, TimestampMixin):
    owner = models.ForeignKey(
        User, on_delete=models.CASCADE, related_name="making_habits"
    )
    title = models.CharField(_("title"), max_length=255)
    method = models.CharField(_("method for recording"), max_length=255)

class HabitLog(SoftDeleteModelMixin, TimestampMixin):
    habit = models.ForeignKey(
        MakingHabit, on_delete=models.CASCADE, related_name="logs"
    )
    date = models.DateField(default=date.today)
    image = models.FileField(_("evidence image"), null=True, blank=True)

this is viewsets.py

@action(methods=["GET"], detail=False, url_path="habitrank", url_name="habitrank")
    def habitrank(self, request, *args, **kwargs):
        logs = HabitLog.objects.values('habit__owner').annotate(habit_count=Count('date'))
        for log in logs:
            print(log)

this print

enter image description here

it's not working what i want.

so, I coding different

@action(methods=["GET"], detail=False, url_path="habitrank", url_name="habitrank")
    def habitrank(self, request, *args, **kwargs):
        logs = HabitLog.objects.values('date').annotate(habit_count=Count('habit__owner'))
        for log in logs:
            print(log)

it work what i want
this print

enter image description here

why the first query not working?


问:
Python Report Writing with flexible templates for report body rows
I have a need to create reports from Python.  Our existing reporting system for my Volunteer Fire Company is being deprecated, and it had some idiosyncrasies anyway. Everything I'm looking at that seems feasible uses a template for the report body.  Before I get too far down a dead end path trying different methods, I'd like to know if anyone knows of anything out there that can do something like this.  Specifically, conditional formatting in a row in the body.  Below is what we get currently- today I do the bolding of the rows manually based on our criteria of 33% or better.  In my code I'll obviously know if the row deserves to be bolded- but everything I'm looking at that uses a template wouldn't allow this.  The end result will be a PDF, but if I have to go through Excel, Word, HTML, or whatever to get there, I'll check it out. Sorry for the non-specific question, but I could potentially churn a lot more wasted time looking for something when somebody may already know what to use.  Thanks.


问:
You want label.new to be displayed once per long or short
I need to display Label.new AVG at a fixed % of the Long or Short signal, now I have AVG appear every time the price reaches 2% of the Long or Short point. How can I make AVG appear only once, before the next signal?</p>
```<code>// Изменения в (%)
stopPer = input.float(5, title='Stop Loss %') / 100
takePer = input.float(5, title='Take Profit %') / 100
avgper = input.float(2,title='AVG %') / 100

//определить, каким был последний сигнал (длинным или коротким)
long_short = 0
long_last = long and (nz(long_short[1]) == 0 or nz(long_short[1]) == -1)
short_last = short and (nz(long_short[1]) == 0 or nz(long_short[1]) == 1)
long_short := long_last ? 1 : short_last ? -1 : long_short[1]

//Расчет входа
longPrice = ta.valuewhen(long_last, close, 0)
shortPrice = ta.valuewhen(short_last, close, 0)
/////
//Calculating AVG.
avgPrice = (long_short == 1 ? longPrice : na) * (1 - avgper)
//determine whether the price intersects with the avgPrice
crossedAbove = ta.crossover(close, avgPrice)
crossedBelow = ta.crossunder(close, avgPrice)

// If the price has crossed avgPrice, set avgHit to true, but only if it
avgHit = (crossedAbove or crossedBelow) and not (close >= avgPrice)
if avgHit
    label.new(bar_index, low, "AVG",color=color.new(#3f2fb4, 0), style = label.style_label_up, textcolor=color.new(color.white, 0), size = size.small)
/////
</code>```

Body:
I need to display Label.new AVG at a fixed % of the Long or Short signal, now I have AVG appear every time the price reaches 2% of the Long or Short point. How can I make AVG appear only once, before the next signal?

// Изменения в (%)
stopPer = input.float(5, title='Stop Loss %') / 100
takePer = input.float(5, title='Take Profit %') / 100
avgper = input.float(2,title='AVG %') / 100

//определить, каким был последний сигнал (длинным или коротким)
long_short = 0
long_last = long and (nz(long_short[1]) == 0 or nz(long_short[1]) == -1)
short_last = short and (nz(long_short[1]) == 0 or nz(long_short[1]) == 1)
long_short := long_last ? 1 : short_last ? -1 : long_short[1]

//Расчет входа
longPrice = ta.valuewhen(long_last, close, 0)
shortPrice = ta.valuewhen(short_last, close, 0)
/////
//Calculating AVG.
avgPrice = (long_short == 1 ? longPrice : na) * (1 - avgper)
//determine whether the price intersects with the avgPrice
crossedAbove = ta.crossover(close, avgPrice)
crossedBelow = ta.crossunder(close, avgPrice)

// If the price has crossed avgPrice, set avgHit to true, but only if it
avgHit = (crossedAbove or crossedBelow) and not (close >= avgPrice)
if avgHit
    label.new(bar_index, low, "AVG",color=color.new(#3f2fb4, 0), style = label.style_label_up, textcolor=color.new(color.white, 0), size = size.small)
/////


问:
TypeScript types by using Node multiprocessing are falsly assumed undefined
Using TypeScript to write a multiprocessing Node application I see the problem that e.g. this code is creating a compiler error although it's definitely working:

```<code>// main.ts
import * as child from 'child_process';
child.fork('my_fork.js', [], {});
</code>```
```<code>// my_fork.ts
process.send({command: 42});  // Error: Cannot invoke an object which is possibly 'undefined'.
(<Required<typeof process>>process).send({command: 42}); // fine, but ugly
</code>```

So how can I tell TypeScript that inside my_fork.ts the process.send will never be undefined?

Body:
Using TypeScript to write a multiprocessing Node application I see the problem that e.g. this code is creating a compiler error although it's definitely working:

// main.ts
import * as child from 'child_process';
child.fork('my_fork.js', [], {});

// my_fork.ts
process.send({command: 42});  // Error: Cannot invoke an object which is possibly 'undefined'.
(<Required<typeof process>>process).send({command: 42}); // fine, but ugly

So how can I tell TypeScript that inside my_fork.ts the process.send will never be undefined?


问:
NEXTJS 13 - Images with z layer not working after upgrading?
I upgraded my project from 12 to 13.

These are the commands that were used:

```<code>yarn upgrade next react react-dom eslint-config-next --latest
</code>```

I used the codemods that were supplied on the nextjs website for the upgrade:

```<code>new-link

next-image-to-legacy-image

next-image-experimental
</code>```

I've also tried using a normal img component, which still didn't work so I feel that it's the full upgrade that might be causing me the issue.

The project has a lot of images that overlap one other.

```<code>  <div className={classNames(styles.overlapGrid, styles.crispy)}>
      {imageLayers
        ?.sort((a, b) => (a.layer > b.layer ? 1 : -1))
        .map((item, i) => (
          <Image
            key={i.toString()}
            src={'images/' + item.src}
            width={props.scale * 150}
            height={props.scale * 150}
            min-width={100}
            min-height={150}
            layout="fixed"
            alt=''
          />
        ))}
    </div>
</code>```

my component.module.css file:

```<code>.overlapGrid {
  display: grid;
  grid-template-areas: "overlay";
  align-self: center;
}

.overlapGrid > span {
  grid-area: overlay;
}

.overlapGrid > div {
  grid-area: overlay;
}

.overlapGrid > div:nth-child(2) {
  /* offset to kill bug where image is 1px too high */
  top: 1px;
}

.crispy {
  /* IE, only works on <img> tags */
  -ms-interpolation-mode: nearest-neighbor;
  /* Firefox */
  image-rendering: crisp-edges;
  /* Chromium + Safari */
  image-rendering: pixelated;
}

</code>```

When these layers are upgraded, they do not overlap like they used to.

They just are pushed down below each other.

If I revert to before the upgrade it works fine.

Body:
I upgraded my project from 12 to 13.

These are the commands that were used:

yarn upgrade next react react-dom eslint-config-next --latest

I used the codemods that were supplied on the nextjs website for the upgrade:

new-link

next-image-to-legacy-image

next-image-experimental

I've also tried using a normal img component, which still didn't work so I feel that it's the full upgrade that might be causing me the issue.

The project has a lot of images that overlap one other.

      {imageLayers
        ?.sort((a, b) => (a.layer > b.layer ? 1 : -1))
        .map((item, i) => (
          <Image
            key={i.toString()}
            src={'images/' + item.src}
            width={props.scale * 150}
            height={props.scale * 150}
            min-width={100}
            min-height={150}
            layout="fixed"
            alt=''
          />
        ))}

my component.module.css file:

.overlapGrid {
  display: grid;
  grid-template-areas: "overlay";
  align-self: center;
}

.overlapGrid > span {
  grid-area: overlay;
}

.overlapGrid > div {
  grid-area: overlay;
}

.overlapGrid > div:nth-child(2) {
  /* offset to kill bug where image is 1px too high */
  top: 1px;
}

.crispy {
  /* IE, only works on  tags */
  -ms-interpolation-mode: nearest-neighbor;
  /* Firefox */
  image-rendering: crisp-edges;
  /* Chromium + Safari */
  image-rendering: pixelated;
}

When these layers are upgraded, they do not overlap like they used to.

They just are pushed down below each other.

If I revert to before the upgrade it works fine.


问:
using data attribute
hi i am making a drum kit with vanila js
I want to make the border-color change to the color corresponding to the keyboard when I press the keyboard.
i want to use data-* attribute in css</p>

Title: using data attribute


问:
Javascript Function to change value on slide
I have a book slider, It was copied from this project. https://github.com/Coding110/bkt-album/blob/master/js/onload.js

I want to call my function when someone is sliding/changing/Fliping a page. I can't find which function is working while changing the page.

I want to add this function

```<code>let pageNumber = 1;

function changePageNumber(amount) {
  if (amount > 0) {
    if (pageNumber >= 12) {
      return;
    }
    pageNumber += 1;
  } else {
    if (pageNumber <= 1) {
      return;
    }
    pageNumber -= 1;
  }
}
</code>```

I added this code in onload.js but the function is not being called, Or maybe I am not placing it in correct function.

```<code>if (Math.abs(self.delta_s) > 5) {
    // existing code...
  } else {
    // Calculate the distance swiped and determine whether to increase or decrease the page number
    var distanceSwiped = self.x_move - self.x_start;
    if (distanceSwiped > 0) {
      changePageNumber(-1);
    } else if (distanceSwiped < 0) {
      changePageNumber(1);
    }
  }
});
</code>```

How can I solve it? Thanks.

Edit1:

in my index.php this is where I am calling it.

```<code><div class="content_large_image">
           <div id="fb5-ajax" data-cat="your_book_name" data-template="true">
              <div class="fb5-preloader"></div>
              <div id="fb5">
                 <section id="config">
                    <ul>
                       <li key="page_width">918</li>
                       <!-- width for page -->
                       <li key="page_height">1298</li>
                       <!-- height for page -->
                       <li key="toolbar_visible">true</li>
                       <li key="lazy_loading_pages">false</li>
                       <li key="pdf_url"></li>
                       <li key="page_mode">single</li>
                       <li key="sound_sheet"></li>
                    </ul>
                 </section>
                 <div id="fb5-container-book">
                    <div id="fb5-book">
                      <?php
                        getimageformobile($pagedatesin, $stredition, $pgnum, $pgnum);
                    ?>
                    </div>
                 </div>
                 <a title="prev page" class="fb5-arrow-left" onclick="plusSCli();plusSlides(-1);">❮</a>
                 <a title="next page" class="fb5-arrow-right" onclick="plusSCli();plusSlides(1);">❯</a>
                 <!-- BEGIN SOUND FOR SHEET  -->
                 <audio preload="auto" id="sound_sheet"></audio>
                 <!-- END SOUND FOR SHEET -->
              </div>
           </div>
        </div>
</code>```

Here,

```<code><div id="fb5-container-book">
                        <div id="fb5-book">
                          <?php
                            getimageformobile($pagedatesin, $stredition, $pgnum, $pgnum);
                        ?>
                        </div>
                     </div>
</code>```

is the code which is calling the book slide from onload.js

Body:
I have a book slider, It was copied from this project. https://github.com/Coding110/bkt-album/blob/master/js/onload.js

I want to call my function when someone is sliding/changing/Fliping a page. I can't find which function is working while changing the page.

I want to add this function

let pageNumber = 1;

function changePageNumber(amount) {
  if (amount > 0) {
    if (pageNumber >= 12) {
      return;
    }
    pageNumber += 1;
  } else {
    if (pageNumber <= 1) {
      return;
    }
    pageNumber -= 1;
  }
}

I added this code in onload.js but the function is not being called, Or maybe I am not placing it in correct function.

if (Math.abs(self.delta_s) > 5) {
    // existing code...
  } else {
    // Calculate the distance swiped and determine whether to increase or decrease the page number
    var distanceSwiped = self.x_move - self.x_start;
    if (distanceSwiped > 0) {
      changePageNumber(-1);
    } else if (distanceSwiped < 0) {
      changePageNumber(1);
    }
  }
});

How can I solve it? Thanks.

Edit1:

in my index.php this is where I am calling it.

918

1298

true

false

single

                      <?php
                        getimageformobile($pagedatesin, $stredition, $pgnum, $pgnum);
                    ?>

                 ❮
                 ❯

                 <audio preload="auto" id="sound_sheet"></audio>

Here,

                          <?php
                            getimageformobile($pagedatesin, $stredition, $pgnum, $pgnum);
                        ?>

is the code which is calling the book slide from onload.js


问:
Is there any solution to know when specific application was maximized and viewed? (windows 11)
I need track some historical logs of events when specific software as maximized and closed.
On this case I need the informations about when and how long a .doc file was viewed.

example:

2022-12-12 08:35:59 - Maximized for 35 seconds

2022-12-12 08:47:35- Maximized for 567 seconds

Do we have any solution for that? I already check in windows event viewer. But there's a bunch of log information there. I don't know how to filter... Do we have a ready to use software? or any straightforward procedure?

Thanks in advance!

I went to some options, but it's very complicated to get a linear procedure.

*Event Viewer
*Local Group Editor>Audit object access
*Software advanced security options>auditing


问:
Issue improving typing of array type for lib johnny-five
I'm trying to type the johnny-five library which the following .d.ts here is my current pull request, not finished HERE

I have two classes Board and Boards which take optionally board ID. ID can be a number or a string, but for simplicity i Accept that it can only be a string

I can instantiate the following way and what i would like to achieve

```<code>// Simple board
const boards = new Boards(["A", "B"]);
const boards = new Boards()
const boards = new Boards([{id: "A", port: "somePort"}, { port: "someOther"}, {id: "C"}])
</code>```

If ID are provided, then i want to be able to do

```<code>boards.byID("") // Auto-complete and check type "A"|"B or string or "A"|"C"|string
boards.on("ready", ({A,B,C}) => {
  // allow destructuring on the arg, because i know names which are keys.
}
</code>```

For sake of simplicity, I'm OK to force the user passing an ID: (marking the prop required, whereas it's not on the lib)

```<code>const board = new Board()
const board = new Board({id: "A", port: "fdsfsd"})

board.id is "A" or string
</code>```

Body:
I'm trying to type the johnny-five library which the following .d.ts here is my current pull request, not finished HERE

I have two classes Board and Boards which take optionally board ID. ID can be a number or a string, but for simplicity i Accept that it can only be a string

I can instantiate the following way and what i would like to achieve

// Simple board
const boards = new Boards(["A", "B"]);
const boards = new Boards()
const boards = new Boards([{id: "A", port: "somePort"}, { port: "someOther"}, {id: "C"}])

If ID are provided, then i want to be able to do

boards.byID("") // Auto-complete and check type "A"|"B or string or "A"|"C"|string
boards.on("ready", ({A,B,C}) => {
  // allow destructuring on the arg, because i know names which are keys.
}

For sake of simplicity, I'm OK to force the user passing an ID: (marking the prop required, whereas it's not on the lib)

const board = new Board()
const board = new Board({id: "A", port: "fdsfsd"})

board.id is "A" or string