问:
prevent image drop duplication while using react dropzone?
I'm using dropzone in my Next JS app. and i'm facing an issues. one of them is i can't prevent image duplication correctly.

what is did is i created a useState() to check if element exists.

```<code>const [found, setFound] = useState(false);
</code>```

and on onDrop() method i checked if the dropped file exists in the stored files. (i haven't figured out to check duplication on multiple image drag). it works but not correctly.

```<code>const [files, setFiles] = useState([]);
 const [found, setFound] = useState(false);
 const { getRootProps, getInputProps } = useDropzone({
    accept: {
      "image/*": [],
    },

    onDrop: (acceptedFiles) => {
      acceptedFiles.filter(
        (el, idx) =>
          idx ===
          files.findIndex((elm) => elm.name === el.name && setFound(true))
      );
      if (!found) {
        setFiles((prev) => [
          ...prev,
          ...acceptedFiles.map((file) =>
            Object.assign(file, {
              preview: URL.createObjectURL(file),
            })
          ),
        ]);
      }
    },
  });
</code>```

the issue with my code is that if i insert images and drag another duplicated image it stores that. but on the next drag it doesn't add the image, whether it is duplicated or not. if it's duplicated again then the next drag won't work either and the first drag after the duplicated drag doesn't work too. but the next non duplicate drag will work.

i think this is happening b/c the condition is checked after the drag is completed and file is added.

how can i drag and drop images correctly by not passing duplicated images in single or multiple drags?

if it's not much to ask can anyone show me to make a limitations to the images that are being dragged or inserted? limit is between 4 and 9.

Thank You in Advance

Body:
I'm using dropzone in my Next JS app. and i'm facing an issues. one of them is i can't prevent image duplication correctly.

what is did is i created a useState() to check if element exists.

const [found, setFound] = useState(false);

and on onDrop() method i checked if the dropped file exists in the stored files. (i haven't figured out to check duplication on multiple image drag). it works but not correctly.

const [files, setFiles] = useState([]);
 const [found, setFound] = useState(false);
 const { getRootProps, getInputProps } = useDropzone({
    accept: {
      "image/*": [],
    },

    onDrop: (acceptedFiles) => {
      acceptedFiles.filter(
        (el, idx) =>
          idx ===
          files.findIndex((elm) => elm.name === el.name && setFound(true))
      );
      if (!found) {
        setFiles((prev) => [
          ...prev,
          ...acceptedFiles.map((file) =>
            Object.assign(file, {
              preview: URL.createObjectURL(file),
            })
          ),
        ]);
      }
    },
  });

the issue with my code is that if i insert images and drag another duplicated image it stores that. but on the next drag it doesn't add the image, whether it is duplicated or not. if it's duplicated again then the next drag won't work either and the first drag after the duplicated drag doesn't work too. but the next non duplicate drag will work.

i think this is happening b/c the condition is checked after the drag is completed and file is added.

how can i drag and drop images correctly by not passing duplicated images in single or multiple drags?

if it's not much to ask can anyone show me to make a limitations to the images that are being dragged or inserted? limit is between 4 and 9.

Thank You in Advance


来源: stackexchange

问:
Do I need a py.typed for tests?
I'm surprised to find mypy is picking up type discrepancies between my app and tests for my app even though I don't have a py.typed. I know libraries are meant to have a py.typed to export type hints, and I would have expected tests to be treated as an app that imports the library/app as a library. So how does this work? Is this expected behaviour?

I don't know if it's relevant that I'm using poetry and running mypy with poetry run mypy tests

ContentLicense: CC BY-SA 4.0

Title: Do I need a py.typed for tests?


问:
Nesting if error and index formulas together
I am using an index formula to pull values from a table.  if the value is 0, my field show a blank.  I want the field to show a "0".  Can I combine and IF Error formula with an index formula, and if so, how do I do that?

I tried to nest the if error into the index formula, but with no success.


问:
How to block scrolling to the top of the page after clicking on a link in the hamburger menu- React Bootstrap
I have a little problem with the hamburger menu in Bootstrap React. When I click on the link (originally it moves the home page down using scrollIntoView) the page goes down to the designated place, and then immediately scrolls up automatically. Can it be turned off?

const handleClickAboutus = () => {
  const aboutus = document.getElementById("aboutus_main");
  if (aboutus) {
    aboutus.scrollIntoView({ behavior: "smooth" });
  }
};
```
<pre class="lang-js prettyprint-override"><code><Navbar.Toggle
  onClick={() => setExpanded(expanded ? false : "expanded")}
  aria-controls={`offcanvasNavbar-expand-${expand}`}
/>
<Navbar.Offcanvas
  id={`offcanvasNavbar-expand-${expand}`}
  aria-labelledby={`offcanvasNavbarLabel-expand-${expand}`}
  placement="end"
  className="offcanvas"
>
  <Offcanvas.Header closeButton>
    <Offcanvas.Title id={`offcanvasNavbarLabel-expand-${expand}`}>
      Menu
    </Offcanvas.Title>
  </Offcanvas.Header>
  <Offcanvas.Body>
    <Navbar.Collapse id="basic-navbar-nav">
      <Nav className="me-auto justify-content-end flex-grow-1 pe-3">
        <Nav.Link onClick={() => setExpanded(false)}>
          <Link to="/">Home</Link>
        </Nav.Link>
        <Nav.Link onClick={() => setExpanded(false)}>
          <Link to="/" onClick={handleClickAboutus}>About us</Link>
        </Nav.Link>
</code>```

I've tried to find anything but can't. The page cannot scroll to the top, because it breaks the entire tabs.

Body:
I have a little problem with the hamburger menu in Bootstrap React. When I click on the link (originally it moves the home page down using scrollIntoView) the page goes down to the designated place, and then immediately scrolls up automatically. Can it be turned off?

const handleClickAboutus = () => {
  const aboutus = document.getElementById("aboutus_main");
  if (aboutus) {
    aboutus.scrollIntoView({ behavior: "smooth" });
  }
};

<Navbar.Toggle
  onClick={() => setExpanded(expanded ? false : "expanded")}
  aria-controls={`offcanvasNavbar-expand-${expand}`}
/>
<Navbar.Offcanvas
  id={`offcanvasNavbar-expand-${expand}`}
  aria-labelledby={`offcanvasNavbarLabel-expand-${expand}`}
  placement="end"
  className="offcanvas"
>
  <Offcanvas.Header closeButton>
    <Offcanvas.Title id={`offcanvasNavbarLabel-expand-${expand}`}>
      Menu
    </Offcanvas.Title>
  </Offcanvas.Header>
  <Offcanvas.Body>
    <Navbar.Collapse id="basic-navbar-nav">

         setExpanded(false)}>
          <Link to="/">Home</Link>

         setExpanded(false)}>
          <Link to="/" onClick={handleClickAboutus}>About us</Link>

I've tried to find anything but can't. The page cannot scroll to the top, because it breaks the entire tabs.


问:
How to alias a model properties in YAML
Consider below YAML model definition of an entity "Disk" in swagger 3.0

If consists of one property "diskName". I want to alias that property with "deviceName", so that I don't have to add another property definition for "deviceName".

```<code>components:
  schemas:
    Disk:
      allOf:
        - type: "object"
          properties:
            diskName:
              type: "string"
              x-constraints:
                maxLength: "ConstantRef(maxNameLength)"
              # Alias diskName to deviceName as well
</code>```

How can I alias the diskName to deviceName so that I can use the term interchangeably?
I appreciate any help you can provide.

I tried the following ways to achieve the result, but was unable to succeed.

```<code>           diskName:
              type: "string"
              x-constraints:
                maxLength: "ConstantRef(maxNameLength)"
#              alias: "{{ deviceName }}"
#              alias:
#                - deviceName
#              x-alias: deviceName
</code>```

Title: How to alias a model properties in YAML

Body:
Consider below YAML model definition of an entity "Disk" in swagger 3.0

If consists of one property "diskName". I want to alias that property with "deviceName", so that I don't have to add another property definition for "deviceName".

components:
  schemas:
    Disk:
      allOf:
        - type: "object"
          properties:
            diskName:
              type: "string"
              x-constraints:
                maxLength: "ConstantRef(maxNameLength)"
              # Alias diskName to deviceName as well

How can I alias the diskName to deviceName so that I can use the term interchangeably?
I appreciate any help you can provide.

I tried the following ways to achieve the result, but was unable to succeed.

           diskName:
              type: "string"
              x-constraints:
                maxLength: "ConstantRef(maxNameLength)"
#              alias: "{{ deviceName }}"
#              alias:
#                - deviceName
#              x-alias: deviceName


问:
Kafka Windowing Streams Junk Data With Windowed Ktable Serdes
I am working on a Kafka Streaming Dashboard where I need count of daily data of last 24 hours

            stream.groupByKey()  .windowedBy(TimeWindows.of(Duration.ofHours(24)).grace(Duration.ofMinutes(5)))  .aggregate(() -> "0",(key, value, aggregate) -> value,Materialized.with(Serdes.String(), Serdes.String())).suppress(untilWindowCloses(unbounded())) .toStream().to("Test_windowing1");

In Above code I am trying to view data with of past 24 hours with windowing but the output before streaming with windowing and after are

Before Windowing

Key: 2023010612
Value: {"Title":"HOURLY_COUNT","Count":"19967","Key":"2023010612"}

After Windowing

Key: 2023010612����
Value: {"Title":"HOURLY_COUNT","Count":"19967","Key":"2023010612"}

I want to delete the past 2 days data with windowing and have same result for the key after windowing as well

Thank you in Advance


问:
Getting the error: Could not find matching close tag for "<%" , although closing tag is provided
Could not find matching close tag for "<%".
at /Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:736:19
at Array.forEach (<anonymous>)
at Template.generateSource (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:721:15)
at Template.compile (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:574:12)
at Object.compile (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:392:16)
at handleCache (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:215:18)
at includeFile (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:292:10)
at include (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:680:16)
at eval (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/app/views/admin/main_layout.html:219:17)
at main_layout (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:682:17)
at tryHandleCache (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:254:36)
at View.exports.renderFile [as engine] (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:485:10)
at View.render (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/express/lib/view.js:135:8)
at tryRender (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/express/lib/application.js:640:10)
at Function.render (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/express/lib/application.js:592:3)
at ServerResponse.render (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/express/lib/response.js:1012:7)
at exports.list (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/app/admin_controllers/corporate_transactions.js:428:9)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

