问:
Union-find: largest component size by common factor algorithm gives different results on every run
I was practicing data structure algorithm and made a Union - Find solution for the question.

The problem is, I think the code seems ok, but when I run it on Xcode playground, it shows different answers for the same input.

For example, I put an array [4, 6, 15, 35] in the function largestComponentSize, then it shows 2, 3, or 4 as the answer. I don't understand what's happening behind.

```<code>class Solution {
    var uf = UnionFind()

    func largestComponentSize(_ nums: [Int]) -> Int {
        var maxNum:Int = 0
        var numFactorMap = [Int:Int]()
        var factorAdded = Set<Int>()
        for num in nums {
            var pFactors = getPrimeFactors(num)
            numFactorMap[num] = pFactors[0]
            for (i, val) in pFactors.enumerated() {
                if !factorAdded.contains(val) {
                    uf.addSet(val)
                    factorAdded.insert(val)
                }
                if i > 0 {
                    uf.union(pFactors[i-1], val)
                }
            }
        }

        var groupCountMap = [Int:Int]()

        for num in nums {
            var groupId = uf.find(numFactorMap[num]!)!
            if groupCountMap.keys.contains(groupId) {
                groupCountMap[groupId]! += 1
            } else {
                groupCountMap[groupId] = 1
            }
            maxNum = max(maxNum, groupCountMap[groupId]!)
        }

        return maxNum
    }

    func getPrimeFactors(_ num: Int) -> [Int] {
        var ans:Set<Int> = []

        if num == 1 {
            return []
        }

        var crrNum = num
        var deno = 2
        while crrNum >= deno {
            if crrNum % deno == 0 {
                ans.insert(deno)
                crrNum = crrNum / deno
            } else {
                deno = deno + 1
            }
        }

        return Array(ans)
    }

    class UnionFind {
        var index = [Int: Int]()
        var parent: [Int]
        var size: [Int]

        init() {
            parent = []
            size = []
        }

        func addSet(_ ele: Int) {
            index[ele] = parent.count
            parent.append(parent.count)
            size.append(1)
        }

        func getSetSize(_ ele: Int) -> Int {
            if let found = find(ele) {
                return size[found]
            }
            return 0
        }

        func find(_ ele: Int) -> Int? {
            if let indexOfEle = index[ele] {
                if parent[indexOfEle] == indexOfEle {
                    return indexOfEle
                } else {
                    if let found = find(parent[indexOfEle]) {
                        parent[indexOfEle] = found
                    }
                    return parent[indexOfEle]
                }
            } else {
                return nil //never come here
            }
        }

        func union(_ first: Int, _ second: Int) {
            guard let indexOfFirst = index[first], let indexOfSecond = index[second] else {
                return
            }

            if parent[indexOfFirst] == parent[indexOfSecond] {
                return
            }

            var indexOfLarger = indexOfFirst
            var indexOfSmaller = indexOfSecond
            if size[indexOfFirst] < size[indexOfSecond] {
                indexOfLarger = indexOfSecond
                indexOfSmaller = indexOfFirst
            }

            parent[indexOfSmaller] = indexOfLarger
            size[indexOfLarger] += size[indexOfSmaller]

            return
        }
    }
}

var sol = Solution()
var nums = [4, 6, 15, 35]
var ans = sol.largestComponentSize(nums)
</code>```

Thank you for your help in advance!

I just tried it on Xcode playground.

Body:
I was practicing data structure algorithm and made a Union - Find solution for the question.

The problem is, I think the code seems ok, but when I run it on Xcode playground, it shows different answers for the same input.

For example, I put an array [4, 6, 15, 35] in the function largestComponentSize, then it shows 2, 3, or 4 as the answer. I don't understand what's happening behind.

class Solution {
    var uf = UnionFind()

    func largestComponentSize(_ nums: [Int]) -> Int {
        var maxNum:Int = 0
        var numFactorMap = [Int:Int]()
        var factorAdded = Set<Int>()
        for num in nums {
            var pFactors = getPrimeFactors(num)
            numFactorMap[num] = pFactors[0]
            for (i, val) in pFactors.enumerated() {
                if !factorAdded.contains(val) {
                    uf.addSet(val)
                    factorAdded.insert(val)
                }
                if i > 0 {
                    uf.union(pFactors[i-1], val)
                }
            }
        }

        var groupCountMap = [Int:Int]()

        for num in nums {
            var groupId = uf.find(numFactorMap[num]!)!
            if groupCountMap.keys.contains(groupId) {
                groupCountMap[groupId]! += 1
            } else {
                groupCountMap[groupId] = 1
            }
            maxNum = max(maxNum, groupCountMap[groupId]!)
        }

        return maxNum
    }

    func getPrimeFactors(_ num: Int) -> [Int] {
        var ans:Set<Int> = []

        if num == 1 {
            return []
        }

        var crrNum = num
        var deno = 2
        while crrNum >= deno {
            if crrNum % deno == 0 {
                ans.insert(deno)
                crrNum = crrNum / deno
            } else {
                deno = deno + 1
            }
        }

        return Array(ans)
    }

    class UnionFind {
        var index = [Int: Int]()
        var parent: [Int]
        var size: [Int]

        init() {
            parent = []
            size = []
        }

        func addSet(_ ele: Int) {
            index[ele] = parent.count
            parent.append(parent.count)
            size.append(1)
        }

        func getSetSize(_ ele: Int) -> Int {
            if let found = find(ele) {
                return size[found]
            }
            return 0
        }

        func find(_ ele: Int) -> Int? {
            if let indexOfEle = index[ele] {
                if parent[indexOfEle] == indexOfEle {
                    return indexOfEle
                } else {
                    if let found = find(parent[indexOfEle]) {
                        parent[indexOfEle] = found
                    }
                    return parent[indexOfEle]
                }
            } else {
                return nil //never come here
            }
        }

        func union(_ first: Int, _ second: Int) {
            guard let indexOfFirst = index[first], let indexOfSecond = index[second] else {
                return
            }

            if parent[indexOfFirst] == parent[indexOfSecond] {
                return
            }

            var indexOfLarger = indexOfFirst
            var indexOfSmaller = indexOfSecond
            if size[indexOfFirst] < size[indexOfSecond] {
                indexOfLarger = indexOfSecond
                indexOfSmaller = indexOfFirst
            }

            parent[indexOfSmaller] = indexOfLarger
            size[indexOfLarger] += size[indexOfSmaller]

            return
        }
    }
}

var sol = Solution()
var nums = [4, 6, 15, 35]
var ans = sol.largestComponentSize(nums)

Thank you for your help in advance!

I just tried it on Xcode playground.


来源: stackexchange

问:
How to generate nested `tqdm` progress bars at the top of the output
I have some code that looks like this:

from tqdm.notebook import tqdm
import time
import numpy as np

for i in range(10):
    for j in range(i):
        print(j)
        time.sleep(0.05)
```
<p>Keep in mind that this is a very dumbed down version. I would like to use nested progress bars for the loops while printing some output.</p>
<p>I tried the following:</p>
<pre class="lang-py prettyprint-override"><code>from tqdm.notebook import tqdm
import time
import numpy as np

p1 = tqdm(range(10))

for i in p1:
    p1.set_description(f'main: {i}')

    p2 = tqdm(range(i), leave=False)
    for j in p2:
        p2.set_description(f'sub: {j}')
        print(j)
        time.sleep(0.1)
</code>```

the problem with this is that the second progress bar is always generated at the bottom of the printed output (see image)

Would it be possible to keep both progress bars at the top of the output while still printing the results in the second loop?

ContentLicense: CC BY-SA 4.0

Body:
I have some code that looks like this:

from tqdm.notebook import tqdm
import time
import numpy as np

for i in range(10):
    for j in range(i):
        print(j)
        time.sleep(0.05)

Keep in mind that this is a very dumbed down version. I would like to use nested progress bars for the loops while printing some output.

I tried the following:

from tqdm.notebook import tqdm
import time
import numpy as np

p1 = tqdm(range(10))

for i in p1:
    p1.set_description(f'main: {i}')

    p2 = tqdm(range(i), leave=False)
    for j in p2:
        p2.set_description(f'sub: {j}')
        print(j)
        time.sleep(0.1)

the problem with this is that the second progress bar is always generated at the bottom of the printed output (see image)

Would it be possible to keep both progress bars at the top of the output while still printing the results in the second loop?


问:
Getting Error While trying to run Storybook on my React project
I have installed storybook in my project and now when I am trying to run the storybook using npm run storybook I am getting this error. I Have searched the whole web and also updated my react-scripts, Node JS and VS Code to latest versions after reading some articles on web but the error is still not resolved.

```<code>Ignoring cached manager due to change in manager config
i ｢wdm｣: wait until bundle finished:
node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (F:\Masai\snehil_agrahari_fw21_1171\unit-5\sprint-3\day-4\you\LIVE\story-book-demo\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (F:\Masai\snehil_agrahari_fw21_1171\unit-5\sprint-3\day-4\you\LIVE\story-book-demo\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (F:\Masai\snehil_agrahari_fw21_1171\unit-5\sprint-3\day-4\you\LIVE\story-book-demo\node_modules\webpack\lib\NormalModule.js:471:10)
    at F:\Masai\snehil_agrahari_fw21_1171\unit-5\sprint-3\day-4\you\LIVE\story-book-demo\node_modules\webpack\lib\NormalModule.js:503:5
    at F:\Masai\snehil_agrahari_fw21_1171\unit-5\sprint-3\day-4\you\LIVE\story-book-demo\node_modules\webpack\lib\NormalModule.js:358:12
    at F:\Masai\snehil_agrahari_fw21_1171\unit-5\sprint-3\day-4\you\LIVE\story-book-demo\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (F:\Masai\snehil_agrahari_fw21_1171\unit-5\sprint-3\day-4\you\LIVE\story-book-demo\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at Array.<anonymous> (F:\Masai\snehil_agrahari_fw21_1171\unit-5\sprint-3\day-4\you\LIVE\story-book-demo\node_modules\loader-runner\lib\LoaderRunner.js:205:4) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
</code>```

Can you please mention how to fix this error

Body:
I have installed storybook in my project and now when I am trying to run the storybook using npm run storybook I am getting this error. I Have searched the whole web and also updated my react-scripts, Node JS and VS Code to latest versions after reading some articles on web but the error is still not resolved.

