问:
Cannot deploy React app to Firebase hosting properly from github Action
I can deploy React app to Firebase properly but If I try to deploy from Github Actions, It can't be deployed(404 error).

The directory structure is like this:

```<code>- github
  - workflow
    - action.yaml
- public
  - sub-dir(React App)
    - build
</code>```

When I deploy a project with this command,
firebase deploy --only hosting

It will run correctly.
(The URL is [my-domain]/sub-dir/build)

but when it is deployed from github actions, getting 404 error page even though accessing the same URL.

this is the statement of action.yaml

```<code>name: Continuous Deployment

on:
  push:
    ### Triggers a push to the main branch and executes the process
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-20.04
    steps:
      - name: checkout branch
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: configure git info
        run: |
          git remote set-url origin https://github-actions:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
          git config --global user.name "${GITHUB_ACTOR}"
          git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"

      - name: check git status and branch
        run: |
          git status
          git branch

      ### sub-dir build
      - name: sub-dir build
        run: |
          cd public/sub-dir
          yarn install
          yarn build

      - name: push the built project
        run: |
          git add .
          git commit -m "Push different part from GitHub Actions"
          git push origin HEAD:${GITHUB_REF}

      ### Firebase deploy
      - uses: actions/setup-node@v3
        with:
          node-version: "14.18.3"
          cache: npm
      - name: Checkout Repo
        uses: actions/checkout@master
      - name: Install Dependencies
        run: npm install
      - name: Install Functions Dependencies
        run: |
          node -v
          cd functions && npm install
          npm i -g firebase-tools
          firebase --version
          git pull origin HEAD:${GITHUB_REF}
      - name: Deploy to Firebase
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only hosting
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

</code>```

package.json

```<code>{
  "name": "xxx",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "@types/jest": "^27.5.2",
    "@types/node": "^16.18.11",
    "@types/react": "^18.0.26",
    "@types/react-dom": "^18.0.10",
    "firebase": "^9.15.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-redux": "^8.0.5",
    "react-scripts": "5.0.1",
    "redux": "^4.2.0",
    "typescript": "^4.9.4",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@types/react-redux": "^7.1.25"
  },
  "homepage": "./"
}
</code>```

I have no idea about the reason. I would be happy to get the answer to this.

Thank you in advance.

Body:
I can deploy React app to Firebase properly but If I try to deploy from Github Actions, It can't be deployed(404 error).

The directory structure is like this:

- github
  - workflow
    - action.yaml
- public
  - sub-dir(React App)
    - build

When I deploy a project with this command,
firebase deploy --only hosting

It will run correctly.
(The URL is [my-domain]/sub-dir/build)

but when it is deployed from github actions, getting 404 error page even though accessing the same URL.

this is the statement of action.yaml

name: Continuous Deployment

on:
  push:
    ### Triggers a push to the main branch and executes the process
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-20.04
    steps:
      - name: checkout branch
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: configure git info
        run: |
          git remote set-url origin https://github-actions:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
          git config --global user.name "${GITHUB_ACTOR}"
          git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"

      - name: check git status and branch
        run: |
          git status
          git branch

      ### sub-dir build
      - name: sub-dir build
        run: |
          cd public/sub-dir
          yarn install
          yarn build

      - name: push the built project
        run: |
          git add .
          git commit -m "Push different part from GitHub Actions"
          git push origin HEAD:${GITHUB_REF}

      ### Firebase deploy
      - uses: actions/setup-node@v3
        with:
          node-version: "14.18.3"
          cache: npm
      - name: Checkout Repo
        uses: actions/checkout@master
      - name: Install Dependencies
        run: npm install
      - name: Install Functions Dependencies
        run: |
          node -v
          cd functions && npm install
          npm i -g firebase-tools
          firebase --version
          git pull origin HEAD:${GITHUB_REF}
      - name: Deploy to Firebase
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only hosting
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

package.json

{
  "name": "xxx",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "@types/jest": "^27.5.2",
    "@types/node": "^16.18.11",
    "@types/react": "^18.0.26",
    "@types/react-dom": "^18.0.10",
    "firebase": "^9.15.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-redux": "^8.0.5",
    "react-scripts": "5.0.1",
    "redux": "^4.2.0",
    "typescript": "^4.9.4",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@types/react-redux": "^7.1.25"
  },
  "homepage": "./"
}

I have no idea about the reason. I would be happy to get the answer to this.

Thank you in advance.


来源: stackexchange

问:
How to send message content when a router got hit it will send the first content then the second
Actually I want to send message when A page is hit. Like I have a page called numbers.blade.php. Here is the route

```<code>Route::get("/numbers", [\App\Http\Controllers\NumberController::class, 'get_numbers_from_ringba'])->name("numbers");
</code>```

When I will get to this route a message will be sent.
Here is the code:

```<code> public function get_numbers_from_ringba()
    {
        $numbers = Number::all();
        $contents = array(
            "We apologize that your call was dropped. We have qualified you for a simple, low-cost health insurance plan. Contact us at +18883470772 again within 1 minute to find out more about your free, no-risk health insurance plan!",
            "Hi, Congratulations! As an apology for the dropped call, We are currently offering you a limited time 20% discount on the ACA Insurance Plan, just for you! Please reach us again at +18883470772. Grab the Lifetime HealthCare Opportunity within a Minute!",
            "Still not Happy with our 20% discount? We have reserved a special enrollment opportunity just for you and your family (all-inclusive medical protection & 25% Discount)! Reduce your chances of becoming ill or injured with ACA, as 14.5 million US citizens have done. Call Now: +18883470772 before the offer expires Today!",
            "We do not want to bother you, just following up about our ACA plan. We can help get your ACA health insurance fixed so your life is more manageable. If you apply today, you might be able to get free health insurance through the Marketplace. Call us +18883470772",
            "Hey there! It’s our final follow-up from our end. Do you still wish to proceed? We are always here to assist you. Call us +18883470772 without any hesitation."
        );
        $twilio_sid = getenv("TWILIO_SID");
        $twilio_token = getenv("TWILIO_TOKEN");
        $client = new Client($twilio_sid, $twilio_token);
        foreach ($numbers as $number) {
            $client->messages->create(
                $number->callerId,
                //"+14356277657",
                [
                    "from" => "+18882998227",
                    "body" => $contents[1]
                ]
            );
        }

        return view("Dashboard.Numbers.numbers", [
            "numbers" => $numbers
        ]);
    }
</code>```

So, here you can see $contents variable. There are some contents inside of an array. When Someone get the route first item of the array will work as "body" of the sms content. When someone go to the route again, 2nd item of the array will be worked as "body". Just like this the process will continue until it reaches to the last item of the array.

Is there any easy solution for me

ContentLicense: CC BY-SA 4.0

Body:
Actually I want to send message when A page is hit. Like I have a page called numbers.blade.php. Here is the route

Route::get("/numbers", [\App\Http\Controllers\NumberController::class, 'get_numbers_from_ringba'])->name("numbers");

When I will get to this route a message will be sent.
Here is the code:

 public function get_numbers_from_ringba()
    {
        $numbers = Number::all();
        $contents = array(
            "We apologize that your call was dropped. We have qualified you for a simple, low-cost health insurance plan. Contact us at +18883470772 again within 1 minute to find out more about your free, no-risk health insurance plan!",
            "Hi, Congratulations! As an apology for the dropped call, We are currently offering you a limited time 20% discount on the ACA Insurance Plan, just for you! Please reach us again at +18883470772. Grab the Lifetime HealthCare Opportunity within a Minute!",
            "Still not Happy with our 20% discount? We have reserved a special enrollment opportunity just for you and your family (all-inclusive medical protection & 25% Discount)! Reduce your chances of becoming ill or injured with ACA, as 14.5 million US citizens have done. Call Now: +18883470772 before the offer expires Today!",
            "We do not want to bother you, just following up about our ACA plan. We can help get your ACA health insurance fixed so your life is more manageable. If you apply today, you might be able to get free health insurance through the Marketplace. Call us +18883470772",
            "Hey there! It’s our final follow-up from our end. Do you still wish to proceed? We are always here to assist you. Call us +18883470772 without any hesitation."
        );
        $twilio_sid = getenv("TWILIO_SID");
        $twilio_token = getenv("TWILIO_TOKEN");
        $client = new Client($twilio_sid, $twilio_token);
        foreach ($numbers as $number) {
            $client->messages->create(
                $number->callerId,
                //"+14356277657",
                [
                    "from" => "+18882998227",
                    "body" => $contents[1]
                ]
            );
        }

        return view("Dashboard.Numbers.numbers", [
            "numbers" => $numbers
        ]);
    }

So, here you can see $contents variable. There are some contents inside of an array. When Someone get the route first item of the array will work as "body" of the sms content. When someone go to the route again, 2nd item of the array will be worked as "body". Just like this the process will continue until it reaches to the last item of the array.

Is there any easy solution for me


问:
openai gpt-3 is asking random question in return of user query when using apis
I am using Open AI api with these parameters

```<code>resp = OpenAIBot.__openai_instance__.Completion.create(model="text-davinci-003",
                        prompt=prompt,
                        temperature=0.9,
                        max_tokens=250,
                        top_p=1,
                        frequency_penalty=0,
                        presence_penalty=0.6,
                        user=botRequest.senderId,
                        stop=[" Human:", " AI:"]
                    )
</code>```

this is first prompt that I am sending

