问:
ParserError: Expected '{' but got 'constant' in Remix IDE
Below is my code.`
pragma solidity ^0.8.0;
contract Auction {

```<code>// Data
//Structure to hold details of the item
struct Item {
    uint itemId; // id of the item
    uint[] itemTokens;  //tokens bid in favor of the item

}
</code>```

//Structure to hold the details of a persons
struct Person {
uint remainingTokens; // tokens remaining with bidder
uint personId; // it serves as tokenId as well
address addr;//address of the bidder
}

```<code>mapping(address => Person) tokenDetails; //address to person
Person [4] bidders;//Array containing 4 person objects

Item [3] public items;//Array containing 3 item objects
address[3] public winners;//Array for address of winners
address public beneficiary;//owner of the smart contract

uint bidderCount=0;//counter

//functions

function Auction() public payable{    //constructor

    //Part 1 Task 1. Initialize beneficiary with address of smart contract’s owner
    //Hint. In the constructor,"msg.sender" is the address of the owner.
    // ** Start code here. 1 line approximately. **/
    beneficiary = msg.sender;
      //** End code here. **/
    uint[] memory emptyArray;
    items[0] = Item({itemId:0,itemTokens:emptyArray});

    //Part 1 Task 2. Initialize two items with at index 1 and 2.
    // ** Start code here. 2 lines approximately. **/
    uint[] memory emptyArray1;
    items[1] = Item({itemId:1,itemTokens:emptyArray1});
    uint[] memory emptyArray2;
    items[2] = Item({itemId:2,itemTokens:emptyArray2});
    //** End code here**/
}

function register() public payable{

    bidders[bidderCount].personId = bidderCount;

    //Part 1 Task 3. Initialize the address of the bidder
    /*Hint. Here the bidders[bidderCount].addr should be initialized with address of the registrant.*/

    // ** Start code here. 1 line approximately. **/
    bidders[bidderCount].addr = msg.sender;
    //** End code here. **

    bidders[bidderCount].remainingTokens = 5; // only 5 tokens
    tokenDetails[msg.sender]=bidders[bidderCount];
    bidderCount++;
}

function bid(uint _itemId, uint _count) public payable{
    /*
        Bids tokens to a particular item.
        Arguments:
        _itemId -- uint, id of the item
        _count -- uint, count of tokens to bid for the item
    */

    /*
    Part 1 Task 4. Implement the three conditions below.
        4.1 If the number of tokens remaining with the bidder is < count of tokens bidded, revert.
        4.2 If there are no tokens remaining with the bidder, revert.
        4.3 If the id of the item for which bid is placed, is greater than 2, revert.

    Hint: "tokenDetails[msg.sender].remainingTokens" gives the details of the number of tokens remaining with the bidder.
    */

    // ** Start code here. 2 lines approximately. **/
    if ( (tokenDetails[msg.sender].remainingTokens < _count) ||
         (tokenDetails[msg.sender].remainingTokens <= 0)
        ) { revert(); }
    if (_itemId > items.length - 1) { revert(); }

    //** End code here. **

    /*Part 1 Task 5. Decrement the remainingTokens by the number of tokens bid and store the value in balance variable.
    Hint. "tokenDetails[msg.sender].remainingTokens" should be decremented by "_count". */

    // ** Start code here. 1 line approximately. **
    uint balance = tokenDetails[msg.sender].remainingTokens - _count;
    //** End code here. **

    tokenDetails[msg.sender].remainingTokens=balance;
    bidders[tokenDetails[msg.sender].personId].remainingTokens=balance;//updating the same balance in bidders map.

    Item storage bidItem = items[_itemId];
    for(uint i=0; i<_count;i++) {
        bidItem.itemTokens.push(tokenDetails[msg.sender].personId);
    }
}

// Part 2 Task 1. Create a modifier named "onlyOwner" to ensure that only owner is allowed to reveal winners
//Hint : Use require to validate if "msg.sender" is equal to the "beneficiary".
modifier onlyOwner {
    // ** Start code here. 2 lines approximately. **
    require (msg.sender == beneficiary);
    _;
    //** End code here. **
}

function revealWinners() public onlyOwner{

    /*
        Iterate over all the items present in the auction.
        If at least on person has placed a bid, randomly select          the winner */

    for (uint id = 0; id < 3; id++) {
        Item storage currentItem=items[id];
        if(currentItem.itemTokens.length != 0){
        // generate random# from block number
        uint randomIndex = (block.number / currentItem.itemTokens.length)% currentItem.itemTokens.length;
        // Obtain the winning tokenId

        uint winnerId = currentItem.itemTokens[randomIndex];

        /* Part 1 Task 6. Assign the winners.
        Hint." bidders[winnerId] " will give you the person object with the winnerId.
        you need to assign the address of the person obtained above to winners[id] */

        // ** Start coding here *** 1 line approximately.
        winners[id] = bidders[winnerId].addr;

        //** end code here*

        }
    }
}
</code>```

//Miscellaneous methods: Below methods are used to assist Grading. Please DONOT CHANGE THEM.
function getPersonDetails(uint id) public constant returns(uint,uint,address){
return (bidders[id].remainingTokens,bidders[id].personId,bidders[id].addr);
}

}`

I am trying to compile it but I am unable to do it.
please help in this regard
thanks

Body:
Below is my code.`
pragma solidity ^0.8.0;
contract Auction {

// Data
//Structure to hold details of the item
struct Item {
    uint itemId; // id of the item
    uint[] itemTokens;  //tokens bid in favor of the item

}

//Structure to hold the details of a persons
struct Person {
uint remainingTokens; // tokens remaining with bidder
uint personId; // it serves as tokenId as well
address addr;//address of the bidder
}

mapping(address => Person) tokenDetails; //address to person
Person [4] bidders;//Array containing 4 person objects

Item [3] public items;//Array containing 3 item objects
address[3] public winners;//Array for address of winners
address public beneficiary;//owner of the smart contract

uint bidderCount=0;//counter

//functions

function Auction() public payable{    //constructor

    //Part 1 Task 1. Initialize beneficiary with address of smart contract’s owner
    //Hint. In the constructor,"msg.sender" is the address of the owner.
    // ** Start code here. 1 line approximately. **/
    beneficiary = msg.sender;
      //** End code here. **/
    uint[] memory emptyArray;
    items[0] = Item({itemId:0,itemTokens:emptyArray});

    //Part 1 Task 2. Initialize two items with at index 1 and 2.
    // ** Start code here. 2 lines approximately. **/
    uint[] memory emptyArray1;
    items[1] = Item({itemId:1,itemTokens:emptyArray1});
    uint[] memory emptyArray2;
    items[2] = Item({itemId:2,itemTokens:emptyArray2});
    //** End code here**/
}

function register() public payable{

    bidders[bidderCount].personId = bidderCount;

    //Part 1 Task 3. Initialize the address of the bidder
    /*Hint. Here the bidders[bidderCount].addr should be initialized with address of the registrant.*/

    // ** Start code here. 1 line approximately. **/
    bidders[bidderCount].addr = msg.sender;
    //** End code here. **

    bidders[bidderCount].remainingTokens = 5; // only 5 tokens
    tokenDetails[msg.sender]=bidders[bidderCount];
    bidderCount++;
}

function bid(uint _itemId, uint _count) public payable{
    /*
        Bids tokens to a particular item.
        Arguments:
        _itemId -- uint, id of the item
        _count -- uint, count of tokens to bid for the item
    */

    /*
    Part 1 Task 4. Implement the three conditions below.
        4.1 If the number of tokens remaining with the bidder is < count of tokens bidded, revert.
        4.2 If there are no tokens remaining with the bidder, revert.
        4.3 If the id of the item for which bid is placed, is greater than 2, revert.

    Hint: "tokenDetails[msg.sender].remainingTokens" gives the details of the number of tokens remaining with the bidder.
    */

    // ** Start code here. 2 lines approximately. **/
    if ( (tokenDetails[msg.sender].remainingTokens < _count) ||
         (tokenDetails[msg.sender].remainingTokens <= 0)
        ) { revert(); }
    if (_itemId > items.length - 1) { revert(); }

    //** End code here. **

    /*Part 1 Task 5. Decrement the remainingTokens by the number of tokens bid and store the value in balance variable.
    Hint. "tokenDetails[msg.sender].remainingTokens" should be decremented by "_count". */

    // ** Start code here. 1 line approximately. **
    uint balance = tokenDetails[msg.sender].remainingTokens - _count;
    //** End code here. **

    tokenDetails[msg.sender].remainingTokens=balance;
    bidders[tokenDetails[msg.sender].personId].remainingTokens=balance;//updating the same balance in bidders map.

    Item storage bidItem = items[_itemId];
    for(uint i=0; i<_count;i++) {
        bidItem.itemTokens.push(tokenDetails[msg.sender].personId);
    }
}

// Part 2 Task 1. Create a modifier named "onlyOwner" to ensure that only owner is allowed to reveal winners
//Hint : Use require to validate if "msg.sender" is equal to the "beneficiary".
modifier onlyOwner {
    // ** Start code here. 2 lines approximately. **
    require (msg.sender == beneficiary);
    _;
    //** End code here. **
}

function revealWinners() public onlyOwner{

    /*
        Iterate over all the items present in the auction.
        If at least on person has placed a bid, randomly select          the winner */

    for (uint id = 0; id < 3; id++) {
        Item storage currentItem=items[id];
        if(currentItem.itemTokens.length != 0){
        // generate random# from block number
        uint randomIndex = (block.number / currentItem.itemTokens.length)% currentItem.itemTokens.length;
        // Obtain the winning tokenId

        uint winnerId = currentItem.itemTokens[randomIndex];

        /* Part 1 Task 6. Assign the winners.
        Hint." bidders[winnerId] " will give you the person object with the winnerId.
        you need to assign the address of the person obtained above to winners[id] */

        // ** Start coding here *** 1 line approximately.
        winners[id] = bidders[winnerId].addr;

        //** end code here*

        }
    }
}

//Miscellaneous methods: Below methods are used to assist Grading. Please DONOT CHANGE THEM.
function getPersonDetails(uint id) public constant returns(uint,uint,address){
return (bidders[id].remainingTokens,bidders[id].personId,bidders[id].addr);
}

}`

I am trying to compile it but I am unable to do it.
please help in this regard
thanks


来源: stackexchange

问:
Linear regression output is given as separated and NAN values
I'm trying to create the best linear regression model and my code is:
Daugialype2 <- lm(TNFBL~IL-4_konc_BL+ MCP-1_konc_BL+IL-8_konc_BL+TGF-β1_konc_BL)
summary(Daugialype2) #this code is working, I get a normal output

BUT

Then I want to introduce more variables to the model, e.g.
Daugialype2 <- lm(TNFBL~IL-4_konc_BL+ MCP-1_konc_BL+IL-8_konc_BL+TGF-β1_konc_BL+MiR_181_BL)