What I did in code base

```<code><nav class="col-md-3 col-lg-2 sidebar">

    <% include admin/side_bar.html %>

</nav>

<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-4">

     <%- locals.flash %>

     <%- include(page_content)%>

 </main>
</code>```

Body:
Could not find matching close tag for "<%".
at /Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:736:19
at Array.forEach (<anonymous>)
at Template.generateSource (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:721:15)
at Template.compile (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:574:12)
at Object.compile (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:392:16)
at handleCache (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:215:18)
at includeFile (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:292:10)
at include (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:680:16)
at eval (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/app/views/admin/main_layout.html:219:17)
at main_layout (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:682:17)
at tryHandleCache (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:254:36)
at View.exports.renderFile [as engine] (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/ejs/lib/ejs.js:485:10)
at View.render (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/express/lib/view.js:135:8)
at tryRender (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/express/lib/application.js:640:10)
at Function.render (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/express/lib/application.js:592:3)
at ServerResponse.render (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/node_modules/express/lib/response.js:1012:7)
at exports.list (/Users/donaldteghen/Desktop/gozem/gozem-merchant-admin/app/admin_controllers/corporate_transactions.js:428:9)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

What I did in code base

    <% include admin/side_bar.html %>

     <%- locals.flash %>

     <%- include(page_content)%>


问:
GLTF model animation lagging out my entire computer
I'm fairly new to the web design world, currently designing with models and displacement maps using threejs.

I've successfully imported a GLTF model with animations "working". However, every time I uncomment my update function inside my animation function, the animation of the model makes my whole computer lag.
How would I be able to animate my model without this lag? I would want the model's animations to run smoothly but this lag seems unnecessary for such a low poly model.

Let me know if you need to see any other lines of code.
Thanks!

I've tried to increase the number of which my update function divides by to 500. This seems to be the only way to make the animation 'smooth'. However, this lags out my PC beyond usability.enter image description here


问:
Laravel response json returns text/html with Inertiajs + Vuejs + Dropzone
I current working on Laravel + Inertia + Vuejs, and my laravel POST endpoint, is expected to return JSON, right after an image has been uploaded using Dropzone. However, when during the first request, this returns Content-Type: text/html; charset=UTF-8 instead of Content-Type: application/json

Now if we are going to reload the entire page, and make the same request, this works okay.

#1 Initial request;

#2 Reload the page (Crt +R ) then make the same request;

Here are the options are tried so far;

#1

```<code>return response()->json([
        'file' => $path,
        'message' => 'Your file has been successfully uploaded.'
]);

</code>```

#2

```<code>return response()->json(
    [
        'file' => $path,
        'message' => 'Your file has been successfully uploaded.'
    ],
    200,
    ['Content-Type' => 'application/json']
);
</code>```

#3

```<code>return Response::json(
    [
        'file' => $path,
        'message' => 'Your file has been successfully uploaded.'
    ],
    200,
    ['Content-Type' => 'application/json']
);
</code>```

This behavior happens on both local and production setup, however, i cant figured out how to isolate the root cause. Also laravel.log does not return any helpful error message, then tried these; if these will help; however, none work.

```<code>php artisan config:clear
php artisan route:clear
</code>```

Any suggestion on how to go about this problem?

Body:
I current working on Laravel + Inertia + Vuejs, and my laravel POST endpoint, is expected to return JSON, right after an image has been uploaded using Dropzone. However, when during the first request, this returns Content-Type: text/html; charset=UTF-8 instead of Content-Type: application/json

Now if we are going to reload the entire page, and make the same request, this works okay.

#1 Initial request;

#2 Reload the page (Crt +R ) then make the same request;

Here are the options are tried so far;

#1

return response()->json([
        'file' => $path,
        'message' => 'Your file has been successfully uploaded.'
]);

#2

return response()->json(
    [
        'file' => $path,
        'message' => 'Your file has been successfully uploaded.'
    ],
    200,
    ['Content-Type' => 'application/json']
);

#3

return Response::json(
    [
        'file' => $path,
        'message' => 'Your file has been successfully uploaded.'
    ],
    200,
    ['Content-Type' => 'application/json']
);

This behavior happens on both local and production setup, however, i cant figured out how to isolate the root cause. Also laravel.log does not return any helpful error message, then tried these; if these will help; however, none work.

php artisan config:clear
php artisan route:clear

Any suggestion on how to go about this problem?


问:
CSS breaks for few milliseconds when re-ordering, adding blocks or changing settings in Shopify Editor
I'm creating a new theme for Shopify. While doing the final testing, I discovered that while adding a block, or using any block or section setting where I am changing layout of the section, or re-ordering any block mostly, the CSS which I have used in that particular section where I have done some change breaks for few milli seconds. Its not that noticeable but looks kind off funny, especially if there are buttons involved. I tried preloading the CSS files and thats improves it most of the times but I'm worried to use it in mostly all the CSS files which are called in section.liquid files maybe that can slow down my theme and give me a bad lighthouse score.

I was using {{ 'image-banner.css' | asset_url | stylesheet_tag }} before and now I use {{ 'image-banner.css' | asset_url | stylesheet_tag: preload: true }} and that improved it but not always. Any solution for this?

I have attached a gif to show how it breaks when buttons are re-ordered.


