问:
Can I catch an Exception inside a package that is used by another package?
There is this one HttpLinkParserException from gql_http_link that I can't seem to catch with my code:

try {
  return Query$GatherAssets$Widget(
    options: ...
    builder: ...
  );
} on HttpLinkParserException catch (e) {
  return Text(e.toString());
}
```
<p>Here I'm using a query widget from graphql_codegen. I haven't logged in my account on purpose to bring up a 302 redirection to my login, but my debug app keeps getting paused at this one <code>throw HttpLinkParserException</code> from <code>gql_http_link</code> and it returns</p>
```OperationException(linkException: ResponseFormatException(originalException: FormatException: Unexpected character (at character 1)
You are being re...
^
), graphqlErrors: [])
```
<p>(This redirection message is returned to me by my server that I do not have control on)
I also tried adding a custom ResponseParser by extending one and adding it to my HttpLink but it didn't even go in as my print didn't show up in the console.</p>
<p>I tried to catch <code>HttpLinkParserException</code>, <code>OperationException</code>, <code>FormatException</code> etc around my query widget, but nothing worked. I asked to Flutter's community on Discord, and someone suggested it was because the codegen package wasn't handling errors so I couldn't either, as a future would only trigger a catch block on an exception if it is awaited within a try block. Therefore, I also asked to both packages their thought on this matter, and the codegen one almost instantly closed the ticket saying they don't do anything special in this library and that I should report this on the client library. Which hasn't answered me yet.
I'm no expert in how try/catch work either, so maybe the mistake is purely on my side.</p>
<p>I don't really have any idea of why I can't catch this exception properly: is it because there is <code>graphql_codegen</code> between the raised exception and my catch, as the title suggests? How would I be able to catch it?</p>
<p>Let me know if there is any missing information, I'm not very used to ask questions here yet.</p>
<p>Versions:</p>
<blockquote>
```gql: ^0.13.1
graphql_codegen: ^0.11.2
```
</blockquote>
<p>Flutter doctor:</p>
<blockquote>
```flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
Flutter (Channel stable, 3.3.9, on Microsoft Windows [version 10.0.19044.2251], locale en-EN)
Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
Chrome - develop for the web
Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.0)
Android Studio (version 2021.1)
VS Code (version 1.73.1)
Connected device (4 available)
HTTP Host Availability

No issues found!
```

Body:
There is this one HttpLinkParserException from gql_http_link that I can't seem to catch with my code:

try {
  return Query$GatherAssets$Widget(
    options: ...
    builder: ...
  );
} on HttpLinkParserException catch (e) {
  return Text(e.toString());
}

Here I'm using a query widget from graphql_codegen. I haven't logged in my account on purpose to bring up a 302 redirection to my login, but my debug app keeps getting paused at this one throw HttpLinkParserException from gql_http_link and it returns

OperationException(linkException: ResponseFormatException(originalException: FormatException: Unexpected character (at character 1)
You are being re...
^
), graphqlErrors: [])

(This redirection message is returned to me by my server that I do not have control on)
I also tried adding a custom ResponseParser by extending one and adding it to my HttpLink but it didn't even go in as my print didn't show up in the console.

I tried to catch HttpLinkParserException, OperationException, FormatException etc around my query widget, but nothing worked. I asked to Flutter's community on Discord, and someone suggested it was because the codegen package wasn't handling errors so I couldn't either, as a future would only trigger a catch block on an exception if it is awaited within a try block. Therefore, I also asked to both packages their thought on this matter, and the codegen one almost instantly closed the ticket saying they don't do anything special in this library and that I should report this on the client library. Which hasn't answered me yet.
I'm no expert in how try/catch work either, so maybe the mistake is purely on my side.

I don't really have any idea of why I can't catch this exception properly: is it because there is graphql_codegen between the raised exception and my catch, as the title suggests? How would I be able to catch it?

Let me know if there is any missing information, I'm not very used to ask questions here yet.

Versions:

gql: ^0.13.1
graphql_codegen: ^0.11.2

Flutter doctor:

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
Flutter (Channel stable, 3.3.9, on Microsoft Windows [version 10.0.19044.2251], locale en-EN)
Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
Chrome - develop for the web
Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.0)
Android Studio (version 2021.1)
VS Code (version 1.73.1)
Connected device (4 available)
HTTP Host Availability

No issues found!


来源: stackexchange

问:
Find all Hamiltonian cycles
n person will go to a meeting. The meeting will be happen once a day and everybody will sit around a round table. The question is how many days have to arrange each day and how to arrange so that each person will have two people next to them who are new friends. Note that all people  want to get to know each others.

n must be an odd number

For example, when n = 11
The number of days has to be (n-1)/2
The programme must print:

1 2 3 4 5 6 7 8 9 10 11 1

1 3 5 2 7 4 9 6 11 8 10 1

1 5 7 3 9 2 11 4 10 6 8 1

1 7 9 5 11 3 10 2 8 4 6 1

1 9 11 7 10 5 8 3 6 2 4 1

How can solve this problem with python ?

ContentLicense: CC BY-SA 4.0

Title: Find all Hamiltonian cycles


问:
actions not using default working directory
I have a repository with some subdirectories. One of the subdirectory is called gradle-specific which is the gradle project. I want to run ./gradlew clean build using github actions. My yaml file looks as follows:

name: Java CI with Gradle

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

permissions:
  contents: read

jobs:
  build:
    runs-on: ubuntu-latest
    defaults:
      run:
        shell: bash
        working-directory: ./gradle-specific
    steps:
    - uses: actions/checkout@v3
    - name: Set up JDK 16
      uses: actions/setup-java@v3
      with:
        java-version: '16'
        distribution: 'temurin'
    - name: Build with Gradle
      uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
      with:
        arguments: clean build
```
<p>but error logs indicate that the build is happening in the root folder itself:</p>
```Error: Error: Cannot locate a Gradle wrapper properties file at '/home/runner/work/service-commons/service-commons/gradle/wrapper/gradle-wrapper.properties'. Specify 'gradle-version' or 'gradle-executable' for projects without Gradle wrapper configured.
```

where service-commons is my repository name

I tried specifying the working directory without relative path, with relative path, specifying globally. I am following https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrun to configure the same

Body:
I have a repository with some subdirectories. One of the subdirectory is called gradle-specific which is the gradle project. I want to run ./gradlew clean build using github actions. My yaml file looks as follows:

name: Java CI with Gradle

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

permissions:
  contents: read

jobs:
  build:
    runs-on: ubuntu-latest
    defaults:
      run:
        shell: bash
        working-directory: ./gradle-specific
    steps:
    - uses: actions/checkout@v3
    - name: Set up JDK 16
      uses: actions/setup-java@v3
      with:
        java-version: '16'
        distribution: 'temurin'
    - name: Build with Gradle
      uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
      with:
        arguments: clean build

but error logs indicate that the build is happening in the root folder itself:

Error: Error: Cannot locate a Gradle wrapper properties file at '/home/runner/work/service-commons/service-commons/gradle/wrapper/gradle-wrapper.properties'. Specify 'gradle-version' or 'gradle-executable' for projects without Gradle wrapper configured.

where service-commons is my repository name

I tried specifying the working directory without relative path, with relative path, specifying globally. I am following https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrun to configure the same


问:
Macro to open reports in a specified folder, then open the vba in each report and find and replace a specific text string
I am not quiet sure if this is possible or not, but I am updating from 32 bit to 64 bit excel, and there is a little of a language change between the two. I have many reports that need updating, and going into each file and find and replace would take really long.

I need a macro to do the following in order:

Open a report from specified folder

search within the visual basic codes

Find and replace a specified text

save and close the file

Move on to the next report

Thanks,
Saima

I have a code that searched through the workbook but not the VBA, i need the code to work for text embedded in the VBA.


问:
Safari 16.0 getUserMedia permission prompt is not showing up after disallowing permissions the 3rd time
Version 16.0 (17614.1.25.9.10, 17614)

I'm currently working on a flow related to allowing user permissions on a certain screen. I tested by clicking Don't allow multiple times. For some reason, the popup stops appearing after clicking Don't allow 3 times and it stays as denied until I closes the browser. Is this the expected behaviour?


问:
Self host runner in github action
The hosts on github action are in US only and I need to run my tests from EU region. I created AWS ec2 with eu region and connect my github workflow to the instance. I installed python3.10 on my ec2 :
enter image description here
but when I try to run the test I get this error:

Version 3.10.0 was not found in the local cache
Error: Version 3.10.0 with arch x64 not found
The list of all available versions can be found here: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json

Do any one know what should I do ?

try to change version , without any version reinstall python. didn't work for me...

Title: Self host runner in github action


问:
Volley Parse Error, Handling String in a Json Object Request
I'm using JsonObjectRequest because the Api Response is in JSON Format but in some cases, the response can be just a String. So if the API returns a String, It will generate a Volley Parse Error. So I'm just wondering if there is any solution for handlings a string in JsonObjectRequest without having to use StringRequest or CustomRequest.
Here's my Code:</p>
```<code>    JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, url,null,
            (Response.Listener<JSONObject>) response -> {
                JSONObject jsonObject = response;
                Map map = new Gson().fromJson(String.valueOf(jsonObject),HashMap.class);

            },
            new Response.ErrorListener() {
                public void onErrorResponse(VolleyError error) {
                    try {
                        String responseBody = new String(error.networkResponse.data, "utf-8");
                        Toast.makeText(mContext, responseBody, Toast.LENGTH_LONG).show();
                    } catch (Exception e) {
                        Toast.makeText(mContext, "Something went wrong! ", Toast.LENGTH_SHORT).show();
                    }

                }
            }
    ) {
        public byte[] getBody() {
            return new JSONObject(params).toString().getBytes();
        }
        public String getBodyContentType() {
            return "application/json";
        }
    };

    Volley.newRequestQueue(mContext).add(request);
</code>```