For unknown reasons, my output looks like this (even though without the MiR_181_BL variable, the output was good:
enter image description here

I don't know where is the problem - I don't get any error message. Could it be in the variable itself?
My variable looks like this (while others have less numbers after comma)

enter image description here

It's my very first model. Thank you for your answers!

ContentLicense: CC BY-SA 4.0


问:
How to fit long time period data into Regression models in scikit-learn?
I'm working on the regresion model with population and demand values my data is for period from 1980 to 2021 by country, below example where under year is the number of population and under year_dem is the demand for item.

Taks is to create prediction model to forecast demand for each country in future.

```<code># Import necessary libraries
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import train_test_split

# Load the dataset containing past data on vaccine demand and supply
data = df.iloc[0]
X = data.drop(['Country','ISO','1980_dem', '1981_dem', '1982_dem','1983_dem','1984_dem','1985_dem','1986_dem','1987_dem','1988_dem','1989_dem','1990_dem','1991_dem','1992_dem','1993_dem','1994_dem','1995_dem','1996_dem','1997_dem','1998_dem','1999_dem','2000_dem','2001_dem','2002_dem','2003_dem','2004_dem','2005_dem','2006_dem','2007_dem','2008_dem','2009_dem','2010_dem','2011_dem','2012_dem','2013_dem','2014_dem','2015_dem','2016_dem','2017_dem','2018_dem','2019_dem','2020_dem','2021_dem'])
y = data['1980_dem']

model = RandomForestRegressor(n_estimators=50, max_features="auto", random_state=44)
model.fit(X_train, y_train)

# Split the DataFrame into a training set and a testing set
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=44)

# Use the trained model to make predictions on the test set
#predictions = model.predict(X_test)

# Calculate the accuracy of the predictions
#accuracy = model.score(X_test, y_test)
#print('Accuracy:', round(accuracy,2),'%.')
</code>```

expect to have created a model with Accuracy printed and poisbilit to predict values for future based on the model.

Body:
I'm working on the regresion model with population and demand values my data is for period from 1980 to 2021 by country, below example where under year is the number of population and under year_dem is the demand for item.

Taks is to create prediction model to forecast demand for each country in future.

# Import necessary libraries
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import train_test_split

# Load the dataset containing past data on vaccine demand and supply
data = df.iloc[0]
X = data.drop(['Country','ISO','1980_dem', '1981_dem', '1982_dem','1983_dem','1984_dem','1985_dem','1986_dem','1987_dem','1988_dem','1989_dem','1990_dem','1991_dem','1992_dem','1993_dem','1994_dem','1995_dem','1996_dem','1997_dem','1998_dem','1999_dem','2000_dem','2001_dem','2002_dem','2003_dem','2004_dem','2005_dem','2006_dem','2007_dem','2008_dem','2009_dem','2010_dem','2011_dem','2012_dem','2013_dem','2014_dem','2015_dem','2016_dem','2017_dem','2018_dem','2019_dem','2020_dem','2021_dem'])
y = data['1980_dem']

model = RandomForestRegressor(n_estimators=50, max_features="auto", random_state=44)
model.fit(X_train, y_train)

# Split the DataFrame into a training set and a testing set
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=44)

# Use the trained model to make predictions on the test set
#predictions = model.predict(X_test)

# Calculate the accuracy of the predictions
#accuracy = model.score(X_test, y_test)
#print('Accuracy:', round(accuracy,2),'%.')

expect to have created a model with Accuracy printed and poisbilit to predict values for future based on the model.


问:
I want to integrate image upload API in react native using react-native-image-crop-picker and in the image response I get only path not uri
```<code>const uploadFile = async () => {
  ImagePicker.openPicker({
    width: 300,
    height: 300,
    cropping: true,
    mediaType: "photo",
    forceJpg: true,
  }).then((option) => {
    console.log(option);
    setImage(option.path);
    const data = new FormData();
    data.append("file", {
      name: option?.filename,
      type: option?.mime,
      uri: option?.path,
    });
    axios.post(
      "Api_URL /provider/UploadFile",
      { file: data },
      {
        headers: {
          Authorization: authToken,
          "Content-Type": "multipart/form-data",
          Accept: "application/json",
        },
      }
    );
  });
};

</code>```

I'm new in this field so I don't have too much knowledge about it hope for the best Thank you

Body:
const uploadFile = async () => {
  ImagePicker.openPicker({
    width: 300,
    height: 300,
    cropping: true,
    mediaType: "photo",
    forceJpg: true,
  }).then((option) => {
    console.log(option);
    setImage(option.path);
    const data = new FormData();
    data.append("file", {
      name: option?.filename,
      type: option?.mime,
      uri: option?.path,
    });
    axios.post(
      "Api_URL /provider/UploadFile",
      { file: data },
      {
        headers: {
          Authorization: authToken,
          "Content-Type": "multipart/form-data",
          Accept: "application/json",
        },
      }
    );
  });
};

I'm new in this field so I don't have too much knowledge about it hope for the best Thank you


问:
How do I add a chain of trust with x509.CertificateBuilder?
I'm building a certificate with cryptography.x509.CertificateBuilder:

```<code>from pathlib import Path
from cryptography import x509
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives.serialization import Encoding

private_key: rsa.RSAPrivateKey

ca_cert: x509.Certificate
ca_cert_private_key: rsa.RSAPrivateKey

cert = (
    x509.CertificateBuilder()
    .subject_name(x509.Name.from_rfc4514_string(f"CN={workstation_name}"))
    .issuer_name(ca_cert.subject)
    .public_key(private_key.public_key())
    .serial_number(x509.random_serial_number())
    .not_valid_before(today)
    .not_valid_after(today + timedelta(days=60))
    .add_extension(subject_alt_name, critical=False)
    .sign(ca_cert_private_key)
)
Path("workstation.crt").write_bytes(cert.public_bytes(Encoding.PEM))
</code>```

How do I add the ca_cert to the certificate chain for the cert I'm creating?

E.g. for stackoverflow, the cert looks like this, and you can see that there are 3 certs in the chain

```<code>$ openssl s_client -connect stackoverflow.com:443
CONNECTED(00000003)
depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = R3
verify return:1
depth=0 CN = *.stackexchange.com
verify return:1
---
Certificate chain
 0 s:CN = *.stackexchange.com
   i:C = US, O = Let's Encrypt, CN = R3
   a:PKEY: rsaEncryption, 2048 (bit); sigalg: RSA-SHA256
   v:NotBefore: Dec 18 14:08:17 2022 GMT; NotAfter: Mar 18 14:08:16 2023 GMT
 1 s:C = US, O = Let's Encrypt, CN = R3
   i:C = US, O = Internet Security Research Group, CN = ISRG Root X1
   a:PKEY: rsaEncryption, 2048 (bit); sigalg: RSA-SHA256
   v:NotBefore: Sep  4 00:00:00 2020 GMT; NotAfter: Sep 15 16:00:00 2025 GMT
 2 s:C = US, O = Internet Security Research Group, CN = ISRG Root X1
   i:O = Digital Signature Trust Co., CN = DST Root CA X3
   a:PKEY: rsaEncryption, 4096 (bit); sigalg: RSA-SHA256
   v:NotBefore: Jan 20 19:14:03 2021 GMT; NotAfter: Sep 30 18:14:03 2024 GMT
---
</code>```

For the cert I'm creating there is only 1 certificate in the chain. How do I add the ca_cert as the 2nd?

```<code>$ openssl s_client -connect localhost:443
CONNECTED(00000003)
Can't use SSL_get_servername
depth=1 CN = [Redacted CA Cert Name]
verify return:1
depth=0 CN = [Redacted Workstation Name]
verify return:1
---
Certificate chain
 0 s:CN = [Redacted Workstation Name]
   i:CN = [Redacted CA Cert Name]
---
</code>```

Body:
I'm building a certificate with cryptography.x509.CertificateBuilder:

from pathlib import Path
from cryptography import x509
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives.serialization import Encoding

private_key: rsa.RSAPrivateKey

ca_cert: x509.Certificate
ca_cert_private_key: rsa.RSAPrivateKey

cert = (
    x509.CertificateBuilder()
    .subject_name(x509.Name.from_rfc4514_string(f"CN={workstation_name}"))
    .issuer_name(ca_cert.subject)
    .public_key(private_key.public_key())
    .serial_number(x509.random_serial_number())
    .not_valid_before(today)
    .not_valid_after(today + timedelta(days=60))
    .add_extension(subject_alt_name, critical=False)
    .sign(ca_cert_private_key)
)
Path("workstation.crt").write_bytes(cert.public_bytes(Encoding.PEM))

How do I add the ca_cert to the certificate chain for the cert I'm creating?

E.g. for stackoverflow, the cert looks like this, and you can see that there are 3 certs in the chain

$ openssl s_client -connect stackoverflow.com:443
CONNECTED(00000003)
depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = R3
verify return:1
depth=0 CN = *.stackexchange.com
verify return:1
---
Certificate chain
 0 s:CN = *.stackexchange.com
   i:C = US, O = Let's Encrypt, CN = R3
   a:PKEY: rsaEncryption, 2048 (bit); sigalg: RSA-SHA256
   v:NotBefore: Dec 18 14:08:17 2022 GMT; NotAfter: Mar 18 14:08:16 2023 GMT
 1 s:C = US, O = Let's Encrypt, CN = R3
   i:C = US, O = Internet Security Research Group, CN = ISRG Root X1
   a:PKEY: rsaEncryption, 2048 (bit); sigalg: RSA-SHA256
   v:NotBefore: Sep  4 00:00:00 2020 GMT; NotAfter: Sep 15 16:00:00 2025 GMT
 2 s:C = US, O = Internet Security Research Group, CN = ISRG Root X1
   i:O = Digital Signature Trust Co., CN = DST Root CA X3
   a:PKEY: rsaEncryption, 4096 (bit); sigalg: RSA-SHA256
   v:NotBefore: Jan 20 19:14:03 2021 GMT; NotAfter: Sep 30 18:14:03 2024 GMT
---

For the cert I'm creating there is only 1 certificate in the chain. How do I add the ca_cert as the 2nd?

$ openssl s_client -connect localhost:443
CONNECTED(00000003)
Can't use SSL_get_servername
depth=1 CN = [Redacted CA Cert Name]
verify return:1
depth=0 CN = [Redacted Workstation Name]
verify return:1
---
Certificate chain
 0 s:CN = [Redacted Workstation Name]
   i:CN = [Redacted CA Cert Name]
---


问:
Firebase error 403. Your client does not have permission to access this url
Dears

I'm having issue with my firebase lately. My app uses firebase authentication. Sometimes it works fine, but some times when I try to get OTP, I get error. After that even if I try to access firebase website from same device browser, I get the error 403. Your client does not have permission to access this URL. Means I cannot access firebase from that device at all.

Note that I'm in a country where we have restricted internet access and I have to use VPN to access many sites, including firebase. After few trials, when I change VPN servers, I can again access firebase in my browser, but as soon as I try using my app, it blocks again.

I have seached a lot on this issue, but couldn't find any solution. Most of the solutions are related to firebase cloud access, but in my case I cannot access firebase at all.

Please also note that I have tried using simulators as well as tried using my mobile for testing.

If you need any further details on the issue, please let me know.

PS: I'm a flutter developer and authentication is working fine if firebase access is not blocked.


问:
How do I send tweets with curl?
I'm trying to make the request with curl but I'm having a lot of problems with authentication.

Could anyone tell me how to make a simple curl request to send a tweet using the twitter v2 api?

Title: How do I send tweets with curl?


问:
iOS all function hook using frida
I wanna hook all functon in specific iOS app using frida

basically I tried 1 func like this

```<code>Interceptor.attach(func_address, {
    onEnter: function(args) {
        console.log("");
        console.log("[+] hooked!");
    },
    onLeave: function(retval) {}
});
</code>```

but I wanna automatcally hook all func with all func searching if it could

like

```<code>....
      ...searching 1000 funcs here it's saved in hook_func array
....

let hook_func = func_array[1000];
for(let i = 0; i < hook_func.length; i++) {
    Interceptor.attach(func_array[i], {
        onEnter: function(args) {
            console.log("");
            console.log("[+] detected somethin!");
    },
        onLeave: function(retval) {}
    });

}
</code>```

anyone try this before ...
I need your help (cry)

