问:
Issue importing Mediapipe library in python
I have created a virtual environment on my local machine and am using jupyter notebook. In my jupyter notebook, I pip installed mediapipe "!pip install mediapipe" and when I check my pip list "!pip list", "mediapipe             0.9.0.1" appears in the list. However, when I go to import mediapipe, it gives me a Module Not Found error. Anyone know what the issue is? I have tried restarting my kernel and still no luck.</p>
```<code>!pip install mediapipe opencv-python scikit-learn pandas

!pip list

Package               Version
--------------------- --------
absl-py               1.3.0
attrs                 22.1.0
contourpy             1.0.6
cycler                0.11.0
flatbuffers           22.12.6
fonttools             4.38.0
joblib                1.2.0
kiwisolver            1.4.4
matplotlib            3.6.2
mediapipe             0.9.0.1
numpy                 1.23.5
opencv-contrib-python 4.6.0.66
opencv-python         4.6.0.66
packaging             22.0
pandas                1.5.2
Pillow                9.3.0
pip                   22.3.1
protobuf              3.20.3
pyparsing             3.0.9
python-dateutil       2.8.2
pytz                  2022.6
scikit-learn          1.2.0
scipy                 1.9.3
setuptools            49.2.1
six                   1.16.0
threadpoolctl         3.1.0

import pandas as pd
import cv2
import mediapipe

ModuleNotFoundError                       Traceback (most recent call last)
Input In [1], in <cell line: 3>()
      1 import pandas as pd
      2 import cv2
----> 3 import mediapipe

ModuleNotFoundError: No module named 'mediapipe'
</code>```

Body:
I have created a virtual environment on my local machine and am using jupyter notebook. In my jupyter notebook, I pip installed mediapipe "!pip install mediapipe" and when I check my pip list "!pip list", "mediapipe             0.9.0.1" appears in the list. However, when I go to import mediapipe, it gives me a Module Not Found error. Anyone know what the issue is? I have tried restarting my kernel and still no luck.

!pip install mediapipe opencv-python scikit-learn pandas

!pip list

Package               Version
--------------------- --------
absl-py               1.3.0
attrs                 22.1.0
contourpy             1.0.6
cycler                0.11.0
flatbuffers           22.12.6
fonttools             4.38.0
joblib                1.2.0
kiwisolver            1.4.4
matplotlib            3.6.2
mediapipe             0.9.0.1
numpy                 1.23.5
opencv-contrib-python 4.6.0.66
opencv-python         4.6.0.66
packaging             22.0
pandas                1.5.2
Pillow                9.3.0
pip                   22.3.1
protobuf              3.20.3
pyparsing             3.0.9
python-dateutil       2.8.2
pytz                  2022.6
scikit-learn          1.2.0
scipy                 1.9.3
setuptools            49.2.1
six                   1.16.0
threadpoolctl         3.1.0

import pandas as pd
import cv2
import mediapipe

ModuleNotFoundError                       Traceback (most recent call last)
Input In [1], in <cell line: 3>()
      1 import pandas as pd
      2 import cv2
----> 3 import mediapipe

ModuleNotFoundError: No module named 'mediapipe'


来源: stackexchange

问:
Can I prevent disk filling up by changing a Mongodb collection from TTL to Capped?
I have a MongoDB 4.4 server (single node, no replicas) for storing IoT-style data. Data is written to several collections every few seconds by my NodeJS app. Documents are not updated/modified, and reads are less common than writes.

I have TTL indices on my big collections so that data older than 6 months is deleted. However, Mongo seems to consume more and more disk space. When the disk inevitably fills up, Mongo and my app stop working. I need to stop Mongo from consuming increasing amounts of disk space.

If I call stats() on my big collections, I can see that there are gigabytes of "file bytes available for reuse". But when I use db.runCommand({compact:'big_collection'}), it doesn't seem to release any space. Other people seem to have similar experiences. I wish I understood why compact isn't working.

I suspect the best alternative approach is to remove the TTL index, and then Cap the collection to a fixed size, but I'd like to hear if anyone has experience with such a process, or alternative recommendations.

ContentLicense: CC BY-SA 4.0


问:
Electron does not save session info as in chrome which causes playwright to not load session info
While I was working on pet project that I was planning to load remote whatsapp web in electron app and scan the qr code then run playwright/puppeteer on the background to celebrate birthdays struggled with loading userDataDir in playwright.

It works perfectly fine when I use my daily browsers(chrome) userDataDir: /Users/x/Library/Application Support/Google/Chrome but when I try to use any of the following:

/Users/x/Library/Application Support/Electron

/Users/x/Library/Application Support/Electron/Partitions

/Users/x/Library/Application Support/Electron/Partitions/infragistics

/Users/x/Library/Application Support/Electron/Partitions/Default

/Users/x/Library/Application Support/Electron/Default

it doesn't load the whatsapp session and asks me to login again...

To reproduce the problem these 2 simple snippets are enough:
Electron:

```<code>mainWindow = new BrowserWindow({
  show: false,
  width: 1024,
  height: 728,
  icon: getAssetPath('icon.png'),
  webPreferences: {
    preload: app.isPackaged
      ? path.join(__dirname, 'preload.js')
      : path.join(__dirname, '../../.erb/dll/preload.js'),
    partition: 'persist:infragistics',
  },
});

mainWindow.loadURL('https://web.whatsapp.com');
</code>```

Playwright:

```<code>const { chromium } = require('playwright');

(async () => {
  const playwrightCtx = await chromium.launchPersistentContext(
    '/Users/x/Library/Application Support/Electron',
    { headless: false }
  );

  const page = await playwrightCtx.newPage();
  await page.goto('https://web.whatsapp.com');
})();

</code>```

Body:
While I was working on pet project that I was planning to load remote whatsapp web in electron app and scan the qr code then run playwright/puppeteer on the background to celebrate birthdays struggled with loading userDataDir in playwright.

It works perfectly fine when I use my daily browsers(chrome) userDataDir: /Users/x/Library/Application Support/Google/Chrome but when I try to use any of the following:

/Users/x/Library/Application Support/Electron

/Users/x/Library/Application Support/Electron/Partitions

/Users/x/Library/Application Support/Electron/Partitions/infragistics

/Users/x/Library/Application Support/Electron/Partitions/Default

/Users/x/Library/Application Support/Electron/Default

it doesn't load the whatsapp session and asks me to login again...

To reproduce the problem these 2 simple snippets are enough:
Electron:

mainWindow = new BrowserWindow({
  show: false,
  width: 1024,
  height: 728,
  icon: getAssetPath('icon.png'),
  webPreferences: {
    preload: app.isPackaged
      ? path.join(__dirname, 'preload.js')
      : path.join(__dirname, '../../.erb/dll/preload.js'),
    partition: 'persist:infragistics',
  },
});

mainWindow.loadURL('https://web.whatsapp.com');

Playwright:

const { chromium } = require('playwright');

(async () => {
  const playwrightCtx = await chromium.launchPersistentContext(
    '/Users/x/Library/Application Support/Electron',
    { headless: false }
  );

  const page = await playwrightCtx.newPage();
  await page.goto('https://web.whatsapp.com');
})();


问:
Getting error on prettier settings not matching on docs when I put in PR
I added to markdown documents to an existing project and I get error on prettier settings not matching the projects.  enter image description here.

I have my settings for prettier on vs code like this enter image description here

I read through this but don't quite understand how to fix https://prettier.io/docs/en/cli.html#--check

I cloned the repo to my local machine and attempted to run some commands to try to find how my prettier settings differ or make them the same as the project but failed. Is there a command or way to make my docs I added have the same prettier settings to the project??


问:
VS2019 QtAddin, undefined reference of qt signals in lib
I am building LIB and exe projects using Qt5.15.2 and VS2019.
exe project use LIB file as input dependencies.
LIB project compiles well and successfully make .lib file.
but in exe file, it says some Qt signals in lib are undefined.
so I try to include mocs_compilation_Release.cpp in lib project, but result was same.
Is there way to solve qt signal undefined error in VS-qt addin project?
Thank you.

It looks visual studio find function name as same as qt signal.


问:
Build error in Android Studio for Ionic/Capacitor project when two particular packages are installed
I'm writing an application using Ionic with the intention of building it for Android and iOS. I came across an error building the app in Android Studio after I added a new package to the project. I've created a simple project with step-by-step instructions on how to replicate this error.

The error is

error: Zip file 'D:\Projects\ionictest\android\app\build\outputs\apk\debug\app-debug.apk' already contains entry 'META-INF/MANIFEST.MF', cannot overwrite.

The error is reproducible by doing the following steps in a command line

```<code>> ionic start ionictest blank --type=react
> cd ionictest
> npm install @capacitor/android @capacitor-community/sqlite
> npx cap add android
> ionic build && npx cap sync && npx cap open android
</code>```

Once Android Studio opens, build the project and it will build fine. Run the following commands

```<code>> npm install cordova-background-geolocation-plugin
> npx cap sync
</code>```

Add the following to string.xml

```<code><string name="plugin_bgloc_account_name">@string/app_name</string>
<string name="plugin_bgloc_account_type">io.ionic.starter.account</string>
<string name="plugin_bgloc_content_authority">io.ionic.starter</string>
</code>```

Once again build the project in Android Studio, this time the build will fail with an error

2 files found with path 'build-data.properties'

I figured out with some research this could be resolved by adding the following to build.gradle

```<code>android {
    packagingOptions {
        pickFirst  '**'
    }
}
</code>```

Once again build the project in Android Studio, this time the build will fail with a new error

Zip file 'D:\Projects\ionictest\android\app\build\outputs\apk\debug\app-debug.apk' already contains entry 'META-INF/MANIFEST.MF', cannot overwrite

That's as far as I got. I've searched far and wide for a solution but I don't understand the error so everything I try is just a stab in the dark. Nothing seems to fix it.

Does anyone have a solution?

```<code>Windows 10 Enterprise
npm 6.14.11
node 16.2.0
ionic 6.20.1
capacitor/cli 4.6.1
capacitor/core 4.6.1
Android SDK Tools 26.1.1
</code>```

Body:
I'm writing an application using Ionic with the intention of building it for Android and iOS. I came across an error building the app in Android Studio after I added a new package to the project. I've created a simple project with step-by-step instructions on how to replicate this error.

The error is

error: Zip file 'D:\Projects\ionictest\android\app\build\outputs\apk\debug\app-debug.apk' already contains entry 'META-INF/MANIFEST.MF', cannot overwrite.

The error is reproducible by doing the following steps in a command line

> ionic start ionictest blank --type=react
> cd ionictest
> npm install @capacitor/android @capacitor-community/sqlite
> npx cap add android
> ionic build && npx cap sync && npx cap open android

