问:
How to restrict image size using frame while init in SwiftUI?
I am having one init method where I am passing Image but I want to restrict its frame but I am not able to set it inside init as it's giving error.

```<code>public init(destinationImage: Image?) {
        self.destinationImage = Image(systemName: "square.and.arrow.down").resizable().scaledToFill() // error Cannot convert value of type 'Image' to expected argument type 'some View'
    }
</code>```

using it like

```<code> ImageHeader(headerImage: destinationImage,
                                content: {
            Text(self.title)
                .Heading2(color: .white)
        })
</code>```

Is there any way to restrict image size?

Body:
I am having one init method where I am passing Image but I want to restrict its frame but I am not able to set it inside init as it's giving error.

public init(destinationImage: Image?) {
        self.destinationImage = Image(systemName: "square.and.arrow.down").resizable().scaledToFill() // error Cannot convert value of type 'Image' to expected argument type 'some View'
    }

using it like

 ImageHeader(headerImage: destinationImage,
                                content: {
            Text(self.title)
                .Heading2(color: .white)
        })

Is there any way to restrict image size?


来源: stackexchange

问:
Unresolved plugin: 'external.atlassian.jgitflow:jgitflow-maven-plugin:1.0-m5.1'
Getting error in my project even comment out Maven plugin, still facing same issue

```<code><!--<plugin>
            <groupId>external.atlassian.jgitflow</groupId>
            <artifactId>jgitflow-maven-plugin</artifactId>
            <configuration>
                <pushReleases>true</pushReleases>
                <pushFeatures>true</pushFeatures>
                <allowSnapshots>true</allowSnapshots>
            </configuration>

            <dependencies>
                <!– required for proper handling of symlinks by jgitflow. Requirements: POSIX and Java7 –>
                <dependency>
                    <groupId>org.eclipse.jgit</groupId>
                    <artifactId>org.eclipse.jgit.java7</artifactId>
                    <!– the same as the one inside jgitflow's dependencies –>
                    <version>3.7.1.201504261725-r</version>
                </dependency>
            </dependencies>
        </plugin>-->
</code>```

ContentLicense: CC BY-SA 4.0


问:
dynamic routes file not including css after reload page using Reactjs
I am working on Reactjs an using Nexts, Whenever i click on "dynamic routes" ([slug.js]) page then its working properly but whenever we refresh that page then css not including (design issues),How can i fix this,Here is my "document.js" code

```<code>import { Html, Head, Main, NextScript } from 'next/document'
import Script from 'next/script'

export default function Document() {
  return (
    <Html>
      <Head>

        <link
          href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
          rel="stylesheet"
          integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
          crossOrigin="anonymous"
        />
        <link rel="stylesheet" type="text/css" href="css/responsive.css" />
        <link rel="stylesheet" type="text/css" href="css/style.css" />

        <link
          href="https://fonts.googleapis.com/css2?family=Dancing+Script:wght@400;500;600;700&family=Darker+Grotesque:wght@300;400&family=Poppins:wght@100;300;400;500;700&display=swap"
          rel="stylesheet"
        />
        <Script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
          integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
          crossorigin="anonymous" />

      </Head>
      <body>

        <Main />
        <NextScript />
      </body>
    </Html>
  )
}
</code>```

Here is my "_app.js" file

```<code>import "../styles/globals.css";
import "../public/Js/main.js";
import "aos/dist/aos.css";
import { useEffect } from "react";
import AOS from "aos";
import "../public/css/style.css";
import "../public/css/custom-audioplayer.css";

function MyApp({ Component, pageProps }) {
  useEffect(() => {
    AOS.init({
      disable: function () {
        var maxWidth = 800;
        return window.innerWidth < maxWidth;
      },
    });
  }, []);

  return <Component {...pageProps} /> ;
}

export default MyApp;
</code>```

Body:
I am working on Reactjs an using Nexts, Whenever i click on "dynamic routes" ([slug.js]) page then its working properly but whenever we refresh that page then css not including (design issues),How can i fix this,Here is my "document.js" code

import { Html, Head, Main, NextScript } from 'next/document'
import Script from 'next/script'