问:
Error in onestrat(x[index, , drop = FALSE], clusters[index], nPSU[index][1], : Stratum (0) has only one PSU at stage 1
i have a dataframe with information of participants' country, demographic characteristics (e.g. age, gender) and biochemical measurements (e.g. weight, bp readings etc). I also have the psu and weights calculated for each participant. i have:

```<code>steps_3jan <- STEPS_All_countries_4_ %>% select(country, year,
                                                age,
                                                sex,
                                                m11,
                                                m12,
                                                stratum,
                                                psu,
                                                wstep1,
                                                wstep2,
                                                wstep3)

steps_3jan <- subset(steps_3jan, !is.na(psu))
steps_3jan <- subset(steps_3jan, !is.na(wstep1))
steps_3jan <- subset(steps_3jan, !is.na(stratum))

steps_3jan_matrix <- as.data.frame(steps_3jan)
</code>```

I was was trying to use svydesign to do this:

```<code>steps_3jan_design <- svydesign(id =~psu,
                               strata =~stratum,
                               nest = TRUE,
                               weights = ~wstep1,
                               data = steps_3jan_matrix)

svymean(~age, steps_3jan_design, na.rm = TRUE)
</code>```

but got the below error:

Error in onestrat(x[index, , drop = FALSE], clusters[index], nPSU[index][1], : Stratum (0) has only one PSU at stage 1

if anyone is able to help it would be greatly appreciated!

Body:
i have a dataframe with information of participants' country, demographic characteristics (e.g. age, gender) and biochemical measurements (e.g. weight, bp readings etc). I also have the psu and weights calculated for each participant. i have:

steps_3jan <- STEPS_All_countries_4_ %>% select(country, year,
                                                age,
                                                sex,
                                                m11,
                                                m12,
                                                stratum,
                                                psu,
                                                wstep1,
                                                wstep2,
                                                wstep3)

steps_3jan <- subset(steps_3jan, !is.na(psu))
steps_3jan <- subset(steps_3jan, !is.na(wstep1))
steps_3jan <- subset(steps_3jan, !is.na(stratum))

steps_3jan_matrix <- as.data.frame(steps_3jan)

I was was trying to use svydesign to do this:

steps_3jan_design <- svydesign(id =~psu,
                               strata =~stratum,
                               nest = TRUE,
                               weights = ~wstep1,
                               data = steps_3jan_matrix)

svymean(~age, steps_3jan_design, na.rm = TRUE)

but got the below error:

Error in onestrat(x[index, , drop = FALSE], clusters[index], nPSU[index][1], : Stratum (0) has only one PSU at stage 1

if anyone is able to help it would be greatly appreciated!


问:
Why does it throw an exception even though my condition seems correct
I have created method in typescript where I pass in a string value as a param. I wanted to include an exception handler where if the 'transactionType' does not equal either 'ADD' or 'REMOVE', then throw an exception.

However, it throws an exception event through I am including the correct param value and I am not sure why that is.

Method examples:

```<code>await cashPage.completeAddRemove('ADD');
await cashPage.completeAddRemove('REMOVE');
</code>```

In that method I attempted both of the following but not working:

```<code>async completeAddRemove(transactionType: string) {
    if (transactionType != 'ADD' || 'REMOVE') {
      throw new Error(`Unrecognised transaction type provided`);
    }

  async completeAddRemove(transactionType: string) {
    if (transactionType !== 'ADD' || 'REMOVE') {
      throw new Error(`Unrecognised transaction type provided`);
    }
</code>```

Body:
I have created method in typescript where I pass in a string value as a param. I wanted to include an exception handler where if the 'transactionType' does not equal either 'ADD' or 'REMOVE', then throw an exception.

However, it throws an exception event through I am including the correct param value and I am not sure why that is.

Method examples:

await cashPage.completeAddRemove('ADD');
await cashPage.completeAddRemove('REMOVE');

In that method I attempted both of the following but not working:

async completeAddRemove(transactionType: string) {
    if (transactionType != 'ADD' || 'REMOVE') {
      throw new Error(`Unrecognised transaction type provided`);
    }

  async completeAddRemove(transactionType: string) {
    if (transactionType !== 'ADD' || 'REMOVE') {
      throw new Error(`Unrecognised transaction type provided`);
    }


问:
How can visualize keypoints from the json? Using PIL or OpenCV library
How can visualization of key points from the given JSON? Using PIL or OpenCV library. read the key point and then change the pixel value to 0  at the key point position.

Import data files and JSON.

```<code>IMG_DIR = '/default/*.png'
JSON = '/default.json'
with open('/default.json') as f:
       d = json.load(f)
       print("Type:", type(data))
       print(d)
</code>```

Data type

```<code>Type: <class 'dict'>
{'info': {}, 'categories': {'label': {'labels': [{'name': 'keypoints', 'parent': '', 'attributes': []}], 'attributes': ['occluded']}, 'points': {'items': []}}, 'items': [{'id': '1024_2048_eduart_420210919_151508', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [326.46, 438.63], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [499.41, 452.61], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [430.61, 454.51], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [37.47, 467.43], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 0}, 'image': {'path': '1024_2048_eduart_420210919_151508.png', 'size': [512, 512]}, 'media': {'path': '1024_2048_eduart_420210919_151508.png'}}, {'id': '1536_1024_imranparkhaus_rub_32', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [234.13, 427.51], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 1}, 'image': {'path': '1536_1024_imranparkhaus_rub_32.png', 'size': [512, 512]}, 'media': {'path': '1536_1024_imranparkhaus_rub_32.png'}}, {'id': '1536_1536_eduart_5642', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [151.31, 437.21], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 2}, 'image': {'path': '1536_1536_eduart_5642.png', 'size': [512, 512]}, 'media': {'path': '1536_1536_eduart_5642.png'}}, {'id': '1536_2560_evgenii_NL_3_120200916_154505', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [51.14, 399.35], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [458.94, 104.43], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 3}, 'image': {'path': '1536_2560_evgenii_NL_3_120200916_154505.png', 'size': [512, 512]}, 'media': {'path': '1536_2560_evgenii_NL_3_120200916_154505.png'}}, {'id': '2048_1024_imran20200801_171936', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [298.43, 411.32], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 4}, 'image': {'path': '2048_1024_imran20200801_171936.png', 'size': [512, 512]}, 'media': {'path': '2048_1024_imran20200801_171936.png'}}, {'id': '2048_1024_imran20200801_184730', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [480.6, 451.42], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 5}, 'image': {'path': '2048_1024_imran20200801_184730.png', 'size': [512, 512]}, 'media': {'path': '2048_1024_imran20200801_184730.png'}}, {'id': '2048_1536_imran20200801_171936', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [4.51, 353.86], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [320.5, 270.6], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [395.73, 240.58], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [169.28, 344.01], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 6}, 'image': {'path': '2048_1536_imran20200801_171936.png', 'size': [512, 512]}, 'media': {'path': '2048_1536_imran20200801_171936.png'}}, {'id': '512_1024_eduart_420210722_170544', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [506.42, 188.26], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [195.07, 50.01], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [68.4, 42.31], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [176.4, 222.6], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [349.96, 240.88], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 7}, 'image': {'path': '512_1024_eduart_420210722_170544.png', 'size': [512, 512]}, 'media': {'path': '512_1024_eduart_420210722_170544.png'}}, {'id': '512_1024_eduart_5493', 'annotations': [], 'attr': {'frame': 8}, 'image': {'path': '512_1024_eduart_5493.png', 'size': [512, 512]}, 'media': {'path': '512_1024_eduart_5493.png'}}, {'id': '512_1024_eduart_5840', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [360.2, 476.5], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [355.6, 404.8], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [410.1, 121.3], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 9}, 'image': {'path': '512_1024_eduart_5840.png', 'size': [512, 512]}, 'media': {'path': '512_1024_eduart_5840.png'}}, {'id': '512_2048_eduart_5702', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [336.33, 51.5], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [201.1, 421.4], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [271.4, 115.9], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 10}, 'image': {'path': '512_2048_eduart_5702.png', 'size': [512, 512]}, 'media': {'path': '512_2048_eduart_5702.png'}}, {'id': '512_2560_eduart_5extra_35', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [494.65, 24.64], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [349.52, 295.38], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 11}, 'image': {'path': '512_2560_eduart_5extra_35.png', 'size': [512, 512]}, 'media': {'path': '512_2560_eduart_5extra_35.png'}}, {'id': '512_2560_evgenii_Ext_120201005_142724', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [434.69, 169.45], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [392.64, 212.4], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 12}, 'image': {'path': '512_2560_evgenii_Ext_120201005_142724.png', 'size': [512, 512]}, 'media': {'path': '512_2560_evgenii_Ext_120201005_142724.png'}}, {'id': '512_512_imran20200801_170919', 'annotations': [], 'attr': {'frame': 13}, 'image': {'path': '512_512_imran20200801_170919.png', 'size': [512, 512]}, 'media': {'path': '512_512_imran20200801_170919.png'}}]}
</code>```
```<code>with open(JSON) as infile:
    json_data = json.load(infile)
</code>```
```<code>json_dict = {}
for k,v in json_data.items():
    if k == "items":
        for i in v:
            for k1,v1 in i.items():
                if type(v1) == dict:
                    for k11,v11 in v1.items():
                        if k11 == "path":
                            json_dict[f"{i['id']}--{k1}-path"] = v11
</code>```
```<code>json_dict
</code>```
```<code>{'1024_2048_eduart_420210919_151508--image-path': '1024_2048_eduart_420210919_151508.png',
 '1024_2048_eduart_420210919_151508--media-path': '1024_2048_eduart_420210919_151508.png',
 '1536_1024_imranparkhaus_rub_32--image-path': '1536_1024_imranparkhaus_rub_32.png',
 '1536_1024_imranparkhaus_rub_32--media-path': '1536_1024_imranparkhaus_rub_32.png',}
</code>```

How can visualization of key points from the given JSON? Using PIL or OpenCV library. read the key point and then change the pixel value to 0  at the key point position. Need to show the labeled key points.

Body:
How can visualization of key points from the given JSON? Using PIL or OpenCV library. read the key point and then change the pixel value to 0  at the key point position.

Import data files and JSON.

IMG_DIR = '/default/*.png'
JSON = '/default.json'
with open('/default.json') as f:
       d = json.load(f)
       print("Type:", type(data))
       print(d)

Data type

Type: <class 'dict'>
{'info': {}, 'categories': {'label': {'labels': [{'name': 'keypoints', 'parent': '', 'attributes': []}], 'attributes': ['occluded']}, 'points': {'items': []}}, 'items': [{'id': '1024_2048_eduart_420210919_151508', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [326.46, 438.63], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [499.41, 452.61], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [430.61, 454.51], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [37.47, 467.43], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 0}, 'image': {'path': '1024_2048_eduart_420210919_151508.png', 'size': [512, 512]}, 'media': {'path': '1024_2048_eduart_420210919_151508.png'}}, {'id': '1536_1024_imranparkhaus_rub_32', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [234.13, 427.51], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 1}, 'image': {'path': '1536_1024_imranparkhaus_rub_32.png', 'size': [512, 512]}, 'media': {'path': '1536_1024_imranparkhaus_rub_32.png'}}, {'id': '1536_1536_eduart_5642', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [151.31, 437.21], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 2}, 'image': {'path': '1536_1536_eduart_5642.png', 'size': [512, 512]}, 'media': {'path': '1536_1536_eduart_5642.png'}}, {'id': '1536_2560_evgenii_NL_3_120200916_154505', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [51.14, 399.35], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [458.94, 104.43], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 3}, 'image': {'path': '1536_2560_evgenii_NL_3_120200916_154505.png', 'size': [512, 512]}, 'media': {'path': '1536_2560_evgenii_NL_3_120200916_154505.png'}}, {'id': '2048_1024_imran20200801_171936', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [298.43, 411.32], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 4}, 'image': {'path': '2048_1024_imran20200801_171936.png', 'size': [512, 512]}, 'media': {'path': '2048_1024_imran20200801_171936.png'}}, {'id': '2048_1024_imran20200801_184730', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [480.6, 451.42], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 5}, 'image': {'path': '2048_1024_imran20200801_184730.png', 'size': [512, 512]}, 'media': {'path': '2048_1024_imran20200801_184730.png'}}, {'id': '2048_1536_imran20200801_171936', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [4.51, 353.86], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [320.5, 270.6], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [395.73, 240.58], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [169.28, 344.01], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 6}, 'image': {'path': '2048_1536_imran20200801_171936.png', 'size': [512, 512]}, 'media': {'path': '2048_1536_imran20200801_171936.png'}}, {'id': '512_1024_eduart_420210722_170544', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [506.42, 188.26], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [195.07, 50.01], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [68.4, 42.31], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [176.4, 222.6], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [349.96, 240.88], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 7}, 'image': {'path': '512_1024_eduart_420210722_170544.png', 'size': [512, 512]}, 'media': {'path': '512_1024_eduart_420210722_170544.png'}}, {'id': '512_1024_eduart_5493', 'annotations': [], 'attr': {'frame': 8}, 'image': {'path': '512_1024_eduart_5493.png', 'size': [512, 512]}, 'media': {'path': '512_1024_eduart_5493.png'}}, {'id': '512_1024_eduart_5840', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [360.2, 476.5], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [355.6, 404.8], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [410.1, 121.3], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 9}, 'image': {'path': '512_1024_eduart_5840.png', 'size': [512, 512]}, 'media': {'path': '512_1024_eduart_5840.png'}}, {'id': '512_2048_eduart_5702', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [336.33, 51.5], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [201.1, 421.4], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [271.4, 115.9], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 10}, 'image': {'path': '512_2048_eduart_5702.png', 'size': [512, 512]}, 'media': {'path': '512_2048_eduart_5702.png'}}, {'id': '512_2560_eduart_5extra_35', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [494.65, 24.64], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [349.52, 295.38], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 11}, 'image': {'path': '512_2560_eduart_5extra_35.png', 'size': [512, 512]}, 'media': {'path': '512_2560_eduart_5extra_35.png'}}, {'id': '512_2560_evgenii_Ext_120201005_142724', 'annotations': [{'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [434.69, 169.45], 'z_order': 0, 'visibility': [2]}, {'id': 0, 'type': 'points', 'attributes': {'occluded': False}, 'group': 0, 'label_id': 0, 'points': [392.64, 212.4], 'z_order': 0, 'visibility': [2]}], 'attr': {'frame': 12}, 'image': {'path': '512_2560_evgenii_Ext_120201005_142724.png', 'size': [512, 512]}, 'media': {'path': '512_2560_evgenii_Ext_120201005_142724.png'}}, {'id': '512_512_imran20200801_170919', 'annotations': [], 'attr': {'frame': 13}, 'image': {'path': '512_512_imran20200801_170919.png', 'size': [512, 512]}, 'media': {'path': '512_512_imran20200801_170919.png'}}]}

with open(JSON) as infile:
    json_data = json.load(infile)

json_dict = {}
for k,v in json_data.items():
    if k == "items":
        for i in v:
            for k1,v1 in i.items():
                if type(v1) == dict:
                    for k11,v11 in v1.items():
                        if k11 == "path":
                            json_dict[f"{i['id']}--{k1}-path"] = v11

json_dict

{'1024_2048_eduart_420210919_151508--image-path': '1024_2048_eduart_420210919_151508.png',
 '1024_2048_eduart_420210919_151508--media-path': '1024_2048_eduart_420210919_151508.png',
 '1536_1024_imranparkhaus_rub_32--image-path': '1536_1024_imranparkhaus_rub_32.png',
 '1536_1024_imranparkhaus_rub_32--media-path': '1536_1024_imranparkhaus_rub_32.png',}

How can visualization of key points from the given JSON? Using PIL or OpenCV library. read the key point and then change the pixel value to 0  at the key point position. Need to show the labeled key points.


问:
get img src link broken in goutte
Sometimes this script doesn't work, for example in my case instead of returning the URI of the image it return the following data :

```<code>$path = 'https://factly.in/category/english/';
$crawler = $client->request('GET', $path);
$crawler->filter('.image-link ')->each(function ($node)  {
    $link = $node->filter('img')->attr('src');
    dd($link);
});
</code>```

"data:image/svg+xml;nitro-empty-id=NTU4OjIwOQ==-1;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTYxOSAxMDgwIiB3aWR0aD0iMTYxOSIgaGVpZ2h0PSIxMDgwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==",

If anyone fixed this issue, please list it here and Thanks in advance!

Title: get img src link broken in goutte

Body:
Sometimes this script doesn't work, for example in my case instead of returning the URI of the image it return the following data :

$path = 'https://factly.in/category/english/';
$crawler = $client->request('GET', $path);
$crawler->filter('.image-link ')->each(function ($node)  {
    $link = $node->filter('img')->attr('src');
    dd($link);
});

"data:image/svg+xml;nitro-empty-id=NTU4OjIwOQ==-1;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTYxOSAxMDgwIiB3aWR0aD0iMTYxOSIgaGVpZ2h0PSIxMDgwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==",

If anyone fixed this issue, please list it here and Thanks in advance!


问:
Getting NoSuchBeanException on migrating my application from Micronaut 2.2.0 to Micronaut 3.5.0
I am migrating my application from Micronaut 2.2.0 to Micronaut 3.5.0 using the official Micronaut documentation

One of the changes which i did was regarding the Inject Annotation.
It says that the javax.inject annotations are no longer a transitive dependency. Micronaut now ships with the Jakarta inject annotations. Either replace all javax.inject imports with jakarta.inject, or add a dependency on javax-inject to continue using the older annotations:

So we removed the javax inject dependency and replace the javax.inject imports with jakarta.inject. After rebuilding and compiling it, it throws us a compilation error of javax.inject.Singleton not found.

Note : Even after removing the javax dependency (also check the external libraries and didn't find any javax library there), the Singleton annotation is getting imported from javax.inject.Singleton.
So to resolve this we added the javax.inject and the compilation got completed successfully. But then we are getting the NoSuchBeanException for the injected classes in our Integration Tests.

In the exception the "clock" object has been injected with the @Inject annotation in the Controller class.

Anyone has any idea of what might be going wrong here.??

After enabling the debug logging for the 'io.micronaut.context.condition' package which will log the reasons why beans were not loaded, i get the following debug and error logs.

```<code>2023-01-09 12:27:15.373 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - Bean [Definition: com.csg.pb.scot.entitlements.apis.$SimulationBreakfundAPIEntitlementIT$MockBreakfundCalculationServiceBean1$Definition$Intercepted] will not be loaded due to failing conditions:
2023-01-09 12:27:15.373 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - * Custom condition [class io.micronaut.test.condition.TestActiveCondition] failed evaluation
2023-01-09 12:27:15.374 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - Bean [Definition: com.csg.pb.scot.entitlements.apis.$InceptionSimulationAPIEntitlementIT$MockInceptionCalculationServiceBean1$Definition$Intercepted] will not be loaded due to failing conditions:
2023-01-09 12:27:15.374 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - * Custom condition [class io.micronaut.test.condition.TestActiveCondition] failed evaluation
2023-01-09 12:27:15.377 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - Bean [Definition: com.csg.pb.scot.entitlements.apis.InceptionSimulationAPIEntitlementIT] will not be loaded due to failing conditions:
2023-01-09 12:27:15.377 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - * Custom condition [class io.micronaut.test.condition.TestActiveCondition] failed evaluation
2023-01-09 12:27:15.379 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - Bean [Definition: com.csg.pb.scot.entitlements.apis.SimulationBreakfundAPIEntitlementIT] will not be loaded due to failing conditions:
2023-01-09 12:27:15.379 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - * Custom condition [class io.micronaut.test.condition.TestActiveCondition] failed evaluation
2023-01-09 12:27:15.532 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - Bean [Definition: com.csg.pb.scot.entitlements.apis.InceptionAPIEntitlementIT] will not be loaded due to failing conditions:
2023-01-09 12:27:15.532 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - * Custom condition [class io.micronaut.test.condition.TestActiveCondition] failed evaluation
2023-01-09 12:27:15.539 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - Bean [Definition: com.csg.pb.scot.entitlements.apis.$InceptionAPIEntitlementIT$MockInceptionCalculationServiceBean1$Definition$Intercepted] will not be loaded due to failing conditions:
2023-01-09 12:27:15.539 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - * Custom condition [class io.micronaut.test.condition.TestActiveCondition] failed evaluation
2023-01-09 12:27:15.862 [io-executor-thread-1] ERROR i.m.http.server.RouteExecutor - Unexpected error occurred: Failed to inject value for parameter [responseMapper] of class: com.csg.pb.scot.calculation.engine.InceptionCalculationService
</code>```

Body:
I am migrating my application from Micronaut 2.2.0 to Micronaut 3.5.0 using the official Micronaut documentation

One of the changes which i did was regarding the Inject Annotation.
It says that the javax.inject annotations are no longer a transitive dependency. Micronaut now ships with the Jakarta inject annotations. Either replace all javax.inject imports with jakarta.inject, or add a dependency on javax-inject to continue using the older annotations:

So we removed the javax inject dependency and replace the javax.inject imports with jakarta.inject. After rebuilding and compiling it, it throws us a compilation error of javax.inject.Singleton not found.

Note : Even after removing the javax dependency (also check the external libraries and didn't find any javax library there), the Singleton annotation is getting imported from javax.inject.Singleton.
So to resolve this we added the javax.inject and the compilation got completed successfully. But then we are getting the NoSuchBeanException for the injected classes in our Integration Tests.

In the exception the "clock" object has been injected with the @Inject annotation in the Controller class.

Anyone has any idea of what might be going wrong here.??

After enabling the debug logging for the 'io.micronaut.context.condition' package which will log the reasons why beans were not loaded, i get the following debug and error logs.

2023-01-09 12:27:15.373 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - Bean [Definition: com.csg.pb.scot.entitlements.apis.$SimulationBreakfundAPIEntitlementIT$MockBreakfundCalculationServiceBean1$Definition$Intercepted] will not be loaded due to failing conditions:
2023-01-09 12:27:15.373 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - * Custom condition [class io.micronaut.test.condition.TestActiveCondition] failed evaluation
2023-01-09 12:27:15.374 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - Bean [Definition: com.csg.pb.scot.entitlements.apis.$InceptionSimulationAPIEntitlementIT$MockInceptionCalculationServiceBean1$Definition$Intercepted] will not be loaded due to failing conditions:
2023-01-09 12:27:15.374 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - * Custom condition [class io.micronaut.test.condition.TestActiveCondition] failed evaluation
2023-01-09 12:27:15.377 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - Bean [Definition: com.csg.pb.scot.entitlements.apis.InceptionSimulationAPIEntitlementIT] will not be loaded due to failing conditions:
2023-01-09 12:27:15.377 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - * Custom condition [class io.micronaut.test.condition.TestActiveCondition] failed evaluation
2023-01-09 12:27:15.379 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - Bean [Definition: com.csg.pb.scot.entitlements.apis.SimulationBreakfundAPIEntitlementIT] will not be loaded due to failing conditions:
2023-01-09 12:27:15.379 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - * Custom condition [class io.micronaut.test.condition.TestActiveCondition] failed evaluation
2023-01-09 12:27:15.532 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - Bean [Definition: com.csg.pb.scot.entitlements.apis.InceptionAPIEntitlementIT] will not be loaded due to failing conditions:
2023-01-09 12:27:15.532 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - * Custom condition [class io.micronaut.test.condition.TestActiveCondition] failed evaluation
2023-01-09 12:27:15.539 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - Bean [Definition: com.csg.pb.scot.entitlements.apis.$InceptionAPIEntitlementIT$MockInceptionCalculationServiceBean1$Definition$Intercepted] will not be loaded due to failing conditions:
2023-01-09 12:27:15.539 [io-executor-thread-2] DEBUG i.m.context.condition.Condition - * Custom condition [class io.micronaut.test.condition.TestActiveCondition] failed evaluation
2023-01-09 12:27:15.862 [io-executor-thread-1] ERROR i.m.http.server.RouteExecutor - Unexpected error occurred: Failed to inject value for parameter [responseMapper] of class: com.csg.pb.scot.calculation.engine.InceptionCalculationService


问:
Thymeleaf - template architecture
What is the best way to build a template architecture?

Option 1:
java

```<code>    @GetMapping("/")
    public String doGet(Model model) {
        model.addAttribute("include", new Include("main","main"));
        return "index";
    }
</code>```

html

```<code><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

  ...
  header code
  ...

  <div th:replace="~{${include.path} :: ${include.name}}"></div>

  ...
  footer code
  ...

</body>
</html>
</code>```

Option 2:
java

```<code>    @GetMapping("/")
    public String doGet(Model model) {

        model.addAttribute("data", data);
        return "index";
    }
</code>```

html

```<code><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div th:replace="~{header :: header}"></div>

  ...
  main code
  ...

  <div th:replace="~{footer:: footer}"></div>
</body>
</html>
</code>```

I'm using the first option, but I'm not sure if it's the right one.

Which is better: load the target fragment into a ready-made index template, or load elements (footer, header, ...) around the target fragment?

Title: Thymeleaf - template architecture

Body:
What is the best way to build a template architecture?

Option 1:
java

    @GetMapping("/")
    public String doGet(Model model) {
        model.addAttribute("include", new Include("main","main"));
        return "index";
    }

html

<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Title</title>

  ...
  header code
  ...

  ...
  footer code
  ...

Option 2:
java

    @GetMapping("/")
    public String doGet(Model model) {

        model.addAttribute("data", data);
        return "index";
    }

html

<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Title</title>

  ...
  main code
  ...

I'm using the first option, but I'm not sure if it's the right one.

Which is better: load the target fragment into a ready-made index template, or load elements (footer, header, ...) around the target fragment?


问:
Persistent Authentication React using UseEffect and Intervals - function not firing
I am attempting to leverage my refresh token backend point within my JWT setup for my React app.

The AuthContext file below works well beside the useEffect and interval. It would seem that my attempt to check the validity of the token every 10 secs is not working. Neither console logs in the refresh function are logged. All ideas very welcome.

```<code>import React, { useEffect, useState, useRef} from 'react';
import RefreshToken from '../Services/RefreshToken';

const AuthContext = React.createContext({
  token: '',
  isLoggedIn: false,
  rToken: '',
  tokenExpiry:'',
  login: (token) => {},
  logout: () => {},
});

export const AuthContextProvider = (props) => {
  const [token, setToken] = useState(null);
  const [refreshToken, setrefreshToken] = useState(null)
  const [tokenExpiry, setTokenExpiry] = useState(null)

  let interval = useRef(null);

  const userIsLoggedIn = !!token;

  const loginHandler = (token,rToken) => {
    setToken(token);
    setrefreshToken(rToken);
    var current = new Date();
    current.setHours(current.getHours(),current.getMinutes()+4,0,0);
    setTokenExpiry(current)

  };

  const logoutHandler = () => {
    setToken(null);
    setrefreshToken(null);
  };

 const contextValue = {
    token: token,
    isLoggedIn: userIsLoggedIn,
    rToken: refreshToken,
    tokenExpiry: tokenExpiry,
    login: loginHandler,
    logout: logoutHandler,
  };

  const refresh =(timenow)=>{

    console.log("checking")

    if(tokenExpiry <= timenow){

         console.log("refresh")

        try {

            const response = RefreshToken(token, refreshToken);

            loginHandler(response.token, response.refreshToken);
        } catch (err) {

            console.log(err);
            logoutHandler();

        }

    }
}

useEffect(() => {

  const timeNow = new Date();
  interval.current = setInterval(refresh(timeNow), 10000);
  return () => clearInterval(interval.current);
}, [])

  return (
     <AuthContext.Provider value={contextValue}>
      {props.children}
     </AuthContext.Provider>
  );
};

export default AuthContext;
</code>```

Body:
I am attempting to leverage my refresh token backend point within my JWT setup for my React app.

The AuthContext file below works well beside the useEffect and interval. It would seem that my attempt to check the validity of the token every 10 secs is not working. Neither console logs in the refresh function are logged. All ideas very welcome.

import React, { useEffect, useState, useRef} from 'react';
import RefreshToken from '../Services/RefreshToken';

const AuthContext = React.createContext({
  token: '',
  isLoggedIn: false,
  rToken: '',
  tokenExpiry:'',
  login: (token) => {},
  logout: () => {},
});

export const AuthContextProvider = (props) => {
  const [token, setToken] = useState(null);
  const [refreshToken, setrefreshToken] = useState(null)
  const [tokenExpiry, setTokenExpiry] = useState(null)

  let interval = useRef(null);

  const userIsLoggedIn = !!token;

  const loginHandler = (token,rToken) => {
    setToken(token);
    setrefreshToken(rToken);
    var current = new Date();
    current.setHours(current.getHours(),current.getMinutes()+4,0,0);
    setTokenExpiry(current)

  };

  const logoutHandler = () => {
    setToken(null);
    setrefreshToken(null);
  };

 const contextValue = {
    token: token,
    isLoggedIn: userIsLoggedIn,
    rToken: refreshToken,
    tokenExpiry: tokenExpiry,
    login: loginHandler,
    logout: logoutHandler,
  };

  const refresh =(timenow)=>{

    console.log("checking")

    if(tokenExpiry <= timenow){

         console.log("refresh")

        try {

            const response = RefreshToken(token, refreshToken);

            loginHandler(response.token, response.refreshToken);
        } catch (err) {

            console.log(err);
            logoutHandler();

        }

    }
}

useEffect(() => {

  const timeNow = new Date();
  interval.current = setInterval(refresh(timeNow), 10000);
  return () => clearInterval(interval.current);
}, [])

  return (
     <AuthContext.Provider value={contextValue}>
      {props.children}
     </AuthContext.Provider>
  );
};

export default AuthContext;


问:
Try to add alias profile to Android profile but got an error
I just tried to add variables on Android /etc/mkshrc file but I get an error:

Read-only file system

Further, I have tried to use adb remount, but it says inaccessible or not found.

I tried to use the following:

```<code>mount -o remount,rw /

</code>```

But it says

```<code>'/dev/block/dm-10'
</code>```

not user mountable in fstab.

Phone is rooted Pixel 6

Body:
I just tried to add variables on Android /etc/mkshrc file but I get an error:

Read-only file system

Further, I have tried to use adb remount, but it says inaccessible or not found.

I tried to use the following:

mount -o remount,rw /

But it says

'/dev/block/dm-10'

not user mountable in fstab.

Phone is rooted Pixel 6


问:
Browser back button breaks React app history
I have ran into a very weird behaviour with the browser back button. I’ve tested on Chrome and Safari, the behaviour is the same.

So, I have a React app that has 3 pages - home (/), signup (/email) and success (/success). The routes are setup via react-router. Every page is in it's own functional component.

The user moves from home to signup via a button and a history.push(). From signup to success via a submit button and a history.push(). Something like this:

```<code>const onClick = () => {
  history.push({ pathname: '/email', search: window.location.search });
};
</code>```

Once on the success page, if the user waits 5 seconds, they will be redirected to an eCom website, via window.location.assign():

```<code>const useRedirectTimer = (
  url: RedirectUrl,
): {
  redirectTimerRef: React.MutableRefObject<NodeJS.Timeout | undefined>;
  clearRedirectTimer: () => void;
} => {
  const history = useHistory();
  const { search } = useLocation();

  const redirectTimerRef = useRef<NodeJS.Timeout | undefined>();

  const clearRedirectTimer = () =>
    redirectTimerRef.current && clearTimeout(redirectTimerRef.current);

  useEffect(() => {
    redirectTimerRef.current = setTimeout(() => {
        window.location.assign(url.url);
    }, delayInMS);

    return () => {
      clearRedirectTimer();
    };
  }, []);

  return { redirectTimerRef, clearRedirectTimer };
};
</code>```

Now, this is where I start having issues. There are 2 main situations:

Not waiting for the eCom website to load fully after the redirect and clicking the browser back button: I am returned to the browser's start page and my app basically disappears from history.

Waiting to be redirected to the eCom website, waiting for the full load, going back to /success page, waiting to be redirected and eCom website be fully loaded again and then pressing the back button - (so basically doing the same thing twice in a row) I am either returned to my app's home page (rarely) or to the browser's start page (more commonly).

Adding a button to the success page and making it do the redirect on click, or even just clicking anywhere on the page and then waiting for the redirect solves the second issue. It seems that no matter how many times I go back and forth, I always end up on the success page.

So my hunch is that at least one element on the page has to be focused once so the page can be returned to. But I could of course be wrong.

Is there any way I can make history preserve my app no matter how many times I go back and forth, and to always return to the success page from the eCom website?

Body:
I have ran into a very weird behaviour with the browser back button. I’ve tested on Chrome and Safari, the behaviour is the same.

So, I have a React app that has 3 pages - home (/), signup (/email) and success (/success). The routes are setup via react-router. Every page is in it's own functional component.

The user moves from home to signup via a button and a history.push(). From signup to success via a submit button and a history.push(). Something like this:

const onClick = () => {
  history.push({ pathname: '/email', search: window.location.search });
};

Once on the success page, if the user waits 5 seconds, they will be redirected to an eCom website, via window.location.assign():

const useRedirectTimer = (
  url: RedirectUrl,
): {
  redirectTimerRef: React.MutableRefObject<NodeJS.Timeout | undefined>;
  clearRedirectTimer: () => void;
} => {
  const history = useHistory();
  const { search } = useLocation();

  const redirectTimerRef = useRef<NodeJS.Timeout | undefined>();

  const clearRedirectTimer = () =>
    redirectTimerRef.current && clearTimeout(redirectTimerRef.current);

  useEffect(() => {
    redirectTimerRef.current = setTimeout(() => {
        window.location.assign(url.url);
    }, delayInMS);

    return () => {
      clearRedirectTimer();
    };
  }, []);

  return { redirectTimerRef, clearRedirectTimer };
};

Now, this is where I start having issues. There are 2 main situations:

Not waiting for the eCom website to load fully after the redirect and clicking the browser back button: I am returned to the browser's start page and my app basically disappears from history.

Waiting to be redirected to the eCom website, waiting for the full load, going back to /success page, waiting to be redirected and eCom website be fully loaded again and then pressing the back button - (so basically doing the same thing twice in a row) I am either returned to my app's home page (rarely) or to the browser's start page (more commonly).

Adding a button to the success page and making it do the redirect on click, or even just clicking anywhere on the page and then waiting for the redirect solves the second issue. It seems that no matter how many times I go back and forth, I always end up on the success page.

So my hunch is that at least one element on the page has to be focused once so the page can be returned to. But I could of course be wrong.

Is there any way I can make history preserve my app no matter how many times I go back and forth, and to always return to the success page from the eCom website?


问:
Unable to deploy php Laravel application with Digital Ocean App getting DB connection timeout during Deployment
I have included a database translation into my Laravel app. And it seems that the build process, particularly composer autoload-dump step is trying to connect to the data base however I am getting a connection timeout even though the application is working just fine only the latest deployment is breaking. It seems like the app is unable to make a DB connection during build time. I can understand if the error was that some table is not found but It can't even connect to the DB.


问:
Using includeHTML(); from w3.js german special chars
I want to have a header include in my HTML pages to avoid changing any page in case I have header changes as the header can grow easily.

Problem:

Expected textoutput : "Schüttgut"

Received textoutput: "SchÃ¼ttgut"

Here is what I did:

Creating a header - saved as inc_head.html:

```<code><meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
</code>```

Including w3 at the end of the index.html page

```<code><script src="https://www.w3schools.com/lib/w3.js"></script>
<script>
    w3.includeHTML();
</script>
</code>```

Setting the head-part in the index-page like

```<code><head>
<div w3-include-html="inc_head.html"></div>
</head>
</code>```

Opening the page shows that the UTF-coding is not working, I receive "Ã¼" signs instead of "ü".
When I replace the w3-include part directly by the two header lines it works correctly.

Any idea why the include fails for this special-chars?
Thank you

Body:
I want to have a header include in my HTML pages to avoid changing any page in case I have header changes as the header can grow easily.

Problem:

Expected textoutput : "Schüttgut"

Received textoutput: "SchÃ¼ttgut"

Here is what I did:

Creating a header - saved as inc_head.html:

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

Including w3 at the end of the index.html page

Setting the head-part in the index-page like

Opening the page shows that the UTF-coding is not working, I receive "Ã¼" signs instead of "ü".
When I replace the w3-include part directly by the two header lines it works correctly.

Any idea why the include fails for this special-chars?
Thank you


问:
Certain audio files not loading on Android 'File not found'
I have an app that allows you to pick an audio file and then load / playback etc.

For some reason certain files do not load, even though they are selectable, and are not unusual file types, for example, I am currently trying an MP3 audio file (6.5mb).

This is the process once selected;

```<code>// load audio to SoundController
public void initSound(String audioPath) {
    File audioFile = new File(audioPath);
    if (audioFile.exists()) {
        String s = audioFile.getName();
        mFileName = s.substring(0, s.length() - 4);
        showProcessDialog();
        try {
            mSoundController.loadAudio(audioFile.getAbsolutePath());
            mSoundController.loadVisualizer(visualizerView, false);
            mSoundController.loadVisualizer(visualizerReverseView, true);

        } catch (Exception e) {
            Toast.makeText(getApplicationContext(), "Cannot load audio file", Toast.LENGTH_SHORT).show();
            closeProcessDiaglog();
        }
    } else {
        Toast.makeText(getApplicationContext(), "File not found", Toast.LENGTH_SHORT).show();
    }
}
</code>```

The showProcessDialog;

```<code>void showProcessDialog() {
        isLoadedAudio = false;
        prcDialog = new ProgressDialog(this);
        prcDialog.setMessage("Please Wait - Loading Audio - if this dialogue appears for more than 15 seconds, your file is not compatible so please try loading a different audio file.");
        prcDialog.setCancelable(true);
        prcDialog.setButton(AlertDialog.BUTTON_NEGATIVE, "Cancel & Try A Different Audio File",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                } );

        prcDialog.show();

    }

    // Close Process dialog
    void closeProcessDiaglog() {
        if (prcDialog.isShowing()) {
            prcDialog.dismiss();
        }
        checkAudioLoaded();
    }

    public void checkAudioLoaded() {
        sbSongProcess.setEnabled(mSoundController.isPlaying());
        if (mSoundController.isLoadedAudio()) {
            playAudio.setEnabled(true);
            playAudio.setChecked(mSoundController.isPlaying());
        } else {
            playAudio.setEnabled(false);
            playAudio.setChecked(false);
        }
    }
</code>```

Of course also onActivityResult;

```<code>@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == AppicationContants.OPEN_FILE_REQUEST && resultCode == RESULT_OK) {
            mPath = data.getStringExtra("Path");
            isLoadingFile = true;

        }
    }
</code>```

This particular mp3 file, the dialogue shows, however does not ever dismiss and the file does not load, but other files will fire the 'File not found' Toast message found in my initSound method.

I am struggling to understand why, these are audio files that are downloaded onto my device.

The ManagerAudioActivity.java file handles the choosing of the file / opening.

```<code>@RequiresApi(api = Build.VERSION_CODES.KITKAT)
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == AppicationContants.AUDIO_PICK_REQUEST_CODE && resultCode == RESULT_OK) {

            try {
                Uri uri = data.getData();
                String arr1 = uri.toString().substring(0, uri.toString().lastIndexOf("/"));
                String id = DocumentsContract.getDocumentId(uri);
                String path = FilePath.getPath(this, uri);
                File t = null;
                // Alternatively, use FileUtils.getFile(Context, Uri)
                if (path != null && FileUtils.isLocal(path)) {
                    t = new File(path);
                }
                mPath = path;
                Toast.makeText(getApplicationContext(), mPath, Toast.LENGTH_LONG).show();
                if(checkIfAudio(mPath)) {
                    if(t.exists()) {
                        String description = "Tempo:100 Pitch:+0 Key:+0";
                        Song newSong = new Song(t.getName().substring(0, t.getName().length() -4), description, t.getAbsolutePath());
                        if(!checkIfExisted(newSong.getName())) {
                            currentCategory.getSongs().add(newSong);
                        }

                        SongAdapter songAdapter = new SongAdapter(ManagerAudioActivity.this, currentCategory.getSongs());
                        lvListSong.setAdapter(songAdapter);
                        ((CustomAdapter) lvListCategory.getAdapter()).updateItemList(categories);
                        saveData();
                    } else {
                        Toast.makeText(getApplicationContext(), "File not found", Toast.LENGTH_SHORT).show();
                    }
                } else {
                    Toast.makeText(getApplicationContext(), "File in wrong format", Toast.LENGTH_SHORT).show();
                }
            } catch (Exception ex) {
                Toast.makeText(getApplicationContext(), "File not found", Toast.LENGTH_SHORT).show();
            }

        }
    }

    public boolean checkIfAudio(String path)
    {
        boolean result = false;
        try {
            SoundStreamAudioPlayer audioPlayer = new SoundStreamAudioPlayer(10, path, 1.0f, 0.0f);
            result = true;
            audioPlayer = null;
        } catch (IOException e) {
            e.printStackTrace();
            Toast.makeText(getApplicationContext(), "error="+e.getMessage(), Toast.LENGTH_SHORT).show();
        }

        return result;
    }
    public boolean checkIfExisted(String name)
    {
        if(currentCategory!= null && currentCategory.getSongs().size()>0)
        {
            for(int i =0 ; i< currentCategory.getSongs().size() ; i++)
            {
                if(currentCategory.getSongs().get(i).getName().equals(name))
                {
                    return true;
                }
            }
        }
        return false;
    }
</code>```

Body:
I have an app that allows you to pick an audio file and then load / playback etc.

For some reason certain files do not load, even though they are selectable, and are not unusual file types, for example, I am currently trying an MP3 audio file (6.5mb).

This is the process once selected;

// load audio to SoundController
public void initSound(String audioPath) {
    File audioFile = new File(audioPath);
    if (audioFile.exists()) {
        String s = audioFile.getName();
        mFileName = s.substring(0, s.length() - 4);
        showProcessDialog();
        try {
            mSoundController.loadAudio(audioFile.getAbsolutePath());
            mSoundController.loadVisualizer(visualizerView, false);
            mSoundController.loadVisualizer(visualizerReverseView, true);

        } catch (Exception e) {
            Toast.makeText(getApplicationContext(), "Cannot load audio file", Toast.LENGTH_SHORT).show();
            closeProcessDiaglog();
        }
    } else {
        Toast.makeText(getApplicationContext(), "File not found", Toast.LENGTH_SHORT).show();
    }
}

The showProcessDialog;

void showProcessDialog() {
        isLoadedAudio = false;
        prcDialog = new ProgressDialog(this);
        prcDialog.setMessage("Please Wait - Loading Audio - if this dialogue appears for more than 15 seconds, your file is not compatible so please try loading a different audio file.");
        prcDialog.setCancelable(true);
        prcDialog.setButton(AlertDialog.BUTTON_NEGATIVE, "Cancel & Try A Different Audio File",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                } );

        prcDialog.show();

    }

    // Close Process dialog
    void closeProcessDiaglog() {
        if (prcDialog.isShowing()) {
            prcDialog.dismiss();
        }
        checkAudioLoaded();
    }

    public void checkAudioLoaded() {
        sbSongProcess.setEnabled(mSoundController.isPlaying());
        if (mSoundController.isLoadedAudio()) {
            playAudio.setEnabled(true);
            playAudio.setChecked(mSoundController.isPlaying());
        } else {
            playAudio.setEnabled(false);
            playAudio.setChecked(false);
        }
    }

Of course also onActivityResult;

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == AppicationContants.OPEN_FILE_REQUEST && resultCode == RESULT_OK) {
            mPath = data.getStringExtra("Path");
            isLoadingFile = true;

        }
    }

This particular mp3 file, the dialogue shows, however does not ever dismiss and the file does not load, but other files will fire the 'File not found' Toast message found in my initSound method.

I am struggling to understand why, these are audio files that are downloaded onto my device.

The ManagerAudioActivity.java file handles the choosing of the file / opening.

@RequiresApi(api = Build.VERSION_CODES.KITKAT)
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == AppicationContants.AUDIO_PICK_REQUEST_CODE && resultCode == RESULT_OK) {

            try {
                Uri uri = data.getData();
                String arr1 = uri.toString().substring(0, uri.toString().lastIndexOf("/"));
                String id = DocumentsContract.getDocumentId(uri);
                String path = FilePath.getPath(this, uri);
                File t = null;
                // Alternatively, use FileUtils.getFile(Context, Uri)
                if (path != null && FileUtils.isLocal(path)) {
                    t = new File(path);
                }
                mPath = path;
                Toast.makeText(getApplicationContext(), mPath, Toast.LENGTH_LONG).show();
                if(checkIfAudio(mPath)) {
                    if(t.exists()) {
                        String description = "Tempo:100 Pitch:+0 Key:+0";
                        Song newSong = new Song(t.getName().substring(0, t.getName().length() -4), description, t.getAbsolutePath());
                        if(!checkIfExisted(newSong.getName())) {
                            currentCategory.getSongs().add(newSong);
                        }

                        SongAdapter songAdapter = new SongAdapter(ManagerAudioActivity.this, currentCategory.getSongs());
                        lvListSong.setAdapter(songAdapter);
                        ((CustomAdapter) lvListCategory.getAdapter()).updateItemList(categories);
                        saveData();
                    } else {
                        Toast.makeText(getApplicationContext(), "File not found", Toast.LENGTH_SHORT).show();
                    }
                } else {
                    Toast.makeText(getApplicationContext(), "File in wrong format", Toast.LENGTH_SHORT).show();
                }
            } catch (Exception ex) {
                Toast.makeText(getApplicationContext(), "File not found", Toast.LENGTH_SHORT).show();
            }

        }
    }

    public boolean checkIfAudio(String path)
    {
        boolean result = false;
        try {
            SoundStreamAudioPlayer audioPlayer = new SoundStreamAudioPlayer(10, path, 1.0f, 0.0f);
            result = true;
            audioPlayer = null;
        } catch (IOException e) {
            e.printStackTrace();
            Toast.makeText(getApplicationContext(), "error="+e.getMessage(), Toast.LENGTH_SHORT).show();
        }

        return result;
    }
    public boolean checkIfExisted(String name)
    {
        if(currentCategory!= null && currentCategory.getSongs().size()>0)
        {
            for(int i =0 ; i< currentCategory.getSongs().size() ; i++)
            {
                if(currentCategory.getSongs().get(i).getName().equals(name))
                {
                    return true;
                }
            }
        }
        return false;
    }


