问:
Heroku deploy fail w/ Angular. Sh: 1: ng: not found. How to get Heroku to recognize "ng" command?
I've gone through a ton of old StackOverflow posts and followed instructions for every one of them but none of them work. I'm just trying to deploy a static one page site with no backend, but its coming up with an application error.

I'm using Heroku CLI and the deploy is working, but the site doesn't work and when I check the "heroku logs" this is the output I'm getting:

```<code>2023-01-09T13:58:20.102130+00:00 app[web.1]: sh: 1: ng: not found
2023-01-09T13:58:20.229260+00:00 heroku[web.1]: Process exited with status 127
2023-01-09T13:58:20.282782+00:00 heroku[web.1]: State changed from starting to crashed
2023-01-09T13:58:20.287984+00:00 heroku[web.1]: State changed from crashed to starting
</code>```

https://pastebin.com/TTxQAnmG

This is my current package.json:

```<code>{
  "name": "fmentor-country",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test"

  },
  "private": true,
  "dependencies": {
    "@angular-devkit/build-angular": "^15.0.2",
    "@angular/animations": "^15.0.0",
    "@angular/cdk": "^15.0.4",
    "@angular/common": "^15.0.0",
    "@angular/compiler": "^15.0.0",
    "@angular/core": "^15.0.0",
    "@angular/forms": "^15.0.0",
    "@angular/material": "^15.0.4",
    "@angular/platform-browser": "^15.0.0",
    "@angular/platform-browser-dynamic": "^15.0.0",
    "@angular/router": "^15.0.0",
    "@emotion/react": "^11.10.5",
    "@emotion/styled": "^11.10.5",
    "@mui/material": "^5.11.3",
    "typescript": "~4.8.2",
    "rxjs": "~7.5.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.12.0",
    "@angular/cli": "~15.0.2",
    "@angular/compiler-cli": "^15.0.0"
  },
  "devDependencies": {
    "@angular/cli": "~15.0.2",
    "@angular/compiler-cli": "^15.0.0",
    "@types/jasmine": "~4.3.0",
    "jasmine-core": "~4.5.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "typescript": "~4.8.2"
  },

  "engines": {
    "node": "16.13.1",
    "npm": "8.5.2"
  }
}
</code>```

I've gone through almost every StackOverflow post on google and nothing is working. I've tried:

Angular 5 Deploy to Heroku Fails with Application Error H10

```<code>In your package.json, copy

"@angular/cli": "1.7.3"", "@angular/compiler-cli": "^5.2.0"

from devDependencies to dependencies.

Create a postinstall script in package.json -

Under "scripts", add a postinstall command:

"postinstall": "ng build --aot --prod"

This tells Heroku to build the application using Ahead Of Time (AOT) compiler and make it production-ready. This will create a dist folder where all html and javascript converted version of our app will be launched from.

Add node and npm engines -

You will need to add the Node and NPM engines that Heroku will use to run your application. Preferably, it should be same version you have on your machine. So, run node -v and npm -v to get the correct version and include it in your package.json file like so:

"engine": { "node": "8.9.4", "npm": "5.6.0" }

Copy typescript to dependencies -

Copy "typescript": "~2.5.3" from devDependencies to dependencies to also inform Heroku what typescript version to use.
</code>```

However this line:

```<code>Under "scripts", add a postinstall command:

"postinstall": "ng build --aot --prod"
</code>```

gets me a failed build with the output saying:

```<code>remote: Error: Unknown argument: prod
remote:
remote: -----> Build failed
</code>```

https://pastebin.com/huEXL398

its the same error when I replace "postinstall" with "heroku-postbuild" too. So I took it out of the package.json and hoped the dependencies alone would be enough to fix it but it doesn't.

Similar advice is found in multiple other SO posts like:

Heroku deploy issue sh: 1: ng: not found?

```<code>you can let heroku build your dev dependencies by setting environment: NPM_CONFIG_PRODUCTION to false. (how?)

or you can move (angular 9)
@angular/cli,
@angular/compiler-cli
@angular-devkit/build-angular
typescript
from devDependencies to dependencies.
</code>```

I didn't want to do the:

```<code>NPM_CONFIG_PRODUCTION = false
</code>```

thing because of this GH post saying its problematic

https://github.com/npm/npm/issues/14168

and

Heroku deployment failed? How to deploy Angular App + NodeJs properly?

```<code>The answer is in this Angular CLI issue.

In it, they recommend that within your package.json file:

Move

"@angular/cli": "7.3.1",
    "@angular/compiler-cli": "7.2.4",

from the "devDependencies" to "dependencies", "as that's the missing ng error. Also, change postinstall for heroku-postbuild as it achieves the same thing, but doesn't trigger a build when you're installing deps locally"
</code>```

This one too:

Failed Heroku deploy: sh: 1: ng: not found

Are there any updates to these answers? Or is my case different because it's only a static site with no backend so the fix instructions aren't the same?

How do I get Heroku to recognize Angular's "ng" command?

Body:
I've gone through a ton of old StackOverflow posts and followed instructions for every one of them but none of them work. I'm just trying to deploy a static one page site with no backend, but its coming up with an application error.

I'm using Heroku CLI and the deploy is working, but the site doesn't work and when I check the "heroku logs" this is the output I'm getting:

2023-01-09T13:58:20.102130+00:00 app[web.1]: sh: 1: ng: not found
2023-01-09T13:58:20.229260+00:00 heroku[web.1]: Process exited with status 127
2023-01-09T13:58:20.282782+00:00 heroku[web.1]: State changed from starting to crashed
2023-01-09T13:58:20.287984+00:00 heroku[web.1]: State changed from crashed to starting

https://pastebin.com/TTxQAnmG

This is my current package.json:

{
  "name": "fmentor-country",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test"

  },
  "private": true,
  "dependencies": {
    "@angular-devkit/build-angular": "^15.0.2",
    "@angular/animations": "^15.0.0",
    "@angular/cdk": "^15.0.4",
    "@angular/common": "^15.0.0",
    "@angular/compiler": "^15.0.0",
    "@angular/core": "^15.0.0",
    "@angular/forms": "^15.0.0",
    "@angular/material": "^15.0.4",
    "@angular/platform-browser": "^15.0.0",
    "@angular/platform-browser-dynamic": "^15.0.0",
    "@angular/router": "^15.0.0",
    "@emotion/react": "^11.10.5",
    "@emotion/styled": "^11.10.5",
    "@mui/material": "^5.11.3",
    "typescript": "~4.8.2",
    "rxjs": "~7.5.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.12.0",
    "@angular/cli": "~15.0.2",
    "@angular/compiler-cli": "^15.0.0"
  },
  "devDependencies": {
    "@angular/cli": "~15.0.2",
    "@angular/compiler-cli": "^15.0.0",
    "@types/jasmine": "~4.3.0",
    "jasmine-core": "~4.5.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "typescript": "~4.8.2"
  },

  "engines": {
    "node": "16.13.1",
    "npm": "8.5.2"
  }
}

I've gone through almost every StackOverflow post on google and nothing is working. I've tried:

Angular 5 Deploy to Heroku Fails with Application Error H10

In your package.json, copy

"@angular/cli": "1.7.3"", "@angular/compiler-cli": "^5.2.0"

from devDependencies to dependencies.

Create a postinstall script in package.json -

Under "scripts", add a postinstall command:

"postinstall": "ng build --aot --prod"

This tells Heroku to build the application using Ahead Of Time (AOT) compiler and make it production-ready. This will create a dist folder where all html and javascript converted version of our app will be launched from.

Add node and npm engines -

You will need to add the Node and NPM engines that Heroku will use to run your application. Preferably, it should be same version you have on your machine. So, run node -v and npm -v to get the correct version and include it in your package.json file like so:

"engine": { "node": "8.9.4", "npm": "5.6.0" }

Copy typescript to dependencies -

Copy "typescript": "~2.5.3" from devDependencies to dependencies to also inform Heroku what typescript version to use.

However this line:

Under "scripts", add a postinstall command:

"postinstall": "ng build --aot --prod"

gets me a failed build with the output saying:

remote: Error: Unknown argument: prod
remote:
remote: -----> Build failed

https://pastebin.com/huEXL398

its the same error when I replace "postinstall" with "heroku-postbuild" too. So I took it out of the package.json and hoped the dependencies alone would be enough to fix it but it doesn't.

Similar advice is found in multiple other SO posts like:

Heroku deploy issue sh: 1: ng: not found?

you can let heroku build your dev dependencies by setting environment: NPM_CONFIG_PRODUCTION to false. (how?)

or you can move (angular 9)
@angular/cli,
@angular/compiler-cli
@angular-devkit/build-angular
typescript
from devDependencies to dependencies.

I didn't want to do the:

NPM_CONFIG_PRODUCTION = false

thing because of this GH post saying its problematic

https://github.com/npm/npm/issues/14168

and

Heroku deployment failed? How to deploy Angular App + NodeJs properly?

The answer is in this Angular CLI issue.

In it, they recommend that within your package.json file:

Move

"@angular/cli": "7.3.1",
    "@angular/compiler-cli": "7.2.4",

from the "devDependencies" to "dependencies", "as that's the missing ng error. Also, change postinstall for heroku-postbuild as it achieves the same thing, but doesn't trigger a build when you're installing deps locally"

This one too:

Failed Heroku deploy: sh: 1: ng: not found

Are there any updates to these answers? Or is my case different because it's only a static site with no backend so the fix instructions aren't the same?

How do I get Heroku to recognize Angular's "ng" command?


来源: stackexchange

问:
Error creating SpatialPoints in sp package
I am trying to convert a dataframe into a SpatialPoints and then save the coordinates in their correct CRS but am coming up with an error

```<code>proj_create: Error 1027 (Invalid value for an argument): utm: Invalid value for zone
Error in CRS("+proj=utm +zone=37N") : NA
</code>```

This script worked fine before I updated my R & RStudio, and I am struggling to find the root of the problem. Any help would be appreciated

```<code>sps.37N <- SpatialPoints(dd3.full[,c("longitude", "latitude")],
                         proj4string = CRS("+proj=utm +zone=37N"))
spst.37N  <- spTransform(sps.37N, CRS("+proj=longlat +datum=WGS84"))
dd3.full[, c("long", "lat")] <- coordinates(spst.37N)
</code>```

Thanks