```<code>"The following is a conversation with an AI assistant. The assistant is helpful, creative, clever, and very friendly.\n\nHuman: Hello, who are you?\nAI: I am an AI created by OpenAI. How are you feeling today?"
</code>```

to which user answers with good

to which bot replies like this

```<code>The following is a conversation with an AI assistant. The assistant is helpful,
 creative, clever, and very friendly.\n\n
Human: Hello, who are you?\n
AI: I am an AI created by OpenAI. How are you feeling today?\n
Human: good\n
AI: , thanks for asking. What do you do?\n
AI: I specialize in providing helpful, creative, and intelligent
assistance for people who need it. From searching the web for information to
helping you stay organized and productive, I'm here to make your life easier.
</code>```

it automatically appends the questions like thanks for asking. What do you do which are not relative.

If i chat on open ai playground with same parameters that I am using, it behaves properly and maintains the context.

Same query context that open ai playground uses I am sending to open ai api. What can be the issue how can I fix this?

Body:
I am using Open AI api with these parameters

resp = OpenAIBot.__openai_instance__.Completion.create(model="text-davinci-003",
                        prompt=prompt,
                        temperature=0.9,
                        max_tokens=250,
                        top_p=1,
                        frequency_penalty=0,
                        presence_penalty=0.6,
                        user=botRequest.senderId,
                        stop=[" Human:", " AI:"]
                    )

this is first prompt that I am sending

"The following is a conversation with an AI assistant. The assistant is helpful, creative, clever, and very friendly.\n\nHuman: Hello, who are you?\nAI: I am an AI created by OpenAI. How are you feeling today?"

to which user answers with good

to which bot replies like this

The following is a conversation with an AI assistant. The assistant is helpful,
 creative, clever, and very friendly.\n\n
Human: Hello, who are you?\n
AI: I am an AI created by OpenAI. How are you feeling today?\n
Human: good\n
AI: , thanks for asking. What do you do?\n
AI: I specialize in providing helpful, creative, and intelligent
assistance for people who need it. From searching the web for information to
helping you stay organized and productive, I'm here to make your life easier.

it automatically appends the questions like thanks for asking. What do you do which are not relative.

If i chat on open ai playground with same parameters that I am using, it behaves properly and maintains the context.

Same query context that open ai playground uses I am sending to open ai api. What can be the issue how can I fix this?


问:
Spring mongodb criteria regex number
Is there way to do regex search with spring mongodb on int field?

```<code>Criteria.where("carId").regex(searchQuery)
</code>```

so when searchquery === 128 , it will query all documents that have car id starting with 128... 1283, 128888, 12823434 etc..

Title: Spring mongodb criteria regex number

Body:
Is there way to do regex search with spring mongodb on int field?

Criteria.where("carId").regex(searchQuery)

so when searchquery === 128 , it will query all documents that have car id starting with 128... 1283, 128888, 12823434 etc..


问:
Applying a non linear ARX model in matlab
I estimated parameters of a non- linear arx model with the system identification toolbox in matlab. I was wondering how I can use these results as a function or maybe directly on other inputs. So basically I want to call my arx model function and get the desired output to the given input.

This is the OutputFcn of my estimated model

How would a function of that model look like.

Thank you for your help and pleas keep in mind that I am new to matlab and coding.

Of course I can compare or simulate the model with an iddata object. But thats not useful for my desired application to use the models function with other inputs or to find the deviations to the measured output in dependence to the input.

Best regards


问:
How to check the compatibility of transitive dependency with its direct dependency Spring Boot Maven Project
So in my organization we started to scan all our application for vurnerabilities and the scanner show up with lots of findings.

Some CVE are easy to be fix, but some require extra steps, and I wonder how to properly fix CVE in transitive dependency, expecially Spring Boot transitive dependency, since many in my application we use the spring boot starter dependency to pull all other spring framework related dependency.

For example one of my application still use Spring Boot version 2.6.2 and some of the CVE foundings include CVE-2022-22978 where I need to upgrade the spring-security-core dependency to a minimum version 5.6.9, it is better to upgrade the spring boot version to the latest 2.6.14 or just upgrade the spring-security-core dependency ? My concern on upgrading the spring boot version to the latest will somehow break my application and will cause a major change to the application.

How do we properly fix CVE issue on the transitive dependency while the direct dependency has not release their fix yet?

Is it safe just to upgrade specific transitive dependency? How do we know if the upgraded transitive dependency compatible with its direct dependency?


问:
Facing error while trying to deploy a Lightning Message Channel(LMC) from VSCode for LWC superbadge
duplicate value found:  duplicates value on record with id:

```<code>**XML File:**
-------------
<?xml version="1.0" encoding="UTF-8"?>
<LightningMessageChannel xmlns="http://soap.sforce.com/2006/04/metadata">
    <description>This is a sample Lightning Message Channel for the Lightning Web Components Superbadge.</description>
    <isExposed>true</isExposed>
    <lightningMessageFields>
        <description>This is the record Id that changed</description>
        <fieldName>recordId</fieldName>
    </lightningMessageFields>
    <masterLabel>BoatMessageChannel</masterLabel>
</LightningMessageChannel>
</code>```

Getting the error message as "duplicate value found:  duplicates value on record with id: " in line 1(  )
Not sure about the root cause of the issue and, I tried disabling the field history tracking too, but no use.

I checked whether the related objects are having field history tracking enabled, but its not.

Body:
duplicate value found:  duplicates value on record with id:

**XML File:**
-------------
<?xml version="1.0" encoding="UTF-8"?>
<LightningMessageChannel xmlns="http://soap.sforce.com/2006/04/metadata">
    <description>This is a sample Lightning Message Channel for the Lightning Web Components Superbadge.</description>
    <isExposed>true</isExposed>
    <lightningMessageFields>
        <description>This is the record Id that changed</description>
        <fieldName>recordId</fieldName>
    </lightningMessageFields>
    <masterLabel>BoatMessageChannel</masterLabel>
</LightningMessageChannel>

Getting the error message as "duplicate value found:  duplicates value on record with id: " in line 1(  )
Not sure about the root cause of the issue and, I tried disabling the field history tracking too, but no use.

I checked whether the related objects are having field history tracking enabled, but its not.


问:
Second Model form is over riding the first model form of same model Django
Hello i am having an issue in django forms.
i am passing 2 forms in a same view.
these both forms are model forms with the same fields and same model as well.
the code is:

```<code>class IncomingOrderForm(forms.ModelForm):
    class Meta:
        model = connector_models.Order
        fields = ['message_type', 'position', 'field']
        widgets = {
            "message_type": forms.TextInput(
                attrs={"data_icon": "fa fa-envelope", "required": "", "col_cls": "col-md-4"}),
            "position": forms.TextInput(
                attrs={"data_icon": "fa fa-hashtag", "required": "", "type": "number", "col_cls": "col-md-4",
                       "value": "0"}),
            "field": forms.TextInput(attrs={"data_icon": "fa fa-keyboard", "required": "", "col_cls": "col-md-4"})
        }

class OutgoingOrderForm(forms.ModelForm):
    class Meta:
        model = connector_models.Order
        fields = ['message_type', 'position', 'field']

        widgets = {
            "message_type": forms.TextInput(
                attrs={"data_icon": "fa fa-comment", "required": "", "col_cls": "col-md-4"}),
            "position": forms.TextInput(
                attrs={"data_icon": "fa fa-hashtag", "required": "", "type": "number", "col_cls": "col-md-4",
                       "value": "0"}),
            "field": forms.TextInput(attrs={"data_icon": "fa fa-keyboard", "required": "", "col_cls": "col-md-4"})
        }
</code>```

i am showing these both forms in a same view for getting 2 different entries.
for example i am typing values for incoming form:
message_type : 'A',position :1, field:1

and for outgoing form:message_type : 'B',position :2, field:2

and when i save these forms
it saves outgoing form entries 2 times instead of saving both forms once
please give me any solution,

thanks in advance

Body:
Hello i am having an issue in django forms.
i am passing 2 forms in a same view.
these both forms are model forms with the same fields and same model as well.
the code is:

class IncomingOrderForm(forms.ModelForm):
    class Meta:
        model = connector_models.Order
        fields = ['message_type', 'position', 'field']
        widgets = {
            "message_type": forms.TextInput(
                attrs={"data_icon": "fa fa-envelope", "required": "", "col_cls": "col-md-4"}),
            "position": forms.TextInput(
                attrs={"data_icon": "fa fa-hashtag", "required": "", "type": "number", "col_cls": "col-md-4",
                       "value": "0"}),
            "field": forms.TextInput(attrs={"data_icon": "fa fa-keyboard", "required": "", "col_cls": "col-md-4"})
        }

class OutgoingOrderForm(forms.ModelForm):
    class Meta:
        model = connector_models.Order
        fields = ['message_type', 'position', 'field']

        widgets = {
            "message_type": forms.TextInput(
                attrs={"data_icon": "fa fa-comment", "required": "", "col_cls": "col-md-4"}),
            "position": forms.TextInput(
                attrs={"data_icon": "fa fa-hashtag", "required": "", "type": "number", "col_cls": "col-md-4",
                       "value": "0"}),
            "field": forms.TextInput(attrs={"data_icon": "fa fa-keyboard", "required": "", "col_cls": "col-md-4"})
        }

i am showing these both forms in a same view for getting 2 different entries.
for example i am typing values for incoming form:
message_type : 'A',position :1, field:1

