问:
Messages seemingly disappearing with javax.mail
I am using the code from this tutorial with minimal modifications. Here is my code: `

```<code>public static void receiveEmail(String hst, String stype, String user, String password) {
        try {
            Properties props = new Properties();
            props.put("mail.store.protocol", "pop3");
            props.put("mail.pop3s.host", hst);
            props.put("mail.pop3s.port", "995");
            props.put("mail.pop3.starttls.enable", "true");
            Session sess = Session.getDefaultInstance(props);
            Store st = sess.getStore("pop3s");
            st.connect(hst, user, password);
            Folder emailFolder = st.getFolder("INBOX");
            emailFolder.open(Folder.READ_ONLY);
            Message[] messages = emailFolder.getMessages();

            Message message = messages[229];
            System.out.println("Welcome To Email");
            System.out.println("Subject: " + message.getSubject());
            System.out.println("From: " + message.getFrom()[0]);
            String body = "body";
            Multipart part = (Multipart) message.getContent();
            MimeBodyPart mimePart = null;
            for (int i = 0; i < part.getCount(); i++) {
                mimePart = (MimeBodyPart) part.getBodyPart(i);
                System.out.println(mimePart.getContent());
                System.out.println("========");
            }

            emailFolder.close(false);
            st.close();
        }// catch (NoSuchProviderException e) {e.printStackTrace();}
        catch (MessagingException e) {e.printStackTrace();}
        catch (IOException e) {e.printStackTrace();}
        }
</code>```

`

I am calling receive email from a driver class.  This is literally the only  method being called.

I will run the code and it will work fine, printing the contents of the 229th email. Then, if i run it again, with not changes whatsoever, I get an array index out of bounds exception saying index 229 is out of bounds for length 229.  As I understand it, when i run it, the code works fine, but somehow the email I want to access is no longer accessible. I have been trying to access the last email for testing purposes and I knew which number it is. What I think is happening is that the code is making the email I just accessed unavailable.  I just added a print line and confirmed that when i first run it, the length is such that the message being accessed is the last element in the array, upon running the program again, the array is mysteriously one element smaller. I have verified that the emails are actually not disappearing from my account. I think i started at email 250 or something and have been gradually losing access.  Another interesting thing to note is that yesterday, I was working with a different email account that only had 19 emails in it, after a short period of time, I was suddenly unable to list out the emails in that account with code.  The emails were there, I could send emails with code, but not access the emails stored on that account.

Body:
I am using the code from this tutorial with minimal modifications. Here is my code: `

public static void receiveEmail(String hst, String stype, String user, String password) {
        try {
            Properties props = new Properties();
            props.put("mail.store.protocol", "pop3");
            props.put("mail.pop3s.host", hst);
            props.put("mail.pop3s.port", "995");
            props.put("mail.pop3.starttls.enable", "true");
            Session sess = Session.getDefaultInstance(props);
            Store st = sess.getStore("pop3s");
            st.connect(hst, user, password);
            Folder emailFolder = st.getFolder("INBOX");
            emailFolder.open(Folder.READ_ONLY);
            Message[] messages = emailFolder.getMessages();

            Message message = messages[229];
            System.out.println("Welcome To Email");
            System.out.println("Subject: " + message.getSubject());
            System.out.println("From: " + message.getFrom()[0]);
            String body = "body";
            Multipart part = (Multipart) message.getContent();
            MimeBodyPart mimePart = null;
            for (int i = 0; i < part.getCount(); i++) {
                mimePart = (MimeBodyPart) part.getBodyPart(i);
                System.out.println(mimePart.getContent());
                System.out.println("========");
            }

            emailFolder.close(false);
            st.close();
        }// catch (NoSuchProviderException e) {e.printStackTrace();}
        catch (MessagingException e) {e.printStackTrace();}
        catch (IOException e) {e.printStackTrace();}
        }

`

I am calling receive email from a driver class.  This is literally the only  method being called.

I will run the code and it will work fine, printing the contents of the 229th email. Then, if i run it again, with not changes whatsoever, I get an array index out of bounds exception saying index 229 is out of bounds for length 229.  As I understand it, when i run it, the code works fine, but somehow the email I want to access is no longer accessible. I have been trying to access the last email for testing purposes and I knew which number it is. What I think is happening is that the code is making the email I just accessed unavailable.  I just added a print line and confirmed that when i first run it, the length is such that the message being accessed is the last element in the array, upon running the program again, the array is mysteriously one element smaller. I have verified that the emails are actually not disappearing from my account. I think i started at email 250 or something and have been gradually losing access.  Another interesting thing to note is that yesterday, I was working with a different email account that only had 19 emails in it, after a short period of time, I was suddenly unable to list out the emails in that account with code.  The emails were there, I could send emails with code, but not access the emails stored on that account.


来源: stackexchange

问:
React web app gets a set-cookie header but doesn't save it
I have a very simple login system, which takes a username and a password from a user, and when the form is submitted the data is posted to an express http app.

The login function at the react app is as following:

```<code>    async function login(event){
        event.preventDefault();
        setRequestState(REQUEST_STATE.pending)

        const request = `${SERVER_URL}/login`;
        const formData = new FormData();

        formData.append("username",data["username"])
        formData.append("password",data["password"])

        const response = await fetch(request, {
            method: 'POST',
            body: formData,
            enctype:"multipart/form-data",
            credentials: 'same-origin',
        })

        if(!response.ok){
            if(response.status === 401){
                console.log("username or password are inccorect")
                setDisplayError(response.status)
            }
            if(response.status === 500){
                console.log("internal server error")
                setDisplayError(response.status)
            }
            setRequestState(REQUEST_STATE.no_request)
            return;
        }

        setRequestState(REQUEST_STATE.success)
        // navigate("/dashboard")
    }
</code>```

the response is successful consistently when the right data is entered.

I use express-sessions to handle sessions, the setup code for the sessions is as following:

```<code>const express = require('express');
const cors = require('cors')
const loginRouter = require('./src/routes/login.js');
const session = require('express-session')

const app = express()

app.use(
    cors({
        origin:true,
        credentials:'same-origin',
}))

app.use(session({
  secret: 'test',
  resave: false,
  saveUninitialized: false,
//   store: sessionStore,
  cookie: {
    secure: false,
    sameSite: 'none',
}
}));

app.use(express.urlencoded({extended: true}))

app.use('/login', loginRouter)

app.listen(process.env.PORT ,()=>{
    console.log(`Server is listening on port ${process.env.PORT}`)
})

</code>```

login router is as following:

```<code>const express = require('express')
const multer = require('multer')
const router = express.Router()
const {getLogin,postLogin, authenticateLogin} = require('../controllers/login')

upload = multer({})

router.post("/", upload.array(0), authenticateLogin, postLogin)
router.get("/", getLogin)

module.exports=router
</code>```

login controller is as following:

```<code>const {pool} = require('../../sqlconfig')
const bcrypt = require('bcrypt');

const postLogin = (req, res) => {
    return res.status(200).send({success:true});
}

const getLogin = (req, res) => {
    // console.log("get this login betch")
    console.log(req.session.id)
    if(req.session.userId){
        return res.status(200).send({success:true});
    }
    // console.log("couldn't get login")
    return res.status(401).send({success:false});
}

const authenticateLogin = async (req, res, next) => {

    const dict = JSON.parse(JSON.stringify(req.body));

    const username = dict["username"];
    const password = dict["password"];

    if(!dict || !username || !password) {
        // console.log("Access deneid")
        return res.status(401).send({error:"Access denied"});
    }
    try{
        const query = "SELECT passwrd FROM admins WHERE admins.username=?";
        const [result] = await pool.execute(query,[username])

        if(result.length <= 0){
            return res.status(401).send({error:"Access denied"});
        }

        const passwordInDB = result[0].passwrd;

        if(!passwordInDB){
            return res.status(401).send({error:"Access denied"});
        }

        const match = await bcrypt.compare(password, passwordInDB);
        // console.log(match)

        if(!match){
            return res.status(401).send({error:"Access denied"});
        }

        const queryUserId = "SELECT id FROM admins WHERE admins.username=?";
        const [resultUserId] = await pool.execute(queryUserId,[username])

        req.session.userId = resultUserId[0].id;
        console.log("logged in successfuly!")
        console.log(req.session)

        next()
    }
    catch(e){
        console.log(e)
    }
}

module.exports={
    authenticateLogin,
    postLogin,
    getLogin
}
</code>```

when login post is called, a session does get created,
and a cookie is sent back to the react application:
Response

but doesn't get saved:
saved cookies

ContentLicense: CC BY-SA 4.0

Body:
I have a very simple login system, which takes a username and a password from a user, and when the form is submitted the data is posted to an express http app.

The login function at the react app is as following:

    async function login(event){
        event.preventDefault();
        setRequestState(REQUEST_STATE.pending)

        const request = `${SERVER_URL}/login`;
        const formData = new FormData();

        formData.append("username",data["username"])
        formData.append("password",data["password"])

        const response = await fetch(request, {
            method: 'POST',
            body: formData,
            enctype:"multipart/form-data",
            credentials: 'same-origin',
        })

        if(!response.ok){
            if(response.status === 401){
                console.log("username or password are inccorect")
                setDisplayError(response.status)
            }
            if(response.status === 500){
                console.log("internal server error")
                setDisplayError(response.status)
            }
            setRequestState(REQUEST_STATE.no_request)
            return;
        }

        setRequestState(REQUEST_STATE.success)
        // navigate("/dashboard")
    }

the response is successful consistently when the right data is entered.

