问:
Set Value to input field but fail to trigger validation using tampermonkey
So I am attempting to write a auto login script for this website
https://www.urbtix.hk/login/?redirect=%252Fperformance-detail%253FeventId%253D9269%2526performanceId%253D41302
but I fail to trigger the validation for the input field, so I cant actually unlock the login button.

I have observed the event fired using monitorEvents($0) in chrome devtool, and I see there is a change event, so attempt to simulate that too but still I fail to trigger the validation. Any clue on how I can get a string filled into the input filed?

```<code>// ==UserScript==
// @name         urbtixLoginAutoFill
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.urbtix.hk/login/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=urbtix.hk
// @require      https://code.jquery.com/jquery-3.6.0.min.js
// @require  https://gist.github.com/raw/2625891/waitForKeyElements.js
// ==/UserScript==
function setControl(elemSelector, value) {
    var zInput = $(elemSelector);
    zInput.val(value);
    console.log("setControl", zInput);
    // var changeEvent = document.createEvent("HTMLEvents");
    // changeEvent.initEvent("change", true, true);
    // zInput[0].dispatchEvent(changeEvent);
    const change = new Event("change");
    zInput[0].dispatchEvent(change);
}
const sleep = async (milliseconds) => {
    await new Promise((resolve) => {
        return setTimeout(resolve, milliseconds);
    });
};

var _username = "username";
var _password = "password";
var userInputSelector = "input[name='loginId']";
var passwordInputSelector = "input[name='password']";
var loginButtonSelector =
    "#root > div > div.main___3Egpk > div > div > div.field-row.field-row-login-button > div.button-wrapper.login-button.blue.disabled";

$(document).ready(async function () {
    await window.addEventListener("load", function load() {
        console.log("before load");
        setControl(userInputSelector, _username);
        setControl(passwordInputSelector, _password);
        console.log("after load");
        // $(loginButtonSelector).removeClass("disabled");
    });
});
</code>```

Body:
So I am attempting to write a auto login script for this website
https://www.urbtix.hk/login/?redirect=%252Fperformance-detail%253FeventId%253D9269%2526performanceId%253D41302
but I fail to trigger the validation for the input field, so I cant actually unlock the login button.

I have observed the event fired using monitorEvents($0) in chrome devtool, and I see there is a change event, so attempt to simulate that too but still I fail to trigger the validation. Any clue on how I can get a string filled into the input filed?

// ==UserScript==
// @name         urbtixLoginAutoFill
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.urbtix.hk/login/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=urbtix.hk
// @require      https://code.jquery.com/jquery-3.6.0.min.js
// @require  https://gist.github.com/raw/2625891/waitForKeyElements.js
// ==/UserScript==
function setControl(elemSelector, value) {
    var zInput = $(elemSelector);
    zInput.val(value);
    console.log("setControl", zInput);
    // var changeEvent = document.createEvent("HTMLEvents");
    // changeEvent.initEvent("change", true, true);
    // zInput[0].dispatchEvent(changeEvent);
    const change = new Event("change");
    zInput[0].dispatchEvent(change);
}
const sleep = async (milliseconds) => {
    await new Promise((resolve) => {
        return setTimeout(resolve, milliseconds);
    });
};

var _username = "username";
var _password = "password";
var userInputSelector = "input[name='loginId']";
var passwordInputSelector = "input[name='password']";
var loginButtonSelector =
    "#root > div > div.main___3Egpk > div > div > div.field-row.field-row-login-button > div.button-wrapper.login-button.blue.disabled";

$(document).ready(async function () {
    await window.addEventListener("load", function load() {
        console.log("before load");
        setControl(userInputSelector, _username);
        setControl(passwordInputSelector, _password);
        console.log("after load");
        // $(loginButtonSelector).removeClass("disabled");
    });
});


来源: stackexchange

问:
Cant get my if Statement to work correctly
I'm trying to make it so that when X is selected it then calls another set of code.  for example
Main Selection is Type of Settlement( 4 choses ) City2, Village, Town, Hommlet.  this is in a drop down in a Name Range. however this really isn't linked to anything, and should affect any of the other outcomes.

part 2 :

```<code> =SORTN('Data Sheet'!D5:E17,1,0,'Data Sheet'!E5:E17,FALSE)
</code>```

Here i have it select from a list of Races ie Human, Dwarf, Elf Ect. along with a % of chance that Race is selected.  there are 3 types that will pop up and some other formulas for calculated % of each.

```<code>              Hommlet     TRUE
</code>```

|                   Hommlet     TRUE

What Type of Settlement?

Population                  54

Races and Purcentage Within the Setttlement

%       Race        # of

Majority Race       91      Half-elf    99  49

Secondary Race      6.03        Genasi      3

Tertiary Race       2.97        Firbolg 97  1.6

3rd on and here is where the issue is.  If the Race is "Human"  THen is needs to pick from a 'list of Human names.  A data base list of name i have.

```<code>=If(N7="Human",INDEX('Name Lists'!B2:B15,RANDBETWEEN(1,COUNTA('Name Lists'!B2:B15))),"None")
</code>```

here is the test i did to insure it would work before i embedded more into the the If formula.  i also did a logic test to see if when Human Appeared it would come back TRUE,  but it always returns False. if I type the word Human in another cell and Direct above code to that cell it works.

check out thew above

ContentLicense: CC BY-SA 4.0

Body:
I'm trying to make it so that when X is selected it then calls another set of code.  for example
Main Selection is Type of Settlement( 4 choses ) City2, Village, Town, Hommlet.  this is in a drop down in a Name Range. however this really isn't linked to anything, and should affect any of the other outcomes.

part 2 :

 =SORTN('Data Sheet'!D5:E17,1,0,'Data Sheet'!E5:E17,FALSE)

Here i have it select from a list of Races ie Human, Dwarf, Elf Ect. along with a % of chance that Race is selected.  there are 3 types that will pop up and some other formulas for calculated % of each.

              Hommlet     TRUE

|                   Hommlet     TRUE

What Type of Settlement?

Population                  54

Races and Purcentage Within the Setttlement

%       Race        # of

Majority Race       91      Half-elf    99  49

Secondary Race      6.03        Genasi      3

Tertiary Race       2.97        Firbolg 97  1.6

3rd on and here is where the issue is.  If the Race is "Human"  THen is needs to pick from a 'list of Human names.  A data base list of name i have.

=If(N7="Human",INDEX('Name Lists'!B2:B15,RANDBETWEEN(1,COUNTA('Name Lists'!B2:B15))),"None")

here is the test i did to insure it would work before i embedded more into the the If formula.  i also did a logic test to see if when Human Appeared it would come back TRUE,  but it always returns False. if I type the word Human in another cell and Direct above code to that cell it works.

check out thew above


问:
Other way to createSchemaNode()
```<code>ObjectMapper objectMapper = new ObjectMapper();
ObjectNode properties = objectMapper.createObjectNode();
properties.set(KEY1, createSchemaNode("string"));
properties.set(KEY2,getSchemaFor(provider,EnvironmentType.class));
properties.set(KEY3, createSchemaNode("string"));
properties.set(KEY4, createSchemaNode("string"));

</code>```

Need other approach to set the properties instead of using createSchemaNode() I am trying to upgrade Jackson version from 2.8 to 2.10. After updating Jackson version to  2.10 I am facing issue with createdSchemaNode(). Because createdSchemaNode() is deprecated from Jackson databind version 2.9.0

Title: Other way to createSchemaNode()

Body:
ObjectMapper objectMapper = new ObjectMapper();
ObjectNode properties = objectMapper.createObjectNode();
properties.set(KEY1, createSchemaNode("string"));
properties.set(KEY2,getSchemaFor(provider,EnvironmentType.class));
properties.set(KEY3, createSchemaNode("string"));
properties.set(KEY4, createSchemaNode("string"));

Need other approach to set the properties instead of using createSchemaNode() I am trying to upgrade Jackson version from 2.8 to 2.10. After updating Jackson version to  2.10 I am facing issue with createdSchemaNode(). Because createdSchemaNode() is deprecated from Jackson databind version 2.9.0


问:
how to Condition ststus data mysql update (delete,add,up) on bashscript?
echo "Downloading Arvancloud IPs list..."
rm -rf ip.txt
curl https://www.arvancloud.ir/fa/ips.txt  >> ip.txt

for  IPLIST in cat ip.txt

do

echo $IPLIST

DB_USER='root';
DB_PASSWD='';

DB_NAME='iplist';
TABLE='iplist';

#Collect Rank Information from flightaware.com
date=$(date +"%H:%M:%S")

status=up
mysql --user=$DB_USER --password=$DB_PASSWD $DB_NAME << EOF
INSERT INTO $TABLE (`id`, `IPLIST`, `status`, `DATE`) VALUES ( NULL, "$IPLIST", "$status", "$date");
EOF
done

echo "Downloading Arvancloud IPs list..."
rm -rf ip.txt
curl https://www.arvancloud.ir/fa/ips.txt  >> ip.txt

for  IPLIST in cat ip.txt

do

echo $IPLIST

DB_USER='root';
DB_PASSWD='';

DB_NAME='iplist';
TABLE='iplist';

#Collect Rank Information from flightaware.com
date=$(date +"%H:%M:%S")

status=up
mysql --user=$DB_USER --password=$DB_PASSWD $DB_NAME << EOF
INSERT INTO $TABLE (`id`, `IPLIST`, `status`, `DATE`) VALUES ( NULL, "$IPLIST", "$status", "$date");
EOF
done


问:
VSCode Extension: "a dynamic import callback was not specified"
In my VSCode extension js file, I am using an import() statement to import an .mjs file in a command definition. This works well in my local debugging environment.

However, when I package the extension using 'vsce package' and install it in a vscode app elsewhere, I see 'a dynamic import callback was not specified' error when import() call is made from the code.

My development & testing vscode versions are same 1.74.2. How can I fix the error? Is there some option in building the 'vsce package' that solves this?


问:
configure and cross compiling samba v4.17.3 has an error
I am cross-compiling samba v4.17.3, i met some questions.
I write auto_config.sh,

```<code>root@gyz-thinkcentre-e73:~/third_source/samba-4.17.3# cat auto_config.sh
qemu_binary="qemu-aarch64"
libdir_qemu="/root/niic/SDK/sysroots/aarch64-niic-linux/lib64/"
base_libdir_qemu="/root/niic/SDK/sysroots/aarch64-niic-linux/usr/lib64/"

prefix_path="/root/result/samba"

CROSS_EXEC= "${qemu_binary} -L /root/niic/SDK/sysroots -E LD_LIBRARY_PATH=${libdir_qemu}:${base_libdir_qemu}"

./configure --prefix=${prefix_path} --target=aarch64-niic-linux --host=aarch64-niic-linux samba_cv_CC_NEGATIVE_ENUM_VALUES=yes --cross-exec="${CROSS_EXEC}"
</code>```

when i run auto_config.sh, a error occured: No such file or directory, but the two path '/root/niic/SDK/sysroots/aarch64-niic-linux/lib64/' and  '/root/niic/SDK/sysroots/aarch64-niic-linux/usr/lib64/' are exist.

