问:
Webpack : Uncaught ReferenceError: Cannot access 'Xf' before initialization Not a Circular dependency in Local Env
Hi I am working on a website, simple HTML/CSS/JS frontend along with firebase and webpack. I make my firebase functions in one file, and export them to different files which are linked to a html page (one js file for each html page).

All other JS files are working fine but I get this error on one page:

```<code>Uncaught ReferenceError: Cannot access 'Xf' before initialization
</code>```

I have searched online and it seems to be a Circular Dependency problem in most cases so, I added the webpack plugin for that however it shows no Circular dependencies here.

```<code>const CircularDependencyPlugin = require("circular-dependency-plugin");

module.exports = {
  plugins: [
    new Dotenv(),
    new CircularDependencyPlugin({
      onStart({ compilation }) {
        console.log("start detecting webpack modules cycles");
      },
      onDetected({ module: webpackModuleRecord, paths, compilation }) {
        compilation.errors.push(new Error(paths.join(" -> ")));
        console.log("Cycle detected : "+new Error(paths.join(" -> ")))
      },
      // `onEnd` is called before the cycle detection ends
      onEnd({ compilation }) {
        console.log("end detecting webpack modules cycles");
      },
    }),
  ],
</code>```

Output

```<code>D:\Websites\New folder\Salio>npm run build
> backend@1.0.0 build
> webpack --config webpack.config.js
start detecting webpack modules cycles
end detecting webpack modules cycles

webpack 5.75.0 compiled with 4 warnings in 32449 ms
</code>```

These are my imports on the file that's giving the error :

```<code>import { addClient, getSources, getWriters } from "../firebase-auth";
</code>```

These are my imports on the firebase file:

```<code>import {
  getAuth,
  signInWithEmailAndPassword,
  createUserWithEmailAndPassword,
  signOut,
  onAuthStateChanged,
  updateProfile,
  updateCurrentUser,
} from "firebase/auth";

import {
  addDoc,
  collection,
  getDocs,
  getFirestore,
  query,
  where,
  getDoc,
  doc,
  setDoc,
} from "firebase/firestore";
import { initializeApp } from "firebase/app";
</code>```

Edit
I deployed the project on google cloud and this error doesn't occur there. To confirm, I downloaded it again from there and ran it in local environment, for some odd reason this error only exists in my local environment...

I don't have a clue what's going on here, any help will be highly appreciated, thanks.

Body:
Hi I am working on a website, simple HTML/CSS/JS frontend along with firebase and webpack. I make my firebase functions in one file, and export them to different files which are linked to a html page (one js file for each html page).

All other JS files are working fine but I get this error on one page:

Uncaught ReferenceError: Cannot access 'Xf' before initialization

I have searched online and it seems to be a Circular Dependency problem in most cases so, I added the webpack plugin for that however it shows no Circular dependencies here.

const CircularDependencyPlugin = require("circular-dependency-plugin");