I use express-sessions to handle sessions, the setup code for the sessions is as following:

const express = require('express');
const cors = require('cors')
const loginRouter = require('./src/routes/login.js');
const session = require('express-session')

const app = express()

app.use(
    cors({
        origin:true,
        credentials:'same-origin',
}))

app.use(session({
  secret: 'test',
  resave: false,
  saveUninitialized: false,
//   store: sessionStore,
  cookie: {
    secure: false,
    sameSite: 'none',
}
}));

app.use(express.urlencoded({extended: true}))

app.use('/login', loginRouter)

app.listen(process.env.PORT ,()=>{
    console.log(`Server is listening on port ${process.env.PORT}`)
})

login router is as following:

const express = require('express')
const multer = require('multer')
const router = express.Router()
const {getLogin,postLogin, authenticateLogin} = require('../controllers/login')

upload = multer({})

router.post("/", upload.array(0), authenticateLogin, postLogin)
router.get("/", getLogin)

module.exports=router

login controller is as following:

const {pool} = require('../../sqlconfig')
const bcrypt = require('bcrypt');

const postLogin = (req, res) => {
    return res.status(200).send({success:true});
}

const getLogin = (req, res) => {
    // console.log("get this login betch")
    console.log(req.session.id)
    if(req.session.userId){
        return res.status(200).send({success:true});
    }
    // console.log("couldn't get login")
    return res.status(401).send({success:false});
}

const authenticateLogin = async (req, res, next) => {

    const dict = JSON.parse(JSON.stringify(req.body));

    const username = dict["username"];
    const password = dict["password"];

    if(!dict || !username || !password) {
        // console.log("Access deneid")
        return res.status(401).send({error:"Access denied"});
    }
    try{
        const query = "SELECT passwrd FROM admins WHERE admins.username=?";
        const [result] = await pool.execute(query,[username])

        if(result.length <= 0){
            return res.status(401).send({error:"Access denied"});
        }

        const passwordInDB = result[0].passwrd;

        if(!passwordInDB){
            return res.status(401).send({error:"Access denied"});
        }

        const match = await bcrypt.compare(password, passwordInDB);
        // console.log(match)

        if(!match){
            return res.status(401).send({error:"Access denied"});
        }

        const queryUserId = "SELECT id FROM admins WHERE admins.username=?";
        const [resultUserId] = await pool.execute(queryUserId,[username])

        req.session.userId = resultUserId[0].id;
        console.log("logged in successfuly!")
        console.log(req.session)

        next()
    }
    catch(e){
        console.log(e)
    }
}

module.exports={
    authenticateLogin,
    postLogin,
    getLogin
}

when login post is called, a session does get created,
and a cookie is sent back to the react application:
Response

but doesn't get saved:
saved cookies


问:
How to handle `process.env` in client-side javascript files when running E2E tests in Cypress?
Embarrassingly, this problem has been holding me up for days, and I must, must get on with my task for work, so I'm reaching out for help.

When running Cypress, I get said error: process is not defined and it points to a JavaScript file in the client portion of my project (shown below). I understand process is a nodeJS property, but I can obviously call this on the FE of my application, and must, so I don't understand why Cypress is throwing an error here. Any help would be much appreciated. I'm running node v14.x.x.

vue.config.js

```<code>const { defineConfig } = require('@vue/cli-service')
// const { VueLoaderPlugin } = require('vue-loader')

module.exports = defineConfig({
  css: {
    loaderOptions: {
      sass: {
        additionalData: '@import src/styles/base/entry.scss',
      },
    },
  },

  lintOnSave: false,

  publicPath: '/',

  transpileDependencies: true,
})
</code>```

Package.json

```<code>{
  "name": "test2",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "test:unit": "vue-cli-service test:unit",
    "test:e2e": "vue-cli-service test:e2e",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "@sentry/apm": "^5.27.1",
    "@sentry/browser": "^7.28.1",
    "@sentry/integrations": "^7.28.1",
    "auth0-js": "^9.20.0",
    "axios": "^1.2.2",
    "axios-retry": "^3.3.1",
    "big.js": "^6.2.1",
    "core-js": "^3.8.3",
    "css-loader": "^6.7.3",
    "moment": "^2.29.4",
    "moment-timezone": "^0.5.40",
    "style-loader": "^3.3.1",
    "toastr": "^2.1.4",
    "uuid": "^9.0.0",
    "vue": "^2.6.14",
    "vue-router": "^3.5.2"
  },
  "devDependencies": {
    "@babel/core": "^7.20.7",
    "@babel/eslint-parser": "^7.19.1",
    "@babel/preset-env": "^7.20.2",
    "@cypress/webpack-preprocessor": "^5.16.1",
    "@vue/cli-plugin-babel": "~5.0.0",
    "@vue/cli-plugin-e2e-cypress": "~5.0.0",
    "@vue/cli-plugin-eslint": "~5.0.0",
    "@vue/cli-plugin-unit-jest": "~5.0.0",
    "@vue/cli-service": "~5.0.0",
    "@vue/test-utils": "^1.1.3",
    "@vue/vue2-jest": "^27.0.0-alpha.2",
    "babel-jest": "^27.0.6",
    "babel-loader": "^8.0.2",
    "cypress": "^9.7.0",
    "eslint": "^7.32.0",
    "eslint-plugin-vue": "^8.0.3",
    "jest": "^27.0.5",
    "node-sass": "^4.14.0",
    "sass-loader": "^12.6.0",
    "ts-jest": "^27.0.4",
    "vue-loader": "^15.0.1",
    "vue-template-compiler": "^2.6.14",
    "webpack": "^5.75.0"
  }
}
</code>```

Cypress webpack config

```<code>/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
const { VueLoaderPlugin } = require('vue-loader')
const webpackPreprocessor = require('@cypress/webpack-preprocessor')

/**
 * @type {Cypress.PluginConfig}
 */
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
  // `on` is used to hook into various events Cypress emits
  // `config` is the resolved Cypress config
  const defaults = webpackPreprocessor.defaultOptions
  // Add to existing rules
  defaults.webpackOptions.module.rules.push(
    {
      test: /\.vue$/,
      loader: 'vue-loader',
    },
    {
      test: /\.sass$/i,
      use: [
        // creates 'style' nodes from JS strings
        "vue-style-loader",
        // Translates CSS into CommonJS
        "css-loader",
        // Compiles Sass to CSS
        {
          loader: "sass-loader",
          options: {
            additionalData: '@import src/styles/base/entry.scss',
            // sass-loader >= 8
            sassOptions: {
              indentedSyntax: true,
            },
          },
        },
      ],
    }
  )
  // Add first plugin
  defaults.webpackOptions.plugins = [ new VueLoaderPlugin() ]
  console.log(defaults)

  on('file:preprocessor', webpackPreprocessor(defaults))
}
</code>```

sentryMixin.js

```<code>...

const environment = process.env.VUE_APP_ENV
                    ^ this is where it points to the error
...
</code>```

Body:
Embarrassingly, this problem has been holding me up for days, and I must, must get on with my task for work, so I'm reaching out for help.

When running Cypress, I get said error: process is not defined and it points to a JavaScript file in the client portion of my project (shown below). I understand process is a nodeJS property, but I can obviously call this on the FE of my application, and must, so I don't understand why Cypress is throwing an error here. Any help would be much appreciated. I'm running node v14.x.x.

vue.config.js

const { defineConfig } = require('@vue/cli-service')
// const { VueLoaderPlugin } = require('vue-loader')

module.exports = defineConfig({
  css: {
    loaderOptions: {
      sass: {
        additionalData: '@import src/styles/base/entry.scss',
      },
    },
  },

  lintOnSave: false,

  publicPath: '/',

  transpileDependencies: true,
})

Package.json

{
  "name": "test2",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "test:unit": "vue-cli-service test:unit",
    "test:e2e": "vue-cli-service test:e2e",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "@sentry/apm": "^5.27.1",
    "@sentry/browser": "^7.28.1",
    "@sentry/integrations": "^7.28.1",
    "auth0-js": "^9.20.0",
    "axios": "^1.2.2",
    "axios-retry": "^3.3.1",
    "big.js": "^6.2.1",
    "core-js": "^3.8.3",
    "css-loader": "^6.7.3",
    "moment": "^2.29.4",
    "moment-timezone": "^0.5.40",
    "style-loader": "^3.3.1",
    "toastr": "^2.1.4",
    "uuid": "^9.0.0",
    "vue": "^2.6.14",
    "vue-router": "^3.5.2"
  },
  "devDependencies": {
    "@babel/core": "^7.20.7",
    "@babel/eslint-parser": "^7.19.1",
    "@babel/preset-env": "^7.20.2",
    "@cypress/webpack-preprocessor": "^5.16.1",
    "@vue/cli-plugin-babel": "~5.0.0",
    "@vue/cli-plugin-e2e-cypress": "~5.0.0",
    "@vue/cli-plugin-eslint": "~5.0.0",
    "@vue/cli-plugin-unit-jest": "~5.0.0",
    "@vue/cli-service": "~5.0.0",
    "@vue/test-utils": "^1.1.3",
    "@vue/vue2-jest": "^27.0.0-alpha.2",
    "babel-jest": "^27.0.6",
    "babel-loader": "^8.0.2",
    "cypress": "^9.7.0",
    "eslint": "^7.32.0",
    "eslint-plugin-vue": "^8.0.3",
    "jest": "^27.0.5",
    "node-sass": "^4.14.0",
    "sass-loader": "^12.6.0",
    "ts-jest": "^27.0.4",
    "vue-loader": "^15.0.1",
    "vue-template-compiler": "^2.6.14",
    "webpack": "^5.75.0"
  }
}