```<code>root@gyz-thinkcentre-e73:~/third_source/samba-4.17.3# ./auto_config.sh
./auto_config.sh: line 7: qemu-aarch64 -L /root/niic/SDK/sysroots -E LD_LIBRARY_PATH=/root/niic/SDK/sysroots/aarch64-niic-linux/lib64/:/root/niic/SDK/sysroots/aarch64-niic-linux/usr/lib64/: No such file or directory
Setting top to                           : /root/third_source/samba-4.17.3
Setting out to                           : /root/third_source/samba-4.17.3/bin
Checking for 'gcc' (C compiler)          : aarch64-niic-linux-gcc -mcpu=cortex-a55 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/root/niic/SDK/sysroots/aarch64-niic-linux
Checking for program 'git'               : /usr/bin/git
Checking for c flags '-MMD'              : yes
Checking for program 'gdb'               : aarch64-niic-linux-gdb
Checking for header sys/utsname.h        : yes
Checking uname sysname type              : not found
Checking uname machine type              : not found
Checking uname release type              : not found
Checking uname version type              : not found
Checking for header stdio.h              : yes
Checking simple C program                : not found
The configuration failed False
(complete log in /root/third_source/samba-4.17.3/bin/config.log)
</code>```

Body:
I am cross-compiling samba v4.17.3, i met some questions.
I write auto_config.sh,

root@gyz-thinkcentre-e73:~/third_source/samba-4.17.3# cat auto_config.sh
qemu_binary="qemu-aarch64"
libdir_qemu="/root/niic/SDK/sysroots/aarch64-niic-linux/lib64/"
base_libdir_qemu="/root/niic/SDK/sysroots/aarch64-niic-linux/usr/lib64/"

prefix_path="/root/result/samba"

CROSS_EXEC= "${qemu_binary} -L /root/niic/SDK/sysroots -E LD_LIBRARY_PATH=${libdir_qemu}:${base_libdir_qemu}"

./configure --prefix=${prefix_path} --target=aarch64-niic-linux --host=aarch64-niic-linux samba_cv_CC_NEGATIVE_ENUM_VALUES=yes --cross-exec="${CROSS_EXEC}"

when i run auto_config.sh, a error occured: No such file or directory, but the two path '/root/niic/SDK/sysroots/aarch64-niic-linux/lib64/' and  '/root/niic/SDK/sysroots/aarch64-niic-linux/usr/lib64/' are exist.

root@gyz-thinkcentre-e73:~/third_source/samba-4.17.3# ./auto_config.sh
./auto_config.sh: line 7: qemu-aarch64 -L /root/niic/SDK/sysroots -E LD_LIBRARY_PATH=/root/niic/SDK/sysroots/aarch64-niic-linux/lib64/:/root/niic/SDK/sysroots/aarch64-niic-linux/usr/lib64/: No such file or directory
Setting top to                           : /root/third_source/samba-4.17.3
Setting out to                           : /root/third_source/samba-4.17.3/bin
Checking for 'gcc' (C compiler)          : aarch64-niic-linux-gcc -mcpu=cortex-a55 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/root/niic/SDK/sysroots/aarch64-niic-linux
Checking for program 'git'               : /usr/bin/git
Checking for c flags '-MMD'              : yes
Checking for program 'gdb'               : aarch64-niic-linux-gdb
Checking for header sys/utsname.h        : yes
Checking uname sysname type              : not found
Checking uname machine type              : not found
Checking uname release type              : not found
Checking uname version type              : not found
Checking for header stdio.h              : yes
Checking simple C program                : not found
The configuration failed False
(complete log in /root/third_source/samba-4.17.3/bin/config.log)


问:
Caching/Persisting State based on URL path with React
I am building a webapp that will host multiple e-commerce stores. All the stores will use the same DNS but will have a unique URL path as follows:

example.com/store1

example.com/store1/checkout

example.com/store2

example.com/store2/checkout

I have a Cart functionality which I am trying to seperate based on the store that is visited. I've tried using redux-persist but can't figure out how to have a different cart state for /store1 and /store2 as the cart items are persisting between stores.

Is redux-persist the right library for this use case? if it is how would the persistConfig look like to be able to seperate e-commerce store cart states? Or is there a better library for this use case. Thanks

My expectation is that I should see cart items relevant to the ecommerce store i'm visiting and the items shouldn't be mixing.


问:
Module not found error when building react project with docker
I've created an npm package and hosted it on gitlab(didn't publish it on npm as I want it to be private). This package only exports one component and one custom hook and this my index.ts file:

I've checked the node_modules I got locally and the file exists.

this is my npm package's package.json

```<code>{
  "name": "customfields",
  "version": "1.1.0",
  "description": "",
  "main": "./dist/cjs/index.js",
  "module": "./dist/esm/index.js",
  "types": "./dist/esm/index.d.ts",
  "scripts": {
    "build": "yarn build:esm && yarn build:cjs",
    "build:esm": "tsc",
    "build:cjs": "tsc --module commonjs --outDir dist/cjs",
    "lint": "eslint \"{**/*,*}.{js,ts,jsx,tsx}\"",
    "prettier": "prettier --write \"{src,tests,example/src}/**/*.{js,ts,jsx,tsx}\"",
    "prepare": "npm run build",
    "prepublishOnly": "npm run prettier && npm run lint",
    "storybook": "start-storybook -p 6006"
  },
  "repository": {
    "type": "git",
    "url": "git+https://gitlab.com/empreinte/dam/customfield.git"
  },
  "keywords": [],
  "author": "empreinte",
  "license": "ISC",
  "bugs": {
    "url": "https://gitlab.com/empreinte/dam/customfield/issues"
  },
  "homepage": "https://gitlab.com/empreinte/dam/customfield#readme",
  "devDependencies": {
    "@babel/core": "^7.20.5",
    "@storybook/addon-actions": "^6.5.15",
    "@storybook/addon-essentials": "^6.5.15",
    "@storybook/addon-interactions": "^6.5.15",
    "@storybook/addon-links": "^6.5.15",
    "@storybook/builder-webpack4": "^6.5.15",
    "@storybook/manager-webpack4": "^6.5.15",
    "@storybook/react": "^6.5.15",
    "@storybook/testing-library": "^0.0.13",
    "@types/react": "^18.0.26",
    "@types/react-dom": "^18.0.10",
    "@typescript-eslint/eslint-plugin": "^5.47.0",
    "@typescript-eslint/parser": "^5.47.0",
    "babel-loader": "^9.1.0",
    "eslint": "^8.30.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-react": "^7.31.11",
    "eslint-plugin-react-hooks": "^4.6.0",
    "prettier": "^2.8.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "typescript": "^4.9.4",
    "tslib": "^2.4.1"
  },
  "peerDependencies": {
    "react": ">=16"
  },
  "files": [
    "dist",
    "src"
  ],
  "dependencies": {
    "@date-io/date-fns": "^2.16.0",
    "@emotion/react": "^11.10.5",
    "@emotion/styled": "^11.10.5",
    "@mui/material": "^5.11.1",
    "@mui/x-date-pickers": "^5.0.11",
    "@tanstack/react-query": "^4.20.4",
    "@types/node": "^18.11.17",
    "axios": "^1.2.1",
    "date-fns": "^2.29.3",
    "i18next": "^22.4.6",
    "i18next-browser-languagedetector": "^7.0.1",
    "i18next-http-backend": "^2.1.1",
    "i18next-localstorage-backend": "^4.1.0",
    "i18next-localstorage-cache": "^1.1.1",
    "react-i18next": "^12.1.1",
    "zod": "^3.20.2",
    "zustand": "^4.1.5"
  }
}
</code>```

and this is my dockerfile FROM node:14 as build-stage

```<code>RUN mkdir -p /app
WORKDIR    /app
RUN apt-get -y install openssh-client
ADD .ssh/id_rsa /root/.ssh/id_rsa
RUN chmod 600 /root/.ssh/id_rsa
RUN apt-get update
RUN apt-get -y install gettext-base
RUN echo "StrictHostKeyChecking no " > /root/.ssh/config
COPY package.json ./
RUN npm install

COPY . .
RUN npm run build
</code>```

Body:
I've created an npm package and hosted it on gitlab(didn't publish it on npm as I want it to be private). This package only exports one component and one custom hook and this my index.ts file:

I've checked the node_modules I got locally and the file exists.

this is my npm package's package.json

{
  "name": "customfields",
  "version": "1.1.0",
  "description": "",
  "main": "./dist/cjs/index.js",
  "module": "./dist/esm/index.js",
  "types": "./dist/esm/index.d.ts",
  "scripts": {
    "build": "yarn build:esm && yarn build:cjs",
    "build:esm": "tsc",
    "build:cjs": "tsc --module commonjs --outDir dist/cjs",
    "lint": "eslint \"{**/*,*}.{js,ts,jsx,tsx}\"",
    "prettier": "prettier --write \"{src,tests,example/src}/**/*.{js,ts,jsx,tsx}\"",
    "prepare": "npm run build",
    "prepublishOnly": "npm run prettier && npm run lint",
    "storybook": "start-storybook -p 6006"
  },
  "repository": {
    "type": "git",
    "url": "git+https://gitlab.com/empreinte/dam/customfield.git"
  },
  "keywords": [],
  "author": "empreinte",
  "license": "ISC",
  "bugs": {
    "url": "https://gitlab.com/empreinte/dam/customfield/issues"
  },
  "homepage": "https://gitlab.com/empreinte/dam/customfield#readme",
  "devDependencies": {
    "@babel/core": "^7.20.5",
    "@storybook/addon-actions": "^6.5.15",
    "@storybook/addon-essentials": "^6.5.15",
    "@storybook/addon-interactions": "^6.5.15",
    "@storybook/addon-links": "^6.5.15",
    "@storybook/builder-webpack4": "^6.5.15",
    "@storybook/manager-webpack4": "^6.5.15",
    "@storybook/react": "^6.5.15",
    "@storybook/testing-library": "^0.0.13",
    "@types/react": "^18.0.26",
    "@types/react-dom": "^18.0.10",
    "@typescript-eslint/eslint-plugin": "^5.47.0",
    "@typescript-eslint/parser": "^5.47.0",
    "babel-loader": "^9.1.0",
    "eslint": "^8.30.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-react": "^7.31.11",
    "eslint-plugin-react-hooks": "^4.6.0",
    "prettier": "^2.8.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "typescript": "^4.9.4",
    "tslib": "^2.4.1"
  },
  "peerDependencies": {
    "react": ">=16"
  },
  "files": [
    "dist",
    "src"
  ],
  "dependencies": {
    "@date-io/date-fns": "^2.16.0",
    "@emotion/react": "^11.10.5",
    "@emotion/styled": "^11.10.5",
    "@mui/material": "^5.11.1",
    "@mui/x-date-pickers": "^5.0.11",
    "@tanstack/react-query": "^4.20.4",
    "@types/node": "^18.11.17",
    "axios": "^1.2.1",
    "date-fns": "^2.29.3",
    "i18next": "^22.4.6",
    "i18next-browser-languagedetector": "^7.0.1",
    "i18next-http-backend": "^2.1.1",
    "i18next-localstorage-backend": "^4.1.0",
    "i18next-localstorage-cache": "^1.1.1",
    "react-i18next": "^12.1.1",
    "zod": "^3.20.2",
    "zustand": "^4.1.5"
  }
}

