问:
how can i output the result of one input tag in another input tag
let say a= 20 and b = 10 and c= 12 ..........etc

output of <input/>  two = input value in <input /> one field * (a or b or c.....)

also

output of <input/>  one = input value in <input/> two  field / (a or b or c.....)

let say a= 20 and b = 10 and c= 12 ..........etc

output of <input/>  two = input value in <input /> one field * (a or b or c.....)

also

output of <input/>  one = input value in <input/> two  field / (a or b or c.....)

```<code>let say a= 20 and b = 10 and c= 12 ..........etc

output of <input/>  two = input value in <input /> one field * (a or b or c.....)

also

output of <input/>  one = input value in <input/> two  field / (a or b or c.....)

let say a= 20 and b = 10 and c= 12 ..........etc

output of <input/>  two = input value in <input /> one field * (a or b or c.....)

also

output of <input/>  one = input value in <input/> two  field / (a or b or c.....)

let say a= 20 and b = 10 and c= 12 ..........etc

output of <input/>  two = input value in <input /> one field * (a or b or c.....)

also

output of <input/>  one = input value in <input/> two  field / (a or b or c.....)

import { useEffect } from "react";
import { useState } from "react";

export default function Converter() {
  const [fromUnit, setFromUnit] = useState(1);
  const [toUnit, setToUnit] = useState(1);
  const [inputValue1, setInputValue1] = useState(1);
  const [inputValue2, setInputValue2] = useState(1);

  const [value, setValue] = useState();
  const [result, setResult] = useState();

  const lenghts = [
    { id: 1, value: "meter" },
    { id: 2, value: "kilometer" },
    { id: 3, value: "centimetre" },
    { id: 4, value: "milimetre" },
  ];

  function setUnit1(e) {
    const value = e.target.value;
    if (value === 1) {
      setFromUnit(1);
    } else if (value === 2) {
      setFromUnit(1000);
    } else if (value === 3) {
      setFromUnit(100);
    } else if (value === 4) {
      setFromUnit(0.01);
    }
  }

  function setUnit2(e) {
    const value = e.target.value;
    if (value === 1) {
      setToUnit(1);
    } else if (value === 2) {
      setToUnit(1000);
    } else if (value === 3) {
      setToUnit(100);
    } else if (value === 4) {
      setToUnit(0.01);
    }
  }
  useEffect(() => {
    setResult((toUnit * parseFloat(inputValue1)) / fromUnit);
    setValue((toUnit * parseFloat(inputValue2)) / fromUnit);
  }, [toUnit, fromUnit, inputValue1, inputValue2]);

  console.log(value);
  console.log(result);

  return (
    <div>
      <div>
        <input
          type="text"
          value={value}
          onChange={(e) => setInputValue1(e.target.value)}
        />
        <select onChange={setUnit1}>
          {lenghts.map((lenght) => (
            <option key={lenght.id} value={lenght.id}>
              {lenght.value}
            </option>
          ))}
        </select>
      </div>
      <div>
        <input
          type="text"
          value={result}
          onChange={(e) => setInputValue2(e.target.value)}
        />
        <select onChange={setUnit2}>
          {lenghts.map((lenght) => (
            <option key={lenght.id} value={lenght.id}>
              {lenght.value}
            </option>
          ))}
        </select>
      </div>
    </div>
  );
}
</code>```

Body:
let say a= 20 and b = 10 and c= 12 ..........etc

output of <input/>  two = input value in <input /> one field * (a or b or c.....)

also

output of <input/>  one = input value in <input/> two  field / (a or b or c.....)

let say a= 20 and b = 10 and c= 12 ..........etc

output of <input/>  two = input value in <input /> one field * (a or b or c.....)

also

output of <input/>  one = input value in <input/> two  field / (a or b or c.....)

let say a= 20 and b = 10 and c= 12 ..........etc

output of <input/>  two = input value in <input /> one field * (a or b or c.....)

also

output of <input/>  one = input value in <input/> two  field / (a or b or c.....)

let say a= 20 and b = 10 and c= 12 ..........etc

output of <input/>  two = input value in <input /> one field * (a or b or c.....)

also

output of <input/>  one = input value in <input/> two  field / (a or b or c.....)

let say a= 20 and b = 10 and c= 12 ..........etc

output of <input/>  two = input value in <input /> one field * (a or b or c.....)

also

output of <input/>  one = input value in <input/> two  field / (a or b or c.....)

import { useEffect } from "react";
import { useState } from "react";

export default function Converter() {
  const [fromUnit, setFromUnit] = useState(1);
  const [toUnit, setToUnit] = useState(1);
  const [inputValue1, setInputValue1] = useState(1);
  const [inputValue2, setInputValue2] = useState(1);

  const [value, setValue] = useState();
  const [result, setResult] = useState();

  const lenghts = [
    { id: 1, value: "meter" },
    { id: 2, value: "kilometer" },
    { id: 3, value: "centimetre" },
    { id: 4, value: "milimetre" },
  ];

  function setUnit1(e) {
    const value = e.target.value;
    if (value === 1) {
      setFromUnit(1);
    } else if (value === 2) {
      setFromUnit(1000);
    } else if (value === 3) {
      setFromUnit(100);
    } else if (value === 4) {
      setFromUnit(0.01);
    }
  }

  function setUnit2(e) {
    const value = e.target.value;
    if (value === 1) {
      setToUnit(1);
    } else if (value === 2) {
      setToUnit(1000);
    } else if (value === 3) {
      setToUnit(100);
    } else if (value === 4) {
      setToUnit(0.01);
    }
  }
  useEffect(() => {
    setResult((toUnit * parseFloat(inputValue1)) / fromUnit);
    setValue((toUnit * parseFloat(inputValue2)) / fromUnit);
  }, [toUnit, fromUnit, inputValue1, inputValue2]);

  console.log(value);
  console.log(result);

  return (

        <input
          type="text"
          value={value}
          onChange={(e) => setInputValue1(e.target.value)}
        />
        <select onChange={setUnit1}>
          {lenghts.map((lenght) => (
            <option key={lenght.id} value={lenght.id}>
              {lenght.value}
            </option>
          ))}
        </select>

        <input
          type="text"
          value={result}
          onChange={(e) => setInputValue2(e.target.value)}
        />
        <select onChange={setUnit2}>
          {lenghts.map((lenght) => (
            <option key={lenght.id} value={lenght.id}>
              {lenght.value}
            </option>
          ))}
        </select>

  );
}


来源: stackexchange

问:
Increment dictionary value in JSON document using Python : Azure functions
Currently developing an python backend API that will increment a value in COSMOS DB(azure serverless database) that is currently running NOSQL. Permissions(output/input) bindings is correct. However I'm able to update the cosmos NOSQL document staticky like this:
`

```<code>import azure.functions as func
import json
import logging

def main(req: func.HttpRequest, inputDocument: func.DocumentList,  outputDocument: func.Out[func.DocumentList]) ->str:
    logging.info('Python HTTP trigger function processed a request.')

    name = req.route_params.get('name')
    for name in inputDocument:
        logging.info(name.to_json())

    if name:
        newdocs = func.DocumentList()
        visitors = {"id": "VISITOR", "testpartitionkey": "testpartitionkey", "visitor": 12}
        key = "visitor"
        if key in visitors:
            visitors[key] +=1
        newdocs_load_json= json.dumps(visitors)
        newdocs.append(func.Document.from_json(newdocs_load_json))
        outputDocument.set(newdocs)

        return func.HttpResponse(f"Hello, new value is: {name} {newdocs} {newdocs_load_json} . ....")

</code>```

`
Document is retrieved from a different function reading the specific document, I'm only getting as far as incrementing the correct document only once, but as Python code is static, I need to somewhat fetch the value of the ID and PartitionkeyAPI response that states correct value from Cosmos DB.

After I change python code to following, I'm just getting a default error 500 message. I have been struggeling with this one for a long time, and can't find another way around to increment a value in a JSON document.

Python code I'm trying with:

```<code>import azure.functions as func
import json
import logging

def main(req: func.HttpRequest, inputDocument: func.DocumentList,  outputDocument: func.Out[func.DocumentList]) ->str:
    logging.info('Python HTTP trigger function processed a request.')

    name = req.route_params.get('name')
    for name in inputDocument:
        logging.info(name.to_json())

    if name:
        newdocs = func.DocumentList()
        for user in inputDocument:
            user_json = {
               "id": "VISITOR",
               "testpartitionkey": "testpartitionkey",
               "visitor": user['visitor']
              }
            key = "visitor"
        if key in user_json:
            user_json[key] +=1
        newdocs_load_json= json.dumps(user_json)
        newdocs.append(func.Document.from_json(newdocs_load_json))
        outputDocument.set(newdocs)

        return func.HttpResponse(f"Hello, new value is: {name} {newdocs} {newdocs_load_json} . ....")

</code>```

