问:
What options are required in a _config.yml file to run a GitHub Page?
```<code>Run actions/jekyll-build-pages@v1
/usr/bin/docker run --name ghcrioactionsjekyllbuildpagesv104_2d9e9e --label 290506 --workdir /github/workspace --rm -e "INPUT_SOURCE" -e "INPUT_DESTINATION" -e "INPUT_FUTURE" -e "INPUT_BUILD_REVISION" -e "INPUT_VERBOSE" -e "INPUT_TOKEN" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_ID_TOKEN_REQUEST_URL" -e "ACTIONS_ID_TOKEN_REQUEST_TOKEN" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/luciennee.github.io/luciennee.github.io":"/github/workspace" ghcr.io/actions/jekyll-build-pages:v1.0.4
  Logging at level: debug
Configuration file: /github/workspace/./_config.yml
      GitHub Pages: github-pages v227
      GitHub Pages: jekyll v3.9.2
             Theme: jekyll-theme-primer
      Theme source: /usr/local/bundle/gems/jekyll-theme-primer-0.6.0
         Requiring: jekyll-github-metadata
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
/usr/local/lib/ruby/2.7.0/fileutils.rb:1466:in `unlink': Is a directory @ apply2files - /github/workspace/_site/assets (Errno::EISDIR)
    from /usr/local/lib/ruby/2.7.0/fileutils.rb:1466:in `block in remove_file'
    from /usr/local/lib/ruby/2.7.0/fileutils.rb:1471:in `platform_support'
    from /usr/local/lib/ruby/2.7.0/fileutils.rb:1465:in `remove_file'
    from /usr/local/lib/ruby/2.7.0/fileutils.rb:795:in `remove_file'
    from /usr/local/lib/ruby/2.7.0/fileutils.rb:582:in `block in rm'
    from /usr/local/lib/ruby/2.7.0/fileutils.rb:581:in `each'
    from /usr/local/lib/ruby/2.7.0/fileutils.rb:581:in `rm'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/static_file.rb:104:in `write'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/site.rb:209:in `block in write'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/site.rb:332:in `block (2 levels) in each_site_file'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/site.rb:331:in `each'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/site.rb:331:in `block in each_site_file'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/site.rb:330:in `each'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/site.rb:330:in `each_site_file'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/site.rb:208:in `write'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/site.rb:73:in `process'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/command.rb:28:in `process_site'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/commands/build.rb:65:in `build'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/commands/build.rb:36:in `process'
    from /usr/local/bundle/gems/github-pages-227/bin/github-pages:70:in `block (3 levels) in <top (required)>'
    from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
    from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
    from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
    from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
    from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
    from /usr/local/bundle/gems/github-pages-227/bin/github-pages:6:in `<top (required)>'
    from /usr/local/bundle/bin/github-pages:23:in `load'
    from /usr/local/bundle/bin/github-pages:23:in `<main>'
         Requiring: jekyll-seo-tag
         Requiring: jekyll-coffeescript
         Requiring: jekyll-commonmark-ghpages
         Requiring: jekyll-gist
         Requiring: jekyll-github-metadata
         Requiring: jekyll-paginate
         Requiring: jekyll-relative-links
         Requiring: jekyll-optional-front-matter
         Requiring: jekyll-readme-index
         Requiring: jekyll-default-layout
         Requiring: jekyll-titles-from-headings
   GitHub Metadata: Initializing...
            Source: /github/workspace/.
       Destination: /github/workspace/./_site
 Incremental build: disabled. Enable with --incremental
      Generating...
       EntryFilter: excluded /CNAME
        Generating: JekyllOptionalFrontMatter::Generator finished in 0.000141401 seconds.
        Generating: JekyllReadmeIndex::Generator finished in 0.001776312 seconds.
        Generating: Jekyll::Paginate::Pagination finished in 4.6e-06 seconds.
        Generating: JekyllRelativeLinks::Generator finished in 1.6801e-05 seconds.
        Generating: JekyllDefaultLayout::Generator finished in 1.3e-05 seconds.
        Generating: JekyllTitlesFromHeadings::Generator finished in 7.9e-06 seconds.
         Rendering: assets/css/style.scss
  Pre-Render Hooks: assets/css/style.scss
  Rendering Markup: assets/css/style.scss
           Writing: /github/workspace/_site/assets/css/style.css
github-pages 227 | Error:  Is a directory @ apply2files - /github/workspace/_site/assets
</code>```

New to programming and GitHub pages in general, but I was trying to push my repo onto the page, but got stuck in the Build with Jekyll stage. I've added a \_config.yml file, but the build message is still spitting out an error message. Is there certain requirements to include in a \_config.yml file?

Body:
Run actions/jekyll-build-pages@v1
/usr/bin/docker run --name ghcrioactionsjekyllbuildpagesv104_2d9e9e --label 290506 --workdir /github/workspace --rm -e "INPUT_SOURCE" -e "INPUT_DESTINATION" -e "INPUT_FUTURE" -e "INPUT_BUILD_REVISION" -e "INPUT_VERBOSE" -e "INPUT_TOKEN" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_ID_TOKEN_REQUEST_URL" -e "ACTIONS_ID_TOKEN_REQUEST_TOKEN" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/luciennee.github.io/luciennee.github.io":"/github/workspace" ghcr.io/actions/jekyll-build-pages:v1.0.4
  Logging at level: debug
Configuration file: /github/workspace/./_config.yml
      GitHub Pages: github-pages v227
      GitHub Pages: jekyll v3.9.2
             Theme: jekyll-theme-primer
      Theme source: /usr/local/bundle/gems/jekyll-theme-primer-0.6.0
         Requiring: jekyll-github-metadata
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
/usr/local/lib/ruby/2.7.0/fileutils.rb:1466:in `unlink': Is a directory @ apply2files - /github/workspace/_site/assets (Errno::EISDIR)
    from /usr/local/lib/ruby/2.7.0/fileutils.rb:1466:in `block in remove_file'
    from /usr/local/lib/ruby/2.7.0/fileutils.rb:1471:in `platform_support'
    from /usr/local/lib/ruby/2.7.0/fileutils.rb:1465:in `remove_file'
    from /usr/local/lib/ruby/2.7.0/fileutils.rb:795:in `remove_file'
    from /usr/local/lib/ruby/2.7.0/fileutils.rb:582:in `block in rm'
    from /usr/local/lib/ruby/2.7.0/fileutils.rb:581:in `each'
    from /usr/local/lib/ruby/2.7.0/fileutils.rb:581:in `rm'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/static_file.rb:104:in `write'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/site.rb:209:in `block in write'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/site.rb:332:in `block (2 levels) in each_site_file'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/site.rb:331:in `each'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/site.rb:331:in `block in each_site_file'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/site.rb:330:in `each'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/site.rb:330:in `each_site_file'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/site.rb:208:in `write'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/site.rb:73:in `process'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/command.rb:28:in `process_site'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/commands/build.rb:65:in `build'
    from /usr/local/bundle/gems/jekyll-3.9.2/lib/jekyll/commands/build.rb:36:in `process'
    from /usr/local/bundle/gems/github-pages-227/bin/github-pages:70:in `block (3 levels) in <top (required)>'
    from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
    from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
    from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
    from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
    from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
    from /usr/local/bundle/gems/github-pages-227/bin/github-pages:6:in `<top (required)>'
    from /usr/local/bundle/bin/github-pages:23:in `load'
    from /usr/local/bundle/bin/github-pages:23:in `'
         Requiring: jekyll-seo-tag
         Requiring: jekyll-coffeescript
         Requiring: jekyll-commonmark-ghpages
         Requiring: jekyll-gist
         Requiring: jekyll-github-metadata
         Requiring: jekyll-paginate
         Requiring: jekyll-relative-links
         Requiring: jekyll-optional-front-matter
         Requiring: jekyll-readme-index
         Requiring: jekyll-default-layout
         Requiring: jekyll-titles-from-headings
   GitHub Metadata: Initializing...
            Source: /github/workspace/.
       Destination: /github/workspace/./_site
 Incremental build: disabled. Enable with --incremental
      Generating...
       EntryFilter: excluded /CNAME
        Generating: JekyllOptionalFrontMatter::Generator finished in 0.000141401 seconds.
        Generating: JekyllReadmeIndex::Generator finished in 0.001776312 seconds.
        Generating: Jekyll::Paginate::Pagination finished in 4.6e-06 seconds.
        Generating: JekyllRelativeLinks::Generator finished in 1.6801e-05 seconds.
        Generating: JekyllDefaultLayout::Generator finished in 1.3e-05 seconds.
        Generating: JekyllTitlesFromHeadings::Generator finished in 7.9e-06 seconds.
         Rendering: assets/css/style.scss
  Pre-Render Hooks: assets/css/style.scss
  Rendering Markup: assets/css/style.scss
           Writing: /github/workspace/_site/assets/css/style.css
github-pages 227 | Error:  Is a directory @ apply2files - /github/workspace/_site/assets

New to programming and GitHub pages in general, but I was trying to push my repo onto the page, but got stuck in the Build with Jekyll stage. I've added a \_config.yml file, but the build message is still spitting out an error message. Is there certain requirements to include in a \_config.yml file?


来源: stackexchange

问:
Is Seaborn, Mayavi compatible in unity also?
Is the seaborn and Mayavi module able to be used in unity?

