问:
Angular Firebase when deployed but the page is blank
I deployed Angular project on firebase without problem but when i enter the website, nothing but a blank page appears.How can i solve this problem i am not getting any error.

1.ng build --configuration "production"

2.firebase init

3.Are you ready to proceed? (Y/n) Y

4.>(*) Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys

5.What do you want to use as your public directory? (public) dist/estelaa

6.Configure as a single-page app (rewrite all urls to /index.html)? (y/N) y

7.Set up automatic builds and deploys with GitHub? (y/N) n

8.File dist/estelaa/index.html already exists. Overwrite? (y/N) n

9.firebase deploy

index.html:

```<code><!doctype html>
<html lang="en">
<head>
  <link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.css"
/>
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.css" />
  <script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.js"></script>
<script src="https://static.iyzipay.com/plugins/v1/iyzico-buttons.min.js"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@500&family=Orbitron&display=swap" rel="stylesheet">

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
  <meta charset="utf-8">
  <title>Calienna Studio | Official Website</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="assets/favicon.jpg">
</head>
<body>

  <app-root class="asd"></app-root>
</body>
</html>

</code>```

firebase.json :

```<code>{
  "functions": {
    "predeploy": "npm --prefix \"$RESOURCE_DIR\" run build",
    "source": "functions"
  },
  "database": {
    "rules": "database.rules.json"
  },
  "storage": {
    "rules": "storage.rules"
  },
  "hosting": {
    "public": "dist/estelaa",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

</code>```

Body:
I deployed Angular project on firebase without problem but when i enter the website, nothing but a blank page appears.How can i solve this problem i am not getting any error.

1.ng build --configuration "production"

2.firebase init

3.Are you ready to proceed? (Y/n) Y

4.>(*) Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys

5.What do you want to use as your public directory? (public) dist/estelaa

6.Configure as a single-page app (rewrite all urls to /index.html)? (y/N) y

7.Set up automatic builds and deploys with GitHub? (y/N) n

8.File dist/estelaa/index.html already exists. Overwrite? (y/N) n

9.firebase deploy

index.html:

<!doctype html>

  <link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.css"
/>
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.css" />

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@500&family=Orbitron&display=swap" rel="stylesheet">

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
  <meta charset="utf-8">
  <title>Calienna Studio | Official Website</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="assets/favicon.jpg">

  <app-root class="asd"></app-root>

firebase.json :

{
  "functions": {
    "predeploy": "npm --prefix \"$RESOURCE_DIR\" run build",
    "source": "functions"
  },
  "database": {
    "rules": "database.rules.json"
  },
  "storage": {
    "rules": "storage.rules"
  },
  "hosting": {
    "public": "dist/estelaa",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}


来源: stackexchange

问:
loading data from GCS bucket to Sharepoint folder
I am working on a POC where I have to load data from GCS Bucket to a sharePoint Location.
I am using the below code but not able to get desired result.</p>
```<code>
# Import the storage library
from google.cloud import storage
client = storage.Client()
bucket_name = 'my-bucket'
file_name = 'my-file.csv'

# Download the file from GCS
bucket = client.bucket(bucket_name)
blob = bucket.blob(file_name)
blob.download_to_filename(file_name)

# Import the office365-rest-python-client library
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.files.file import File

# Set the SharePoint site URL
site_url = 'https://7rhjkshshgvavvd.sharepoint.com/sites/MyDemo/testing/'

# Authenticate with SharePoint
context = AuthenticationContext(url=site_url)
if context.acquire_token_for_user(username="XXXXXX", password="XXXXXX"):
    print("Authenticated with SharePoint")
else:
    print("Failed to authenticate with SharePoint")

# Construct a ClientContext object
client_context = ClientContext(site_url, context)

# Set the path to the file you want to upload
# Upload the file to SharePoint
file_creation_info = File.from_local_file(client_context)
sp_file = file_creation_info.upload()
client_context.execute_query()

print(f'File uploaded to SharePoint: {sp_file.server_relative_url}')

</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am working on a POC where I have to load data from GCS Bucket to a sharePoint Location.
I am using the below code but not able to get desired result.

# Import the storage library
from google.cloud import storage
client = storage.Client()
bucket_name = 'my-bucket'
file_name = 'my-file.csv'

# Download the file from GCS
bucket = client.bucket(bucket_name)
blob = bucket.blob(file_name)
blob.download_to_filename(file_name)

# Import the office365-rest-python-client library
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.files.file import File

# Set the SharePoint site URL
site_url = 'https://7rhjkshshgvavvd.sharepoint.com/sites/MyDemo/testing/'

# Authenticate with SharePoint
context = AuthenticationContext(url=site_url)
if context.acquire_token_for_user(username="XXXXXX", password="XXXXXX"):
    print("Authenticated with SharePoint")
else:
    print("Failed to authenticate with SharePoint")

# Construct a ClientContext object
client_context = ClientContext(site_url, context)

# Set the path to the file you want to upload
# Upload the file to SharePoint
file_creation_info = File.from_local_file(client_context)
sp_file = file_creation_info.upload()
client_context.execute_query()

print(f'File uploaded to SharePoint: {sp_file.server_relative_url}')


问:
How to correctly fill the permission declaration form in the google play console for READ_CALL_LOG permission
I have one application which used to be taking sensitive Call Log permissions.
android.permission.PROCESS_OUTGOING_CALLS
android.permission.READ_CALL_LOG

By using these permissions, I am processing incoming calls to display caller name from my local DB. After submitting my app, it is rejected. Got mail like Requested permissions do not match core functionality of the app.
Which option, I have to choose.
==== Permissions Choices =======

Default SMS handler

Default Phone handler

Default Assistant handler

Transactional backup and restore for users and archive for enterprise (time-limited/non-continuous)

Enterprise SMS call archives

Caller ID, spam detection, and blocking

Connected device companion apps (for example, smartwatch or automotive)

Cross-device synchronization or transfer of SMS or calls

SMS-based financial transactions and related activity where access is restricted to financial SMS transactions (for example, 5-digit messages)

SMS based money management

Proxy calls

Services - Carrier

Services - OEM

Device Automation

Physical safety / emergency alert apps (e.g., senior safety)

Call-based OTP account verification

Using SMS_CB_RECEIVED for customer communications (e.g., Smart Zone Cast service)

How to uses sensitive permissions Read_call_log in my app.


问:
Show list of users with comparison two references in Android Firebase
In Firebase I have the "users" where I save all users' information.

Now I want to show someone I like in the "Favor".

This is "Favors"

In "Favor", only my ID and people ID I added to the favor list

And this is "users":

In "users", I have all users' information inside people's ID

And this is my code to show all users

```<code>database.getReference().child("users").addValueEventListener(new ValueEventListener() {
    @Override
    public void onDataChange(@NonNull DataSnapshot snapshot) {
        users.clear();
        for(DataSnapshot snapshot1: snapshot.getChildren()){
            User user= snapshot1.getValue(User.class);

            if(!user.getUid().equals(FirebaseAuth.getInstance().getUid()) && hasChat != null)
                users.add(user);

        }
        binding.recyclerView.hideShimmerAdapter();
        usersAdapter.notifyDataSetChanged();
    }

    @Override
    public void onCancelled(@NonNull DatabaseError error) {

    }
});
</code>```

And this code i'm trying to show favor list, but it's show blank:

```<code> database.getReference().child("users").addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot snapshot) {
                users.clear();
                for (DataSnapshot snapshot1 : snapshot.getChildren()) {
                    User user = snapshot1.getValue(User.class);

                    if (!user.getUid().equals(FirebaseAuth.getInstance().getUid()) && user.getUid().equals(database.getReference().child("Favors").getKey()))
                        users.add(user);

                }
                binding.recyclerView.hideShimmerAdapter();
                usersAdapter.notifyDataSetChanged();
            }

            @Override
            public void onCancelled(@NonNull DatabaseError error) {

            }
        });
</code>```

Body:
In Firebase I have the "users" where I save all users' information.

Now I want to show someone I like in the "Favor".

This is "Favors"

In "Favor", only my ID and people ID I added to the favor list

And this is "users":

In "users", I have all users' information inside people's ID

And this is my code to show all users

database.getReference().child("users").addValueEventListener(new ValueEventListener() {
    @Override
    public void onDataChange(@NonNull DataSnapshot snapshot) {
        users.clear();
        for(DataSnapshot snapshot1: snapshot.getChildren()){
            User user= snapshot1.getValue(User.class);

            if(!user.getUid().equals(FirebaseAuth.getInstance().getUid()) && hasChat != null)
                users.add(user);

        }
        binding.recyclerView.hideShimmerAdapter();
        usersAdapter.notifyDataSetChanged();
    }

    @Override
    public void onCancelled(@NonNull DatabaseError error) {

    }
});

And this code i'm trying to show favor list, but it's show blank:

 database.getReference().child("users").addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot snapshot) {
                users.clear();
                for (DataSnapshot snapshot1 : snapshot.getChildren()) {
                    User user = snapshot1.getValue(User.class);

                    if (!user.getUid().equals(FirebaseAuth.getInstance().getUid()) && user.getUid().equals(database.getReference().child("Favors").getKey()))
                        users.add(user);

                }
                binding.recyclerView.hideShimmerAdapter();
                usersAdapter.notifyDataSetChanged();
            }

            @Override
            public void onCancelled(@NonNull DatabaseError error) {

            }
        });


问:
Select one option only using Multi Select Dialog Field Flutter
I'm using the MultiSelectDialogField widget, but I wanted the user to be able to select only one option, does anyone know if there's a way to do this with this widget?
Or if there is another widget with dialog that is more recommended?

 MultiSelectDialogField(
            searchable: true,
            items: _itensStudent,
            title: const Text("Students"),
            selectedColor: Colors.black,
            decoration: BoxDecoration(
              border: Border.all(
                color: theme.primaryColor,
                width: 2,
              ),
            ),
            isDismissible: false,
            buttonText: Text(
              "Select student",
              style: TextStyle(
                color: theme.primaryColor,
                fontSize: 16,
              ),
            ),
            chipDisplay: MultiSelectChipDisplay.none(),
            onConfirm: (results) {
            },
          ),
```


问:
How do i trasform multiple Ascii files to dfs2 files?
Is if possible to use any code for changing Ascii (text) file to create dfs2 files?   Can this be done in Mike Zero for multiple files? Now i can use Mike Zero tool box for changing each file in a time.</p>


问:
R-error: "number of levels of each grouping factor must be < number of observations"
I'm relatively new to R and have to perform a Linear Mixed Model-Analysis on some data for my university studies.

To describe my data ("data_complete_group"):
I tested flow (variable: "fss_M") for individual soccer players deriving from 4 different teams. Each team (and therefore each player in the related team) was allocated to one of two conditions of the variable "group".
Each person also completed three different surveys on three different days and therefore had a personalized "ID" (which is also a variable in the model).
The variable "team_num" represents the related team for each player.

I now want test whether the group-factor has a significant influence on the flow-score.
The model looks as follows:

```<code>model1 <- lmer(fss_M ~ group + (1 + group|team_num/ID), data = data_complete_group)
summary(model1)

</code>```

If I understood it correctly, this means that "fss_M ~ group" is the fixed effect with "1 + group|team_num/ID" as random effect.
Unfortunately I get an error message when I want to run the code:

```<code>Eror: number of levels of each grouping factor must be < number of observations (problems: ID:team_num)
</code>```

In contrast to that, the analysis works when I remove the term for the random effect.
How can I understand this? What's wrong with the code for the analysis with fixed + random effect?

I'm glad for every answer to this, thanks a lot!

Body:
I'm relatively new to R and have to perform a Linear Mixed Model-Analysis on some data for my university studies.

To describe my data ("data_complete_group"):
I tested flow (variable: "fss_M") for individual soccer players deriving from 4 different teams. Each team (and therefore each player in the related team) was allocated to one of two conditions of the variable "group".
Each person also completed three different surveys on three different days and therefore had a personalized "ID" (which is also a variable in the model).
The variable "team_num" represents the related team for each player.