问:
Whmcs run woocommerce and scripts
I have a question about WHMCS, when I open a new package can I have it pre-installed (swordpress - soopsomerchete) or what else...? I tried a lot but I didn't succeed is there a way to open a new package should the above be ready?

I tried to do it through WP-Toolkit, but it didn't work

Title: Whmcs run woocommerce and scripts


问:
How to activate hyperthreading for ipcluster and MPI
I am starting an IPython cluster with an MPI engine to execute a jupyter notebook on multiple processes:

```<code>ipcluster start --engines=MPI -n 6 --profile=mpi
</code>```

The machine has 6 cores so this works without an issue. However, I would also like to use its 12 threads. How do I tell IPython/the ipcluster command to activate hyperthreading (i.e. pass --use-hwthread-cpus to the mpirun/mpiexec command it executes)?

Error message I receive when trying the above ipcluster command with 12 nodes:

```<code>2023-01-06 14:01:35.586 [IPClusterStart] Starting 12 engines with <class 'ipyparallel.cluster.launcher.MPIEngineSetLauncher'>
2023-01-06 14:01:35.688 [IPClusterStart] WARNING | engine set stopped 1673010095: {'exit_code': 1, 'pid': 187667, 'identifier': 'ipengine-1673010095-187622'}
2023-01-06 14:01:35.689 [IPClusterStart] ERROR |
            Engines shutdown early, they probably failed to connect.

            Check the engine log files for output.

            If your controller and engines are not on the same machine, you probably
            have to instruct the controller to listen on an interface other than localhost.

            You can set this by adding "--ip=*" to your ControllerLauncher.controller_args.

            Be sure to read our security docs before instructing your controller to listen on
            a public interface.

2023-01-06 14:01:35.690 [IPClusterStart] ERROR | Engine output:
Invalid MIT-MAGIC-COOKIE-1 key--------------------------------------------------------------------------
There are not enough slots available in the system to satisfy the 12
slots that were requested by the application:

  /****/venv/bin/python

Either request fewer slots for your application, or make more slots
available for use.

A "slot" is the Open MPI term for an allocatable unit where we can
launch a process.  The number of slots available are defined by the
environment in which Open MPI processes are run:

  1. Hostfile, via "slots=N" clauses (N defaults to number of
     processor cores if not provided)
  2. The --host command line parameter, via a ":N" suffix on the
     hostname (N defaults to 1 if not provided)
  3. Resource manager (e.g., SLURM, PBS/Torque, LSF, etc.)
  4. If none of a hostfile, the --host command line parameter, or an
     RM is present, Open MPI defaults to the number of processor cores

In all the above cases, if you want Open MPI to default to the number
of hardware threads instead of the number of processor cores, use the
--use-hwthread-cpus option.

Alternatively, you can use the --oversubscribe option to ignore the
number of available slots when deciding the number of processes to
launch.
--------------------------------------------------------------------------

2023-01-06 14:01:35.690 [IPClusterStart] ERROR | IPython cluster: stopping
2023-01-06 14:01:35.691 [IPClusterStart] Stopping controller
2023-01-06 14:01:35.691 [IPController] CRITICAL | Received signal 15, shutting down
2023-01-06 14:01:35.692 [IPController] CRITICAL | terminating children...
2023-01-06 14:01:35.816 [IPClusterStart] Controller stopped: {'exit_code': 0, 'pid': 187624, 'identifier': 'ipcontroller-187622'}
2023-01-06 14:01:35.816 [IPClusterStart] Stopping engine(s): 1673010095
</code>```