I am writing a code based on python.
In code, i used seaborn and mayavi for visualizing 3d model.
But I am trying to make GUI with the unity.
I would like to connect my python script to the unity GUI.
Is there any ways to use modules?

ContentLicense: CC BY-SA 4.0


问:
Google Analytics Data API (GA4) - Assisted Conversion Paths
Using the API, is there an equivalent way to pull data from GA4 for assisted conversion paths?

I know that GA4 has this information: Advertising > Attribution > Conversion paths

Similar to how the Multi-Channel Funnels Reporting API for UA worked.

With MCF API, you would call mcf:assistedConversions and mcf:assistedValue (https://s.vlm.co/E0uRyW01).

So far it appears that I would have to come up with another way to create the same kind of data?

EDIT 1/10/23: I have found this article, explaining we are limited to "first user source" and "session source" in GA4. I may have to look into the funnel exploration report.


问:
What is the process for reverting and cherry picking unwanted pull request from master while deploying it to master
Deployment Design

Below are the steps that I was thinking to implement for the DevOps Deployment

Create features1 (user1) and feature2 (user2) and then create Pull Request (1583,1584) to merge to Master branch.

Move it to Acceptance environment for developer or business user testing, smoking testing etc.

Create milestone once a week for production deployment (every Monday)

now let's say I just want 1583 feature to land to production environment but 1584 feature is not required so I will revert 1584 PR specifically from master branch and then do my deployment to production

after production deployment, I will cherry pick 1584 PR and then merge it to master branch again.

This is the typical design I was thinking to implement, only one burden here that I have to carry by this design is that let's say an old feature PR is there in acceptance and user doesn't want to move since two month to production , so every time we need to revert and cherry pick that item from master branch.

Kindly let me know if you see any future hurdles for this design or any suggestions is most welcome.

As mentioned above, I am going to implement this design but wanted to know if my deployment design is correct or can be improvise further, any other challenges that I might face ?


问:
MIT Course - Merge Sort - why max number of comparisons made between two sublists is <= length of the longer list?
I'm doing the open MIT Course - Introduction To Computer Science And Programming In Python.
The last class talks about the merge sort algorithm and it's order of growth.
I understand that the complexity is O(n*log (n)) as:

log (n) = number of recursion levels, n = total time required to merge lists per recursion level, where n is the length of the original list.

What I don't understand is the statement in bold when they breakdown the complexity of merging sublists step:

go through two lists, only one pass

compare only smallest elements in each sublist

O(len(left)+len(right)) copied elements

O(len(longer list)) comparisons

linear in length of the lists

I expected the number of comparisons to be: the length of both sublists O(len(left) + len(right)) or the length of both sublists minus 1 O((len(left) + len(right))-1) because for example:

For these 2 lists:

[1,3,5] and [2,4]

If I want to merge them together I would have to do 4 comparisons and not 3:

1º - 1,2;

2º - 3,2;

3º - 3,4;

4º - 5,4.


问:
What is wrong with this portion of my SSM document?
Getting this error when creating SSM document: invalidDocumentContent: YAML not well-formed.

This is the line below that the error references
"$version = '6.18'",

I get the same error on other lines in the new block, so if I can figure out this line, I can figure out the rest too.

I cloned a working SSM document and put this block of code in. The document works fine besides this block. I'm just perplexed, and I am sure this is due to my inexperience and the answer is simple and I will feel stupid when it's revealed...

Document:

```<code>    {
  "schemaVersion": "2.2",
  "description": "X",
  "parameters": {},
  "mainSteps": [
    {
      "action": "aws:runPowerShellScript",
      "name": "dbaCustomizations",
      "precondition": {
        "StringEquals": [
          "platformType",
          "Windows"
        ]
      },
      "inputs": {
        "runCommand": [
          "$errorActionPreference = 'stop'",
          "try {",
          "$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'",
          "[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols",
          "Set-ItemProperty -Path 'HKLM:\\SOFTWARE\\Wow6432Node\\Microsoft\\.NetFramework\\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord",
          "Set-ItemProperty -Path 'HKLM:\\SOFTWARE\\Microsoft\\.NetFramework\\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord",
          "",
          "# PG admin separately for the ALLUSERS flag for now. ",
          "$version = '6.18'",
          "$output = [string]::Format('C:\pgadmin4-{0}-x64.exe',$version)",
          "$url = [string]::Format('https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v{0}/windows/pgadmin4-{0}-x64.exe',$version)",
          "(New-Object Net.WebClient).DownloadFile($url, $output)",
          "Start-Process -Wait -FilePath $output -ArgumentList '/ALLUSERS /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-' -PassThru",
          "}",
          "} catch",
          "{",
          "    Write-Output \"Error encountered \" + $Error[0].Exception.Message",
          "    exit 1",
          "}",
          ""
        ],
        "timeoutSeconds": 7200
      }
    }
  ]
}
</code>```

Body:
Getting this error when creating SSM document: invalidDocumentContent: YAML not well-formed.

This is the line below that the error references
"$version = '6.18'",

I get the same error on other lines in the new block, so if I can figure out this line, I can figure out the rest too.

I cloned a working SSM document and put this block of code in. The document works fine besides this block. I'm just perplexed, and I am sure this is due to my inexperience and the answer is simple and I will feel stupid when it's revealed...

Document:

    {
  "schemaVersion": "2.2",
  "description": "X",
  "parameters": {},
  "mainSteps": [
    {
      "action": "aws:runPowerShellScript",
      "name": "dbaCustomizations",
      "precondition": {
        "StringEquals": [
          "platformType",
          "Windows"
        ]
      },
      "inputs": {
        "runCommand": [
          "$errorActionPreference = 'stop'",
          "try {",
          "$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'",
          "[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols",
          "Set-ItemProperty -Path 'HKLM:\\SOFTWARE\\Wow6432Node\\Microsoft\\.NetFramework\\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord",
          "Set-ItemProperty -Path 'HKLM:\\SOFTWARE\\Microsoft\\.NetFramework\\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord",
          "",
          "# PG admin separately for the ALLUSERS flag for now. ",
          "$version = '6.18'",
          "$output = [string]::Format('C:\pgadmin4-{0}-x64.exe',$version)",
          "$url = [string]::Format('https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v{0}/windows/pgadmin4-{0}-x64.exe',$version)",
          "(New-Object Net.WebClient).DownloadFile($url, $output)",
          "Start-Process -Wait -FilePath $output -ArgumentList '/ALLUSERS /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-' -PassThru",
          "}",
          "} catch",
          "{",
          "    Write-Output \"Error encountered \" + $Error[0].Exception.Message",
          "    exit 1",
          "}",
          ""
        ],
        "timeoutSeconds": 7200
      }
    }
  ]
}


问:
Pinia lost its types when using factory pattern
for the need of my project I need to create a storeFactory to modulate the creation of a pinia store.

I specifically removed the parameters here and simplified the code example.

When I'm in File A, the type of storeFactory is automatically retrieved correctly

When I'm file B the type is lost and only this can be inferred

```<code>StoreDefinition<"store_id", {} | _UnwrapAll<Pick<any, string | number>>, {} | Pick<...>, {} | Pick<...>
</code>```

File A

```<code>export function storeFactory() {
  const baseEntityComponents = {}
  const extensionComponents = {}

  return defineStore(`store_id`, () => ({ // type OK
    ...baseEntityComponents,
    ...extensionComponents,
  }));
}
</code>```

File B

```<code>import {storeFactory} './fileA.ts'
export const useStore = storeFactory(); // type lost
</code>```

Question

How can we preserve the automatic type while wrapping the define store in a factory method?
If automatic type inferring is not possible, is there a way to define manually the type. I created an interface with all methods from the store but it's obviously not the same type as a instance of a pinia store containing those methods.

Body:
for the need of my project I need to create a storeFactory to modulate the creation of a pinia store.

I specifically removed the parameters here and simplified the code example.

When I'm in File A, the type of storeFactory is automatically retrieved correctly

When I'm file B the type is lost and only this can be inferred

StoreDefinition<"store_id", {} | _UnwrapAll<Pick<any, string | number>>, {} | Pick<...>, {} | Pick<...>

File A

export function storeFactory() {
  const baseEntityComponents = {}
  const extensionComponents = {}

  return defineStore(`store_id`, () => ({ // type OK
    ...baseEntityComponents,
    ...extensionComponents,
  }));
}

File B

import {storeFactory} './fileA.ts'
export const useStore = storeFactory(); // type lost

Question

How can we preserve the automatic type while wrapping the define store in a factory method?
If automatic type inferring is not possible, is there a way to define manually the type. I created an interface with all methods from the store but it's obviously not the same type as a instance of a pinia store containing those methods.


问:
Show backtrace for procedural macro panic
Is there a way to enable backtraces for panics that occur inside a procedural macro?

I have a fairly complicated macro which includes a lot of parse_quote! calls. Currently, one or more are panicking, presumably due to bad syntax. The only way I can figure out which is causing this is by commenting out code until the error stops, then toggling the comments to narrow in on the specific line.

I can't use cargo expand because the macro panics before it emits anything useful, so the effected code is just removed from the command's output.

RUST_BACKTRACE=1 has no effect. RUSTFLAGS="-Z macro-backtrace" also has no effect.

The error message just prints out a very basic message:

error: custom attribute panicked
  --> [insert file here]:57:1
   |
57 | #[entity]
   | ^^^^^^^^^
   |
   = help: message: expected `,`
```


问:
Is it possible to get access to the woocommerce api via wp rest api?
im writing an app to update product details in my wordpress/woocommerce shop.
i'm able to do this via woocommerce api consumer key and consumer secret. now i want to login via wordpress user password. this is no problem. i'm using jwt auth and check the token. but how can i now receive the woocommerce api keys based on this user details?
thanks for your help.
greets

I'm expecting the keys as a return value from a GET request.  I don't want to hardcode the keys.


问:
python cannot make seleniumwire undetected_chromedriver working together
I have python 3.9 installed in a virtual environment.

My virtual environment contains the following libraries:

seleniumwire

undetected_chromedriver

I have also installed the certificate ca.ctr in my virtual environment root using the command:

```<code>python3 -m seleniumwire extractcert
</code>```

In the root I have a script that try to access a website e.g. https://www.google.com

Here my code:

```<code>import seleniumwire.undetected_chromedriver as uc

options = {
    'ca_cert': '/ca.crt'
}

chrome_options = uc.ChromeOptions()

driver = uc.Chrome(
    options=chrome_options,
    seleniumwire_options=options
)

url = "https://www.google.com/"

driver.get(self.url)
</code>```

I get the following error when running the script:

line 1309, in do_handshake
self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get
local issuer certificate (_ssl.c:1129)

Please note I am trying to make this work on a virtual environment installed on a Mac. thank you for your help

Body:
I have python 3.9 installed in a virtual environment.

My virtual environment contains the following libraries:

seleniumwire

undetected_chromedriver

I have also installed the certificate ca.ctr in my virtual environment root using the command:

python3 -m seleniumwire extractcert

In the root I have a script that try to access a website e.g. https://www.google.com

Here my code:

import seleniumwire.undetected_chromedriver as uc

options = {
    'ca_cert': '/ca.crt'
}

chrome_options = uc.ChromeOptions()

driver = uc.Chrome(
    options=chrome_options,
    seleniumwire_options=options
)

url = "https://www.google.com/"

driver.get(self.url)

I get the following error when running the script:

line 1309, in do_handshake
self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get
local issuer certificate (_ssl.c:1129)

Please note I am trying to make this work on a virtual environment installed on a Mac. thank you for your help


问:
why am i getting error after importing bootsrap-dark-5 in react file?
```<code>import '../node_modules/bootstrap-dark-5/dist/css/bootsrap-dark-5.min.css';

//error
Compiled with problems:X

ERROR in ./src/App.js 8:0-75

Module not found: Error: Can't resolve '../node_modules/bootstrap-dark-5/dist/css/bootsrap-dark-5.min.css' in 'C:\Users\ankan\Desktop\food app\zebrakat\khana\src'

// my error
Compiled with problems:X

ERROR in ./src/App.js 8:0-75

Module not found: Error: Can't resolve '../node_modules/bootstrap-dark-5/dist/css/bootsrap-dark-5.min.css' in 'C:\Users\ankan\Desktop\food app\zebrakat\khana\src'
</code>```


问:
Expand graph to the full size of the Dash bootstrap (dbc) column in python
I've been working with dash recently and come across a problem. My Graph on the Side does not expand to the full size of the dbc column and I dont get why. In the end I want both line charts stacked above each other and the bar chart next to them. If anybody has a fix for the I'd highly appreciate it.

```<code> content = html.Div(
    [
        dbc.Row(
            [
                dbc.Col(
                    [
                        dbc.Row([

                            html.P(id="Ticker-Chart-Headline", style={"textAlign": "center"}),
                            dcc.Graph(id="line-graph"),

                        ]),
                        dbc.Row([
                            html.P(id="Indicator-Chart-Headline", style={"textAlign": "center"}),
                            dcc.Graph(id="Indicator-Graph")
                        ])

                    ], width={"size": 7},
                    className="bg-dark text-white"
                ),
                dbc.Col(
                    [
                        html.P(id="Backtesting-Graph-Headline", style={"textAlign": "center"}),
                        dcc.Graph(id="Backtesting-Graph",responsive=True)

                    ], width={"size": 5},
                    className="bg-dark text-white"
                )
            ],
            style={
                "margin-top": "0px", "margin-left": "8px",
                "margin-bottom": "8px"}),

    ]
)
app.layout = dbc.Container(
    [
        html.H1("Stock market trading Dashbaord", id="Headline",
                style={"color": "white", "textAlign": "center", "font-weight": "bold"}),
        dbc.Row(
            [
                dbc.Col(sidebar, width=2, className="text-white bg-primary font-italic"),
                dbc.Col(content, width=10, className="text-white font-italic")
            ],

        ),
    ],
    fluid=True
)`
</code>```

Thats how its looking rn. But I want the bar chart to extend all the way down where the second line chart is

Body:
I've been working with dash recently and come across a problem. My Graph on the Side does not expand to the full size of the dbc column and I dont get why. In the end I want both line charts stacked above each other and the bar chart next to them. If anybody has a fix for the I'd highly appreciate it.

 content = html.Div(
    [
        dbc.Row(
            [
                dbc.Col(
                    [
                        dbc.Row([

                            html.P(id="Ticker-Chart-Headline", style={"textAlign": "center"}),
                            dcc.Graph(id="line-graph"),

                        ]),
                        dbc.Row([
                            html.P(id="Indicator-Chart-Headline", style={"textAlign": "center"}),
                            dcc.Graph(id="Indicator-Graph")
                        ])

                    ], width={"size": 7},
                    className="bg-dark text-white"
                ),
                dbc.Col(
                    [
                        html.P(id="Backtesting-Graph-Headline", style={"textAlign": "center"}),
                        dcc.Graph(id="Backtesting-Graph",responsive=True)

                    ], width={"size": 5},
                    className="bg-dark text-white"
                )
            ],
            style={
                "margin-top": "0px", "margin-left": "8px",
                "margin-bottom": "8px"}),

    ]
)
app.layout = dbc.Container(
    [
        html.H1("Stock market trading Dashbaord", id="Headline",
                style={"color": "white", "textAlign": "center", "font-weight": "bold"}),
        dbc.Row(
            [
                dbc.Col(sidebar, width=2, className="text-white bg-primary font-italic"),
                dbc.Col(content, width=10, className="text-white font-italic")
            ],

        ),
    ],
    fluid=True
)`

Thats how its looking rn. But I want the bar chart to extend all the way down where the second line chart is


问:
How to execute a groovy script from a jenkins pipeline
I am new to Jenkins.

I have written a groovy script, which loads a token secret from an adjacent config.properties file.

What's the best way to execute this script in a groovy pipeline ?

What I think I need to do is:

download that script from SCM

change the token in config.properties (retrieved from the stored jenkins credentials)

execute that script

I've seen various options :

loading the script with load(), but this seems to be more dedicated to loading helper functions, whereas I only need to execute the whole script

using shared libraries, but this seems to be more dedicated to code snippets reused across multiple jobs, which is not my case

using withGroovy {}

using sh groovy

using a docker image that contains a groovy sdk

I tried these, and managed to get none of them to work (in part due to the extra-difficulty of retrieving the credential), so before I go any further I'd like to know what's the best option to proceed. For example, instead of trying to change the file config.properties in my pipeline to set the correct token, should I rather try to change my groovy script so that it takes the token from an environment variable ?

Thanks


问:
Find all subgraphs which has a single input edge and a single output edge in a graph

Given a graph, I want to find all the subgraphs that only has 1 input edge and 1 output edge. For example, in this graph, the subgraphs will be [1, 2, 3, 4], [5, 6, 7, 8]. I don't know how to describe this problem in a formal way so just putting a graph here.

Edit:
Thanks to the comment. The subgraphs shouldn't overlap with each other. Fro example, I don't want [2, 3] since it is part of [1, 2, 3, 4].


问:
HAProxy configuration for load balacing
I trying to configure a Haproxy load balancer in layer 7. It worked, but after reinstalled HAProxy the backend servers failed the health check. Haproxy says they are down. How do I fix it?

I got this:

I reinstalled haproxy and always the same thing.

Title: HAProxy configuration for load balacing


问:
Is it safe to read data with boto3 from S3 if that data had been written using Stocator in pyspark?
I have an application that uses Stocator as a connector for Spark. This application writes the data to the S3 cos bucket.

Now I am working on a service that's supposed to read that data from S3. According to this thread here, you cannot specify the uri/protocol that boto3 uses. Is it safe to read that data using the default protocol of S3 REST API?

The reason I am asking is that I have been told that reading data using S3A (another protocol) that has been written using Stocator could result in reading duplicates.


问:
Swagger UI / Flask behind NGINX not finding js files
I am running a flask API with connexion.App vi Swagger / OPENAPI.  I can access the Swagger UI directly,  but when accessing behind a nginx proxy,  it attempts to find the javascript files in a location that does not exist.

It is looking for:

swagger-ui.css

swagger-ui-standalone-preset.js

swagger-ui-bundle.js

in the path set by NGINX,  ie /my-api/doc.  The files exist in the python package:

python3.7/site-packages/flask_swagger_ui/dist/

Also I get:

SwaggerUIBundle is not defined

Any suggestions on how to pass these files,  locations through the NGINX proxy?

I have tried passing js through the proxy,  but it seems like it is not finding the files.


问:
What's the difference between the following function type definitions?
Having these two different types of definitions I don't seem to perceive a difference in terms of their application. The only slight change that I can notice is that my code editor shows the symbol for function for First and the symbol for property for Second.

So is there any difference type-wise? are there any other quirks regarding the different notations?

```<code>type First = {
  a(): any;
}
</code>```

vs

```<code>type Second = {
  a: () => any;
}
</code>```

Body:
Having these two different types of definitions I don't seem to perceive a difference in terms of their application. The only slight change that I can notice is that my code editor shows the symbol for function for First and the symbol for property for Second.

So is there any difference type-wise? are there any other quirks regarding the different notations?

type First = {
  a(): any;
}

vs

type Second = {
  a: () => any;
}


问:
Configure azure credentials inside DotNetCoreCLI@2 task
I need to make an api call to an azure resource within a test file. I run those tests in the pipeline with the DotNetCoreCLI@2 task. The test relies on the DefaultAzureCredential (which itself enumerates several credential providers) but I am struggling to understand how I can tell the build agent to set one of these credentials. I tried creating my own credential provider implementation by setting an environment variable using the pipeline provided token, but that doesn't work.

    public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken)
    {
      string environmentVariable = Environment.GetEnvironmentVariable("SYSTEM_ACCESSTOKEN");
      return new AccessToken("Bearer " + environmentVariable, DateTime.Now.AddMinutes(60.0));
    }
```
<pre class="lang-yaml prettyprint-override"><code>  - task: DotNetCoreCLI@2
    displayName: 'dotnet test'
    env:
      SYSTEM_ACCESSTOKEN: $(System.AccessToken)
    inputs:
      SecretsFilter: "*"
      command: test
      arguments: --collect "Code coverage"
      projects: ${{ parameters.testProjects }}
</code>```

Body:
I need to make an api call to an azure resource within a test file. I run those tests in the pipeline with the DotNetCoreCLI@2 task. The test relies on the DefaultAzureCredential (which itself enumerates several credential providers) but I am struggling to understand how I can tell the build agent to set one of these credentials. I tried creating my own credential provider implementation by setting an environment variable using the pipeline provided token, but that doesn't work.

    public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken)
    {
      string environmentVariable = Environment.GetEnvironmentVariable("SYSTEM_ACCESSTOKEN");
      return new AccessToken("Bearer " + environmentVariable, DateTime.Now.AddMinutes(60.0));
    }

  - task: DotNetCoreCLI@2
    displayName: 'dotnet test'
    env:
      SYSTEM_ACCESSTOKEN: $(System.AccessToken)
    inputs:
      SecretsFilter: "*"
      command: test
      arguments: --collect "Code coverage"
      projects: ${{ parameters.testProjects }}


问:
matplotlib subplots don't honor ylim
I'm trying to create 9 subplots (3x3) all with the same x and y ranges. I setup the plots using this code, and all but the last subplot use the correct y-range (ylim).

```<code>brightM = -22 # Plot range...
limitM  = -14
dataIn = np.load("testLFdata.tst.npy",allow_pickle=True)

fig, axs = plt.subplots(nrows=3, ncols=3, sharex='all',sharey='all',figsize=(15,15))
linaxs   = axs.reshape(-1)
for i, ax in zip(range(dataIn[0].size), linaxs):
    print("z={}".format(dataIn[0,i]))
    xdata = dataIn[1,i][0]
    ydata = dataIn[1,i][1]
    ax.plot(xdata,ydata,ls='-',marker='o', c="b")

    # Format plt
    ax.set_yscale('log')
    ax.set_ylim([5e-6,1e-1])
    ax.set_yticks(np.logspace(-6,-1,6))
    ax.set_xscale('linear')
    ax.set_xlim([brightM-0.85,limitM+0.5])
    ax.set_xticks(np.arange(brightM,limitM+1,2))
    ax.set_xticklabels([str(i) for i in np.arange(brightM,limitM+1,2)])
    ax.grid(b=True)
    gc.collect()

plt.subplots_adjust(left=0.07, bottom=0.08, right=1.0, top=1.0, wspace=.0, hspace=.0)
gc.collect()
</code>```

Here's the data for the data struct "dataIn".

Here's the plot I get... As you can see the lower-right plot has the wrong y-limits!

Title: matplotlib subplots don't honor ylim

Body:
I'm trying to create 9 subplots (3x3) all with the same x and y ranges. I setup the plots using this code, and all but the last subplot use the correct y-range (ylim).

brightM = -22 # Plot range...
limitM  = -14
dataIn = np.load("testLFdata.tst.npy",allow_pickle=True)

fig, axs = plt.subplots(nrows=3, ncols=3, sharex='all',sharey='all',figsize=(15,15))
linaxs   = axs.reshape(-1)
for i, ax in zip(range(dataIn[0].size), linaxs):
    print("z={}".format(dataIn[0,i]))
    xdata = dataIn[1,i][0]
    ydata = dataIn[1,i][1]
    ax.plot(xdata,ydata,ls='-',marker='o', c="b")

    # Format plt
    ax.set_yscale('log')
    ax.set_ylim([5e-6,1e-1])
    ax.set_yticks(np.logspace(-6,-1,6))
    ax.set_xscale('linear')
    ax.set_xlim([brightM-0.85,limitM+0.5])
    ax.set_xticks(np.arange(brightM,limitM+1,2))
    ax.set_xticklabels([str(i) for i in np.arange(brightM,limitM+1,2)])
    ax.grid(b=True)
    gc.collect()

plt.subplots_adjust(left=0.07, bottom=0.08, right=1.0, top=1.0, wspace=.0, hspace=.0)
gc.collect()

Here's the data for the data struct "dataIn".

Here's the plot I get... As you can see the lower-right plot has the wrong y-limits!


问:
NET Core Multitenant JWT Validation
I'm working on a multi-tenant net core 7 webapi, where each customer has its own database and I want each customer to have its own key to generate the jwt token, instead of having one for all.

I've seen some samples but the keys are hardcoded, so this won't work for my scenario, it should, in someway to be dynamic.

I thought of having these keys in a database, but this means that, each request will have to check database and retrieve the key to validate jwt, this doesn't sounds good.

What would be the right way to achieve this?

Title: NET Core Multitenant JWT Validation


问:
how to ask if a variable is equal to a list of words
I am trying to do an ifelse statement that tests if a variable is equal to a series of character strings. In dummy data, I am trying the following:

```<code>mtcars$mpg <- as.character(mtcars$mpg)
table(ifelse(mtcars$mpg == c("21", "18.1", "14.3"), "TRUE", "FALSE"))
</code>```

I want this to produce 4 Trues, and 28 Falses.

Body:
I am trying to do an ifelse statement that tests if a variable is equal to a series of character strings. In dummy data, I am trying the following:

mtcars$mpg <- as.character(mtcars$mpg)
table(ifelse(mtcars$mpg == c("21", "18.1", "14.3"), "TRUE", "FALSE"))

I want this to produce 4 Trues, and 28 Falses.


问:
Sharing common SQL tables across different SQL Server Database projects / git repos
What would be the best solution/design for sharing common SQL tables definitions between different projects whilst using SQL Server Database projects deployed as DacPacs?

For example:

```<code>Master Project sqlproj
 - CommonTable1.sql
</code>```
```<code>Sub Project 1 sqlproject
 - P1CustomTable1.sql
</code>```
```<code>Sub Project 2 sqlproject
 - P2CustomTable1.sql
 - P2CustomTable1.sql
</code>```

All sub-projects should contain CommonTable1.sql. Ideally in a single SQL Server Database project (sqlproj) per sub-project.

Key points/goals:

All projects should be self-contained and in their own repositories and build pipelines

Full CI/CD with Azure DevOps / build pipelines

Seamless when working on sub-projects. Bring a package in and forget about it. Updates just update NuGet packages if/where wanted.

Ease of updating Local SQL development env (ideally right click sqlproj and publish

Avoiding EF migrations (but could be the solution? If the master project changes in the future,
subprojects should be able to easily bring in the changes.

Option 1

I liked the idea of having a Master.DbSchema package that can be included in sub-projects sqlproj via NuGet. But this doesn’t seem fully possible as Sqlproj does not allow for Nuget references (still .Net Framework 4.8 / Standard 2.0).

I explored having a separate c# Class Library (not sqlproj) with all SQL files defined. Then used prop files etc.. and nuget to bring them into sub-projects. Similar to the answer here - How to flatten Nuget package contentFiles?

This allowed for sub-projects to add the files into sqlproj but only via linked files in another new class library that I could reference the Master.DbSchema in. This wasn’t ideal for a few reasons. 1 you lose compilation validation of the SQL files when not in sqlproj, 2. It required a middle library for each sub-project, 3. it was easy to accidentally edit linked files and the middle library. 4. Lots of editing of proj files – felt hacky.

Option 2

I've fumbled my way around having a dacpac generated from Master 1 and packaged that up into a NuGet feed. This could then be added separately in the sub-project's yaml files to deploy both the master and the sub-project dacpacs. This took some hacking around of sub-projects libraries to include build output from the NuGet pgk (see - How to deploy dacpac file from a nuget package in c#). Again doesn’t feel right

Option 3

I'm still not happy with the approach and now thinking Git submodules I'm sure this will have similar issues and submodules come with their own maintenance headache. Will likely have the same outcome in that SQL files contained within a sqlproj file for compile time validation?

My Conclusion

The overall design is probably off until such a time when SQL Database project support .Net Core and NuGet packages. Do I reinvest in making the master and all sub-projects use Code migrations? Am I'm missing something simple?

EDIT: Context

To add a bit more context to what I’m trying to achieve.

Assume I have 5 applications/solutions all with identical tables. Audit, Activity for example … but some do also include their own unique objects.

Each solution has its own sqlproj, its own DbContext, Models, ViewModels, Validation etc.. most of which are duplicated and sometimes out of sync.

There is an existing Master project that is already referenced in all 5 projects.

I was hoping to cut out all the repetitive code and include Common features into a master project and keep only project-specific things for each sub-project.

Body:
What would be the best solution/design for sharing common SQL tables definitions between different projects whilst using SQL Server Database projects deployed as DacPacs?

For example:

Master Project sqlproj
 - CommonTable1.sql

Sub Project 1 sqlproject
 - P1CustomTable1.sql

Sub Project 2 sqlproject
 - P2CustomTable1.sql
 - P2CustomTable1.sql

All sub-projects should contain CommonTable1.sql. Ideally in a single SQL Server Database project (sqlproj) per sub-project.

Key points/goals:

All projects should be self-contained and in their own repositories and build pipelines

Full CI/CD with Azure DevOps / build pipelines

Seamless when working on sub-projects. Bring a package in and forget about it. Updates just update NuGet packages if/where wanted.

Ease of updating Local SQL development env (ideally right click sqlproj and publish

Avoiding EF migrations (but could be the solution? If the master project changes in the future,
subprojects should be able to easily bring in the changes.

Option 1

I liked the idea of having a Master.DbSchema package that can be included in sub-projects sqlproj via NuGet. But this doesn’t seem fully possible as Sqlproj does not allow for Nuget references (still .Net Framework 4.8 / Standard 2.0).

I explored having a separate c# Class Library (not sqlproj) with all SQL files defined. Then used prop files etc.. and nuget to bring them into sub-projects. Similar to the answer here - How to flatten Nuget package contentFiles?

This allowed for sub-projects to add the files into sqlproj but only via linked files in another new class library that I could reference the Master.DbSchema in. This wasn’t ideal for a few reasons. 1 you lose compilation validation of the SQL files when not in sqlproj, 2. It required a middle library for each sub-project, 3. it was easy to accidentally edit linked files and the middle library. 4. Lots of editing of proj files – felt hacky.

Option 2

I've fumbled my way around having a dacpac generated from Master 1 and packaged that up into a NuGet feed. This could then be added separately in the sub-project's yaml files to deploy both the master and the sub-project dacpacs. This took some hacking around of sub-projects libraries to include build output from the NuGet pgk (see - How to deploy dacpac file from a nuget package in c#). Again doesn’t feel right

Option 3

I'm still not happy with the approach and now thinking Git submodules I'm sure this will have similar issues and submodules come with their own maintenance headache. Will likely have the same outcome in that SQL files contained within a sqlproj file for compile time validation?

My Conclusion

The overall design is probably off until such a time when SQL Database project support .Net Core and NuGet packages. Do I reinvest in making the master and all sub-projects use Code migrations? Am I'm missing something simple?

EDIT: Context

To add a bit more context to what I’m trying to achieve.

Assume I have 5 applications/solutions all with identical tables. Audit, Activity for example … but some do also include their own unique objects.

Each solution has its own sqlproj, its own DbContext, Models, ViewModels, Validation etc.. most of which are duplicated and sometimes out of sync.

There is an existing Master project that is already referenced in all 5 projects.

I was hoping to cut out all the repetitive code and include Common features into a master project and keep only project-specific things for each sub-project.


问:
Best tips for cloudflare WAF rules blocking bots/hacker attacks
Hello i have resently gone through the task of adding firewall blocking rules on my site.

I want some tips for adding more security to wordpress sites

Currently i am blocking by specific uri path which are common on my web statistics and also irrelevant for front-end users.

I am also blocking by no ssl connection in relation to these and http 1 (maybe i should add http 1,1, as many of these bots use it.

Threat level and locations have also been added for blocking.

Lately i have begun adding specific ASN numbers as i see these bots/hackers use free or hacked hosting services. And i dont assume front-end users will use these. I also blocked a couple of ISP providers in foreign countries.

Note:
I am worried that i can be blocking specific bots such as google that crawl my page…


问:
I have many buttons (views) to set click listeners, can I do this using a loop and a modifiable String or StringBuilder?
My Android App have a simple QWERTY keyboard, but I have to set click listeners to all of them, one by one. Can I make something like this?

```<code>fun setOnClickListeners() {
    var letter = '?'
    var function = "binding.button$letter.setOnclickListener { anotherFunction(binding.button$letter) }"

    for(f in 'A'..'Z') {
        letter = f
        execute(function, letter)
    }
}
</code>```

I have one set click listener function for every button, this works, but I don't know if this is correct.

Body:
My Android App have a simple QWERTY keyboard, but I have to set click listeners to all of them, one by one. Can I make something like this?

fun setOnClickListeners() {
    var letter = '?'
    var function = "binding.button$letter.setOnclickListener { anotherFunction(binding.button$letter) }"

    for(f in 'A'..'Z') {
        letter = f
        execute(function, letter)
    }
}

I have one set click listener function for every button, this works, but I don't know if this is correct.


问:
How do I distribute a simple desktop application with Visual Studio?
I was asked to do some bug fixes on a Windows desktop application written in c#. I did not create the application in question and I don't have access to the person who did.

I made the changes I need but I don't know how to distribute them. I can build an .EXE file, but that file only works on my computer. I tried to "Publish" it, but the publish options are "From a web site", "From a UNC path" or "From a CD-ROM". None of those really describes my situation. I want to deliver the progam to my customer but I don't know how he plans to distribute it. He'll probably put it on a web site but I don't know the URL of the web site (and I don't understand why Visual Studio needs this information anyway).

I went ahead and tried the CD-ROM publish option since this is closest to what I'm after; Visual Studio output two files, setup.exe and productname.application. The setup.exe works on my computer but when I sent the two files to my customer he says they don't work on his computer.

Thanks,
Frank


问:
Is there a way to change data entry on one sheet while on another sheet in excel (manual entry of the same data point in two locations)
I am building a financial model with 3 sections (Data Entry/Assumptions, Calculations, Reporting).  The team is very excel heavy so my options around system automation are limited.  In the data entry tab, junior team members would enter 100's of assumptions, calculation would take place in the background and management reporting would update.  Management is going to want to be able to toggle a handful of those same assumptions from the reporting tab, as they are not going to go into the depths of the data entry.

Essentially, from the Reporting Tab & the Data Entry tab, users will need to be able to change the same cell.  Is there a way to get a view into and be able to change the data on one tab while one a different tab?  I thought that I saw an embedded window once where a different tab was represented, allowing the user to change that tab from another but I have not been able to find anything.

Ideally, the result would be the embedded window.  I have considered forms but haven't dug into the functionality yet.  I am not comfortable in VBA (defer to Power Query for automated data manipulation) but I am not opposed to a simplistic application. I am wondering if it makes sense to have the Junior team enter their assumptions and have a VBA enabled button overwrite that data with whatever is in the other tab once clicked by management - open to ideas.


问:
Sklearn's One-Class SVM with separable Nu Parameter
The existing One-Class Classification (OCC) model implementation from Sklearn  (OneClassSVM) has a parameter (Nu) that handles both the upper bound of training errors and the lower bound of support vectors. I have data that has no training error, however, I still want support vectors. Is there any known Python implementation of OneClassSVM that has separable parameters so that I can specify training error and support vectors separately?

Currently, my alternative is to purposely contaminate my one-class data.

Documentation: https://scikit-learn.org/stable/modules/generated/sklearn.svm.OneClassSVM.html

Alternatively, is there any pure one-class SVM implementation that does not assume an outlier class instance in training?


问:
How to glob (use wild card) with FTP to download certain files? (Either via CLI or Python)
I'm trying to grab and download all of the following files:
https://ftp.ensembl.org/pub/current_fasta/*/dna/*.dna.toplevel.fa.gz

I tried adapting the following code:
https://www.geeksforgeeks.org/how-to-list-all-files-and-directories-in-ftp-server-using-python/

```<code>from ftplib import FTP
ftp = FTP("ftp.ensembl.org")
ftp.login()
ftp.cwd("pub/current_fasta")
</code>```

That's as far as I've gotten.  I can't figure out how to glob or download the files.

Any help would be greatly appreciated.

Body:
I'm trying to grab and download all of the following files:
https://ftp.ensembl.org/pub/current_fasta/*/dna/*.dna.toplevel.fa.gz

I tried adapting the following code:
https://www.geeksforgeeks.org/how-to-list-all-files-and-directories-in-ftp-server-using-python/

from ftplib import FTP
ftp = FTP("ftp.ensembl.org")
ftp.login()
ftp.cwd("pub/current_fasta")

That's as far as I've gotten.  I can't figure out how to glob or download the files.

Any help would be greatly appreciated.


问:
Typescript: Build project on another folder
I have a Typescript project that's structured like this:

```<code> package.json
 package.lock.json
 server (Folder with multiple folders that contain TS files)
 client (Folder with multiple folders that contain TS files)
</code>```

The package.json in the root folder contains the following, since the proyect used to be written in JS.

```<code>{
  ...
  "exports": "./server/index.js",
  "scripts": {
    "preinstall": "cd server && npm install",
    "dev": "nodemon ./server/index.js",
    "start": "node ./server/index.js"
  },
  "engines": {
    "node": "^17.0.0"
  },
  "type": "module"
}
</code>```

And I want to change the start script in order for it to work with the new typescript files. I tried with something like this:

"start": "npx tsc && node ./server/dist/index.js"

However, that only brings up the Typescript common commands menu whenever I run it with npm run start. So, how can I change it in order for it to work?

Body:
I have a Typescript project that's structured like this:

 package.json
 package.lock.json
 server (Folder with multiple folders that contain TS files)
 client (Folder with multiple folders that contain TS files)

The package.json in the root folder contains the following, since the proyect used to be written in JS.

{
  ...
  "exports": "./server/index.js",
  "scripts": {
    "preinstall": "cd server && npm install",
    "dev": "nodemon ./server/index.js",
    "start": "node ./server/index.js"
  },
  "engines": {
    "node": "^17.0.0"
  },
  "type": "module"
}

And I want to change the start script in order for it to work with the new typescript files. I tried with something like this:

"start": "npx tsc && node ./server/dist/index.js"

However, that only brings up the Typescript common commands menu whenever I run it with npm run start. So, how can I change it in order for it to work?


问:
Changed the springframework.version to 5.3.23, the web application didn't work: 'NoSuchMethodError': CorsConfiguration.addAllowedOriginPattern
I have to use spring framework, spring security and web.xml (not spring boot) in order to make web application.
When I used springframework.version 5.2.20.RELEASE, the application worked well.
But, when I changed the springframework.version to 5.3.1, the web application didn't work and I received the following error.

```<code>SEVERE: Servlet.init() for servlet [dispatcher] threw exception
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]: Factory method 'requestMappingHandlerMapping' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.web.cors.CorsConfiguration.addAllowedOriginPattern(Ljava/lang/String;)V
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1179)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:571)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:588)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:702)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:668)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:716)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:591)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:530)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:170)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1161)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1114)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1007)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4948)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5256)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1383)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1383)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:265)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:430)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:772)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:347)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]: Factory method 'requestMappingHandlerMapping' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.web.cors.CorsConfiguration.addAllowedOriginPattern(Ljava/lang/String;)V
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651)
    ... 52 more