I now want test whether the group-factor has a significant influence on the flow-score.
The model looks as follows:

model1 <- lmer(fss_M ~ group + (1 + group|team_num/ID), data = data_complete_group)
summary(model1)

If I understood it correctly, this means that "fss_M ~ group" is the fixed effect with "1 + group|team_num/ID" as random effect.
Unfortunately I get an error message when I want to run the code:

Eror: number of levels of each grouping factor must be < number of observations (problems: ID:team_num)

In contrast to that, the analysis works when I remove the term for the random effect.
How can I understand this? What's wrong with the code for the analysis with fixed + random effect?

I'm glad for every answer to this, thanks a lot!


问:
filter in array of object in object
hope you can help me:

i try to get all the user who have the techno name on their abilities.

my json object look like (fake data):
`

```<code>[
    {
        "name": "Thomas",
        "firstname": "pardou",
        "job": "Backend developer",
        "technos": [
            {
                "name": "Javascript",
                "appreciation": "Beginner"
            },
            {
                "name": "Php",
                "appreciation": "Expert"
            },
            {
                "name": "Ruby",
                "appreciation": "Regular"
            },
            {
                "name": "Scrum",
                "appreciation": "Ignore"
            },
            {
                "name": "Démarchage",
                "appreciation": "Guru"
            }
        ],
        "missions": [
            [
                {
                    "name": "Backend Developer"
                },
                {
                    "name": "Product Owner"
                }
            ]
        ],
        "createdAt": "2022-12-22T11:46:08.193Z",
        "updatedAt": "2022-12-22T11:46:08.193Z",
        "id": "63a44380da6f96d105b6d86b"
    }
]
</code>```

i try to di it with :

```<code>    let filteredData = userData.filter(e => e.technos.name === data.name)

</code>```

anyone can help me with a solution ? thanks

Title: filter in array of object in object

Body:
hope you can help me:

i try to get all the user who have the techno name on their abilities.

my json object look like (fake data):
`

[
    {
        "name": "Thomas",
        "firstname": "pardou",
        "job": "Backend developer",
        "technos": [
            {
                "name": "Javascript",
                "appreciation": "Beginner"
            },
            {
                "name": "Php",
                "appreciation": "Expert"
            },
            {
                "name": "Ruby",
                "appreciation": "Regular"
            },
            {
                "name": "Scrum",
                "appreciation": "Ignore"
            },
            {
                "name": "Démarchage",
                "appreciation": "Guru"
            }
        ],
        "missions": [
            [
                {
                    "name": "Backend Developer"
                },
                {
                    "name": "Product Owner"
                }
            ]
        ],
        "createdAt": "2022-12-22T11:46:08.193Z",
        "updatedAt": "2022-12-22T11:46:08.193Z",
        "id": "63a44380da6f96d105b6d86b"
    }
]

i try to di it with :

    let filteredData = userData.filter(e => e.technos.name === data.name)

anyone can help me with a solution ? thanks


问:
How can I put a single Quote in a string without the backslash in VBA?
I want to format the data of my table with a number format like this:
wsOptimisation.ListObjects("tblOptiData").DataBodyRange.NumberFormat = "#'##0.0 ""mm"""
If I run this Code it pastes it like this:
#\'##0.0 "mm"
VBA adds the backslash and thus it won't get recognized as the 1000 seperator.

Edit:
I changed the 1000 seperator from , to '

How can I get rid of the backslash?

Image from Format Cells Window in Excel:
excel

I tried using the Chr(39) function, but same issue.


问:
How to keep specific pixels untouched and the rest of pixels are trained and generated in GANs?
I want 2 pixels to be fixed and not changed in fake generated images in generator.
I have a feeling that masking that specific pixels are needed. But I dont know how exactly to do so in GANs training procedure. Because even though I mask the pixels before training loop starts, I do not know how to leave the fixed pixels not to be used in generating scene. I wish someone can code up a bit to show how it should be done.

Or I just need to train it and then replace those generated two pixel locations with original pixel values that I want to fix with? But this must distort other pixel values because I generated the two pixels as well that shouldnt be affected and affecting other pixels.


问:
Spring Boot Neo4jRepository Find All Items With Stream
You know that there is a stream find-all method under JpaRepository:

```<code>@QueryHints(value = {
    @QueryHint(name = HINT_FETCH_SIZE, value = ""),
    @QueryHint(name = HINT_CACHEABLE, value = "false"),
    @QueryHint(name = HINT_READONLY, value = "true"),
})
Stream<PaidKeyword> findAllBy();
</code>```

Can I handle same/similar method for Neo4jRepository?

My purpose is so simple. To fetch all data (~5M) partially and effectively. Otherwise, I got timeout errors...

Body:
You know that there is a stream find-all method under JpaRepository:

@QueryHints(value = {
    @QueryHint(name = HINT_FETCH_SIZE, value = ""),
    @QueryHint(name = HINT_CACHEABLE, value = "false"),
    @QueryHint(name = HINT_READONLY, value = "true"),
})
Stream<PaidKeyword> findAllBy();

Can I handle same/similar method for Neo4jRepository?

My purpose is so simple. To fetch all data (~5M) partially and effectively. Otherwise, I got timeout errors...


问:
Multiple Azure Storage Integration with Rails 6 application
I have used Azure Active Storage for all the user files that are uploaded on my application developed using Rails v6. Works perfectly fine.

Now I wanted to make a copy of the files that are getting uploaded on my application to Another Azure storage account. How can I go about this approach. Any help would be much appreciated.


问:
Webpack Vendor Files: Importing From node_modules Seems Inconsistent
This past week it took me way too long to get Webpack set up and running.  The biggest hurdle wasn't the technology, but rather my lack of understanding of how to properly configure the imports file.  There seems to be some inconsistency there.

For example:

In some cases you may include a package by simply referencing the node_modules folder:

```<code>import "bootstrap";
</code>```

At other times it appears you must get oddly specific and reference a particular file:

```<code>import "summernote/dist/summernote-lite.min.js";
</code>```

Sometimes a combination of the two is necessary:

```<code>import "datatables.net-bs5";
</code>```
```<code>import "datatables.net-buttons-bs5";
</code>```
```<code>import "datatables.net-bs5/css/dataTables.bootstrap5.min.css";
</code>```
```<code>import "datatables.net-buttons-bs5/css/buttons.bootstrap5.min.css";
</code>```
```<code>import "datatables.net-buttons/js/buttons.html5.min.js";
</code>```
```<code>import "datatables.net-buttons/js/buttons.print.min.js";
</code>```
```<code>import "datatables.net-buttons/js/buttons.colvis.min.js";
</code>```

Don't get too hung up on the imports themselves.  I just want to have a better idea of how to approach this sort of set up in the future.  I spent way too much time looking at what files the example pages on a site were pulling in from a CDN, pulling in those same files, and failing.  Clearly building resources from Webpack has some mojo going on that I don't understand.

So how do I know when to simply reference the node_modules folder and when I need to dig into the directory and reference a particular file?

Body:
This past week it took me way too long to get Webpack set up and running.  The biggest hurdle wasn't the technology, but rather my lack of understanding of how to properly configure the imports file.  There seems to be some inconsistency there.

For example:

In some cases you may include a package by simply referencing the node_modules folder:

import "bootstrap";

At other times it appears you must get oddly specific and reference a particular file:

import "summernote/dist/summernote-lite.min.js";

Sometimes a combination of the two is necessary:

import "datatables.net-bs5";

import "datatables.net-buttons-bs5";

import "datatables.net-bs5/css/dataTables.bootstrap5.min.css";

import "datatables.net-buttons-bs5/css/buttons.bootstrap5.min.css";

import "datatables.net-buttons/js/buttons.html5.min.js";

import "datatables.net-buttons/js/buttons.print.min.js";

import "datatables.net-buttons/js/buttons.colvis.min.js";

Don't get too hung up on the imports themselves.  I just want to have a better idea of how to approach this sort of set up in the future.  I spent way too much time looking at what files the example pages on a site were pulling in from a CDN, pulling in those same files, and failing.  Clearly building resources from Webpack has some mojo going on that I don't understand.

So how do I know when to simply reference the node_modules folder and when I need to dig into the directory and reference a particular file?


问:
How to put application live on firebase or other which is using node packages to start (npm start)
When I added one page website live by firebase I didn't have any problems but now It's empty website. To start my application I'm using npm start but when its live its imposible. I'm quite fresh with programing. Please be understanting and if you can please help. Thanks for any help.</p>


问:
Found array with 0 sample(s) (shape=(0, 1)) while a minimum of 1 is required
```<code>from sklearn.model_selection import train_test_split
X_train,X_test,y_train,y_test=train_test_split(default.drop(labels=['ID'], axis=1),
    default['ID'],
    test_size=0.3,
    random_state=0)
</code>```
```<code>from sklearn.feature_selection import mutual_info_classif
# determine the mutual information
mutual_info = mutual_info_classif(X_train, y_train.values.ravel())
mutual_info
</code>```

the result is :

```<code> Found array with 0 sample(s) (shape=(0, 1)) while a minimum of 1 is required.
</code>```

i dont how to fix it.

The resul of mutual_info

Body:
from sklearn.model_selection import train_test_split
X_train,X_test,y_train,y_test=train_test_split(default.drop(labels=['ID'], axis=1),
    default['ID'],
    test_size=0.3,
    random_state=0)

from sklearn.feature_selection import mutual_info_classif
# determine the mutual information
mutual_info = mutual_info_classif(X_train, y_train.values.ravel())
mutual_info

the result is :

 Found array with 0 sample(s) (shape=(0, 1)) while a minimum of 1 is required.

i dont how to fix it.

The resul of mutual_info


问:
Airflow operator inside while loop
In Airflow, I have a modified DockerOperator. In the operator args I pass a random port for the port mapping. I choose the port randomly from a interval.

```<code>my_task = ModifiedDockerOperator(
  ...,
  port_mapping=_get_random_port_mapping(),
  ...)
</code>```

When I run more than one DAG with this operator concurrently, it is possible that I pass to the operator a port equal to the port other running operator is already using. It gives me an error, because you cannot use port mapping with the same host port on two Docker containers at the same time:

docker.errors.APIError: 500 Server Error ... Bind for 0.0.0.0:21099 failed: port is already allocated")

To solve the problem, I would like try starting the task repeatedly until it happens that _get_random_port_mapping() picks a port that is not in use by other running Docker container.

My approach was to place the operator on a while loop, with a try block. Something like this:

```<code>is_success = 0
while is_success < 1:
  try:
    operator = ModifiedDockerOperator(
      ...,
      port_mapping=_get_random_port_mapping(),
      ...)
    is_success += 1
  except:
    pass

my_task = operator
</code>```

The "while with try-except" approach had no effect. If the operator tries to run a container with a port that is already in use by other running container, I receive the exact same error that I was receiving before, without the "while with try-except".

Moreover, the "while loop" itself had no effect, as the task immediately fails in the first failed attempt to run the container, and do not try to instantiate the operator a second time.

What am I missing here?

Title: Airflow operator inside while loop

Body:
In Airflow, I have a modified DockerOperator. In the operator args I pass a random port for the port mapping. I choose the port randomly from a interval.

my_task = ModifiedDockerOperator(
  ...,
  port_mapping=_get_random_port_mapping(),
  ...)

When I run more than one DAG with this operator concurrently, it is possible that I pass to the operator a port equal to the port other running operator is already using. It gives me an error, because you cannot use port mapping with the same host port on two Docker containers at the same time:

docker.errors.APIError: 500 Server Error ... Bind for 0.0.0.0:21099 failed: port is already allocated")

To solve the problem, I would like try starting the task repeatedly until it happens that _get_random_port_mapping() picks a port that is not in use by other running Docker container.

My approach was to place the operator on a while loop, with a try block. Something like this:

is_success = 0
while is_success < 1:
  try:
    operator = ModifiedDockerOperator(
      ...,
      port_mapping=_get_random_port_mapping(),
      ...)
    is_success += 1
  except:
    pass

my_task = operator

