问:
Display the data in the HTML table as well as in the table
To create the database, I used WAMP and with the help of PhpMyAdmin.
Data display problem in the database table and in the HTML table.

```<code><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
    <style>
    body{
        background-color:#000

    }
    h1,h2,h3,h4,h5,h6{
            color:#fff
    }
    hr{
        border-color:#999
    }
    tr,th,td,label{
        color:#fff
    }
    input[type="text"]{
        background-color:#999;
    }
    </style>
    <title>Affichage Test</title>
</head>
<body>
    <div  class="container col-md-12">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <br>
                <h3 class="text-center">Formulaire des Résidences</h3>
                <hr>
                <br>
            </div>
        </div>
        <div class="row">
            <div class="col-md-8">
                <h3 class="text-center">Afficher les données de la BDD</h3>
                <hr>
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <th>Filiale</th>
                            <th>Société</th>
                            <th>Résidence</th>
                            <th>Res_site</th>
                            <th>Adresse</th>
                            <th>CP</th>
                            <th>Ville</th>
                            <th>Téléphone</th>
                            <th>Mobile</th>
                            <th>Mail</th>
                            <th>Nb de logts</th>
                            <th>Syndic</th>
                            <th>N°Siret</th>
                            <th>Numéro_TVA_Intracommunautaire</th>
                            <th>Capital</th>
                            <th>Code_NAF_APE</th>
                            <th>IBAN</th>
                            <th>BIC</th>
                            <td colspan="2" class="text-center" >Action</td>
                        </tr>
                        <?php
                            $serverName = "localhost";
                            $dbname = "bddtest";
                            $password = "r7c9d1!mqtC";
                            $username = "root";
                            try{
                                if(isset($_POST['btn_Ajout']))
                                {
                                $filiale = $_POST['txtfiliale'];
                                $societe = $_POST['txtsociete'];
                                $residence = $_POST['txtresidence'];
                                $resp = $_POST['txtresp'];
                                $adresse = $_POST['txtadresse'];
                                $cp = $_POST['txtcp'];
                                $ville = $_POST['txtville'];
                                $tel = $_POST['txttel'];
                                $mobile = $_POST['txtmobile'];
                                $mail = $_POST['txtmail'];
                                $nblgts = $_POST['txtnblgts'];
                                $syndic = $_POST['txtsyndic'];
                                $siret = $_POST['txtsiret'];
                                $tva = $_POST['txttva'];
                                $capital = $_POST['txtcapital'];
                                $code = $_POST['txtcode'];
                                $iban = $_POST['txtiban'];
                                $bic = $_POST['txtbic'];

                                // Connexion à la base de données
                                $dbco = new PDO("mysql:host=$serverName;dbname=$dbname",$username,$password);
                                $dbco->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                                echo "Connexion réussi";
                                //On récupère les infos de la table
                                $sth = $dbco->prepare("SELECT (Filiale, Societe, Residences, Resp_residence, Adresse, CP, Ville, Telephone, Mobile, Mail, Nb_de_logts, Syndic, N_Siret, Numero_TVA_Intracommunautaire, Capital, Code_NAF_APE, IBAN, BIC) FROM residences");
                                $sth->execute();

                                //On affiche le résultat dans un tableau
                                while($donnees = $sth->fetch()){
                                    //On affiche toutes les informations des residences
                                    echo"<tr";
                                    echo"</th> $donnees[Filiale]<th>";
                                    echo"</th> $donnees[Société]<th>";
                                    echo"</th> $donnees[Résidence]<th>";
                                    echo"</th> $donnees[Res_site]<th>";
                                    echo"</th> $donnees[Adresse]<th>";
                                    echo"</th> $donnees[CP]<th>";
                                    echo"</th> $donnees[Ville]<th>";
                                    echo"</th> $donnees[Téléphone]<th>";
                                    echo"</th> $donnees[Mobile]<th>";
                                    echo"</th> $donnees[Mail]<th>";
                                    echo"</th> $donnees[Nb_de_logts]<th>";
                                    echo"</th> $donnees[Syndic]<th>";
                                    echo"</th> $donnees[N°Siret]<th>";
                                    echo"</th> $donnees[Numéro_TVA_Intracommunautaire]<th>";
                                    echo"</th> $donnees[Capital]<th>";
                                    echo"</th> $donnees[Code_NAF_APE]<th>";
                                    echo"</th> $donnees[IBAN]<th>";
                                    echo"</th> $donnees[BIC]<th>";
                                    echo"</tr";
                                }

                                // Insertion des données dans la table
                                $sth = $dbco->prepare("INSERT INTO residences(Filiale, Societe, Residences, Resp_residence, Adresse, CP, Ville, Telephone, Mobile, Mail, Nb_de_logts, Syndic, N_Siret, Numero_TVA_Intracommunautaire, Capital, Code_NAF_APE, IBAN, BIC) VALUES($filiale, $societe, $residence, $resp, $adresse, $cp, $ville, $tel, $mobile, $mail, $nblgts, $syndic, $siret, $tva, $capital, $code, $iban, $bic)");
                                $sth->execute($filiale, $societe, $residence, $resp, $adresse, $cp, $ville, $tel, $mobile, $mail, $nblgts, $syndic, $siret, $tva, $capital, $code, $iban, $bic);
                                echo "Insertion réussi";

                                }

                            }
                            catch(PDOException $e){
                                echo 'Impossible de traiter les données. Erreur : '.$e->getMessage();
                            }
                        ?>
                    </thead>
                    <tbody>
                            <td><a href="#" class="btn btn-danger">Supprimer</a></td>
                            <td><a href="#" class="btn btn-info">Modifier</a></td>
                        </tr>
                    </tbody>
                </table>
            </div>

            <div class="col-md-4">
                <h3 class="text-center">Ajouter des Résidences</h3>
                <hr>
                <form method="post" action="">
                    <div class="form-row">
                        <div class="form-group col-md-3">
                        <label>Filiale :</label>
                        <select class="form-control" name="txtfiliale" >
                            <option value="Tourisme">Tourisme</option>
                            <option value="Etudiants">Etudiants</option>
                            <option value="Affaires">Affaires</option>
                        </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label>Société :</label>
                        <input type="text" name="txtsociete" class="form-control" placeholder="Tapez la société" value="societe"> </input>
                    </div>
                    <div class="form-group">
                        <label>Résidence :</label>
                        <input type="text" name="txtresidence" class="form-control" placeholder="Tapez le nom de la résidence"> </input>
                    </div>
                    <div class="form-group">
                        <label>Responsable de résidence :</label>
                        <input type="text" name="txtresp" class="form-control" placeholder="Tapez le Responsable de site"> </input>
                    </div>
                    <div class="form-group">
                        <label>Adresse :</label>
                        <input type="text" name="txtadresse" class="form-control" placeholder="Tapez l'adresse"> </input>
                    </div>
                    <div class="form-group">
                        <label>Code Postal :</label>
                        <input type="text" name="txtcp" class="form-control" placeholder="Tapez le code postal"> </input>
                    </div>
                    <div class="form-group">
                        <label>Ville :</label>
                        <input type="text" name="txtville" class="form-control" placeholder="Tapez la ville"> </input>
                    </div>
                    <div class="form-group">
                        <label>Téléphone :</label>
                        <input type="text" name="txttel" class="form-control" placeholder="Tapez le téléphone"> </input>
                    </div>
                    <div class="form-group">
                        <label>Mobile :</label>
                        <input type="text" name="txtmobile" class="form-control" placeholder="Tapez le mobile"> </input>
                    </div>
                    <div class="form-group">
                        <label>Mail :</label>
                        <input type="text" name="txtmail" class="form-control" placeholder="Tapez le mail"> </input>
                    </div>
                    <div class="form-group">
                        <label>Nombre de logement :</label>
                        <input type="text" name="txtnblgts" class="form-control" placeholder="Tapez le nombre de logements"> </input>
                    </div>
                    <div class="form-group">
                        <label>Syndic :</label>
                        <input type="text" name="txtsyndic" class="form-control" placeholder="Tapez le syndic"> </input>
                    </div>
                    <div class="form-group">
                        <label>N°Siret :</label>
                        <input type="text" name="txtsiret" class="form-control" placeholder="Tapez le numéro de siret "> </input>
                    </div>
                    <div class="form-group">
                        <label>Numéro TVA Intracommuanuataire :</label>
                        <input type="text" name="txttva" class="form-control" placeholder="Tapez le numéro de TVA intracommunautaire"> </input>
                    </div>
                    <div class="form-group">
                        <label>Capital :</label>
                        <input type="text" name="txtcapital" class="form-control" placeholder="Tapez le capital"> </input>
                    </div>
                    <div class="form-group">
                        <label>Code NAF/APE :</label>
                        <input type="text" name="txtcode" class="form-control" placeholder="Tapez le code NAF/APE"> </input>
                    </div>
                    <div class="form-group">
                        <label>IBAN :</label>
                        <input type="text" name="txtiban" class="form-control" placeholder="Tapez l'Iban"> </input>
                    </div>
                    <div class="form-group">
                        <label>BIC :</label>
                        <input type="text" name="txtbic" class="form-control" placeholder="Tapez le Bic"> </input>
                    </div>
                    <div class="form-group">
                        <input type="submit" name="btn_Ajout" class="btn btn-primary btn-block" value="Enregistrer"></input>
                        <hr>
                    </div>
                </form>
            </div>
        </div>
    </div>
</body>
</html>
</code>```

Error message :

Connexion réussiImpossible de traiter les données. Erreur : SQLSTATE[42000]: Syntax error or access violation: 1064 Erreur de syntaxe pr�s de ' , , , , , , , , , , , , , , )' � la ligne 1

Body:
To create the database, I used WAMP and with the help of PhpMyAdmin.
Data display problem in the database table and in the HTML table.

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">

    <title>Affichage Test</title>

Formulaire des Résidences