Caused by: java.lang.NoSuchMethodError: org.springframework.web.cors.CorsConfiguration.addAllowedOriginPattern(Ljava/lang/String;)V
    at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.<clinit>(AbstractHandlerMethodMapping.java:87)
    at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.createRequestMappingHandlerMapping(WebMvcConfigurationSupport.java:344)
    at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.requestMappingHandlerMapping(WebMvcConfigurationSupport.java:304)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    ... 53 more
</code>```

The link of Github is as follows:
spring-mvc-demo

Currently the springframework.version is 5.3.1 and it will not work properly.
If you change the springframework.version to 5.2.20.RELEASE, it will work.

Would you please advise me on how to resolve the issue?

The spring MVC application need to work properly with the springframework version 5.3.x(the target version is 5.3.23)

Body:
I have to use spring framework, spring security and web.xml (not spring boot) in order to make web application.
When I used springframework.version 5.2.20.RELEASE, the application worked well.
But, when I changed the springframework.version to 5.3.1, the web application didn't work and I received the following error.

SEVERE: Servlet.init() for servlet [dispatcher] threw exception
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]: Factory method 'requestMappingHandlerMapping' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.web.cors.CorsConfiguration.addAllowedOriginPattern(Ljava/lang/String;)V
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1179)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:571)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:588)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:702)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:668)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:716)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:591)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:530)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:170)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1161)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1114)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1007)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4948)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5256)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1383)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1383)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:265)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:430)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:772)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:347)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]: Factory method 'requestMappingHandlerMapping' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.web.cors.CorsConfiguration.addAllowedOriginPattern(Ljava/lang/String;)V
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651)
    ... 52 more
Caused by: java.lang.NoSuchMethodError: org.springframework.web.cors.CorsConfiguration.addAllowedOriginPattern(Ljava/lang/String;)V
    at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.<clinit>(AbstractHandlerMethodMapping.java:87)
    at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.createRequestMappingHandlerMapping(WebMvcConfigurationSupport.java:344)
    at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.requestMappingHandlerMapping(WebMvcConfigurationSupport.java:304)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    ... 53 more

The link of Github is as follows:
spring-mvc-demo

Currently the springframework.version is 5.3.1 and it will not work properly.
If you change the springframework.version to 5.2.20.RELEASE, it will work.

Would you please advise me on how to resolve the issue?

The spring MVC application need to work properly with the springframework version 5.3.x(the target version is 5.3.23)


问:
Firebase Notifications for in app messaging between two users
I am developing an IOS application where two users could message each other. I have encountered a problem with being able to set something up where if user A messaged user B, user B would receive an automatic notification that they have a message.

So far I have everything set up so that, I, can send notifications to every user via Firebase Cloud Messaging. I have searched everywhere to see if this could extend to notifications being able to be triggered by users but could not find anything that was not sending a notification to every user as administrator.

I have a collection in my cloud storage that handles messaging, so messages are stored and fetched properly and in real time. Is there a way where I could possibly put a live listener in the same function of storing a message in the DB that would trigger a notification for the user receiving the message?  This is what my send message function looks like.

```<code>    func sendMessage(matchId: String, message: String){

        fetchUserProfile { result in
            switch result {
            case .success(let user):
                self.db.collection("matches").document(matchId).collection("messages")
                    .addDocument(data:
                                    ["message" : message,
                                     "senderId" : self.userId!,
                                     "timestamp" : FieldValue.serverTimestamp(),
                                     "senderName" : user.name
                                    ])
            case .failure(let error):
                print("Error sending message \(error)")
            }
        }

    }