Title: iOS all function hook using frida

Body:
I wanna hook all functon in specific iOS app using frida

basically I tried 1 func like this

Interceptor.attach(func_address, {
    onEnter: function(args) {
        console.log("");
        console.log("[+] hooked!");
    },
    onLeave: function(retval) {}
});

but I wanna automatcally hook all func with all func searching if it could

like

....
      ...searching 1000 funcs here it's saved in hook_func array
....

let hook_func = func_array[1000];
for(let i = 0; i < hook_func.length; i++) {
    Interceptor.attach(func_array[i], {
        onEnter: function(args) {
            console.log("");
            console.log("[+] detected somethin!");
    },
        onLeave: function(retval) {}
    });

}

anyone try this before ...
I need your help (cry)


问:
pyspark dataframe imported from mongo containing 6 M records has two records as string ('Error...' ) and the rest are of structytpe. cant write to s3
I have to import data from mongodb using AWS Glue. i import the data in glue dynamic frame and conver glue df to spark df successfully. there is one field of struct datatype which gets it data from another server after it conducts a few tests in the form json object. one day their server went down and they were not able to perform their tests and our mongo server recorded their response as string - 'Error while checking the transaction for duplicate trueSample status'. out of a total of about 6 million records there are only two records of this type. this is causing my job to fail while writing this data as json to s3.
I want to know how can i put a condition that filters out these bad rows after the spark df is created from glue df.

```<code>df.filter(~spark_df.smplChnResp.startswith('Error while checking the transaction for duplicate trueSample status')).show()
</code>```

getting error as

```<code>AnalysisException: "cannot resolve 'startswith(`smplChnResp`, 'Error while checking the transaction for duplicate trueSample status')'
due to data type mismatch: argument 1 requires string type, however, '`smplChnResp`' is of
struct<Respondent:struct<country:string,country_code:string,latitude:double,longitude:double,respondent_risk:int,respondent_ud:string,threat_potential:string,threat_potential_score:int,time_zone:string,weather_code:string>,Surveys:array<struct<country_mismatch:int,description:string,duplicate_initial_ud:string,duplicate_potential:string,duplicate_score:int,failure_reason:string,flag:int,survey_number:string>>> type.;;
\n'Filter NOT StartsWith(smplChnResp#1039, Error while checking the transaction for duplicate trueSample status)
\n+- LogicalRDD
</code>```

Tried casting this column to string to filter out this row but still receiving error

```<code>df = df.filter(psf.col('smplChnResp').cast(pst.StringType()).contains('Error while checking') == False)

df.count()

Py4JJavaError: An error occurred while calling o422.showString.
: org.apache.spark.SparkException: Job aborted due to stage failure: Task 2 in stage 6.0 failed 4 times, most recent failure: Lost task 2.3 in stage 6.0 (TID 19, 172.34.161.54, executor 1): com.mongodb.spark.exceptions.MongoTypeConversionException: Cannot cast STRING into a StructType(StructField(Respondent,StructType(StructField(country,StringType,true), StructField(country_code,StringType,true), StructField(latitude,DoubleType,true), StructField(longitude,DoubleType,true), StructField(respondent_risk,IntegerType,true), StructField(respondent_ud,StringType,true), StructField(threat_potential,StringType,true), StructField(threat_pot
</code>```

Body:
I have to import data from mongodb using AWS Glue. i import the data in glue dynamic frame and conver glue df to spark df successfully. there is one field of struct datatype which gets it data from another server after it conducts a few tests in the form json object. one day their server went down and they were not able to perform their tests and our mongo server recorded their response as string - 'Error while checking the transaction for duplicate trueSample status'. out of a total of about 6 million records there are only two records of this type. this is causing my job to fail while writing this data as json to s3.
I want to know how can i put a condition that filters out these bad rows after the spark df is created from glue df.

df.filter(~spark_df.smplChnResp.startswith('Error while checking the transaction for duplicate trueSample status')).show()

getting error as

AnalysisException: "cannot resolve 'startswith(`smplChnResp`, 'Error while checking the transaction for duplicate trueSample status')'
due to data type mismatch: argument 1 requires string type, however, '`smplChnResp`' is of
struct<Respondent:struct<country:string,country_code:string,latitude:double,longitude:double,respondent_risk:int,respondent_ud:string,threat_potential:string,threat_potential_score:int,time_zone:string,weather_code:string>,Surveys:array<struct<country_mismatch:int,description:string,duplicate_initial_ud:string,duplicate_potential:string,duplicate_score:int,failure_reason:string,flag:int,survey_number:string>>> type.;;
\n'Filter NOT StartsWith(smplChnResp#1039, Error while checking the transaction for duplicate trueSample status)
\n+- LogicalRDD

Tried casting this column to string to filter out this row but still receiving error

df = df.filter(psf.col('smplChnResp').cast(pst.StringType()).contains('Error while checking') == False)

df.count()

Py4JJavaError: An error occurred while calling o422.showString.
: org.apache.spark.SparkException: Job aborted due to stage failure: Task 2 in stage 6.0 failed 4 times, most recent failure: Lost task 2.3 in stage 6.0 (TID 19, 172.34.161.54, executor 1): com.mongodb.spark.exceptions.MongoTypeConversionException: Cannot cast STRING into a StructType(StructField(Respondent,StructType(StructField(country,StringType,true), StructField(country_code,StringType,true), StructField(latitude,DoubleType,true), StructField(longitude,DoubleType,true), StructField(respondent_risk,IntegerType,true), StructField(respondent_ud,StringType,true), StructField(threat_potential,StringType,true), StructField(threat_pot


问:
what is the best output format / platform to display different sorts of extracted data?
I am writing a script, that extracts different types of data from different kind of custom log files.
But before I continue to write, I want to determine in what output format / platform I want it to be, so it is displayed properly or it can be read properly.

examples:

sometimes it is certain lines of text with an important word in it

sometimes it is a block of text between a start and end phrase

sometimes it are data points, which i then want to visualize better in a line chart

....

OR it is a combination of those

At first i thought i write it so that it is in a markdown file format, so i can for instance create fold able blocks, so that i just unfold the part that i want to read.
But markdown is not versatile. Meaning I cant create line charts or other kinds of stuff (thinking about the future)

So know I put the different types of data in different type of output formats and visualize them in an HTML file.

meaning, the blocks of text in a markdown file, which I then import though a java-script markdown viewer

the data points, I create a line chart through a java-script chart

.....

HOWEVER, I am not sure that this is the best/correct way to go .....

What is your advice ?


问:
AWS SAM CLI Not Shwoing Success Events In Terminal
[IMAGE OF MY TERMINAL]
1Iam able to successfully do sam build as well as sam deploy

but after doing sam deploy.. Iam not able to see success events in my terminal and terminal is still on hold waiting for success response. whereas, if i login to aws console and check the stack status its under creation_complete or update_complete but my terminal is still waiting for the response.

I tried to uninstall and reinstall aws cli as well as sam cli still no luck.

Iam using windows machine.

I basically expect terminal to show completed response.


问:
Is connecting(binding, inflating) layout with activity or fragment in constructor advisable? What android advice to use binding or constructor?
I used before view Binding to bind layout with activity or fragment, I saw that after Fragment 1.1.0 we can bind layout in constructor, which is performance. What android says.

Activity

With binding

```<code>class MainActivity : AppCompatActivity() {

    private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)
    }
}
</code>```

With constructor

```<code>class MainActivity : AppCompatActivity(R.layout.activity_main)
</code>```

Fragment

With binding

```<code>class MyFragment: Fragment() {

    private var _binding: MyFragmentBinding? = null
    private val binding get() = _binding!!

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        _binding = MyFragmentBinding.inflate(inflater, container, false)
        return binding.root
    }
}
</code>```

With constructor

```<code>class MyFragment: Fragment(R.layout.my_fragment) {

private var _binding: MyFragmentBinding? = null
private val binding get() = _binding!!

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)
    _binding = MyFragmentBinding.bind(view)
   }
}
</code>```

Body:
I used before view Binding to bind layout with activity or fragment, I saw that after Fragment 1.1.0 we can bind layout in constructor, which is performance. What android says.

Activity

With binding

class MainActivity : AppCompatActivity() {

    private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)
    }
}

With constructor

class MainActivity : AppCompatActivity(R.layout.activity_main)

Fragment

With binding

class MyFragment: Fragment() {

    private var _binding: MyFragmentBinding? = null
    private val binding get() = _binding!!

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        _binding = MyFragmentBinding.inflate(inflater, container, false)
        return binding.root
    }
}

With constructor

class MyFragment: Fragment(R.layout.my_fragment) {

private var _binding: MyFragmentBinding? = null
private val binding get() = _binding!!

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)
    _binding = MyFragmentBinding.bind(view)
   }
}


问:
How can import a serializer module from Django app with in the standalone script in the "scripts" package?
Here is my project setup.

ProjectDirectorty

AppDirectory

model.py

serializer.py

scripts Directory

init.py

main.py

manage.py

I am trying to call external API and get JSON data. Later deserialize it and store in the DB created by App.

When I am running main.py using python manage.py runscript main , I get error "Cannot import module 'scripts.main': No module named 'mix.mixapp'"

project setup

I understand diffrence between Script vs. Module and read Relative imports for the billionth time

I got stuck in this part of article "perhaps you don't actually want to run moduleX, you just want to run some other script, say myfile.py, that uses functions inside moduleX. If that is the case, put myfile.py somewhere else – not inside the package directory – and run it. If inside myfile.py you do things like from package.moduleA import spam, it will work fine."

It is similar to my case. I am running main.py which is in the "scripts" dir and using function from AppDirectory.

It didn't help. Please guide me to solve this problem.


问:
Convert Confluence Shorten Url to Confluence Actual Url
Example :

https://wiki.abc.com/x/ATftKg (Shorten Url)

to

https://wiki.abc.com/pages/viewpage.action?pageId=778910876

I am try to solve this using python language . I tried below solution but not helping . How can I unshorten a URL?


问:
C# extern alias
I have two assemblies with the exact same interface (lets call them Assem1 and Assem2)

Is it possible to use extern alias in order to call methods of Assem1 from Assem2?

The source code is something like this:

```<code>//Pre steps - set Reference in Assem1 to assem2 and set it's alias to Assem2Alias
//Both assemblies named MyAssembly.dll, has exact same interface but different Guids

//Assem1 code

extern alias Assem2;

using Assem2 = Assem2Alias.MyAssembly;

namespace MyAssembly
{
    public class MyClass
    {
        public int Foo()
        {
           return new Assem2.MyClass().Foo();
        }
    }
}
//Assem2 code
namespace MyAssembly
{
    public class MyClass
    {
        public int Foo()
        {
           return 10;
        }
    }
}
</code>```

Edited:
As requested - I'm adding extra information regard the general task:

I need to test application that uses ActiveX.exe to get data (responses) from external services.
My task is to replace this ActiveX.exe so I will control the responses.
Since the responses are large textual data, I would to generate the request using the original ActiveX.exe file.

The new assembly (Assem1 in my question) must have the exact same interface as the original ActiveX.exe (Assem2).
The general idea: Assem1 gets a request from the tested application. If the request matches response in its data source --> it read the response and return it to the application. If it does not match any of the responses, then Assem1 requests Assem2 for response, adds it to its data source and response to the tested application.

As mentioned both must have the exact same interface, so I uses extern alias to refer to the original ActiveX.exe.
All the examples on the internet using extern alias in C# specified to one assembly refering to two assemblies with the same interface, but not from one to each other.

ContentLicense: CC BY-SA 3.0

Title: C# extern alias