Afficher les données de la BDD

                            Filiale
                            Société
                            Résidence
                            Res_site
                            Adresse
                            CP
                            Ville
                            Téléphone
                            Mobile
                            Mail
                            Nb de logts
                            Syndic
                            N°Siret
                            Numéro_TVA_Intracommunautaire
                            Capital
                            Code_NAF_APE
                            IBAN
                            BIC
                            Action

                        <?php
                            $serverName = "localhost";
                            $dbname = "bddtest";
                            $password = "r7c9d1!mqtC";
                            $username = "root";
                            try{
                                if(isset($_POST['btn_Ajout']))
                                {
                                $filiale = $_POST['txtfiliale'];
                                $societe = $_POST['txtsociete'];
                                $residence = $_POST['txtresidence'];
                                $resp = $_POST['txtresp'];
                                $adresse = $_POST['txtadresse'];
                                $cp = $_POST['txtcp'];
                                $ville = $_POST['txtville'];
                                $tel = $_POST['txttel'];
                                $mobile = $_POST['txtmobile'];
                                $mail = $_POST['txtmail'];
                                $nblgts = $_POST['txtnblgts'];
                                $syndic = $_POST['txtsyndic'];
                                $siret = $_POST['txtsiret'];
                                $tva = $_POST['txttva'];
                                $capital = $_POST['txtcapital'];
                                $code = $_POST['txtcode'];
                                $iban = $_POST['txtiban'];
                                $bic = $_POST['txtbic'];

                                // Connexion à la base de données
                                $dbco = new PDO("mysql:host=$serverName;dbname=$dbname",$username,$password);
                                $dbco->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                                echo "Connexion réussi";
                                //On récupère les infos de la table
                                $sth = $dbco->prepare("SELECT (Filiale, Societe, Residences, Resp_residence, Adresse, CP, Ville, Telephone, Mobile, Mail, Nb_de_logts, Syndic, N_Siret, Numero_TVA_Intracommunautaire, Capital, Code_NAF_APE, IBAN, BIC) FROM residences");
                                $sth->execute();

                                //On affiche le résultat dans un tableau
                                while($donnees = $sth->fetch()){
                                    //On affiche toutes les informations des residences
                                    echo"<tr";
                                    echo"	 $donnees[Filiale]";
                                    echo"	 $donnees[Société]";
                                    echo"	 $donnees[Résidence]";
                                    echo"	 $donnees[Res_site]";
                                    echo"	 $donnees[Adresse]";
                                    echo"	 $donnees[CP]";
                                    echo"	 $donnees[Ville]";
                                    echo"	 $donnees[Téléphone]";
                                    echo"	 $donnees[Mobile]";
                                    echo"	 $donnees[Mail]";
                                    echo"	 $donnees[Nb_de_logts]";
                                    echo"	 $donnees[Syndic]";
                                    echo"	 $donnees[N°Siret]";
                                    echo"	 $donnees[Numéro_TVA_Intracommunautaire]";
                                    echo"	 $donnees[Capital]";
                                    echo"	 $donnees[Code_NAF_APE]";
                                    echo"	 $donnees[IBAN]";
                                    echo"	 $donnees[BIC]";
                                    echo"
prepare("INSERT INTO residences(Filiale, Societe, Residences, Resp_residence, Adresse, CP, Ville, Telephone, Mobile, Mail, Nb_de_logts, Syndic, N_Siret, Numero_TVA_Intracommunautaire, Capital, Code_NAF_APE, IBAN, BIC) VALUES($filiale, $societe, $residence, $resp, $adresse, $cp, $ville, $tel, $mobile, $mail, $nblgts, $syndic, $siret, $tva, $capital, $code, $iban, $bic)");
                                $sth->execute($filiale, $societe, $residence, $resp, $adresse, $cp, $ville, $tel, $mobile, $mail, $nblgts, $syndic, $siret, $tva, $capital, $code, $iban, $bic);
                                echo "Insertion réussi";

                                }

                            }
                            catch(PDOException $e){
                                echo 'Impossible de traiter les données. Erreur : '.$e->getMessage();
                            }
                        ?>

                            Supprimer
                            Modifier

Ajouter des Résidences

                <form method="post" action="">

                        Filiale :
                        <select class="form-control" name="txtfiliale" >
                            <option value="Tourisme">Tourisme</option>
                            <option value="Etudiants">Etudiants</option>
                            <option value="Affaires">Affaires</option>
                        </select>

                        Société :
                        <input type="text" name="txtsociete" class="form-control" placeholder="Tapez la société" value="societe"> </input>

                        Résidence :
                        <input type="text" name="txtresidence" class="form-control" placeholder="Tapez le nom de la résidence"> </input>

                        Responsable de résidence :
                        <input type="text" name="txtresp" class="form-control" placeholder="Tapez le Responsable de site"> </input>

                        Adresse :
                        <input type="text" name="txtadresse" class="form-control" placeholder="Tapez l'adresse"> </input>

                        Code Postal :
                        <input type="text" name="txtcp" class="form-control" placeholder="Tapez le code postal"> </input>

                        Ville :
                        <input type="text" name="txtville" class="form-control" placeholder="Tapez la ville"> </input>

                        Téléphone :
                        <input type="text" name="txttel" class="form-control" placeholder="Tapez le téléphone"> </input>

                        Mobile :
                        <input type="text" name="txtmobile" class="form-control" placeholder="Tapez le mobile"> </input>

                        Mail :
                        <input type="text" name="txtmail" class="form-control" placeholder="Tapez le mail"> </input>

                        Nombre de logement :
                        <input type="text" name="txtnblgts" class="form-control" placeholder="Tapez le nombre de logements"> </input>

                        Syndic :
                        <input type="text" name="txtsyndic" class="form-control" placeholder="Tapez le syndic"> </input>

                        N°Siret :
                        <input type="text" name="txtsiret" class="form-control" placeholder="Tapez le numéro de siret "> </input>

                        Numéro TVA Intracommuanuataire :
                        <input type="text" name="txttva" class="form-control" placeholder="Tapez le numéro de TVA intracommunautaire"> </input>

                        Capital :
                        <input type="text" name="txtcapital" class="form-control" placeholder="Tapez le capital"> </input>

                        Code NAF/APE :
                        <input type="text" name="txtcode" class="form-control" placeholder="Tapez le code NAF/APE"> </input>

                        IBAN :
                        <input type="text" name="txtiban" class="form-control" placeholder="Tapez l'Iban"> </input>

                        BIC :
                        <input type="text" name="txtbic" class="form-control" placeholder="Tapez le Bic"> </input>

                        <input type="submit" name="btn_Ajout" class="btn btn-primary btn-block" value="Enregistrer"></input>

                </form>

Error message :

Connexion réussiImpossible de traiter les données. Erreur : SQLSTATE[42000]: Syntax error or access violation: 1064 Erreur de syntaxe pr�s de ' , , , , , , , , , , , , , , )' � la ligne 1


来源: stackexchange

问:
Compile two golang files into one executable and run in vscode
I have a go program with a main.go and a sub.go. When I run it under the debugger, main cannot see the function defined in sub. I tried creating a tasks.json but when I run it nothing happens.]

The MS documentaiton linked is for Node Package Manager and it doesn't state where the identifier for the task is placed in the configuration file

Here is my tasks.json:

```<code>{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "echo",
            "type": "shell",
            "command": "go run crypto.go sbox.go state.go utility.go"
        }
    ]
}
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I have a go program with a main.go and a sub.go. When I run it under the debugger, main cannot see the function defined in sub. I tried creating a tasks.json but when I run it nothing happens.]

The MS documentaiton linked is for Node Package Manager and it doesn't state where the identifier for the task is placed in the configuration file

Here is my tasks.json:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "echo",
            "type": "shell",
            "command": "go run crypto.go sbox.go state.go utility.go"
        }
    ]
}


问:
python3 binary with SUID cannot execute command as `root`
As the title suggests, my /usr/bin/python3.10 binary cannot be executed under root privilege even though I set the right to -rwsr-xr-x.

I tested using command /usr/bin/python3.10 -c "import os; os.system('whoami')". The result is not root as expected, rather it is the username of the user executed such command.

However when I do a ps auxf command, I could see that the username of the above python process (the value at the first column) is still root.

I am testing on Ubuntu 20.04 and Ubuntu 22.04.

Can somebody help me, please?


问:
Loading blockchain is taking to long for each users in database, any way to make it faster?
```<code>blockchain = pickle.loads(blockchain['blockchain'])
app.logger.debug(f'BlockChain loaded for user {email_to_revoke}. Size: {str(getsizeof(blockchain))} bytes')
previous_block = "0" * 64
try:
    for x, block in enumerate(blockchain):
        if block.index == x and block.previous_block == previous_block:
            response.append((block.data, block.approved_timestamp))
        else:
            if not x == block.index == 0: raise Exception("BLOCKCHAIN_VERIFICATION_ERROR")
        previous_block = block.hash
except Exception as e: app.logger.exception(e)
</code>```

I'm trying to get every user in mongo db to load their blockchain and get specific data, but it's taking forever to load every user data, and my endpoint is going to timeout when I'm sending a request, before it processes every user in db.

Body:
blockchain = pickle.loads(blockchain['blockchain'])
app.logger.debug(f'BlockChain loaded for user {email_to_revoke}. Size: {str(getsizeof(blockchain))} bytes')
previous_block = "0" * 64
try:
    for x, block in enumerate(blockchain):
        if block.index == x and block.previous_block == previous_block:
            response.append((block.data, block.approved_timestamp))
        else:
            if not x == block.index == 0: raise Exception("BLOCKCHAIN_VERIFICATION_ERROR")
        previous_block = block.hash
except Exception as e: app.logger.exception(e)

I'm trying to get every user in mongo db to load their blockchain and get specific data, but it's taking forever to load every user data, and my endpoint is going to timeout when I'm sending a request, before it processes every user in db.


问:
Unified SDLC integration in Jira or confluence Page
Is there a way, where gitlab new sorftware versions, environmental changes(IP, auth), and testing bugs can be displayed automatically in Jira or Confluence? Basicly a unified page where all changes could be tracked would be useful.

My general idea of a page is like a three column page:

Environment 1:
current version per each app | environment address and auth | jira highest priority bugs

Environment 2:
current version per each app | environment address and auth | jira highest priority bugs

Environment 3:
current version per each app | environment address and auth | jira highest priority bugs

So now, at my company, all of the above are spread all across the different apps and pages and issues. It is time consuming and a hassle to login and, load all pages all the time.

Different pages we now use:
Gitlab branches
Confluence environment page
Jira testing bugs


问:
I give non-existent arguments to my ParagraphStyle class, start my script, and it doesn't crash. Why?
So I was using reportlab to print a PDF. At some point, I used the PargraphStyle class as shown below.

```<code>style = ParagraphStyle('Main paragraph style', fontName='VeraBd', leading=15, fontSize=12, alignment=TA_JUSTIFY)
</code>```

Here is the thing. At first, I wrote the "fontSize" argument as "fontsize", and I didn't notice it, and my code wasn't crashing. However, of course, the size of the font on my PDF didn't change, which is totally logic. But as the code wasn't crashing, I thought that I wrote nothing wrong, and that I was maybe using the wrong argument, or that I was using it in a wrong way.

I ended up finding my mistake, but this felt strange to me. I'm still a beginner, but when you learn to code, one of the first things you're being told, is that, most of the time, the computer and the programming languages are case-sensitive ; for them "Word" and "word" are NOT the same thing. So in my opinion, if the class recieves a "fontsize" argument (instead of "fontSize"), which she doesn't know what it is, it should make the script crash.

At first, I thought that the reportlab team somehow built things to manage those kind of silly mistakes, but in fact, I found out that you could even give the ParagraphStyle class a completly non-existent argument, and the code still wouldn't crash. A program using reportlab with the following line runs without crashing.

```<code>style = ParagraphStyle('Main paragraph style', fontName='VeraBd',
leading=15, fontSize=12, alignment=TA_JUSTIFY, alanTuring="god", iLikeSand=False)
</code>```

I built a little script with only a class and a wrong creation of an instance of this class to verify my thoughts. For example, when running this :

```<code>class Book:
    def __init__(self, title="N/A", author="N/A", page_nb="N/A", genre="N/A", main_character="N/A", country="N/A"):
        self.title = title
        self.author = author
        self.page_nb = page_nb
        self.genre = genre
        self.main_character = main_character
        self.country = country