</code>```

Or perhaps there is something else I have to do? Any guidance towards the right direction will help. Thank you.

Body:
I am developing an IOS application where two users could message each other. I have encountered a problem with being able to set something up where if user A messaged user B, user B would receive an automatic notification that they have a message.

So far I have everything set up so that, I, can send notifications to every user via Firebase Cloud Messaging. I have searched everywhere to see if this could extend to notifications being able to be triggered by users but could not find anything that was not sending a notification to every user as administrator.

I have a collection in my cloud storage that handles messaging, so messages are stored and fetched properly and in real time. Is there a way where I could possibly put a live listener in the same function of storing a message in the DB that would trigger a notification for the user receiving the message?  This is what my send message function looks like.

    func sendMessage(matchId: String, message: String){

        fetchUserProfile { result in
            switch result {
            case .success(let user):
                self.db.collection("matches").document(matchId).collection("messages")
                    .addDocument(data:
                                    ["message" : message,
                                     "senderId" : self.userId!,
                                     "timestamp" : FieldValue.serverTimestamp(),
                                     "senderName" : user.name
                                    ])
            case .failure(let error):
                print("Error sending message \(error)")
            }
        }

    }

Or perhaps there is something else I have to do? Any guidance towards the right direction will help. Thank you.


问:
API Call returning Gibberish
I'm building a recipe app with Next.js and JS and using RapidAPI for the api. I used the JS axios snippet for the api but when it tries to fetch, it shows the data as gibberish.

```<code>{data: '\x03�\x04\x00�̦���r��/椥f�b���\nfY\v�ݜX(«ձoi�<\x16X�KX�\x1A~3�&Ԁ��\x7F�…�����\rg�Y\x19��[\x15{<;R\x7F�܄E�_r��M�i�\x05��M��\x11��{X\r�e�7\x00\x03', status: 200, statusText: 'OK', headers: AxiosHeaders, config: {…}, …}
config
:
{transitional: {…}, adapter: Array(2), transformRequest: Array(1), transformResponse: Array(1), timeout: 0, …}
data
:
"\u0003�\u0004\u0000�̦���r��/椥f�b���\nfY\u000b�ݜX(«ձoi�<\u0016X�KX�\u001a~3�&Ԁ���D\u0019��/L���\n��_\u0018� :\rH҄:��\f\u0011�R�\t�0��A�\b�Z�%v:e�X�S�}��_ϟ̽�!��� �\u000e��\u0010�P{�̃���{�!�����\u0018�\u000e\u000b�\"�Ag�Y\u001bg�\u001c/�:����qF4¬f�\u001biҁư��lPZ�Ţ(-α�\u0016EI�{�f�pF�\u0011-�\u0015��I.\u0015Ɛ�f�@�B>oI��\u001c�x\u0014��\u0012�j+�I?��\u0014q�\u0005��[��u�^�i�1b~{q�xvx��CT�D�'�Q�k�z���\u0011p\u0003��e\u0005��N�\u0003�r̷.p��&�{���Q��;GF�s�-�?��\u001c���*\b�'\u0016������ꈽ��c������\rg�Y\u0019��[\u0015{<;R�܄E�_r��M�i�\u0005��M��\u0011��{X\r�e�7\u0000\u0003"
headers
:
AxiosHeaders {content-length: '928', content-type: 'application/json; charset=utf-8', date: 'Tue, 10 Jan 2023 00:14:52 GMT', etag: '"6fu9sm4bm6fx"', vary: 'Accept-Encoding'}
request
:
XMLHttpRequest {onreadystatechange: null, readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, …}
status
:
200
statusText
:
"OK"
[[Prototype]]
:
Object
</code>```

Below is the call for the api. I don't know if it has something to do with my key or what. Any help would be greatly appreciated.

```<code>export default async function handler(req, res) {
   const options = {
      url: 'https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/complexSearch',
      params: {
         query: req.query.keyword,
         diet: req.query.diet,
         intolerances: req.query.intolerances,
         excludeIngredients: req.query.exclude,
         number: '20',
         offset: '0',
      },
      headers: {
         'X-RapidAPI-Host':
            'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com',
         'X-RapidAPI-Key': process.env.NEXT_PUBLIC_RAPIDAPI_KEY,
      },
   };

   try {
      let response = await axios(options);
      res.status(200).json(response.data);
   } catch (error) {
      console.error(error.response);
   }
}
</code>```

Title: API Call returning Gibberish

Body:
I'm building a recipe app with Next.js and JS and using RapidAPI for the api. I used the JS axios snippet for the api but when it tries to fetch, it shows the data as gibberish.

{data: '\x03�\x04\x00�̦���r��/椥f�b���\nfY\v�ݜX(«ձoi�<\x16X�KX�\x1A~3�&Ԁ��\x7F�…�����\rg�Y\x19��[\x15{<;R\x7F�܄E�_r��M�i�\x05��M��\x11��{X\r�e�7\x00\x03', status: 200, statusText: 'OK', headers: AxiosHeaders, config: {…}, …}
config
:
{transitional: {…}, adapter: Array(2), transformRequest: Array(1), transformResponse: Array(1), timeout: 0, …}
data
:
"\u0003�\u0004\u0000�̦���r��/椥f�b���\nfY\u000b�ݜX(«ձoi�<\u0016X�KX�\u001a~3�&Ԁ���D\u0019��/L���\n��_\u0018� :\rH҄:��\f\u0011�R�\t�0��A�\b�Z�%v:e�X�S�}��_ϟ̽�!��� �\u000e��\u0010�P{�̃���{�!�����\u0018�\u000e\u000b�\"�Ag�Y\u001bg�\u001c/�:����qF4¬f�\u001biҁư��lPZ�Ţ(-α�\u0016EI�{�f�pF�\u0011-�\u0015��I.\u0015Ɛ�f�@�B>oI��\u001c�x\u0014��\u0012�j+�I?��\u0014q�\u0005��[��u�^�i�1b~{q�xvx��CT�D�'�Q�k�z���\u0011p\u0003��e\u0005��N�\u0003�r̷.p��&�{���Q��;GF�s�-�?��\u001c���*\b�'\u0016������ꈽ��c������\rg�Y\u0019��[\u0015{<;R�܄E�_r��M�i�\u0005��M��\u0011��{X\r�e�7\u0000\u0003"
headers
:
AxiosHeaders {content-length: '928', content-type: 'application/json; charset=utf-8', date: 'Tue, 10 Jan 2023 00:14:52 GMT', etag: '"6fu9sm4bm6fx"', vary: 'Accept-Encoding'}
request
:
XMLHttpRequest {onreadystatechange: null, readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, …}
status
:
200
statusText
:
"OK"
[[Prototype]]
:
Object

Below is the call for the api. I don't know if it has something to do with my key or what. Any help would be greatly appreciated.

export default async function handler(req, res) {
   const options = {
      url: 'https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/complexSearch',
      params: {
         query: req.query.keyword,
         diet: req.query.diet,
         intolerances: req.query.intolerances,
         excludeIngredients: req.query.exclude,
         number: '20',
         offset: '0',
      },
      headers: {
         'X-RapidAPI-Host':
            'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com',
         'X-RapidAPI-Key': process.env.NEXT_PUBLIC_RAPIDAPI_KEY,
      },
   };

   try {
      let response = await axios(options);
      res.status(200).json(response.data);
   } catch (error) {
      console.error(error.response);
   }
}


问:
How to write code that implements Grey-edge color correction method?
I need function in python that implements grey edge method for color correction. Function should get image that is type numpy and return corrected image.

I explored how grey-edge works ( https://www.researchgate.net/publication/49856707_Computational_Color_Constancy_Survey_and_Experiments , http://lear.inrialpes.fr/people/vandeweijer/papers/cr2542.pdf ) and I wrote a function using numpy. I was sure this was good logic but it seems like it isn't. I gave my everything to try to understand what should happen.

```<code>import cv2
import numpy as np
from skimage import io
import matplotlib.pyplot as plt

