问:
Prepare ubuntu to vuejs project
I have a vuejs project done with windows. I intent migrate to linux ubuntu.
So, I have now a Ubuntu as my dev machine.
I used git and cloned the project.
After I issue a npm install, I get some errors as:</p>
```<code>...
 npm WARN deprecated @types/browserslist@4.15.0: This is a stub types definition. browserslist provides its own type definitions, so you do not need this installed.
npm WARN deprecated @types/anymatch@3.0.0: This is a stub types definition. anymatch provides its own type definitions, so you do not need this installed.
npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command /home/luiz/.nvm/versions/node/v18.12.0/bin/node /home/luiz/.nvm/versions/node/v18.12.0/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/home/luiz/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN ERESOLVE overriding peer dependency
npm ERR! npm WARN While resolving: gulp-better-rollup@4.0.1
npm ERR! npm WARN Found: rollup@2.35.1
npm ERR! npm WARN node_modules/rollup
npm ERR! npm WARN   dev rollup@"^2.35.1" from the root project
npm ERR! npm WARN   3 more (rollup-plugin-babel, rollup-plugin-commonjs, rollup-plugin-node-resolve)
npm ERR! npm WARN
npm ERR! npm WARN Could not resolve dependency:
npm ERR! npm WARN peer rollup@"^1.4.1" from gulp-better-rollup@4.0.1
npm ERR! npm WARN node_modules/gulp-better-rollup
npm ERR! npm WARN   dev gulp-better-rollup@"^4.0.1" from the root project
npm ERR! npm WARN
npm ERR! npm WARN Conflicting peer dependency: rollup@1.32.1
npm ERR! npm WARN node_modules/rollup
npm ERR! npm WARN   peer rollup@"^1.4.1" from gulp-better-rollup@4.0.1
npm ERR! npm WARN   node_modules/gulp-better-rollup
npm ERR! npm WARN     dev gulp-better-rollup@"^4.0.1" from the root project
npm ERR! npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm ERR! npm WARN deprecated @stylelint/postcss-markdown@0.36.2: Use the original unforked package instead: postcss-markdown
npm ERR! npm WARN deprecated har-validator@5.1.3: this library is no longer supported
npm ERR! npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
npm ERR! npm WARN deprecated libnpmconfig@1.2.1: This module is not used anymore. npm config is parsed by npm itself and by @npmcli/config
npm ERR! npm WARN deprecated plugin-log@0.1.0: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm ERR! npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm ERR! npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm ERR! npm WARN deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm ERR! npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm ERR! npm WARN deprecated rollup-plugin-no

</code>```

Title: Prepare ubuntu to vuejs project

Body:
I have a vuejs project done with windows. I intent migrate to linux ubuntu.
So, I have now a Ubuntu as my dev machine.
I used git and cloned the project.
After I issue a npm install, I get some errors as:

...
 npm WARN deprecated @types/browserslist@4.15.0: This is a stub types definition. browserslist provides its own type definitions, so you do not need this installed.
npm WARN deprecated @types/anymatch@3.0.0: This is a stub types definition. anymatch provides its own type definitions, so you do not need this installed.
npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command /home/luiz/.nvm/versions/node/v18.12.0/bin/node /home/luiz/.nvm/versions/node/v18.12.0/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/home/luiz/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN ERESOLVE overriding peer dependency
npm ERR! npm WARN While resolving: gulp-better-rollup@4.0.1
npm ERR! npm WARN Found: rollup@2.35.1
npm ERR! npm WARN node_modules/rollup
npm ERR! npm WARN   dev rollup@"^2.35.1" from the root project
npm ERR! npm WARN   3 more (rollup-plugin-babel, rollup-plugin-commonjs, rollup-plugin-node-resolve)
npm ERR! npm WARN
npm ERR! npm WARN Could not resolve dependency:
npm ERR! npm WARN peer rollup@"^1.4.1" from gulp-better-rollup@4.0.1
npm ERR! npm WARN node_modules/gulp-better-rollup
npm ERR! npm WARN   dev gulp-better-rollup@"^4.0.1" from the root project
npm ERR! npm WARN
npm ERR! npm WARN Conflicting peer dependency: rollup@1.32.1
npm ERR! npm WARN node_modules/rollup
npm ERR! npm WARN   peer rollup@"^1.4.1" from gulp-better-rollup@4.0.1
npm ERR! npm WARN   node_modules/gulp-better-rollup
npm ERR! npm WARN     dev gulp-better-rollup@"^4.0.1" from the root project
npm ERR! npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm ERR! npm WARN deprecated @stylelint/postcss-markdown@0.36.2: Use the original unforked package instead: postcss-markdown
npm ERR! npm WARN deprecated har-validator@5.1.3: this library is no longer supported
npm ERR! npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
npm ERR! npm WARN deprecated libnpmconfig@1.2.1: This module is not used anymore. npm config is parsed by npm itself and by @npmcli/config
npm ERR! npm WARN deprecated plugin-log@0.1.0: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm ERR! npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm ERR! npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm ERR! npm WARN deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm ERR! npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm ERR! npm WARN deprecated rollup-plugin-no


来源: stackexchange

问:
Create images composed of both png's and jpegs nodejs
Is it possible to combine png's and jpegs in the same image? when I attempt to do so, the server just crashes. Not the server, but repl.it, which I host it on.

```<code>  jimp.read(req.file.buffer, (err, fir_img) => {
                                  if(err) {
                                      console.log(err);
                                      res.send({status: "error"})

                                  } else {
                                      jimp.read(file10.location[0], (err, sec_img) => {
                                          if(err) {
                                              console.log(err);
                                            res.send({status: "error"})
                                          } else {
                                              sec_img.resize((image.bitmap.height*pixelMultiplier)/10, (pixelMultiplier*image.bitmap.height)/10);
                                              fir_img.composite( sec_img, Math.round(pixelMultiplier*FINALX), Math.round(pixelMultiplier*FINALY));
                                             fir_img.write('new_imgae14.png');
</code>```

Its all good and smooth, all working fine, up until fir_img.write, when it then shatters into a million pieces and the only response I get is "replit's signal has been killed".

Is there a way to make jpeg and png in the same image, or must I just convert the jpeg to a png then do it?

ContentLicense: CC BY-SA 4.0