and for outgoing form:message_type : 'B',position :2, field:2

and when i save these forms
it saves outgoing form entries 2 times instead of saving both forms once
please give me any solution,

thanks in advance


问:
Is there a way to make it so that the bot opens the tab on the right side of my screen instead of the left side?
I am using VScode to run a bot that I made that can open up a google chrome page. The problem is the position on the screen that the bot opens the tab on. Is there a way to make it so that the bot opens the tab on the right side of my screen instead of the left side?

import time
import random
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

chromedriver = "/user/local/bin/chromedriver"
driver = webdriver.Chrome(chromedriver)

link = "https://docs/google/com/forms/d/e/1FAIpasdadTaerWE-ArYUfzNjfQosl_nlesd"
driver.get(link)

x_p = '//*[@id="mG61Hd"]/div/div[2]/div/div/div[2]div/span/div/div[1]'
submit_xp = '//*[@id="mG61Hd"]/div/div[2]/div[3]/div/div/div/span/span'

while(count < 25):
  d = driver.find_element_by_xpath(x_p)
  d.click()
  time.sleep(0.5)
  submit = driver.find_element_by_xpath(submit_xp)
  submit.click()
  count = count + 1
  driver.get(link)
```

I tried looking on google, but since the question is really dumb and I don't really know how to rephrase it well, I would often find pages on a completely different subject.

Body:
I am using VScode to run a bot that I made that can open up a google chrome page. The problem is the position on the screen that the bot opens the tab on. Is there a way to make it so that the bot opens the tab on the right side of my screen instead of the left side?

import time
import random
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

chromedriver = "/user/local/bin/chromedriver"
driver = webdriver.Chrome(chromedriver)

link = "https://docs/google/com/forms/d/e/1FAIpasdadTaerWE-ArYUfzNjfQosl_nlesd"
driver.get(link)

x_p = '//*[@id="mG61Hd"]/div/div[2]/div/div/div[2]div/span/div/div[1]'
submit_xp = '//*[@id="mG61Hd"]/div/div[2]/div[3]/div/div/div/span/span'

while(count < 25):
  d = driver.find_element_by_xpath(x_p)
  d.click()
  time.sleep(0.5)
  submit = driver.find_element_by_xpath(submit_xp)
  submit.click()
  count = count + 1
  driver.get(link)

I tried looking on google, but since the question is really dumb and I don't really know how to rephrase it well, I would often find pages on a completely different subject.


问:
Postman - Can't inspect Find & Replace results
I am searching for requests in a collection which contain a specific string using Find And Replace.  After entering in a value, I am able to see the results.  I would like to inspect the requests/responses that are in the search results. Specifically, I need to see their headers, and in case of results that are responses—their entire response bodies.

There is an "Open in builder" button by each search result that unfortunately does absolutely nothing, and to further complicate things—the URL of the request is truncated in the search results. Because of this, I can not even manually find the request in the collection and inspect it.

Does anyone have a solution to this problem?


问:
Using Vite JS as a package with apollo client spits a "TypeError: Cannot set property Headers of #<Object> which has only a getter error"
So I'm building out a library which uses apollo client for caching and for graphql requests.

I used vitejs for bundling.

But when I am using next js 13 it shows an error "TypeError: Cannot set property Headers of # which has only a getter error. It works good on other versions of next or CRA.

As for https://github.com/vercel/next.js/issues/41866 it states that for newer versions of node js headers are read-only and might've been changed by the package and is what's causing the error.

But isn't there a way to change vite's build to make this work on higher versions of node?

Here is my config:

```<code>import react from '@vitejs/plugin-react';
import path from 'path';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';

export default defineConfig({
  plugins: [
    react(),
    dts({
      tsConfigFilePath: 'tsconfig.build.json',
      insertTypesEntry: true,
      noEmitOnError: true,
      skipDiagnostics: false,
    }),
  ],
  build: {
    minify: false,
    lib: {
      entry: path.resolve(__dirname, 'src/index.ts'),
      formats: ['es', 'cjs'],
      fileName: (format) => (format === 'es' ? 'index.mjs' : 'index.cjs'),
    },
    rollupOptions: {
      external: ['react', 'react-dom'],
    },
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
    },
  },
});
</code>```

Body:
So I'm building out a library which uses apollo client for caching and for graphql requests.

I used vitejs for bundling.

But when I am using next js 13 it shows an error "TypeError: Cannot set property Headers of # which has only a getter error. It works good on other versions of next or CRA.

As for https://github.com/vercel/next.js/issues/41866 it states that for newer versions of node js headers are read-only and might've been changed by the package and is what's causing the error.

But isn't there a way to change vite's build to make this work on higher versions of node?

Here is my config:

import react from '@vitejs/plugin-react';
import path from 'path';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';

export default defineConfig({
  plugins: [
    react(),
    dts({
      tsConfigFilePath: 'tsconfig.build.json',
      insertTypesEntry: true,
      noEmitOnError: true,
      skipDiagnostics: false,
    }),
  ],
  build: {
    minify: false,
    lib: {
      entry: path.resolve(__dirname, 'src/index.ts'),
      formats: ['es', 'cjs'],
      fileName: (format) => (format === 'es' ? 'index.mjs' : 'index.cjs'),
    },
    rollupOptions: {
      external: ['react', 'react-dom'],
    },
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
    },
  },
});


问:
Webpack: UI Library's exports in index.ts are getting eliminated as unused exports?
I have my own ui library setup with webpack(v5.75.0) as the bundler. When it's built, all the exported components from src/index.ts (specified as entry file in webpack.config.js) are getting eliminated.

As a webpack newbie, it feels like tree shaking is happening although I actually want to export all of the components even if not used internally in the UI library package.

Here're the src/index.ts and webpack.config.js. I'd appreciate any pointers. Thanks in advance.

src/index.ts

```<code>export * from './componentA';
export * from './componentB';
</code>```

webpack.config.js

```<code>
module.exports = {
  entry: ['./src/index.ts'],
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'index.js',
  },
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        use: 'babel-loader',
        exclude: /node_modules/,
      },
      {
        test: /\.ts(x)?$/,
        loader: 'ts-loader',
        exclude: /node_modules/,
      },
      {
        test: /\.css$/,
        use: [
          MiniCssExtractPlugin.loader,
          {
            loader: 'css-loader',
            options: {
              importLoaders: 1,
            },
          },
          'postcss-loader',
        ],
      },
      {
        test: /\.svg$/i,
        issuer: /\.tsx?$/,
        use: ['@svgr/webpack', 'file-loader'],
      },
      {
        test: /\.png$/,
        use: [
          {
            loader: 'url-loader',
            options: {
              mimetype: 'image/png',
            },
          },
        ],
      },
    ],
  },
  devServer: {
    static: {
      directory: './dist',
    },
  },
  plugins: [
    new CopyPlugin({
      patterns: [{ from: 'src/assets' }],
    }),
    new BundleAnalyzerPlugin({
      analyzerMode: 'static',
      openAnalyzer: false,
    }),
    new MiniCssExtractPlugin(),
    new CleanWebpackPlugin(),
  ],
  resolve: {
    extensions: ['.tsx', '.ts', '.js'],
  },
  externals: {
    react: {
      root: 'React',
      commonjs2: 'react',
      commonjs: 'react',
      amd: 'react',
    },
    'react-dom': {
      root: 'ReactDOM',
      commonjs2: 'react-dom',
      commonjs: 'react-dom',
      amd: 'react-dom',
    },
  },
};

</code>```

Body:
I have my own ui library setup with webpack(v5.75.0) as the bundler. When it's built, all the exported components from src/index.ts (specified as entry file in webpack.config.js) are getting eliminated.

As a webpack newbie, it feels like tree shaking is happening although I actually want to export all of the components even if not used internally in the UI library package.

Here're the src/index.ts and webpack.config.js. I'd appreciate any pointers. Thanks in advance.

src/index.ts

export * from './componentA';
export * from './componentB';

webpack.config.js

module.exports = {
  entry: ['./src/index.ts'],
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'index.js',
  },
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        use: 'babel-loader',
        exclude: /node_modules/,
      },
      {
        test: /\.ts(x)?$/,
        loader: 'ts-loader',
        exclude: /node_modules/,
      },
      {
        test: /\.css$/,
        use: [
          MiniCssExtractPlugin.loader,
          {
            loader: 'css-loader',
            options: {
              importLoaders: 1,
            },
          },
          'postcss-loader',
        ],
      },
      {
        test: /\.svg$/i,
        issuer: /\.tsx?$/,
        use: ['@svgr/webpack', 'file-loader'],
      },
      {
        test: /\.png$/,
        use: [
          {
            loader: 'url-loader',
            options: {
              mimetype: 'image/png',
            },
          },
        ],
      },
    ],
  },
  devServer: {
    static: {
      directory: './dist',
    },
  },
  plugins: [
    new CopyPlugin({
      patterns: [{ from: 'src/assets' }],
    }),
    new BundleAnalyzerPlugin({
      analyzerMode: 'static',
      openAnalyzer: false,
    }),
    new MiniCssExtractPlugin(),
    new CleanWebpackPlugin(),
  ],
  resolve: {
    extensions: ['.tsx', '.ts', '.js'],
  },
  externals: {
    react: {
      root: 'React',
      commonjs2: 'react',
      commonjs: 'react',
      amd: 'react',
    },
    'react-dom': {
      root: 'ReactDOM',
      commonjs2: 'react-dom',
      commonjs: 'react-dom',
      amd: 'react-dom',
    },
  },
};


问:
How to perform filter or match in a reference field in MongoDB?
So, I have two collections named Records and Collections.

In records.model.js, I have a field which refers to Collections like this:

```<code>const Records = new mongoose.Schema(
  {
    collection: { type: mongoose.Schema.Types.ObjectId, ref: "Collection" },
  },
);
</code>```

While in the Collections, I have a field like this:

```<code>const Collection = new mongoose.Schema(
  {
    name: { type: String, required: true },
  },
);
</code>```

What I am trying to do is to perform a search in the Records with the collection name that I am getting from the req.query.

So far, I have tried:

```<code>let { text } = req.query;