Once Android Studio opens, build the project and it will build fine. Run the following commands

> npm install cordova-background-geolocation-plugin
> npx cap sync

Add the following to string.xml

<string name="plugin_bgloc_account_name">@string/app_name</string>
<string name="plugin_bgloc_account_type">io.ionic.starter.account</string>
<string name="plugin_bgloc_content_authority">io.ionic.starter</string>

Once again build the project in Android Studio, this time the build will fail with an error

2 files found with path 'build-data.properties'

I figured out with some research this could be resolved by adding the following to build.gradle

android {
    packagingOptions {
        pickFirst  '**'
    }
}

Once again build the project in Android Studio, this time the build will fail with a new error

Zip file 'D:\Projects\ionictest\android\app\build\outputs\apk\debug\app-debug.apk' already contains entry 'META-INF/MANIFEST.MF', cannot overwrite

That's as far as I got. I've searched far and wide for a solution but I don't understand the error so everything I try is just a stab in the dark. Nothing seems to fix it.

Does anyone have a solution?

Windows 10 Enterprise
npm 6.14.11
node 16.2.0
ionic 6.20.1
capacitor/cli 4.6.1
capacitor/core 4.6.1
Android SDK Tools 26.1.1


问:
what is the max numbers of inputs for `keras.model(input)` instead of `keras.model.predict(input)`
In this documentation of Keras.model, it describe the differences between using keras.model.predict(input) and keras.model(input), stating that the latter is a better suit for small numbers of inputs.

My question is, what is the max numbers of inputs for keras.model(input)?

Revision 12-20-2022

"For small numbers of inputs that fit in one batch, directly use __call__() for faster execution, e.g., model(x)"

The quote is as above. learner and Dr. snoopy said that I might misunderstand the meaning of "small numbers of inputs that fit in one batch".


问:
How to move the switch tab buttons in the “tab bar” to the app bar in Flet?
How to move the switch tab buttons in the “tab bar” to the app bar in Flet?
I have 3 tabs, but if I use tabs, there will be a "tab bar" under the app bar. But I don't want to demolish the app bar. Are there any ways to move the "tab bar" buttons to the app bar? Or are there any functions to switch tabs? Thanks!</p>


问:
Counting agents in discrete system during Parameter Variation Experiment
I am working on a project for personnel allocation during a Navy maintenance availability using AnyLogic. I have the simulation running and have set the parameters (the personnel) variable up and running. However, I am trying to pull the numbers of checks entering the system and those leaving the system for each simulation run to assess the efficiency of the manpower allocation. I'm not able to do that because I cannot convert "agent" to "double". How can I fix this?

I tried creating new agents, trying to make the count into a variable to gather it on the ParametersVariation page and that did not work either.


问:
Are the scopes defined when 'exposing an API' in an Azure AD Application Registration for information purposes only? If not, how are they enforced?
Desired Behaviour

I am setting up a Node.js web application using Azure AD B2C authentication and authorisation.

It is a confidential, server side, client (i.e. - not a Single Page Application).

The desired behaviour is:

Authenticate and authorise a user via login using Azure ADB2C

Based on a successful login, allow users to call routes in the Node web app

My specific question is at the bottom of this post, but is essentially:

Given that, if an accessToken is present in req.session, my
application will return the result from calling ANY endpoint I choose
(even if it is not related to any of the 'scopes' defined when
'exposing the api'), are the scopes that are defined when 'exposing an
API' essentially 'for information purposes only' - both for
application admins and end users?  Or should they somehow be enforced in each relevant Express route handler?

Research

I have done extensive reading and video watching around the topic, including:

GitHub Repositories:

active-directory-b2c-msal-node-sign-in-sign-out-webapp

active-directory-b2c-javascript-nodejs-webapi

learn.microsoft.com articles:

https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-overview

https://learn.microsoft.com/en-au/azure/active-directory-b2c/configure-a-sample-node-web-app

https://docs.microsoft.com/azure/active-directory-b2c/enable-authentication-in-node-web-app

https://docs.microsoft.com/azure/active-directory-b2c/configure-authentication-in-sample-node-web-app-with-api

https://docs.microsoft.com/azure/active-directory-b2c/enable-authentication-in-node-web-app-with-api

Videos:

Identity for Developers Playlist by Microsoft Security

OAuth 2.0 and OpenID Connect (in plain English) by OktaDev

What I've Tried

I have been able to implement a basic prototype consisting of:

Node.js web application (a confidential, server side, client, not a Single Page App)

Sign Up, Sign In and Edit Profile User flows

2 x Application Registrations in Azure - one for the Web App and one for the Web App API

I have 'exposed the API' in the Web App API registration, eg:  :

```<code>https://my-tenant-name.onmicrosoft.com/my-api-uri-thing/tasks.read
https://my-tenant-name.onmicrosoft.com/my-api-uri-thing/tasks.write
</code>```

I have 'added permissions' to the Web App registration (to access the Web App API registration), eg:

```<code>MY-APP-API (2)
tasks.read, Delegated, Admin Consent Required - Yes, Granted for MY-APP
tasks.write, Delegated, Admin Consent Required - Yes, Granted for MY-APP

Microsoft Graph (2)
offline_access, Delegated, Admin Consent Required - No, Granted for MY-APP
openid, Delegated, Admin Consent Required - No, Granted for MY-APP
</code>```

So the workflow is as follows (based on this code):

User clicks on a '/signin' link

The relevant Express route handler passes through the required scopes to getAuthCode():

```<code>app.get('/signin',(req, res)=>{
        //Initiate a Auth Code Flow >> for sign in
        //Pass the api scopes as well so that you received both the IdToken and accessToken
        getAuthCode(process.env.SIGN_UP_SIGN_IN_POLICY_AUTHORITY,apiConfig.webApiScopes, APP_STATES.LOGIN, res);
});
</code>```

Source

The value of the scopes parameter is:

```<code>['https://${process.env.TENANT_NAME}.onmicrosoft.com/my-api-uri-thing/tasks.read','https://${process.env.TENANT_NAME}.onmicrosoft.com/my-api-uri-thing/tasks.write']
</code>```

Upon successful sign in, the user is redirected to /redirect

The relevant Express route handler passes through a tokenRequest object to get an accessToken which is then added to req.session:

```<code>app.get('/redirect',(req, res)=>{

    if (req.query.state === APP_STATES.LOGIN) {
        // prepare the request for calling the web API
        tokenRequest.authority = process.env.SIGN_UP_SIGN_IN_POLICY_AUTHORITY;
        tokenRequest.scopes = apiConfig.webApiScopes;
        tokenRequest.code = req.query.code;
        confidentialClientApplication.acquireTokenByCode(tokenRequest)
        .then((response) => {
            req.session.accessToken = response.accessToken;
            req.session.givenName = response.idTokenClaims.given_name;
            console.log('\nAccessToken:' + req.session.accessToken);
            res.render('signin', {showSignInButton: false, givenName: response.idTokenClaims.given_name});
        }).catch((error) => {
            console.log(error);
            res.status(500).send(error);
        });
    }else{
        res.status(500).send('We do not recognize this response!');
    }
});
</code>```

User calls a 'protected API'

The relevant Express route handler checks if req.session contains an accessToken value

If the accessToken is present, it makes an http request to the desired endpoint using axios and passes through the accessToken as the Bearer token in the headers of the request.

The 'protected content' is then returned

```<code>app.get('/api', async (req, res) => {
    if(!req.session.accessToken){
        //User is not logged in and so they can only call the anonymous API
        try {
            const response = await axios.get(apiConfig.anonymousUri);
            console.log('API response' + response.data);
            res.render('api',{data: JSON.stringify(response.data), showSignInButton: true, bg_color:'warning'});
        } catch (error) {
            console.error(error);
            res.status(500).send(error);
        }
    }else{
        //Users have the accessToken because they signed in and the accessToken is still in the session
        console.log('\nAccessToken:' + req.session.accessToken);
        let accessToken = req.session.accessToken;
        const options = {
            headers: {
                //accessToken used as bearer token to call a protected API
                Authorization: `Bearer ${accessToken}`
            }
        };

        try {
            const response = await axios.get(apiConfig.protectedUri, options);
            console.log('API response' + response.data);
            res.render('api',{data: JSON.stringify(response.data), showSignInButton: false, bg_color:'success', givenName: req.session.givenName});
        } catch (error) {
            console.error(error);
            res.status(500).send(error);
        }
    }
});
</code>```

Question

Given that, if an accessToken is present in req.session, my application will return the result from calling ANY endpoint I choose (even if it is not related to any of the 'scopes' defined when 'exposing the api'), are the scopes that are defined when 'exposing an API' essentially 'for information purposes only' - both for application admins and end users?

Or should I be coding in a conditional statement in each relevant Express route handler that says:

IF the required scope for accessing this content is present in this access token,

THEN you can access this content

and therefore 'enforces' the scope that has been defined and consented to by the user.

With my current level of understanding, I am assuming that these scopes ARE just for information purposes only, because I haven't seen any examples where the scopes are enforced through code.

Body:
Desired Behaviour

I am setting up a Node.js web application using Azure AD B2C authentication and authorisation.

It is a confidential, server side, client (i.e. - not a Single Page Application).

The desired behaviour is:

Authenticate and authorise a user via login using Azure ADB2C

Based on a successful login, allow users to call routes in the Node web app

My specific question is at the bottom of this post, but is essentially:

Given that, if an accessToken is present in req.session, my
application will return the result from calling ANY endpoint I choose
(even if it is not related to any of the 'scopes' defined when
'exposing the api'), are the scopes that are defined when 'exposing an
API' essentially 'for information purposes only' - both for
application admins and end users?  Or should they somehow be enforced in each relevant Express route handler?

Research

I have done extensive reading and video watching around the topic, including:

GitHub Repositories:

active-directory-b2c-msal-node-sign-in-sign-out-webapp

active-directory-b2c-javascript-nodejs-webapi

learn.microsoft.com articles:

https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-overview

https://learn.microsoft.com/en-au/azure/active-directory-b2c/configure-a-sample-node-web-app

https://docs.microsoft.com/azure/active-directory-b2c/enable-authentication-in-node-web-app

https://docs.microsoft.com/azure/active-directory-b2c/configure-authentication-in-sample-node-web-app-with-api

https://docs.microsoft.com/azure/active-directory-b2c/enable-authentication-in-node-web-app-with-api

Videos:

Identity for Developers Playlist by Microsoft Security

OAuth 2.0 and OpenID Connect (in plain English) by OktaDev

What I've Tried