export default function Document() {
  return (

        <link
          href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
          rel="stylesheet"
          integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
          crossOrigin="anonymous"
        />
        <link rel="stylesheet" type="text/css" href="css/responsive.css" />
        <link rel="stylesheet" type="text/css" href="css/style.css" />

        <link
          href="https://fonts.googleapis.com/css2?family=Dancing+Script:wght@400;500;600;700&family=Darker+Grotesque:wght@300;400&family=Poppins:wght@100;300;400;500;700&display=swap"
          rel="stylesheet"
        />


问:
How do I generate dynamic body using the specific column in feeder using SCALA
I am using a CSV feeder which looks like this

```<code>name, hobbies, age, sex
foo, reading singing,19, Male
</code>```

I need to create a body that looks like

{

"req":[
{
"name": "foo",
"hobby": "reading",
"age": 19,
"sex": "Male"
},
{
"name": "foo",
"hobby": "singing",
"age": 19,
"sex": "Male"
}
]
}
```
<p>I need to achieve this using the CSV feeder only in SCALA.
What I have tried so far</p>
<pre class="lang-scala prettyprint-override"><code>val hobbies = """${hobbies}""".stripMargin
val template =
    """{
      |"name": ["${name}"],
      |"hobby": ["${hobby}"],
      |"age": ${age},
      |"sex" : "${sex}",
      |},""".stripMargin
var temp = ""
  hobbies.split(" ").foreach(hobby => {
        temp = temp + template
  })
  val req = temp
  val body =
    s"""{
        "req":[
        ${intents}
        ]
        }
     """.stripMargin
</code>```

And I am running the scala code as

val req = exec {
    http(SetupConstants.REQ)
      .post(s"$host${url.endpoint}")
      .headers(getHeaders())
       .body(StringBody(body))
      .check(status.is(202))
    }
```
<p>and below is the scenario code</p>
<pre class="lang-scala prettyprint-override"><code>scenario("Bulk Price Change by TPNB")
      .forever() {
          exec(commonSession(_))
          .feed(csvFeed)
          .exec(req)
          .doIf(additionalExecs.nonEmpty) {
            exec(additionalExecs)
          }
      }
</code>```

Body:
I am using a CSV feeder which looks like this

name, hobbies, age, sex
foo, reading singing,19, Male

I need to create a body that looks like

{

"req":[
{
"name": "foo",
"hobby": "reading",
"age": 19,
"sex": "Male"
},
{
"name": "foo",
"hobby": "singing",
"age": 19,
"sex": "Male"
}
]
}

I need to achieve this using the CSV feeder only in SCALA.
What I have tried so far

val hobbies = """${hobbies}""".stripMargin
val template =
    """{
      |"name": ["${name}"],
      |"hobby": ["${hobby}"],
      |"age": ${age},
      |"sex" : "${sex}",
      |},""".stripMargin
var temp = ""
  hobbies.split(" ").foreach(hobby => {
        temp = temp + template
  })
  val req = temp
  val body =
    s"""{
        "req":[
        ${intents}
        ]
        }
     """.stripMargin

And I am running the scala code as

val req = exec {
    http(SetupConstants.REQ)
      .post(s"$host${url.endpoint}")
      .headers(getHeaders())
       .body(StringBody(body))
      .check(status.is(202))
    }

and below is the scenario code

scenario("Bulk Price Change by TPNB")
      .forever() {
          exec(commonSession(_))
          .feed(csvFeed)
          .exec(req)
          .doIf(additionalExecs.nonEmpty) {
            exec(additionalExecs)
          }
      }


问:
How to verify tooltip text using Karate
How to verify tooltip text using Karate?
Upon hovering mouse over the element, tooltip text is displayed. I need to verify the tooltip text.</p>

Title: How to verify tooltip text using Karate


问:
how to extract json from a string?
a POST request comes to my server in string format, are there any simple methods for converting to JSON format, for further work with data?</p>
```<code>import json

file = "POST / HTTP/1.1\r\nHost: 11.112.19.113:5111\r\nUser-Agent: Yandex.Forms/1.0\r\nContent-Length: 187\r\nAccept: */*\r\nAccept-Encoding: gzip, deflate, br\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nX-Delivery-Id: 139195725\r\nX-Form-Answer-Id: 1278204217\r\nX-Form-Id: 63976cbbc09c022dcd6a47e3\r\n\r\n{\"jsonrpc\": \"2.0\", \"method\": \"\", \"params\": {\"message\": \"{\\\"\\u0421\\u043e\\u043e\\u0431\\u0449\\u0435\\u043d\\u0438\\u0435\\\": \\\"my test message\\\"}\", \"email\": \"jjrkl@yandex.ru\"}, \"id\": \"139195725\"}"
filename = 'test.json'

data = file.split("\n")
with open(filename, 'w') as f:
    json.dump(data, f, indent=2)
</code>```

Title: how to extract json from a string?

Body:
a POST request comes to my server in string format, are there any simple methods for converting to JSON format, for further work with data?

import json

file = "POST / HTTP/1.1\r\nHost: 11.112.19.113:5111\r\nUser-Agent: Yandex.Forms/1.0\r\nContent-Length: 187\r\nAccept: */*\r\nAccept-Encoding: gzip, deflate, br\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nX-Delivery-Id: 139195725\r\nX-Form-Answer-Id: 1278204217\r\nX-Form-Id: 63976cbbc09c022dcd6a47e3\r\n\r\n{\"jsonrpc\": \"2.0\", \"method\": \"\", \"params\": {\"message\": \"{\\\"\\u0421\\u043e\\u043e\\u0431\\u0449\\u0435\\u043d\\u0438\\u0435\\\": \\\"my test message\\\"}\", \"email\": \"jjrkl@yandex.ru\"}, \"id\": \"139195725\"}"
filename = 'test.json'

data = file.split("\n")
with open(filename, 'w') as f:
    json.dump(data, f, indent=2)


问:
Reorganise Arrays in Python
I cannot seem to figure out a performant algorithm (using numpy) to reorganise the following arrays. I have a long explicite vectors array, which I want to reorganise into a vertices array, that has all the unique points in it and an indices array that is a placeholder to rebuild the vectors with the indices of the vertices array. I need an algorithm that goes both ways.

The following example might explain it. This goes in:

```<code>vectors (Nx3x3):
[[[a.x, a.y, a.z], [b.x, b.y, b.z], [c.x, c.y, c.z]],
 [[ .... c .... ], [ .... d .... ], [ .... a .... ]],
 [[ .... b .... ], [ .... d .... ], [ .... e .... ]],...]
</code>```

And I want these to come out:

```<code>vertices (Nx3):
[[a.x, a.y, a.z],
 [b.x, b.y, b.z],
 [c.x, c.y, c.z],
 [ .... d .... ],...]

indices (Nx3):
[[0, 1, 2],
 [2, 3, 0],
 [1, 3, 4],..]
</code>```

The other way around is already working for me.

The letters are actually floats, but for easier understanding I replaced them.

I need this to load a Mesh with numpy-stl and restructure it to fit another datatype. My current implementation looks something like this:

# from vector to vertices and indices
help1 = vectors.reshape([int(m.vectors.size/3), 3])
_, indices, inverse = np.unique(help1, axis=0, return_index=True, return_inverse=True)
vertices = help1[np.sort(indices)] # this gives what I want
faces = np.zeros(help1.shape[0], dtype=int)

# this is super slow and trivial, but it gives the correct result...
for i, h1 in enumerate(help1):
    for j, v1 in enumerate(vertices):
        if np.array_equal(h1, v1):
            faces[i] = j
faces = faces.reshape(int(faces.shape[0]/3), 3)
```
<p>The other way is already working, but just for clarification, here it is:</p>
```# from vertices and indices to vector
m = mesh.Mesh(np.zeros(len(faces), dtype=mesh.Mesh.dtype))

for i, face in enumerate(faces):
    for j in range(3)
        m.vectors[i,j] = vertices[face[f],:]
```

The thing is, that numpy.unique sorts the vertices array, which makes things out of order. But I cannot use panda.unique (I think) because it wouldnt work with numpy-stl.

Thanks for your help.

Title: Reorganise Arrays in Python

Body:
I cannot seem to figure out a performant algorithm (using numpy) to reorganise the following arrays. I have a long explicite vectors array, which I want to reorganise into a vertices array, that has all the unique points in it and an indices array that is a placeholder to rebuild the vectors with the indices of the vertices array. I need an algorithm that goes both ways.

The following example might explain it. This goes in:

vectors (Nx3x3):
[[[a.x, a.y, a.z], [b.x, b.y, b.z], [c.x, c.y, c.z]],
 [[ .... c .... ], [ .... d .... ], [ .... a .... ]],
 [[ .... b .... ], [ .... d .... ], [ .... e .... ]],...]

And I want these to come out:

vertices (Nx3):
[[a.x, a.y, a.z],
 [b.x, b.y, b.z],
 [c.x, c.y, c.z],
 [ .... d .... ],...]

indices (Nx3):
[[0, 1, 2],
 [2, 3, 0],
 [1, 3, 4],..]

The other way around is already working for me.

The letters are actually floats, but for easier understanding I replaced them.

I need this to load a Mesh with numpy-stl and restructure it to fit another datatype. My current implementation looks something like this:

# from vector to vertices and indices
help1 = vectors.reshape([int(m.vectors.size/3), 3])
_, indices, inverse = np.unique(help1, axis=0, return_index=True, return_inverse=True)
vertices = help1[np.sort(indices)] # this gives what I want
faces = np.zeros(help1.shape[0], dtype=int)

# this is super slow and trivial, but it gives the correct result...
for i, h1 in enumerate(help1):
    for j, v1 in enumerate(vertices):
        if np.array_equal(h1, v1):
            faces[i] = j
faces = faces.reshape(int(faces.shape[0]/3), 3)

The other way is already working, but just for clarification, here it is:

# from vertices and indices to vector
m = mesh.Mesh(np.zeros(len(faces), dtype=mesh.Mesh.dtype))

for i, face in enumerate(faces):
    for j in range(3)
        m.vectors[i,j] = vertices[face[f],:]

The thing is, that numpy.unique sorts the vertices array, which makes things out of order. But I cannot use panda.unique (I think) because it wouldnt work with numpy-stl.

Thanks for your help.


问:
How to index to a particular commit without touching HEAD or any other ref?
Basically, I'm looking for the opposite of git reset --soft - ideally a plumbing command.

I need to modify a particular index file (set via GIT_INDEX_FILE) to point to a specific commit, without altering any ref like HEAD (or anything else).

Is there a command that can modify an index in this manner? How can I achieve this?


问:
Get scaled coordinate of webcam capture
I want to implement a website with webcam video capture and get the coordinates when user clicked on a point on the capture.

But since webcam resolution is different and I also want a static dimension (720px * 480px)  of the video element.

How can I do this?

e.g. Video element with 720px width and 480 height, with 1920 x 1080p camera.

Expect: I click on 720*480 video element, return with x, y coordinate corresponding in 1920 * 1080 dimension

Title: Get scaled coordinate of webcam capture


问:
I try to parse internal network webpage using by beautifulsoup library but didn't same like html
I'd like to make an auto login program in internal network website.

So, I try to parse that site using requests and Beautifulsoup library.

It works...and I get some html alot shorter than that site's html.

what's the problem? maybe security issue?..

pleas help me.

```<code>import requests
from bs4 import BeautifulSoup as bs

page = requests.get("http://test.com")
soup = bs(page.text, "html.parse")
print(soup) # I get some html alot shorter than that site's html
</code>```

Body:
I'd like to make an auto login program in internal network website.

So, I try to parse that site using requests and Beautifulsoup library.

It works...and I get some html alot shorter than that site's html.

what's the problem? maybe security issue?..

pleas help me.

import requests
from bs4 import BeautifulSoup as bs

page = requests.get("http://test.com")
soup = bs(page.text, "html.parse")
print(soup) # I get some html alot shorter than that site's html


问:
Don't Able To Download Video using ytdl-core, express and nextjs
I am trying to download youtube video using ytdl-core. I made simple express server for backend and made frontend UI with nextjs. From my nextjs app, I made a post request to express server using axios.

```<code>Axios.post("http://localhost:3030/ytdonwload", {url : url}).then((response)=>{
            fileDownload(response.data, `video.mp4`);
})
</code>```

In express server, I receive youtube url from req.body and send response like this.

```<code>app.post("/ytdonwload",(req, res)=>{
    res.header('Content-Disposition', 'attachment; filename="video.mp4"');
    ytdl(req.body.url).pipe(res)
})
</code>```

To download file in frontend, I used js-file-download. The video is downloaded but it's not playable.

I really don't have idea what to do.

Body:
I am trying to download youtube video using ytdl-core. I made simple express server for backend and made frontend UI with nextjs. From my nextjs app, I made a post request to express server using axios.

Axios.post("http://localhost:3030/ytdonwload", {url : url}).then((response)=>{
            fileDownload(response.data, `video.mp4`);
})

In express server, I receive youtube url from req.body and send response like this.

app.post("/ytdonwload",(req, res)=>{
    res.header('Content-Disposition', 'attachment; filename="video.mp4"');
    ytdl(req.body.url).pipe(res)
})

To download file in frontend, I used js-file-download. The video is downloaded but it's not playable.

I really don't have idea what to do.


问:
how to add divider to NavigationRail in flutter
I need to add a divider between each NavigationRailDestination.
inside  NavigationRail there is destinations where we add NavigationRailDestination.

it's only accept children from the type NavigationRailDestination.

I tried to do it in this way but it's not what I wanted, there are unnecessary padding I can't get ride of it and it's do actions when I click on it

Here is my code:

```<code> NavigationRail(
  backgroundColor: customTheme.card,
  leading: IconButton(
      onPressed: () => Navigator.of(context).pop(),
      icon: Icon(
        FeatherIcons.chevronLeft,
        size: 20,
        color: theme.colorScheme.onBackground,
      )),
  selectedIndex: _selectedIndex,
  onDestinationSelected: (int index) {
    setState(() {
      _selectedIndex = index;
      controller.animateToPage(index,
          duration: const Duration(milliseconds: 250),
          curve: Curves.easeInOut);
    });
  },
  labelType: NavigationRailLabelType.selected,
  /*------------- Build Tabs -------------------*/
  destinations: [
    NavigationRailDestination(
      icon: const Icon(Icons.dashboard),
      selectedIcon: const Icon(Icons.dashboard),
      label: FxText.titleSmall('Dashboard',
          fontWeight: 500, color: theme.colorScheme.primary),
    ),
    NavigationRailDestination(
      icon: Divider(color: Colors.black),
      selectedIcon: Divider(color: Colors.black),
      label: FxText.titleSmall('',
          fontWeight: 100, color: theme.colorScheme.primary),
      padding:EdgeInsets.only(top:1,left: 10,right:10,bottom: 1)
    ),

    NavigationRailDestination(
      icon: const Icon(Icons.tour),
      selectedIcon: const Icon(Icons.tour),
      label: FxText.titleSmall('Tours',
          fontWeight: 600, color: theme.colorScheme.primary),
    ),
    NavigationRailDestination(
      icon: const Icon(Icons.flight),
      selectedIcon: const Icon(Icons.flight),
      label: FxText.titleSmall('Flights',
          fontWeight: 600, color: theme.colorScheme.primary),
    ),

    NavigationRailDestination(
      icon: const Icon(Icons.hotel),
      selectedIcon: const Icon(Icons.hotel),
      label: FxText.titleSmall('Hotels',
          fontWeight: 600, color: theme.colorScheme.primary),
    ),

    NavigationRailDestination(
        icon: Divider(color: Colors.black),
        selectedIcon: Divider(color: Colors.black),
        label: FxText.titleSmall('',
            fontWeight: 100, color: theme.colorScheme.primary),
        padding:EdgeInsets.only(top:1,left: 10,right:10,bottom: 1)
    ),
    NavigationRailDestination(
      icon: const Icon(Icons.payment),
      selectedIcon: const Icon(Icons.payment),
      label: FxText.titleSmall('Payments',
          fontWeight: 600, color: theme.colorScheme.primary),
    ),
  ],
),
</code>```

This the result I want to get but without that space between icons and the dividers:

Body:
I need to add a divider between each NavigationRailDestination.
inside  NavigationRail there is destinations where we add NavigationRailDestination.

it's only accept children from the type NavigationRailDestination.

I tried to do it in this way but it's not what I wanted, there are unnecessary padding I can't get ride of it and it's do actions when I click on it

Here is my code:

 NavigationRail(
  backgroundColor: customTheme.card,
  leading: IconButton(
      onPressed: () => Navigator.of(context).pop(),
      icon: Icon(
        FeatherIcons.chevronLeft,
        size: 20,
        color: theme.colorScheme.onBackground,
      )),
  selectedIndex: _selectedIndex,
  onDestinationSelected: (int index) {
    setState(() {
      _selectedIndex = index;
      controller.animateToPage(index,
          duration: const Duration(milliseconds: 250),
          curve: Curves.easeInOut);
    });
  },
  labelType: NavigationRailLabelType.selected,
  /*------------- Build Tabs -------------------*/
  destinations: [
    NavigationRailDestination(
      icon: const Icon(Icons.dashboard),
      selectedIcon: const Icon(Icons.dashboard),
      label: FxText.titleSmall('Dashboard',
          fontWeight: 500, color: theme.colorScheme.primary),
    ),
    NavigationRailDestination(
      icon: Divider(color: Colors.black),
      selectedIcon: Divider(color: Colors.black),
      label: FxText.titleSmall('',
          fontWeight: 100, color: theme.colorScheme.primary),
      padding:EdgeInsets.only(top:1,left: 10,right:10,bottom: 1)
    ),

    NavigationRailDestination(
      icon: const Icon(Icons.tour),
      selectedIcon: const Icon(Icons.tour),
      label: FxText.titleSmall('Tours',
          fontWeight: 600, color: theme.colorScheme.primary),
    ),
    NavigationRailDestination(
      icon: const Icon(Icons.flight),
      selectedIcon: const Icon(Icons.flight),
      label: FxText.titleSmall('Flights',
          fontWeight: 600, color: theme.colorScheme.primary),
    ),

    NavigationRailDestination(
      icon: const Icon(Icons.hotel),
      selectedIcon: const Icon(Icons.hotel),
      label: FxText.titleSmall('Hotels',
          fontWeight: 600, color: theme.colorScheme.primary),
    ),

    NavigationRailDestination(
        icon: Divider(color: Colors.black),
        selectedIcon: Divider(color: Colors.black),
        label: FxText.titleSmall('',
            fontWeight: 100, color: theme.colorScheme.primary),
        padding:EdgeInsets.only(top:1,left: 10,right:10,bottom: 1)
    ),
    NavigationRailDestination(
      icon: const Icon(Icons.payment),
      selectedIcon: const Icon(Icons.payment),
      label: FxText.titleSmall('Payments',
          fontWeight: 600, color: theme.colorScheme.primary),
    ),
  ],
),

This the result I want to get but without that space between icons and the dividers:


问:
Data Prepper Pipelines + OpenSearch Trace Analytics
I'm using the latest version of AWS OpenSearch but somehow, when I'm trying to go to the Trace analytics Dashboard it does not show the traces sent by the Data Prepper.

Manual OpenTelemetry instrumented application

Data Prepper is running in a Docker (opensearchproject/data-prepper:latest)

OpenSearch is running on the latest version

Sample Configuration

data-prepper-config.yaml

ssl: false
```
<p><code>pipelines.yaml</code></p>
<pre class="lang-yaml prettyprint-override"><code>entry-pipeline:
  delay: "100"
  source:
    otel_trace_source:
      ssl: false
  sink:
    - pipeline:
        name: "raw-pipeline"
    - pipeline:
        name: "service-map-pipeline"
raw-pipeline:
  delay: "100"
  source:
    pipeline:
      name: "entry-pipeline"
  processor:
    - otel_trace_raw:
  sink:
    - opensearch:
        hosts: [ "https://opensearch-domain" ]
        username: "admin"
        password: "admin"
        index_type: trace-analytics-raw
service-map-pipeline:
  delay: "100"
  source:
    pipeline:
      name: "entry-pipeline"
  processor:
    - service_map_stateful:
  sink:
    - opensearch:
        hosts: ["https://opensearch-domain"]
        username: "admin"
        password: "admin"
        index_type: trace-analytics-service-map
</code>```

remote-collector.yaml

...
exporters:
  otlp/data-prepper:
    endpoint: data-prepper-address:21890

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [otlp/data-prepper]
```
<p>When I try to go to the Query Workbench and run the query <code>SELECT * FROM otel-v1-apm-span</code>, I'm getting the list of received trace spans. But I'm unable to see a chart or something on the Trace Analytics Dashboard (both Traces and Services). It's just an empty dashboard.</p>
<p>I'm also getting a warning:</p>
<pre class="lang-json prettyprint-override"><code>WARN  org.opensearch.dataprepper.plugins.processor.oteltrace.OTelTraceRawProcessor - Missing trace group for SpanId: xxxxxxxxxxxx
</code>```

The traceGroupFields are also empty.

"traceGroupFields": {
  "endTime": null,
  "durationInNanos": null,
  "statusCode": null
}
```

Is there something wrong with my setup? Any help is appreciated.

Body:
I'm using the latest version of AWS OpenSearch but somehow, when I'm trying to go to the Trace analytics Dashboard it does not show the traces sent by the Data Prepper.

Manual OpenTelemetry instrumented application

Data Prepper is running in a Docker (opensearchproject/data-prepper:latest)

OpenSearch is running on the latest version

Sample Configuration

data-prepper-config.yaml

ssl: false

pipelines.yaml

entry-pipeline:
  delay: "100"
  source:
    otel_trace_source:
      ssl: false
  sink:
    - pipeline:
        name: "raw-pipeline"
    - pipeline:
        name: "service-map-pipeline"
raw-pipeline:
  delay: "100"
  source:
    pipeline:
      name: "entry-pipeline"
  processor:
    - otel_trace_raw:
  sink:
    - opensearch:
        hosts: [ "https://opensearch-domain" ]
        username: "admin"
        password: "admin"
        index_type: trace-analytics-raw
service-map-pipeline:
  delay: "100"
  source:
    pipeline:
      name: "entry-pipeline"
  processor:
    - service_map_stateful:
  sink:
    - opensearch:
        hosts: ["https://opensearch-domain"]
        username: "admin"
        password: "admin"
        index_type: trace-analytics-service-map

remote-collector.yaml

...
exporters:
  otlp/data-prepper:
    endpoint: data-prepper-address:21890

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [otlp/data-prepper]

When I try to go to the Query Workbench and run the query SELECT * FROM otel-v1-apm-span, I'm getting the list of received trace spans. But I'm unable to see a chart or something on the Trace Analytics Dashboard (both Traces and Services). It's just an empty dashboard.

I'm also getting a warning:

WARN  org.opensearch.dataprepper.plugins.processor.oteltrace.OTelTraceRawProcessor - Missing trace group for SpanId: xxxxxxxxxxxx

The traceGroupFields are also empty.

"traceGroupFields": {
  "endTime": null,
  "durationInNanos": null,
  "statusCode": null
}

Is there something wrong with my setup? Any help is appreciated.


问:
React Native android app crash on android 12 after creating a patch for "react-native-nordic-dfu"
I create a new patch using patch-package for react-native-nordic-dfu and after that my app crash without opening.

When crash the app I'm not getting any error log in metro

Reason to create a patch because react-native-nordic-dfu not supporting for Android 12.

This is the patch I added.

```<code>diff --git a/node_modules/react-native-nordic-dfu/.DS_Store b/node_modules/react-native-nordic-dfu/.DS_Store
new file mode 100644
index 0000000..e69de29
diff --git a/node_modules/react-native-nordic-dfu/android/.DS_Store b/node_modules/react-native-nordic-dfu/android/.DS_Store
new file mode 100644
index 0000000..e69de29
diff --git a/node_modules/react-native-nordic-dfu/android/build.gradle b/node_modules/react-native-nordic-dfu/android/build.gradle
index eb225b1..b9c1783 100644
--- a/node_modules/react-native-nordic-dfu/android/build.gradle
+++ b/node_modules/react-native-nordic-dfu/android/build.gradle
@@ -1,20 +1,20 @@

 buildscript {
     repositories {
-        jcenter()
+        mavenCentral()
         google()
     }

     dependencies {
-        classpath 'com.android.tools.build:gradle:3.1.4'
+        classpath 'com.android.tools.build:gradle:4.0.1'
     }
 }

 apply plugin: 'com.android.library'

-def DEFAULT_COMPILE_SDK_VERSION = 28
-def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3'
-def DEFAULT_TARGET_SDK_VERSION = 26
+def DEFAULT_COMPILE_SDK_VERSION = 31
+def DEFAULT_BUILD_TOOLS_VERSION = '31.0.0'
+def DEFAULT_TARGET_SDK_VERSION = 31

 android {
     compileSdkVersion project.hasProperty('compileSdkVersion') ? project.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
@@ -38,6 +38,5 @@ repositories {

 dependencies {
     implementation 'com.facebook.react:react-native:+'
-    implementation 'no.nordicsemi.android:dfu:1.8.0'
+    implementation 'no.nordicsemi.android:dfu:2.0.1'
 }
-
</code>```

Body:
I create a new patch using patch-package for react-native-nordic-dfu and after that my app crash without opening.

When crash the app I'm not getting any error log in metro

Reason to create a patch because react-native-nordic-dfu not supporting for Android 12.

This is the patch I added.

diff --git a/node_modules/react-native-nordic-dfu/.DS_Store b/node_modules/react-native-nordic-dfu/.DS_Store
new file mode 100644
index 0000000..e69de29
diff --git a/node_modules/react-native-nordic-dfu/android/.DS_Store b/node_modules/react-native-nordic-dfu/android/.DS_Store
new file mode 100644
index 0000000..e69de29
diff --git a/node_modules/react-native-nordic-dfu/android/build.gradle b/node_modules/react-native-nordic-dfu/android/build.gradle
index eb225b1..b9c1783 100644
--- a/node_modules/react-native-nordic-dfu/android/build.gradle
+++ b/node_modules/react-native-nordic-dfu/android/build.gradle
@@ -1,20 +1,20 @@

 buildscript {
     repositories {
-        jcenter()
+        mavenCentral()
         google()
     }

     dependencies {
-        classpath 'com.android.tools.build:gradle:3.1.4'
+        classpath 'com.android.tools.build:gradle:4.0.1'
     }
 }

 apply plugin: 'com.android.library'

-def DEFAULT_COMPILE_SDK_VERSION = 28
-def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3'
-def DEFAULT_TARGET_SDK_VERSION = 26
+def DEFAULT_COMPILE_SDK_VERSION = 31
+def DEFAULT_BUILD_TOOLS_VERSION = '31.0.0'
+def DEFAULT_TARGET_SDK_VERSION = 31

 android {
     compileSdkVersion project.hasProperty('compileSdkVersion') ? project.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
@@ -38,6 +38,5 @@ repositories {

 dependencies {
     implementation 'com.facebook.react:react-native:+'
-    implementation 'no.nordicsemi.android:dfu:1.8.0'
+    implementation 'no.nordicsemi.android:dfu:2.0.1'
 }
-


问:
Docker Clair config.yaml
with older versions of clair v2.x, it doesnt have modes like indexer, matcher or notifier.

With the latest version of calir v4.x, the config has changed.
Can anyone of you can share the example or working config.yaml?

What ever I am trying, the closet I came is getting Initialization failed error.

enter image description here

I am looking for config.yaml sample.

Title: Docker Clair config.yaml


问:
why input() is not blocking in this case?
so I have programmed a simple script that suppose to draw a shape based on an input.
as I know, input() is a blocking function which means it must wait for an input
before the code can run again.
but, it performs the next line before I even enter a value.
it makes no sense to me. why does it happen?</p>
```<code>import turtle
import time

mouse = turtle.Turtle()

x = input()

turtle.Screen()

if x == "t":
    for i in range(3):
        mouse.fd(100)
        mouse.rt(120)

elif x == "c":
    mouse.circle(100)

else:
    mouse.bk(100)

time.sleep(2)
</code>```

Body:
so I have programmed a simple script that suppose to draw a shape based on an input.
as I know, input() is a blocking function which means it must wait for an input
before the code can run again.
but, it performs the next line before I even enter a value.
it makes no sense to me. why does it happen?

import turtle
import time

mouse = turtle.Turtle()

x = input()

turtle.Screen()

if x == "t":
    for i in range(3):
        mouse.fd(100)
        mouse.rt(120)

elif x == "c":
    mouse.circle(100)

else:
    mouse.bk(100)

time.sleep(2)


问:
C# Sender and Receiver clock sync (timeToleranceInSeconds)
I am facing a below exception in C# application using .NET 4.5 framework. the server clock is 8 hours behind and for some reason I cant change the server time. I am facing this error. I am very new to dot NET, I might sound naive.

```<code>An error was discovered processing the <Security> header ---> WSE065: Creation time of the timestamp is in the future. This typically indicates lack of synchronization between sender and receiver clocks. Make sure the clocks are synchronized or use the timeToleranceInSeconds element in the microsoft.web.services3 configuration section to adjust tolerance for lack of clock synchronization.
</code>```

After some research I found that adding below lines of code might help.

```<code><configSections>
     <section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>

<microsoft.web.services3>
    <tokenIssuer>
       <ttlInSeconds value="900000" />
    </tokenIssuer>
    <security>
       <defaultTtlInSeconds value="9000000" />
      <timeToleranceInSeconds value="9000000" />
    </security>
<web.services3>
</code>```

But this has resulted in an error I dont understand. Exception in Application
I am not sure if I have to add anything in the code as well.
Thanks in advance.

Body:
I am facing a below exception in C# application using .NET 4.5 framework. the server clock is 8 hours behind and for some reason I cant change the server time. I am facing this error. I am very new to dot NET, I might sound naive.

An error was discovered processing the <Security> header ---> WSE065: Creation time of the timestamp is in the future. This typically indicates lack of synchronization between sender and receiver clocks. Make sure the clocks are synchronized or use the timeToleranceInSeconds element in the microsoft.web.services3 configuration section to adjust tolerance for lack of clock synchronization.

After some research I found that adding below lines of code might help.

<configSections>

</configSections>

<microsoft.web.services3>
    <tokenIssuer>
       <ttlInSeconds value="900000" />
    </tokenIssuer>
    <security>
       <defaultTtlInSeconds value="9000000" />
      <timeToleranceInSeconds value="9000000" />
    </security>
<web.services3>

But this has resulted in an error I dont understand. Exception in Application
I am not sure if I have to add anything in the code as well.
Thanks in advance.


问:
Loading JSON file and parsing
My input JSON (created using notebook) is as below:

```<code>{"title": "Item number - This is of no use"}
{"title": "Did you find Ram's sale application?"}
</code>```

When I load and read the JSON file and read the contents, the string becomes as below:

```<code>with open(data, 'r', encoding='utf8') as file:
        test = json.load(file)
df = pd.DataFrame.from_dict(test)
</code>```

The string becomes as below in df column: How to prevent and preserve the original contents as "Item number - This is of no use" and "Did you find Ram's sale application?"

```<code>Item number û This is of no use
Did you find RamÆs sale application?
</code>```

I tried removing double and single quotes also. But still doesn't help.

Title: Loading JSON file and parsing

Body:
My input JSON (created using notebook) is as below:

{"title": "Item number - This is of no use"}
{"title": "Did you find Ram's sale application?"}

When I load and read the JSON file and read the contents, the string becomes as below:

with open(data, 'r', encoding='utf8') as file:
        test = json.load(file)
df = pd.DataFrame.from_dict(test)

The string becomes as below in df column: How to prevent and preserve the original contents as "Item number - This is of no use" and "Did you find Ram's sale application?"

Item number û This is of no use
Did you find RamÆs sale application?

I tried removing double and single quotes also. But still doesn't help.


问:
How To Filter an Array that has an Array of Objects Inside of it In JavaScript
I have an array that contains an array and inside of that array there are several objects.

I want to filter it based on a category id that is passed to it and if any elements in the array match it would return back the filtered array.

the structure of the data is like this:

```<code>var myArr = [{
               id:"1",
               category: [{
                   id:"1",
                   name:"cat 1"
               }, {
                   id:"2",
                   name:"cat 2"
               }];
            },{
               id:"2",
               category: [{
                   id:"2",
                   name:"cat 2"
               }, {
                   id:"3",
                   name:"cat 3"
               }];
           },{
               id:"3",
               category: [{
                   id:"3",
                   name:"cat 3"
               }, {
                   id:"4",
                   name:"cat 4"
               }];
           }];
</code>```

How can I filter this array to return only the elements that have a category id that is equal to 2 for instance?

Here is my code:

```<code>  const p3 = $scope.myArr.filter(arr => {

                   return arr.category.includes("2");
                });
                console.log(p3);
</code>```

i get this error when trying the above code:

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

Body:
I have an array that contains an array and inside of that array there are several objects.

I want to filter it based on a category id that is passed to it and if any elements in the array match it would return back the filtered array.

the structure of the data is like this:

var myArr = [{
               id:"1",
               category: [{
                   id:"1",
                   name:"cat 1"
               }, {
                   id:"2",
                   name:"cat 2"
               }];
            },{
               id:"2",
               category: [{
                   id:"2",
                   name:"cat 2"
               }, {
                   id:"3",
                   name:"cat 3"
               }];
           },{
               id:"3",
               category: [{
                   id:"3",
                   name:"cat 3"
               }, {
                   id:"4",
                   name:"cat 4"
               }];
           }];

How can I filter this array to return only the elements that have a category id that is equal to 2 for instance?

Here is my code:

  const p3 = $scope.myArr.filter(arr => {

                   return arr.category.includes("2");
                });
                console.log(p3);

i get this error when trying the above code:

"TypeError: Cannot read properties of undefined (reading 'includes')"


问:
Using logical operator between mixed data (include out of range data) is there any rule for this?
recently I studied a lot of information and improvement from leetcode

Usually, I prefer & | operator than and or operator, because of short typo (not really big difference though).

But some question of leetcode using logical operator and solve the question really suprisingly method.

For example,

```<code>s = []
print(s and s[0]) # it returns []
print(s[0] and s) # it returns IndexError: list index out of range of course..
</code>```

also I tested somethings with integer and empty list like above,

```<code>a = 1
print(s and a) # it returns []
print(a and s) # it returns [] without any errors
</code>```

For this reason, I think my code written methods when using condition (i.e. if methods) with bitwise operator rather than logical operators.

I want to know,

Why above example works and how it works different results by order (a and b // b and a)

Is it problem using bitwise operator than logical operator with some conditions or handling the data (include bolean)?

If is there any rules or important things must I know, please let me know.

Thanks for your help even with the basic knowledge of Python.

Body:
recently I studied a lot of information and improvement from leetcode

Usually, I prefer & | operator than and or operator, because of short typo (not really big difference though).

But some question of leetcode using logical operator and solve the question really suprisingly method.

For example,

s = []
print(s and s[0]) # it returns []
print(s[0] and s) # it returns IndexError: list index out of range of course..

also I tested somethings with integer and empty list like above,

a = 1
print(s and a) # it returns []
print(a and s) # it returns [] without any errors

For this reason, I think my code written methods when using condition (i.e. if methods) with bitwise operator rather than logical operators.

I want to know,

Why above example works and how it works different results by order (a and b // b and a)

Is it problem using bitwise operator than logical operator with some conditions or handling the data (include bolean)?

If is there any rules or important things must I know, please let me know.

Thanks for your help even with the basic knowledge of Python.


问:
Flutter proper way to add image
im struggling in adding an image with fit size, im building a card widget with image and i can't choose which is better to just use static width and height example width: 300, height: 100 or width: MediaQuery.of(context).size.width, heigth: MediaQuery.of(context).size.height. i just want the image to show uncopped, when i use BoxFit.cover it will crop, if i use BoxFit.fill it will stretch and the image doesn't seems so good, if i use BoxFit.contain the image won't match it's parent width x height.

im afraid if the widget i build doesn't match with the image size from the api data

note: im using Get.width x Get.height here instead of MediaQuery

```<code>Container(
        margin: const EdgeInsets.fromLTRB(16, 11, 16, 0),
        width: Get.width * 0.75,
        child: Column(
          children: [
            // top card section
            Container(
              height: Get.height * 0.2,
              clipBehavior: Clip.antiAlias,
              decoration: BoxDecoration(
                borderRadius: const BorderRadius.vertical(
                  top: Radius.circular(8),
                ),
                image: DecorationImage(
                  image: imageProvider,
                  fit: BoxFit.cover,
                ),
              ),
              child: Material(
                color: Colors.transparent,
                child: InkWell(
                  onTap: () {
                    Navigator.pushNamed(context, AppRoute.tvStreaming,
                        arguments: e);
                  },
                  child: widget.isLive
                      ? Align(
                          alignment: Alignment.topLeft,
                          child: Container(
                            margin: const EdgeInsets.fromLTRB(10, 10, 0, 0),
                            padding: const EdgeInsets.fromLTRB(8, 4, 8, 4),
                            decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(40),
                              color: MyThemes.colorPink2,
                              boxShadow: const [
                                BoxShadow(
                                  offset: Offset(3, 3),
                                  spreadRadius: -3,
                                  blurRadius: 5,
                                  color: Colors.black26,
                                ),
                              ],
                            ),
                            child: Row(
                              mainAxisSize: MainAxisSize.min,
                              children: [
                                Image.asset(
                                  'assets/icons/icon-live.png',
                                  width: 16,
                                ),
                                const SizedBox(width: 4),
                                const Text(
                                  'Live',
                                  style: TextStyle(
                                    color: MyThemes.colorWhite,
                                    fontSize: 10,
                                  ),
                                ),
                              ],
                            ),
                          ),
                        )
                      : Container(),
                ),
              ),
            ),

            // bottom card section
            Container(
              width: Get.width,
              clipBehavior: Clip.antiAlias,
              decoration: const BoxDecoration(
                borderRadius: BorderRadius.vertical(
                  bottom: Radius.circular(8),
                ),
                color: MyThemes.colorDarkBlue,
              ),
              child: Material(
                color: Colors.transparent,
                child: InkWell(
                  onTap: () {
                    Navigator.pushNamed(context, AppRoute.tvDetail,
                        arguments: e);
                  },
                  child: Padding(
                    padding: const EdgeInsets.all(10),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Container(
                          width: 32,
                          height: 32,
                          margin: const EdgeInsets.only(right: 10),
                          decoration: BoxDecoration(
                            image: DecorationImage(
                              image: NetworkImage(e['avatar_url']),
                              fit: BoxFit.cover,
                            ),
                            color: Colors.white,
                            shape: BoxShape.circle,
                            border: Border.all(
                              width: 1,
                              color: MyThemes.colorPink2,
                            ),
                          ),
                        ),
                        Expanded(
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: [
                              Text(
                                e['label'],
                                style: const TextStyle(
                                  color: MyThemes.colorWhite,
                                  fontSize: 14,
                                  fontWeight: MyThemes.bold,
                                ),
                                maxLines: 1,
                              ),
                              const SizedBox(height: 4),
                              Text(
                                '${e['episode']} Episode',
                                style: TextStyle(
                                  color:
                                      MyThemes.colorWhite.withOpacity(0.4),
                                  fontSize: 12,
                                ),
                              ),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
              ),
            ),
          ],
        ),
      );
</code>```

Title: Flutter proper way to add image

Body:
im struggling in adding an image with fit size, im building a card widget with image and i can't choose which is better to just use static width and height example width: 300, height: 100 or width: MediaQuery.of(context).size.width, heigth: MediaQuery.of(context).size.height. i just want the image to show uncopped, when i use BoxFit.cover it will crop, if i use BoxFit.fill it will stretch and the image doesn't seems so good, if i use BoxFit.contain the image won't match it's parent width x height.

im afraid if the widget i build doesn't match with the image size from the api data

note: im using Get.width x Get.height here instead of MediaQuery

Container(
        margin: const EdgeInsets.fromLTRB(16, 11, 16, 0),
        width: Get.width * 0.75,
        child: Column(
          children: [
            // top card section
            Container(
              height: Get.height * 0.2,
              clipBehavior: Clip.antiAlias,
              decoration: BoxDecoration(
                borderRadius: const BorderRadius.vertical(
                  top: Radius.circular(8),
                ),
                image: DecorationImage(
                  image: imageProvider,
                  fit: BoxFit.cover,
                ),
              ),
              child: Material(
                color: Colors.transparent,
                child: InkWell(
                  onTap: () {
                    Navigator.pushNamed(context, AppRoute.tvStreaming,
                        arguments: e);
                  },
                  child: widget.isLive
                      ? Align(
                          alignment: Alignment.topLeft,
                          child: Container(
                            margin: const EdgeInsets.fromLTRB(10, 10, 0, 0),
                            padding: const EdgeInsets.fromLTRB(8, 4, 8, 4),
                            decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(40),
                              color: MyThemes.colorPink2,
                              boxShadow: const [
                                BoxShadow(
                                  offset: Offset(3, 3),
                                  spreadRadius: -3,
                                  blurRadius: 5,
                                  color: Colors.black26,
                                ),
                              ],
                            ),
                            child: Row(
                              mainAxisSize: MainAxisSize.min,
                              children: [
                                Image.asset(
                                  'assets/icons/icon-live.png',
                                  width: 16,
                                ),
                                const SizedBox(width: 4),
                                const Text(
                                  'Live',
                                  style: TextStyle(
                                    color: MyThemes.colorWhite,
                                    fontSize: 10,
                                  ),
                                ),
                              ],
                            ),
                          ),
                        )
                      : Container(),
                ),
              ),
            ),

            // bottom card section
            Container(
              width: Get.width,
              clipBehavior: Clip.antiAlias,
              decoration: const BoxDecoration(
                borderRadius: BorderRadius.vertical(
                  bottom: Radius.circular(8),
                ),
                color: MyThemes.colorDarkBlue,
              ),
              child: Material(
                color: Colors.transparent,
                child: InkWell(
                  onTap: () {
                    Navigator.pushNamed(context, AppRoute.tvDetail,
                        arguments: e);
                  },
                  child: Padding(
                    padding: const EdgeInsets.all(10),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Container(
                          width: 32,
                          height: 32,
                          margin: const EdgeInsets.only(right: 10),
                          decoration: BoxDecoration(
                            image: DecorationImage(
                              image: NetworkImage(e['avatar_url']),
                              fit: BoxFit.cover,
                            ),
                            color: Colors.white,
                            shape: BoxShape.circle,
                            border: Border.all(
                              width: 1,
                              color: MyThemes.colorPink2,
                            ),
                          ),
                        ),
                        Expanded(
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: [
                              Text(
                                e['label'],
                                style: const TextStyle(
                                  color: MyThemes.colorWhite,
                                  fontSize: 14,
                                  fontWeight: MyThemes.bold,
                                ),
                                maxLines: 1,
                              ),
                              const SizedBox(height: 4),
                              Text(
                                '${e['episode']} Episode',
                                style: TextStyle(
                                  color:
                                      MyThemes.colorWhite.withOpacity(0.4),
                                  fontSize: 12,
                                ),
                              ),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
              ),
            ),
          ],
        ),
      );


问:
React Native function return the promise in JSX
I am trying to return the value using the function. If I console the result in the function, I get the value but if I use distance, it is not working. It returns as a promise. How to fix this issue in JSX? I can't use the useState because ci_empAddressDetails will come from the loop.

```<code>import haversine from 'haversine';
import { getCurrentLocation } from 'src/utils/helpers';
 const { data, style, handleSelect, bg } = props;
    const { am_accountNo, am_advArrAmt, am_avdArrDays, c_id, p_code, amtp_lastActionTaken, cusInfo } = data;
    const { ci_customerNameUnformatted, ci_empAddressDetails } = cusInfo[0];

const distance = useMemo(async () => {
        if (!isEmpty(ci_empAddressDetails)) {
            const { value } = ci_empAddressDetails[0];
            const { ci_latitude, ci_longitude } = value[0];
            const res = await getCurrentLocation();
            const end = {
                latitude: ci_latitude,
                longitude: ci_longitude,
            };
            const result = haversine(res, end, { unit: 'mile' });
            console.log(result);
            return result;
        } else {
            return false;
        }
    }, [ci_empAddressDetails]);
</code>```

In Jsx I am returning the value

```<code><View style={{ width: '30%', justifyContent: 'flex-end', alignItems: 'flex-end' }}>
                    <Text style={[styles.linkTo, styles.labelName]}>{!isEmpty(ci_empAddressDetails) ? distance : '-'}</Text>
                </View>
</code>```

Body:
I am trying to return the value using the function. If I console the result in the function, I get the value but if I use distance, it is not working. It returns as a promise. How to fix this issue in JSX? I can't use the useState because ci_empAddressDetails will come from the loop.

import haversine from 'haversine';
import { getCurrentLocation } from 'src/utils/helpers';
 const { data, style, handleSelect, bg } = props;
    const { am_accountNo, am_advArrAmt, am_avdArrDays, c_id, p_code, amtp_lastActionTaken, cusInfo } = data;
    const { ci_customerNameUnformatted, ci_empAddressDetails } = cusInfo[0];

const distance = useMemo(async () => {
        if (!isEmpty(ci_empAddressDetails)) {
            const { value } = ci_empAddressDetails[0];
            const { ci_latitude, ci_longitude } = value[0];
            const res = await getCurrentLocation();
            const end = {
                latitude: ci_latitude,
                longitude: ci_longitude,
            };
            const result = haversine(res, end, { unit: 'mile' });
            console.log(result);
            return result;
        } else {
            return false;
        }
    }, [ci_empAddressDetails]);

In Jsx I am returning the value

<View style={{ width: '30%', justifyContent: 'flex-end', alignItems: 'flex-end' }}>
                    <Text style={[styles.linkTo, styles.labelName]}>{!isEmpty(ci_empAddressDetails) ? distance : '-'}</Text>
                </View>


问:
Relay not permitted - Microsoft365 Direct Send
I am building a C# application which has to send certain (no-reply) e-mails within my company.(Warnings, Notifications, etc. Internal addresses only)

As I have spoken to our IT manager, it is possible without any authentication, even without an existing sender address (I can give anything I want), through a protected SMTP Host, only for internal use.

He even tested it with some printer application to show me that it works.
This is also explained here (Option 2):
https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365

In my code, I get a "Relay Not Permitted" exception :

```<code>public static void Email(string htmlString, string subject, string address)
        {
            MailMessage message = new MailMessage();
            SmtpClient smtp = new SmtpClient();
            message.From = new MailAddress("sender@internal_domain.com");
            message.To.Add(new MailAddress(address));
            message.Subject = subject;
            message.IsBodyHtml = true;
            message.Body = htmlString;
            smtp.Port = 25;
            smtp.Host = "***.protection.outlook.com";
            smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
            try
            {
                smtp.Send(message);
                Console.WriteLine("E-mail Sent!");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception Message: " + ex.Message);
                if (ex.InnerException != null)
                    Console.WriteLine("Exception Inner:   " + ex.InnerException);
            }
        }
</code>```

I have changed the SMTP Host and the sender address for security purposes. The host is otherwise reachable.
The receiver's address is my own work e-mail address, given as parameter.

What should I look into?

Thanks in advance!

Body:
I am building a C# application which has to send certain (no-reply) e-mails within my company.(Warnings, Notifications, etc. Internal addresses only)

As I have spoken to our IT manager, it is possible without any authentication, even without an existing sender address (I can give anything I want), through a protected SMTP Host, only for internal use.

He even tested it with some printer application to show me that it works.
This is also explained here (Option 2):
https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365

In my code, I get a "Relay Not Permitted" exception :

public static void Email(string htmlString, string subject, string address)
        {
            MailMessage message = new MailMessage();
            SmtpClient smtp = new SmtpClient();
            message.From = new MailAddress("sender@internal_domain.com");
            message.To.Add(new MailAddress(address));
            message.Subject = subject;
            message.IsBodyHtml = true;
            message.Body = htmlString;
            smtp.Port = 25;
            smtp.Host = "***.protection.outlook.com";
            smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
            try
            {
                smtp.Send(message);
                Console.WriteLine("E-mail Sent!");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception Message: " + ex.Message);
                if (ex.InnerException != null)
                    Console.WriteLine("Exception Inner:   " + ex.InnerException);
            }
        }

I have changed the SMTP Host and the sender address for security purposes. The host is otherwise reachable.
The receiver's address is my own work e-mail address, given as parameter.

What should I look into?

Thanks in advance!


问:
unable to perform a POST (Update is not allowed for this operation)
I decided to start learning Angular (I'm on version 15.0.3) and do some CRUD.
My application is well connected to my api (I use api-platform via Symfony), the method
GetCollection() works.

On the other hand, as soon as I have finished setting up the Post() method, I get this message: Update is not allowed for this operation.
I have done various searches, but nothing has solved my problem.
Do you have an idea ?

Thanks in advance

Here is my entity

```<code>#[ORM\Entity(repositoryClass: SerieRepository::class)]
#[
    ApiResource(
        operations: [
            new Meta\GetCollection(),
            new Meta\Post(),
            new Meta\Get(
                uriTemplate: '/series/name/{name}',
                uriVariables: 'name'
            ),
            new Meta\Get(),
            new Meta\Patch(),
            new Meta\Delete()
        ],
        normalizationContext: [
            'groups' => ['series:read']
        ],
        denormalizationContext: [
            'groups' => ['series:post']
        ],
    )
]
class Serie
{
    #[
        ORM\Id,
        ORM\GeneratedValue,
        ORM\Column,
        Meta\ApiProperty(identifier: true),
        Groups(['series:read','books:read'])
    ]
    private ?int $id = null;

    #[
        ORM\Column(length: 100, unique: true),
        Groups(['series:read','series:post','books:read'])
    ]
    private ?string $name = null;

    #[
        ORM\OneToMany(mappedBy: 'serie', targetEntity: Book::class),
        Groups(['series:read'])
    ]
    private Collection $books;

    public function __construct()
    {
        $this->books = new ArrayCollection();
    }
[...]
</code>```

The service for the entity

```<code>create(serie: Serie): Observable<Serie> {
  return this.http.post<Serie>(
    'http://127.0.0.1:8000/api/series',
    serie,
    {
      headers: {'Content-Type':'application/json'},
      responseType: "json",
    }
  )
}
</code>```

And the component

```<code>export class SeriesPostComponent {
  serie: Serie;

  constructor(private _formBuilder: FormBuilder, private serieService: SerieService, private snackBar: SnackBarComponent) {
    this.serie = new Serie(0,"",[]);
  }

  nameFormGroup = this._formBuilder.group({ firstCtrl: ['', Validators.required], });

  addSerie(): void {
    this.serie.name = this.nameFormGroup.value.firstCtrl ?? '';
    this.serieService.create(this.serie as Serie).subscribe(
      data => { this.snackBar.successSnackBar(`la série < ${data.name} > à été ajouté`) },
      echec => {
        this.snackBar.errorSnackBar(echec.error.detail)
        console.log(echec);

      }
    );
  }
}
</code>```

Edit:
Put(), Get(), Delete() methods work. But still no Post()

Edit*:
I changed my service creation method to this

```<code>  create(serie: Serie): Observable<Serie> {
    return this.http.post<Serie>(
      this.seriesurl,
      {
        'name': serie.name
      },
      {
        headers: {'Content-Type':'application/json'},
        responseType: "json",
      }
    )
  }
</code>```

And it worked.
Can someone explain to me why?

Body:
I decided to start learning Angular (I'm on version 15.0.3) and do some CRUD.
My application is well connected to my api (I use api-platform via Symfony), the method
GetCollection() works.

On the other hand, as soon as I have finished setting up the Post() method, I get this message: Update is not allowed for this operation.
I have done various searches, but nothing has solved my problem.
Do you have an idea ?

Thanks in advance

Here is my entity

#[ORM\Entity(repositoryClass: SerieRepository::class)]
#[
    ApiResource(
        operations: [
            new Meta\GetCollection(),
            new Meta\Post(),
            new Meta\Get(
                uriTemplate: '/series/name/{name}',
                uriVariables: 'name'
            ),
            new Meta\Get(),
            new Meta\Patch(),
            new Meta\Delete()
        ],
        normalizationContext: [
            'groups' => ['series:read']
        ],
        denormalizationContext: [
            'groups' => ['series:post']
        ],
    )
]
class Serie
{
    #[
        ORM\Id,
        ORM\GeneratedValue,
        ORM\Column,
        Meta\ApiProperty(identifier: true),
        Groups(['series:read','books:read'])
    ]
    private ?int $id = null;

    #[
        ORM\Column(length: 100, unique: true),
        Groups(['series:read','series:post','books:read'])
    ]
    private ?string $name = null;

    #[
        ORM\OneToMany(mappedBy: 'serie', targetEntity: Book::class),
        Groups(['series:read'])
    ]
    private Collection $books;

    public function __construct()
    {
        $this->books = new ArrayCollection();
    }
[...]

The service for the entity

create(serie: Serie): Observable<Serie> {
  return this.http.post<Serie>(
    'http://127.0.0.1:8000/api/series',
    serie,
    {
      headers: {'Content-Type':'application/json'},
      responseType: "json",
    }
  )
}

And the component

export class SeriesPostComponent {
  serie: Serie;

  constructor(private _formBuilder: FormBuilder, private serieService: SerieService, private snackBar: SnackBarComponent) {
    this.serie = new Serie(0,"",[]);
  }

  nameFormGroup = this._formBuilder.group({ firstCtrl: ['', Validators.required], });

  addSerie(): void {
    this.serie.name = this.nameFormGroup.value.firstCtrl ?? '';
    this.serieService.create(this.serie as Serie).subscribe(
      data => { this.snackBar.successSnackBar(`la série < ${data.name} > à été ajouté`) },
      echec => {
        this.snackBar.errorSnackBar(echec.error.detail)
        console.log(echec);

      }
    );
  }
}

Edit:
Put(), Get(), Delete() methods work. But still no Post()

Edit*:
I changed my service creation method to this

  create(serie: Serie): Observable<Serie> {
    return this.http.post<Serie>(
      this.seriesurl,
      {
        'name': serie.name
      },
      {
        headers: {'Content-Type':'application/json'},
        responseType: "json",
      }
    )
  }

And it worked.
Can someone explain to me why?


问:
Filter specific message value in logstash
i am new to logstash.
I am trying to parse log value and applying filter on value using grok.
The log data is -
{"log":"11:20:15|INFO|config-app: Starting_thread\n","stream":"stdout","time":"2022-12-19T11:19:15.089894627Z"}

The logstash.conf is-

```<code>input {
   beats {
        port =>  5045
        host => "0.0.0.0"
    }
}
filter {
  json {
    source => "message"
    add_field => {
        "log1" => "%{log}"
    }
  }
  grok {
     match => { "%{log1}" => ['(%{TIME:time}\|%{LOGLEVEL:logLevel}\|%{USER:microservice_name}(:) %{GREEDYDATA:logMessage}'] }
  }
}
output {
    elasticsearch {
     hosts => "elasticsearch:9200"
     user => elastic
     password => yourstrongpasswordhere
     index => "pj"
     }
   stdout {}
}
</code>```

Tried running the above file but pipeline is not creating in logstash.

Body:
i am new to logstash.
I am trying to parse log value and applying filter on value using grok.
The log data is -
{"log":"11:20:15|INFO|config-app: Starting_thread\n","stream":"stdout","time":"2022-12-19T11:19:15.089894627Z"}

The logstash.conf is-

input {
   beats {
        port =>  5045
        host => "0.0.0.0"
    }
}
filter {
  json {
    source => "message"
    add_field => {
        "log1" => "%{log}"
    }
  }
  grok {
     match => { "%{log1}" => ['(%{TIME:time}\|%{LOGLEVEL:logLevel}\|%{USER:microservice_name}(:) %{GREEDYDATA:logMessage}'] }
  }
}
output {
    elasticsearch {
     hosts => "elasticsearch:9200"
     user => elastic
     password => yourstrongpasswordhere
     index => "pj"
     }
   stdout {}
}

Tried running the above file but pipeline is not creating in logstash.


问:
.Net Reactor - Excluded class is showing encrypted in calling
When we are exculding any class from Ofuscation and calling the same ina method then it is showing encrypted. How to handle those files in C#.</p>


问:
Http security header - X-Frame-Options and CSP what takes precedence?
I need to allow my web application to be iframed.

Both headers will be on the same response. This is different from How does Content-Security-Policy work with X-Frame-Options? which is referring to headers on both the parent page and the iframed page.

Currently, it has the x-frame-options set as sameorigin. I cannot modify this due to being inherited from a parent project.
However, I am able to modify the Content-Security-Policy to add a frame ancestor so I can add the option I need to allow Iframing.

My headers will look like this

```<code>Content-Security-Policy: frame-ancestors https://theHostOfMyIframe.com
X-Frame-Options: SAMEORIGIN
</code>```

My question is, will the CSP override the xframe option to allow my site to be iframed?

Body:
I need to allow my web application to be iframed.

Both headers will be on the same response. This is different from How does Content-Security-Policy work with X-Frame-Options? which is referring to headers on both the parent page and the iframed page.

Currently, it has the x-frame-options set as sameorigin. I cannot modify this due to being inherited from a parent project.
However, I am able to modify the Content-Security-Policy to add a frame ancestor so I can add the option I need to allow Iframing.

My headers will look like this

Content-Security-Policy: frame-ancestors https://theHostOfMyIframe.com
X-Frame-Options: SAMEORIGIN

My question is, will the CSP override the xframe option to allow my site to be iframed?


问:
How to junit a method that returns Mono and contains WebClient
I have the following code

```<code>private final WebClient.Builder webClientBuilder;

@Autowired
public WhitepagesServiceImpl(WebClient.Builder webClientBuilder) {
  this.webClientBuilder = webClientBuilder;
}

</code>```
```<code>public Mono<String> getTwitterAvatarUrlByHandle(Mono<String> handle) {
  log.info("Reaching out to whitepages for twitter avatar");

  return handle.flatMap(h -> webClientBuilder
          .baseUrl(whitepagesBaseUrl)
          .build()
          .post()
          .uri(GET_AVATAR_URL)
          .accept(MediaType.APPLICATION_JSON)
          .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
          .body(BodyInserters.fromValue(getTwitterAvatarRequestBody(h)))
          .retrieve()
          .bodyToMono(String.class)
          .timeout(Duration.ofSeconds(whitepagesTimeout))
          .doOnSuccess(item -> log.debug("Retrieved Twitter Avatar Url {}", item))
          .doOnError(error ->
                  log.error("Failed to retrieve Twitter Avatar Url: {}", error.getMessage()))
          .onErrorResume(e -> Mono.just(""))
          .map(this::mapTwitterImageUrlFromTwitterAvatarResponse));
}
</code>```

And I want to junit of the getTwitterAvatarUrlByHandle method

I think that I need to mock the webClientBuilder but I'm not sure how to do it, or if there is another way to write the junit

Body:
I have the following code

private final WebClient.Builder webClientBuilder;

@Autowired
public WhitepagesServiceImpl(WebClient.Builder webClientBuilder) {
  this.webClientBuilder = webClientBuilder;
}

public Mono<String> getTwitterAvatarUrlByHandle(Mono<String> handle) {
  log.info("Reaching out to whitepages for twitter avatar");

  return handle.flatMap(h -> webClientBuilder
          .baseUrl(whitepagesBaseUrl)
          .build()
          .post()
          .uri(GET_AVATAR_URL)
          .accept(MediaType.APPLICATION_JSON)
          .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
          .body(BodyInserters.fromValue(getTwitterAvatarRequestBody(h)))
          .retrieve()
          .bodyToMono(String.class)
          .timeout(Duration.ofSeconds(whitepagesTimeout))
          .doOnSuccess(item -> log.debug("Retrieved Twitter Avatar Url {}", item))
          .doOnError(error ->
                  log.error("Failed to retrieve Twitter Avatar Url: {}", error.getMessage()))
          .onErrorResume(e -> Mono.just(""))
          .map(this::mapTwitterImageUrlFromTwitterAvatarResponse));
}

And I want to junit of the getTwitterAvatarUrlByHandle method

I think that I need to mock the webClientBuilder but I'm not sure how to do it, or if there is another way to write the junit


问:
MFA using auth0 in django
I need to enable authentication using Auth0 in my django app

This are things i want to achieve with auth0 in my django app

1.MFA with OTP via email

2.2FA using google authentication/authy/etc

3.SSO using google, outlook.

4.existing accounts to move over to Auth0 signin

5.Attach google authentication to current account

I have been looking but can't find proper documentation to integrate auth0 with django
can anyone help me with this?

Title: MFA using auth0 in django


问:
How to dynamically accepts user input and process the inputs and render output as a calculated count Using Flask web app
I am developing small web application which accepts user inputs and process the input values and count the output using flask this is the python which is static and already given static inputs are min(unit),max(unit) if user enter the min and max values dynamically it has to count and render as id_count. where x is array contains list of values i need to count the cycles where the min value is bilow 13 and max values is above 18 and bilow 25 in python it is running successfulyy and gives my output as count 4

```<code>x = np.array([0, 14, 9, 0, 0, 7, 0, 0, 12, 16, 15, 11, 7, 20, 24, 13, 13,
                   14, 19, 13, 12, 10, 7, 3, 3, 3, 25, 14, 14, 14, 7, 24, 20, 20,
                   21, 20, 20, 20, 20, 20, 21, 16, 11, 11, 18, 22, 22, 20, 19, 19, 18])
sub_lists = np.split(x, np.where(np.diff(x) < 0)[0] + 1)
id_count = 0
id_list = []
for unit in sub_lists:
    if min(unit) <13 and max(unit)>18 and max(unit)<26  and len(set(unit)) > 1:
        id_count += 1
        id_list.append(unit)
print(id_count)
</code>```

iam new to flask app i dont know how to approach this geeting error while reading count value as output
so far used this

```<code>import numpy as np
from flask import Flask
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def count(id_count):
    x1 = np.array([0, 14, 9, 0, 0, 7, 0, 0, 12, 16, 15, 11, 7, 20, 24, 13, 13,
                   14, 19, 13, 12, 10, 7, 3, 3, 3, 25, 14, 14, 14, 7, 24, 20, 20,
                   21, 20, 20, 20, 20, 20, 21, 16, 11, 11, 18, 22, 22, 20, 19, 19, 18])
    sub_lists = np.split(x1, np.where(np.diff(x1) < 0)[0] + 1)
    count = 0
    id_list = []
    for unit in sub_lists:
      if min(unit) < 13 and max(unit) > 18 and max(unit) <= 25 and len(set(unit)) > 1:
        count += 1
        id_list.append(unit)
        print("count is",count)
        return render_template('index.html',count=count)
if __name__ == '__main__':
   app.run(debug = True,port=8086)
</code>```

when user enters min(unit)<13 and max(unit)>18 and max(unit)<=25 it has to give the output as count value

<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Title</title>
<form action="/data" method = "POST">

enter value from 0 to 13<input type = "text" name = "Name" />

enter values from above 18 <input type = "text" name = "City" />

enter value bilow 26<input type = "text" name = "Country" />

<input type = "submit" value = "Submit" />

the acceleration count is {{count}}

</form>

```

how to approach this kindly help to this thanks in adavance

Body:
I am developing small web application which accepts user inputs and process the input values and count the output using flask this is the python which is static and already given static inputs are min(unit),max(unit) if user enter the min and max values dynamically it has to count and render as id_count. where x is array contains list of values i need to count the cycles where the min value is bilow 13 and max values is above 18 and bilow 25 in python it is running successfulyy and gives my output as count 4

x = np.array([0, 14, 9, 0, 0, 7, 0, 0, 12, 16, 15, 11, 7, 20, 24, 13, 13,
                   14, 19, 13, 12, 10, 7, 3, 3, 3, 25, 14, 14, 14, 7, 24, 20, 20,
                   21, 20, 20, 20, 20, 20, 21, 16, 11, 11, 18, 22, 22, 20, 19, 19, 18])
sub_lists = np.split(x, np.where(np.diff(x) < 0)[0] + 1)
id_count = 0
id_list = []
for unit in sub_lists:
    if min(unit) <13 and max(unit)>18 and max(unit)<26  and len(set(unit)) > 1:
        id_count += 1
        id_list.append(unit)
print(id_count)

iam new to flask app i dont know how to approach this geeting error while reading count value as output
so far used this

import numpy as np
from flask import Flask
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def count(id_count):
    x1 = np.array([0, 14, 9, 0, 0, 7, 0, 0, 12, 16, 15, 11, 7, 20, 24, 13, 13,
                   14, 19, 13, 12, 10, 7, 3, 3, 3, 25, 14, 14, 14, 7, 24, 20, 20,
                   21, 20, 20, 20, 20, 20, 21, 16, 11, 11, 18, 22, 22, 20, 19, 19, 18])
    sub_lists = np.split(x1, np.where(np.diff(x1) < 0)[0] + 1)
    count = 0
    id_list = []
    for unit in sub_lists:
      if min(unit) < 13 and max(unit) > 18 and max(unit) <= 25 and len(set(unit)) > 1:
        count += 1
        id_list.append(unit)
        print("count is",count)
        return render_template('index.html',count=count)
if __name__ == '__main__':
   app.run(debug = True,port=8086)

when user enters min(unit)<13 and max(unit)>18 and max(unit)<=25 it has to give the output as count value

<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Title</title>
<form action="/data" method = "POST">

enter value from 0 to 13<input type = "text" name = "Name" />

enter values from above 18 <input type = "text" name = "City" />

enter value bilow 26<input type = "text" name = "Country" />

<input type = "submit" value = "Submit" />

the acceleration count is {{count}}

</form>

how to approach this kindly help to this thanks in adavance


问:
Amplify studio content manager - can't delete linked many to many items
I am unable to delete many to many relationships using amplify studio's content manager.

There is an option to unlink related records. I click the "X" and it prompts me if i want to unlink the record.

Nothing happens when I click it. No error messages and the link is not deleted.

I have BodyParts and Symptoms:

```<code>type BodyPart @model @auth(rules: [{allow: private}]) {
  id: ID!
  name: String
  Symptoms: [Symptom] @manyToMany(relationName: "BodyPartSymptom")
}

type Symptom @model @auth(rules: [{allow: private}]) {
  id: ID!
  name: String!
  type: [String]
  bodyparts: [BodyPart] @manyToMany(relationName: "BodyPartSymptom")
}
</code>```

Body:
I am unable to delete many to many relationships using amplify studio's content manager.

There is an option to unlink related records. I click the "X" and it prompts me if i want to unlink the record.

Nothing happens when I click it. No error messages and the link is not deleted.

I have BodyParts and Symptoms:

type BodyPart @model @auth(rules: [{allow: private}]) {
  id: ID!
  name: String
  Symptoms: [Symptom] @manyToMany(relationName: "BodyPartSymptom")
}

type Symptom @model @auth(rules: [{allow: private}]) {
  id: ID!
  name: String!
  type: [String]
  bodyparts: [BodyPart] @manyToMany(relationName: "BodyPartSymptom")
}


问:
How to improve this Max length for content editable element code
I have the following code to limit characters in a content editable element.

$('div').on('keydown', function(event) {
  $('span').text('Total chars:' + $(this).text().length);
  if ($(this).text().length === 10 && event.keyCode != 8) {
    event.preventDefault();
  }
});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>div {
  height: 100px;
  width: 300px;
  border: 1px solid grey;
  outline: 0;
}</code>```

```

https://jsfiddle.net/ableinfosoft/pw6L9j8u/1/

Problems:

If the 10 characters are full, even the arrow keys or ctrl+A wont work.

Still able to copy paste more characters than 10.

How can I allow only numbers depending on requirement?

Body:
I have the following code to limit characters in a content editable element.

$('div').on('keydown', function(event) {
  $('span').text('Total chars:' + $(this).text().length);
  if ($(this).text().length === 10 && event.keyCode != 8) {
    event.preventDefault();
  }
});

div {
  height: 100px;
  width: 300px;
  border: 1px solid grey;
  outline: 0;
}

https://jsfiddle.net/ableinfosoft/pw6L9j8u/1/

Problems:

If the 10 characters are full, even the arrow keys or ctrl+A wont work.

Still able to copy paste more characters than 10.

How can I allow only numbers depending on requirement?


问:
testContainers Initialization Error with java.lang.InterruptedException
I am having this error running Quarkus tests with docker-compose, upgrading from Quarkus 2.4.0 to Quarkus 2.15.0, not sure why it is happening, but if anybody can shed some light it will be helpful.

It happens running integration tests, it sounds like it is timing out, so I tried to put a higher timeout value

```<code>quarkus.devservices.timeout=180
</code>```

but it did not work either.

```<code>[2022-12-19T08:55:14.576Z] > Task :score-integrationtest:test
[2022-12-19T08:55:14.576Z]     2022-12-19 08:55:12,293 WARN  [org.ecl.jet.ser.AbstractConnector] (pool-2-thread-1) Acceptors should be <= availableProcessors: NetworkTrafficServerConnector@161ff9e6{HTTP/1.1, (http/1.1, h2c)}{0.0.0.0:0}
[2022-12-19T08:55:14.576Z]     2022-12-19 08:55:12,720 INFO  [org.ecl.jet.ser.Server] (pool-2-thread-1) jetty-9.4.49.v20220914; built: 2022-09-14T01:07:36.601Z; git: 4231a3b2e4cb8548a412a789936d640a97b1aa0a; jvm 17.0.1+12-LTS
[2022-12-19T08:55:14.576Z]     2022-12-19 08:55:12,803 INFO  [org.ecl.jet.ser.han.ContextHandler] (pool-2-thread-1) Started o.e.j.s.ServletContextHandler@64f54045{/__admin,null,AVAILABLE}
[2022-12-19T08:55:14.576Z]     2022-12-19 08:55:12,848 INFO  [org.ecl.jet.ser.han.Con.ROOT] (pool-2-thread-1) RequestHandlerClass from context returned com.github.tomakehurst.wiremock.http.StubRequestHandler. Normalized mapped under returned 'null'
[2022-12-19T08:55:14.576Z]     2022-12-19 08:55:12,856 INFO  [org.ecl.jet.ser.han.ContextHandler] (pool-2-thread-1) Started o.e.j.s.ServletContextHandler@5e9f3de4{/,null,AVAILABLE}
[2022-12-19T08:55:14.576Z]     2022-12-19 08:55:12,876 INFO  [org.ecl.jet.ser.AbstractConnector] (pool-2-thread-1) Started NetworkTrafficServerConnector@161ff9e6{HTTP/1.1, (http/1.1, h2c)}{0.0.0.0:9701}
[2022-12-19T08:55:14.576Z]     2022-12-19 08:55:12,877 INFO  [org.ecl.jet.ser.Server] (pool-2-thread-1) Started @30367ms
...
[2022-12-19T08:55:16.123Z]     2022-12-19 08:55:15,908 INFO  [ .5]] (agroal-11) Creating container for image: postgres:14.5
[2022-12-19T08:55:16.423Z]     2022-12-19 08:55:16,106 INFO  [ .5]] (agroal-11) Container postgres:14.5 is starting: 3225b3d78588be4297362f627043c39b27ddf5b1dd71438e153b2b5b4d07fc29
[2022-12-19T08:55:21.997Z]     2022-12-19 08:55:20,933 ERROR [ .5]] (agroal-11) Could not start container: java.lang.RuntimeException: java.lang.InterruptedException
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.output.WaitingConsumer.waitUntil(WaitingConsumer.java:105)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.output.WaitingConsumer.waitUntil(WaitingConsumer.java:78)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy.waitUntilReady(LogMessageWaitStrategy.java:45)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:52)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.PostgreSQLContainer.waitUntilContainerStarted(PostgreSQLContainer.java:143)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:485)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:344)
[2022-12-19T08:55:21.997Z]      at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:334)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:322)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.jdbc.ContainerDatabaseDriver.connect(ContainerDatabaseDriver.java:124)
[2022-12-19T08:55:21.997Z]      at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:226)
[2022-12-19T08:55:21.997Z]      at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:535)
[2022-12-19T08:55:21.997Z]      at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:516)
[2022-12-19T08:55:21.997Z]      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[2022-12-19T08:55:21.997Z]      at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
[2022-12-19T08:55:21.997Z]      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
[2022-12-19T08:55:21.997Z]      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[2022-12-19T08:55:21.997Z]      at java.base/java.lang.Thread.run(Thread.java:833)
[2022-12-19T08:55:21.997Z]     Caused by: java.lang.InterruptedException
[2022-12-19T08:55:21.997Z]      at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1679)
[2022-12-19T08:55:21.997Z]      at java.base/java.util.concurrent.LinkedBlockingDeque.pollLast(LinkedBlockingDeque.java:533)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.output.WaitingConsumer.waitUntil(WaitingConsumer.java:85)
[2022-12-19T08:55:21.997Z]      ... 18 more
</code>```

Body:
I am having this error running Quarkus tests with docker-compose, upgrading from Quarkus 2.4.0 to Quarkus 2.15.0, not sure why it is happening, but if anybody can shed some light it will be helpful.

It happens running integration tests, it sounds like it is timing out, so I tried to put a higher timeout value

quarkus.devservices.timeout=180

but it did not work either.

[2022-12-19T08:55:14.576Z] > Task :score-integrationtest:test
[2022-12-19T08:55:14.576Z]     2022-12-19 08:55:12,293 WARN  [org.ecl.jet.ser.AbstractConnector] (pool-2-thread-1) Acceptors should be <= availableProcessors: NetworkTrafficServerConnector@161ff9e6{HTTP/1.1, (http/1.1, h2c)}{0.0.0.0:0}
[2022-12-19T08:55:14.576Z]     2022-12-19 08:55:12,720 INFO  [org.ecl.jet.ser.Server] (pool-2-thread-1) jetty-9.4.49.v20220914; built: 2022-09-14T01:07:36.601Z; git: 4231a3b2e4cb8548a412a789936d640a97b1aa0a; jvm 17.0.1+12-LTS
[2022-12-19T08:55:14.576Z]     2022-12-19 08:55:12,803 INFO  [org.ecl.jet.ser.han.ContextHandler] (pool-2-thread-1) Started o.e.j.s.ServletContextHandler@64f54045{/__admin,null,AVAILABLE}
[2022-12-19T08:55:14.576Z]     2022-12-19 08:55:12,848 INFO  [org.ecl.jet.ser.han.Con.ROOT] (pool-2-thread-1) RequestHandlerClass from context returned com.github.tomakehurst.wiremock.http.StubRequestHandler. Normalized mapped under returned 'null'
[2022-12-19T08:55:14.576Z]     2022-12-19 08:55:12,856 INFO  [org.ecl.jet.ser.han.ContextHandler] (pool-2-thread-1) Started o.e.j.s.ServletContextHandler@5e9f3de4{/,null,AVAILABLE}
[2022-12-19T08:55:14.576Z]     2022-12-19 08:55:12,876 INFO  [org.ecl.jet.ser.AbstractConnector] (pool-2-thread-1) Started NetworkTrafficServerConnector@161ff9e6{HTTP/1.1, (http/1.1, h2c)}{0.0.0.0:9701}
[2022-12-19T08:55:14.576Z]     2022-12-19 08:55:12,877 INFO  [org.ecl.jet.ser.Server] (pool-2-thread-1) Started @30367ms
...
[2022-12-19T08:55:16.123Z]     2022-12-19 08:55:15,908 INFO  [ .5]] (agroal-11) Creating container for image: postgres:14.5
[2022-12-19T08:55:16.423Z]     2022-12-19 08:55:16,106 INFO  [ .5]] (agroal-11) Container postgres:14.5 is starting: 3225b3d78588be4297362f627043c39b27ddf5b1dd71438e153b2b5b4d07fc29
[2022-12-19T08:55:21.997Z]     2022-12-19 08:55:20,933 ERROR [ .5]] (agroal-11) Could not start container: java.lang.RuntimeException: java.lang.InterruptedException
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.output.WaitingConsumer.waitUntil(WaitingConsumer.java:105)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.output.WaitingConsumer.waitUntil(WaitingConsumer.java:78)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy.waitUntilReady(LogMessageWaitStrategy.java:45)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:52)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.PostgreSQLContainer.waitUntilContainerStarted(PostgreSQLContainer.java:143)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:485)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:344)
[2022-12-19T08:55:21.997Z]      at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:334)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:322)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.jdbc.ContainerDatabaseDriver.connect(ContainerDatabaseDriver.java:124)
[2022-12-19T08:55:21.997Z]      at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:226)
[2022-12-19T08:55:21.997Z]      at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:535)
[2022-12-19T08:55:21.997Z]      at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:516)
[2022-12-19T08:55:21.997Z]      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[2022-12-19T08:55:21.997Z]      at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
[2022-12-19T08:55:21.997Z]      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
[2022-12-19T08:55:21.997Z]      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[2022-12-19T08:55:21.997Z]      at java.base/java.lang.Thread.run(Thread.java:833)
[2022-12-19T08:55:21.997Z]     Caused by: java.lang.InterruptedException
[2022-12-19T08:55:21.997Z]      at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1679)
[2022-12-19T08:55:21.997Z]      at java.base/java.util.concurrent.LinkedBlockingDeque.pollLast(LinkedBlockingDeque.java:533)
[2022-12-19T08:55:21.997Z]      at org.testcontainers.containers.output.WaitingConsumer.waitUntil(WaitingConsumer.java:85)
[2022-12-19T08:55:21.997Z]      ... 18 more


问:
What is the correct file extension for PEM-encoded SPKI strings?
I'm using the library jose to generate a public key. I'm using the function exportSPKI to convert the key object to a PEM-encoded SPKI string format. An example might be

```<code>const publicKey = `-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFlHHWfLk0gLBbsLTcuCrbCqoHqmM
YJepMC+Q+Dd6RBmBiA41evUsNMwLeN+PNFqib+xwi9JkJ8qhZkq8Y/IzGg==
-----END PUBLIC KEY-----`
</code>```

Is it a good idea to write the value of the variable into a .txt file because it's easy to read? Or should I use the .key extension? Or the .pem extension? ( I've never done this before )

Body:
I'm using the library jose to generate a public key. I'm using the function exportSPKI to convert the key object to a PEM-encoded SPKI string format. An example might be

const publicKey = `-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFlHHWfLk0gLBbsLTcuCrbCqoHqmM
YJepMC+Q+Dd6RBmBiA41evUsNMwLeN+PNFqib+xwi9JkJ8qhZkq8Y/IzGg==
-----END PUBLIC KEY-----`

Is it a good idea to write the value of the variable into a .txt file because it's easy to read? Or should I use the .key extension? Or the .pem extension? ( I've never done this before )


问:
YOLOv5 model deployment on Google Earth Engine
Recently, I work on an object detection task. I use YOLOv5 for the model and already saved the best weights that I got from model training on the custom dataset. The question is related to the deployment part. If I want to deploy this model on Google Earth Engine, what's the right way to do that?</p>