def grey_edge(img: np.ndarray) -> np.ndarray:
    img = img.astype(np.float32)
    # Convert image to opponent color space
    O1 = img[..., 0] - 0.5 * img[..., 1] - 0.5 * img[..., 2]
    O2 = 0.5 * img[..., 0] - 0.5 * img[..., 1] + img[..., 2]
    O3 = 0.5 * img[..., 0] + img[..., 1] - 0.5 * img[..., 2]
    img_opponent = np.stack([O1, O2, O3], axis=-1)

    # Calculate color derivatives using OpenCV
    color_derivatives = np.zeros_like(img)
    for channel in range(3):
        color_derivatives[..., channel] = cv2.Sobel(img_opponent[..., channel], cv2.CV_64F, 1, 0)

    # Find average color derivative
    avg_derivative = color_derivatives.mean(axis=(0, 1))

    # Perform the skewing operation
    k = 1 / avg_derivative
    color_derivatives *= k

    # Transform the image back to the original color space
    img_corrected = np.zeros_like(img)
    img_corrected[..., 0] = O1 + k[0] * O3
    img_corrected[..., 1] = O2 + k[1] * O3
    img_corrected[..., 2] = O3 + k[2] * O3

    # Clipping the pixels value above 1 and below 0
    img_corrected = np.clip(img_corrected, 0, 1)
    return img_corrected