I have been able to implement a basic prototype consisting of:

Node.js web application (a confidential, server side, client, not a Single Page App)

Sign Up, Sign In and Edit Profile User flows

2 x Application Registrations in Azure - one for the Web App and one for the Web App API

I have 'exposed the API' in the Web App API registration, eg:  :

https://my-tenant-name.onmicrosoft.com/my-api-uri-thing/tasks.read
https://my-tenant-name.onmicrosoft.com/my-api-uri-thing/tasks.write

I have 'added permissions' to the Web App registration (to access the Web App API registration), eg:

MY-APP-API (2)
tasks.read, Delegated, Admin Consent Required - Yes, Granted for MY-APP
tasks.write, Delegated, Admin Consent Required - Yes, Granted for MY-APP

Microsoft Graph (2)
offline_access, Delegated, Admin Consent Required - No, Granted for MY-APP
openid, Delegated, Admin Consent Required - No, Granted for MY-APP

So the workflow is as follows (based on this code):

User clicks on a '/signin' link

The relevant Express route handler passes through the required scopes to getAuthCode():

app.get('/signin',(req, res)=>{
        //Initiate a Auth Code Flow >> for sign in
        //Pass the api scopes as well so that you received both the IdToken and accessToken
        getAuthCode(process.env.SIGN_UP_SIGN_IN_POLICY_AUTHORITY,apiConfig.webApiScopes, APP_STATES.LOGIN, res);
});

Source

The value of the scopes parameter is:

['https://${process.env.TENANT_NAME}.onmicrosoft.com/my-api-uri-thing/tasks.read','https://${process.env.TENANT_NAME}.onmicrosoft.com/my-api-uri-thing/tasks.write']

Upon successful sign in, the user is redirected to /redirect

The relevant Express route handler passes through a tokenRequest object to get an accessToken which is then added to req.session:

app.get('/redirect',(req, res)=>{

    if (req.query.state === APP_STATES.LOGIN) {
        // prepare the request for calling the web API
        tokenRequest.authority = process.env.SIGN_UP_SIGN_IN_POLICY_AUTHORITY;
        tokenRequest.scopes = apiConfig.webApiScopes;
        tokenRequest.code = req.query.code;
        confidentialClientApplication.acquireTokenByCode(tokenRequest)
        .then((response) => {
            req.session.accessToken = response.accessToken;
            req.session.givenName = response.idTokenClaims.given_name;
            console.log('\nAccessToken:' + req.session.accessToken);
            res.render('signin', {showSignInButton: false, givenName: response.idTokenClaims.given_name});
        }).catch((error) => {
            console.log(error);
            res.status(500).send(error);
        });
    }else{
        res.status(500).send('We do not recognize this response!');
    }
});

User calls a 'protected API'

The relevant Express route handler checks if req.session contains an accessToken value

If the accessToken is present, it makes an http request to the desired endpoint using axios and passes through the accessToken as the Bearer token in the headers of the request.

The 'protected content' is then returned

app.get('/api', async (req, res) => {
    if(!req.session.accessToken){
        //User is not logged in and so they can only call the anonymous API
        try {
            const response = await axios.get(apiConfig.anonymousUri);
            console.log('API response' + response.data);
            res.render('api',{data: JSON.stringify(response.data), showSignInButton: true, bg_color:'warning'});
        } catch (error) {
            console.error(error);
            res.status(500).send(error);
        }
    }else{
        //Users have the accessToken because they signed in and the accessToken is still in the session
        console.log('\nAccessToken:' + req.session.accessToken);
        let accessToken = req.session.accessToken;
        const options = {
            headers: {
                //accessToken used as bearer token to call a protected API
                Authorization: `Bearer ${accessToken}`
            }
        };

        try {
            const response = await axios.get(apiConfig.protectedUri, options);
            console.log('API response' + response.data);
            res.render('api',{data: JSON.stringify(response.data), showSignInButton: false, bg_color:'success', givenName: req.session.givenName});
        } catch (error) {
            console.error(error);
            res.status(500).send(error);
        }
    }
});

Question

Given that, if an accessToken is present in req.session, my application will return the result from calling ANY endpoint I choose (even if it is not related to any of the 'scopes' defined when 'exposing the api'), are the scopes that are defined when 'exposing an API' essentially 'for information purposes only' - both for application admins and end users?

Or should I be coding in a conditional statement in each relevant Express route handler that says:

IF the required scope for accessing this content is present in this access token,

THEN you can access this content

and therefore 'enforces' the scope that has been defined and consented to by the user.

With my current level of understanding, I am assuming that these scopes ARE just for information purposes only, because I haven't seen any examples where the scopes are enforced through code.


问:
JEST late test case affects previous test case
I'm writing a unit test to check if a certain section would appear if a related button is clicked

An I have this piece of code

```<code>const sections = [...document.querySelectorAll("section")];
const buttons = [...document.querySelectorAll("button")];

const showRelatedSection = (buttonID) => {
  sections.forEach((section) => {
    if (section.id === buttonID) {
      section.removeAttribute("hidden");
    } else {
      section.setAttribute("hidden", "true");
    }
  })
};

buttons.forEach((button) => {
  button.addEventListener("click", function () {
    showRelatedSection(button.id);
  });
});

const randomIndex = Math.floor(Math.random() * buttons.length);
const randomButton = buttons[randomIndex];

describe('click a random button', () => {
  randomButton.click();

  test('related section is shown', () => {
    const section = sections.find(s => s.id === randomButton.id);
    expect(section.hasAttribute("hidden")).toBeFalsy();
  });
});

describe('click another random button', () => {
  const restSections = sections;
  restSections.splice(randomIndex, 1);

  const anotherRandomIndex = Math.floor(Math.random() * restSections.length);
  const anotherRandomButton = restSections[anotherRandomIndex];

  anotherRandomButton.click();

  test('previous section is hidden', () => {
    const section = sections.find(s => s.id === randomButton.id);
    expect(section.hasAttribute("hidden")).toBeTruthy();
  });

  test('new related section is shown', () => {
    const section = sections.find(s => s.id === anotherRandomButton.id);
    expect(section.hasAttribute("hidden")).toBeFalsy();
  });
});

</code>```

If I only ran 'click a random button' test it would pass, and 'related section is shown' would return false as expected.

but if I ran the whole test, the 'click another random button' would pass, but 'click a random button' would fail and 'related section is shown' would return true instead of false.

So, it seems that when I ran the whole test, the 'related section is shown' cannot check the test against the array of sections in that moment, and instead it checks the test against the array of sections from the late describe block.

How can I make the whole test pass?

Body:
I'm writing a unit test to check if a certain section would appear if a related button is clicked

An I have this piece of code

const sections = [...document.querySelectorAll("section")];
const buttons = [...document.querySelectorAll("button")];

const showRelatedSection = (buttonID) => {
  sections.forEach((section) => {
    if (section.id === buttonID) {
      section.removeAttribute("hidden");
    } else {
      section.setAttribute("hidden", "true");
    }
  })
};

buttons.forEach((button) => {
  button.addEventListener("click", function () {
    showRelatedSection(button.id);
  });
});

const randomIndex = Math.floor(Math.random() * buttons.length);
const randomButton = buttons[randomIndex];

describe('click a random button', () => {
  randomButton.click();

  test('related section is shown', () => {
    const section = sections.find(s => s.id === randomButton.id);
    expect(section.hasAttribute("hidden")).toBeFalsy();
  });
});

describe('click another random button', () => {
  const restSections = sections;
  restSections.splice(randomIndex, 1);

  const anotherRandomIndex = Math.floor(Math.random() * restSections.length);
  const anotherRandomButton = restSections[anotherRandomIndex];

  anotherRandomButton.click();

  test('previous section is hidden', () => {
    const section = sections.find(s => s.id === randomButton.id);
    expect(section.hasAttribute("hidden")).toBeTruthy();
  });

  test('new related section is shown', () => {
    const section = sections.find(s => s.id === anotherRandomButton.id);
    expect(section.hasAttribute("hidden")).toBeFalsy();
  });
});

If I only ran 'click a random button' test it would pass, and 'related section is shown' would return false as expected.

but if I ran the whole test, the 'click another random button' would pass, but 'click a random button' would fail and 'related section is shown' would return true instead of false.

So, it seems that when I ran the whole test, the 'related section is shown' cannot check the test against the array of sections in that moment, and instead it checks the test against the array of sections from the late describe block.

How can I make the whole test pass?


问:
How to generate logs when running functions in parallel
I have 3 classes, a main class that is called App, a secondary class that have some business rules and another class that has some useful functions called Utils.

The main class, App has a method that run another method of the secondary class in parallel,  this method of the secondary class uses a method of the class Utils to generate logs, but I think that because of the context manager that I use to run processeses in parallel, the logging module loses his configurations. See:

```<code>class App:
    otherClass = OtherClass()
    utils = Utils()
    n_cpus = os.cpu_count()
    def call_multiprocessing(self):
        #When I run this way the logging messages goes to the console and not to the file
        #specified in basic config
        with concurrent.futures.ProcessPoolExecutor(max_workers=self.n_cpus) as executor:
            co_routines = executor.map(self.otherClass.some_method(), self.list_of_parameters)

class OtherClass()
    utils = Utils()
    utils.setup_log_folder(folder_name)

    def some_method(self, some_parameter):
        for a in some_parameter:
            #DO SOME STUFF
        self.utils.generate_log(some_message)

import logging

class Utils:

    def setup_log(folder):
        # if someone tried to log something before basicConfig is called, Python creates a default handler that
        # goes to the console and will ignore further basicConfig calls. So I Remove the handler if there is one.
        root = logging.getLogger()
        if root.handlers:
            for handler in root.handlers:
                root.removeHandler(handler)
        logging.basicConfig(
            format="%(asctime)s [%(levelname)s] %(message)s",
            datefmt='%d/%m/%Y %H:%M:%S',
            handlers=[
                logging.FileHandler(os.path.join(folder, 'log.txt'), 'w', 'utf-8'),
            ]
        )
</code>```

The file log.txt is created, but the log messages are shown in console. How can I solve that?

Body:
I have 3 classes, a main class that is called App, a secondary class that have some business rules and another class that has some useful functions called Utils.

The main class, App has a method that run another method of the secondary class in parallel,  this method of the secondary class uses a method of the class Utils to generate logs, but I think that because of the context manager that I use to run processeses in parallel, the logging module loses his configurations. See:

class App:
    otherClass = OtherClass()
    utils = Utils()
    n_cpus = os.cpu_count()
    def call_multiprocessing(self):
        #When I run this way the logging messages goes to the console and not to the file
        #specified in basic config
        with concurrent.futures.ProcessPoolExecutor(max_workers=self.n_cpus) as executor:
            co_routines = executor.map(self.otherClass.some_method(), self.list_of_parameters)