Body:
Is it possible to combine png's and jpegs in the same image? when I attempt to do so, the server just crashes. Not the server, but repl.it, which I host it on.

  jimp.read(req.file.buffer, (err, fir_img) => {
                                  if(err) {
                                      console.log(err);
                                      res.send({status: "error"})

                                  } else {
                                      jimp.read(file10.location[0], (err, sec_img) => {
                                          if(err) {
                                              console.log(err);
                                            res.send({status: "error"})
                                          } else {
                                              sec_img.resize((image.bitmap.height*pixelMultiplier)/10, (pixelMultiplier*image.bitmap.height)/10);
                                              fir_img.composite( sec_img, Math.round(pixelMultiplier*FINALX), Math.round(pixelMultiplier*FINALY));
                                             fir_img.write('new_imgae14.png');

Its all good and smooth, all working fine, up until fir_img.write, when it then shatters into a million pieces and the only response I get is "replit's signal has been killed".

Is there a way to make jpeg and png in the same image, or must I just convert the jpeg to a png then do it?


问:
How to update multiple documents in mongodb using Golang
I am trying to update a collection of multiple data in MongoDB using Golang at the same time, instead, it updates only one record, I'm using a for loop to perform this action

My filter code

```<code>if len(list_phone) > 1 {
        for i := 0; i < len(list_phone); i++ {
            update_userPhone, err := helpers.UpdatePhone(list_phone[i]["phone"].(string), list_phone[i]["email"].(string))
            if err != nil {
                w.WriteHeader(http.StatusInternalServerError)
                w.Write([]byte(`{"status:":"error", "error": true, "msg": "Something went wrong" }`))
                return
            }
            json.NewEncoder(w).Encode(update_userPhone)
            return
        }
    }
</code>```

my update function

```<code>func UpdatePhone(phone string, email string) (bool, error) {
    userCollection, _ := GetDBCollection("users")
    ctx, cancel := context.WithTimeout(context.Background(), 100*time.Second)
    id := email
    filter := bson.M{"email": id}
    update := bson.M{"$set": bson.M{"phone": phone}}

    _, err := userCollection.UpdateOne(ctx, filter, update)
    defer cancel()

    if err != nil {
        return false, err
    }
    return true, err
}
</code>```

Body:
I am trying to update a collection of multiple data in MongoDB using Golang at the same time, instead, it updates only one record, I'm using a for loop to perform this action

My filter code

if len(list_phone) > 1 {
        for i := 0; i < len(list_phone); i++ {
            update_userPhone, err := helpers.UpdatePhone(list_phone[i]["phone"].(string), list_phone[i]["email"].(string))
            if err != nil {
                w.WriteHeader(http.StatusInternalServerError)
                w.Write([]byte(`{"status:":"error", "error": true, "msg": "Something went wrong" }`))
                return
            }
            json.NewEncoder(w).Encode(update_userPhone)
            return
        }
    }

my update function

func UpdatePhone(phone string, email string) (bool, error) {
    userCollection, _ := GetDBCollection("users")
    ctx, cancel := context.WithTimeout(context.Background(), 100*time.Second)
    id := email
    filter := bson.M{"email": id}
    update := bson.M{"$set": bson.M{"phone": phone}}

    _, err := userCollection.UpdateOne(ctx, filter, update)
    defer cancel()

    if err != nil {
        return false, err
    }
    return true, err
}


问:
Xmlsec - key is not found [ECDSA, DSA]
I am trying to sign an XML, I can successfully do this with RSA, but can't seem to sign it with ECDSA or DSA. For this example, I am trying ECDSA. Any help will be appreciated.

The error I am getting:

```<code>func=xmlSecKeysMngrGetKey:file=keys.c:line=1253:obj=unknown:subj=xmlSecKeysMngrFindKey:error=1:xmlsec library function failed:
func=xmlSecDSigCtxProcessKeyInfoNode:file=xmldsig.c:line=793:obj=unknown:subj=unknown:error=45:key is not found:details=NULL
func=xmlSecDSigCtxProcessSignatureNode:file=xmldsig.c:line=508:obj=unknown:subj=xmlSecDSigCtxProcessKeyInfoNode:error=1:xmlsec library function failed:
func=xmlSecDSigCtxSign:file=xmldsig.c:line=291:obj=unknown:subj=xmlSecDSigCtxProcessSignatureNode:error=1:xmlsec library function failed:
Error: signature failed
Error: failed to sign file "raw.xml"
</code>```

The command I am running in Ubuntu 22.04 (xmlsec1 1.2.33 (openssl))

```<code>xmlsec1 --sign --output request-signed.xml --privkey-pem secp384r1.pem raw.xml
</code>```

Key and x509 certificate generation command:

```<code>openssl ecparam -name secp256r1 -genkey -noout -out secp384r1.pem
openssl req -new -key secp384r1.pem -x509 -nodes -days 365 -out cert.pem
</code>```

The raw.xml

```<code><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:ebs="http://ebs.health.ontario.ca/" xmlns:idp="http://idp.ebs.health.ontario.ca/"
xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://hcv.health.ontario.ca/">
<SOAP-ENV:Header>
    <wsse:Security mustUnderstand="true">
        <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">\n<SignedInfo>\n<CanonicalizationMethod
                    Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />\n<SignatureMethod
                    Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />\n<Reference
                    URI="#id-61b15061-d275-40bf-9ca0-ecc684158a3b">\n<Transforms>\n<Transform
                            Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />\n</Transforms>
            \n<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />\n<DigestValue />
            \n</Reference>\n<Reference URI="#id-68662a30-bb75-4261-a255-5fea0515ae44">\n<Transforms>
            \n<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />\n</Transforms>\n<DigestMethod
                        Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />\n<DigestValue />\n</Reference>
            \n<Reference URI="#id-49d3b458-cf41-483b-9d55-8b4692078014">\n<Transforms>\n<Transform
                            Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />\n</Transforms>
            \n<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />\n<DigestValue />
            \n</Reference>\n<Reference URI="#id-2ac9f68c-e1b5-4e04-bf08-9950e4d1ca8f">\n<Transforms>
            \n<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />\n</Transforms>\n<DigestMethod
                        Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />\n<DigestValue />\n</Reference>
            \n<Reference URI="#id-e6adeae4-ef18-4c22-ba7e-f7b17d7ab24c">\n<Transforms>\n<Transform
                            Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />\n</Transforms>
            \n<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />\n<DigestValue />
            \n</Reference>\n</SignedInfo>\n<SignatureValue />\n<KeyInfo>\n<X509Data>
                    <X509IssuerSerial />
                    <X509Certificate />
                </X509Data>\n</KeyInfo>\n</Signature>
        <wsu:Timestamp wsu:Id="id-68662a30-bb75-4261-a255-5fea0515ae44">
            <wsu:Created>2023-01-11T14:44:05.335752+00:00</wsu:Created>
            <wsu:Expires>2023-01-11T14:45:35.335752+00:00</wsu:Expires>
        </wsu:Timestamp>
        <wsse:UsernameToken wsu:Id="id-e6adeae4-ef18-4c22-ba7e-f7b17d7ab24c">
            <wsse:Username>confsu+435@gmail.com</wsse:Username>
            <wsse:Password>Password2!</wsse:Password>
        </wsse:UsernameToken>
    </wsse:Security>
    <ebs:EBS wsu:Id="id-49d3b458-cf41-483b-9d55-8b4692078014">
        <SoftwareConformanceKey>2ec86c34-fdd2-435d-b5e3-dcb306855096</SoftwareConformanceKey>
        <AuditId>63840137-4c16-43f2-bae9-82710391240b</AuditId>
    </ebs:EBS>
    <idp:IDP wsu:Id="id-2ac9f68c-e1b5-4e04-bf08-9950e4d1ca8f">
        <ServiceUserMUID>622100</ServiceUserMUID>
    </idp:IDP>
</SOAP-ENV:Header>
<ns0:Body wsu:Id="id-61b15061-d275-40bf-9ca0-ecc684158a3b">
    <ns1:validate>
        <requests>
            <hcvRequest>
                <healthNumber>9287170261</healthNumber>
                <versionCode>DK</versionCode>
            </hcvRequest>
        </requests>
        <locale>en</locale>
    </ns1:validate>
</ns0:Body>
</SOAP-ENV:Envelope>
</code>```

Title: Xmlsec - key is not found [ECDSA, DSA]

Body:
I am trying to sign an XML, I can successfully do this with RSA, but can't seem to sign it with ECDSA or DSA. For this example, I am trying ECDSA. Any help will be appreciated.

The error I am getting:

func=xmlSecKeysMngrGetKey:file=keys.c:line=1253:obj=unknown:subj=xmlSecKeysMngrFindKey:error=1:xmlsec library function failed:
func=xmlSecDSigCtxProcessKeyInfoNode:file=xmldsig.c:line=793:obj=unknown:subj=unknown:error=45:key is not found:details=NULL
func=xmlSecDSigCtxProcessSignatureNode:file=xmldsig.c:line=508:obj=unknown:subj=xmlSecDSigCtxProcessKeyInfoNode:error=1:xmlsec library function failed:
func=xmlSecDSigCtxSign:file=xmldsig.c:line=291:obj=unknown:subj=xmlSecDSigCtxProcessSignatureNode:error=1:xmlsec library function failed:
Error: signature failed
Error: failed to sign file "raw.xml"

The command I am running in Ubuntu 22.04 (xmlsec1 1.2.33 (openssl))

xmlsec1 --sign --output request-signed.xml --privkey-pem secp384r1.pem raw.xml

Key and x509 certificate generation command:

openssl ecparam -name secp256r1 -genkey -noout -out secp384r1.pem
openssl req -new -key secp384r1.pem -x509 -nodes -days 365 -out cert.pem

The raw.xml

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:ebs="http://ebs.health.ontario.ca/" xmlns:idp="http://idp.ebs.health.ontario.ca/"
xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://hcv.health.ontario.ca/">
<SOAP-ENV:Header>
    <wsse:Security mustUnderstand="true">
        <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">\n<SignedInfo>\n<CanonicalizationMethod
                    Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />\n<SignatureMethod
                    Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />\n<Reference
                    URI="#id-61b15061-d275-40bf-9ca0-ecc684158a3b">\n<Transforms>\n<Transform
                            Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />\n</Transforms>
            \n<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />\n<DigestValue />
            \n</Reference>\n<Reference URI="#id-68662a30-bb75-4261-a255-5fea0515ae44">\n<Transforms>
            \n<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />\n</Transforms>\n<DigestMethod
                        Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />\n<DigestValue />\n</Reference>
            \n<Reference URI="#id-49d3b458-cf41-483b-9d55-8b4692078014">\n<Transforms>\n<Transform
                            Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />\n</Transforms>
            \n<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />\n<DigestValue />
            \n</Reference>\n<Reference URI="#id-2ac9f68c-e1b5-4e04-bf08-9950e4d1ca8f">\n<Transforms>
            \n<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />\n</Transforms>\n<DigestMethod
                        Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />\n<DigestValue />\n</Reference>
            \n<Reference URI="#id-e6adeae4-ef18-4c22-ba7e-f7b17d7ab24c">\n<Transforms>\n<Transform
                            Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />\n</Transforms>
            \n<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />\n<DigestValue />
            \n</Reference>\n</SignedInfo>\n<SignatureValue />\n<KeyInfo>\n<X509Data>
                    <X509IssuerSerial />
                    <X509Certificate />
                </X509Data>\n</KeyInfo>\n</Signature>
        <wsu:Timestamp wsu:Id="id-68662a30-bb75-4261-a255-5fea0515ae44">
            <wsu:Created>2023-01-11T14:44:05.335752+00:00</wsu:Created>
            <wsu:Expires>2023-01-11T14:45:35.335752+00:00</wsu:Expires>
        </wsu:Timestamp>
        <wsse:UsernameToken wsu:Id="id-e6adeae4-ef18-4c22-ba7e-f7b17d7ab24c">
            <wsse:Username>confsu+435@gmail.com</wsse:Username>
            <wsse:Password>Password2!</wsse:Password>
        </wsse:UsernameToken>
    </wsse:Security>
    <ebs:EBS wsu:Id="id-49d3b458-cf41-483b-9d55-8b4692078014">
        <SoftwareConformanceKey>2ec86c34-fdd2-435d-b5e3-dcb306855096</SoftwareConformanceKey>
        <AuditId>63840137-4c16-43f2-bae9-82710391240b</AuditId>
    </ebs:EBS>
    <idp:IDP wsu:Id="id-2ac9f68c-e1b5-4e04-bf08-9950e4d1ca8f">
        <ServiceUserMUID>622100</ServiceUserMUID>
    </idp:IDP>
</SOAP-ENV:Header>
<ns0:Body wsu:Id="id-61b15061-d275-40bf-9ca0-ecc684158a3b">
    <ns1:validate>
        <requests>
            <hcvRequest>
                <healthNumber>9287170261</healthNumber>
                <versionCode>DK</versionCode>
            </hcvRequest>
        </requests>
        <locale>en</locale>
    </ns1:validate>
</ns0:Body>
</SOAP-ENV:Envelope>


问:
PHP Prepared Statement not inserting, no errors appearing
I am attempting to insert some data via prepared statements in PHP.  I have the following code which is not inserting for me.  I also have the following code set already

```<code>ini_set('display_errors', 1);

error_reporting(~0);

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
</code>```

             try {
                $sqlInsert = "INSERT INTO deck_cards (deckid, cardid, qty) VALUES (?,?,?)";
                $stmtInsert = $conn->prepare($sqlInsert);

                if ($stmtInsert)
                {
                    $stmtInsert->bind_param("sss", $deckid, $cardid, $cardcount) or trigger_error($stmtInsert->error, E_USER_ERROR);
                    $stmtInsert->execute() or trigger_error($stmtInsert->error, E_USER_ERROR);
                    echo "Check if this ran";
                }
                else {
                    echo "Error: " . $sql . "
" . $conn->error;
                    $conn->close();
                }

                $stmtInsert->close();
            }
            catch (Exception $ex)
            {
                echo 'Exception occurred '.$ex->getTraceAsString();
            }
```

When this executes, I do see the text "Check if this ran" but no other messages.  The data is not inserted into the database.  Additionally, I echo'd the sql string and variables and ran it against the MySQL directly and it inserted ok.  Not sure what is happening in my very straightforward code above.

Additionally, inserts are happening ok in other pages within my app, but this page for some reason isn't working.

I know it's overkill on my error reporting, but I threw everything I could think of to see if there is an error somewhere, but this one is a head scratcher for me.  Thanks for any assistance!

Body:
I am attempting to insert some data via prepared statements in PHP.  I have the following code which is not inserting for me.  I also have the following code set already

ini_set('display_errors', 1);

error_reporting(~0);

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);

             try {
                $sqlInsert = "INSERT INTO deck_cards (deckid, cardid, qty) VALUES (?,?,?)";
                $stmtInsert = $conn->prepare($sqlInsert);

                if ($stmtInsert)
                {
                    $stmtInsert->bind_param("sss", $deckid, $cardid, $cardcount) or trigger_error($stmtInsert->error, E_USER_ERROR);
                    $stmtInsert->execute() or trigger_error($stmtInsert->error, E_USER_ERROR);
                    echo "Check if this ran";
                }
                else {
                    echo "Error: " . $sql . "
" . $conn->error;
                    $conn->close();
                }

                $stmtInsert->close();
            }
            catch (Exception $ex)
            {
                echo 'Exception occurred '.$ex->getTraceAsString();
            }

When this executes, I do see the text "Check if this ran" but no other messages.  The data is not inserted into the database.  Additionally, I echo'd the sql string and variables and ran it against the MySQL directly and it inserted ok.  Not sure what is happening in my very straightforward code above.

Additionally, inserts are happening ok in other pages within my app, but this page for some reason isn't working.

I know it's overkill on my error reporting, but I threw everything I could think of to see if there is an error somewhere, but this one is a head scratcher for me.  Thanks for any assistance!


问:
Show Waveform in Timeline using Extendscript for After Effects
I'm creating a script that will create a whole bunch (hundreds) of AE comps and fills them with items etc.

When I go in to edit these comps I always set the same view options over and over before doing the editing. Namely, I show the opacity (shortcut: T - ) then hold shift and press 'LL' to show the waveform, then wait a second and press 'L' again to show the audio keyframes.

I'm looking to set this as the default view for every comp I enter... How can I do this?

I've tried something like:

```<code>    var item = app.property.activeItem;
    item.property("Opacity").enabled = true;
</code>```

But no luck!

Body:
I'm creating a script that will create a whole bunch (hundreds) of AE comps and fills them with items etc.

When I go in to edit these comps I always set the same view options over and over before doing the editing. Namely, I show the opacity (shortcut: T - ) then hold shift and press 'LL' to show the waveform, then wait a second and press 'L' again to show the audio keyframes.

I'm looking to set this as the default view for every comp I enter... How can I do this?

I've tried something like:

    var item = app.property.activeItem;
    item.property("Opacity").enabled = true;

But no luck!


问:
how to serialize dynamic json object with yamldotnet
i'm trying to creating yaml file from json using with YamlDotNet library, but i need to use dynamic object because i don't know what type of object they will send me,

I created base class for serialization like this:

```<code>public class plugins
{
     public string name { get; set; }
     public object config { get; set; }
}
</code>```

EDIT
It worked when I edited it as StriplingWarrior said.

```<code>public class plugins
{
     public string name { get; set; }
     public IDictionary<string, object> config { get; set; }
}
</code>```

EDIT 2

i don't know my json file how will be like because of that i tried to use dynamic, when i use IDictionary<string, object> it's worked but when my json data have list inside list, result again empty, how i need to change my class or i need to write my own Converter?

    {
        "name": "correlation-id",
        "config": {
            "add": {
                "headers": [
                    "content-encoding:deflate,gzip",
                    "accept-encoding:deflate,gzip;q=1.0,*;q=0.5%"
                ]
            }
        }
    }
```
<p>Result:</p>
<pre class="lang-yaml prettyprint-override"><code>    plugins:
    - name: correlation-id
      config:
        generator: uuid
        header_name: Aura-Correlation-Id
        echo_downstream: true
    - name: correlation-id
      config:
        config: data
        header_name: Aura-Correlation-Id
        val3: true
    - name: correlation-id
      config:
        add:
          headers:
          - []
          - []
</code>```

EDIT 2 END

And my json values like that:

```<code>[
    {
        "name": "corr-id",
        "config": {
            "generator": "uuid",
            "header_name": "-Id",
            "echo_downstream": true
        }
    },
    {
        "name": "cation-id2",
        "config": {
            "val4": "val3",
            "header_name": "Aura-Id",
            "echo_downstream": true,
            "title": "kube"
        }
    },
    {
        "name": "ation-id2",
        "config": {
            "val1": "val2",
            "title": "val3"
        }
    },
    {
        "name": "ati2",
        "config": {
            "contact": "some val",
            "group": "lenght",
            "title": "transform"
        }
    }
]
</code>```

Final result like that:

```<code>    plugins:

    - name: corr-id

      config:

        generator: []

        header_name: []

        echo_downstream: &o0 []

    - name: cation-id2

      config:

        val4: &o1 []

        header_name: []

        echo_downstream: *o0

        title: []

    - name: ation-id2

      config:

        val1: []

        title: *o1

    - name: ati2

      config:

        contact: []

        group: []

        title: []

</code>```

I tried send to serializer json string but returned to me same data and i also tried made new JObject and add all values this object but it didnt worked.

Body:
i'm trying to creating yaml file from json using with YamlDotNet library, but i need to use dynamic object because i don't know what type of object they will send me,

I created base class for serialization like this:

public class plugins
{
     public string name { get; set; }
     public object config { get; set; }
}

EDIT
It worked when I edited it as StriplingWarrior said.

public class plugins
{
     public string name { get; set; }
     public IDictionary<string, object> config { get; set; }
}

EDIT 2

i don't know my json file how will be like because of that i tried to use dynamic, when i use IDictionary<string, object> it's worked but when my json data have list inside list, result again empty, how i need to change my class or i need to write my own Converter?

    {
        "name": "correlation-id",
        "config": {
            "add": {
                "headers": [
                    "content-encoding:deflate,gzip",
                    "accept-encoding:deflate,gzip;q=1.0,*;q=0.5%"
                ]
            }
        }
    }

Result:

    plugins:
    - name: correlation-id
      config:
        generator: uuid
        header_name: Aura-Correlation-Id
        echo_downstream: true
    - name: correlation-id
      config:
        config: data
        header_name: Aura-Correlation-Id
        val3: true
    - name: correlation-id
      config:
        add:
          headers:
          - []
          - []

EDIT 2 END

And my json values like that:

[
    {
        "name": "corr-id",
        "config": {
            "generator": "uuid",
            "header_name": "-Id",
            "echo_downstream": true
        }
    },
    {
        "name": "cation-id2",
        "config": {
            "val4": "val3",
            "header_name": "Aura-Id",
            "echo_downstream": true,
            "title": "kube"
        }
    },
    {
        "name": "ation-id2",
        "config": {
            "val1": "val2",
            "title": "val3"
        }
    },
    {
        "name": "ati2",
        "config": {
            "contact": "some val",
            "group": "lenght",
            "title": "transform"
        }
    }
]

Final result like that:

    plugins:

    - name: corr-id

      config:

        generator: []

        header_name: []

        echo_downstream: &o0 []

    - name: cation-id2

      config:

        val4: &o1 []

        header_name: []

        echo_downstream: *o0

        title: []

    - name: ation-id2

      config:

        val1: []

        title: *o1

    - name: ati2

      config:

        contact: []

        group: []

        title: []

I tried send to serializer json string but returned to me same data and i also tried made new JObject and add all values this object but it didnt worked.


问:
ActivityScenario.launch not returning control flow / hanging
I have an issue where ActivityScenario.launch is not returning control flow, but hanging. This create an issue where the test cases are not run and the test just sits indefinitely.

I am using koin, robolectric, jetpack components, and LiveData

The code is below. The Activity never reaches onPause or appears to crash.

```<code>@RunWith(RobolectricTestRunner::class)
@Config(instrumentedPackages = ["androidx.loader.content"], application = Application::class)
class MainActivityTest {

@get:Rule
var rule: TestRule = InstantTaskExecutorRule()

@get:Rule
val coroutineRule = MainCoroutineRule()

private val viewModel: MainActivityViewModel = mockk(relaxed = true)
private val homeViewModel: HomeViewModel = mockk<HomeViewModel>(relaxed = true).apply {
    every { homeState } returns MutableStateFlow(HomeState(UiState.Loading))
}
val module = module {
    viewModel { viewModel }
    viewModel { homeViewModel }
}

private lateinit var activityScenarioRule: ActivityScenario<MainActivity>

@Before
fun setUp() {
    startKoin {
        androidContext(ApplicationProvider.getApplicationContext<Application>())
        modules(testAppModules + module)
    }

    activityScenarioRule = ActivityScenario.launch(MainActivity::class.java)
}

@Test
fun onNewIntent() {
    activityScenarioRule.result
    activityScenarioRule.onActivity {
        assertThat(it).isNotNull()
    }
}
</code>```

}

Body:
I have an issue where ActivityScenario.launch is not returning control flow, but hanging. This create an issue where the test cases are not run and the test just sits indefinitely.

I am using koin, robolectric, jetpack components, and LiveData

The code is below. The Activity never reaches onPause or appears to crash.

@RunWith(RobolectricTestRunner::class)
@Config(instrumentedPackages = ["androidx.loader.content"], application = Application::class)
class MainActivityTest {

@get:Rule
var rule: TestRule = InstantTaskExecutorRule()

@get:Rule
val coroutineRule = MainCoroutineRule()

private val viewModel: MainActivityViewModel = mockk(relaxed = true)
private val homeViewModel: HomeViewModel = mockk<HomeViewModel>(relaxed = true).apply {
    every { homeState } returns MutableStateFlow(HomeState(UiState.Loading))
}
val module = module {
    viewModel { viewModel }
    viewModel { homeViewModel }
}

private lateinit var activityScenarioRule: ActivityScenario<MainActivity>

@Before
fun setUp() {
    startKoin {
        androidContext(ApplicationProvider.getApplicationContext<Application>())
        modules(testAppModules + module)
    }

    activityScenarioRule = ActivityScenario.launch(MainActivity::class.java)
}

@Test
fun onNewIntent() {
    activityScenarioRule.result
    activityScenarioRule.onActivity {
        assertThat(it).isNotNull()
    }
}

}


问:
Cannot run migration from Django on Docker to MariaDB installed on host
I created a Django project running on Docker, and I successfully connected from the container to the host MariaDB server as an URL host.docker.internal:3306 with the command sudo docker run -p 8000:8000 --add-host=host.docker.internal:host-gateway -d kms1212/jsis:latest. But due to several problems(I can't remember why I did it), I removed the original database, created a new database, and modified settings.py. Then I ran the modified Docker image that is built from Dockerfile:

```<code>FROM ubuntu:22.04

ENV PYTHONUNBUFFERED 1

RUN apt-get -y update
RUN apt-get -y install build-essential python-is-python3 pip mysql-client libmysqlclient-dev

RUN mkdir /usr/local/workdir
WORKDIR /usr/local/workdir

COPY requirements.txt .

RUN pip install --upgrade pip
RUN pip install -r requirements.txt

COPY jsis .

EXPOSE 8000
CMD ["bash", "-c", "python manage.py makemigrations && python manage.py showmigrations && python manage.py migrate && gunicorn --bind 0.0.0.0:8000 -k uvicorn.workers.UvicornWorker jsis.asgi:application"]
</code>```

I dropped and recreated the database and checked that no old constraints and tables were left, but despite my effort, I got some error messages from the container log like this eventually:

```<code>No changes detected
admin
 [ ] 0001_initial
 [ ] 0002_logentry_remove_auto_add
 [ ] 0003_logentry_add_action_flag_choices
auth
 [ ] 0001_initial
 [ ] 0002_alter_permission_name_max_length
 [ ] 0003_alter_user_email_max_length
 [ ] 0004_alter_user_username_opts
 [ ] 0005_alter_user_last_login_null
 [ ] 0006_require_contenttypes_0002
 [ ] 0007_alter_validators_add_error_messages
 [ ] 0008_alter_user_username_max_length
 [ ] 0009_alter_user_last_name_max_length
 [ ] 0010_alter_group_name_max_length
 [ ] 0011_update_proxy_permissions
 [ ] 0012_alter_user_first_name_max_length
contenttypes
 [ ] 0001_initial
 [ ] 0002_remove_content_type_name
sessions
 [ ] 0001_initial
sites
 [ ] 0001_initial
 [ ] 0002_alter_domain_unique
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions, sites
Running migrations:
  Applying contenttypes.0001_initial... OK
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/mysql/base.py", line 75, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/connections.py", line 254, in query
    _mysql.connection.query(self, query)
MySQLdb.OperationalError: (1005, 'Can\'t create table `jsisdb`.`django_admin_log` (errno: 150 "Foreign key constraint is incorrectly formed")')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/workdir/manage.py", line 22, in <module>
    main()
  File "/usr/local/workdir/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 402, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 448, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 96, in wrapped
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/commands/migrate.py", line 349, in handle
    post_migrate_state = executor.migrate(
  File "/usr/local/lib/python3.10/dist-packages/django/db/migrations/executor.py", line 135, in migrate
    state = self._migrate_all_forwards(
  File "/usr/local/lib/python3.10/dist-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
    state = self.apply_migration(
  File "/usr/local/lib/python3.10/dist-packages/django/db/migrations/executor.py", line 249, in apply_migration
    with self.connection.schema_editor(
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/base/schema.py", line 164, in __exit__
    self.execute(sql)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/base/schema.py", line 199, in execute
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 103, in execute
    return super().execute(sql, params)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
  File "/usr/local/lib/python3.10/dist-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/mysql/base.py", line 75, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/connections.py", line 254, in query
    _mysql.connection.query(self, query)
django.db.utils.OperationalError: (1005, 'Can\'t create table `jsisdb`.`django_admin_log` (errno: 150 "Foreign key constraint is incorrectly formed")')
</code>```

(+ Edit)And this is model code:

```<code>class UserPermissions(models.IntegerChoices):
    USER = 0
    HQ = 1
    TEACHER = 2
    OTHER = 3

class UserAccountManager(BaseUserManager):
    def create_user(self, username, email, visiblename, agreement_status, password=None):
        if not email:
            raise ValueError('Users must have an email address')
        if not username:
            raise ValueError('Users must have a username')
        if not visiblename:
            raise ValueError('Users must have a visible name')

        user = self.model(
            username=username,
            email=self.normalize_email(email),
            visiblename=visiblename,
            agreement_status=agreement_status,
        )

        user.set_password(password)
        user.save(using=self._db)
        return user

    def create_superuser(self, username, email, visiblename, agreement_status, password):
        user = self.create_user(
            username=username,
            email=self.normalize_email(email),
            visiblename=visiblename,
            agreement_status=agreement_status,
            password=password,
        )

        user.is_admin = True
        user.permission = UserPermissions.OTHER

        user.save(using=self._db)
        return user

class UserAccount(AbstractBaseUser):
    userid = models.AutoField(primary_key=True)
    username = models.CharField(max_length=20, unique=True)
    visiblename = models.CharField(max_length=40, unique=True)
    email = models.EmailField(max_length=255, unique=True)
    permission = models.IntegerField(default=UserPermissions.USER, choices=UserPermissions.choices)
    agreement_status = models.JSONField()
    date_joined = models.DateTimeField(auto_now_add=True)
    date_lastlogin = models.DateTimeField(auto_now=True)
    is_active = models.BooleanField(default=True)
    is_blocked = models.BooleanField(default=False)
    is_blocked_anon = models.BooleanField(default=False)
    block_reason = models.TextField(default="", blank=True)
    is_admin = models.BooleanField(default=False)

    USERNAME_FIELD = 'username'
    EMAIL_FIELD = 'email'
    REQUIRED_FIELDS = ['email', 'visiblename']

    objects = UserAccountManager()

    def __str__(self):
        return self.username

    def has_perm(self, perm, obj=None):
        return self.is_admin

    def has_module_perms(self, app_label):
        return True
</code>```

So, what can I do about this problem? Should I reset all the MariaDB databases? Or are there some better solutions?

Body:
I created a Django project running on Docker, and I successfully connected from the container to the host MariaDB server as an URL host.docker.internal:3306 with the command sudo docker run -p 8000:8000 --add-host=host.docker.internal:host-gateway -d kms1212/jsis:latest. But due to several problems(I can't remember why I did it), I removed the original database, created a new database, and modified settings.py. Then I ran the modified Docker image that is built from Dockerfile:

FROM ubuntu:22.04

ENV PYTHONUNBUFFERED 1

RUN apt-get -y update
RUN apt-get -y install build-essential python-is-python3 pip mysql-client libmysqlclient-dev

RUN mkdir /usr/local/workdir
WORKDIR /usr/local/workdir

COPY requirements.txt .

RUN pip install --upgrade pip
RUN pip install -r requirements.txt

COPY jsis .

EXPOSE 8000
CMD ["bash", "-c", "python manage.py makemigrations && python manage.py showmigrations && python manage.py migrate && gunicorn --bind 0.0.0.0:8000 -k uvicorn.workers.UvicornWorker jsis.asgi:application"]

I dropped and recreated the database and checked that no old constraints and tables were left, but despite my effort, I got some error messages from the container log like this eventually:

No changes detected
admin
 [ ] 0001_initial
 [ ] 0002_logentry_remove_auto_add
 [ ] 0003_logentry_add_action_flag_choices
auth
 [ ] 0001_initial
 [ ] 0002_alter_permission_name_max_length
 [ ] 0003_alter_user_email_max_length
 [ ] 0004_alter_user_username_opts
 [ ] 0005_alter_user_last_login_null
 [ ] 0006_require_contenttypes_0002
 [ ] 0007_alter_validators_add_error_messages
 [ ] 0008_alter_user_username_max_length
 [ ] 0009_alter_user_last_name_max_length
 [ ] 0010_alter_group_name_max_length
 [ ] 0011_update_proxy_permissions
 [ ] 0012_alter_user_first_name_max_length
contenttypes
 [ ] 0001_initial
 [ ] 0002_remove_content_type_name
sessions
 [ ] 0001_initial
sites
 [ ] 0001_initial
 [ ] 0002_alter_domain_unique
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions, sites
Running migrations:
  Applying contenttypes.0001_initial... OK
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/mysql/base.py", line 75, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/connections.py", line 254, in query
    _mysql.connection.query(self, query)
MySQLdb.OperationalError: (1005, 'Can\'t create table `jsisdb`.`django_admin_log` (errno: 150 "Foreign key constraint is incorrectly formed")')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/workdir/manage.py", line 22, in <module>
    main()
  File "/usr/local/workdir/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 402, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 448, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 96, in wrapped
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/commands/migrate.py", line 349, in handle
    post_migrate_state = executor.migrate(
  File "/usr/local/lib/python3.10/dist-packages/django/db/migrations/executor.py", line 135, in migrate
    state = self._migrate_all_forwards(
  File "/usr/local/lib/python3.10/dist-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
    state = self.apply_migration(
  File "/usr/local/lib/python3.10/dist-packages/django/db/migrations/executor.py", line 249, in apply_migration
    with self.connection.schema_editor(
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/base/schema.py", line 164, in __exit__
    self.execute(sql)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/base/schema.py", line 199, in execute
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 103, in execute
    return super().execute(sql, params)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
  File "/usr/local/lib/python3.10/dist-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/mysql/base.py", line 75, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/connections.py", line 254, in query
    _mysql.connection.query(self, query)
django.db.utils.OperationalError: (1005, 'Can\'t create table `jsisdb`.`django_admin_log` (errno: 150 "Foreign key constraint is incorrectly formed")')

(+ Edit)And this is model code:

class UserPermissions(models.IntegerChoices):
    USER = 0
    HQ = 1
    TEACHER = 2
    OTHER = 3

class UserAccountManager(BaseUserManager):
    def create_user(self, username, email, visiblename, agreement_status, password=None):
        if not email:
            raise ValueError('Users must have an email address')
        if not username:
            raise ValueError('Users must have a username')
        if not visiblename:
            raise ValueError('Users must have a visible name')

        user = self.model(
            username=username,
            email=self.normalize_email(email),
            visiblename=visiblename,
            agreement_status=agreement_status,
        )

        user.set_password(password)
        user.save(using=self._db)
        return user

    def create_superuser(self, username, email, visiblename, agreement_status, password):
        user = self.create_user(
            username=username,
            email=self.normalize_email(email),
            visiblename=visiblename,
            agreement_status=agreement_status,
            password=password,
        )

        user.is_admin = True
        user.permission = UserPermissions.OTHER

        user.save(using=self._db)
        return user

class UserAccount(AbstractBaseUser):
    userid = models.AutoField(primary_key=True)
    username = models.CharField(max_length=20, unique=True)
    visiblename = models.CharField(max_length=40, unique=True)
    email = models.EmailField(max_length=255, unique=True)
    permission = models.IntegerField(default=UserPermissions.USER, choices=UserPermissions.choices)
    agreement_status = models.JSONField()
    date_joined = models.DateTimeField(auto_now_add=True)
    date_lastlogin = models.DateTimeField(auto_now=True)
    is_active = models.BooleanField(default=True)
    is_blocked = models.BooleanField(default=False)
    is_blocked_anon = models.BooleanField(default=False)
    block_reason = models.TextField(default="", blank=True)
    is_admin = models.BooleanField(default=False)

    USERNAME_FIELD = 'username'
    EMAIL_FIELD = 'email'
    REQUIRED_FIELDS = ['email', 'visiblename']

    objects = UserAccountManager()

    def __str__(self):
        return self.username

    def has_perm(self, perm, obj=None):
        return self.is_admin

    def has_module_perms(self, app_label):
        return True

So, what can I do about this problem? Should I reset all the MariaDB databases? Or are there some better solutions?


问:
Resolving variables in remote ArgoCD applications
I am using some ArgoCD applications and Helm charts that reside on a GitHub repo. Everytime I need to deploy them I need to clone, populate the values, push and trigger ArgoCD by applying the root application.

The root application then has a reference to other helm and argo applications.

My question: is there a way to populated paramaters or environment variables in ArgoCD so it takes care of substituting them inside helm charts and applications?

What is a better way than cloning, populating variables, pushing and triggering the argocd app?


问:
C++ Multithreading CreateProcess. Exe running slower with more threads active
Recently upgraded my dev machine to a i9-13900k (24 cores, 32 threads) as a result I'm looking into refactoring a test harness I utilise, the issue appears to be that there is no improvement in total time taken for tests to complete past 6 threads, which is not expected.

The setup.

```<code> std::vector<std::string> tests;
 std::ifstream input("");
 for (std::string line; getline(input, line); ) {
   tests.push_back(line);
 }

  const int processor_count = 24;

  vector<int> thread_pool(processor_count, thread_status::thread_free);
  for (int i = 0; i < processor_count; i++) {
    thread(ThreadedFunc, ref(thread_pool[i])).detach();
  }

 auto not_all_done = [&thread_pool]()
  {
    return any_of(thread_pool.begin(), thread_pool.end(), [](int a_ThreadStatus)
    {
      return a_ThreadStatus < thread_done;
    });
  };

  while (not_all_done()) {
  }

void ThreadedFunc(int& a_ThreadStatus)
{
    while (!tests.empty() ) {

    // CRITICAL SECTION
    std::string l_Test;
    {
      std::lock_guard<std::mutex> guard(mtx);
      l_Test = tests.front();
      tests.erase(tests.begin() + 0);
    }
    // ================
    auto start = std::chrono::system_clock::now();
    std::time_t start_time = std::chrono::system_clock::to_time_t(start);
    std::stringstream msg;
    msg << "Test: " << l_Test << " started." << std::endl;
    std::cout << msg.str();

    auto l_ClassID = std::stoi(l_Test);

    std::wstring l_wexe = std::wstring(m_exe.begin(), m_exe.end());
    LPCWSTR l_exe = l_wexe.c_str();

    std::wstring cmdArgslistSetChannel = l_wexe;
    cmdArgslistSetChannel += L" -utest ";
    cmdArgslistSetChannel += std::to_wstring(l_ClassID);
    cmdArgslistSetChannel += L" cpufactor ";
    cmdArgslistSetChannel += std::to_wstring(m_CPUFactor);
    cmdArgslistSetChannel += L" ParallelRunning CrashReporting";

    STARTUPINFO si = { sizeof(STARTUPINFO) };
    si.cb = sizeof(si);
    si.dwFlags = STARTF_USESHOWWINDOW;
    si.wShowWindow = SW_HIDE;
    PROCESS_INFORMATION pi;

    start = std::chrono::system_clock::now();
    CreateProcess(NULL, &cmdArgslistSetChannel[0], NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi);
    WaitForSingleObject(pi.hProcess, INFINITE);
    auto end = std::chrono::system_clock::now();

    CloseHandle(pi.hProcess);
    CloseHandle(pi.hThread);

    std::time_t end_time = std::chrono::system_clock::to_time_t(end);
    auto diff_time = std::difftime(end_time, start_time);
    std::stringstream msg1;
    msg1 << "Test: " << l_Test << " completed. Elapsed: " << diff_time << std::endl;
    std::cout << msg1.str();
  }

  a_ThreadStatus = thread_status::thread_done;
}
</code>```

It is appearing that past 6 threads the CreateProcess call is taking longer to execute. Would this be expected given the hardware.

Some numbers for 100 tests.

thread
time (mins)

1
?

2
1.07

4
0.71

6
0.68

8
0.72

12
0.79

24
1.07

I was not expecting 2 threads to be on par with 24. We know from test logging the test itself is NOT taking any longer to execute, would it be the 24 CreateProcess calls fighting each other, before the exe launches.

I started writing this in perl as that's out current testing scripting lang, switched to C++ and from a one parent firing off a new thread (fork) for every test to a thread manages its work model, to the same results.

Body:
Recently upgraded my dev machine to a i9-13900k (24 cores, 32 threads) as a result I'm looking into refactoring a test harness I utilise, the issue appears to be that there is no improvement in total time taken for tests to complete past 6 threads, which is not expected.

The setup.

 std::vector<std::string> tests;
 std::ifstream input("");
 for (std::string line; getline(input, line); ) {
   tests.push_back(line);
 }

  const int processor_count = 24;

  vector<int> thread_pool(processor_count, thread_status::thread_free);
  for (int i = 0; i < processor_count; i++) {
    thread(ThreadedFunc, ref(thread_pool[i])).detach();
  }

 auto not_all_done = [&thread_pool]()
  {
    return any_of(thread_pool.begin(), thread_pool.end(), [](int a_ThreadStatus)
    {
      return a_ThreadStatus < thread_done;
    });
  };

  while (not_all_done()) {
  }

void ThreadedFunc(int& a_ThreadStatus)
{
    while (!tests.empty() ) {

    // CRITICAL SECTION
    std::string l_Test;
    {
      std::lock_guard<std::mutex> guard(mtx);
      l_Test = tests.front();
      tests.erase(tests.begin() + 0);
    }
    // ================
    auto start = std::chrono::system_clock::now();
    std::time_t start_time = std::chrono::system_clock::to_time_t(start);
    std::stringstream msg;
    msg << "Test: " << l_Test << " started." << std::endl;
    std::cout << msg.str();

    auto l_ClassID = std::stoi(l_Test);

    std::wstring l_wexe = std::wstring(m_exe.begin(), m_exe.end());
    LPCWSTR l_exe = l_wexe.c_str();

    std::wstring cmdArgslistSetChannel = l_wexe;
    cmdArgslistSetChannel += L" -utest ";
    cmdArgslistSetChannel += std::to_wstring(l_ClassID);
    cmdArgslistSetChannel += L" cpufactor ";
    cmdArgslistSetChannel += std::to_wstring(m_CPUFactor);
    cmdArgslistSetChannel += L" ParallelRunning CrashReporting";

    STARTUPINFO si = { sizeof(STARTUPINFO) };
    si.cb = sizeof(si);
    si.dwFlags = STARTF_USESHOWWINDOW;
    si.wShowWindow = SW_HIDE;
    PROCESS_INFORMATION pi;

    start = std::chrono::system_clock::now();
    CreateProcess(NULL, &cmdArgslistSetChannel[0], NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi);
    WaitForSingleObject(pi.hProcess, INFINITE);
    auto end = std::chrono::system_clock::now();

    CloseHandle(pi.hProcess);
    CloseHandle(pi.hThread);

    std::time_t end_time = std::chrono::system_clock::to_time_t(end);
    auto diff_time = std::difftime(end_time, start_time);
    std::stringstream msg1;
    msg1 << "Test: " << l_Test << " completed. Elapsed: " << diff_time << std::endl;
    std::cout << msg1.str();
  }

  a_ThreadStatus = thread_status::thread_done;
}

It is appearing that past 6 threads the CreateProcess call is taking longer to execute. Would this be expected given the hardware.

Some numbers for 100 tests.

thread
time (mins)

1
?

2
1.07

4
0.71

6
0.68

8
0.72

12
0.79

24
1.07

I was not expecting 2 threads to be on par with 24. We know from test logging the test itself is NOT taking any longer to execute, would it be the 24 CreateProcess calls fighting each other, before the exe launches.

I started writing this in perl as that's out current testing scripting lang, switched to C++ and from a one parent firing off a new thread (fork) for every test to a thread manages its work model, to the same results.


问:
Cannot grow BufferHolder; exceeds size limitation
any help on spark error "Cannot grow BufferHolder; exceeds size limitation"
I have tried using databricks recommended solution https://kb.databricks.com/en_US/sql/cannot-grow-bufferholder-exceeds-size but no success.

I tried other solutions online and no success


问:
PECL fails to install Xdebug on PHP 8.1 because it thinks I'm on PHP version 7.4
I've searched far and wide, tried everything but I can't get to install Xdebug on PHP 8.1

I've got multiple PHP versions installed via homebrew, when I switch to PHP 8.1 and try to install Xdebug I get the following:

```<code>BE-C02CRC3FMD6N:~ treynaert$ php -v
PHP 8.1.14 (cli) (built: Jan  9 2023 16:02:41) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.14, Copyright (c) Zend Technologies

BE-C02CRC3FMD6N:~ treynaert$ pecl install xdebug
pecl/xdebug requires PHP (version >= 8.0.0, version <= 8.2.99), installed version is 7.4.33
No valid packages found
install failed
</code>```

As you can see, php -v returns 8.1, phpinfo() in the browser gives me the same. Though for some reason pecl thinks I'm on 7.4.

I'm on Mac OSX Catalina BTW (10.15.7)

Anyone has a clue?

Body:
I've searched far and wide, tried everything but I can't get to install Xdebug on PHP 8.1

I've got multiple PHP versions installed via homebrew, when I switch to PHP 8.1 and try to install Xdebug I get the following:

BE-C02CRC3FMD6N:~ treynaert$ php -v
PHP 8.1.14 (cli) (built: Jan  9 2023 16:02:41) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.14, Copyright (c) Zend Technologies

BE-C02CRC3FMD6N:~ treynaert$ pecl install xdebug
pecl/xdebug requires PHP (version >= 8.0.0, version <= 8.2.99), installed version is 7.4.33
No valid packages found
install failed

As you can see, php -v returns 8.1, phpinfo() in the browser gives me the same. Though for some reason pecl thinks I'm on 7.4.

I'm on Mac OSX Catalina BTW (10.15.7)

Anyone has a clue?


问:
Install local package through a Dockerfile
I have started learning Docker and I have developed a Python package (not published anywhere, it is just used internally) that installs and works fine locally (here I will call it mypackage). However, when trying to install it in a Docker container, Python in the container fails to recognise it even though during the build of the image no error was raised. The Dockerfile looks like this:

```<code># install Ubuntu 20.04
FROM ubuntu:20.04

# update Ubuntu packages
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils \
           build-essential \
           curl \
           mysql-server \
           libmysqlclient-dev \
           libffi-dev \
           libssl-dev \
               libxml2-dev \
               libxslt1-dev \
               unzip \
               zlib1g-dev

# install Python 3.9
RUN apt-get install -y software-properties-common gcc && \
    add-apt-repository -y ppa:deadsnakes/ppa
RUN apt-get update && apt-get install -y python3.9 python3.9-dev python3.9-distutils python3-pip python3-apt python3.9-venv

# make symlink (overriding default Python3.8 installed with Ubuntu)
RUN rm /usr/bin/python3
RUN ln -s /usr/bin/python3.9 /usr/bin/python3

# copy package files and source code
RUN mkdir mypackage
COPY pyproject.toml setup.cfg setup.py requirements.txt ./mypackage/
COPY src mypackage/src/

# add path
ENV PACKAGE_PATH=/mypackage/
ENV PATH="$PACKAGE_PATH/:$PATH"

# install mypackage
RUN pip3 install -e ./mypackage

CMD ["python3.9", "main.py"]
</code>```

So the above runs successfully, but if I run sudo docker run -it test_image bin/bash and run pip3 list, the package will not be there and a ModuleNotFoundError when running code depending on mypackage. Interestingly if I create a virtual environment by replacing this:

```<code>ENV PACKAGE_PATH=/mypackage/
ENV PATH="$PACKAGE_PATH/:$PATH"
</code>```

by this:

```<code>ENV VIRTUAL_ENV=/opt/venv
RUN python3.9 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
</code>```

it works. Ideally, I want to know why I need to create a virtual environment and how can I run local packages in a container without creating virtual environments.

Body:
I have started learning Docker and I have developed a Python package (not published anywhere, it is just used internally) that installs and works fine locally (here I will call it mypackage). However, when trying to install it in a Docker container, Python in the container fails to recognise it even though during the build of the image no error was raised. The Dockerfile looks like this:

# install Ubuntu 20.04
FROM ubuntu:20.04

# update Ubuntu packages
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils \
           build-essential \
           curl \
           mysql-server \
           libmysqlclient-dev \
           libffi-dev \
           libssl-dev \
               libxml2-dev \
               libxslt1-dev \
               unzip \
               zlib1g-dev

# install Python 3.9
RUN apt-get install -y software-properties-common gcc && \
    add-apt-repository -y ppa:deadsnakes/ppa
RUN apt-get update && apt-get install -y python3.9 python3.9-dev python3.9-distutils python3-pip python3-apt python3.9-venv

# make symlink (overriding default Python3.8 installed with Ubuntu)
RUN rm /usr/bin/python3
RUN ln -s /usr/bin/python3.9 /usr/bin/python3

# copy package files and source code
RUN mkdir mypackage
COPY pyproject.toml setup.cfg setup.py requirements.txt ./mypackage/
COPY src mypackage/src/

# add path
ENV PACKAGE_PATH=/mypackage/
ENV PATH="$PACKAGE_PATH/:$PATH"

# install mypackage
RUN pip3 install -e ./mypackage

CMD ["python3.9", "main.py"]

So the above runs successfully, but if I run sudo docker run -it test_image bin/bash and run pip3 list, the package will not be there and a ModuleNotFoundError when running code depending on mypackage. Interestingly if I create a virtual environment by replacing this:

ENV PACKAGE_PATH=/mypackage/
ENV PATH="$PACKAGE_PATH/:$PATH"

by this:

ENV VIRTUAL_ENV=/opt/venv
RUN python3.9 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

it works. Ideally, I want to know why I need to create a virtual environment and how can I run local packages in a container without creating virtual environments.


问:
How can I solve MUI GridActionsCellItem types
I am using @mui/x-data-grid package in my react app and after upgrading to the latest version,I started getting a type error GridActionsCellItem component.

Below is my Code

```<code>  const columns = React.useMemo(
    () => [
      { field: 'displayName', headerName: 'Name', minWidth: 100, flex: 1 },
      {
        field: 'actions',
        type: 'actions',
        width: 70,
        getActions: params => [<GridActionsCellItem icon={<DeleteIcon />} label="Delete" />]
      }
    ],
    [programData, programTeamsData, rolesData]
  );
</code>```

Below is the Type Error.

```<code>Type '{ icon: Element; label: string; }' is not assignable to type 'IntrinsicAttributes & ((Pick<{ label: string; icon?: ReactElement<any, string | JSXElementConstructor<any>>; } & ... 4 more ... & Omit<...>, "action" | ... 283 more ... | "showInMenu"> | Pick<...>) & RefAttributes<...>)'.
  Type '{ icon: Element; label: string; }' is missing the following properties from type 'Pick<{ label: string; icon?: ReactElement<any, string | JSXElementConstructor<any>>; } & { showInMenu: true; } & { autoFocus?: boolean; classes?: Partial<...>; ... 5 more ...; sx?: SxProps<...>; } & Omit<...> & CommonProps & Omit<...>, "action" | ... 276 more ... | "divider">': onResize, onResizeCapture, showInMenu
</code>```

I have tried to update all my packages to the latest version but  still get this error.
According to me, I should not be getting this error because GridActionsCellItem expects an icon and label items which i have passed.

I have also tried to pass an onClick attribute but i ge the same error. Below is an example.
.

Kindly help me understand where i might be going wrong. Thank you

Body:
I am using @mui/x-data-grid package in my react app and after upgrading to the latest version,I started getting a type error GridActionsCellItem component.

Below is my Code

  const columns = React.useMemo(
    () => [
      { field: 'displayName', headerName: 'Name', minWidth: 100, flex: 1 },
      {
        field: 'actions',
        type: 'actions',
        width: 70,
        getActions: params => [<GridActionsCellItem icon={<DeleteIcon />} label="Delete" />]
      }
    ],
    [programData, programTeamsData, rolesData]
  );

Below is the Type Error.

Type '{ icon: Element; label: string; }' is not assignable to type 'IntrinsicAttributes & ((Pick<{ label: string; icon?: ReactElement<any, string | JSXElementConstructor<any>>; } & ... 4 more ... & Omit<...>, "action" | ... 283 more ... | "showInMenu"> | Pick<...>) & RefAttributes<...>)'.
  Type '{ icon: Element; label: string; }' is missing the following properties from type 'Pick<{ label: string; icon?: ReactElement<any, string | JSXElementConstructor<any>>; } & { showInMenu: true; } & { autoFocus?: boolean; classes?: Partial<...>; ... 5 more ...; sx?: SxProps<...>; } & Omit<...> & CommonProps & Omit<...>, "action" | ... 276 more ... | "divider">': onResize, onResizeCapture, showInMenu

I have tried to update all my packages to the latest version but  still get this error.
According to me, I should not be getting this error because GridActionsCellItem expects an icon and label items which i have passed.

I have also tried to pass an onClick attribute but i ge the same error. Below is an example.
.

Kindly help me understand where i might be going wrong. Thank you


问:
When i use VoiceOver of Mac to navigate through the website, focus is remaining at a button and its being there until another button is encountered
When I use VoiceOver of Mac to navigate the website using the keyboard command (cmd+shift+left/right arrows), the focus remains on a button. It is there until another button is encountered. The issue is only in Chrome and Microsoft Edge browsers. The above-mentioned scenario is working well for Safari and Firefox browsers. When a button gets the focus and VoiceOver moves to other text elements, due to the focus of the button, the voiceover is again navigating back to the focused button and iterating through the elements that are already read.

I tried "focusin","focusout" event listeners to set aria-hidden / tabIndex values accordingly. I also tried setting the focus of elements using CSS, making box-shadow:none, outline:none, but that just makes the focus not visible.


问:
How to bind scrollbar with an active Button to perform a task
I need to create a page or form using tkinter. But the problem is when I scroll down the text box than I need to activate a button.

I am trying to use scrollbar method get() and set() but its not working. Kindly suggest any method to bind or connect the scrollbar with a button in frame.

In the below code Accept button is disabled by default. However I want it to be enable when I drag the scrollbar downside.

```<code>from tkinter import *
def extract_data():
    print(text_box.get('1.0', 'end'))

def Accept():

    messagebox.showinfo("logged In", "Successfully logged In")

def Decline():
    logout = os.system("shutdown -l")

ws = Tk()
ws.title('PythonGuides')
ws.geometry('400x300')
ws.config(bg='#84BF04')

message ='''
One
Two
Three
Four
Five
Six
Seven
Eight
Nine
Ten
eleven
twelve
thirteen
fourteen
fifteen
sixteen
seventeen
eighteen
nineteen
twenty
'''
frame = Frame(ws)
text_box = Text(
    frame,
    height=13,
    width=20,
    wrap='word'
)
text_box.insert('end', message)
text_box.pack(side=LEFT,expand=True)
sb = Scrollbar(frame)
sb.pack(side=RIGHT, fill=BOTH)
text_box.config(yscrollcommand=sb.set)
frame.pack(expand=True)
button_frame = Frame(ws)
button_frame.pack()
Accept_button = Button(button_frame, text="Accept", command=lambda:Accept(),state=DISABLED)
Accept_button.grid(row=1,column=0)
Decline_button = Button(button_frame, text="Decline", command=Decline)
Decline_button.grid(row=1, column=1,padx=20)
sb.config(command=Accept_button.invoke)
ws.mainloop()
</code>```

Body:
I need to create a page or form using tkinter. But the problem is when I scroll down the text box than I need to activate a button.

I am trying to use scrollbar method get() and set() but its not working. Kindly suggest any method to bind or connect the scrollbar with a button in frame.

In the below code Accept button is disabled by default. However I want it to be enable when I drag the scrollbar downside.

from tkinter import *
def extract_data():
    print(text_box.get('1.0', 'end'))

def Accept():

    messagebox.showinfo("logged In", "Successfully logged In")

def Decline():
    logout = os.system("shutdown -l")

ws = Tk()
ws.title('PythonGuides')
ws.geometry('400x300')
ws.config(bg='#84BF04')

message ='''
One
Two
Three
Four
Five
Six
Seven
Eight
Nine
Ten
eleven
twelve
thirteen
fourteen
fifteen
sixteen
seventeen
eighteen
nineteen
twenty
'''
frame = Frame(ws)
text_box = Text(
    frame,
    height=13,
    width=20,
    wrap='word'
)
text_box.insert('end', message)
text_box.pack(side=LEFT,expand=True)
sb = Scrollbar(frame)
sb.pack(side=RIGHT, fill=BOTH)
text_box.config(yscrollcommand=sb.set)
frame.pack(expand=True)
button_frame = Frame(ws)
button_frame.pack()
Accept_button = Button(button_frame, text="Accept", command=lambda:Accept(),state=DISABLED)
Accept_button.grid(row=1,column=0)
Decline_button = Button(button_frame, text="Decline", command=Decline)
Decline_button.grid(row=1, column=1,padx=20)
sb.config(command=Accept_button.invoke)
ws.mainloop()


问:
MochaJS testing retries. Is there a way to get currentRetry?
I'm using MochaJS (10.1) as my testing framework with WDIO and we use this.retries(3) which tell the test to retry if failing the first time (sometimes we have flaky tests, race conditions, etc). But we'd like to capture which retry attempt actually passed.

I see there is a protected currentRetry in the mocha runner class. Not sure why they would protect it, but I'm trying to figure out how I can maybe make a subclass for that to expose it to my test.

I think I can do that with something like:

```<code>class myRunnable extends Mocha.Runnable {
    public get myCurrentRetry() {return super.currentRetry}
}
</code>```

but not sure how to get my tests to use myRunnable rather than normal mocha

Body:
I'm using MochaJS (10.1) as my testing framework with WDIO and we use this.retries(3) which tell the test to retry if failing the first time (sometimes we have flaky tests, race conditions, etc). But we'd like to capture which retry attempt actually passed.

I see there is a protected currentRetry in the mocha runner class. Not sure why they would protect it, but I'm trying to figure out how I can maybe make a subclass for that to expose it to my test.

I think I can do that with something like:

class myRunnable extends Mocha.Runnable {
    public get myCurrentRetry() {return super.currentRetry}
}

but not sure how to get my tests to use myRunnable rather than normal mocha


问:
Iterate over Typescript interface keys without package?
I know this is not the first time asked, but old questions don't help.
Is there a way to get all the keys of an interface in Typescript, without, an external package?</p>


问:
ValueError: Found array with dim 3. Estimator expected <= 2.explored the existing solutions
Was running my Python program and I received this error:

```<code>3 fits failed with the following error:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/sklearn/model_selection/_validation.py", line 680, in _fit_and_score
    estimator.fit(X_train, y_train, **fit_params)
  File "/usr/local/lib/python3.8/dist-packages/sklearn/neighbors/_classification.py", line 198, in fit
    return self._fit(X, y)
  File "/usr/local/lib/python3.8/dist-packages/sklearn/neighbors/_base.py", line 400, in _fit
    X, y = self._validate_data(X, y, accept_sparse="csr", multi_output=True)
  File "/usr/local/lib/python3.8/dist-packages/sklearn/base.py", line 581, in _validate_data
    X, y = check_X_y(X, y, **check_params)
  File "/usr/local/lib/python3.8/dist-packages/sklearn/utils/validation.py", line 964, in check_X_y
    X = check_array(
  File "/usr/local/lib/python3.8/dist-packages/sklearn/utils/validation.py", line 794, in check_array
    raise ValueError(
ValueError: Found array with dim 3. Estimator expected <= 2.
</code>```

My code looks like this:

```<code># evaluate each model in turn
results = []
names = []

for name, model in models:
    kfold = StratifiedKFold(n_splits=3, random_state=1, shuffle=True)
    cv_results = cross_val_score(model, X_train, Y_train, cv=kfold, scoring='accuracy')
    results.append(cv_results)
    names.append(name)
    print('%s: %f (%f)' % (name, cv_results.mean(), cv_results.std()))
</code>```

Body:
Was running my Python program and I received this error:

3 fits failed with the following error:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/sklearn/model_selection/_validation.py", line 680, in _fit_and_score
    estimator.fit(X_train, y_train, **fit_params)
  File "/usr/local/lib/python3.8/dist-packages/sklearn/neighbors/_classification.py", line 198, in fit
    return self._fit(X, y)
  File "/usr/local/lib/python3.8/dist-packages/sklearn/neighbors/_base.py", line 400, in _fit
    X, y = self._validate_data(X, y, accept_sparse="csr", multi_output=True)
  File "/usr/local/lib/python3.8/dist-packages/sklearn/base.py", line 581, in _validate_data
    X, y = check_X_y(X, y, **check_params)
  File "/usr/local/lib/python3.8/dist-packages/sklearn/utils/validation.py", line 964, in check_X_y
    X = check_array(
  File "/usr/local/lib/python3.8/dist-packages/sklearn/utils/validation.py", line 794, in check_array
    raise ValueError(
ValueError: Found array with dim 3. Estimator expected <= 2.

My code looks like this:

# evaluate each model in turn
results = []
names = []

for name, model in models:
    kfold = StratifiedKFold(n_splits=3, random_state=1, shuffle=True)
    cv_results = cross_val_score(model, X_train, Y_train, cv=kfold, scoring='accuracy')
    results.append(cv_results)
    names.append(name)
    print('%s: %f (%f)' % (name, cv_results.mean(), cv_results.std()))


问:
Javassist call PolymorphicSignature method
I am trying to call MethodHandle.invokeExact in a generated Javassist method, but I always get Exception in thread "main" javassist.CannotCompileException: [source error] invokeExact(int) not found in java.lang.invoke.MethodHandle

This seems to be because invokeExact is a @PolymorphicSignature method.
How can I call it from a Javassist method?


问:
Can I prevent automatic conversion of Collection without generics to Collection<String> in Weblogic 14
I have a legacy java project with a lot of collections without the use of generics .

The collections basically looks like this example:

```<code>    Collection myCollectionOfObjects;

    public Collection getMyCollectionOfObjects() {
        return myCollectionOfObjects;
    }

    public void setMyCollectionOfObjects(Collection myCollectionOfObjects) {
        this.myCollectionOfObjects = myCollectionOfObjects;
    }
</code>```

The collection is filled with strings and are later accessed in JavaScript and the value is retrieved:

```<code>        myString = myCollectionOfObjects[1].value;
</code>```

We are looking at upgrading from Weblogic 12c to Weblogic 14, but are facing problems with these collections, due to the fact that Weblogic 14 automatically handles conversion if the collection contains the same type for every entry, and the JavaScript fails because the collection is handled as Collection<String> and not Collection<Object> which in turn means that myCollectionOfObjects[1].value is undefined.

The obvious solution would of course be to change the legacy code to use generics, but the sheer volume where this is used and the fact that the error occurs in JavaScript at runtime is a big obstacle.

So, my question is if there is anyway to have Weblogic not do the automatic conversion?

I have changed the Collection to Collection<String> which resulted in the code working as it should.

The problem is that, due to the complexity of the legacy code, it is an overwhelming task to find all the places in the code where this can potentially occur.

Body:
I have a legacy java project with a lot of collections without the use of generics .

The collections basically looks like this example:

    Collection myCollectionOfObjects;

    public Collection getMyCollectionOfObjects() {
        return myCollectionOfObjects;
    }

    public void setMyCollectionOfObjects(Collection myCollectionOfObjects) {
        this.myCollectionOfObjects = myCollectionOfObjects;
    }

The collection is filled with strings and are later accessed in JavaScript and the value is retrieved:

        myString = myCollectionOfObjects[1].value;

We are looking at upgrading from Weblogic 12c to Weblogic 14, but are facing problems with these collections, due to the fact that Weblogic 14 automatically handles conversion if the collection contains the same type for every entry, and the JavaScript fails because the collection is handled as Collection<String> and not Collection<Object> which in turn means that myCollectionOfObjects[1].value is undefined.

The obvious solution would of course be to change the legacy code to use generics, but the sheer volume where this is used and the fact that the error occurs in JavaScript at runtime is a big obstacle.

So, my question is if there is anyway to have Weblogic not do the automatic conversion?

I have changed the Collection to Collection<String> which resulted in the code working as it should.

The problem is that, due to the complexity of the legacy code, it is an overwhelming task to find all the places in the code where this can potentially occur.


问:
Issues with FTPS connection on port 990 in VScode
I'm trying to setup my FTP in VSCode using the sftp extension but I can't get it to connect, it says it's timing out every time. The issue is that my SFTP config from sublime text has always worked on this specific server (ftps connection using port 990). Never had a single issue.

The config that has been working on sublime text:

```<code>"type": "ftps",

    "save_before_upload": true,
    "upload_on_save": true,

    "host": "ftpweb.user.srv",
    "user": "ftpweb.user.srv|user1",
    "password": "redacted",
    "port": "990",

    "remote_path": "/",

    "connect_timeout": 5,
    "keepalive": 120,
    "ftp_passive_mode": true,
    "ftp_obey_passive_host": true,
    "allow_config_upload": true,
</code>```

new config for VScode that is timing out:

```<code>{
    "name": "test",
    "host": "ftpweb.user.srv",
    "protocol": "ftp",
    "secure": true,
    "secureOptions": {
        "rejectUnauthorized": false
    },
    "port": 990,
    "username": "ftpweb.user.srv|user1",
    "password": "redacted",
    "remotepath": "/",
    "uploadOnSave": true
}
</code>```

What am I missing in VScode? I know it doesn't truly support ftps but I thought there would be a workaround using ftp, I just can't seem to find any loophole here. Has anyone been able to connect to a FTPS server on port 990 in VSCode?

Body:
I'm trying to setup my FTP in VSCode using the sftp extension but I can't get it to connect, it says it's timing out every time. The issue is that my SFTP config from sublime text has always worked on this specific server (ftps connection using port 990). Never had a single issue.

The config that has been working on sublime text:

"type": "ftps",

    "save_before_upload": true,
    "upload_on_save": true,

    "host": "ftpweb.user.srv",
    "user": "ftpweb.user.srv|user1",
    "password": "redacted",
    "port": "990",

    "remote_path": "/",

    "connect_timeout": 5,
    "keepalive": 120,
    "ftp_passive_mode": true,
    "ftp_obey_passive_host": true,
    "allow_config_upload": true,

new config for VScode that is timing out:

{
    "name": "test",
    "host": "ftpweb.user.srv",
    "protocol": "ftp",
    "secure": true,
    "secureOptions": {
        "rejectUnauthorized": false
    },
    "port": 990,
    "username": "ftpweb.user.srv|user1",
    "password": "redacted",
    "remotepath": "/",
    "uploadOnSave": true
}

What am I missing in VScode? I know it doesn't truly support ftps but I thought there would be a workaround using ftp, I just can't seem to find any loophole here. Has anyone been able to connect to a FTPS server on port 990 in VSCode?