if __name__ == '__main__':
    image = io.imread("images/1.png")
    plt.imshow(image)
    plt.axis('off')
    plt.waitforbuttonpress()
    image = grey_edge(image)
    plt.imshow(image)
    plt.axis('off')
    plt.waitforbuttonpress()
</code>```

This is my code.
Output:
[1]: https://i.stack.imgur.com/I4A2r.png
[2]: https://i.stack.imgur.com/hDRkf.png

It is clearly not working, but I don't know how to change in logic.

Body:
I need function in python that implements grey edge method for color correction. Function should get image that is type numpy and return corrected image.

I explored how grey-edge works ( https://www.researchgate.net/publication/49856707_Computational_Color_Constancy_Survey_and_Experiments , http://lear.inrialpes.fr/people/vandeweijer/papers/cr2542.pdf ) and I wrote a function using numpy. I was sure this was good logic but it seems like it isn't. I gave my everything to try to understand what should happen.

import cv2
import numpy as np
from skimage import io
import matplotlib.pyplot as plt

def grey_edge(img: np.ndarray) -> np.ndarray:
    img = img.astype(np.float32)
    # Convert image to opponent color space
    O1 = img[..., 0] - 0.5 * img[..., 1] - 0.5 * img[..., 2]
    O2 = 0.5 * img[..., 0] - 0.5 * img[..., 1] + img[..., 2]
    O3 = 0.5 * img[..., 0] + img[..., 1] - 0.5 * img[..., 2]
    img_opponent = np.stack([O1, O2, O3], axis=-1)

    # Calculate color derivatives using OpenCV
    color_derivatives = np.zeros_like(img)
    for channel in range(3):
        color_derivatives[..., channel] = cv2.Sobel(img_opponent[..., channel], cv2.CV_64F, 1, 0)

    # Find average color derivative
    avg_derivative = color_derivatives.mean(axis=(0, 1))

    # Perform the skewing operation
    k = 1 / avg_derivative
    color_derivatives *= k

    # Transform the image back to the original color space
    img_corrected = np.zeros_like(img)
    img_corrected[..., 0] = O1 + k[0] * O3
    img_corrected[..., 1] = O2 + k[1] * O3
    img_corrected[..., 2] = O3 + k[2] * O3

    # Clipping the pixels value above 1 and below 0
    img_corrected = np.clip(img_corrected, 0, 1)
    return img_corrected

if __name__ == '__main__':
    image = io.imread("images/1.png")
    plt.imshow(image)
    plt.axis('off')
    plt.waitforbuttonpress()
    image = grey_edge(image)
    plt.imshow(image)
    plt.axis('off')
    plt.waitforbuttonpress()

This is my code.
Output:
[1]: https://i.stack.imgur.com/I4A2r.png
[2]: https://i.stack.imgur.com/hDRkf.png

It is clearly not working, but I don't know how to change in logic.


问:
Add daily data while keeping the data from the day before (Measuring Daily -Incremental-Change) in Excel, Power Query
I have a basic query (Excel, Power Query) that I refresh daily and wanted to start keeping track of daily changes, and incremental changes to totals when I group the data set by select categories. For example, the data table has five different categories, Grp A through Grp E, and the users in my data set can move between these categories day to day.
I was able to group all the users from my data set and got the total of users in each group daily. However, I want to track (daily) changes between the groups. In essence, I am trying to keep the old data in the grouped table from the day before, then add a new column to reflect today's total users in each group, then the next day, the day after the next, and so on. I did make an attempt to use "Append" but I lose the previous data (Number of --Count of-- users per group) from the day before each time I refreshed my queries. I also tried using Pivot Tables outside Power Query but had no success.

Please note that not all the group categories may appear every day. For example, Monday, I may have 25,31,19, and 33 in groups "Grp A, Grp B, Grp C, Grp D", respectively. While the next day, I may have users in Grp A, Grp D only and 0 in groups B and C. I still want to account for the change under this scenario as well.
Below is a snippet of the output table that I would like to get, and my only other question;is there a way to reference the new columns headers to today's (current) date whenever I refresh the query to measure the daily change?

I would really appreciate it if you can share any guidance,suggestions or point me in the right direction. I might be overthinking, complicating this process.


问:
Django 4 - TransactionTestCase - Postgresql sqlflush error
My code:

Django 4.1

I am using multiple postgresql schemas for my models, postgresql12 with out-of-box ubuntu 20.04 setup.

I am performing unit tests of some code which uses transactions.

migrations are created

When running other non-transaction tests with django TestCase, everything works normal.

When running transaction test with TransactionTestCase (even with empty test function), this happens:

```<code>django.db.utils.NotSupportedError: cannot truncate a table referenced in a foreign key constraint
DETAIL:  Table "users_user_permissions" references "auth_permission".
HINT:  Truncate table "users_user_permissions" at the same time, or use TRUNCATE ... CASCADE.
...
django.core.management.base.CommandError: Database test_mike3 couldn't be flushed. Possible reasons:
  * The database isn't running or isn't configured correctly.
  * At least one of the expected database tables doesn't exist.
  * The SQL was invalid.