Cypress webpack config

/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
const { VueLoaderPlugin } = require('vue-loader')
const webpackPreprocessor = require('@cypress/webpack-preprocessor')

/**
 * @type {Cypress.PluginConfig}
 */
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
  // `on` is used to hook into various events Cypress emits
  // `config` is the resolved Cypress config
  const defaults = webpackPreprocessor.defaultOptions
  // Add to existing rules
  defaults.webpackOptions.module.rules.push(
    {
      test: /\.vue$/,
      loader: 'vue-loader',
    },
    {
      test: /\.sass$/i,
      use: [
        // creates 'style' nodes from JS strings
        "vue-style-loader",
        // Translates CSS into CommonJS
        "css-loader",
        // Compiles Sass to CSS
        {
          loader: "sass-loader",
          options: {
            additionalData: '@import src/styles/base/entry.scss',
            // sass-loader >= 8
            sassOptions: {
              indentedSyntax: true,
            },
          },
        },
      ],
    }
  )
  // Add first plugin
  defaults.webpackOptions.plugins = [ new VueLoaderPlugin() ]
  console.log(defaults)

  on('file:preprocessor', webpackPreprocessor(defaults))
}

sentryMixin.js

...

const environment = process.env.VUE_APP_ENV
                    ^ this is where it points to the error
...


问:
Model bound complex types must not be abstract or value types and must have a parameterless constructor
Full error message:

InvalidOperationException: Could not create an instance of type 'System.ValueTuple2[[System.Collections.Generic.List1[[To_Do.Models.ToDoTask, To-Do, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]'.

Model bound complex types must not be abstract or value types and must have a parameterless constructor. Alternatively, give the 'list_id' parameter a non-null default value.

I am attempting to pass a tuple of types (List<TodoTask>, int) to my action method that takes in said type, but is it is throwing the error shown above.

Code that calls action method:

```<code>(List<ToDoTask>, int)list_id_tuple= (resultSet, (int)folderId);
return RedirectToAction("SearchResults", "Folder", new { list_id = list_id_tuple});
</code>```

Action method being called:

```<code>[HttpGet]
public IActionResult SearchResults((List<ToDoTask>,int) list_id)
{
    // code
}
</code>```

I need to pass two objects to the SearchResults method, but RedirectToAction only allows one, so I'm passing in a tuple that contains my data instead, but it throws an exception. The methods are in different controllers, and I do have a parameterless constructor for ToDoTask, so I'm not sure what the message means when it says I need one.

Body:
Full error message:

InvalidOperationException: Could not create an instance of type 'System.ValueTuple2[[System.Collections.Generic.List1[[To_Do.Models.ToDoTask, To-Do, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]'.

Model bound complex types must not be abstract or value types and must have a parameterless constructor. Alternatively, give the 'list_id' parameter a non-null default value.

I am attempting to pass a tuple of types (List<TodoTask>, int) to my action method that takes in said type, but is it is throwing the error shown above.

Code that calls action method:

(List<ToDoTask>, int)list_id_tuple= (resultSet, (int)folderId);
return RedirectToAction("SearchResults", "Folder", new { list_id = list_id_tuple});

Action method being called:

[HttpGet]
public IActionResult SearchResults((List<ToDoTask>,int) list_id)
{
    // code
}

I need to pass two objects to the SearchResults method, but RedirectToAction only allows one, so I'm passing in a tuple that contains my data instead, but it throws an exception. The methods are in different controllers, and I do have a parameterless constructor for ToDoTask, so I'm not sure what the message means when it says I need one.


问:
Python script not recover the whole folder, instead recover single jpeg twice
```<code>import sys
import os
import getpass
import uuid
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QComboBox, QPushButton, QVBoxLayout, QProgressBar, QLineEdit, QMessageBox, QStyle
from PyQt5.QtCore import Qt, QTimer
from PyQt5.QtGui import QIcon
import tkinter as tk
from tkinter import filedialog
from tkinter import ttk
from tkinter import messagebox

class DataRecoveryWindow(QWidget):

    def __init__(self):
        super().__init__()

        # Create a label and a combo box for selecting the drive to recover data from
        self.drive_label = QLabel("Select drive:")
        self.drive_combo_box = QComboBox()
        self.drive_combo_box.addItems(["C:", "D:", "E:", "F:", "G:"])

        # self.recovered = QLabel("Idle")
        # self.recovered.setAlignment(Qt.AlignCenter)

        # folder path
        self.folder_path_label = QLabel("Enter folder path:")
        self.folder_path_line_edit = QLineEdit()

        # status
        self.status_label = QLabel("Status  :   Idle")

        # Create a button to start the data recovery process
        self.recover_button = QPushButton("Recover Data")
        self.recover_button.clicked.connect(self.recover_data)

        # Create a vertical layout to hold the widgets
        layout = QVBoxLayout()
        layout.addWidget(self.drive_label)
        layout.addWidget(self.drive_combo_box)
        layout.addWidget(self.folder_path_label)
        layout.addWidget(self.folder_path_line_edit)
        layout.addWidget(self.status_label)
        # layout.addWidget(self.recovered)
        layout.addWidget(self.recover_button)

        # Set the layout for the main window

        self.setLayout(layout)

    def recover_data(self):
        # Get the selected drive from the combo box
        drive = self.drive_combo_box.currentText()

        # Get the folder path from the line edit widget
        folder_path = self.folder_path_line_edit.text()
        current_user_folder_path = '/Users/' + 'husay'
        users_with_backslashes = current_user_folder_path.replace('/', '\\')

        # Get the total number of files in the folder
        num_files = len(os.listdir(drive + '\\Users\\husay' +
                                         folder_path))

        print(users_with_backslashes)
        # Make sure the folder path is not empty
        if folder_path == '':
            # Display an error message if the folder path is empty
            self.error_message = QMessageBox.warning(
                self, 'Error', 'Please enter a folder path!')
            return

        print(str(folder_path))
        # Check if the folder path is valid
        print('Check Path : '+ drive + '\\Users\\husay' + folder_path)
        if not os.path.exists(drive + '\\Users\\husay' + folder_path):
            # Display an error message if the folder path is invalid
            self.error_message = QMessageBox.warning(self, 'Error',
                                                     'Invalid folder path!')
            return

        # Create a folder to save the recovered JPEG files
        recovered_folder_name = os.path.join(
            drive + '\\Users\\husay' + folder_path, "Recovered JPEGs")
        if not os.path.exists(recovered_folder_name):
            os.makedirs(recovered_folder_name)

        print(recovered_folder_name + ' : Recovered Folder Name')

        # Walk through the files in the specified folder
        for root, dirs, files in os.walk(drive + '\\Users\\husay' +
                                         folder_path):

            print(f"Files in {root}: {files}")

            for f in files:
                # Open the file as a file and read 512-byte chunks
                file_path = os.path.join(root, f)

                print('before for : ' + file_path)
                fileD = open(file_path, "rb")
                size = 4096
                byte = fileD.read(size)
                offs = 0
                drec = False
                rcvd = 0

                print('filePath :' + str(file_path))

                while byte:
                    # Look for the start of image marker
                    found = byte.find(b'\xff\xd8\xff\xe0\x00\x10\x4a\x46')

                    if found >= 0:
                        drec = True

                        print('==== Found JPG at ' + drive + ' ' +
                              str(hex(found + (size * offs))) + ' ====')
                        # Now create a recovered file and search for the end of image marker

                        file_uuid = uuid.uuid4()
                        file_s = f"{file_uuid}.jpg"

                        file_name = os.path.join(recovered_folder_name,
                                                 str(rcvd) + file_s)

                        fileN = open(file_name, "wb")
                        print('fileN :open(file_name, "wb") : ' + file_name)
                        fileN.write(byte[found:])

                        while drec:
                            byte = fileD.read(size)
                            bfind = byte.find(b'\xff\xd9')
                            if bfind >= 0:
                                fileN.write(byte[:bfind + 2])
                                fileD.seek((offs + 1) * size)
                                drec = False
                                rcvd += 1
                                print('==== Wrote JPG to ' + drive +
                                      users_with_backslashes + '\\' +
                                      recovered_folder_name + ': ' +
                                      str(rcvd) + '.jpg ====\n')

                                print(str(rcvd) + ' pictures recovered.')
                                print(str(num_files) + ' : num_files')

                                fileN.close()
                            else:

                                fileN.write(byte)

                            self.status_label.setText(str(rcvd)+ ' pictures recovered from '+root)
                            QApplication.processEvents()

                    byte = fileD.read(size)
                    offs += 1

                    if not byte:
                        break

                fileD.close()

        # Display a message when the recovery process is done
        messagebox.showinfo("Recovery Complete", "The recovery process is complete.")

if __name__ == "__main__":
    app = QApplication(sys.argv)
    window = DataRecoveryWindow()
    window.resize(700, 200)
    window.setWindowTitle('Data Recovery using Python By FRLNCEDEV')
    icon = QIcon("C:/Users/husay/Desktop/dataRecovery/Almost done/tigericon.ico")
    window.setWindowIcon(icon)
    window.show()
    sys.exit(app.exec_())
</code>```

Here is my code, and the problem is in a folder contain 2 different jpeg, it will produce 2 same jpeg, which i assume it recovering the same jpeg twice, or it overwrite the second jpeg.

And moreover, for example, i delete the first jpeg, it would not provide any recovered jpeg.