Body:
I am starting an IPython cluster with an MPI engine to execute a jupyter notebook on multiple processes:

ipcluster start --engines=MPI -n 6 --profile=mpi

The machine has 6 cores so this works without an issue. However, I would also like to use its 12 threads. How do I tell IPython/the ipcluster command to activate hyperthreading (i.e. pass --use-hwthread-cpus to the mpirun/mpiexec command it executes)?

Error message I receive when trying the above ipcluster command with 12 nodes:

2023-01-06 14:01:35.586 [IPClusterStart] Starting 12 engines with <class 'ipyparallel.cluster.launcher.MPIEngineSetLauncher'>
2023-01-06 14:01:35.688 [IPClusterStart] WARNING | engine set stopped 1673010095: {'exit_code': 1, 'pid': 187667, 'identifier': 'ipengine-1673010095-187622'}
2023-01-06 14:01:35.689 [IPClusterStart] ERROR |
            Engines shutdown early, they probably failed to connect.

            Check the engine log files for output.

            If your controller and engines are not on the same machine, you probably
            have to instruct the controller to listen on an interface other than localhost.

            You can set this by adding "--ip=*" to your ControllerLauncher.controller_args.

            Be sure to read our security docs before instructing your controller to listen on
            a public interface.

2023-01-06 14:01:35.690 [IPClusterStart] ERROR | Engine output:
Invalid MIT-MAGIC-COOKIE-1 key--------------------------------------------------------------------------
There are not enough slots available in the system to satisfy the 12
slots that were requested by the application:

  /****/venv/bin/python