class OtherClass()
    utils = Utils()
    utils.setup_log_folder(folder_name)

    def some_method(self, some_parameter):
        for a in some_parameter:
            #DO SOME STUFF
        self.utils.generate_log(some_message)

import logging

class Utils:

    def setup_log(folder):
        # if someone tried to log something before basicConfig is called, Python creates a default handler that
        # goes to the console and will ignore further basicConfig calls. So I Remove the handler if there is one.
        root = logging.getLogger()
        if root.handlers:
            for handler in root.handlers:
                root.removeHandler(handler)
        logging.basicConfig(
            format="%(asctime)s [%(levelname)s] %(message)s",
            datefmt='%d/%m/%Y %H:%M:%S',
            handlers=[
                logging.FileHandler(os.path.join(folder, 'log.txt'), 'w', 'utf-8'),
            ]
        )

The file log.txt is created, but the log messages are shown in console. How can I solve that?


问:
powershell script throwing cmd not found error for powershell tag
I am trying to run a user-data script for aws ec2 windows instance.
I added this line in my main.tf

```<code>user_data               = data.template_file.user_data.rendered
</code>```

then I have defined this in data module as template file :

```<code>data "template_file" "user_data" {
  template = "<powershell>${file("./entry_script.ps1")}</powershell><persist>true</persist>"
  vars = {
     REGION          = var.aws_region
      ENV            = local.ENV
      env            = local.env
  }
}
</code>```

But my script doesn't run on ec2 instance created

I checked the user_data from the aws console for that particular instance and it is adding this powershell tag along with my script :

```<code><powershell>
my script
</powershell><persist>true</persist>

</code>```

and when I try to run this complete script from the instance created it throws below error :

```<code> < : The term '<' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At C:\Users\Administrator\Desktop\script.ps1:1 char:1
+ <powershell>
+ ~
    + CategoryInfo          : ObjectNotFound: (<:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
</code>```

I am not sure if this powershell tags should always work with the powershell or not.
I searched for scripts and found that people do use powershell tags but for me it's not working.
Someone kinldy help me to resolve this issue.

Body:
I am trying to run a user-data script for aws ec2 windows instance.
I added this line in my main.tf

user_data               = data.template_file.user_data.rendered

then I have defined this in data module as template file :

data "template_file" "user_data" {
  template = "<powershell>${file("./entry_script.ps1")}</powershell><persist>true</persist>"
  vars = {
     REGION          = var.aws_region
      ENV            = local.ENV
      env            = local.env
  }
}

But my script doesn't run on ec2 instance created

I checked the user_data from the aws console for that particular instance and it is adding this powershell tag along with my script :

<powershell>
my script
</powershell><persist>true</persist>

and when I try to run this complete script from the instance created it throws below error :

 < : The term '<' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At C:\Users\Administrator\Desktop\script.ps1:1 char:1
+ <powershell>
+ ~
    + CategoryInfo          : ObjectNotFound: (<:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I am not sure if this powershell tags should always work with the powershell or not.
I searched for scripts and found that people do use powershell tags but for me it's not working.
Someone kinldy help me to resolve this issue.


问:
Pop-up for connecting raspberry pi pico w to wifi
I'm trying to find a way to have a raspberry pi pico w connect to wifi without needing to write in the SSID and password into the code. I'm using a non-touch screen with it and no keyboard.

Is there a way to have the pico automatically create a pop-up when plugged into a computer to query the user for a WIFI ID and password?

An answer on here which has recently been deleted suggested code that would use the a generic router IP, but I wasn't able to try it.


问:
While Loop not breaking. python
The while loop below does not break when I input "no"
Code:

```<code>def information():
    name = input("What is your name?: ")
    bid = input("what is your bid?: ")
    auction_dict = {
                    }
    bidders = input("Are there any other bidders? Type 'yes' or 'no'.")
    while bidders == "yes":
        clear()
        information()
        if bidders == "no":
            break
    print("Loop ended")

information()

</code>```

When I input "no" after typing "yes" the loop continues.
However, if I type "no" before typing "yes"
the while loop while break and print.

Title: While Loop not breaking. python

Body:
The while loop below does not break when I input "no"
Code:

def information():
    name = input("What is your name?: ")
    bid = input("what is your bid?: ")
    auction_dict = {
                    }
    bidders = input("Are there any other bidders? Type 'yes' or 'no'.")
    while bidders == "yes":
        clear()
        information()
        if bidders == "no":
            break
    print("Loop ended")

information()

When I input "no" after typing "yes" the loop continues.
However, if I type "no" before typing "yes"
the while loop while break and print.


问:
How to reuse thread in Python or at least destroy the thread after it's finished?
My goal is to reuse thread or at least destroy the thread after it's done its job.

```<code>import threading

def do_something():
    display("hello %s" % threading.current_thread())
    scrap_daily = threading.Timer(interval=1, function=do_something)
    scrap_daily.start()

do_something()
</code>```

The output

```<code>'hello <_MainThread(MainThread, started 4310353280)>'
'hello <Timer(Thread-5, started 6297972736)>'
'hello <Timer(Thread-6, started 6314799104)>'
'hello <Timer(Thread-7, started 6297972736)>'
'hello <Timer(Thread-8, started 6314799104)>'
'hello <Timer(Thread-9, started 6297972736)>'
'hello <Timer(Thread-10, started 6314799104)>'
'hello <Timer(Thread-11, started 6297972736)>'
'hello <Timer(Thread-12, started 6314799104)>'
</code>```

The problem is the Thread name keeps increasing. I am worried that the previous thread is not destroyed.

The active_count() return 9 threads. So I think it's okay-ish (assuming Python destroy the finished thread)?

Body:
My goal is to reuse thread or at least destroy the thread after it's done its job.

import threading

def do_something():
    display("hello %s" % threading.current_thread())
    scrap_daily = threading.Timer(interval=1, function=do_something)
    scrap_daily.start()

do_something()

The output

'hello <_MainThread(MainThread, started 4310353280)>'
'hello <Timer(Thread-5, started 6297972736)>'
'hello <Timer(Thread-6, started 6314799104)>'
'hello <Timer(Thread-7, started 6297972736)>'
'hello <Timer(Thread-8, started 6314799104)>'
'hello <Timer(Thread-9, started 6297972736)>'
'hello <Timer(Thread-10, started 6314799104)>'
'hello <Timer(Thread-11, started 6297972736)>'
'hello <Timer(Thread-12, started 6314799104)>'

The problem is the Thread name keeps increasing. I am worried that the previous thread is not destroyed.

The active_count() return 9 threads. So I think it's okay-ish (assuming Python destroy the finished thread)?


问:
Flutter: navigator to unique post id
In my flutter app, there is a screen that exists to recursively go to a post(Wave)'s respective child. What I would like to do is have each instance of the WaveReplies screen to have a unique route name to make it easier for the Navigator to pop back to that specific instance. My current problem is this:

Im trying to create the route like this:

```<code>static String routeName(WaveTile waveTile) {
    return '/waveReplies/${waveTile.wave.id}';
  }
</code>```

and im trying to call it in my app.router as this

```<code>case WaveRepliesScreen.routeName(
          (settings.arguments as List<WaveTile>)[0]
      ):
</code>```

which is throwing the error 'Case expressions must be constant'. Which means that I cannot use a method to use for Navigator to determine the routename. So my question is, how can I implement a method that will return a const, or any alternative solution?

Thanks!

Title: Flutter: navigator to unique post id

Body:
In my flutter app, there is a screen that exists to recursively go to a post(Wave)'s respective child. What I would like to do is have each instance of the WaveReplies screen to have a unique route name to make it easier for the Navigator to pop back to that specific instance. My current problem is this:

Im trying to create the route like this:

static String routeName(WaveTile waveTile) {
    return '/waveReplies/${waveTile.wave.id}';
  }

and im trying to call it in my app.router as this

case WaveRepliesScreen.routeName(
          (settings.arguments as List<WaveTile>)[0]
      ):

which is throwing the error 'Case expressions must be constant'. Which means that I cannot use a method to use for Navigator to determine the routename. So my question is, how can I implement a method that will return a const, or any alternative solution?

Thanks!


问:
modal can't add the second data after i close the first and closed it
```<code>$('#form-add-Group').submit(function(e) {
        e.preventDefault();
        let start = $('#start').val();
        let end = $('#end').val();
        let useFlag = $('#useFlag').val();
        let nameGroup = $('#nameGroup').val();
        let createDate = moment().format('YYYY-MM-DD HH:mm:ss') + '.' + moment().millisecond();

        $.ajax({

            url: '<?php echo base_url(); ?>canteen/CanteenManagement/addG',
            method: 'post',
            cache: false,
            data: {
                session: '<?php echo $this->session->userdata('id_user') ?>',
                start: start,
                end: end,
                useFlag: useFlag,
                nameGroup: nameGroup,
                createDate: createDate
            },
            success: function(data) {
                alert('success');
                $('#session,#start,#end,#useFlag,#createDate,#nameGroup').val('');
                $('#modal-default2').modal('hide');
                viewschedule();
            }
        })
    });
</code>```

i can add the first data succesfully but after the modal closed and add the second data on my database there are some coloms that missing from it

Body:
$('#form-add-Group').submit(function(e) {
        e.preventDefault();
        let start = $('#start').val();
        let end = $('#end').val();
        let useFlag = $('#useFlag').val();
        let nameGroup = $('#nameGroup').val();
        let createDate = moment().format('YYYY-MM-DD HH:mm:ss') + '.' + moment().millisecond();

        $.ajax({

            url: '<?php echo base_url(); ?>canteen/CanteenManagement/addG',
            method: 'post',
            cache: false,
            data: {
                session: '<?php echo $this->session->userdata('id_user') ?>',
                start: start,
                end: end,
                useFlag: useFlag,
                nameGroup: nameGroup,
                createDate: createDate
            },
            success: function(data) {
                alert('success');
                $('#session,#start,#end,#useFlag,#createDate,#nameGroup').val('');
                $('#modal-default2').modal('hide');
                viewschedule();
            }
        })
    });

i can add the first data succesfully but after the modal closed and add the second data on my database there are some coloms that missing from it


问:
Retrofit2 with JaxbConverterFactory for parsing xml getting exceptoin: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory
First, I don't use it in Android, but still getting this erorr:

My project module's dependencies:

```<code>implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-jaxb:2.9.0")
</code>```

exception stack:

```<code>Exception in thread "main" java.lang.IllegalArgumentException: Unable to create converter for class com.zeroarst.MyData
    for method MyDataService.getXml
    at retrofit2.Utils.methodError(Utils.java:54)
    at retrofit2.HttpServiceMethod.createResponseConverter(HttpServiceMethod.java:126)
    at retrofit2.HttpServiceMethod.parseAnnotations(HttpServiceMethod.java:85)
    at retrofit2.ServiceMethod.parseAnnotations(ServiceMethod.java:39)
    at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:202)
    at retrofit2.Retrofit$1.invoke(Retrofit.java:160)
    at com.sun.proxy.$Proxy0.getXml(Unknown Source)
    at com.zeroarst.GoogleRepository.getMasterIndex(GoogleRepository.kt:30)
    at com.zeroarst.NewVersionsChecker.checkNewVersions(NewVersionsChecker.kt:32)
    at com.zeroarst.TestKt$main$1$1.invokeSuspend(Test.kt:9)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
    at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
    at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
    at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
    at com.zeroarst.TestKt.main(Test.kt:7)
    at com.zeroarst.TestKt.main(Test.kt)
Caused by: java.lang.IllegalArgumentException: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
 - with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
    at retrofit2.converter.jaxb.JaxbConverterFactory.contextForType(JaxbConverterFactory.java:81)
    at retrofit2.converter.jaxb.JaxbConverterFactory.responseBodyConverter(JaxbConverterFactory.java:72)
    at retrofit2.Retrofit.nextResponseBodyConverter(Retrofit.java:362)
    at retrofit2.Retrofit.responseBodyConverter(Retrofit.java:345)
    at retrofit2.HttpServiceMethod.createResponseConverter(HttpServiceMethod.java:124)
    ... 18 more
Caused by: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
 - with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:278)
    at javax.xml.bind.ContextFinder.find(ContextFinder.java:421)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662)
    at retrofit2.converter.jaxb.JaxbConverterFactory.contextForType(JaxbConverterFactory.java:79)
    ... 22 more
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    at javax.xml.bind.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:122)
    at javax.xml.bind.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:155)
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:276)
    ... 26 more

</code>```

I traced down to the cause. It seems that the exception is thrown from
jaxb-api-2.3.1 line 118:

```<code>static Class nullSafeLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException {
    if (classLoader == null) {
        return Class.forName(className);
    } else {
        return classLoader.loadClass(className); // here
    }
}
</code>```

I googled and it seems that new versions of jaxb has removed whatever dependencies that contains com.sun.xml.internal.bind.v2.ContextFactory.

I don't really get that why would the library removed a dependency that is required and rely on all people to work out how to fix it?

How can I fix it?

Body:
First, I don't use it in Android, but still getting this erorr:

My project module's dependencies:

implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-jaxb:2.9.0")

exception stack:

Exception in thread "main" java.lang.IllegalArgumentException: Unable to create converter for class com.zeroarst.MyData
    for method MyDataService.getXml
    at retrofit2.Utils.methodError(Utils.java:54)
    at retrofit2.HttpServiceMethod.createResponseConverter(HttpServiceMethod.java:126)
    at retrofit2.HttpServiceMethod.parseAnnotations(HttpServiceMethod.java:85)
    at retrofit2.ServiceMethod.parseAnnotations(ServiceMethod.java:39)
    at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:202)
    at retrofit2.Retrofit$1.invoke(Retrofit.java:160)
    at com.sun.proxy.$Proxy0.getXml(Unknown Source)
    at com.zeroarst.GoogleRepository.getMasterIndex(GoogleRepository.kt:30)
    at com.zeroarst.NewVersionsChecker.checkNewVersions(NewVersionsChecker.kt:32)
    at com.zeroarst.TestKt$main$1$1.invokeSuspend(Test.kt:9)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
    at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
    at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
    at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
    at com.zeroarst.TestKt.main(Test.kt:7)
    at com.zeroarst.TestKt.main(Test.kt)