animal_farm = Book(title="Animal Farm", publisher="Olaf Scholz")

</code>```

I get a TypeError, which seems normal to me
TypeError: __init__() got an unexpected keyword argument 'publisher'

So now, how is it possible that the ParagraphStyle doesn't care about non-existent arguments. What is the difference between my example Book class and the ParagraphStyle class ? What makes that one crashes and not the other ?

I asked two people that work as programmers since quite a bit of time, they didn't know. I found nothing on Internet as well.

This is not really a "problem" since I found the mistake, but if you have any idea, know something, or have something to share, I'd be curious to know.

Body:
So I was using reportlab to print a PDF. At some point, I used the PargraphStyle class as shown below.

style = ParagraphStyle('Main paragraph style', fontName='VeraBd', leading=15, fontSize=12, alignment=TA_JUSTIFY)

Here is the thing. At first, I wrote the "fontSize" argument as "fontsize", and I didn't notice it, and my code wasn't crashing. However, of course, the size of the font on my PDF didn't change, which is totally logic. But as the code wasn't crashing, I thought that I wrote nothing wrong, and that I was maybe using the wrong argument, or that I was using it in a wrong way.

I ended up finding my mistake, but this felt strange to me. I'm still a beginner, but when you learn to code, one of the first things you're being told, is that, most of the time, the computer and the programming languages are case-sensitive ; for them "Word" and "word" are NOT the same thing. So in my opinion, if the class recieves a "fontsize" argument (instead of "fontSize"), which she doesn't know what it is, it should make the script crash.

At first, I thought that the reportlab team somehow built things to manage those kind of silly mistakes, but in fact, I found out that you could even give the ParagraphStyle class a completly non-existent argument, and the code still wouldn't crash. A program using reportlab with the following line runs without crashing.

style = ParagraphStyle('Main paragraph style', fontName='VeraBd',
leading=15, fontSize=12, alignment=TA_JUSTIFY, alanTuring="god", iLikeSand=False)

I built a little script with only a class and a wrong creation of an instance of this class to verify my thoughts. For example, when running this :

class Book:
    def __init__(self, title="N/A", author="N/A", page_nb="N/A", genre="N/A", main_character="N/A", country="N/A"):
        self.title = title
        self.author = author
        self.page_nb = page_nb
        self.genre = genre
        self.main_character = main_character
        self.country = country

animal_farm = Book(title="Animal Farm", publisher="Olaf Scholz")

I get a TypeError, which seems normal to me
TypeError: __init__() got an unexpected keyword argument 'publisher'

So now, how is it possible that the ParagraphStyle doesn't care about non-existent arguments. What is the difference between my example Book class and the ParagraphStyle class ? What makes that one crashes and not the other ?

I asked two people that work as programmers since quite a bit of time, they didn't know. I found nothing on Internet as well.

This is not really a "problem" since I found the mistake, but if you have any idea, know something, or have something to share, I'd be curious to know.


问:
How to solve android studio loading project?
Android studio says
"This version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 2021.1.1 or newer."</p>


问:
Fire Alert once per trade id using alert(,alert.freq_all)?
So, my trading signal have like multiple alerts in same candle and hence i can not use alert(,alert.freq_once_per_bar)

So here is my code:

```<code>alertMsg(side,tt1,tt2,stoploss,tempid)
   "string"

var globalalertid = array.new_string(30)
fuction_which_gets_calleed_constantly_on_every_tick_and_is_needed(tempid,side,tt1,tt2,stoploss):
    found = array.includes(globalalertid, tempid) ? true : false

    if found == false and tempid != "NO"
        array.push(globalalertid, tempid)
        alert(alertMsg(side,tt1,tt2,stoploss,tempid),alert.freq_all)
</code>```

Any idea why my code is not working?
ISSUE: Its firing alerts a lot of time in the same candle when entry signal comes. tempid passes only if same candle has entry.

Thus alerts stopps in next candle, which is fine. But in the same candle its not respecting tempid once alert.

Body:
So, my trading signal have like multiple alerts in same candle and hence i can not use alert(,alert.freq_once_per_bar)

So here is my code:

alertMsg(side,tt1,tt2,stoploss,tempid)
   "string"

var globalalertid = array.new_string(30)
fuction_which_gets_calleed_constantly_on_every_tick_and_is_needed(tempid,side,tt1,tt2,stoploss):
    found = array.includes(globalalertid, tempid) ? true : false

    if found == false and tempid != "NO"
        array.push(globalalertid, tempid)
        alert(alertMsg(side,tt1,tt2,stoploss,tempid),alert.freq_all)

Any idea why my code is not working?
ISSUE: Its firing alerts a lot of time in the same candle when entry signal comes. tempid passes only if same candle has entry.

Thus alerts stopps in next candle, which is fine. But in the same candle its not respecting tempid once alert.


问:
Laravel 9: Data does not appear before editing when the ID is changed then the form autofills using JQUERY AJAX
good afternoon everyone. I'm making a form to edit leave allocation data with jquery ajax. the form consists of (id_kategoricuti, id_karyawan,durasi, mode_alokasi, tgl_masuk, tgl_sekarang, aktif_dari, sampai).

Previously in from create, the conditions are:

when id_kategoricuti is selected, the form durasi, mode_alokasi will be filled in automatically using ajax.

For example, in the selected id_kategoricuti id form Cuti Tahunan, the tgl_masuk and tgl_sekarang forms will appear.

then, when selecting  id_karyawan, the tanggal_masuk form will automatically be filled according to the entry date data in the employee table. so that only the aktif_dari and sampai forms are filled in.

condition from edit leave allocation:

data appears according to the id that has been selected.

the user makes changes to the desired data.

save.

however, I'm facing a problem on this edit form:

because when I click on one of the data to edit, what appears on the form is only id_kategoricuti and id_karyawan.

the form mode_alokasi, durasi, aktif_dari and sampai are empty.

The form was only filled in when id_karyawan/id_kagotericuti was edited.

the data in the box below the category form is the data that should appear on the form.

This is the appearance of the leave allocation edit form before editing:

this is the appearance of the leave allocation edit form after the leave id_categories are edited:

my Controller:

```<code> public function getTglmasuk(Request $request)
 {
    try {
        $getTglmasuk = Karyawan::select('tglmasuk')
        ->where('id','=',$request->id_karyawan)->first();

        // dd($request->id_karyawan,$getTglmasuk);
        if(!$getTglmasuk) {
            throw new \Exception('Data not found');
        }
        return response()->json($getTglmasuk,200);

    } catch (\Exception $e){
        return response()->json([
            'message' =>$e->getMessage()
        ], 500);
    }
 }

 public function getSettingalokasi(Request $request)
 {
    try {
        $getSettingalokasi=Settingalokasi::select('id','id_jeniscuti','durasi','mode_alokasi')
        ->where('id_jeniscuti','=',$request->id_jeniscuti)->first();

        if(!$getSettingalokasi) {
            throw new \Exception('Data not found');
        }
        return response()->json($getSettingalokasi,200);

    } catch (\Exception $e){
        return response()->json([
            'message' =>$e->getMessage()
        ], 500);
    }
  }