```<code>Sample data: structure(list(longitude = c(811674L, 811674L, 812382L, 811674L,
812382L, 811674L, 807900L, 807900L, 812382L, 812405L), latitude = c(1061627L,
1061627L, 1061168L, 1061627L, 1061168L, 1061627L, 1064949L, 1064949L,
1061168L, 1061386L), site = c("DD City", "DD City", "DD City",
"DD City", "DD City", "DD City", "DD City", "DD City", "DD City",
"DD City"), idindividual = c("DDIC-001-C1-F01", "DDIC-001-C1-F02",
"DDIC-001-C1-F03", "DDIC-001-C1-F04", "DDIC-001-C1-F05", "DDIC-001-C1-F06",
"DDIC-001-C2-F01", "DDIC-001-C2-F02", "DDIC-001-C2-F03", "DDIC-001-C3-F01"
)), row.names = c(NA, 10L), class = "data.frame")
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am trying to convert a dataframe into a SpatialPoints and then save the coordinates in their correct CRS but am coming up with an error

proj_create: Error 1027 (Invalid value for an argument): utm: Invalid value for zone
Error in CRS("+proj=utm +zone=37N") : NA

This script worked fine before I updated my R & RStudio, and I am struggling to find the root of the problem. Any help would be appreciated

sps.37N <- SpatialPoints(dd3.full[,c("longitude", "latitude")],
                         proj4string = CRS("+proj=utm +zone=37N"))
spst.37N  <- spTransform(sps.37N, CRS("+proj=longlat +datum=WGS84"))
dd3.full[, c("long", "lat")] <- coordinates(spst.37N)

Thanks

Sample data: structure(list(longitude = c(811674L, 811674L, 812382L, 811674L,
812382L, 811674L, 807900L, 807900L, 812382L, 812405L), latitude = c(1061627L,
1061627L, 1061168L, 1061627L, 1061168L, 1061627L, 1064949L, 1064949L,
1061168L, 1061386L), site = c("DD City", "DD City", "DD City",
"DD City", "DD City", "DD City", "DD City", "DD City", "DD City",
"DD City"), idindividual = c("DDIC-001-C1-F01", "DDIC-001-C1-F02",
"DDIC-001-C1-F03", "DDIC-001-C1-F04", "DDIC-001-C1-F05", "DDIC-001-C1-F06",
"DDIC-001-C2-F01", "DDIC-001-C2-F02", "DDIC-001-C2-F03", "DDIC-001-C3-F01"
)), row.names = c(NA, 10L), class = "data.frame")


问:
JavaFX Could not find or load main class Java 8 Linux
I know this is often a common issue but the Java 8 aspect confuses me. I'm aware that since Oracle removed JavaFX from the Java distribution, this issue is usually resolved with VM arguments (--module-path,--add-modules, etc).

However, I'm exporting a .jar file using jre 1.8.0_202 in eclipse. And this works great without any arguments on my windows machine. Sadly when I move this jar to my linux machine, I see the classic "Cloud not find or load main class". For reference, the linux machine is running 1.8.0_342. I would think that this shouldn't be an issue because I'm using older Java versions?

Any insight on why this works on one platform and not the other?


问:
Why do some named exports fail to import?
To keep things concise -- I'm using create-react-app and bundling my named component exports using an index.js file.

Does anyone know why named exports (bundled together in an index.js file) occasionally can't find one of the exports?  Is there a limitation to how many named exports can be called at once in a project? On a single import? A limitation with create-react-app absolute pathing?  Or did I miss something small?

// This is src/modules/index.js and exports all named exports in child folders for use, elsewhere

export * from './app/firstExport ';
export * from './app/secondExport ';
export * from './app/thirdExport ';
export * from './app/fourthExport ';

export * from './auth/fifthExport ';
export * from './auth/sixthExport ';
export * from './auth/seventhExport ';
export * from './auth/eighthExport ';

// And so on...
```
<pre class="lang-js prettyprint-override"><code>// This is src/modules/auth/seventhExport.js
// There's also src/modules/app/firstExport.js, etc.

const seventhExport = () => {
  console.log('Seventh function export, called.');
};

export { seventhExport };
</code>```

I'm using absolute pathing with the following jsconfig.json file located in the root of the project:

{
  "compilerOptions": {
    "baseUrl": "src"
  },
  "include": [ "src" ]
}
```
<p>When I import, most of the time the following works...</p>
<pre class="lang-js prettyprint-override"><code>import { firstExport, secondExport, thirdExport, fourthExport } from 'modules';
</code>```

This named export bundling and import setup is everywhere in the project but occasionally in another file, i'll do this:

import { fifthExport, sixthExport, seventhExport, eighthExport } from 'modules';
```
<p>...and get:
<code>Cannot read properties of undefined (reading 'seventhExport')</code>. Resulting in me having to explicitly map the import to it's file locations to fix this file throwing an error. So without changing anything else, this works:</p>
<pre class="lang-js prettyprint-override"><code>import { fifthExport, sixthExport, eighthExport } from 'modules';
import { seventhExport } from 'modules/app/seventhExport';
</code>```

Sometimes the whole named import destructuring will fail and I have to break each one apart for it to work:

import { fifthExport } from 'modules/auth/fifthExport';
import { sixthExport } from 'modules/auth/sixthExport';
import { seventhExport } from 'modules/auth/seventhExport';
import { eighthExport } from 'modules/auth/eighthExport';
```

Body:
To keep things concise -- I'm using create-react-app and bundling my named component exports using an index.js file.

Does anyone know why named exports (bundled together in an index.js file) occasionally can't find one of the exports?  Is there a limitation to how many named exports can be called at once in a project? On a single import? A limitation with create-react-app absolute pathing?  Or did I miss something small?

// This is src/modules/index.js and exports all named exports in child folders for use, elsewhere

export * from './app/firstExport ';
export * from './app/secondExport ';
export * from './app/thirdExport ';
export * from './app/fourthExport ';

export * from './auth/fifthExport ';
export * from './auth/sixthExport ';
export * from './auth/seventhExport ';
export * from './auth/eighthExport ';

// And so on...

// This is src/modules/auth/seventhExport.js
// There's also src/modules/app/firstExport.js, etc.

const seventhExport = () => {
  console.log('Seventh function export, called.');
};

export { seventhExport };

I'm using absolute pathing with the following jsconfig.json file located in the root of the project:

{
  "compilerOptions": {
    "baseUrl": "src"
  },
  "include": [ "src" ]
}

When I import, most of the time the following works...

import { firstExport, secondExport, thirdExport, fourthExport } from 'modules';

This named export bundling and import setup is everywhere in the project but occasionally in another file, i'll do this:

import { fifthExport, sixthExport, seventhExport, eighthExport } from 'modules';

...and get:
Cannot read properties of undefined (reading 'seventhExport'). Resulting in me having to explicitly map the import to it's file locations to fix this file throwing an error. So without changing anything else, this works:

import { fifthExport, sixthExport, eighthExport } from 'modules';
import { seventhExport } from 'modules/app/seventhExport';

Sometimes the whole named import destructuring will fail and I have to break each one apart for it to work:

import { fifthExport } from 'modules/auth/fifthExport';
import { sixthExport } from 'modules/auth/sixthExport';
import { seventhExport } from 'modules/auth/seventhExport';
import { eighthExport } from 'modules/auth/eighthExport';


问:
Email activation link from localhost can't point to android studio webview?
i am a beginner.
i made email activation with php, smtp phpmailer,
when I run it on localhost it works.
but when I make it a webview the activation link sent cannot point to my webview application.. what should I do? Please help me

how do you make the link activation code sent to email using php and smpt on localhost can be directed to the android studio webview application?


问:
SentenceEmbeddings and SentenceTransformer cause this error: The kernel appears to have died. It will restart automatically
My kernel in python restarts every time I try to call a SentenceEmbedding or a SentenceTransformer model in the Polyfuzz library.

Here are my imports, code, and versions:

```<code># General imports for data transformation
import pandas as pd
import numpy as np
import string
import re
import wrangler as wr

# Imports for n-grams building
# and fuzzy string matching
import nltk
import fuzzywuzzy
import polyfuzz
import sklearn

from nltk.metrics.distance import edit_distance
from fuzzywuzzy import fuzz
from polyfuzz import PolyFuzz
from polyfuzz.models import TFIDF
from polyfuzz.models import SentenceEmbeddings
from sentence_transformers import SentenceTransformer

from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
</code>```

After processing the data, I started with this below and it killed the kernel then showed the message "The kernel appears to have died. It will restart automatically."

```<code>model = SentenceEmbeddings('all-MiniLM-L6-v2')
</code>```

So I tried using this below to find a way around SentenceEmbeddings  which they suggest in the documentation.

```<code>embedding_model = SentenceTransformer('all-MiniLM-L6-v2')
distance_model = SentenceEmbeddings(embedding_model)
</code>```

I still got the same error. TFIDF works tho.

I uninstalled Polyfuzz and reinstalled it using pip but it still isn't working.

I looked for a way to download Polyfuzz using Conda but couldn't find any.

Versions:

Python 3.9.7

Polyfuzz 0.4.0

Body:
My kernel in python restarts every time I try to call a SentenceEmbedding or a SentenceTransformer model in the Polyfuzz library.

Here are my imports, code, and versions:

# General imports for data transformation
import pandas as pd
import numpy as np
import string
import re
import wrangler as wr

# Imports for n-grams building
# and fuzzy string matching
import nltk
import fuzzywuzzy
import polyfuzz
import sklearn

from nltk.metrics.distance import edit_distance
from fuzzywuzzy import fuzz
from polyfuzz import PolyFuzz
from polyfuzz.models import TFIDF
from polyfuzz.models import SentenceEmbeddings
from sentence_transformers import SentenceTransformer

from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity

After processing the data, I started with this below and it killed the kernel then showed the message "The kernel appears to have died. It will restart automatically."

model = SentenceEmbeddings('all-MiniLM-L6-v2')

So I tried using this below to find a way around SentenceEmbeddings  which they suggest in the documentation.

embedding_model = SentenceTransformer('all-MiniLM-L6-v2')
distance_model = SentenceEmbeddings(embedding_model)

I still got the same error. TFIDF works tho.

I uninstalled Polyfuzz and reinstalled it using pip but it still isn't working.

I looked for a way to download Polyfuzz using Conda but couldn't find any.

Versions:

Python 3.9.7

Polyfuzz 0.4.0


问:
Is there a way of passing extra data to the Left lambda in Match without having to add it to every intermediate method?
Suppose I have a method that takes the Id of a card issuer (think of loyalty cards for shops), and I want to get the status of the customer who made the most recent transaction. Yes this is a silly scenario, but it's easer than trying to describe the real one, and it's good enough to show the problem. The code shown here constitutes a working example, except for the last bit, which is where my question lies.

Here are two very simple types needed to support the workflow...

record CardIssuer(string Id, string Key);

enum CustomerStatus {
  Active,
  Inactive
}
```
<p>I have some static methods that return an <code>Either<string, T></code>, where <code>T</code> is specific to the actual method. The versions shown are stupidly simple for clarity...</p>
<pre class="lang-cs prettyprint-override"><code>static Either<string, CardIssuer> GetCardIssuer(string id) =>
 id == "1" ? new CardIssuer("1", "abc") : new CardIssuer(id, "def");

static Either<string, int> GetLatestTransactionId(CardIssuer issuer) =>
  issuer.Id == "1" ? 42 : 666;

static Either<string, CustomerStatus> GetCustomerStatus(int transactionId) =>
 transactionId == 42 ? CustomerStatus.Active : CustomerStatus.Inactive;
</code>```

I use these in a method like this...

static async Task<String> Process(string cardIssuerId) =>
  await (
    from issuer in GetCardIssuer(cardIssuerId).ToAsync()
    from id in GetLatestTransactionId(issuer).ToAsync()
    from status in GetCustomerStatus(id).ToAsync()
    select status.ToString()
  )
  .Match(status => {
    return status;
  },
  error => {
    return $"Error: {error}";
  });