Either request fewer slots for your application, or make more slots
available for use.

A "slot" is the Open MPI term for an allocatable unit where we can
launch a process.  The number of slots available are defined by the
environment in which Open MPI processes are run:

  1. Hostfile, via "slots=N" clauses (N defaults to number of
     processor cores if not provided)
  2. The --host command line parameter, via a ":N" suffix on the
     hostname (N defaults to 1 if not provided)
  3. Resource manager (e.g., SLURM, PBS/Torque, LSF, etc.)
  4. If none of a hostfile, the --host command line parameter, or an
     RM is present, Open MPI defaults to the number of processor cores

In all the above cases, if you want Open MPI to default to the number
of hardware threads instead of the number of processor cores, use the
--use-hwthread-cpus option.

Alternatively, you can use the --oversubscribe option to ignore the
number of available slots when deciding the number of processes to
launch.
--------------------------------------------------------------------------

2023-01-06 14:01:35.690 [IPClusterStart] ERROR | IPython cluster: stopping
2023-01-06 14:01:35.691 [IPClusterStart] Stopping controller
2023-01-06 14:01:35.691 [IPController] CRITICAL | Received signal 15, shutting down
2023-01-06 14:01:35.692 [IPController] CRITICAL | terminating children...
2023-01-06 14:01:35.816 [IPClusterStart] Controller stopped: {'exit_code': 0, 'pid': 187624, 'identifier': 'ipcontroller-187622'}
2023-01-06 14:01:35.816 [IPClusterStart] Stopping engine(s): 1673010095