</code>```

my Editalokasi.blade.php:

```<code>{{-- FORM SETTING ALOKASI--}}
<div class="modal fade" id="editalokasi{{$data->id}}" tabindex="-1" role="dialog" aria-
labelledby="editalokasi" aria-hidden="true">
<div class="modal-dialog modal-lg">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-
             hidden="true">×</button>
            <h4 class="modal-title" id="editalokasi">Edit Alokasi Cuti</h4>
        </div>
        <div class="modal-body">
            <form class="input" action="/updatealokasi/{{$data->id}}" method="POST"
                 enctype="multipart/form-data">
                @csrf
                @method('POST')
                <div class="panel-body">
                    <div class="col-md-6">
                        <div class="form-group col-sm">
                            <label for="id_jeniscuti" class="col-form-label">Kategori
                              Cuti</label>
                            <select name="id_jeniscuti" id="idjeniscuti" class="form-control">
                                <option value="{{$data->id_jeniscuti}}" selected>
                                 {{$data->jeniscutis->jenis_cuti}}
                                </option>
                                @foreach ($jeniscuti as $jenis)
                                    <option value="{{$jenis->id }}">{{ $jenis->jenis_cuti }}
                                    </option>
                                @endforeach
                            </select>
                        </div>
                        <input type="text" class="form-control" name="durasi"
                        placeholder="durasi" id="idsettingalokasi" value="{{$data-
                        >id_settingalokasi}} --> id settingalokasi" readonly>
                        <input type="text" class="form-control" name="durasi"
                        placeholder="durasi" id="idjeniscutis" value="{{$data->id_jeniscuti}}
                        --> id kategori" readonly>
                        <input type="text" class="form-control" name="durasi"
                        placeholder="durasi" id="idjeniscutis" value="{{$data->id_karyawan}} -
                        ->id karyawan" readonly>
                        <input type="text" class="form-control" name="durasi"
                         placeholder="durasi" id="idjeniscutis" value="{{$data->durasi}} Hari
                        --> durasi" readonly>
                        <input type="text" class="form-control" name="durasi"
                         placeholder="durasi" id="idjeniscutis" value="{{$data->mode_alokasi}}
                        -->mode alokasi" readonly>
                        <input type="text" class="form-control" name="durasi"
                         placeholder="durasi" id="idjeniscutis" value="
                         {{\Carbon\carbon::parse($data->aktif_dari)->format('m/d/Y')}} --
                        >aktif dari" readonly>
                        <input type="text" class="form-control" name="durasi"
                        placeholder="durasi" id="idjeniscutis" value="
                         {{\Carbon\carbon::parse($data->sampai)->format('m/d/Y')}} -->sampai tanggal"readonly>

                        <div class="form-group col-sm" id="idkaryawan">
                            <label for="id_karyawan" class="col-form-label">Karyawan</label>
                            <select name="id_karyawan" id="id_karyawan" class="form-control">
                                <option value="{{$data->id_karyawan}}" selected>{{$data->karyawans->nama}}</option>
                                @foreach ($karyawan as $data)
                                    <option value="{{ $data->id }}">{{ $data->nama }}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="durasi" class="col-form-label">Durasi (Hari)</label>
                            <input type="text" class="form-control" name="durasi" placeholder="durasi" id="duration" value="{{$data->durasi}}" readonly>
                        </div>
                        <div class="form-group">
                            <label for="mode_alokasi" class="col-form-label">Mode Alokasi</label>
                            <input type="text" class="form-control" name="mode_alokasi" placeholder="mode alokasi" value="{{$data->mode_alokasi}}" id="modealokasi" readonly>
                        </div>
                    </div>

                    <div class="col-md-6">
                        <div class=""  id="tglmulai">
                            <div class="form-group">
                                <label for="tgl_masuk" class="form-label">Tanggal Masuk</label>
                                <div class="input-group">
                                    <input type="text" class="form-control" placeholder="mm/dd/yyyy" id="tglmasuk" name="tgl_masuk" autocomplete="off" readonly>
                                    <span class="input-group-addon bg-custom b-0"><i class="mdi mdi-calendar text-white"></i></span>
                                </div>
                            </div>
                        </div>
                        <div class="" id="tglnow">
                            <div class="form-group">
                                <label for="tgl_sekarang" class="form-label">Tanggal Sekarang</label>
                                <div class="input-group">
                                    <input type="text" class="form-control" id="tglsekarang" name="tgl_sekarang" autocomplete="off" readonly>
                                    <span class="input-group-addon bg-custom b-0"><i class="mdi mdi-calendar text-white"></i></span>
                                </div>
                            </div>
                        </div>
                        <div class=""  id="tanggalmulai">
                            <div class="form-group">
                                <label for="tgl_mulai" class="form-label">Aktif Dari</label>
                                <div class="input-group">
                                    <input type="text" class="form-control" placeholder="mm/dd/yyyy" id="datepicker-autoclosea3" name="aktif_dari" value="{{\Carbon\carbon::parse($data->aktif_dari)->format('m/d/Y')}}"  autocomplete="off">
                                    <span class="input-group-addon bg-custom b-0"><i class="mdi mdi-calendar text-white"></i></span>
                                </div>
                            </div>
                        </div>
                        <div class="" id="tanggalselesai">
                            <div class="form-group">
                                <label for="sampai" class="form-label">Sampai</label>
                                <div class="input-group">
                                    <input type="text" class="form-control" placeholder="mm/dd/yyyy" id="datepicker-autoclosea4" name="sampai" value="{{\Carbon\carbon::parse($data->sampai)->format('m/d/Y')}}" autocomplete="off">
                                    <span class="input-group-addon bg-custom b-0"><i class="mdi mdi-calendar text-white"></i></span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-light" data-dismiss="modal">Close</button>
                    <button type="submit" class="btn btn-info" name="submit" value="save">Save Changes</button>
                </div>
            </form>
        </div>
    </div>
</div>
</div>

   <!-- jQuery  -->
   <script src="assets/js/jquery.min.js"></script>
   <script src="assets/js/app.js"></script>
    <script src="assets/pages/form-advanced.js"></script>
</code>```

my Javascript:

```<code><!-- script to fetch data settingalokasi from table settingalokasi -->
<script>
$('#idjeniscuti').on('change',function(e){
    var id_jeniscuti = e.target.value;
    $.ajaxSetup({
        headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]')
                    .attr('content')
                }
    });
    $.ajax({
        type:"POST",
        url: '{{route('get.Setting.alokasi')}}',
        data: {'id_jeniscuti':id_jeniscuti},
        success:function(data){
            // console.log(data);
            $('#idsettingalokasi').val(data.id);
            $('#duration').val(data.durasi);
            $('#modealokasi').val(data.mode_alokasi);
        }
    });
});
</script>

<!-- script to fetch data tanggal_masuk from table karyawan-->
<script>
$('#id_karyawan').on('change',function(e){
    var id_karyawan = e.target.value;
    $.ajaxSetup({
        headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]')
                    .attr('content')
                }
    });
    $.ajax({
        type:"POST",
        url: '{{route('get.Tanggalmasuk')}}',
        data: {'id_karyawan':id_karyawan},
        success:function(data){
            // console.log(data);
            $('#tgl_masuk').val(data.tglmasuk);
            // console.log(data?.tglmasuk)
        }
    });
});
</script>

<script type="text/javascript">
$(function()
{
    $('#tglmulai').prop("hidden", true);
    $('#tglnow').prop("hidden", true);

    $('#jenicuti').on('change', function(a)
    {
        if(a.target.value == 1)
        {
            $('#tglmulai').prop("hidden", false);
            $('#tglnow').prop("hidden", false);
        } else
            {
                $('#tglmulai').prop("hidden", true);
                $('#tglnow').prop("hidden", true);
        }
    });
});
</script>
</code>```

this is my first time using JQUERY AJAX for AUTOFILL. can anyone help me to solve this problem?

Body:
good afternoon everyone. I'm making a form to edit leave allocation data with jquery ajax. the form consists of (id_kategoricuti, id_karyawan,durasi, mode_alokasi, tgl_masuk, tgl_sekarang, aktif_dari, sampai).

Previously in from create, the conditions are:

when id_kategoricuti is selected, the form durasi, mode_alokasi will be filled in automatically using ajax.

For example, in the selected id_kategoricuti id form Cuti Tahunan, the tgl_masuk and tgl_sekarang forms will appear.

then, when selecting  id_karyawan, the tanggal_masuk form will automatically be filled according to the entry date data in the employee table. so that only the aktif_dari and sampai forms are filled in.

condition from edit leave allocation:

data appears according to the id that has been selected.

the user makes changes to the desired data.

save.

however, I'm facing a problem on this edit form:

because when I click on one of the data to edit, what appears on the form is only id_kategoricuti and id_karyawan.

the form mode_alokasi, durasi, aktif_dari and sampai are empty.

The form was only filled in when id_karyawan/id_kagotericuti was edited.

the data in the box below the category form is the data that should appear on the form.

This is the appearance of the leave allocation edit form before editing:

this is the appearance of the leave allocation edit form after the leave id_categories are edited:

my Controller:

 public function getTglmasuk(Request $request)
 {
    try {
        $getTglmasuk = Karyawan::select('tglmasuk')
        ->where('id','=',$request->id_karyawan)->first();

        // dd($request->id_karyawan,$getTglmasuk);
        if(!$getTglmasuk) {
            throw new \Exception('Data not found');
        }
        return response()->json($getTglmasuk,200);

    } catch (\Exception $e){
        return response()->json([
            'message' =>$e->getMessage()
        ], 500);
    }
 }

 public function getSettingalokasi(Request $request)
 {
    try {
        $getSettingalokasi=Settingalokasi::select('id','id_jeniscuti','durasi','mode_alokasi')
        ->where('id_jeniscuti','=',$request->id_jeniscuti)->first();

        if(!$getSettingalokasi) {
            throw new \Exception('Data not found');
        }
        return response()->json($getSettingalokasi,200);

    } catch (\Exception $e){
        return response()->json([
            'message' =>$e->getMessage()
        ], 500);
    }
  }

my Editalokasi.blade.php:

{{-- FORM SETTING ALOKASI--}}

id}}" tabindex="-1" role="dialog" aria-
labelledby="editalokasi" aria-hidden="true">

            <button type="button" class="close" data-dismiss="modal" aria-
             hidden="true">×</button>

Edit Alokasi Cuti

            <form class="input" action="/updatealokasi/{{$data->id}}" method="POST"
                 enctype="multipart/form-data">
                @csrf
                @method('POST')

                            Kategori
                              Cuti
                            <select name="id_jeniscuti" id="idjeniscuti" class="form-control">
                                <option value="{{$data->id_jeniscuti}}" selected>
                                 {{$data->jeniscutis->jenis_cuti}}
                                </option>
                                @foreach ($jeniscuti as $jenis)
                                    <option value="{{$jenis->id }}">{{ $jenis->jenis_cuti }}
                                    </option>
                                @endforeach
                            </select>

                        <input type="text" class="form-control" name="durasi"
                        placeholder="durasi" id="idsettingalokasi" value="{{$data-
                        >id_settingalokasi}} --> id settingalokasi" readonly>
                        <input type="text" class="form-control" name="durasi"
                        placeholder="durasi" id="idjeniscutis" value="{{$data->id_jeniscuti}}
                        --> id kategori" readonly>
                        <input type="text" class="form-control" name="durasi"
                        placeholder="durasi" id="idjeniscutis" value="{{$data->id_karyawan}} -
                        ->id karyawan" readonly>
                        <input type="text" class="form-control" name="durasi"
                         placeholder="durasi" id="idjeniscutis" value="{{$data->durasi}} Hari
                        --> durasi" readonly>
                        <input type="text" class="form-control" name="durasi"
                         placeholder="durasi" id="idjeniscutis" value="{{$data->mode_alokasi}}
                        -->mode alokasi" readonly>
                        <input type="text" class="form-control" name="durasi"
                         placeholder="durasi" id="idjeniscutis" value="
                         {{\Carbon\carbon::parse($data->aktif_dari)->format('m/d/Y')}} --
                        >aktif dari" readonly>
                        <input type="text" class="form-control" name="durasi"
                        placeholder="durasi" id="idjeniscutis" value="
                         {{\Carbon\carbon::parse($data->sampai)->format('m/d/Y')}} -->sampai tanggal"readonly>

                            Karyawan
                            <select name="id_karyawan" id="id_karyawan" class="form-control">
                                <option value="{{$data->id_karyawan}}" selected>{{$data->karyawans->nama}}</option>
                                @foreach ($karyawan as $data)
                                    <option value="{{ $data->id }}">{{ $data->nama }}</option>
                                @endforeach
                            </select>

                            Durasi (Hari)
                            <input type="text" class="form-control" name="durasi" placeholder="durasi" id="duration" value="{{$data->durasi}}" readonly>

                            Mode Alokasi
                            <input type="text" class="form-control" name="mode_alokasi" placeholder="mode alokasi" value="{{$data->mode_alokasi}}" id="modealokasi" readonly>

                                Tanggal Masuk

                                    <input type="text" class="form-control" placeholder="mm/dd/yyyy" id="tglmasuk" name="tgl_masuk" autocomplete="off" readonly>

                                Tanggal Sekarang

                                    <input type="text" class="form-control" id="tglsekarang" name="tgl_sekarang" autocomplete="off" readonly>

                                Aktif Dari

                                    <input type="text" class="form-control" placeholder="mm/dd/yyyy" id="datepicker-autoclosea3" name="aktif_dari" value="{{\Carbon\carbon::parse($data->aktif_dari)->format('m/d/Y')}}"  autocomplete="off">

                                Sampai

                                    <input type="text" class="form-control" placeholder="mm/dd/yyyy" id="datepicker-autoclosea4" name="sampai" value="{{\Carbon\carbon::parse($data->sampai)->format('m/d/Y')}}" autocomplete="off">

                    <button type="button" class="btn btn-light" data-dismiss="modal">Close</button>
                    <button type="submit" class="btn btn-info" name="submit" value="save">Save Changes</button>

            </form>

my Javascript:

this is my first time using JQUERY AJAX for AUTOFILL. can anyone help me to solve this problem?


问:
Recursion of Strassen Multiplication
I have a question. For example our matrix 16x16 and we divide it 4x4 subblocks. Now how we will apply Strassen and how we choose which matrices to multiply? I mean for multiplication first 4x4 block of 16x16 matrix will we choose A1B1+A2B3 and apply Strassen for A1B2 and A2B3 separately and then add them? I mean fist we divide 8x8 matrices and divide 4x4 matrices. But choosing which matrices to multiply especially when subblocks are n/4 or n/8 confused me.

Thanks for answering

Title: Recursion of Strassen Multiplication


问:
Command in Crontab not running but can be executed directly on the terminal
I created a cronjob on ubuntu server using the following command:

```<code>sudo crontab -e
</code>```

And added the following line:

```<code>* * * * * cd /vhosts/example.com && sudo /usr/bin/docker exec -it sample-fpm /usr/local/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1
</code>```

But nothing happened. When I check on sudo /etc/init.d/cron status. I can see the log contains the above command.

If I run cd /vhosts/example.com && sudo /usr/bin/docker exec -it sample-fpm /usr/local/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1 directly on terminal, it work fine.

UPDATE

I have tried directly set the cron on container but same result. And tried to do some simple thing such as touch /tmp/test.txt on crontab and it work fine. Not sure why the artisan command doesn't work on the crontab.

Body:
I created a cronjob on ubuntu server using the following command:

sudo crontab -e

And added the following line:

* * * * * cd /vhosts/example.com && sudo /usr/bin/docker exec -it sample-fpm /usr/local/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1

But nothing happened. When I check on sudo /etc/init.d/cron status. I can see the log contains the above command.

If I run cd /vhosts/example.com && sudo /usr/bin/docker exec -it sample-fpm /usr/local/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1 directly on terminal, it work fine.

UPDATE

I have tried directly set the cron on container but same result. And tried to do some simple thing such as touch /tmp/test.txt on crontab and it work fine. Not sure why the artisan command doesn't work on the crontab.


问:
How to identify angular config errors easily
I am wondering if there is any ng command to help me identify any angular.json or any configuration related mistakes.

Because of I am too busy fixing other outdated npm packages, only recently I noticed that this angular.json is not what it is supposed to be like v15 after I compared it with a new v15.04.

But there is no report of anything wrong on ng version or ng update. But I do have to somehow keep core.js on v2.x which is used by src/polyfills.ts which is removed by angular since v8.

I can probably manually make the change. But I wonder why Angular does not update angular.json for me. And I fear there are other stuff that I missed.


问:
ReactJs Registration using SpringBoot RestApi
My Backend code is working correctly while testing with Postman. However, when I use my React app it shows a 400, and in IntelliJ it logs the following:

WARN 1264 --- [nio-8080-exec-1]
.w.s.m.s.DefaultHandlerExceptionResolver : Resolved
[org.springframework.http.converter.HttpMessageNotReadableException:
Required request body is missing: public
org.springframework.http.ResponseEntity<com.msys.smartkart.config.GenericResponseDto>
com.msys.smartkart.controller.UserController.addUser(com.msys.smartkart.entity.User)
throws java.lang.Exception].

```<code>@GetMapping("/register")
public ResponseEntity<GenericResponseDto> addUser(@RequestBody User user) throws Exception {

    final boolean isNotExists = userService.findUserByEmailAddress(user.getEmailAddress());

    if (isNotExists) {
        userService.registerUser(user);
        log.info("User saved successfully");

    } else {
        log.warn("User is Already exists");
        throw new Exception(user.getEmailAddress() + "Already Exists");
    }
    return new ResponseEntity<>(new GenericResponseDto(200, "User Registered"), HttpStatus.ACCEPTED);
}
</code>```
```<code> const submitHandler = () => {
    fetch(
      `http://localhost:8080/register?` +
        new URLSearchParams({
          name: name,
          emailAddress: emailAddress,
          mobileNumber: mobileNumber,
          password: password,
          confirmPassword: confirmPassword,
          address: address,
        })
    )
      .then((response) => response.json())
      .then((res) => {
        if (res.statusCode === 200) {
          console.log(res);
          console.log(res.responseData);
          setData(res.responseData);
        } else {
          alert("Somthing went wrong try again");
        }
      });
  };