```
<p>All of the above works fine, and is all you need to reproduce the simple scenario.</p>
<p>Suppose I now have a requirement that the result is encrypted, using the issuer-specific encryption key held in the <code>Key</code> property of <code>CardIssuer</code>.</p>
<p>Modifying the <code>Right</code> lambda is easy, I just change the last few lines of the query to look like this...</p>
<pre class="lang-cs prettyprint-override"><code>static async Task<String> Process(string cardIssuerId) =>
  await (
    from issuer in GetCardIssuer(cardIssuerId).ToAsync()
    from id in GetLatestTransactionId(issuer).ToAsync()
    from status in GetCustomerStatus(id).ToAsync()
    // Next line changed, along with the first lambda to Match
    select (issuer, status.ToString())
  )
  .Match((CardIssuer issuer, string status) => {
    return Encrypt(status, issuer.Key);
  },
  error => {
    // What do I do here?
  });
</code>```

This assumes an Encrypt method...

static string Encrypt(string s, string key) =>
  // Do some clever encryption with the key
  "";
```

However, I don't know how to get the encryption key into the Left lambda.

I know I can do this by modifying each of the Either-returning methods to return a tuple containing the type they currently return, along with a string for the key, however, this means that a significant number of currently reusable (and reused) methods would now have to take in and pass out data that has nothing to do with them.

Is there a better way of passing data to the Left lambda?

Body:
Suppose I have a method that takes the Id of a card issuer (think of loyalty cards for shops), and I want to get the status of the customer who made the most recent transaction. Yes this is a silly scenario, but it's easer than trying to describe the real one, and it's good enough to show the problem. The code shown here constitutes a working example, except for the last bit, which is where my question lies.

Here are two very simple types needed to support the workflow...

record CardIssuer(string Id, string Key);

enum CustomerStatus {
  Active,
  Inactive
}

I have some static methods that return an Either<string, T>, where T is specific to the actual method. The versions shown are stupidly simple for clarity...

static Either<string, CardIssuer> GetCardIssuer(string id) =>
 id == "1" ? new CardIssuer("1", "abc") : new CardIssuer(id, "def");

static Either<string, int> GetLatestTransactionId(CardIssuer issuer) =>
  issuer.Id == "1" ? 42 : 666;

static Either<string, CustomerStatus> GetCustomerStatus(int transactionId) =>
 transactionId == 42 ? CustomerStatus.Active : CustomerStatus.Inactive;

I use these in a method like this...

static async Task<String> Process(string cardIssuerId) =>
  await (
    from issuer in GetCardIssuer(cardIssuerId).ToAsync()
    from id in GetLatestTransactionId(issuer).ToAsync()
    from status in GetCustomerStatus(id).ToAsync()
    select status.ToString()
  )
  .Match(status => {
    return status;
  },
  error => {
    return $"Error: {error}";
  });

All of the above works fine, and is all you need to reproduce the simple scenario.

Suppose I now have a requirement that the result is encrypted, using the issuer-specific encryption key held in the Key property of CardIssuer.

Modifying the Right lambda is easy, I just change the last few lines of the query to look like this...

static async Task<String> Process(string cardIssuerId) =>
  await (
    from issuer in GetCardIssuer(cardIssuerId).ToAsync()
    from id in GetLatestTransactionId(issuer).ToAsync()
    from status in GetCustomerStatus(id).ToAsync()
    // Next line changed, along with the first lambda to Match
    select (issuer, status.ToString())
  )
  .Match((CardIssuer issuer, string status) => {
    return Encrypt(status, issuer.Key);
  },
  error => {
    // What do I do here?
  });

This assumes an Encrypt method...

static string Encrypt(string s, string key) =>
  // Do some clever encryption with the key
  "";

However, I don't know how to get the encryption key into the Left lambda.

I know I can do this by modifying each of the Either-returning methods to return a tuple containing the type they currently return, along with a string for the key, however, this means that a significant number of currently reusable (and reused) methods would now have to take in and pass out data that has nothing to do with them.

Is there a better way of passing data to the Left lambda?


问:
How certain debug prints are automatically enabled in linux kernel?
I was exploring dynamic debug feature in linux kernel and the documentation gives enough details.

On my test setup, I have booted 5.16 mainline kernel on QEMU with below command:

qemu-system-aarch64 -smp 4 -m 2G -machine virt -cpu cortex-a57 -kernel uImage \
                    -netdev tap,id=mynet0,ifname=tap0,script=no,downscript=no -device e1000,netdev=mynet0,mac=52:55:00:d1:55:01 \
                    -display none -serial mon:stdio \
                    -append "console=ttyAMA0,115200n8 root=/dev/nfs rw nfsroot=10.105.226.234:/home/naveen/nfsroot/rootfs-busybox-arm64,nolock,vers=4,tcp ip=10.105.226.235"
```
<p>I am using Busybox as rootfs. I notice that certain debug prints are by default enabled e.g.</p>
<pre class="lang-sh prettyprint-override"><code>$ cat /proc/dynamic_debug/control | grep =p
drivers/scsi/libsas/sas_expander.c:2084 [libsas]sas_rediscover =p "ex %016llx phy%02d originated BROADCAST(CHANGE)\012"
drivers/scsi/libsas/sas_expander.c:2008 [libsas]sas_rediscover_dev =p "ex %016llx rediscovering phy%02d%s\012"
drivers/scsi/libsas/sas_expander.c:2048 [libsas]sas_rediscover_dev =p "ex %016llx phy%02d broadcast flutter%s\012"
drivers/scsi/libsas/sas_scsi_host.c:117 [libsas]sas_scsi_task_done =p "task done but aborted\012"
drivers/scsi/libsas/sas_scsi_host.c:122 [libsas]sas_scsi_task_done =p "task_done called with non existing SCSI cmnd!\012"
drivers/scsi/libsas/sas_scsi_host.c:193 [libsas]sas_queuecommand =p "lldd_execute_task returned: %d\012"
</code>```

I have not passed any specific cmdline option to enable these. These are in-built into the kernel and not loaded as modules. Can someone please explain how above debug prints are enabled by default? In total, I have fair amount of logs enabled in mysterious way

$ cat /proc/dynamic_debug/control | grep =p | wc -l
37
$ cat /proc/dynamic_debug/control | grep =_ | wc -l
5513
```

I just wanted to know how these debug prints got enabled because I didn't enable them at least, so someone must be doing it.

Body:
I was exploring dynamic debug feature in linux kernel and the documentation gives enough details.

On my test setup, I have booted 5.16 mainline kernel on QEMU with below command:

qemu-system-aarch64 -smp 4 -m 2G -machine virt -cpu cortex-a57 -kernel uImage \
                    -netdev tap,id=mynet0,ifname=tap0,script=no,downscript=no -device e1000,netdev=mynet0,mac=52:55:00:d1:55:01 \
                    -display none -serial mon:stdio \
                    -append "console=ttyAMA0,115200n8 root=/dev/nfs rw nfsroot=10.105.226.234:/home/naveen/nfsroot/rootfs-busybox-arm64,nolock,vers=4,tcp ip=10.105.226.235"

I am using Busybox as rootfs. I notice that certain debug prints are by default enabled e.g.

$ cat /proc/dynamic_debug/control | grep =p
drivers/scsi/libsas/sas_expander.c:2084 [libsas]sas_rediscover =p "ex %016llx phy%02d originated BROADCAST(CHANGE)\012"
drivers/scsi/libsas/sas_expander.c:2008 [libsas]sas_rediscover_dev =p "ex %016llx rediscovering phy%02d%s\012"
drivers/scsi/libsas/sas_expander.c:2048 [libsas]sas_rediscover_dev =p "ex %016llx phy%02d broadcast flutter%s\012"
drivers/scsi/libsas/sas_scsi_host.c:117 [libsas]sas_scsi_task_done =p "task done but aborted\012"
drivers/scsi/libsas/sas_scsi_host.c:122 [libsas]sas_scsi_task_done =p "task_done called with non existing SCSI cmnd!\012"
drivers/scsi/libsas/sas_scsi_host.c:193 [libsas]sas_queuecommand =p "lldd_execute_task returned: %d\012"

I have not passed any specific cmdline option to enable these. These are in-built into the kernel and not loaded as modules. Can someone please explain how above debug prints are enabled by default? In total, I have fair amount of logs enabled in mysterious way

$ cat /proc/dynamic_debug/control | grep =p | wc -l
37
$ cat /proc/dynamic_debug/control | grep =_ | wc -l
5513

I just wanted to know how these debug prints got enabled because I didn't enable them at least, so someone must be doing it.


问:
React app making hundreds of read requests to Firestore database unintentionally
I have created a React app with Material UI that makes a connection to a Rapid API endpoint and retrieves a list of exercises based on a search result on my home page. The results are displayed a little further down the page in individual cards. These cards have a button that when clicked adds the endpoint data to a Firebase Firestore collection. The exercises are correctly saving to the database. In the SavedExercisesCards component I have created a connection to the Firestore database and I am attempting to retrieve those exercises and display them in cards. This is working correctly, however the code I am using is creating a lot of read request-- like hundreds of them within a few minutes, even when I am not manually requesting them. As you can see I am using the getDocs method to pull those documents from the collection.

This component is called SavedExercisesCard.jsx

```<code>const [exercises, setExercises] = useState([]);

  useEffect(() => {
    const pullSavedExercises = async () => {
      // grabs collection of documents from server and saves them to a variable
      const colRef = collection(db, "savedExercises");
      const savedExercises = await getDocs(colRef);
      // sets state to mapped collection documents
      setExercises(
        savedExercises.docs.map((savedExercise) => ({
          ...savedExercise.data(),
          id: savedExercise.id,
        }))
      );
    };
    pullSavedExercises();
  }, []);
</code>```

A little further down in the same component I map over the exercises state object and attempt to display them in individual cards. This is working and is displaying the cards as expected.

```<code>  return (
    <>

      {exercises.map((exercise) => (
        <Container maxWidth="lg">
          <Box>
            <Grid container spacing={1}>
              <Grid item xs={12} xl={4}>
                <Card>
                  <CardMedia
                    component="img"
                    alt={exercise.name}
                    image={exercise.gifUrl}
                  />
                  <CardContent sx={{ pb: 2, height: "75px" }}>
                    <Typography variant="h5" sx={{ pb: 1 }}>
                      {exercise.name.toUpperCase()}
                    </Typography>
                    <Typography variant="body2">
                      {exercise.target.toUpperCase()}
                    </Typography>
                  </CardContent>

                </Card>
              </Grid>
            </Grid>
          </Box>
        </Container>
      ))}
    </>
  );
</code>```

I include this component in my SavedExercises page; it looks like this.

```<code>import { Box } from "@mui/system";
import React from "react";
import SavedExercisesCard from "../components/SavedExercisesCard.jsx";

const SavedExercises = ({ exercises }) => {
  return (
    <Box sx={{ mt: "75px" }}>
      <SavedExercisesCard exercises={exercises} />
    </Box>
  );
};

export default SavedExercises;
</code>```

Why am I making so many read requests? When I add an exercise to the collection it is correctly writing it to the database--it is not making any extra writes.

Body:
I have created a React app with Material UI that makes a connection to a Rapid API endpoint and retrieves a list of exercises based on a search result on my home page. The results are displayed a little further down the page in individual cards. These cards have a button that when clicked adds the endpoint data to a Firebase Firestore collection. The exercises are correctly saving to the database. In the SavedExercisesCards component I have created a connection to the Firestore database and I am attempting to retrieve those exercises and display them in cards. This is working correctly, however the code I am using is creating a lot of read request-- like hundreds of them within a few minutes, even when I am not manually requesting them. As you can see I am using the getDocs method to pull those documents from the collection.