Body:
I have two assemblies with the exact same interface (lets call them Assem1 and Assem2)

Is it possible to use extern alias in order to call methods of Assem1 from Assem2?

The source code is something like this:

//Pre steps - set Reference in Assem1 to assem2 and set it's alias to Assem2Alias
//Both assemblies named MyAssembly.dll, has exact same interface but different Guids

//Assem1 code

extern alias Assem2;

using Assem2 = Assem2Alias.MyAssembly;

namespace MyAssembly
{
    public class MyClass
    {
        public int Foo()
        {
           return new Assem2.MyClass().Foo();
        }
    }
}
//Assem2 code
namespace MyAssembly
{
    public class MyClass
    {
        public int Foo()
        {
           return 10;
        }
    }
}

Edited:
As requested - I'm adding extra information regard the general task:

I need to test application that uses ActiveX.exe to get data (responses) from external services.
My task is to replace this ActiveX.exe so I will control the responses.
Since the responses are large textual data, I would to generate the request using the original ActiveX.exe file.

The new assembly (Assem1 in my question) must have the exact same interface as the original ActiveX.exe (Assem2).
The general idea: Assem1 gets a request from the tested application. If the request matches response in its data source --> it read the response and return it to the application. If it does not match any of the responses, then Assem1 requests Assem2 for response, adds it to its data source and response to the tested application.

As mentioned both must have the exact same interface, so I uses extern alias to refer to the original ActiveX.exe.
All the examples on the internet using extern alias in C# specified to one assembly refering to two assemblies with the same interface, but not from one to each other.


问:
PyTorch equivalent for Keras model
How to get the perfect copy of this Keras sequential network in PyTorch?

```<code>model = Sequential()
model.add(Masking(mask_value=-99., input_shape=(sequence_length, train_array.shape[2])))
model.add(LSTM(32, activation='tanh'))
model.add(Dense(1))

model.compile(loss='mean_squared_error', optimizer='adam')  # the model is recompiled to reset the optimizer
model.load_weights('simple_lstm_weights.h5')  # weights are reloaded to ensure reproducible results

history = model.fit(train_split_array, train_split_label,
                    validation_data=(val_split_array, val_split_label),
                    epochs=5,
                   batch_size=32)
</code>```

How to get the perfect copy of this Keras sequential network in PyTorch?

Title: PyTorch equivalent for Keras model

Body:
How to get the perfect copy of this Keras sequential network in PyTorch?

model = Sequential()
model.add(Masking(mask_value=-99., input_shape=(sequence_length, train_array.shape[2])))
model.add(LSTM(32, activation='tanh'))
model.add(Dense(1))

model.compile(loss='mean_squared_error', optimizer='adam')  # the model is recompiled to reset the optimizer
model.load_weights('simple_lstm_weights.h5')  # weights are reloaded to ensure reproducible results

history = model.fit(train_split_array, train_split_label,
                    validation_data=(val_split_array, val_split_label),
                    epochs=5,
                   batch_size=32)

How to get the perfect copy of this Keras sequential network in PyTorch?


问:
I want to :after and :before you to see the next and prev image
In my slideshow i have create :after and :before and i want the user to see the next and prev image.
Could some help me how to do this???

(I have a blur(10px) i want the background of blur to are the next and prev image)

Thanks a lot about your time.

our html

```<code>.slideshow2 {
    position: relative;
}

.slideshow2 .slider {
    width: 100%;
    height: auto;
}

.slideshow2::before {
    content: "";
    position: absolute;
    display: block;
    top: 0;
    left: 0;
    width: 6%;
    height: 100%;
    backdrop-filter: blur(10px);
    z-index: 2;
    border-right: 1.5px solid #fff;
}

.slideshow2::after {
    content: "";
    position: absolute;
    display: block;
    top: 0;
    right: 0;
    width: 6%;
    height: 100%;
    backdrop-filter: blur(10px);
    z-index: 2;
    border-left: 1.5px solid #fff;
}
</code>```

Body:
In my slideshow i have create :after and :before and i want the user to see the next and prev image.
Could some help me how to do this???

(I have a blur(10px) i want the background of blur to are the next and prev image)

Thanks a lot about your time.

our html

.slideshow2 {
    position: relative;
}

.slideshow2 .slider {
    width: 100%;
    height: auto;
}

.slideshow2::before {
    content: "";
    position: absolute;
    display: block;
    top: 0;
    left: 0;
    width: 6%;
    height: 100%;
    backdrop-filter: blur(10px);
    z-index: 2;
    border-right: 1.5px solid #fff;
}

.slideshow2::after {
    content: "";
    position: absolute;
    display: block;
    top: 0;
    right: 0;
    width: 6%;
    height: 100%;
    backdrop-filter: blur(10px);
    z-index: 2;
    border-left: 1.5px solid #fff;
}


问:
Address sanitizer ignorelist not working with visual studio 2019

I'm trying to use address-sanitizer with visual studio 2019 (version 16.9.2).
 I would like
to ignore some of the errors generated by address-sanitizer as they are emitted from external
libraries.

When I use /fsanitize-ignorelist=D:\asan_blacklist.txt in

Configuration Properties->C/C++->Command Line->Additional Options

/fsanitize-ignorelist=D:\asan_blacklist.txt

Then I get following error message

command line warning D9002: ignoring unknown option '/fsanitize-ignorelist=D:\asan_blacklist.txt'

I've also tried /fsanitize-blacklist=D:\asan_blacklist.txt option but no luck.


问:
Angular Unit testing event handle keypress is not returning the right value
I trying to do a unit testing for angular in jasmine test framework for an event of key event. I want to make the index become 0 when the value is less than 0.

```<code>      if ($event.code === 'ArrowUp') {
          if (this.currentIndex < 0) {
              this.currentIndex = 0;
          } else if (this.currentIndex > 0) {
              this.currentIndex--;
          }
</code>```
```<code>    it('should return 0 when value is less than 0', () => {
      const event = new KeyboardEvent('ArrowUp', { code: 'ArrowUp' });
      component['currentIndex'] = -5;
      component.handleKeyboardEvents(event);
      expect(component['currentIndex']).toBe(0);
    });
</code>```

it doesnt seem like the value was reassign