</code>```

What is causing this behaviour?

Body:
My Backend code is working correctly while testing with Postman. However, when I use my React app it shows a 400, and in IntelliJ it logs the following:

WARN 1264 --- [nio-8080-exec-1]
.w.s.m.s.DefaultHandlerExceptionResolver : Resolved
[org.springframework.http.converter.HttpMessageNotReadableException:
Required request body is missing: public
org.springframework.http.ResponseEntity<com.msys.smartkart.config.GenericResponseDto>
com.msys.smartkart.controller.UserController.addUser(com.msys.smartkart.entity.User)
throws java.lang.Exception].

@GetMapping("/register")
public ResponseEntity<GenericResponseDto> addUser(@RequestBody User user) throws Exception {

    final boolean isNotExists = userService.findUserByEmailAddress(user.getEmailAddress());

    if (isNotExists) {
        userService.registerUser(user);
        log.info("User saved successfully");

    } else {
        log.warn("User is Already exists");
        throw new Exception(user.getEmailAddress() + "Already Exists");
    }
    return new ResponseEntity<>(new GenericResponseDto(200, "User Registered"), HttpStatus.ACCEPTED);
}

 const submitHandler = () => {
    fetch(
      `http://localhost:8080/register?` +
        new URLSearchParams({
          name: name,
          emailAddress: emailAddress,
          mobileNumber: mobileNumber,
          password: password,
          confirmPassword: confirmPassword,
          address: address,
        })
    )
      .then((response) => response.json())
      .then((res) => {
        if (res.statusCode === 200) {
          console.log(res);
          console.log(res.responseData);
          setData(res.responseData);
        } else {
          alert("Somthing went wrong try again");
        }
      });
  };

What is causing this behaviour?


问:
publish a mail with text from SNS topic with cloudformation template
I am creating a cloudformation code to publish emails to multiple recipients via SNS topic which works fine but i need the mail text to be added in same code. I am getting validation error while publishing the message. below is the code</p>
```<code>AWSTemplateFormatVersion: '2010-09-09'

Resources:
  MySNSTopic:
    Type: AWS::SNS::Topic
    Properties:
      TopicName: my-sns-topic

  MySNSSubscription1:
    Type: AWS::SNS::Subscription
    Properties:
      TopicArn:
        Ref: MySNSTopic
      Protocol: email
      Endpoint: email-address-1@example.com

  MySNSSubscription2:
    Type: AWS::SNS::Subscription
    Properties:
      TopicArn:
        Ref: MySNSTopic
      Protocol: email
      Endpoint: email-address-2@example.com
  MySNSPublishMessage:
   Type: AWS::SNS::Publish
   Properties:
     Message: "status check failed"
     TopicArn: !Ref MySNSTopic

check the documentation
</code>```

Body:
I am creating a cloudformation code to publish emails to multiple recipients via SNS topic which works fine but i need the mail text to be added in same code. I am getting validation error while publishing the message. below is the code

AWSTemplateFormatVersion: '2010-09-09'

Resources:
  MySNSTopic:
    Type: AWS::SNS::Topic
    Properties:
      TopicName: my-sns-topic

  MySNSSubscription1:
    Type: AWS::SNS::Subscription
    Properties:
      TopicArn:
        Ref: MySNSTopic
      Protocol: email
      Endpoint: email-address-1@example.com

  MySNSSubscription2:
    Type: AWS::SNS::Subscription
    Properties:
      TopicArn:
        Ref: MySNSTopic
      Protocol: email
      Endpoint: email-address-2@example.com
  MySNSPublishMessage:
   Type: AWS::SNS::Publish
   Properties:
     Message: "status check failed"
     TopicArn: !Ref MySNSTopic

check the documentation


问:
Issue with import command in Pentaho 9.3
We are using Java version 11.0.17 and Pentaho 9.3 and while using import command, getting below error. Please help to debug this issue</p>
```<code>cd /home/pentaho/client/data-integration/
/home/pentaho/client/data-integration/import.sh -rep=stage_repo -user=xyx -pass="Encrypted password" -dir=/ -file=/home/xyz/stg/xyz/ -no rules
Exception in thread "main" java.lang.ClassNotFoundException: org.pentaho.di.imp.Import
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        at org.pentaho.commons.launcher.Launcher.main(Launcher.java:87)
</code>```

Body:
We are using Java version 11.0.17 and Pentaho 9.3 and while using import command, getting below error. Please help to debug this issue

cd /home/pentaho/client/data-integration/
/home/pentaho/client/data-integration/import.sh -rep=stage_repo -user=xyx -pass="Encrypted password" -dir=/ -file=/home/xyz/stg/xyz/ -no rules
Exception in thread "main" java.lang.ClassNotFoundException: org.pentaho.di.imp.Import
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        at org.pentaho.commons.launcher.Launcher.main(Launcher.java:87)