The "while with try-except" approach had no effect. If the operator tries to run a container with a port that is already in use by other running container, I receive the exact same error that I was receiving before, without the "while with try-except".

Moreover, the "while loop" itself had no effect, as the task immediately fails in the first failed attempt to run the container, and do not try to instantiate the operator a second time.

What am I missing here?


问:
A faster Hessian vector product in PyTorch
I need to take a Hessian vector product of a loss w.r.t. model parameters a large number of times. It seems that there is no efficient way to do this and a for loop is always required, resulting in a large number of independent autograd.grad calls. My current implementation is given below, it is representative of my use case. Do note in the real case the collection of vectors v are not all known beforehand.

import torch
import time

# Create model
model = torch.nn.Sequential(torch.nn.Linear(1, 500), torch.nn.Tanh(), torch.nn.Linear(500, 1))
num_param = sum(p.numel() for p in model.parameters())

# Evaluate some loss on a random dataset
x = torch.rand((10000,1))
y = torch.rand((10000,1))
y_hat = model(x)
loss = ((y_hat - y)**2).mean()

# Calculate Jacobian of loss w.r.t. model parameters
J = torch.autograd.grad(loss, list(model.parameters()), create_graph=True)
J = torch.cat([e.flatten() for e in J]) # flatten

# Calculate Hessian vector product
start_time = time.time()
for i in range(10):
    v = torch.rand(num_param)
    HVP = torch.autograd.grad(J, list(model.parameters()), v, retain_graph=True)
print('Time per HVP: ', (time.time() - start_time)/10)
```

Which takes around 0.05 s per Hessian vector product on my machine. Is there a way to speed this up? Especially considering that the Hessian itself does not change in between calls.

Body:
I need to take a Hessian vector product of a loss w.r.t. model parameters a large number of times. It seems that there is no efficient way to do this and a for loop is always required, resulting in a large number of independent autograd.grad calls. My current implementation is given below, it is representative of my use case. Do note in the real case the collection of vectors v are not all known beforehand.

import torch
import time

# Create model
model = torch.nn.Sequential(torch.nn.Linear(1, 500), torch.nn.Tanh(), torch.nn.Linear(500, 1))
num_param = sum(p.numel() for p in model.parameters())

# Evaluate some loss on a random dataset
x = torch.rand((10000,1))
y = torch.rand((10000,1))
y_hat = model(x)
loss = ((y_hat - y)**2).mean()

# Calculate Jacobian of loss w.r.t. model parameters
J = torch.autograd.grad(loss, list(model.parameters()), create_graph=True)
J = torch.cat([e.flatten() for e in J]) # flatten

# Calculate Hessian vector product
start_time = time.time()
for i in range(10):
    v = torch.rand(num_param)
    HVP = torch.autograd.grad(J, list(model.parameters()), v, retain_graph=True)
print('Time per HVP: ', (time.time() - start_time)/10)

Which takes around 0.05 s per Hessian vector product on my machine. Is there a way to speed this up? Especially considering that the Hessian itself does not change in between calls.


问:
could not able to connect socket server to client
socket is not connecting on live server, although it is connecting in my local machine.

I tried to put connect_error on socket but it gives server error. What does it mean?


问:
What the benefits of "Shape" in yup?
As I saw examples on the internet I found out that some use shape and some use object without shape.

Can someone please explain the difference between a schema defined with Yup.object({...}) and Yup.object().shape({...})?

as I saw in ts the schema ith shape is Yup.ObjectSchema and without is OptionalObjectSchema but when testing validation there is no difference.

Title: What the benefits of "Shape" in yup?


问:
Can't use more than 32 Docker containers (networking issues)
I am currently setting up a multi-agent system in Docker, such that each agent is running in a separate container and communicates with the other agents within the Docker network.

Everything works fine, if I start less than 32 containers.
If I run more than that, the agents are not able to communicate anymore.

Further, the network on my host machine behaves strangely and I loose internet connection. The containers themselves start without any issues, though (only communication doesn't work). If I stop all containers, my host machine is connected to the internet again.

First, I create a custom Docker network:

```<code>docker network create --driver bridge agent_network --subnet 10.10.1.0/24
</code>```

I made sure that the IP range is not used by other services on my machine.

Next, I specify the custom network in my docker-compose.yml file which also contains my agents as services:

```<code>version: "3.8"

networks:
  default:
    external: true
    name: agent_network

services:
  agent:
    ...