This component is called SavedExercisesCard.jsx

const [exercises, setExercises] = useState([]);

  useEffect(() => {
    const pullSavedExercises = async () => {
      // grabs collection of documents from server and saves them to a variable
      const colRef = collection(db, "savedExercises");
      const savedExercises = await getDocs(colRef);
      // sets state to mapped collection documents
      setExercises(
        savedExercises.docs.map((savedExercise) => ({
          ...savedExercise.data(),
          id: savedExercise.id,
        }))
      );
    };
    pullSavedExercises();
  }, []);

A little further down in the same component I map over the exercises state object and attempt to display them in individual cards. This is working and is displaying the cards as expected.

  return (
    <>

      {exercises.map((exercise) => (
        <Container maxWidth="lg">
          <Box>
            <Grid container spacing={1}>
              <Grid item xs={12} xl={4}>
                <Card>
                  <CardMedia
                    component="img"
                    alt={exercise.name}
                    image={exercise.gifUrl}
                  />
                  <CardContent sx={{ pb: 2, height: "75px" }}>
                    <Typography variant="h5" sx={{ pb: 1 }}>
                      {exercise.name.toUpperCase()}
                    </Typography>
                    <Typography variant="body2">
                      {exercise.target.toUpperCase()}
                    </Typography>
                  </CardContent>

                </Card>
              </Grid>
            </Grid>
          </Box>
        </Container>
      ))}
    </>
  );

I include this component in my SavedExercises page; it looks like this.

import { Box } from "@mui/system";
import React from "react";
import SavedExercisesCard from "../components/SavedExercisesCard.jsx";

const SavedExercises = ({ exercises }) => {
  return (
    <Box sx={{ mt: "75px" }}>
      <SavedExercisesCard exercises={exercises} />
    </Box>
  );
};

export default SavedExercises;

Why am I making so many read requests? When I add an exercise to the collection it is correctly writing it to the database--it is not making any extra writes.


问:
Spring Security with Custom Auth Server and Microsoft SSO resulting in double "nonce" parameter?
I have a spring boot application running that serves some static html/css/javascript via a rest endpoint(GET).
Now I want to add security to the page so not everyone can access the resources.
For this I am provided with a authorization uri, client id and client secret.
My application.properties looks like this:

```<code>spring.security.oauth2.client.registration.custom.client-id=${CLIENT_ID}
spring.security.oauth2.client.registration.custom.client-secret=${CLIENT_SECRET}
spring.security.oauth2.client.registration.custom.redirect-uri=http://localhost:8080/
spring.security.oauth2.client.registration.custom.authorization-grant-type=authorization_code
spring.security.oauth2.client.registration.custom.scope=openid
spring.security.oauth2.client.registration.custom.provider=custom-provider

spring.security.oauth2.client.provider.custom-provider.authorization-uri=https://example.com/oauth/authorize
spring.security.oauth2.client.provider.custom-provider.token-uri=https://example.com/oauth/token
</code>```

When I call localhost:8080 spring returns something like this:

```<code>https://example.com/oauth/authorize?response_type=code&client_id=MY-CLIENT-ID&scope=openid&state=SOME-STATE-ID&redirect_uri=http://localhost:8080&nonce=SOME-NONCE-ID
</code>```

This auth server redirects to

```<code>https://MICROSOFT-LOGIN-PAGE.com/SOME-MICROSOFT-ID/oauth2/v2.0/authorize?client_id=SOME-MICROSOFT-CLIENT-ID&redirect_uri=https://example.com/oauth/authorize&scope=openid&nonce=SOME-NONCE-ID&nonce=NONCE-ID-FROM-PREVIOUS-REDIRECT&response_type=code&state=-SOME-STATE-ID
</code>```

Then I see the Microsoft login page with the following error:

AADSTS9000411: The request is not properly formatted. The parameter 'nonce' is duplicated.

Originally I had https://oauthdebugger.com/debug as a redirect uri. When I then manually remove the nonce parameter that gets attached from spring everything works as it should and I get redirected to https://oauthdebugger.com/debug and I see a SUCCESS message with the state and authorization code.

When I change the redirect uri to http://localhost:8080/ I again get the error from Microsoft that the parameter nonce is duplicated. Even when I manually remove it.

I would have expected to get redirected back to localhost:8080 and see the html/css/javascript loaded.
Unfortunately I do not have any access/control over this custom authentication server and I have to use it.

This is my first time working with (spring) security and OIDC/oauth2.
Please show me where I got something wrong or point me in a direction.

Thanks in advance

Body:
I have a spring boot application running that serves some static html/css/javascript via a rest endpoint(GET).
Now I want to add security to the page so not everyone can access the resources.
For this I am provided with a authorization uri, client id and client secret.
My application.properties looks like this:

spring.security.oauth2.client.registration.custom.client-id=${CLIENT_ID}
spring.security.oauth2.client.registration.custom.client-secret=${CLIENT_SECRET}
spring.security.oauth2.client.registration.custom.redirect-uri=http://localhost:8080/
spring.security.oauth2.client.registration.custom.authorization-grant-type=authorization_code
spring.security.oauth2.client.registration.custom.scope=openid
spring.security.oauth2.client.registration.custom.provider=custom-provider

spring.security.oauth2.client.provider.custom-provider.authorization-uri=https://example.com/oauth/authorize
spring.security.oauth2.client.provider.custom-provider.token-uri=https://example.com/oauth/token

When I call localhost:8080 spring returns something like this:

https://example.com/oauth/authorize?response_type=code&client_id=MY-CLIENT-ID&scope=openid&state=SOME-STATE-ID&redirect_uri=http://localhost:8080&nonce=SOME-NONCE-ID

This auth server redirects to

https://MICROSOFT-LOGIN-PAGE.com/SOME-MICROSOFT-ID/oauth2/v2.0/authorize?client_id=SOME-MICROSOFT-CLIENT-ID&redirect_uri=https://example.com/oauth/authorize&scope=openid&nonce=SOME-NONCE-ID&nonce=NONCE-ID-FROM-PREVIOUS-REDIRECT&response_type=code&state=-SOME-STATE-ID

Then I see the Microsoft login page with the following error:

AADSTS9000411: The request is not properly formatted. The parameter 'nonce' is duplicated.

Originally I had https://oauthdebugger.com/debug as a redirect uri. When I then manually remove the nonce parameter that gets attached from spring everything works as it should and I get redirected to https://oauthdebugger.com/debug and I see a SUCCESS message with the state and authorization code.

When I change the redirect uri to http://localhost:8080/ I again get the error from Microsoft that the parameter nonce is duplicated. Even when I manually remove it.

I would have expected to get redirected back to localhost:8080 and see the html/css/javascript loaded.
Unfortunately I do not have any access/control over this custom authentication server and I have to use it.

This is my first time working with (spring) security and OIDC/oauth2.
Please show me where I got something wrong or point me in a direction.

Thanks in advance


问:
Is there a way to dynamic/lazy import material ui icons without importing all the icons module?
I found this post, but it's not been answered..
Import React Material UI Icons dynamically

Currently, I have the code below, and it works, but I don't want to use

import * as Icons from '@mui/icons-material';

```<code>import { createElement } from 'react';
import * as Icons from '@mui/icons-material';

export const MaterialUIIcon = ({ iconName }) => {
    return createElement(Icons[iconName]});
};
</code>```

Is there a way to import an icon from a string without importing all other unrelated icons?

Something like React.lazy(() => import('@mui/icons-material/${iconName}')); which I tried but it didn't work..

Body:
I found this post, but it's not been answered..
Import React Material UI Icons dynamically

Currently, I have the code below, and it works, but I don't want to use

import * as Icons from '@mui/icons-material';

import { createElement } from 'react';
import * as Icons from '@mui/icons-material';

export const MaterialUIIcon = ({ iconName }) => {
    return createElement(Icons[iconName]});
};

Is there a way to import an icon from a string without importing all other unrelated icons?

Something like React.lazy(() => import('@mui/icons-material/${iconName}')); which I tried but it didn't work..


问:
Cakephp Cookies for internalization
I'm trying to save the runtime language an offer users the option of switch it.

I have this in my default.php:

```<code>          <li class="nav-item">
            <?php
            if (I18n::getLocale() !== 'en_US'){
          ?>
              <?= $this->Html->link('EN', ['action' => 'changeLang']); ?>
              <?php
            }else{ ?>
              <?= $this->Html->link('ES', ['action' => 'ccc']); ?>
            <?php    } ?>
          </li>
</code>```

I have never worked with Cookies so I'm a bit lost in this part.
In my AppController I have this in the method initialize:

```<code>public function initialize(): void
{
    parent::initialize();

    $this->loadComponent('RequestHandler');
    $this->loadComponent('Flash');
    $this->loadComponent('Authentication.Authentication');
    $idioma=$this->request->getCookie($idiomacookie);
    if ($idioma == 'en_US'){
        I18n::setLocale('es_ES');

    }else{
        I18n::setLocale('en_US');
    }
}
</code>```

And o the method changLAng I have this:

```<code>public function changeLang():void
{
    if (I18n::getLocale() !== 'en_US'){
        I18n::setLocale('en_US');
        $idioma = Cookie::create('idiomacookie', 'en_US');
        $this->response = $this->response->withCookie($idioma);
        $this->idiomacookie = 'en_US';
    }else{
        I18n::setLocale('es_ES');
        $idioma = Cookie::create('idiomacookie', 'es_ES');
        $this->response = $this->response->withCookie($idioma);
        $this->idiomacookie = 'es_ES';
    }

    $this->redirect($this->referer());

}
</code>```

Where do I declare the Cookie so it doesn't always take the default value? I'm not sure if I'm using $this->response->withCookie correctly.

Title: Cakephp Cookies for internalization

Body:
I'm trying to save the runtime language an offer users the option of switch it.

I have this in my default.php:

            <?php
            if (I18n::getLocale() !== 'en_US'){
          ?>
              <?= $this->Html->link('EN', ['action' => 'changeLang']); ?>
              <?php
            }else{ ?>
              <?= $this->Html->link('ES', ['action' => 'ccc']); ?>
            <?php    } ?>

I have never worked with Cookies so I'm a bit lost in this part.
In my AppController I have this in the method initialize:

public function initialize(): void
{
    parent::initialize();

    $this->loadComponent('RequestHandler');
    $this->loadComponent('Flash');
    $this->loadComponent('Authentication.Authentication');
    $idioma=$this->request->getCookie($idiomacookie);
    if ($idioma == 'en_US'){
        I18n::setLocale('es_ES');

    }else{
        I18n::setLocale('en_US');
    }
}

And o the method changLAng I have this:

public function changeLang():void
{
    if (I18n::getLocale() !== 'en_US'){
        I18n::setLocale('en_US');
        $idioma = Cookie::create('idiomacookie', 'en_US');
        $this->response = $this->response->withCookie($idioma);
        $this->idiomacookie = 'en_US';
    }else{
        I18n::setLocale('es_ES');
        $idioma = Cookie::create('idiomacookie', 'es_ES');
        $this->response = $this->response->withCookie($idioma);
        $this->idiomacookie = 'es_ES';
    }

    $this->redirect($this->referer());

}