const pipeline = [
{
          $lookup: {
            from: Collection.collection.name,
            localField: "_id",
            foreignField: "_id",
            pipeline: [
              {
                $match: {
                   name: text
                },
              },
            ],
            as: "collectionInfo",
          },
        }]
</code>```

What I've tried is working but I want to get the results even with the substring of the name because currently, it needs the exact name for me to get the results.

If I have a query of abc, I want to get the Records with the text of abcdefg under the Collection not typing the exact words before I get the expected result. How can I do this?

Body:
So, I have two collections named Records and Collections.

In records.model.js, I have a field which refers to Collections like this:

const Records = new mongoose.Schema(
  {
    collection: { type: mongoose.Schema.Types.ObjectId, ref: "Collection" },
  },
);

While in the Collections, I have a field like this:

const Collection = new mongoose.Schema(
  {
    name: { type: String, required: true },
  },
);

What I am trying to do is to perform a search in the Records with the collection name that I am getting from the req.query.

So far, I have tried:

let { text } = req.query;

const pipeline = [
{
          $lookup: {
            from: Collection.collection.name,
            localField: "_id",
            foreignField: "_id",
            pipeline: [
              {
                $match: {
                   name: text
                },
              },
            ],
            as: "collectionInfo",
          },
        }]

What I've tried is working but I want to get the results even with the substring of the name because currently, it needs the exact name for me to get the results.

If I have a query of abc, I want to get the Records with the text of abcdefg under the Collection not typing the exact words before I get the expected result. How can I do this?


问:
Jenkins Gerrit code review plugin doesn't allow me to use Gerrit Trigger plugin
We use gerrit as our SCM and I'm configuring tests in jenkins to have -+1 opinion on our code reviews. I have configured multibranch pipeline according documentation. I can see branches in the branch view but no jobs are triggering. I have gerrit trigger plugin which works on the server. The documentation says that "configure gerrit trigger as normal" but there is no option to configure it in multibranch pipeline options. I can neither modify any options in any of the pipelines in multibranch.

How do I "configure gerrit trigger as normal" when there are no options to configure it?


问:
Installing tensorboard
I am trying to convert my CSV to tfrecords.
I am  using Dat Tran generate tfrecords.py.
When I execute

Py Generate_tfrecords --csv_input='input.csv' --output_path='output.record'

I am getting error.
Cannot dlopen some GPU library.
Skipping registering GPU Devices...

I think it's problem of installing tensorflow

Please help me solve this problem

Title: Installing tensorboard


问:
Firebase React Js receiving duplicate pushes at a same time
When I send push to someone from console or api, they are receiving duplicate pushes at a same time

messaging.onBackgroundMessage((payload) => {
  console.log(
    "[firebase-messaging-sw.js] Received background message ",
    payload
  );
  const notificationTitle = payload.data.title;
  const notificationOptions = {
    body: payload.data.body,
    tag: "myapp",
  };

  self.registration.showNotification(notificationTitle, notificationOptions);
});
```


问:
Need to make html field ID dynamic for drop down options using jQuery
I am trying to make a search UI, where I am using Keys and Values for making an API call to backend.

These key value fields are dynamic - there is a button that adds extra field.

Now these, field depending on the key selected will have drop down on the value side...

I was able to create a logic for it but it is taking it for all the previous fields as well and not the current only.

I am seeing that the function works for the previous key value fields as well ( meaning when I add more filters - key value fields using a button, the last key value field whichever I will select on the key side will then the function will work for the above key value field as well, I ll add a photo for explanation)

I was looking for a solution to overcome this to keeping it to the latest key value fields only. ( I am thinking of using html id dynamic here for solution)

When I select Car or Phone the drop down should appear on the right,
add filter adds key value fields below..

I add multiple key value fields, the last key which I select will also make value side drop down to its above fields as well....

To change this I am thinking of using id = advanced-filter-2 as dynamic... I need solution for this as I am a beginner.

js fiddle link - https://jsfiddle.net/3wb8sq96/

function Getoptions(e) {
  // $("#advancedFilter+1").change(function (e) {
  var opt = e.value;
  if (opt == "Color" || opt == "Phone") {
    $("#advanced-filter-2").append("<option value='Green'></option>");
    $("#advanced-filter-2").append("<option value='Yellow'></option>");
    $("#advanced-filter-2").append("<option value='Red'></option>");
    $("#advanced-filter-2").append("<option value='Orange'></option>");
  } else {
    $("#advanced-filter-2").empty();
  }
  // });
}

var filterCount = 1;

$(".removeFilter").toggle(filterCount > 1); //toggling appearance of removefilter button on condition

//Function to replicate fields in the form
function replicateFields(inputClass, anchorClass, i) {
  // debugger;
  var elementToReplicate = $(inputClass).first(), //Only clone first group of inputs
    clonedElement = elementToReplicate.clone(); //Cloned the element
  clonedElement.find("input").val(""); //Clear cloned elements value on each new addition
  clonedElement.find("input").each(function() {
    this.name = this.name;
  });
  clonedElement.insertBefore($(anchorClass));
}

//Calling function on click
$(".addFilter").click(function() {
  replicateFields(".filterInputs", ".addFilter", filterCount++);
  //console.log(filterCount);
  $(".removeFilter").toggle(filterCount > 1);
});

// Function to remove added filter in the form
function removeFields(inputClass, anchorClass, i) {
  // debugger;
  var elementToRemove = $(inputClass).last(), //Only remove last group of inputs
    removedElement = elementToRemove.remove(); //Removed the element
  removedElement.remove($(anchorClass));
}