问:
Is there a way to use strict SNI matching in Istio?
As the title says, we would like to enable strict SNI checking for security reasons (so the server doesn't answer with an invalid certificate when accessing the server through the IP) on our istio ingress gateways. The documentation however is a bit confusing and the SNI matching only seems to work in passthrough mode.

Is there any way to get istio to check the SNI against the, in the Gateway, configured hostnames, while having TLS termination enabled?


问:
Why can't I find and # field (shown in chrome) in my styles.css file?
I really don't know how to formulate this question because it's a new thing to me. Basically I have to change the style of a button which, if I click on it after pressing f12 in chrome, it shows me and # field. If I modify it, the button changes as it should, but that field doesn't exist in my styles.css file. Am I doing something wrong?</p>


问:
JPA compare fields before update
I'm using my Spring boot service, to check an entity. If the entity has a attachmentID filled, the service will retrieve the attachment and return that one. If there is no attachmentID set, the service will call a function to generate the attachment, update the entity and return the attachment.

When updating the entity, I want to reset the approval status and delete the attachment, because the attachment needs to be regenerated after any change.

In order for this to work properly, I want to check what is being updatet on the entity. If the attachmentID is set, than I clearly don't want it to be removed. If anything else is updatet, I want to set the attachmentID to: 0.

What is best practice to do this? I've found topics about the JPA beforeUpdate functions. However, in that functions I can't compare before and after. I've tried cloning the entity as shown in my code, but than the change is already made to the original entity. Any advice would be great.

```<code>    public PDFDocument getDocumentPreview(Long id) {
    FD fD = fDRepository.findById(id).orElse(null);
    //Check if exists

    //Check if attachmentId is already set, if not, than generate pdf
    if (fD.getAttachmentId() != 0) {
            return getPDFById(fD.getAttachmentId());
    } else {
        //Generate PDF
        Long returnedPDFId = pdfGeneratorService.generatePDF(fD,0L,false);

        //Set returned ID on financialDocument
        fD.setAttachmentId(returnedPDFId);

        // update document with correct attachmentId
        updateFD(id, fD);

        return getPDFById(returnedPDFId);
    }
}

public FD updateFD(Long id, FD fD) {
    FD fDCurrent = fDRepository.findById(id).orElse(null);
    //Check if exists

    //Check what's being updatet
    FD clone = (FD) SerializationUtils.clone(fDCurrent);

    //TODO if there is a change in anything but updating the attachment, than remove the attachment

    if (!(clone.equals(fD))) {
        System.out.println("Not the same!");
        if(!Objects.equals(clone.getAttachmentId(),fD.getAttachmentId())) {
            System.out.println("Attachment PDF is being updatet");
        } else {
            System.out.println("Attachment PDF stays the same!");

            //If document is approved, than reset that approval
            if (fD.getIsApproved() == true) {
                fD.setIsApproved(false);
            }
        }
    } else
        System.out.println("objects are equal");
    }

    //Update
    return fDRepository.save(fD);
}
</code>```

Title: JPA compare fields before update

Body:
I'm using my Spring boot service, to check an entity. If the entity has a attachmentID filled, the service will retrieve the attachment and return that one. If there is no attachmentID set, the service will call a function to generate the attachment, update the entity and return the attachment.

When updating the entity, I want to reset the approval status and delete the attachment, because the attachment needs to be regenerated after any change.

In order for this to work properly, I want to check what is being updatet on the entity. If the attachmentID is set, than I clearly don't want it to be removed. If anything else is updatet, I want to set the attachmentID to: 0.

What is best practice to do this? I've found topics about the JPA beforeUpdate functions. However, in that functions I can't compare before and after. I've tried cloning the entity as shown in my code, but than the change is already made to the original entity. Any advice would be great.

    public PDFDocument getDocumentPreview(Long id) {
    FD fD = fDRepository.findById(id).orElse(null);
    //Check if exists

    //Check if attachmentId is already set, if not, than generate pdf
    if (fD.getAttachmentId() != 0) {
            return getPDFById(fD.getAttachmentId());
    } else {
        //Generate PDF
        Long returnedPDFId = pdfGeneratorService.generatePDF(fD,0L,false);

        //Set returned ID on financialDocument
        fD.setAttachmentId(returnedPDFId);

        // update document with correct attachmentId
        updateFD(id, fD);

        return getPDFById(returnedPDFId);
    }
}

public FD updateFD(Long id, FD fD) {
    FD fDCurrent = fDRepository.findById(id).orElse(null);
    //Check if exists

    //Check what's being updatet
    FD clone = (FD) SerializationUtils.clone(fDCurrent);

    //TODO if there is a change in anything but updating the attachment, than remove the attachment

    if (!(clone.equals(fD))) {
        System.out.println("Not the same!");
        if(!Objects.equals(clone.getAttachmentId(),fD.getAttachmentId())) {
            System.out.println("Attachment PDF is being updatet");
        } else {
            System.out.println("Attachment PDF stays the same!");

            //If document is approved, than reset that approval
            if (fD.getIsApproved() == true) {
                fD.setIsApproved(false);
            }
        }
    } else
        System.out.println("objects are equal");
    }

    //Update
    return fDRepository.save(fD);
}


问:
ReveaJS Slidenumber
The function slideNumber of the JavaScript Framework RevealJS has a bug for me. It shows a slightly visible number beneath the shown slide number. Does someone had a similar issue and how did you fixed it? I opened an issue on Github, but nobody posted an idea about it. I post a screenshot of an example here:

Title: ReveaJS Slidenumber


问:
Platform Check LARAVEL
See the 'o' before html tag

That o before  is being appended on every page even the default 404 not found laravel page, where can I find this o

See the 'o' in top left of page

I changed the php version requirement in platform_check.php from >704 to >702 because currently i have php 7.2 installed. i wanted to bypass php error message.

from

```<code>if (!(PHP_VERSION_ID >= 70400)) {
    $issues[] = 'Your Composer dependencies require a PHP version ">= 7.4.0". You are running ' . PHP_VERSION . '.';
}

</code>```

to

```<code>if (!(PHP_VERSION_ID >= 70200)) {
    $issues[] = 'Your Composer dependencies require a PHP version ">= 7.4.0". You are running ' . PHP_VERSION . '.';
}

</code>```

after doing that, the error was gone ,but then i got errors of some classes which php 7.2 was not able to interpret , i installed php json  and the error was gone. Now am seen that o before  on every page

Title: Platform Check LARAVEL

Body:
See the 'o' before html tag

That o before  is being appended on every page even the default 404 not found laravel page, where can I find this o

See the 'o' in top left of page

I changed the php version requirement in platform_check.php from >704 to >702 because currently i have php 7.2 installed. i wanted to bypass php error message.

from

if (!(PHP_VERSION_ID >= 70400)) {
    $issues[] = 'Your Composer dependencies require a PHP version ">= 7.4.0". You are running ' . PHP_VERSION . '.';
}

to

if (!(PHP_VERSION_ID >= 70200)) {
    $issues[] = 'Your Composer dependencies require a PHP version ">= 7.4.0". You are running ' . PHP_VERSION . '.';
}

after doing that, the error was gone ,but then i got errors of some classes which php 7.2 was not able to interpret , i installed php json  and the error was gone. Now am seen that o before  on every page


问:
How to add audio in react with increasing pitch value i.e frequency
```<code>let audioCtx = new AudioContext();  Run / Edit

let osc = audioCtx.createOscillator();

let f1 = 440;
let f2 = 440 * 2;
let f3 = 440 * 2 * 2;

osc.frequency.setValueAtTime(f1, audioCtx.currentTime + 1);
osc.frequency.exponentialRampToValueAtTime(f2, audioCtx.currentTime + 2);
osc.frequency.setValueAtTime(f2, audioCtx.currentTime + 3);
osc.frequency.exponentialRampToValueAtTime(f3, audioCtx.currentTime + 4);

osc.connect(audioCtx.destination);
osc.start();
osc.stop(audioCtx.currentTime + 5);
</code>```

I tried to implement this using web audio api. In That Changing pitch by adjusting frequency works in way that pitch gets changed. But i want that sound on repeated basis like when my laser is on play the sound and as my laser goes near to my target number i.e suppose 9.0 or 10.0 (as i have list of number from 0.1 - 10.9 which is basically a score) make the pitch value higher i.e change frequency.
How to achieve this ?

Body:
let audioCtx = new AudioContext();  Run / Edit

let osc = audioCtx.createOscillator();

let f1 = 440;
let f2 = 440 * 2;
let f3 = 440 * 2 * 2;

osc.frequency.setValueAtTime(f1, audioCtx.currentTime + 1);
osc.frequency.exponentialRampToValueAtTime(f2, audioCtx.currentTime + 2);
osc.frequency.setValueAtTime(f2, audioCtx.currentTime + 3);
osc.frequency.exponentialRampToValueAtTime(f3, audioCtx.currentTime + 4);

osc.connect(audioCtx.destination);
osc.start();
osc.stop(audioCtx.currentTime + 5);

I tried to implement this using web audio api. In That Changing pitch by adjusting frequency works in way that pitch gets changed. But i want that sound on repeated basis like when my laser is on play the sound and as my laser goes near to my target number i.e suppose 9.0 or 10.0 (as i have list of number from 0.1 - 10.9 which is basically a score) make the pitch value higher i.e change frequency.
How to achieve this ?


问:
save output from R as a table
I want to save output from my R markdown in a table format that I can directly add in my publication.

The code does wilcoxson signed rank test on multiple variables at the same time. I want to export the output I get from the modellist into a table format such that I can have the p - value and the variable names.

Additionally, I also tried using the sjt.frq() function from the sJplot library to get summary statistics for my likert scale data but apparently sjt.frq() does not show up anymore, does anyone know if it has been removed and why does it not show in R anymore? I have added the code I used with sjt.frq().

Thank you for the hep!