and this is my dockerfile FROM node:14 as build-stage

RUN mkdir -p /app
WORKDIR    /app
RUN apt-get -y install openssh-client
ADD .ssh/id_rsa /root/.ssh/id_rsa
RUN chmod 600 /root/.ssh/id_rsa
RUN apt-get update
RUN apt-get -y install gettext-base
RUN echo "StrictHostKeyChecking no " > /root/.ssh/config
COPY package.json ./
RUN npm install

COPY . .
RUN npm run build


问:
How to compute the coefficient of determination with respect to the 1:1 line in Python?
I am working with time-series in which peaks can be observed that are (often) approximately Gaussian shaped. To each of these peaks, I fit a Gaussian curve and want to assess how well this Gaussian curve fits the actual data. For this assessment, I want to determine the coefficient of determination.

On Stackoverflow I've came across many topics on how to implement the coefficient of determination. However, to me it seems all of the answers on Stackoverflow describe how to implement the square of the Pearson correlation coefficient r^2, which to my understanding is notably different from the coefficient of determination R^2. As explained in this article per definition the Pearson correlation coefficient r depends on the distance between points and the best-fit line whereby the coefficient of determination R^2 depends on the distance between  points and the 1:1 line. Therefore r^2 is unequal to R^2.

My question is: is the definition in above article correct that R^2 depends on the distance between points and the 1:1 line? If so, are there implementations of R^2 (note: not the square of the Pearson correlation coefficient) in Python?

Right now I've implemented the R^2 using the definition shown below, but I've noticed that this is the square of the Pearson correlation coefficient and not the coefficient of determination.

```<code>def coeffofdetermination(x,y):#coefficient of determination
    Rsqrd = np.corrcoef(x, y)[0, 1]**2
    return Rsqrd

</code>```

Thanks a lot in advance for replying.

Rik

Body:
I am working with time-series in which peaks can be observed that are (often) approximately Gaussian shaped. To each of these peaks, I fit a Gaussian curve and want to assess how well this Gaussian curve fits the actual data. For this assessment, I want to determine the coefficient of determination.

On Stackoverflow I've came across many topics on how to implement the coefficient of determination. However, to me it seems all of the answers on Stackoverflow describe how to implement the square of the Pearson correlation coefficient r^2, which to my understanding is notably different from the coefficient of determination R^2. As explained in this article per definition the Pearson correlation coefficient r depends on the distance between points and the best-fit line whereby the coefficient of determination R^2 depends on the distance between  points and the 1:1 line. Therefore r^2 is unequal to R^2.

My question is: is the definition in above article correct that R^2 depends on the distance between points and the 1:1 line? If so, are there implementations of R^2 (note: not the square of the Pearson correlation coefficient) in Python?

Right now I've implemented the R^2 using the definition shown below, but I've noticed that this is the square of the Pearson correlation coefficient and not the coefficient of determination.

def coeffofdetermination(x,y):#coefficient of determination
    Rsqrd = np.corrcoef(x, y)[0, 1]**2
    return Rsqrd

Thanks a lot in advance for replying.

Rik


问:
Getting Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: exception in following code
Since I want to save similar data in two tables, instead of having two different tables I went with a single table with a differentiator that should serve my purpose but got the following exception with the below code. What is wrong with the code?

Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.abc.xyz.GuaranteeCountPay.payRuleProfile in com.abc.xyz.PayRuleProfile.guaranteeCountPayCategories

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "TYPE_INDICATOR", discriminatorType = DiscriminatorType.STRING)
public abstract class GuaranteePay
{
    protected PayCategory payCategory;

    protected PayRuleProfile payRuleProfile;

    @ManyToOne
    public PayCategory getPayCategory()
    {
        return payCategory;
    }

    public void setPayCategory(PayCategory payCategory)
    {
        this.payCategory = payCategory;
    }

    @ManyToOne
    public PayRuleProfile getPayRuleProfile()
    {
        return payRuleProfile;
    }

    public void setPayRuleProfile(
    PayRuleProfile payRuleProfile)
    {
        this.payRuleProfile = payRuleProfile;
    }
}
```
<pre class="lang-java prettyprint-override"><code>@Entity
@DiscriminatorValue(value = "GuaranteeReducePay")
public class GuaranteeReducePay extends GuaranteePay
{

}
</code>```

@Entity
@DiscriminatorValue(value = "GuaranteeCountPay")
public class GuaranteeCountPay extends GuaranteePay
{

}
```
<pre class="lang-java prettyprint-override"><code>@Entity
public class PayRuleProfile
{
    private Set<GuaranteeCountPay> guaranteeCountPayCategories = new HashSet<>();

    private Set<GuaranteeReducePay> guaranteeReducePayCategories = new HashSet<>();

    @BatchSize(size = 20)
    @OneToMany(mappedBy = "payRuleProfile", cascade = {
    CascadeType.ALL }, orphanRemoval = true)
    public Set<GuaranteeCountPay> getGuaranteeCountPayCategories()
    {
        return guaranteeCountPayCategories;
    }

    public void setGuaranteeCountPayCategories(
    Set<GuaranteeCountPay> guaranteeCountPayCategories)
    {
        this.guaranteeCountPayCategories = guaranteeCountPayCategories;
    }

    @BatchSize(size = 20)
    @OneToMany(mappedBy = "payRuleProfile", cascade = {
    CascadeType.ALL }, orphanRemoval = true)
    public Set<GuaranteeReducePay> getGuaranteeReducePayCategories()
    {
        return guaranteeReducePayCategories;
    }

    public void setGuaranteeReducePayCategories(
    Set<GuaranteeReducePay> guaranteeReducePayCategories)
    {
        this.guaranteeReducePayCategories = guaranteeReducePayCategories;
    }
}
</code>```

Body:
Since I want to save similar data in two tables, instead of having two different tables I went with a single table with a differentiator that should serve my purpose but got the following exception with the below code. What is wrong with the code?

Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.abc.xyz.GuaranteeCountPay.payRuleProfile in com.abc.xyz.PayRuleProfile.guaranteeCountPayCategories

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "TYPE_INDICATOR", discriminatorType = DiscriminatorType.STRING)
public abstract class GuaranteePay
{
    protected PayCategory payCategory;

    protected PayRuleProfile payRuleProfile;

    @ManyToOne
    public PayCategory getPayCategory()
    {
        return payCategory;
    }

    public void setPayCategory(PayCategory payCategory)
    {
        this.payCategory = payCategory;
    }

    @ManyToOne
    public PayRuleProfile getPayRuleProfile()
    {
        return payRuleProfile;
    }

    public void setPayRuleProfile(
    PayRuleProfile payRuleProfile)
    {
        this.payRuleProfile = payRuleProfile;
    }
}

@Entity
@DiscriminatorValue(value = "GuaranteeReducePay")
public class GuaranteeReducePay extends GuaranteePay
{

}

@Entity
@DiscriminatorValue(value = "GuaranteeCountPay")
public class GuaranteeCountPay extends GuaranteePay
{

}

@Entity
public class PayRuleProfile
{
    private Set<GuaranteeCountPay> guaranteeCountPayCategories = new HashSet<>();

    private Set<GuaranteeReducePay> guaranteeReducePayCategories = new HashSet<>();

    @BatchSize(size = 20)
    @OneToMany(mappedBy = "payRuleProfile", cascade = {
    CascadeType.ALL }, orphanRemoval = true)
    public Set<GuaranteeCountPay> getGuaranteeCountPayCategories()
    {
        return guaranteeCountPayCategories;
    }

    public void setGuaranteeCountPayCategories(
    Set<GuaranteeCountPay> guaranteeCountPayCategories)
    {
        this.guaranteeCountPayCategories = guaranteeCountPayCategories;
    }

    @BatchSize(size = 20)
    @OneToMany(mappedBy = "payRuleProfile", cascade = {
    CascadeType.ALL }, orphanRemoval = true)
    public Set<GuaranteeReducePay> getGuaranteeReducePayCategories()
    {
        return guaranteeReducePayCategories;
    }

    public void setGuaranteeReducePayCategories(
    Set<GuaranteeReducePay> guaranteeReducePayCategories)
    {
        this.guaranteeReducePayCategories = guaranteeReducePayCategories;
    }
}


问:
Files are empty after downloading zip from assets flutter
I have a file and folder structure like

```<code>Folder
   subfolder x
      file_x.txt
      file_y.txt
      ....
   subfolder y
      file_x.txt
      file_y.txt
      ....
   subfolder n
</code>```

I created zip of complete structure in ubuntu and paste that zip in assets folder of flutter project, added assets in pubspecc.yaml

Now I want to open asset zip add new generated file and download complete zip For this i am using  archive package. code to load asset add new file and download is as

```<code>  downloadZip() async {
    /// this function open zip template from assets and add custom file in zip
    /// and then download whole zip
    String newFileString = '...';
    final zipEncoder = ZipEncoder();
    List<int> utf8encodedData = utf8.encode(newFileString);  // newFileString is content of new file to be added
    ArchiveFile newFile =
        ArchiveFile("file", utf8encodedData.length, utf8encodedData);

DefaultAssetBundle.of(Get.context!)
    .load("files/file.zip")
    .then((ByteData value) {
  Uint8List wzzip =
      value.buffer.asUint8List(value.offsetInBytes, value.lengthInBytes);
  InputStream inputFileStream = InputStream(wzzip);
  final archive = ZipDecoder().decodeBuffer(inputFileStream);
  archive.addFile(newFile);

  final encodedFile = zipEncoder.encode(archive);
  String content = base64Encode(encodedFile!);
  html.AnchorElement(
      href:
          "data:application/octet-stream;charset=utf-16le;base64,$content")
    ..setAttribute("download", "project.zip")
    ..click();
  inputFileStream.close();
});
}
</code>```

Problem: In downloaded zip, folder structure is perfect but all files are empty except newFile that i added

Body:
I have a file and folder structure like

Folder
   subfolder x
      file_x.txt
      file_y.txt
      ....
   subfolder y
      file_x.txt
      file_y.txt
      ....
   subfolder n

I created zip of complete structure in ubuntu and paste that zip in assets folder of flutter project, added assets in pubspecc.yaml

Now I want to open asset zip add new generated file and download complete zip For this i am using  archive package. code to load asset add new file and download is as

  downloadZip() async {
    /// this function open zip template from assets and add custom file in zip
    /// and then download whole zip
    String newFileString = '...';
    final zipEncoder = ZipEncoder();
    List<int> utf8encodedData = utf8.encode(newFileString);  // newFileString is content of new file to be added
    ArchiveFile newFile =
        ArchiveFile("file", utf8encodedData.length, utf8encodedData);

DefaultAssetBundle.of(Get.context!)
    .load("files/file.zip")
    .then((ByteData value) {
  Uint8List wzzip =
      value.buffer.asUint8List(value.offsetInBytes, value.lengthInBytes);
  InputStream inputFileStream = InputStream(wzzip);
  final archive = ZipDecoder().decodeBuffer(inputFileStream);
  archive.addFile(newFile);

  final encodedFile = zipEncoder.encode(archive);
  String content = base64Encode(encodedFile!);
  html.AnchorElement(
      href:
          "data:application/octet-stream;charset=utf-16le;base64,$content")
    ..setAttribute("download", "project.zip")
    ..click();
  inputFileStream.close();
});
}