For anyone asking for logcats, there is no error from the script, just maybe my mistake not found the error.

Thank you in advance !

Body:
import sys
import os
import getpass
import uuid
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QComboBox, QPushButton, QVBoxLayout, QProgressBar, QLineEdit, QMessageBox, QStyle
from PyQt5.QtCore import Qt, QTimer
from PyQt5.QtGui import QIcon
import tkinter as tk
from tkinter import filedialog
from tkinter import ttk
from tkinter import messagebox

class DataRecoveryWindow(QWidget):

    def __init__(self):
        super().__init__()

        # Create a label and a combo box for selecting the drive to recover data from
        self.drive_label = QLabel("Select drive:")
        self.drive_combo_box = QComboBox()
        self.drive_combo_box.addItems(["C:", "D:", "E:", "F:", "G:"])

        # self.recovered = QLabel("Idle")
        # self.recovered.setAlignment(Qt.AlignCenter)

        # folder path
        self.folder_path_label = QLabel("Enter folder path:")
        self.folder_path_line_edit = QLineEdit()

        # status
        self.status_label = QLabel("Status  :   Idle")

        # Create a button to start the data recovery process
        self.recover_button = QPushButton("Recover Data")
        self.recover_button.clicked.connect(self.recover_data)

        # Create a vertical layout to hold the widgets
        layout = QVBoxLayout()
        layout.addWidget(self.drive_label)
        layout.addWidget(self.drive_combo_box)
        layout.addWidget(self.folder_path_label)
        layout.addWidget(self.folder_path_line_edit)
        layout.addWidget(self.status_label)
        # layout.addWidget(self.recovered)
        layout.addWidget(self.recover_button)

        # Set the layout for the main window

        self.setLayout(layout)

    def recover_data(self):
        # Get the selected drive from the combo box
        drive = self.drive_combo_box.currentText()

        # Get the folder path from the line edit widget
        folder_path = self.folder_path_line_edit.text()
        current_user_folder_path = '/Users/' + 'husay'
        users_with_backslashes = current_user_folder_path.replace('/', '\\')

        # Get the total number of files in the folder
        num_files = len(os.listdir(drive + '\\Users\\husay' +
                                         folder_path))

        print(users_with_backslashes)
        # Make sure the folder path is not empty
        if folder_path == '':
            # Display an error message if the folder path is empty
            self.error_message = QMessageBox.warning(
                self, 'Error', 'Please enter a folder path!')
            return

        print(str(folder_path))
        # Check if the folder path is valid
        print('Check Path : '+ drive + '\\Users\\husay' + folder_path)
        if not os.path.exists(drive + '\\Users\\husay' + folder_path):
            # Display an error message if the folder path is invalid
            self.error_message = QMessageBox.warning(self, 'Error',
                                                     'Invalid folder path!')
            return

        # Create a folder to save the recovered JPEG files
        recovered_folder_name = os.path.join(
            drive + '\\Users\\husay' + folder_path, "Recovered JPEGs")
        if not os.path.exists(recovered_folder_name):
            os.makedirs(recovered_folder_name)

        print(recovered_folder_name + ' : Recovered Folder Name')

        # Walk through the files in the specified folder
        for root, dirs, files in os.walk(drive + '\\Users\\husay' +
                                         folder_path):

            print(f"Files in {root}: {files}")

            for f in files:
                # Open the file as a file and read 512-byte chunks
                file_path = os.path.join(root, f)

                print('before for : ' + file_path)
                fileD = open(file_path, "rb")
                size = 4096
                byte = fileD.read(size)
                offs = 0
                drec = False
                rcvd = 0

                print('filePath :' + str(file_path))

                while byte:
                    # Look for the start of image marker
                    found = byte.find(b'\xff\xd8\xff\xe0\x00\x10\x4a\x46')

                    if found >= 0:
                        drec = True

                        print('==== Found JPG at ' + drive + ' ' +
                              str(hex(found + (size * offs))) + ' ====')
                        # Now create a recovered file and search for the end of image marker

                        file_uuid = uuid.uuid4()
                        file_s = f"{file_uuid}.jpg"

                        file_name = os.path.join(recovered_folder_name,
                                                 str(rcvd) + file_s)

                        fileN = open(file_name, "wb")
                        print('fileN :open(file_name, "wb") : ' + file_name)
                        fileN.write(byte[found:])

                        while drec:
                            byte = fileD.read(size)
                            bfind = byte.find(b'\xff\xd9')
                            if bfind >= 0:
                                fileN.write(byte[:bfind + 2])
                                fileD.seek((offs + 1) * size)
                                drec = False
                                rcvd += 1
                                print('==== Wrote JPG to ' + drive +
                                      users_with_backslashes + '\\' +
                                      recovered_folder_name + ': ' +
                                      str(rcvd) + '.jpg ====\n')

                                print(str(rcvd) + ' pictures recovered.')
                                print(str(num_files) + ' : num_files')

                                fileN.close()
                            else:

                                fileN.write(byte)

                            self.status_label.setText(str(rcvd)+ ' pictures recovered from '+root)
                            QApplication.processEvents()

                    byte = fileD.read(size)
                    offs += 1

                    if not byte:
                        break

                fileD.close()

        # Display a message when the recovery process is done
        messagebox.showinfo("Recovery Complete", "The recovery process is complete.")

if __name__ == "__main__":
    app = QApplication(sys.argv)
    window = DataRecoveryWindow()
    window.resize(700, 200)
    window.setWindowTitle('Data Recovery using Python By FRLNCEDEV')
    icon = QIcon("C:/Users/husay/Desktop/dataRecovery/Almost done/tigericon.ico")
    window.setWindowIcon(icon)
    window.show()
    sys.exit(app.exec_())

Here is my code, and the problem is in a folder contain 2 different jpeg, it will produce 2 same jpeg, which i assume it recovering the same jpeg twice, or it overwrite the second jpeg.

And moreover, for example, i delete the first jpeg, it would not provide any recovered jpeg.

For anyone asking for logcats, there is no error from the script, just maybe my mistake not found the error.

Thank you in advance !


问:
Determine tile size for matrix multiplication with AVX
I wrote the code below for tiled matrix multiplication with AVX.

```<code>#include <x86intrin.h>
#include <immintrin.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void fill(double *mat, int n) {
  register int i;
  register int j;
  for (i = 0; i < n; ++i) {
    for (j = 0; j < n; ++j) {
      mat[i * n + j] = (double) (i * n + j);
    }
  }
}

void blocked_mmul_avx(double *A, double *B, double *C, int n) {
  register int row, block, chunk, sub_chunk;
  int block_size = 4;

  for (row = 0; row < n; row++)
    for (block = 0; block < n; block += block_size) {
      register __m256d c0 = _mm256_setzero_pd();
      for (chunk = 0; chunk < n; chunk += block_size) {
        for (sub_chunk = 0; sub_chunk < block_size; sub_chunk++) {
          register __m256d a = _mm256_broadcast_sd(
              &A[row * n + chunk + sub_chunk]);
          register __m256d b = _mm256_loadu_pd(
              &B[chunk * n + sub_chunk * n + block]);
          c0 += a * b;
        }
      }
      _mm256_storeu_pd(&C[row * n + block], c0);
    }
}

int main() {
  int n = 4096; //n = 512, 1024, 2048, 4096

  double *A;
  double *B;
  double *C;

  A = (double*) malloc(n * n * sizeof(double));
  B = (double*) malloc(n * n * sizeof(double));
  C = (double*) malloc(n * n * sizeof(double));

  srand(0);
  fill(A, n);  // it is a function to load A and B with random numbers
  fill(B, n);

  printf("n = %d\n\n", n);
  clock_t t0 = clock();
  blocked_mmul_avx(A, B, C, n);
  clock_t t1 = clock();
  printf("Execution Time = %0.3f s \n\n", (float) (t1 - t0) / CLOCKS_PER_SEC);

  free(A);
  free(B);
  free(C);
  return 0;
}
</code>```

If I set size of the block to 4, the code works correctly. But if I increase it to 16, 1/4 of entries of output matrix is correct. I don't know why this is happening??

I checked and there are 16 YMM registers so I think block size can be increased to 16. But my experiment shows the otherwise.
Any idea why this is happening?

Body:
I wrote the code below for tiled matrix multiplication with AVX.

#include <x86intrin.h>
#include <immintrin.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void fill(double *mat, int n) {
  register int i;
  register int j;
  for (i = 0; i < n; ++i) {
    for (j = 0; j < n; ++j) {
      mat[i * n + j] = (double) (i * n + j);
    }
  }
}

void blocked_mmul_avx(double *A, double *B, double *C, int n) {
  register int row, block, chunk, sub_chunk;
  int block_size = 4;

  for (row = 0; row < n; row++)
    for (block = 0; block < n; block += block_size) {
      register __m256d c0 = _mm256_setzero_pd();
      for (chunk = 0; chunk < n; chunk += block_size) {
        for (sub_chunk = 0; sub_chunk < block_size; sub_chunk++) {
          register __m256d a = _mm256_broadcast_sd(
              &A[row * n + chunk + sub_chunk]);
          register __m256d b = _mm256_loadu_pd(
              &B[chunk * n + sub_chunk * n + block]);
          c0 += a * b;
        }
      }
      _mm256_storeu_pd(&C[row * n + block], c0);
    }
}