问:
clang fails to deduce function template parameter with packed variadic parameters

#include <tuple>

template<std::size_t... Is, std::size_t... Js>
auto test(std::tuple<std::index_sequence<Is, Js>...>) {}

int main()
{
    test(std::tuple<std::index_sequence<0, 0>>{});
}
```

You can see the compile result of each compiler here: https://godbolt.org/z/z6TEWxn49

The latest GCC and MSVC compiles this code but clang doesn't.

I cannot find why clang fails, so I'd like to make an issue report, if it's clang's bug.

Is clang right by standard? Or, is it a bug of clang?

Body:
#include <tuple>

template<std::size_t... Is, std::size_t... Js>
auto test(std::tuple<std::index_sequence<Is, Js>...>) {}

int main()
{
    test(std::tuple<std::index_sequence<0, 0>>{});
}

You can see the compile result of each compiler here: https://godbolt.org/z/z6TEWxn49

The latest GCC and MSVC compiles this code but clang doesn't.

I cannot find why clang fails, so I'd like to make an issue report, if it's clang's bug.

Is clang right by standard? Or, is it a bug of clang?


问:
how to handle xml response with fetch?
i have a angular project that calls a firebase function, my firebase function uses fetch to get a xml response, the problem is i dont know how to handle the xml response that needs to be sent back to my angular project..can anyone help please

firebase function

app.post('/provider', bodyParser.json(), async (req, res) => {
  const response = await fetch(
    'https://api.verify.example.com/identification/report_verification/',
    {
      method: 'POST',
      body: req.body,
      headers: {
        'Content-Type': 'application/json'  ,
        'Authorization': 'Token 8c708fe3306f3f55644842a4d1f00561aa57b02e'    }
    })

    const str = await response.text()
    res.send(str)
})```