module.exports = {
  plugins: [
    new Dotenv(),
    new CircularDependencyPlugin({
      onStart({ compilation }) {
        console.log("start detecting webpack modules cycles");
      },
      onDetected({ module: webpackModuleRecord, paths, compilation }) {
        compilation.errors.push(new Error(paths.join(" -> ")));
        console.log("Cycle detected : "+new Error(paths.join(" -> ")))
      },
      // `onEnd` is called before the cycle detection ends
      onEnd({ compilation }) {
        console.log("end detecting webpack modules cycles");
      },
    }),
  ],

Output

D:\Websites\New folder\Salio>npm run build
> backend@1.0.0 build
> webpack --config webpack.config.js
start detecting webpack modules cycles
end detecting webpack modules cycles

webpack 5.75.0 compiled with 4 warnings in 32449 ms

These are my imports on the file that's giving the error :

import { addClient, getSources, getWriters } from "../firebase-auth";

These are my imports on the firebase file:

import {
  getAuth,
  signInWithEmailAndPassword,
  createUserWithEmailAndPassword,
  signOut,
  onAuthStateChanged,
  updateProfile,
  updateCurrentUser,
} from "firebase/auth";

import {
  addDoc,
  collection,
  getDocs,
  getFirestore,
  query,
  where,
  getDoc,
  doc,
  setDoc,
} from "firebase/firestore";
import { initializeApp } from "firebase/app";

Edit
I deployed the project on google cloud and this error doesn't occur there. To confirm, I downloaded it again from there and ran it in local environment, for some odd reason this error only exists in my local environment...

I don't have a clue what's going on here, any help will be highly appreciated, thanks.


来源: stackexchange

问:
Getting a com.jcraft.jsch.JSchException: Auth fail over ssh despite adding a jSch identity
I'm getting an Auth fail exception when attempting to clone a git repository with jgit written in Kotlin.

Having created a public and private key with

```<code>ssh-keygen -t rsa -m PEM
</code>```

this is to ensure the keys are generated using rsa and not openssh which is not supported by jgit.
The 2 keys are then saved to my machine under /Users/Me/.ssh

The public key has been added to the GitHub repository I want to clone in the Deploy Keys section and I've removed the user and hostname from the public key according to something I read here -> https://ngdeveloper.com/how-to-clone-git-using-ssh-in-java/ (image -> https://i0.wp.com/ngdeveloper.com/wp-content/uploads/2021/06/image-4.png?ssl=1)

The code that then does the cloning of the GitHub repository has been written in a Kotlin App but I followed instructions from an article on dzone for 'Accessing Git Repos With Java Using SSH Keys' https://dzone.com/articles/accessing-git-repos-with-java-using-ssh-keys and converted this to kotlin.

I've got a service with the following code:

```<code>fun backup() {
        // Clone the repo
        val workingDir: File = Files.createTempDirectory("workspace").toFile()

        val transportConfigCallback: TransportConfigCallback = SshTransportConfigCallback()

        var git = Git.cloneRepository()
            .setDirectory(workingDir)
            .setTransportConfigCallback(transportConfigCallback)
            .setURI(gitUrl) // ssh://github.blah.io/Domain/project-name.git
            .call()
    }
</code>```

and another class (SshTransportConfigCallback) that overrides the configuration

```<code>open class SshTransportConfigCallback : TransportConfigCallback {

    private val sshSessionFactory: SshSessionFactory = object : JschConfigSessionFactory() {
        override fun configure(hc: OpenSshConfig.Host?, session: Session) {
            session.setConfig("StrictHostKeyChecking", "no")
        }

        @Throws(JSchException::class)
        override fun createDefaultJSch(fs: FS?): JSch {
            val jSch: JSch = super.createDefaultJSch(fs)
            jSch.removeAllIdentity()
            jSch.addIdentity("/path/to/private/key/file/in/this/app") // not the file located under ~/.ssh but copied and pasted in the Kotlin app

            return jSch
        }

    }

    override fun configure(transport: Transport) {
        val sshTransport: SshTransport = transport as SshTransport
        sshTransport.sshSessionFactory = sshSessionFactory
    }
}
</code>```

The build.gradle implementations for adding jgit are as follows:

```<code>implementation("org.eclipse.jgit:org.eclipse.jgit:6.4.0.202211300538-r")
implementation("org.eclipse.jgit:org.eclipse.jgit.ssh.jsch:6.4.0.202211300538-r")
</code>```

Debugging the code and what I find is that when a session is being created jgit is looking on my local machine for the config in ~/.ssh/config but I don't have such a file.

When the public and private keys were generated with

```<code>ssh-keygen -t rsa -m PEM
</code>```

they were saved in ~/.ssh under the Users folder on my laptop and then I ran

```<code>ssh-add git-ssh
</code>```

also according to https://ngdeveloper.com/how-to-clone-git-using-ssh-in-java/

Given the config in SshTransportConfigCallback, I thought that the private key that I have copied from ~/.ssh and into my app adding it as an identity when overriding the defaultJSch behaviour this meant jgit would use this and not look in a config file on my local machines (~/.ssh)?

I'm thinking that I'm missing some config somewhere to tell jgit not to do this?

If I change the filename of the private key in SshTransportConfigCallback (to test that the code is being hit) I do get an exception saying the file wasn't found so the private key it contains is being read and used somewhere but maybe not being used to initiate the session with GitHub?

Would appreciate any suggestions! Thank you

ContentLicense: CC BY-SA 4.0

Body:
I'm getting an Auth fail exception when attempting to clone a git repository with jgit written in Kotlin.

Having created a public and private key with

ssh-keygen -t rsa -m PEM

this is to ensure the keys are generated using rsa and not openssh which is not supported by jgit.
The 2 keys are then saved to my machine under /Users/Me/.ssh

The public key has been added to the GitHub repository I want to clone in the Deploy Keys section and I've removed the user and hostname from the public key according to something I read here -> https://ngdeveloper.com/how-to-clone-git-using-ssh-in-java/ (image -> https://i0.wp.com/ngdeveloper.com/wp-content/uploads/2021/06/image-4.png?ssl=1)

The code that then does the cloning of the GitHub repository has been written in a Kotlin App but I followed instructions from an article on dzone for 'Accessing Git Repos With Java Using SSH Keys' https://dzone.com/articles/accessing-git-repos-with-java-using-ssh-keys and converted this to kotlin.

I've got a service with the following code:

fun backup() {
        // Clone the repo
        val workingDir: File = Files.createTempDirectory("workspace").toFile()

        val transportConfigCallback: TransportConfigCallback = SshTransportConfigCallback()

        var git = Git.cloneRepository()
            .setDirectory(workingDir)
            .setTransportConfigCallback(transportConfigCallback)
            .setURI(gitUrl) // ssh://github.blah.io/Domain/project-name.git
            .call()
    }

and another class (SshTransportConfigCallback) that overrides the configuration

open class SshTransportConfigCallback : TransportConfigCallback {

    private val sshSessionFactory: SshSessionFactory = object : JschConfigSessionFactory() {
        override fun configure(hc: OpenSshConfig.Host?, session: Session) {
            session.setConfig("StrictHostKeyChecking", "no")
        }

        @Throws(JSchException::class)
        override fun createDefaultJSch(fs: FS?): JSch {
            val jSch: JSch = super.createDefaultJSch(fs)
            jSch.removeAllIdentity()
            jSch.addIdentity("/path/to/private/key/file/in/this/app") // not the file located under ~/.ssh but copied and pasted in the Kotlin app

            return jSch
        }

    }

    override fun configure(transport: Transport) {
        val sshTransport: SshTransport = transport as SshTransport
        sshTransport.sshSessionFactory = sshSessionFactory
    }
}

The build.gradle implementations for adding jgit are as follows:

implementation("org.eclipse.jgit:org.eclipse.jgit:6.4.0.202211300538-r")
implementation("org.eclipse.jgit:org.eclipse.jgit.ssh.jsch:6.4.0.202211300538-r")

Debugging the code and what I find is that when a session is being created jgit is looking on my local machine for the config in ~/.ssh/config but I don't have such a file.

When the public and private keys were generated with

ssh-keygen -t rsa -m PEM

they were saved in ~/.ssh under the Users folder on my laptop and then I ran

ssh-add git-ssh

also according to https://ngdeveloper.com/how-to-clone-git-using-ssh-in-java/

Given the config in SshTransportConfigCallback, I thought that the private key that I have copied from ~/.ssh and into my app adding it as an identity when overriding the defaultJSch behaviour this meant jgit would use this and not look in a config file on my local machines (~/.ssh)?

I'm thinking that I'm missing some config somewhere to tell jgit not to do this?

If I change the filename of the private key in SshTransportConfigCallback (to test that the code is being hit) I do get an exception saying the file wasn't found so the private key it contains is being read and used somewhere but maybe not being used to initiate the session with GitHub?

Would appreciate any suggestions! Thank you


问:
Unique user identifier when using Cognito (UserPool and Identity Pool)
I can use a UserPool Authorizer or an IAM Authorizer for Lambdas when exposing a REST endpoint to authenticated Cognito users. If I ultimately want to set up federated identities would what would I use as a unique user ID: The Userpool SUB or the Identity Pool Identity ID?

I see that I can federate both through the Userpool or the Identity Pool.


问:
RStudio .Rmds run Python loops line by line instead of as Chunks when using CTRL+Enter
I'm trying to start using Python and want to use the RStudio IDE as it's what I'm used to.

I cannot seem to get .Rmd code chucks to run all at once, Rmds just run each line one after another. This isn't the case when I click "run current chunk"

Consider a basic loop I found online :

```<code>fruits = ["apple", "banana", "cherry"]
for x in fruits:
  print(x)
</code>```

This is what I get when I try to run pressing CTRL+Enter :

Whereas when I press "run current chunk" twice, it behaves normally :

Basically, something seems to be wrong with when it thinks the loop is over. Any ideas?

Body:
I'm trying to start using Python and want to use the RStudio IDE as it's what I'm used to.

I cannot seem to get .Rmd code chucks to run all at once, Rmds just run each line one after another. This isn't the case when I click "run current chunk"

Consider a basic loop I found online :

fruits = ["apple", "banana", "cherry"]
for x in fruits:
  print(x)

This is what I get when I try to run pressing CTRL+Enter :

Whereas when I press "run current chunk" twice, it behaves normally :

Basically, something seems to be wrong with when it thinks the loop is over. Any ideas?


问:
Checking whether multiple resources exists using existenceCondition in Azure policy
I am trying to bring up an azure policy to create alert rules for a specific type of resource when there are desired alert rules already not defined for the particular resource. For that i used deployIfNotExists effect and existenceCondition with anyOf.

But it is not working as expected. Need some help on this if someone already handled similar scenario for your usecase.

```<code>    "then": {
    "effect": "deployIfNotExists",
    "details": {
      "type": "microsoft.insights/metricAlerts",
      "resourceGroupName": "[resourceGroup().name]",
      "existenceCondition": {
        "anyOf": [
          {
            "field": "name",
            "equals": "[concat('alert_appgw_failedrequests_',field('Name'))]"
          },
          {
            "field": "name",
            "equals": "[concat('alert_appgw_throughput_',field('Name'))]"
          },
          {
            "field": "name",
            "equals": "[concat('alert_appgw_unhealthyhost_',field('Name'))]"
          }
        ]
      },
      "roleDefinitionIds": [
        "/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
      ],
      "deployment": {
</code>```

This is not working as expected, this is actually metricalert resource i try to create if not exists for appgateway, if i delete any one of the metricalert alone for an appgateway it is not creating an alertrule/metric alert.

I need to create a metricalert if even any one of the metric alert is deleted or not exists for a appgateway.

Someone help out with your ideas,

PS: Please correct me if this query is not clear enough.

Edit:

Posting the full definition, Actually, i am getting non-compliant resources as compliant too. @Niclas

```<code>{
  "mode": "All",
  "policyRule": {
    "if": {
      "allOf": [
        {
          "field": "type",
          "equals": "Microsoft.Network/applicationGateways"
        },
        {
          "field": "tags.nomonitor",
          "exists": false
        }
      ]
    },
    "then": {
      "effect": "deployIfNotExists",
      "details": {
        "type": "microsoft.insights/metricAlerts",
        "resourceGroupName": "[resourceGroup().name]",
        "existenceCondition": {
          "anyOf": [
            {
              "field": "name",
              "equals": "[concat('alert_appgw_failedrequests_',field('Name'))]"
            },
            {
              "field": "name",
              "equals": "[concat('alert_appgw_throughput_',field('Name'))]"
            },
            {
              "field": "name",
              "equals": "[concat('alert_appgw_unhealthyhost_',field('Name'))]"
            }
          ]
        },
        "roleDefinitionIds": [
          "/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
        ],
        "deployment": {
          "properties": {
            "mode": "incremental",
            "template": {
              "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
              "contentVersion": "1.0.0.0",
              "parameters": {
                "appgateway_name": {
                  "type": "String"
                },
                "location": {
                  "type": "String"
                }
              },
              "resources": [
                {
                  "type": "microsoft.insights/metricAlerts",
                  "apiVersion": "2018-03-01",
                  "name": "[concat('alert_appgw_failedrequests_',parameters('appgateway_name'))]",
                  "location": "global",
                  "properties": {
                    "description": "Platform alerts",
                    "severity": 2,
                    "enabled": true,
                    "scopes": [
                      "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/applicationGateways/',parameters('appgateway_name'))]"
                    ],
                    "evaluationFrequency": "PT15M",
                    "windowSize": "PT15M",
                    "criteria": {
                      "allOf": [
                        {
                          "threshold": 10,
                          "name": "Metric1",
                          "metricNamespace": "Microsoft.Network/applicationGateways",
                          "metricName": "FailedRequests",
                          "operator": "GreaterThanOrEqual",
                          "timeAggregation": "Total",
                          "criterionType": "StaticThresholdCriterion"
                        }
                      ],
                      "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria"
                    },
                    "autoMitigate": true,
                    "targetResourceType": "Microsoft.Network/applicationGateways",
                    "targetResourceRegion": "[parameters('location')]",
                    "actions": [
                      {
                        "actionGroupId": "/subscriptions/ec23feef-629f-481d-b69e-a5d7faa5cb26/resourceGroups/DefaultResourceGroup-WUS2/providers/microsoft.insights/actionGroups/ALERT-DL",
                        "webHookProperties": {}
                      }
                    ]
                  }
                },
                {
                  "type": "microsoft.insights/metricAlerts",
                  "apiVersion": "2018-03-01",
                  "name": "[concat('alert_appgw_throughput_',parameters('appgateway_name'))]",
                  "location": "global",
                  "properties": {
                    "description": "Platform alerts",
                    "severity": 2,
                    "enabled": true,
                    "scopes": [
                      "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/applicationGateways/',parameters('appgateway_name'))]"
                    ],
                    "evaluationFrequency": "PT15M",
                    "windowSize": "PT15M",
                    "criteria": {
                      "allOf": [
                        {
                          "threshold": 1000,
                          "name": "Metric1",
                          "metricNamespace": "Microsoft.Network/applicationGateways",
                          "metricName": "Throughput",
                          "operator": "GreaterThan",
                          "timeAggregation": "Average",
                          "criterionType": "StaticThresholdCriterion"
                        }
                      ],
                      "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria"
                    },
                    "autoMitigate": true,
                    "targetResourceType": "Microsoft.Network/applicationGateways",
                    "targetResourceRegion": "[parameters('location')]",
                    "actions": [
                      {
                        "actionGroupId": "/subscriptions/ec23feef-629f-481d-b69e-a5d7faa5cb26/resourceGroups/DefaultResourceGroup-WUS2/providers/microsoft.insights/actionGroups/ALERT-DL",
                        "webHookProperties": {}
                      }
                    ]
                  }
                },
                {
                  "type": "microsoft.insights/metricAlerts",
                  "apiVersion": "2018-03-01",
                  "name": "[concat('alert_appgw_unhealthyhost_',parameters('appgateway_name'))]",
                  "location": "global",
                  "properties": {
                    "description": "Platform alerts",
                    "severity": 2,
                    "enabled": true,
                    "scopes": [
                      "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/applicationGateways/',parameters('appgateway_name'))]"
                    ],
                    "evaluationFrequency": "PT15M",
                    "windowSize": "PT15M",
                    "criteria": {
                      "allOf": [
                        {
                          "threshold": 1,
                          "name": "Metric1",
                          "metricNamespace": "Microsoft.Network/applicationGateways",
                          "metricName": "UnhealthyHostCount",
                          "operator": "GreaterThanOrEqual",
                          "timeAggregation": "Average",
                          "criterionType": "StaticThresholdCriterion"
                        }
                      ],
                      "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria"
                    },
                    "autoMitigate": true,
                    "targetResourceType": "Microsoft.Network/applicationGateways",
                    "targetResourceRegion": "[parameters('location')]",
                    "actions": [
                      {
                        "actionGroupId": "/subscriptions/ec23feef-629f-481d-b69e-a5d7faa5cb26/resourceGroups/DefaultResourceGroup-WUS2/providers/microsoft.insights/actionGroups/ALERT-DL",
                        "webHookProperties": {}
                      }
                    ]
                  }
                }
              ]
            },
            "parameters": {
              "appgateway_name": {
                "value": "[field('Name')]"
              },
              "location": {
                "value": "[field('Location')]"
              }
            }
          }
        }
      }
    }
  },
  "parameters": {}
}
</code>```

Body:
I am trying to bring up an azure policy to create alert rules for a specific type of resource when there are desired alert rules already not defined for the particular resource. For that i used deployIfNotExists effect and existenceCondition with anyOf.

But it is not working as expected. Need some help on this if someone already handled similar scenario for your usecase.

    "then": {
    "effect": "deployIfNotExists",
    "details": {
      "type": "microsoft.insights/metricAlerts",
      "resourceGroupName": "[resourceGroup().name]",
      "existenceCondition": {
        "anyOf": [
          {
            "field": "name",
            "equals": "[concat('alert_appgw_failedrequests_',field('Name'))]"
          },
          {
            "field": "name",
            "equals": "[concat('alert_appgw_throughput_',field('Name'))]"
          },
          {
            "field": "name",
            "equals": "[concat('alert_appgw_unhealthyhost_',field('Name'))]"
          }
        ]
      },
      "roleDefinitionIds": [
        "/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
      ],
      "deployment": {

This is not working as expected, this is actually metricalert resource i try to create if not exists for appgateway, if i delete any one of the metricalert alone for an appgateway it is not creating an alertrule/metric alert.

I need to create a metricalert if even any one of the metric alert is deleted or not exists for a appgateway.

Someone help out with your ideas,

PS: Please correct me if this query is not clear enough.

Edit:

Posting the full definition, Actually, i am getting non-compliant resources as compliant too. @Niclas

{
  "mode": "All",
  "policyRule": {
    "if": {
      "allOf": [
        {
          "field": "type",
          "equals": "Microsoft.Network/applicationGateways"
        },
        {
          "field": "tags.nomonitor",
          "exists": false
        }
      ]
    },
    "then": {
      "effect": "deployIfNotExists",
      "details": {
        "type": "microsoft.insights/metricAlerts",
        "resourceGroupName": "[resourceGroup().name]",
        "existenceCondition": {
          "anyOf": [
            {
              "field": "name",
              "equals": "[concat('alert_appgw_failedrequests_',field('Name'))]"
            },
            {
              "field": "name",
              "equals": "[concat('alert_appgw_throughput_',field('Name'))]"
            },
            {
              "field": "name",
              "equals": "[concat('alert_appgw_unhealthyhost_',field('Name'))]"
            }
          ]
        },
        "roleDefinitionIds": [
          "/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
        ],
        "deployment": {
          "properties": {
            "mode": "incremental",
            "template": {
              "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
              "contentVersion": "1.0.0.0",
              "parameters": {
                "appgateway_name": {
                  "type": "String"
                },
                "location": {
                  "type": "String"
                }
              },
              "resources": [
                {
                  "type": "microsoft.insights/metricAlerts",
                  "apiVersion": "2018-03-01",
                  "name": "[concat('alert_appgw_failedrequests_',parameters('appgateway_name'))]",
                  "location": "global",
                  "properties": {
                    "description": "Platform alerts",
                    "severity": 2,
                    "enabled": true,
                    "scopes": [
                      "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/applicationGateways/',parameters('appgateway_name'))]"
                    ],
                    "evaluationFrequency": "PT15M",
                    "windowSize": "PT15M",
                    "criteria": {
                      "allOf": [
                        {
                          "threshold": 10,
                          "name": "Metric1",
                          "metricNamespace": "Microsoft.Network/applicationGateways",
                          "metricName": "FailedRequests",
                          "operator": "GreaterThanOrEqual",
                          "timeAggregation": "Total",
                          "criterionType": "StaticThresholdCriterion"
                        }
                      ],
                      "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria"
                    },
                    "autoMitigate": true,
                    "targetResourceType": "Microsoft.Network/applicationGateways",
                    "targetResourceRegion": "[parameters('location')]",
                    "actions": [
                      {
                        "actionGroupId": "/subscriptions/ec23feef-629f-481d-b69e-a5d7faa5cb26/resourceGroups/DefaultResourceGroup-WUS2/providers/microsoft.insights/actionGroups/ALERT-DL",
                        "webHookProperties": {}
                      }
                    ]
                  }
                },
                {
                  "type": "microsoft.insights/metricAlerts",
                  "apiVersion": "2018-03-01",
                  "name": "[concat('alert_appgw_throughput_',parameters('appgateway_name'))]",
                  "location": "global",
                  "properties": {
                    "description": "Platform alerts",
                    "severity": 2,
                    "enabled": true,
                    "scopes": [
                      "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/applicationGateways/',parameters('appgateway_name'))]"
                    ],
                    "evaluationFrequency": "PT15M",
                    "windowSize": "PT15M",
                    "criteria": {
                      "allOf": [
                        {
                          "threshold": 1000,
                          "name": "Metric1",
                          "metricNamespace": "Microsoft.Network/applicationGateways",
                          "metricName": "Throughput",
                          "operator": "GreaterThan",
                          "timeAggregation": "Average",
                          "criterionType": "StaticThresholdCriterion"
                        }
                      ],
                      "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria"
                    },
                    "autoMitigate": true,
                    "targetResourceType": "Microsoft.Network/applicationGateways",
                    "targetResourceRegion": "[parameters('location')]",
                    "actions": [
                      {
                        "actionGroupId": "/subscriptions/ec23feef-629f-481d-b69e-a5d7faa5cb26/resourceGroups/DefaultResourceGroup-WUS2/providers/microsoft.insights/actionGroups/ALERT-DL",
                        "webHookProperties": {}
                      }
                    ]
                  }
                },
                {
                  "type": "microsoft.insights/metricAlerts",
                  "apiVersion": "2018-03-01",
                  "name": "[concat('alert_appgw_unhealthyhost_',parameters('appgateway_name'))]",
                  "location": "global",
                  "properties": {
                    "description": "Platform alerts",
                    "severity": 2,
                    "enabled": true,
                    "scopes": [
                      "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/applicationGateways/',parameters('appgateway_name'))]"
                    ],
                    "evaluationFrequency": "PT15M",
                    "windowSize": "PT15M",
                    "criteria": {
                      "allOf": [
                        {
                          "threshold": 1,
                          "name": "Metric1",
                          "metricNamespace": "Microsoft.Network/applicationGateways",
                          "metricName": "UnhealthyHostCount",
                          "operator": "GreaterThanOrEqual",
                          "timeAggregation": "Average",
                          "criterionType": "StaticThresholdCriterion"
                        }
                      ],
                      "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria"
                    },
                    "autoMitigate": true,
                    "targetResourceType": "Microsoft.Network/applicationGateways",
                    "targetResourceRegion": "[parameters('location')]",
                    "actions": [
                      {
                        "actionGroupId": "/subscriptions/ec23feef-629f-481d-b69e-a5d7faa5cb26/resourceGroups/DefaultResourceGroup-WUS2/providers/microsoft.insights/actionGroups/ALERT-DL",
                        "webHookProperties": {}
                      }
                    ]
                  }
                }
              ]
            },
            "parameters": {
              "appgateway_name": {
                "value": "[field('Name')]"
              },
              "location": {
                "value": "[field('Location')]"
              }
            }
          }
        }
      }
    }
  },
  "parameters": {}
}


问:
How to create a condition for wait and service block?
I'm learning about anylogic simulation.
My simulation is a process assemble. There is many workstation, and each one them do something activities, so, it's diferents times.

Modeling Process

I'm trying to write a condition for this process, some like rotine below...

For exemple:

if service block number 2 is occupated, all the process before must to wait until it finished.
And service block 3, 4, 5... 10, 11, 12... same thing.

How I should to do?


问:
FirebaseRecyclerOptions query for certain array of keys
firebase database
I should extract only certain keys from drinkCategories and display them in FirebaseRecyclerOptions. I'm wondering how should I manipulate the query or FirebaseDatabase reference to only look for specific keys.

Edit: below is my code, arrayOfCategories inside equalTo is not real array, just a representation of what I want to acomplish. "equalTo" takes one string but is there another way to query only certain keys, example i want to query only by keys category-id-7 and category-id-9 (these two keys are stored inside arrayOfCategories), ignore all other keys.

```<code>    categoriesRef = FirebaseDatabase.getInstance().getReference("drinksCategories");
    Query query = categoriesRef.orderByKey().equalTo(arrayOfCategories);

    FirebaseRecyclerOptions<Category> options = new FirebaseRecyclerOptions.Builder<Category>()
            .setQuery(query, Category.class)
            .build();

    FirebaseRecyclerAdapter<Category, MenuViewHolder> adapter = new FirebaseRecyclerAdapter<Category, MenuViewHolder>(options) {
        @Override
        protected void onBindViewHolder(@NonNull MenuViewHolder holder, int position, @NonNull Category model) {
            String categoryId = getRef(position).getKey();
            categoriesRef.child(categoryId).addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(@NonNull DataSnapshot snapshot) {
                    if(snapshot.hasChild("image")) {
                        Toast.makeText(getActivity(), snapshot.getValue(Category.class).getName(), Toast.LENGTH_SHORT).show();
                        String description = snapshot.child("description").getValue().toString();
                        String profileImage = snapshot.child("image").getValue().toString();
                        String name = snapshot.child("name").getValue().toString();

                        int id = getResources().getIdentifier(profileImage, "drawable", getActivity().getPackageName());
                        Drawable drawable;
                        if (id == 0) {
                            id = getResources().getIdentifier("no_image", "drawable", getActivity().getPackageName());
                            drawable = getResources().getDrawable(id);
                        }
                        else
                            drawable = getResources().getDrawable(id);
                        Glide.with(getActivity()).load(drawable).centerCrop().into(holder.imageView);

                        holder.txtMenuName.setText(name);
                        holder.setItemClickListener(new ItemClickListener() {
                            @Override
                            public void onClick(View view, int position, boolean isLongClick) {
                                recyclerMenu.setVisibility(View.GONE);
                                insertDrinks(name);
                                recyclerMenuDrinks.setVisibility(view.VISIBLE);
                            }
                        });
                    }
                    else {
                        String name = snapshot.child("name").getKey().toString();
                        String description = snapshot.child("description").getKey().toString();

                        holder.txtMenuName.setText(name);
                    }
                }

                @Override
                public void onCancelled(@NonNull DatabaseError error) {
                    Toast.makeText(getActivity(), "Error!", Toast.LENGTH_SHORT).show();
                }
            });
        }
        @NonNull
        @Override
        public MenuViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
            View view = LayoutInflater.from(parent.getContext())
                    .inflate(R.layout.menu_item, parent, false);
            return new MenuViewHolder(view);
        }
    };
    recyclerMenu.setAdapter(adapter);
    adapter.startListening();
</code>```

Body:
firebase database
I should extract only certain keys from drinkCategories and display them in FirebaseRecyclerOptions. I'm wondering how should I manipulate the query or FirebaseDatabase reference to only look for specific keys.

Edit: below is my code, arrayOfCategories inside equalTo is not real array, just a representation of what I want to acomplish. "equalTo" takes one string but is there another way to query only certain keys, example i want to query only by keys category-id-7 and category-id-9 (these two keys are stored inside arrayOfCategories), ignore all other keys.

    categoriesRef = FirebaseDatabase.getInstance().getReference("drinksCategories");
    Query query = categoriesRef.orderByKey().equalTo(arrayOfCategories);

    FirebaseRecyclerOptions<Category> options = new FirebaseRecyclerOptions.Builder<Category>()
            .setQuery(query, Category.class)
            .build();

    FirebaseRecyclerAdapter<Category, MenuViewHolder> adapter = new FirebaseRecyclerAdapter<Category, MenuViewHolder>(options) {
        @Override
        protected void onBindViewHolder(@NonNull MenuViewHolder holder, int position, @NonNull Category model) {
            String categoryId = getRef(position).getKey();
            categoriesRef.child(categoryId).addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(@NonNull DataSnapshot snapshot) {
                    if(snapshot.hasChild("image")) {
                        Toast.makeText(getActivity(), snapshot.getValue(Category.class).getName(), Toast.LENGTH_SHORT).show();
                        String description = snapshot.child("description").getValue().toString();
                        String profileImage = snapshot.child("image").getValue().toString();
                        String name = snapshot.child("name").getValue().toString();

                        int id = getResources().getIdentifier(profileImage, "drawable", getActivity().getPackageName());
                        Drawable drawable;
                        if (id == 0) {
                            id = getResources().getIdentifier("no_image", "drawable", getActivity().getPackageName());
                            drawable = getResources().getDrawable(id);
                        }
                        else
                            drawable = getResources().getDrawable(id);
                        Glide.with(getActivity()).load(drawable).centerCrop().into(holder.imageView);

                        holder.txtMenuName.setText(name);
                        holder.setItemClickListener(new ItemClickListener() {
                            @Override
                            public void onClick(View view, int position, boolean isLongClick) {
                                recyclerMenu.setVisibility(View.GONE);
                                insertDrinks(name);
                                recyclerMenuDrinks.setVisibility(view.VISIBLE);
                            }
                        });
                    }
                    else {
                        String name = snapshot.child("name").getKey().toString();
                        String description = snapshot.child("description").getKey().toString();

                        holder.txtMenuName.setText(name);
                    }
                }

                @Override
                public void onCancelled(@NonNull DatabaseError error) {
                    Toast.makeText(getActivity(), "Error!", Toast.LENGTH_SHORT).show();
                }
            });
        }
        @NonNull
        @Override
        public MenuViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
            View view = LayoutInflater.from(parent.getContext())
                    .inflate(R.layout.menu_item, parent, false);
            return new MenuViewHolder(view);
        }
    };
    recyclerMenu.setAdapter(adapter);
    adapter.startListening();


问:
How can I implement the typestate pattern based on a discriminator?
I have a use-case in mind where I query a database by handing it a Device<T> where T: Counter.  I can imagine how the consuming API looks:

fn get_counts<T: Counter>(dev: Device<T>) -> Vec<Count> {}
```
<p>But when trying to implement <code>Device</code>, I can't find a pattern that satisfied the compiler.  I want to do something like:</p>
<pre class="lang-rs prettyprint-override"><code>struct Device<T> {
  id: i64,
  addr: i64,
  _marker: PhantomData<T>,
}

impl<T> Device<T> {
  fn new(id: i64, addr: i64, kind: i64) -> Self {
    match kind {
      // where MyType1 implements Counter
      0 => Self { id, addr, _marker: PhantomData<MyType1> },
      // where MyType2 implements SomeDefaultTrait
      1 => Self { id, addr, _marker: PhantomData<MyType2> },
      _ => todo!(),
    }
  }
}
</code>```

And this complains that type Device<MyType1> is not a Device<T>.  How do I move forward with implementing this pattern that satisfies the compiler?  I couldn't find any examples that implement typestate based off a discriminator to give me a resulting type.

Body:
I have a use-case in mind where I query a database by handing it a Device<T> where T: Counter.  I can imagine how the consuming API looks:

fn get_counts<T: Counter>(dev: Device<T>) -> Vec<Count> {}

But when trying to implement Device, I can't find a pattern that satisfied the compiler.  I want to do something like:

struct Device<T> {
  id: i64,
  addr: i64,
  _marker: PhantomData<T>,
}

impl<T> Device<T> {
  fn new(id: i64, addr: i64, kind: i64) -> Self {
    match kind {
      // where MyType1 implements Counter
      0 => Self { id, addr, _marker: PhantomData<MyType1> },
      // where MyType2 implements SomeDefaultTrait
      1 => Self { id, addr, _marker: PhantomData<MyType2> },
      _ => todo!(),
    }
  }
}

And this complains that type Device<MyType1> is not a Device<T>.  How do I move forward with implementing this pattern that satisfies the compiler?  I couldn't find any examples that implement typestate based off a discriminator to give me a resulting type.


问:
Dealing with internal dependencies when publishing to central repository (maven central) and generating release pom.xml
So I'm currently working in publishing a java library to the maven central repository using sonatype, The thing is that my core library (the one I'm trying to push) has some internal dependencies which I'm not sure how to add to the deployment process.
i.e
`
com.internal.dep
messages-dep

```<code>    <dependency>
        <groupId>com.internal.dep</groupId>
        <artifactId>messages-api-dep</artifactId>
    </dependency>

    <dependency>
        <groupId>com.internal.dep</groupId>
        <artifactId>messages-control-dep</artifactId>
    </dependency>

   etc...`
</code>```