Ignoring cached manager due to change in manager config
i ｢wdm｣: wait until bundle finished:
node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (F:\Masai\snehil_agrahari_fw21_1171\unit-5\sprint-3\day-4\you\LIVE\story-book-demo\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (F:\Masai\snehil_agrahari_fw21_1171\unit-5\sprint-3\day-4\you\LIVE\story-book-demo\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (F:\Masai\snehil_agrahari_fw21_1171\unit-5\sprint-3\day-4\you\LIVE\story-book-demo\node_modules\webpack\lib\NormalModule.js:471:10)
    at F:\Masai\snehil_agrahari_fw21_1171\unit-5\sprint-3\day-4\you\LIVE\story-book-demo\node_modules\webpack\lib\NormalModule.js:503:5
    at F:\Masai\snehil_agrahari_fw21_1171\unit-5\sprint-3\day-4\you\LIVE\story-book-demo\node_modules\webpack\lib\NormalModule.js:358:12
    at F:\Masai\snehil_agrahari_fw21_1171\unit-5\sprint-3\day-4\you\LIVE\story-book-demo\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (F:\Masai\snehil_agrahari_fw21_1171\unit-5\sprint-3\day-4\you\LIVE\story-book-demo\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at Array.<anonymous> (F:\Masai\snehil_agrahari_fw21_1171\unit-5\sprint-3\day-4\you\LIVE\story-book-demo\node_modules\loader-runner\lib\LoaderRunner.js:205:4) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Can you please mention how to fix this error


问:
BigQuery Pricing for Parameterized data types
I have 2 BQ tables myds.mytable1(col1 string) and myds.mytable2(col1 string(1))

We are storing constant "Y" and "N" values in col1 for both the tables.

In BigQuery, will the pricing be same or will string(1) cost less ?

Thanks,
Santanu


问:
What's wrong with my code that I can't see the transparency?
I have already scanned through the alpha values of the Color method, but no results appear.

This is a simple example of the code:

```<code>import pygame
import sys

pygame.init()

SCREEN_WIDTH = 450
SCREEN_HEIGHT = 450
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))

transparent_red = pygame.Color(255, 0, 0, 128)
transparent_blue = pygame.Color(0, 0, 255, 128)

pygame.draw.rect(screen, transparent_red, (100, 100, 200, 200))
pygame.draw.rect(screen, transparent_blue, (150, 150, 200, 200))

pygame.display.update()

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()

</code>```

And what I like is to be able to see a blend of the two colors as an overlap of transparencies. What's wrong?

Body:
I have already scanned through the alpha values of the Color method, but no results appear.

This is a simple example of the code:

import pygame
import sys

pygame.init()

SCREEN_WIDTH = 450
SCREEN_HEIGHT = 450
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))

transparent_red = pygame.Color(255, 0, 0, 128)
transparent_blue = pygame.Color(0, 0, 255, 128)

pygame.draw.rect(screen, transparent_red, (100, 100, 200, 200))
pygame.draw.rect(screen, transparent_blue, (150, 150, 200, 200))

pygame.display.update()

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()

And what I like is to be able to see a blend of the two colors as an overlap of transparencies. What's wrong?


问:
Return full data on JavaScript Promise for a function within a class while using node-client-ntlm
I have a function within a class that makes a call and returns a promise object with data. I do get the data back the issue is I cannot figure out how to make the call wait till all of the data is returned at the moment it only returns a few lines of data and cuts off the rest of the return.</p>
```<code>  async callCurl(postFields) {
    this.postFields = postFields;
    const response = await client
      .request(
        {
          url: this.url,
          method: "POST",
          debug: true,
          body: "folderGuid=" + this.postFields,
          headers: {
            "content-type": "application/x-www-form-urlencoded",
          },
          resolve: true,
        },
        "username",
        "password",
        "",
        "domain"
      )
      .then((response) => {
        console.log(response.body);
      })
      .catch(function (error) {
        console.log(error);
      });

    //return response;
  }
</code>```

Body:
I have a function within a class that makes a call and returns a promise object with data. I do get the data back the issue is I cannot figure out how to make the call wait till all of the data is returned at the moment it only returns a few lines of data and cuts off the rest of the return.

  async callCurl(postFields) {
    this.postFields = postFields;
    const response = await client
      .request(
        {
          url: this.url,
          method: "POST",
          debug: true,
          body: "folderGuid=" + this.postFields,
          headers: {
            "content-type": "application/x-www-form-urlencoded",
          },
          resolve: true,
        },
        "username",
        "password",
        "",
        "domain"
      )
      .then((response) => {
        console.log(response.body);
      })
      .catch(function (error) {
        console.log(error);
      });

    //return response;
  }


问:
Is there a way to perform a cross-join for multiple rows X multiple columns (more than 3) using vba?
Is there a way to perform a cross-join for multiple rows X multiple columns using VBA? (No limit to the number of columns & rows. The range should be selectable)

I cannot find the same solution to build up the cross-join of multiple columns by VBA (3 columns limited version exists, but it is not the same), so let me ask it here.

1st, VBA should intake range composed of multiple rows and columns. Suppose there is a 2x4 cell range in Excel like this:

```<code>1 a x 5
2 b y 6
</code>```

Then the VBA should join each row element in each column. The number of columns in the initially selected range should not be changed in the result cross join table. In the case of the above range, the joined result (Cartesian product) should be as below.

```<code>1 a x 5
1 a y 5
2 a x 5
2 a y 5
1 b x 5
1 b y 5
2 b x 5
2 b y 5
1 a x 6
1 a y 6
2 a x 6
2 a y 6
1 b x 6
1 b y 6
2 b x 6
2 b y 6
</code>```

This example only shows the pattern of 4 columns, but I hope it adapts more columns. I made a halfway code below, and I cannot resolve it myself at the part surrounded by ###.

```<code>Sub CrossJoin()
    Dim i, j, k, m As Long, ws As Worksheet
    Set ws = ThisWorkbook.ActiveSheet ' Set the active worksheet

    ' Prompt the user to select the range of cells containing the data list
    Dim temp As Range
    Set temp = Application.InputBox(Prompt:="Select the range of cells containing the data list:", Type:=8)

    ' Store the selected range in the dataList array
    Dim dataList As Variant
    dataList = temp.Value

    ' Calculate the number of rows/cols in the dataList array
    Dim numRows, numCols As Long
    numRows = UBound(dataList, 1)
    numCols = UBound(dataList, 2)

    ' Calculate the number of elements in the result array
    Dim numElements As Long
    numElements = 1
    For i = 1 To numCols
        numElements = numElements * numRows
    Next i

    ' Initialize the result array
    Dim result As Variant
    ReDim result(1 To numElements, 1 To numCols)

    ' Perform the cross join
    Dim elementCounter As Long
    elementCounter = 1

    For i = 1 To numRows
        '### ↓Here I cannot solve what I should write↓ ###
        For j = 1 To numCols
            result(elementCounter, j) = dataList(i, j)
            elementCounter = elementCounter + 1
        Next j
        '### ↑Here I cannot solve what I should write↑ ###
    Next i

    Dim dest As Range
    Set dest = Application.InputBox(Prompt:="Select the cell where you want to put the result:", Type:=8)

    ' Paste the result to the worksheet
    dest.Resize(UBound(result), UBound(result)).Value = result
End Sub

</code>```

Body:
Is there a way to perform a cross-join for multiple rows X multiple columns using VBA? (No limit to the number of columns & rows. The range should be selectable)

I cannot find the same solution to build up the cross-join of multiple columns by VBA (3 columns limited version exists, but it is not the same), so let me ask it here.

1st, VBA should intake range composed of multiple rows and columns. Suppose there is a 2x4 cell range in Excel like this:

1 a x 5
2 b y 6

Then the VBA should join each row element in each column. The number of columns in the initially selected range should not be changed in the result cross join table. In the case of the above range, the joined result (Cartesian product) should be as below.

1 a x 5
1 a y 5
2 a x 5
2 a y 5
1 b x 5
1 b y 5
2 b x 5
2 b y 5
1 a x 6
1 a y 6
2 a x 6
2 a y 6
1 b x 6
1 b y 6
2 b x 6
2 b y 6

This example only shows the pattern of 4 columns, but I hope it adapts more columns. I made a halfway code below, and I cannot resolve it myself at the part surrounded by ###.

Sub CrossJoin()
    Dim i, j, k, m As Long, ws As Worksheet
    Set ws = ThisWorkbook.ActiveSheet ' Set the active worksheet

    ' Prompt the user to select the range of cells containing the data list
    Dim temp As Range
    Set temp = Application.InputBox(Prompt:="Select the range of cells containing the data list:", Type:=8)

    ' Store the selected range in the dataList array
    Dim dataList As Variant
    dataList = temp.Value

    ' Calculate the number of rows/cols in the dataList array
    Dim numRows, numCols As Long
    numRows = UBound(dataList, 1)
    numCols = UBound(dataList, 2)

    ' Calculate the number of elements in the result array
    Dim numElements As Long
    numElements = 1
    For i = 1 To numCols
        numElements = numElements * numRows
    Next i

    ' Initialize the result array
    Dim result As Variant
    ReDim result(1 To numElements, 1 To numCols)

    ' Perform the cross join
    Dim elementCounter As Long
    elementCounter = 1

    For i = 1 To numRows
        '### ↓Here I cannot solve what I should write↓ ###
        For j = 1 To numCols
            result(elementCounter, j) = dataList(i, j)
            elementCounter = elementCounter + 1
        Next j
        '### ↑Here I cannot solve what I should write↑ ###
    Next i

    Dim dest As Range
    Set dest = Application.InputBox(Prompt:="Select the cell where you want to put the result:", Type:=8)

    ' Paste the result to the worksheet
    dest.Resize(UBound(result), UBound(result)).Value = result
End Sub


问:
Why my program to scrape NSE website using CURL in a Python program is not giving proper JSON output?

import subprocess
import os
os.chdir(os.path.dirname(os.path.abspath(__file__)))

subprocess.Popen('curl "https://www.nseindia.com/api/option-chain-currency?symbol=USDINR" -H "Connection: keep-alive" -H "Cache-Control: max-age=0" -H "DNT: 1" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36" -H "Sec-Fetch-User: ?1" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" -H "Sec-Fetch-Site: none" -H "Sec-Fetch-Mode: navigate" -H "Accept-Encoding: gzip, deflate, br" -H "Accept-Language: en-US,en;q=0.9,hi;q=0.8" -o maxpain.json', shell=True)

f=open("maxpain.json","r")
var=f.read()
print(var)
```

[I was supposed to get JSON output like thisInstead i am getting this output](https://i.stack.imgur.com/gOjdB.png)

Body:
import subprocess
import os
os.chdir(os.path.dirname(os.path.abspath(__file__)))

subprocess.Popen('curl "https://www.nseindia.com/api/option-chain-currency?symbol=USDINR" -H "Connection: keep-alive" -H "Cache-Control: max-age=0" -H "DNT: 1" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36" -H "Sec-Fetch-User: ?1" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" -H "Sec-Fetch-Site: none" -H "Sec-Fetch-Mode: navigate" -H "Accept-Encoding: gzip, deflate, br" -H "Accept-Language: en-US,en;q=0.9,hi;q=0.8" -o maxpain.json', shell=True)

f=open("maxpain.json","r")
var=f.read()
print(var)

[I was supposed to get JSON output like thisInstead i am getting this output](https://i.stack.imgur.com/gOjdB.png)


问:
How to print all the duplicated elements of an array with how many times are repeated
So I have this problem I want my program to print all the duplicated elements of an array and the times they were repeated , I wrote the program so that the user enters then integer they are intrested to know how much it was repeated but I want it to print all the duplicated elements and the times of repetition without asking the user , for example :
array={1,4,1,5,2,6,4,4}
it prints : "The duplicates are 1:2 , 4:3)

#include<stdio.h>
#include<stdlib.h>
int arr[]= {1 , 4 , 5 , 9 , 7 , 1 , 8 , 1 , 5};
int x;
int s=0;
printf("Enter x = ");
scanf("%d",&x);
for (int i = 0; i < 9; i++)
    {
if (x==arr[i])
        {
s++;
        }
  }
printf("%d:%d",x,s);
}
```


问:
Error "Invalid Time Format" when using pychatkit
I am trying to code a homework list script that sends the homework to a group chat every day but I keep getting a invalid time format error because of pywhatkit. The error message only disappears when I delete the +65 but another error message will pop up saying that there is no country code for the number. I'm not sure how to solve it since I am trying to send to a group chat and not a phone number.

```<code>import pywhatkit
import datetime

# Dictionary to store the homework assignments and their due dates
homework_dict = {}

# Function to add a homework assignment to the dictionary
def add_homework(assignment, due_date):
  homework_dict\[assignment\] = due_date

# Function to delete homework assignments that are due one day before the actual due date
def delete_overdue_homework():

    # Check the current date
    now = datetime.datetime.now()

    # Calculate the date one day before the current date
    yesterday = now - datetime.timedelta(days=1)

    # Delete any assignments that are due on the calculated date
    for assignment, due_date in homework_dict.items():
      if due_date == yesterday.date():
        del homework_dict\[assignment\]

# Function to send the homework list to the WhatsApp group chat
def send_homework_list():

  # Check the current date
  now = datetime.datetime.now()

  # Initialize the message with the current date
  message = "Homework of the day (" + now.strftime("%B %d, %Y") + "):\\n"

    # Add each homework assignment to the message
    for assignment, due_date in homework_dict.items():
    \# If the due date has not passed, add the assignment to the message
      if due_date \>= now.date():
        message += " - " + assignment + "\\n"

# Calculate the hour to send the message (current hour + 18)
send_hour = (now.hour + 18) % 24

# Send the message to the WhatsApp group chat
pywhatkit.sendwhatmsg("+65 Homework List", send_hour, 0, message)

# Add some homework assignments for testing
add_homework("Math worksheet", datetime.date(2023, 1, 10))
add_homework("Science reading", datetime.date(2023, 1, 11))
add_homework("English essay", datetime.date(2023, 1, 15))

# Send the homework list to the WhatsApp group chat at 6:00 PM every day
while True:
  delete_overdue_homework()
  send_homework_list()

# Wait for 24 hours before sending the list again
time.sleep(24*60*60)
</code>```

When I used 18, 0, for 6PM so I tried a different solution but it still shows as an error.

Body:
I am trying to code a homework list script that sends the homework to a group chat every day but I keep getting a invalid time format error because of pywhatkit. The error message only disappears when I delete the +65 but another error message will pop up saying that there is no country code for the number. I'm not sure how to solve it since I am trying to send to a group chat and not a phone number.

import pywhatkit
import datetime

# Dictionary to store the homework assignments and their due dates
homework_dict = {}

# Function to add a homework assignment to the dictionary
def add_homework(assignment, due_date):
  homework_dict\[assignment\] = due_date

# Function to delete homework assignments that are due one day before the actual due date
def delete_overdue_homework():

    # Check the current date
    now = datetime.datetime.now()

    # Calculate the date one day before the current date
    yesterday = now - datetime.timedelta(days=1)

    # Delete any assignments that are due on the calculated date
    for assignment, due_date in homework_dict.items():
      if due_date == yesterday.date():
        del homework_dict\[assignment\]

# Function to send the homework list to the WhatsApp group chat
def send_homework_list():

  # Check the current date
  now = datetime.datetime.now()

  # Initialize the message with the current date
  message = "Homework of the day (" + now.strftime("%B %d, %Y") + "):\\n"

    # Add each homework assignment to the message
    for assignment, due_date in homework_dict.items():
    \# If the due date has not passed, add the assignment to the message
      if due_date \>= now.date():
        message += " - " + assignment + "\\n"

# Calculate the hour to send the message (current hour + 18)
send_hour = (now.hour + 18) % 24

# Send the message to the WhatsApp group chat
pywhatkit.sendwhatmsg("+65 Homework List", send_hour, 0, message)

# Add some homework assignments for testing
add_homework("Math worksheet", datetime.date(2023, 1, 10))
add_homework("Science reading", datetime.date(2023, 1, 11))
add_homework("English essay", datetime.date(2023, 1, 15))

# Send the homework list to the WhatsApp group chat at 6:00 PM every day
while True:
  delete_overdue_homework()
  send_homework_list()

# Wait for 24 hours before sending the list again
time.sleep(24*60*60)

When I used 18, 0, for 6PM so I tried a different solution but it still shows as an error.


问:
Network-First for precaching, in a workbox PWA
I'm using the following code ( which is generated from https://create-react-app.dev/docs/making-a-progressive-web-app/ )

```<code>// in service-worker.js
precacheAndRoute(self.__WB_MANIFEST);

// Set up App Shell-style routing, so that all navigation requests
// are fulfilled with your index.html shell. Learn more at
// https://developers.google.com/web/fundamentals/architecture/app-shell
const fileExtensionRegexp = new RegExp('/[^/?]+\\.[^/]+$');
registerRoute(
  // Return false to exempt requests from being fulfilled by index.html.
  ({ request, url }) => {
    console.log(request, url)
    // If this isn't a navigation, skip.
    if (request.mode !== 'navigate') {
      return false;
    } // If this is a URL that starts with /_, skip.

    if (url.pathname.startsWith('/_')) {
      return false;
    } // If this looks like a URL for a resource, because it contains // a file extension, skip.

    if (url.pathname.match(fileExtensionRegexp)) {
      return false;
    } // Return true to signal that we want to use the handler.

    return true;
  },
  createHandlerBoundToURL(process.env.PUBLIC_URL + '/index.html')
);
</code>```

It does work, and I can go offline, and refresh the page.

It doesn't update the page when I make changes, however.

Is it possible to have a "Network-First" approach to precaching, when using google workbox?

Body:
I'm using the following code ( which is generated from https://create-react-app.dev/docs/making-a-progressive-web-app/ )

// in service-worker.js
precacheAndRoute(self.__WB_MANIFEST);

// Set up App Shell-style routing, so that all navigation requests
// are fulfilled with your index.html shell. Learn more at
// https://developers.google.com/web/fundamentals/architecture/app-shell
const fileExtensionRegexp = new RegExp('/[^/?]+\\.[^/]+$');
registerRoute(
  // Return false to exempt requests from being fulfilled by index.html.
  ({ request, url }) => {
    console.log(request, url)
    // If this isn't a navigation, skip.
    if (request.mode !== 'navigate') {
      return false;
    } // If this is a URL that starts with /_, skip.

    if (url.pathname.startsWith('/_')) {
      return false;
    } // If this looks like a URL for a resource, because it contains // a file extension, skip.

    if (url.pathname.match(fileExtensionRegexp)) {
      return false;
    } // Return true to signal that we want to use the handler.

    return true;
  },
  createHandlerBoundToURL(process.env.PUBLIC_URL + '/index.html')
);

It does work, and I can go offline, and refresh the page.

It doesn't update the page when I make changes, however.

Is it possible to have a "Network-First" approach to precaching, when using google workbox?


问:
Browser getting 404 on all CSS and JS pages on Rundeck
Rundeck: 4.8.0
RHEL 7.9
Install: RPM
DB: file

Rundeck started throwing 404 response on all css and js pages after I login. Not sure how and why this started to happen.

I am seeing these errors in service.log...

[2023-01-06T16:41:35,017] WARN servlet.PageNotFound - No mapping for GET //assets/vendor/vue.min-5ecf19da2608574a2818739f14aaa804.js
[2023-01-06T16:41:35,024] WARN servlet.PageNotFound - No mapping for GET //assets/static/css/components/theme-a881608cd0df3ed46ccec6d80d54f867.css
[2023-01-06T16:41:35,030] WARN servlet.PageNotFound - No mapping for GET //assets/ansi24-57d7a35972a3170ed7697cf3bdf4a2f8.css
[2023-01-06T16:41:35,032] WARN servlet.PageNotFound - No mapping for GET //assets/vendor/perfect-scrollbar-b4637c317b2f97ece10726ea6e3eb314.css
[2023-01-06T16:41:35,036] WARN servlet.PageNotFound - No mapping for GET //assets/github-markdown-371020050d5a02d3e440c2a5d7b26057.css
[2023-01-06T16:41:35,041] WARN servlet.PageNotFound - No mapping for GET //assets/vendor/jquery-ui-531fe4367a4266aaa1fa43972fa739d0.js
[2023-01-06T16:41:35,041] WARN servlet.PageNotFound - No mapping for GET //assets/vendor/perfect-scrollbar-80c7dc9be9b25f4452390f63a8ca5f75.js
[2023-01-06T16:41:35,041] WARN servlet.PageNotFound - No mapping for GET //assets/umd-vue-component-loader-c710398a6722b3283913530b8b784485.js

404 respons in browser dev tools
page in browser

Rundeck was working fine and this started happening all of a sudden without any changes.


问:
How do I get value in object>arrey>object>title
I want to get the value of description in Title(textview)

Here is json :

{
  "kind": "youtube#videoListResponse",
  "etag": "HCuE2tlv6pL-pkBXCa6_p5vmZGc",
  "items": [
    {
      "kind": "youtube#video",
      "etag": "yDMBbFsSFuOYTDqCooA3YoiGb_0",
      "id": "omHuhbtWIY0",
      "snippet": {
        "publishedAt": "2022-03-11T12:40:37Z",
        "channelId": "UCIjzLN8bj7Qv5daGJqj9rHA",
        "title": "HTML creator master",
        "description": "App Link - https://technical-studio-develop-7a3b1.web.app/\n\n00:00 Intro\n00:08 Introducing to app\n\n\n-----------------------------------------------\nCopyright Disclaimer under Section 107 of the copyright act 1976, allowance is made for fair use for purposes such as criticism, comment, news reporting, scholarship, and research. Fair use is a use permitted by copyright statute that might otherwise be infringing. Non-profit, educational or personal use tips the balance in favour of fair use.",
        "thumbnails": {
          "default": {
            "url": "https://i.ytimg.com/vi/omHuhbtWIY0/default.jpg",
            "width": 120,
            "height": 90
          },
          "medium": {
            "url": "https://i.ytimg.com/vi/omHuhbtWIY0/mqdefault.jpg",
            "width": 320,
            "height": 180
          },
          "high": {
            "url": "https://i.ytimg.com/vi/omHuhbtWIY0/hqdefault.jpg",
            "width": 480,
            "height": 360
          },
          "standard": {
            "url": "https://i.ytimg.com/vi/omHuhbtWIY0/sddefault.jpg",
            "width": 640,
            "height": 480
          },
          "maxres": {
            "url": "https://i.ytimg.com/vi/omHuhbtWIY0/maxresdefault.jpg",
            "width": 1280,
            "height": 720
          }
        },
        "channelTitle": "Dream Programmers",
        "categoryId": "22",
        "liveBroadcastContent": "none",
        "localized": {
          "title": "HTML creator master",
          "description": "App Link - https://technical-studio-develop-7a3b1.web.app/\n\n00:00 Intro\n00:08 Introducing to app\n\n\n-----------------------------------------------\nCopyright Disclaimer under Section 107 of the copyright act 1976, allowance is made for fair use for purposes such as criticism, comment, news reporting, scholarship, and research. Fair use is a use permitted by copyright statute that might otherwise be infringing. Non-profit, educational or personal use tips the balance in favour of fair use."
        }
      }
    }
  ],
  "pageInfo": {
    "totalResults": 1,
    "resultsPerPage": 1
  }
}
```
<p>My Java code:</p>
```_youtube_data_request_listener = new RequestNetwork.RequestListener() {
            @Override
            public void onResponse(String _param1, String _param2, HashMap<String, Object> _param3) {
                final String _tag = _param1;
                final String _response = _param2;
                final HashMap<String, Object> _responseHeaders = _param3;

                /*
 = new Gson().fromJson("", new TypeToken<ArrayList<String>>(){}.getType());
*/
                _processdialog(false, "");
                ytData = new HashMap<>();
                ytData = new Gson().fromJson(_response, new TypeToken<HashMap<String, Object>>(){}.getType());
                title.setText(ytData.get("items")[].snippet.title);
                ytData.clear();
            }

            @Override
            public void onErrorResponse(String _param1, String _param2) {
                final String _tag = _param1;
                final String _message = _param2;
            }
        };
```

I want to get the value in title and set it in title textview.

Body:
I want to get the value of description in Title(textview)

Here is json :

{
  "kind": "youtube#videoListResponse",
  "etag": "HCuE2tlv6pL-pkBXCa6_p5vmZGc",
  "items": [
    {
      "kind": "youtube#video",
      "etag": "yDMBbFsSFuOYTDqCooA3YoiGb_0",
      "id": "omHuhbtWIY0",
      "snippet": {
        "publishedAt": "2022-03-11T12:40:37Z",
        "channelId": "UCIjzLN8bj7Qv5daGJqj9rHA",
        "title": "HTML creator master",
        "description": "App Link - https://technical-studio-develop-7a3b1.web.app/\n\n00:00 Intro\n00:08 Introducing to app\n\n\n-----------------------------------------------\nCopyright Disclaimer under Section 107 of the copyright act 1976, allowance is made for fair use for purposes such as criticism, comment, news reporting, scholarship, and research. Fair use is a use permitted by copyright statute that might otherwise be infringing. Non-profit, educational or personal use tips the balance in favour of fair use.",
        "thumbnails": {
          "default": {
            "url": "https://i.ytimg.com/vi/omHuhbtWIY0/default.jpg",
            "width": 120,
            "height": 90
          },
          "medium": {
            "url": "https://i.ytimg.com/vi/omHuhbtWIY0/mqdefault.jpg",
            "width": 320,
            "height": 180
          },
          "high": {
            "url": "https://i.ytimg.com/vi/omHuhbtWIY0/hqdefault.jpg",
            "width": 480,
            "height": 360
          },
          "standard": {
            "url": "https://i.ytimg.com/vi/omHuhbtWIY0/sddefault.jpg",
            "width": 640,
            "height": 480
          },
          "maxres": {
            "url": "https://i.ytimg.com/vi/omHuhbtWIY0/maxresdefault.jpg",
            "width": 1280,
            "height": 720
          }
        },
        "channelTitle": "Dream Programmers",
        "categoryId": "22",
        "liveBroadcastContent": "none",
        "localized": {
          "title": "HTML creator master",
          "description": "App Link - https://technical-studio-develop-7a3b1.web.app/\n\n00:00 Intro\n00:08 Introducing to app\n\n\n-----------------------------------------------\nCopyright Disclaimer under Section 107 of the copyright act 1976, allowance is made for fair use for purposes such as criticism, comment, news reporting, scholarship, and research. Fair use is a use permitted by copyright statute that might otherwise be infringing. Non-profit, educational or personal use tips the balance in favour of fair use."
        }
      }
    }
  ],
  "pageInfo": {
    "totalResults": 1,
    "resultsPerPage": 1
  }
}

My Java code:

_youtube_data_request_listener = new RequestNetwork.RequestListener() {
            @Override
            public void onResponse(String _param1, String _param2, HashMap<String, Object> _param3) {
                final String _tag = _param1;
                final String _response = _param2;
                final HashMap<String, Object> _responseHeaders = _param3;

                /*
 = new Gson().fromJson("", new TypeToken<ArrayList<String>>(){}.getType());
*/
                _processdialog(false, "");
                ytData = new HashMap<>();
                ytData = new Gson().fromJson(_response, new TypeToken<HashMap<String, Object>>(){}.getType());
                title.setText(ytData.get("items")[].snippet.title);
                ytData.clear();
            }

            @Override
            public void onErrorResponse(String _param1, String _param2) {
                final String _tag = _param1;
                final String _message = _param2;
            }
        };

I want to get the value in title and set it in title textview.


问:
FileNotFoundError in python while trying to use an icon
I'm following a tutorial to make a PyGame game and when I change the icon, wich is in the same folder as my main.py, it says:

"Traceback (most recent call last):
File "c:\Users\maheg\Desktop\python garbage\PyGame\Space Invader\main.py", line 11, in
icon = pygame.image.load('kmt.png')
FileNotFoundError: No file 'kmt.png' found in working directory 'c:\Users\maheg\Desktop\python garbage'."

my folder where my files are located
My code

I didn't really try anything but I want python to display my 'kmt.png' as the icon of my application


问:
How to add reference for mongoose of many
I have three schemas - User, Community and User:

User:

```<code>export const UserSchema = new Schema<IUser>({
  address: { type: String, unique: true },
  name: String
}, { timestamps: true });

const UserModel = model<IUser>("User", UserSchema);
</code>```

Community:

```<code>const CommunitySchema = new Schema<ICommunity>({
  slug: { type: String, unique: true },
  name: String,
  description: String,
}, { timestamps: true });

</code>```

UserCommunity:

```<code>export const UserCommunitySchema = new Schema<IUserCommunity>({
  user: { type: Schema.Types.ObjectId, ref: "User" },
  community: { type: Schema.Types.ObjectId, ref: 'Community' },
  joinedAt: Date,
  leavedAt: Date,
  isActive: Boolean,
}, { timestamps: true });

const UserCommunityModel = model<IUserCommunity>("UserCommunity", UserCommunitySchema);
</code>```

User can be in many communities. I can access userCommunities well with the ref User and Community: userCommunity.user and userCommunity.community, but I couldn't make it work to add a reference to the userCommunity to the User neither Community.

I'd like to be able to do user.userCommunities or community.userCommunities but it didn't work even if I added the reference to both to the UserCommunity. I also tried the virtual property from mongoose.

Could you help me to achieve the goal?)

Body:
I have three schemas - User, Community and User:

User:

export const UserSchema = new Schema<IUser>({
  address: { type: String, unique: true },
  name: String
}, { timestamps: true });

const UserModel = model<IUser>("User", UserSchema);

Community:

const CommunitySchema = new Schema<ICommunity>({
  slug: { type: String, unique: true },
  name: String,
  description: String,
}, { timestamps: true });

UserCommunity:

export const UserCommunitySchema = new Schema<IUserCommunity>({
  user: { type: Schema.Types.ObjectId, ref: "User" },
  community: { type: Schema.Types.ObjectId, ref: 'Community' },
  joinedAt: Date,
  leavedAt: Date,
  isActive: Boolean,
}, { timestamps: true });

const UserCommunityModel = model<IUserCommunity>("UserCommunity", UserCommunitySchema);

User can be in many communities. I can access userCommunities well with the ref User and Community: userCommunity.user and userCommunity.community, but I couldn't make it work to add a reference to the userCommunity to the User neither Community.

I'd like to be able to do user.userCommunities or community.userCommunities but it didn't work even if I added the reference to both to the UserCommunity. I also tried the virtual property from mongoose.

Could you help me to achieve the goal?)


问:
Copying the icon of target file to its shortcut in Python
I'm a beginner at programming and recently started experimenting with creating shortcuts using python.
I know how to create a shortcut using win32com client but was wondering how to copy the same icon of the target file to its shortcut that is being created.

To illustrate, here is the code:

import win32com.client
path = r"D:\\meh.lnk"
target = r"D:\\Python\words.txt"
icon = r"" # i dont have any icon to attach here yet.
shell = win32com.client.Dispatch("WScript.Shell")
shortcut = shell.CreateShortCut(path)
shortcut.Targetpath = target
shortcut.IconLocation = icon

```

So I was wondering how I can set the path of the original target file's icon to the the icon
variable, to attach it to its shortcut, or some other way to achieve the same goal.

I haven't really tried anything yet because i dont know where to start, i did try to put the same path of the target file to the icon variable, but that did not work.

EDIT: Ok so, the solution to this is not to set the IconLocation manually, the icon is set automatically from the target file unless it is set manually.

Body:
I'm a beginner at programming and recently started experimenting with creating shortcuts using python.
I know how to create a shortcut using win32com client but was wondering how to copy the same icon of the target file to its shortcut that is being created.

To illustrate, here is the code:

import win32com.client
path = r"D:\\meh.lnk"
target = r"D:\\Python\words.txt"
icon = r"" # i dont have any icon to attach here yet.
shell = win32com.client.Dispatch("WScript.Shell")
shortcut = shell.CreateShortCut(path)
shortcut.Targetpath = target
shortcut.IconLocation = icon

So I was wondering how I can set the path of the original target file's icon to the the icon
variable, to attach it to its shortcut, or some other way to achieve the same goal.

I haven't really tried anything yet because i dont know where to start, i did try to put the same path of the target file to the icon variable, but that did not work.

EDIT: Ok so, the solution to this is not to set the IconLocation manually, the icon is set automatically from the target file unless it is set manually.


问:
Add connection string to configmap yaml
I need to connect a configmap file to an App Insight in Azure Devops. I have the connection string but I'm just not sure where to add it to connect a specific configmap file to the App Insights.

I tried following this https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-in-process-agent which helps me get to the point where I have the connection string but it seems like the step where I add the connection string isn't what I'm looking for specifically in that documentation.

Edit: I created a web.config file and added the conection string to it.

```<code><connectionStrings>
 <add  name="configmapConnectionString"
       connectionString=
       providerName="System.Data.SqlClient" />
</connectionStrings>
</code>```

All I need is how to add or refer to that connection string inside my configmap file

Title: Add connection string to configmap yaml

Body:
I need to connect a configmap file to an App Insight in Azure Devops. I have the connection string but I'm just not sure where to add it to connect a specific configmap file to the App Insights.

I tried following this https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-in-process-agent which helps me get to the point where I have the connection string but it seems like the step where I add the connection string isn't what I'm looking for specifically in that documentation.

Edit: I created a web.config file and added the conection string to it.

<connectionStrings>
 <add  name="configmapConnectionString"
       connectionString=
       providerName="System.Data.SqlClient" />
</connectionStrings>

All I need is how to add or refer to that connection string inside my configmap file


问:
React native I'm suffering this problem sometimes in react native and I couldn't find a solution yet
Sometimes this error appears

Error: Requiring unknown menter code hereodule "undefined". If you are sure the module exists, try restarting Metro. You may also want to run yarn or npm install., js engine: hermes
ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes`

my package.json

```<code>"dependencies": {
    "@react-native-firebase/analytics": "^14.9.3",
    "@react-native-firebase/app": "^14.9.3",
    "@react-native-firebase/crashlytics": "^14.9.3",
    "@react-native-firebase/messaging": "^14.9.3",
    "@react-navigation/bottom-tabs": "^6.5.2",
    "@react-navigation/drawer": "^6.5.6",
    "@react-navigation/native": "^6.0.16",
    "@react-navigation/stack": "^6.3.7",
    "@shopify/flash-list": "^1.4.0",
    "@shopify/restyle": "^2.1.0",
    "@testing-library/jest-native": "^5.3.1",
    "@testing-library/react-hooks": "^8.0.1",
    "@testing-library/react-native": "^11.5.0",
    "axios": "^1.2.1",
    "formik": "^2.2.9",
    "i18next": "^22.0.8",
    "jsc-android": "^294992.0.0",
    "lottie-ios": "3.2.3",
    "luxon": "^3.2.1",
    "react": "18.1.0",
    "react-i18next": "^12.0.0",
    "react-native": "0.70.6",
    "react-native-gesture-handler": "^2.8.0",
    "react-native-image-picker": "^4.10.3",
    "react-native-localize": "^2.2.4",
    "react-native-masked-text": "^1.13.0",
    "react-native-reanimated": "^2.13.0",
    "react-native-safe-area-context": "^4.3.1",
    "react-native-screens": "^3.18.2",
    "react-native-sensitive-info": "^5.5.8",
    "react-native-splash-screen": "^3.3.0",
    "react-native-svg": "^13.6.0",
    "react-native-tracking-transparency": "^0.1.2",
    "react-native-vector-icons": "^9.2.0",
    "react-native-view-pdf": "^0.14.0",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@commitlint/cli": "^17.3.0",
    "@commitlint/config-conventional": "^17.3.0",
    "@react-native-community/eslint-config": "^2.0.0",
    "@tsconfig/react-native": "^2.0.2",
    "@types/jest": "^26.0.23",
    "@types/luxon": "^3.2.0",
    "@types/react": "^18.0.21",
    "@types/react-native": "^0.70.6",
    "@types/react-native-vector-icons": "^6.4.12",
    "@types/react-test-renderer": "^18.0.0",
    "@typescript-eslint/eslint-plugin": "^5.37.0",
    "@typescript-eslint/eslint-plugin-tslint": "^5.46.0",
    "@typescript-eslint/parser": "^5.37.0",
    "babel-jest": "^26.6.3",
    "babel-plugin-module-resolver": "^4.1.0",
    "eslint": "^7.32.0",
    "eslint-config-airbnb-typescript": "^12.3.1",
    "eslint-plugin-eslint-comments": "^3.2.0",
    "eslint-plugin-flowtype": "^5.3.1",
    "eslint-plugin-import": "^2.25.2",
    "eslint-plugin-jest": "^24.1.9",
    "eslint-plugin-jsdoc": "^37.0.3",
    "eslint-plugin-jsx-a11y": "^6.4.1",
    "eslint-plugin-prefer-arrow": "^1.2.3",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-react": "^7.26.1",
    "eslint-plugin-react-hooks": "^4.2.0",
    "eslint-plugin-react-native": "^3.10.0",
    "eslint-plugin-security": "^1.4.0",
    "husky": "^8.0.0",
    "jest": "^26.6.3",
    "jest-circus": "^29.3.1",
    "jest-junit": "^15.0.0",
    "metro-react-native-babel-preset": "0.72.3",
    "react-native-svg-transformer": "^1.0.0",
    "react-test-renderer": "18.1.0",
    "typescript": "^4.8.3"
  }
</code>```

I still couldn't find solutions to this problem, I already tried to map it in the flipper but the same log appears

Body:
Sometimes this error appears

Error: Requiring unknown menter code hereodule "undefined". If you are sure the module exists, try restarting Metro. You may also want to run yarn or npm install., js engine: hermes
ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes`

my package.json

"dependencies": {
    "@react-native-firebase/analytics": "^14.9.3",
    "@react-native-firebase/app": "^14.9.3",
    "@react-native-firebase/crashlytics": "^14.9.3",
    "@react-native-firebase/messaging": "^14.9.3",
    "@react-navigation/bottom-tabs": "^6.5.2",
    "@react-navigation/drawer": "^6.5.6",
    "@react-navigation/native": "^6.0.16",
    "@react-navigation/stack": "^6.3.7",
    "@shopify/flash-list": "^1.4.0",
    "@shopify/restyle": "^2.1.0",
    "@testing-library/jest-native": "^5.3.1",
    "@testing-library/react-hooks": "^8.0.1",
    "@testing-library/react-native": "^11.5.0",
    "axios": "^1.2.1",
    "formik": "^2.2.9",
    "i18next": "^22.0.8",
    "jsc-android": "^294992.0.0",
    "lottie-ios": "3.2.3",
    "luxon": "^3.2.1",
    "react": "18.1.0",
    "react-i18next": "^12.0.0",
    "react-native": "0.70.6",
    "react-native-gesture-handler": "^2.8.0",
    "react-native-image-picker": "^4.10.3",
    "react-native-localize": "^2.2.4",
    "react-native-masked-text": "^1.13.0",
    "react-native-reanimated": "^2.13.0",
    "react-native-safe-area-context": "^4.3.1",
    "react-native-screens": "^3.18.2",
    "react-native-sensitive-info": "^5.5.8",
    "react-native-splash-screen": "^3.3.0",
    "react-native-svg": "^13.6.0",
    "react-native-tracking-transparency": "^0.1.2",
    "react-native-vector-icons": "^9.2.0",
    "react-native-view-pdf": "^0.14.0",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@commitlint/cli": "^17.3.0",
    "@commitlint/config-conventional": "^17.3.0",
    "@react-native-community/eslint-config": "^2.0.0",
    "@tsconfig/react-native": "^2.0.2",
    "@types/jest": "^26.0.23",
    "@types/luxon": "^3.2.0",
    "@types/react": "^18.0.21",
    "@types/react-native": "^0.70.6",
    "@types/react-native-vector-icons": "^6.4.12",
    "@types/react-test-renderer": "^18.0.0",
    "@typescript-eslint/eslint-plugin": "^5.37.0",
    "@typescript-eslint/eslint-plugin-tslint": "^5.46.0",
    "@typescript-eslint/parser": "^5.37.0",
    "babel-jest": "^26.6.3",
    "babel-plugin-module-resolver": "^4.1.0",
    "eslint": "^7.32.0",
    "eslint-config-airbnb-typescript": "^12.3.1",
    "eslint-plugin-eslint-comments": "^3.2.0",
    "eslint-plugin-flowtype": "^5.3.1",
    "eslint-plugin-import": "^2.25.2",
    "eslint-plugin-jest": "^24.1.9",
    "eslint-plugin-jsdoc": "^37.0.3",
    "eslint-plugin-jsx-a11y": "^6.4.1",
    "eslint-plugin-prefer-arrow": "^1.2.3",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-react": "^7.26.1",
    "eslint-plugin-react-hooks": "^4.2.0",
    "eslint-plugin-react-native": "^3.10.0",
    "eslint-plugin-security": "^1.4.0",
    "husky": "^8.0.0",
    "jest": "^26.6.3",
    "jest-circus": "^29.3.1",
    "jest-junit": "^15.0.0",
    "metro-react-native-babel-preset": "0.72.3",
    "react-native-svg-transformer": "^1.0.0",
    "react-test-renderer": "18.1.0",
    "typescript": "^4.8.3"
  }

I still couldn't find solutions to this problem, I already tried to map it in the flipper but the same log appears


问:
Display map tiles over a map in power bi or another application
I am looking to display map tiles over a map inside of a boundary box at exact coordinates.
I can display images at coordinates in power bi but they do not change size when zooming in and out.
Does anyone know how to do this? I have looked into azure maps a little but it seems I need to either use or setup a tile service to do this?
At the moment I just have my images in blob storage and wondering whether this is possible in powerbi or if someone has another solution?

I have looked into Tableau but I was informed that cannot display images from urls.

I have also looked into grafana but it seems for that I need to setup a tile server.

I am wondering if this is possible without those things.


问:
create a conditional base on switch value
If the switch is checked I want one  R.drawable if not I want another, could you help me, please?

I'm using a data base, viewmodel, room. I just don't know how to properly write the conditional

```<code>@Composable
fun PetCard(userInfo: PetEntity, mPetViewModel: PetViewModel) {
    Card(
        shape = MaterialTheme.shapes.large,
        elevation = 5.dp,
        backgroundColor= MaterialTheme.colorScheme.primary,
        modifier = Modifier
            .width(195.dp)
            .padding(5.dp)
            .fillMaxSize()
    ) {
        Image(painter = if (userInfo.vPetsSpecies != null) {
            painterResource(id = R.drawable.pet_cat)
        } else {
            painterResource(id = R.drawable.pet_dog)
        },
            contentDescription = "Pet",
            contentScale = ContentScale.FillBounds,
            modifier = Modifier
                .fillMaxSize()
        )
        Text(text = userInfo.vPetName,
            modifier = Modifier
                .padding(10.dp),
            color = MaterialTheme.colorScheme.onPrimary,
            style = MaterialTheme.typography.headlineMedium,
            textAlign= TextAlign.Left
        )
    }
}
</code>```

Body:
If the switch is checked I want one  R.drawable if not I want another, could you help me, please?

I'm using a data base, viewmodel, room. I just don't know how to properly write the conditional

@Composable
fun PetCard(userInfo: PetEntity, mPetViewModel: PetViewModel) {
    Card(
        shape = MaterialTheme.shapes.large,
        elevation = 5.dp,
        backgroundColor= MaterialTheme.colorScheme.primary,
        modifier = Modifier
            .width(195.dp)
            .padding(5.dp)
            .fillMaxSize()
    ) {
        Image(painter = if (userInfo.vPetsSpecies != null) {
            painterResource(id = R.drawable.pet_cat)
        } else {
            painterResource(id = R.drawable.pet_dog)
        },
            contentDescription = "Pet",
            contentScale = ContentScale.FillBounds,
            modifier = Modifier
                .fillMaxSize()
        )
        Text(text = userInfo.vPetName,
            modifier = Modifier
                .padding(10.dp),
            color = MaterialTheme.colorScheme.onPrimary,
            style = MaterialTheme.typography.headlineMedium,
            textAlign= TextAlign.Left
        )
    }
}


问:
How to fix a SQL Server function that is used millions of times and regenerating in the query plan
I have a SQL Server function (see fn_TestBinaryBitwiseOr below) with millions of executions. While this is anticipated, SQL Server has an expensive query report that says:

There have been multiple executions of this query pattern (query
hash), but all of the executions are generating the same query plan
(query plan hash).  This wastes CPU time to compile the query plans
and memory to cache them.  To improve overall SQL Server performance,
consider parameterizing this query (via the application, template plan
guide, or forced parameterization). Refer to Books Online for more
information on parameterization.

I am pretty sure I am hitting RedFlag #1 from https://eitanblumin.com/2022/08/25/too-many-plans-for-the-same-query-hash/ but still not sure what I can do in my case. I cannot use a stored procedure because it is used in another function in a select and has the output. I haven't gone to forced parameterization due to some of the downsides but may look into that next.

Is it possible to change fn_TestBinaryBitwiseOr below to a parameterized procedure? Is there a different solution to test.

```<code>CREATE OR ALTER FUNCTION[dbo].[fn_TestBinaryBitwiseOr]
    (@TestFlags1 binary(16),
     @TestFlags2 binary(16))
RETURNS binary(16)
AS
BEGIN
    RETURN (SELECT TOP(1)
                          CASE
                              WHEN @TestFlags1 IS NULL AND @TestFlags2 IS NULL
                                  THEN 0x0
                              WHEN @TestFlags1 IS NULL
                                  THEN @TestFlags2
                              WHEN @TestFlags2 IS NULL
                                  THEN @TestFlags1
                              ELSE
                                  CONVERT(binary(16), CONVERT(binary(4), (SUBSTRING(@TestFlags2, 1, 4) | CONVERT(bigint, SUBSTRING(@TestFlags1, 1, 4)))) +
                                                      CONVERT(binary(4), (SUBSTRING(@TestFlags2, 5, 4) | CONVERT(bigint, SUBSTRING(@TestFlags1, 5, 4)))) +
                                                      CONVERT(binary(4), (SUBSTRING(@TestFlags2, 9, 4) | CONVERT(bigint, SUBSTRING(@TestFlags1,9,4)))) +
                                                      CONVERT(binary(4), (SUBSTRING(@TestFlags2, 13, 4) | CONVERT(bigint, SUBSTRING(@TestFlags1, 13, 4))))
                )
            END
        )
END
GO

-- another function to call my first function,
CREATE OR ALTER FUNCTION[dbo].[DoAThing]()
RETURNS @T TABLE(ColName binary(16))
AS
BEGIN
    -- sample data
    DECLARE  @Table1 TABLE (id int, binary1 binary(16))
    DECLARE  @Table2 TABLE(table1Id int, binary2 binary(16))

    INSERT INTO @Table1
    VALUES (1, 0x10000000000000000000000000000A01),
           (2, 0x00000000000000000000000000000101)

    INSERT INTO @Table2
    VALUES (1, 0x00000000000000000000000000000100),
           (2, 0x00000000000000000000000000000100)

    -- using a function from a function
    INSERT INTO @T(ColName)
        (SELECT [dbo].[fn_TestBinaryBitwiseOr](t1.binary1, t2.binary2) AS result
         FROM @Table1 t1
         JOIN @Table2 t2 ON t1.id = t2.table1Id)
    RETURN
END
GO

--executing
SELECT * FROM [dbo].[DoAThing]()
</code>```

Body:
I have a SQL Server function (see fn_TestBinaryBitwiseOr below) with millions of executions. While this is anticipated, SQL Server has an expensive query report that says:

There have been multiple executions of this query pattern (query
hash), but all of the executions are generating the same query plan
(query plan hash).  This wastes CPU time to compile the query plans
and memory to cache them.  To improve overall SQL Server performance,
consider parameterizing this query (via the application, template plan
guide, or forced parameterization). Refer to Books Online for more
information on parameterization.

I am pretty sure I am hitting RedFlag #1 from https://eitanblumin.com/2022/08/25/too-many-plans-for-the-same-query-hash/ but still not sure what I can do in my case. I cannot use a stored procedure because it is used in another function in a select and has the output. I haven't gone to forced parameterization due to some of the downsides but may look into that next.

Is it possible to change fn_TestBinaryBitwiseOr below to a parameterized procedure? Is there a different solution to test.

CREATE OR ALTER FUNCTION[dbo].[fn_TestBinaryBitwiseOr]
    (@TestFlags1 binary(16),
     @TestFlags2 binary(16))
RETURNS binary(16)
AS
BEGIN
    RETURN (SELECT TOP(1)
                          CASE
                              WHEN @TestFlags1 IS NULL AND @TestFlags2 IS NULL
                                  THEN 0x0
                              WHEN @TestFlags1 IS NULL
                                  THEN @TestFlags2
                              WHEN @TestFlags2 IS NULL
                                  THEN @TestFlags1
                              ELSE
                                  CONVERT(binary(16), CONVERT(binary(4), (SUBSTRING(@TestFlags2, 1, 4) | CONVERT(bigint, SUBSTRING(@TestFlags1, 1, 4)))) +
                                                      CONVERT(binary(4), (SUBSTRING(@TestFlags2, 5, 4) | CONVERT(bigint, SUBSTRING(@TestFlags1, 5, 4)))) +
                                                      CONVERT(binary(4), (SUBSTRING(@TestFlags2, 9, 4) | CONVERT(bigint, SUBSTRING(@TestFlags1,9,4)))) +
                                                      CONVERT(binary(4), (SUBSTRING(@TestFlags2, 13, 4) | CONVERT(bigint, SUBSTRING(@TestFlags1, 13, 4))))
                )
            END
        )
END
GO

-- another function to call my first function,
CREATE OR ALTER FUNCTION[dbo].[DoAThing]()
RETURNS @T TABLE(ColName binary(16))
AS
BEGIN
    -- sample data
    DECLARE  @Table1 TABLE (id int, binary1 binary(16))
    DECLARE  @Table2 TABLE(table1Id int, binary2 binary(16))

    INSERT INTO @Table1
    VALUES (1, 0x10000000000000000000000000000A01),
           (2, 0x00000000000000000000000000000101)

    INSERT INTO @Table2
    VALUES (1, 0x00000000000000000000000000000100),
           (2, 0x00000000000000000000000000000100)

    -- using a function from a function
    INSERT INTO @T(ColName)
        (SELECT [dbo].[fn_TestBinaryBitwiseOr](t1.binary1, t2.binary2) AS result
         FROM @Table1 t1
         JOIN @Table2 t2 ON t1.id = t2.table1Id)
    RETURN
END
GO

--executing
SELECT * FROM [dbo].[DoAThing]()


问:
How to configure celery on amazon linux 2?
I tried several ways to configure a celery worker service to run on beanstalk amazon linux 2, I followed this tutorial, however it doesn't work for me, I got the following error:

Failed at step EXEC spawning /var/app/current:$PYTHONPATH/celery: No such file or directory

This my 01_create_service_celery.sh:

```<code>#!/usr/bin/env bash

# Create the celery systemd service file
echo "[Unit]

Description=Celery service for __
After=network.target

[Service]
Type=simple
Restart=always
RestartSec=30
User=root
WorkingDirectory=/var/app/current
ExecStart=$PYTHONPATH/celery -A notifications worker --loglevel=INFO
ExecReload=$PYTHONPATH/celery -A notifications worker --loglevel=INFO
EnvironmentFile=/opt/elasticbeanstalk/deployment/env
[Install]
WantedBy=multi-user.target
" | tee /etc/systemd/system/celery.service

# Start celery service
systemctl start celery.service

# Enable celery service to load on system start
systemctl enable celery.service
</code>```

Body:
I tried several ways to configure a celery worker service to run on beanstalk amazon linux 2, I followed this tutorial, however it doesn't work for me, I got the following error:

Failed at step EXEC spawning /var/app/current:$PYTHONPATH/celery: No such file or directory

This my 01_create_service_celery.sh:

#!/usr/bin/env bash

# Create the celery systemd service file
echo "[Unit]

Description=Celery service for __
After=network.target

[Service]
Type=simple
Restart=always
RestartSec=30
User=root
WorkingDirectory=/var/app/current
ExecStart=$PYTHONPATH/celery -A notifications worker --loglevel=INFO
ExecReload=$PYTHONPATH/celery -A notifications worker --loglevel=INFO
EnvironmentFile=/opt/elasticbeanstalk/deployment/env
[Install]
WantedBy=multi-user.target
" | tee /etc/systemd/system/celery.service

# Start celery service
systemctl start celery.service

# Enable celery service to load on system start
systemctl enable celery.service


问:
How to do an Exploratory Factor Analysis on data tha some variables are ordinal and others dichotomous in R?
I am trying to do an exploratory factor analysis using a data set that contains items from questionnaires. Some questions were answered and have 4 levels and some had only two. However I am not sure what is the implementation in R when using both types of variables.

I have seen that psych is a good toolbox and have used the ordinal and dichotomous items separately well, but I am not sure how to combine both. The tetrachoric or polyphoric function does not seem to work for example when I am using both data types together.

My code as it stands is this:

```<code>poly_cor = polychoric(data)
rho = poly_cor$rho
cor.plot(rho, numbers=T, upper=FALSE, main = "Polychoric Correlation", show.legend = FALSE)
fa.parallel(data, fm="pa", fa="fa", main = "Scree Plot")
poly_model = fa(data, nfactor=4, cor="poly", fm="mle", rotate = "oblimin")
</code>```

However the polychoric functions says that there is not an equal number of response alternatives.

Body:
I am trying to do an exploratory factor analysis using a data set that contains items from questionnaires. Some questions were answered and have 4 levels and some had only two. However I am not sure what is the implementation in R when using both types of variables.

I have seen that psych is a good toolbox and have used the ordinal and dichotomous items separately well, but I am not sure how to combine both. The tetrachoric or polyphoric function does not seem to work for example when I am using both data types together.

My code as it stands is this:

poly_cor = polychoric(data)
rho = poly_cor$rho
cor.plot(rho, numbers=T, upper=FALSE, main = "Polychoric Correlation", show.legend = FALSE)
fa.parallel(data, fm="pa", fa="fa", main = "Scree Plot")
poly_model = fa(data, nfactor=4, cor="poly", fm="mle", rotate = "oblimin")

However the polychoric functions says that there is not an equal number of response alternatives.


问:
Hi I want to display a positive negative value graph in apex chart , I want 2 individual color like green for positive and red for negative
How to display 2 bar color, attached the image.

I tried giving a loop then if the condition inside the loop but only for the first value is the color set not for the remaining values (apex chart).

```<code>colors: [function() {
  for (var i in chartdata ) {
     if(chartdata[i]>1){
     console.log("positive")
     // setPostiveColor("#0000FF")
     return '#7E36AF'
   } else if(chartdata[i]<0){
     console.log("negative",chartdata[i])
     return '#D9534F'
 }
}
</code>```

Body:
How to display 2 bar color, attached the image.

I tried giving a loop then if the condition inside the loop but only for the first value is the color set not for the remaining values (apex chart).

colors: [function() {
  for (var i in chartdata ) {
     if(chartdata[i]>1){
     console.log("positive")
     // setPostiveColor("#0000FF")
     return '#7E36AF'
   } else if(chartdata[i]<0){
     console.log("negative",chartdata[i])
     return '#D9534F'
 }
}


问:
Element won't load in puppeteer chromium, but does in firefox nightly
In a front heavy webpage, a div element won't load for puppeteer's chromium no matter how long I wait, but will in Firefox Nightly.

Said element loads in two phases that I can tell. First it loads the wrapper, and the interior content shows "loading...". After a beat, it should load its content. However, when using standard puppeteer, it hangs at "loading..."

Partially loaded:

```<code><div class="WavePlayer"><div class="jss20 jss22"><div class="MuiCircularProgress-root MuiCircularProgress-colorPrimary MuiCircularProgress-indeterminate" role="progressbar" style="width: 20px; height: 20px; color: rgb(0, 90, 80);"><svg class="MuiCircularProgress-svg" viewBox="22 22 44 44"><circle class="MuiCircularProgress-circle MuiCircularProgress-circleIndeterminate" cx="44" cy="44" r="20.2" fill="none" stroke-width="3.6"></circle></svg></div><span class="jss21">Loading audio...</span></div><div class="WavePlayer__wavewrap loading"><wave style="display: block; position: relative; user-select: none; height: 128px; width: 100%; overflow: auto hidden;"><wave style="position: absolute; z-index: 3; left: 0px; top: 0px; bottom: 0px; overflow: hidden; width: 0px; display: none; box-sizing: border-box; border-right: 1px solid transparent; pointer-events: none;"><canvas style="position: absolute; left: 0px; top: 0px; bottom: 0px; height: 100%;"></canvas></wave><canvas style="position: absolute; z-index: 2; left: 0px; top: 0px; bottom: 0px; height: 100%; pointer-events: none;"></canvas></wave></div></div>
</code>```

Fully loaded:

```<code><div class="WavePlayer">
  <div class="WavePlayer__wavewrap">
    <wave style="display: block; position: relative; user-select: none; height: 128px; overflow: auto hidden;">
      <wave style="position: absolute; z-index: 3; left: 0px; top: 0px; bottom: 0px; overflow: hidden; width: 0px; display: block; box-sizing: border-box; border-right: 1px solid transparent; pointer-events: none;">
        <canvas style="position: absolute; left: 0px; top: 0px; bottom: 0px; height: 100%; width: 806px;" width="806" height="128">
        </canvas>
      </wave>
      <canvas style="position: absolute; z-index: 2; left: 0px; top: 0px; bottom: 0px; height: 100%; pointer-events: none; width: 806px;" width="806" height="128">
      </canvas>
    </wave>
  </div>
<div>
</code>```

Either I use a wait for selection like

```<code>await page2.waitForSelector('div[class="WavePlayer__highlight"]');
</code>```

(there's a bunch of WavePlayer__highlight elements when it's fully loaded that I didn't bother copying)

Or a manual delay like
delay(10000)
which is defined as

```<code>function delay(time) {
    return new Promise(function(resolve) {
        setTimeout(resolve, time)
    });
 }
</code>```

However, I feel either line is not too relevant because the issue happens regardless of code, since it's about the webpage itself not loading an element even when debugging, but again, it does load in Firefox. Putting a waitForNavigation right after going to this url will not wait for the WavePlayer element to fully load. Neither does using await page.goto(URL_VIDEO, {waitUntil: 'networkidle2', timeout: 0});

I am guessing WavePlayer is a premade tool made with Web Audio API and HTML5 canvas. I could find a few WavePlayers googling around, but I don't know which one is the exact one.

I'm obviously able to screencap it because I'm launching puppeteer with headless=false. However, the same timeout happens at the same spot in headless mode. Given it loads in puppeteer's firefox, I would happily go with it, but other basic commands I use break with firefox. I assume it's because it's still an experimental build, and not puppeteer's core mission anyway.

The element loads correctly under desktop Firefox, Chrome, Chromium and Brave under Ubuntu 22.04.1 LTS. I cannot share the webpage URL since it's a paid online service. For those curious, it's amberscript.com

Body:
In a front heavy webpage, a div element won't load for puppeteer's chromium no matter how long I wait, but will in Firefox Nightly.

Said element loads in two phases that I can tell. First it loads the wrapper, and the interior content shows "loading...". After a beat, it should load its content. However, when using standard puppeteer, it hangs at "loading..."

Partially loaded:

<svg class="MuiCircularProgress-svg" viewBox="22 22 44 44"><circle class="MuiCircularProgress-circle MuiCircularProgress-circleIndeterminate" cx="44" cy="44" r="20.2" fill="none" stroke-width="3.6"></circle></svg>
Loading audio...

<wave style="display: block; position: relative; user-select: none; height: 128px; width: 100%; overflow: auto hidden;"><wave style="position: absolute; z-index: 3; left: 0px; top: 0px; bottom: 0px; overflow: hidden; width: 0px; display: none; box-sizing: border-box; border-right: 1px solid transparent; pointer-events: none;"><canvas style="position: absolute; left: 0px; top: 0px; bottom: 0px; height: 100%;"></canvas></wave><canvas style="position: absolute; z-index: 2; left: 0px; top: 0px; bottom: 0px; height: 100%; pointer-events: none;"></canvas></wave>

Fully loaded:

    <wave style="display: block; position: relative; user-select: none; height: 128px; overflow: auto hidden;">
      <wave style="position: absolute; z-index: 3; left: 0px; top: 0px; bottom: 0px; overflow: hidden; width: 0px; display: block; box-sizing: border-box; border-right: 1px solid transparent; pointer-events: none;">
        <canvas style="position: absolute; left: 0px; top: 0px; bottom: 0px; height: 100%; width: 806px;" width="806" height="128">
        </canvas>
      </wave>
      <canvas style="position: absolute; z-index: 2; left: 0px; top: 0px; bottom: 0px; height: 100%; pointer-events: none; width: 806px;" width="806" height="128">
      </canvas>
    </wave>

Either I use a wait for selection like

await page2.waitForSelector('div[class="WavePlayer__highlight"]');

(there's a bunch of WavePlayer__highlight elements when it's fully loaded that I didn't bother copying)

Or a manual delay like
delay(10000)
which is defined as

function delay(time) {
    return new Promise(function(resolve) {
        setTimeout(resolve, time)
    });
 }

However, I feel either line is not too relevant because the issue happens regardless of code, since it's about the webpage itself not loading an element even when debugging, but again, it does load in Firefox. Putting a waitForNavigation right after going to this url will not wait for the WavePlayer element to fully load. Neither does using await page.goto(URL_VIDEO, {waitUntil: 'networkidle2', timeout: 0});

I am guessing WavePlayer is a premade tool made with Web Audio API and HTML5 canvas. I could find a few WavePlayers googling around, but I don't know which one is the exact one.

I'm obviously able to screencap it because I'm launching puppeteer with headless=false. However, the same timeout happens at the same spot in headless mode. Given it loads in puppeteer's firefox, I would happily go with it, but other basic commands I use break with firefox. I assume it's because it's still an experimental build, and not puppeteer's core mission anyway.

The element loads correctly under desktop Firefox, Chrome, Chromium and Brave under Ubuntu 22.04.1 LTS. I cannot share the webpage URL since it's a paid online service. For those curious, it's amberscript.com


问:
How to make jhipster react-js validateField select dropdown filterable?
I have a small Jhipster-generated application. And the application frontend client is React.

The application has a relationship with another entity and on create/update page there's a select dropdown option. Jhipster used <ValidatedForm> <\ValidatedForm> for Form and ValidateField for input fields. I have this following dropdown select and I need the option to make it filterable. If I use React-Select or any other type of field then I cannot seem to make it work with the <ValidateForm>. How can I make this select field searchable/filterable?

Here's the code:

```<code><ValidatedField id="recruitment-jobCircular" name="jobCircular" data-cy="jobCircular" label="Position" type="select" validate={{
    required: { value: true, message: 'This field is required.' },
    }}>
    <option value="" key="0" />
    { jobCirculars ? jobCirculars.map(otherEntity => (
     <option value={otherEntity.id} key={otherEntity.id}>
    {otherEntity.title}
    </option>
    ))
  : null}
</ValidatedField>
</code>```

Body:
I have a small Jhipster-generated application. And the application frontend client is React.

The application has a relationship with another entity and on create/update page there's a select dropdown option. Jhipster used <ValidatedForm> <\ValidatedForm> for Form and ValidateField for input fields. I have this following dropdown select and I need the option to make it filterable. If I use React-Select or any other type of field then I cannot seem to make it work with the <ValidateForm>. How can I make this select field searchable/filterable?

Here's the code:

<ValidatedField id="recruitment-jobCircular" name="jobCircular" data-cy="jobCircular" label="Position" type="select" validate={{
    required: { value: true, message: 'This field is required.' },
    }}>
    <option value="" key="0" />
    { jobCirculars ? jobCirculars.map(otherEntity => (
     <option value={otherEntity.id} key={otherEntity.id}>
    {otherEntity.title}
    </option>
    ))
  : null}
</ValidatedField>


问:
Counting number of words on each page in Word Document
I'm attempting to write a macro in Word that inserts a marker at the beginning of each page in tiny font so it doesn't bump any text forward to the next page. (I then output the document to HTML and do some additional processing of the markers there in Javascript.)

I have basically figured out the script to do that:

```<code>Sub Test()

    Dim PageCounter As Long
    Dim FirstPageInput As String
    Dim PageFirstWordRange As Range
    Dim InsertWord As String

    FirstPageInput = InputBox("What is the initial page number for this article?", "First Page Number?")

    For PageCounter = 1 To ActiveDocument.BuiltInDocumentProperties("Number of Pages")

        Set PageFirstWordRange = ActiveDocument.Range.GoTo(wdGoToPage, wdGoToAbsolute, PageCounter)

        'If this is the first page, add the initial page number. Otherwise, just insert a marker.'
        If PageCounter = 1 Then
            InsertWord = "!@" + FirstPageInput + "@! "
            PageFirstWordRange.InsertBefore (InsertWord)
        Else
            'PageFirstWordRange.MoveEnd wdCharacter, -1'
            InsertWord = " !@@! "
            PageFirstWordRange.InsertAfter (InsertWord)
        End If

        'Select the word we just inserted, and change its size to 1'
        With PageFirstWordRange.Font
            .Size = 1
        End With

    Next
End Sub
</code>```

The issue is that there are sometimes pages and pages filled up with footnotes. Because the script tries to find the first word on each page, it ends up skipping these footnote pages (not writing a marker for them) and I need the script to do that.

The solution I've decided is to count the words on each page as I iterate. If there are any pages with 0 text (not including the footnotes) then I will add an additional marker for each blank page.

I have no idea how to do this - I'm so bad with VBA. Does anyone have a solution for me? This feels like an easy thing to do, but I'm pulling my hair out!

Body:
I'm attempting to write a macro in Word that inserts a marker at the beginning of each page in tiny font so it doesn't bump any text forward to the next page. (I then output the document to HTML and do some additional processing of the markers there in Javascript.)

I have basically figured out the script to do that:

Sub Test()

    Dim PageCounter As Long
    Dim FirstPageInput As String
    Dim PageFirstWordRange As Range
    Dim InsertWord As String

    FirstPageInput = InputBox("What is the initial page number for this article?", "First Page Number?")

    For PageCounter = 1 To ActiveDocument.BuiltInDocumentProperties("Number of Pages")

        Set PageFirstWordRange = ActiveDocument.Range.GoTo(wdGoToPage, wdGoToAbsolute, PageCounter)

        'If this is the first page, add the initial page number. Otherwise, just insert a marker.'
        If PageCounter = 1 Then
            InsertWord = "!@" + FirstPageInput + "@! "
            PageFirstWordRange.InsertBefore (InsertWord)
        Else
            'PageFirstWordRange.MoveEnd wdCharacter, -1'
            InsertWord = " !@@! "
            PageFirstWordRange.InsertAfter (InsertWord)
        End If

        'Select the word we just inserted, and change its size to 1'
        With PageFirstWordRange.Font
            .Size = 1
        End With

    Next
End Sub

The issue is that there are sometimes pages and pages filled up with footnotes. Because the script tries to find the first word on each page, it ends up skipping these footnote pages (not writing a marker for them) and I need the script to do that.

The solution I've decided is to count the words on each page as I iterate. If there are any pages with 0 text (not including the footnotes) then I will add an additional marker for each blank page.

I have no idea how to do this - I'm so bad with VBA. Does anyone have a solution for me? This feels like an easy thing to do, but I'm pulling my hair out!


问:
Nuget API to get all listed packages
I'm using the following endpoint to get the versions of a given package:

https://api.nuget.org/v3-flatcontainer/$PackageId/index.json

The problem is that it lists all versions of the package, and I need only the ones that are not unlisted.

I tried to look in the documentation but could not find it. Is there any way to get this information using the API?

Title: Nuget API to get all listed packages


问:
Cron job is not creating logs after running jar in Java
I run a cron job in Linux with jar files that executed successfully but the log file is not created.</p>
```<code>*/10 * * * * java -jar /home/rrs/app.jar
</code>```

Body:
I run a cron job in Linux with jar files that executed successfully but the log file is not created.

*/10 * * * * java -jar /home/rrs/app.jar


问:
Stop power saver mode from disabling accessibility settings
Using local adb shell, I was able to modify battery_saver_constants.
it didn't do the need though

```<code>    advertise_is_enabled=true,datasaver_disabled=false,enable_night_mode=true,launch_boost_disabled=true,vibration_disabled=true,animation_disabled=true,soundtrigger_disabled=true,fullbackup_deferred=true,keyvaluebackup_deferred=true,firewall_disabled=true,gps_mode=2,adjust_brightness_disabled=false,adjust_brightness_factor=0.5,

force_all_apps_standby=false,force_background_check=false,

optional_sensors_disabled=true,aod_disabled=true,quick_doze_enabled=true
</code>```

these are my modifications, Is there any way to stop switching accessibility settings off?

Body:
Using local adb shell, I was able to modify battery_saver_constants.
it didn't do the need though

    advertise_is_enabled=true,datasaver_disabled=false,enable_night_mode=true,launch_boost_disabled=true,vibration_disabled=true,animation_disabled=true,soundtrigger_disabled=true,fullbackup_deferred=true,keyvaluebackup_deferred=true,firewall_disabled=true,gps_mode=2,adjust_brightness_disabled=false,adjust_brightness_factor=0.5,

force_all_apps_standby=false,force_background_check=false,

optional_sensors_disabled=true,aod_disabled=true,quick_doze_enabled=true

these are my modifications, Is there any way to stop switching accessibility settings off?


问:
What is the quickest way to collapse cells that are the same word but capitalized differently?
I have a variable that looks like this:

```<code>> dput(df$value)
c("Positive", "Negative", "Negative", "Negative", "Negative",
"Negative", "Negative", "negative", "Negative", "Negative", "NEGATIVE",
"Negative", "Negative", "Positive", "POSITIVE", "Negative", "Negative")
</code>```

I want to group the Negative, negative, and NEGATIVE together

and also group the POSITIVE and Positive together.

What is a quick way to do this?

Body:
I have a variable that looks like this:

> dput(df$value)
c("Positive", "Negative", "Negative", "Negative", "Negative",
"Negative", "Negative", "negative", "Negative", "Negative", "NEGATIVE",
"Negative", "Negative", "Positive", "POSITIVE", "Negative", "Negative")

I want to group the Negative, negative, and NEGATIVE together

and also group the POSITIVE and Positive together.

What is a quick way to do this?


问:
How to create requirements.txt using "make" commands?
I would like to create a requirements_all.txt file using make commands. I am using Anaconda.

I have tried the following but none have worked as intended.

```<code>requirements_all.txt:
    conda list --export
</code>```

This displays all of the packages I have installed in the terminal window, and does not create requirements_all.txt.

```<code>requirements_all.txt:
    @echo conda list --export
</code>```

This displays @echo conda list --export in the terminal window, and does not create requirements_all.txt.

```<code>requirements_all.txt:
    @echo conda list --export > requirements_all.txt
</code>```

This created a file called requirements_all.txt containing conda list --export.

Body:
I would like to create a requirements_all.txt file using make commands. I am using Anaconda.

I have tried the following but none have worked as intended.

requirements_all.txt:
    conda list --export

This displays all of the packages I have installed in the terminal window, and does not create requirements_all.txt.

requirements_all.txt:
    @echo conda list --export

This displays @echo conda list --export in the terminal window, and does not create requirements_all.txt.

requirements_all.txt:
    @echo conda list --export > requirements_all.txt

This created a file called requirements_all.txt containing conda list --export.


问:
StoreKit how to test originalAppVersion
I'm trying to check the original app version that the user installed so they can have unlocked premium features without paying twice.

In StoreKit for iOS 16 there's an "originalAppVersion" property on a transaction:
https://developer.apple.com/documentation/storekit/apptransaction/3954447-originalappversion?changes=_8_2

Unfortunately this, and the "appVersion" property in development both return "1".

I was expecting a string of the form "1.0.5".

Do I need to do something different?

Title: StoreKit how to test originalAppVersion


问:
"Geodatabase field exists: fid" loading shape file
I'm attempting to create a feature layer in ARC GIS using a shape file but I'm getting the following exception when trying to open the shape file with ShapefileFeatureTable.OpenAsync

{"Geodatabase field exists: fid"}

```<code>var shapeFileFeatureTable = ShapefileFeatureTable.OpenAsync(@"...\myshape.shp").Result;

           fl = new FeatureLayer(shapeFileFeatureTable)
            {
                // Set the rendering mode of the feature layer to be dynamic (needed for extrusion to work).
                RenderingMode = FeatureRenderingMode.Dynamic,
                IsVisible = true,
            };
</code>```

Body:
I'm attempting to create a feature layer in ARC GIS using a shape file but I'm getting the following exception when trying to open the shape file with ShapefileFeatureTable.OpenAsync

{"Geodatabase field exists: fid"}

var shapeFileFeatureTable = ShapefileFeatureTable.OpenAsync(@"...\myshape.shp").Result;

           fl = new FeatureLayer(shapeFileFeatureTable)
            {
                // Set the rendering mode of the feature layer to be dynamic (needed for extrusion to work).
                RenderingMode = FeatureRenderingMode.Dynamic,
                IsVisible = true,
            };