Caused by: java.lang.IllegalArgumentException: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
 - with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
    at retrofit2.converter.jaxb.JaxbConverterFactory.contextForType(JaxbConverterFactory.java:81)
    at retrofit2.converter.jaxb.JaxbConverterFactory.responseBodyConverter(JaxbConverterFactory.java:72)
    at retrofit2.Retrofit.nextResponseBodyConverter(Retrofit.java:362)
    at retrofit2.Retrofit.responseBodyConverter(Retrofit.java:345)
    at retrofit2.HttpServiceMethod.createResponseConverter(HttpServiceMethod.java:124)
    ... 18 more
Caused by: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
 - with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:278)
    at javax.xml.bind.ContextFinder.find(ContextFinder.java:421)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662)
    at retrofit2.converter.jaxb.JaxbConverterFactory.contextForType(JaxbConverterFactory.java:79)
    ... 22 more
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    at javax.xml.bind.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:122)
    at javax.xml.bind.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:155)
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:276)
    ... 26 more

I traced down to the cause. It seems that the exception is thrown from
jaxb-api-2.3.1 line 118:

static Class nullSafeLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException {
    if (classLoader == null) {
        return Class.forName(className);
    } else {
        return classLoader.loadClass(className); // here
    }
}

I googled and it seems that new versions of jaxb has removed whatever dependencies that contains com.sun.xml.internal.bind.v2.ContextFactory.

I don't really get that why would the library removed a dependency that is required and rely on all people to work out how to fix it?

How can I fix it?


问:
Is there anyway to set Content-Type and Content-Length for a CloudFront signed URL?
I have a mobile app that allows users to upload photos. Up to now, I've had both downloading and uploading go through my backend server.

Now I'm adding the ability for users to upload videos. Through some research, I've learned it's better to upload to S3 via signed URLs directly then confirm with the backend when the upload is finished to complete whatever business logic. I've always learned to take advantage of CloudFront to serve my content instead of through my backend... so now I'm switching to that.