My current thought is to upload them as separate libraries to the repository and then make dependencies for that. However I'm not sure how good is that approach.

Also I need to generate a release pom including the dependencies cause the one we currently use for internal deployment includes unnecessary and probably sensitive information.

Body:
So I'm currently working in publishing a java library to the maven central repository using sonatype, The thing is that my core library (the one I'm trying to push) has some internal dependencies which I'm not sure how to add to the deployment process.
i.e
`
com.internal.dep
messages-dep

    <dependency>
        <groupId>com.internal.dep</groupId>
        <artifactId>messages-api-dep</artifactId>
    </dependency>

    <dependency>
        <groupId>com.internal.dep</groupId>
        <artifactId>messages-control-dep</artifactId>
    </dependency>

   etc...`

My current thought is to upload them as separate libraries to the repository and then make dependencies for that. However I'm not sure how good is that approach.

Also I need to generate a release pom including the dependencies cause the one we currently use for internal deployment includes unnecessary and probably sensitive information.


问:
How can I handle multiple queries with useInfinityQuery?
I need to be able to call multiple endpoints and automatically keep fetching more data using cursors returned from the BE. Multiple queries handling can be done with useQueries, but as soon as data is loaded I need to be able to fetch more chunks using cursors, therefore pointing me to useInfinityQuery. But the thing is that it seems that this hook cannot handle multiple queries.