Where do I declare the Cookie so it doesn't always take the default value? I'm not sure if I'm using $this->response->withCookie correctly.


问:
Align a slicer when file opens
I have a workbook that has several pivot tables linked to 1 slicer as in Year & Week, but I would like to auto update these when my file opens as part of the check routine and I am getting more and more confused looking at whats online

I currently have the below but I am unsure how to get it to reference the slicer against the value B13?
I have tried various example but either get the

1004 or 438 error.

Can anyone point me in the right direction please as it only needs to be loaded this way the first time the file is opened as its then down to the individual to filter as needed

I have tried the code below and various others but seem to be going round in circles

```<code>Dim pf As PivotField

CYear = Worksheets("LiveStaffLoader").Range("B11").Value
CWN = Worksheets("LiveStaffLoader").Range("B12").Value
PWN = Worksheets("LiveStaffLoader").Range("B13").Value

PivotTables("PivotTable2").ClearAllFilters
 Set pf = ActiveSheet.SlicerCaches("Year") _
  .VisibleSlicerItemsList = Array("[PivotTable2].[Year].&[" &        Worksheets("LiveStaffLoader").Range("B13").Value & "]")
</code>```

Title: Align a slicer when file opens

Body:
I have a workbook that has several pivot tables linked to 1 slicer as in Year & Week, but I would like to auto update these when my file opens as part of the check routine and I am getting more and more confused looking at whats online

I currently have the below but I am unsure how to get it to reference the slicer against the value B13?
I have tried various example but either get the

1004 or 438 error.

Can anyone point me in the right direction please as it only needs to be loaded this way the first time the file is opened as its then down to the individual to filter as needed

I have tried the code below and various others but seem to be going round in circles

Dim pf As PivotField

CYear = Worksheets("LiveStaffLoader").Range("B11").Value
CWN = Worksheets("LiveStaffLoader").Range("B12").Value
PWN = Worksheets("LiveStaffLoader").Range("B13").Value

PivotTables("PivotTable2").ClearAllFilters
 Set pf = ActiveSheet.SlicerCaches("Year") _
  .VisibleSlicerItemsList = Array("[PivotTable2].[Year].&[" &        Worksheets("LiveStaffLoader").Range("B13").Value & "]")


问:
500 (Internal Server Error) using a proxy on an apache webserver
On my raspberry-pi I set up an apache web server. I copied the files of my built vue.js project in the /var/www/html folder. So far so good, everything works.

Now I need a proxy for some requests to my api. After research I found the fairly simple proxypass from apache.

I tried to configure it as follows:

```<code>sudo a2enmod proxy
sudo a2enmod proxy_html
sudo a2enmod proxy_http
</code>```

Then I added the following lines to apache.config:

```<code>ProxyPass /api https://api-adress.com:apiport
ProxyPassReverse /api https://api-adress.com:apiport
</code>```

Then I restarted the server using

```<code>sudo systemctl restart apache2
</code>```

The call in my project to my api looks like this:

```<code>const res = await fetch(`api/apisubadress`, {
        method: 'POST',
        headers: {
            'Content-type': 'application/json',
            'X-API-KEY': 1234,
        },
        body: data,
    });
</code>```

Whenever this is called, the console yields:

```<code>POST http://serverip/api/apisubaddress 500 (Internal Server Error)
</code>```

On the proxy of my devserver (which I cannot use in production) the call works flawlessly. This proxy is configured as follows in my vue project:

```<code>module.exports = {
  devServer: {
    https: false,
    proxy: {
      '^/api': {
        target: `${apiConfig.ip}:${apiConfig.port}`,
        changeOrigin: true,
        pathRewrite: { '^/api': '/' },
      },
    },
  },
}
</code>```

I also read to add LoadModule to apache2.conf like this:

```<code>LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
</code>```

but in my apache2 folder there is no such folder modules, only mod-available / enabled, which do not contain .so files.

I have the feeling this is fairly basic and should be simple, but I am missing some things. Help would be greatly appreciated.

Body:
On my raspberry-pi I set up an apache web server. I copied the files of my built vue.js project in the /var/www/html folder. So far so good, everything works.

Now I need a proxy for some requests to my api. After research I found the fairly simple proxypass from apache.

I tried to configure it as follows:

sudo a2enmod proxy
sudo a2enmod proxy_html
sudo a2enmod proxy_http

Then I added the following lines to apache.config:

ProxyPass /api https://api-adress.com:apiport
ProxyPassReverse /api https://api-adress.com:apiport

Then I restarted the server using

sudo systemctl restart apache2

The call in my project to my api looks like this:

const res = await fetch(`api/apisubadress`, {
        method: 'POST',
        headers: {
            'Content-type': 'application/json',
            'X-API-KEY': 1234,
        },
        body: data,
    });

Whenever this is called, the console yields:

POST http://serverip/api/apisubaddress 500 (Internal Server Error)

On the proxy of my devserver (which I cannot use in production) the call works flawlessly. This proxy is configured as follows in my vue project:

module.exports = {
  devServer: {
    https: false,
    proxy: {
      '^/api': {
        target: `${apiConfig.ip}:${apiConfig.port}`,
        changeOrigin: true,
        pathRewrite: { '^/api': '/' },
      },
    },
  },
}

I also read to add LoadModule to apache2.conf like this:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

but in my apache2 folder there is no such folder modules, only mod-available / enabled, which do not contain .so files.

I have the feeling this is fairly basic and should be simple, but I am missing some things. Help would be greatly appreciated.


问:
QT QML how to center rectangles in parent rectangle
I have four rectangles that are supposed to simulate buttons. These are arranged in another rectangle.

Is there a simple way to distribute these four evenly in the frame or do I have to calculate the distances between them and set it manually?

And one other question

```<code>Rectangle {
    id: buttons
    Layout.row: 3
    Layout.column: 1
    Layout.fillWidth: true
    Layout.fillHeight: true
    Layout.preferredHeight: _buttonsHeight
    color: "gray"

    RowLayout {
        anchors.fill: parent

        Rectangle {
            id: button1
            height: _buttonsHeight * 0.6
            width: height
            radius: height / 2
            border.width: 1
            border.color: "black"
        }
        Rectangle {
            id: button2
            height: button1.height
            width: height
            radius: height / 2
            border.width: 1
            border.color: "black"
        }
    }
}
</code>```

_buttonsHeight is set at the beginning of the window.

If I change the height in button1 to parent.height * 0.6 instead of _buttonsHeight * 0.6, it wouldn't work.

Is this related to the fact that only the preferedHeight is set in the parent?

Body:
I have four rectangles that are supposed to simulate buttons. These are arranged in another rectangle.

Is there a simple way to distribute these four evenly in the frame or do I have to calculate the distances between them and set it manually?

And one other question

Rectangle {
    id: buttons
    Layout.row: 3
    Layout.column: 1
    Layout.fillWidth: true
    Layout.fillHeight: true
    Layout.preferredHeight: _buttonsHeight
    color: "gray"

    RowLayout {
        anchors.fill: parent

        Rectangle {
            id: button1
            height: _buttonsHeight * 0.6
            width: height
            radius: height / 2
            border.width: 1
            border.color: "black"
        }
        Rectangle {
            id: button2
            height: button1.height
            width: height
            radius: height / 2
            border.width: 1
            border.color: "black"
        }
    }
}

_buttonsHeight is set at the beginning of the window.

If I change the height in button1 to parent.height * 0.6 instead of _buttonsHeight * 0.6, it wouldn't work.

Is this related to the fact that only the preferedHeight is set in the parent?


问:
How to produce an equation for graphs using seaborn.lmplot()
So I need to produce an equation for my regression lines which I have obtained using the lmplot function. Any help greatly appreciated :)

```<code>sns.lmplot(x='Timestamp_s', y='Heart_Rate(bpm)', hue='Subject', col='Subject', data=Activity1);
</code>```

I've tried using different functions however they don't allow me to produce a grid of many graphs like lmplot has.

Body:
So I need to produce an equation for my regression lines which I have obtained using the lmplot function. Any help greatly appreciated :)

sns.lmplot(x='Timestamp_s', y='Heart_Rate(bpm)', hue='Subject', col='Subject', data=Activity1);

I've tried using different functions however they don't allow me to produce a grid of many graphs like lmplot has.