Now my problem is with uploading via CloudFront signed URLs. With S3 pre-signed URLs, you can set the method (PUT), Content-Type, and Content-Length. With CloudFront URLs, you can't? I know I can limit CloudFront's permission with a bucket policy, but if I allow both GET and PUT with the policy, can a single signed URL be used for both GET and PUT? Can I not define what type of file I'm expecting, and what the size limit is? Looking at S3 Transfer Acceleration, it's suggested that files under 1GB (which is what I'm expecting) should be using CloudFront PUT instead.

I've seen suggestions to have one bucket for serving content, and one for uploading. Or using a Lambda function to verify the upload when a user uses a signed URL. But why should I have to maintain another lambda function and set up another bucket, then transfer content between the two?

I'm just going to go ahead with using CloudFront for serving and S3 for uploading, and hoping the upload speeds aren't terrible. But am I missing something here with CloudFront signed URLs?


问:
Browser crashes after loading 1-2k+ facebook comments
Comment loading slows down exponentially with the number of comments loaded in browser. The code below uses selenium to login and gets this post which has 10k+ comments. Then the view more comments button is continuously clicked to load more comments as shown below:

```<code>from datetime import timedelta
from time import perf_counter

from selenium.common.exceptions import (
    ElementClickInterceptedException,
    ElementNotInteractableException,
    StaleElementReferenceException,
)
from selenium.webdriver import Chrome, ChromeOptions
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait

def login(driver, email, password):
    driver.find_element(By.ID, 'email').send_keys(email)
    driver.find_element(By.ID, 'pass').send_keys(password)
    driver.find_element(By.XPATH, '//*[contains(@type, "submit")]').click()
    WebDriverWait(driver, 1000).until(
        expected_conditions.presence_of_element_located(
            (By.XPATH, '//*[contains(@action, "/logout")]')
        )
    )

if __name__ == '__main__':
    options = ChromeOptions()
    options.add_argument('disable-notifications')
    _driver = Chrome(options=options)
    _driver.get('https://facebook.com')
    login(_driver, 'email', 'password')  # replace with credentials
    _driver.get(
        'https://www.facebook.com/SarcasmSociety/photos/a.10150919189073866/10155498125313866'
    )
    reload_btn = WebDriverWait(_driver, 1000).until(
        expected_conditions.presence_of_element_located(
            (By.XPATH, '//*[contains(text(), "View more comments")]')
        )
    )
    prev_count = 0
    t = perf_counter()
    while True:
        _driver.execute_script('arguments[0].scrollIntoView();', reload_btn)
        try:
            reload_btn.click()
        except (
            ElementClickInterceptedException,
            StaleElementReferenceException,
            ElementNotInteractableException,
        ):
            pass
        total_loaded = (
            WebDriverWait(_driver, 1000)
            .until(
                expected_conditions.presence_of_element_located(
                    (By.XPATH, '//div[4]/div[2]/div[2]/span')
                )
            )
            .text.split('of')[0]
        )
        if prev_count != total_loaded:
            print(
                f'comments loaded: {total_loaded} load time {timedelta(seconds=perf_counter() - t)}'
            )
            prev_count = total_loaded
            t = perf_counter()
</code>```

As the number of comments loaded increases, the loading time keeps increasing and the browser eventually hangs and crashes. I tried with chrome, safari, firefox and I get the same result.

```<code>comments loaded: 6  load time 0:00:00.956970
comments loaded: 56  load time 0:00:05.018559
comments loaded: 106  load time 0:00:05.097524
comments loaded: 156  load time 0:00:12.881246
comments loaded: 206  load time 0:00:14.915316
comments loaded: 256  load time 0:00:07.909231
comments loaded: 306  load time 0:00:14.662676
comments loaded: 356  load time 0:00:17.050463
comments loaded: 406  load time 0:00:14.737875
comments loaded: 456  load time 0:00:10.441015
comments loaded: 506  load time 0:00:22.218294
comments loaded: 556  load time 0:00:20.039933
comments loaded: 606  load time 0:00:14.072164
comments loaded: 656  load time 0:00:33.570592
comments loaded: 706  load time 0:00:29.157080
comments loaded: 756  load time 0:00:27.104434
comments loaded: 806  load time 0:00:28.285868
comments loaded: 856  load time 0:00:29.938833
comments loaded: 906  load time 0:00:31.281724
comments loaded: 956  load time 0:00:36.025857
comments loaded: 1,006  load time 0:00:34.422590
comments loaded: 1,056  load time 0:00:32.973732
comments loaded: 1,156  load time 0:01:16.370328
comments loaded: 1,206  load time 0:00:44.005518
comments loaded: 1,256  load time 0:00:47.166408
comments loaded: 1,306  load time 0:00:44.392992
comments loaded: 1,356  load time 0:01:01.694369
comments loaded: 1,406  load time 0:00:28.100825
comments loaded: 1,456  load time 0:00:52.131026
comments loaded: 1,506  load time 0:00:57.448965
comments loaded: 1,556  load time 0:00:53.571871
comments loaded: 1,606  load time 0:00:57.142948
comments loaded: 1,656  load time 0:00:58.251598
comments loaded: 1,706  load time 0:01:33.050878
comments loaded: 1,756  load time 0:00:33.725328
comments loaded: 1,856  load time 0:02:20.364518
comments loaded: 1,906  load time 0:01:08.370199
comments loaded: 1,956  load time 0:01:22.470486
comments loaded: 2,006  load time 0:01:35.449901
comments loaded: 2,056  load time 0:02:20.828311
comments loaded: 2,106  load time 0:00:49.856041
comments loaded: 2,156  load time 0:01:38.646713
comments loaded: 2,206  load time 0:01:38.485394
comments loaded: 2,256  load time 0:01:46.626105
comments loaded: 2,306  load time 0:02:00.718524
Traceback (most recent call last):
  File "/Users/user/Library/Application Support/JetBrains/PyCharm2022.3/scratches/scratch_2.py", line 48, in <module>
    reload_btn.click()
  File "/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/webelement.py", line 93, in click
    self._execute(Command.CLICK_ELEMENT)
  File "/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/webelement.py", line 410, in _execute
    return self._parent.execute(command, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 444, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 249, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: session deleted because of page crash
from unknown error: cannot determine loading status
from tab crashed
  (Session info: chrome=108.0.5359.124)
Stacktrace:
0   chromedriver                        0x0000000100d16f38 chromedriver + 4910904
1   chromedriver                        0x0000000100c96a03 chromedriver + 4385283
2   chromedriver                        0x00000001008db5bd chromedriver + 472509
3   chromedriver                        0x00000001008c4064 chromedriver + 376932
4   chromedriver                        0x00000001008c27f2 chromedriver + 370674
5   chromedriver                        0x00000001008c2d18 chromedriver + 371992
6   chromedriver                        0x00000001008d144c chromedriver + 431180
7   chromedriver                        0x00000001008d2752 chromedriver + 436050
8   chromedriver                        0x00000001008e50ce chromedriver + 512206
9   chromedriver                        0x0000000100961425 chromedriver + 1020965
10  chromedriver                        0x0000000100945ee3 chromedriver + 909027
11  chromedriver                        0x000000010091030c chromedriver + 688908
12  chromedriver                        0x000000010091188e chromedriver + 694414
13  chromedriver                        0x0000000100ce41de chromedriver + 4702686
14  chromedriver                        0x0000000100ce8b19 chromedriver + 4721433
15  chromedriver                        0x0000000100cf028e chromedriver + 4752014
16  chromedriver                        0x0000000100ce991a chromedriver + 4725018
17  chromedriver                        0x0000000100cbdb02 chromedriver + 4545282
18  chromedriver                        0x0000000100d08888 chromedriver + 4851848
19  chromedriver                        0x0000000100d08a05 chromedriver + 4852229
20  chromedriver                        0x0000000100d1ee5f chromedriver + 4943455
21  libsystem_pthread.dylib             0x00007ff8163df259 _pthread_start + 125
22  libsystem_pthread.dylib             0x00007ff8163dac7b thread_start + 15
python-BaseException
</code>```

At first I thought the browser is being crowded by comments and that's why it's crashing and hence, deleting the loaded comments might fix the issue, so I tried:

```<code>for (let element of $x("//div[4]/ul/li")) {
    element.parentNode.removeChild(element)
}
</code>```

Nothing improves and the browser eventually crashes again. I thought perhaps the reload requests are being throttled by the server specially after getting the same exact response time multiple times. But if this is the case, the page won't freeze and stop responding, just the delay would be expected in this case without a browser crash. So, what's causing the crash? How to avoid this outcome and eventually load all comments in a reasonable time?

Body:
Comment loading slows down exponentially with the number of comments loaded in browser. The code below uses selenium to login and gets this post which has 10k+ comments. Then the view more comments button is continuously clicked to load more comments as shown below:

from datetime import timedelta
from time import perf_counter

from selenium.common.exceptions import (
    ElementClickInterceptedException,
    ElementNotInteractableException,
    StaleElementReferenceException,
)
from selenium.webdriver import Chrome, ChromeOptions
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait

def login(driver, email, password):
    driver.find_element(By.ID, 'email').send_keys(email)
    driver.find_element(By.ID, 'pass').send_keys(password)
    driver.find_element(By.XPATH, '//*[contains(@type, "submit")]').click()
    WebDriverWait(driver, 1000).until(
        expected_conditions.presence_of_element_located(
            (By.XPATH, '//*[contains(@action, "/logout")]')
        )
    )

if __name__ == '__main__':
    options = ChromeOptions()
    options.add_argument('disable-notifications')
    _driver = Chrome(options=options)
    _driver.get('https://facebook.com')
    login(_driver, 'email', 'password')  # replace with credentials
    _driver.get(
        'https://www.facebook.com/SarcasmSociety/photos/a.10150919189073866/10155498125313866'
    )
    reload_btn = WebDriverWait(_driver, 1000).until(
        expected_conditions.presence_of_element_located(
            (By.XPATH, '//*[contains(text(), "View more comments")]')
        )
    )
    prev_count = 0
    t = perf_counter()
    while True:
        _driver.execute_script('arguments[0].scrollIntoView();', reload_btn)
        try:
            reload_btn.click()
        except (
            ElementClickInterceptedException,
            StaleElementReferenceException,
            ElementNotInteractableException,
        ):
            pass
        total_loaded = (
            WebDriverWait(_driver, 1000)
            .until(
                expected_conditions.presence_of_element_located(
                    (By.XPATH, '//div[4]/div[2]/div[2]/span')
                )
            )
            .text.split('of')[0]
        )
        if prev_count != total_loaded:
            print(
                f'comments loaded: {total_loaded} load time {timedelta(seconds=perf_counter() - t)}'
            )
            prev_count = total_loaded
            t = perf_counter()

As the number of comments loaded increases, the loading time keeps increasing and the browser eventually hangs and crashes. I tried with chrome, safari, firefox and I get the same result.

comments loaded: 6  load time 0:00:00.956970
comments loaded: 56  load time 0:00:05.018559
comments loaded: 106  load time 0:00:05.097524
comments loaded: 156  load time 0:00:12.881246
comments loaded: 206  load time 0:00:14.915316
comments loaded: 256  load time 0:00:07.909231
comments loaded: 306  load time 0:00:14.662676
comments loaded: 356  load time 0:00:17.050463
comments loaded: 406  load time 0:00:14.737875
comments loaded: 456  load time 0:00:10.441015
comments loaded: 506  load time 0:00:22.218294
comments loaded: 556  load time 0:00:20.039933
comments loaded: 606  load time 0:00:14.072164
comments loaded: 656  load time 0:00:33.570592
comments loaded: 706  load time 0:00:29.157080
comments loaded: 756  load time 0:00:27.104434
comments loaded: 806  load time 0:00:28.285868
comments loaded: 856  load time 0:00:29.938833
comments loaded: 906  load time 0:00:31.281724
comments loaded: 956  load time 0:00:36.025857
comments loaded: 1,006  load time 0:00:34.422590
comments loaded: 1,056  load time 0:00:32.973732
comments loaded: 1,156  load time 0:01:16.370328
comments loaded: 1,206  load time 0:00:44.005518
comments loaded: 1,256  load time 0:00:47.166408
comments loaded: 1,306  load time 0:00:44.392992
comments loaded: 1,356  load time 0:01:01.694369
comments loaded: 1,406  load time 0:00:28.100825
comments loaded: 1,456  load time 0:00:52.131026
comments loaded: 1,506  load time 0:00:57.448965
comments loaded: 1,556  load time 0:00:53.571871
comments loaded: 1,606  load time 0:00:57.142948
comments loaded: 1,656  load time 0:00:58.251598
comments loaded: 1,706  load time 0:01:33.050878
comments loaded: 1,756  load time 0:00:33.725328
comments loaded: 1,856  load time 0:02:20.364518
comments loaded: 1,906  load time 0:01:08.370199
comments loaded: 1,956  load time 0:01:22.470486
comments loaded: 2,006  load time 0:01:35.449901
comments loaded: 2,056  load time 0:02:20.828311
comments loaded: 2,106  load time 0:00:49.856041
comments loaded: 2,156  load time 0:01:38.646713
comments loaded: 2,206  load time 0:01:38.485394
comments loaded: 2,256  load time 0:01:46.626105
comments loaded: 2,306  load time 0:02:00.718524
Traceback (most recent call last):
  File "/Users/user/Library/Application Support/JetBrains/PyCharm2022.3/scratches/scratch_2.py", line 48, in <module>
    reload_btn.click()
  File "/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/webelement.py", line 93, in click
    self._execute(Command.CLICK_ELEMENT)
  File "/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/webelement.py", line 410, in _execute
    return self._parent.execute(command, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 444, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 249, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: session deleted because of page crash
from unknown error: cannot determine loading status
from tab crashed
  (Session info: chrome=108.0.5359.124)
Stacktrace:
0   chromedriver                        0x0000000100d16f38 chromedriver + 4910904
1   chromedriver                        0x0000000100c96a03 chromedriver + 4385283
2   chromedriver                        0x00000001008db5bd chromedriver + 472509
3   chromedriver                        0x00000001008c4064 chromedriver + 376932
4   chromedriver                        0x00000001008c27f2 chromedriver + 370674
5   chromedriver                        0x00000001008c2d18 chromedriver + 371992
6   chromedriver                        0x00000001008d144c chromedriver + 431180
7   chromedriver                        0x00000001008d2752 chromedriver + 436050
8   chromedriver                        0x00000001008e50ce chromedriver + 512206
9   chromedriver                        0x0000000100961425 chromedriver + 1020965
10  chromedriver                        0x0000000100945ee3 chromedriver + 909027
11  chromedriver                        0x000000010091030c chromedriver + 688908
12  chromedriver                        0x000000010091188e chromedriver + 694414
13  chromedriver                        0x0000000100ce41de chromedriver + 4702686
14  chromedriver                        0x0000000100ce8b19 chromedriver + 4721433
15  chromedriver                        0x0000000100cf028e chromedriver + 4752014
16  chromedriver                        0x0000000100ce991a chromedriver + 4725018
17  chromedriver                        0x0000000100cbdb02 chromedriver + 4545282
18  chromedriver                        0x0000000100d08888 chromedriver + 4851848
19  chromedriver                        0x0000000100d08a05 chromedriver + 4852229
20  chromedriver                        0x0000000100d1ee5f chromedriver + 4943455
21  libsystem_pthread.dylib             0x00007ff8163df259 _pthread_start + 125
22  libsystem_pthread.dylib             0x00007ff8163dac7b thread_start + 15
python-BaseException

At first I thought the browser is being crowded by comments and that's why it's crashing and hence, deleting the loaded comments might fix the issue, so I tried:

for (let element of $x("//div[4]/ul/li")) {
    element.parentNode.removeChild(element)
}

Nothing improves and the browser eventually crashes again. I thought perhaps the reload requests are being throttled by the server specially after getting the same exact response time multiple times. But if this is the case, the page won't freeze and stop responding, just the delay would be expected in this case without a browser crash. So, what's causing the crash? How to avoid this outcome and eventually load all comments in a reasonable time?


问:
Why am I getting the error react-resizable module not found?
Hi I have this resizable box component using the react-resizable library. I have downloaded the library and also the type declarations. But for some reason I am getting this error

Module not found: Can't resolve 'react-resizable' in '/Users/ChristopherDobbs/public-ui/src/user/pages/Payments/PaymentHeaders/PaymentsCharts/PaymentsChartComponents'

My code is as follows

```<code>import React, {ReactNode} from 'react';
import {ResizableBox as ReactResizableBox} from 'react-resizable';

import 'react-resizable/css/styles.css';

interface IResizableBoxProps {
    children?: React.ReactNode;
    width: number;
    height: number;
    resizable: boolean;
    style: {};
    className?: string;
}

export default function ResizableBox({
    children,
    width = 600,
    height = 300,
    resizable = true,
    style = {},
    className = '',
}: IResizableBoxProps): JSX.Element {
    return (
        <div style={{marginLeft: 20}}>
            <div
                style={{
                    display: 'inline-block',
                    width: 'auto',
                    background: 'white',
                    padding: '.5rem',
                    borderRadius: '0.5rem',
                    boxShadow: '0 30px 40px rgba(0,0,0,.1)',
                    ...style,
                }}
            >
                {resizable ? (
                    <ReactResizableBox width={width} height={height}>
                        <div
                            style={{
                                width: '100%',
                                height: '100%',
                            }}
                            className={className}
                        >
                            {children}
                        </div>
                    </ReactResizableBox>
                ) : (
                    <div
                        style={{
                            width: `${width}px`,
                            height: `${height}px`,
                        }}
                        className={className}
                    >
                        {children}
                    </div>
                )}
            </div>
        </div>
    );
}
</code>```

I tried messing around with the imports but it doesn't seem to have fixed the issue.

Body:
Hi I have this resizable box component using the react-resizable library. I have downloaded the library and also the type declarations. But for some reason I am getting this error

Module not found: Can't resolve 'react-resizable' in '/Users/ChristopherDobbs/public-ui/src/user/pages/Payments/PaymentHeaders/PaymentsCharts/PaymentsChartComponents'

My code is as follows

import React, {ReactNode} from 'react';
import {ResizableBox as ReactResizableBox} from 'react-resizable';

import 'react-resizable/css/styles.css';

interface IResizableBoxProps {
    children?: React.ReactNode;
    width: number;
    height: number;
    resizable: boolean;
    style: {};
    className?: string;
}

export default function ResizableBox({
    children,
    width = 600,
    height = 300,
    resizable = true,
    style = {},
    className = '',
}: IResizableBoxProps): JSX.Element {
    return (

                {resizable ? (
                    <ReactResizableBox width={width} height={height}>

                            {children}

                    </ReactResizableBox>
                ) : (
                    <div
                        style={{
                            width: `${width}px`,
                            height: `${height}px`,
                        }}
                        className={className}
                    >
                        {children}

                )}

    );
}

I tried messing around with the imports but it doesn't seem to have fixed the issue.


问:
VS Code python funtion tip not working while add a decorator?
I found the when I add a decorator to foo function,VS Code tooltip will not show function signature.When remove the decorator, the tooltip will work correct.Someone know how to avoid this problem?

 I use pylance as python language server

code sample

import os
import enum
import math
import types

from functools import wraps

class Decorator:

    def __init__(self, func):
        wraps(func)(self)

    def __call__(self, *args, **kwargs):

        ret = self.__wrapped__(*args, **kwargs)
        return None

    def __get__(self, instance, cls):
        if instance is None:
            return self
        else:
            return types.MethodType(self, instance)

class A:

    @Decorator
    def foo(self, a: int, b: str) -> bool:
        """_summary_

        :param int a: _description_
        :param str b: _description_
        :return bool: _description_
        """
        return "Test"

objA = A()

objA.foo()
```


问:
Can't program ESP32-MINI-1 over serial despite "Waiting for Download"
While I've been able to program both the ESP32-WROOM-32D (mounted on a custom PCB) as well as the ESP32-DevKitV1 using the Espressif idf and a TTL-234X-3V3-WE FTDI cable through the RXD/TXD lines, I am not able to connect to the ESP32-DevKitM-1 in the same way.
I can't find very much information online specifically about the esp32-mini-1, so I've been working off the assumption that it functions and can be programmed identically to the esp32-wroom-32d I'm more familiar with.

I can see the "waiting for download" message when starting the ESP32-DevKitM-1 with the boot button held down, so the TXD line is clearly working, however I just receive a "Failed to connect to ESP32" error when attempting to flash code. At this point I have tried with two separate ESP32-DevKitM-1's to check that the issue wasn't caused by a faulty chip, and retested flashing a program onto an ESP32-DevKitV1 to check that the FTDI cable was working correctly.
Since there is no connection established at all, I assume the issue is not related to the code itself, but either with the hardware, or my environment - which is set up by following the espressif idf guide for linux. (I'm using Windows 11, but performing the flashing and what not using the Ubuntu WSL shell)

My connection to the ESP32-DevKitM-1 from the FTDI cable is cable TXD to devkit RXD, and cable RXD to devkit TXD. The power and ground are also supplied to the devkit over the FTDI cable (into the devkit's 5V pin) and the 3V3 pin is showing 3.293V. I have also tested powering the devkit's 3V3 pin directly from a benchtop power supply (with the FTDI's 5V line disconnected, but both FTDI and power supply grounds connected) to ensure the issue isn't caused by a power issue.

In all cases I have been able to program the ESP32 devkit with no issues, and see a 'waiting for download' response from the ESP32-mini devkit, but fail to connect to the ESP32-mini devkit when flashing code or attempting to erase flash. Are there any secrets to programming the ESP32-MINI-1 which don't apply to the ESP32-WROOM-32D?


问:
Implementation Error: Could not find com.borjabravo:readmoretextview:2.1.0
I tried to build my project on Android Studio, but my Log show this error:

```<code>Could not find com.borjabravo:readmoretextview:2.1.0.
Required by:
    project :app
</code>```

I had implement that dependency, but it doesn't work on my module. And I want to fix it.

My build.gradle (:app) is below:

```<code>plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-kapt'
    id 'androidx.navigation.safeargs.kotlin'
    id 'kotlin-parcelize'
}

android {
    compileSdkVersion rootProject.compileSdkVersion

    defaultConfig {
        applicationId "com.clcmo.marvelchallenge"
        minSdkVersion rootProject.minSdkVersion
        targetSdkVersion rootProject.targetSdkVersion

        versionCode 1
        versionName "1.0.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    }
    buildFeatures {
        dataBinding true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8.toString()
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

//... other dependencies

    implementation uiDependencies.readMoreTextView

}
</code>```

Body:
I tried to build my project on Android Studio, but my Log show this error:

Could not find com.borjabravo:readmoretextview:2.1.0.
Required by:
    project :app

I had implement that dependency, but it doesn't work on my module. And I want to fix it.

My build.gradle (:app) is below:

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-kapt'
    id 'androidx.navigation.safeargs.kotlin'
    id 'kotlin-parcelize'
}

android {
    compileSdkVersion rootProject.compileSdkVersion

    defaultConfig {
        applicationId "com.clcmo.marvelchallenge"
        minSdkVersion rootProject.minSdkVersion
        targetSdkVersion rootProject.targetSdkVersion

        versionCode 1
        versionName "1.0.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    }
    buildFeatures {
        dataBinding true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8.toString()
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

//... other dependencies

    implementation uiDependencies.readMoreTextView

}


问:
How to remove dart on linux mint
I have tried to google how to remove darts but found no solution

Does anyone here know how to permanently remove darts?

Title: How to remove dart on linux mint


问:
How to move data between x87 registers and SSE registers?
I'm not sure if this is possible, but I'd like to find a way to move a value between the x87 FPU registers, e.g., st(0) and the SSE registers, e.g., xmm1. The context is I'm computing the sine of some floating-point value stored in memory. My current solution loads this value into the st(0) register, invokes fsin, stores the result out to a temporary global variable, and then moves it into xmm1. Is there a way to go directly to the xmm1 register without involving this load to and from memory?

I understand that this isn't the most elegant x64 assembly, but the broader context is that it applies to a compiler that I'm writing (which largely uses SSE instructions and registers, but I see that I need to dip into x87 for trigonometry instructions).

```<code>.section .data
    outfloatfmt: .asciz "%lf\n"
    val: .double 90
    tmp: .double 0
    sinres: .double 0
.section .text
    .extern printf
    .global main
main:
    pushq %rbp
    movq %rsp, %rbp
    fld val(%rip)               # Load value into st(0)
    fsin                        # For some reason, this computes the sine of zero...
    fst tmp(%rip)               # Store sine in temp val.
    movsd tmp(%rip), %xmm1      # Load tmp sine into xmm1.
    movsd %xmm1, sinres(%rip)   # THIS is where I want to store the res.
    movsd sinres(%rip), %xmm0
    leaq outfloatfmt(%rip), %rdi
    movq $1, %rax
    callq printf
    movq %rbp, %rsp
    popq %rbp
    ret
</code>```

Another problem is that I don't think st(0) is getting loaded with the correct value from memory. After fld is invoked, I check the register via GDB, but it always reads 0. For an input of 90, it should return 1.

Body:
I'm not sure if this is possible, but I'd like to find a way to move a value between the x87 FPU registers, e.g., st(0) and the SSE registers, e.g., xmm1. The context is I'm computing the sine of some floating-point value stored in memory. My current solution loads this value into the st(0) register, invokes fsin, stores the result out to a temporary global variable, and then moves it into xmm1. Is there a way to go directly to the xmm1 register without involving this load to and from memory?

I understand that this isn't the most elegant x64 assembly, but the broader context is that it applies to a compiler that I'm writing (which largely uses SSE instructions and registers, but I see that I need to dip into x87 for trigonometry instructions).

.section .data
    outfloatfmt: .asciz "%lf\n"
    val: .double 90
    tmp: .double 0
    sinres: .double 0
.section .text
    .extern printf
    .global main
main:
    pushq %rbp
    movq %rsp, %rbp
    fld val(%rip)               # Load value into st(0)
    fsin                        # For some reason, this computes the sine of zero...
    fst tmp(%rip)               # Store sine in temp val.
    movsd tmp(%rip), %xmm1      # Load tmp sine into xmm1.
    movsd %xmm1, sinres(%rip)   # THIS is where I want to store the res.
    movsd sinres(%rip), %xmm0
    leaq outfloatfmt(%rip), %rdi
    movq $1, %rax
    callq printf
    movq %rbp, %rsp
    popq %rbp
    ret

Another problem is that I don't think st(0) is getting loaded with the correct value from memory. After fld is invoked, I check the register via GDB, but it always reads 0. For an input of 90, it should return 1.


问:
How can I change a dropdown selected option on page load?
I would like to change the selected option on page load using the class name.
Change selected option "-- Select Option --" to "Curitiba".</p>
```<code>
<select class="divi-acf et_pb_contact_select">
<option value="" selected="">-- Select Option --</option>
<option value="Almirante Tamandaré">Almirante Tamandaré</option>
<option value="Caiobá">Caiobá</option>
<option value="Campo Largo">Campo Largo</option>
<option value="Campo Magro">Campo Magro</option>
<option value="Curitiba">Curitiba</option>
<option value="Guaratuba">Guaratuba</option>
<option value="Piraquara">Piraquara</option>
<option value="Pontal do Sul">Pontal do Sul</option>
<option value="Quatro Barras">Quatro Barras</option>
</select>

</code>```

Body:
I would like to change the selected option on page load using the class name.
Change selected option "-- Select Option --" to "Curitiba".

<select class="divi-acf et_pb_contact_select">
<option value="" selected="">-- Select Option --</option>
<option value="Almirante Tamandaré">Almirante Tamandaré</option>
<option value="Caiobá">Caiobá</option>
<option value="Campo Largo">Campo Largo</option>
<option value="Campo Magro">Campo Magro</option>
<option value="Curitiba">Curitiba</option>
<option value="Guaratuba">Guaratuba</option>
<option value="Piraquara">Piraquara</option>
<option value="Pontal do Sul">Pontal do Sul</option>
<option value="Quatro Barras">Quatro Barras</option>
</select>


问:
Do Lambda functions qualify for the SES free tier?
I am currently unsure whether I can send outbound emails for my lambda functions through SES for free up to 62k messages. Documentation says that Ec2 and Beanstalk instances qualify but I read an old reddit thread from a few years ago saying that Lambdas execute on an EC2 instance and therefore do quality. What's the truth?

Official Documentation:

As part of AWS Free Tier, AWS SES offers 62,000 Outbound Messages per month to any recipient when you call Amazon SES from an Amazon EC2 instance directly or through AWS Elastic Beanstalk, and 1,000 Inbound Messages per month.

Reddit Post:

How AWS runs it is an implementation detail and is unrelated to billing. Most services in AWS run on EC2 internally.

The billing details is a but unclear on what it means for EC2, but it means any application running inside AWS. For example: EC2 native, ECS, EKS, or as you're asking lambda. Basically it costs more if your application is not running in AWS.

Can anyone confirm if this is true? I cannot find any sources to totally confirm or deny.

I browsed through the official documentation here and found their explanation to be somewhat unclear, primarily due to what is stated here in the first comment.


问:
AWS Amplify Auth.verifyCurrentUserAttributeSubmit returns InternalErrorException
We have a Cognito user pool that supports login with email and phone number. Using Auth.verifyCurrentUserAttributeSubmit we are able to successfully verify code received on email for email change of logged in user.  However the same verifyCurrentUserAttributeSubmit method returns InternalErrorException from Cognito when verifying phone_number attribute using the code received on sms. Wondering how to verify the phone_number change using Amplify?

Based on HTTP response from Cognito, something internally failed and seems to be a bug in Cognito but not sure if there is a work around. Interesting, it's able to verify email attribute.

From browser console, here is the curl equivalent snippet for the call made from Amplify in ReactJS app. The same API works fine if AttributeName being verified is email.

```<code>curl 'https://cognito-idp.ap-southeast-1.amazonaws.com/' \
  -H 'authority: cognito-idp.ap-southeast-1.amazonaws.com' \
  -H 'cache-control: max-age=0' \
  -H 'content-type: application/x-amz-json-1.1' \
  -H 'x-amz-target: AWSCognitoIdentityProviderService.VerifyUserAttribute' \
  -H 'x-amz-user-agent: aws-amplify/5.0.4 js' \
  --data-raw '{"AttributeName":"phone_number","Code":"713032","AccessToken":"xxxtokenxxxx"}' \
  --compressed

  Response:
  {"__type":"InternalErrorException","message":"Internal server error."}
</code>```

Body:
We have a Cognito user pool that supports login with email and phone number. Using Auth.verifyCurrentUserAttributeSubmit we are able to successfully verify code received on email for email change of logged in user.  However the same verifyCurrentUserAttributeSubmit method returns InternalErrorException from Cognito when verifying phone_number attribute using the code received on sms. Wondering how to verify the phone_number change using Amplify?

Based on HTTP response from Cognito, something internally failed and seems to be a bug in Cognito but not sure if there is a work around. Interesting, it's able to verify email attribute.

From browser console, here is the curl equivalent snippet for the call made from Amplify in ReactJS app. The same API works fine if AttributeName being verified is email.

curl 'https://cognito-idp.ap-southeast-1.amazonaws.com/' \
  -H 'authority: cognito-idp.ap-southeast-1.amazonaws.com' \
  -H 'cache-control: max-age=0' \
  -H 'content-type: application/x-amz-json-1.1' \
  -H 'x-amz-target: AWSCognitoIdentityProviderService.VerifyUserAttribute' \
  -H 'x-amz-user-agent: aws-amplify/5.0.4 js' \
  --data-raw '{"AttributeName":"phone_number","Code":"713032","AccessToken":"xxxtokenxxxx"}' \
  --compressed

  Response:
  {"__type":"InternalErrorException","message":"Internal server error."}


问:
Run emulator on jenkins
i am trying to run emulator on jenkins but whenever i run following command

```<code>  emulator/emulator -skin 1080x1920 -ports 5784,5785 -report-console tcp:5868,max=60 -prop persist.sys.language=en -prop persist.sys.country=US -avd emulatorname -wipe-data -no-window
</code>```

i am getting following error

ERROR   | could not connect to server on TCP:5868: Operation timed out
saving arm snapshot.... !!!

```<code>INFO    | Wait for emulator (pid 99639) 20 seconds to shutdown gracefully before kill;you can set environment variable ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL(in seconds) to change the default value (20 seconds)
</code>```

Can  someone help with script which will open the emulator and wait till its finish boot

Title: Run emulator on jenkins

Body:
i am trying to run emulator on jenkins but whenever i run following command

  emulator/emulator -skin 1080x1920 -ports 5784,5785 -report-console tcp:5868,max=60 -prop persist.sys.language=en -prop persist.sys.country=US -avd emulatorname -wipe-data -no-window

i am getting following error

ERROR   | could not connect to server on TCP:5868: Operation timed out
saving arm snapshot.... !!!

INFO    | Wait for emulator (pid 99639) 20 seconds to shutdown gracefully before kill;you can set environment variable ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL(in seconds) to change the default value (20 seconds)

Can  someone help with script which will open the emulator and wait till its finish boot


问:
I get an error when trying to deploy my app to Vercel. What does it mean by "Invalid/Missing environment variable: "MONGODB_URI""?
Whenever I try to deploy my app to Vercel it fails with an error
`

```<code>Error: Invalid/Missing environment variable: "MONGODB_URI"
    at 7000 (/vercel/path0/.next/server/chunks/748.js:136:11)
    at __webpack_require__ (/vercel/path0/.next/server/webpack-runtime.js:25:42)
    at 4186 (/vercel/path0/.next/server/pages/index.js:20:70)
    at __webpack_require__ (/vercel/path0/.next/server/webpack-runtime.js:25:42)
    at __webpack_exec__ (/vercel/path0/.next/server/pages/index.js:470:39)
    at /vercel/path0/.next/server/pages/index.js:471:77
    at __webpack_require__.X (/vercel/path0/.next/server/webpack-runtime.js:108:21)
    at /vercel/path0/.next/server/pages/index.js:471:47
    at Object.<anonymous> (/vercel/path0/.next/server/pages/index.js:474:3)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
</code>```

and

```<code>> Build error occurred
Error: Failed to collect page data for /
    at /vercel/path0/node_modules/next/dist/build/utils.js:959:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  type: 'Error'
}
</code>```

I am new at using MongoDB with Next.js and don't understand what I am missing. Here's my env.local minus my username and password

```<code>MONGODB_URI=mongodb+srv://<username>:<password>@cluster0.z74c5nt.mongodb.net/?retryWrites=true&w=majority
</code>```

`

I have tried changing the MONGODB_URI but I nothing else works. I've googled and looked for an answer and can't find anything else related to the same issue.

Body:
Whenever I try to deploy my app to Vercel it fails with an error
`

Error: Invalid/Missing environment variable: "MONGODB_URI"
    at 7000 (/vercel/path0/.next/server/chunks/748.js:136:11)
    at __webpack_require__ (/vercel/path0/.next/server/webpack-runtime.js:25:42)
    at 4186 (/vercel/path0/.next/server/pages/index.js:20:70)
    at __webpack_require__ (/vercel/path0/.next/server/webpack-runtime.js:25:42)
    at __webpack_exec__ (/vercel/path0/.next/server/pages/index.js:470:39)
    at /vercel/path0/.next/server/pages/index.js:471:77
    at __webpack_require__.X (/vercel/path0/.next/server/webpack-runtime.js:108:21)
    at /vercel/path0/.next/server/pages/index.js:471:47
    at Object.<anonymous> (/vercel/path0/.next/server/pages/index.js:474:3)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)

and

> Build error occurred
Error: Failed to collect page data for /
    at /vercel/path0/node_modules/next/dist/build/utils.js:959:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  type: 'Error'
}

I am new at using MongoDB with Next.js and don't understand what I am missing. Here's my env.local minus my username and password

MONGODB_URI=mongodb+srv://<username>:<password>@cluster0.z74c5nt.mongodb.net/?retryWrites=true&w=majority

`

I have tried changing the MONGODB_URI but I nothing else works. I've googled and looked for an answer and can't find anything else related to the same issue.