int main() {
  int n = 4096; //n = 512, 1024, 2048, 4096

  double *A;
  double *B;
  double *C;

  A = (double*) malloc(n * n * sizeof(double));
  B = (double*) malloc(n * n * sizeof(double));
  C = (double*) malloc(n * n * sizeof(double));

  srand(0);
  fill(A, n);  // it is a function to load A and B with random numbers
  fill(B, n);

  printf("n = %d\n\n", n);
  clock_t t0 = clock();
  blocked_mmul_avx(A, B, C, n);
  clock_t t1 = clock();
  printf("Execution Time = %0.3f s \n\n", (float) (t1 - t0) / CLOCKS_PER_SEC);

  free(A);
  free(B);
  free(C);
  return 0;
}

If I set size of the block to 4, the code works correctly. But if I increase it to 16, 1/4 of entries of output matrix is correct. I don't know why this is happening??

I checked and there are 16 YMM registers so I think block size can be increased to 16. But my experiment shows the otherwise.
Any idea why this is happening?


问:
Breakpoints from props not working (Tailwindcss)
I have a problem with my project, I don't understand why when trying to pass 'width' from props it won't work

https://i.stack.imgur.com/SoXzx.png

code looks like this

```<code> <div className={'border-b-[1px] w-[50%] lg:' + props.width + ' text-thirdMainColor ' + props.margin }></div>

</code>```

I will add that I also tried to add breakpoints in 'tailwind.config.js', but this did not change anything.

```<code>  theme: {
    screens: {
      sm: '480px',
      md: '768px',
      lg: '976px',
      xl: '1440px',
    },
</code>```

The following form works normally.
https://i.stack.imgur.com/siSaq.png

Body:
I have a problem with my project, I don't understand why when trying to pass 'width' from props it won't work

https://i.stack.imgur.com/SoXzx.png

code looks like this

I will add that I also tried to add breakpoints in 'tailwind.config.js', but this did not change anything.

  theme: {
    screens: {
      sm: '480px',
      md: '768px',
      lg: '976px',
      xl: '1440px',
    },

The following form works normally.
https://i.stack.imgur.com/siSaq.png


问:
Unable to save response as image in WhatsApp cloud Api using curl and php
I am facing saving image from curl image.
right now used in curl cli and postman worked in both but in case of php does not work.

working on curl and postman
curl eg.

```<code>curl  \
 'https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=874575937325370&ext=1672595325&hash=ATtpPT6xh31fKJgKmv5gALTnHvlLR8GOZEKR5Ly4WHo-UA' \
 -H 'Authorization: Bearer ACCESS_TOKEN' > image.jpg
</code>```

Current PHP code

```<code>$rptaUrlMedia = "https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=874575937325370&ext=1672591353&hash=ATu_gBkH9rfUoUwp6-js54WQj3ycCcUHm5Mys4W5slUQxQ";

$ch = curl_init($rptaUrlMedia);

$token = "xxx";

$output_filename = 'demo.png';
$fp = fopen($output_filename, 'wb');

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 400);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_CUSTOMREQUEST , "GET");
curl_setopt($ch,CURLOPT_ENCODING , "");
curl_setopt($ch,CURLOPT_FILE , $fp);

$headers = [];
$headers[]  = "Authorization: Bearer " . $token;
$headers[]  = "Accept-Language:en-US,en;q=0.5";
$headers[]  = "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);

$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
</code>```

Please let me know what I am missing in curl cli and php script so, I can save my response in jpg format.

My main purpose to get image from url and download it as similar postman did while saving as response.

I have go to another stack overflow answers but does not find solutions.

Error WhatAspp cloud API save image using cURL and PHP

Body:
I am facing saving image from curl image.
right now used in curl cli and postman worked in both but in case of php does not work.

working on curl and postman
curl eg.

curl  \
 'https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=874575937325370&ext=1672595325&hash=ATtpPT6xh31fKJgKmv5gALTnHvlLR8GOZEKR5Ly4WHo-UA' \
 -H 'Authorization: Bearer ACCESS_TOKEN' > image.jpg

Current PHP code

$rptaUrlMedia = "https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=874575937325370&ext=1672591353&hash=ATu_gBkH9rfUoUwp6-js54WQj3ycCcUHm5Mys4W5slUQxQ";

$ch = curl_init($rptaUrlMedia);

$token = "xxx";

$output_filename = 'demo.png';
$fp = fopen($output_filename, 'wb');

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 400);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_CUSTOMREQUEST , "GET");
curl_setopt($ch,CURLOPT_ENCODING , "");
curl_setopt($ch,CURLOPT_FILE , $fp);

$headers = [];
$headers[]  = "Authorization: Bearer " . $token;
$headers[]  = "Accept-Language:en-US,en;q=0.5";
$headers[]  = "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$raw = curl_exec($ch);

$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

Please let me know what I am missing in curl cli and php script so, I can save my response in jpg format.

My main purpose to get image from url and download it as similar postman did while saving as response.

I have go to another stack overflow answers but does not find solutions.

Error WhatAspp cloud API save image using cURL and PHP


问:
The Testing Library's fireEvent.click() not working on my Vanilla JS app
Am trying to test if a
 element value is incremented after clicking the  element. The app app works fine when I run it in the browser and click the button because the value increments. However, when I run Jest and use the testing libralie's `fireEvent.click() on the button, my test doesn't not pass because the value is not incremented in the DOM.

Here is my main.js file:

```<code>const incrementBtn = document.querySelector(".increment");
const outputElement = document.querySelector(".output");
let counter = Number(outputElement.textContent);

function increment() {
  outputElement.textContent = counter++;
}

incrementBtn.addEventListener("click", increment);

</code>```

Here is the test in main.test.js file:

```<code>import { fireEvent } from "@testing-library/dom";
...
describe("index.html", () => {
  beforeEach(() => {
    dom = new JSDOM(html, { runScripts: "dangerously" });
    container = dom.window.document.body;
  });
  // This test passes
  it("renders a heading element", () => {
    expect(container.querySelector("h3")).not.toBeNull();
  });
  // This does not pass
  it("increment a value via JavaScript when the button is clicked", async () => {
    const button = container.querySelector(".increment");
    fireEvent.click(button);  // Firing the event

    expect(container.querySelector(".output")).toHaveTextContent("1"); // This is failing.
  });
});
</code>```

The following is the output from Jest:

```<code>...
  ● index.html › increment a value via JavaScript when the button is clicked

    expect(element).toHaveTextContent()

    Expected element to have text content:
      1
    Received:
      0

      22 |     fireEvent.click(button);
      23 |
    > 24 |     expect(container.querySelector(".output")).toHaveTextContent("1");
         |                                                ^
      25 |   });
      26 | });
      27 |

      at toHaveTextContent (main.test.js:24:48)
      at tryCatch (main.test.js:2:1)
      at Generator.<anonymous> (main.test.js:2:1)
      at Generator.next (main.test.js:2:1)
      at asyncGeneratorStep (main.test.js:2:1)
      at _next (main.test.js:2:1)
      at main.test.js:2:1
      at Object.<anonymous> (main.test.js:2:1)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 passed, 2 total
Snapshots:   0 total
Time:        4.199 s
</code>```

Here is my index.html file.

```<code><!DOCTYPE html>
<html lang="en">
  <body>
    <div class="wrapper">
      <h3>Counter App</h3>
      <p>The Count is:</p>
      <p class="output">0</p>
      <div class="buttons">
        <button class="increment">
          <svg class="icon icon-plus"><use xlink:href="#icon-plus"></use></svg>
        </button>

      </div>
    </div>
    <svg>
      <defs>
        <symbol id="icon-plus" viewBox="0 0 32 32">
          <path
            d="M31 12h-11v-11c0-0.552-0.448-1-1-1h-6c-0.552 0-1 0.448-1 1v11h-11c-0.552 0-1 0.448-1 1v6c0 0.552 0.448 1 1 1h11v11c0 0.552 0.448 1 1 1h6c0.552 0 1-0.448 1-1v-11h11c0.552 0 1-0.448 1-1v-6c0-0.552-0.448-1-1-1z"
          ></path>
        </symbol>
      </defs>
    </svg>
    <script src="main.js"></script>
  </body>
</html>
</code>```

I expected the test to pass considering when I click the button manually, it increments. The implementation works fine, but for some reason, using fireEvent.click() seems not work.

Body:
Am trying to test if a
 element value is incremented after clicking the  element. The app app works fine when I run it in the browser and click the button because the value increments. However, when I run Jest and use the testing libralie's `fireEvent.click() on the button, my test doesn't not pass because the value is not incremented in the DOM.

Here is my main.js file:

const incrementBtn = document.querySelector(".increment");
const outputElement = document.querySelector(".output");
let counter = Number(outputElement.textContent);

function increment() {
  outputElement.textContent = counter++;
}

incrementBtn.addEventListener("click", increment);

Here is the test in main.test.js file:

import { fireEvent } from "@testing-library/dom";
...
describe("index.html", () => {
  beforeEach(() => {
    dom = new JSDOM(html, { runScripts: "dangerously" });
    container = dom.window.document.body;
  });
  // This test passes
  it("renders a heading element", () => {
    expect(container.querySelector("h3")).not.toBeNull();
  });
  // This does not pass
  it("increment a value via JavaScript when the button is clicked", async () => {
    const button = container.querySelector(".increment");
    fireEvent.click(button);  // Firing the event

    expect(container.querySelector(".output")).toHaveTextContent("1"); // This is failing.
  });
});

The following is the output from Jest:

...
  ● index.html › increment a value via JavaScript when the button is clicked

    expect(element).toHaveTextContent()

    Expected element to have text content:
      1
    Received:
      0

      22 |     fireEvent.click(button);
      23 |
    > 24 |     expect(container.querySelector(".output")).toHaveTextContent("1");
         |                                                ^
      25 |   });
      26 | });
      27 |

      at toHaveTextContent (main.test.js:24:48)
      at tryCatch (main.test.js:2:1)
      at Generator.<anonymous> (main.test.js:2:1)
      at Generator.next (main.test.js:2:1)
      at asyncGeneratorStep (main.test.js:2:1)
      at _next (main.test.js:2:1)
      at main.test.js:2:1
      at Object.<anonymous> (main.test.js:2:1)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 passed, 2 total
Snapshots:   0 total
Time:        4.199 s

Here is my index.html file.

<!DOCTYPE html>

Counter App

The Count is:

0

        <button class="increment">
          <svg class="icon icon-plus"><use xlink:href="#icon-plus"></use></svg>
        </button>

    <svg>
      <defs>
        <symbol id="icon-plus" viewBox="0 0 32 32">
          <path
            d="M31 12h-11v-11c0-0.552-0.448-1-1-1h-6c-0.552 0-1 0.448-1 1v11h-11c-0.552 0-1 0.448-1 1v6c0 0.552 0.448 1 1 1h11v11c0 0.552 0.448 1 1 1h6c0.552 0 1-0.448 1-1v-11h11c0.552 0 1-0.448 1-1v-6c0-0.552-0.448-1-1-1z"
          ></path>
        </symbol>
      </defs>
    </svg>

I expected the test to pass considering when I click the button manually, it increments. The implementation works fine, but for some reason, using fireEvent.click() seems not work.


问:
Using NLTK or similar, how in Python can I conjugate verb once I have the base word (lemma)?
Using NLTK or similar, how can I take a base word (lemma) and get other parts of speech for that word, especially other forms of a verb?

NLTK does not directly support this.

I tried "pattern" with Python 3.9 and 3.10 and could not get it working.
NodeBox and MontyLingua just lead to dead links these days.


问:
create API Client with ohmyfetch inside nuxt project
I am trying to create this:

```<code>const client = axios.create({baseURL: settings.api.url});
</code>```

but using ohmyfetch instead of axios. I tried to do:

```<code>import {$fetch} from 'ohmyfetch';
const client = $fetch.create({baseURL: settings.api.url});
</code>```

but it returns error

```<code>s.$fetch.create is not a function
</code>```

and I cant find anything that would help me solve my problem.

version: ohmyfetch@0.4.21

Body:
I am trying to create this:

const client = axios.create({baseURL: settings.api.url});

but using ohmyfetch instead of axios. I tried to do:

import {$fetch} from 'ohmyfetch';
const client = $fetch.create({baseURL: settings.api.url});

but it returns error

s.$fetch.create is not a function

and I cant find anything that would help me solve my problem.

version: ohmyfetch@0.4.21


问:
Importing js (es6) files into typescript parent dependencies with non conventional extension `*.es6` fails? ts(2307)
We are adding typescript to our project which for legacy and migration purposes overtime has had *.es6 files for source es6 modules vs *.js (which are loose generated files and bundles).

What i have found in typescript is i can import these exact files if they are .js / .ts, i would prefer not to have to rename and change all build tooling and etc from .es6 to .js for all files in the repo. Im assuming there should be a way to say treat extension of "es6" as a "js" non-ts file

p.s. Also if this is maybe an IDE issue (but ther error is coming direct from TS), my IDE is VSCode

Example:

```<code>// asbstracted models
import { Model } from "./model.es6"; // js (because ext, typescript intellisense error)

// resources
import { http } from '../utils/http.es6'; // js (because ext, typescript intellisense error)
import { Rando } from '../utils/rando'; // ts (ok)
import { Rando2 } from '../utils/rando2.js'; // js (ok)

...
</code>```

I tried adding all sort of things to tsconfig.json. Babel / webpack can compile the bundle fine, but the tsconfig in vscode is throwing. The lint error is:

```<code>Cannot find module '../utils/http.es6' or its corresponding type declarations.ts(2307)
</code>```

tsconfig.json

```<code>{
  "include": [
    "js_es6/**/*.ts",
    "js_es6/**/*.es6",
  ],
  "types": ["./types/index.d.ts"],
  "compilerOptions": {
    "allowJs": true,
    "target": "es6",
    "module": "commonjs",
    "moduleResolution": "node",
    "baseUrl": "./",
    "paths": {
      "@js_es6/*": ["js_es6/*"],
    }
  }
}
</code>```

I am new to typescript configuration but is it flexible enough to allow variable file extensions for js, as up into now build tooling and js is more or less extension agnostic.

image for additional reference:

Body:
We are adding typescript to our project which for legacy and migration purposes overtime has had *.es6 files for source es6 modules vs *.js (which are loose generated files and bundles).

What i have found in typescript is i can import these exact files if they are .js / .ts, i would prefer not to have to rename and change all build tooling and etc from .es6 to .js for all files in the repo. Im assuming there should be a way to say treat extension of "es6" as a "js" non-ts file

p.s. Also if this is maybe an IDE issue (but ther error is coming direct from TS), my IDE is VSCode

Example:

// asbstracted models
import { Model } from "./model.es6"; // js (because ext, typescript intellisense error)

// resources
import { http } from '../utils/http.es6'; // js (because ext, typescript intellisense error)
import { Rando } from '../utils/rando'; // ts (ok)
import { Rando2 } from '../utils/rando2.js'; // js (ok)

...

I tried adding all sort of things to tsconfig.json. Babel / webpack can compile the bundle fine, but the tsconfig in vscode is throwing. The lint error is:

Cannot find module '../utils/http.es6' or its corresponding type declarations.ts(2307)

tsconfig.json

{
  "include": [
    "js_es6/**/*.ts",
    "js_es6/**/*.es6",
  ],
  "types": ["./types/index.d.ts"],
  "compilerOptions": {
    "allowJs": true,
    "target": "es6",
    "module": "commonjs",
    "moduleResolution": "node",
    "baseUrl": "./",
    "paths": {
      "@js_es6/*": ["js_es6/*"],
    }
  }
}

I am new to typescript configuration but is it flexible enough to allow variable file extensions for js, as up into now build tooling and js is more or less extension agnostic.

image for additional reference:


问:
tailwind ccs styles not reflecting on the Svelte project (localhost)
I have followed the instruction on https://tailwindcss.com/docs/guides/sveltekit
Install Tailwind CSS with SvelteKit, however the styles do not reflect on the project.
Get the error "unkown at rule @tailwind

import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/kit/vite';

/** @type {import('@sveltejs/kit').Config} */
const config = {
  kit: {
    adapter: adapter()
  },
  preprocess: vitePreprocess()
};

export default config;
```


问:
Does Polars Implement Pandas Compatible Relational Functions?
Looks like Polars doesn't implement the commonly used Pandas relational functions e.g df['Qty'].ge(100), at least not at this time. I've warmed up to Pandas relational functions syntax especially since operator priority bugs become a non-issue, reduces parenthesis matching errors and provides more syntactic compatibility when porting code. Definitely not a deal breaker. Seems like a deliberate decision not to implement but what's the rationale?


问:
How to call vue-router link in gridjs?
I'm having a Vue.js application and using gridjs for rending my tables. Everything works fine, except one thing... My code is the following (modified from the original expamle from Grid.js):

<template>

</template>

```

As you can see, I've two links (Link 1 and Link 2) in the then function of the server. Link 1 is a link to another page in my vue application, while Link 2 is an external link. My problem is now that when I click on Link 1, it completely ignores/bypasses my vue-router because it simply loads the entire site completely from scratch. So instead of this, I added a function showPokemon which uses the router but my problem is now... how can I call this function? Or instead of the a-tag, maybe it's possible to use the router-link-tag? But if so, how to do this because the html() function renders it 1:1 to html. So my html source would contain <router-link>. Any ideas how to handle this?

Title: How to call vue-router link in gridjs?

Body:
I'm having a Vue.js application and using gridjs for rending my tables. Everything works fine, except one thing... My code is the following (modified from the original expamle from Grid.js):

<template>

</template>

As you can see, I've two links (Link 1 and Link 2) in the then function of the server. Link 1 is a link to another page in my vue application, while Link 2 is an external link. My problem is now that when I click on Link 1, it completely ignores/bypasses my vue-router because it simply loads the entire site completely from scratch. So instead of this, I added a function showPokemon which uses the router but my problem is now... how can I call this function? Or instead of the a-tag, maybe it's possible to use the router-link-tag? But if so, how to do this because the html() function renders it 1:1 to html. So my html source would contain <router-link>. Any ideas how to handle this?


问:
PHP script with firefox returns SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data. OK with IE, Chrome, Edge
If I include the statement:

```<code>    header("Content-Type: application/json; charset=utf-8");
</code>```

in a PHP script, then execute the script in debug mode in VS2022 Community, I get an error

```<code>SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
</code>```

only when using Firefox.  I do not get the error with Edge, Chrome, or IE.

Taking the header statement out of the PHP and everything runs OK on all browsers.  PHP.INI has default charset utf-8; Removing charset=utf-8 from the header has no effect.

I believe I'm dealing with a char-set issue, but don't know where the issue lies.  The PHP file is on localhost and just does a database call to retrieve some rows from MySQL.

I can leave the header statement out, but I don't understand why the header fails.  Can anyone explain?

Body:
If I include the statement:

    header("Content-Type: application/json; charset=utf-8");

in a PHP script, then execute the script in debug mode in VS2022 Community, I get an error

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