问:
Failure while running flutter
I'am trying to run my flutter app on my android device but everytime
I try to run it I'am getting an error but the things is that the flutter
app is a newly created flutter project and I haven't run any code
yet but the android device is the one I always use to run my flutter apps
this is the error:</p>
```<code>Launching lib\main.dart on SM G9250 in debug mode...
Running Gradle task 'assembleDebug'...
F/CoreApps(23818): [1][CommonFeature] ###versionCode : 115082101, CONTACT_PROFILE_SERVICE_ENABLE : true, FREE_MESSAGE_ENABLE : true
F/CoreApps(23818): [1][CommonFeature] ###versionCode : 115082101, CONTACT_PROFILE_SERVICE_ENABLE : true, FREE_MESSAGE_ENABLE : true
F/CoreApps(23818): [ELog][1][EasySignUp] [NotRegistered][014dade2924475c9ae5e0ed07254fa66fa9f1650bb]
F/CoreApps(24071): [1][CommonFeature] ###versionCode : 115082101, CONTACT_PROFILE_SERVICE_ENABLE : true, FREE_MESSAGE_ENABLE : true
F/CoreApps(24071): [1][CommonFeature] ###versionCode : 115082101, CONTACT_PROFILE_SERVICE_ENABLE : true, FREE_MESSAGE_ENABLE : true
F/CoreApps(24071): [ELog][1][EasySignUp] [NotRegistered][014dade2924475c9ae5e0ed07254fa66fa9f1650bb]
F/CoreApps(24352): [1][CommonFeature] ###versionCode : 115082101, CONTACT_PROFILE_SERVICE_ENABLE : true, FREE_MESSAGE_ENABLE : true
F/CoreApps(24352): [1][CommonFeature] ###versionCode : 115082101, CONTACT_PROFILE_SERVICE_ENABLE : true, FREE_MESSAGE_ENABLE : true
F/CoreApps(24352): [ELog][1][EasySignUp] [NotRegistered][014dade2924475c9ae5e0ed07254fa66fa9f1650bb]
F/CoreApps(24586): [1][CommonFeature] ###versionCode : 115082101, CONTACT_PROFILE_SERVICE_ENABLE : true, FREE_MESSAGE_ENABLE : true
F/CoreApps(24586): [1][CommonFeature] ###versionCode : 115082101, CONTACT_PROFILE_SERVICE_ENABLE : true, FREE_MESSAGE_ENABLE : true
F/CoreApps(24586): [ELog][1][EasySignUp] [NotRegistered][014dade2924475c9ae5e0ed07254fa66fa9f1650bb]
F/Finsky:background(25198): [62819] kce.h(3): Service object is not present when stopServiceSafely was called.
F/Finsky:background(25198): com.google.android.flib.log.WhatATerribleException
F/Finsky:background(25198):     at adil.h(PG:2)
F/Finsky:background(25198):     at com.google.android.finsky.utils.FinskyLog.k(PG:3)
F/Finsky:background(25198):     at kce.h(PG:3)
F/Finsky:background(25198):     at kce.g(PG)
F/Finsky:background(25198):     at kce.e(PG:2)
F/Finsky:background(25198):     at kcp.h(PG)
F/Finsky:background(25198):     at kcn.a(PG:4)
F/Finsky:background(25198):     at kcp.j(PG:1)
F/Finsky:background(25198):     at kcp.c(PG)
F/Finsky:background(25198):     at jzy.e(PG:12)
F/Finsky:background(25198):     at jzv.apply(PG:117)
F/Finsky:background(25198):     at j$.util.stream.s.accept(SourceFile:45)
F/Finsky:background(25198):     at j$.util.a.forEachRemaining(SourceFile:20)
F/Finsky:background(25198):     at j$.util.stream.c.y(SourceFile:21)
F/Finsky:background(25198):     at j$.util.stream.c.G(SourceFile:8)
F/Finsky:background(25198):     at j$.util.stream.Z0.e(SourceFile:1)
F/Finsky:background(25198):     at j$.util.stream.c.J(SourceFile:35)
F/Finsky:background(25198):     at j$.util.stream.A1.collect(SourceFile:83)
F/Finsky:background(25198):     at jzm.a(PG:57)
F/Finsky:background(25198):     at akic.e(PG:2)
F/Finsky:background(25198):     at akie.run(PG:9)
F/Finsky:background(25198):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
F/Finsky:background(25198):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
F/Finsky:background(25198):     at htq.run(PG:40)
F/Finsky:background(25198):     at java.lang.Thread.run(Thread.java:818)
F/Finsky:background(26867): [62984] kce.h(3): Service object is not present when stopServiceSafely was called.
F/Finsky:background(26867): com.google.android.flib.log.WhatATerribleException
F/Finsky:background(26867):     at adil.h(PG:2)
F/Finsky:background(26867):     at com.google.android.finsky.utils.FinskyLog.k(PG:3)
F/Finsky:background(26867):     at kce.h(PG:3)
F/Finsky:background(26867):     at kce.g(PG)
F/Finsky:background(26867):     at kce.e(PG:2)
F/Finsky:background(26867):     at kcp.h(PG)
F/Finsky:background(26867):     at kcn.a(PG:4)
F/Finsky:background(26867):     at kcp.j(PG:1)
F/Finsky:background(26867):     at kcp.c(PG)
F/Finsky:background(26867):     at jzy.e(PG:12)
F/Finsky:background(26867):     at jzv.apply(PG:117)
F/Finsky:background(26867):     at j$.util.stream.s.accept(SourceFile:45)
F/Finsky:background(26867):     at j$.util.a.forEachRemaining(SourceFile:20)
F/Finsky:background(26867):     at j$.util.stream.c.y(SourceFile:21)
F/Finsky:background(26867):     at j$.util.stream.c.G(SourceFile:8)
F/Finsky:background(26867):     at j$.util.stream.Z0.e(SourceFile:1)
F/Finsky:background(26867):     at j$.util.stream.c.J(SourceFile:35)
F/Finsky:background(26867):     at j$.util.stream.A1.collect(SourceFile:83)
F/Finsky:background(26867):     at jzm.a(PG:57)
F/Finsky:background(26867):     at akic.e(PG:2)
F/Finsky:background(26867):     at akie.run(PG:9)
F/Finsky:background(26867):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
F/Finsky:background(26867):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
F/Finsky:background(26867):     at htq.run(PG:40)
F/Finsky:background(26867):     at java.lang.Thread.run(Thread.java:818)
</code>```

Title: Failure while running flutter

Body:
I'am trying to run my flutter app on my android device but everytime
I try to run it I'am getting an error but the things is that the flutter
app is a newly created flutter project and I haven't run any code
yet but the android device is the one I always use to run my flutter apps
this is the error:

Launching lib\main.dart on SM G9250 in debug mode...
Running Gradle task 'assembleDebug'...
F/CoreApps(23818): [1][CommonFeature] ###versionCode : 115082101, CONTACT_PROFILE_SERVICE_ENABLE : true, FREE_MESSAGE_ENABLE : true
F/CoreApps(23818): [1][CommonFeature] ###versionCode : 115082101, CONTACT_PROFILE_SERVICE_ENABLE : true, FREE_MESSAGE_ENABLE : true
F/CoreApps(23818): [ELog][1][EasySignUp] [NotRegistered][014dade2924475c9ae5e0ed07254fa66fa9f1650bb]
F/CoreApps(24071): [1][CommonFeature] ###versionCode : 115082101, CONTACT_PROFILE_SERVICE_ENABLE : true, FREE_MESSAGE_ENABLE : true
F/CoreApps(24071): [1][CommonFeature] ###versionCode : 115082101, CONTACT_PROFILE_SERVICE_ENABLE : true, FREE_MESSAGE_ENABLE : true
F/CoreApps(24071): [ELog][1][EasySignUp] [NotRegistered][014dade2924475c9ae5e0ed07254fa66fa9f1650bb]
F/CoreApps(24352): [1][CommonFeature] ###versionCode : 115082101, CONTACT_PROFILE_SERVICE_ENABLE : true, FREE_MESSAGE_ENABLE : true
F/CoreApps(24352): [1][CommonFeature] ###versionCode : 115082101, CONTACT_PROFILE_SERVICE_ENABLE : true, FREE_MESSAGE_ENABLE : true
F/CoreApps(24352): [ELog][1][EasySignUp] [NotRegistered][014dade2924475c9ae5e0ed07254fa66fa9f1650bb]
F/CoreApps(24586): [1][CommonFeature] ###versionCode : 115082101, CONTACT_PROFILE_SERVICE_ENABLE : true, FREE_MESSAGE_ENABLE : true
F/CoreApps(24586): [1][CommonFeature] ###versionCode : 115082101, CONTACT_PROFILE_SERVICE_ENABLE : true, FREE_MESSAGE_ENABLE : true
F/CoreApps(24586): [ELog][1][EasySignUp] [NotRegistered][014dade2924475c9ae5e0ed07254fa66fa9f1650bb]
F/Finsky:background(25198): [62819] kce.h(3): Service object is not present when stopServiceSafely was called.
F/Finsky:background(25198): com.google.android.flib.log.WhatATerribleException
F/Finsky:background(25198):     at adil.h(PG:2)
F/Finsky:background(25198):     at com.google.android.finsky.utils.FinskyLog.k(PG:3)
F/Finsky:background(25198):     at kce.h(PG:3)
F/Finsky:background(25198):     at kce.g(PG)
F/Finsky:background(25198):     at kce.e(PG:2)
F/Finsky:background(25198):     at kcp.h(PG)
F/Finsky:background(25198):     at kcn.a(PG:4)
F/Finsky:background(25198):     at kcp.j(PG:1)
F/Finsky:background(25198):     at kcp.c(PG)
F/Finsky:background(25198):     at jzy.e(PG:12)
F/Finsky:background(25198):     at jzv.apply(PG:117)
F/Finsky:background(25198):     at j$.util.stream.s.accept(SourceFile:45)
F/Finsky:background(25198):     at j$.util.a.forEachRemaining(SourceFile:20)
F/Finsky:background(25198):     at j$.util.stream.c.y(SourceFile:21)
F/Finsky:background(25198):     at j$.util.stream.c.G(SourceFile:8)
F/Finsky:background(25198):     at j$.util.stream.Z0.e(SourceFile:1)
F/Finsky:background(25198):     at j$.util.stream.c.J(SourceFile:35)
F/Finsky:background(25198):     at j$.util.stream.A1.collect(SourceFile:83)
F/Finsky:background(25198):     at jzm.a(PG:57)
F/Finsky:background(25198):     at akic.e(PG:2)
F/Finsky:background(25198):     at akie.run(PG:9)
F/Finsky:background(25198):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
F/Finsky:background(25198):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
F/Finsky:background(25198):     at htq.run(PG:40)
F/Finsky:background(25198):     at java.lang.Thread.run(Thread.java:818)
F/Finsky:background(26867): [62984] kce.h(3): Service object is not present when stopServiceSafely was called.
F/Finsky:background(26867): com.google.android.flib.log.WhatATerribleException
F/Finsky:background(26867):     at adil.h(PG:2)
F/Finsky:background(26867):     at com.google.android.finsky.utils.FinskyLog.k(PG:3)
F/Finsky:background(26867):     at kce.h(PG:3)
F/Finsky:background(26867):     at kce.g(PG)
F/Finsky:background(26867):     at kce.e(PG:2)
F/Finsky:background(26867):     at kcp.h(PG)
F/Finsky:background(26867):     at kcn.a(PG:4)
F/Finsky:background(26867):     at kcp.j(PG:1)
F/Finsky:background(26867):     at kcp.c(PG)
F/Finsky:background(26867):     at jzy.e(PG:12)
F/Finsky:background(26867):     at jzv.apply(PG:117)
F/Finsky:background(26867):     at j$.util.stream.s.accept(SourceFile:45)
F/Finsky:background(26867):     at j$.util.a.forEachRemaining(SourceFile:20)
F/Finsky:background(26867):     at j$.util.stream.c.y(SourceFile:21)
F/Finsky:background(26867):     at j$.util.stream.c.G(SourceFile:8)
F/Finsky:background(26867):     at j$.util.stream.Z0.e(SourceFile:1)
F/Finsky:background(26867):     at j$.util.stream.c.J(SourceFile:35)
F/Finsky:background(26867):     at j$.util.stream.A1.collect(SourceFile:83)
F/Finsky:background(26867):     at jzm.a(PG:57)
F/Finsky:background(26867):     at akic.e(PG:2)
F/Finsky:background(26867):     at akie.run(PG:9)
F/Finsky:background(26867):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
F/Finsky:background(26867):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
F/Finsky:background(26867):     at htq.run(PG:40)
F/Finsky:background(26867):     at java.lang.Thread.run(Thread.java:818)


问:
SQL server triggers : Deleted table empty after update
I have a database A, table t with a transactional replication to a database B table t

on B.t there is a trigger

```<code>SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE OR ALTER TRIGGER [dbo].[synchro_trigger]
ON [dbo].[t]
FOR INSERT, UPDATE
AS
BEGIN
    -- update case
    IF EXISTS ( SELECT 0 FROM Deleted )
...
</code>```

when running an update on A.t :

```<code>update A.t set field1='1' where id=?
</code>```

the value is replicated then the trigger is called and SELECT 0 FROM Deleted exist;
the trigger does its job.

When updating ALL fields on table t (some get a different value, some get the same value)

```<code>update A.t set field1='1', field2='1', ... where id=?
</code>```

the values (which are differents) are replicated then the triggrer is called BUT SELECT 0 FROM Deleted doesn't exist.

so the trigger does nothing, it is not what I want.

In case of update the previous row value is supposed to be inside Deleted, right?
How it is possible that the trigger doesn't receive the previous value inside the Delete table ?

Note :
it looks like the same issue as : SQLServer Update Trigger with empty DELETED logical table

Body:
I have a database A, table t with a transactional replication to a database B table t

on B.t there is a trigger

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE OR ALTER TRIGGER [dbo].[synchro_trigger]
ON [dbo].[t]
FOR INSERT, UPDATE
AS
BEGIN
    -- update case
    IF EXISTS ( SELECT 0 FROM Deleted )
...