Problem: In downloaded zip, folder structure is perfect but all files are empty except newFile that i added


问:
Consider calling ActivityCompat#requestPermissions
```<code> @Override
    public void onConnected(@Nullable Bundle bundle) {

        if (ActivityCompat.checkSelfPermission(this, ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
            // TODO: Consider calling
            //    ActivityCompat#requestPermissions
            // here to request the missing permissions, and then overriding
            //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
            //                                          int[] grantResults)
            // to handle the case where the user grants the permission. See the documentation
            // for ActivityCompat#requestPermissions for more details.
            return;
        }
</code>```

Can anyone help me with what code to be written in TODO part?

Looked for several solutions but couldn't find the accurate one .

Body:
 @Override
    public void onConnected(@Nullable Bundle bundle) {

        if (ActivityCompat.checkSelfPermission(this, ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
            // TODO: Consider calling
            //    ActivityCompat#requestPermissions
            // here to request the missing permissions, and then overriding
            //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
            //                                          int[] grantResults)
            // to handle the case where the user grants the permission. See the documentation
            // for ActivityCompat#requestPermissions for more details.
            return;
        }

Can anyone help me with what code to be written in TODO part?

Looked for several solutions but couldn't find the accurate one .


问:
Two modules cannot share the same content root, Handle common gradle subproject dependency on intellij IDEA
I'm trying to handle a microservice based project in Intellijn IDEA ultimate, I've imported multiple gradle projects(spring based microservices) as Intellij modules.
My projects are A, B, C, the project B and C contain project A as a common subproject dependecy.

All three project are currently imported as modules inside intellij project.

Project B setting.gradle

```<code>rootProject.name = 'B'
include ":A"
project(":A").projectDir = file("../../A")
</code>```

Project B build.gradle

```<code>dependencies {
...

implementation project(':A')

...
}
</code>```

Project C setting.gradle

```<code>rootProject.name = 'C'
include ":A"
project(":A").projectDir = file("../../A")
</code>```

Project C build.gradle

```<code>dependencies {
...

implementation project(':A')

...
}
</code>```

Every time I open the Project setting menu (File -> Project Structure) and I try to change anything(e.g. add/edit/remove a module) i get the following error:

Content root 'path/to/module/A/src/main' is defined for modules B.A.main and C.A.main. Two modules cannot share the same content root

I've tried deleteing the A module dependency for B and C inside the Modules tab inside Project strcuture tab, but all three projects are imported via gradle so it did not work

Is there a way to tell Intellij to import both B and C project without Intellij to go mad about it?

Body:
I'm trying to handle a microservice based project in Intellijn IDEA ultimate, I've imported multiple gradle projects(spring based microservices) as Intellij modules.
My projects are A, B, C, the project B and C contain project A as a common subproject dependecy.

All three project are currently imported as modules inside intellij project.

Project B setting.gradle

rootProject.name = 'B'
include ":A"
project(":A").projectDir = file("../../A")

Project B build.gradle

dependencies {
...

implementation project(':A')

...
}

Project C setting.gradle

rootProject.name = 'C'
include ":A"
project(":A").projectDir = file("../../A")

Project C build.gradle

dependencies {
...

implementation project(':A')

...
}

Every time I open the Project setting menu (File -> Project Structure) and I try to change anything(e.g. add/edit/remove a module) i get the following error:

Content root 'path/to/module/A/src/main' is defined for modules B.A.main and C.A.main. Two modules cannot share the same content root

I've tried deleteing the A module dependency for B and C inside the Modules tab inside Project strcuture tab, but all three projects are imported via gradle so it did not work

Is there a way to tell Intellij to import both B and C project without Intellij to go mad about it?


问:
Is it possible to swipe cards in all four directions (right, left, top, bottom) using Swipe(React)?
I'm trying to use Swiper(React) to create a deck of cards that can be swiped. The default setting is to swipe either left or right. I want the swipe action for all four directions (right, left, top, bottom). Swiping in four different directions will lead to four different outcomes. Is it possible to achieve this?

Link to the library I want to use
Is it possible to achieve this using any other library?

I'm trying to build this for mobile devices only.

I tried to achieve this using different libraries but failed to do so. I'm thinking of implementing it from scratch (no external libraries) if nothing works.


问:
Access WSL2 subdomain via postmen
I'm using WLS2(ubuntu) on win11 & apache2 on the ubuntu. I created subdomains Ex : bi.local,crm2.local etc.. . These steps are working fine. i can access to all subdomains from chrome in windows. cmd ping also working.

But the issue is i cannot access subdomains from the postmen.

Title: Access WSL2 subdomain via postmen


问:
Is it possible to add a context menu on Team Explorer > Changeset Details > Action control?
I'm trying to create a VS extension for copying the history details of a selected TFS changeset to clipboard. Basically, applying the tfs command from this blog into a context menu under Team Explorer > Changeset Details > Action control (something like in the screenshot).

I've been googling and watching some of Mads Kristensen's tutorials about VS extensions but if anyone can point me to a more specific direction to accomplish the task, that would be great! TIA.


问:
Database backup, only update not download the database again. PostgreSQL
I have one database. And daily have backup. The database postgreSQL. Now the backup every day download the whole database. But i like to only update the already backuped file ( only the changes add to the already downloaded database ) not download always the whola database again, again, again. That is possible? If yes how? If not, have any option to do different way?
I use PG-Admin. DBeaver 7.1.3.

Many thanks!


问:
Can't generate a react native apk
The error arises while generating a react native apk

kalvin@Kalvins-MacBook-Pro android % ./gradlew assembleRelease
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

FAILURE: Build failed with an exception.

What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/6.7/userguide/gradle_daemon.html
Process command line: /Library/Java/JavaVirtualMachines/temurin-18.jdk/Contents/Home/bin/java -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country=HK -Duser.language=en -Duser.variant -cp /Users/kalvin/.gradle/wrapper/dists/gradle-6.7-all/cuy9mc7upwgwgeb72wkcrupxe/gradle-6.7/lib/gradle-launcher-6.7.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 6.7
Please read the following process output to find out more:

Unrecognized VM option 'MaxPermSize=512m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Get more help at https://help.gradle.org

Title: Can't generate a react native apk


问:
how to make radio button and checkbox work together
How can I make a radio button filter and a check box filter work together? currently with the radio filter I already create a variable with the page shown in order to make it work together with a text filter but now I also need to use an additional filter

HTML

```<code>                <input id="sito" class="find" name="txt" placeholder="CLIENTE" type="text" size=15 >
                <input id="IP" class="find" name="txt" placeholder="INDIRIZZO IP" type="text" size=15>
                <input id = 'all' class = "filter" type="radio" value="All" checked name="test"><label>All</label>
                <input id = 'prod' class = "filter" type="radio" value="PROD" name="test"><label>PROD</label>
                <input id = 'test' class = "filter"type="radio" value="TEST" name="test"><label>TEST</label>
                <input id="check-naz" type="checkbox" class = "filter check" value="NAZ" name="test"><label>NAZIONALI</label>
                <input id="check-est" type="checkbox" class = "filter check" value="EST" name="test"><label>ESTERI</label>
     <div id="elenco">
                <div class="cliente naz"  value="PROD">
                    cliente
                    <div class="desc" >
                            scommettendo prod <br>

                    </div>
                    <div class="funzioni">
                        <span>
                         <span>INDIRIZZI IP</span>
                        </span>
                        <button type="button" onclick="managerScomP(clienti.get('scommettendo').get('scommettendo prod').get('manager'))" id="m1">manager</button>
                         <button type="button" onclick="reloadmemScommP(clienti.get('scommettendo').get('scommettendo prod').get('reload'), 'resultScommP')" id="r1">reload</button>
                         <br>

                        <ul>
                            <li class="version"><button type="button" onclick="UpVersioneT(clienti.get('scommettendo').get('scommettendo prod').get('versione')+'/upgradeVersion','upVersionScommP')" class="rs1">UpVersione</button><div class="resultVersion" id="upVersionScommP">Risultato</div></li>
                            <li><button type="button" onclick="rilascio(clienti.get('scommettendo').get('scommettendo prod').get('versione')+'/upgradeVersion?isRelease=1 ','rilascio-scommettendo-P')" class="rs1 rilascio">Rilascio</button><div class="resultVersion" id="rilascio-scommettendo-P">Risultato</div></li>                        <li><button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[0]+'/XPayments/reload','resultScommP0')" class="rs1">10.38.0.21</button><div class="result" id="resultScommP0">Risultato</div></li>
                            <li><button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[1]+'/XPayments/reload','resultScommP1')" class="rs1"></button><div class="result"  id="resultScommP1">Risultato</div></li>
                            <li><button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[2]+'/XPayments/reload','resultScommP2')" class="rs1"></button><div class="result" id="resultScommP2">Risultato</div></li>

                          </ul>

                    </div>
                </div>
                <div class="cliente estero" value="PROD">
                    cliente
                    <div class="desc">
                        betafrik prod <br>

                    </div>
                    <div class="funzioni">
                         <span>INDIRIZZI IP</span>
                        <button type="button" onclick="managerScomP(clienti.get('betafrik').get('betafrik prod').get('manager'))" id="m1">manager</button>
                        <button type="button" onclick="reloadmemScommP(clienti.get('betafrik').get('betafrik prod').get('reload'),'resultBetafrikP')" id="r1">reload</button>
                        <br>
                        <ul>
                            <li class="version"><button type="button" onclick="UpVersioneT(clienti.get('betafrik').get('betafrik prod').get('versione') + '/upgradeVersion','UpVersioneBetafrikP')" class="rs1">UpVersione</button><div class="resultVersion" id="UpVersioneBetafrikP">Risultato</div></li>
                            <li><button type="button" onclick="rilascio(clienti.get('betafrik').get('betafrik prod').get('versione')+'/upgradeVersion?isRelease=1 ','rilascio-betafrik-P')" class="rs1 rilascio">Rilascio</button><div class="resultVersion" id="rilascio-betafrik-P">Risultato</div></li>
                            <li><button type="button" onclick="reloadmem(clienti.get('betafrik').get('betafrik prod').get('reload')[0] +'/XPayments/reload','resultBetafrikP0')" class="rs1"></button><div class="result" id="resultBetafr

ikP0">Risultato</div></li>
                        <li><button type="button" onclick="reloadmem(clienti.get('betafrik').get('betafrik prod').get('reload')[1] +'/XPayments/reload','resultBetafrikP1')" class="rs1"></button><div class="result" id="resultBetafrikP1">Risultato</div></li>
                    </ul>

                </div>
            </div>
        </div>
</code>```

JS

```<code>$(function() {
    var dom = $('#elenco .cliente');
    $('input[name="test"]').on('change', function(a, b) {
    value1 = this.value;
    console.log(value1)
    $('#elenco .cliente').hide();
    if (value1 == 'All') {
        $('#elenco .cliente').show();
        dom = $('#elenco .cliente');
        $('#sito').val('')
        $('#IP').val('')
    }
    if (value1 == 'PROD') {
        $('#elenco .cliente[value="PROD"]').show();
        dom = $('#elenco .cliente[value="PROD"]');
    }
    if (value1 == 'TEST') {
        $('#elenco .cliente[value="TEST"]').show();
        dom = $('#elenco .cliente[value="TEST"]');
    }
    if ($('#check-naz').is(':checked')){
        $('.naz').show();
        dom = $('.naz');
    }
    if ($('#check-est').is(':checked')){
        $('.estero').show();
        dom = $('.estero');
    }
    });
</code>```

i tried doing dom.find('.naz').show() but it didn't work. at the end of everything in the dom variable there must be only the elements that are actually seen on the screen

Body:
How can I make a radio button filter and a check box filter work together? currently with the radio filter I already create a variable with the page shown in order to make it work together with a text filter but now I also need to use an additional filter

HTML

                <input id="sito" class="find" name="txt" placeholder="CLIENTE" type="text" size=15 >
                <input id="IP" class="find" name="txt" placeholder="INDIRIZZO IP" type="text" size=15>
                <input id = 'all' class = "filter" type="radio" value="All" checked name="test">All
                <input id = 'prod' class = "filter" type="radio" value="PROD" name="test">PROD
                <input id = 'test' class = "filter"type="radio" value="TEST" name="test">TEST
                <input id="check-naz" type="checkbox" class = "filter check" value="NAZ" name="test">NAZIONALI
                <input id="check-est" type="checkbox" class = "filter check" value="EST" name="test">ESTERI

                    cliente

                            scommettendo prod

                         INDIRIZZI IP

                        <button type="button" onclick="managerScomP(clienti.get('scommettendo').get('scommettendo prod').get('manager'))" id="m1">manager</button>
                         <button type="button" onclick="reloadmemScommP(clienti.get('scommettendo').get('scommettendo prod').get('reload'), 'resultScommP')" id="r1">reload</button>

<button type="button" onclick="UpVersioneT(clienti.get('scommettendo').get('scommettendo prod').get('versione')+'/upgradeVersion','upVersionScommP')" class="rs1">UpVersione</button>
Risultato

<button type="button" onclick="rilascio(clienti.get('scommettendo').get('scommettendo prod').get('versione')+'/upgradeVersion?isRelease=1 ','rilascio-scommettendo-P')" class="rs1 rilascio">Rilascio</button>
Risultato

<button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[0]+'/XPayments/reload','resultScommP0')" class="rs1">10.38.0.21</button>
Risultato

<button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[1]+'/XPayments/reload','resultScommP1')" class="rs1"></button>
Risultato