//Calling function on click
$(".removeFilter").click(function() {
  removeFields(".filterInputs", ".removeFilter", filterCount--);
  //console.log(filterCount);
  $(".removeFilter").toggle(filterCount > 1); //toggling appearance of removefilter button on condition
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">

<h2 class="card-title">Search</h2>
<form id="search" action="/service/table/search/" method="post">
  <div class="form-group row">
    <div class="filterInputs col-sm-12">
      <input type="text" name="filterKey[]" id="advancedFilter" list="advanced-filter-1" onchange="Getoptions(this);" />
      <datalist id="advanced-filter-1">
          <option value="Color"></option>
          <option value="Car"></option>
          <option value="Phone"></option>
        </datalist>
      <input type="text" name="filterValue[]" list="advanced-filter-2" />
      <datalist id="advanced-filter-2">
        </datalist>
    </div>
    Add Filter
    href="#!" style="text-align: center" class="removeFilter col-sm-2 col-form-label">Remove Filter</a
      >
    </div>
    <div class="form-group row">
      <div class="col-sm-10">
        <button type="submit" class="btn btn-primary">Search</button>
      </div>
    </div>
  </form></code>```

Body:
I am trying to make a search UI, where I am using Keys and Values for making an API call to backend.

These key value fields are dynamic - there is a button that adds extra field.

Now these, field depending on the key selected will have drop down on the value side...

I was able to create a logic for it but it is taking it for all the previous fields as well and not the current only.

I am seeing that the function works for the previous key value fields as well ( meaning when I add more filters - key value fields using a button, the last key value field whichever I will select on the key side will then the function will work for the above key value field as well, I ll add a photo for explanation)

I was looking for a solution to overcome this to keeping it to the latest key value fields only. ( I am thinking of using html id dynamic here for solution)

When I select Car or Phone the drop down should appear on the right,
add filter adds key value fields below..

I add multiple key value fields, the last key which I select will also make value side drop down to its above fields as well....

To change this I am thinking of using id = advanced-filter-2 as dynamic... I need solution for this as I am a beginner.

js fiddle link - https://jsfiddle.net/3wb8sq96/

function Getoptions(e) {
  // $("#advancedFilter+1").change(function (e) {
  var opt = e.value;
  if (opt == "Color" || opt == "Phone") {
    $("#advanced-filter-2").append("<option value='Green'></option>");
    $("#advanced-filter-2").append("<option value='Yellow'></option>");
    $("#advanced-filter-2").append("<option value='Red'></option>");
    $("#advanced-filter-2").append("<option value='Orange'></option>");
  } else {
    $("#advanced-filter-2").empty();
  }
  // });
}

var filterCount = 1;

$(".removeFilter").toggle(filterCount > 1); //toggling appearance of removefilter button on condition

//Function to replicate fields in the form
function replicateFields(inputClass, anchorClass, i) {
  // debugger;
  var elementToReplicate = $(inputClass).first(), //Only clone first group of inputs
    clonedElement = elementToReplicate.clone(); //Cloned the element
  clonedElement.find("input").val(""); //Clear cloned elements value on each new addition
  clonedElement.find("input").each(function() {
    this.name = this.name;
  });
  clonedElement.insertBefore($(anchorClass));
}

//Calling function on click
$(".addFilter").click(function() {
  replicateFields(".filterInputs", ".addFilter", filterCount++);
  //console.log(filterCount);
  $(".removeFilter").toggle(filterCount > 1);
});

// Function to remove added filter in the form
function removeFields(inputClass, anchorClass, i) {
  // debugger;
  var elementToRemove = $(inputClass).last(), //Only remove last group of inputs
    removedElement = elementToRemove.remove(); //Removed the element
  removedElement.remove($(anchorClass));
}

//Calling function on click
$(".removeFilter").click(function() {
  removeFields(".filterInputs", ".removeFilter", filterCount--);
  //console.log(filterCount);
  $(".removeFilter").toggle(filterCount > 1); //toggling appearance of removefilter button on condition
});

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">

Search

<form id="search" action="/service/table/search/" method="post">

      <input type="text" name="filterKey[]" id="advancedFilter" list="advanced-filter-1" onchange="Getoptions(this);" />
      <datalist id="advanced-filter-1">
          <option value="Color"></option>
          <option value="Car"></option>
          <option value="Phone"></option>
        </datalist>
      <input type="text" name="filterValue[]" list="advanced-filter-2" />
      <datalist id="advanced-filter-2">
        </datalist>

    Add Filter
    Remove Filter

        <button type="submit" class="btn btn-primary">Search</button>

  </form>


问:
Is there a way to create parameters in apache superset like we have in tableau?Or is there any way to do same functionality as parameters
I want to create a drop down using which user can get the feature of changing the aggregation level of metrics.
For example we have sum(cost) as a metrics in the report. Now we want User should have functionality to dynamically select at what level they want to see the view.Either at category level or subcategory level or gender level.

We tried doing this with the help of filters but didn't get any success.


问:
WCF AJAX Enabled Web Service using the ASP.NET Identity Provider (Forms Authentication) for Username and Password Authentication and Authorization
In an existing ASP.NET web application with the Identity Provider, using Forms Authentication, I'd like to authenticate a WCF AJAX Enabled Web Service using the user's already provided logon credentials for the site.

i.e. the WCF web service is only authenticated if the user has passed authentication for the forms website. No further authentication would be necessary for the WCF web service since it is hosted on the same web application.

The check if the user is authenticated would use the Identity framework code like

```<code>bool isUserAuthenticated= (System.Web.HttpContext.Current.User != null) && System.Web.HttpContext.Current.User.Identity.IsAuthenticated
</code>```

from How to check user is "logged in"?

The server-service code should be able to get the user's username from

```<code>System.Web.HttpContext.Current.User.Identity.GetUserId()
</code>```

from
ASP.NET MVC 5 - Identity. How to get current ApplicationUser

The context for a WCF web service is OperationContext, not HttpContext.

Body:
In an existing ASP.NET web application with the Identity Provider, using Forms Authentication, I'd like to authenticate a WCF AJAX Enabled Web Service using the user's already provided logon credentials for the site.

i.e. the WCF web service is only authenticated if the user has passed authentication for the forms website. No further authentication would be necessary for the WCF web service since it is hosted on the same web application.

The check if the user is authenticated would use the Identity framework code like

bool isUserAuthenticated= (System.Web.HttpContext.Current.User != null) && System.Web.HttpContext.Current.User.Identity.IsAuthenticated

from How to check user is "logged in"?

The server-service code should be able to get the user's username from

System.Web.HttpContext.Current.User.Identity.GetUserId()

from
ASP.NET MVC 5 - Identity. How to get current ApplicationUser

The context for a WCF web service is OperationContext, not HttpContext.


问:
How to structure and query firestore data of all group messages for particular user in a whatsapp like app?

Story

My app is not a chat app but my use case is very similar to that. Imagine a group chat app like whatsapp where people added in the group can see messages of that group.

Scenario

Groups will have participants

Groups will have messages

Requirement

When user opens the app, I want every group where he is participant to be synced in his device.

Data Modelling Case 1: Participants array at group level

firestoreRoot: {
   groupsCollection : {
      group1Id: {
        participantsArray: ['user1','user2'],
        messagesSubCollection : {msg1:{...data},msg2:{...data},msg3:{...data},...{...}}
      }
   }
}
```
<p><strong>How to get all messages?</strong></p>
<ol>
<li>For this do I need to query group first where is the participants. Then I need to query again for all groups messages? Is that right? If he is part of 50 groups then 50 new queries will be made.</li>
<li>Will collection queries help? Can i query all messages from parent data like <code>message.parent.participants hasElement clientUserId</code>. Can i access parent field in sub collection data? Then i can do single query but not sure this feature is there?</li>
</ol>
<h2>Data Modelling Case 2: Participants array in all messages</h2>
<pre class="lang-js prettyprint-override"><code>firestoreRoot: {
   groupsCollection : {
      group1Id: {
        messagesSubCollection :
            [
            msg1:{...data,participantArray:['user1','user2']},
            msg2:{...data,participantArray:['user1','user2']},
            msg3:{...data,participantArray:['user1','user2']},
            ]
      }
   }
}
</code>```

How to get all messages?

I will create collection group index of messageSubCollection. I will query all messages where participantArray hasElement clientUserId. Only single query will work.

But now I have to repeat participant array in all messages? If there are 100 participants, then this huge data will be repeated. If user add or remove one participant then all the messages in that group needs to be updated.

Help

Can i go with anyone of these scenario depending upon simplicity/cost based on my use cases?

Am i missing some another feature?

Body:
Story

My app is not a chat app but my use case is very similar to that. Imagine a group chat app like whatsapp where people added in the group can see messages of that group.

Scenario

Groups will have participants

Groups will have messages

Requirement

When user opens the app, I want every group where he is participant to be synced in his device.

Data Modelling Case 1: Participants array at group level

firestoreRoot: {
   groupsCollection : {
      group1Id: {
        participantsArray: ['user1','user2'],
        messagesSubCollection : {msg1:{...data},msg2:{...data},msg3:{...data},...{...}}
      }
   }
}

How to get all messages?

For this do I need to query group first where is the participants. Then I need to query again for all groups messages? Is that right? If he is part of 50 groups then 50 new queries will be made.

Will collection queries help? Can i query all messages from parent data like message.parent.participants hasElement clientUserId. Can i access parent field in sub collection data? Then i can do single query but not sure this feature is there?

Data Modelling Case 2: Participants array in all messages

firestoreRoot: {
   groupsCollection : {
      group1Id: {
        messagesSubCollection :
            [
            msg1:{...data,participantArray:['user1','user2']},
            msg2:{...data,participantArray:['user1','user2']},
            msg3:{...data,participantArray:['user1','user2']},
            ]
      }
   }
}

How to get all messages?

I will create collection group index of messageSubCollection. I will query all messages where participantArray hasElement clientUserId. Only single query will work.

But now I have to repeat participant array in all messages? If there are 100 participants, then this huge data will be repeated. If user add or remove one participant then all the messages in that group needs to be updated.

Help

Can i go with anyone of these scenario depending upon simplicity/cost based on my use cases?

Am i missing some another feature?


问:
Does apple healthkit queries run asynchronously?
Does the apple healthkit queries like HKStatisticsQuery, HKSampleQuery and HKStatisticsCollectionQuery run asynchronously or do we need to explicitly run the queries in a separate thread ?

I just wrote the queries using any async way as follows and it works. I want to know whether I should put it inside an async block

```<code>private func readOxygrnSaturation(){
        dispatchGroup.enter()
        let quantityType  = HKObjectType.quantityType(forIdentifier: .oxygenSaturation)!
        let sampleQuery = HKSampleQuery.init(sampleType: quantityType,
                                             predicate: nil,
                                             limit: HKObjectQueryNoLimit,
                                             sortDescriptors: nil,
                                             resultsHandler: { (query, results, error) in

            guard let samples = results as? [HKQuantitySample] else {
                print(error!)
                return
            }
            for sample in samples {
                let mSample = sample.quantity.doubleValue(for: HKUnit(from: "%"))
                self.oxygenSaturation.append(HealthData(unit: "%", startDate: self.dateFormatter.string(from: sample.startDate) , endDate: self.dateFormatter.string(from: sample.endDate), value: mSample))
            }
            self.dispatchGroup.leave()
        })
        self.healthStore .execute(sampleQuery)

    }

</code>```

Body:
Does the apple healthkit queries like HKStatisticsQuery, HKSampleQuery and HKStatisticsCollectionQuery run asynchronously or do we need to explicitly run the queries in a separate thread ?

I just wrote the queries using any async way as follows and it works. I want to know whether I should put it inside an async block

private func readOxygrnSaturation(){
        dispatchGroup.enter()
        let quantityType  = HKObjectType.quantityType(forIdentifier: .oxygenSaturation)!
        let sampleQuery = HKSampleQuery.init(sampleType: quantityType,
                                             predicate: nil,
                                             limit: HKObjectQueryNoLimit,
                                             sortDescriptors: nil,
                                             resultsHandler: { (query, results, error) in

            guard let samples = results as? [HKQuantitySample] else {
                print(error!)
                return
            }
            for sample in samples {
                let mSample = sample.quantity.doubleValue(for: HKUnit(from: "%"))
                self.oxygenSaturation.append(HealthData(unit: "%", startDate: self.dateFormatter.string(from: sample.startDate) , endDate: self.dateFormatter.string(from: sample.endDate), value: mSample))
            }
            self.dispatchGroup.leave()
        })
        self.healthStore .execute(sampleQuery)

    }


问:
After upgrade in magento2.4.5 showing category page issue
3 exception(s):
Exception #0 (Magento\Framework\DB\Adapter\TableNotFoundException): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'Radiatorm2newdata.store' doesn't exist, query was: SELECT e.entity_id, stockItem.stock_status AS is_salable, cat_index.position, price_index.max_price AS price FROM mgoz_catalog_product_entity AS e
INNER JOIN mgoz_cataloginventory_stock_status AS stockItem ON stockItem.product_id = e.entity_id AND stockItem.website_id = 0 AND stockItem.stock_id = 1
INNER JOIN mgoz_catalog_category_product_index_store1 AS cat_index ON cat_index.product_id = e.entity_id AND cat_index.category_id = 176 AND cat_index.store_id = 1
LEFT JOIN mgoz_catalog_product_index_price AS price_index ON price_index.entity_id = e.entity_id AND price_index.customer_group_id = 0 AND price_index.website_id = (Select website_id FROM store WHERE store_id = 1) ORDER BY is_salable DESC, price ASC, position ASC, entity_id DESC
LIMIT 8


问:
Why does the sub menu not open if you click on it faster than it can show in PySide6
I am using Pyside6 version 6.3.0 and I am trying to make a sub menu work properly.

I made a simple menu bar attached to MainWindow who has a sub menu with a random action.
Making this is not the problem. The problem comes from an unexpected sub menu behaviour.

If you can click the sub menu square fast enough, you can make it so the sub menu with the action never appears. This issue is resolved when you click away from menu bar and repeat the proces without fast clicking the sub menu square.

Is this mybe a bug in pyside6 or is ther a block of code that has to be inserted for this to work properly.

Example code:

```<code>from PySide6.QtGui import QAction
from PySide6.QtWidgets import QApplication, QMainWindow

def function():
    print("function exe")

# Create a main window

class MainWindowSubMenu(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)

        # Create a menu bar
        menu_bar = self.menuBar()

        # Create a main menu
        main_menu = menu_bar.addMenu("Main Menu")

        # Create a submenu
        sub_menu = main_menu.addMenu("Sub Menu")

        # Add a menu action to the submenu
        action = QAction("Action", self)
        sub_menu.addAction(action)

        sub_menu.aboutToShow.connect(lambda: function())

    def function():
        print("Sub menu is about to show")

if __name__ == "__main__":
    app = QApplication()
    window = MainWindowSubMenu()

    # Show the window
    window.show()

    # Run the application event loop
    app.exec()
</code>```

Body:
I am using Pyside6 version 6.3.0 and I am trying to make a sub menu work properly.

I made a simple menu bar attached to MainWindow who has a sub menu with a random action.
Making this is not the problem. The problem comes from an unexpected sub menu behaviour.

If you can click the sub menu square fast enough, you can make it so the sub menu with the action never appears. This issue is resolved when you click away from menu bar and repeat the proces without fast clicking the sub menu square.

Is this mybe a bug in pyside6 or is ther a block of code that has to be inserted for this to work properly.

Example code:

from PySide6.QtGui import QAction
from PySide6.QtWidgets import QApplication, QMainWindow

def function():
    print("function exe")

# Create a main window

class MainWindowSubMenu(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)

        # Create a menu bar
        menu_bar = self.menuBar()

        # Create a main menu
        main_menu = menu_bar.addMenu("Main Menu")

        # Create a submenu
        sub_menu = main_menu.addMenu("Sub Menu")

        # Add a menu action to the submenu
        action = QAction("Action", self)
        sub_menu.addAction(action)

        sub_menu.aboutToShow.connect(lambda: function())

    def function():
        print("Sub menu is about to show")

if __name__ == "__main__":
    app = QApplication()
    window = MainWindowSubMenu()

    # Show the window
    window.show()

    # Run the application event loop
    app.exec()


问:
SMTP ERROR Failed to connect to server A connection attempt failed
I have a problem sending an email and this is the error:

```<code>Connection: opening to smtp.gmail.com:587, timeout=300, options=array()

Connection failed. Error #2: stream_socket_client(): unable to connect to smtp.gmail.com:587 (A connection attempt failed because the connected party did not respond properly after a period of time, or established connection failed because connected host has failed to respond.)

SMTP ERROR: Failed to connect to server: A connection attempt failed because the connected party did not respond properly after a period of time, or the established connection failed because the connected host failed to respond. (10060)
</code>```

I've adjusted the one on https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting and it's still an error, can someone help me please?

```<code>public function Approve1($id)
{
    // For database
    $data = $this->ApprovalModel->requisition_approval(array('hod'=>'submit'),$id);
    if($this->db->affected_rows() > 0)
    // PHPMailer object
    $id=$this->uri->segment(3);
    $email=$this->uri->segment(4);
    $response = false;
    $mail = new PHPMailer();
    // SMTP configuration
    $mail->isSMTP();
    $mail->Host = 'smtp.gmail.com';
    $mail->SMTPDebug = 3;
    $mail->SMTPAuth = true;
    $mail->Username = 'xyz@gmail.com';
    $mail->Password = 'xyz';
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
    $mail->Port = 587;
    $mail->setFrom('xyz@gmail.com', 'xxx');
    $mail->addAddress($email);
    $mail->Subject = 'hii!';
    $mail->isHTML(true);
    // Email body content
    $loginlink = site_url() . 'login' . '"';
    $mailContent = <<<HEREDOC
        Dear Sir/Madam ,
        Your staff asked for Manpower Request, please click this link for your approval $loginlink
        <p>Thank you,</p>
        <p>Cladtek HRIS</p>
        HEREDOC;
    $mail->Body = $mailContent;
    // Send email
    if(!$mail->send()){
        echo 'Message could not be sent.';
        echo 'Mailer Error: ' . $mail->ErrorInfo;
    }
    else{
        $this->session->set_flashdata('flash', '<div class="alert alert-success" role="alert"> Submit Succesfully!<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button></div>');
        return redirect('home/manage_data');
    }
}

</code>```

Body:
I have a problem sending an email and this is the error:

Connection: opening to smtp.gmail.com:587, timeout=300, options=array()

Connection failed. Error #2: stream_socket_client(): unable to connect to smtp.gmail.com:587 (A connection attempt failed because the connected party did not respond properly after a period of time, or established connection failed because connected host has failed to respond.)

SMTP ERROR: Failed to connect to server: A connection attempt failed because the connected party did not respond properly after a period of time, or the established connection failed because the connected host failed to respond. (10060)

I've adjusted the one on https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting and it's still an error, can someone help me please?

public function Approve1($id)
{
    // For database
    $data = $this->ApprovalModel->requisition_approval(array('hod'=>'submit'),$id);
    if($this->db->affected_rows() > 0)
    // PHPMailer object
    $id=$this->uri->segment(3);
    $email=$this->uri->segment(4);
    $response = false;
    $mail = new PHPMailer();
    // SMTP configuration
    $mail->isSMTP();
    $mail->Host = 'smtp.gmail.com';
    $mail->SMTPDebug = 3;
    $mail->SMTPAuth = true;
    $mail->Username = 'xyz@gmail.com';
    $mail->Password = 'xyz';
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
    $mail->Port = 587;
    $mail->setFrom('xyz@gmail.com', 'xxx');
    $mail->addAddress($email);
    $mail->Subject = 'hii!';
    $mail->isHTML(true);
    // Email body content
    $loginlink = site_url() . 'login' . '"';
    $mailContent = <<<HEREDOC
        Dear Sir/Madam ,
        Your staff asked for Manpower Request, please click this link for your approval $loginlink

Thank you,

Cladtek HRIS

        HEREDOC;
    $mail->Body = $mailContent;
    // Send email
    if(!$mail->send()){
        echo 'Message could not be sent.';
        echo 'Mailer Error: ' . $mail->ErrorInfo;
    }
    else{
        $this->session->set_flashdata('flash', '
 Submit Succesfully!<button type="button" class="close" data-dismiss="alert" aria-label="Close">×</button>
');
        return redirect('home/manage_data');
    }
}


问:
How to update peerDependencies of child projects/libraries when upgrading Angular?
I just upgraded a project from Angular 12 to 13. The ng update CLI updated the versions of packages in the package.json at the root of the project.

But the angular packages mentioned in peerDependencies inside package.json of individual libraries inside the projects/ directory are still on Angular 12.

Is there a CLI available to update them automatically to coincide with the versions from the root package.json or do I need to go in each library and update its package.json manually?

Directory structure:

```<code>my-project/
|---- projects/
|     |---- my-library1/
|     |      |---- package.json (peerDependencies still on Angular 12)
|     |
|     |---- my-library2/
|           |---- package.json (peerDependencies still on Angular 12)
|
|---- package.json (All dependencies & devDependencies migrated to Angular 13)
</code>```

Body:
I just upgraded a project from Angular 12 to 13. The ng update CLI updated the versions of packages in the package.json at the root of the project.

But the angular packages mentioned in peerDependencies inside package.json of individual libraries inside the projects/ directory are still on Angular 12.

Is there a CLI available to update them automatically to coincide with the versions from the root package.json or do I need to go in each library and update its package.json manually?

Directory structure:

my-project/
|---- projects/
|     |---- my-library1/
|     |      |---- package.json (peerDependencies still on Angular 12)
|     |
|     |---- my-library2/
|           |---- package.json (peerDependencies still on Angular 12)
|
|---- package.json (All dependencies & devDependencies migrated to Angular 13)


问:
Networking issues when running multiple Docker containers
I am currently getting familiar with Docker and one issue I have is launching several Docker containers on the same host machine.

If I run 32 or less containers, everything works fine.

However, if I start more containers, not only my host machine loses internet connection, but also the containers are not able anymore to communicate with each other.

After searching the web, this seems to be a common issue, but no solution worked for me yet.

I tried setting up custom Docker network bridges as well as editing the /etc/docker/daemon.json  file.

In any case, if I run docker network inspect on the respective network, everything seems fine and each containers has its own IP address correctly assigned.


问:
populating an input element within an flt-glass-pane in WebView
I have an Android application that has a WebView in it, it opens an external website that is supposed to be populated by my application. There is no issue populating it using javascript

```<code>(document.getElementById('id').value='something')
</code>```

if it's an ordinary website.

However, the site that I am having trouble with is done in Flutter so it is making use of Dart.js. The form elements are not accessible and will always return null with any selector.

I have tried document.getElementsByTagName, document.querySelector and document.evaluate for xpath but the result is the same.

The goal of the application is to autofill the site with its profile data.

EDIT: I've done some reading and found out that it makes use of Shadow DOM which I am not familiar to, I was able to pull the value but it doesn't accept any changes

```<code>(document.firstChild.nextSibling.childNodes[2].childNodes[10].shadowRoot.childNodes[5].value)
</code>```

Body:
I have an Android application that has a WebView in it, it opens an external website that is supposed to be populated by my application. There is no issue populating it using javascript

(document.getElementById('id').value='something')

if it's an ordinary website.

However, the site that I am having trouble with is done in Flutter so it is making use of Dart.js. The form elements are not accessible and will always return null with any selector.

I have tried document.getElementsByTagName, document.querySelector and document.evaluate for xpath but the result is the same.

The goal of the application is to autofill the site with its profile data.

EDIT: I've done some reading and found out that it makes use of Shadow DOM which I am not familiar to, I was able to pull the value but it doesn't accept any changes

(document.firstChild.nextSibling.childNodes[2].childNodes[10].shadowRoot.childNodes[5].value)


问:
Latest build not visible in App store Connect to submit build for review
I have uploaded Multiple builds form 1 to 13 for app version 3.5.11. I want submit app for review with app version 3.5.11 and build no 12.

But in App store connect, add build section i am able select form 1 to 8 builds only. From 9 to 13 build only not visible.

I have also connected with apple support team but did not get any response.

Please check attached images. In TestFlight section you can see upto 13 no build is visible and in App store connect from 1 to 8 builds.

TestFlight Image

App Store Connect Image


问:
Clearing Shared Preference when Mobile is switched off

Possible Duplicate:

  Problem with back button in my app

I want to clear the values in shared preference when i'll switch off my mobile

Please help

ContentLicense: CC BY-SA 3.0


问:
Create a real-time line chart by using kotlin
I'm trying to create a chart that displays sensor data from a cell phone in real time. I wrote a code for this, but the data was recorded, but the graph was recorded only on the same x-axis. The code is shown below. How should I solve this? If I need to create a separate thread, where should I add it?</p>
```<code>package com.example.ex_linear_acc_graph

import android.content.Context
import android.graphics.Color
import android.hardware.Sensor
import android.hardware.SensorEvent
import android.hardware.SensorEventListener
import android.hardware.SensorManager
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import android.widget.LinearLayout
import android.widget.TextView
import com.github.mikephil.charting.charts.LineChart
import com.github.mikephil.charting.components.Legend
import com.github.mikephil.charting.components.XAxis
import com.github.mikephil.charting.components.YAxis
import com.github.mikephil.charting.data.Entry
import com.github.mikephil.charting.data.LineData
import com.github.mikephil.charting.data.LineDataSet
import com.github.mikephil.charting.formatter.ValueFormatter
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
import kotlin.concurrent.timer

class linearActivity : AppCompatActivity(), SensorEventListener {

    private val mSensorManager by lazy {
        getSystemService(Context.SENSOR_SERVICE) as SensorManager
    }

    private lateinit var chart: LineChart
    private lateinit var data: LineData

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_linear)

        chart = findViewById(R.id.chart_line)
        chart.description.isEnabled = false
        chart.setTouchEnabled(true)
        chart.isDragEnabled = true
        chart.setScaleEnabled(true)
        chart.setPinchZoom(false)
        chart.legend.form = Legend.LegendForm.LINE
        chart.xAxis.position = XAxis.XAxisPosition.BOTTOM
        chart.xAxis.setDrawLabels(true)
        chart.xAxis.axisMaximum = 0f
        chart.xAxis.setDrawAxisLine(true)
        chart.xAxis.setDrawGridLines(false)
        chart.axisRight.isEnabled = false
        chart.legend.textColor = Color.WHITE
        chart.animateXY(2000, 2000)
        chart.invalidate()

        data = LineData()
        chart.data = data
    }
    override fun onResume() {
        super.onResume()

        mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD)?.also{
                linearacceleration -> mSensorManager.registerListener(
            this,
            linearacceleration,
            SensorManager.SENSOR_DELAY_NORMAL,
            SensorManager.SENSOR_DELAY_UI
        )}
    }

    override fun onPause() {
        super.onPause()
        mSensorManager.unregisterListener(this)
    }

    override fun onSensorChanged(event: SensorEvent) {

        var second : Float = 0f

        timer(period = 1000, initialDelay = 1000){
            second++
        }

        if(event.sensor.type == Sensor.TYPE_MAGNETIC_FIELD){
            val mag_x = event.values[0]
            val mag_y = event.values[1]
            val mag_z = event.values[2]

            val tv_mag : TextView = findViewById(R.id.tv_linear_acc)
            tv_mag.text = "mag_x : ${mag_x}\nmag_y : ${mag_y}\nmag_z : ${mag_z}"

            val dataSet = LineDataSet(listOf(Entry(second, mag_x), Entry(second, mag_y), Entry(second, mag_z)), "Accelerometer Data")
            data.addDataSet(dataSet)
            chart.notifyDataSetChanged()
        }
    }

    override fun onAccuracyChanged(sensor: Sensor?, accuracy: Int) {
        // Do nothing
    }

}
</code>```

Body:
I'm trying to create a chart that displays sensor data from a cell phone in real time. I wrote a code for this, but the data was recorded, but the graph was recorded only on the same x-axis. The code is shown below. How should I solve this? If I need to create a separate thread, where should I add it?

package com.example.ex_linear_acc_graph

import android.content.Context
import android.graphics.Color
import android.hardware.Sensor
import android.hardware.SensorEvent
import android.hardware.SensorEventListener
import android.hardware.SensorManager
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import android.widget.LinearLayout
import android.widget.TextView
import com.github.mikephil.charting.charts.LineChart
import com.github.mikephil.charting.components.Legend
import com.github.mikephil.charting.components.XAxis
import com.github.mikephil.charting.components.YAxis
import com.github.mikephil.charting.data.Entry
import com.github.mikephil.charting.data.LineData
import com.github.mikephil.charting.data.LineDataSet
import com.github.mikephil.charting.formatter.ValueFormatter
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
import kotlin.concurrent.timer

class linearActivity : AppCompatActivity(), SensorEventListener {

    private val mSensorManager by lazy {
        getSystemService(Context.SENSOR_SERVICE) as SensorManager
    }

    private lateinit var chart: LineChart
    private lateinit var data: LineData

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_linear)

        chart = findViewById(R.id.chart_line)
        chart.description.isEnabled = false
        chart.setTouchEnabled(true)
        chart.isDragEnabled = true
        chart.setScaleEnabled(true)
        chart.setPinchZoom(false)
        chart.legend.form = Legend.LegendForm.LINE
        chart.xAxis.position = XAxis.XAxisPosition.BOTTOM
        chart.xAxis.setDrawLabels(true)
        chart.xAxis.axisMaximum = 0f
        chart.xAxis.setDrawAxisLine(true)
        chart.xAxis.setDrawGridLines(false)
        chart.axisRight.isEnabled = false
        chart.legend.textColor = Color.WHITE
        chart.animateXY(2000, 2000)
        chart.invalidate()

        data = LineData()
        chart.data = data
    }
    override fun onResume() {
        super.onResume()

        mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD)?.also{
                linearacceleration -> mSensorManager.registerListener(
            this,
            linearacceleration,
            SensorManager.SENSOR_DELAY_NORMAL,
            SensorManager.SENSOR_DELAY_UI
        )}
    }

    override fun onPause() {
        super.onPause()
        mSensorManager.unregisterListener(this)
    }

    override fun onSensorChanged(event: SensorEvent) {

        var second : Float = 0f

        timer(period = 1000, initialDelay = 1000){
            second++
        }

        if(event.sensor.type == Sensor.TYPE_MAGNETIC_FIELD){
            val mag_x = event.values[0]
            val mag_y = event.values[1]
            val mag_z = event.values[2]

            val tv_mag : TextView = findViewById(R.id.tv_linear_acc)
            tv_mag.text = "mag_x : ${mag_x}\nmag_y : ${mag_y}\nmag_z : ${mag_z}"

            val dataSet = LineDataSet(listOf(Entry(second, mag_x), Entry(second, mag_y), Entry(second, mag_z)), "Accelerometer Data")
            data.addDataSet(dataSet)
            chart.notifyDataSetChanged()
        }
    }

    override fun onAccuracyChanged(sensor: Sensor?, accuracy: Int) {
        // Do nothing
    }

}


问:
Put a single blog page inside blog folder without re-running server using static-site-generator 11ty
I have build a blog project using this blog (https://www.sitepoint.com/wordpress-headless-cms-eleventy/).

I want to make it waork:- As I add new blog on wordpress it should apear in my live site but without re-running server in my code.

It should just add new blog html page in the built folder. but definitely it should not re-create all pages.


问:
How to make color picker ComboBox with Aspose.Cells.GridDesktop?
I'd like to make color picker Combobox like the picture "Color picker ComboBox".Color picker ComboBox
I made it like "Color picker ComboBox - Text only".Color picker ComboBox - Text only
I heard "DrawMode" of ComboBox should be changed to display Color-bar with text and "DrawItem" event should be added too.
But I don't know how to change "DrawMode" and add event with Aspose.Cells.GridDesktop.

I wrote below code. It showed ComboBox without color-bar.

```<code> private void ColorTableComboBox_Add(string cellPosition)
        {
            ArrayList ColorList = new ArrayList();
            Type ColorType = typeof(System.Drawing.Color);
            PropertyInfo[] PropInfoList = ColorType.GetProperties(BindingFlags.Static | BindingFlags.DeclaredOnly | BindingFlags.Public);
            string[] str = new string[PropInfoList.Length];
            int count = 0;
            foreach (PropertyInfo c in PropInfoList)
            {
                str[count++] = c.Name;
            }

            this.Sheet.Controls.AddComboBox(cellPosition, str);
        }