only when using Firefox.  I do not get the error with Edge, Chrome, or IE.

Taking the header statement out of the PHP and everything runs OK on all browsers.  PHP.INI has default charset utf-8; Removing charset=utf-8 from the header has no effect.

I believe I'm dealing with a char-set issue, but don't know where the issue lies.  The PHP file is on localhost and just does a database call to retrieve some rows from MySQL.

I can leave the header statement out, but I don't understand why the header fails.  Can anyone explain?


问:
How to test a chrome extension developed for linkedin?
I am trying to write some E2E tests for my chrome extension that helps to highlight information on some linkedin pages (for logged in user). LinkedIn is refusing to load on puppeteer and cypress.

Is there some alternative way to load linkedIn or some other way to test?


问:
Inner recyclerview not scrolling in android
I have a recyclerview which is the outer recyclerview
tried nestedscrollingenabled to false but not working still

```<code><androidx.core.widget.NestedScrollView
android:layout_width="0dp"
android:layout_height="0dp"
android:fillViewport="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/user_details_cv"
app:layout_constraintTop_toTopOf="@id/user_details_cv"
app:layout_constraintBottom_toBottomOf="parent"
>
<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/rvItems"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginStart="@dimen/_5sdp"
    android:scrollbars="vertical"
    android:visibility="visible"
    android:layout_marginBottom="@dimen/_10sdp"
    app:spanCount="3"
    app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
    tool:listitem="@layout/item_ordered_item" />
</code>```

</androidx.core.widget.NestedScrollView>

now in side this recyclerview i have two recyclerview but those two inner recyclerviews are not scrollable

```<code> <androidx.core.widget.NestedScrollView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:fillViewport="true"
            android:clipToPadding="true"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintTop_toBottomOf="@id/item_name"
            app:layout_constraintStart_toStartOf="@id/item_name"
            app:layout_constraintEnd_toEndOf="parent"
            >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:nestedScrollingEnabled="false"
                android:layout_marginTop="@dimen/_5sdp"

                >

                <TextView
                    android:id="@+id/tvAddOnType"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="@font/montserrat_semibold"
                    android:text="Options"
                    android:textColor="#4D4D4D"
                    android:textSize="@dimen/_3ssp"
                     />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rv_add"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="@dimen/_1sdp"
                    android:textColor="@color/colorBlack"
                    android:scrollbars="vertical"
                    app:layout_constraintStart_toStartOf="@id/tvAddOnType"
                    app:layout_constraintTop_toBottomOf="@id/tvAddOnType"
                    app:layout_constraintBottom_toTopOf="@id/tvStaticExtras"
                    app:layout_constraintEnd_toEndOf="parent"
                    tools:text="Add on" />

                <TextView
                    android:id="@+id/tvStaticExtras"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/_3sdp"
                    android:fontFamily="@font/montserrat_semibold"
                    android:text="Extras"
                    android:textColor="#4D4D4D"
                    android:textSize="@dimen/_3ssp"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/rv_add" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rvAddons"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/_1sdp"
                    android:scrollbars="vertical"
                    app:layout_constraintEnd_toEndOf="parent"
                    android:layout_marginBottom="@dimen/_7sdp"
                    tools:listitem="@layout/item_addon_category"
                     />

            </LinearLayout>

        </androidx.core.widget.NestedScrollView>
</code>```

Body:
I have a recyclerview which is the outer recyclerview
tried nestedscrollingenabled to false but not working still

<androidx.core.widget.NestedScrollView
android:layout_width="0dp"
android:layout_height="0dp"
android:fillViewport="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/user_details_cv"
app:layout_constraintTop_toTopOf="@id/user_details_cv"
app:layout_constraintBottom_toBottomOf="parent"
>
<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/rvItems"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginStart="@dimen/_5sdp"
    android:scrollbars="vertical"
    android:visibility="visible"
    android:layout_marginBottom="@dimen/_10sdp"
    app:spanCount="3"
    app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
    tool:listitem="@layout/item_ordered_item" />

</androidx.core.widget.NestedScrollView>

now in side this recyclerview i have two recyclerview but those two inner recyclerviews are not scrollable

 <androidx.core.widget.NestedScrollView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:fillViewport="true"
            android:clipToPadding="true"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintTop_toBottomOf="@id/item_name"
            app:layout_constraintStart_toStartOf="@id/item_name"
            app:layout_constraintEnd_toEndOf="parent"
            >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:nestedScrollingEnabled="false"
                android:layout_marginTop="@dimen/_5sdp"

                >

                <TextView
                    android:id="@+id/tvAddOnType"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="@font/montserrat_semibold"
                    android:text="Options"
                    android:textColor="#4D4D4D"
                    android:textSize="@dimen/_3ssp"
                     />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rv_add"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="@dimen/_1sdp"
                    android:textColor="@color/colorBlack"
                    android:scrollbars="vertical"
                    app:layout_constraintStart_toStartOf="@id/tvAddOnType"
                    app:layout_constraintTop_toBottomOf="@id/tvAddOnType"
                    app:layout_constraintBottom_toTopOf="@id/tvStaticExtras"
                    app:layout_constraintEnd_toEndOf="parent"
                    tools:text="Add on" />

                <TextView
                    android:id="@+id/tvStaticExtras"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/_3sdp"
                    android:fontFamily="@font/montserrat_semibold"
                    android:text="Extras"
                    android:textColor="#4D4D4D"
                    android:textSize="@dimen/_3ssp"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/rv_add" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rvAddons"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/_1sdp"
                    android:scrollbars="vertical"
                    app:layout_constraintEnd_toEndOf="parent"
                    android:layout_marginBottom="@dimen/_7sdp"
                    tools:listitem="@layout/item_addon_category"
                     />

            </LinearLayout>

        </androidx.core.widget.NestedScrollView>


问:
How to capture event of clicking on a bookmark
I am writing an add-on that stores some information using storage.local when a bookmark is created.

I would like to use that stored info when users click on the bookmark to decide how to open the url of the bookmark. However, after searching bookmarks API, I didn't find any event to capture clicking on a bookmark, because I would like to get bookmarks.BookmarkTreeNode object of that bookmark.

Is there anyway I can capture the event of clicking on a bookmark?


问:
Adding one single point in a plot in R language
I have created a R script which plots the SML with x-axis = beta, y axis = CAPM. The following is the script:

```<code>#Market Annual Return (M)
getSymbols(Symbols = "^GSPC", src = "yahoo", periodicity = "weekly", auto.assign = TRUE)
GSPC = as.data.frame(GSPC)
GSPC <- cbind(rownames(GSPC), data.frame(GSPC, row.names=NULL))
colnames(GSPC)[1] <- "Date"

GSPC[,ncol(GSPC)+1] <- (GSPC[,5] / lag(GSPC[,5])-1)
colnames(GSPC)[ncol(GSPC)] <- "GSPC.WeeklyReturn"
M = mean(GSPC$GSPC.WeeklyReturn, na.rm = TRUE)
M = (1+M)^50-1

sd.M <- sd(GSPC$GSPC.Close)

View(GSPC)

#Risk Free Rate (Rfr)
getSymbols(Symbols = "^TNX", src = "yahoo", periodicity = "daily", auto.assign = TRUE)
TNX <- as.data.frame(TNX)
Rfr = TNX[length(TNX$TNX.Close),4]
Rfr = as.numeric(Rfr)
Rfr = Rfr/100

View(TNX)

#Construct a SML line
beta = seq(-3,3,by=0.5)
capm = Rfr + beta*(M-Rfr)
plot(beta, capm, type = "o")

</code>```

Basically, it just get data from yahoo and plot CAPM against BETA range from -3 to 3. In order to do my analysis on AAPL stock with the plot, I have acquired the "Return of AAPL" and also the "Beta of AAPL", I named them as "Return.AAPL" and "Beta.AAPL" respectively. However, when I try to visualize AAPL return by inputting "Return.AAPL" as y-axis and "Beta.AAPL" as x-axis into the SML plot. I dont know how to do it!!!

I have seen people say use: points(x = Beta.AAPL, y = Return.AAPL). However, the plot shows no change and does not work. Please help how to add one single point into my SML plot

Body:
I have created a R script which plots the SML with x-axis = beta, y axis = CAPM. The following is the script:

#Market Annual Return (M)
getSymbols(Symbols = "^GSPC", src = "yahoo", periodicity = "weekly", auto.assign = TRUE)
GSPC = as.data.frame(GSPC)
GSPC <- cbind(rownames(GSPC), data.frame(GSPC, row.names=NULL))
colnames(GSPC)[1] <- "Date"

GSPC[,ncol(GSPC)+1] <- (GSPC[,5] / lag(GSPC[,5])-1)
colnames(GSPC)[ncol(GSPC)] <- "GSPC.WeeklyReturn"
M = mean(GSPC$GSPC.WeeklyReturn, na.rm = TRUE)
M = (1+M)^50-1

sd.M <- sd(GSPC$GSPC.Close)

View(GSPC)

#Risk Free Rate (Rfr)
getSymbols(Symbols = "^TNX", src = "yahoo", periodicity = "daily", auto.assign = TRUE)
TNX <- as.data.frame(TNX)
Rfr = TNX[length(TNX$TNX.Close),4]
Rfr = as.numeric(Rfr)
Rfr = Rfr/100

View(TNX)

#Construct a SML line
beta = seq(-3,3,by=0.5)
capm = Rfr + beta*(M-Rfr)
plot(beta, capm, type = "o")