```<code>
samp<-structure(list(ID_formerge = c(44422.98569, 44423.08525, 44423.09342, 44423.09724, 44423.82518), Participant = c("4", "5", "6", "7", "8"), ID_formerge.1 = c("C4", "C5", "C6", "C7", "C8"), country = c("Colombia-Bucaramanga",
"Colombia-Bucaramanga", "Colombia-Bucaramanga", "Colombia-Bucaramanga", "Colombia-Bucaramanga"), Fecha_bankssp = c(44422L, 44423L, 44423L, 44423L, 44423L), att1_goodofall = c(4L, 4L, 2L, 4L, 4L), att2_pvtdisease = c(4L, 4L, 3L, 3L, 4L),att3_curedisease = c(4L, 2L, 4L, 3L, 3L), att4_timewaste = c(4L, 4L, 3L, 5L, 4L), att5_helpgenerations = c(4L, 4L, 4L, 4L, 3L), att6_healthinterfere = c(4L, 3L, 3L, 5L, 3L), att7_helpfamily = c(4L, 3L, 3L, 3L, 4L), att8_noriskstolen = c(4L, 2L, 3L, 4L, 2L), att9_helpdengue = c(4L, 4L, 4L, 4L, 2L), att10_perinfosafe = c(4L, 4L, 3L, 4L, 2L), att11_identhealthproblem = c(4L, 2L, 3L, 3L, 4L), att12_highmedicalcost = c(4L, 3L, 2L, 4L, 3L)), row.names = c(NA,
5L), class = "data.frame")

modellist<-list()
for(i in 6:17){
    fmla <- formula(paste(names(samp)[i], "~ country"))
    modellist[[i]]<-wilcox.test(fmla, data = samp, paired = FALSE)
}

>#I tried the following way but it did not work.
samp%>%tab_cells(sheet(att1_goodofall,att2_pvtdisease,att3_curedisease))%>%tab_cols(total(label = "W"),am)%>%
                  tab_stat_fun_df(

                    funcation(x){

                      modellist<-list()
                        for(i in 6:17){
                                        fmla <- formula(paste(names(samp)[i], "~ country"))
                                        modellist[[i]]<-wilcox.test(fmla, data = sam, paired = FALSE)
                                        sheet('p-value' = coef(modellist), confint(model))

                                              }

                    }

                  )%>%tab_pivot()

sjt.frq(samp$att1_goodofall,variablelabels=variables['att1_goodofall'],valuelablels=values[['att1_goodofall']])

</code>```

Title: save output from R as a table

Body:
I want to save output from my R markdown in a table format that I can directly add in my publication.

The code does wilcoxson signed rank test on multiple variables at the same time. I want to export the output I get from the modellist into a table format such that I can have the p - value and the variable names.

Additionally, I also tried using the sjt.frq() function from the sJplot library to get summary statistics for my likert scale data but apparently sjt.frq() does not show up anymore, does anyone know if it has been removed and why does it not show in R anymore? I have added the code I used with sjt.frq().

Thank you for the hep!

samp<-structure(list(ID_formerge = c(44422.98569, 44423.08525, 44423.09342, 44423.09724, 44423.82518), Participant = c("4", "5", "6", "7", "8"), ID_formerge.1 = c("C4", "C5", "C6", "C7", "C8"), country = c("Colombia-Bucaramanga",
"Colombia-Bucaramanga", "Colombia-Bucaramanga", "Colombia-Bucaramanga", "Colombia-Bucaramanga"), Fecha_bankssp = c(44422L, 44423L, 44423L, 44423L, 44423L), att1_goodofall = c(4L, 4L, 2L, 4L, 4L), att2_pvtdisease = c(4L, 4L, 3L, 3L, 4L),att3_curedisease = c(4L, 2L, 4L, 3L, 3L), att4_timewaste = c(4L, 4L, 3L, 5L, 4L), att5_helpgenerations = c(4L, 4L, 4L, 4L, 3L), att6_healthinterfere = c(4L, 3L, 3L, 5L, 3L), att7_helpfamily = c(4L, 3L, 3L, 3L, 4L), att8_noriskstolen = c(4L, 2L, 3L, 4L, 2L), att9_helpdengue = c(4L, 4L, 4L, 4L, 2L), att10_perinfosafe = c(4L, 4L, 3L, 4L, 2L), att11_identhealthproblem = c(4L, 2L, 3L, 3L, 4L), att12_highmedicalcost = c(4L, 3L, 2L, 4L, 3L)), row.names = c(NA,
5L), class = "data.frame")

modellist<-list()
for(i in 6:17){
    fmla <- formula(paste(names(samp)[i], "~ country"))
    modellist[[i]]<-wilcox.test(fmla, data = samp, paired = FALSE)
}

>#I tried the following way but it did not work.
samp%>%tab_cells(sheet(att1_goodofall,att2_pvtdisease,att3_curedisease))%>%tab_cols(total(label = "W"),am)%>%
                  tab_stat_fun_df(

                    funcation(x){

                      modellist<-list()
                        for(i in 6:17){
                                        fmla <- formula(paste(names(samp)[i], "~ country"))
                                        modellist[[i]]<-wilcox.test(fmla, data = sam, paired = FALSE)
                                        sheet('p-value' = coef(modellist), confint(model))

                                              }

                    }

                  )%>%tab_pivot()

sjt.frq(samp$att1_goodofall,variablelabels=variables['att1_goodofall'],valuelablels=values[['att1_goodofall']])


问:
Qt SQL qt6.4.1 and MySQL 8.0 TLS problems
I have an MySQL Server 8.0, which supports connection with TLS>1.2.
I use Qt 6.4.1 and I created an MySQL client.
I am not able to connect with my server, I tried with another server which has MySQL 5.7 and it works perfectly.
Can I resolve it?
I didn't find option to set TLS in QSqlDatabase option.
Thanks.

I would like to find a solution for my problems. I searched it, without success.


问:
Why multiple log files are getting created with GUID using System.Diagnostics c#

Possible Duplicate:

  TextWriterTraceListener and trace filenames with GUIDs

I am using System.Diagnostics to trace the each n every method in my application. Tracing is working fine in the desired log file i.e xyz.log but at the same time multiple log are getting creating with Guidxyz.log.

My application is a powerpoint addin. Tracing will happen as long as user is working on it.

How can I prevent this from happening?

Sample code:

```<code>string userDirectoryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicatio??nData),
UserSettings.GetApplicationSettingsValue("AppFolder"));

string fileName = Path.Combine(Path.Combine(userDirectoryPath,
UserSettings.GetApplicationSettingsValue("LogFolder")), "ICAddInLog.log");

Trace.Listeners.Add(new TextWriterTraceListener(fileName));

Trace.WriteLine(string.Format(
    "{0} \r\n\r\n Title: {1} \r\n\r\n Message: {2} \r\n\r\n TimeStamp: {3} \r\n\r\n {4}",
    "---------------Tracing-------------------",
    title,
    logText,
    DateTime.Now,
    "-----End"));
</code>```

ContentLicense: CC BY-SA 3.0

Body:
Possible Duplicate:

  TextWriterTraceListener and trace filenames with GUIDs

I am using System.Diagnostics to trace the each n every method in my application. Tracing is working fine in the desired log file i.e xyz.log but at the same time multiple log are getting creating with Guidxyz.log.

My application is a powerpoint addin. Tracing will happen as long as user is working on it.

How can I prevent this from happening?

Sample code:

string userDirectoryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicatio??nData),
UserSettings.GetApplicationSettingsValue("AppFolder"));

string fileName = Path.Combine(Path.Combine(userDirectoryPath,
UserSettings.GetApplicationSettingsValue("LogFolder")), "ICAddInLog.log");

Trace.Listeners.Add(new TextWriterTraceListener(fileName));

Trace.WriteLine(string.Format(
    "{0} \r\n\r\n Title: {1} \r\n\r\n Message: {2} \r\n\r\n TimeStamp: {3} \r\n\r\n {4}",
    "---------------Tracing-------------------",
    title,
    logText,
    DateTime.Now,
    "-----End"));


问:
Picking out a shape-coordinates in an image
I have some flat material on which I make a mark with a laser cutter - currently I'm marking a "plus"-sign. I would then like to take a picture and automatically find the mark so that I can calibrate the position of the laser to the material. Here is an example of such an image:

I have then tried to construct convolution kernels to pick out the marks. In the example below I have a kernel where the green dots are positive and the dark-red dots are negative and gray is not counted. I can easily change the desity and shape of the points:

I figured that this would pick out plusses and only plusses, where the center yields the highest convolution signal to the kernel - like this:

But it turns out that if there is dark or white noise of any shape they will get picked instead of the plusses if the colors are darker or lighter than the mark color (which is not that dark compared to the background). In the image below the black doodles are just much more black and thus give a higher signal for the kernel regardless of the non-plus shape. This could be an actual issue if there is dirt, stains, glarring etc. on the material.

I have tried edge detection first but here too the black color gives stronger edges and still gives a stronger signal when the plus-kernal is applied. I can tweek carefully filters to pick out the plusses, but this seems suprisingly delicate and I doubt it will pick out marks from all different types of noise.

Am I not sure if I am going about this all wrong or if there is a smart sequence of convolutions, normalizing, clustering etc. that could reliably get the shapes. I could easily change shape as well (maybe circles) if that helps. Any ideas or thoughts would be greatly appriciated.


问:
Colab: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory warn(f"Failed to load image Python extension: {e}")
I'm trying to use the python package aitextgen in google Colab so I can fine-tune GPT.

First, when I installed the last version of this package I had this error when importing it.

```<code>Unable to import name '_TPU_AVAILABLE' from 'pytorch_lightning.utilities'
</code>```

Though with the help of the solutions given in this question I could pass this error by downgrading my packages like this:

```<code>!pip3 install -q aitextgen==0.5.2
!pip3 install -q torchtext==0.10.0
!pip3 install -q torchmetrics==0.6.0
!pip3 install -q pytorch-lightning==1.4.0rc0
</code>```

But now I'm facing this error when importing the aitextgen package and colab will crash!

```<code>/usr/local/lib/python3.8/dist-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory
  warn(f"Failed to load image Python extension: {e}")
</code>```

Keep in mind that the error is in importing the package and there is not a bug in my code. To be more clear I have this error when I just import aitextgen like this:

```<code>import aitextgen
</code>```

How can I deal with this error?

Body:
I'm trying to use the python package aitextgen in google Colab so I can fine-tune GPT.

First, when I installed the last version of this package I had this error when importing it.

Unable to import name '_TPU_AVAILABLE' from 'pytorch_lightning.utilities'

Though with the help of the solutions given in this question I could pass this error by downgrading my packages like this:

!pip3 install -q aitextgen==0.5.2
!pip3 install -q torchtext==0.10.0
!pip3 install -q torchmetrics==0.6.0
!pip3 install -q pytorch-lightning==1.4.0rc0

But now I'm facing this error when importing the aitextgen package and colab will crash!

/usr/local/lib/python3.8/dist-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory
  warn(f"Failed to load image Python extension: {e}")

Keep in mind that the error is in importing the package and there is not a bug in my code. To be more clear I have this error when I just import aitextgen like this:

import aitextgen

How can I deal with this error?


问:
validations doesn't work for array of objects, if I add whitelist: true
by adding the whitelist: true, it is not validating array of objects although I added type, but still am getting error, can somebody help please

export class Service {
 id: number;
 name:string;
}
```
<p>************** DTO **********
it should validate array of objects according to the type I added i.e Service</p>
<pre class="lang-js prettyprint-override"><code>@ApiProperty()
@ValidateNested({ each: true })
@Type(() => Service)
services: Service[]
</code>```

