问:
how do i do it accordion grid
In the images below, the small box is like a tab, when clicked it will show the content at the bottom of it.

When the window / viewed in a smaller screen it will reduce the columns accordingly, however it should preserve its functionality.

Tablet

Mobile

const about = document.querySelector(".wrapper");
const btns = document.querySelectorAll(".accordion");
const articles = document.querySelectorAll(".content");
about.addEventListener("click", function(e) {
  const id = e.target.dataset.id;
  if (id) {
    // remove selected from other buttons
    btns.forEach(function(btn) {
      btn.classList.remove("active");
    });
    e.target.classList.add("active");
    // hide other articles
    articles.forEach(function(article) {
      article.classList.remove("active");
    });
    const element = document.getElementById(id);
    element.classList.add("active");
  }
});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>* {
  margin: 0 auto;
  padding: 0;
  max-width: 1000px;
  box-sizing: border-box;
  background-color: gray;
}

.accordion {
  margin-top: 5px;
  background-color: #eee;
  color: #444;
  padding: 15px;
  width: 50%;
  transition: 0.4s;
}

.accordion.active {
  background-color: #ccc;
}

.post-container {
  content: "";
  display: table;
  clear: both;
}

.container {
  display: flex;
  flex-direction: row;
  gap: 6px;
}

.wrapper {
  display: flex;
  flex-direction: column;
}

.content {
  display: none;
}

.wrapper2 {
  width: 100%;
}

.content.active {
  display: block;
  padding: 20px;
}

.active,
.accordion:hover {
  background-color: #ccc;
}</code>```

      <button data-id="1" class="accordion">Section 1</button>
      <button data-id="2" class="accordion">Section 2</button>
      <button data-id="3" class="accordion">Section 3</button>

Lorem ipsum dolor sit amet consectetur adipisicing elit. Iure ipsa optio eaque placeat aut deleniti facere nisi repudiandae sequi distinctio? Error dignissimos excepturi perferendis pariatur ad a ratione dolore atque.

Lorem, ipsum dolor sit amet consectetur adipisicing elit. Assumenda nesciunt autem dignissimos commodi ut velit iure sequi eveniet repudiandae. Nisi impedit ad, libero voluptates autem minima corporis mollitia illo eum.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloribus, numquam culpa. Impedit voluptates ad ea distinctio a doloremque ex officiis ducimus, nobis nihil qui repudiandae, dolore, pariatur ratione error nemo.

      <button data-id="4" class="accordion">Section 4</button>
      <button data-id="5" class="accordion">Section 5</button>
      <button data-id="6" class="accordion">Section 6</button>

Lorem, ipsum dolor sit amet consectetur adipisicing elit. Dolor ducimus cupiditate fuga ratione tempore eveniet possimus maiores quod sequi natus? Iusto dolor hic facilis culpa ad illo vel deserunt minima?

Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur nihil obcaecati a cumque quos adipisci aliquam illum perspiciatis fugit, tempora aperiam officiis dignissimos odit incidunt modi tempore corporis. Porro, a.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum, quis est. Animi fuga ipsum porro ullam blanditiis illum inventore magnam, earum nesciunt ab quis placeat iste quo! Repudiandae, ratione sapiente!

```

Title: how do i do it accordion grid

Body:
In the images below, the small box is like a tab, when clicked it will show the content at the bottom of it.

When the window / viewed in a smaller screen it will reduce the columns accordingly, however it should preserve its functionality.

Tablet

Mobile

const about = document.querySelector(".wrapper");
const btns = document.querySelectorAll(".accordion");
const articles = document.querySelectorAll(".content");
about.addEventListener("click", function(e) {
  const id = e.target.dataset.id;
  if (id) {
    // remove selected from other buttons
    btns.forEach(function(btn) {
      btn.classList.remove("active");
    });
    e.target.classList.add("active");
    // hide other articles
    articles.forEach(function(article) {
      article.classList.remove("active");
    });
    const element = document.getElementById(id);
    element.classList.add("active");
  }
});

* {
  margin: 0 auto;
  padding: 0;
  max-width: 1000px;
  box-sizing: border-box;
  background-color: gray;
}

.accordion {
  margin-top: 5px;
  background-color: #eee;
  color: #444;
  padding: 15px;
  width: 50%;
  transition: 0.4s;
}

.accordion.active {
  background-color: #ccc;
}

.post-container {
  content: "";
  display: table;
  clear: both;
}

.container {
  display: flex;
  flex-direction: row;
  gap: 6px;
}

.wrapper {
  display: flex;
  flex-direction: column;
}

.content {
  display: none;
}

.wrapper2 {
  width: 100%;
}

.content.active {
  display: block;
  padding: 20px;
}

.active,
.accordion:hover {
  background-color: #ccc;
}

      <button data-id="1" class="accordion">Section 1</button>
      <button data-id="2" class="accordion">Section 2</button>
      <button data-id="3" class="accordion">Section 3</button>

Lorem ipsum dolor sit amet consectetur adipisicing elit. Iure ipsa optio eaque placeat aut deleniti facere nisi repudiandae sequi distinctio? Error dignissimos excepturi perferendis pariatur ad a ratione dolore atque.

Lorem, ipsum dolor sit amet consectetur adipisicing elit. Assumenda nesciunt autem dignissimos commodi ut velit iure sequi eveniet repudiandae. Nisi impedit ad, libero voluptates autem minima corporis mollitia illo eum.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloribus, numquam culpa. Impedit voluptates ad ea distinctio a doloremque ex officiis ducimus, nobis nihil qui repudiandae, dolore, pariatur ratione error nemo.

      <button data-id="4" class="accordion">Section 4</button>
      <button data-id="5" class="accordion">Section 5</button>
      <button data-id="6" class="accordion">Section 6</button>

Lorem, ipsum dolor sit amet consectetur adipisicing elit. Dolor ducimus cupiditate fuga ratione tempore eveniet possimus maiores quod sequi natus? Iusto dolor hic facilis culpa ad illo vel deserunt minima?

Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur nihil obcaecati a cumque quos adipisci aliquam illum perspiciatis fugit, tempora aperiam officiis dignissimos odit incidunt modi tempore corporis. Porro, a.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum, quis est. Animi fuga ipsum porro ullam blanditiis illum inventore magnam, earum nesciunt ab quis placeat iste quo! Repudiandae, ratione sapiente!


来源: stackexchange

问:
iframe cannot display site due to policy restriction
i'm trying to do simple workaround if posible beouase of policy issues.

running this html

```<code><!DOCTYPE html>
<html>
<head>
<p>Please see these following stocks</p>
</head>
<body>
<iframe src="https://finance.yahoo.com/quote/META/history/" title="META"></iframe>
<iframe src="https://www.bloomberg.com/quote/MSF:GR" title="MSF:GR"></iframe>
<iframe src="https://www.google.com/finance/quote/AMZN:NASDAQ" title="AMZN:NASDAQ"></iframe>
</body>
</html>
</code>```

getting the following error:

Unrecognized Content-Security-Policy directive 'require-trusted-types-for'.

Refused to display 'https://www.google.com/finance/quote/AMZN:NASDAQ' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

The service worker navigation preload request was cancelled before 'preloadResponse' settled. If you intend to use 'preloadResponse', use waitUntil() or respondWith() to wait for the promise to settle.

Refused to display 'https://www.bloomberg.com/quote/MSF:GR' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self' https://.bloomberg.com https://.bloomberg.co.jp".

Refused to display 'https://finance.yahoo.com/quote/META/history/' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self' https://.yahoo.com https://.engadget.com https://.pnr.ouryahoo.com https://pnr.ouryahoo.com https://.search.aol.com https://.onesearch.com https://.publishing.oath.com https://*.aol.com".

any idea for workaround these issue?

ContentLicense: CC BY-SA 4.0

Body:
i'm trying to do simple workaround if posible beouase of policy issues.

running this html

<!DOCTYPE html>

Please see these following stocks

getting the following error:

Unrecognized Content-Security-Policy directive 'require-trusted-types-for'.

Refused to display 'https://www.google.com/finance/quote/AMZN:NASDAQ' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

The service worker navigation preload request was cancelled before 'preloadResponse' settled. If you intend to use 'preloadResponse', use waitUntil() or respondWith() to wait for the promise to settle.

Refused to display 'https://www.bloomberg.com/quote/MSF:GR' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self' https://.bloomberg.com https://.bloomberg.co.jp".

Refused to display 'https://finance.yahoo.com/quote/META/history/' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self' https://.yahoo.com https://.engadget.com https://.pnr.ouryahoo.com https://pnr.ouryahoo.com https://.search.aol.com https://.onesearch.com https://.publishing.oath.com https://*.aol.com".

any idea for workaround these issue?


问:
React-Native how to get ID from SVG
i am new in react-native and i am trying to programm an Android app there I have the following problem, I have a svg  thats shows all states from germany and I want to get the ID of a state if I press on it.

my code

```<code>import React, { useState } from 'react';
import { StyleSheet, View, Text, TouchableOpacity } from 'react-native'
import Germany from '../assets/Karte_Bundesrepublik_Deutschland.svg'

const StatesScreen = () => {

    const handlePress = (stateName) => {
        console.log(stateName.id)
    };

    return (
        <View style={styles.container}>
            <Germany onPress={(e) => handlePress(e)} />
        </View>
    );
};
export default StatesScreen

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
    },
});
</code>```

Link to the svg:
https://upload.wikimedia.org/wikipedia/commons/2/2c/Karte_Bundesrepublik_Deutschland.svg

Title: React-Native how to get ID from SVG

Body:
i am new in react-native and i am trying to programm an Android app there I have the following problem, I have a svg  thats shows all states from germany and I want to get the ID of a state if I press on it.

my code

import React, { useState } from 'react';
import { StyleSheet, View, Text, TouchableOpacity } from 'react-native'
import Germany from '../assets/Karte_Bundesrepublik_Deutschland.svg'

const StatesScreen = () => {

    const handlePress = (stateName) => {
        console.log(stateName.id)
    };

    return (
        <View style={styles.container}>
            <Germany onPress={(e) => handlePress(e)} />
        </View>
    );
};
export default StatesScreen

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
    },
});

Link to the svg:
https://upload.wikimedia.org/wikipedia/commons/2/2c/Karte_Bundesrepublik_Deutschland.svg


问:
Strawberry with social_django
How can I use social_django with strawberry graphql? With graphene, I inherited my strawberry.type from SocialAuthJWT
I used in grapgene like this.

```<code>class SocialAuth(graphql_social_auth.SocialAuthJWT):
    user = graphene.Field(UserType)

    @classmethod
    def resolve(cls, root, info, social, **kwargs):
        social.user.is_verified = True
        social.user.save()
        token = get_token(social.user)
        return cls(user=social.user, token=token)
</code>```

I'd like to log in with google.

Title: Strawberry with social_django

Body:
How can I use social_django with strawberry graphql? With graphene, I inherited my strawberry.type from SocialAuthJWT
I used in grapgene like this.