Hint: Look at the output of 'django-admin sqlflush'. That's the SQL this command wasn't able to run.
</code>```

django-admin sqlflush:

```<code>BEGIN;
TRUNCATE "django_content_type", "auth_group_permissions", "django_session", "auth_group", "auth_permission", "django_admin_log" RESTART IDENTITY;
COMMIT;
</code>```

My solution

I have gone into code and added _fixture_teardown(self) override to my ExampleTestCase(TransactionTestCase): basically changed allow_cascade=True in flush command.

Since by this documentation: https://docs.djangoproject.com/en/4.1/topics/testing/advanced/ not setting available_apps might cause memory leaks, I will probably set all my apps to it so allow_cascade is set to True automatically. Original django code:

```<code>    def _fixture_teardown(self):
        # Allow TRUNCATE ... CASCADE and don't emit the post_migrate signal
        # when flushing only a subset of the apps
        for db_name in self._databases_names(include_mirrors=False):
            # Flush the database
            inhibit_post_migrate = (
                self.available_apps is not None or
                (   # Inhibit the post_migrate signal when using serialized
                    # rollback to avoid trying to recreate the serialized data.
                    self.serialized_rollback and
                    hasattr(connections[db_name], '_test_serialized_contents')
                )
            )
            call_command('flush', verbosity=0, interactive=False,
                         database=db_name, reset_sequences=False,
                         allow_cascade=self.available_apps is not None,
                         inhibit_post_migrate=inhibit_post_migrate)