</code>```

Finally, I run the system using the command:

```<code>docker-compose up --build --scale agent=32 agent
</code>```

Such that 32 instances of the agent as defined in the docker-compose.yml file are started.

The agents start successfully and there is no error from Docker concerning network issues. Only problem is, the agents don't receive any messages.

Does anyone has a solution to this problem? Many answers I found online were considering using the default bridge of Docker and mainpulating the address space. However, this doen't work either in my case and it's recommended to not use the default bridge by the Docker docs.

Also editing the /etc/docker/daemon.json file to expand the address space did not work.

If it helps, here are some technical details of my system:

Host machine OS: Ubuntu 22.04.1 LTS

Host machine IP: 192.168.0.34

Docker: 20.10.22

docker-compose: 1.29.2

Update 1:

Below is the output of the command docker network inspect agent_network when the containers are running (43 containers were started):

```<code>[
    {
        "Name": "agent_network",
        "Id": "7e5a4b6abe02d01144690f62dad120660d11319abd34b3dc62de37ce3f0c2a0e",
        "Created": "2022-12-22T16:24:58.776012944+01:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "10.10.1.0/24"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "03fb10e0d4e0c1b28053ebb80294029f51018a91e84dadb266a8872be45d19ac": {
                "Name": "docker_iwt_agent_17",
                "EndpointID": "24c52fab24963827d02fa844f1c15a7b3d8296d9832b5b1f63cac1957a456a67",
                "MacAddress": "02:42:0a:0a:01:05",
                "IPv4Address": "10.10.1.5/24",
                "IPv6Address": ""
            },
            "05c91dabd601118ea8269d77756b69236eddd0d97918633542b5640cbc65738c": {
                "Name": "docker_iwt_agent_15",
                "EndpointID": "efc0abf1397e2e55b0496aedfdb4619edaf38213eb8ee952186a5953bdf05d43",
                "MacAddress": "02:42:0a:0a:01:28",
                "IPv4Address": "10.10.1.40/24",
                "IPv6Address": ""
            },
            "09cca2d89486b163314c402efa3e72a13a41e9c046837bec9d1308c63bd8288b": {
                "Name": "docker_iwt_agent_1",
                "EndpointID": "565d6010c9919eddfd98a937a532200d2477f87a8f056627f6b2abce8647a98e",
                "MacAddress": "02:42:0a:0a:01:10",
                "IPv4Address": "10.10.1.16/24",
                "IPv6Address": ""
            },
            "0b3f43c0f6d250619c5051a76549f7f2f70014e020cefa4816eabb3adb5fb885": {
                "Name": "docker_iwt_agent_8",
                "EndpointID": "10b691061cd220b8dfc030d3641512a9fba3bb9c08b9c4d3514f7f661eaffde2",
                "MacAddress": "02:42:0a:0a:01:03",
                "IPv4Address": "10.10.1.3/24",
                "IPv6Address": ""
            },
            "0b776566285f7be530ea91a4fd2295a459d4e27130e19f8e3181f1bb302ac493": {
                "Name": "docker_iwt_agent_25",
                "EndpointID": "cfc21fdee01fdfaba8d7e08f1f8c6e6a520c464b6fca219001119416b51ec906",
                "MacAddress": "02:42:0a:0a:01:16",
                "IPv4Address": "10.10.1.22/24",
                "IPv6Address": ""
            },
            "25b4d77eaf2a249bd516131565621ee41edf85e9cd66ef2950657de88cf80d21": {
                "Name": "docker_iwt_agent_11",
                "EndpointID": "203333983f3ec9382da87212e48b3afe4ba890e86c9159b1b58bc94d6e9c3d89",
                "MacAddress": "02:42:0a:0a:01:0c",
                "IPv4Address": "10.10.1.12/24",
                "IPv6Address": ""
            },
            "2654ba6e89d0153e59f2de477a787ab5b3064dd99284949d4db66d6bd659306d": {
                "Name": "docker_iwt_agent_24",
                "EndpointID": "89e5db4f584a584272a51cdf9301ff86b0931ae0cda786355829cbe8ac68ecb4",
                "MacAddress": "02:42:0a:0a:01:1d",
                "IPv4Address": "10.10.1.29/24",
                "IPv6Address": ""
            },
            "26a6b5d80abadcf9b27f5606d9e53ef44e25f11bc85dc2c651e8c3034af9b122": {
                "Name": "docker_iwt_agent_34",
                "EndpointID": "6c8de526c126eb62fd4f01a21b01a3aba12963ae7e684102babcdf7c32fa7858",
                "MacAddress": "02:42:0a:0a:01:2b",
                "IPv4Address": "10.10.1.43/24",
                "IPv6Address": ""
            },
            "2fda699d23ddf42546eefdc21b22b984f186eee10c9d087958d4fb4303b8a343": {
                "Name": "docker_iwt_agent_41",
                "EndpointID": "6410170b70bb49bf83d31c22e7eb3e0c8c8a79063f0705956e8a26683a4ab45b",
                "MacAddress": "02:42:0a:0a:01:0b",
                "IPv4Address": "10.10.1.11/24",
                "IPv6Address": ""
            },
            "38f653bb69ea04d1424b64bacf258f66380c3a276bbd3df50cb45b6f73eae5d5": {
                "Name": "docker_iwt_agent_20",
                "EndpointID": "13bd9bba90ceeda0de8e8bdc9d2a075e0f1dba86ff94ff5ab0f7517733ca67c7",
                "MacAddress": "02:42:0a:0a:01:14",
                "IPv4Address": "10.10.1.20/24",
                "IPv6Address": ""
            },
            "473e179b73f32b289435f3e3cbbb7f9a7034635d703fd66f7293893eabfb8802": {
                "Name": "docker_iwt_agent_22",
                "EndpointID": "22ce17c3dc719142bfa101d49583a2a0f71e1ec01a19c881621ebe66e8b4e211",
                "MacAddress": "02:42:0a:0a:01:1f",
                "IPv4Address": "10.10.1.31/24",
                "IPv6Address": ""
            },
            "581f91b16bc22949de0e60a85669c909c8748e5438a35b01ad10b8c3d18e5bce": {
                "Name": "docker_iwt_agent_6",
                "EndpointID": "b0c5ea84bd9d5e9a642d1b7317e5f8792fe28204bf88bde503273e4df2227b40",
                "MacAddress": "02:42:0a:0a:01:20",
                "IPv4Address": "10.10.1.32/24",
                "IPv6Address": ""
            },
            "58a966dd9478139d34ffa94355fe1daee168d7863cf211423e7f643f9f0b104f": {
                "Name": "docker_iwt_agent_40",
                "EndpointID": "f9e4efcc927fb4966d5b54c0210dbcf1f595222a1fb5f0c0607896dbb33d98e6",
                "MacAddress": "02:42:0a:0a:01:21",
                "IPv4Address": "10.10.1.33/24",
                "IPv6Address": ""
            },
            "5f63e021e176fcc714b9c9b4d7579c38467cfe6ef23d97038d2c8ee84c252028": {
                "Name": "docker_iwt_agent_35",
                "EndpointID": "c3be1cd49404b5b60e63a37601e50d09928c7caedc5d4697fac862fa4fc9d50b",
                "MacAddress": "02:42:0a:0a:01:0e",
                "IPv4Address": "10.10.1.14/24",
                "IPv6Address": ""
            },
            "6038fa2517624496e7fb5248841f5e1d28c22173ffeba9c1124ef4177e7761ed": {
                "Name": "docker_iwt_agent_21",
                "EndpointID": "b45812055779b2fc56e5a6c9765fef05b374089b626725f6e1f915661179d10c",
                "MacAddress": "02:42:0a:0a:01:29",
                "IPv4Address": "10.10.1.41/24",
                "IPv6Address": ""
            },
            "62f24f4a5c3ad9dbd8b604c4eb6d5a0e8fd8ce539008a486e71c4d6716cfd976": {
                "Name": "docker_iwt_agent_13",
                "EndpointID": "7bc2201c2a9b602d708e609882b5c6bfbbae7df0db9a341f4633deae6d37ab42",
                "MacAddress": "02:42:0a:0a:01:0f",
                "IPv4Address": "10.10.1.15/24",
                "IPv6Address": ""
            },
            "6a2a81660b72e3138ccddbfc70e8c907196217f7d5e5985e241eeb38a759477d": {
                "Name": "docker_iwt_agent_16",
                "EndpointID": "266df1ee74cca9e26dbe19350feff84530e37324001495c029058fffe63cceb3",
                "MacAddress": "02:42:0a:0a:01:12",
                "IPv4Address": "10.10.1.18/24",
                "IPv6Address": ""
            },
            "6aea9c53022d5155d05f8013091d001187afa968fb04e0d1ab0d987371b1f1ce": {
                "Name": "docker_iwt_agent_43",
                "EndpointID": "90b1e7e4ff057207d6ad11b1d0e46793f9b849c953508c02cfbb2b9cf5b52c56",
                "MacAddress": "02:42:0a:0a:01:19",
                "IPv4Address": "10.10.1.25/24",
                "IPv6Address": ""
            },
            "6e4847a8d50745a7b9bad71691367379c09e6cce8ee8117fffff0be19cb8c97f": {
                "Name": "docker_iwt_agent_31",
                "EndpointID": "8c5630ca5d6697140b316b0ab8e92c98eb707612eefa29002fae077525d6ac6a",
                "MacAddress": "02:42:0a:0a:01:18",
                "IPv4Address": "10.10.1.24/24",
                "IPv6Address": ""
            },
            "80aa000edc914d7ea8d9bbc3288eb5e61e1c200643b043deff704c4d7b6ccdaf": {
                "Name": "docker_iwt_agent_2",
                "EndpointID": "a3e6fb766d3ed3b23b7447d0524a791e8b70e2e8c558f9f3be46d6e2ee35e050",
                "MacAddress": "02:42:0a:0a:01:04",
                "IPv4Address": "10.10.1.4/24",
                "IPv6Address": ""
            },
            "85ef36d28f6decbb58f8140fc78f96dc33acf39142f00224baaa0bdede26b77a": {
                "Name": "docker_iwt_agent_12",
                "EndpointID": "35a6e014b1231f5f5b9eece616543f600d41a40036a50e373617e7801bf42593",
                "MacAddress": "02:42:0a:0a:01:27",
                "IPv4Address": "10.10.1.39/24",
                "IPv6Address": ""
            },
            "876e22b8982b85eca3e4d3e4f1e621b206f74258d122c0f80586fa4e8e71e825": {
                "Name": "docker_iwt_agent_14",
                "EndpointID": "df91e7a3901cd70b644deb51ad25ca75106b2bfc109d9285978d5058c8d7de45",
                "MacAddress": "02:42:0a:0a:01:09",
                "IPv4Address": "10.10.1.9/24",
                "IPv6Address": ""
            },
            "8bc187fd30125562970e9cd20ce3b79f55cb4a251a79683140b792ee2aa26437": {
                "Name": "docker_iwt_agent_42",
                "EndpointID": "e991d3aae99c93d4fb2475613f033ef020062c81696f07f3d032846baa646008",
                "MacAddress": "02:42:0a:0a:01:2a",
                "IPv4Address": "10.10.1.42/24",
                "IPv6Address": ""
            },
            "934a0cc93ef080ee70a26cc168916e39bfd060d3edaa32a795599ba6b9520c32": {
                "Name": "docker_iwt_agent_33",
                "EndpointID": "f77ae0a71c0b92d2050546db3effc5f40781ff68b78d6efa5380114ae4205bce",
                "MacAddress": "02:42:0a:0a:01:1c",
                "IPv4Address": "10.10.1.28/24",
                "IPv6Address": ""
            },
            "9c1194fe4c17087b9459674625269bb648539832f72a9bd9eb8ec295938bda6a": {
                "Name": "docker_iwt_agent_5",
                "EndpointID": "6e9a9dcf41b252f0895a1137928c82a8c1848718c4f1a05165b1f4f571f7db58",
                "MacAddress": "02:42:0a:0a:01:06",
                "IPv4Address": "10.10.1.6/24",
                "IPv6Address": ""
            },
            "9cf86420156e6cb7a897e22ddba47be3e2a03e56fb508bc224c8c7086c534f4f": {
                "Name": "docker_iwt_agent_10",
                "EndpointID": "39b52cb28ff118b2b66ea6b10a40ae2a09f30d9a0a335352c8520dad257d4d5b",
                "MacAddress": "02:42:0a:0a:01:17",
                "IPv4Address": "10.10.1.23/24",
                "IPv6Address": ""
            },
            "9d8a52bb6ccc127d59deb410510c8daf9dbe0b8390b95f9df88f77a5f4531227": {
                "Name": "docker_iwt_agent_29",
                "EndpointID": "74a37f1cda8d866d31307b9724de8b20c3586369b595004a646f57afcbdfc81b",
                "MacAddress": "02:42:0a:0a:01:0a",
                "IPv4Address": "10.10.1.10/24",
                "IPv6Address": ""
            },
            "b0f08db9efc2f8fdede0c217131f4d9057b90b4bd9e46de4a0ca05cb303c6775": {
                "Name": "docker_iwt_agent_19",
                "EndpointID": "937a75187cf7769ea3dfdfcdb6784cca20074e3678c9d11595c2b06900b48991",
                "MacAddress": "02:42:0a:0a:01:15",
                "IPv4Address": "10.10.1.21/24",
                "IPv6Address": ""
            },
            "b39034c21095449ca11005dc39dd6e6e01136626ab6505cd87838916b593125c": {
                "Name": "docker_iwt_agent_30",
                "EndpointID": "38176fb2110c43a65c9ab0e1980d2736dc8d51db7ae812b7b84f0d098cd7bc9a",
                "MacAddress": "02:42:0a:0a:01:23",
                "IPv4Address": "10.10.1.35/24",
                "IPv6Address": ""
            },
            "b4a6e4b193df0db681e5d4e80c9e6d8c460419282a5925609a8bfc49e6da546b": {
                "Name": "docker_iwt_agent_3",
                "EndpointID": "2bd0b5e20bd4bf47e28a5bdb3151d065f7df7146d0a9c4c675076538de2a4445",
                "MacAddress": "02:42:0a:0a:01:26",
                "IPv4Address": "10.10.1.38/24",
                "IPv6Address": ""
            },
            "baf7691f3aabaac9198bb152237ae40848cc3ec71bfd5c839d1bacded09839e5": {
                "Name": "docker_iwt_agent_23",
                "EndpointID": "e942e0d9f9e3d1849e3b43e316acc817eaacb9cdeab9b5c27fd2275aac10abef",
                "MacAddress": "02:42:0a:0a:01:02",
                "IPv4Address": "10.10.1.2/24",
                "IPv6Address": ""
            },
            "c0810b6fb6f06a33971c132069fc5b15b0191762b5f9f2915da641e02212c481": {
                "Name": "docker_iwt_agent_39",
                "EndpointID": "b9da33c0858803fa3cf09c0a33410539046a8d0add3dbe5c8426db4599d9c8e6",
                "MacAddress": "02:42:0a:0a:01:25",
                "IPv4Address": "10.10.1.37/24",
                "IPv6Address": ""
            },
            "c11c0e1d6c19b58fcb655bd421167fbc52ba046962f4c42397a6cb7d52a0b043": {
                "Name": "docker_iwt_agent_9",
                "EndpointID": "883f51cfdc72a9f5b5765038936853c3126fc9c20c597fe4db0378123569fa0f",
                "MacAddress": "02:42:0a:0a:01:1a",
                "IPv4Address": "10.10.1.26/24",
                "IPv6Address": ""
            },
            "c32fc4209a75d4a17b8043007c7bc5f1ff19b8df6e0d5bf4dc779c0f9fb96d25": {
                "Name": "docker_iwt_agent_37",
                "EndpointID": "e0e03869ec48c5467eb7bd8c65ac115ca7948a3b20b440337482612a914d37b4",
                "MacAddress": "02:42:0a:0a:01:22",
                "IPv4Address": "10.10.1.34/24",
                "IPv6Address": ""
            },
            "d5cf8cef442b85694dd73f74835dc6711bdff64e7e32ca43733cbe9e2b0a3017": {
                "Name": "docker_iwt_agent_28",
                "EndpointID": "899e7cf06e2965f5a899ac39ea599fd8e755f0d3c4e2f493fae6e0183ab03f0b",
                "MacAddress": "02:42:0a:0a:01:1b",
                "IPv4Address": "10.10.1.27/24",
                "IPv6Address": ""
            },
            "d9f24bd6d4a6886fcef1368f64c21ebef3e2f99437681d5779f33168038935cc": {
                "Name": "docker_iwt_agent_26",
                "EndpointID": "e10cc1b2ce2e4fe15619742a5aab23d12c5dae19c2cbd5203171a3d54627c494",
                "MacAddress": "02:42:0a:0a:01:08",
                "IPv4Address": "10.10.1.8/24",
                "IPv6Address": ""
            },
            "dd21d43db623ea47a8c2e2d353c6f50213fd478ca446e1bdca7a4b2b29648c57": {
                "Name": "docker_iwt_agent_38",
                "EndpointID": "32353ca1e5da0b6ab7f25568db8b0b4267956f0a0485bf0079049e5821ada648",
                "MacAddress": "02:42:0a:0a:01:11",
                "IPv4Address": "10.10.1.17/24",
                "IPv6Address": ""
            },
            "e1a5a45f1842bb7149e15afd4e76aa973f40ec312b882da5629a881d887b4b38": {
                "Name": "docker_iwt_agent_27",
                "EndpointID": "7e233de0421931932330c4900bd273e93bc190f76bfd83a1521377cf9fe358f0",
                "MacAddress": "02:42:0a:0a:01:2c",
                "IPv4Address": "10.10.1.44/24",
                "IPv6Address": ""
            },
            "e1b5f8a7a0f68579c8031051005a3ae7753d7fe2992d2c1e632cc7c1049346c3": {
                "Name": "docker_iwt_agent_32",
                "EndpointID": "a98a6db3f9bc0c3788eb91330f6f57f4f4373d508427e2b0e285397e8ac5b4ed",
                "MacAddress": "02:42:0a:0a:01:0d",
                "IPv4Address": "10.10.1.13/24",
                "IPv6Address": ""
            },
            "e334302d1694a6458e014b90406a2945e91c43fedbb63566a0e3aa4d0068e60e": {
                "Name": "docker_iwt_agent_7",
                "EndpointID": "915f03e069de97948949df5bc2a69187ba54cca000be25921715a605a2611326",
                "MacAddress": "02:42:0a:0a:01:07",
                "IPv4Address": "10.10.1.7/24",
                "IPv6Address": ""
            },
            "ecbac3f6726a40b04b8b874680f78d77cb27a0b462a0d082c053f62ce95f22b7": {
                "Name": "docker_iwt_agent_18",
                "EndpointID": "c50600484f96862bd41bcd7749f7e3cabef224778b622e7e3441715bab65c158",
                "MacAddress": "02:42:0a:0a:01:1e",
                "IPv4Address": "10.10.1.30/24",
                "IPv6Address": ""
            },
            "f4f88c8d286072cfce68ef6f119c24f903be9e62e265fa9ef7c99b26f4bdea29": {
                "Name": "docker_iwt_agent_36",
                "EndpointID": "ef37ed88c4cac957f9d4794b865024e6be8c1ca8920c82a3bd84a149926d83cc",
                "MacAddress": "02:42:0a:0a:01:24",
                "IPv4Address": "10.10.1.36/24",
                "IPv6Address": ""
            },
            "f9c42de6bb873e9ecc199d6c6799873d40ea45d4b436151c948c447089973ca1": {
                "Name": "docker_iwt_agent_4",
                "EndpointID": "9f757b85a87ea2f1fe05e9961feb978e16bc871a42042f7981cbdf12b44d1efb",
                "MacAddress": "02:42:0a:0a:01:13",
                "IPv4Address": "10.10.1.19/24",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]
</code>```

Update 2:

Analogously to the proceedings above, I tried to set up the custom Docker network for the use of IPv6.

Hence, I create the network using following command:

```<code>docker network create --driver bridge --subnet=2a01:4f8:a:b:c::/80 --ipv6 agent_network
</code>```

Additionally, I enabled IPv6 in the /etc/docker/daemon.json
file as follows:

```<code>{
    "ipv6": true,
    "fixed-cidr-v6": "2a01:4f8:a:b::/64"
}
</code>```

However, the same issues as before persist, and even though the output of the command docker network inspect agent_network states that all containers are connected to the Docker network and have uniques IP addresses, there is no communication between the containers. As before, my host network shuts down as well as soon as I start the Docker containers. Still, everything is running perfectly if I start less than 32 containers (also using IPv6).

Body:
I am currently setting up a multi-agent system in Docker, such that each agent is running in a separate container and communicates with the other agents within the Docker network.

Everything works fine, if I start less than 32 containers.
If I run more than that, the agents are not able to communicate anymore.

Further, the network on my host machine behaves strangely and I loose internet connection. The containers themselves start without any issues, though (only communication doesn't work). If I stop all containers, my host machine is connected to the internet again.

First, I create a custom Docker network:

docker network create --driver bridge agent_network --subnet 10.10.1.0/24

I made sure that the IP range is not used by other services on my machine.

Next, I specify the custom network in my docker-compose.yml file which also contains my agents as services:

version: "3.8"

networks:
  default:
    external: true
    name: agent_network

services:
  agent:
    ...

Finally, I run the system using the command:

docker-compose up --build --scale agent=32 agent

Such that 32 instances of the agent as defined in the docker-compose.yml file are started.

The agents start successfully and there is no error from Docker concerning network issues. Only problem is, the agents don't receive any messages.

Does anyone has a solution to this problem? Many answers I found online were considering using the default bridge of Docker and mainpulating the address space. However, this doen't work either in my case and it's recommended to not use the default bridge by the Docker docs.

Also editing the /etc/docker/daemon.json file to expand the address space did not work.

If it helps, here are some technical details of my system:

Host machine OS: Ubuntu 22.04.1 LTS

Host machine IP: 192.168.0.34

Docker: 20.10.22

docker-compose: 1.29.2

Update 1:

Below is the output of the command docker network inspect agent_network when the containers are running (43 containers were started):

[
    {
        "Name": "agent_network",
        "Id": "7e5a4b6abe02d01144690f62dad120660d11319abd34b3dc62de37ce3f0c2a0e",
        "Created": "2022-12-22T16:24:58.776012944+01:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "10.10.1.0/24"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "03fb10e0d4e0c1b28053ebb80294029f51018a91e84dadb266a8872be45d19ac": {
                "Name": "docker_iwt_agent_17",
                "EndpointID": "24c52fab24963827d02fa844f1c15a7b3d8296d9832b5b1f63cac1957a456a67",
                "MacAddress": "02:42:0a:0a:01:05",
                "IPv4Address": "10.10.1.5/24",
                "IPv6Address": ""
            },
            "05c91dabd601118ea8269d77756b69236eddd0d97918633542b5640cbc65738c": {
                "Name": "docker_iwt_agent_15",
                "EndpointID": "efc0abf1397e2e55b0496aedfdb4619edaf38213eb8ee952186a5953bdf05d43",
                "MacAddress": "02:42:0a:0a:01:28",
                "IPv4Address": "10.10.1.40/24",
                "IPv6Address": ""
            },
            "09cca2d89486b163314c402efa3e72a13a41e9c046837bec9d1308c63bd8288b": {
                "Name": "docker_iwt_agent_1",
                "EndpointID": "565d6010c9919eddfd98a937a532200d2477f87a8f056627f6b2abce8647a98e",
                "MacAddress": "02:42:0a:0a:01:10",
                "IPv4Address": "10.10.1.16/24",
                "IPv6Address": ""
            },
            "0b3f43c0f6d250619c5051a76549f7f2f70014e020cefa4816eabb3adb5fb885": {
                "Name": "docker_iwt_agent_8",
                "EndpointID": "10b691061cd220b8dfc030d3641512a9fba3bb9c08b9c4d3514f7f661eaffde2",
                "MacAddress": "02:42:0a:0a:01:03",
                "IPv4Address": "10.10.1.3/24",
                "IPv6Address": ""
            },
            "0b776566285f7be530ea91a4fd2295a459d4e27130e19f8e3181f1bb302ac493": {
                "Name": "docker_iwt_agent_25",
                "EndpointID": "cfc21fdee01fdfaba8d7e08f1f8c6e6a520c464b6fca219001119416b51ec906",
                "MacAddress": "02:42:0a:0a:01:16",
                "IPv4Address": "10.10.1.22/24",
                "IPv6Address": ""
            },
            "25b4d77eaf2a249bd516131565621ee41edf85e9cd66ef2950657de88cf80d21": {
                "Name": "docker_iwt_agent_11",
                "EndpointID": "203333983f3ec9382da87212e48b3afe4ba890e86c9159b1b58bc94d6e9c3d89",
                "MacAddress": "02:42:0a:0a:01:0c",
                "IPv4Address": "10.10.1.12/24",
                "IPv6Address": ""
            },
            "2654ba6e89d0153e59f2de477a787ab5b3064dd99284949d4db66d6bd659306d": {
                "Name": "docker_iwt_agent_24",
                "EndpointID": "89e5db4f584a584272a51cdf9301ff86b0931ae0cda786355829cbe8ac68ecb4",
                "MacAddress": "02:42:0a:0a:01:1d",
                "IPv4Address": "10.10.1.29/24",
                "IPv6Address": ""
            },
            "26a6b5d80abadcf9b27f5606d9e53ef44e25f11bc85dc2c651e8c3034af9b122": {
                "Name": "docker_iwt_agent_34",
                "EndpointID": "6c8de526c126eb62fd4f01a21b01a3aba12963ae7e684102babcdf7c32fa7858",
                "MacAddress": "02:42:0a:0a:01:2b",
                "IPv4Address": "10.10.1.43/24",
                "IPv6Address": ""
            },
            "2fda699d23ddf42546eefdc21b22b984f186eee10c9d087958d4fb4303b8a343": {
                "Name": "docker_iwt_agent_41",
                "EndpointID": "6410170b70bb49bf83d31c22e7eb3e0c8c8a79063f0705956e8a26683a4ab45b",
                "MacAddress": "02:42:0a:0a:01:0b",
                "IPv4Address": "10.10.1.11/24",
                "IPv6Address": ""
            },
            "38f653bb69ea04d1424b64bacf258f66380c3a276bbd3df50cb45b6f73eae5d5": {
                "Name": "docker_iwt_agent_20",
                "EndpointID": "13bd9bba90ceeda0de8e8bdc9d2a075e0f1dba86ff94ff5ab0f7517733ca67c7",
                "MacAddress": "02:42:0a:0a:01:14",
                "IPv4Address": "10.10.1.20/24",
                "IPv6Address": ""
            },
            "473e179b73f32b289435f3e3cbbb7f9a7034635d703fd66f7293893eabfb8802": {
                "Name": "docker_iwt_agent_22",
                "EndpointID": "22ce17c3dc719142bfa101d49583a2a0f71e1ec01a19c881621ebe66e8b4e211",
                "MacAddress": "02:42:0a:0a:01:1f",
                "IPv4Address": "10.10.1.31/24",
                "IPv6Address": ""
            },
            "581f91b16bc22949de0e60a85669c909c8748e5438a35b01ad10b8c3d18e5bce": {
                "Name": "docker_iwt_agent_6",
                "EndpointID": "b0c5ea84bd9d5e9a642d1b7317e5f8792fe28204bf88bde503273e4df2227b40",
                "MacAddress": "02:42:0a:0a:01:20",
                "IPv4Address": "10.10.1.32/24",
                "IPv6Address": ""
            },
            "58a966dd9478139d34ffa94355fe1daee168d7863cf211423e7f643f9f0b104f": {
                "Name": "docker_iwt_agent_40",
                "EndpointID": "f9e4efcc927fb4966d5b54c0210dbcf1f595222a1fb5f0c0607896dbb33d98e6",
                "MacAddress": "02:42:0a:0a:01:21",
                "IPv4Address": "10.10.1.33/24",
                "IPv6Address": ""
            },
            "5f63e021e176fcc714b9c9b4d7579c38467cfe6ef23d97038d2c8ee84c252028": {
                "Name": "docker_iwt_agent_35",
                "EndpointID": "c3be1cd49404b5b60e63a37601e50d09928c7caedc5d4697fac862fa4fc9d50b",
                "MacAddress": "02:42:0a:0a:01:0e",
                "IPv4Address": "10.10.1.14/24",
                "IPv6Address": ""
            },
            "6038fa2517624496e7fb5248841f5e1d28c22173ffeba9c1124ef4177e7761ed": {
                "Name": "docker_iwt_agent_21",
                "EndpointID": "b45812055779b2fc56e5a6c9765fef05b374089b626725f6e1f915661179d10c",
                "MacAddress": "02:42:0a:0a:01:29",
                "IPv4Address": "10.10.1.41/24",
                "IPv6Address": ""
            },
            "62f24f4a5c3ad9dbd8b604c4eb6d5a0e8fd8ce539008a486e71c4d6716cfd976": {
                "Name": "docker_iwt_agent_13",
                "EndpointID": "7bc2201c2a9b602d708e609882b5c6bfbbae7df0db9a341f4633deae6d37ab42",
                "MacAddress": "02:42:0a:0a:01:0f",
                "IPv4Address": "10.10.1.15/24",
                "IPv6Address": ""
            },
            "6a2a81660b72e3138ccddbfc70e8c907196217f7d5e5985e241eeb38a759477d": {
                "Name": "docker_iwt_agent_16",
                "EndpointID": "266df1ee74cca9e26dbe19350feff84530e37324001495c029058fffe63cceb3",
                "MacAddress": "02:42:0a:0a:01:12",
                "IPv4Address": "10.10.1.18/24",
                "IPv6Address": ""
            },
            "6aea9c53022d5155d05f8013091d001187afa968fb04e0d1ab0d987371b1f1ce": {
                "Name": "docker_iwt_agent_43",
                "EndpointID": "90b1e7e4ff057207d6ad11b1d0e46793f9b849c953508c02cfbb2b9cf5b52c56",
                "MacAddress": "02:42:0a:0a:01:19",
                "IPv4Address": "10.10.1.25/24",
                "IPv6Address": ""
            },
            "6e4847a8d50745a7b9bad71691367379c09e6cce8ee8117fffff0be19cb8c97f": {
                "Name": "docker_iwt_agent_31",
                "EndpointID": "8c5630ca5d6697140b316b0ab8e92c98eb707612eefa29002fae077525d6ac6a",
                "MacAddress": "02:42:0a:0a:01:18",
                "IPv4Address": "10.10.1.24/24",
                "IPv6Address": ""
            },
            "80aa000edc914d7ea8d9bbc3288eb5e61e1c200643b043deff704c4d7b6ccdaf": {
                "Name": "docker_iwt_agent_2",
                "EndpointID": "a3e6fb766d3ed3b23b7447d0524a791e8b70e2e8c558f9f3be46d6e2ee35e050",
                "MacAddress": "02:42:0a:0a:01:04",
                "IPv4Address": "10.10.1.4/24",
                "IPv6Address": ""
            },
            "85ef36d28f6decbb58f8140fc78f96dc33acf39142f00224baaa0bdede26b77a": {
                "Name": "docker_iwt_agent_12",
                "EndpointID": "35a6e014b1231f5f5b9eece616543f600d41a40036a50e373617e7801bf42593",
                "MacAddress": "02:42:0a:0a:01:27",
                "IPv4Address": "10.10.1.39/24",
                "IPv6Address": ""
            },
            "876e22b8982b85eca3e4d3e4f1e621b206f74258d122c0f80586fa4e8e71e825": {
                "Name": "docker_iwt_agent_14",
                "EndpointID": "df91e7a3901cd70b644deb51ad25ca75106b2bfc109d9285978d5058c8d7de45",
                "MacAddress": "02:42:0a:0a:01:09",
                "IPv4Address": "10.10.1.9/24",
                "IPv6Address": ""
            },
            "8bc187fd30125562970e9cd20ce3b79f55cb4a251a79683140b792ee2aa26437": {
                "Name": "docker_iwt_agent_42",
                "EndpointID": "e991d3aae99c93d4fb2475613f033ef020062c81696f07f3d032846baa646008",
                "MacAddress": "02:42:0a:0a:01:2a",
                "IPv4Address": "10.10.1.42/24",
                "IPv6Address": ""
            },
            "934a0cc93ef080ee70a26cc168916e39bfd060d3edaa32a795599ba6b9520c32": {
                "Name": "docker_iwt_agent_33",
                "EndpointID": "f77ae0a71c0b92d2050546db3effc5f40781ff68b78d6efa5380114ae4205bce",
                "MacAddress": "02:42:0a:0a:01:1c",
                "IPv4Address": "10.10.1.28/24",
                "IPv6Address": ""
            },
            "9c1194fe4c17087b9459674625269bb648539832f72a9bd9eb8ec295938bda6a": {
                "Name": "docker_iwt_agent_5",
                "EndpointID": "6e9a9dcf41b252f0895a1137928c82a8c1848718c4f1a05165b1f4f571f7db58",
                "MacAddress": "02:42:0a:0a:01:06",
                "IPv4Address": "10.10.1.6/24",
                "IPv6Address": ""
            },
            "9cf86420156e6cb7a897e22ddba47be3e2a03e56fb508bc224c8c7086c534f4f": {
                "Name": "docker_iwt_agent_10",
                "EndpointID": "39b52cb28ff118b2b66ea6b10a40ae2a09f30d9a0a335352c8520dad257d4d5b",
                "MacAddress": "02:42:0a:0a:01:17",
                "IPv4Address": "10.10.1.23/24",
                "IPv6Address": ""
            },
            "9d8a52bb6ccc127d59deb410510c8daf9dbe0b8390b95f9df88f77a5f4531227": {
                "Name": "docker_iwt_agent_29",
                "EndpointID": "74a37f1cda8d866d31307b9724de8b20c3586369b595004a646f57afcbdfc81b",
                "MacAddress": "02:42:0a:0a:01:0a",
                "IPv4Address": "10.10.1.10/24",
                "IPv6Address": ""
            },
            "b0f08db9efc2f8fdede0c217131f4d9057b90b4bd9e46de4a0ca05cb303c6775": {
                "Name": "docker_iwt_agent_19",
                "EndpointID": "937a75187cf7769ea3dfdfcdb6784cca20074e3678c9d11595c2b06900b48991",
                "MacAddress": "02:42:0a:0a:01:15",
                "IPv4Address": "10.10.1.21/24",
                "IPv6Address": ""
            },
            "b39034c21095449ca11005dc39dd6e6e01136626ab6505cd87838916b593125c": {
                "Name": "docker_iwt_agent_30",
                "EndpointID": "38176fb2110c43a65c9ab0e1980d2736dc8d51db7ae812b7b84f0d098cd7bc9a",
                "MacAddress": "02:42:0a:0a:01:23",
                "IPv4Address": "10.10.1.35/24",
                "IPv6Address": ""
            },
            "b4a6e4b193df0db681e5d4e80c9e6d8c460419282a5925609a8bfc49e6da546b": {
                "Name": "docker_iwt_agent_3",
                "EndpointID": "2bd0b5e20bd4bf47e28a5bdb3151d065f7df7146d0a9c4c675076538de2a4445",
                "MacAddress": "02:42:0a:0a:01:26",
                "IPv4Address": "10.10.1.38/24",
                "IPv6Address": ""
            },
            "baf7691f3aabaac9198bb152237ae40848cc3ec71bfd5c839d1bacded09839e5": {
                "Name": "docker_iwt_agent_23",
                "EndpointID": "e942e0d9f9e3d1849e3b43e316acc817eaacb9cdeab9b5c27fd2275aac10abef",
                "MacAddress": "02:42:0a:0a:01:02",
                "IPv4Address": "10.10.1.2/24",
                "IPv6Address": ""
            },
            "c0810b6fb6f06a33971c132069fc5b15b0191762b5f9f2915da641e02212c481": {
                "Name": "docker_iwt_agent_39",
                "EndpointID": "b9da33c0858803fa3cf09c0a33410539046a8d0add3dbe5c8426db4599d9c8e6",
                "MacAddress": "02:42:0a:0a:01:25",
                "IPv4Address": "10.10.1.37/24",
                "IPv6Address": ""
            },
            "c11c0e1d6c19b58fcb655bd421167fbc52ba046962f4c42397a6cb7d52a0b043": {
                "Name": "docker_iwt_agent_9",
                "EndpointID": "883f51cfdc72a9f5b5765038936853c3126fc9c20c597fe4db0378123569fa0f",
                "MacAddress": "02:42:0a:0a:01:1a",
                "IPv4Address": "10.10.1.26/24",
                "IPv6Address": ""
            },
            "c32fc4209a75d4a17b8043007c7bc5f1ff19b8df6e0d5bf4dc779c0f9fb96d25": {
                "Name": "docker_iwt_agent_37",
                "EndpointID": "e0e03869ec48c5467eb7bd8c65ac115ca7948a3b20b440337482612a914d37b4",
                "MacAddress": "02:42:0a:0a:01:22",
                "IPv4Address": "10.10.1.34/24",
                "IPv6Address": ""
            },
            "d5cf8cef442b85694dd73f74835dc6711bdff64e7e32ca43733cbe9e2b0a3017": {
                "Name": "docker_iwt_agent_28",
                "EndpointID": "899e7cf06e2965f5a899ac39ea599fd8e755f0d3c4e2f493fae6e0183ab03f0b",
                "MacAddress": "02:42:0a:0a:01:1b",
                "IPv4Address": "10.10.1.27/24",
                "IPv6Address": ""
            },
            "d9f24bd6d4a6886fcef1368f64c21ebef3e2f99437681d5779f33168038935cc": {
                "Name": "docker_iwt_agent_26",
                "EndpointID": "e10cc1b2ce2e4fe15619742a5aab23d12c5dae19c2cbd5203171a3d54627c494",
                "MacAddress": "02:42:0a:0a:01:08",
                "IPv4Address": "10.10.1.8/24",
                "IPv6Address": ""
            },
            "dd21d43db623ea47a8c2e2d353c6f50213fd478ca446e1bdca7a4b2b29648c57": {
                "Name": "docker_iwt_agent_38",
                "EndpointID": "32353ca1e5da0b6ab7f25568db8b0b4267956f0a0485bf0079049e5821ada648",
                "MacAddress": "02:42:0a:0a:01:11",
                "IPv4Address": "10.10.1.17/24",
                "IPv6Address": ""
            },
            "e1a5a45f1842bb7149e15afd4e76aa973f40ec312b882da5629a881d887b4b38": {
                "Name": "docker_iwt_agent_27",
                "EndpointID": "7e233de0421931932330c4900bd273e93bc190f76bfd83a1521377cf9fe358f0",
                "MacAddress": "02:42:0a:0a:01:2c",
                "IPv4Address": "10.10.1.44/24",
                "IPv6Address": ""
            },
            "e1b5f8a7a0f68579c8031051005a3ae7753d7fe2992d2c1e632cc7c1049346c3": {
                "Name": "docker_iwt_agent_32",
                "EndpointID": "a98a6db3f9bc0c3788eb91330f6f57f4f4373d508427e2b0e285397e8ac5b4ed",
                "MacAddress": "02:42:0a:0a:01:0d",
                "IPv4Address": "10.10.1.13/24",
                "IPv6Address": ""
            },
            "e334302d1694a6458e014b90406a2945e91c43fedbb63566a0e3aa4d0068e60e": {
                "Name": "docker_iwt_agent_7",
                "EndpointID": "915f03e069de97948949df5bc2a69187ba54cca000be25921715a605a2611326",
                "MacAddress": "02:42:0a:0a:01:07",
                "IPv4Address": "10.10.1.7/24",
                "IPv6Address": ""
            },
            "ecbac3f6726a40b04b8b874680f78d77cb27a0b462a0d082c053f62ce95f22b7": {
                "Name": "docker_iwt_agent_18",
                "EndpointID": "c50600484f96862bd41bcd7749f7e3cabef224778b622e7e3441715bab65c158",
                "MacAddress": "02:42:0a:0a:01:1e",
                "IPv4Address": "10.10.1.30/24",
                "IPv6Address": ""
            },
            "f4f88c8d286072cfce68ef6f119c24f903be9e62e265fa9ef7c99b26f4bdea29": {
                "Name": "docker_iwt_agent_36",
                "EndpointID": "ef37ed88c4cac957f9d4794b865024e6be8c1ca8920c82a3bd84a149926d83cc",
                "MacAddress": "02:42:0a:0a:01:24",
                "IPv4Address": "10.10.1.36/24",
                "IPv6Address": ""
            },
            "f9c42de6bb873e9ecc199d6c6799873d40ea45d4b436151c948c447089973ca1": {
                "Name": "docker_iwt_agent_4",
                "EndpointID": "9f757b85a87ea2f1fe05e9961feb978e16bc871a42042f7981cbdf12b44d1efb",
                "MacAddress": "02:42:0a:0a:01:13",
                "IPv4Address": "10.10.1.19/24",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

Update 2:

Analogously to the proceedings above, I tried to set up the custom Docker network for the use of IPv6.

Hence, I create the network using following command:

docker network create --driver bridge --subnet=2a01:4f8:a:b:c::/80 --ipv6 agent_network

Additionally, I enabled IPv6 in the /etc/docker/daemon.json
file as follows:

{
    "ipv6": true,
    "fixed-cidr-v6": "2a01:4f8:a:b::/64"
}

However, the same issues as before persist, and even though the output of the command docker network inspect agent_network states that all containers are connected to the Docker network and have uniques IP addresses, there is no communication between the containers. As before, my host network shuts down as well as soon as I start the Docker containers. Still, everything is running perfectly if I start less than 32 containers (also using IPv6).


问:
Query an instrumentedattribute by its length in SQLAlchemy
The way the database is setup is like this. I'm using SQLModel, but underneath it's SQLAlchemy.

```<code>class Paper(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
        similar: List["PaperSimilarLink"] = Relationship(
        link_model=PaperSimilarLink,
        back_populates="similar",
        sa_relationship_kwargs=dict(
            primaryjoin="Paper.id==PaperSimilarLink.paper_id",
            secondaryjoin="Paper.id==PaperSimilarLink.similar_id",
        ),
    )

class PaperSimilarLink(SQLModel, table=True):
    paper_id: int = Field(default=None, foreign_key="paper.id", primary_key=True)
    similar_id: int = Field(default=None, foreign_key="paper.id", primary_key=True)
    paper: "Paper" = Relationship(
        back_populates="similar",
        sa_relationship_kwargs=dict(
            foreign_keys="[PaperSimilarLink.paper_id]",
        ),
    )
    similar: "Paper" = Relationship(
        back_populates="similar",
        sa_relationship_kwargs=dict(
            foreign_keys="[PaperSimilarLink.similar_id]",
        ),
    )
    similarity: Optional[float]
</code>```

The query I am looking for is to look for all the Paper objects that have less than x number of PaperSimilarLinks located at Paper.similar. I've tried this:

papers = session.exec(select(Paper).where(Paper.similar.count() <= 11)).all()

It errors me out saying AttributeError: Neither 'InstrumentedAttribute' object nor 'Comparator' object associated with Paper.similar has an attribute 'count'

I figured this was a very simple query, but it's illuding me! How would I do this?

Body:
The way the database is setup is like this. I'm using SQLModel, but underneath it's SQLAlchemy.

class Paper(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
        similar: List["PaperSimilarLink"] = Relationship(
        link_model=PaperSimilarLink,
        back_populates="similar",
        sa_relationship_kwargs=dict(
            primaryjoin="Paper.id==PaperSimilarLink.paper_id",
            secondaryjoin="Paper.id==PaperSimilarLink.similar_id",
        ),
    )

class PaperSimilarLink(SQLModel, table=True):
    paper_id: int = Field(default=None, foreign_key="paper.id", primary_key=True)
    similar_id: int = Field(default=None, foreign_key="paper.id", primary_key=True)
    paper: "Paper" = Relationship(
        back_populates="similar",
        sa_relationship_kwargs=dict(
            foreign_keys="[PaperSimilarLink.paper_id]",
        ),
    )
    similar: "Paper" = Relationship(
        back_populates="similar",
        sa_relationship_kwargs=dict(
            foreign_keys="[PaperSimilarLink.similar_id]",
        ),
    )
    similarity: Optional[float]

The query I am looking for is to look for all the Paper objects that have less than x number of PaperSimilarLinks located at Paper.similar. I've tried this:

papers = session.exec(select(Paper).where(Paper.similar.count() <= 11)).all()

It errors me out saying AttributeError: Neither 'InstrumentedAttribute' object nor 'Comparator' object associated with Paper.similar has an attribute 'count'

I figured this was a very simple query, but it's illuding me! How would I do this?


问:
conflicting option string: --browser Error error
I am getting below error screen when running my test case from terminal
argparse.ArgumentError: argument --browser: conflicting option string: --browser

configtest code mentioned below


问:
numpy `genfromtxt` and `loadtxt` caching data when loading from a URL
When submitting subsequent calls to either of these functions, the same data from the first call is loaded. Related to this previous question.</p>
```<code>import numpy as np
url = 'http://svo2.cab.inta-csic.es/theory/fps/getdata.php?format=ascii&id=JWST/MIRI.F770W'
dat = np.loadtxt(url)
print(dat[:4])

> [[1.69040e+04 1.01581e-04]
  [1.69140e+04 1.10712e-04]
  [1.69240e+04 1.21338e-04]
  [1.69340e+04 1.33109e-04]]

url = 'http://svo2.cab.inta-csic.es/theory/fps/getdata.php?format=ascii&id=JWST/NIRCam.F200W'
dat = np.loadtxt(url)
print(dat[:4])

> [[1.69040e+04 1.01581e-04]
  [1.69140e+04 1.10712e-04]
  [1.69240e+04 1.21338e-04]
  [1.69340e+04 1.33109e-04]]
</code>```

Body:
When submitting subsequent calls to either of these functions, the same data from the first call is loaded. Related to this previous question.

import numpy as np
url = 'http://svo2.cab.inta-csic.es/theory/fps/getdata.php?format=ascii&id=JWST/MIRI.F770W'
dat = np.loadtxt(url)
print(dat[:4])

> [[1.69040e+04 1.01581e-04]
  [1.69140e+04 1.10712e-04]
  [1.69240e+04 1.21338e-04]
  [1.69340e+04 1.33109e-04]]

url = 'http://svo2.cab.inta-csic.es/theory/fps/getdata.php?format=ascii&id=JWST/NIRCam.F200W'
dat = np.loadtxt(url)
print(dat[:4])

> [[1.69040e+04 1.01581e-04]
  [1.69140e+04 1.10712e-04]
  [1.69240e+04 1.21338e-04]
  [1.69340e+04 1.33109e-04]]


问:
how to delete a series of events from recurring set using ics file?
Im trying to delete a series of dates like google or zoom does ("delete this and following occurrences") but cant seem to delete them all

here is the code I'm using to do so
RECURRENCE-ID;RANGE=THISANDFUTURE;TZID=America/New_York:20230221T100000Z

I saw few people recommending to use UNTIL in the range parameter for recurrence-id but cannot find any syntax or working example.

Thanks in advance

Full code for creating recurring event:

```<code>BEGIN:VCALENDAR
VERSION:2.0
PRODID://Events//iCal 2.1//EN
METHOD:REQUEST
X-WR-CALNAME:Event Calendar
X-WR-TIMEZONE:America/New_York
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:America/New_York
TZURL:http://tzurl.org/zoneinfo-outlook/America/New_York
X-LIC-LOCATION:America/New_York
BEGIN:DAYLIGHT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
TZNAME:EDT
DTSTART:19700308T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
TZNAME:EST
DTSTART:19701101T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
TRANSP:OPAQUE
CREATED:20221221T094254Z
UID:TESTSC20221221094254
DTEND;TZID=America/New_York:20221226T110000
SUMMARY:deadline approaching Event
LOCATION;ENCODING=QUOTED-PRINTABLE:Virtual Meeting
DTSTART;TZID=America/New_York:20221226T100000
DTSTAMP:20221221T094254Z
ORGANIZER;CN=Events:mailto:events@abc.org
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=abc@abc.org;X-NUM-GUESTS=0:mailto:abc@abc.org
STATUS:CONFIRMED
DESCRIPTION:A. Want to join the meeting from your computer, tablet or smartphone?\n go to https://zoom.us/
SEQUENCE:0
RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20230228T110000Z
BEGIN:VALARM
DESCRIPTION:REMINDER
TRIGGER;RELATED=START:-PT10M
ACTION:DISPLAY
END:VALARM
END:VEVENT
END:VCALENDAR
</code>```

Full code I use for deleting:

```<code>VERSION:2.0
PRODID://Events//iCal 2.1//EN
METHOD:CANCEL
X-WR-CALNAME:Event Calendar
X-WR-TIMEZONE:America/New_York
CALSCALE:GREGORIAN
BEGIN:VEVENT
TRANSP:OPAQUE
CREATED:20221221T145554Z
UID:TESTSC20221221094254
DTSTART;TZID=America/New_York:20221226T100000
DTEND;TZID=America/New_York:20221226T110000
SUMMARY:Event: deadline approaching Cancelled
LOCATION;ENCODING=QUOTED-PRINTABLE:Virtual Meeting
DTSTAMP:20221221T145554Z
ORGANIZER;CN=Events:mailto:events@abc.org
RECURRENCE-ID;RANGE=THISANDFUTURE;TZID=America/New_York:20230221T100000Z
SEQUENCE:0
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=abc@abc.org;X-NUM-GUESTS=0:mailto:abc@abc.org
STATUS:CANCELLED
DESCRIPTION:This meeting has been deleted. Please contact HQ for scheduling a new meeting or more information about this.
END:VEVENT
END:VCALENDAR```
```

Body:
Im trying to delete a series of dates like google or zoom does ("delete this and following occurrences") but cant seem to delete them all

here is the code I'm using to do so
RECURRENCE-ID;RANGE=THISANDFUTURE;TZID=America/New_York:20230221T100000Z

I saw few people recommending to use UNTIL in the range parameter for recurrence-id but cannot find any syntax or working example.

Thanks in advance

Full code for creating recurring event:

BEGIN:VCALENDAR
VERSION:2.0
PRODID://Events//iCal 2.1//EN
METHOD:REQUEST
X-WR-CALNAME:Event Calendar
X-WR-TIMEZONE:America/New_York
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:America/New_York
TZURL:http://tzurl.org/zoneinfo-outlook/America/New_York
X-LIC-LOCATION:America/New_York
BEGIN:DAYLIGHT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
TZNAME:EDT
DTSTART:19700308T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
TZNAME:EST
DTSTART:19701101T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
TRANSP:OPAQUE
CREATED:20221221T094254Z
UID:TESTSC20221221094254
DTEND;TZID=America/New_York:20221226T110000
SUMMARY:deadline approaching Event
LOCATION;ENCODING=QUOTED-PRINTABLE:Virtual Meeting
DTSTART;TZID=America/New_York:20221226T100000
DTSTAMP:20221221T094254Z
ORGANIZER;CN=Events:mailto:events@abc.org
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=abc@abc.org;X-NUM-GUESTS=0:mailto:abc@abc.org
STATUS:CONFIRMED
DESCRIPTION:A. Want to join the meeting from your computer, tablet or smartphone?\n go to https://zoom.us/
SEQUENCE:0
RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20230228T110000Z
BEGIN:VALARM
DESCRIPTION:REMINDER
TRIGGER;RELATED=START:-PT10M
ACTION:DISPLAY
END:VALARM
END:VEVENT
END:VCALENDAR

Full code I use for deleting:

VERSION:2.0
PRODID://Events//iCal 2.1//EN
METHOD:CANCEL
X-WR-CALNAME:Event Calendar
X-WR-TIMEZONE:America/New_York
CALSCALE:GREGORIAN
BEGIN:VEVENT
TRANSP:OPAQUE
CREATED:20221221T145554Z
UID:TESTSC20221221094254
DTSTART;TZID=America/New_York:20221226T100000
DTEND;TZID=America/New_York:20221226T110000
SUMMARY:Event: deadline approaching Cancelled
LOCATION;ENCODING=QUOTED-PRINTABLE:Virtual Meeting
DTSTAMP:20221221T145554Z
ORGANIZER;CN=Events:mailto:events@abc.org
RECURRENCE-ID;RANGE=THISANDFUTURE;TZID=America/New_York:20230221T100000Z
SEQUENCE:0
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=abc@abc.org;X-NUM-GUESTS=0:mailto:abc@abc.org
STATUS:CANCELLED
DESCRIPTION:This meeting has been deleted. Please contact HQ for scheduling a new meeting or more information about this.
END:VEVENT
END:VCALENDAR```


问:
Native base extend theme not fully applying
i'm trying to change the outline variant of Native Base's Button component. I want it to have a border color the same as the text color.

I have a theme.ts file with this

```<code>const theme = extendTheme({
  components: {
    Button: {
      variants: {
        outline: ({ colorScheme }: any) => {
          return {
            borderColor: `${colorScheme}.500`,
          };
        },
      },
      baseStyle: {
        _text: {
          fontWeight: 800,
        },
      },
    },
  },
}
</code>```

And this is my App.tsx

```<code>export default function App() {
  const { Navigator, Screen } = createNativeStackNavigator();
  return (
    <QueryClientProvider client={queryClient}>
      <ContextProvider>
        <NativeBaseProvider theme={theme}>
          <NavigationContainer>
            <Navigator
              initialRouteName="Login"
              screenOptions={{ headerShown: false }}
            >
              <Screen name="Login" component={Auth}></Screen>
              <Screen name="Register" component={Register}></Screen>
            </Navigator>
          </NavigationContainer>
        </NativeBaseProvider>
      </ContextProvider>
    </QueryClientProvider>
  );
}
</code>```

The fontWeight of the baseStyle is getting applied, but the border color is not changing at all. I tried to change other properties and apparently only the _text is changing.

Body:
i'm trying to change the outline variant of Native Base's Button component. I want it to have a border color the same as the text color.

I have a theme.ts file with this

const theme = extendTheme({
  components: {
    Button: {
      variants: {
        outline: ({ colorScheme }: any) => {
          return {
            borderColor: `${colorScheme}.500`,
          };
        },
      },
      baseStyle: {
        _text: {
          fontWeight: 800,
        },
      },
    },
  },
}

And this is my App.tsx

export default function App() {
  const { Navigator, Screen } = createNativeStackNavigator();
  return (
    <QueryClientProvider client={queryClient}>
      <ContextProvider>
        <NativeBaseProvider theme={theme}>
          <NavigationContainer>
            <Navigator
              initialRouteName="Login"
              screenOptions={{ headerShown: false }}
            >
              <Screen name="Login" component={Auth}></Screen>
              <Screen name="Register" component={Register}></Screen>
            </Navigator>
          </NavigationContainer>
        </NativeBaseProvider>
      </ContextProvider>
    </QueryClientProvider>
  );
}

The fontWeight of the baseStyle is getting applied, but the border color is not changing at all. I tried to change other properties and apparently only the _text is changing.


问:
URL in heroCard does not open a new browser window
We have a node js based app for message extension.
For the text param of the hero card we provide an  with an URL in href.
In the chat or group chat, clicking the url does not open a new browser tab.
When we do the same thing in a team post the url opens a new tab.

We want the url in the card to open a new browser tab also in a chat and a group chat.


问:
ternary operator in c
The problem that i'm having is that the condition always returns false and thus runs the second statement.
code:

```<code>void main()
{
    char a[20],b[20],c[20],d[20];
    printf("enter your first name:");
    scanf("%s",a);
    printf("enter your second name:");
    scanf("%s",b);
    printf("enter your last name:");
    scanf("%s",c);
    (b=="none")?printf("%s %s",a,c):printf("%s %s %s",a,b,c);
}
</code>```

in this (b=="none") always returns false ,i also converted this into if else statement but the results were same.

Title: ternary operator in c

Body:
The problem that i'm having is that the condition always returns false and thus runs the second statement.
code:

void main()
{
    char a[20],b[20],c[20],d[20];
    printf("enter your first name:");
    scanf("%s",a);
    printf("enter your second name:");
    scanf("%s",b);
    printf("enter your last name:");
    scanf("%s",c);
    (b=="none")?printf("%s %s",a,c):printf("%s %s %s",a,b,c);
}

in this (b=="none") always returns false ,i also converted this into if else statement but the results were same.


问:
Attach a PPT in outlook through VBA
My aim is to generate a mail.

The code does work, except for the attachment. "File settimanale" is a variant containing the path of the ppt I want to attach.

Has someone a solution?

```<code>    'First, select the body format as olFormatHtml.
    .BodyFormat = olFormatHTML

    'Now display the email.
    .Display

    'write the email in the body of the email
    .HTMLBody = "Buongiorno Giacomo, " & "<br>" & "<br>" & "Invio in allegato il monitoraggio settimanale di Neafidi al " & DataCons & "<br>" & "<br>" & "Grazie e buon proseguimento," & .HTMLBody

    'Invio la mail al seguente indirizzo
    .To = MailInvio
    .CC = MailInvioCC

    'Inserisco oggetto della mail
    .Subject = SoggettoMail

    'Inserisco allegato nella mail
    .Attachment = FileSettimanale

End With
</code>```

Title: Attach a PPT in outlook through VBA

Body:
My aim is to generate a mail.

The code does work, except for the attachment. "File settimanale" is a variant containing the path of the ppt I want to attach.

Has someone a solution?

    'First, select the body format as olFormatHtml.
    .BodyFormat = olFormatHTML

    'Now display the email.
    .Display

    'write the email in the body of the email
    .HTMLBody = "Buongiorno Giacomo, " & "
" & "
" & "Invio in allegato il monitoraggio settimanale di Neafidi al " & DataCons & "
" & "
" & "Grazie e buon proseguimento," & .HTMLBody

    'Invio la mail al seguente indirizzo
    .To = MailInvio
    .CC = MailInvioCC

    'Inserisco oggetto della mail
    .Subject = SoggettoMail

    'Inserisco allegato nella mail
    .Attachment = FileSettimanale

End With


问:
Sharing Jobs on Linkedin from externa mobile app (Firstbird)
Currently (since 2 days) it is not possible to share jobs via the mobile app firstbird2go.
before it was perfectly fine.

Right now it is leading to an error message and a strange userprofile (which is not mine) see left side corner user icon. Seems to be a random one.

Error message

This behavior is valid for every user of the firstbird app.

You can workaround by sharing the job clicking (iOS) to open up in safari browser.

I need your help as this looks like a linkedin issue

Tried to workaround.
Need information from Linkedin Side


问:
Capistrano deployment stuck at assets:precompile
We are facing an issue with deploying our Rails app using Capistrano from a MacOS machine.

Capistrano runs inside a Docker container.

If I trigger the deployment from a Linux host machine (Capistrano running in Docker), it succeeds on all servers.
However, on MacOS, the deployment to production runs fine but not to the staging server.

The deployment is stuck at:

```<code>0:28 deploy:assets:precompile
      01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
</code>```

I can see on the server that the pre-compilation is running but Capistrano is stuck.

However, when it is run on a Linux machine or a CI server or to Production, it works fine.

```<code>00:09 deploy:assets:precompile
      01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
      01 yarn install v1.22.17
      01 [1/4] Resolving packages...
      01 [2/4] Fetching packages...
      01 [3/4] Linking dependencies...
      01 warning " > @rails/actiontext@6.1.7" has incorrect peer dependency "trix@^1.2.0".
      01 [4/4] Building fresh packages...
      01 Done in 22.10s.
      01 yarn run v1.22.17
      01 $ RAILS_ENV=${RAILS_ENV:-production} NODE_ENV=${NODE_ENV:-production} && webpack --config webpack.prod.js --env NODE_ENV=${NODE_ENV} --env RAILS_ENV=${RAILS_ENV} --progress
      01 <s> [webpack.Progress] 0%
      01
      01 <s> [webpack.Progress] 1% setup before run
      01 <s> [webpack.Progress] 1% setup before run NodeEnvironmentPlugin
      01 <s> [webpack.Progress] 1% setup before run
</code>```

In all scenarios, Capistrano is running from inside a Docker container.

The problem is only on MacOS and for only one server. Exact same Capistrano config and setup works for production deployments on MacOS.

I'm not sure on how to continue debugging this further and I would be very happy if someone could help and point me into the right direction.

Additionally, if I run Capistrano only for deploy:assets:precompile job, the job runs without any issues and print the output.

------ UPDATE --------

After restarting my development machine, everything seems to work now. It would be helpful to understand why this is the case. Others have also reported similar issues that got fixed after restart.

Body:
We are facing an issue with deploying our Rails app using Capistrano from a MacOS machine.

Capistrano runs inside a Docker container.

If I trigger the deployment from a Linux host machine (Capistrano running in Docker), it succeeds on all servers.
However, on MacOS, the deployment to production runs fine but not to the staging server.

The deployment is stuck at:

0:28 deploy:assets:precompile
      01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile

I can see on the server that the pre-compilation is running but Capistrano is stuck.

However, when it is run on a Linux machine or a CI server or to Production, it works fine.

00:09 deploy:assets:precompile
      01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
      01 yarn install v1.22.17
      01 [1/4] Resolving packages...
      01 [2/4] Fetching packages...
      01 [3/4] Linking dependencies...
      01 warning " > @rails/actiontext@6.1.7" has incorrect peer dependency "trix@^1.2.0".
      01 [4/4] Building fresh packages...
      01 Done in 22.10s.
      01 yarn run v1.22.17
      01 $ RAILS_ENV=${RAILS_ENV:-production} NODE_ENV=${NODE_ENV:-production} && webpack --config webpack.prod.js --env NODE_ENV=${NODE_ENV} --env RAILS_ENV=${RAILS_ENV} --progress
      01 <s> [webpack.Progress] 0%
      01
      01 <s> [webpack.Progress] 1% setup before run
      01 <s> [webpack.Progress] 1% setup before run NodeEnvironmentPlugin
      01 <s> [webpack.Progress] 1% setup before run

In all scenarios, Capistrano is running from inside a Docker container.

The problem is only on MacOS and for only one server. Exact same Capistrano config and setup works for production deployments on MacOS.

I'm not sure on how to continue debugging this further and I would be very happy if someone could help and point me into the right direction.

Additionally, if I run Capistrano only for deploy:assets:precompile job, the job runs without any issues and print the output.

------ UPDATE --------

After restarting my development machine, everything seems to work now. It would be helpful to understand why this is the case. Others have also reported similar issues that got fixed after restart.


问:
Empty training data was given. You'll need more than one sample
File "./rastreamento_de_rosto.py", line 43, in                                                                                recognizer.train(x_train, np.array(y_labels))                                                                                cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv_contrib\modules\face\src\lbph_faces.cpp:362: error: (-210:Unsupported format or combination of formats) Empty training data was given. You'll need more than one sample to learn a model. in function 'cv::face::LBPH::train'

I am having a problem with this code, it is supposed to be reading images and making a resumed pixel per color matrix of said images for a facial recognizer. but once i run this code, it keeps giving me the error said in the title, even though before it reaches the line of that code it reads the images before.

```<code>import cv2
import os
import numpy as np
from PIL import Image
import pickle

BASE_DIR = os.path.dirname(os.path.abspath(__file__))
image_dir = os.path.join(BASE_DIR, "images")

face_cascade = cv2.CascadeClassifier('cascades/haarcascade_frontalface_alt2.xml')
print("não e aqui em face_cascade")
recognizer = cv2.face.LBPHFaceRecognizer_create()
print(recognizer)

current_id = 0
label_ids = {}
y_labels = []
x_train = []

for root, dirs, files in os.walk(image_dir):
    for file in files:
        if file.endswith("png") or file.endswith("jpg"):
            path = os.path.join(root, file)
            label = os.path.basename(root).replace(" ", "-").lower()
            if not label in label_ids:
                label_ids[label] = current_id
                current_id += 1
            pil_image = Image.open(path).convert("L")
            size = (550, 550)
            final_image = pil_image.resize(size, Image.ANTIALIAS)
            image_array = np.array(final_image, "uint8")
            faces = face_cascade.detectMultiScale(image_array,scaleFactor=1.5,minNeighbors=5)
            print(image_array)
            for (x,y,w,h) in faces:
                roi = image_array[y:y+h, x:x+w]
                x_train.append(roi)
                y_labels.append(id_)

with open("pickles/face-labels.pickle", 'wb') as f:
    pickle.dump(label_ids, f)

recognizer.train(x_train, np.array(y_labels))
recognizer.save("recognizers/face-trainner.yml")
</code>```

I basicaly tried everything, and every time I "fix" it it gives me another error until, and keep "fixing it" until i am back onto the same error. please send some help

Body:
File "./rastreamento_de_rosto.py", line 43, in                                                                                recognizer.train(x_train, np.array(y_labels))                                                                                cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv_contrib\modules\face\src\lbph_faces.cpp:362: error: (-210:Unsupported format or combination of formats) Empty training data was given. You'll need more than one sample to learn a model. in function 'cv::face::LBPH::train'

I am having a problem with this code, it is supposed to be reading images and making a resumed pixel per color matrix of said images for a facial recognizer. but once i run this code, it keeps giving me the error said in the title, even though before it reaches the line of that code it reads the images before.

import cv2
import os
import numpy as np
from PIL import Image
import pickle

BASE_DIR = os.path.dirname(os.path.abspath(__file__))
image_dir = os.path.join(BASE_DIR, "images")

face_cascade = cv2.CascadeClassifier('cascades/haarcascade_frontalface_alt2.xml')
print("não e aqui em face_cascade")
recognizer = cv2.face.LBPHFaceRecognizer_create()
print(recognizer)

current_id = 0
label_ids = {}
y_labels = []
x_train = []

for root, dirs, files in os.walk(image_dir):
    for file in files:
        if file.endswith("png") or file.endswith("jpg"):
            path = os.path.join(root, file)
            label = os.path.basename(root).replace(" ", "-").lower()
            if not label in label_ids:
                label_ids[label] = current_id
                current_id += 1
            pil_image = Image.open(path).convert("L")
            size = (550, 550)
            final_image = pil_image.resize(size, Image.ANTIALIAS)
            image_array = np.array(final_image, "uint8")
            faces = face_cascade.detectMultiScale(image_array,scaleFactor=1.5,minNeighbors=5)
            print(image_array)
            for (x,y,w,h) in faces:
                roi = image_array[y:y+h, x:x+w]
                x_train.append(roi)
                y_labels.append(id_)

with open("pickles/face-labels.pickle", 'wb') as f:
    pickle.dump(label_ids, f)

recognizer.train(x_train, np.array(y_labels))
recognizer.save("recognizers/face-trainner.yml")

I basicaly tried everything, and every time I "fix" it it gives me another error until, and keep "fixing it" until i am back onto the same error. please send some help