</code>```

Body:
I'd like to make color picker Combobox like the picture "Color picker ComboBox".Color picker ComboBox
I made it like "Color picker ComboBox - Text only".Color picker ComboBox - Text only
I heard "DrawMode" of ComboBox should be changed to display Color-bar with text and "DrawItem" event should be added too.
But I don't know how to change "DrawMode" and add event with Aspose.Cells.GridDesktop.

I wrote below code. It showed ComboBox without color-bar.

 private void ColorTableComboBox_Add(string cellPosition)
        {
            ArrayList ColorList = new ArrayList();
            Type ColorType = typeof(System.Drawing.Color);
            PropertyInfo[] PropInfoList = ColorType.GetProperties(BindingFlags.Static | BindingFlags.DeclaredOnly | BindingFlags.Public);
            string[] str = new string[PropInfoList.Length];
            int count = 0;
            foreach (PropertyInfo c in PropInfoList)
            {
                str[count++] = c.Name;
            }

            this.Sheet.Controls.AddComboBox(cellPosition, str);
        }


问:
InterruptedException Issue on Sonar while getting data from CompletableFuture
Here inside the for loop I'm trying to get the value from stringCompletableFutureEntry which throws the InterruptedException and with sonar enabled on this, I am supposed to interrupt the thread when an exception occurs but according to my expectation I should get data for all futures if it's not there than I can use Optional.empty() or skip this iteration and move further. How should I get rid of this sonar issue?

private void mapFutures(
      Map<Obj1, CompletableFuture<DummyContainer>> futures, List<DummyStatus> dummyStatusList) {
    for (Map.Entry<Obj1, CompletableFuture<DummyContainer>> stringCompletableFutureEntry :
        futures.entrySet()) {
      try {
        Optional<DummyContainer> dummyContainer =
            Optional.ofNullable(**stringCompletableFutureEntry.getValue().get()**);
        List<Dummy> dummy = null;
        dummy = dummyContainer.map(DummyContainer::getDummyData).orElseGet(() -> null);

        if (!CollectionUtils.isEmpty(dummy)) {
          dummyStatusList.add(new DummyStatus(stringCompletableFutureEntry.getKey(), dummy.get(0)));
        } else {
          dummyStatusList.add(new DummyStatus(stringCompletableFutureEntry.getKey()));
        }
      } catch (InterruptedException | ExecutionException e) {
        Thread.currentThread().interrupt(); // sonar expectation
      }
    }
  }

```
<p>I tried using timeout while getting data e.g.</p>
<pre class="lang-java prettyprint-override"><code>stringCompletableFutureEntry.getValue().get(Long.parseLong("3000"), TimeUnit.MILLISECONDS))
</code>```

It'll throw a TimeoutException once the time threshold is reached.

I'm looking for other Solutions to get rid of InterruptedException inside the loop.

Body:
Here inside the for loop I'm trying to get the value from stringCompletableFutureEntry which throws the InterruptedException and with sonar enabled on this, I am supposed to interrupt the thread when an exception occurs but according to my expectation I should get data for all futures if it's not there than I can use Optional.empty() or skip this iteration and move further. How should I get rid of this sonar issue?

private void mapFutures(
      Map<Obj1, CompletableFuture<DummyContainer>> futures, List<DummyStatus> dummyStatusList) {
    for (Map.Entry<Obj1, CompletableFuture<DummyContainer>> stringCompletableFutureEntry :
        futures.entrySet()) {
      try {
        Optional<DummyContainer> dummyContainer =
            Optional.ofNullable(**stringCompletableFutureEntry.getValue().get()**);
        List<Dummy> dummy = null;
        dummy = dummyContainer.map(DummyContainer::getDummyData).orElseGet(() -> null);

        if (!CollectionUtils.isEmpty(dummy)) {
          dummyStatusList.add(new DummyStatus(stringCompletableFutureEntry.getKey(), dummy.get(0)));
        } else {
          dummyStatusList.add(new DummyStatus(stringCompletableFutureEntry.getKey()));
        }
      } catch (InterruptedException | ExecutionException e) {
        Thread.currentThread().interrupt(); // sonar expectation
      }
    }
  }

I tried using timeout while getting data e.g.

stringCompletableFutureEntry.getValue().get(Long.parseLong("3000"), TimeUnit.MILLISECONDS))

It'll throw a TimeoutException once the time threshold is reached.

I'm looking for other Solutions to get rid of InterruptedException inside the loop.


问:
The VPN app getting close after click connect button (React Native)
I want to build a VPN app with React Native and cloned a repository from this GitHub. When I run the project with yarn android, it throws me error like this:

```<code> WARN  `new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method.
    at App (http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.fourthvpn&modulesOnly=false&runModule=true:93333:41)
    at RCTView
    at View
    at RCTView
    at View
    at AppContainer (http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.fourthvpn&modulesOnly=false&runModule=true:84989:36)
    at FourthVPN(RootComponent) (http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.fourthvpn&modulesOnly=false&runModule=true:89596:28)
 WARN  `new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method.
    at App (http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.fourthvpn&modulesOnly=false&runModule=true:93333:41)
    at RCTView
    at View
    at RCTView
    at View
    at AppContainer (http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.fourthvpn&modulesOnly=false&runModule=true:84989:36)
    at FourthVPN(RootComponent) (http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.fourthvpn&modulesOnly=false&runModule=true:89596:28)