```<code> const {
    status,
    data,
    isFetching,
    isFetchingNextPage,
    fetchNextPage,
    hasNextPage,
  } = useInfiniteQuery({
    // here there is only the option to use one query
    queryKey: ['projects'],
    queryFn: fetchProjects,
    getNextPageParam: (lastPage, pages) => lastPage.nextCursor,
  })
</code>```

And as we cannot use hooks inside callbacks, we cannot map the queries and make multiple calls with the hook.

Any suggestions?

Thanks!

Body:
I need to be able to call multiple endpoints and automatically keep fetching more data using cursors returned from the BE. Multiple queries handling can be done with useQueries, but as soon as data is loaded I need to be able to fetch more chunks using cursors, therefore pointing me to useInfinityQuery. But the thing is that it seems that this hook cannot handle multiple queries.

 const {
    status,
    data,
    isFetching,
    isFetchingNextPage,
    fetchNextPage,
    hasNextPage,
  } = useInfiniteQuery({
    // here there is only the option to use one query
    queryKey: ['projects'],
    queryFn: fetchProjects,
    getNextPageParam: (lastPage, pages) => lastPage.nextCursor,
  })

And as we cannot use hooks inside callbacks, we cannot map the queries and make multiple calls with the hook.

Any suggestions?

Thanks!


问:
How to create multipart form data request for image and json data using URLSession- Swift
I need to send an image and json data to the server by using multipart/form-data request by using URLSession. Please refer the below screenshot for request.

I can successfully able to upload the image and json data by using postman. But i am struggling to upload the image and json data by using URLSession

Please refer to the below code