and then I added whitelist: true,forbidNonWhitelisted: true, transform: true to strip out unwanted data

and into the post request I sent

{
    "companyName": "test",
    "officeLocation": "Australia",
    "agencySize": "1_10",
    "agencyWebsite": "www.test.com",
    "services": [{"id": 12}]
}
```
<p>and am getting error for this</p>
<pre class="lang-json prettyprint-override"><code>{
    "statusCode": 400,
    "message": [
        "services.0.property id should not exist"
    ],
    "error": "Bad Request"
}
</code>```

Body:
by adding the whitelist: true, it is not validating array of objects although I added type, but still am getting error, can somebody help please

export class Service {
 id: number;
 name:string;
}

************** DTO **********
it should validate array of objects according to the type I added i.e Service

@ApiProperty()
@ValidateNested({ each: true })
@Type(() => Service)
services: Service[]

and then I added whitelist: true,forbidNonWhitelisted: true, transform: true to strip out unwanted data

and into the post request I sent

{
    "companyName": "test",
    "officeLocation": "Australia",
    "agencySize": "1_10",
    "agencyWebsite": "www.test.com",
    "services": [{"id": 12}]
}

and am getting error for this

{
    "statusCode": 400,
    "message": [
        "services.0.property id should not exist"
    ],
    "error": "Bad Request"
}


问:
Restrict interface type parameter to class that is implementing the interface
I'd like to create an interface that gives objects of certain classes an id and a dictionary where you can find the reference by Id. So every class should have their own counting id (starting at 1).

That is what I have:

```<code>interface IIdentifiable<T>
{
    public int id { get; }
    public static int NextId { get; private set; } = 1;
    private static readonly Dictionary<int, T> InstanceById = new Dictionary<int, T>();

    public static T GetInstanceById(int id)
    {
        return InstanceById[id];
    }

    protected static void AddInstanceById(T instance, int id)
    {
        InstanceById.Add(id, instance);
    }

    protected static void IncrementNextId() => NextId++;
}

</code>```

It works, but I'd like to restrict it in the way so that every class is only allowed to implement the interface that corresponds to the class.

e.g.:

```<code>class A : IIdentifiable<A> // how to make sure, that only A is allowed here?
{ }
</code>```

I know about type restrictions, but they don't suit for this case because they are defined in the interface via (where T : ..) but the interface can't know what class it is currently implemented by.

Is there any way to formulate this restriction? Maybe also using a slightly different architechture?

Thanks!

Body:
I'd like to create an interface that gives objects of certain classes an id and a dictionary where you can find the reference by Id. So every class should have their own counting id (starting at 1).

That is what I have:

interface IIdentifiable<T>
{
    public int id { get; }
    public static int NextId { get; private set; } = 1;
    private static readonly Dictionary<int, T> InstanceById = new Dictionary<int, T>();

    public static T GetInstanceById(int id)
    {
        return InstanceById[id];
    }

    protected static void AddInstanceById(T instance, int id)
    {
        InstanceById.Add(id, instance);
    }

    protected static void IncrementNextId() => NextId++;
}

It works, but I'd like to restrict it in the way so that every class is only allowed to implement the interface that corresponds to the class.

e.g.:

class A : IIdentifiable // how to make sure, that only A is allowed here?
{ }

I know about type restrictions, but they don't suit for this case because they are defined in the interface via (where T : ..) but the interface can't know what class it is currently implemented by.

Is there any way to formulate this restriction? Maybe also using a slightly different architechture?

Thanks!


问:
In Flutter is it possible to make light mode and dark mode that are not part of the built in ThemeData
So what I am trying to do is create multiple color variations for my app in light as well as in dark theme. Meaning that my colors are not only primaryColor, backgroundColor, buttonColor etc. What I want to do is lets say have multiple buttons which will have different colors when theme changes meaning: button1 = Colors.red, button2 = Colors.blue, button3 = Colors.black and for the dark theme they will be button1  = Colors.yellow, button2 = Colors.green, button3 = Colors.white.

I have seen that the best way to handle the dark/light theme in Flutter is using providers but from all what I have seen is that all of them are using already existing ThemeData. Is there a way to make even more color combinations where I will assign that color to my specific widget for instance like this (its not syntax correct but u get the idea):

```<code>    Button(
    color:Theme.of(context).button1,
)
</code>```

Body:
So what I am trying to do is create multiple color variations for my app in light as well as in dark theme. Meaning that my colors are not only primaryColor, backgroundColor, buttonColor etc. What I want to do is lets say have multiple buttons which will have different colors when theme changes meaning: button1 = Colors.red, button2 = Colors.blue, button3 = Colors.black and for the dark theme they will be button1  = Colors.yellow, button2 = Colors.green, button3 = Colors.white.

I have seen that the best way to handle the dark/light theme in Flutter is using providers but from all what I have seen is that all of them are using already existing ThemeData. Is there a way to make even more color combinations where I will assign that color to my specific widget for instance like this (its not syntax correct but u get the idea):

    Button(
    color:Theme.of(context).button1,
)


问:
JEST error EACCES: permission denied, mkdir
I'm working on a Typescript Rest API with Express, that I run on a linux machine, and in one of my middleware in charge of uploading files, I create a folder in the public folder with a specific ID as a name.

It's working all fine until I run my tests with jest where I got this error :

EACCES: permission denied, mkdir './public/uploads/jobCVs/639c396892d8bf249f9c98c7'

From :

```<code>      22 |         const folderPath = `./public/uploads/jobCVs/${req.params.jobId.toString()}`;
    > 23 |         fs.mkdirSync(folderPath, { recursive: true });
</code>```

This fs.mkdir right here.

I don't get why it is blocked just during my tests... and anyone know how to get the permission to allow the mkdir call even when running tests with jests ?

I tried solutions from this stackoverflow question : Error: EACCES: permission denied but still got the same error...

EDIT
I'm working inside a Docker container, and launching the test command inside it resolved all access problems. I can do this like this but still don't get why it doesn't work locally (outside docker).

Body:
I'm working on a Typescript Rest API with Express, that I run on a linux machine, and in one of my middleware in charge of uploading files, I create a folder in the public folder with a specific ID as a name.

It's working all fine until I run my tests with jest where I got this error :

EACCES: permission denied, mkdir './public/uploads/jobCVs/639c396892d8bf249f9c98c7'

From :

      22 |         const folderPath = `./public/uploads/jobCVs/${req.params.jobId.toString()}`;
    > 23 |         fs.mkdirSync(folderPath, { recursive: true });

This fs.mkdir right here.

I don't get why it is blocked just during my tests... and anyone know how to get the permission to allow the mkdir call even when running tests with jests ?

I tried solutions from this stackoverflow question : Error: EACCES: permission denied but still got the same error...

EDIT
I'm working inside a Docker container, and launching the test command inside it resolved all access problems. I can do this like this but still don't get why it doesn't work locally (outside docker).


问:
(Wrong)Redirect to Login page instead submitting record MVC c#
I have a login page and another page that has a submit button.

When inputting record and clicking submit instead of processing action, it automatically redirects to login page.

MVC View:

```<code><div class="form-group row">
    <input type="button" value="Download PDF" class="btn btn-lg w-100 bg-primary text-white" id="DownloadPDF" />
    <label class="small disclaimerText">Please input your name</label>
</div>
</code>```

JS:

```<code>$('#DownloadPDF').click(function (e) {
    alert("clicking download");
    --just code for download pdf
}
</code>```

Adding console log. It appears that it is still going to function but still redirect to login page.

Body:
I have a login page and another page that has a submit button.

When inputting record and clicking submit instead of processing action, it automatically redirects to login page.

MVC View:

    <input type="button" value="Download PDF" class="btn btn-lg w-100 bg-primary text-white" id="DownloadPDF" />
    Please input your name

JS:

$('#DownloadPDF').click(function (e) {
    alert("clicking download");
    --just code for download pdf
}

Adding console log. It appears that it is still going to function but still redirect to login page.


问:
How to programatically create a svg with different colors in python/django?
In telegram, when you have yet to upload your picture, they will programatically generate a logo based on your initials like the following

I want something similar but as SVG and ICO for a Django web app.

I only need 26 letters from A to Z. And I need to be able to change the fill color based on taiwindcss colors

The letters itself would be white or black.

Is there a programatical way to generate these svg and ico to be used in a Django webapp? I could not find any library that does this.

I only need it as a square basically


问:
Can't print from docker-compose container to the Docker desktop app
I am trying to print from a docker-compose container to the terminal/docker desktop app or wehere ever I will be able to see it. But it doesn't work for some reason.

What I already tried using:

-u flag

stdin_open: true and tty: true in the docker-compose

flush=True in the print statment

But none of it working.

Can someone please help me figer this out?.

I am running it using the following command:

docker-compose up -d

this is my docker-compose:

```<code>version: '3.5'

environment:
  PYTHONUNBUFFERED=1

services:
  relay:
    container_name: relay
    image: image
    command: python3 -u server.py
    expose:
      - "443"
    networks:
      pNetwork1:
        ipv4_address: 10.1.0.3
    stdin_open: true
    tty: true
</code>```

and this is my server.py:

```<code>def main():
    print("Please Work!", flush=True)
if __name__ == "__main__":
    main()
</code>```

Body:
I am trying to print from a docker-compose container to the terminal/docker desktop app or wehere ever I will be able to see it. But it doesn't work for some reason.

What I already tried using:

-u flag

stdin_open: true and tty: true in the docker-compose

flush=True in the print statment

But none of it working.

Can someone please help me figer this out?.

I am running it using the following command:

docker-compose up -d

this is my docker-compose:

version: '3.5'

environment:
  PYTHONUNBUFFERED=1

services:
  relay:
    container_name: relay
    image: image
    command: python3 -u server.py
    expose:
      - "443"
    networks:
      pNetwork1:
        ipv4_address: 10.1.0.3
    stdin_open: true
    tty: true

and this is my server.py:

def main():
    print("Please Work!", flush=True)
if __name__ == "__main__":
    main()


问:
In this I am getting dataframereader error for parsing xml using pyspark?
This is the code in google colab I am performing for parsing xml through pyspark:

```<code>df = spark.read.format("com.databricks.spark.xml").option("rowTag","persons").xml("/content/xl1.xml")
</code>```

This is the error showing:

'DataFrameReader' object has no attribute 'xml'

Body:
This is the code in google colab I am performing for parsing xml through pyspark:

df = spark.read.format("com.databricks.spark.xml").option("rowTag","persons").xml("/content/xl1.xml")

This is the error showing:

'DataFrameReader' object has no attribute 'xml'