class SocialAuth(graphql_social_auth.SocialAuthJWT):
    user = graphene.Field(UserType)

    @classmethod
    def resolve(cls, root, info, social, **kwargs):
        social.user.is_verified = True
        social.user.save()
        token = get_token(social.user)
        return cls(user=social.user, token=token)

I'd like to log in with google.


问:
is it possible for kiwi tcms to login through Active Directory?
Is it possible for kiwi tcms to login through Active Directory?

I would like to implement in the company where I work.

I looked for documentation on the internet but without success, is there this possibility or something thought about in this area?


问:
R Shiny: How to fetch pdf file from remote server and display it in an iframe
I am looking to build a Shiny app where users can select a pdf file (with some extra info), which is then displayed in-app.

I was able to pull up a pdf from files placed in the app's www/ directory, as detailed here.

Below is my demo app. To run this, make a directory www/reports/ next to your app.R and place 3 pdfs in there named report1.pdf, report2.pdf and report3.pdf. Or download my project folder here. Run the app in the browser to see the full pdf viewer.

```<code>library(shiny)

ui <- fluidPage(
  selectInput("select_pdf", "Select PDF file", choices = c("report1.pdf", "report2.pdf", "report3.pdf")),
  actionButton("btn_view_pdf", "View PDF"),
  htmlOutput("pdfviewer")
)

server <- function(input, output) {

  # Construct pdf filepath on button click
  pdf_filepath <- eventReactive(input$btn_view_pdf, {
    pdf_dir <- "reports"
    file.path(pdf_dir, input$select_pdf)
  })

  # Show PDF in iframe
  output$pdfviewer <- renderText({
    paste('<iframe style="height:1000px; width:50%" src="', pdf_filepath(), '"></iframe>', sep = "")
  })

}

shinyApp(ui = ui, server = server)
</code>```

While this works nicely, it is not enough for my purpose. The pdfs I want to show currently live on our company HPC server, and there are thousands of pdfs, i.e. I can't copy all of them into the www/ directory inside my shiny app.

Is there a way to 1) directly fetch the pdfs from the company server and 2) feed them into the iframe? I have credentials to access the company server file tree (via ssh) and could probably put them into environment variables on the server that hosts the shiny app.

Can you point me to any best practices, resources or packages for this? I thought this is a common thing to do, but I am not finding much info out there. Thanks!

Body:
I am looking to build a Shiny app where users can select a pdf file (with some extra info), which is then displayed in-app.

I was able to pull up a pdf from files placed in the app's www/ directory, as detailed here.

Below is my demo app. To run this, make a directory www/reports/ next to your app.R and place 3 pdfs in there named report1.pdf, report2.pdf and report3.pdf. Or download my project folder here. Run the app in the browser to see the full pdf viewer.

library(shiny)

ui <- fluidPage(
  selectInput("select_pdf", "Select PDF file", choices = c("report1.pdf", "report2.pdf", "report3.pdf")),
  actionButton("btn_view_pdf", "View PDF"),
  htmlOutput("pdfviewer")
)

server <- function(input, output) {

  # Construct pdf filepath on button click
  pdf_filepath <- eventReactive(input$btn_view_pdf, {
    pdf_dir <- "reports"
    file.path(pdf_dir, input$select_pdf)
  })

  # Show PDF in iframe
  output$pdfviewer <- renderText({
    paste('', sep = "")
  })

}

shinyApp(ui = ui, server = server)

While this works nicely, it is not enough for my purpose. The pdfs I want to show currently live on our company HPC server, and there are thousands of pdfs, i.e. I can't copy all of them into the www/ directory inside my shiny app.

Is there a way to 1) directly fetch the pdfs from the company server and 2) feed them into the iframe? I have credentials to access the company server file tree (via ssh) and could probably put them into environment variables on the server that hosts the shiny app.

Can you point me to any best practices, resources or packages for this? I thought this is a common thing to do, but I am not finding much info out there. Thanks!


问:
challenging direct traffic using AWS ACL
We used to use cloudflare where setting up a challenge for direct traffic is pretty straight forward but we have now moved entirely to AWS cloudfront and for the life of me cannot see a way of setting up a rule to challenge direct traffic with a captcha or challenge

I followed a blog post to setup a referrer channel, but 'Match type' and 'Value to match' do not have the terms required to filter direct traffic

eg match type doesn't have an 'exclude term'
and 'Value to match' cannot contain 'nothing'


问:
React / nextjs query string passed through props to component does not seem to resolve
I have a nextjs sample app project.  A query is passed through props, but comes back "undefined"

```<code>Unhandled Runtime Error
TypeError: Cannot read properties of undefined (reading 'toLowerCase')

Source
components\RestaurantList\index.js (54:17) @ eval

  52 |
  53 |     const searchQuery = data.restaurants.data.filter((query) => {
> 54 |       query.name.toLowerCase().includes(props.search)
     |                 ^
  55 |   });
</code>```

In pages/index.js, I have:

```<code>function Home() {
**  const [query, updateQuery] = useState("");**
  return (
    <div className="container-fluid">
      <Row>
        <Col>
          <div className="search">
**            <InputGroup>
              <InputGroupAddon addonType="append"> Search </InputGroupAddon>
              <Input
                onChange={e => updateQuery(e.target.value.toLocaleLowerCase())}
                value={query}
              />
            </InputGroup>**
          </div>

**          <RestaurantList search={query} />**
        </Col>
      </Row>
</code>```

In my components/RestaurantList, I have

```<code>function RestaurantList(props) {
  const { loading, error, data } = useQuery(QUERY);
  if (error) return "Error loading restaurants";
  //if restaurants are returned from the GraphQL query, run the filter query
  //and set equal to variable restaurantSearch
  if (loading) return <h1>Fetching</h1>;
  if (data.restaurants.data && data.restaurants.data.length) {
    console.log(`restaurant list is ${data.restaurants.data}`);
    //searchQuery

**    const searchQuery = data.restaurants.data.filter((query) => {
      query.name.toLowerCase().includes(props.search)
  });**

  //const searchQuery = `a ${props.search}`;
    if (searchQuery.length != 0) {
      return (
</code>```

...

I have tried using console.log to see what props has or if query is null.  It seems to be empty

Body:
I have a nextjs sample app project.  A query is passed through props, but comes back "undefined"

Unhandled Runtime Error
TypeError: Cannot read properties of undefined (reading 'toLowerCase')

Source
components\RestaurantList\index.js (54:17) @ eval

  52 |
  53 |     const searchQuery = data.restaurants.data.filter((query) => {
> 54 |       query.name.toLowerCase().includes(props.search)
     |                 ^
  55 |   });

In pages/index.js, I have:

function Home() {
**  const [query, updateQuery] = useState("");**
  return (

      <Row>
        <Col>

**            <InputGroup>
              <InputGroupAddon addonType="append"> Search </InputGroupAddon>
              <Input
                onChange={e => updateQuery(e.target.value.toLocaleLowerCase())}
                value={query}
              />
            </InputGroup>**

**          <RestaurantList search={query} />**
        </Col>
      </Row>

In my components/RestaurantList, I have

function RestaurantList(props) {
  const { loading, error, data } = useQuery(QUERY);
  if (error) return "Error loading restaurants";
  //if restaurants are returned from the GraphQL query, run the filter query
  //and set equal to variable restaurantSearch
  if (loading) return
Fetching
;
  if (data.restaurants.data && data.restaurants.data.length) {
    console.log(`restaurant list is ${data.restaurants.data}`);
    //searchQuery

**    const searchQuery = data.restaurants.data.filter((query) => {
      query.name.toLowerCase().includes(props.search)
  });**

  //const searchQuery = `a ${props.search}`;
    if (searchQuery.length != 0) {
      return (

...

I have tried using console.log to see what props has or if query is null.  It seems to be empty


问:
Arguments with @BatchMapping in GraphQL Spring Boot
In Java Spring Boot with BatchMapping, I was wondering how to access the arguments. Below is parts of the schema:

```<code>type Query {
    user(username: String!): User
}

type User {
    username: String!
    posts: [Post!]!
}

type Post {
    upvotes: [User!]!
    upvoted(username: String!): Boolean
}
</code>```

and the resolver looks like this:

```<code>@SchemaMapping
public Boolean upvoted(@Argument String username) {
        //...
}
</code>```

but if I want to improve efficiency because of the n + 1 problem, I would do something like:

```<code>@BatchMapping
public Map<Post, Boolean> upvoted(List<Post> posts) {
      // ...
}
</code>```

I am not sure how to access the argument "username" in order to query the database, such as in a query like this:

```<code>{
 user(username: "1") {
    posts {
      upvoted(username: "2")
    }
  }
}
</code>```

Body:
In Java Spring Boot with BatchMapping, I was wondering how to access the arguments. Below is parts of the schema:

type Query {
    user(username: String!): User
}

type User {
    username: String!
    posts: [Post!]!
}

type Post {
    upvotes: [User!]!
    upvoted(username: String!): Boolean
}

and the resolver looks like this:

@SchemaMapping
public Boolean upvoted(@Argument String username) {
        //...
}

but if I want to improve efficiency because of the n + 1 problem, I would do something like:

@BatchMapping
public Map<Post, Boolean> upvoted(List<Post> posts) {
      // ...
}

I am not sure how to access the argument "username" in order to query the database, such as in a query like this:

{
 user(username: "1") {
    posts {
      upvoted(username: "2")
    }
  }
}


问:
My Opencart 4.0.1.1 admin modules is broken
I recently installed a language extension for Opencart 4.0.1.1. And now my products are not accesible from the shop (error 500) and if I go to Extensions > extensions > modules, the modules list is not appearing and instead, I see the shop home page (it loads the html from the frontpage of teh shop instead de admin modules list...)

Any idea? Thanks


问:
SBT Plugin Published Locally Could not Resolve Proper Scala Version
I wrote a simple sbt plugin which I published locally on my machine. I wanted to reference this plugin in one of my project and I ran into errors. The sbt plugin that I published had the following settings:

```<code>lazy val root = (project in file(".")).
  settings(
    name := "openelectrons-scalafmt-common-sbt-plugin",
    version := "0.0.1",
    organization := "com.openelectrons",
    scalaVersion := "2.13.8",
    sbtPlugin := true,
    sbtVersion := "1.6.2"
  )
</code>```

I can see in my .ivy repo that the plugin is published under scala_2.13.

I have another Scala project where I want to use this plugin for which I added it in my plugins.sbt and when I ran it using sbt, it failed as it was looking for a Scala_2.12 version of the plugin. I'm  using sbt 1.6.2. How can I force sbt to look for the sclaa_2.13 version of my plugin?

Body:
I wrote a simple sbt plugin which I published locally on my machine. I wanted to reference this plugin in one of my project and I ran into errors. The sbt plugin that I published had the following settings:

lazy val root = (project in file(".")).
  settings(
    name := "openelectrons-scalafmt-common-sbt-plugin",
    version := "0.0.1",
    organization := "com.openelectrons",
    scalaVersion := "2.13.8",
    sbtPlugin := true,
    sbtVersion := "1.6.2"
  )

I can see in my .ivy repo that the plugin is published under scala_2.13.

I have another Scala project where I want to use this plugin for which I added it in my plugins.sbt and when I ran it using sbt, it failed as it was looking for a Scala_2.12 version of the plugin. I'm  using sbt 1.6.2. How can I force sbt to look for the sclaa_2.13 version of my plugin?


问:
Is there a way, in VSCode, to preserve all user input linebreaks, and format all other linebreaks
I want to be able to add multiple empty lines to separate code visually. But I'd like to be able to format all other empty lines out.

example: If I delete 3 lines of code, on save, I want the formatter to scoot the code up 3 lines. But if I add 3 empty lines to separate my code, on save, I dont want these lines to be formatted out.


问:
Gmail API and workload identity federation with AWS and Google Cloud
I'm looking to integrated with the Gmail API and want to use a service user with domain-wide delegation to request data on behalf of users in Google Workspaces. My code is running in EC2 in AWS. Reading through the docs it seems best practice is to use workload identity federation to authenticate as a service user so there's no risk of the key being leaked.

I've followed the steps on Google's site to setup workload identity federation with AWS and have, in addition, run the following command in the google cloud shell:

```<code>gcloud iam service-accounts add-iam-policy-binding <service_account_email>  \
--role=roles/iam.workloadIdentityUser  \
--member="principalSet://iam.googleapis.com/projects/<project_id>/locations/global/workloadIdentityPools/<pool_id>/attribute.aws_role/arn:aws:sts::<aws_account_id>:assumed-role/<aws_role_name>" \
--project <google_cloud_project_name>
</code>```

I have the following test application code:

```<code>const { google } = require("googleapis");
const { GoogleAuth } = require("google-auth-library");
const path = require("path");

module.exports = async (req, res) => {
  const scopes = [
    "https://www.googleapis.com/auth/gmail.readonly",
    "https://www.googleapis.com/auth/admin.directory.user.readonly",
  ];

  let status = "";

  try {

    //Inject the client library config as the GOOGLE_APPLICATION_CREDENTIALS
    const configPath = path.join(__dirname, "client_library_config.json");
    process.env["GOOGLE_APPLICATION_CREDENTIALS"] = configPath;
    process.env["GOOGLE_CLOUD_PROJECT"] = "XXXX";

    const auth = new GoogleAuth({
      scopes,
      subject: "XXXX@XXXX.com",//email address of the test account we want to impersonate
      projectId: "XXXXX", //Google Cloud Project Name
    });

    const gmailClient = google.gmail({ version: "v1", auth });

    const user = await gmailClient.users.threads.list({
      userId: "XXXX@XXXX.com", //email address of the test account whose gmail threads we want to get
    });
  } catch (err) {
    console.log("error", err);
  }
  res.status(200).json({
    status: "ok",
  });
};
</code>```

When trying to run this code I get the following error message:

```<code>error GaxiosError: Precondition check failed.
at Gaxios._request (/opt/backend/node_modules/gaxios/build/src/gaxios.js:130:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async AwsClient.requestAsync (/opt/backend/node_modules/google-auth-library/build/src/auth/baseexternalclient.js:240:24)
</code>```

What's strange is when I run this code locally with a private key and JWT authentication for the service user it works perfectly and I don't run into any issues. Any ideas what might be going on?

Body:
I'm looking to integrated with the Gmail API and want to use a service user with domain-wide delegation to request data on behalf of users in Google Workspaces. My code is running in EC2 in AWS. Reading through the docs it seems best practice is to use workload identity federation to authenticate as a service user so there's no risk of the key being leaked.

I've followed the steps on Google's site to setup workload identity federation with AWS and have, in addition, run the following command in the google cloud shell:

gcloud iam service-accounts add-iam-policy-binding <service_account_email>  \
--role=roles/iam.workloadIdentityUser  \
--member="principalSet://iam.googleapis.com/projects/<project_id>/locations/global/workloadIdentityPools/<pool_id>/attribute.aws_role/arn:aws:sts::<aws_account_id>:assumed-role/<aws_role_name>" \
--project <google_cloud_project_name>

I have the following test application code:

const { google } = require("googleapis");
const { GoogleAuth } = require("google-auth-library");
const path = require("path");

module.exports = async (req, res) => {
  const scopes = [
    "https://www.googleapis.com/auth/gmail.readonly",
    "https://www.googleapis.com/auth/admin.directory.user.readonly",
  ];

  let status = "";

  try {

    //Inject the client library config as the GOOGLE_APPLICATION_CREDENTIALS
    const configPath = path.join(__dirname, "client_library_config.json");
    process.env["GOOGLE_APPLICATION_CREDENTIALS"] = configPath;
    process.env["GOOGLE_CLOUD_PROJECT"] = "XXXX";

    const auth = new GoogleAuth({
      scopes,
      subject: "XXXX@XXXX.com",//email address of the test account we want to impersonate
      projectId: "XXXXX", //Google Cloud Project Name
    });

    const gmailClient = google.gmail({ version: "v1", auth });

    const user = await gmailClient.users.threads.list({
      userId: "XXXX@XXXX.com", //email address of the test account whose gmail threads we want to get
    });
  } catch (err) {
    console.log("error", err);
  }
  res.status(200).json({
    status: "ok",
  });
};

When trying to run this code I get the following error message:

error GaxiosError: Precondition check failed.
at Gaxios._request (/opt/backend/node_modules/gaxios/build/src/gaxios.js:130:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async AwsClient.requestAsync (/opt/backend/node_modules/google-auth-library/build/src/auth/baseexternalclient.js:240:24)

What's strange is when I run this code locally with a private key and JWT authentication for the service user it works perfectly and I don't run into any issues. Any ideas what might be going on?


问:
Defining Riemann tensor in Python
If I introduce the Kerr metric, how can I calculate the Riemann tensor? The procedure I have followed is to first define the metric, inverse of the metric, the derivatives of the metric (using a symbolic approach), the Christoffell symbols, and then recalling them inside the function Riem and calculating their derivatives to compute the Riemann tensor. Here it is my code:

```<code>import sympy as sym
from sympy import *
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import interactive
import time
from time import perf_counter
import math
from sympy.parsing.mathematica import mathematica
from sympy import var
from sympy import symbols, Matrix, Transpose, Array
# PARAMETERS
a      = 0.1;
#-------------------------------------------------
#   1. KERR METRIC AND RELATED QUANTITIES
#-------------------------------------------------
# METRIC g_{\mu\nu}
def g(r,theta):
 Delta = r**2-2*r+a**2
 Sigma = r**2+(a*cos(theta))**2
 rho   = r**2+a**2+(2*a**2*r*sin(theta)**2)/Sigma
 return np.array([[-(1-(2*r)/Sigma), 0, 0, -((2*a*r*sin(theta)**2)/Sigma)],
   [0, Sigma/Delta, 0, 0],
   [0, 0,Sigma,0],
   [-((2*a*r*sin(theta)**2)/Sigma),0,0,rho*sin(theta)**2]])

# INVERSE METRIC g^{\mu\nu}
def ginv(r,theta):
 return np.array([[-1 - (4*r*(a**2+r**2))/((a**2+r*(-2+r))*(a**2+2*r**2+a**2*cos(2*theta))), 0, 0, -((4*a*r)/((a**2 + r*(-2+ r))*(a**2 + 2*r**2 + a**2*cos(2*theta))))],[0, (a**2 - 2*r + r**2)/(r**2 + a**2*cos(theta)**2), 0, 0], [0, 0, 1/(r**2 + a**2*cos(theta)**2),0], [-((4*a*r)/((a**2 + r*(-2+ r))*(a**2 + 2*r**2 +a**2*cos(2*theta)))), 0, 0, (2*(r*(-2+r) + a**2*cos(theta)**2)*csc(theta)**2)/((a**2 +r*(-2+ r))*(a**2 + 2*r**2 +a**2*cos(2*theta)))]])

def Dg(r,theta):
 x,y     = symbols('x y')
 f       = g(x,y)
 Drf     = Matrix(np.zeros((4,4)))
 Dthetaf = Matrix(np.zeros((4,4)))
 for i in range(4):
  for j in range(4):
   Drf[i,j]     = diff(f[i,j], x)
   Dthetaf[i,j] = diff(f[i,j], y)
 Drg     = np.array(Drf.subs(x,r).subs(y,theta), dtype=np.float64)
 Dthetag = np.array(Dthetaf.subs(x,r).subs(y,theta), dtype=np.float64)
 return np.array([np.zeros((4,4)),Drg,Dthetag,np.zeros((4,4))])

#-----LEVI CIVITA SYMBOL---------------------------------
def Gamma(r,theta):
 Dgg   = Dg(r,theta)
 gginv = ginv(r,theta)
 xx    = np.zeros((4,4,4))
 for i in range(4):
  for j in range(4):
    for l in range(4):
     xx[l,i,j]=sum([(1/2)*gginv[l,k]*(Dgg[i,k,j]+Dgg[j,k,i]-Dgg[k,i,j]) for k in range(4)])
 return xx
#-----RIEMANN---------------------------------
# R^\mu_{\ \nu\alpha\beta}
def Riem(r,theta):
 x,y  = symbols('x y')
 f    = Gamma(x,y)
 Drf  = Matrix(np.zeros((4,4,4)))
 Dthf = Matrix(np.zeros((4,4,4)))
 for i in range(4):
  for j in range(4):
   for k in range(4):
    Drf[k,i,j]  = diff(f[k,i,j], x)
    Dthf[k,i,j] = diff(f[k,i,j], y)
 DrGamma     = np.array(Df.subs(x,r).subs(y,theta), dtype=np.float64)
 DthetaGamma = np.array(Df.subs(x,r).subs(y,theta), dtype=np.float64)
 DGamma      = np.array([np.zeros((4,4,4)),DrGamma,DthetaGamma,np.zeros((4,4,4))])
 xx=np.zeros((4,4,4,4))
 for j in range(4):
  for i in range(4):
    for l in range(4):
     for k in range(4):
      xx[l,k,i,j]=DGamma[i,l,j,k]-DGamma[j,l,i,k]+sum([Gamma[l,i,p]*Gamma[p,j,k] for p in range(4)])-sum([Gamma[l,j,p]*Gamma[p,i,k] for p in range(4)])
 return xx
</code>```

When I compile I get an errore message, how can I solve it?

Title: Defining Riemann tensor in Python

Body:
If I introduce the Kerr metric, how can I calculate the Riemann tensor? The procedure I have followed is to first define the metric, inverse of the metric, the derivatives of the metric (using a symbolic approach), the Christoffell symbols, and then recalling them inside the function Riem and calculating their derivatives to compute the Riemann tensor. Here it is my code:

import sympy as sym
from sympy import *
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import interactive
import time
from time import perf_counter
import math
from sympy.parsing.mathematica import mathematica
from sympy import var
from sympy import symbols, Matrix, Transpose, Array
# PARAMETERS
a      = 0.1;
#-------------------------------------------------
#   1. KERR METRIC AND RELATED QUANTITIES
#-------------------------------------------------
# METRIC g_{\mu\nu}
def g(r,theta):
 Delta = r**2-2*r+a**2
 Sigma = r**2+(a*cos(theta))**2
 rho   = r**2+a**2+(2*a**2*r*sin(theta)**2)/Sigma
 return np.array([[-(1-(2*r)/Sigma), 0, 0, -((2*a*r*sin(theta)**2)/Sigma)],
   [0, Sigma/Delta, 0, 0],
   [0, 0,Sigma,0],
   [-((2*a*r*sin(theta)**2)/Sigma),0,0,rho*sin(theta)**2]])

# INVERSE METRIC g^{\mu\nu}
def ginv(r,theta):
 return np.array([[-1 - (4*r*(a**2+r**2))/((a**2+r*(-2+r))*(a**2+2*r**2+a**2*cos(2*theta))), 0, 0, -((4*a*r)/((a**2 + r*(-2+ r))*(a**2 + 2*r**2 + a**2*cos(2*theta))))],[0, (a**2 - 2*r + r**2)/(r**2 + a**2*cos(theta)**2), 0, 0], [0, 0, 1/(r**2 + a**2*cos(theta)**2),0], [-((4*a*r)/((a**2 + r*(-2+ r))*(a**2 + 2*r**2 +a**2*cos(2*theta)))), 0, 0, (2*(r*(-2+r) + a**2*cos(theta)**2)*csc(theta)**2)/((a**2 +r*(-2+ r))*(a**2 + 2*r**2 +a**2*cos(2*theta)))]])

def Dg(r,theta):
 x,y     = symbols('x y')
 f       = g(x,y)
 Drf     = Matrix(np.zeros((4,4)))
 Dthetaf = Matrix(np.zeros((4,4)))
 for i in range(4):
  for j in range(4):
   Drf[i,j]     = diff(f[i,j], x)
   Dthetaf[i,j] = diff(f[i,j], y)
 Drg     = np.array(Drf.subs(x,r).subs(y,theta), dtype=np.float64)
 Dthetag = np.array(Dthetaf.subs(x,r).subs(y,theta), dtype=np.float64)
 return np.array([np.zeros((4,4)),Drg,Dthetag,np.zeros((4,4))])

#-----LEVI CIVITA SYMBOL---------------------------------
def Gamma(r,theta):
 Dgg   = Dg(r,theta)
 gginv = ginv(r,theta)
 xx    = np.zeros((4,4,4))
 for i in range(4):
  for j in range(4):
    for l in range(4):
     xx[l,i,j]=sum([(1/2)*gginv[l,k]*(Dgg[i,k,j]+Dgg[j,k,i]-Dgg[k,i,j]) for k in range(4)])
 return xx
#-----RIEMANN---------------------------------
# R^\mu_{\ \nu\alpha\beta}
def Riem(r,theta):
 x,y  = symbols('x y')
 f    = Gamma(x,y)
 Drf  = Matrix(np.zeros((4,4,4)))
 Dthf = Matrix(np.zeros((4,4,4)))
 for i in range(4):
  for j in range(4):
   for k in range(4):
    Drf[k,i,j]  = diff(f[k,i,j], x)
    Dthf[k,i,j] = diff(f[k,i,j], y)
 DrGamma     = np.array(Df.subs(x,r).subs(y,theta), dtype=np.float64)
 DthetaGamma = np.array(Df.subs(x,r).subs(y,theta), dtype=np.float64)
 DGamma      = np.array([np.zeros((4,4,4)),DrGamma,DthetaGamma,np.zeros((4,4,4))])
 xx=np.zeros((4,4,4,4))
 for j in range(4):
  for i in range(4):
    for l in range(4):
     for k in range(4):
      xx[l,k,i,j]=DGamma[i,l,j,k]-DGamma[j,l,i,k]+sum([Gamma[l,i,p]*Gamma[p,j,k] for p in range(4)])-sum([Gamma[l,j,p]*Gamma[p,i,k] for p in range(4)])
 return xx

When I compile I get an errore message, how can I solve it?


问:
One table pointing to other table with two same foreign keys Sequelize
i have a table Transactions with: ID/sender_wallet/addressee_wallet/ammount
I'm trying to create a new transaction from Wallet - to - Wallet and Sequelize forces sender_wallet/addressee_wallet to be WalletId(the other table) because of the references foreign key.

I don't know how to disable that renaming or to force that naming pointing the same reference.

Associations:

Wallets.hasMany(Transactions);
Transactions.belongsTo(Wallets);

Model:

```<code>Transactions.init(
  {
    id: {
      type: DataTypes.INTEGER,
      primaryKey: true,
      autoIncrement: true,
      allowNull: false,
      unique: true,
    },
    sender_wallet: {
      type: DataTypes.INTEGER,
      allowNull: false,
      references: {
        model: "Wallets",
        key: "id",
      },
    },
    addressee_wallet: {
      type: DataTypes.INTEGER,
      allowNull: false,
      references: {
        model: "Wallets",
        key: "id",
      },
    },
    quantity: {
      type: DataTypes.INTEGER,
      allowNull: false,
      validate: {
        isNumeric: true,
      },
    },
  },
  {
    sequelize,
    modelName: "Transactions",
    createdAt: true,
    updatedAt: false,
    freezeTableName: true,
    underscored: false,
  }
);

</code>```

Tried to rename all other tables but don't work on this one

Body:
i have a table Transactions with: ID/sender_wallet/addressee_wallet/ammount
I'm trying to create a new transaction from Wallet - to - Wallet and Sequelize forces sender_wallet/addressee_wallet to be WalletId(the other table) because of the references foreign key.

I don't know how to disable that renaming or to force that naming pointing the same reference.

Associations:

Wallets.hasMany(Transactions);
Transactions.belongsTo(Wallets);

Model:

Transactions.init(
  {
    id: {
      type: DataTypes.INTEGER,
      primaryKey: true,
      autoIncrement: true,
      allowNull: false,
      unique: true,
    },
    sender_wallet: {
      type: DataTypes.INTEGER,
      allowNull: false,
      references: {
        model: "Wallets",
        key: "id",
      },
    },
    addressee_wallet: {
      type: DataTypes.INTEGER,
      allowNull: false,
      references: {
        model: "Wallets",
        key: "id",
      },
    },
    quantity: {
      type: DataTypes.INTEGER,
      allowNull: false,
      validate: {
        isNumeric: true,
      },
    },
  },
  {
    sequelize,
    modelName: "Transactions",
    createdAt: true,
    updatedAt: false,
    freezeTableName: true,
    underscored: false,
  }
);

Tried to rename all other tables but don't work on this one


问:
Volume Buttons with JavaScript
I want to create a section of my extention that has buttons that, when clicked, will increase the volume of video and audio tags by 2, 3, 4, and 5 times the original volume. I am attempting to use the Web Audio API to do this, but I'm not sure how to create the JavaScript to complete this task.

So far, I have created the buttons that the user of the extention will use, but I'm stuck on how to create the JavaScript code to increase the volumes when clicked. I have been looking into this GitHub Repo for a possible solution, but their code does not indicate that it will work in the way that I need this API to work.

Does anyone have any solutions that I could try?

Title: Volume Buttons with JavaScript


问:
why do i get an error when i try to use my bot's "play" command?
my bot returns this error:

```<code>TypeError: Cannot read properties of undefined (reading 'options')
</code>```

im trying to make a discord music bot. my code is here:

```<code>  execute: async ({ client, interaction }) => {
        let url = interaction.options.getString("url")
        client.distube.play(interaction.member.voice.channel, url, {
          member: interaction.member,
          textChannel: interaction.channel,
          interaction
        })
    }
}
</code>```

it errors on the line where it says "interaction.options.getString"

Body:
my bot returns this error:

TypeError: Cannot read properties of undefined (reading 'options')

im trying to make a discord music bot. my code is here:

  execute: async ({ client, interaction }) => {
        let url = interaction.options.getString("url")
        client.distube.play(interaction.member.voice.channel, url, {
          member: interaction.member,
          textChannel: interaction.channel,
          interaction
        })
    }
}

it errors on the line where it says "interaction.options.getString"


问:
What are Visual Studio file path limits?
VS2010 has a mechanism that prevents you from creating projects if the resulting path is too long. I was going on the assumption that the maximum path length is 260 characters and the maximum directory path is 256 characters, but upon examination, VS2010 seems to set much shorter limits. Does anyone know why, and what those limits really are? Thanks.</p>

ContentLicense: CC BY-SA 3.0


问:
Not getting results from Flower API
I've been experimenting with escriptorium, which uses Flower and Celery. As part of that I'm attempting to write some scripting to query Flower workers using its API. When I view my Flower dashboard I can see 4 workers listed.

But when I use the API to get a list of workers, /api/workers, I get a 200 and an empty list. I'm doing this in a Gitpod workspace so my dashboard URL, because of the port mapping, is something like https://5555-kineticsqui-escriptoriu....gitpod.io/dashboard and the api https://5555-kineticsqui-escriptoriu....gitpod.io/api/workers. I feel like I'm missing something simple.

Title: Not getting results from Flower API


问:
draw sprites to surface? ( I want to create a surface layer for shadows )
Im coming from game maker studio background and the engine would let you draw sprites onto surfaces. A way to achieve shadows was to add a script to instances that required shadows. the script would draw a sprite of itself with a little bit of an offset onto the shadow surface layer. With the surface ready, you can then paint the surface black + add some alpha.

Is there a way to achieve a similar effect in godot?


问:
Fragment not showing Jetpack Compose content
In my app I have an Activity with a single Fragment which contains only Jetpack Compose code. I need the Fragment due to a library that requires a Fragment. My issue is, inside the Fragment the Jetpack Compose UI is not being shown. Note how in MainFragment a Text("hello world") is added, but not shown:

What am I doing wrong?

This is my code:

MainActivity

```<code>class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        if(savedInstanceState == null) {
            supportFragmentManager.commit {
                setReorderingAllowed(true)
                add(MainFragment(), "mainFragmentTag")
            }
        }
    }
}
</code>```

MainFragment

```<code>class MainFragment : Fragment() {
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        Timber.i("MainFragment oncreateview")
        return ComposeView(requireContext()).apply {
            // Dispose of the Composition when the view's LifecycleOwner is destroyed
            setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)

            setContent {
                MaterialTheme {
                    Text("hello world")
                }
            }
        }
    }
}
</code>```

themes.xml

```<code><?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Theme.MyAppTheme" parent="Theme.AppCompat.DayNight">
    </style>
</resources>
</code>```

AndroidManifest.xml

```<code><?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.MyAppTheme">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTask"
            android:theme="@style/Theme.MyAppTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>
    </application>
</manifest>
</code>```

Body:
In my app I have an Activity with a single Fragment which contains only Jetpack Compose code. I need the Fragment due to a library that requires a Fragment. My issue is, inside the Fragment the Jetpack Compose UI is not being shown. Note how in MainFragment a Text("hello world") is added, but not shown:

What am I doing wrong?

This is my code:

MainActivity

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        if(savedInstanceState == null) {
            supportFragmentManager.commit {
                setReorderingAllowed(true)
                add(MainFragment(), "mainFragmentTag")
            }
        }
    }
}

MainFragment

class MainFragment : Fragment() {
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        Timber.i("MainFragment oncreateview")
        return ComposeView(requireContext()).apply {
            // Dispose of the Composition when the view's LifecycleOwner is destroyed
            setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)

            setContent {
                MaterialTheme {
                    Text("hello world")
                }
            }
        }
    }
}

themes.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

</resources>

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.MyAppTheme">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTask"
            android:theme="@style/Theme.MyAppTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>
    </application>
</manifest>


问:
map function wont render text correctly
I want to display Metatags from an Image with a Map Function. But when rendering the keywords from the image, it only displays the first letter of the first keyword and no letters from the other keywords. But when I console.log the keywords there are all displayed correctly.
I also have another function to add keywords manually using the UI and those are displayed correctly.

This is my Array. I'm using a Set to prevent duplicate entry's

```<code>const [listOfSelectedTagsFromTheMenu, setListOfSelectedTagsFromTheMenu] = useState(new Set([]));
</code>```

This is where I fetch the keywords from another function. The function returns a list like ["Home", "Sun"]

```<code>const fetchImageKeywords = async () => {
    setListOfSelectedTagsFromTheMenu(new Set());
    let keywords = await getImageKeywords(imageUri);
    keywords.forEach((keyword) => {
      listOfSelectedTagsFromTheMenu.add(keyword);
      setListOfSelectedTagsFromTheMenu(new Set(listOfSelectedTagsFromTheMenu));
    });
  };
</code>```

This is where the keywords are getting rendered.

```<code><Layout style={{ display: "flex", flexWrap: "wrap" }}>
              {[...listOfSelectedTagsFromTheMenu].map((keyword, index) => (
                <Card key={index} style={{ width: 100, height: 50 }}>
                  <Layout style={{ flexDirection: "row" }} level="1">
                    <Text>{keyword}</Text>
                    <Icon
                      onPress={() => {
                        listOfSelectedTagsFromTheMenu.delete(keyword);
                        setListOfSelectedTagsFromTheMenu(
                          new Set(listOfSelectedTagsFromTheMenu)
                        );
                      }}
                      style={{ height: 23, width: 23 }}
                      fill="red"
                      name="close-outline"
                    />
                  </Layout>
                </Card>
              ))}
            </Layout>
</code>```

I don't know why this simply task are giving me such a headache

Title: map function wont render text correctly

Body:
I want to display Metatags from an Image with a Map Function. But when rendering the keywords from the image, it only displays the first letter of the first keyword and no letters from the other keywords. But when I console.log the keywords there are all displayed correctly.
I also have another function to add keywords manually using the UI and those are displayed correctly.

This is my Array. I'm using a Set to prevent duplicate entry's

const [listOfSelectedTagsFromTheMenu, setListOfSelectedTagsFromTheMenu] = useState(new Set([]));

This is where I fetch the keywords from another function. The function returns a list like ["Home", "Sun"]

const fetchImageKeywords = async () => {
    setListOfSelectedTagsFromTheMenu(new Set());
    let keywords = await getImageKeywords(imageUri);
    keywords.forEach((keyword) => {
      listOfSelectedTagsFromTheMenu.add(keyword);
      setListOfSelectedTagsFromTheMenu(new Set(listOfSelectedTagsFromTheMenu));
    });
  };

This is where the keywords are getting rendered.

<Layout style={{ display: "flex", flexWrap: "wrap" }}>
              {[...listOfSelectedTagsFromTheMenu].map((keyword, index) => (
                <Card key={index} style={{ width: 100, height: 50 }}>
                  <Layout style={{ flexDirection: "row" }} level="1">
                    <Text>{keyword}</Text>
                    <Icon
                      onPress={() => {
                        listOfSelectedTagsFromTheMenu.delete(keyword);
                        setListOfSelectedTagsFromTheMenu(
                          new Set(listOfSelectedTagsFromTheMenu)
                        );
                      }}
                      style={{ height: 23, width: 23 }}
                      fill="red"
                      name="close-outline"
                    />
                  </Layout>
                </Card>
              ))}
            </Layout>

I don't know why this simply task are giving me such a headache


问:
Multiple Firebase errors in Xcode
I keep getting these weird errors when I'm building in Xcode. I'm using flutter. I've tried deleting my .xcworkspace and using flutter clean. I've searched multiple answers but none of them work. Please help.

Title: Multiple Firebase errors in Xcode


问:
Vuetify extend v-dialog TypeError: Cannot read properties of undefined
I'm trying to extend the v-dialog component so I can set up a standard dialog format for many of my modals.  I've lifted the below pattern from this question:

<template>
  <v-dialog v-bind="$props" v-on="$listeners">
    <template
      v-for="slot in Object.keys($scopedSlots)"
      :slot="slot"
      slot-scope="scope"
    >
      <slot :name="slot" v-bind="scope" />
    </template>
  </v-dialog>
</template>

```

The <template> portion causes a failure when calling the component from a page where the standard <v-dialog> component works.

This is the error:

client.js?06a0:103 TypeError: Cannot read properties of undefined (reading 'contains')
at VueComponent.eval (VDialog.js?169a:166:1)
at Array.eval (vue.runtime.esm.js?2b0e:1989:1)
at flushCallbacks (vue.runtime.esm.js?2b0e:1915:1)

The packages it refers to are standard vue.js packages so it's a really gritty debug.

I'm using the last version of Vuetify on Vue2.

I've asked the same question on their Github here: https://github.com/vuetifyjs/vuetify/issues/14581#issuecomment-1368083092

Body:
I'm trying to extend the v-dialog component so I can set up a standard dialog format for many of my modals.  I've lifted the below pattern from this question:

<template>
  <v-dialog v-bind="$props" v-on="$listeners">
    <template
      v-for="slot in Object.keys($scopedSlots)"
      :slot="slot"
      slot-scope="scope"
    >
      <slot :name="slot" v-bind="scope" />
    </template>
  </v-dialog>
</template>

The <template> portion causes a failure when calling the component from a page where the standard <v-dialog> component works.

This is the error:

client.js?06a0:103 TypeError: Cannot read properties of undefined (reading 'contains')
at VueComponent.eval (VDialog.js?169a:166:1)
at Array.eval (vue.runtime.esm.js?2b0e:1989:1)
at flushCallbacks (vue.runtime.esm.js?2b0e:1915:1)

The packages it refers to are standard vue.js packages so it's a really gritty debug.

I'm using the last version of Vuetify on Vue2.

I've asked the same question on their Github here: https://github.com/vuetifyjs/vuetify/issues/14581#issuecomment-1368083092


问:
PhpStorm: trans(), view(), asset() Cannot find declaration to go to
I am currently working on a Laravel project and for that I am using JetBrains PhpStorm PHP IDE, and I've also installed Symfony Support Plugin along with PHP Annotations Plugin & PHP Toolbox plugin.

One important note maybe this would be useful:
I have recently upgraded my PhpStorm IDE from version 2020.01 to 2022.2

Now the IDE has suddenly stopped resolving references, whenever I try to open any of the file type as mentioned below:

trans('hello.world');
view('hello.world');
asset('assets/hello/world.jpg');
```

It shows resolving references for few seconds and then shows me an error Cannot find declaration to go to.
Previously I also was able to navigate to my routes and controller from blade files but now I am unable to do that too.

I tried googling this issue and found some solutions for the same, and I tried implementing and debugging it one by one, but none helped me.

All my unsuccessful attempts as per solutions on the internet:

I tried deleting the .idea folder.

Reinstalled the plugins, even reinstalled entire software too.

In Settings -> Directories, I made these changes (added vendor and .idea folders to excluded):
 Directories" />

Settings -> PHP -> Annotations -> scheduled annotation reindex:

Settings -> PHP -> Symfony, now looks like:

For this there were two solutions I found, viz. changing the fields. I tried changing

Translation Root Path to:

lang

src/AppBundle/Resources/translations

src/AppBundle/translations

src/AppBundle/Resources/lang

src/AppBundle/lang

app/cache/dev/translations

var/cache/dev/translations

app/cache/dev/lang

var/cache/dev/lang

./var/cache/dev/lang/

./var/cache/dev/translations/

App Directory to:

app

config

/app/

/config/

./app/

./config/

Web Directory to:

public

./public/

/public/

Nothing has worked till now. I am not sure why IDE is not able to resolve references, and give suggestions or open any file.

Body:
I am currently working on a Laravel project and for that I am using JetBrains PhpStorm PHP IDE, and I've also installed Symfony Support Plugin along with PHP Annotations Plugin & PHP Toolbox plugin.

One important note maybe this would be useful:
I have recently upgraded my PhpStorm IDE from version 2020.01 to 2022.2

Now the IDE has suddenly stopped resolving references, whenever I try to open any of the file type as mentioned below:

trans('hello.world');
view('hello.world');
asset('assets/hello/world.jpg');

It shows resolving references for few seconds and then shows me an error Cannot find declaration to go to.
Previously I also was able to navigate to my routes and controller from blade files but now I am unable to do that too.

I tried googling this issue and found some solutions for the same, and I tried implementing and debugging it one by one, but none helped me.

All my unsuccessful attempts as per solutions on the internet:

I tried deleting the .idea folder.

Reinstalled the plugins, even reinstalled entire software too.

In Settings -> Directories, I made these changes (added vendor and .idea folders to excluded):
 Directories" />

Settings -> PHP -> Annotations -> scheduled annotation reindex:

Settings -> PHP -> Symfony, now looks like:

For this there were two solutions I found, viz. changing the fields. I tried changing

Translation Root Path to:

lang

src/AppBundle/Resources/translations

src/AppBundle/translations

src/AppBundle/Resources/lang

src/AppBundle/lang

app/cache/dev/translations

var/cache/dev/translations

app/cache/dev/lang

var/cache/dev/lang

./var/cache/dev/lang/

./var/cache/dev/translations/

App Directory to:

app

config

/app/

/config/

./app/

./config/

Web Directory to:

public

./public/

/public/

Nothing has worked till now. I am not sure why IDE is not able to resolve references, and give suggestions or open any file.


问:
What is causing my C# WASM function to run slowly?
I was playing around with csharp wasm features in dotnet 7, and was seeing a huge speed difference where csharp was extremely slow compared to JavaScript. I was just concatenating a bunch of numbers.

In csharp, it took a over 60 seconds to concatenate 100k numbers together. Whereas in JavaScript, to do the same thing took ~20ms.

What caused this?

The C# code

public partial class MyClass
{
  [JSExport]
  internal static string CountTo(int number)
  {
    var text = "";
    for (int i = 0; i < number; i++)
    {
      text += $"{i}";
    }
    return text;
  }
}
```
<p>The JavaScript</p>
<pre class="lang-js prettyprint-override"><code>import { dotnet } from './dotnet.js';
const { getAssemblyExports, getConfig } = await dotnet.create();

const count = 100000;

const config = getConfig();
const exports = await getAssemblyExports(config.mainAssemblyName);

// Test the C# WASM function
console.time('csharp');
exports.MyClass.CountTo(count);
console.timeEnd('csharp');

function countTo(number) {
    var text = "";
    for (let i = 0; i < number; i++) {
        text += `${i}`;
    }
    return text;
}

// Test the JavaScript function
console.time('js');
countTo(count);
console.timeEnd('js');
</code>```

I was to believe that WASM was supposed to be faster aka native speeds...

Body:
I was playing around with csharp wasm features in dotnet 7, and was seeing a huge speed difference where csharp was extremely slow compared to JavaScript. I was just concatenating a bunch of numbers.

In csharp, it took a over 60 seconds to concatenate 100k numbers together. Whereas in JavaScript, to do the same thing took ~20ms.

What caused this?

The C# code

public partial class MyClass
{
  [JSExport]
  internal static string CountTo(int number)
  {
    var text = "";
    for (int i = 0; i < number; i++)
    {
      text += $"{i}";
    }
    return text;
  }
}

The JavaScript

import { dotnet } from './dotnet.js';
const { getAssemblyExports, getConfig } = await dotnet.create();

const count = 100000;

const config = getConfig();
const exports = await getAssemblyExports(config.mainAssemblyName);

// Test the C# WASM function
console.time('csharp');
exports.MyClass.CountTo(count);
console.timeEnd('csharp');

function countTo(number) {
    var text = "";
    for (let i = 0; i < number; i++) {
        text += `${i}`;
    }
    return text;
}

// Test the JavaScript function
console.time('js');
countTo(count);
console.timeEnd('js');

I was to believe that WASM was supposed to be faster aka native speeds...


问:
inference error when testing each element of a mixed-type list with "instanceof" in a ternary operator on a stream() in Java
I know this could be a design flaw in Java, but I'd like to process a list with unknown types (easy to do in Python), mapping each element with a lambda function that tests the type and outputs something accordingly.

I tried to process a list of integers and a string, like so:

```<code>import java.util.Arrays;
import java.util.List;

public class TestMixedTypesArrays {
    public static void main(String[] args) {
        List<Object> myArray = Arrays.asList(2, 3, "a", 5);
        myArray.stream().map(x -> x instanceof Integer ? x * x : x + x).forEach(System.out::println);
    }
}

</code>```

I expected to be able to process each element according to it's types, but the compiler gives the following exception:

```<code>Exception in thread "main" java.lang.Error: Unresolved compilation problems:
        Cannot infer type argument(s) for <R> map(Function<? super T,? extends R>)
        The operator * is undefined for the argument type(s) java.lang.Object, java.lang.Object
        The operator + is undefined for the argument type(s) java.lang.Object, java.lang.Object
</code>```

Body:
I know this could be a design flaw in Java, but I'd like to process a list with unknown types (easy to do in Python), mapping each element with a lambda function that tests the type and outputs something accordingly.

I tried to process a list of integers and a string, like so:

import java.util.Arrays;
import java.util.List;

public class TestMixedTypesArrays {
    public static void main(String[] args) {
        List<Object> myArray = Arrays.asList(2, 3, "a", 5);
        myArray.stream().map(x -> x instanceof Integer ? x * x : x + x).forEach(System.out::println);
    }
}

I expected to be able to process each element according to it's types, but the compiler gives the following exception:

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
        Cannot infer type argument(s) for <R> map(Function<? super T,? extends R>)
        The operator * is undefined for the argument type(s) java.lang.Object, java.lang.Object
        The operator + is undefined for the argument type(s) java.lang.Object, java.lang.Object


问:
chat app based on UDP in java: Problem on Thread Send and Recieve. when I start application thread recieve don't let thread send to finish
I work on a project to make a chat app using udp (datagramsockets) in java.
the idea is multiple clients can communicate with each other with intermediate a server, server here get message from client1 and send to the destination, and this destination can answer to client1.
so each client can write messages and recieve messages without having none block.
THREAD SEND:

```<code>package org.example.Client;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.util.Scanner;

public class Send extends Thread{
    DatagramSocket datagramSocket;
    Scanner clavier = new Scanner(System.in);
    Client client;
    String operation;
    public Send(DatagramSocket socket, Client client,String operation){
        this.datagramSocket = socket;
        this.client = client;
        this.operation = operation;
    }
    @Override
    public void run() {
        System.out.println("Send ... ");
        String msg=null;
        byte[] tampon;

            System.out.println("DESTINATAIRE : ");
            String destinataire = clavier.nextLine();
            do {
                tampon = new byte[1024];
                msg = clavier.nextLine();
                try {
                    tampon =(operation+"|"+destinataire+"|"+client.username+"|"+msg).getBytes();
                    DatagramPacket packet = new DatagramPacket(tampon,tampon.length, InetAddress.getByName("localhost"),1234);
                    datagramSocket.send(packet);
                    System.out.println("SEND ....");
                    //datagramSocket.close();
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }while(msg!=null);
    }
}

</code>```

Thread recieve:

```<code>package org.example.Client;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class Recieve extends Thread{
    DatagramSocket datagramSocket;

    public Recieve(DatagramSocket socket){
        this.datagramSocket=socket;
    }

    @Override
    public void run() {
        System.out.println("Recieve ...,");
        while (true){
            byte[] tampon = new byte[1024];
            DatagramPacket packet = new DatagramPacket(tampon,tampon.length);
            try {
                datagramSocket.receive(packet);
                System.out.println("RECIEVE .....");
                System.out.println("REcieve || "+packet.getPort()+ " || "+new String(packet.getData()));
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}

</code>```

Client:

```<code>package org.example.Client;

import org.example.ConnexionDb.ConnexionDb;
import org.example.GUI.ConnexionForm;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.util.Scanner;

public class Client {
    String username;
    public DatagramSocket datagramSocket;

    public Client(String username){
        this.username = username;
        try {
            datagramSocket = new DatagramSocket();
        } catch (SocketException e) {
            throw new RuntimeException(e);
        }
    }

    public static void main(String[] args) throws Exception{
        Scanner clavier = new Scanner(System.in);
        //new ConnexionForm();
        System.out.println("Connexion Nouveau Utilisateur: ");

        //Connection à la base de données:
        ConnexionDb connexionDb = new ConnexionDb();
        boolean isConnected = false;
        while (!isConnected){
            System.out.println("Username: ");
            String username = clavier.nextLine();
            System.out.println("Password: ");
            String password = clavier.nextLine();
            if(connexionDb.connexionUtilisateur(username,password)==1){
                System.out.println("Connexion avec succé");
                Client client = new Client(username);
                DatagramSocket socket = new DatagramSocket();
                byte[] tampon = ("1|"+client.username).getBytes();
                DatagramPacket packet = new DatagramPacket(tampon,tampon.length, InetAddress.getByName("localhost"),1234);
                socket.send(packet);
                socket.close();
                System.out.println("1- Envoyer un message\n" +
                        "2- Les utilisateurs connectés");

                String choix = clavier.nextLine();
                isConnected = true;
                switch (choix){
                    case "1":
                        //Client client = new Client(username);
                        //DatagramSocket socket = new DatagramSocket();
                        Send send = new Send(client.datagramSocket, client,"2");
                        send.start();
                        Recieve recieve = new Recieve(client.datagramSocket);
                        recieve.start();
                        break;
                    case "2":
                        break;

                }
            }
            else {
                System.out.println("Vérifier vos informations et réassayer.");
            }
        }
    }
}

</code>```

Server:

```<code>package org.example.Serveur;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.util.ArrayList;

public class Serveur extends Thread{
    DatagramSocket datagramSocketClient;
    DatagramSocket datagramSocketServer;
    int port;
    byte[] tampon;
    ArrayList<ConnectedUsers> connectedUsers = new ArrayList<>();

    public Serveur(int port){
        this.port = port;
    }

    @Override
    public void run() {
        System.out.println("Serveur ... ");
        while(true){
            try {
                datagramSocketServer = new DatagramSocket(port);
                tampon = new byte[1024];
                DatagramPacket packet = new DatagramPacket(tampon, tampon.length);
                datagramSocketServer.receive(packet);
                System.out.println("Message recu : " + packet.getPort() + " || " + new String(packet.getData()));
                datagramSocketServer.close();
                String[] recieved = (new String(packet.getData(),0,tampon.length).trim()).split("[|]");
                System.out.println("apres close: " + packet.getPort());
                datagramSocketClient = new DatagramSocket();
                InetAddress inetAddress = InetAddress.getByName("localhost");
                switch (recieved[0]){
                    case "1":
                        connectedUsers.add(new ConnectedUsers(recieved[1],packet.getPort(),packet.getAddress()));
                        System.out.println("New USER CONNECTED "+recieved[1]);
                        break;
                    case "2":
                        System.out.println("FROM-->"+recieved[2]+" To-->"+recieved[1]+" ::: "+recieved[3]);
                        int port = 0;
                        InetAddress inetAddress1 = null;
                        for(int i=0; i<connectedUsers.size();i++){
                            if(connectedUsers.get(i).username.equals(recieved[1])){
                                port = connectedUsers.get(i).port;
                                inetAddress1 = connectedUsers.get(i).inetAddress;
                            }
                        }
                        tampon = (recieved[2]+" :::: "+recieved[3]).getBytes();
                        DatagramPacket packet1 = new DatagramPacket(tampon,tampon.length,inetAddress1,port);
                        datagramSocketClient.send(packet1);
                        System.out.println("Envoyé au destinataire::: ");
                        break;
                }
                //DatagramPacket packet1 = new DatagramPacket(tampon, tampon.length,inetAddress,destPort);
                datagramSocketClient.close();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }

    public static void main(String[] args) {
        Serveur serveur = new Serveur(1234);
        serveur.start();
    }

    public class ConnectedUsers{
        int port;
        InetAddress inetAddress;
        String username;

        public ConnectedUsers(String username, int port, InetAddress inetAddress){
            this.port = port;
            this.username = username;
            this.inetAddress = inetAddress;
        }
    }
}

</code>```

Server works good.
The problem is on client: when I run Client, I authenticate client
the problem is here
recieve don't let send to finish.
I want to have possibility to send message and recieve without block between those two threads.

```<code>Thread send = new Send(client.datagramSocket, client,"2");
send.start();
Thread recieve = new Recieve(client.datagramSocket);
recieve.start();
</code>```

Body:
I work on a project to make a chat app using udp (datagramsockets) in java.
the idea is multiple clients can communicate with each other with intermediate a server, server here get message from client1 and send to the destination, and this destination can answer to client1.
so each client can write messages and recieve messages without having none block.
THREAD SEND:

package org.example.Client;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.util.Scanner;

public class Send extends Thread{
    DatagramSocket datagramSocket;
    Scanner clavier = new Scanner(System.in);
    Client client;
    String operation;
    public Send(DatagramSocket socket, Client client,String operation){
        this.datagramSocket = socket;
        this.client = client;
        this.operation = operation;
    }
    @Override
    public void run() {
        System.out.println("Send ... ");
        String msg=null;
        byte[] tampon;

            System.out.println("DESTINATAIRE : ");
            String destinataire = clavier.nextLine();
            do {
                tampon = new byte[1024];
                msg = clavier.nextLine();
                try {
                    tampon =(operation+"|"+destinataire+"|"+client.username+"|"+msg).getBytes();
                    DatagramPacket packet = new DatagramPacket(tampon,tampon.length, InetAddress.getByName("localhost"),1234);
                    datagramSocket.send(packet);
                    System.out.println("SEND ....");
                    //datagramSocket.close();
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }while(msg!=null);
    }
}

Thread recieve:

package org.example.Client;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class Recieve extends Thread{
    DatagramSocket datagramSocket;

    public Recieve(DatagramSocket socket){
        this.datagramSocket=socket;
    }

    @Override
    public void run() {
        System.out.println("Recieve ...,");
        while (true){
            byte[] tampon = new byte[1024];
            DatagramPacket packet = new DatagramPacket(tampon,tampon.length);
            try {
                datagramSocket.receive(packet);
                System.out.println("RECIEVE .....");
                System.out.println("REcieve || "+packet.getPort()+ " || "+new String(packet.getData()));
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}

Client:

package org.example.Client;

import org.example.ConnexionDb.ConnexionDb;
import org.example.GUI.ConnexionForm;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.util.Scanner;

public class Client {
    String username;
    public DatagramSocket datagramSocket;

    public Client(String username){
        this.username = username;
        try {
            datagramSocket = new DatagramSocket();
        } catch (SocketException e) {
            throw new RuntimeException(e);
        }
    }

    public static void main(String[] args) throws Exception{
        Scanner clavier = new Scanner(System.in);
        //new ConnexionForm();
        System.out.println("Connexion Nouveau Utilisateur: ");

        //Connection à la base de données:
        ConnexionDb connexionDb = new ConnexionDb();
        boolean isConnected = false;
        while (!isConnected){
            System.out.println("Username: ");
            String username = clavier.nextLine();
            System.out.println("Password: ");
            String password = clavier.nextLine();
            if(connexionDb.connexionUtilisateur(username,password)==1){
                System.out.println("Connexion avec succé");
                Client client = new Client(username);
                DatagramSocket socket = new DatagramSocket();
                byte[] tampon = ("1|"+client.username).getBytes();
                DatagramPacket packet = new DatagramPacket(tampon,tampon.length, InetAddress.getByName("localhost"),1234);
                socket.send(packet);
                socket.close();
                System.out.println("1- Envoyer un message\n" +
                        "2- Les utilisateurs connectés");

                String choix = clavier.nextLine();
                isConnected = true;
                switch (choix){
                    case "1":
                        //Client client = new Client(username);
                        //DatagramSocket socket = new DatagramSocket();
                        Send send = new Send(client.datagramSocket, client,"2");
                        send.start();
                        Recieve recieve = new Recieve(client.datagramSocket);
                        recieve.start();
                        break;
                    case "2":
                        break;

                }
            }
            else {
                System.out.println("Vérifier vos informations et réassayer.");
            }
        }
    }
}

Server:

package org.example.Serveur;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.util.ArrayList;

public class Serveur extends Thread{
    DatagramSocket datagramSocketClient;
    DatagramSocket datagramSocketServer;
    int port;
    byte[] tampon;
    ArrayList<ConnectedUsers> connectedUsers = new ArrayList<>();

    public Serveur(int port){
        this.port = port;
    }

    @Override
    public void run() {
        System.out.println("Serveur ... ");
        while(true){
            try {
                datagramSocketServer = new DatagramSocket(port);
                tampon = new byte[1024];
                DatagramPacket packet = new DatagramPacket(tampon, tampon.length);
                datagramSocketServer.receive(packet);
                System.out.println("Message recu : " + packet.getPort() + " || " + new String(packet.getData()));
                datagramSocketServer.close();
                String[] recieved = (new String(packet.getData(),0,tampon.length).trim()).split("[|]");
                System.out.println("apres close: " + packet.getPort());
                datagramSocketClient = new DatagramSocket();
                InetAddress inetAddress = InetAddress.getByName("localhost");
                switch (recieved[0]){
                    case "1":
                        connectedUsers.add(new ConnectedUsers(recieved[1],packet.getPort(),packet.getAddress()));
                        System.out.println("New USER CONNECTED "+recieved[1]);
                        break;
                    case "2":
                        System.out.println("FROM-->"+recieved[2]+" To-->"+recieved[1]+" ::: "+recieved[3]);
                        int port = 0;
                        InetAddress inetAddress1 = null;
                        for(int i=0; i<connectedUsers.size();i++){
                            if(connectedUsers.get(i).username.equals(recieved[1])){
                                port = connectedUsers.get(i).port;
                                inetAddress1 = connectedUsers.get(i).inetAddress;
                            }
                        }
                        tampon = (recieved[2]+" :::: "+recieved[3]).getBytes();
                        DatagramPacket packet1 = new DatagramPacket(tampon,tampon.length,inetAddress1,port);
                        datagramSocketClient.send(packet1);
                        System.out.println("Envoyé au destinataire::: ");
                        break;
                }
                //DatagramPacket packet1 = new DatagramPacket(tampon, tampon.length,inetAddress,destPort);
                datagramSocketClient.close();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }

    public static void main(String[] args) {
        Serveur serveur = new Serveur(1234);
        serveur.start();
    }

    public class ConnectedUsers{
        int port;
        InetAddress inetAddress;
        String username;

        public ConnectedUsers(String username, int port, InetAddress inetAddress){
            this.port = port;
            this.username = username;
            this.inetAddress = inetAddress;
        }
    }
}

Server works good.
The problem is on client: when I run Client, I authenticate client
the problem is here
recieve don't let send to finish.
I want to have possibility to send message and recieve without block between those two threads.

Thread send = new Send(client.datagramSocket, client,"2");
send.start();
Thread recieve = new Recieve(client.datagramSocket);
recieve.start();


问:
R: Script plots open up in new window
Instead of being charged in the plot pane, plots now open in a new window
this does not happen with Rmd files

How can i set the plots to open in the plot pane next to the code instead of a new tab?

general options are like this

I've tried this

options(device = "RStudioGD")
plot(DNase$conc, DNase$density)
Error in .Call("rs_createGD") :
C symbol name "rs_createGD" not in load table
getOption("device")
[1] "RStudioGD"
dev.off()
Error in dev.off() : cannot shut down device 1 (the null device)

Title: R: Script plots open up in new window


问:
Variable Sites in Alignment using Python
```<code>from Bio import AlignIO
from Bio.Seq import Seq
from Bio.Align import MultipleSeqAlignment
from Bio.SeqRecord import SeqRecord

counter = 0
Sitesofvariation = []

for i in range(0,len(alig[0])):
        s = alig[:,i]
        if s == len(s) * s[0]:
            counter += 1
            Sitesofvariation.append(i+1)
</code>```

Will this work to help me find the sites of variation in my genome alignment?

Body:
from Bio import AlignIO
from Bio.Seq import Seq
from Bio.Align import MultipleSeqAlignment
from Bio.SeqRecord import SeqRecord

counter = 0
Sitesofvariation = []

for i in range(0,len(alig[0])):
        s = alig[:,i]
        if s == len(s) * s[0]:
            counter += 1
            Sitesofvariation.append(i+1)

Will this work to help me find the sites of variation in my genome alignment?


问:
Imported Material in Unity looks grayish
I have imported a Tree asset from asset store into my Unity project. There's a problem that its Material looks partially grayish. This is also true in the Unity Editor. However, when I import the same asset into a new project, everything works. So it's not a problem of the asset, but rather something in my project.

The material is used for leaves. I have noticed that when you move around the tree, even in the Editor, it changes what parts are grey and what are green. I suspect this has something to do with lightning. I have never used advanced lightning, baking etc... Both projects use default built-in render pipeline.

I tried deleting caches and resetting the light, but it didn't help.


问:
<Box> Element causing overflows on smaller screens, even though it does not reach the end of the screen. Material UI React & Webpack
On smaller screens my react box component makes the screen "expand" on the right side, and this causes the navbar to expand, and also horizontal scroll to appear, I have attached my return code, and also a few screenshots that may help.

My element

```<code>    return (
    <div>
        {/* Name "input" panel */}
        <Container>
            <Box
                sx={{
                    maxWidth: { xs: 350, sm: 480, md: 600, lg: 800},
                    borderWidth: 15,
                    borderStyle: 'solid',
                    borderColor: 'background.paper',
                    borderRadius: 4,
                    boxShadow: 8,
                    backgroundColor: 'background.paper',
                    '&:hover': {
                        backgroundColor: 'background.paper',
                        opacity: [0.98, 0.93, 0.9],
                    },
                }}
            >
                <Typography variant="h4" sx={{fontWeight: 700}}>Enter the name you'd like to look up </Typography>

                <FormControl sx={{ m: 2, width: '26ch' }} variant="outlined">
                    <OutlinedInput id="filled-basic" type="text" label="VinuPay Name" variant="filled" sx={{paddingBottom: 2}}  error={!isValid} onChange={(event) => {checkNameValidity(event.target.value)}} endAdornment={<InputAdornment position="end">.vinu</InputAdornment>}/>
                    <InputLabel htmlFor="filled-adornment-amount">VinuPay Name</InputLabel>
                    <Typography variant="h6" display={reasonId === undefined ? "none" : "block"} color={isValid ? "#1eff18" : "#ff0000"}>{isValid ? "Looking good!" : reason}</Typography>
                </FormControl>
                <br/>
                <LoadingButton
                    onClick={() => {lookupName()}}
                    endIcon={<SearchRoundedIcon />}
                    loading={shouldLoad}
                    loadingPosition="end"
                    variant="contained"
                    color="secondary" sx={{minHeight: 50, minWidth: 120}}
                    disabled={!isValid || name === ''}
                >
                    Look up
                </LoadingButton>
                <Typography variant="h3" sx={{fontWeight: 800, paddingTop : 5}}>Vinu<Typography display="inline" variant="h3" sx={{fontWeight: 800, color: '#006aff'}}>Pay </Typography></Typography>
                <Typography variant="h5" sx={{fontWeight: 700, mt: 5}} color="error">NOTICE: The displaying of the result of the lookup will most likely be changed in future versions. Happy to hear your feedback :) </Typography>
            </Box>

        </Container>

        {/* Name "output" panel */}
        <Container sx={{paddingTop: 3}}>
            {nameData !== null? <NamePanel name={nameData.name} nameId={nameData.nameId} owner={nameData.ownerAddress} isVerified={name.isTrusted}  canManage={false} style={{paddingTop: 5}}/> : ''}
        </Container>
    </div>
)
</code>```

Some screenshots of the issue:

As you see on the "right side" of the view, the different grey colour appears, and that is the place where the element overflows.

You can view the issue here: https://dev.vinu.cash/nameLookup (visible on mobile devices, on chrome selecting Galaxy S8+ (360x740) device to view on also shows the issue.

Body:
On smaller screens my react box component makes the screen "expand" on the right side, and this causes the navbar to expand, and also horizontal scroll to appear, I have attached my return code, and also a few screenshots that may help.

My element

    return (

        {/* Name "input" panel */}
        <Container>
            <Box
                sx={{
                    maxWidth: { xs: 350, sm: 480, md: 600, lg: 800},
                    borderWidth: 15,
                    borderStyle: 'solid',
                    borderColor: 'background.paper',
                    borderRadius: 4,
                    boxShadow: 8,
                    backgroundColor: 'background.paper',
                    '&:hover': {
                        backgroundColor: 'background.paper',
                        opacity: [0.98, 0.93, 0.9],
                    },
                }}
            >
                <Typography variant="h4" sx={{fontWeight: 700}}>Enter the name you'd like to look up </Typography>

                <FormControl sx={{ m: 2, width: '26ch' }} variant="outlined">
                    <OutlinedInput id="filled-basic" type="text" label="VinuPay Name" variant="filled" sx={{paddingBottom: 2}}  error={!isValid} onChange={(event) => {checkNameValidity(event.target.value)}} endAdornment={<InputAdornment position="end">.vinu</InputAdornment>}/>
                    <InputLabel htmlFor="filled-adornment-amount">VinuPay Name</InputLabel>
                    <Typography variant="h6" display={reasonId === undefined ? "none" : "block"} color={isValid ? "#1eff18" : "#ff0000"}>{isValid ? "Looking good!" : reason}</Typography>
                </FormControl>

                <LoadingButton
                    onClick={() => {lookupName()}}
                    endIcon={<SearchRoundedIcon />}
                    loading={shouldLoad}
                    loadingPosition="end"
                    variant="contained"
                    color="secondary" sx={{minHeight: 50, minWidth: 120}}
                    disabled={!isValid || name === ''}
                >
                    Look up
                </LoadingButton>
                <Typography variant="h3" sx={{fontWeight: 800, paddingTop : 5}}>Vinu<Typography display="inline" variant="h3" sx={{fontWeight: 800, color: '#006aff'}}>Pay </Typography></Typography>
                <Typography variant="h5" sx={{fontWeight: 700, mt: 5}} color="error">NOTICE: The displaying of the result of the lookup will most likely be changed in future versions. Happy to hear your feedback :) </Typography>
            </Box>

        </Container>

        {/* Name "output" panel */}
        <Container sx={{paddingTop: 3}}>
            {nameData !== null? <NamePanel name={nameData.name} nameId={nameData.nameId} owner={nameData.ownerAddress} isVerified={name.isTrusted}  canManage={false} style={{paddingTop: 5}}/> : ''}
        </Container>

)

Some screenshots of the issue:

As you see on the "right side" of the view, the different grey colour appears, and that is the place where the element overflows.

You can view the issue here: https://dev.vinu.cash/nameLookup (visible on mobile devices, on chrome selecting Galaxy S8+ (360x740) device to view on also shows the issue.


问:
Any work around for the overflow in asciim and asciin variables?
I am trying to solve the leetcode anagram problem using unicode the only problem is that I am failing the last testcase due to the size of the thing. It's causing a overflow, I tried to reset the the variable using if statement it still fails. Do you guys know of anywork arounds.

```<code>class Solution  {
public:

bool isAnagram(string s, string t) {

        int ascii1 = 0;
        int ascii2 = 0;
        long asciim = 1;
        long asciin = 1;
        int add1 = 0;
        int add2 = 0;

        for (int i = 0; i < s.length(); i++) {
            loop1:
            ascii1 = int(s[i]) - 95;
            add1 += ascii1;
            asciim *= ascii1;
            if (asciim > 100000000000000) {
                asciim = 1;
                goto loop1;
            }
        }

        for (int i = 0; i < t.length(); i++) {
            loop2:
            ascii2 = int(t[i]) - 95;
            add2 += ascii2;
            asciin *= ascii2;
            if (asciin > 100000000000000){
                asciin = 1;
                goto loop2;
            }
        }

        if (add1 == add2 && asciim == asciin) {
            return true;
        } else{ return false; }
    }
};
</code>```

I tried to reset the the variable using an if statement it still fails.

Body:
I am trying to solve the leetcode anagram problem using unicode the only problem is that I am failing the last testcase due to the size of the thing. It's causing a overflow, I tried to reset the the variable using if statement it still fails. Do you guys know of anywork arounds.

class Solution  {
public:

bool isAnagram(string s, string t) {

        int ascii1 = 0;
        int ascii2 = 0;
        long asciim = 1;
        long asciin = 1;
        int add1 = 0;
        int add2 = 0;

        for (int i = 0; i < s.length(); i++) {
            loop1:
            ascii1 = int(s[i]) - 95;
            add1 += ascii1;
            asciim *= ascii1;
            if (asciim > 100000000000000) {
                asciim = 1;
                goto loop1;
            }
        }

        for (int i = 0; i < t.length(); i++) {
            loop2:
            ascii2 = int(t[i]) - 95;
            add2 += ascii2;
            asciin *= ascii2;
            if (asciin > 100000000000000){
                asciin = 1;
                goto loop2;
            }
        }

        if (add1 == add2 && asciim == asciin) {
            return true;
        } else{ return false; }
    }
};

I tried to reset the the variable using an if statement it still fails.


问:
Date comparison logic not working in python pandas
I have a dataframe df which has a column named "PKUP_DTT" and it has dates in the format of DateTime (e.g, 2022-12-31 23:58:00)

Below code tries to see if there is a specific date which is present in the "PKUP_DTT" column, but due to some reasons its not executing the if block even though the condition is true

```<code>for i,r in df.iterrows():
    if (r['PKUP_DTT'] == '2022-12-31 23:58:00'):
        print("yes")
    else:
        print("No")

Output : No
Expected Output : yes
</code>```

Body:
I have a dataframe df which has a column named "PKUP_DTT" and it has dates in the format of DateTime (e.g, 2022-12-31 23:58:00)

Below code tries to see if there is a specific date which is present in the "PKUP_DTT" column, but due to some reasons its not executing the if block even though the condition is true

for i,r in df.iterrows():
    if (r['PKUP_DTT'] == '2022-12-31 23:58:00'):
        print("yes")
    else:
        print("No")

Output : No
Expected Output : yes


问:
How to assign valid coredata to zoo object RESET Test
I am doing a SUR regression on several airline stocks and COVID Data. Everything works perfectly fine - however the reset test now shows an error message:

The dataset contains:
Stock Return, Index Return, Oilprice Return, Covid searches Worldwide, Covid searches with airline name
and looks like this:
enter image description here

Regression looks like this:
enter image description here

```<code>Error in `coredata<-.zoo`(`*tmp*`, value = `*vtmp*`) :
  “value” : attempt to assign invalid coredata to zoo object
</code>```

Hence the scope of my work I start by plotting the residuals before I do the RESET-Test. Code looks like this:

```<code>x11()
regline1 = lm(EASYReturn ~ INDEXReturn+BRENTReturn+COVIDReturn+EASYCovid)
plot(EASYReturn ~ INDEXReturn+BRENTReturn+COVIDReturn+EASYCovid)
abline(regline1)

resettest(regline1,power=2,type="regressor")
</code>```

I am using
R-Version 2022.12.0+353 (2022.12.0+353)
on macOS 12.6.2

I did not purposely change something in the data - before i deleted one of ten regressions the test went without any problem

Body:
I am doing a SUR regression on several airline stocks and COVID Data. Everything works perfectly fine - however the reset test now shows an error message:

The dataset contains:
Stock Return, Index Return, Oilprice Return, Covid searches Worldwide, Covid searches with airline name
and looks like this:
enter image description here

Regression looks like this:
enter image description here

Error in `coredata<-.zoo`(`*tmp*`, value = `*vtmp*`) :
  “value” : attempt to assign invalid coredata to zoo object

Hence the scope of my work I start by plotting the residuals before I do the RESET-Test. Code looks like this:

x11()
regline1 = lm(EASYReturn ~ INDEXReturn+BRENTReturn+COVIDReturn+EASYCovid)
plot(EASYReturn ~ INDEXReturn+BRENTReturn+COVIDReturn+EASYCovid)
abline(regline1)

resettest(regline1,power=2,type="regressor")

I am using
R-Version 2022.12.0+353 (2022.12.0+353)
on macOS 12.6.2

I did not purposely change something in the data - before i deleted one of ten regressions the test went without any problem


问:
How to fix exec /bin/sh: exec format error in Azure?
I build and pushed IoT Edge solution, it was built successfuly,  modules reported by device (rpi3), but Azure gives me these errors

exec /bin/sh: exec format error

another custom module gives me this error as well

exec /usr/local/bin/python3: exec format error

Dockerfile 1:

```<code>FROM python:3.7-slim

RUN pip install -U pip
RUN pip install --no-cache-dir numpy~=1.17.5 tensorflow~=2.0.2 flask~=2.1.2 pillow~=7.2.0 protobuf~=3.20.0
RUN pip install --no-cache-dir mscviplib==2.200731.16

COPY app /app

EXPOSE 80

WORKDIR /app

CMD python -u app.py
</code>```

Dockerfile 2:

```<code>FROM amd64/python:3.7-slim-buster

WORKDIR /app

ADD ./test_image.jpg .

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

COPY . .

CMD [ "python3", "-u", "./main.py" ]
</code>```

Any thoughts on how to resolve these? I'm new to docker.

Body:
I build and pushed IoT Edge solution, it was built successfuly,  modules reported by device (rpi3), but Azure gives me these errors

exec /bin/sh: exec format error

another custom module gives me this error as well

exec /usr/local/bin/python3: exec format error

Dockerfile 1:

FROM python:3.7-slim

RUN pip install -U pip
RUN pip install --no-cache-dir numpy~=1.17.5 tensorflow~=2.0.2 flask~=2.1.2 pillow~=7.2.0 protobuf~=3.20.0
RUN pip install --no-cache-dir mscviplib==2.200731.16

COPY app /app

EXPOSE 80

WORKDIR /app

CMD python -u app.py

Dockerfile 2:

FROM amd64/python:3.7-slim-buster

WORKDIR /app

ADD ./test_image.jpg .

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

COPY . .

CMD [ "python3", "-u", "./main.py" ]

Any thoughts on how to resolve these? I'm new to docker.