<button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[2]+'/XPayments/reload','resultScommP2')" class="rs1"></button>
Risultato

                    cliente

                        betafrik prod

                         INDIRIZZI IP
                        <button type="button" onclick="managerScomP(clienti.get('betafrik').get('betafrik prod').get('manager'))" id="m1">manager</button>
                        <button type="button" onclick="reloadmemScommP(clienti.get('betafrik').get('betafrik prod').get('reload'),'resultBetafrikP')" id="r1">reload</button>

<button type="button" onclick="UpVersioneT(clienti.get('betafrik').get('betafrik prod').get('versione') + '/upgradeVersion','UpVersioneBetafrikP')" class="rs1">UpVersione</button>
Risultato

<button type="button" onclick="rilascio(clienti.get('betafrik').get('betafrik prod').get('versione')+'/upgradeVersion?isRelease=1 ','rilascio-betafrik-P')" class="rs1 rilascio">Rilascio</button>
Risultato

<button type="button" onclick="reloadmem(clienti.get('betafrik').get('betafrik prod').get('reload')[0] +'/XPayments/reload','resultBetafrikP0')" class="rs1"></button>
Risultato

<button type="button" onclick="reloadmem(clienti.get('betafrik').get('betafrik prod').get('reload')[1] +'/XPayments/reload','resultBetafrikP1')" class="rs1"></button>
Risultato

JS