</code>```

Do you have any idea why is it unable to flush db with TransactionTestCase in the first place?

Body:
My code:

Django 4.1

I am using multiple postgresql schemas for my models, postgresql12 with out-of-box ubuntu 20.04 setup.

I am performing unit tests of some code which uses transactions.

migrations are created

When running other non-transaction tests with django TestCase, everything works normal.

When running transaction test with TransactionTestCase (even with empty test function), this happens:

django.db.utils.NotSupportedError: cannot truncate a table referenced in a foreign key constraint
DETAIL:  Table "users_user_permissions" references "auth_permission".
HINT:  Truncate table "users_user_permissions" at the same time, or use TRUNCATE ... CASCADE.
...
django.core.management.base.CommandError: Database test_mike3 couldn't be flushed. Possible reasons:
  * The database isn't running or isn't configured correctly.
  * At least one of the expected database tables doesn't exist.
  * The SQL was invalid.
Hint: Look at the output of 'django-admin sqlflush'. That's the SQL this command wasn't able to run.

django-admin sqlflush:

BEGIN;
TRUNCATE "django_content_type", "auth_group_permissions", "django_session", "auth_group", "auth_permission", "django_admin_log" RESTART IDENTITY;
COMMIT;

My solution

I have gone into code and added _fixture_teardown(self) override to my ExampleTestCase(TransactionTestCase): basically changed allow_cascade=True in flush command.

Since by this documentation: https://docs.djangoproject.com/en/4.1/topics/testing/advanced/ not setting available_apps might cause memory leaks, I will probably set all my apps to it so allow_cascade is set to True automatically. Original django code:

    def _fixture_teardown(self):
        # Allow TRUNCATE ... CASCADE and don't emit the post_migrate signal
        # when flushing only a subset of the apps
        for db_name in self._databases_names(include_mirrors=False):
            # Flush the database
            inhibit_post_migrate = (
                self.available_apps is not None or
                (   # Inhibit the post_migrate signal when using serialized
                    # rollback to avoid trying to recreate the serialized data.
                    self.serialized_rollback and
                    hasattr(connections[db_name], '_test_serialized_contents')
                )
            )
            call_command('flush', verbosity=0, interactive=False,
                         database=db_name, reset_sequences=False,
                         allow_cascade=self.available_apps is not None,
                         inhibit_post_migrate=inhibit_post_migrate)

Do you have any idea why is it unable to flush db with TransactionTestCase in the first place?


问:
React how to implement case opening animation

```<code>import { useEffect, useState } from "react"
import { useParams } from "react-router-dom"
import robux from "../images/robux.png"
import CaseItem from "../Components/CaseItem"
export default function CaseOpening() {
    const chosenCase = useParams().case
    console.log(chosenCase)
    const items = [1, 2, 3, 4, 5, 6, 1]
    //we have a param, lets see if its a valid case!

    return (
        <div className="case-open-container">
            <h2 className="case-title">{chosenCase}</h2>
            <div className="case-price">
                <div className="case-price-in mx-3">53,155</div>
                <img className="sell-robux" src={robux} ></img>

            </div>
            <div className="case-area">
                <div className="arrow-down"></div>
                <div className="case-items" style={{ overflow: "visible" }}>
                    {items.map((item, index) =>
                        <CaseItem
                            key={index}
                            title={"Eerie Pumpkin Head"}
                            price={"59,421"}
                            image={'https://rest-bf.blox.land/render/1158416'}
                        ></CaseItem>

                    )}
                </div>
                <div className="arrow-up"></div>
            </div>
        </div >
    )

}
</code>```

I want to create a case opening animation like so when a user clicks a button to spin this will spin and randomly pick an item. Does anyone have any ideas for how I could implement something like this in React I honestly don't even know where to begin.

Body:
import { useEffect, useState } from "react"
import { useParams } from "react-router-dom"
import robux from "../images/robux.png"
import CaseItem from "../Components/CaseItem"
export default function CaseOpening() {
    const chosenCase = useParams().case
    console.log(chosenCase)
    const items = [1, 2, 3, 4, 5, 6, 1]
    //we have a param, lets see if its a valid case!

    return (

{chosenCase}

53,155

                    {items.map((item, index) =>
                        <CaseItem
                            key={index}
                            title={"Eerie Pumpkin Head"}
                            price={"59,421"}
                            image={'https://rest-bf.blox.land/render/1158416'}
                        ></CaseItem>

                    )}

    )

}

I want to create a case opening animation like so when a user clicks a button to spin this will spin and randomly pick an item. Does anyone have any ideas for how I could implement something like this in React I honestly don't even know where to begin.


问:
pyqgis plugin change QDialog to QMainWindow
I have a plugin window is QDialog, but I want to add QMenubar or QStatusBar

I have tried to find a way to convert QDialog to QMainWindow, but there is no result,
So I try to add QMenubar in QDialog again and everything works fine
Until the position of the object I added to the layout screen ran to the upper left corner.

I am not a native English speaker

def run(self):
    """Run method that performs all the real work"""

    # Create the dialog with elements (after translation) and keep reference
    # Only create GUI ONCE in callback, so that it will only load when the plugin is started
    if self.first_start == True:
        self.first_start = False

    #建立menuBar的父節點物件
    file_menu = QMenu("File")
    #建立一個
    open_action = QAction("Open",file_menu)
    open_action.setShortcut('Alt+F4')
    #把剛才建立的open action 加入file 節點
    file_menu.addAction(open_action)
    #建立一個menubar物件
    menubar = QMenuBar(self.dlg)
    #將父節點加入menubar
    menubar.addMenu(file_menu)
    #將self.dlg的menubar設定為menubar物件
    self.dlg.setMenuBar(menubar)

    # show the dialog
    self.dlg.show()
    # Run the dialog event loop
    result = self.dlg.exec_()
    # See if OK was pressed
    if result:
        # Do something useful here - delete the line containing pass and
        # substitute with your code.
        pass

```