When checking logs in Azure function, this is what's it stating, it's not able to find the key I would like to update cannot be founderror message received in azure functions

Any ideas how to approach this?

I did change in the code as it stated below here, but not sure if I'm approaching this correct. In short terms I'm expecting this to update an document in a nosql db.

ContentLicense: CC BY-SA 4.0

Body:
Currently developing an python backend API that will increment a value in COSMOS DB(azure serverless database) that is currently running NOSQL. Permissions(output/input) bindings is correct. However I'm able to update the cosmos NOSQL document staticky like this:
`

import azure.functions as func
import json
import logging

def main(req: func.HttpRequest, inputDocument: func.DocumentList,  outputDocument: func.Out[func.DocumentList]) ->str:
    logging.info('Python HTTP trigger function processed a request.')

    name = req.route_params.get('name')
    for name in inputDocument:
        logging.info(name.to_json())

    if name:
        newdocs = func.DocumentList()
        visitors = {"id": "VISITOR", "testpartitionkey": "testpartitionkey", "visitor": 12}
        key = "visitor"
        if key in visitors:
            visitors[key] +=1
        newdocs_load_json= json.dumps(visitors)
        newdocs.append(func.Document.from_json(newdocs_load_json))
        outputDocument.set(newdocs)

        return func.HttpResponse(f"Hello, new value is: {name} {newdocs} {newdocs_load_json} . ....")

`
Document is retrieved from a different function reading the specific document, I'm only getting as far as incrementing the correct document only once, but as Python code is static, I need to somewhat fetch the value of the ID and PartitionkeyAPI response that states correct value from Cosmos DB.

After I change python code to following, I'm just getting a default error 500 message. I have been struggeling with this one for a long time, and can't find another way around to increment a value in a JSON document.

Python code I'm trying with:

import azure.functions as func
import json
import logging

def main(req: func.HttpRequest, inputDocument: func.DocumentList,  outputDocument: func.Out[func.DocumentList]) ->str:
    logging.info('Python HTTP trigger function processed a request.')

    name = req.route_params.get('name')
    for name in inputDocument:
        logging.info(name.to_json())

    if name:
        newdocs = func.DocumentList()
        for user in inputDocument:
            user_json = {
               "id": "VISITOR",
               "testpartitionkey": "testpartitionkey",
               "visitor": user['visitor']
              }
            key = "visitor"
        if key in user_json:
            user_json[key] +=1
        newdocs_load_json= json.dumps(user_json)
        newdocs.append(func.Document.from_json(newdocs_load_json))
        outputDocument.set(newdocs)

        return func.HttpResponse(f"Hello, new value is: {name} {newdocs} {newdocs_load_json} . ....")

When checking logs in Azure function, this is what's it stating, it's not able to find the key I would like to update cannot be founderror message received in azure functions

Any ideas how to approach this?

I did change in the code as it stated below here, but not sure if I'm approaching this correct. In short terms I'm expecting this to update an document in a nosql db.


问:
Ignore MethodArgumentNotValidException or get the sent object
is there a way to ignore the validation done through annotation? In the project that I am working at the moment there is the need to work with predefined generated entities that have some annotated validation, such a email, length, etc.

I want to be able to ignore this validation that is performed through the entity. If this is not possible, I am already able to catch the exception in my exception handler through ControllerAdvice, but I am unable to find a way to get the object that was sent through there. Is this even possible?

This is my handler for it:

```<code>@ExceptionHandler(value = {MethodArgumentNotValidException.class, ConstraintViolationException.class})
public final ResponseEntity handleValidationExceptions(HttpServletRequest request, HttpServletResponse response,
    Object handler) throws IOException {
    return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Not ok");
}
</code>```

I though about intercepting the request with preHandle as well, but then I come to the same issue of how to get the sent object in there. Through the HandlerMethod I know I can see the args that the method will receive but I can't find the request anywhere.

This would also be a suitable solution since I can just perform what I have to do over there and then "resume" the execution to the main method.

Body:
is there a way to ignore the validation done through annotation? In the project that I am working at the moment there is the need to work with predefined generated entities that have some annotated validation, such a email, length, etc.

I want to be able to ignore this validation that is performed through the entity. If this is not possible, I am already able to catch the exception in my exception handler through ControllerAdvice, but I am unable to find a way to get the object that was sent through there. Is this even possible?

This is my handler for it:

@ExceptionHandler(value = {MethodArgumentNotValidException.class, ConstraintViolationException.class})
public final ResponseEntity handleValidationExceptions(HttpServletRequest request, HttpServletResponse response,
    Object handler) throws IOException {
    return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Not ok");
}

I though about intercepting the request with preHandle as well, but then I come to the same issue of how to get the sent object in there. Through the HandlerMethod I know I can see the args that the method will receive but I can't find the request anywhere.

This would also be a suitable solution since I can just perform what I have to do over there and then "resume" the execution to the main method.


问:
How to read an excel file and get exact data types for the fields from the front side using Angular
I am trying to read a file and printing its data types using type of function of typescript for a particular field.

I have tried using the xlsx package and reading and parsing it

This is my source code of .ts file:

export class AppComponent {
  name = 'Angular ' + VERSION.major;
  public tableData: any;
  public tableTitle: any;
  public tableTitle1: any;
  public customPagination = 1;
  public recordsPerPage = 5;
  public tableRecords = [];
  public pageStartCount = 0;
  public pageEndCount = 5;
  public totalPageCount = 0;
  public currentPage = 0;
  fieldCount: number;

  public uploadData(e) {
    console.log(e.target.files[0]);
    /* wire up file reader */
    const target: DataTransfer = <DataTransfer>(<unknown>event.target);

    const reader: FileReader = new FileReader();
    reader.readAsBinaryString(target.files[0]);
    reader.onload = (e: any) => {
      /* create workbook */
      const binarystr: string = e.target.result;
      const wb: XLSX.WorkBook = XLSX.read(binarystr, {
        type: 'binary',
        sheetRows: 6,
      });

      /* selected the first sheet */
      const wsname: string = wb.SheetNames[0];
      const ws: XLSX.WorkSheet = wb.Sheets[wsname];
      /* save data */
      const data = XLSX.utils.sheet_to_json(ws); // to get 2d array pass 2nd parameter as object {header: 1}
      console.log(data); // Data will be logged in array format containing objects

      this.tableData = data;

      this.tableTitle = Object.keys(this.tableData[0]);
      this.fieldCount = this.tableTitle.length;
      this.tableTitle1 = Object.keys(this.tableData[this.tableData.length - 1]);
      this.tableTitle1.forEach((element: any, i: number) => {
        if (!this.tableTitle.includes(element)) {
          this.tableTitle.push(element);
        }
      });

      this.tableRecords = this.tableData.slice();
      let temp = [];
      this.tableRecords.forEach((element: any, i: number) => {
        const dataKey = Object.keys(element);
        const dataValue = Object.values(element);

        let a = {};

        dataKey.forEach((element2: any, i: number) => {
          a[element2] = dataValue[i] + ' ' + typeof dataValue[i];
        });
        temp.push(a);
      });
      this.tableRecords = temp;

      this.totalPageCount = this.tableData.length / this.recordsPerPage;
    };
  }
}
```
<p>This is my HTML file:</p>
<pre class="lang-html prettyprint-override"><code><h1>Please upload CSV file or Excel file</h1>
<div class="uploadDocument">
  <input
    id="my-file-selector"
    type="file" multiple
    (change)="uploadData($event)"
    name="uploadExcel"
  />
  <svg
    xmlns="http://www.w3.org/2000/svg"
    height="24px"
    viewBox="0 0 24 24"
    width="24px"
    fill="#000000"
  >
    <path d="M0 0h24v24H0V0z" fill="none" />
    <path
      d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95C8.08 7.14 9.94 6 12 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11c1.56.1 2.78 1.41 2.78 2.96 0 1.65-1.35 3-3 3zM8 13h2.55v3h2.9v-3H16l-4-4z"
    />
  </svg>
  <span>Please upload file</span>
</div>
<!--pre>{{ tableData | json }}</pre-->
<table cellspacing="0" cellpadding="0">
  <tr>
    <th *ngFor="let header of tableTitle">{{ header }}</th>
  </tr>
  <tr *ngFor="let data of tableRecords; let i = index">
    <td *ngFor="let header of tableTitle">
      {{ data[header] }}
    </td>
    <!-- <td typeof></td> -->
  </tr>
  <div>Total Fields : {{ this.fieldCount }}</div>
</table>

</code>```

And this is the output I am getting:

But as you can see, the data types I am getting are not proper, it is not recognizing float and datetime data types, it is just reading string and number data types.

Stackblitz link:- https://angular-ivy-28fdv3.stackblitz.io

Body:
I am trying to read a file and printing its data types using type of function of typescript for a particular field.

I have tried using the xlsx package and reading and parsing it

This is my source code of .ts file:

export class AppComponent {
  name = 'Angular ' + VERSION.major;
  public tableData: any;
  public tableTitle: any;
  public tableTitle1: any;
  public customPagination = 1;
  public recordsPerPage = 5;
  public tableRecords = [];
  public pageStartCount = 0;
  public pageEndCount = 5;
  public totalPageCount = 0;
  public currentPage = 0;
  fieldCount: number;

  public uploadData(e) {
    console.log(e.target.files[0]);
    /* wire up file reader */
    const target: DataTransfer = <DataTransfer>(<unknown>event.target);

    const reader: FileReader = new FileReader();
    reader.readAsBinaryString(target.files[0]);
    reader.onload = (e: any) => {
      /* create workbook */
      const binarystr: string = e.target.result;
      const wb: XLSX.WorkBook = XLSX.read(binarystr, {
        type: 'binary',
        sheetRows: 6,
      });

      /* selected the first sheet */
      const wsname: string = wb.SheetNames[0];
      const ws: XLSX.WorkSheet = wb.Sheets[wsname];
      /* save data */
      const data = XLSX.utils.sheet_to_json(ws); // to get 2d array pass 2nd parameter as object {header: 1}
      console.log(data); // Data will be logged in array format containing objects

      this.tableData = data;

      this.tableTitle = Object.keys(this.tableData[0]);
      this.fieldCount = this.tableTitle.length;
      this.tableTitle1 = Object.keys(this.tableData[this.tableData.length - 1]);
      this.tableTitle1.forEach((element: any, i: number) => {
        if (!this.tableTitle.includes(element)) {
          this.tableTitle.push(element);
        }
      });

      this.tableRecords = this.tableData.slice();
      let temp = [];
      this.tableRecords.forEach((element: any, i: number) => {
        const dataKey = Object.keys(element);
        const dataValue = Object.values(element);

        let a = {};

        dataKey.forEach((element2: any, i: number) => {
          a[element2] = dataValue[i] + ' ' + typeof dataValue[i];
        });
        temp.push(a);
      });
      this.tableRecords = temp;

      this.totalPageCount = this.tableData.length / this.recordsPerPage;
    };
  }
}

This is my HTML file:

Please upload CSV file or Excel file

  <input
    id="my-file-selector"
    type="file" multiple
    (change)="uploadData($event)"
    name="uploadExcel"
  />
  <svg
    xmlns="http://www.w3.org/2000/svg"
    height="24px"
    viewBox="0 0 24 24"
    width="24px"
    fill="#000000"
  >
    <path d="M0 0h24v24H0V0z" fill="none" />
    <path
      d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95C8.08 7.14 9.94 6 12 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11c1.56.1 2.78 1.41 2.78 2.96 0 1.65-1.35 3-3 3zM8 13h2.55v3h2.9v-3H16l-4-4z"
    />
  </svg>
  Please upload file

    {{ header }}

      {{ data[header] }}

Total Fields : {{ this.fieldCount }}

And this is the output I am getting:

But as you can see, the data types I am getting are not proper, it is not recognizing float and datetime data types, it is just reading string and number data types.

Stackblitz link:- https://angular-ivy-28fdv3.stackblitz.io


问:
Chrome extension MV3 doesn't work with Vite server?
I'm trying to create a Chrome Extension with Vite and HMR.