$(function() {
    var dom = $('#elenco .cliente');
    $('input[name="test"]').on('change', function(a, b) {
    value1 = this.value;
    console.log(value1)
    $('#elenco .cliente').hide();
    if (value1 == 'All') {
        $('#elenco .cliente').show();
        dom = $('#elenco .cliente');
        $('#sito').val('')
        $('#IP').val('')
    }
    if (value1 == 'PROD') {
        $('#elenco .cliente[value="PROD"]').show();
        dom = $('#elenco .cliente[value="PROD"]');
    }
    if (value1 == 'TEST') {
        $('#elenco .cliente[value="TEST"]').show();
        dom = $('#elenco .cliente[value="TEST"]');
    }
    if ($('#check-naz').is(':checked')){
        $('.naz').show();
        dom = $('.naz');
    }
    if ($('#check-est').is(':checked')){
        $('.estero').show();
        dom = $('.estero');
    }
    });

i tried doing dom.find('.naz').show() but it didn't work. at the end of everything in the dom variable there must be only the elements that are actually seen on the screen


问:
Use parameters in Elsa CompositeActivity.Build
I'm currently trying to accomplish following thing in Elsa: a CompositeActivity should take a parameter called Path, then build a workflow where it is waiting for a SignalReceived on Path and then do some other stuff.

[ActivityInput]
public string Path { get; set; }

public override void Build(ICompositeActivityBuilder builder)
{
  builder
   .SignalReceived(Path)
   .SomeOtherStuff();
}
```

However, Path gets set after Build is called when constructing a workflow, thus Path is null while setting the signal.

Is there a way to have parameters in the Build method of a CompositeActivity? Does not necessarily need to be an ActivityInput.

I tried using ActivityInput to set Path. Did not work via the GUI nor via a custom .WithPath() method using the Extensions pattern. The documentation for CompositeActivity is currently under construction and I could not find an example in the Elsa repo related to my problem.

Body:
I'm currently trying to accomplish following thing in Elsa: a CompositeActivity should take a parameter called Path, then build a workflow where it is waiting for a SignalReceived on Path and then do some other stuff.

[ActivityInput]
public string Path { get; set; }

public override void Build(ICompositeActivityBuilder builder)
{
  builder
   .SignalReceived(Path)
   .SomeOtherStuff();
}

However, Path gets set after Build is called when constructing a workflow, thus Path is null while setting the signal.

Is there a way to have parameters in the Build method of a CompositeActivity? Does not necessarily need to be an ActivityInput.

I tried using ActivityInput to set Path. Did not work via the GUI nor via a custom .WithPath() method using the Extensions pattern. The documentation for CompositeActivity is currently under construction and I could not find an example in the Elsa repo related to my problem.


问:
Why is Confluent Cloudwatch Source Connector retrieving string and not json?
I've set up a manged connector (Cloudwatch source connector) and it is writing to a topic. However, the messages are a string and are including escape characters "" to ignore the quotes by each key and each value of the json.

Any advise or anything I should look into?

I've tried schema's (Avo, Json, Json_sr) nothing is working.
I've tried changing the format of the log in Cloudwatch.
I am expecting to get a json on confluent cloud and not a string


问:
Need api for gym exercice like api-ninjas
I am building a gym log tracker where I will put my exercice from gym. The problem is that I cannot find the one that offers pictures also.
I found https://api-ninjas.com/api/exercises but is offering only a limited info.

I am looking for something like exerciceDB, because the exerciceDB offers also images...


问:
Cmake Swift framework with C files - setting target membership and properties
I am trying to build a framework with a combination of swift and C files and using cmake to generate the XCode Project:

After generating the project using this command:

```<code>add_library(MyLibrary STATIC ${FLAT_LIBRARY_FILES})
set_target_properties(MyLibrary PROPERTIES
    FRAMEWORK TRUE
    MACOSX_FRAMEWORK_IDENTIFIER com.MyLibrary.MyLibrary
    # "current version" in semantic format in Mach-O binary file
    VERSION 16.4.0
    # "compatibility version" in semantic format in Mach-O binary file
    SOVERSION 1.0.0
    PUBLIC_HEADER MyLibrary.h
    DEFINES_MODULE YES
    XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer")
</code>```

with command:

```<code>cmake -G Xcode -B ./build/sdk/ios ./sdk/ios
</code>```

but after this project is generated, I still have to do the following to be able to build the library for iOS:

Add iOS as platform

Add swift files to target (C files are added to the target correctly)

Set defines_module to true

Set swift_version

Uncheck test file from target

Make headers public

There have been scant documentation about dealing with this scenario and I have tried various set() commands that I was able to find, to no success. How can I handle this?

Body:
I am trying to build a framework with a combination of swift and C files and using cmake to generate the XCode Project:

After generating the project using this command:

add_library(MyLibrary STATIC ${FLAT_LIBRARY_FILES})
set_target_properties(MyLibrary PROPERTIES
    FRAMEWORK TRUE
    MACOSX_FRAMEWORK_IDENTIFIER com.MyLibrary.MyLibrary
    # "current version" in semantic format in Mach-O binary file
    VERSION 16.4.0
    # "compatibility version" in semantic format in Mach-O binary file
    SOVERSION 1.0.0
    PUBLIC_HEADER MyLibrary.h
    DEFINES_MODULE YES
    XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer")

with command:

cmake -G Xcode -B ./build/sdk/ios ./sdk/ios

but after this project is generated, I still have to do the following to be able to build the library for iOS:

Add iOS as platform

Add swift files to target (C files are added to the target correctly)

Set defines_module to true

Set swift_version

Uncheck test file from target

Make headers public

There have been scant documentation about dealing with this scenario and I have tried various set() commands that I was able to find, to no success. How can I handle this?


问:
How to reliably write to json files from different functions at the same time?
I am trying to run a gaming website that requires writing json data in Python 3 to a user dictionary. And now that users are starting to play frequently, Data is being written at the same time causing an error in the structure of the dictionary and i was wondering if there was any solutions to this issue like a queue system or a more reliable method?

CODE EXAMPLES:

```<code># DICTIONARY FORMAT
{
    'User': {
        'Data': 999,
        'Nonce': 420
    }
}
# PYTHON DEFINITION
def example(user, number):
    with open('example.json', 'r') as f:
        example = json.load(f)
    example[user]['Data'] = example[user]['Data'] + number
    with open('example.json', 'w') as f:
        json.dump(example, f, indent=4)
</code>```

The end result is just a structure error causing it to stop writing data at a certain point for some unknown reason and not closing the {}

Body:
I am trying to run a gaming website that requires writing json data in Python 3 to a user dictionary. And now that users are starting to play frequently, Data is being written at the same time causing an error in the structure of the dictionary and i was wondering if there was any solutions to this issue like a queue system or a more reliable method?

CODE EXAMPLES:

# DICTIONARY FORMAT
{
    'User': {
        'Data': 999,
        'Nonce': 420
    }
}
# PYTHON DEFINITION
def example(user, number):
    with open('example.json', 'r') as f:
        example = json.load(f)
    example[user]['Data'] = example[user]['Data'] + number
    with open('example.json', 'w') as f:
        json.dump(example, f, indent=4)

The end result is just a structure error causing it to stop writing data at a certain point for some unknown reason and not closing the {}


问:
ePub3 eBook - Allowing users to enter the page they want to go to
I am currently working on an ePubv3 book and have run into a problem. I'm using Sigil as the IDE. My goal is to allow the reader to type in the page number that they would like to jump to. Here is my code:

```<code><head>
  <title>testing</title>
<script>
function goToPage() {
var pageNumber = document.getElementById('page-number').value;
</script>
</head>
<body>
  <p> </p>

<form method="post" onsubmit="goToPage" action="#">
<label for="page-number">Enter page number:</label>
<input type="text" id="page-number" name="page-number"><BR>
<p class="submit">
<input type="submit" value="Go to page"></input>
</p>
</form>
</body>
</html>
</code>```

I have tried a few different ways. With and without the "class" option, changing the javascript. But haven't been able to get it to work.

Would someone please tell me what I am doing wrong?

Thank you

The goal is to allow the reader to type in a number to go to that page. An example being that they want to go to page 33 (from say page 2). They would just type in 33 in the input box and go to that page.

Body:
I am currently working on an ePubv3 book and have run into a problem. I'm using Sigil as the IDE. My goal is to allow the reader to type in the page number that they would like to jump to. Here is my code:

  <title>testing</title>

<form method="post" onsubmit="goToPage" action="#">
Enter page number:
<input type="text" id="page-number" name="page-number">

<input type="submit" value="Go to page"></input>

</form>

I have tried a few different ways. With and without the "class" option, changing the javascript. But haven't been able to get it to work.

Would someone please tell me what I am doing wrong?

Thank you

The goal is to allow the reader to type in a number to go to that page. An example being that they want to go to page 33 (from say page 2). They would just type in 33 in the input box and go to that page.


问:
Stream file failed- how to fail the stream on BE+FE
I have a fullstack application with react and nodeJS.
I want to create a flow-> click on a button -> download file from the server.

I did it using stream (on the server side), and window.open() on the client side

How can I detect if window.open downloaded a file successfully?
I want to catch errors (such as error 500) but didn't find a way to do so...


问:
how to request payment using google pay to merchant iD
i what to send some employees with my app and collect some money from client to my account so i am planning to created a employees app where they can put client UIP id and amount and collect the amount to my account  how can i do this in my research i understand that i need a merchant iD so i created one on the google Wallet Console  and i dont know what to do next

my doubts

1, is this possible using google pay

2, i dont want  my google pay account on employees mobile

3, how to make use of the merchant id and request money using employees google pay to my merchant ID

so far i am able to send money from my own gpay to others

GooglePay tutorial
i found this code but i dont know how to use this

```<code>    private static JSONObject getGatewayTokenizationSpecification() throws JSONException {
    return new JSONObject() {{
      put("type", "PAYMENT_GATEWAY");
      put("parameters", new JSONObject() {{
        put("gateway", "example");
        put("gatewayMerchantId", "exampleGatewayMerchantId");
      }});
    }};
    }
</code>```

i want to do this on secure way need help a set by step guide much appreciated

Body:
i what to send some employees with my app and collect some money from client to my account so i am planning to created a employees app where they can put client UIP id and amount and collect the amount to my account  how can i do this in my research i understand that i need a merchant iD so i created one on the google Wallet Console  and i dont know what to do next

my doubts

1, is this possible using google pay

2, i dont want  my google pay account on employees mobile

3, how to make use of the merchant id and request money using employees google pay to my merchant ID

so far i am able to send money from my own gpay to others

GooglePay tutorial
i found this code but i dont know how to use this

    private static JSONObject getGatewayTokenizationSpecification() throws JSONException {
    return new JSONObject() {{
      put("type", "PAYMENT_GATEWAY");
      put("parameters", new JSONObject() {{
        put("gateway", "example");
        put("gatewayMerchantId", "exampleGatewayMerchantId");
      }});
    }};
    }

i want to do this on secure way need help a set by step guide much appreciated


问:
Docker compose issue with pgAdmin
I have the following docker-compose file.

But I am unable to connect to pgAdmin from the browser. I don't understand the issue as if I send data from postman then it gets saved to pgAdmin app which is on my local machine But when I visit localhost://5050/browser/ then that table does not appear in the browser.

```<code>version: '1'

services:
  postgres:
    container_name: postgres_container
    image: 'postgres:latest'
    environment:
      POSTGRES_USER: ${POSTGRES_USERNAME}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DATABASE}
    ports:
      - 5432:5432
    networks:
      app_network:
        ipv4_address: 172.26.0.11
    restart: unless-stopped
    healthcheck:
      test: ['CMD', 'pg_isready -U postgres']
      interval: 5s
      timeout: 5s
      retries: 5
    volumes:
      - postgres:/data/postgres
  pgadmin:
    container_name: pgadmin_container
    image: dpage/pgadmin4
    depends_on:
      - postgres
    volumes:
      - pgadmin:/var/lib/pgadmin

    environment:
      PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-'email'}
      PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-'password'}
      PGADMIN_CONFIG_SERVER_MODE: 'False'

    ports:
      - '${PGADMIN_PORT:-5050}:80'
    networks:
      - app_network
    restart: unless-stopped

networks:
  app_network:
    external: true
    driver: bridge
volumes:
  postgres:
  pgadmin:
</code>```

The tables from my pgAdmin app.

The tables from the localhost:5050/browser/ link.

I have correctly set the connection for pgAdmin in browser.

Title: Docker compose issue with pgAdmin

Body:
I have the following docker-compose file.

But I am unable to connect to pgAdmin from the browser. I don't understand the issue as if I send data from postman then it gets saved to pgAdmin app which is on my local machine But when I visit localhost://5050/browser/ then that table does not appear in the browser.

version: '1'

services:
  postgres:
    container_name: postgres_container
    image: 'postgres:latest'
    environment:
      POSTGRES_USER: ${POSTGRES_USERNAME}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DATABASE}
    ports:
      - 5432:5432
    networks:
      app_network:
        ipv4_address: 172.26.0.11
    restart: unless-stopped
    healthcheck:
      test: ['CMD', 'pg_isready -U postgres']
      interval: 5s
      timeout: 5s
      retries: 5
    volumes:
      - postgres:/data/postgres
  pgadmin:
    container_name: pgadmin_container
    image: dpage/pgadmin4
    depends_on:
      - postgres
    volumes:
      - pgadmin:/var/lib/pgadmin

    environment:
      PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-'email'}
      PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-'password'}
      PGADMIN_CONFIG_SERVER_MODE: 'False'

    ports:
      - '${PGADMIN_PORT:-5050}:80'
    networks:
      - app_network
    restart: unless-stopped

networks:
  app_network:
    external: true
    driver: bridge
volumes:
  postgres:
  pgadmin:

The tables from my pgAdmin app.

The tables from the localhost:5050/browser/ link.

I have correctly set the connection for pgAdmin in browser.


问:
Postgres autocomplete not working in version 10
Whenever i press up/down arrows, the command history is not getting displayed and whenever i press tab, autocomplete is not happening.</p>


问:
Voronoi Vertices inside a rectangle
I wrote a python code for getting a Voronoi diagram of a region. The region that I consider is a rectangle [-1, 10] by [-1, 10]. Now I am trying to get the Voronoi vertices that lies only inside the rectangle. Can anyone help me in this?

Here is the code:

import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import Voronoi, voronoi_plot_2d

# make up data points
points = np.random.randint(0, 10, size=(5,2))
print(points)

# compute Voronoi tesselation
vor = Voronoi(points)

# plot
voronoi_plot_2d(vor, show_vertices=False, line_colors='black',line_width=2, line_alpha=1, point_size=10)

# colorize
for region in vor.regions:
    if not -1 in region:
        polygon = [vor.vertices[i] for i in region]
        plt.fill(*zip(*polygon),alpha=0.4)

# fix the range of axes
plt.xlim([-1,11]), plt.ylim([-1,11])

print(vertices)
print(vor.vertices)
plt.show()
```

Also can we get the points of intersection of the Voronoi polygonal lines with the square? I mean I want to know the red circled points in the image below. Is there any way?

I want to know the Voronoi vertices only inside the square and the point of intersections of the Voronoi regions with the square.

Title: Voronoi Vertices inside a rectangle

Body:
I wrote a python code for getting a Voronoi diagram of a region. The region that I consider is a rectangle [-1, 10] by [-1, 10]. Now I am trying to get the Voronoi vertices that lies only inside the rectangle. Can anyone help me in this?

Here is the code:

import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import Voronoi, voronoi_plot_2d

# make up data points
points = np.random.randint(0, 10, size=(5,2))
print(points)

# compute Voronoi tesselation
vor = Voronoi(points)

# plot
voronoi_plot_2d(vor, show_vertices=False, line_colors='black',line_width=2, line_alpha=1, point_size=10)

# colorize
for region in vor.regions:
    if not -1 in region:
        polygon = [vor.vertices[i] for i in region]
        plt.fill(*zip(*polygon),alpha=0.4)

# fix the range of axes
plt.xlim([-1,11]), plt.ylim([-1,11])

print(vertices)
print(vor.vertices)
plt.show()

Also can we get the points of intersection of the Voronoi polygonal lines with the square? I mean I want to know the red circled points in the image below. Is there any way?

I want to know the Voronoi vertices only inside the square and the point of intersections of the Voronoi regions with the square.


问:
Weird behaviour of connectTimeout in mysql Spring Boot
I want to implement Database connection timeout in my spring boot application so that whenever establishing connection to the Database takes more than a certain time, it should throw a timeout exception and it should not wait indefinetely. I am using mysql as database. In my JDBC URL I have mentioned the parameter "connectTimeout" like this:

datasource.jdbc-url=jdbc:mysql://XX.XX.XX.XX/dbName?connectTimeout=5000

In the official docs, its mentioned that the unit is in milliseconds. Now I have measured the database connection time in my local to be around 1400ms.

```<code>stopwatch.start();
datasource.getConnection();
stopwatch.stop();
</code>```

So ideally, setting connectTimeout to be less than 1000 should throw timeout exception. But it does not throw any error even after giving a value as low as 10.

Only when I mention the value to be 1, then it throws me timeout exception.

datasource.jdbc-url=jdbc:mysql://XX.XX.XX.XX/dbName?connectTimeout=1

Which gives me the notion that maybe the timeout is being considered in seconds? Am I doing anything wrong here?

Mysql Connector Verion: 5.1.46

Docs Link: https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-connp-props-networking.html

Body:
I want to implement Database connection timeout in my spring boot application so that whenever establishing connection to the Database takes more than a certain time, it should throw a timeout exception and it should not wait indefinetely. I am using mysql as database. In my JDBC URL I have mentioned the parameter "connectTimeout" like this:

datasource.jdbc-url=jdbc:mysql://XX.XX.XX.XX/dbName?connectTimeout=5000

In the official docs, its mentioned that the unit is in milliseconds. Now I have measured the database connection time in my local to be around 1400ms.

stopwatch.start();
datasource.getConnection();
stopwatch.stop();

So ideally, setting connectTimeout to be less than 1000 should throw timeout exception. But it does not throw any error even after giving a value as low as 10.

Only when I mention the value to be 1, then it throws me timeout exception.

datasource.jdbc-url=jdbc:mysql://XX.XX.XX.XX/dbName?connectTimeout=1

Which gives me the notion that maybe the timeout is being considered in seconds? Am I doing anything wrong here?

Mysql Connector Verion: 5.1.46

Docs Link: https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-connp-props-networking.html


问:
how to download file from slack api with python
```<code>import requests
from requests.packages import urllib3
urllib3.disable_warnings()
url = 'https://app.slack.com/client/~'
token = 'xoxe.xoxp-~'
r = requests.get(url,verify = False,headers={'Authorization': 'Bearer %s' % token})
r.raise_for_status
file_data = r.content
print(r.status_code)
file_name = 'TEST.xlsx'
with open(file_name , 'w+b') as f:
  f.write(bytearray(file_data))
</code>```

It can run, but the "TEST.xlsx" file is empty. It can't find the file that I need~ Please help me.

I hope use slack-bot to download file with python.

Body:
import requests
from requests.packages import urllib3
urllib3.disable_warnings()
url = 'https://app.slack.com/client/~'
token = 'xoxe.xoxp-~'
r = requests.get(url,verify = False,headers={'Authorization': 'Bearer %s' % token})
r.raise_for_status
file_data = r.content
print(r.status_code)
file_name = 'TEST.xlsx'
with open(file_name , 'w+b') as f:
  f.write(bytearray(file_data))

It can run, but the "TEST.xlsx" file is empty. It can't find the file that I need~ Please help me.

I hope use slack-bot to download file with python.


问:
How to attach HttpPostedFileBase file in aws ses email in C#
I am trying to attach a file in the AWS ses email. The file is being received by HttpPostedFileBase but the problem is I have no idea how can I use it to attach in a method called GetMessageBody() because body.Attachments.Add() only takes input for file location, not the HttpPostedFileBase file. Any idea how can I attach the file received by HttpPostedFileBase?

Use case:

```<code>[HttpPost, ValidateInput(false)]
public ActionResult SendHtmlEmailWithAttachment(HttpPostedFileBase file)
{
    AWSEmailWithAttachment.SendAttachmentEmails("test@gmail.com", "noreply@test.co.uk", "my subject", file);

    return Json("ok");
}
</code>```

AWS ses email class:

```<code>public class AWSEmailWithAttachment
{
    private static BodyBuilder GetMessageBody(HttpPostedFileBase attachment)
    {
        var body = new BodyBuilder()
        {
            HtmlBody = @"<p>Amazon SES Test body</p>",
            TextBody = "Amazon SES Test body",
        };
        body.Attachments.Add(@"C:\Users\liaka\OneDrive\Desktop\attachment.txt");//I can use file location to attach with email but no idea how can i take file input form HttpPostedFileBase

        return body;
    }

    private static MimeMessage GetMessage(string receiveraddress, string senderaddress, string subject, HttpPostedFileBase attachment)
    {
        var message = new MimeMessage();
        message.From.Add(new MailboxAddress("Foo Bar", senderaddress));
        message.To.Add(new MailboxAddress(string.Empty, receiveraddress));
        message.Subject = subject;
        message.Body = GetMessageBody(attachment).ToMessageBody();
        return message;
    }

    private static MemoryStream GetMessageStream(string receiveraddress, string senderaddress, string subject, HttpPostedFileBase attachment)
    {
        var stream = new MemoryStream();
        GetMessage(receiveraddress, senderaddress, subject, attachment).WriteTo(stream);
        return stream;
    }

    public static void SendAttachmentEmails(string receiveraddress, string senderaddress, string subject, HttpPostedFileBase attachment)
    {
        var credentals = new BasicAWSCredentials(Credentials.AWS_Access_Key_ID, Credentials.AWS_Secret_Access_Key);

        using (var client = new AmazonSimpleEmailServiceClient(credentals, RegionEndpoint.EUWest2))
        {
            var sendRequest = new SendRawEmailRequest { RawMessage = new RawMessage(GetMessageStream(receiveraddress, senderaddress, subject, attachment)) };
            try
            {
                var response = client.SendRawEmail(sendRequest);
            }
            catch (Exception e) { }
        }
    }
}
</code>```

Body:
I am trying to attach a file in the AWS ses email. The file is being received by HttpPostedFileBase but the problem is I have no idea how can I use it to attach in a method called GetMessageBody() because body.Attachments.Add() only takes input for file location, not the HttpPostedFileBase file. Any idea how can I attach the file received by HttpPostedFileBase?

Use case:

[HttpPost, ValidateInput(false)]
public ActionResult SendHtmlEmailWithAttachment(HttpPostedFileBase file)
{
    AWSEmailWithAttachment.SendAttachmentEmails("test@gmail.com", "noreply@test.co.uk", "my subject", file);

    return Json("ok");
}

AWS ses email class:

public class AWSEmailWithAttachment
{
    private static BodyBuilder GetMessageBody(HttpPostedFileBase attachment)
    {
        var body = new BodyBuilder()
        {
            HtmlBody = @"
Amazon SES Test body
",
            TextBody = "Amazon SES Test body",
        };
        body.Attachments.Add(@"C:\Users\liaka\OneDrive\Desktop\attachment.txt");//I can use file location to attach with email but no idea how can i take file input form HttpPostedFileBase

        return body;
    }

    private static MimeMessage GetMessage(string receiveraddress, string senderaddress, string subject, HttpPostedFileBase attachment)
    {
        var message = new MimeMessage();
        message.From.Add(new MailboxAddress("Foo Bar", senderaddress));
        message.To.Add(new MailboxAddress(string.Empty, receiveraddress));
        message.Subject = subject;
        message.Body = GetMessageBody(attachment).ToMessageBody();
        return message;
    }

    private static MemoryStream GetMessageStream(string receiveraddress, string senderaddress, string subject, HttpPostedFileBase attachment)
    {
        var stream = new MemoryStream();
        GetMessage(receiveraddress, senderaddress, subject, attachment).WriteTo(stream);
        return stream;
    }

    public static void SendAttachmentEmails(string receiveraddress, string senderaddress, string subject, HttpPostedFileBase attachment)
    {
        var credentals = new BasicAWSCredentials(Credentials.AWS_Access_Key_ID, Credentials.AWS_Secret_Access_Key);

        using (var client = new AmazonSimpleEmailServiceClient(credentals, RegionEndpoint.EUWest2))
        {
            var sendRequest = new SendRawEmailRequest { RawMessage = new RawMessage(GetMessageStream(receiveraddress, senderaddress, subject, attachment)) };
            try
            {
                var response = client.SendRawEmail(sendRequest);
            }
            catch (Exception e) { }
        }
    }
}


问:
copy spreadsheet and his script to a folder
I have an original spreadsheet that contains some functions in the script.
When I make a copy of that file I want to copy also the script not only the file

I use this line of code, but it copies only the file not the file+scripr

```<code> var destFolder = DriveApp.getFolderById(myFolderID);
 DriveApp.getFileById("..........").makeCopy("New Name ",destFolder);
</code>```

Body:
I have an original spreadsheet that contains some functions in the script.
When I make a copy of that file I want to copy also the script not only the file

I use this line of code, but it copies only the file not the file+scripr

 var destFolder = DriveApp.getFolderById(myFolderID);
 DriveApp.getFileById("..........").makeCopy("New Name ",destFolder);


问:
I am not able to write delta table into minio
I am not able to write the delta table into minio.

I am running my spark as master and worker pods in Kubernetes. using Jupyter notebook as driver and minio for storage.

While writing the delta table it is failing

```<code>df1.write.partitionBy(['asset_id']).format("delta").mode("append").option("mergeSchema", "true").save("s3a://test/asset-table")
</code>```

python version: 3.7
pyspark: 3.2.2
java JDK : 8

error:

```<code>23/01/04 07:37:12 WARN TaskSetManager: Lost task 0.0 in stage 5.0 (TID 12) (10.244.28.3 executor 0): java.lang.ClassCastException: cannot assign instance of java.lang.invoke.SerializedLambda to field org.apache.spark.rdd.MapPartitionsRDD.f of type scala.Function3 in instance of org.apache.spark.rdd.MapPartitionsRDD
</code>```

but I am able to write parquet files to minio but not delta table

```<code>df1.write.partitionBy(['asset_id']).format("delta").mode("append").option("mergeSchema", "true").save("s3a://test/asset-table")

Py4JJavaError: An error occurred while calling o195.save.
: org.apache.spark.SparkException: Job aborted.
</code>```

Body:
I am not able to write the delta table into minio.

I am running my spark as master and worker pods in Kubernetes. using Jupyter notebook as driver and minio for storage.

While writing the delta table it is failing

df1.write.partitionBy(['asset_id']).format("delta").mode("append").option("mergeSchema", "true").save("s3a://test/asset-table")

python version: 3.7
pyspark: 3.2.2
java JDK : 8

error:

23/01/04 07:37:12 WARN TaskSetManager: Lost task 0.0 in stage 5.0 (TID 12) (10.244.28.3 executor 0): java.lang.ClassCastException: cannot assign instance of java.lang.invoke.SerializedLambda to field org.apache.spark.rdd.MapPartitionsRDD.f of type scala.Function3 in instance of org.apache.spark.rdd.MapPartitionsRDD

but I am able to write parquet files to minio but not delta table

df1.write.partitionBy(['asset_id']).format("delta").mode("append").option("mergeSchema", "true").save("s3a://test/asset-table")

Py4JJavaError: An error occurred while calling o195.save.
: org.apache.spark.SparkException: Job aborted.


问:
sparkluancher Submit task error command line is too long
I'm submitting the sparkStandalone task using the sparklauncherAPI to submit the task to the spark cluster in the local idea area but I'm having a problem reporting that the command line is too long to submit the task to the sparkStandalone cluster
enter image description here
enter image description here

I modified the configuration of idea and Shorten command line according to the online configuration, but it still has no effect
enter image description here


问:
Selenium open chrome default profile but get an error WebDriverException
I'm trying to open chrome with default browser by Selenium. Once the chrome is opened, the cell output shows an error:

```<code>"WebDriverException"
"Message: unknown error: Chrome failed to start: exited normally.\n  (unknown error: DevToolsActivePort file doesn't exist)\n  (The process started from chrome location C:\\\\Program Files\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)\nStacktrace:\nBacktrace:\n\t(No symbol) [0x00B0F243]\n\t(No symbol) [0x00A97FD1]\n\t(No symbol) [0x0098D04D]\n\t(No symbol) [0x009AC24E]\n\t(No symbol) [0x009A82E9]\n\t(No symbol) [0x009DF056]\n\t(No symbol) [0x009DEB2A]\n\t(No symbol) [0x009D8386]\n\t(No symbol) [0x009B163C]\n\t(No symbol) [0x009B269D]\n\tGetHandleVerifier [0x00DA9A22+2655074]\n\tGetHandleVerifier [0x00D9CA24+2601828]\n\tGetHandleVerifier [0x00BB8C0A+619850]\n\tGetHandleVerifier [0x00BB7830+614768]\n\t(No symbol) [0x00AA05FC]\n\t(No symbol) [0x00AA5968]\n\t(No symbol) [0x00AA5A55]\n\t(No symbol) [0x00AB051B]\n\tBaseThreadInitThunk [0x7579FEF9+25]\n\tRtlGetAppContainerNamedObjectPath [0x77297BBE+286]\n\tRtlGetAppContainerNamedObjectPath [0x77297B8E+238]\n"
</code>```

I also run without profile argument, it works fine. But when profile argument is added, the error occurs.

Chrome version: 108.0.5359.125
Python version: 3.9.12
Selenium version: 4.7.2
Code:

```<code>from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service

chrome_options = Options()

chrome_options.add_argument("--user-data-dir=C:\\Users\\Rattapong.Pojpatin\\AppData\\Local\\Google\\Chrome\\User Data\\") # change to profile path
chrome_options.add_argument('--profile-directory=Profile 2')

browser = webdriver.Chrome(executable_path="D:\\Chromedriver\\chromedriver.exe", chrome_options=chrome_options)
browser.get('https://sellercenter.lazada.co.th/apps/seller/login')
</code>```

Body:
I'm trying to open chrome with default browser by Selenium. Once the chrome is opened, the cell output shows an error:

"WebDriverException"
"Message: unknown error: Chrome failed to start: exited normally.\n  (unknown error: DevToolsActivePort file doesn't exist)\n  (The process started from chrome location C:\\\\Program Files\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)\nStacktrace:\nBacktrace:\n\t(No symbol) [0x00B0F243]\n\t(No symbol) [0x00A97FD1]\n\t(No symbol) [0x0098D04D]\n\t(No symbol) [0x009AC24E]\n\t(No symbol) [0x009A82E9]\n\t(No symbol) [0x009DF056]\n\t(No symbol) [0x009DEB2A]\n\t(No symbol) [0x009D8386]\n\t(No symbol) [0x009B163C]\n\t(No symbol) [0x009B269D]\n\tGetHandleVerifier [0x00DA9A22+2655074]\n\tGetHandleVerifier [0x00D9CA24+2601828]\n\tGetHandleVerifier [0x00BB8C0A+619850]\n\tGetHandleVerifier [0x00BB7830+614768]\n\t(No symbol) [0x00AA05FC]\n\t(No symbol) [0x00AA5968]\n\t(No symbol) [0x00AA5A55]\n\t(No symbol) [0x00AB051B]\n\tBaseThreadInitThunk [0x7579FEF9+25]\n\tRtlGetAppContainerNamedObjectPath [0x77297BBE+286]\n\tRtlGetAppContainerNamedObjectPath [0x77297B8E+238]\n"

I also run without profile argument, it works fine. But when profile argument is added, the error occurs.

Chrome version: 108.0.5359.125
Python version: 3.9.12
Selenium version: 4.7.2
Code:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service

chrome_options = Options()

chrome_options.add_argument("--user-data-dir=C:\\Users\\Rattapong.Pojpatin\\AppData\\Local\\Google\\Chrome\\User Data\\") # change to profile path
chrome_options.add_argument('--profile-directory=Profile 2')

browser = webdriver.Chrome(executable_path="D:\\Chromedriver\\chromedriver.exe", chrome_options=chrome_options)
browser.get('https://sellercenter.lazada.co.th/apps/seller/login')


问:
SQL71005: The reference to the column [106] could not be resolved
This is more annoying then an actual issue, from initially 100's of errors and warning in a visual studio solution the last Rebuild I was left with just 2 identical warnings, and yes they can be suppressed but wondered if anyone else has had a similar issue, appears to be the UNPIVOT and use of an OPENQUERY, and I say all other issues resolved. The Solution builds fine I just prefer no warnings and good housekeeping.

SQL71005: The reference to the column [106] could not be resolved.
SQL71005: The reference to the column [107] could not be resolved.

```<code>SELECT @providerCode AS [Provider_Code]
    , @siteCode AS [Site_Code]
    , @departmentCode AS [Department_Code]
    , @startDate8am AS [Period_DateTime_Start]
    , @endDate8am AS [Period_DateTime_End]
    , [pvt].[items] AS [Metric_ID]
    , CAST([pvt].[Value] AS VARCHAR(255)) AS [Metric_Value]
FROM (
        SELECT SUM(CASE
                    WHEN DATEDIFF([mi], [openq1].[ArrivalDateTime], [openq1].[CompletedDateTime]) > 240
                        THEN 1
                    ELSE 0
                END) AS [106]
                ,SUM(CASE
                    WHEN DATEDIFF([mi], [openq1].[ArrivalDateTime], [openq1].[CompletedDateTime]) > 240
                        THEN 0
                    ELSE 1
                END) AS [107]
        FROM OPENQUERY([HRI-INFOPROD],'SELECT [Patient].[PatientId]
            , [AdmissionEvent].[AdmitDateTime]
            , [AEAttendance].[ArrivalDateTime]
            , [AEAttendance].[CompletedDateTime]
        FROM [dbo].[Patient]
        INNER JOIN [dbo].[AEAttendance]
            ON [AEAttendance].[PatientId] = [Patient].[PatientId]
        INNER JOIN [dbo].[AdmissionEvent]
            ON [Patient].[PatientId] = [AdmissionEvent].[PatientId]
        LEFT JOIN [dummy].[ActivePatient] AS [dummy]
            ON [Patient].[PatientId] = [dummy].[PatientId]
                AND DATEDIFF(HH,[AEAttendance].[CompletedDateTime], [AdmissionEvent].[AdmitDateTime]) BETWEEN -24 AND 24
        WHERE [AdmissionEvent].[ADMTYCode] = ''21''
            AND [AdmissionEvent].[IsCancelled] = 0
            AND [dummy].[PatientId] IS NULL') AS [openq1]
        WHERE [openq1].[AdmitDateTime] >= @startDate8am
            AND [openq1].[AdmitDateTime] < @endDate8am
            AND DATEDIFF([mi], [openq1].[CompletedDateTime], [openq1].[AdmitDateTime]) = (
                                                                                SELECT MIN(DATEDIFF([mi], [openq2].[CompletedDateTime], [openq2].[AdmitDateTime]))
                                                                                FROM OPENQUERY([HRI-INFOPROD],'SELECT [AdmissionEvent].[PatientId]
                                                                                , [AEAttendance].[CompletedDateTime]
                                                                                , [AdmissionEvent].[AdmitDateTime]
                                                                                FROM [dbo].[AdmissionEvent]
                                                                                INNER JOIN [dbo].[AEAttendance]
                                                                                ON [AEAttendance].[PatientId] = [AdmissionEvent].[PatientId]
                                                                                WHERE DATEDIFF([HH],[AEAttendance].[CompletedDateTime], [AdmissionEvent].[AdmitDateTime]) BETWEEN -24 AND 24
                                                                                AND [AdmissionEvent].[ADMTYCode] = ''21''
                                                                                AND [AdmissionEvent].[IsCancelled] = 0') AS [openq2]
                                                                                WHERE [openq2].[PatientId] = [openq1].[PatientId]
                                                                                AND [openq2].[AdmitDateTime] >= @startDate8am
                                                                                AND [openq2].[AdmitDateTime] < @endDate8am
                                                                                )

    ) AS [EDAdmissions]
UNPIVOT ([Value] FOR [items] IN ([106], [107])) AS [pvt];
</code>```

Body:
This is more annoying then an actual issue, from initially 100's of errors and warning in a visual studio solution the last Rebuild I was left with just 2 identical warnings, and yes they can be suppressed but wondered if anyone else has had a similar issue, appears to be the UNPIVOT and use of an OPENQUERY, and I say all other issues resolved. The Solution builds fine I just prefer no warnings and good housekeeping.

SQL71005: The reference to the column [106] could not be resolved.
SQL71005: The reference to the column [107] could not be resolved.

SELECT @providerCode AS [Provider_Code]
    , @siteCode AS [Site_Code]
    , @departmentCode AS [Department_Code]
    , @startDate8am AS [Period_DateTime_Start]
    , @endDate8am AS [Period_DateTime_End]
    , [pvt].[items] AS [Metric_ID]
    , CAST([pvt].[Value] AS VARCHAR(255)) AS [Metric_Value]
FROM (
        SELECT SUM(CASE
                    WHEN DATEDIFF([mi], [openq1].[ArrivalDateTime], [openq1].[CompletedDateTime]) > 240
                        THEN 1
                    ELSE 0
                END) AS [106]
                ,SUM(CASE
                    WHEN DATEDIFF([mi], [openq1].[ArrivalDateTime], [openq1].[CompletedDateTime]) > 240
                        THEN 0
                    ELSE 1
                END) AS [107]
        FROM OPENQUERY([HRI-INFOPROD],'SELECT [Patient].[PatientId]
            , [AdmissionEvent].[AdmitDateTime]
            , [AEAttendance].[ArrivalDateTime]
            , [AEAttendance].[CompletedDateTime]
        FROM [dbo].[Patient]
        INNER JOIN [dbo].[AEAttendance]
            ON [AEAttendance].[PatientId] = [Patient].[PatientId]
        INNER JOIN [dbo].[AdmissionEvent]
            ON [Patient].[PatientId] = [AdmissionEvent].[PatientId]
        LEFT JOIN [dummy].[ActivePatient] AS [dummy]
            ON [Patient].[PatientId] = [dummy].[PatientId]
                AND DATEDIFF(HH,[AEAttendance].[CompletedDateTime], [AdmissionEvent].[AdmitDateTime]) BETWEEN -24 AND 24
        WHERE [AdmissionEvent].[ADMTYCode] = ''21''
            AND [AdmissionEvent].[IsCancelled] = 0
            AND [dummy].[PatientId] IS NULL') AS [openq1]
        WHERE [openq1].[AdmitDateTime] >= @startDate8am
            AND [openq1].[AdmitDateTime] < @endDate8am
            AND DATEDIFF([mi], [openq1].[CompletedDateTime], [openq1].[AdmitDateTime]) = (
                                                                                SELECT MIN(DATEDIFF([mi], [openq2].[CompletedDateTime], [openq2].[AdmitDateTime]))
                                                                                FROM OPENQUERY([HRI-INFOPROD],'SELECT [AdmissionEvent].[PatientId]
                                                                                , [AEAttendance].[CompletedDateTime]
                                                                                , [AdmissionEvent].[AdmitDateTime]
                                                                                FROM [dbo].[AdmissionEvent]
                                                                                INNER JOIN [dbo].[AEAttendance]
                                                                                ON [AEAttendance].[PatientId] = [AdmissionEvent].[PatientId]
                                                                                WHERE DATEDIFF([HH],[AEAttendance].[CompletedDateTime], [AdmissionEvent].[AdmitDateTime]) BETWEEN -24 AND 24
                                                                                AND [AdmissionEvent].[ADMTYCode] = ''21''
                                                                                AND [AdmissionEvent].[IsCancelled] = 0') AS [openq2]
                                                                                WHERE [openq2].[PatientId] = [openq1].[PatientId]
                                                                                AND [openq2].[AdmitDateTime] >= @startDate8am
                                                                                AND [openq2].[AdmitDateTime] < @endDate8am
                                                                                )

    ) AS [EDAdmissions]
UNPIVOT ([Value] FOR [items] IN ([106], [107])) AS [pvt];


问:
JAVA_HOME not found in your environment
enter image description here

How can I fix this i even tried reinstalling jdk and setting up Environment variables but still the error is unresolved

Title: JAVA_HOME not found in your environment