</code>```

I deleted the node_modules and installed it again with yarn add but I am still facing the same issue. Also I run ./gradlew clean, but still facing the same issue.

In emulator, the app getting close after I click connect button, and it's can't connect to server but still running in background. But in real device, the app getting close when I open the app.

Thanks in advance for any help.

I've try to rebuild to the new project but it's getting the same error.

Body:
I want to build a VPN app with React Native and cloned a repository from this GitHub. When I run the project with yarn android, it throws me error like this:

 WARN  `new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method.
    at App (http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.fourthvpn&modulesOnly=false&runModule=true:93333:41)
    at RCTView
    at View
    at RCTView
    at View
    at AppContainer (http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.fourthvpn&modulesOnly=false&runModule=true:84989:36)
    at FourthVPN(RootComponent) (http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.fourthvpn&modulesOnly=false&runModule=true:89596:28)
 WARN  `new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method.
    at App (http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.fourthvpn&modulesOnly=false&runModule=true:93333:41)
    at RCTView
    at View
    at RCTView
    at View
    at AppContainer (http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.fourthvpn&modulesOnly=false&runModule=true:84989:36)
    at FourthVPN(RootComponent) (http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.fourthvpn&modulesOnly=false&runModule=true:89596:28)

I deleted the node_modules and installed it again with yarn add but I am still facing the same issue. Also I run ./gradlew clean, but still facing the same issue.

In emulator, the app getting close after I click connect button, and it's can't connect to server but still running in background. But in real device, the app getting close when I open the app.

Thanks in advance for any help.

I've try to rebuild to the new project but it's getting the same error.


问:
C# Selenium Webdriver chromedriver problem with version
I have a problem with chrome and chromedriver version, I tried to find some solution but without success.

System.InvalidOperationException : session not created: This version of ChromeDriver only supports Chrome version 106 Current browser version is 108.0.5359.125 with binary path

I updated version of chromedriver through NuGet, but It's still the same...

Google Chrome version
chromedriver version

Do you have any idea what's wrong?

I tried to update version of chrome driver through NuGet and manually. Also uninstalling it and installing again but it didn't worked.


问:
Python gives ModuleNotFoundError for some python3 modules if I am not using a virtual environment
Python gives ModuleNotFoundError for some python3 modules if I am not using a virtual environment, with the following modules:

uvicorn

flask

mysql.connector
But, when I create a virtual environment, and install these modules in that environment, everything works fine. What seems to be the problem here? I have installed python on ubuntu using the sudo apt-get install  command.