Title: how to handle xml response with fetch?


问:
When using per page layout in Next.js, is the key prop a valid way to prevent remount when siblings to the layout changes on navigation?
I had an issue where I lost state on navigation in Next.js. I've set up the layout as per-page layout. Here is an example:

```<code>// Page: PageA.tsx
PageA.getLayout = function getLayout(page) {
    return (
        <>
            <AnotherComponent />
            <SharedComponent />
            <Layout>{page}</Layout>
        </>
    )
}

// Page: PageB.tsx
PageB.getLayout = function getLayout(page) {
    return (
        <>
            <SharedComponent />
            <Layout>{page}</Layout>
        </>
    )
}
</code>```

When navigating, the state setup in <Layout> would be reset because the layout component remounts. I assume it is because the siblings to the layout component changes, and React looses track of it. I figured out I could fix it by adding a key prop to the layout:

```<code>PageA: <Layout key="layout">...</Layout>
PageB: <Layout key="layout">...</Layout>
</code>```

Since the key is the same between the pages, the layout component is not remounted. Is this an approach that will work, or does it have unintended consequences for the children of the layout component? The alternative is to move the siblings to the layout component, so the layout component is the only root returned from getLayout, like this:

```<code>// Page: PageA.tsx
PageA.getLayout = function getLayout(page) {
    return <Layout>{page}</Layout>;
}

// Page: PageB.tsx
PageB.getLayout = function getLayout(page) {
    return <Layout>{page}</Layout>;
}
</code>```

This also works. Is there a recommended approach from React or Nextjs?

Body:
I had an issue where I lost state on navigation in Next.js. I've set up the layout as per-page layout. Here is an example:

// Page: PageA.tsx
PageA.getLayout = function getLayout(page) {
    return (
        <>
            <AnotherComponent />
            <SharedComponent />
            <Layout>{page}</Layout>
        </>
    )
}

// Page: PageB.tsx
PageB.getLayout = function getLayout(page) {
    return (
        <>
            <SharedComponent />
            <Layout>{page}</Layout>
        </>
    )
}

When navigating, the state setup in <Layout> would be reset because the layout component remounts. I assume it is because the siblings to the layout component changes, and React looses track of it. I figured out I could fix it by adding a key prop to the layout:

PageA: <Layout key="layout">...</Layout>
PageB: <Layout key="layout">...</Layout>

Since the key is the same between the pages, the layout component is not remounted. Is this an approach that will work, or does it have unintended consequences for the children of the layout component? The alternative is to move the siblings to the layout component, so the layout component is the only root returned from getLayout, like this:

// Page: PageA.tsx
PageA.getLayout = function getLayout(page) {
    return <Layout>{page}</Layout>;
}

// Page: PageB.tsx
PageB.getLayout = function getLayout(page) {
    return <Layout>{page}</Layout>;
}

This also works. Is there a recommended approach from React or Nextjs?


问:
update max_intervals and interval Dash
I have a Dash project which read and plot data from a db in real-time.
I have tried to write a chained callback to control max_intervals and interval to enable the user to define both of them as input number! I have tried to define both as global variable to change them, but it does not work either!
any help is appreciated

my code:

```<code>waiting_time  = 1000   #witing time for interval dash
max_time = 100 #100 defaulit

app.layout = html.Div([  ... dcc.Interval(id='update_Graph', interval = waiting_time  , max_intervals = max_time),
dcc.Input(id = 'max_interval' , type="number", min=10, max=10000, step=50 , ),  ... ])

@app.callback(Output('update_Graph' , 'n_intervals'),
             Input('max_interval' , 'value'),
             )

def update_maxtime(value):
    global max_time
    max_time = value

</code>```

Title: update max_intervals and interval Dash

Body:
I have a Dash project which read and plot data from a db in real-time.
I have tried to write a chained callback to control max_intervals and interval to enable the user to define both of them as input number! I have tried to define both as global variable to change them, but it does not work either!
any help is appreciated

my code:

waiting_time  = 1000   #witing time for interval dash
max_time = 100 #100 defaulit

app.layout = html.Div([  ... dcc.Interval(id='update_Graph', interval = waiting_time  , max_intervals = max_time),
dcc.Input(id = 'max_interval' , type="number", min=10, max=10000, step=50 , ),  ... ])

@app.callback(Output('update_Graph' , 'n_intervals'),
             Input('max_interval' , 'value'),
             )

def update_maxtime(value):
    global max_time
    max_time = value


问:
could not find the driver
I try to do php artisan migrate and the error is

In Connection.php line 664:

could not find driver (SQL: select * from information_schema.tables where t
able_schema = stock_management and table_name = migrations)

In Connector.php line 67:

could not find driver

Connection.php line 664

```<code>try {
            $result = $callback($query, $bindings);
        }

        // If an exception occurs when attempting to run a query, we'll format the error
        // message to include the bindings with SQL, which will make this exception a
        // lot more helpful to the developer instead of just the database's errors.
        catch (Exception $e) {
-->line 664        throw new QueryException(
                $query, $this->prepareBindings($bindings), $e
            );
        }
</code>```

Connector.php line 67

```<code>protected function createPdoConnection($dsn, $username, $password, $options)
    {
        if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) {
            return new PDOConnection($dsn, $username, $password, $options);
        }

--> line 67    return new PDO($dsn, $username, $password, $options);
    }
</code>```

Title: could not find the driver

Body:
I try to do php artisan migrate and the error is

In Connection.php line 664:

could not find driver (SQL: select * from information_schema.tables where t
able_schema = stock_management and table_name = migrations)

In Connector.php line 67:

could not find driver

Connection.php line 664

try {
            $result = $callback($query, $bindings);
        }

        // If an exception occurs when attempting to run a query, we'll format the error
        // message to include the bindings with SQL, which will make this exception a
        // lot more helpful to the developer instead of just the database's errors.
        catch (Exception $e) {
-->line 664        throw new QueryException(
                $query, $this->prepareBindings($bindings), $e
            );
        }

Connector.php line 67

protected function createPdoConnection($dsn, $username, $password, $options)
    {
        if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) {
            return new PDOConnection($dsn, $username, $password, $options);
        }

--> line 67    return new PDO($dsn, $username, $password, $options);
    }


Title: pyspark equivalent code for panda's evm (Exponential moving average)

Body:
I want to calculate the EVM (Exponential moving average) of units, I am using pandas evm method like

tup = [
    (3634, "2022-11-12","3.26"), (3634, "2022-11-13","2.97"),(3634, "2022-11-14","5.3"),
    (3634, "2022-11-15","11.94"),(3634, "2022-11-16","5.5"),(3634, "2022-11-17","11.02")
]
df = spark.createDataFrame(tup, ["id", "date","units"])
df.show()

+----+----------+-----+
|  id|      date|units|
+----+----------+-----+
|3634|2022-11-12| 3.26|
|3634|2022-11-13| 2.97|
|3634|2022-11-14|  5.3|
|3634|2022-11-15|11.94|
|3634|2022-11-16|  5.5|
|3634|2022-11-17|11.02|
+----+----------+-----+

In pandas:

pandas_df = df.toPandas()
pandas_df["ewm"] = pandas_df["units"].ewm(alpha=0.7, min_periods=0).mean()
spark.createDataFrame(pandas_df).show()

+----+----------+-----+-----------------+
|  id|      date|units|              ewm|
+----+----------+-----+-----------------+
|3634|2022-11-12| 3.26|             3.26|
|3634|2022-11-13| 2.97|3.036923076923077|
|3634|2022-11-14|  5.3|4.665035971223021|
|3634|2022-11-15|11.94| 9.79909668313338|
|3634|2022-11-16|  5.5|6.782398428180479|
|3634|2022-11-17|11.02|9.750883554110947|
+----+----------+-----+-----------------+

I wanted to know if i could do the same in pyspark without using pandas_udf. Preferable ably with Windows function.

Any lead is appreciated
Thank you


问:
Docker - Identify Unused Volumes
I'm trying to find a way to identify what container created a volume as well as where it wants to mount to & also If it will be reused when the container restarts for volumes that are currently not in use.

I know I can see what container is currently using a volume, & where it's mounted to in said container, but that isn't enough. I need to identify containers that are no longer running.

The Situation

I've noticed a frequently reoccurring problem with Docker, I create a container to test it out, make some adjustments, restart it, make some more, restart it, until I get it working how I want it to.

In the process, many times, I come across containers that create worthless volumes. These, after the fact, I can identify as 8K volumes not currently in use & just delete them.

But many times these volumes aren't even persistent, as the container will create a new one each time it runs.

At times I look at my Volumes list & see over 100 volumes, none of which are currently in use. The 8KB ones I'll delete without a second thought, but the ones that are 12KB or 24KB or 100KB or 5Mb, etc, etc I don't want to just delete.

I use a Portainer agent inside Portainer solely for the ability to quickly browse these volumes & decide if it needs to be kept, transferred to a Bind mount, or just discarded, but it's becoming more & more of a problem & I figure there has to be some way to identify the container they came from. I'm sure it will require some sort of code exploration, but where? is there not a tool to do this? If I know where the information is I should be able to write a script or even make a container just for this purpose, I just don't know where to begin.

The most annoying thing is when a container creates a second container & that container, that I have no control over, is using a volume, but it creates a new one each time it starts.

Some examples

adoring_hellman created by VS Code Server container linuxserver/code-server

datadog/agent creates a container I believe is called st-vector or something similar

Both which have access to /var/run/docker.sock

Title: Docker - Identify Unused Volumes