when running an update on A.t :

update A.t set field1='1' where id=?

the value is replicated then the trigger is called and SELECT 0 FROM Deleted exist;
the trigger does its job.

When updating ALL fields on table t (some get a different value, some get the same value)

update A.t set field1='1', field2='1', ... where id=?

the values (which are differents) are replicated then the triggrer is called BUT SELECT 0 FROM Deleted doesn't exist.

so the trigger does nothing, it is not what I want.

In case of update the previous row value is supposed to be inside Deleted, right?
How it is possible that the trigger doesn't receive the previous value inside the Delete table ?

Note :
it looks like the same issue as : SQLServer Update Trigger with empty DELETED logical table


问:
Difference between 2 kinds of text corpus vocabulary creations with spacy
I am trying to retrieve the vocabulary of a text corpus with spacy.
The corpus is a list of strings with each string being a document from the corpus.

I came up with 2 different  methods to create the vocabulary. Both work but yield slightly different results and i dont know why.

The first approach results in a vocabulary size of 5000:

```<code>words = nlp(" ".join(docs))
vocab2 = []
for word in words:
    if word.lemma_ not in vocab2 and word.is_alpha == True:
        vocab2.append(word.lemma_)
</code>```

The second approach results in a vocabulary size of 5001 -> a single word more:

```<code>vocab = set()

for doc in docs:
    doc = nlp(doc)

    for token in doc:
        if token.is_alpha:
            vocab.add(token.lemma_)
</code>```

Why do the 2 results differ?

My best guess would be that the model behind nlp() somehow interprets different token when it has the input as a whole vs. the input per document.

Body:
I am trying to retrieve the vocabulary of a text corpus with spacy.
The corpus is a list of strings with each string being a document from the corpus.

I came up with 2 different  methods to create the vocabulary. Both work but yield slightly different results and i dont know why.

The first approach results in a vocabulary size of 5000:

words = nlp(" ".join(docs))
vocab2 = []
for word in words:
    if word.lemma_ not in vocab2 and word.is_alpha == True:
        vocab2.append(word.lemma_)

The second approach results in a vocabulary size of 5001 -> a single word more:

vocab = set()

for doc in docs:
    doc = nlp(doc)

    for token in doc:
        if token.is_alpha:
            vocab.add(token.lemma_)

Why do the 2 results differ?

My best guess would be that the model behind nlp() somehow interprets different token when it has the input as a whole vs. the input per document.


问:
KNN and Feature Importance
How to identify the features that have the highest impact on the KNN model's predictions?
i have used the permutation importance from eli5 module as a proxy. What are the other ways to get the feature importance?</p>

Title: KNN and Feature Importance


问:
How to solve these errors, trying to download @railway/cli using npm install?
I am trying to download Railway CLI uisng npm install but I am getting these errors and I am not sure what to do.

Errors:

```<code>npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\Jash\\AppData\\Roaming\\npm\\node_modules\\@railway\\cli',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\Jash\AppData\Roaming\npm\node_modules\@railway\cli\node_modules\node-fetch\src'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\Jash\\AppData\\Roaming\\npm\\node_modules\\@railway\\cli\\node_modules\\node-fetch\\src'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Users\Jash\AppData\Roaming\npm\node_modules\@railway\cli
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node ./npm-install/postinstall.js
npm ERR! Error: aborted
npm ERR!     at connResetException (node:internal/errors:711:14)
npm ERR!     at TLSSocket.socketCloseListener (node:_http_client:454:19)
npm ERR!     at TLSSocket.emit (node:events:525:35)
npm ERR!     at node:net:313:12
npm ERR!     at TCP.done (node:_tls_wrap:587:7) {
npm ERR!   code: 'ECONNRESET'
npm ERR! }

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Jash\AppData\Local\npm-cache\_logs\2023-01-09T16_43_57_237Z-debug-0.log`
</code>```

As some of the answers on another post suggested that I need a package.json file, I looked into the directory and the file was already there. Not sure what to do.

Body:
I am trying to download Railway CLI uisng npm install but I am getting these errors and I am not sure what to do.

Errors:

npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\Jash\\AppData\\Roaming\\npm\\node_modules\\@railway\\cli',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\Jash\AppData\Roaming\npm\node_modules\@railway\cli\node_modules\node-fetch\src'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\Jash\\AppData\\Roaming\\npm\\node_modules\\@railway\\cli\\node_modules\\node-fetch\\src'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Users\Jash\AppData\Roaming\npm\node_modules\@railway\cli
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node ./npm-install/postinstall.js
npm ERR! Error: aborted
npm ERR!     at connResetException (node:internal/errors:711:14)
npm ERR!     at TLSSocket.socketCloseListener (node:_http_client:454:19)
npm ERR!     at TLSSocket.emit (node:events:525:35)
npm ERR!     at node:net:313:12
npm ERR!     at TCP.done (node:_tls_wrap:587:7) {
npm ERR!   code: 'ECONNRESET'
npm ERR! }

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Jash\AppData\Local\npm-cache\_logs\2023-01-09T16_43_57_237Z-debug-0.log`

As some of the answers on another post suggested that I need a package.json file, I looked into the directory and the file was already there. Not sure what to do.


问:
Is there a way to do Dynamic Harmonic Regression in R using multiple variables?
The company I work for would like to forecast weekly transactions, given a certain weekly sales budget (i.e. predicted weekly sales) for a period of time.

We are a highly seasonal business, particularly around holidays, which do not always have a fixed recurring date, e.g. Easter.

ETS smoothing didn't seem applicable, and ARIMA modelling is poor working with high integer seasonal periods (e.g. days/weeks rather than months/quarters), and also struggles with a non-integer seasonal period (i.e. 52 weeks some years, 53 weeks other years).

My best bet seemed to be Dynamic Harmonic Regression with ARIMA errors, however, I don't know how (or if it's possible) to do this with multiple variables. Specifically Sales and Transactions, but potentially also dummy variables representing holidays. Is this possible?

Datacamp has the following R code demonstrating Multivariate Dynamic Regression:

```<code># Matrix of regressors
xreg <- cbind(MaxTemp = elec[, "Temperature"],
              MaxTempSq = elec[, "Temperature"]**2,
              Workday = elec[, "Workday"])

# Fit model
fit <- auto.arima(elec[,"Demand"], xreg = xreg)

# Forecast fit one day ahead
forecast(fit, xreg = cbind(20, 20^2, 1))
</code>```

It also has the following code demonstrating Dynamic Harmonic Regression:

```<code># Set up harmonic regressors of order 13
harmonics <- fourier(gasoline, K = 13)

# Fit regression model with ARIMA errors
fit <- auto.arima(gasoline, xreg = harmonics, seasonal = FALSE)

# Forecasts next 3 years (weekly data)
newharmonics <- fourier(gasoline, K = 13, h = 156)
fc <- forecast(fit, xreg = newharmonics)
</code>```

Is it possible to combine these two methodologies? That is, Multivariate Dynamic Harmonic Regression? Or is there perhaps a different way to go about tackling my particular problem?

Body:
The company I work for would like to forecast weekly transactions, given a certain weekly sales budget (i.e. predicted weekly sales) for a period of time.

We are a highly seasonal business, particularly around holidays, which do not always have a fixed recurring date, e.g. Easter.

ETS smoothing didn't seem applicable, and ARIMA modelling is poor working with high integer seasonal periods (e.g. days/weeks rather than months/quarters), and also struggles with a non-integer seasonal period (i.e. 52 weeks some years, 53 weeks other years).

My best bet seemed to be Dynamic Harmonic Regression with ARIMA errors, however, I don't know how (or if it's possible) to do this with multiple variables. Specifically Sales and Transactions, but potentially also dummy variables representing holidays. Is this possible?

Datacamp has the following R code demonstrating Multivariate Dynamic Regression:

# Matrix of regressors
xreg <- cbind(MaxTemp = elec[, "Temperature"],
              MaxTempSq = elec[, "Temperature"]**2,
              Workday = elec[, "Workday"])

# Fit model
fit <- auto.arima(elec[,"Demand"], xreg = xreg)

# Forecast fit one day ahead
forecast(fit, xreg = cbind(20, 20^2, 1))

It also has the following code demonstrating Dynamic Harmonic Regression:

# Set up harmonic regressors of order 13
harmonics <- fourier(gasoline, K = 13)

# Fit regression model with ARIMA errors
fit <- auto.arima(gasoline, xreg = harmonics, seasonal = FALSE)

# Forecasts next 3 years (weekly data)
newharmonics <- fourier(gasoline, K = 13, h = 156)
fc <- forecast(fit, xreg = newharmonics)

Is it possible to combine these two methodologies? That is, Multivariate Dynamic Harmonic Regression? Or is there perhaps a different way to go about tackling my particular problem?


问:
rendering html elements in jupyter notebook
I am playing around with Arcgis, a mapping tool.

It has an api in python which I have downloaded and gotten to work properly (it imports and runs properly).

My problem is that the map is not being rendered within my IDE (VSCode, PyCharm or DataSpell). When I open the notebook inside of my browser, the map shows up properly and it can be interacted with etc. I believe the map itself is made using html but the IDE's im using are unable to display the maps. Is there a setting or a package I can download to show the map?

Expected Behavior:

This code:

from arcgis.gis import GIS

gis = GIS()

m = gis.map("Berlin")
display(m)
```

should display this.

Rather it displays this.

How would I get the HTML/Map render to be displayed inside of my IDE?

Body:
I am playing around with Arcgis, a mapping tool.

It has an api in python which I have downloaded and gotten to work properly (it imports and runs properly).

My problem is that the map is not being rendered within my IDE (VSCode, PyCharm or DataSpell). When I open the notebook inside of my browser, the map shows up properly and it can be interacted with etc. I believe the map itself is made using html but the IDE's im using are unable to display the maps. Is there a setting or a package I can download to show the map?

Expected Behavior:

This code:

from arcgis.gis import GIS

gis = GIS()

m = gis.map("Berlin")
display(m)

should display this.

Rather it displays this.

How would I get the HTML/Map render to be displayed inside of my IDE?


问:
Can anyone tell me what's going on here in this Rust struct re: lifetimes?
```<code>struct MutStr<'a, 'b> {
  s: &'a mut &'b str
}
</code>```

I'm scratching my head trying to understand this syntax.

Thanks in advance.

I have tried looking this syntax up everywhere and cannot find anything on two lifetimes on a single struct field.

Body:
struct MutStr<'a, 'b> {
  s: &'a mut &'b str
}

I'm scratching my head trying to understand this syntax.

Thanks in advance.

I have tried looking this syntax up everywhere and cannot find anything on two lifetimes on a single struct field.


问:
CheckboxListTitle trouble
I have a problem with my code. I want to control with a checkboxListTitle a list from an http request, as you know in the value: only true or false values are supported, however what I have is a string data type (0 false and 1 True). How could I fix this?, the closest I have been is with this code, but this way it only allows me to check or uncheck, not both at the same time and I can not see the real status of each data.

How could I treat each string in the list as a boolean so as not to lose this logic?

```<code> `Future<List> getData() async {
    final response = await http.post(Uri.parse(baseurl + 'gettipo.php'),
        body: {"categoria": widget.tipo});
    return json.decode(response.body);
  }

Widget build(BuildContext context) {
    return RefreshIndicator(
      onRefresh: () async {
        setState(() {
          getData();
        });
      },
      child: FutureBuilder<List>(
        future: getData(),
        builder: ((context, snapshot) {
          if (snapshot.hasError) print(snapshot.error);
          return snapshot.hasData
              ? ItemList(
                  list: snapshot.data!,
                )
              : Center(
                  child: new CircularProgressIndicator(),
                );
        }),
      ),
    );
  }
}

class ItemList extends StatefulWidget {
  final List list;
  ItemList({required this.list});

  @override
  State<ItemList> createState() => _ItemListState();
}

class _ItemListState extends State<ItemList> {

  @override
  Widget build(BuildContext context) {

value: widget.list[index]['ocultar'] != 0,
            onChanged: (val) {
              setState(() {
                widget.list[index]['ocultar'] = 0;
              });`