My Vite configuration for Popup only...

 base: isServer ? 'https://localhost:3303/' : './',
    server: {
      port: 3303,
      hmr: {
        host: 'localhost'
      }
    },
    build: {
      sourcemap: isDevelopment ? 'inline' : false,
      outDir: path.resolve('dist/'),
      emptyOutDir: false,
      terserOptions: {
        mangle: false
      },
      rollupOptions: {
        input: {
          index: path.resolve(pagesDirectory, 'popup', 'index.html')
        },
        output: {
          sourcemap: true,
          entryFileNames: 'src/pages/[name]/index.js',
          chunkFileNames: isDevelopment ? 'assets/js/[name].js' : 'assets/js/[name].[hash].js',
          assetFileNames: (assetInfo) => {
            const { dir, name: _name } = path.parse(assetInfo.name);
            const assetFolder = getLastElement(dir.split('/'));
            const name = assetFolder + firstUpperCase(_name);
            return `assets/[ext]/${name}.chunk.[ext]`;
          }
        }
      }

... // Other configuration
```
<p>And this results on this HTML</p>
<pre class="lang-html prettyprint-override"><code><!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover" />
    <link rel="preconnect" href="//firebaseinstallations.googleapis.com">
    <link rel="preconnect" href="//firebaseremoteconfig.googleapis.com">
    <link rel="preconnect" href="//firebaselogging-pa.googleapis.com">
    <title>Popup</title>
</head>

<body>
<div id="app-container">Vite server did not start</div>
<script type="module" src="http://localhost:3303/popup/index.tsx"></script>
</body>
</html>

</code>```

My manifest

```<code>{
  "manifest_version": 3,
  "background": {
    "service_worker": "src/pages/background/background.global.js"
  },
  "permissions": [
    "tabs",
    "webNavigation"
  ],
  "host_permissions": [
    "http://*/*",
    "https://*/*",
    "http://localhost:3303/*"
  ],
  "content_security_policy": {
    "extension_pages": "script-src 'self'; default-src 'self'; object-src 'self'"
  },
  "content_scripts": [
    {
      "matches": [
        "https://*.google.com/search?q*"
      ],
      "css": [
        "src/pages/contentScript/style.css"
      ],
      "js": [
        "src/pages/contentScript/contentScript.global.js"
      ]
    }
  ],
  "action": {
    "default_title": "Web Answers",
    "default_popup": "src/pages/popup/index.html"
  },
  "web_accessible_resources": [
    {
      "resources": [
        "assets/js/**/*"
      ],
      "matches": [
        "<all_urls>"
      ]
    },
    {
      "resources": [
        "src/pages/**/*.js.map"
      ],
      "matches": [
        "<all_urls>"
      ]
    },
    {
      "resources": [
        "src/pages/**/*.css"
      ],
      "matches": [
        "<all_urls>"
      ]
    },
    {
      "resources": [
        "locales/*"
      ],
      "matches": [
        "<all_urls>"
      ]
    }
  ],
}
</code>```

Error

With this configuration, I'm getting this error

Vite server did not start

Second attempt

In the manifest, I included http://localhost:3303 into extension_pages...

```<code>...
"content_security_policy": {
    "extension_pages": "script-src 'self' 'http://localhost:3303'; default-src 'self'; object-src 'self'"
  },
...
</code>```

'content_security_policy.extension_pages': Insecure CSP value "'http://localhost:3303'" in directive 'script-src'.
Could not load manifest.

Body:
I'm trying to create a Chrome Extension with Vite and HMR.

My Vite configuration for Popup only...

 base: isServer ? 'https://localhost:3303/' : './',
    server: {
      port: 3303,
      hmr: {
        host: 'localhost'
      }
    },
    build: {
      sourcemap: isDevelopment ? 'inline' : false,
      outDir: path.resolve('dist/'),
      emptyOutDir: false,
      terserOptions: {
        mangle: false
      },
      rollupOptions: {
        input: {
          index: path.resolve(pagesDirectory, 'popup', 'index.html')
        },
        output: {
          sourcemap: true,
          entryFileNames: 'src/pages/[name]/index.js',
          chunkFileNames: isDevelopment ? 'assets/js/[name].js' : 'assets/js/[name].[hash].js',
          assetFileNames: (assetInfo) => {
            const { dir, name: _name } = path.parse(assetInfo.name);
            const assetFolder = getLastElement(dir.split('/'));
            const name = assetFolder + firstUpperCase(_name);
            return `assets/[ext]/${name}.chunk.[ext]`;
          }
        }
      }

... // Other configuration

And this results on this HTML

<!DOCTYPE html>

    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover" />
    <link rel="preconnect" href="//firebaseinstallations.googleapis.com">
    <link rel="preconnect" href="//firebaseremoteconfig.googleapis.com">
    <link rel="preconnect" href="//firebaselogging-pa.googleapis.com">
    <title>Popup</title>

Vite server did not start

My manifest

{
  "manifest_version": 3,
  "background": {
    "service_worker": "src/pages/background/background.global.js"
  },
  "permissions": [
    "tabs",
    "webNavigation"
  ],
  "host_permissions": [
    "http://*/*",
    "https://*/*",
    "http://localhost:3303/*"
  ],
  "content_security_policy": {
    "extension_pages": "script-src 'self'; default-src 'self'; object-src 'self'"
  },
  "content_scripts": [
    {
      "matches": [
        "https://*.google.com/search?q*"
      ],
      "css": [
        "src/pages/contentScript/style.css"
      ],
      "js": [
        "src/pages/contentScript/contentScript.global.js"
      ]
    }
  ],
  "action": {
    "default_title": "Web Answers",
    "default_popup": "src/pages/popup/index.html"
  },
  "web_accessible_resources": [
    {
      "resources": [
        "assets/js/**/*"
      ],
      "matches": [
        "<all_urls>"
      ]
    },
    {
      "resources": [
        "src/pages/**/*.js.map"
      ],
      "matches": [
        "<all_urls>"
      ]
    },
    {
      "resources": [
        "src/pages/**/*.css"
      ],
      "matches": [
        "<all_urls>"
      ]
    },
    {
      "resources": [
        "locales/*"
      ],
      "matches": [
        "<all_urls>"
      ]
    }
  ],
}

Error

With this configuration, I'm getting this error

Vite server did not start

Second attempt

In the manifest, I included http://localhost:3303 into extension_pages...

...
"content_security_policy": {
    "extension_pages": "script-src 'self' 'http://localhost:3303'; default-src 'self'; object-src 'self'"
  },
...

'content_security_policy.extension_pages': Insecure CSP value "'http://localhost:3303'" in directive 'script-src'.
Could not load manifest.


问:
Managing TLS certs on GCP marketplace for kubernetes apps
I am working on packaging our kubernetes application to be listed on GCP Marketplace.
I am stuck at passing TLS from the GCP marketplace UI to our kubernetes application.

Wrote schema to take certificates as mentioned here , but how exactly do we pass the contents of the certificate files to the application?

Reference Link: https://github.com/GoogleCloudPlatform/marketplace-k8s-app-tools


问:
Invalid iops to storage (GB) ratio for engine name aurora-postgresql and storage type aurora
I tried to create aurora PostgreSQL using troposphere.

```<code>self.add_resource(
    rds.DBInstance(
        identifier,
        AllocatedStorage="50",
        Engine="aurora-postgresql",
        MasterUsername="myName",
        DBSubnetGroupName=Ref(subnet_group),
        MasterUserPassword="myPassword",
        DBInstanceClass="db.t4g.medium",
        SourceRegion="eu-west-1"

    )
)
</code>```

When I executed this, I'm getting below error.

```<code>Invalid iops to storage (GB) ratio for engine name aurora-postgresql and storage type aurora: 0.0000
</code>```

Based on the [1] Iops is not required for Amazon Aurora. Then how can I get this issue?
Appreciate your responses.

[1] https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#USER_PIOPS

Body:
I tried to create aurora PostgreSQL using troposphere.

self.add_resource(
    rds.DBInstance(
        identifier,
        AllocatedStorage="50",
        Engine="aurora-postgresql",
        MasterUsername="myName",
        DBSubnetGroupName=Ref(subnet_group),
        MasterUserPassword="myPassword",
        DBInstanceClass="db.t4g.medium",
        SourceRegion="eu-west-1"

    )
)

When I executed this, I'm getting below error.

Invalid iops to storage (GB) ratio for engine name aurora-postgresql and storage type aurora: 0.0000

Based on the [1] Iops is not required for Amazon Aurora. Then how can I get this issue?
Appreciate your responses.

[1] https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#USER_PIOPS


问:
python 3.9 magenta not working on Windows
I receive various error when trying to install magenta with pip

i get an error for building wheels for numba, llvmlite and python-rtmidi example for numba:

```<code>  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-39
      creating build\lib.win-amd64-cpython-39\rtmidi
      copying rtmidi\midiconstants.py -> build\lib.win-amd64-cpython-39\rtmidi
      copying rtmidi\midiutil.py -> build\lib.win-amd64-cpython-39\rtmidi
      copying rtmidi\release.py -> build\lib.win-amd64-cpython-39\rtmidi
      copying rtmidi\__init__.py -> build\lib.win-amd64-cpython-39\rtmidi
      running build_ext
      building 'rtmidi._rtmidi' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for python-rtmidi
  Running setup.py clean for python-rtmidi
  Building wheel for llvmlite (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [40 lines of output]
      running bdist_wheel
      C:\Users\Dell\anaconda3\python.exe C:\Users\Dell\AppData\Local\Temp\pip-install-f301n_gf\llvmlite_52e74a978a1540339621403e230729a1\ffi\build.py
      -- Selecting Windows SDK version  to target Windows 10.0.19044.
      CMake Error at CMakeLists.txt:3 (project):
        Failed to run MSBuild command:

          MSBuild.exe

        to get the value of VCTargetsPath:

          Das System kann die angegebene Datei nicht finden

      -- Configuring incomplete, errors occurred!
      See also "C:/Users/Dell/AppData/Local/Temp/tmpjza6m78t/CMakeFiles/CMakeOutput.log".
      CMake Error at CMakeLists.txt:3 (project):
        Generator

          Visual Studio 15 2017 Win64

        could not find any instance of Visual Studio.

      -- Configuring incomplete, errors occurred!
      See also "C:/Users/Dell/AppData/Local/Temp/tmp0ap85972/CMakeFiles/CMakeOutput.log".
      Trying generator 'Visual Studio 14 2015 Win64'
      Trying generator 'Visual Studio 15 2017 Win64'
      Traceback (most recent call last):
        File "C:\Users\Dell\AppData\Local\Temp\pip-install-f301n_gf\llvmlite_52e74a978a1540339621403e230729a1\ffi\build.py", line 192, in <module>
          main()
        File "C:\Users\Dell\AppData\Local\Temp\pip-install-f301n_gf\llvmlite_52e74a978a1540339621403e230729a1\ffi\build.py", line 180, in main
          main_win32()
        File "C:\Users\Dell\AppData\Local\Temp\pip-install-f301n_gf\llvmlite_52e74a978a1540339621403e230729a1\ffi\build.py", line 89, in main_win32
          generator = find_win32_generator()
        File "C:\Users\Dell\AppData\Local\Temp\pip-install-f301n_gf\llvmlite_52e74a978a1540339621403e230729a1\ffi\build.py", line 85, in find_win32_generator
          raise RuntimeError("No compatible cmake generator installed on this machine")
      RuntimeError: No compatible cmake generator installed on this machine
      error: command 'C:\\Users\\Dell\\anaconda3\\python.exe' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for llvmlite
  Running setup.py clean for llvmlite
Failed to build numba python-rtmidi llvmlite
Installing collected packages: python-rtmidi, pygtrie, mido, llvmlite, keras, flatbuffers, tensorflow-estimator, sox, scipy, protobuf, promise, numba, keras-preprocessing, importlib_resources, imageio, etils, absl-py, tf-slim, tensorflow-probability, sk-video, resampy, mir-eval, matplotlib, googleapis-common-protos, dm-sonnet, tensorflow-metadata, librosa, tensorflow-datasets, tensorboard, note-seq, tensorflow, magenta
  Running setup.py install for python-rtmidi ... error
  error: subprocess-exited-with-error

  × Running setup.py install for python-rtmidi did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      running install
      C:\Users\Dell\anaconda3\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-39
      creating build\lib.win-amd64-cpython-39\rtmidi
      copying rtmidi\midiconstants.py -> build\lib.win-amd64-cpython-39\rtmidi
      copying rtmidi\midiutil.py -> build\lib.win-amd64-cpython-39\rtmidi
      copying rtmidi\release.py -> build\lib.win-amd64-cpython-39\rtmidi
      copying rtmidi\__init__.py -> build\lib.win-amd64-cpython-39\rtmidi
      running build_ext
      building 'rtmidi._rtmidi' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> python-rtmidi

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
</code>```

I have no idea how to continue. Do you have a solution for this?

What we've found out is, that this issue is only appearing on windows but working on mac OS.

my python version is 3.9.13

Thank you very much!

tried to install magenta but receive errors

what I already tried and didn't work:

reinstall all 3 packages

downgrade versions of those packages

the same with cmake and wheel package

install windows sdk

test it on another device

Body:
I receive various error when trying to install magenta with pip

i get an error for building wheels for numba, llvmlite and python-rtmidi example for numba:

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-39
      creating build\lib.win-amd64-cpython-39\rtmidi
      copying rtmidi\midiconstants.py -> build\lib.win-amd64-cpython-39\rtmidi
      copying rtmidi\midiutil.py -> build\lib.win-amd64-cpython-39\rtmidi
      copying rtmidi\release.py -> build\lib.win-amd64-cpython-39\rtmidi
      copying rtmidi\__init__.py -> build\lib.win-amd64-cpython-39\rtmidi
      running build_ext
      building 'rtmidi._rtmidi' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for python-rtmidi
  Running setup.py clean for python-rtmidi
  Building wheel for llvmlite (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [40 lines of output]
      running bdist_wheel
      C:\Users\Dell\anaconda3\python.exe C:\Users\Dell\AppData\Local\Temp\pip-install-f301n_gf\llvmlite_52e74a978a1540339621403e230729a1\ffi\build.py
      -- Selecting Windows SDK version  to target Windows 10.0.19044.
      CMake Error at CMakeLists.txt:3 (project):
        Failed to run MSBuild command:

          MSBuild.exe

        to get the value of VCTargetsPath:

          Das System kann die angegebene Datei nicht finden

      -- Configuring incomplete, errors occurred!
      See also "C:/Users/Dell/AppData/Local/Temp/tmpjza6m78t/CMakeFiles/CMakeOutput.log".
      CMake Error at CMakeLists.txt:3 (project):
        Generator

          Visual Studio 15 2017 Win64

        could not find any instance of Visual Studio.

      -- Configuring incomplete, errors occurred!
      See also "C:/Users/Dell/AppData/Local/Temp/tmp0ap85972/CMakeFiles/CMakeOutput.log".
      Trying generator 'Visual Studio 14 2015 Win64'
      Trying generator 'Visual Studio 15 2017 Win64'
      Traceback (most recent call last):
        File "C:\Users\Dell\AppData\Local\Temp\pip-install-f301n_gf\llvmlite_52e74a978a1540339621403e230729a1\ffi\build.py", line 192, in <module>
          main()
        File "C:\Users\Dell\AppData\Local\Temp\pip-install-f301n_gf\llvmlite_52e74a978a1540339621403e230729a1\ffi\build.py", line 180, in main
          main_win32()
        File "C:\Users\Dell\AppData\Local\Temp\pip-install-f301n_gf\llvmlite_52e74a978a1540339621403e230729a1\ffi\build.py", line 89, in main_win32
          generator = find_win32_generator()
        File "C:\Users\Dell\AppData\Local\Temp\pip-install-f301n_gf\llvmlite_52e74a978a1540339621403e230729a1\ffi\build.py", line 85, in find_win32_generator
          raise RuntimeError("No compatible cmake generator installed on this machine")
      RuntimeError: No compatible cmake generator installed on this machine
      error: command 'C:\\Users\\Dell\\anaconda3\\python.exe' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for llvmlite
  Running setup.py clean for llvmlite
Failed to build numba python-rtmidi llvmlite
Installing collected packages: python-rtmidi, pygtrie, mido, llvmlite, keras, flatbuffers, tensorflow-estimator, sox, scipy, protobuf, promise, numba, keras-preprocessing, importlib_resources, imageio, etils, absl-py, tf-slim, tensorflow-probability, sk-video, resampy, mir-eval, matplotlib, googleapis-common-protos, dm-sonnet, tensorflow-metadata, librosa, tensorflow-datasets, tensorboard, note-seq, tensorflow, magenta
  Running setup.py install for python-rtmidi ... error
  error: subprocess-exited-with-error

  × Running setup.py install for python-rtmidi did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      running install
      C:\Users\Dell\anaconda3\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-39
      creating build\lib.win-amd64-cpython-39\rtmidi
      copying rtmidi\midiconstants.py -> build\lib.win-amd64-cpython-39\rtmidi
      copying rtmidi\midiutil.py -> build\lib.win-amd64-cpython-39\rtmidi
      copying rtmidi\release.py -> build\lib.win-amd64-cpython-39\rtmidi
      copying rtmidi\__init__.py -> build\lib.win-amd64-cpython-39\rtmidi
      running build_ext
      building 'rtmidi._rtmidi' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> python-rtmidi

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

I have no idea how to continue. Do you have a solution for this?

What we've found out is, that this issue is only appearing on windows but working on mac OS.

my python version is 3.9.13

Thank you very much!

tried to install magenta but receive errors

what I already tried and didn't work:

reinstall all 3 packages

downgrade versions of those packages

the same with cmake and wheel package

install windows sdk

test it on another device


问:
How to override application.yaml or configmap.yaml dynamically
How to override application.yaml or configmap.yaml property values dynamically or during runtime in springboot using java

i am having 3 Boolean flags in application.yaml, by default A1,A2 will be false and i am introducing 3rd Boolean Z.

1st scenario: if ZConnector.isEnable: ture means

A1Connector.isEnable: true
A2Connector.isEnable: false

2nd scenario: if ZConnector.isEnable: false means

A1Connector.isEnable: false
A2Connector.isEnable: true

once the application is started means value should be override in application.yaml or configmap.yaml and maintain override value in full session.

I tried using postconstruct method but the value is not maintained in the session, it is maintained in the implemented class only instead in session.


问:
reading value from textbox in mvc application
I'm working on old mvc application, and I'm trying to read value from textbox (textmode = "Date"), but in Text attribute I got empty string, how can I fix this? The code is below</p>
```<code><asp:TextBox ID="DateFrom" autocomplete="off" runat="server" textmode="Date" Width="150px" Height="20px" ClientIDMode="Static"></asp:TextBox><br />

DateTime dateFrom = DateTime.Parse(DateFrom.Text); //DateFrom.Text = """
</code>```

Body:
I'm working on old mvc application, and I'm trying to read value from textbox (textmode = "Date"), but in Text attribute I got empty string, how can I fix this? The code is below

<asp:TextBox ID="DateFrom" autocomplete="off" runat="server" textmode="Date" Width="150px" Height="20px" ClientIDMode="Static"></asp:TextBox>

DateTime dateFrom = DateTime.Parse(DateFrom.Text); //DateFrom.Text = """


问:
Deno + Vite + Sass failed to load
I'm trying to use Sass with Deno + Vite (see templates create-vite-extra).

I added import "npm:sass@^1.57.0" to vite.config.mjs. The package is available in node_modules.

It seems Vite fails to resolve the path to sass, but given the callstack I'm not sure if this is a bug in Vite or Deno.

```<code>14:03:05 [vite] Internal server error: Preprocessor dependency "sass" failed to load:
Empty filepath.
  Plugin: vite:css
  File: C:/project/src/foo.scss
      at pathDirname (deno:ext/node/02_require.js:50:13)
      at new Module (deno:ext/node/02_require.js:255:17)
      at Function.Module._resolveFilename (deno:ext/node/02_require.js:553:30)
      at Function.resolve (deno:ext/node/02_require.js:811:21)
      at requireResolveFromRootWithFallback (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:12238:23)
      at loadPreprocessor (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:38038:26)
      at scss (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:38083:20)
      at compileCSS (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:37603:40)
      at async TransformContext.transform (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:37156:56)
      at async Object.transform (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:42626:30)
      at async loadAndTransform (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:40434:29)
      at loadPreprocessor (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:38046:29)
      at scss (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:38083:20)
      at compileCSS (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:37603:40)
      at async TransformContext.transform (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:37156:56)
      at async Object.transform (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:42626:30)
      at async loadAndTransform (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:40434:29)
</code>```

Update

I retested with Deno version v1.31.1 but unfortunately still getting the same error.

Title: Deno + Vite + Sass failed to load

Body:
I'm trying to use Sass with Deno + Vite (see templates create-vite-extra).

I added import "npm:sass@^1.57.0" to vite.config.mjs. The package is available in node_modules.

It seems Vite fails to resolve the path to sass, but given the callstack I'm not sure if this is a bug in Vite or Deno.

14:03:05 [vite] Internal server error: Preprocessor dependency "sass" failed to load:
Empty filepath.
  Plugin: vite:css
  File: C:/project/src/foo.scss
      at pathDirname (deno:ext/node/02_require.js:50:13)
      at new Module (deno:ext/node/02_require.js:255:17)
      at Function.Module._resolveFilename (deno:ext/node/02_require.js:553:30)
      at Function.resolve (deno:ext/node/02_require.js:811:21)
      at requireResolveFromRootWithFallback (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:12238:23)
      at loadPreprocessor (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:38038:26)
      at scss (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:38083:20)
      at compileCSS (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:37603:40)
      at async TransformContext.transform (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:37156:56)
      at async Object.transform (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:42626:30)
      at async loadAndTransform (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:40434:29)
      at loadPreprocessor (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:38046:29)
      at scss (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:38083:20)
      at compileCSS (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:37603:40)
      at async TransformContext.transform (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:37156:56)
      at async Object.transform (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:42626:30)
      at async loadAndTransform (file:///C:/project/node_modules/.deno/vite@4.0.2/node_modules/vite/dist/node/chunks/dep-6305614c.js:40434:29)

Update

I retested with Deno version v1.31.1 but unfortunately still getting the same error.


问:
How to skip accessor when eager loading inside model relations
I have model loan_request inside it I am maing a relation to get repay_loans

```<code>public function repay_loans() {
    return $this->hasMany("App\Models\LoanTransaction", "loan_request_id")->where("amount", "<", 0)->whereNotNull("paid_date")->with("payslip");
}
</code>```

now in above code ->with("payslip") has an accessor named reminder but I dont want it here how can I skip here.

Body:
I have model loan_request inside it I am maing a relation to get repay_loans

public function repay_loans() {
    return $this->hasMany("App\Models\LoanTransaction", "loan_request_id")->where("amount", "<", 0)->whereNotNull("paid_date")->with("payslip");
}

now in above code ->with("payslip") has an accessor named reminder but I dont want it here how can I skip here.


问:
Does the end user need to install Docker?
I'm writing a .NET Framework application and decided to use Docker, but every example online seems to run the docker run command from the command line. My end users won't have Docker installed nor will they have experience using the command line. For them, using the app should be:

Download app.exe

Run it

Open app

Not installing Docker and running docker run. Am I missing the purpose of Docker here? Isn't supposed to create an exe file that containarize the app in some way?


问:
react-native-wifi-p2p sendFile() and receiveFile() is not working
I have created a react native app where initially the server creates a group, and then the client connects to the group.The server should send those files to the client. I tried sending files by calling receiveFiles() in the client and then sendFiles() in the server. In the server it displays as "You can use the storage" but the client doesn't receive the files. How can I send files from the server to the client?

We want to share data from one device to another device using wifi-direct. Here we are using react-native-wifi-p2p (https://www.npmjs.com/package/react-native-wifi-p2p)

```<code> onSendFile = () => {
//const url = '/storage/sdcard0/Music/Rammstein:Amerika.mp3';
PermissionsAndroid.request(
  PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE
)
  .then((granted: any) => {
    if (granted === PermissionsAndroid.RESULTS.GRANTED) {
      console.log('You can use the storage');
    } else {
      console.log('Storage permission denied');
    }
  })
  .then(() => {
    return PermissionsAndroid.request(
      PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE
    );
  })
  .then(() => {
    DocumentPicker.pick({
      presentationStyle: 'fullScreen',
    })
      .then(async (file) => {
        // Send the selected file
        console.log(file[0].uri);
        const filePath = file[0].uri;
        RNFetchBlob.fs
          .readFile(filePath, 'base64')
          .then((data) => {
            sendFile(data);
          })
          .catch((err) => { console.log(err); });
      })
      .catch((err: any) => {
        // Error selecting file
        console.log(err);
      });
    // const response = await DocumentPicker.pick({
    //   presentationStyle: 'fullScreen',
    // });
    // console.log(response[0].uri);
    // return sendFile(response[0].uri)
    //   .then((metaInfo: any) => console.log('File sent successfully', metaInfo))
    //   .catch((err: any) => console.log('Error while file sending', err));
  })
  .catch((err: any) => console.log(err));
</code>```

};

ReceiveFile

```<code>onReceiveFile = () => {
PermissionsAndroid.request(
  PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE
)
  .then((granted: any) => {
    if (granted === PermissionsAndroid.RESULTS.GRANTED) {
      console.log('You can use the storage');
    } else {
      console.log('Storage permission denied');
    }
  })
  .then(() => {
    return PermissionsAndroid.request(
      PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE
    );
  })
  .then(() => {

    console.log('tag 98');
    // eslint-disable-next-line no-undef
    return receiveFile("/storage/", "test.txt")
      .then((file) => {
        console.log('File received successfully');
        const filePath = `${folder}/${file.name}`
        RNFS.writeFile(filePath, file.data, 'base64')
          .then(() => {
            console.log('File received successfully');
          })
          .catch((err) => {
            console.log(err);
          })
      })
      .catch((err: any) => console.log('Error while file receiving', err));
  })
  .catch((err: any) => {
    console.log("Tag 78" + err);
  });
</code>```

};

Body:
I have created a react native app where initially the server creates a group, and then the client connects to the group.The server should send those files to the client. I tried sending files by calling receiveFiles() in the client and then sendFiles() in the server. In the server it displays as "You can use the storage" but the client doesn't receive the files. How can I send files from the server to the client?

We want to share data from one device to another device using wifi-direct. Here we are using react-native-wifi-p2p (https://www.npmjs.com/package/react-native-wifi-p2p)

 onSendFile = () => {
//const url = '/storage/sdcard0/Music/Rammstein:Amerika.mp3';
PermissionsAndroid.request(
  PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE
)
  .then((granted: any) => {
    if (granted === PermissionsAndroid.RESULTS.GRANTED) {
      console.log('You can use the storage');
    } else {
      console.log('Storage permission denied');
    }
  })
  .then(() => {
    return PermissionsAndroid.request(
      PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE
    );
  })
  .then(() => {
    DocumentPicker.pick({
      presentationStyle: 'fullScreen',
    })
      .then(async (file) => {
        // Send the selected file
        console.log(file[0].uri);
        const filePath = file[0].uri;
        RNFetchBlob.fs
          .readFile(filePath, 'base64')
          .then((data) => {
            sendFile(data);
          })
          .catch((err) => { console.log(err); });
      })
      .catch((err: any) => {
        // Error selecting file
        console.log(err);
      });
    // const response = await DocumentPicker.pick({
    //   presentationStyle: 'fullScreen',
    // });
    // console.log(response[0].uri);
    // return sendFile(response[0].uri)
    //   .then((metaInfo: any) => console.log('File sent successfully', metaInfo))
    //   .catch((err: any) => console.log('Error while file sending', err));
  })
  .catch((err: any) => console.log(err));

};

ReceiveFile

onReceiveFile = () => {
PermissionsAndroid.request(
  PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE
)
  .then((granted: any) => {
    if (granted === PermissionsAndroid.RESULTS.GRANTED) {
      console.log('You can use the storage');
    } else {
      console.log('Storage permission denied');
    }
  })
  .then(() => {
    return PermissionsAndroid.request(
      PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE
    );
  })
  .then(() => {

    console.log('tag 98');
    // eslint-disable-next-line no-undef
    return receiveFile("/storage/", "test.txt")
      .then((file) => {
        console.log('File received successfully');
        const filePath = `${folder}/${file.name}`
        RNFS.writeFile(filePath, file.data, 'base64')
          .then(() => {
            console.log('File received successfully');
          })
          .catch((err) => {
            console.log(err);
          })
      })
      .catch((err: any) => console.log('Error while file receiving', err));
  })
  .catch((err: any) => {
    console.log("Tag 78" + err);
  });

};


问:
push local environment variable stored in .env.local to Vercel project
How to push all environment variables stored in .env.local to a Vercel project?

Do I really need to add them one by one with

vercel env add [name] [environment] [gitbranch] < [file]

as specified in the docs
https://vercel.com/docs/cli/env


问:
Create Filter activity in automation with SSJS
We would like to create a filter activity and add it on an automation based on Data filter already existing.
Is it possible to create it with SSJS ? I created the Data filter with SSJS but I don't know if it's possible to create the Filter acttivity with SSJS.

Thank you in advance,
Ilyass

I created the Data filter with SSJS.


问:
Auto embed YouTube channel 3-4 latest videos
I want to auto embed the most recent videos from our YouTube channel to our website so I don't have to go in and copy/paste the embed code every time we post a new video (which is becoming more frequent). I don't want jQuery in the code because pulling from the library slows our site down significantly, so ideally a purely JavaScript solution would work.

I tried the following to load the first video automatically, with the surrounding code to make the page still run quickly.

```


Title: I want to get more specific float numbers on certain areas of the graph that have a dot on them(python matplotlib)

Body:
I have a small piece of code that displays some data with Python and matplotlib in a graph using scatter() and errorbar(), but I want the numbers to be more specific on points with dots on them using floats. I don't want overlapping and I want to be able to see the entire graph without having to move so that when I save it to a file it's all visible

Here's the code:

import matplotlib.pyplot as plt

y = [88, 137, 134, 78, 107, 154, 108, 123, 118, 133, 125, 140, 66, 82, 28, 45, 102, 68, 4, 1, 155, 5, 124, 95, 107, 36, 127, 63, 90, 32, 64, 148, 130, 141, 73, 99, 149, 18, 3, 30, 16, 85, 149, 67, 29, 18, 153, 79, 69, 9, 124, 119, 22, 9, 10, 122, 144, 36, 5, 128, 126, 155, 34, 133, 49, 36, 60, 83, 152, 135, 40, 28, 150, 80, 150, 127, 13, 85, 56, 61, 37, 152, 25, 7, 125, 45, 59, 41, 13, 17, 56, 44, 155, 40, 14, 69, 96, 114, 128, 51, 135, 87, 132, 132, 132, 38, 83, 21, 93, 111, 43, 84, 148, 22, 24, 99, 23, 95, 72, 102, 135, 8, 27, 49, 105, 111, 43, 50, 31, 155, 28, 8, 151, 99, 28, 14, 122, 9, 147, 91, 81, 147, 28, 125]
x = [-69, -118, -115, -59, -88, -135, -89, -104, -99, -114, -106, -121, -47, -63, -9, -26, -83, -49, 15, 18, -136, 14, -105, -76, -88, -17, -108, -44, -71, -13, -45, -129, -111, -122, -54, -80, -130, 1, 16, -11, 3, -66, -130, -48, -10, 1, -134, -60, -50, 10, -105, -100, -3, 10, 9, -103, -125, -17, 14, -109, -107, -136, -15, -114, -30, -17, -41, -64, -133, -116, -21, -9, -131, -61, -131, -108, 6, -66, -37, -42, -18, -133, -6, 12, -106, -26, -40, -22, 6, 2, -37, -25, -136, -21, 5, -50, -77, -95, -109, -32, -116, -68, -113, -113, -113, -19, -64, -2, -74, -92, -24, -65, -129, -3, -5, -80, -4, -76, -53, -83, -116, 11, -8, -30, -86, -92, -24, -31, -12, -136, -9, 11, -132, -80, -9, 5, -103, 10, -128, -72, -62, -128, -9, -106]

plt.scatter(x, y, c = 'red')
plt.errorbar(x, y, c = 'red')
plt.title("EL")
plt.xlabel("X")
plt.ylabel("Y")
plt.savefig("tst.png")
plt.show()


问:
Can I modify headers in a Origin Request Function that I can access in Viewer Response function? (AWS Cloudfront)

Background

I'm using

an origin request function (LambdaEdge)

a viewer response function (Cloudfront Function)

In the origin request function I'm querying a database. In some cases I want to rewrite the request to an error document.

The handler of the origin request function contains something like:

```<code>if (entity === undefined) {
      request.uri = '/errorPages/entityNotFound.txt'
      request.headers['error-page'] = [
        {
          value: 'entityNotFound',
        },
      ]
    }
</code>```

In the viewer response function I need to change the http status code from 200 to 404. In order to do that I wanted to check the header.

Problem

Neither the event.request.headers nor the event.response.headers objects of viewer response function contains the headers I'm setting in origin request function.

Question

can I access the headers in viewer response function that I'm setting in origin request function.

alternatively, can I pass information between these two in any other way? (uri in event.request.uri is only what the user initially navigated to, and event.response doesn't contain uri)

Body:
Background

I'm using

an origin request function (LambdaEdge)

a viewer response function (Cloudfront Function)

In the origin request function I'm querying a database. In some cases I want to rewrite the request to an error document.

The handler of the origin request function contains something like:

if (entity === undefined) {
      request.uri = '/errorPages/entityNotFound.txt'
      request.headers['error-page'] = [
        {
          value: 'entityNotFound',
        },
      ]
    }

In the viewer response function I need to change the http status code from 200 to 404. In order to do that I wanted to check the header.

Problem

Neither the event.request.headers nor the event.response.headers objects of viewer response function contains the headers I'm setting in origin request function.

Question

can I access the headers in viewer response function that I'm setting in origin request function.

alternatively, can I pass information between these two in any other way? (uri in event.request.uri is only what the user initially navigated to, and event.response doesn't contain uri)


问:
Authenticated requests not reaching their endpoints through filter chain
I'm hoping someone can help me with this question please. I've done some searches online but I'm not sure if I'm using the right terminology so not finding articles that appear completely relevant.

As is probably apparent in the code, I'm only a few months into learning Java / Spring Boot.

Prior to adding a WebFilter, all endpoints in my application were tested and worked correctly.

After implementing my webfilter, a bunch of my use cases don't work. For example, a PATCH request to the '/member/update' endpoint with the correct payload doesn't seem to reach the endpoint code in the restcontroller.

My Webfilter code is below.

```<code>package com.example.assessment.Filter;

import com.example.assessment.ClassBooking.DTOs.NewClassBookingDTO;
import com.example.assessment.Instructor.DTOs.InstructorCredentialsDTO;
import com.example.assessment.Instructor.Entities.Instructor;
import com.example.assessment.Instructor.InstructorService;
import com.example.assessment.Member.DTOs.MemberCredentialsDTO;
import com.example.assessment.Member.DTOs.UpdatedMemberDTO;
import com.example.assessment.Member.Entities.Member;
import com.example.assessment.Member.MemberService;
import com.example.assessment.Workout.DTOs.NewWorkoutDTO;
import com.example.assessment.Workout.Entities.Workout;
import com.example.assessment.Workout.WorkoutRepository;
import com.example.assessment.WorkoutExercise.DTOs.NewWorkoutExerciseDTO;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@AllArgsConstructor
@WebFilter(urlPatterns = {"/*"})
public class AuthorisationFilter implements Filter {

    private final MemberService memberService;
    private final InstructorService instructorService;

    private final WorkoutRepository workoutRepository;

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest)servletRequest;
        HttpServletResponse response = (HttpServletResponse)servletResponse;
        String requestURI = request.getRequestURI().toLowerCase();

        // AUTHORISATION RULES
        if (requestURI.contains("member/create")) {
            // No authorisation required to create a new member
            filterChain.doFilter(servletRequest, servletResponse);
        }
        else if (memberIsAuthorised(request)) {
            filterChain.doFilter(servletRequest, servletResponse);
        } else {
            response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
        }
    }

    private boolean memberIsAuthorised(HttpServletRequest request) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        String requestURI = request.getRequestURI().toLowerCase();
        String token = request.getHeader("AUTHORIZATION");
        if (token != null) {
            Member m;
            // REMINDER: Convert token to DTO when necessary.
            if (token.contains("email_address") && token.contains("password")) {
                String[] authParts = token.split("\"");
                MemberCredentialsDTO mcredDTO = new MemberCredentialsDTO(authParts[3], authParts[7]);
                m = memberService.checkCredentials(mcredDTO);
            } else {
                m = memberService.checkCredentials(token);
            }
            if (m != null) {
                // Use case authorisation rules for member
                if (requestURI.startsWith("/fitnessclass/create") || requestURI.startsWith("/fitnessclass/update") ||
                        requestURI.startsWith("/fitnessclass/instructor")) {
                    // Members aren't allowed to do these fitnessclass use cases
                    return false;
                } else if (requestURI.startsWith("/classbooking")) {
                    // Members can only book / cancel / view class booking for themselves
                    if (requestURI.startsWith("/classbooking/create")) {
                        // TODO: Authentication happens but request is not passed to endpoint.
                        NewClassBookingDTO nDTO = mapper.readValue(request.getInputStream(), NewClassBookingDTO.class);
                        return m.getId() == nDTO.getMember_id();
                    } else if (requestURI.startsWith("/classbooking/cancel")) {
                        return m.getId() == requestTargetID(requestURI, 2);
                    } else if (requestURI.startsWith("/classbooking/attendee")) {
                        return m.getId() == requestTargetID(requestURI, 2);
                    }
                } else if (requestURI.startsWith("/workout/")) {
                    // Members can only create a workout or add exercises for themselves.
                    if (requestURI.startsWith("/workout/create")) {
                        // TODO: Authentication happens but request is not passed to endpoint.
                        NewWorkoutDTO nwDTO = mapper.readValue(request.getInputStream(), NewWorkoutDTO.class);
                        return m.getId() == nwDTO.getMember_id();
                    } else if (requestURI.startsWith("/workout/addexercise")) {
                        // TODO: Authentication happens but request is not passed to endpoint.
                        NewWorkoutExerciseDTO nEDTO = mapper.readValue(request.getInputStream(), NewWorkoutExerciseDTO.class);
                        Workout w = workoutRepository.findById(nEDTO.getWorkout_id()).orElse(null);
                        if (w != null) {
                            return m.getId() == w.getMember().getId();
                        }
                    }
                } else if (requestURI.startsWith("/member/delete/")) {
                    return m.getId() == requestTargetID(requestURI, 2);
                } else if (requestURI.startsWith("/member/update/")) {
                    // TODO: Authentication happens but request is not passed to endpoint.
                    UpdatedMemberDTO uMemberDTO = mapper.readValue(request.getInputStream(), UpdatedMemberDTO.class);
                    return m.getId() == uMemberDTO.getId();
                }
                else {
                    // All other use cases require no authorisation.
                    return true;
                }
            }
        }
        return false;
    }

    private int requestTargetID(String requestURI, int part) {
        String[] parts = requestURI.substring(1).split("/");
        return Integer.parseInt(parts[part]);
    }
}
</code>```

I've tried leaving 'println' statements all through the filter, rest controller and service classes to track the progress of incoming requests. I'm very confident that the requests are hitting the filter and being authorised / authenticated correctly in there but some of the requests don't seem to be hitting the restcontroller code once authenticated, as noted by the //TODO comments above.

If anyone can help provide some pointers on how to debug this, I'd be really grateful. Having 'println' as the last line in the filter before filterChain.doFilter(... and as the first line in the rest controller seems to suggest that requests are hitting the 'doFilter' line but not hitting the first line of code in the restcontroller.

The full project code is up at Github, if looking at other elements that come into play might help.

Body:
I'm hoping someone can help me with this question please. I've done some searches online but I'm not sure if I'm using the right terminology so not finding articles that appear completely relevant.

As is probably apparent in the code, I'm only a few months into learning Java / Spring Boot.

Prior to adding a WebFilter, all endpoints in my application were tested and worked correctly.

After implementing my webfilter, a bunch of my use cases don't work. For example, a PATCH request to the '/member/update' endpoint with the correct payload doesn't seem to reach the endpoint code in the restcontroller.

My Webfilter code is below.

package com.example.assessment.Filter;

import com.example.assessment.ClassBooking.DTOs.NewClassBookingDTO;
import com.example.assessment.Instructor.DTOs.InstructorCredentialsDTO;
import com.example.assessment.Instructor.Entities.Instructor;
import com.example.assessment.Instructor.InstructorService;
import com.example.assessment.Member.DTOs.MemberCredentialsDTO;
import com.example.assessment.Member.DTOs.UpdatedMemberDTO;
import com.example.assessment.Member.Entities.Member;
import com.example.assessment.Member.MemberService;
import com.example.assessment.Workout.DTOs.NewWorkoutDTO;
import com.example.assessment.Workout.Entities.Workout;
import com.example.assessment.Workout.WorkoutRepository;
import com.example.assessment.WorkoutExercise.DTOs.NewWorkoutExerciseDTO;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@AllArgsConstructor
@WebFilter(urlPatterns = {"/*"})
public class AuthorisationFilter implements Filter {

    private final MemberService memberService;
    private final InstructorService instructorService;

    private final WorkoutRepository workoutRepository;

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest)servletRequest;
        HttpServletResponse response = (HttpServletResponse)servletResponse;
        String requestURI = request.getRequestURI().toLowerCase();

        // AUTHORISATION RULES
        if (requestURI.contains("member/create")) {
            // No authorisation required to create a new member
            filterChain.doFilter(servletRequest, servletResponse);
        }
        else if (memberIsAuthorised(request)) {
            filterChain.doFilter(servletRequest, servletResponse);
        } else {
            response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
        }
    }

    private boolean memberIsAuthorised(HttpServletRequest request) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        String requestURI = request.getRequestURI().toLowerCase();
        String token = request.getHeader("AUTHORIZATION");
        if (token != null) {
            Member m;
            // REMINDER: Convert token to DTO when necessary.
            if (token.contains("email_address") && token.contains("password")) {
                String[] authParts = token.split("\"");
                MemberCredentialsDTO mcredDTO = new MemberCredentialsDTO(authParts[3], authParts[7]);
                m = memberService.checkCredentials(mcredDTO);
            } else {
                m = memberService.checkCredentials(token);
            }
            if (m != null) {
                // Use case authorisation rules for member
                if (requestURI.startsWith("/fitnessclass/create") || requestURI.startsWith("/fitnessclass/update") ||
                        requestURI.startsWith("/fitnessclass/instructor")) {
                    // Members aren't allowed to do these fitnessclass use cases
                    return false;
                } else if (requestURI.startsWith("/classbooking")) {
                    // Members can only book / cancel / view class booking for themselves
                    if (requestURI.startsWith("/classbooking/create")) {
                        // TODO: Authentication happens but request is not passed to endpoint.
                        NewClassBookingDTO nDTO = mapper.readValue(request.getInputStream(), NewClassBookingDTO.class);
                        return m.getId() == nDTO.getMember_id();
                    } else if (requestURI.startsWith("/classbooking/cancel")) {
                        return m.getId() == requestTargetID(requestURI, 2);
                    } else if (requestURI.startsWith("/classbooking/attendee")) {
                        return m.getId() == requestTargetID(requestURI, 2);
                    }
                } else if (requestURI.startsWith("/workout/")) {
                    // Members can only create a workout or add exercises for themselves.
                    if (requestURI.startsWith("/workout/create")) {
                        // TODO: Authentication happens but request is not passed to endpoint.
                        NewWorkoutDTO nwDTO = mapper.readValue(request.getInputStream(), NewWorkoutDTO.class);
                        return m.getId() == nwDTO.getMember_id();
                    } else if (requestURI.startsWith("/workout/addexercise")) {
                        // TODO: Authentication happens but request is not passed to endpoint.
                        NewWorkoutExerciseDTO nEDTO = mapper.readValue(request.getInputStream(), NewWorkoutExerciseDTO.class);
                        Workout w = workoutRepository.findById(nEDTO.getWorkout_id()).orElse(null);
                        if (w != null) {
                            return m.getId() == w.getMember().getId();
                        }
                    }
                } else if (requestURI.startsWith("/member/delete/")) {
                    return m.getId() == requestTargetID(requestURI, 2);
                } else if (requestURI.startsWith("/member/update/")) {
                    // TODO: Authentication happens but request is not passed to endpoint.
                    UpdatedMemberDTO uMemberDTO = mapper.readValue(request.getInputStream(), UpdatedMemberDTO.class);
                    return m.getId() == uMemberDTO.getId();
                }
                else {
                    // All other use cases require no authorisation.
                    return true;
                }
            }
        }
        return false;
    }

    private int requestTargetID(String requestURI, int part) {
        String[] parts = requestURI.substring(1).split("/");
        return Integer.parseInt(parts[part]);
    }
}

I've tried leaving 'println' statements all through the filter, rest controller and service classes to track the progress of incoming requests. I'm very confident that the requests are hitting the filter and being authorised / authenticated correctly in there but some of the requests don't seem to be hitting the restcontroller code once authenticated, as noted by the //TODO comments above.

If anyone can help provide some pointers on how to debug this, I'd be really grateful. Having 'println' as the last line in the filter before filterChain.doFilter(... and as the first line in the rest controller seems to suggest that requests are hitting the 'doFilter' line but not hitting the first line of code in the restcontroller.

The full project code is up at Github, if looking at other elements that come into play might help.


问:
WebLogic apache plugin PathTrim: context root is wrong in serverside generated URLs
I use the WebLogic apache plug-in to access my webapps.

The (important part of) config is:

```<code><Location /WLS1/approot>
  WebLogicPort 7003
  SetHandler weblogic-handler
  PathTrim /WLS1
</Location>
</code>```

The idea is to have URLs in form https://apache-hostname/WLS1/approot/page.jsp redirected to https://weblogic-hostname:7003/approot/page.jsp

The above works, but redirects and URLs in HTML are wrong, as they are like "/approot/xyz" instead of "/WLS1/approot/xyz" (URLs in HTML/JSP are generated with the c:url JSTL tag, it prepends the context root, but not the "/WLS1" part, as it is unknown to the server).

Is there a way to fix this?

The example in the plugin documentation is similar:

```<code><Location /weblogic>
  SetHandler weblogic-handler
  PathTrim /weblogic
</Location>
</code>```

But it does not mention the above issue.

WebLogic is version 10.3.6 , apache is version 2.2

Body:
I use the WebLogic apache plug-in to access my webapps.

The (important part of) config is:

<Location /WLS1/approot>
  WebLogicPort 7003
  SetHandler weblogic-handler
  PathTrim /WLS1
</Location>

The idea is to have URLs in form https://apache-hostname/WLS1/approot/page.jsp redirected to https://weblogic-hostname:7003/approot/page.jsp

The above works, but redirects and URLs in HTML are wrong, as they are like "/approot/xyz" instead of "/WLS1/approot/xyz" (URLs in HTML/JSP are generated with the c:url JSTL tag, it prepends the context root, but not the "/WLS1" part, as it is unknown to the server).

Is there a way to fix this?

The example in the plugin documentation is similar:

<Location /weblogic>
  SetHandler weblogic-handler
  PathTrim /weblogic
</Location>

But it does not mention the above issue.

WebLogic is version 10.3.6 , apache is version 2.2