Basically, it just get data from yahoo and plot CAPM against BETA range from -3 to 3. In order to do my analysis on AAPL stock with the plot, I have acquired the "Return of AAPL" and also the "Beta of AAPL", I named them as "Return.AAPL" and "Beta.AAPL" respectively. However, when I try to visualize AAPL return by inputting "Return.AAPL" as y-axis and "Beta.AAPL" as x-axis into the SML plot. I dont know how to do it!!!

I have seen people say use: points(x = Beta.AAPL, y = Return.AAPL). However, the plot shows no change and does not work. Please help how to add one single point into my SML plot


问:
java.lang.instrument.IllegalClassFormatException: Error while instrumenting javax/script/ScriptEngine. at org.jacoco.agent
I am getting the following error when test/coverage is run

java.lang.instrument.IllegalClassFormatException: Error while instrumenting javax/script/ScriptEngine.
at org.jacoco.agent.rt.internal_035b120.CoverageTransformer.transform(CoverageTransformer.java:93)

Here is the effectif POM. Thank you for your help

```<code><?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>io.javabrains</groupId>
  <artifactId>junit-5-basics</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>junit-5-basics</name>
  <description>Code accompanying the JUnit 5 Basics course on Java Brains (javabrains.io)</description>
  <properties>
    <maven.compiler.source>11</maven.compiler.source>
    <sonar.dependencyCheck.htmlReportPath>./target/dependency-check-report.html</sonar.dependencyCheck.htmlReportPath>
    <junit.jupiter.version>5.4.0</junit.jupiter.version>
    <dependency-check-maven.version>7.3.0</dependency-check-maven.version>
    <maven.compiler.target>11</maven.compiler.target>
    <sonar.dependencyCheck.jsonReportPath>./target/dependency-check-report.json</sonar.dependencyCheck.jsonReportPath>
    <sonar.dependencyCheck.summarize>true</sonar.dependencyCheck.summarize>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>5.4.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>5.4.0</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <repositories>
    <repository>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
    </pluginRepository>
  </pluginRepositories>
  <build>
    <sourceDirectory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\src\main\java</sourceDirectory>
    <scriptSourceDirectory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\src\main\scripts</scriptSourceDirectory>
    <testSourceDirectory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\src\test\java</testSourceDirectory>
    <outputDirectory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\target\classes</outputDirectory>
    <testOutputDirectory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\target\test-classes</testOutputDirectory>
    <resources>
      <resource>
        <directory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\src\main\resources</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\src\test\resources</directory>
      </testResource>
    </testResources>
    <directory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\target</directory>
    <finalName>junit-5-basics-0.0.1-SNAPSHOT</finalName>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>1.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.2-beta-5</version>
        </plugin>
        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.8</version>
        </plugin>
        <plugin>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.3</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.1</version>
        <executions>
          <execution>
            <id>default-test</id>
            <phase>test</phase>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.9-SNAPSHOT</version>
        <executions>
          <execution>
            <id>prepare-agent</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.owasp</groupId>
        <artifactId>dependency-check-maven</artifactId>
        <version>7.3.0</version>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <formats>
                <format>html</format>
                <format>json</format>
              </formats>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <formats>
            <format>html</format>
            <format>json</format>
          </formats>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>2.5</version>
        <executions>
          <execution>
            <id>default-clean</id>
            <phase>clean</phase>
            <goals>
              <goal>clean</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.6</version>
        <executions>
          <execution>
            <id>default-testResources</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>testResources</goal>
            </goals>
          </execution>
          <execution>
            <id>default-resources</id>
            <phase>process-resources</phase>
            <goals>
              <goal>resources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>default-jar</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <executions>
          <execution>
            <id>default-compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
          <execution>
            <id>default-testCompile</id>
            <phase>test-compile</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-install-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>default-install</id>
            <phase>install</phase>
            <goals>
              <goal>install</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>2.7</version>
        <executions>
          <execution>
            <id>default-deploy</id>
            <phase>deploy</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.3</version>
        <executions>
          <execution>
            <id>default-site</id>
            <phase>site</phase>
            <goals>
              <goal>site</goal>
            </goals>
            <configuration>
              <outputDirectory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\target\site</outputDirectory>
              <reportPlugins>
                <reportPlugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-project-info-reports-plugin</artifactId>
                </reportPlugin>
              </reportPlugins>
            </configuration>
          </execution>
          <execution>
            <id>default-deploy</id>
            <phase>site-deploy</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
            <configuration>
              <outputDirectory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\target\site</outputDirectory>
              <reportPlugins>
                <reportPlugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-project-info-reports-plugin</artifactId>
                </reportPlugin>
              </reportPlugins>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <outputDirectory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\target\site</outputDirectory>
          <reportPlugins>
            <reportPlugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-project-info-reports-plugin</artifactId>
            </reportPlugin>
          </reportPlugins>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <reporting>
    <outputDirectory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\target\site</outputDirectory>
  </reporting>
</project>
</code>```

Body:
I am getting the following error when test/coverage is run

java.lang.instrument.IllegalClassFormatException: Error while instrumenting javax/script/ScriptEngine.
at org.jacoco.agent.rt.internal_035b120.CoverageTransformer.transform(CoverageTransformer.java:93)

Here is the effectif POM. Thank you for your help

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>io.javabrains</groupId>
  <artifactId>junit-5-basics</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>junit-5-basics</name>
  <description>Code accompanying the JUnit 5 Basics course on Java Brains (javabrains.io)</description>
  <properties>
    <maven.compiler.source>11</maven.compiler.source>
    <sonar.dependencyCheck.htmlReportPath>./target/dependency-check-report.html</sonar.dependencyCheck.htmlReportPath>
    <junit.jupiter.version>5.4.0</junit.jupiter.version>
    <dependency-check-maven.version>7.3.0</dependency-check-maven.version>
    <maven.compiler.target>11</maven.compiler.target>
    <sonar.dependencyCheck.jsonReportPath>./target/dependency-check-report.json</sonar.dependencyCheck.jsonReportPath>
    <sonar.dependencyCheck.summarize>true</sonar.dependencyCheck.summarize>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>5.4.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>5.4.0</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <repositories>
    <repository>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
    </pluginRepository>
  </pluginRepositories>
  <build>
    <sourceDirectory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\src\main\java</sourceDirectory>

    <testSourceDirectory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\src\test\java</testSourceDirectory>
    <outputDirectory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\target\classes</outputDirectory>
    <testOutputDirectory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\target\test-classes</testOutputDirectory>
    <resources>
      <resource>
        <directory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\src\main\resources</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\src\test\resources</directory>
      </testResource>
    </testResources>
    <directory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\target</directory>
    <finalName>junit-5-basics-0.0.1-SNAPSHOT</finalName>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>1.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.2-beta-5</version>
        </plugin>
        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.8</version>
        </plugin>
        <plugin>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.3</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.1</version>
        <executions>
          <execution>
            <id>default-test</id>
            <phase>test</phase>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.9-SNAPSHOT</version>
        <executions>
          <execution>
            <id>prepare-agent</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.owasp</groupId>
        <artifactId>dependency-check-maven</artifactId>
        <version>7.3.0</version>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <formats>
                <format>html</format>
                <format>json</format>
              </formats>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <formats>
            <format>html</format>
            <format>json</format>
          </formats>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>2.5</version>
        <executions>
          <execution>
            <id>default-clean</id>
            <phase>clean</phase>
            <goals>
              <goal>clean</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.6</version>
        <executions>
          <execution>
            <id>default-testResources</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>testResources</goal>
            </goals>
          </execution>
          <execution>
            <id>default-resources</id>
            <phase>process-resources</phase>
            <goals>
              <goal>resources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>default-jar</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <executions>
          <execution>
            <id>default-compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
          <execution>
            <id>default-testCompile</id>
            <phase>test-compile</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-install-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>default-install</id>
            <phase>install</phase>
            <goals>
              <goal>install</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>2.7</version>
        <executions>
          <execution>
            <id>default-deploy</id>
            <phase>deploy</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.3</version>
        <executions>
          <execution>
            <id>default-site</id>
            <phase>site</phase>
            <goals>
              <goal>site</goal>
            </goals>
            <configuration>
              <outputDirectory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\target\site</outputDirectory>
              <reportPlugins>
                <reportPlugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-project-info-reports-plugin</artifactId>
                </reportPlugin>
              </reportPlugins>
            </configuration>
          </execution>
          <execution>
            <id>default-deploy</id>
            <phase>site-deploy</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
            <configuration>
              <outputDirectory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\target\site</outputDirectory>
              <reportPlugins>
                <reportPlugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-project-info-reports-plugin</artifactId>
                </reportPlugin>
              </reportPlugins>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <outputDirectory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\target\site</outputDirectory>
          <reportPlugins>
            <reportPlugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-project-info-reports-plugin</artifactId>
            </reportPlugin>
          </reportPlugins>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <reporting>
    <outputDirectory>C:\Projects\Workspace-Eclipse-Junit\junit-5-basics-course\target\site</outputDirectory>
  </reporting>
</project>


问:
GitHub Dev: Unable to authenticate session
I am having an issue with the GitHub web editor. Whenever I try to edit a file, the editor does not load and I am unable to make any changes, as it isn't authenticating my session. I have tried clearing my cache and cookies, and also tried using a different browser, but the issue persists.

Has anyone else experienced this problem, and if so, do you have any recommendations for how to resolve it? I would greatly appreciate any help or advice you can offer. There is a GitHub thread for the following error as well: https://github.com/orgs/community/discussions/43020

Thank you in advance for your assistance.