Body:
I trying to do a unit testing for angular in jasmine test framework for an event of key event. I want to make the index become 0 when the value is less than 0.

      if ($event.code === 'ArrowUp') {
          if (this.currentIndex < 0) {
              this.currentIndex = 0;
          } else if (this.currentIndex > 0) {
              this.currentIndex--;
          }

    it('should return 0 when value is less than 0', () => {
      const event = new KeyboardEvent('ArrowUp', { code: 'ArrowUp' });
      component['currentIndex'] = -5;
      component.handleKeyboardEvents(event);
      expect(component['currentIndex']).toBe(0);
    });

it doesnt seem like the value was reassign


问:
Qt Sql Database which model need to use
I have to fetch some data from different   database table and show in table view, the table view not contain all column from database but mixed from different data base table. I need to do the following.

Fetch few column from table1.

Fetch one cell from table2 and edit the data from table1(1 or 2 column).

Display the edited data on table view.

Update table1 on DB while user edit on table view.

Update table view in particular time interval.

So should I use QAbstractItemModel or SQL Model Classes like QSqlQueryModel, QSqlTableModel,QSqlRelationalTableModel .Whcih one is more suited in my scenario.

I looked in documentation but seems minimal example.

Title: Qt Sql Database which model need to use


问:
NoSuchMethodError in idea stream debug

It can be run successfully in idea, but cannot be debugged

Title: NoSuchMethodError in idea stream debug


问:
PyQt5: How to display web image with text together in QTextBrowser
I made a news crawler that crawls news' title and contents with 'requests' lib.
All the crawled data are displayed in QTextBrowser so that I can copy and paste to somewhere.

The problem is I have no idea on bringing images from the news content so that I can copy images with text together.

If QTextBrowser cannot do such thing, what would be a best solution to get all data from the news? To make me easier to copy and paste?


问:
wallpaper_manager 1.0.10: [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: type 'String' is not a subtype of type 'int?' in type cast
I am trying to set wallpaper using wallpaper_manager 1.0.10. But it is returning an error in the platform_channel.dart file. This is how I am setting the wallpaper.

```<code>var file = await DefaultCacheManager().getSingleFile(url);
final String result = await WallpaperManager.setWallpaperFromFile(
file.path.toString(), location);
</code>```

Please look at the screenshot below to know more about this issue.

Body:
I am trying to set wallpaper using wallpaper_manager 1.0.10. But it is returning an error in the platform_channel.dart file. This is how I am setting the wallpaper.

var file = await DefaultCacheManager().getSingleFile(url);
final String result = await WallpaperManager.setWallpaperFromFile(
file.path.toString(), location);

Please look at the screenshot below to know more about this issue.


问:
Cassnadra DELETE using mult-partition BATCH vs IN operator
We have a table where we need to process a group of  delete atomically  spread across partition keys Would it be referable to do  with a LOGGED BATCH  of separate DELETE statement ,or one DELETE with the keys to be deleted given in a WHERE.... IN (...) clause?</p>


问:
NextJS fetch API in getServerSideProps return connect ETIMEDOUT XXX.XXX.XXX.XXX:443
I'm using a function that calls an API fetch in getServerSideProps, but I'm getting the connect ETIMEDOUT XXX.XXX.XXX.XXX:443 error after a long load time.
I deployed the application on an apache server with pm2

I call the same API and it works for the redux use case.
The code works perfectly also locally, so I would like to know why it does not work on the online server


问:
In Client Assertion, issued time and expiry time are both coming as in past before the client assertion api call from postman
We are facing issue regarding, when we are call "Create JWT Client Assertion' API call from postman we can see 'Issued Time (iat) and Expiry time(exp) both coming as past values even before we are making the client assertion call.

Finally, when we are calling the next api, we are getting "Invalid Client_id" with an error description "Invalid JWT Token"

Please assist on how we can keep the client assertion call alive so that in the next API call it is not expired.

Please help.

We have tried to modify the x-duration-seconds in 'Create JWT' api call but still no luck.


问:
GetCurrentHwProfile not working in my "CLR Empty Project (.NET Framework)"
I would like to make a Windows Desktop application that is checking the hardware ID of currently used PC.
I'm using VS2019 and created a "CLR Empty Project (.NET Framework)". I created a new C++ file with exemplary code available on learn.microsoft:

```<code>#include <windows.h>
#include <stdio.h>
#include <tchar.h>

void main(void)
{
   HW_PROFILE_INFO   HwProfInfo;
   if (!GetCurrentHwProfile(&HwProfInfo))
   {
      _tprintf(TEXT("GetCurrentHwProfile failed with error %lx\n"),
                 GetLastError());
      return;
   }
   _tprintf(TEXT("DockInfo = %d\n"), HwProfInfo.dwDockInfo);
   _tprintf(TEXT("Profile Guid = %s\n"), HwProfInfo.szHwProfileGuid);
   _tprintf(TEXT("Friendly Name = %s\n"), HwProfInfo.szHwProfileName);
}
</code>```

Then I get the problems in this image: Error Message
When I do the same with an "Empty C++ Project" everything works as expected.

I would be really happy if someone could explain what's the problem and how to solve this.
Thanks!

Andy

Body:
I would like to make a Windows Desktop application that is checking the hardware ID of currently used PC.
I'm using VS2019 and created a "CLR Empty Project (.NET Framework)". I created a new C++ file with exemplary code available on learn.microsoft:

#include <windows.h>
#include <stdio.h>
#include <tchar.h>

void main(void)
{
   HW_PROFILE_INFO   HwProfInfo;
   if (!GetCurrentHwProfile(&HwProfInfo))
   {
      _tprintf(TEXT("GetCurrentHwProfile failed with error %lx\n"),
                 GetLastError());
      return;
   }
   _tprintf(TEXT("DockInfo = %d\n"), HwProfInfo.dwDockInfo);
   _tprintf(TEXT("Profile Guid = %s\n"), HwProfInfo.szHwProfileGuid);
   _tprintf(TEXT("Friendly Name = %s\n"), HwProfInfo.szHwProfileName);
}

Then I get the problems in this image: Error Message
When I do the same with an "Empty C++ Project" everything works as expected.

I would be really happy if someone could explain what's the problem and how to solve this.
Thanks!

Andy


问:
I need ordering the user's likes with start current user like in prisma
I am using prisma.
I need to get likes of posts with last 3 liked user .
So I want to get these user that starts with current user like .
Becouse I can check is liked this post in frontend part easly.
How can I do this issue with prisma.
Thanks for your help :)

let posts = await prisma.posts.findMany({
      where: {
        active: true,
      },
      orderBy: {
        id: 'desc'
      },
      select: {
        id: true,
        userId: true,
        text: true,
        files: {
          select: {
            files: true
          }
        },
        createdAt: true,
        active: true,
        user: {
          select: {
            id: true,
            fullName: true,
            profileImg: {
              select: {
                url: true
              }
            }
          },
        },
        _count: {
          select: {
            likes: true,
            comments: true
          }
        },
        likes: {
          orderBy: {
            id: 'desc'
          },
          select: {
            postId: true,
            userId: true,
            user: {
              select: {
                id: true,
                fullName: true,
                profileImg: {
                  select: {
                    url: true
                  }
                }
              },
            }
          },
          take: 3
        }
      },

    })
```


问:
conditions inside useEffect() is not working as expected in electron build windows
I am using useEffect() in reactjs for triggering api changes in the backend flask app. But when I run using npm run start it works fine. But when I build it into electron windows application it's not working as expected.

I am using backdrop as a loading animation when the api response status is in processing and dialog when status is completed.

```<code>useEffect(() => {
    return () => {
      Axios.get('http://localhost:8080/checkStatus')
        .then(
          res => {
            console.log(res.data)
            if (res.data === "Completed") {
              setSuccessDialog(true)
              console.log("completed")
              setDrop(false)
              alert("completed")
            }
            else if (res.data === "processing") {
              setDrop(!drop)
              console.log("processed")
            }
            setData(res.data)
            console.log(sessionStorage.getItem("sessionId"))
          })
    }
  }, [data])
</code>```

Above is the code for reference.

Body:
I am using useEffect() in reactjs for triggering api changes in the backend flask app. But when I run using npm run start it works fine. But when I build it into electron windows application it's not working as expected.

I am using backdrop as a loading animation when the api response status is in processing and dialog when status is completed.

useEffect(() => {
    return () => {
      Axios.get('http://localhost:8080/checkStatus')
        .then(
          res => {
            console.log(res.data)
            if (res.data === "Completed") {
              setSuccessDialog(true)
              console.log("completed")
              setDrop(false)
              alert("completed")
            }
            else if (res.data === "processing") {
              setDrop(!drop)
              console.log("processed")
            }
            setData(res.data)
            console.log(sessionStorage.getItem("sessionId"))
          })
    }
  }, [data])

Above is the code for reference.


问:
How to print the value of a env var as a key to different env var in bash
I have

```<code>export a=b
export b=c
</code>```

Now I want to print the value of a inside the key of other env var like

```<code>echo ${${a}} // so it must look like `echo ${b}`
</code>```

that must yield me c. But I am getting bad substitution error.
Please help.

Body:
I have

export a=b
export b=c

Now I want to print the value of a inside the key of other env var like

echo ${${a}} // so it must look like `echo ${b}`

that must yield me c. But I am getting bad substitution error.
Please help.


问:
How can call webapi(file upload) from .net core application

i want to consume Api from .net core application,but when i send file image along with data not do that


问:
Change text Input control of mobile keyboard on website
I have a text input field on a website that people have found confusing. To use it you have to hit the enter key on your keyboard, but since the mobile keyboard shows a return button people think it means new line and not submit.

I noticed that flutter has textInputAction property that can be changed, I was hoping that there may be something similar in html, css, or js that has similar fine grained control.

The only thing I have found is that type="search" guarantees a button that won't be return. This is a possible solution as the button I see for search fields is a generic checkmark, but I'd like to avoid mislabeling my input type. As well I'd like to avoid a magnifying glass icon which I believe has been and may still be used for some devices.


问:
How to add dynamic container in storage account
I want to add dynamic container into the storage account through logic app workflow by using upload blob to storage container.

Is there any way to add dynamic container into storage account according to month and date which is coming from api file like (created date or modified date).

I tried through the logic app connector like Upload blob to storage connector but didn't see any option there .


问:
Amplify backend pull failed in web host app
We have set the CI/CD pipeline in amplify and since 22nd Dec the backend build is getting failed and throwing the error "Failed to pull the backend" as per the attached screenshot,

Expected behavior: The build should be successfully completed. Here I'm attaching the last successful build screenshot,

I tried to redeploy the last successful build, but that also failed and gave the same error.

version details,
Node.js: 16.18.1
Amplify CLI Version: 10.5.2
OS: Amazon Linux 2

NOTE: The project is working fine locally, and also the amplify pull command runs successfully. In local I'm using windows.

Thank you.


问:
Error setting up log4j configuration using command line
I am trying to set up log4j configuration on my computer using the command line, but I am running into some problems. I have downloaded the log4j jar file and added it to my classpath, but when I try to run my Java application, I get an error saying that log4j is not found. I am not sure what I am doing wrong. Can anyone help me troubleshoot this issue?"

I tried to set up log4j configuration by downloading the log4j jar file and adding it to the classpath when running my Java application from the command line. I was expecting to be able to run my application without any errors and for log4j to be properly configured.


问:
How to make hive join performant?
I have one query as below:

Select a.col1,a.col2,b.col3,c.col4 from TableA A left join TableB B on a.col1=b.col2 left join TableC C on a.col1=c.col4  where a.col1='some value' and a.col2='some other value'

Now, will it be more performant if i change the above query like this in Hive?

Select a.col1,a.col2,b.col3,c.col4 from (select * from TableA where col1='some value' and col2='some other value' ) A left join TableB B on a.col1=b.col2 left join TableC C on a.col1=c.col4

Title: How to make hive join performant?


问:
How to undo the differencing diff() after creating a forecast on a non-stationary time series
I created a several forecasts with scalecast and named them fa, fb, and fc. It turned out that all series was non-stationary so I used the diff() function to improve the result on the forecasts. Here are my settings:

```<code>for f in (fa,fb,fc):
    f.generate_future_dates(6)
    f.set_test_length(12)
    f.set_validation_length(6)
    f.add_seasonal_regressors('month','quarter',raw=False,sincos=True)
    f.add_seasonal_regressors('year')
    f.add_time_trend()
    f.add_ar_terms(4)
    f.diff() # non-stationary data forecasts better differenced with this model
</code>```

After I have found and tuned the best model I get an "ok" result, but when exporting the data the forecast it is still differentiated. How can I revert back to the actuals of e.g. series "a" and add the forecasting values to it?

Plot of forecast "a":

```<code>mvf.plot(series='A', models="mlr", ci=True)
plt.title('A',size=16)
plt.show()
</code>```

enter image description here

Current export of forecast "a":

When i export "a" i get:

```<code>fa.export(dfs=["all_fcsts"],to_excel=True)
</code>```

enter image description here

So once again for the question, how can I revert back to un-differentiated series, add the forecasting values to them, and export all forecasts (fa, fb, and fc) to one excel?

Thanks!

/Allan

I have searched all over stackoverflow but cannot find a working undiff function...

Body:
I created a several forecasts with scalecast and named them fa, fb, and fc. It turned out that all series was non-stationary so I used the diff() function to improve the result on the forecasts. Here are my settings:

for f in (fa,fb,fc):
    f.generate_future_dates(6)
    f.set_test_length(12)
    f.set_validation_length(6)
    f.add_seasonal_regressors('month','quarter',raw=False,sincos=True)
    f.add_seasonal_regressors('year')
    f.add_time_trend()
    f.add_ar_terms(4)
    f.diff() # non-stationary data forecasts better differenced with this model

After I have found and tuned the best model I get an "ok" result, but when exporting the data the forecast it is still differentiated. How can I revert back to the actuals of e.g. series "a" and add the forecasting values to it?

Plot of forecast "a":

mvf.plot(series='A', models="mlr", ci=True)
plt.title('A',size=16)
plt.show()

enter image description here

Current export of forecast "a":

When i export "a" i get:

fa.export(dfs=["all_fcsts"],to_excel=True)

enter image description here

So once again for the question, how can I revert back to un-differentiated series, add the forecasting values to them, and export all forecasts (fa, fb, and fc) to one excel?

Thanks!

/Allan

I have searched all over stackoverflow but cannot find a working undiff function...


问:
Cin In struct for a string not working as expected
Here is the code as well as the output, it only takes the student name once.

```<code>#include <iostream>
#include<string>

using namespace std;
struct record
{
    string name;
    int marks[6];
    int total=0;
};
int index = 5;
record recorder[5];
void adder(record a[], int index)
{

    for (int i = 0; i < index; i++)
    {

        cout << "Enter the Student Name:\n";
            cin.clear();
        getline(cin, a[i].name);
        for (int j = 0; i < 6; i++)
        {
            cout << "Enter the " << j << " Subject Marks";
            cin >> a[i].marks[j];
        }

        for (int j = 0; i < 6; i++)
        {

            a[i].total += a[i].marks[j];
        }
    }
}
int comparer(record a[],int index){
    int i=0;
    int totalfn =0;
    while (i<index)
    {
        if (a[i].total>totalfn)
        {
            totalfn= a[i].total;
        }
        index++;
    }
    return totalfn;
}

void toppercalc(record a[] , int index ,int topper){
    for (int i = 0; i < index; i++)
    {
        if (topper == a[i].total)
        {
            cout<<a[i].name;
            return;
        }

    }

}
int main()
{
adder(recorder,index);
int topper = comparer(recorder,index);
toppercalc(recorder ,index , topper);
    return 0;
}
</code>```

Screenshot

```<code>Enter the Student Name:
mary
Enter the 0 Subject Marks
33
Enter the 0 Subject Marks
4
Enter the 0 Subject Marks
3
Enter the 0 Subject Marks
2
Enter the 0 Subject Marks
3
Enter the 0 Subject Marks
4

Enter the Student Name:
alina
Enter the 1 Subject Marks
33
Enter the 1 Subject Marks
4
Enter the 1 Subject Marks
3
Enter the 1 Subject Marks
2
Enter the 1 Subject Marks
3
Enter the 1 Subject Marks
4
</code>```

Body:
Here is the code as well as the output, it only takes the student name once.

#include <iostream>
#include<string>

using namespace std;
struct record
{
    string name;
    int marks[6];
    int total=0;
};
int index = 5;
record recorder[5];
void adder(record a[], int index)
{

    for (int i = 0; i < index; i++)
    {

        cout << "Enter the Student Name:\n";
            cin.clear();
        getline(cin, a[i].name);
        for (int j = 0; i < 6; i++)
        {
            cout << "Enter the " << j << " Subject Marks";
            cin >> a[i].marks[j];
        }

        for (int j = 0; i < 6; i++)
        {

            a[i].total += a[i].marks[j];
        }
    }
}
int comparer(record a[],int index){
    int i=0;
    int totalfn =0;
    while (i<index)
    {
        if (a[i].total>totalfn)
        {
            totalfn= a[i].total;
        }
        index++;
    }
    return totalfn;
}

void toppercalc(record a[] , int index ,int topper){
    for (int i = 0; i < index; i++)
    {
        if (topper == a[i].total)
        {
            cout<<a[i].name;
            return;
        }

    }

}
int main()
{
adder(recorder,index);
int topper = comparer(recorder,index);
toppercalc(recorder ,index , topper);
    return 0;
}

Screenshot

Enter the Student Name:
mary
Enter the 0 Subject Marks
33
Enter the 0 Subject Marks
4
Enter the 0 Subject Marks
3
Enter the 0 Subject Marks
2
Enter the 0 Subject Marks
3
Enter the 0 Subject Marks
4

Enter the Student Name:
alina
Enter the 1 Subject Marks
33
Enter the 1 Subject Marks
4
Enter the 1 Subject Marks
3
Enter the 1 Subject Marks
2
Enter the 1 Subject Marks
3
Enter the 1 Subject Marks
4


问:
Need suggestion for lit-- Cannot read properties of null (reading 'insertBefore')
We recently upgraded "lit": "^2.4.1",'

```<code>Value: TypeError: Cannot read properties of null (reading 'insertBefore')
at St.O (lit-html.js:1402:53)
at St.T (lit-html.js:1442:36)
at St.g (lit-html.js:1488:14)
at St._$AI (lit-html.js:1371:14)
at $t.p (lit-html.js:1181:16)
at St.$ (lit-html.js:1525:51)
at St._$AI (lit-html.js:1375:12)
at It (lit-html.js:2169:8)
at Ia.update (lit-element.js:165:24)
at Ia.performUpdate (reactive-element.js:1327:14) TypeError: Cannot read properties of null (reading 'insertBefore')
</code>```

Anyone can help here

Solution to solve the dump

Body:
We recently upgraded "lit": "^2.4.1",'

Value: TypeError: Cannot read properties of null (reading 'insertBefore')
at St.O (lit-html.js:1402:53)
at St.T (lit-html.js:1442:36)
at St.g (lit-html.js:1488:14)
at St._$AI (lit-html.js:1371:14)
at $t.p (lit-html.js:1181:16)
at St.$ (lit-html.js:1525:51)
at St._$AI (lit-html.js:1375:12)
at It (lit-html.js:2169:8)
at Ia.update (lit-element.js:165:24)
at Ia.performUpdate (reactive-element.js:1327:14) TypeError: Cannot read properties of null (reading 'insertBefore')

Anyone can help here

Solution to solve the dump


问:
Python watchdog - How to handle when the directory is deleted while watchdog is running async
I have a process where it monitors multiple watchdog threads in parallelly.

I did appended the directory to start the observer.

Here I'm using async to run multiple folder watcher as a separate taks and another task is to storing some data into database.

Task1 = folderwatcher --> it has multiple threads
Task2 = storing data into the db.

This is working fine as expected. But here i want to handle a scenario where if any of the directory been deleted by users, then watchdog should skip it..

Can anyone advise how I can handle this scenario?


问:
In elastic search, using the REST API and update by query, I need the search to wait for the completion before showing results
I have an index in Elastic Search (v7.15) that I'm updating by using the REST API and update_by_query?wait_for_completion.

While doing this update I might get some search hits in the index from other processes, I want them to wait for the completion of the update before returning any result.

I can see that ?refresh?wait_for can be used for this, but not with _update_by_query, is there an alternative?

As per the documentation for refresh:

Refreshing shards
Specifying the refresh parameter refreshes all shards once the request completes. This is different than the update API’s refresh parameter, which causes just the shard that received the request to be refreshed. Unlike the update API, it does not support wait_for.

What will happen if the _update_by_query is not completed and a search is performed?


问:
Cannot fetch hosts : [index_not_found_exception] no such index [kibana_sample_data_logs]
I am doing an implementain of EFK(elasticsearch, fluentd, kibana) stack on local host using docker container. I created a seprate nginx container to generate logs. I have also added the logtrail plugin to kibana .but logtrail plugin dont showing any logs . but when I go to kibana->discover then it showing the logs.

docker-compose.yaml

```<code>version: '3.0'
services:
  fluentd:
    container_name: fluentd
    build: ./fluentd
    volumes:
      - ./fluentd/conf:/fluentd/etc
    tty: true
    environment:
      - "ELASTIC_USERNAME=elastic"
      - "ELASTIC_PASSWORF=elastic"
    depends_on:
      - "elasticsearch"
    ports:
      - 24224:24224
      - 24224:24224/udp
    networks:
      - flunet

  elasticsearch:
    container_name: elasticsearch
    image: elasticsearch:7.17.8
    tty: true
    environment:
      - "node.name=elastic"
      - "cluster.name=docker-cluster"
      - "xpack.license.self_generated.type=basic"
      - "discovery.type=single-node"
      - "xpack.security.enabled=true"
      - "ELASTIC_USERNAME=elastic"
      - "ELASTIC_PASSWORD=elastic"
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "bootstrap.memory_lock=true"
      - "action.auto_create_index=-l*,+z*,+f*,fluentd-*,fluentd*"
      #- "action.auto_create_index=true"
       #      - "xpack.security.transport.ssl.enabled=true"
       #      - "xpack.security.transport.ssl.verification_mode=certificate"
       #      -"xpack.security.transport.ssl.keystore.path=/usr/share/elasticsearch/config/certificates/elastic-certificates.p12"
    #      - "xpack.security.transport.ssl.truststore.path=/usr/share/elasticsearch/config/certificates/elastic-certificates.p12"
    #      - ""
    ports:
      - 9200:9200
    expose:
      - 9200
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
      #    depends_on:
      #      - "fluentd"
    volumes:
      - elasticsearch:/usr/share/elasticsearch/data
    networks:
      - flunet

  kibana:
    container_name: kibana
    build: ./kibana
    environment:
      - "ELASTICSEARCH_HOSTS=http://elasticsearch:9200/"
      - "ELASTICSEARCH_URL=http://elasticsearch:9200/"
      - "ELASTICSEARCH_USERNAME=elastic"
      - "ELASTICSEARCH_PASSWORD=elastic"
      - "xpack.security.enabled=true"
    #      - "xpack.security.transport.ssl.enabled=true"
    depends_on:
      - "elasticsearch"
    ports:
      - 5601:5601
    depends_on:
      - "elasticsearch"
      - "fluentd"
    volumes:
      - ./kibana:/kibana/etc
    networks:
      - flunet

networks:
  flunet:
    name: flunet
    external: true
volumes:
  elasticsearch:
</code>```

**kibana dockerfile
**

```<code>FROM docker.elastic.co/kibana/kibana:7.17.8
RUN ./bin/kibana-plugin install https://github.com/sivasamyk/logtrail/releases/download/v0.1.31/logtrail-7.8.0-0.1.31.zip
RUN /usr/local/bin/kibana-docker --optimize
COPY logtrail.json ./plugins/logtrail/logtrail.json
</code>```

**logtrail.json
**

```<code>{
  "version" : 2,
  "index_patterns" : [
    {
      "es": {
        "default_index": "kibana_sample_data_logs"
      },
      "tail_interval_in_seconds": 10,
      "es_index_time_offset_in_seconds": 0,
      "display_timezone": "local",
      "display_timestamp_format": "MMM DD HH:mm:ss",
      "max_buckets": 500,
      "default_time_range_in_days" : 0,
      "max_hosts": 100,
      "max_events_to_keep_in_viewer": 5000,
      "default_search": "",
      "fields" : {
        "mapping" : {
            "timestamp" : "@timestamp",
            "hostname" : "host",
            "program": "machine.os",
            "message": "message"
        },
        "message_format": "{{{message}}}",
        "keyword_suffix" : "keyword"
      },
      "color_mapping" : {
      }
    },
    {
      "es": {
        "default_index": "kibana_sample_data_ecommerce"
      },
      "tail_interval_in_seconds": 10,
      "es_index_time_offset_in_seconds": 0,
      "display_timezone": "local",
      "display_timestamp_format": "MMM DD HH:mm:ss",
      "max_buckets": 500,
      "default_time_range_in_days" : 0,
      "max_hosts": 100,
      "max_events_to_keep_in_viewer": 5000,
      "default_search": "",
      "fields" : {
        "mapping" : {
            "timestamp" : "@timestamp",
            "hostname" : "currency",
            "program": "category",
            "message": "email"
        },
        "message_format": "{{{email}}}",
        "keyword_suffix" : "keyword"
      },
      "color_mapping" : {
      }
    }
  ]
}
</code>```

`

**My tree structure
**

```<code>.
├── contf
│   └── compose.yml
└── efk2
    ├── docker-compose.yml
    ├── fluentd
    │   ├── conf
    │   │   └── fluent.conf
    │   └── Dockerfile
    ├── kibana
    │   └── Dockerfile
    └── logtrail.json
</code>```

here is the screenshot of error
screen shot of error when i open logtrail plugin

how can solve this issue, do I need to share any information??

I want my logtrail plugin to show logs in kibana.

Body:
I am doing an implementain of EFK(elasticsearch, fluentd, kibana) stack on local host using docker container. I created a seprate nginx container to generate logs. I have also added the logtrail plugin to kibana .but logtrail plugin dont showing any logs . but when I go to kibana->discover then it showing the logs.

docker-compose.yaml

version: '3.0'
services:
  fluentd:
    container_name: fluentd
    build: ./fluentd
    volumes:
      - ./fluentd/conf:/fluentd/etc
    tty: true
    environment:
      - "ELASTIC_USERNAME=elastic"
      - "ELASTIC_PASSWORF=elastic"
    depends_on:
      - "elasticsearch"
    ports:
      - 24224:24224
      - 24224:24224/udp
    networks:
      - flunet

  elasticsearch:
    container_name: elasticsearch
    image: elasticsearch:7.17.8
    tty: true
    environment:
      - "node.name=elastic"
      - "cluster.name=docker-cluster"
      - "xpack.license.self_generated.type=basic"
      - "discovery.type=single-node"
      - "xpack.security.enabled=true"
      - "ELASTIC_USERNAME=elastic"
      - "ELASTIC_PASSWORD=elastic"
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "bootstrap.memory_lock=true"
      - "action.auto_create_index=-l*,+z*,+f*,fluentd-*,fluentd*"
      #- "action.auto_create_index=true"
       #      - "xpack.security.transport.ssl.enabled=true"
       #      - "xpack.security.transport.ssl.verification_mode=certificate"
       #      -"xpack.security.transport.ssl.keystore.path=/usr/share/elasticsearch/config/certificates/elastic-certificates.p12"
    #      - "xpack.security.transport.ssl.truststore.path=/usr/share/elasticsearch/config/certificates/elastic-certificates.p12"
    #      - ""
    ports:
      - 9200:9200
    expose:
      - 9200
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
      #    depends_on:
      #      - "fluentd"
    volumes:
      - elasticsearch:/usr/share/elasticsearch/data
    networks:
      - flunet

  kibana:
    container_name: kibana
    build: ./kibana
    environment:
      - "ELASTICSEARCH_HOSTS=http://elasticsearch:9200/"
      - "ELASTICSEARCH_URL=http://elasticsearch:9200/"
      - "ELASTICSEARCH_USERNAME=elastic"
      - "ELASTICSEARCH_PASSWORD=elastic"
      - "xpack.security.enabled=true"
    #      - "xpack.security.transport.ssl.enabled=true"
    depends_on:
      - "elasticsearch"
    ports:
      - 5601:5601
    depends_on:
      - "elasticsearch"
      - "fluentd"
    volumes:
      - ./kibana:/kibana/etc
    networks:
      - flunet

networks:
  flunet:
    name: flunet
    external: true
volumes:
  elasticsearch:

**kibana dockerfile
**

FROM docker.elastic.co/kibana/kibana:7.17.8
RUN ./bin/kibana-plugin install https://github.com/sivasamyk/logtrail/releases/download/v0.1.31/logtrail-7.8.0-0.1.31.zip
RUN /usr/local/bin/kibana-docker --optimize
COPY logtrail.json ./plugins/logtrail/logtrail.json

**logtrail.json
**

{
  "version" : 2,
  "index_patterns" : [
    {
      "es": {
        "default_index": "kibana_sample_data_logs"
      },
      "tail_interval_in_seconds": 10,
      "es_index_time_offset_in_seconds": 0,
      "display_timezone": "local",
      "display_timestamp_format": "MMM DD HH:mm:ss",
      "max_buckets": 500,
      "default_time_range_in_days" : 0,
      "max_hosts": 100,
      "max_events_to_keep_in_viewer": 5000,
      "default_search": "",
      "fields" : {
        "mapping" : {
            "timestamp" : "@timestamp",
            "hostname" : "host",
            "program": "machine.os",
            "message": "message"
        },
        "message_format": "{{{message}}}",
        "keyword_suffix" : "keyword"
      },
      "color_mapping" : {
      }
    },
    {
      "es": {
        "default_index": "kibana_sample_data_ecommerce"
      },
      "tail_interval_in_seconds": 10,
      "es_index_time_offset_in_seconds": 0,
      "display_timezone": "local",
      "display_timestamp_format": "MMM DD HH:mm:ss",
      "max_buckets": 500,
      "default_time_range_in_days" : 0,
      "max_hosts": 100,
      "max_events_to_keep_in_viewer": 5000,
      "default_search": "",
      "fields" : {
        "mapping" : {
            "timestamp" : "@timestamp",
            "hostname" : "currency",
            "program": "category",
            "message": "email"
        },
        "message_format": "{{{email}}}",
        "keyword_suffix" : "keyword"
      },
      "color_mapping" : {
      }
    }
  ]
}

`

**My tree structure
**

.
├── contf
│   └── compose.yml
└── efk2
    ├── docker-compose.yml
    ├── fluentd
    │   ├── conf
    │   │   └── fluent.conf
    │   └── Dockerfile
    ├── kibana
    │   └── Dockerfile
    └── logtrail.json

here is the screenshot of error
screen shot of error when i open logtrail plugin

how can solve this issue, do I need to share any information??

I want my logtrail plugin to show logs in kibana.


问:
Why I can't loop the last 2 elements in a list using a for loop in python after using .pop method?
In this python code:

```<code># make a list called sandwich_orders, fill it with names of sandwiches
sandwich_orders = ['American sub', 'Baked bean','Barros Luco', 'Bocadillo', 'Bosna']

# make an empty list called finished_sandwiches
finished_sandwiches = []

# loop through the list of sandwich orders, print message for each order
for sandwich_order in sandwich_orders:
    finished = sandwich_orders.pop()
    print(f"I made your {finished} sandwich")
    finished_sandwiches.append(finished)
    print(sandwich_orders)

for finished_sandwich in finished_sandwiches:
    print(finished_sandwich)
</code>```

after executing this code I've found that the last 3 elements of the list sandwich_orders are executed but 'American sub' and 'Baked bean' are not.

Although If I use a while looping it would work fine

```<code># make a list called sandwich_orders, fill it with names of sandwiches
sandwich_orders = ['American sub', 'Baked bean','Barros Luco', 'Bocadillo', 'Bosna']

# make an empty list called finished_sandwiches
finished_sandwiches = []

# loop through the list of sandwich orders, print message for each order
while sandwich_orders:
    finished = sandwich_orders.pop()
    print(f"I made your {finished} sandwich")
    finished_sandwiches.append(finished)
    print(sandwich_orders)

for finished_sandwich in finished_sandwiches:
    print(finished_sandwich)
</code>```

This will execute the whole list, so:
Why it didn't give the same answer in the for looping?

Body:
In this python code:

# make a list called sandwich_orders, fill it with names of sandwiches
sandwich_orders = ['American sub', 'Baked bean','Barros Luco', 'Bocadillo', 'Bosna']

# make an empty list called finished_sandwiches
finished_sandwiches = []

# loop through the list of sandwich orders, print message for each order
for sandwich_order in sandwich_orders:
    finished = sandwich_orders.pop()
    print(f"I made your {finished} sandwich")
    finished_sandwiches.append(finished)
    print(sandwich_orders)

for finished_sandwich in finished_sandwiches:
    print(finished_sandwich)

after executing this code I've found that the last 3 elements of the list sandwich_orders are executed but 'American sub' and 'Baked bean' are not.

Although If I use a while looping it would work fine

# make a list called sandwich_orders, fill it with names of sandwiches
sandwich_orders = ['American sub', 'Baked bean','Barros Luco', 'Bocadillo', 'Bosna']

# make an empty list called finished_sandwiches
finished_sandwiches = []

# loop through the list of sandwich orders, print message for each order
while sandwich_orders:
    finished = sandwich_orders.pop()
    print(f"I made your {finished} sandwich")
    finished_sandwiches.append(finished)
    print(sandwich_orders)

for finished_sandwich in finished_sandwiches:
    print(finished_sandwich)

This will execute the whole list, so:
Why it didn't give the same answer in the for looping?


问:
Plastic SCM - Avoid having two heads in main branch while developing with XLinks
We are a studio developing a set of projects in Unreal Engine. These projects share most of the Plugins, so each plugin has its own Cloud Plastic Repository and we reference them via XLinks.

We make these XLinks all editable so when changes are made in one project, they are checked in to the Plugin's repo.

The problem is that if two projects are working on the same Plugin, when they merge 2 heads are created inside the Plugins repo (the one referencing via XLink), needing to go to the plugin, merge the head, and then update the Xlinks accross all the projects.

A second problem is that we normally have around 10 Plugins linked via XLinks, so when we need to update the Main we need to go and do that manually for each Plugin and each project.

I love XLinks, I think are really good, but these two problems make friction and we developers end up having errors and tedious merges and updates.

Is there anything I can do to ease our updates? Is there a script or something we can write to help the day to day work?

Regards,


问:
Build failed with an exception. A problem occurred configuring project ':path_provider_android'
I add the path_provider to the project and when I run the project
I get this Error

What went wrong:
A problem occurred configuring project ':path_provider_android'.

Could not resolve all files for configuration ':path_provider_android:classpath'.
Could not find gradle-7.3.1.jar (com.android.tools.build:gradle:7.3.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.3.1/gradle-7.3.1.jar

and Iget the Error when I add the path provider

I try the ./gradlew clean build but it failed

I try to upgrade the gradle but it doesn't work
try to higher the minsdk still get the same error

and I Use diffrent version of path_provider


问:
Routing with NextJs in React
I'm trying to create a react app with NextJs, but the routing is not working. The homepage is working, but with my other page, which is my detail-page, it just says 404 error.

This is how my folder and project structure looks like:

```<code>const detail = () => {
    return(
        <h1>Detail side</h1>
    )
}

export default detail();
</code>```

Title: Routing with NextJs in React

Body:
I'm trying to create a react app with NextJs, but the routing is not working. The homepage is working, but with my other page, which is my detail-page, it just says 404 error.

This is how my folder and project structure looks like:

const detail = () => {
    return(

Detail side

    )
}

export default detail();


问:
Add different footers on pages in PDF generated from HTML
I am generating a PDF from HTML. My PDF contains different pages and those pages might have different footers. I know by using below CSS, we can add footers to pages which will repeat on all the pages.

I thought of manually adding footers by playing with pixels, but it is creating lot of issues. Have any one gone across this?

```<code>.template-footer {
    padding: 0px 10px;
    position: fixed;
    bottom: 0;
    height: 50px;
    opacity: 0.3;
}
</code>```

Body:
I am generating a PDF from HTML. My PDF contains different pages and those pages might have different footers. I know by using below CSS, we can add footers to pages which will repeat on all the pages.

I thought of manually adding footers by playing with pixels, but it is creating lot of issues. Have any one gone across this?

.template-footer {
    padding: 0px 10px;
    position: fixed;
    bottom: 0;
    height: 50px;
    opacity: 0.3;
}


问:
Hello, I tried to use the Vantage V API to check for the p/e ratio
I tried to use the Vantage V API to check for the p/e ratio ,but it didnt seem to work

the var price worked with [05. price] but it doesn't seem to work with [12. earnings per share]
does anybody know the value that should be used


问:
User inside Docker container can’t access X11 (but root can) on a Ubuntu 22.04 with Wayland
I am running Ubuntu 22.04 with Wayland and having trouble starting a Docker (Version: 20.10.22, build 3a2c30b) container as a specific user (ubuntu) that is created in the DOCKERFILE and in the entrypoint I use exec gosu ubuntu "$@".
I installed docker and ran the "docker-rootles-setuptool.sh".

My problem is, that only the root user inside the docker container can start X11 applications.

For example executing xterm as the default user (ubuntu) throws the error: xterm: Xt error: Can't open display: :0 but sudo xterm works.

This is the Dockerfile:

```<code>FROM osrf/ros:humble-desktop-full
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN apt-get update && apt-get install -y --no-install-recommends \
    tmux xterm gosu \
    python3-pip python3-vcstool python3-rosdep \
    ros-humble-turtlebot3* && \
    apt-get clean &&  rm -rf /var/lib/apt/lists/*

ARG USERNAME=ubuntu
ARG GROUP_ID=1000
ARG USER_ID=1000
RUN addgroup --gid $GROUP_ID ubuntu && \
    adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID ${USERNAME} && \
    usermod -g sudo ${USERNAME} && passwd -d ${USERNAME}

# Fix for: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
RUN su ${USERNAME} -c "pip install setuptools==58.2.0"
RUN su ${USERNAME} -c "rosdep update"

COPY --chown=${USER_ID}:${GROUP_ID} bug_planning/dependencies.yml /home/${USERNAME}/ros2_ws/src/dependencies.yml
WORKDIR /home/${USERNAME}/ros2_ws/
# RUN vcs import src < src/dependencies.yml && sudo apt-get update && \
#     rosdep install --from-paths src --ignore-src -r -y && /bin/bash -c ". /opt/ros/humble/setup.bash; colcon build --symlink-install" && \
#     sudo apt-get clean && sudo rm -rf /var/lib/apt/lists/*

RUN echo "set -g mouse on" > /home/${USERNAME}/.tmux.conf
RUN chmod +x /ros_entrypoint.sh
ENTRYPOINT [ "/ros_entrypoint.sh" ]
</code>```

This is the "/ros_entrypoint.sh" script that is used as the ENTRYPOINT int docker:

```<code>#!/bin/bash
set -e

DEFAULT_USER_ID=1000
#
# Ensure host and container have the same user ID. This is to allow both sides
# to read and write the shared directories.
#
if [ -v USER_ID ] && [ "$USER_ID" != "$DEFAULT_USER_ID" ]; then
    echo "Changing ubuntu user ID to match your host's user ID ($USER_ID)."
    echo "This operation can take a while..."

    usermod --uid "$USER_ID" ubuntu

    # Ensure all files in the home directory are owned by the new user ID
    find /home/ubuntu -user $DEFAULT_USER_ID -exec chown -h "$USER_ID" {} \;
fi
# If no command is provided, set bash to start interactive shell
if [ -z "$1" ]; then
    set - "/bin/bash" -l
fi

# setup ros2 environment
source "/opt/ros/$ROS_DISTRO/setup.bash" --
if [ -f "/home/ubuntu"/ros2_ws/install/setup.bash ]; then
    source "/home/ubuntu/ros2_ws/install/setup.bash" --
fi
exec gosu ubuntu "$@"
</code>```

And I try to start it using the following script:

```<code>#!/bin/bash
set -e
XSOCK=/tmp/.X11-unix
XAUTH="$HOME/.Xauthority"

HOST_DIR="$(pwd)/bug_planning"
DOCKER_DIR="/home/ubuntu/ros2_ws/src/bug_planning"

xhost +
docker run -it --rm \
    --name="bug_path_planning" \
    --mount type=bind,source="$XSOCK",target="$XSOCK" \
    --mount type=bind,source="$XAUTH",target="$XAUTH" \
    --env="DISPLAY=${DISPLAY}" \
    --env="XSOCK=${XSOCK}" \
    --env="XAUTH=${XAUTH}" \
    --shm-size=1g \
    --env="QT_X11_NO_MITSHM=1" \
    --mount type=bind,source="$HOST_DIR",target="$DOCKER_DIR" \
    bug:$(git rev-parse --abbrev-ref HEAD) tmux
xhost -
</code>```

I tryed

chown the X11 Socket in the container, but I get the error: "chmod: changing permissions of '/tmp/.X11-unix': Operation not permittet"

The permissions of '/tmp/.X11-unix' are as follows inside the container: drwxrwxrwt 2 nobody nogroup 4.0K Jan  5 06:35 .X11-unix

On the host I created a group with the UID (100999) and GUID (100999) of the user in the docker container (see here why 100999) and used sudo setfacl -R -m "g:docker_share:rx" /tmp/.X11-unix/ to add read and execute permissions to the X11 Socket for the group.

Sadly non of these things worked

Body:
I am running Ubuntu 22.04 with Wayland and having trouble starting a Docker (Version: 20.10.22, build 3a2c30b) container as a specific user (ubuntu) that is created in the DOCKERFILE and in the entrypoint I use exec gosu ubuntu "$@".
I installed docker and ran the "docker-rootles-setuptool.sh".

My problem is, that only the root user inside the docker container can start X11 applications.

For example executing xterm as the default user (ubuntu) throws the error: xterm: Xt error: Can't open display: :0 but sudo xterm works.

This is the Dockerfile:

FROM osrf/ros:humble-desktop-full
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN apt-get update && apt-get install -y --no-install-recommends \
    tmux xterm gosu \
    python3-pip python3-vcstool python3-rosdep \
    ros-humble-turtlebot3* && \
    apt-get clean &&  rm -rf /var/lib/apt/lists/*

ARG USERNAME=ubuntu
ARG GROUP_ID=1000
ARG USER_ID=1000
RUN addgroup --gid $GROUP_ID ubuntu && \
    adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID ${USERNAME} && \
    usermod -g sudo ${USERNAME} && passwd -d ${USERNAME}

# Fix for: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
RUN su ${USERNAME} -c "pip install setuptools==58.2.0"
RUN su ${USERNAME} -c "rosdep update"

COPY --chown=${USER_ID}:${GROUP_ID} bug_planning/dependencies.yml /home/${USERNAME}/ros2_ws/src/dependencies.yml
WORKDIR /home/${USERNAME}/ros2_ws/
# RUN vcs import src < src/dependencies.yml && sudo apt-get update && \
#     rosdep install --from-paths src --ignore-src -r -y && /bin/bash -c ". /opt/ros/humble/setup.bash; colcon build --symlink-install" && \
#     sudo apt-get clean && sudo rm -rf /var/lib/apt/lists/*

RUN echo "set -g mouse on" > /home/${USERNAME}/.tmux.conf
RUN chmod +x /ros_entrypoint.sh
ENTRYPOINT [ "/ros_entrypoint.sh" ]

This is the "/ros_entrypoint.sh" script that is used as the ENTRYPOINT int docker:

#!/bin/bash
set -e

DEFAULT_USER_ID=1000
#
# Ensure host and container have the same user ID. This is to allow both sides
# to read and write the shared directories.
#
if [ -v USER_ID ] && [ "$USER_ID" != "$DEFAULT_USER_ID" ]; then
    echo "Changing ubuntu user ID to match your host's user ID ($USER_ID)."
    echo "This operation can take a while..."

    usermod --uid "$USER_ID" ubuntu

    # Ensure all files in the home directory are owned by the new user ID
    find /home/ubuntu -user $DEFAULT_USER_ID -exec chown -h "$USER_ID" {} \;
fi
# If no command is provided, set bash to start interactive shell
if [ -z "$1" ]; then
    set - "/bin/bash" -l
fi

# setup ros2 environment
source "/opt/ros/$ROS_DISTRO/setup.bash" --
if [ -f "/home/ubuntu"/ros2_ws/install/setup.bash ]; then
    source "/home/ubuntu/ros2_ws/install/setup.bash" --
fi
exec gosu ubuntu "$@"

And I try to start it using the following script:

#!/bin/bash
set -e
XSOCK=/tmp/.X11-unix
XAUTH="$HOME/.Xauthority"

HOST_DIR="$(pwd)/bug_planning"
DOCKER_DIR="/home/ubuntu/ros2_ws/src/bug_planning"

xhost +
docker run -it --rm \
    --name="bug_path_planning" \
    --mount type=bind,source="$XSOCK",target="$XSOCK" \
    --mount type=bind,source="$XAUTH",target="$XAUTH" \
    --env="DISPLAY=${DISPLAY}" \
    --env="XSOCK=${XSOCK}" \
    --env="XAUTH=${XAUTH}" \
    --shm-size=1g \
    --env="QT_X11_NO_MITSHM=1" \
    --mount type=bind,source="$HOST_DIR",target="$DOCKER_DIR" \
    bug:$(git rev-parse --abbrev-ref HEAD) tmux
xhost -

I tryed

chown the X11 Socket in the container, but I get the error: "chmod: changing permissions of '/tmp/.X11-unix': Operation not permittet"

The permissions of '/tmp/.X11-unix' are as follows inside the container: drwxrwxrwt 2 nobody nogroup 4.0K Jan  5 06:35 .X11-unix

On the host I created a group with the UID (100999) and GUID (100999) of the user in the docker container (see here why 100999) and used sudo setfacl -R -m "g:docker_share:rx" /tmp/.X11-unix/ to add read and execute permissions to the X11 Socket for the group.

Sadly non of these things worked


问:
I am unable to connect visual basic to MYSQL
Hi I am trying to connect visual basic to MYSQL but I am having two errors. One is when clicking on the drop-down list of databases it doesn't show any database; instead it displays an error saying UNABLE TO RETRIEVE LIST OF DATABASES, with that i add the database manually by typing it down and click on OK. Now I want to expand the tables folder on the server explorer and another error pops up which is CHARACTER SET UTF8MB3 IS NOT SUPPORTED BY .NET FRAMEWORK.

Error 1 - character set utf8mb3 is not supported by .net framework

Error 2 - unable to retrieve list of databases

I have searched for countless solutions on youtube and here on stack but to no avail. I even tried to downgrade MYSQL versions hoping it would solve the problem but I am still getting the same errors. I am using visual basic 2019 and MYSQL workbench, the server is up and running. I am stuck in these two errors and cannot find a solution. If anyone could shed a light here and guide me on the errors. I have attached two screenshots of the errors.


问:
How to generate random value in api using rest assured framework
I'm using restAssured framework for api automation
this the request body

```<code>{
  "requestNumber": 705,
  "referenceNumber": "abcde1",
  "cardType": "Corporate 1000",
  "companyName": "NSX",
   "rejectMessage": "Invalid request",
  "contactEmail": "abc@gmail.com",

  "serviceProviderEmailList": [
    "ddd@gmail.com",
    "Lorem in"
  ],
  "approvedBy": "sup",
  "approvedDate": "2020-09-23T09:11:31.020Z"
}
</code>```

Here i am passing reference number that is unique value

After everyrun it will accept unique value only so how i need generate random value here
after every script run it should generate unique value

Body:
I'm using restAssured framework for api automation
this the request body

{
  "requestNumber": 705,
  "referenceNumber": "abcde1",
  "cardType": "Corporate 1000",
  "companyName": "NSX",
   "rejectMessage": "Invalid request",
  "contactEmail": "abc@gmail.com",

  "serviceProviderEmailList": [
    "ddd@gmail.com",
    "Lorem in"
  ],
  "approvedBy": "sup",
  "approvedDate": "2020-09-23T09:11:31.020Z"
}

Here i am passing reference number that is unique value

After everyrun it will accept unique value only so how i need generate random value here
after every script run it should generate unique value


问:
Augmented Dickey Fuller test: p-value is a nan
I am trying to predict some time series and would like to check stationarity using the p-value of the augmented Dickey-Fuller test:

from statsmodels.tsa.stattools import adfuller
df = pd.read_csv(path)
adfuller(df['values'])
```
<p>With a working example, the following is printed:</p>
```ADF: -12.792326588071095
P-Value: 7.033712977770105e-24
Number of Lags: 0
Number of observations: 165
```
<p>The problem is that for some time series the values are 'nan' and I don't know why.</p>
<p>Here is an example:</p>
```ADF: nan
P-Value: nan
Number of Lags: 0
Number of observations: 165
```
<p>I would like to understand the following:<br />
What does it mean? What is the reason for these results and how can I solve the problem?</p>
<p>This is a part from one DataFrame</p>
<pre class="lang-py prettyprint-override"><code>df.head()
</code>```

value

0
35.54

1
2.022

2
1.94

3
0.0

4
34.89

df.head().to_csv()
',value\r\n0,35.54\r\n1,2.022\r\n2,1.94\r\n3,0.0\r\n4,34.89\r\n'
```

Body:
I am trying to predict some time series and would like to check stationarity using the p-value of the augmented Dickey-Fuller test:

from statsmodels.tsa.stattools import adfuller
df = pd.read_csv(path)
adfuller(df['values'])

With a working example, the following is printed:

ADF: -12.792326588071095
P-Value: 7.033712977770105e-24
Number of Lags: 0
Number of observations: 165

The problem is that for some time series the values are 'nan' and I don't know why.

Here is an example:

ADF: nan
P-Value: nan
Number of Lags: 0
Number of observations: 165

I would like to understand the following:

What does it mean? What is the reason for these results and how can I solve the problem?

This is a part from one DataFrame

df.head()

value

0
35.54

1
2.022

2
1.94

3
0.0

4
34.89

df.head().to_csv()
',value\r\n0,35.54\r\n1,2.022\r\n2,1.94\r\n3,0.0\r\n4,34.89\r\n'


问:
Reassembly of IPV6 packets might not work?
I think it should be possible to send long ICMP ping or UDP from Host to node from Host.
( UIP_CONF_IPV6_REASSEMBLY =1)

MTU is set 1500 bytes on the host ( via tunslip6 ) and on node UIP_LINK_MTU 1500.

I have send long ping (-s 2000) from Host to Node.
I can see Linux split ping on 2 parts but Contiki-NG drop second part:

[WARN: IPv6      ] incomplete IPv6 header received (8 bytes)

[WARN: IPv6      ] incomplete IPv6 header received (8 bytes)

[WARN: IPv6      ] incomplete IPv6 header received (7 bytes)

Most probably it is not understand fragmentation header and drop fragments.

Node have also simple UDP echo server but result is the same.

Cam I be sure if UIP_CONF_IPV6_REASSEMBLY =1 configuration in UIP stack is implemented ?