```<code>    let session = URLSession.shared
    let boundary = UUID().uuidString

    var urlRequest = URLRequest(url: URL(string: "https://dev.example.com/api/msg/sendmsg")!)
    urlRequest.httpMethod = "POST"
    urlRequest.setValue(authToken, forHTTPHeaderField: Key.RequestParam.authToken)

    urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")

    var data = Data()

    data.append("\r\n--\(boundary)\r\n".data(using: .utf8)!)

    let imageName = "file"
    data.append("Content-Disposition: form-data; name=\"\(imageName)\"; filename=\"\(imageName)\" \r\n".data(using: .utf8)!)
    data.append("Content-Type: image/jpeg \r\n".data(using: .utf8)!)
    data.append(imageData)

    data.append("\r\n--\(boundary)\r\n".data(using: .utf8)!)

    data.append("Content-Disposition: form-data; name=msgRequest \r\n".data(using: .utf8)!)
    data.append("Content-Type: application/json \r\n".data(using: .utf8)!)
    data.append(msgRequest)

    data.append("\r\n--\(boundary)--\r\n".data(using: .utf8)!)

    urlRequest.httpBody = data

    session.dataTask(with: urlRequest) { responseData, response, error in
        if(error != nil){
            print("\(error!.localizedDescription)")
        }

        guard let responseData = responseData else {
            print("no response data")
            return
        }
        if let responseString = String(data: responseData, encoding: .utf8) {
            print("uploaded to: \(responseString)")
        }
    }.resume()
</code>```

Request headers

```<code>["Authorization": "Bearer edasdasddaUzI1NiJ9.eyJqdaaddjY0OCIsImRldmljZUlkIjoiNEI4OTEzREYtQTQyQSEJBmlkcuwWF0IjoxNjcyNzM5NzY1LCasdadadasjk1NjV9.eaddLFCRK0mMICuFhhujhdoaise3M-RiydXoiuhowbfs", "Content-Length": "11314616", "Content-Type": "multipart/form-data; boundary=08D6DB1A-C888-40E5-8BD6-FE218E892A06"]
</code>```

Below is the urlRequest data

```<code>--08D6DB1A-C888-40E5-8BD6-FE218E892A06

Content-Disposition: form-data; name="file"; filename="file1"

Content-Type: "image/jpeg"

ImageData

--08D6DB1A-C888-40E5-8BD6-FE218E892A06

Content-Disposition: form-data; name="msgRequest"

Content-Type: "application/json"

{"msgBody":"Hi there”,”clientId”:”29385422222”}

--08D6DB1A-C888-40E5-8BD6-FE218E892A06--
</code>```

I am getting the response Status Code: 400

Please help me out with this problem. Thanks!

Body:
I need to send an image and json data to the server by using multipart/form-data request by using URLSession. Please refer the below screenshot for request.

I can successfully able to upload the image and json data by using postman. But i am struggling to upload the image and json data by using URLSession

Please refer to the below code

    let session = URLSession.shared
    let boundary = UUID().uuidString

    var urlRequest = URLRequest(url: URL(string: "https://dev.example.com/api/msg/sendmsg")!)
    urlRequest.httpMethod = "POST"
    urlRequest.setValue(authToken, forHTTPHeaderField: Key.RequestParam.authToken)

    urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")

    var data = Data()

    data.append("\r\n--\(boundary)\r\n".data(using: .utf8)!)

    let imageName = "file"
    data.append("Content-Disposition: form-data; name=\"\(imageName)\"; filename=\"\(imageName)\" \r\n".data(using: .utf8)!)
    data.append("Content-Type: image/jpeg \r\n".data(using: .utf8)!)
    data.append(imageData)

    data.append("\r\n--\(boundary)\r\n".data(using: .utf8)!)

    data.append("Content-Disposition: form-data; name=msgRequest \r\n".data(using: .utf8)!)
    data.append("Content-Type: application/json \r\n".data(using: .utf8)!)
    data.append(msgRequest)

    data.append("\r\n--\(boundary)--\r\n".data(using: .utf8)!)

    urlRequest.httpBody = data

    session.dataTask(with: urlRequest) { responseData, response, error in
        if(error != nil){
            print("\(error!.localizedDescription)")
        }

        guard let responseData = responseData else {
            print("no response data")
            return
        }
        if let responseString = String(data: responseData, encoding: .utf8) {
            print("uploaded to: \(responseString)")
        }
    }.resume()

Request headers

["Authorization": "Bearer edasdasddaUzI1NiJ9.eyJqdaaddjY0OCIsImRldmljZUlkIjoiNEI4OTEzREYtQTQyQSEJBmlkcuwWF0IjoxNjcyNzM5NzY1LCasdadadasjk1NjV9.eaddLFCRK0mMICuFhhujhdoaise3M-RiydXoiuhowbfs", "Content-Length": "11314616", "Content-Type": "multipart/form-data; boundary=08D6DB1A-C888-40E5-8BD6-FE218E892A06"]

Below is the urlRequest data

--08D6DB1A-C888-40E5-8BD6-FE218E892A06

Content-Disposition: form-data; name="file"; filename="file1"

Content-Type: "image/jpeg"

ImageData

--08D6DB1A-C888-40E5-8BD6-FE218E892A06

Content-Disposition: form-data; name="msgRequest"

Content-Type: "application/json"