Body:
I'm using JsonObjectRequest because the Api Response is in JSON Format but in some cases, the response can be just a String. So if the API returns a String, It will generate a Volley Parse Error. So I'm just wondering if there is any solution for handlings a string in JsonObjectRequest without having to use StringRequest or CustomRequest.
Here's my Code:

    JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, url,null,
            (Response.Listener<JSONObject>) response -> {
                JSONObject jsonObject = response;
                Map map = new Gson().fromJson(String.valueOf(jsonObject),HashMap.class);

            },
            new Response.ErrorListener() {
                public void onErrorResponse(VolleyError error) {
                    try {
                        String responseBody = new String(error.networkResponse.data, "utf-8");
                        Toast.makeText(mContext, responseBody, Toast.LENGTH_LONG).show();
                    } catch (Exception e) {
                        Toast.makeText(mContext, "Something went wrong! ", Toast.LENGTH_SHORT).show();
                    }

                }
            }
    ) {
        public byte[] getBody() {
            return new JSONObject(params).toString().getBytes();
        }
        public String getBodyContentType() {
            return "application/json";
        }
    };

    Volley.newRequestQueue(mContext).add(request);


问:
Problem installing npm passport package and removing node_modules (Node.js errno: -4094)
Can anyone help me out with this issue? I've tried to install npm passport package (as well as another packages for trial) unsuccessfully and I've got the following message at terminal:

```<code>z00441xk@md3n4gkc MINGW64 \~/Documentos/Samuel/Documento Pessoais/Node.js/Secrets (master)
$ npm i passport
npm ERR! code UNKNOWN
npm ERR! syscall rename
npm ERR! path C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk\\credential-pro
npm ERR! dest C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk.credential-pr
npm ERR! errno -4094
npm ERR! UNKNOWN: unknown error, rename 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_moduocumentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk.credential-provider-sso-Hgt41GOO'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\\Users\\z00441xk\\AppData\\Local\\npm-cache_logs\\2022-12-08T09_19_34_435Z-debug-0.log
</code>```

And the log has the following content:

```<code>0 verbose cli C:\\Program Files\\nodejs\\node.exe C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js
1 info using npm@8.19.2
2 info using node@v18.12.0
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:\\Program Files\\nodejs\\node_modules\\npm\\npmrc Completed in 3ms
6 timing config:load:builtin Completed in 3ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets.npmrc Completed in 1ms
10 timing config:load:project Completed in 7ms
11 timing config:load:file:C:\\Users\\z00441xk.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:C:\\Users\\z00441xk\\AppData\\Roaming\\npm\\etc\\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 17ms
19 timing npm:load:configload Completed in 17ms
20 timing npm:load:mkdirpcache Completed in 1ms
21 timing npm:load:mkdirplogs Completed in 0ms
22 verbose title npm i passport
23 verbose argv "i" "passport"
24 timing npm:load:setTitle Completed in 2ms
25 timing config:load:flatten Completed in 2ms
26 timing npm:load:display Completed in 3ms
27 verbose logfile logs-max:10 dir:C:\\Users\\z00441xk\\AppData\\Local\\npm-cache_logs
28 verbose logfile C:\\Users\\z00441xk\\AppData\\Local\\npm-cache_logs\\2022-12-08T09_01_48_742Z-debug-0.log
29 timing npm:load:logFile Completed in 12ms
30 timing npm:load:timers Completed in 1ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 36ms
33 timing arborist:ctor Completed in 1ms
34 silly logfile start cleaning logs, removing 2 files
35 silly logfile done cleaning log files
36 timing idealTree:init Completed in 135ms
37 timing idealTree:userRequests Completed in 2ms
38 silly idealTree buildDeps
39 silly fetch manifest passport@\*
40 verbose shrinkwrap failed to load node_modules/.package-lock.json \[Error: UNKNOWN: unknown error, readlink 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk\\credential-provider-sso'\] {
40 verbose shrinkwrap   errno: -4094,
40 verbose shrinkwrap   code: 'UNKNOWN',
40 verbose shrinkwrap   syscall: 'readlink',
40 verbose shrinkwrap   path: 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules\\@aws-sdk\\credential-provider-sso'
40 verbose shrinkwrap }
41 http fetch GET 200 https://registry.npmjs.org/passport 560ms (cache revalidated)
42 silly placeDep ROOT passport@0.6.0 OK for: secrets---starting-code@1.0.0 want: \*
43 silly fetch manifest passport-strategy@1.x.x
44 silly fetch manifest pause@0.0.1
45 http fetch GET 200 https://registry.npmjs.org/pause 151ms (cache revalidated)
46 http fetch GET 200 https://registry.npmjs.org/passport-strategy 354ms (cache revalidated)
47 timing idealTree:#root Completed in 922ms
48 silly placeDep ROOT passport-strategy@1.0.0 OK for: passport@0.6.0 want: 1.x.x
49 silly placeDep ROOT pause@0.0.1 OK for: passport@0.6.0 want: 0.0.1
50 timing idealTree:node_modules/passport Completed in 2ms
51 timing idealTree:node_modules/passport-strategy Completed in 0ms
52 timing idealTree:node_modules/pause Completed in 0ms
53 timing idealTree:buildDeps Completed in 924ms
54 timing idealTree:fixDepFlags Completed in 2ms
55 timing idealTree Completed in 1067ms
56 timing reify:loadTrees Completed in 1067ms
57 timing reify:diffTrees Completed in 14ms
58 silly reify mark retired \[
58 silly reify   'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules\\@aws-sdk\\credential-provider-sso'
58 silly reify \]
59 silly reify moves {
59 silly reify   'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules\\@aws-sdk\\credential-provider-sso': 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules\\@aws-sdk\\.credential-provider-sso-Hgt41GOO'
59 silly reify }
60 timing reify:rollback:retireShallow Completed in 3ms
61 timing command:i Completed in 1098ms
62 verbose stack Error: UNKNOWN: unknown error, rename 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk\\credential-provider-sso' -\> 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk.credential-provider-sso-Hgt41GOO'
63 verbose cwd C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets
64 verbose Windows_NT 10.0.19042
65 verbose node v18.12.0
66 verbose npm  v8.19.2
67 error code UNKNOWN
68 error syscall rename
69 error path C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk\\credential-provider-sso
70 error dest C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk.credential-provider-sso-Hgt41GOO
71 error errno -4094
72 error UNKNOWN: unknown error, rename 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk\\credential-provider-sso' -\> 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk.credential-provider-sso-Hgt41GOO'
73 verbose exit -4094
74 timing npm Completed in 1281ms
75 verbose unfinished npm timer reify 1670490108915
76 verbose unfinished npm timer reify:retireShallow 1670490110006
77 verbose code -4094
78 error A complete log of this run can be found in:
78 error     C:\\Users\\z00441xk\\AppData\\Local\\npm-cache_logs\\2022-12-08T09_01_48_742Z-debug-0.log
</code>```

After some research I've ended up to try and remove node_modules and add it again. However I cannot remove it and I get the following message:

```<code>*z00441xk@md3n4gkc MINGW64 ~/Documentos/Samuel/Documento Pessoais/Node.js/Secrets (master)
$ rm -rf node_modules
rm: cannot remove 'node_modules/@aws-sdk/credential-provider-sso': Input/output error*
</code>```

Finally I've been installing rimraf (npm install rimraf -g) and using the command "$ rimraf node_modules" as well as "$ npx rimraf node_modules", "$ npm cache clean --force", but unfortunately I've got the following message from both attempts from terminal:

```<code>z00441xk@md3n4gkc MINGW64 ~/Documentos/Samuel/Documento Pessoais/Node.js/Secrets (master)
$ npx rimraf node_modules
C:\Users\z00441xk\AppData\Roaming\npm\node_modules\rimraf\bin.js:46
      throw er
      ^

[Error: UNKNOWN: unknown error, unlink 'C:\Users\z00441xk\Documentos\Samuel\Documento Pessoais\Node.js\Secrets\node_modules\@aws-sdk\credential-provider-sso'] {
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'unlink',
  path: 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules\\@aws-sdk\\credential-provider-sso'
}

Node.js v18.12.0
</code>```

Has anyone experienced this before or know what is causing this?
Thank you very much for your cooperation!

Body:
Can anyone help me out with this issue? I've tried to install npm passport package (as well as another packages for trial) unsuccessfully and I've got the following message at terminal:

z00441xk@md3n4gkc MINGW64 \~/Documentos/Samuel/Documento Pessoais/Node.js/Secrets (master)
$ npm i passport
npm ERR! code UNKNOWN
npm ERR! syscall rename
npm ERR! path C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk\\credential-pro
npm ERR! dest C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk.credential-pr
npm ERR! errno -4094
npm ERR! UNKNOWN: unknown error, rename 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_moduocumentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk.credential-provider-sso-Hgt41GOO'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\\Users\\z00441xk\\AppData\\Local\\npm-cache_logs\\2022-12-08T09_19_34_435Z-debug-0.log

And the log has the following content:

0 verbose cli C:\\Program Files\\nodejs\\node.exe C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js
1 info using npm@8.19.2
2 info using node@v18.12.0
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:\\Program Files\\nodejs\\node_modules\\npm\\npmrc Completed in 3ms
6 timing config:load:builtin Completed in 3ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets.npmrc Completed in 1ms
10 timing config:load:project Completed in 7ms
11 timing config:load:file:C:\\Users\\z00441xk.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:C:\\Users\\z00441xk\\AppData\\Roaming\\npm\\etc\\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 17ms
19 timing npm:load:configload Completed in 17ms
20 timing npm:load:mkdirpcache Completed in 1ms
21 timing npm:load:mkdirplogs Completed in 0ms
22 verbose title npm i passport
23 verbose argv "i" "passport"
24 timing npm:load:setTitle Completed in 2ms
25 timing config:load:flatten Completed in 2ms
26 timing npm:load:display Completed in 3ms
27 verbose logfile logs-max:10 dir:C:\\Users\\z00441xk\\AppData\\Local\\npm-cache_logs
28 verbose logfile C:\\Users\\z00441xk\\AppData\\Local\\npm-cache_logs\\2022-12-08T09_01_48_742Z-debug-0.log
29 timing npm:load:logFile Completed in 12ms
30 timing npm:load:timers Completed in 1ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 36ms
33 timing arborist:ctor Completed in 1ms
34 silly logfile start cleaning logs, removing 2 files
35 silly logfile done cleaning log files
36 timing idealTree:init Completed in 135ms
37 timing idealTree:userRequests Completed in 2ms
38 silly idealTree buildDeps
39 silly fetch manifest passport@\*
40 verbose shrinkwrap failed to load node_modules/.package-lock.json \[Error: UNKNOWN: unknown error, readlink 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk\\credential-provider-sso'\] {
40 verbose shrinkwrap   errno: -4094,
40 verbose shrinkwrap   code: 'UNKNOWN',
40 verbose shrinkwrap   syscall: 'readlink',
40 verbose shrinkwrap   path: 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules\\@aws-sdk\\credential-provider-sso'
40 verbose shrinkwrap }
41 http fetch GET 200 https://registry.npmjs.org/passport 560ms (cache revalidated)
42 silly placeDep ROOT passport@0.6.0 OK for: secrets---starting-code@1.0.0 want: \*
43 silly fetch manifest passport-strategy@1.x.x
44 silly fetch manifest pause@0.0.1
45 http fetch GET 200 https://registry.npmjs.org/pause 151ms (cache revalidated)
46 http fetch GET 200 https://registry.npmjs.org/passport-strategy 354ms (cache revalidated)
47 timing idealTree:#root Completed in 922ms
48 silly placeDep ROOT passport-strategy@1.0.0 OK for: passport@0.6.0 want: 1.x.x
49 silly placeDep ROOT pause@0.0.1 OK for: passport@0.6.0 want: 0.0.1
50 timing idealTree:node_modules/passport Completed in 2ms
51 timing idealTree:node_modules/passport-strategy Completed in 0ms
52 timing idealTree:node_modules/pause Completed in 0ms
53 timing idealTree:buildDeps Completed in 924ms
54 timing idealTree:fixDepFlags Completed in 2ms
55 timing idealTree Completed in 1067ms
56 timing reify:loadTrees Completed in 1067ms
57 timing reify:diffTrees Completed in 14ms
58 silly reify mark retired \[
58 silly reify   'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules\\@aws-sdk\\credential-provider-sso'
58 silly reify \]
59 silly reify moves {
59 silly reify   'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules\\@aws-sdk\\credential-provider-sso': 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules\\@aws-sdk\\.credential-provider-sso-Hgt41GOO'
59 silly reify }
60 timing reify:rollback:retireShallow Completed in 3ms
61 timing command:i Completed in 1098ms
62 verbose stack Error: UNKNOWN: unknown error, rename 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk\\credential-provider-sso' -\> 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk.credential-provider-sso-Hgt41GOO'
63 verbose cwd C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets
64 verbose Windows_NT 10.0.19042
65 verbose node v18.12.0
66 verbose npm  v8.19.2
67 error code UNKNOWN
68 error syscall rename
69 error path C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk\\credential-provider-sso
70 error dest C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk.credential-provider-sso-Hgt41GOO
71 error errno -4094
72 error UNKNOWN: unknown error, rename 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk\\credential-provider-sso' -\> 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules@aws-sdk.credential-provider-sso-Hgt41GOO'
73 verbose exit -4094
74 timing npm Completed in 1281ms
75 verbose unfinished npm timer reify 1670490108915
76 verbose unfinished npm timer reify:retireShallow 1670490110006
77 verbose code -4094
78 error A complete log of this run can be found in:
78 error     C:\\Users\\z00441xk\\AppData\\Local\\npm-cache_logs\\2022-12-08T09_01_48_742Z-debug-0.log

After some research I've ended up to try and remove node_modules and add it again. However I cannot remove it and I get the following message:

*z00441xk@md3n4gkc MINGW64 ~/Documentos/Samuel/Documento Pessoais/Node.js/Secrets (master)
$ rm -rf node_modules
rm: cannot remove 'node_modules/@aws-sdk/credential-provider-sso': Input/output error*

Finally I've been installing rimraf (npm install rimraf -g) and using the command "$ rimraf node_modules" as well as "$ npx rimraf node_modules", "$ npm cache clean --force", but unfortunately I've got the following message from both attempts from terminal:

z00441xk@md3n4gkc MINGW64 ~/Documentos/Samuel/Documento Pessoais/Node.js/Secrets (master)
$ npx rimraf node_modules
C:\Users\z00441xk\AppData\Roaming\npm\node_modules\rimraf\bin.js:46
      throw er
      ^

[Error: UNKNOWN: unknown error, unlink 'C:\Users\z00441xk\Documentos\Samuel\Documento Pessoais\Node.js\Secrets\node_modules\@aws-sdk\credential-provider-sso'] {
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'unlink',
  path: 'C:\\Users\\z00441xk\\Documentos\\Samuel\\Documento Pessoais\\Node.js\\Secrets\\node_modules\\@aws-sdk\\credential-provider-sso'
}

Node.js v18.12.0

Has anyone experienced this before or know what is causing this?
Thank you very much for your cooperation!


问:
Graphql query request URL is to large, and i get a status response of 400 Bad Request
My issue is because I have a query that is to big when my configurator runs the getCartDetails.graphql file. In Chrome, under Network, my Graphql call has a 400 Bad Request as its to big to handle it.
My question is, how to split this file, so it doesn't cause this issue?

I have tried to create two seperate files where I import the main graphql file.
First half and second halt, basically to split the main file into 2.
And then call the new merged file where I need it.
But im not sure this is the correct way in doing it.

Any help is much appreciated.
Thank you!

My main graphql file looks like this:

```<code>query getCartDetails($cartId: String!) {
    cart(cart_id: $cartId) {
        id
        items {
            id
            configuration_id
            configuration_short_id
            threekit_image
            created_at
            updated_at
            measurement_status {
                status
                is_expired
                date
                created_by
                messages
                measurement_id
            }
            product {
                id
                name
                sku
                small_image {
                    url
                    label
                }
                price {
                    regularPrice {
                        amount {
                            value
                        }
                    }
                }
                upsell_products {
                    id
                    name
                    sku
                }
                options_container
                uses_configurator
                classification
            }
            extension_attributes {
                kashiyama_quote_item {
                    brand
                    fabric_name
                    item_type
                    item_name
                    model_number
                    season
                    options {
                        part_id
                        part_label
                        model
                        model_label
                        multiplication_factor
                        options {
                            option_label
                            option_id
                            option_value_id
                            option_value_label
                        }
                    }
                    extra_part_options {
                        extra_part_id
                        part_id
                        options {
                            option_id
                            option_value_id
                            price
                        }
                    }
                    extension_attributes {
                        measurement {
                            created_at
                            updated_at
                            options {
                                configurations {
                                    part_id
                                    part_label
                                    tryon_size
                                }
                            }
                        }
                    }
                }
            }
            prices {
                price {
                    currency
                    value
                }
                row_total {
                    currency
                    value
                }
            }
            quantity
            ... on ConfigurableCartItem {
                configurable_options {
                    id
                    option_label
                    value_id
                    value_label
                }
            }
        }
        prices {
            grand_total {
                value
                currency
            }
            subtotal_including_tax {
                value
                currency
            }
            subtotal_excluding_tax {
                value
                currency
            }
            applied_taxes {
                amount {
                    value
                    currency
                }
                label
            }
            discounts {
                amount {
                    value
                    currency
                }
                label
            }
        }
        applied_store_credit {
            enabled
            current_balance {
                value
                currency
            }
            applied_balance {
                value
                currency
            }
        }
        applied_gift_cards {
            code
            expiration_date
            current_balance {
                value
                currency
            }
            applied_balance {
                value
                currency
            }
        }
        applied_coupons {
            code
        }
        applied_gift_cards {
            code
        }
    }
}

</code>```

This is what I tried but im not sure is correct:

```<code>[![enter image description here](https://i.stack.imgur.com/bxhDM.png)](https://i.stack.imgur.com/bxhDM.png)
</code>```

Body:
My issue is because I have a query that is to big when my configurator runs the getCartDetails.graphql file. In Chrome, under Network, my Graphql call has a 400 Bad Request as its to big to handle it.
My question is, how to split this file, so it doesn't cause this issue?

I have tried to create two seperate files where I import the main graphql file.
First half and second halt, basically to split the main file into 2.
And then call the new merged file where I need it.
But im not sure this is the correct way in doing it.

Any help is much appreciated.
Thank you!

My main graphql file looks like this:

query getCartDetails($cartId: String!) {
    cart(cart_id: $cartId) {
        id
        items {
            id
            configuration_id
            configuration_short_id
            threekit_image
            created_at
            updated_at
            measurement_status {
                status
                is_expired
                date
                created_by
                messages
                measurement_id
            }
            product {
                id
                name
                sku
                small_image {
                    url
                    label
                }
                price {
                    regularPrice {
                        amount {
                            value
                        }
                    }
                }
                upsell_products {
                    id
                    name
                    sku
                }
                options_container
                uses_configurator
                classification
            }
            extension_attributes {
                kashiyama_quote_item {
                    brand
                    fabric_name
                    item_type
                    item_name
                    model_number
                    season
                    options {
                        part_id
                        part_label
                        model
                        model_label
                        multiplication_factor
                        options {
                            option_label
                            option_id
                            option_value_id
                            option_value_label
                        }
                    }
                    extra_part_options {
                        extra_part_id
                        part_id
                        options {
                            option_id
                            option_value_id
                            price
                        }
                    }
                    extension_attributes {
                        measurement {
                            created_at
                            updated_at
                            options {
                                configurations {
                                    part_id
                                    part_label
                                    tryon_size
                                }
                            }
                        }
                    }
                }
            }
            prices {
                price {
                    currency
                    value
                }
                row_total {
                    currency
                    value
                }
            }
            quantity
            ... on ConfigurableCartItem {
                configurable_options {
                    id
                    option_label
                    value_id
                    value_label
                }
            }
        }
        prices {
            grand_total {
                value
                currency
            }
            subtotal_including_tax {
                value
                currency
            }
            subtotal_excluding_tax {
                value
                currency
            }
            applied_taxes {
                amount {
                    value
                    currency
                }
                label
            }
            discounts {
                amount {
                    value
                    currency
                }
                label
            }
        }
        applied_store_credit {
            enabled
            current_balance {
                value
                currency
            }
            applied_balance {
                value
                currency
            }
        }
        applied_gift_cards {
            code
            expiration_date
            current_balance {
                value
                currency
            }
            applied_balance {
                value
                currency
            }
        }
        applied_coupons {
            code
        }
        applied_gift_cards {
            code
        }
    }
}

This is what I tried but im not sure is correct:

[![enter image description here](https://i.stack.imgur.com/bxhDM.png)](https://i.stack.imgur.com/bxhDM.png)


问:
what is the difference between pytorch and python kernel in jupyter (or pyspark, tensorflow, XGBoost)?
I noticed when I create a new Jupyter notebook, that I can choose different kernels that are all python based.

I understand when you would choose an R kernel vs a python kernel because you would be writing different code in those situations.

However, what I am really curious about is the difference between a pytorch kernel (or other python based package) and the python kernel.

Are there certain advantages of using the pytorch kernel for a pytorch project or would the python kernel work just as well?


问:
How to set static ip, gateway, dns1 and 2 on android 10?
WifiConfiguration is deprecated and stopped working in API 29

wifiManager.configuredNetworks now returns null

On previous android version I was able to use the below solution using WifiConfiguration

```<code>`fun setStaticIpConfiguration(manager: WifiManager, config: WifiConfiguration, ipAddress: InetAddress?, prefixLength: Int, gateway: InetAddress, dns: Array<InetAddress?>) { // First set up IpAssignment to STATIC.
    val ipAssignment = getEnumValue("android.net.IpConfiguration\$IpAssignment", "STATIC")
    callMethod(config, "setIpAssignment", arrayOf("android.net.IpConfiguration\$IpAssignment"), arrayOf(ipAssignment))

    // Then set properties in StaticIpConfiguration.
    val staticIpConfig = newInstance("android.net.StaticIpConfiguration")
    val linkAddress = newInstance("android.net.LinkAddress", arrayOf(InetAddress::class.java, Int::class.javaPrimitiveType), arrayOf(ipAddress, prefixLength))
    setField(staticIpConfig, "ipAddress", linkAddress)
    setField(staticIpConfig, "gateway", gateway)
    getField(staticIpConfig, "dnsServers", ArrayList::class.java).clear()
    for (i in dns.indices) getField(staticIpConfig, "dnsServers", ArrayList::class.java).add(dns[i] as Nothing)

    callMethod(config, "setStaticIpConfiguration", arrayOf("android.net.StaticIpConfiguration"), arrayOf(staticIpConfig))

    val netId = manager.updateNetwork(config)
    val result = netId != -1
    if (result) {
        val isDisconnected = manager.disconnect()
        val configSaved = manager.saveConfiguration()
        val isEnabled = manager.enableNetwork(config.networkId, true)
        val isReconnected = manager.reconnect()
    }
}

@Throws(IllegalAccessException::class, IllegalArgumentException::class, NoSuchFieldException::class)
private fun setField(`object`: Any, fieldName: String, value: Any) {
    val field = `object`.javaClass.getDeclaredField(fieldName)
    field[`object`] = value
}
`
</code>```
```<code>The android documentation suggest NetworkSpecifier and WifiNetworkSuggestion should be used to replace WifiConfiguration but there are no methods to set ip addresses in these classes.

From API level 33 android introduced StaticIpConfiguration but my device is running on android 10
</code>```

Body:
WifiConfiguration is deprecated and stopped working in API 29

wifiManager.configuredNetworks now returns null

On previous android version I was able to use the below solution using WifiConfiguration

`fun setStaticIpConfiguration(manager: WifiManager, config: WifiConfiguration, ipAddress: InetAddress?, prefixLength: Int, gateway: InetAddress, dns: Array<InetAddress?>) { // First set up IpAssignment to STATIC.
    val ipAssignment = getEnumValue("android.net.IpConfiguration\$IpAssignment", "STATIC")
    callMethod(config, "setIpAssignment", arrayOf("android.net.IpConfiguration\$IpAssignment"), arrayOf(ipAssignment))

    // Then set properties in StaticIpConfiguration.
    val staticIpConfig = newInstance("android.net.StaticIpConfiguration")
    val linkAddress = newInstance("android.net.LinkAddress", arrayOf(InetAddress::class.java, Int::class.javaPrimitiveType), arrayOf(ipAddress, prefixLength))
    setField(staticIpConfig, "ipAddress", linkAddress)
    setField(staticIpConfig, "gateway", gateway)
    getField(staticIpConfig, "dnsServers", ArrayList::class.java).clear()
    for (i in dns.indices) getField(staticIpConfig, "dnsServers", ArrayList::class.java).add(dns[i] as Nothing)

    callMethod(config, "setStaticIpConfiguration", arrayOf("android.net.StaticIpConfiguration"), arrayOf(staticIpConfig))

    val netId = manager.updateNetwork(config)
    val result = netId != -1
    if (result) {
        val isDisconnected = manager.disconnect()
        val configSaved = manager.saveConfiguration()
        val isEnabled = manager.enableNetwork(config.networkId, true)
        val isReconnected = manager.reconnect()
    }
}

@Throws(IllegalAccessException::class, IllegalArgumentException::class, NoSuchFieldException::class)
private fun setField(`object`: Any, fieldName: String, value: Any) {
    val field = `object`.javaClass.getDeclaredField(fieldName)
    field[`object`] = value
}
`

The android documentation suggest NetworkSpecifier and WifiNetworkSuggestion should be used to replace WifiConfiguration but there are no methods to set ip addresses in these classes.

From API level 33 android introduced StaticIpConfiguration but my device is running on android 10


问:
React admin Custom menu issue with menu.resourceItem
I try to develop my own menu to add a custom page to it. When i tried to use custom menu, and especially Menu.ResourceItem it doesn't find my resource ....

My Menu

```<code>// in src/MyMenu.js
import { Menu } from 'react-admin';
import LabelIcon from '@mui/icons-material/Label';

export const MyMenu = () => (
    <Menu>
        <Menu.DashboardItem />
         <Menu.ResourceItem name='user'/>
        <Menu.Item to="/custom-route" primaryText="Miscellaneous" leftIcon={<LabelIcon />}/>
    </Menu>
);

</code>```

My Layout

```<code>// in src/MyLayout.js
import { Layout, LayoutProps } from 'react-admin';

import { MyMenu } from './MyMenu';

export const MyLayout = (props: JSX.IntrinsicAttributes & LayoutProps) => <Layout {...props} menu={MyMenu} />;
</code>```

My reactAdmin.tsx

```<code>import { Admin, Resource } from "react-admin";
import { UserCreate, UserEdit, UserList, UserShow } from "./resources/User";
import { useSession } from "next-auth/react";
import { authProvider } from "./providers/authProvider";
import { dataProvider } from "./providers/dataProvider";
import LoginPage from "./custom-pages/LoginPage";
import { FeedbackList, FeedbackShow } from "./resources/Feedback";
import AccountCircleIcon from '@mui/icons-material/AccountCircle';
import FeedbackIcon from '@mui/icons-material/Feedback';
import { MyLayout } from "./components/MyLayout";

const ReactAdmin = () => {
   const { data: session, status } = useSession();
   if (status === "loading") return <p>loading</p>;

  return (
    <Admin
      authProvider={authProvider()}
      dataProvider={dataProvider}
      disableTelemetry
      layout={MyLayout}
    >
        <Resource
        name="user"
        list={UserList}
        create={UserCreate}
        edit={UserEdit}
        show={UserShow}
        icon={AccountCircleIcon}
      />
      <Resource name="feedback" list={FeedbackList} show={FeedbackShow} icon={FeedbackIcon}/>

    </Admin>
  );
};

export default ReactAdmin;

</code>```

I tried to comment Resources in ReactAdmin.tsx and to just have the menu btu when i'm doing that i have only the home page of react admin which displays...

Body:
I try to develop my own menu to add a custom page to it. When i tried to use custom menu, and especially Menu.ResourceItem it doesn't find my resource ....

My Menu

// in src/MyMenu.js
import { Menu } from 'react-admin';
import LabelIcon from '@mui/icons-material/Label';

export const MyMenu = () => (
    <Menu>
        <Menu.DashboardItem />
         <Menu.ResourceItem name='user'/>
        <Menu.Item to="/custom-route" primaryText="Miscellaneous" leftIcon={<LabelIcon />}/>
    </Menu>
);

My Layout

// in src/MyLayout.js
import { Layout, LayoutProps } from 'react-admin';

import { MyMenu } from './MyMenu';

export const MyLayout = (props: JSX.IntrinsicAttributes & LayoutProps) => <Layout {...props} menu={MyMenu} />;

My reactAdmin.tsx

import { Admin, Resource } from "react-admin";
import { UserCreate, UserEdit, UserList, UserShow } from "./resources/User";
import { useSession } from "next-auth/react";
import { authProvider } from "./providers/authProvider";
import { dataProvider } from "./providers/dataProvider";
import LoginPage from "./custom-pages/LoginPage";
import { FeedbackList, FeedbackShow } from "./resources/Feedback";
import AccountCircleIcon from '@mui/icons-material/AccountCircle';
import FeedbackIcon from '@mui/icons-material/Feedback';
import { MyLayout } from "./components/MyLayout";

const ReactAdmin = () => {
   const { data: session, status } = useSession();
   if (status === "loading") return
loading
;

  return (
    <Admin
      authProvider={authProvider()}
      dataProvider={dataProvider}
      disableTelemetry
      layout={MyLayout}
    >
        <Resource
        name="user"
        list={UserList}
        create={UserCreate}
        edit={UserEdit}
        show={UserShow}
        icon={AccountCircleIcon}
      />
      <Resource name="feedback" list={FeedbackList} show={FeedbackShow} icon={FeedbackIcon}/>

    </Admin>
  );
};

export default ReactAdmin;

I tried to comment Resources in ReactAdmin.tsx and to just have the menu btu when i'm doing that i have only the home page of react admin which displays...


问:
How to setup Apache HTTPS reverse-proxy with Cloudflare?
I been trying for days plus looking for a tutorial on how to setup Apache HTTPS reverse-proxy with Cloudflare, but I only found articles with partial solutions like apache reverse-proxy with https only

I found this tutorial: https://www.centosblog.com/configure-apache-https-reverse-proxy-centos-linux/, but it is old and from 2017, I followed all the steps and installed httpd and mod_ssl on my centos 8 linux server,
this is my /etc/httpd/conf.d/thespacebar.io.conf file:

```<code><VirtualHost *:80>

  ServerName thespacebar.io

  # Redirect any HTTP request to HTTPS
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]

  # Logging
  LogLevel warn
  ErrorLog logs/thespacebar.io-error_log
  CustomLog logs/thespacebar.io-access_log combined

</VirtualHost>

# HTTPS
<VirtualHost *:443>

  ServerName thespacebar.io

  # Logging
  LogLevel warn
  ErrorLog thespacebar.io-error_log
  CustomLog thespacebar.io-access_log combined

  # SSL Configuration - uses strong cipher list - these might need to be downgraded if you need to support older browsers/devices
  SSLEngine on
  SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
  SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
  SSLHonorCipherOrder On
  SSLCertificateFile /thespacebar.io/certificate.crt
  SSLCertificateKeyFile /thespacebar.io/certificate.private_key
  SSLCertificateChainFile /thespacebar.io/chainfile.crt

  # HSTS (optional)
  Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;"
  # Remove this if you need to use frames or iframes
  Header always set X-Frame-Options DENY
  # Prevent MIME based attacks
  Header set X-Content-Type-Options "nosniff"

  # Reverse proxy configuration
  <Location />
    ProxyPass http://localhost:8080/
    ProxyPassReverse http://localhost:8080/
  </Location>

</VirtualHost>
</code>```

after running systemctl enable httpd && systemctl start httpd and visiting thespacebar.io

I get:

```<code>Forbidden
You don't have permission to access this resource.
</code>```

This is my first time dealing with Apache config file, so I am not sure what is causing this, is it the SSLCipherSuite or the certificates?

From some of the tutorials I found Apache have a module for cloudflare named mod_cloudflare (https://github.com/cloudflare/mod_cloudflare) but it is deprecated and replaced by mod_remoteip

will this module help in my case?

Body:
I been trying for days plus looking for a tutorial on how to setup Apache HTTPS reverse-proxy with Cloudflare, but I only found articles with partial solutions like apache reverse-proxy with https only

I found this tutorial: https://www.centosblog.com/configure-apache-https-reverse-proxy-centos-linux/, but it is old and from 2017, I followed all the steps and installed httpd and mod_ssl on my centos 8 linux server,
this is my /etc/httpd/conf.d/thespacebar.io.conf file:

<VirtualHost *:80>

  ServerName thespacebar.io

  # Redirect any HTTP request to HTTPS
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]

  # Logging
  LogLevel warn
  ErrorLog logs/thespacebar.io-error_log
  CustomLog logs/thespacebar.io-access_log combined

</VirtualHost>

# HTTPS
<VirtualHost *:443>

  ServerName thespacebar.io

  # Logging
  LogLevel warn
  ErrorLog thespacebar.io-error_log
  CustomLog thespacebar.io-access_log combined

  # SSL Configuration - uses strong cipher list - these might need to be downgraded if you need to support older browsers/devices
  SSLEngine on
  SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
  SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
  SSLHonorCipherOrder On
  SSLCertificateFile /thespacebar.io/certificate.crt
  SSLCertificateKeyFile /thespacebar.io/certificate.private_key
  SSLCertificateChainFile /thespacebar.io/chainfile.crt

  # HSTS (optional)
  Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;"
  # Remove this if you need to use frames or iframes
  Header always set X-Frame-Options DENY
  # Prevent MIME based attacks
  Header set X-Content-Type-Options "nosniff"

  # Reverse proxy configuration
  <Location />
    ProxyPass http://localhost:8080/
    ProxyPassReverse http://localhost:8080/
  </Location>

</VirtualHost>

after running systemctl enable httpd && systemctl start httpd and visiting thespacebar.io

I get:

Forbidden
You don't have permission to access this resource.

This is my first time dealing with Apache config file, so I am not sure what is causing this, is it the SSLCipherSuite or the certificates?

From some of the tutorials I found Apache have a module for cloudflare named mod_cloudflare (https://github.com/cloudflare/mod_cloudflare) but it is deprecated and replaced by mod_remoteip

will this module help in my case?


问:
RegEx - Is there a way to use a previous match content as variable to use it as a group length?
I'm searching a way to complete my regex with perfect goal, what I'm trying to do is to use a previous match to use it (the valid value) as a length for the next validation group.

Regex is read step by step so I'm asking if it's possible, I think it's not but if there is a way to do it like this or differently I take it.

I test all my regex on : regex101

Thanks for reading,

Strings to evaluate :

Valid

15,000000001111111

Not valid

15,00000000111111

Actual regex (sadly validate both previous strings):

/^([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]),{1}[0-4]{1,128}$/

I have 3 groups to validate, we have :

The first : ([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]) Content is between 1 and 128

The second : ,{1} the comma

The third : [0-4]{1,128} Content is between 0 and 4 with a length corresponding to the first group content

What I'm searching for is define X, which is the first group validated, to use it as the third group length, we want to reach something like this :

([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]),{1}(?(1)[0-4]{*group1 Content*}|*no match*)

Condition into the third group said :

if first group is valid then "check third group validation" else "this is a no match"


问:
How do you change the port of Microsoft Form Recognizer on-premise?
Microsoft Azure Form Recognizer as part of Cognitive Services can run in a container:

```<code>pull docker://mcr.microsoft.com/azure-cognitive-services/form-recognizer/layout
</code>```

You can run the container on the default port 5000.

But when you open a pod in podman with several ports. The MS form recognizer grabs all open ports 5000+. We would like to allow only one or two ports for this service.

```<code>podman pod create --name=my_pod  -p 5000:5000 -p 5002:5002 -p 5008:8888
</code>```

You can run and define the incoming ports with a command like this:

```<code>podman run --rm -it -d --name myFormRecognizer -p 5000:5000 --memory 16g --cpus 4 mcr.microsoft.com/azure-cognitive-services/vision/read:3.2-model-2022-04-30 Eula=accept Billing=https://cs-container.cognitiveservices.azure.com/ ApiKey=XXXX
</code>```

But when using pods, ports are already defined when creating the pod. Thus the p-switch is not available running the container.

Is there a method to prevent MS Forms container using specific ports? Our workaround today is, running other services first, and MS forms last, when starting the pod.

Body:
Microsoft Azure Form Recognizer as part of Cognitive Services can run in a container:

pull docker://mcr.microsoft.com/azure-cognitive-services/form-recognizer/layout

You can run the container on the default port 5000.

But when you open a pod in podman with several ports. The MS form recognizer grabs all open ports 5000+. We would like to allow only one or two ports for this service.

podman pod create --name=my_pod  -p 5000:5000 -p 5002:5002 -p 5008:8888

You can run and define the incoming ports with a command like this:

podman run --rm -it -d --name myFormRecognizer -p 5000:5000 --memory 16g --cpus 4 mcr.microsoft.com/azure-cognitive-services/vision/read:3.2-model-2022-04-30 Eula=accept Billing=https://cs-container.cognitiveservices.azure.com/ ApiKey=XXXX

But when using pods, ports are already defined when creating the pod. Thus the p-switch is not available running the container.

Is there a method to prevent MS Forms container using specific ports? Our workaround today is, running other services first, and MS forms last, when starting the pod.


问:
My recipients received emails with MIME-Attachment
Good afternoon,
I created a program that sends emails with .pdf attachments through gmail. I had some problems related the receivers that got my emails, some people received my emails in mime-attachment format (.mime) and these people can't read the .pdf files sent by me. But, the mail is generated correctly by me, I can saw the .pdf file that I sent to each one. So, the problem what could be? The piece of script that I made for generating this type of message is:

```<code>email_send = email_to_send

        subject = titleMessage

        msg = MIMEMultipart()
        msg['From'] = email_user
        msg['To'] = email_send
        msg['Subject'] = subject

        body = object
        msg.attach(MIMEText(body,'plain'))

        filename=filePdf # path to give
        attachment = open(filename,'rb')

        part = MIMEBase('application','octet-stream')
        part.set_payload((attachment).read())
        encoders.encode_base64(part)
        part.add_header('Content-Disposition',"attachment; filename= "+filename.split("/")[-1])
        msg.attach(part)

        text = msg.as_string()

        if "gmail" in email_user:
            server = smtplib.SMTP('smtp.gmail.com',587)
        elif "yahoo" in email_user:
            server = smtplib.SMTP('smtp.mail.yahoo.com',587)
        else:
            server = smtplib.SMTP('smtp-mail.outlook.com',587) # smtp.live.com

        server.ehlo()
        server.starttls()
        server.ehlo()
        server.login(email_user,email_password)

        server.sendmail(email_user,email_send,text)
        server.quit()
</code>```

Thanks for who will help me!

Body:
Good afternoon,
I created a program that sends emails with .pdf attachments through gmail. I had some problems related the receivers that got my emails, some people received my emails in mime-attachment format (.mime) and these people can't read the .pdf files sent by me. But, the mail is generated correctly by me, I can saw the .pdf file that I sent to each one. So, the problem what could be? The piece of script that I made for generating this type of message is:

email_send = email_to_send

        subject = titleMessage

        msg = MIMEMultipart()
        msg['From'] = email_user
        msg['To'] = email_send
        msg['Subject'] = subject

        body = object
        msg.attach(MIMEText(body,'plain'))

        filename=filePdf # path to give
        attachment = open(filename,'rb')

        part = MIMEBase('application','octet-stream')
        part.set_payload((attachment).read())
        encoders.encode_base64(part)
        part.add_header('Content-Disposition',"attachment; filename= "+filename.split("/")[-1])
        msg.attach(part)

        text = msg.as_string()

        if "gmail" in email_user:
            server = smtplib.SMTP('smtp.gmail.com',587)
        elif "yahoo" in email_user:
            server = smtplib.SMTP('smtp.mail.yahoo.com',587)
        else:
            server = smtplib.SMTP('smtp-mail.outlook.com',587) # smtp.live.com

        server.ehlo()
        server.starttls()
        server.ehlo()
        server.login(email_user,email_password)

        server.sendmail(email_user,email_send,text)
        server.quit()

Thanks for who will help me!


问:
Adding Custom httpStatus to Kubernetes Virtual Service
I am deploying a virtual service on Kubernetes using which I want to expose a host. This host will target the elastic search DB and allow read only operations on it. Every other CRUD operation should be blocked.
After blocking I get 404 Not Found HTTP Response but I want to customize it to HTTP 405: Method Not Found.
Any suggestions on achieving this? Attached is the virtual service YAML file used in kubernetes

Tried

```<code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: read-es-vs
spec:
  hosts:
  - "readonlyelastic.com"
  gateways:
  - istio-system/default-gateway

  http:

  - match:
    - uri:
        prefix: /
      method:
        exact: GET
    route:
    - destination:
        port:
          number: 8080
        host: elasticsearch-master-data

     fault:
        abort:
           httpStatus: 405
</code>```

But it didnot give the expected result

Body:
I am deploying a virtual service on Kubernetes using which I want to expose a host. This host will target the elastic search DB and allow read only operations on it. Every other CRUD operation should be blocked.
After blocking I get 404 Not Found HTTP Response but I want to customize it to HTTP 405: Method Not Found.
Any suggestions on achieving this? Attached is the virtual service YAML file used in kubernetes

Tried

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: read-es-vs
spec:
  hosts:
  - "readonlyelastic.com"
  gateways:
  - istio-system/default-gateway

  http:

  - match:
    - uri:
        prefix: /
      method:
        exact: GET
    route:
    - destination:
        port:
          number: 8080
        host: elasticsearch-master-data

     fault:
        abort:
           httpStatus: 405

But it didnot give the expected result


问:
MongoDB get average and total
I am new to MongoDB, I have 2 collections named locations and reviews. What I am trying to do is I need all the total reviews and average rating inside location. I am able to get total reviews but the average rating is giving me hard time. Also I want to group these reviews by review source like I have reviews in google, facebook, yelp I want to get average of these as well

Here What I have done till now to get total reviews

```<code>[
  {
    '$match': {
      'locationId': 'BS03064329691'
    }
  }, {
    '$lookup': {
      'from': 'reviews',
      'localField': 'locationId',
      'foreignField': 'locationId',
      'pipeline': [
        {
          '$match': {
            'date': {
              '$gte': 1667779200000,
              '$lte': 1670457600000
            }
          }
        }
      ],
      'as': 'reviews'
    }
  }, {
    '$project': {
      'locationName': '$name',
      'locationId': '$locationId',
      'totalReviews': {
        '$size': '$reviews'
      },
      'reviews': '$reviews'
    }
  }
]
</code>```

I am successfully able to get

```<code>_id: 'xyz',
locationName: 'xyz',
locationId: 'xyz',
totalReviews: 7,
reviews: [
  {
   source: "Google"
   createdDate: 1669835812092
   date: 1669835812092
   rating: 5
  },
  {review2},{review3},{review4},{review5},{review6},{review7}
]

</code>```

Title: MongoDB get average and total

Body:
I am new to MongoDB, I have 2 collections named locations and reviews. What I am trying to do is I need all the total reviews and average rating inside location. I am able to get total reviews but the average rating is giving me hard time. Also I want to group these reviews by review source like I have reviews in google, facebook, yelp I want to get average of these as well

Here What I have done till now to get total reviews

[
  {
    '$match': {
      'locationId': 'BS03064329691'
    }
  }, {
    '$lookup': {
      'from': 'reviews',
      'localField': 'locationId',
      'foreignField': 'locationId',
      'pipeline': [
        {
          '$match': {
            'date': {
              '$gte': 1667779200000,
              '$lte': 1670457600000
            }
          }
        }
      ],
      'as': 'reviews'
    }
  }, {
    '$project': {
      'locationName': '$name',
      'locationId': '$locationId',
      'totalReviews': {
        '$size': '$reviews'
      },
      'reviews': '$reviews'
    }
  }
]

I am successfully able to get

_id: 'xyz',
locationName: 'xyz',
locationId: 'xyz',
totalReviews: 7,
reviews: [
  {
   source: "Google"
   createdDate: 1669835812092
   date: 1669835812092
   rating: 5
  },
  {review2},{review3},{review4},{review5},{review6},{review7}
]


问:
Firebase function not returning a response in Android
I am trying to add M-PESA checkout option in my app and I need to confirm that the payment made by the user went through before confirming the order. My callback URL is a Firebase Function. While I am able to show the STK-PUSH, the callback URL doesn't send any response hence there's no way for me to know if the payment went through or not. I followed this tutorial but it didn't work for me. My index.js inside the functions folder:

```<code>const functions = require('firebase-functions');
const admin = require('firebase-admin');

admin.initializeApp(functions.config().firebase);
const express = require('express');
const body_parser = require('body-parser');

const app = express();
app.use(body_parser.json());
app.disable('x-powered-by');

app.post('/CallbackUrl', (request, result) => {
  let response = {
    "ResultCode": 0,
    "ResultDesc": "Success"
  }

  result.status(200).json(response);

  let requestBody = request.body;
  let myPayload = JSON.stringify(requestBody)

  // Logs successful function calls
  console.log(myPayload)

  let topicId = body.Body.stkCallback.CheckoutRequestID

  const sentPayload = {
    data: {
      myPayload,
    },
    topicId: id
  };

  return admin.messaging().send(sentPayload).catch(error => {

    // Logs Failed function calls
    console.error(error)
  })
})

exports.api = functions.https.onRequest(app);
</code>```

Callback URL: https://us-central1-<PROJECT_ID>.cloudfunctions.net/api

Firebase.JSON

```<code>{
  "functions": [
    {
      "source": "functions",
      "codebase": "default",
      "ignore": [
        "node_modules",
        ".git",
        "firebase-debug.log",
        "firebase-debug.*.log"
      ]
    }
  ]
}

</code>```

Google Cloud logs: Function execution took 12 ms. Finished with status code: 404

What could I be missing?

What I'm able to do: Screenshot (https://i.stack.imgur.com/Xjb8B.png)

What I'm not able to do: Receive response from callback url about the payment status

Body:
I am trying to add M-PESA checkout option in my app and I need to confirm that the payment made by the user went through before confirming the order. My callback URL is a Firebase Function. While I am able to show the STK-PUSH, the callback URL doesn't send any response hence there's no way for me to know if the payment went through or not. I followed this tutorial but it didn't work for me. My index.js inside the functions folder:

const functions = require('firebase-functions');
const admin = require('firebase-admin');

admin.initializeApp(functions.config().firebase);
const express = require('express');
const body_parser = require('body-parser');

const app = express();
app.use(body_parser.json());
app.disable('x-powered-by');

app.post('/CallbackUrl', (request, result) => {
  let response = {
    "ResultCode": 0,
    "ResultDesc": "Success"
  }

  result.status(200).json(response);

  let requestBody = request.body;
  let myPayload = JSON.stringify(requestBody)

  // Logs successful function calls
  console.log(myPayload)

  let topicId = body.Body.stkCallback.CheckoutRequestID

  const sentPayload = {
    data: {
      myPayload,
    },
    topicId: id
  };

  return admin.messaging().send(sentPayload).catch(error => {

    // Logs Failed function calls
    console.error(error)
  })
})

exports.api = functions.https.onRequest(app);

Callback URL: https://us-central1-<PROJECT_ID>.cloudfunctions.net/api

Firebase.JSON

{
  "functions": [
    {
      "source": "functions",
      "codebase": "default",
      "ignore": [
        "node_modules",
        ".git",
        "firebase-debug.log",
        "firebase-debug.*.log"
      ]
    }
  ]
}

Google Cloud logs: Function execution took 12 ms. Finished with status code: 404

What could I be missing?

What I'm able to do: Screenshot (https://i.stack.imgur.com/Xjb8B.png)

What I'm not able to do: Receive response from callback url about the payment status


问:
Unprotecting PowerPoint PPAM file not working
I just tried to edit a PPAM of mine that I lost the PPTM of.  I tried the hexeditor fix changing the DPX CMX and CG values but when I open I try to set the properties in VBA all I get is the password prompt.  I'm on the latest version of Microsoft 365.

Thanks


问:
Does ANTLR4 produce DFA for pattern matching in scanner?
I am currently using Flex for generating scanners for my project. But I intend to support Unicode input. So I thought of shifting to something else.

I have heard a lot about ANTLR4 online. It generates performant parsers. But since I only use the scanner part of it, I needed to know about the scanner performance. I suppose DFA based scanners will be more performant than other techniques. But I couldn't find any source that says if the scanner generated by ANTLR4 uses DFA or something else.

Also, if ANTLR is suitable for my use case, what are other alternatives? I found RE/flex. Any other suggestions? if I only care about performance.


问:
A model field for storing an ordered list of ForeignKeys with duplicates
I have two models A and B, and B would like to keep an ordered list of As that can contain duplicates.

class A(models.Model):
    ...

class B(models.Model):
    As = models.OrderedOneToManyWithDuplicatesField(A)
```
<p>Where <code>OrderedOneToManyWithDuplicatesField</code> is mythical.</p>
<p>I imagine that it might be a <code>ManyToManyField</code> with a custom through model that keeps a and ordering key, but am not sure if and how that would support the same A appearing more than ones in a given <code>B.As</code>.</p>
<pre class="lang-py prettyprint-override"><code>class A(models.Model):
    ...

class B(models.Model):
    As = models.ManyToManyField(A, through=A_List)

class A_List(models.Model):
    A = models.ForeignKey(A)
    B = models.ForeignKey(B)
    index = models.PositiveIntegerField()
</code>```

I guess I haven't found any documentation clearly stating this yet, nor made time to test it (which I will do), and I am wondering if anyone has experience to share in the interim.

I guess the question boils down to whether A_list can can contain multiple rows that have the same A and B but a different index.  Which in turn may boil down to:

How Django keys that model (if it has an independent AutoField primary key, implicit or explicit) for example. That is, A and B are not together a unique key.

Whether the manager(s) have any built-in premises about through table uniqueness that break. This is a harder thing to establish through a basic empirical test and may demand some code review or knowledge.

In any case, I'd like ultimately to have a property or method on B that just returns me the ordered list As (including any duplicates) for downstream use.

Further, I imagine this has the unintended (and possibly undesired, but not gravely bothersome) effect of providing A with access to a list of Bs in which it appears under B.As.

Body:
I have two models A and B, and B would like to keep an ordered list of As that can contain duplicates.

class A(models.Model):
    ...

class B(models.Model):
    As = models.OrderedOneToManyWithDuplicatesField(A)

Where OrderedOneToManyWithDuplicatesField is mythical.

I imagine that it might be a ManyToManyField with a custom through model that keeps a and ordering key, but am not sure if and how that would support the same A appearing more than ones in a given B.As.

class A(models.Model):
    ...

class B(models.Model):
    As = models.ManyToManyField(A, through=A_List)

class A_List(models.Model):
    A = models.ForeignKey(A)
    B = models.ForeignKey(B)
    index = models.PositiveIntegerField()

I guess I haven't found any documentation clearly stating this yet, nor made time to test it (which I will do), and I am wondering if anyone has experience to share in the interim.

I guess the question boils down to whether A_list can can contain multiple rows that have the same A and B but a different index.  Which in turn may boil down to:

How Django keys that model (if it has an independent AutoField primary key, implicit or explicit) for example. That is, A and B are not together a unique key.

Whether the manager(s) have any built-in premises about through table uniqueness that break. This is a harder thing to establish through a basic empirical test and may demand some code review or knowledge.

In any case, I'd like ultimately to have a property or method on B that just returns me the ordered list As (including any duplicates) for downstream use.

Further, I imagine this has the unintended (and possibly undesired, but not gravely bothersome) effect of providing A with access to a list of Bs in which it appears under B.As.


问:
Why does the GraphQL standard separate Mutations and Queries
In GraphQL, queries are not supposed to modify the state of the data on the server while mutations do. Other than that they are really very similar. On the subject of why this distinction is made the GraphQL docs say:

In REST, any request might end up causing some side-effects on the server, but by convention it's suggested that one doesn't use GET requests to modify data. GraphQL is similar - technically any query could be implemented to cause a data write. However, it's useful to establish a convention that any operations that cause writes should be sent explicitly via a mutation.

But why is this useful?

The only reason for the usefulness of this separation I can se mentioned in the docs is

While query fields are executed in parallel, mutation fields run in series, one after the other.

This means that if we send two incrementCredits mutations in one request, the first is guaranteed to finish before the second begins, ensuring that we don't end up with a race condition with ourselves.

Are there other upsides of this separation that led to the decision to implement it like this?

Link to GraphQL docs


问:
How to send SMS automatically in Flutter & Kotlin in foreground state, background state and terminated state
I am receiving and sending message through Telephony. It is working perfectly when the app is in foreground state but it is not working when the app is in background, though my app is receiving message in background but it is giving error on sending background message.

Permission in AndroidManifest.xml file

```<code><uses-permission android:name="android.permission.SEND_SMS"/\>
<uses-permission android:name="android.permission.RECEIVE_SMS"/\>
</code>```

Method Channel for sending SMS

```<code>import android.telephony.SmsManager

val CHANNEL = "example.sms"

override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler {
call, result -\>
if(call.method == "sendsms") {
val phone = call.argument\<String\>("phone")
val msg = call.argument\<String\>("msg")
if (phone != null && msg != null) {
sendSms(phone, msg)
}
} else {
result.notImplemented()
}
}
}

private fun sendSms(phoneNumber: String, message: String) {

        try {
            val smsManager = SmsManager.getDefault()
            smsManager.sendTextMessage(phoneNumber, null, message, null, null)

        } catch (e: Exception) {
            e.printStackTrace()
        }

    }
</code>```

Body:
I am receiving and sending message through Telephony. It is working perfectly when the app is in foreground state but it is not working when the app is in background, though my app is receiving message in background but it is giving error on sending background message.

Permission in AndroidManifest.xml file

<uses-permission android:name="android.permission.SEND_SMS"/\>
<uses-permission android:name="android.permission.RECEIVE_SMS"/\>

Method Channel for sending SMS

import android.telephony.SmsManager

val CHANNEL = "example.sms"

override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler {
call, result -\>
if(call.method == "sendsms") {
val phone = call.argument\<String\>("phone")
val msg = call.argument\<String\>("msg")
if (phone != null && msg != null) {
sendSms(phone, msg)
}
} else {
result.notImplemented()
}
}
}

private fun sendSms(phoneNumber: String, message: String) {

        try {
            val smsManager = SmsManager.getDefault()
            smsManager.sendTextMessage(phoneNumber, null, message, null, null)

        } catch (e: Exception) {
            e.printStackTrace()
        }

    }


问:
What is the difference between payload and meta of redux toolkit action?
Hello I am currently studying redux-toolkit. As the title, I'm curious about the difference between the two. I would appreciate it if you could let me know in which case result data goes into the payload and in which case it goes into the meta.

enter image description here
enter image description here

const templateGetOne = createAsyncThunk('template/check/code', async (code) => {
  const response = axios.get(`${api}/temp/info?template_code=${code}`)
  const data = await response.data
  console.log('response data>>>>', data)
  return data
})
```
<pre class="lang-js prettyprint-override"><code>    builder.addCase(templateGetOne.fulfilled, (state, action) => {
      state.code = action.meta
      console.log('state code: ', state.code)
      console.log('action: ', action)
      console.log('action payload: ', action.payload)
      console.log('action meta: ', action.meta)
    })
</code>```

  const handleCheck = (event) => {
    dispatch(templateGetOne(event.target.value))
  }
```

I'm guessing that maybe something went wrong in the process of passing the action and finding the reducer. However, I don't know the exact difference between the two and it's hard to figure out because I still don't understand the principle of how it works. Help

Body:
Hello I am currently studying redux-toolkit. As the title, I'm curious about the difference between the two. I would appreciate it if you could let me know in which case result data goes into the payload and in which case it goes into the meta.

enter image description here
enter image description here

const templateGetOne = createAsyncThunk('template/check/code', async (code) => {
  const response = axios.get(`${api}/temp/info?template_code=${code}`)
  const data = await response.data
  console.log('response data>>>>', data)
  return data
})

    builder.addCase(templateGetOne.fulfilled, (state, action) => {
      state.code = action.meta
      console.log('state code: ', state.code)
      console.log('action: ', action)
      console.log('action payload: ', action.payload)
      console.log('action meta: ', action.meta)
    })

  const handleCheck = (event) => {
    dispatch(templateGetOne(event.target.value))
  }

I'm guessing that maybe something went wrong in the process of passing the action and finding the reducer. However, I don't know the exact difference between the two and it's hard to figure out because I still don't understand the principle of how it works. Help


问:
React/TS how to pass a react style parameter name as a variable
I want to create custom style object through a function, something like this

```<code>function myFunc(styleParam, value){
const style = {styleParam: value} as React.CSSProperties
return style
}
</code>```

Is there a way to pass a react style parameter as a variable?

Edit: solved!

Body:
I want to create custom style object through a function, something like this

function myFunc(styleParam, value){
const style = {styleParam: value} as React.CSSProperties
return style
}

Is there a way to pass a react style parameter as a variable?

Edit: solved!


问:
Swagger bearerAuth. How to change the name of header?
Cannot understand how to change the name of header in bearerAuth. Can some one help?

I use yaml config:

```<code>components:
  securitySchemes:
    bearerAuth:
      description: Basic auth to get tokens
      type: http
      scheme: bearer
      bearerFormat: JWT
</code>```

Body:
Cannot understand how to change the name of header in bearerAuth. Can some one help?

I use yaml config:

components:
  securitySchemes:
    bearerAuth:
      description: Basic auth to get tokens
      type: http
      scheme: bearer
      bearerFormat: JWT


问:
MLFlow version of registered model conda.yml and defined conda.yml differ causing conflicts
MLFlow versions of the registered model conda.yml and defined conda.yml differ causing conflicts.

The original conda.yml used for deployment:

channels:
- conda-forge
dependencies:
- python=3.8
- mlflow=1.29.0
- cloudpickle
- inflection
- cython
- pip
- pip:
  - privatepackage==2.1.2
name: myenv
```
<p>Registration is done using the <code>log</code> API:</p>
<pre class="lang-py prettyprint-override"><code>mlflow.pyfunc.log_model(
                artifact_path=model_name,
                python_model=model,
                registered_model_name=model_name,
                conda_env='../conda.yaml',
                code_path=code_path
            )
</code>```

However, when I look at the registry itself I see that mlflow was added to the pip installation at the conda.yml, even though it wasn't there before, but at conda managed installations

channels:
- conda-forge
dependencies:
- python=3.8
- mlflow=1.29.0
- cloudpickle
- inflection
- cython
- pip
- pip:
  - mlflow # THIS WASN'T in the conda.yml used for model registration
  - privatepackage==2.1.2
name: myenv
```
<p>Important to note that after registration <code>mlflow</code> was added to <code>pip</code> installations without our consent since it wasn't in the used <code>conda.yml</code>.
Moreover, it was added with an open version, and we know <code>pip</code> installations occur <strong>after</strong> the packages defined on <code>conda</code> installation. Therefore, when the model is installed using this automatically changed <code>conda.yml</code> we end up with the latest <code>mlflow</code>, even though we asked for <code>mlflow=1.29.0</code>. This causes conflicts.</p>
<p>An usage example:</p>
<pre class="lang-py prettyprint-override"><code>logged_model = 'models:/mymodel/staging'

loaded_model = mlflow.pyfunc.spark_udf(spark, model_uri=logged_model, result_type='Array<Double>', env_manager="conda") # using conda, but this is the file that was changed and got mlflow open version added to it without "my consent"

# then this will fail, because of breaking changes between mlflow versions
result = df.withColumn('predictions', loaded_model(struct(col("content"))))
</code>```

Resulting a failure:

```<code>PythonException: 'Exception: Invocation failed (error code 400, response: {"error_code": "BAD_REQUEST", "message": "The input must be a JSON dictionary with exactly one of the input fields {'inputs', 'dataframe_records', 'dataframe_split', 'instances'}. Received dictionary with input fields: ['index', 'columns', 'data']. IMPORTANT: The MLflow Model scoring protocol has changed in MLflow version 2.0. If you are seeing this error, you are likely using an outdated scoring request format. To resolve the error, either update your request format or adjust your MLflow Model's requirements file to specify an older version of MLflow (for example, change the 'mlflow' requirement specifier to 'mlflow==1.30.0'). If you are making a request using the MLflow client (e.g. via `mlflow.pyfunc.spark_udf()`), upgrade your MLflow client to a version >= 2.0 in order to use the new request format. For more information about the updated MLflow Model scoring protocol in MLflow 2.0, see https://mlflow.org/docs/latest/models.html#deploy-mlflow-models."})'
</code>```

From the error message, it's obvious that the internal scoring server is using mlflow>=2.0, and not the 1.29.0 we defined at deployment time. This happens because the conda.yml was automatically modified by mlflow registry API (why?) during registration.

Why this happens?

How to solve it?

Thanks.

Body:
MLFlow versions of the registered model conda.yml and defined conda.yml differ causing conflicts.

The original conda.yml used for deployment:

channels:
- conda-forge
dependencies:
- python=3.8
- mlflow=1.29.0
- cloudpickle
- inflection
- cython
- pip
- pip:
  - privatepackage==2.1.2
name: myenv

Registration is done using the log API:

mlflow.pyfunc.log_model(
                artifact_path=model_name,
                python_model=model,
                registered_model_name=model_name,
                conda_env='../conda.yaml',
                code_path=code_path
            )

However, when I look at the registry itself I see that mlflow was added to the pip installation at the conda.yml, even though it wasn't there before, but at conda managed installations

channels:
- conda-forge
dependencies:
- python=3.8
- mlflow=1.29.0
- cloudpickle
- inflection
- cython
- pip
- pip:
  - mlflow # THIS WASN'T in the conda.yml used for model registration
  - privatepackage==2.1.2
name: myenv

Important to note that after registration mlflow was added to pip installations without our consent since it wasn't in the used conda.yml.
Moreover, it was added with an open version, and we know pip installations occur after the packages defined on conda installation. Therefore, when the model is installed using this automatically changed conda.yml we end up with the latest mlflow, even though we asked for mlflow=1.29.0. This causes conflicts.

An usage example:

logged_model = 'models:/mymodel/staging'

loaded_model = mlflow.pyfunc.spark_udf(spark, model_uri=logged_model, result_type='Array<Double>', env_manager="conda") # using conda, but this is the file that was changed and got mlflow open version added to it without "my consent"

# then this will fail, because of breaking changes between mlflow versions
result = df.withColumn('predictions', loaded_model(struct(col("content"))))

Resulting a failure:

PythonException: 'Exception: Invocation failed (error code 400, response: {"error_code": "BAD_REQUEST", "message": "The input must be a JSON dictionary with exactly one of the input fields {'inputs', 'dataframe_records', 'dataframe_split', 'instances'}. Received dictionary with input fields: ['index', 'columns', 'data']. IMPORTANT: The MLflow Model scoring protocol has changed in MLflow version 2.0. If you are seeing this error, you are likely using an outdated scoring request format. To resolve the error, either update your request format or adjust your MLflow Model's requirements file to specify an older version of MLflow (for example, change the 'mlflow' requirement specifier to 'mlflow==1.30.0'). If you are making a request using the MLflow client (e.g. via `mlflow.pyfunc.spark_udf()`), upgrade your MLflow client to a version >= 2.0 in order to use the new request format. For more information about the updated MLflow Model scoring protocol in MLflow 2.0, see https://mlflow.org/docs/latest/models.html#deploy-mlflow-models."})'

From the error message, it's obvious that the internal scoring server is using mlflow>=2.0, and not the 1.29.0 we defined at deployment time. This happens because the conda.yml was automatically modified by mlflow registry API (why?) during registration.

Why this happens?

How to solve it?

Thanks.


问:
Where does the gap come from, and how to get rid of it?
A simple document:

svg {
  background-color: blue;
}
div {
  background-color: green;
}
svg, div {
  width: 100%;
  height: 100px;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><svg></svg>
<div></div></code>```

And just in case it's just on my system (Chrome/Mac), here's how it comes out:

I can't see any margin or border on either element, but there is a gap between the two elements. And it only happens with a svg there: if I replace the svg with another div, no gap.

Where does it come from, and how do I make it go away?

Body:
A simple document:

svg {
  background-color: blue;
}
div {
  background-color: green;
}
svg, div {
  width: 100%;
  height: 100px;
}

<svg></svg>

And just in case it's just on my system (Chrome/Mac), here's how it comes out:

I can't see any margin or border on either element, but there is a gap between the two elements. And it only happens with a svg there: if I replace the svg with another div, no gap.

Where does it come from, and how do I make it go away?


问:
Cannot make permanent changes with sed
I want that command to be permanent :

```<code>sudo sed -E "s/( )[^#]*/\1$(cat tmp_script) /" hosts
</code>```

So i tried with -i instead but it's not working. It tells me to change the part with \1
but when i do it nothing happends on hosts file anymore.

I just want the first command to be able to write on the file.

Title: Cannot make permanent changes with sed

Body:
I want that command to be permanent :

sudo sed -E "s/( )[^#]*/\1$(cat tmp_script) /" hosts

So i tried with -i instead but it's not working. It tells me to change the part with \1
but when i do it nothing happends on hosts file anymore.

I just want the first command to be able to write on the file.


问:
How to estimate a Multivariate GARCH-M Model with R?
I'm looking for an R package where I can perform multiple Garch-M model (sepisifically bivariate E-GARCH-M)). In my long-term research, I could not find a package that I could make estimation.

I would also like to take this opportunity to learn how the multiple GARCH-M model should be executed in R program and how the mean can be included in the model. Every explanation you make about running the model in R program is very valuable to me.

I am familiar with R program in data manipulating and data visualization. However, I have not performed a statistical analysis yet. I would be very happy if you could help me with this. Even finding the right r package that I can at least make multiple GARCH-M for is very important to me.

I am looking for an R package where I can run multiple GARCH-M models (bivariate EGARCH-M in my work) in R program.

It would also be great to show how the mean can be included in the model. An example showing how multiple GARCH-M models should be run would be perfect.

Thank you in advance.


问:
'SqlColumnEncryptionKeyStoreProvider' claims it is defined in 'System.Data' error
Severity Code Description Project File Line Suppression State Error CS7069 Reference to type 'SqlColumnEncryptionKeyStoreProvider' claims it is defined in 'System.Data', but it could not be found in file</p>


问:
adding corresponding values of parameters in each row for 30 sheets of excel files using pandas
I'm new to pandas library and I need to find the summation value for some parameters in 30 sheets of an excel file. the parameters  are in the same column but their rows differ from each other in every sheet. I import the sheets into jupyter notebook with pandas as a series of dataframes. now I don't know how to find different parameters with their corresponding value( in another column) in these dataframes so that I would be able to calculate their sumation and create a new dataframe with these parameters and their added values.

```<code>our data is like this:
1       a      56     unemployed
2       b      76     employer
3       d      85     employee
4       c      92     self-employed
</code>```

the a, b, c and d parameters rows differ in every sheets. but their column is the same
I want to write a code to iterate over every dataframe and find the parameter. get its value for instane in here for a, is 56, add it to its value in every dataframe and do this for other parameters and give the results as a dataframe with this parameter and their overall values.
I really need this. thanks

I already import the data as follow:

```<code>import numpy as np
import pandas as pd

dict_df = pd.read_excel("location of file", sheet_name=[i for i in range(0, 30)])

## I made a list of sheets as dataframes dfList=[df1, df2, ..., df30]

dfList = list(dict_df.values())
</code>```

Body:
I'm new to pandas library and I need to find the summation value for some parameters in 30 sheets of an excel file. the parameters  are in the same column but their rows differ from each other in every sheet. I import the sheets into jupyter notebook with pandas as a series of dataframes. now I don't know how to find different parameters with their corresponding value( in another column) in these dataframes so that I would be able to calculate their sumation and create a new dataframe with these parameters and their added values.

our data is like this:
1       a      56     unemployed
2       b      76     employer
3       d      85     employee
4       c      92     self-employed

the a, b, c and d parameters rows differ in every sheets. but their column is the same
I want to write a code to iterate over every dataframe and find the parameter. get its value for instane in here for a, is 56, add it to its value in every dataframe and do this for other parameters and give the results as a dataframe with this parameter and their overall values.
I really need this. thanks

I already import the data as follow:

import numpy as np
import pandas as pd

dict_df = pd.read_excel("location of file", sheet_name=[i for i in range(0, 30)])

## I made a list of sheets as dataframes dfList=[df1, df2, ..., df30]

dfList = list(dict_df.values())


问:
My Docker container for Nestjs microservice + mongodb atlas doesn't work
I built two nestjs projects in a folder: one works as an api, another one connects to mongodb atlas database. They worked well. But after I containerized them into docker containers. I couldn't post data to mongodb database.

Note: the mongodb database is not local but in cloud. I saw many youtube videos and tutorials but they all talked about mongodb local database, I dont know if that will affect my outcome.

My project structure:

```<code>.
├── api-gateway
│   └── src
│       └── users
├── microservice
│   └── src
│       └── users
</code>```

api-gateway Dockerfile:

```<code>FROM node:18
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 8080
CMD [ "node", "dist/main.js" ]
</code>```

microservice Dockerfile:

```<code>FROM node:18
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 8876
CMD [ "node", "dist/main.js" ]
</code>```

.dockerignore for both sub-folders:

```<code>node_modules
npm-debug.log
</code>```

docker-compose.yml:

```<code>version: "3.9"
services:
  api:
    build: ./api-gateway
    ports:
      - "8080:3000"
  microservice:
    build: ./microservice
    ports:
      - "8876:8876"
</code>```

Can anyone please tell me where is wrong?

Body:
I built two nestjs projects in a folder: one works as an api, another one connects to mongodb atlas database. They worked well. But after I containerized them into docker containers. I couldn't post data to mongodb database.

Note: the mongodb database is not local but in cloud. I saw many youtube videos and tutorials but they all talked about mongodb local database, I dont know if that will affect my outcome.

My project structure:

.
├── api-gateway
│   └── src
│       └── users
├── microservice
│   └── src
│       └── users

api-gateway Dockerfile:

FROM node:18
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 8080
CMD [ "node", "dist/main.js" ]

microservice Dockerfile:

FROM node:18
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 8876
CMD [ "node", "dist/main.js" ]

.dockerignore for both sub-folders:

node_modules
npm-debug.log

docker-compose.yml:

version: "3.9"
services:
  api:
    build: ./api-gateway
    ports:
      - "8080:3000"
  microservice:
    build: ./microservice
    ports:
      - "8876:8876"

Can anyone please tell me where is wrong?


问:
Training an Hugginface model without n_epochs
I would like to train from scratch a   RobertaForMaskedLM in Hugginface.
However I would like to not specify any stopping time, but to stop only when there is no more improvement in the training. There is a way to do that? I know that the n_epochs in the  Trainer   is default 3.

Thanks


问:
Redis - Ruby - How do I check persistence?
Using a Ruby client connecting to a Redis instance, how do I check the persistence set on this Redis instance?</p>
```<code>gem 'redis'

client = Redis.new

client.persistence == 'AOF' ...?
</code>```

Body:
Using a Ruby client connecting to a Redis instance, how do I check the persistence set on this Redis instance?

gem 'redis'

client = Redis.new

client.persistence == 'AOF' ...?


问:
Angular Dialog Open problem in component -errors desnt open
I have a problem with Dialog in Angular:
HTML:

```<code> <button mat-raised-button (click)="openDialog(content)">Add</button>

      <template #content>
    Hello Angular!
  </template>
</code>```

TS:

```<code>   openDialog() {
  this.dialog.open(content);
}
</code>```

Body:
I have a problem with Dialog in Angular:
HTML:

 <button mat-raised-button (click)="openDialog(content)">Add</button>

      <template #content>
    Hello Angular!
  </template>

TS:

   openDialog() {
  this.dialog.open(content);
}