</code>```

Title: CheckboxListTitle trouble

Body:
I have a problem with my code. I want to control with a checkboxListTitle a list from an http request, as you know in the value: only true or false values are supported, however what I have is a string data type (0 false and 1 True). How could I fix this?, the closest I have been is with this code, but this way it only allows me to check or uncheck, not both at the same time and I can not see the real status of each data.

How could I treat each string in the list as a boolean so as not to lose this logic?

 `Future<List> getData() async {
    final response = await http.post(Uri.parse(baseurl + 'gettipo.php'),
        body: {"categoria": widget.tipo});
    return json.decode(response.body);
  }

Widget build(BuildContext context) {
    return RefreshIndicator(
      onRefresh: () async {
        setState(() {
          getData();
        });
      },
      child: FutureBuilder<List>(
        future: getData(),
        builder: ((context, snapshot) {
          if (snapshot.hasError) print(snapshot.error);
          return snapshot.hasData
              ? ItemList(
                  list: snapshot.data!,
                )
              : Center(
                  child: new CircularProgressIndicator(),
                );
        }),
      ),
    );
  }
}

class ItemList extends StatefulWidget {
  final List list;
  ItemList({required this.list});

  @override
  State<ItemList> createState() => _ItemListState();
}

class _ItemListState extends State<ItemList> {

  @override
  Widget build(BuildContext context) {

value: widget.list[index]['ocultar'] != 0,
            onChanged: (val) {
              setState(() {
                widget.list[index]['ocultar'] = 0;
              });`


问:
Does Bigquery data transfer service perform Incremental dataset copy cross region?
I am trying to Copy a dataset from one region to another region. I would want to understand each data transfer job run copies the entire data again or only copies the delta(changes happened after previous data transfer run). Kindly help me to understand.</p>


问:
Serch for automaitc comments for telegram group
I'm a dumb sparrow and can't find a bot or app.

I am looking for a telegram program that will create the app of communication in a group.

as I see it, I prescribe phrases for comments, and the app randomly select N number and posts them from !different accounts! to the chat. (I posted the news, turned on the bot and it threw various reactions) manually jumping between accounts writing comments to the group is very dreary.

Has anyone seen something like this? I only find services, not the app.

find app or advise for supporting tg group.


问:
error: expected initializer before `extern` on GCC libraries
I'm trying to build code on another system. Machine A builds the code Machine B does not. Machine B needed updated to GCC 6.1.0 in order to compile said code. The update was handled exactly the same as Machine A's upgrade to GCC 6.1.0. I need to build several applications and they all output a similar error when building on Machine B:

```<code>In file included from /usr/include/features.h:375:0,
                 from /usr/include/string.h:25,
                 from app.h:12,
                 from app.c:28:
/usr/include/sys/types.h:27:1: error: expected initializer before 'extern'
 __BEGIN_DECLS
 ^
In file included from /usr/local/include/c++/6.1.0/new:40:0,
                 from /usr/local/include/c++/6.1.0/ext/new_allocator.h:33,
                 from /usr/local/include/c++/6.1.0/x86_64-pc-linux-gnu/bits/c++allocator.h:33,
                 from /usr/local/include/c++/6.1.0/bits/allocator.h:46,
                 from /usr/local/include/c++/6.1.0/string:41,
                 from ./Lib/Inc/AppCommon.h:11,
                 from ./Lib/Inc/header0.h:10,
                 from ./Lib/Inc/header1.h:4,
                 from ./Lib/Inc/header2.h:10,
                 from app.c:30:
/usr/local/include/c++/6.1.0/exception:35:37: error: expected declaration before end of line
 #pragma GCC visibility push(default)
                                     ^
</code>```

This error is not present on Machine A when building the applications. Is this a problem with GCC libraries? What differences between the environments, that I might not be accounting for, cause such an error? Could this have to do with the order files that need to be included in the build command; would this be different on different machines of the same environment?

Body:
I'm trying to build code on another system. Machine A builds the code Machine B does not. Machine B needed updated to GCC 6.1.0 in order to compile said code. The update was handled exactly the same as Machine A's upgrade to GCC 6.1.0. I need to build several applications and they all output a similar error when building on Machine B:

In file included from /usr/include/features.h:375:0,
                 from /usr/include/string.h:25,
                 from app.h:12,
                 from app.c:28:
/usr/include/sys/types.h:27:1: error: expected initializer before 'extern'
 __BEGIN_DECLS
 ^
In file included from /usr/local/include/c++/6.1.0/new:40:0,
                 from /usr/local/include/c++/6.1.0/ext/new_allocator.h:33,
                 from /usr/local/include/c++/6.1.0/x86_64-pc-linux-gnu/bits/c++allocator.h:33,
                 from /usr/local/include/c++/6.1.0/bits/allocator.h:46,
                 from /usr/local/include/c++/6.1.0/string:41,
                 from ./Lib/Inc/AppCommon.h:11,
                 from ./Lib/Inc/header0.h:10,
                 from ./Lib/Inc/header1.h:4,
                 from ./Lib/Inc/header2.h:10,
                 from app.c:30:
/usr/local/include/c++/6.1.0/exception:35:37: error: expected declaration before end of line
 #pragma GCC visibility push(default)
                                     ^

This error is not present on Machine A when building the applications. Is this a problem with GCC libraries? What differences between the environments, that I might not be accounting for, cause such an error? Could this have to do with the order files that need to be included in the build command; would this be different on different machines of the same environment?


问:
how to handle npm WARN EBADENGINE Unsupported engine
when i am trying to install npm install --save concurrently it's showing the below error</p>
```<code>npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'server@1.0.0',
npm WARN EBADENGINE   required: { node: 'v16.13.1', npm: '9.2.0' },
npm WARN EBADENGINE   current: { node: 'v18.13.0', npm: '9.2.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'hawk@0.10.2',
npm WARN EBADENGINE   required: { node: '0.8.x' },
npm WARN EBADENGINE   current: { node: 'v18.13.0', npm: '9.2.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'hoek@0.7.6',
npm WARN EBADENGINE   required: { node: '0.8.x' },
npm WARN EBADENGINE   current: { node: 'v18.13.0', npm: '9.2.0' }
npm WARN EBADENGINE }
</code>```

Body:
when i am trying to install npm install --save concurrently it's showing the below error

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'server@1.0.0',
npm WARN EBADENGINE   required: { node: 'v16.13.1', npm: '9.2.0' },
npm WARN EBADENGINE   current: { node: 'v18.13.0', npm: '9.2.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'hawk@0.10.2',
npm WARN EBADENGINE   required: { node: '0.8.x' },
npm WARN EBADENGINE   current: { node: 'v18.13.0', npm: '9.2.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'hoek@0.7.6',
npm WARN EBADENGINE   required: { node: '0.8.x' },
npm WARN EBADENGINE   current: { node: 'v18.13.0', npm: '9.2.0' }
npm WARN EBADENGINE }


问:
Modify registry value during uninstalling MSI build in Windows
We have tried to modify the proxy value which is present in HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings during the uninstall process in windows machine (32-bit). We are able to get the value but not able to modify it. We have tried in multiple methods like Async, Threading, CMD method, Created new exe & tried to execute it. But, none of the methods have modified the value. Is there any other way to modify the value?

```<code>string inetPath = @"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";
RegistryKey inetSubkey = Registry.CurrentUser.OpenSubKey(internetSettingsSubkeyPath, RegistryKeyPermissionCheck.ReadWriteSubTree);
string keyName = inetSubkey.Name;
string valueName1 = "ProxyEnable";
string value = "0";
RegistryValueKind dataType = RegistryValueKind.DWord;
Registry.SetValue(keyName, valueName1, value, dataType);
</code>```

I need to modify the ProxyEnable during the uninstall process of MSI application.

Body:
We have tried to modify the proxy value which is present in HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings during the uninstall process in windows machine (32-bit). We are able to get the value but not able to modify it. We have tried in multiple methods like Async, Threading, CMD method, Created new exe & tried to execute it. But, none of the methods have modified the value. Is there any other way to modify the value?

string inetPath = @"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";
RegistryKey inetSubkey = Registry.CurrentUser.OpenSubKey(internetSettingsSubkeyPath, RegistryKeyPermissionCheck.ReadWriteSubTree);
string keyName = inetSubkey.Name;
string valueName1 = "ProxyEnable";
string value = "0";
RegistryValueKind dataType = RegistryValueKind.DWord;
Registry.SetValue(keyName, valueName1, value, dataType);

I need to modify the ProxyEnable during the uninstall process of MSI application.


问:
Async Cross Fields Validator
In a form I have to validate a field considering the value of another field.
i.e. if the first dropdown has value 1 then the second dropdown value must be selected.

To do this I've tried with async validators with no clue.

I add the validator with .setAsyncValidators
and the validator of the "second" dropdown looks like this:

```<code>validateDropDown(formControl: FormControl){
    const parent = formControl.parent!;
    const firstDD = parent.get("firstDropDown")!;
    return firstDD.valueChanges.pipe(
        map ((res) => {
          let isValid = false;
          if (res.id == 1 || res.id == 10) {
            const value = formControl.value.length;
            if (value > 0) {
              isValid = true;
            } else {
              isValid = false;
            }
          } else {
            isValid = true;
          }
            return of (isValid == true ? null : {
              userValid: {
                valid: false
              }
          });
        })
    );
}
</code>```

I know that with that code I can't check the value.length of the second DropDown because the return is only on the first dropdown value change, but that's a secondary issues.

Any suggestion?
Thanks

Title: Async Cross Fields Validator

Body:
In a form I have to validate a field considering the value of another field.
i.e. if the first dropdown has value 1 then the second dropdown value must be selected.

To do this I've tried with async validators with no clue.

I add the validator with .setAsyncValidators
and the validator of the "second" dropdown looks like this:

validateDropDown(formControl: FormControl){
    const parent = formControl.parent!;
    const firstDD = parent.get("firstDropDown")!;
    return firstDD.valueChanges.pipe(
        map ((res) => {
          let isValid = false;
          if (res.id == 1 || res.id == 10) {
            const value = formControl.value.length;
            if (value > 0) {
              isValid = true;
            } else {
              isValid = false;
            }
          } else {
            isValid = true;
          }
            return of (isValid == true ? null : {
              userValid: {
                valid: false
              }
          });
        })
    );
}

I know that with that code I can't check the value.length of the second DropDown because the return is only on the first dropdown value change, but that's a secondary issues.

Any suggestion?
Thanks