{"msgBody":"Hi there”,”clientId”:”29385422222”}

--08D6DB1A-C888-40E5-8BD6-FE218E892A06--

I am getting the response Status Code: 400

Please help me out with this problem. Thanks!


问:
Have triple click select only a span?
I have a paragraph in my html and an-id-with-dashes. If I doubleclick it only the word is selected. If I triple click the entire paragraph is selected. How do I have triple click (or double click) select only the span? I tried using a div with inline-block but it failed to work unless it was display:block. I also noticed '.' tends to be highlighted. If there's a period after the span (or div) I'd like that to not be selected</p>

Title: Have triple click select only a span?


问:
Setting fs.mqueue.msg_max with docker flag --sysctl does not allow more than 9 message queues
I have an application which uses POSIX messages queues and create more than 9 message queues (10 is the default value for ulimit -q) and my size is 2048. This application is running under Redhat 8 has a host and Debian 8 for the container, as the docker docs says Configure namespaced kernel parameters (sysctls) at runtime (--sysctl)

The --sysctl sets namespaced kernel parameters (sysctls) in the container. For example, to turn on IP forwarding in the containers network namespace, run this command:

docker run --sysctl net.ipv4.ip_forward=1 someimage

Currently supported sysctls
IPC Namespace:

kernel.msgmax, kernel.msgmnb, kernel.msgmni, kernel.sem, kernel.shmall, kernel.shmmax,
kernel.shmmni, kernel.shm_rmid_forced.

Sysctls beginning with fs.mqueue.*

If you use the --ipc=host option these sysctls are not allowed.

I have tried to launch my app as follows with a private IPC namespace and the --sysctl option of docker run:

docker run --sysctl fs.mqueue.msg_max=2048 --ipc=private myimageapp
```
<p>When I do <code>ipcs -q</code> in my container it displays 9 created queues from my app which create 20  messages queue normally.</p>
<p>But instead of using <code>--sysctl fs.mqueue.msg_max=2048 --ipc=private</code> docker options I have set in my <code>/etc/sysctl.d/99-systcl.conf</code> <code>fs.mqueue.msg_max=2048</code> and restarted my computer.</p>
<p>After reboot I have tried to launch my docker image with the <code>--ipc=host</code> option like that:</p>
```docker run --ipc=host myimageapp
```

And now in the host the ipcs -q command shows me 20 messages queues.

What can differ from a "docker private IPC namespace" and set the --sysctl fs.mqueue.msg_max=2048 option to set the fs.mqueue.msg_max=2048 directly in the host and share the host IPC namespace?

Body:
I have an application which uses POSIX messages queues and create more than 9 message queues (10 is the default value for ulimit -q) and my size is 2048. This application is running under Redhat 8 has a host and Debian 8 for the container, as the docker docs says Configure namespaced kernel parameters (sysctls) at runtime (--sysctl)

The --sysctl sets namespaced kernel parameters (sysctls) in the container. For example, to turn on IP forwarding in the containers network namespace, run this command:

docker run --sysctl net.ipv4.ip_forward=1 someimage

Currently supported sysctls
IPC Namespace:

kernel.msgmax, kernel.msgmnb, kernel.msgmni, kernel.sem, kernel.shmall, kernel.shmmax,
kernel.shmmni, kernel.shm_rmid_forced.

Sysctls beginning with fs.mqueue.*

If you use the --ipc=host option these sysctls are not allowed.

I have tried to launch my app as follows with a private IPC namespace and the --sysctl option of docker run:

docker run --sysctl fs.mqueue.msg_max=2048 --ipc=private myimageapp

When I do ipcs -q in my container it displays 9 created queues from my app which create 20  messages queue normally.

But instead of using --sysctl fs.mqueue.msg_max=2048 --ipc=private docker options I have set in my /etc/sysctl.d/99-systcl.conf fs.mqueue.msg_max=2048 and restarted my computer.

After reboot I have tried to launch my docker image with the --ipc=host option like that:

docker run --ipc=host myimageapp

And now in the host the ipcs -q command shows me 20 messages queues.

What can differ from a "docker private IPC namespace" and set the --sysctl fs.mqueue.msg_max=2048 option to set the fs.mqueue.msg_max=2048 directly in the host and share the host IPC namespace?


问:
Chrome extension to modify input and paste into discord
I'm trying to build a chrome extension that modifies an input text and copies the output to a discord channel and hits enter to submit. We can assume the user has discord and channel open.

content.js

```<code>chrome.runtime.onMessage.addListener(
  function ({ text }) {
    consoleLog(`Received input text: ${text}`);
    if (text) {
      const modified = modify(text);
      runInDiscord(modified)
    }
  }
);

function modified(text) {
  let modified = '';
  // Modify text
  return modified;
}

function runInDiscord(text) {
  const txtMessage = document.querySelector('[aria-label="Message @Company Bot"]');
  if (!txtMessage) {
    alert('Ensure you have the Company Bot Channel opened up');
    return;
  }

  txtMessage.focus();

  const txtMessageInner = txtMessage.querySelector('div > span > span > span');
  txtMessageInner.textContent = text;

  const event = new Event('input', { bubbles: true });
  txtMessageInner.dispatchEvent(event);

  const event = new KeyboardEvent('keydown', { keyCode: 13, which: 13 });
  document.dispatchEvent(event);

}
</code>```

I've tried a bunch of different ways:

Send keydown, keyup and keypress events in txtMessage

Send keydown, keyup and keypress events in txtMessageInner

Focus on txtMessageInner instead of txtMessage

Send keydown, keyup and keypress in documents after focus

None of these methods correctly apply the text to discord's message state.

PS: I know about discord's API. I want to keep this frontend only.

Any idea how I can send message in discord using a chrome extension?

Body:
I'm trying to build a chrome extension that modifies an input text and copies the output to a discord channel and hits enter to submit. We can assume the user has discord and channel open.

content.js

chrome.runtime.onMessage.addListener(
  function ({ text }) {
    consoleLog(`Received input text: ${text}`);
    if (text) {
      const modified = modify(text);
      runInDiscord(modified)
    }
  }
);

function modified(text) {
  let modified = '';
  // Modify text
  return modified;
}

function runInDiscord(text) {
  const txtMessage = document.querySelector('[aria-label="Message @Company Bot"]');
  if (!txtMessage) {
    alert('Ensure you have the Company Bot Channel opened up');
    return;
  }

  txtMessage.focus();

  const txtMessageInner = txtMessage.querySelector('div > span > span > span');
  txtMessageInner.textContent = text;

  const event = new Event('input', { bubbles: true });
  txtMessageInner.dispatchEvent(event);

  const event = new KeyboardEvent('keydown', { keyCode: 13, which: 13 });
  document.dispatchEvent(event);

}

I've tried a bunch of different ways:

Send keydown, keyup and keypress events in txtMessage

Send keydown, keyup and keypress events in txtMessageInner

Focus on txtMessageInner instead of txtMessage

Send keydown, keyup and keypress in documents after focus

None of these methods correctly apply the text to discord's message state.

PS: I know about discord's API. I want to keep this frontend only.

Any idea how I can send message in discord using a chrome extension?


问:
Create minicharts inside a dataframe
I would like to recreate an excel table that has minicharts inside the cells in a python dataframe.
What I want to create looks like this:

does someone has any idea of how to do it?

I havent tried much yet because dont know where to start

Title: Create minicharts inside a dataframe


问:
MERN deploy script bundles on render
All my code compiles into dist folder. Client by CopyWebpackPlugin, server by tsc. and it looks like this. HTML sends app.get("*", (req, res) => { res.sendFile(path.join(__dirname, "client", "public", "index.html")); }); For static files i tried app.use("/static", express.static(path.join(__dirname, "client"))); app.use(express.static(path.join(__dirname, "client", "public"))); etc. Add all variants of scripts connection

```<code><!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <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=Roboto&display=swap" rel="stylesheet" />
        <title>Document</title>
    </head>
    <body>
        <div id="root"></div>
        <script src="/bundle.js"></script>
        <script src="/client/public/bundle.js"></script>
        <script src="/static/bundle.js"></script>
        <script src="/static/public/bundle.js"></script>
    </body>
</html>

</code>```

And all my bundle.js files looks like this deployed app. How i suppose to add script bundles? Repo https://github.com/Dimkosyanklg/Cards-Test

Can't figure it out

Title: MERN deploy script bundles on render

Body:
All my code compiles into dist folder. Client by CopyWebpackPlugin, server by tsc. and it looks like this. HTML sends app.get("*", (req, res) => { res.sendFile(path.join(__dirname, "client", "public", "index.html")); }); For static files i tried app.use("/static", express.static(path.join(__dirname, "client"))); app.use(express.static(path.join(__dirname, "client", "public"))); etc. Add all variants of scripts connection

<!DOCTYPE html>

        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <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=Roboto&display=swap" rel="stylesheet" />
        <title>Document</title>

And all my bundle.js files looks like this deployed app. How i suppose to add script bundles? Repo https://github.com/Dimkosyanklg/Cards-Test

Can't figure it out


问:
Building my Next JS application is failing when building static pages using Strapi data (prerender-error)
I am building a website for my podcast network and while everything is working as expected in development, when I build the application for production, the build fails when building static pages, seemingly from gathering data from my Strapi backend. The pages are individual [slug].js pages for each cast member and for each show (though it appears to be failing only for the show pages).

Here is the code for the [slug].js:

```<code>import React from "react"
import Image from "next/image"
import Grid from "@mui/material/Grid"
import Typography from "@mui/material/Typography"
import Chip from "@mui/material/Chip"

import GMCard from "../../src/components/GMCard"
import PlayerCard from "../../src/components/PlayerCard"

import { fetchAPI } from "../../lib/api"
import { getStrapiMedia } from "../../lib/media"

const Game = ({ game, characters, people }) => {
  let players = []
  let pcs = []

  const gameMaster = people.filter(
    (person) => person.id === game.attributes.gameMaster.data.id
  )

  game.attributes.players.data.forEach((player) => {
    const filtered = people.filter((person) => player.id === person.id)
    players.push(filtered.pop())
  })

  game.attributes.characters.data.forEach((pc) => {
    const filtered = characters.filter((char) => pc.id === char.id)
    pcs.push(filtered.pop())
  })

  return (
    <Grid container direction="column">
      <Grid item>
        <Grid container direction="column" alignItems="center">
          <Grid item sx={{ marginBottom: "3rem" }}>
            <Typography variant="h1">Our Games and Shows</Typography>
          </Grid>
          <Grid item sx={{ marginBottom: "3rem" }}>
            <Typography variant="h2">{game.attributes.name}</Typography>
          </Grid>
          <Grid container justifyContent="center">
            <Grid item sx={{ marginBottom: "3rem", marginLeft: "3rem" }}>
              <Image
                src={getStrapiMedia(game.attributes.image)}
                alt={`${game.attributes.name} logo`}
                style={{ height: "25rem" }}
              ></Image>
            </Grid>
            <Grid item sx={{ marginBottom: "3rem", marginLeft: "3rem" }}>
              <Grid container direction="column" sx={{ width: "50rem" }}>
                <Grid item>
                  <Typography variant="h2">{game.attributes.system}</Typography>
                </Grid>
                <Grid item>
                  {game.attributes.season1 ? (
                    <Chip
                      label={"Season 1"}
                      sx={{
                        padding: 0,
                        marginRight: "0.5rem",
                        marginBottom: "0.5rem",
                        color: "#ffffff",
                        backgroundColor: "green",
                      }}
                    />
                  ) : null}
                  {game.attributes.season2 ? (
                    <Chip
                      label={"Season 2"}
                      sx={{
                        padding: 0,
                        marginRight: "0.5rem",
                        marginBottom: "0.5rem",
                        color: "#000000",
                        backgroundColor: "#ffff00",
                      }}
                    />
                  ) : null}
                </Grid>
                <Grid item>
                  <Typography variant="body1">
                    {game.attributes.description}
                  </Typography>
                </Grid>
              </Grid>
            </Grid>
          </Grid>
          <Grid container direction="column" alignItems="center">
            <Grid item sx={{ marginBottom: "3rem" }}>
              <Typography variant="h2">Game Master</Typography>
            </Grid>
            <Grid item sx={{ marginBottom: "3rem" }}>
              <Grid container direction="column">
                <Grid item>
                  <GMCard person={gameMaster[0]} />
                </Grid>
              </Grid>
            </Grid>
          </Grid>
          <Grid container direction="column" alignItems="center">
            <Grid item sx={{ marginBottom: "3rem" }}>
              <Typography variant="h2">Players</Typography>
            </Grid>
            <Grid container justifyContent="center">
              {players.map((player) => {
                const pc = pcs.filter(
                  (char) => char.attributes.player.data.id === player.id
                )
                return (
                  <Grid item key={`char_${player.id}`}>
                    <PlayerCard person={player} character={pc[0]} />
                  </Grid>
                )
              })}
            </Grid>
          </Grid>
        </Grid>
      </Grid>
    </Grid>
  )
}

export async function getStaticPaths() {
  const gamesres = await fetchAPI("/games", { fields: ["slug"] })

  return {
    paths: gamesres.data.map((game) => ({
      params: {
        slug: game.attributes.slug,
      },
    })),
    fallback: false,
  }
}

export async function getStaticProps({ params }) {
  const [peopleRes] = await Promise.all([
    fetchAPI("/people", { populate: "*" }),
  ])
  const [charactersRes] = await Promise.all([
    fetchAPI("/characters", { populate: "*" }),
  ])
  const gamesRes = await fetchAPI("/games", {
    filters: {
      slug: params.slug,
    },
    populate: "*",
  })

  return {
    props: {
      game: gamesRes.data[0],
      characters: charactersRes.data,
      people: peopleRes.data,
    },
    revalidate: 1,
  }
}

export default Game
</code>```

GMCard.js:

```<code>import React from "react"
import Grid from "@mui/material/Grid"
import Typography from "@mui/material/Typography"
import Card from "@mui/material/Card"
import CardActions from "@mui/material/CardActions"
import CardContent from "@mui/material/CardContent"
import CardMedia from "@mui/material/CardMedia"
import Button from "@mui/material/Button"

import { getStrapiMedia } from "../../lib/media"

import ArrowForwardIcon from "@mui/icons-material/ArrowForward"

const GMCard = ({ person }) => {
  return (
    <Grid item sx={{ margin: "1rem" }}>
      <Card
        sx={{
          width: 400,
          minHeight: 400,
          display: "flex",
          flexDirection: "column",
        }}
      >
        <CardMedia
          sx={{ height: 400 }}
          image={getStrapiMedia(person.attributes.headshot)}
          title={`${person.attributes.lastName} headshot`}
        />
        <CardContent>
          <Typography variant="h3" component="div">
            {`${person.attributes.firstName} ${person.attributes.lastName}`}
          </Typography>
          <Grid item>
            <Typography variant="h4" component="div">
              {`Game Master`}
            </Typography>
          </Grid>
        </CardContent>
        <CardActions sx={{ justifyContent: "flex-end", marginTop: "auto" }}>
          <Button
            href={`/about/${person.attributes.slug}`}
            endIcon={<ArrowForwardIcon />}
          >
            Bio
          </Button>
        </CardActions>
      </Card>
    </Grid>
  )
}

export default GMCard
</code>```

PlayerCard.js:

```<code>import React, { useState } from "react"
import Image from "next/image"
import Grid from "@mui/material/Grid"
import Typography from "@mui/material/Typography"
import Card from "@mui/material/Card"
import CardActions from "@mui/material/CardActions"
import CardContent from "@mui/material/CardContent"
import CardMedia from "@mui/material/CardMedia"
import Button from "@mui/material/Button"
import Modal from "@mui/material/Modal"

import { getStrapiMedia } from "../../lib/media"

import ArrowForwardIcon from "@mui/icons-material/ArrowForward"

const PlayerCard = ({ person, character }) => {
  const [open, setOpen] = useState(false)
  const handleOpen = () => setOpen(true)
  const handleClose = () => setOpen(false)

  return (
    <Grid item sx={{ margin: "1rem" }}>
      <Card
        sx={{
          width: 400,
          minHeight: 400,
          display: "flex",
          flexDirection: "column",
        }}
      >
        <CardMedia
          sx={{ height: 400 }}
          image={getStrapiMedia(person.attributes.headshot)}
          title={`${person.attributes.lastName} headshot`}
        />
        <CardContent>
          <Typography variant="h3" component="div">
            {`${person.attributes.firstName} ${person.attributes.lastName} as`}
          </Typography>
          <Grid item>
            <Typography variant="h3" component="div">
              {`${character.attributes.name}`}
            </Typography>
          </Grid>
        </CardContent>
        <CardActions sx={{ justifyContent: "flex-end", marginTop: "auto" }}>
          <Grid container direction="column" alignItems="flex-end">
            <Button
              href={`/about/${person.attributes.slug}`}
              endIcon={<ArrowForwardIcon />}
            >
              Bio
            </Button>
            <Button onClick={handleOpen} endIcon={<ArrowForwardIcon />}>
              Character Info
            </Button>
          </Grid>
        </CardActions>
      </Card>
      <Modal open={open} onClose={handleClose}>
        <Grid container direction="column">
          <Grid
            item
            sx={{
              position: "absolute",
              top: "50%",
              left: "50%",
              transform: "translate(-50%, -50%)",
              width: 600,
              bgcolor: "background.paper",
              border: "2px solid #000",
              boxShadow: 24,
              p: 4,
            }}
          >
            <Grid container>
              <Grid item>
                <Image
                  src={getStrapiMedia(character.attributes.image)}
                  alt={`${character.attributes.name} art`}
                  style={{ height: 225, width: 225 }}
                />
              </Grid>
              <Grid item>
                <Grid
                  container
                  direction="column"
                  justifyContent="space-between"
                  sx={{ height: 225, marginLeft: "0.5rem" }}
                >
                  <Grid item>
                    <Grid container direction="column">
                      <Grid item>
                        <Typography variant="h3" component="div">
                          {`${character.attributes.name}`}
                        </Typography>
                      </Grid>
                      <Grid item>
                        <Typography variant="h4" component="div">
                          {`${character.attributes.role}`}
                        </Typography>
                      </Grid>
                      <Grid item>
                        <Button
                          href={`/team/${character.attributes.player.data.attributes.slug}`}
                          sx={{
                            textTransform: "none",
                            padding: 0,
                            color: "#000",
                          }}
                        >
                          {`Played by ${character.attributes.player.data.attributes.firstName} ${character.attributes.player.data.attributes.lastName}`}
                        </Button>
                      </Grid>
                    </Grid>
                  </Grid>
                  <Grid item>
                    <Grid container direction="column">
                      <Grid item>
                        <Typography
                          variant="h3"
                          component="div"
                          sx={{
                            color: "#000",
                          }}
                        >
                          {`${character.attributes.game.data.attributes.name}`}
                        </Typography>
                      </Grid>
                      <Grid item>
                        <Button
                          endIcon={<ArrowForwardIcon />}
                          sx={{ textTransform: "none", padding: 0 }}
                        >
                          {`About ${character.attributes.game.data.attributes.name}`}
                        </Button>
                      </Grid>
                    </Grid>
                  </Grid>
                </Grid>
              </Grid>
            </Grid>
            <Grid item>
              <Typography variant="body1">
                {character.attributes.bio}
              </Typography>
            </Grid>
          </Grid>
        </Grid>
      </Modal>
    </Grid>
  )
}

export default PlayerCard
</code>```

And here's the errors:

```<code>$ npm run build

> frontend@0.1.0 build
> next build

info  - Loaded env from C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\.env
info  - Linting and checking validity of types
info  - Creating an optimized production build
info  - Compiled successfully
Warning: You have opted-out of Automatic Static Optimization due to `getInitialProps` in `pages/_app`. This does not opt-out pages with `getStaticProps`
Read more: https://nextjs.org/docs/messages/opt-out-auto-static-optimization

info  - Collecting page data
[==  ] info  - Generating static pages (0/45)
Error occurred prerendering page "/games/call-of-the-deep". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of undefined (reading 'id')
    at C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\.next\server\pages\games\[slug].js:212:109
    at Array.filter (<anonymous>)
    at C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\.next\server\pages\games\[slug].js:212:52
    at Array.map (<anonymous>)
    at Game (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\.next\server\pages\games\[slug].js:211:51)
    at Wc (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:44)
    at Zc (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:253)
    at Z (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
    at $c (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)
    at bd (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:77:404)

Error occurred prerendering page "/games/the-academy". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of undefined (reading 'attributes')
    at C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\.next\server\pages\games\[slug].js:212:72
    at Array.filter (<anonymous>)
    at C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\.next\server\pages\games\[slug].js:212:52
    at Array.map (<anonymous>)
    at Game (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\.next\server\pages\games\[slug].js:211:51)
    at Wc (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:44)
    at Zc (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:253)
    at Z (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
    at $c (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)
    at bd (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:77:404)

// ...repeating errors for each page

info  - Generating static pages (45/45)

> Build error occurred
Error: Export encountered errors on following paths:
        /games/[slug]: /games/a-walk-among-gods
        /games/[slug]: /games/brave-new-wild
        /games/[slug]: /games/call-of-the-deep
        /games/[slug]: /games/duskvale
        /games/[slug]: /games/friday-night-fights
        /games/[slug]: /games/furusato
        /games/[slug]: /games/heckna
        /games/[slug]: /games/neon-memories
        /games/[slug]: /games/nights-of-payne-town
        /games/[slug]: /games/red-harvest
        /games/[slug]: /games/tavern-tales
        /games/[slug]: /games/the-academy
        /games/[slug]: /games/the-crystal-city
        /games/[slug]: /games/the-hunt-for-glory
    at C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\next\dist\export\index.js:409:19
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Span.traceAsyncFn (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\next\dist\trace\trace.js:79:20)
    at async C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\next\dist\build\index.js:1345:21
    at async Span.traceAsyncFn (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\next\dist\trace\trace.js:79:20)
    at async C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\next\dist\build\index.js:1205:17
    at async Span.traceAsyncFn (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\next\dist\trace\trace.js:79:20)
    at async Object.build [as default] (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\next\dist\build\index.js:66:29)
</code>```

Let me know if there is any more info you need, but I could use all the help I can get. I'm out of ideas.

Body:
I am building a website for my podcast network and while everything is working as expected in development, when I build the application for production, the build fails when building static pages, seemingly from gathering data from my Strapi backend. The pages are individual [slug].js pages for each cast member and for each show (though it appears to be failing only for the show pages).

Here is the code for the [slug].js:

import React from "react"
import Image from "next/image"
import Grid from "@mui/material/Grid"
import Typography from "@mui/material/Typography"
import Chip from "@mui/material/Chip"

import GMCard from "../../src/components/GMCard"
import PlayerCard from "../../src/components/PlayerCard"

import { fetchAPI } from "../../lib/api"
import { getStrapiMedia } from "../../lib/media"

const Game = ({ game, characters, people }) => {
  let players = []
  let pcs = []

  const gameMaster = people.filter(
    (person) => person.id === game.attributes.gameMaster.data.id
  )

  game.attributes.players.data.forEach((player) => {
    const filtered = people.filter((person) => player.id === person.id)
    players.push(filtered.pop())
  })

  game.attributes.characters.data.forEach((pc) => {
    const filtered = characters.filter((char) => pc.id === char.id)
    pcs.push(filtered.pop())
  })

  return (
    <Grid container direction="column">
      <Grid item>
        <Grid container direction="column" alignItems="center">
          <Grid item sx={{ marginBottom: "3rem" }}>
            <Typography variant="h1">Our Games and Shows</Typography>
          </Grid>
          <Grid item sx={{ marginBottom: "3rem" }}>
            <Typography variant="h2">{game.attributes.name}</Typography>
          </Grid>
          <Grid container justifyContent="center">
            <Grid item sx={{ marginBottom: "3rem", marginLeft: "3rem" }}>
              <Image
                src={getStrapiMedia(game.attributes.image)}
                alt={`${game.attributes.name} logo`}
                style={{ height: "25rem" }}
              ></Image>
            </Grid>
            <Grid item sx={{ marginBottom: "3rem", marginLeft: "3rem" }}>
              <Grid container direction="column" sx={{ width: "50rem" }}>
                <Grid item>
                  <Typography variant="h2">{game.attributes.system}</Typography>
                </Grid>
                <Grid item>
                  {game.attributes.season1 ? (
                    <Chip
                      label={"Season 1"}
                      sx={{
                        padding: 0,
                        marginRight: "0.5rem",
                        marginBottom: "0.5rem",
                        color: "#ffffff",
                        backgroundColor: "green",
                      }}
                    />
                  ) : null}
                  {game.attributes.season2 ? (
                    <Chip
                      label={"Season 2"}
                      sx={{
                        padding: 0,
                        marginRight: "0.5rem",
                        marginBottom: "0.5rem",
                        color: "#000000",
                        backgroundColor: "#ffff00",
                      }}
                    />
                  ) : null}
                </Grid>
                <Grid item>
                  <Typography variant="body1">
                    {game.attributes.description}
                  </Typography>
                </Grid>
              </Grid>
            </Grid>
          </Grid>
          <Grid container direction="column" alignItems="center">
            <Grid item sx={{ marginBottom: "3rem" }}>
              <Typography variant="h2">Game Master</Typography>
            </Grid>
            <Grid item sx={{ marginBottom: "3rem" }}>
              <Grid container direction="column">
                <Grid item>
                  <GMCard person={gameMaster[0]} />
                </Grid>
              </Grid>
            </Grid>
          </Grid>
          <Grid container direction="column" alignItems="center">
            <Grid item sx={{ marginBottom: "3rem" }}>
              <Typography variant="h2">Players</Typography>
            </Grid>
            <Grid container justifyContent="center">
              {players.map((player) => {
                const pc = pcs.filter(
                  (char) => char.attributes.player.data.id === player.id
                )
                return (
                  <Grid item key={`char_${player.id}`}>
                    <PlayerCard person={player} character={pc[0]} />
                  </Grid>
                )
              })}
            </Grid>
          </Grid>
        </Grid>
      </Grid>
    </Grid>
  )
}

export async function getStaticPaths() {
  const gamesres = await fetchAPI("/games", { fields: ["slug"] })

  return {
    paths: gamesres.data.map((game) => ({
      params: {
        slug: game.attributes.slug,
      },
    })),
    fallback: false,
  }
}

export async function getStaticProps({ params }) {
  const [peopleRes] = await Promise.all([
    fetchAPI("/people", { populate: "*" }),
  ])
  const [charactersRes] = await Promise.all([
    fetchAPI("/characters", { populate: "*" }),
  ])
  const gamesRes = await fetchAPI("/games", {
    filters: {
      slug: params.slug,
    },
    populate: "*",
  })

  return {
    props: {
      game: gamesRes.data[0],
      characters: charactersRes.data,
      people: peopleRes.data,
    },
    revalidate: 1,
  }
}

export default Game

GMCard.js:

import React from "react"
import Grid from "@mui/material/Grid"
import Typography from "@mui/material/Typography"
import Card from "@mui/material/Card"
import CardActions from "@mui/material/CardActions"
import CardContent from "@mui/material/CardContent"
import CardMedia from "@mui/material/CardMedia"
import Button from "@mui/material/Button"

import { getStrapiMedia } from "../../lib/media"

import ArrowForwardIcon from "@mui/icons-material/ArrowForward"

const GMCard = ({ person }) => {
  return (
    <Grid item sx={{ margin: "1rem" }}>
      <Card
        sx={{
          width: 400,
          minHeight: 400,
          display: "flex",
          flexDirection: "column",
        }}
      >
        <CardMedia
          sx={{ height: 400 }}
          image={getStrapiMedia(person.attributes.headshot)}
          title={`${person.attributes.lastName} headshot`}
        />
        <CardContent>
          <Typography variant="h3" component="div">
            {`${person.attributes.firstName} ${person.attributes.lastName}`}
          </Typography>
          <Grid item>
            <Typography variant="h4" component="div">
              {`Game Master`}
            </Typography>
          </Grid>
        </CardContent>
        <CardActions sx={{ justifyContent: "flex-end", marginTop: "auto" }}>
          <Button
            href={`/about/${person.attributes.slug}`}
            endIcon={<ArrowForwardIcon />}
          >
            Bio
          </Button>
        </CardActions>
      </Card>
    </Grid>
  )
}

export default GMCard

PlayerCard.js:

import React, { useState } from "react"
import Image from "next/image"
import Grid from "@mui/material/Grid"
import Typography from "@mui/material/Typography"
import Card from "@mui/material/Card"
import CardActions from "@mui/material/CardActions"
import CardContent from "@mui/material/CardContent"
import CardMedia from "@mui/material/CardMedia"
import Button from "@mui/material/Button"
import Modal from "@mui/material/Modal"

import { getStrapiMedia } from "../../lib/media"

import ArrowForwardIcon from "@mui/icons-material/ArrowForward"

const PlayerCard = ({ person, character }) => {
  const [open, setOpen] = useState(false)
  const handleOpen = () => setOpen(true)
  const handleClose = () => setOpen(false)

  return (
    <Grid item sx={{ margin: "1rem" }}>
      <Card
        sx={{
          width: 400,
          minHeight: 400,
          display: "flex",
          flexDirection: "column",
        }}
      >
        <CardMedia
          sx={{ height: 400 }}
          image={getStrapiMedia(person.attributes.headshot)}
          title={`${person.attributes.lastName} headshot`}
        />
        <CardContent>
          <Typography variant="h3" component="div">
            {`${person.attributes.firstName} ${person.attributes.lastName} as`}
          </Typography>
          <Grid item>
            <Typography variant="h3" component="div">
              {`${character.attributes.name}`}
            </Typography>
          </Grid>
        </CardContent>
        <CardActions sx={{ justifyContent: "flex-end", marginTop: "auto" }}>
          <Grid container direction="column" alignItems="flex-end">
            <Button
              href={`/about/${person.attributes.slug}`}
              endIcon={<ArrowForwardIcon />}
            >
              Bio
            </Button>
            <Button onClick={handleOpen} endIcon={<ArrowForwardIcon />}>
              Character Info
            </Button>
          </Grid>
        </CardActions>
      </Card>
      <Modal open={open} onClose={handleClose}>
        <Grid container direction="column">
          <Grid
            item
            sx={{
              position: "absolute",
              top: "50%",
              left: "50%",
              transform: "translate(-50%, -50%)",
              width: 600,
              bgcolor: "background.paper",
              border: "2px solid #000",
              boxShadow: 24,
              p: 4,
            }}
          >
            <Grid container>
              <Grid item>
                <Image
                  src={getStrapiMedia(character.attributes.image)}
                  alt={`${character.attributes.name} art`}
                  style={{ height: 225, width: 225 }}
                />
              </Grid>
              <Grid item>
                <Grid
                  container
                  direction="column"
                  justifyContent="space-between"
                  sx={{ height: 225, marginLeft: "0.5rem" }}
                >
                  <Grid item>
                    <Grid container direction="column">
                      <Grid item>
                        <Typography variant="h3" component="div">
                          {`${character.attributes.name}`}
                        </Typography>
                      </Grid>
                      <Grid item>
                        <Typography variant="h4" component="div">
                          {`${character.attributes.role}`}
                        </Typography>
                      </Grid>
                      <Grid item>
                        <Button
                          href={`/team/${character.attributes.player.data.attributes.slug}`}
                          sx={{
                            textTransform: "none",
                            padding: 0,
                            color: "#000",
                          }}
                        >
                          {`Played by ${character.attributes.player.data.attributes.firstName} ${character.attributes.player.data.attributes.lastName}`}
                        </Button>
                      </Grid>
                    </Grid>
                  </Grid>
                  <Grid item>
                    <Grid container direction="column">
                      <Grid item>
                        <Typography
                          variant="h3"
                          component="div"
                          sx={{
                            color: "#000",
                          }}
                        >
                          {`${character.attributes.game.data.attributes.name}`}
                        </Typography>
                      </Grid>
                      <Grid item>
                        <Button
                          endIcon={<ArrowForwardIcon />}
                          sx={{ textTransform: "none", padding: 0 }}
                        >
                          {`About ${character.attributes.game.data.attributes.name}`}
                        </Button>
                      </Grid>
                    </Grid>
                  </Grid>
                </Grid>
              </Grid>
            </Grid>
            <Grid item>
              <Typography variant="body1">
                {character.attributes.bio}
              </Typography>
            </Grid>
          </Grid>
        </Grid>
      </Modal>
    </Grid>
  )
}

export default PlayerCard

And here's the errors:

$ npm run build

> frontend@0.1.0 build
> next build

info  - Loaded env from C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\.env
info  - Linting and checking validity of types
info  - Creating an optimized production build
info  - Compiled successfully
Warning: You have opted-out of Automatic Static Optimization due to `getInitialProps` in `pages/_app`. This does not opt-out pages with `getStaticProps`
Read more: https://nextjs.org/docs/messages/opt-out-auto-static-optimization

info  - Collecting page data
[==  ] info  - Generating static pages (0/45)
Error occurred prerendering page "/games/call-of-the-deep". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of undefined (reading 'id')
    at C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\.next\server\pages\games\[slug].js:212:109
    at Array.filter (<anonymous>)
    at C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\.next\server\pages\games\[slug].js:212:52
    at Array.map (<anonymous>)
    at Game (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\.next\server\pages\games\[slug].js:211:51)
    at Wc (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:44)
    at Zc (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:253)
    at Z (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
    at $c (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)
    at bd (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:77:404)

Error occurred prerendering page "/games/the-academy". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of undefined (reading 'attributes')
    at C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\.next\server\pages\games\[slug].js:212:72
    at Array.filter (<anonymous>)
    at C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\.next\server\pages\games\[slug].js:212:52
    at Array.map (<anonymous>)
    at Game (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\.next\server\pages\games\[slug].js:211:51)
    at Wc (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:44)
    at Zc (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:253)
    at Z (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
    at $c (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)
    at bd (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:77:404)

// ...repeating errors for each page

info  - Generating static pages (45/45)

> Build error occurred
Error: Export encountered errors on following paths:
        /games/[slug]: /games/a-walk-among-gods
        /games/[slug]: /games/brave-new-wild
        /games/[slug]: /games/call-of-the-deep
        /games/[slug]: /games/duskvale
        /games/[slug]: /games/friday-night-fights
        /games/[slug]: /games/furusato
        /games/[slug]: /games/heckna
        /games/[slug]: /games/neon-memories
        /games/[slug]: /games/nights-of-payne-town
        /games/[slug]: /games/red-harvest
        /games/[slug]: /games/tavern-tales
        /games/[slug]: /games/the-academy
        /games/[slug]: /games/the-crystal-city
        /games/[slug]: /games/the-hunt-for-glory
    at C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\next\dist\export\index.js:409:19
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Span.traceAsyncFn (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\next\dist\trace\trace.js:79:20)
    at async C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\next\dist\build\index.js:1345:21
    at async Span.traceAsyncFn (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\next\dist\trace\trace.js:79:20)
    at async C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\next\dist\build\index.js:1205:17
    at async Span.traceAsyncFn (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\next\dist\trace\trace.js:79:20)
    at async Object.build [as default] (C:\Users\gmrpr\Desktop\Code_Projects\VibeTribe\frontend\node_modules\next\dist\build\index.js:66:29)

Let me know if there is any more info you need, but I could use all the help I can get. I'm out of ideas.