问:
I need to change data on the modal but when modal is opened the info written there is fixed and i can not type anything
i have a component of servizi. after i add data i want to change/update the data on the modal which will be opened. but the problem is that when modal is opened, i can  not change , delete info written there and i can not even write any thing. the data added are fixed there.i ll appreciate if you help me to resolve it.

servizi component:

```<code>import React,{useState, useEffect} from 'react'
// import '../Modal.css';
import  {useForm}  from "react-cool-form";
import lookupService from '../../services/lookup.service';

function EditServizioAPagamento({id, onClose}) {

    const [idServizio, setIdServizio] = useState(id)
    const [ServizioInfo, setServizioInfo] = useState({
        codiceServizio:"",
        descrizione:""
    })

    const { form, use } = useForm({
        defaultValues: { codiceServizio: "", descrizione: ""},
        onSubmit: (values) => {
            lookupService.updateServizi(id, values.codiceServizio, values.descrizione)
            window.location.reload();
        }
    });
    const errors = use("errors");

    useEffect(() => {
       const data= lookupService.getOneServizi(id).then((res)=>setServizioInfo(res.data))

    }, [idServizio])

    return (

        <div onClick={onClose} className='overlay'>
            <div onClick={(e) => {
                e.stopPropagation()
            }} className="modalContainer">
                <div className="modalRight">
                    <p onClick={onClose} className="closeBtn">X</p>
                    <div className="content">
                        <form  style={{margin:"0" }} ref={form} noValidate>
                            <p className="bold">Codice Servizio</p>
                                <input name="codiceServizio" placeholder="Codice servizio" value={ServizioInfo.codiceServizio} required />
                                {errors.codiceServizio && <p>{errors.codiceServizio}</p>}
                            <span style={{color:"grey"}}>----------------------</span>
                            <p className="bold">Descrizione</p>
                            <input name="descrizione" placeholder="Descrizione"  value={ServizioInfo.descrizione} required />
                                {errors.lastName && <p>{errors.lastName}</p>}
                            <input className="invia" type="submit" />
                        </form>
                    </div>
                </div>
            </div>
        </div>
    )
}

export default EditServizioAPagamento
</code>```

lookup service :

```<code>const getOneServizi = (id) => {
    return axios.get(API_URL_SERVIZI + "getOne/"+id ,{headers: authHeader()});
 };
const getServizi = () => {
   return axios.get(API_URL_SERVIZI + "getAll",{headers: authHeader()});
};
const addServizi = (codiceServizio, descrizione) => {
    return axios.post(API_URL_SERVIZI + "create",{
        codiceServizio: codiceServizio,
        descrizione: descrizione
    },{headers: authHeader()});
};
const deleteServizi = (id) => {
    return axios.get(API_URL_SERVIZI + "delete/" + id,{headers: authHeader()});
};
const updateServizi = (id, codiceServizio, descrizione) => {
    return axios.put(API_URL_SERVIZI + "update/"+id,{codiceServizio: codiceServizio, descrizione:descrizione},
    {headers: authHeader()});
};

tabel component:

 const editServizio =  (event) =>{

        props.aggiorna.edit(event.currentTarget.id);

    }

const tdData = () => {

            return props.dati.map((data) => {
                data.Aggiorna = <CardButton id={data.id}  onClick={editServizio} style={{margin:0}} ><FaPenSquare/></CardButton> ;
                data.Elimina = <CardButton id={data.id} onClick={elimina} style={{margin:0, background:"red"}} ><FaTrash/></CardButton> ;
                return (
                    <tr>
                        {
                            column.map((v) => {
                                return <td>{data[v]}</td>
                            }
                            )

                        }
                    </tr>
                )
            })
        }
</code>```

lookup js:

```<code>function Lookup (){

    const {id} = useParams();

    const [change, setChange] = useState(true)

    const [dati, setDati] = useState([{}]);
    const [openModal, setOpenModal] = useState(false);
    const [modal, setModal] = useState();

    var fnMap = {
        ":1": {
            "getOne":
                function (id) {
                    lookupService.getOneServizi(id)
                        .then((res) => {
                            setDati(res.data)

                        })
                        .catch((e) => {
                            alert("nessun servizio trovato")
                        })
                },
            "get":
                function () {
                    lookupService.getServizi()
                        .then((res) => {
                            setDati(res.data)

                        })
                        .catch((e) => {
                            alert("nessun servizio trovato")
                        })
                },
            "delete":
                function (id2) {
                    lookupService.deleteServizi(id2)
                        .then((res) => {
                            "Servzio cancellato"
                        })
                        .catch((e) => {
                            alert("Servizio non cancellato")
                        })
                },
            "add":
                function() {
                        setModal(<InserisciServizioAPagamento onClose={() => {
                            setOpenModal(false)
                            setModal(null)
                    }}/>);
            },
            "edit":
                function(id) {

                        setModal(<EditServizioAPagamento id={id} onClose={() => {
                            setOpenModal(false)
                            setModal(null)
                    }}/>);
            }

        },
        ":2": {
            "get":
                function () {
                    lookupService.getAbbonamentiAziende()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessun abbonamento trovato")
                        })
                },
            "delete":
                function (id2){
                    lookupService.deleteAbbonamentiAziende(id2)
                        .then((res) => ("Abbonamento cancellato"))
                        .catch((e)=>("Abbonamento non cancellato"))
                              },
            "add":
                function() {
                console.log("ciqo")
                    setModal(<TipologiaAbbonamentoAzienda onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }

        },
        ":3": {
            "get":
                function () {
                    lookupService.getAllAbbonamentiConsulenti()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessun abbonamento trovato")
                        })
                },
            "delete":
                function (id2) {
                    lookupService.deleteAbbonamentoConsulente(id2)
                        .then((res) =>
                                                            setChange(true))
                        .catch((e) => ("Abbonamento non cancellato"))
                },
            "add":
                function() {
                    setModal(<TipologiaAbbonamentoConsulente onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":4": {
            "get":
                function () {
                    offerteService.getOfferte()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessuna offerta trovata")
                        })
                },
            "delete":
                function (id2) {
                    offerteService.deleteOfferta(id2)
                        .then((res) => ("Offerta cancellata"))
                        .catch((e) => ("Offerta non cancellata"))
                },
            "add":
                function() {
                    setModal(<StatoOfferte onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":5": {
            "get":
                function () {
                    proposteService.getAllProposte()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessuna proposta trovata" + e)
                        })
                },
            "delete":
                function (id2) {
                    proposteService.deleteProposte(id2)
                        .then((res) => ("Proposta cancellata"))
                        .catch((e) => ("Proposta non cancellata"))
                },
            "add":
                function() {
                    setModal(<StatoProposte onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":6": {
            "get":
                function () {
                    asteService.getAllAste()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessun' asta trovata")
                        })
                },
            "delete":
                function (id2) {
                    asteService.deleteAsta(id2)
                        .then((res) => ("Asta cancellata"))
                        .catch((e) => ("Asta non cancellata"))
                },
            "add":
                function() {
                    setModal(<StatoAste onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":7": {
            "get":
                function () {
                    lookupService.getAllAree()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessun' area professionale trovata")
                        })
                },
            "delete":
                function (id2) {
                    lookupService.deleteAree(id2)
                        .then((res) => ("Asta cancellata"))
                        .catch((e) => ("Area professionale non cancellata"))
                },
            "add":
                function() {
                    setModal(<AreeProfessionali onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":8": {
            "get":
                function () {
                    lookupService.getAllTitoli()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessun titolo trovato")
                        })
                },
            "delete":
                function (id2) {
                    lookupService.deleteTitoli(id2)
                        .then((res) => ("Titolo cancellato"))
                        .catch((e) => ("Titolo non cancellata"))
                },
            "add":
                function() {
                    setModal(<TitoloStudio onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":9": {
            "get":
                function () {
                    lookupService.getAllLingue()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessuna lingua trovata")
                        })
                },
            "delete":
                function (id2) {
                    lookupService.deleteLingue(id2)
                        .then((res) => ("Lingua cancellata"))
                        .catch((e) => ("Lingua non cancellata"))
                },
            "add":
                function() {
                    setModal(<Lingue onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":10": {
            "get":
                function () {
                    consulenteService.getListaConsulenti()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessuna lingua trovata")
                        })
                },
            "add":
                function() {
                    setModal(<AnagraficaConsulente onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":11": {
            "get":
                function () {
                    cvConsulenteService.getAll()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessuna lingua trovata")
                        })
                },
            "delete":
                function (id2) {
                    cvConsulenteService.deleteCV(id2)
                        .then((res) => ("Lingua cancellata"))
                        .catch((e) => ("Lingua non cancellata"))
                },
            "add":
                function() {
                    setModal(<AnagraficaAziende onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":12": {
            "get":
                function () {
                    lookupService.getAllAziende()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessuna lingua trovata")
                        })
                },
            "delete":
                function (username) {
                    lookupService.deleteAziende(username)
                        .then((res) => ("Lingua cancellata"))
                        .catch((e) => ("Lingua non cancellata"))
                },
            "add":
                function() {
                    setModal(<AnagraficaAziende onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },

    }

    const { user: currentUser } = useSelector((state) => state.auth);
    const navigate = useNavigate();

    let state;
    state = { isShown: false };

    useEffect(() => {
        if (fnMap[id]["get"]()) { fnMap[id]["get"]();
            setChange(false)
        }
    }, [id]);

    return (
        <div style={{display:"grid"}}>
            <DynamicTable dati={dati}  elimina={fnMap[id]}  aggiorna={fnMap[id]}/>

            <CardButton onClick={fnMap[id]["add"]} style={{ marginTop:"1%", marginRight:"1px"}}>Aggiungi entry</CardButton>
            {modal}
        </div>
    );
};
export default Lookup;
</code>```

Body:
i have a component of servizi. after i add data i want to change/update the data on the modal which will be opened. but the problem is that when modal is opened, i can  not change , delete info written there and i can not even write any thing. the data added are fixed there.i ll appreciate if you help me to resolve it.

servizi component:

import React,{useState, useEffect} from 'react'
// import '../Modal.css';
import  {useForm}  from "react-cool-form";
import lookupService from '../../services/lookup.service';

function EditServizioAPagamento({id, onClose}) {

    const [idServizio, setIdServizio] = useState(id)
    const [ServizioInfo, setServizioInfo] = useState({
        codiceServizio:"",
        descrizione:""
    })

    const { form, use } = useForm({
        defaultValues: { codiceServizio: "", descrizione: ""},
        onSubmit: (values) => {
            lookupService.updateServizi(id, values.codiceServizio, values.descrizione)
            window.location.reload();
        }
    });
    const errors = use("errors");

    useEffect(() => {
       const data= lookupService.getOneServizi(id).then((res)=>setServizioInfo(res.data))

    }, [idServizio])

    return (

 {
                e.stopPropagation()
            }} className="modalContainer">

X

                        <form  style={{margin:"0" }} ref={form} noValidate>

Codice Servizio

                                <input name="codiceServizio" placeholder="Codice servizio" value={ServizioInfo.codiceServizio} required />
                                {errors.codiceServizio &&
{errors.codiceServizio}
}
                            ----------------------

Descrizione

                            <input name="descrizione" placeholder="Descrizione"  value={ServizioInfo.descrizione} required />
                                {errors.lastName &&
{errors.lastName}
}
                            <input className="invia" type="submit" />
                        </form>

    )
}

export default EditServizioAPagamento

lookup service :

const getOneServizi = (id) => {
    return axios.get(API_URL_SERVIZI + "getOne/"+id ,{headers: authHeader()});
 };
const getServizi = () => {
   return axios.get(API_URL_SERVIZI + "getAll",{headers: authHeader()});
};
const addServizi = (codiceServizio, descrizione) => {
    return axios.post(API_URL_SERVIZI + "create",{
        codiceServizio: codiceServizio,
        descrizione: descrizione
    },{headers: authHeader()});
};
const deleteServizi = (id) => {
    return axios.get(API_URL_SERVIZI + "delete/" + id,{headers: authHeader()});
};
const updateServizi = (id, codiceServizio, descrizione) => {
    return axios.put(API_URL_SERVIZI + "update/"+id,{codiceServizio: codiceServizio, descrizione:descrizione},
    {headers: authHeader()});
};

tabel component:

 const editServizio =  (event) =>{

        props.aggiorna.edit(event.currentTarget.id);

    }

const tdData = () => {

            return props.dati.map((data) => {
                data.Aggiorna = <CardButton id={data.id}  onClick={editServizio} style={{margin:0}} ><FaPenSquare/></CardButton> ;
                data.Elimina = <CardButton id={data.id} onClick={elimina} style={{margin:0, background:"red"}} ><FaTrash/></CardButton> ;
                return (

                        {
                            column.map((v) => {
                                return {data[v]}
                            }
                            )

                        }

                )
            })
        }

lookup js:

function Lookup (){

    const {id} = useParams();

    const [change, setChange] = useState(true)

    const [dati, setDati] = useState([{}]);
    const [openModal, setOpenModal] = useState(false);
    const [modal, setModal] = useState();

    var fnMap = {
        ":1": {
            "getOne":
                function (id) {
                    lookupService.getOneServizi(id)
                        .then((res) => {
                            setDati(res.data)

                        })
                        .catch((e) => {
                            alert("nessun servizio trovato")
                        })
                },
            "get":
                function () {
                    lookupService.getServizi()
                        .then((res) => {
                            setDati(res.data)

                        })
                        .catch((e) => {
                            alert("nessun servizio trovato")
                        })
                },
            "delete":
                function (id2) {
                    lookupService.deleteServizi(id2)
                        .then((res) => {
                            "Servzio cancellato"
                        })
                        .catch((e) => {
                            alert("Servizio non cancellato")
                        })
                },
            "add":
                function() {
                        setModal(<InserisciServizioAPagamento onClose={() => {
                            setOpenModal(false)
                            setModal(null)
                    }}/>);
            },
            "edit":
                function(id) {

                        setModal(<EditServizioAPagamento id={id} onClose={() => {
                            setOpenModal(false)
                            setModal(null)
                    }}/>);
            }

        },
        ":2": {
            "get":
                function () {
                    lookupService.getAbbonamentiAziende()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessun abbonamento trovato")
                        })
                },
            "delete":
                function (id2){
                    lookupService.deleteAbbonamentiAziende(id2)
                        .then((res) => ("Abbonamento cancellato"))
                        .catch((e)=>("Abbonamento non cancellato"))
                              },
            "add":
                function() {
                console.log("ciqo")
                    setModal(<TipologiaAbbonamentoAzienda onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }

        },
        ":3": {
            "get":
                function () {
                    lookupService.getAllAbbonamentiConsulenti()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessun abbonamento trovato")
                        })
                },
            "delete":
                function (id2) {
                    lookupService.deleteAbbonamentoConsulente(id2)
                        .then((res) =>
                                                            setChange(true))
                        .catch((e) => ("Abbonamento non cancellato"))
                },
            "add":
                function() {
                    setModal(<TipologiaAbbonamentoConsulente onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":4": {
            "get":
                function () {
                    offerteService.getOfferte()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessuna offerta trovata")
                        })
                },
            "delete":
                function (id2) {
                    offerteService.deleteOfferta(id2)
                        .then((res) => ("Offerta cancellata"))
                        .catch((e) => ("Offerta non cancellata"))
                },
            "add":
                function() {
                    setModal(<StatoOfferte onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":5": {
            "get":
                function () {
                    proposteService.getAllProposte()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessuna proposta trovata" + e)
                        })
                },
            "delete":
                function (id2) {
                    proposteService.deleteProposte(id2)
                        .then((res) => ("Proposta cancellata"))
                        .catch((e) => ("Proposta non cancellata"))
                },
            "add":
                function() {
                    setModal(<StatoProposte onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":6": {
            "get":
                function () {
                    asteService.getAllAste()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessun' asta trovata")
                        })
                },
            "delete":
                function (id2) {
                    asteService.deleteAsta(id2)
                        .then((res) => ("Asta cancellata"))
                        .catch((e) => ("Asta non cancellata"))
                },
            "add":
                function() {
                    setModal(<StatoAste onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":7": {
            "get":
                function () {
                    lookupService.getAllAree()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessun' area professionale trovata")
                        })
                },
            "delete":
                function (id2) {
                    lookupService.deleteAree(id2)
                        .then((res) => ("Asta cancellata"))
                        .catch((e) => ("Area professionale non cancellata"))
                },
            "add":
                function() {
                    setModal(<AreeProfessionali onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":8": {
            "get":
                function () {
                    lookupService.getAllTitoli()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessun titolo trovato")
                        })
                },
            "delete":
                function (id2) {
                    lookupService.deleteTitoli(id2)
                        .then((res) => ("Titolo cancellato"))
                        .catch((e) => ("Titolo non cancellata"))
                },
            "add":
                function() {
                    setModal(<TitoloStudio onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":9": {
            "get":
                function () {
                    lookupService.getAllLingue()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessuna lingua trovata")
                        })
                },
            "delete":
                function (id2) {
                    lookupService.deleteLingue(id2)
                        .then((res) => ("Lingua cancellata"))
                        .catch((e) => ("Lingua non cancellata"))
                },
            "add":
                function() {
                    setModal(<Lingue onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":10": {
            "get":
                function () {
                    consulenteService.getListaConsulenti()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessuna lingua trovata")
                        })
                },
            "add":
                function() {
                    setModal(<AnagraficaConsulente onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":11": {
            "get":
                function () {
                    cvConsulenteService.getAll()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessuna lingua trovata")
                        })
                },
            "delete":
                function (id2) {
                    cvConsulenteService.deleteCV(id2)
                        .then((res) => ("Lingua cancellata"))
                        .catch((e) => ("Lingua non cancellata"))
                },
            "add":
                function() {
                    setModal(<AnagraficaAziende onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },
        ":12": {
            "get":
                function () {
                    lookupService.getAllAziende()
                        .then((res) => setDati(res.data))
                        .catch((e) => {
                            alert("nessuna lingua trovata")
                        })
                },
            "delete":
                function (username) {
                    lookupService.deleteAziende(username)
                        .then((res) => ("Lingua cancellata"))
                        .catch((e) => ("Lingua non cancellata"))
                },
            "add":
                function() {
                    setModal(<AnagraficaAziende onClose={() => {
                        setOpenModal(false)
                        setModal(null)
                    }}/>);
                }
        },

    }

    const { user: currentUser } = useSelector((state) => state.auth);
    const navigate = useNavigate();

    let state;
    state = { isShown: false };

    useEffect(() => {
        if (fnMap[id]["get"]()) { fnMap[id]["get"]();
            setChange(false)
        }
    }, [id]);

    return (

            <DynamicTable dati={dati}  elimina={fnMap[id]}  aggiorna={fnMap[id]}/>

            <CardButton onClick={fnMap[id]["add"]} style={{ marginTop:"1%", marginRight:"1px"}}>Aggiungi entry</CardButton>
            {modal}

    );
};
export default Lookup;


来源: stackexchange

问:
joining of three tables in sql ,and add a column to it using when condition
when we create the three tables in sql. i.e: one is student, second one is subject, third one is  results
comparing of three tables i want extra one colum i.e status
how to add a column in sql with out using ,but,have wen condition and it depends on the marks
for example ;</p>
```<code>case when marks>=90 THEN 'Exc'
         when marks<=89 AND st_marks>=80  THEN 'Good'

```so depend on this condition i want to add a column ie status

i tried with alter,but it doesn't work to add a colum  when thre tables .and i am expecting that status column in the table with fields depends on when condition which is related to marks
</code>```

ContentLicense: CC BY-SA 4.0

Body:
when we create the three tables in sql. i.e: one is student, second one is subject, third one is  results
comparing of three tables i want extra one colum i.e status
how to add a column in sql with out using ,but,have wen condition and it depends on the marks
for example ;

case when marks>=90 THEN 'Exc'
         when marks<=89 AND st_marks>=80  THEN 'Good'

```so depend on this condition i want to add a column ie status

i tried with alter,but it doesn't work to add a colum  when thre tables .and i am expecting that status column in the table with fields depends on when condition which is related to marks


问:
Duplcated of How to access the original case sensitive username input in custom user storage provider of keycloak?
I developed a service provider interface (SPI) for User Federation in keycloak.

When I try to login with an existing case sensitive user, keycloak converts it to lower case, so at the end, the sent username was not found in my user API.

I am using keycloak 20.0.1 version and it is deploying in a docker container.

I found this post in stackoverflow that share an anwerd relatated for this, buth I do not get solution. I replaced conf/cache-ispn.xml as it metion, buth when keycloak starts it gets the error Cache 'users' has been requested, but no matching cache configuration exists.

I realy apreciate if some one knows if there is an alternative.

Regardles.

I tried to get original input username with case sensitive in keycloak login.


问:
GraphiQL breaks with an scaffolded mutation in Rails
Building a GraphQL API with rails, I scaffolded a create mutation for one of my records like so:

```<code>$ rails g graphql:mutation_create event
</code>```

This added the mutation type like so in app/graphql/types/mutation_type.rb:

```<code>field :event_create, mutation: Mutations::EventCreate
</code>```

And the mutation as follows in app/graphql/mutations/event_create.rb:

```<code># frozen_string_literal: true

module Mutations
  class EventCreate < BaseMutation
    description "Creates a new event"

    field :event, Types::EventType, null: false

    argument :event_input, Types::EventInputType, required: true

    def resolve(event_input:)
      event = ::Event.new(**event_input)
      raise GraphQL::ExecutionError.new "Error creating event", extensions: event.errors.to_hash unless event.save

      { event: event }
    end
  end
end
</code>```

But I get the following error when loading up the GraphiQL, notice this just appears when loading the GraphiQL, it has nothing to do with me trying the mutation on hand (I've scaffolded the delete mutation and works like a charm):

```<code>{
  "message": "Invalid or incomplete introspection result. Ensure that you are passing \"data\" property of introspection response and no \"errors\" was returned alongside: {}.",
  "stack": "Error: Invalid or incomplete introspection result. Ensure that you are passing \"data\" property of introspection response and no \"errors\" was returned alongside: {}.\n    at devAssert (webpack-internal:///../../../node_modules/graphql/jsutils/devAssert.mjs:7:11)\n    at buildClientSchema (webpack-internal:///../../../node_modules/graphql/utilities/buildClientSchema.mjs:41:266)\n    at eval (webpack-internal:///./components/GraphiQL.tsx:1133:57)"
}
</code>```

Any idea what's going on?

PS. Apparently it happens with the update mutation as well when scaffolded. If I comment those mutations out from the mutation type the error disappears.

Body:
Building a GraphQL API with rails, I scaffolded a create mutation for one of my records like so:

$ rails g graphql:mutation_create event

This added the mutation type like so in app/graphql/types/mutation_type.rb:

field :event_create, mutation: Mutations::EventCreate

And the mutation as follows in app/graphql/mutations/event_create.rb:

# frozen_string_literal: true

module Mutations
  class EventCreate < BaseMutation
    description "Creates a new event"

    field :event, Types::EventType, null: false

    argument :event_input, Types::EventInputType, required: true

    def resolve(event_input:)
      event = ::Event.new(**event_input)
      raise GraphQL::ExecutionError.new "Error creating event", extensions: event.errors.to_hash unless event.save

      { event: event }
    end
  end
end

But I get the following error when loading up the GraphiQL, notice this just appears when loading the GraphiQL, it has nothing to do with me trying the mutation on hand (I've scaffolded the delete mutation and works like a charm):

{
  "message": "Invalid or incomplete introspection result. Ensure that you are passing \"data\" property of introspection response and no \"errors\" was returned alongside: {}.",
  "stack": "Error: Invalid or incomplete introspection result. Ensure that you are passing \"data\" property of introspection response and no \"errors\" was returned alongside: {}.\n    at devAssert (webpack-internal:///../../../node_modules/graphql/jsutils/devAssert.mjs:7:11)\n    at buildClientSchema (webpack-internal:///../../../node_modules/graphql/utilities/buildClientSchema.mjs:41:266)\n    at eval (webpack-internal:///./components/GraphiQL.tsx:1133:57)"
}

Any idea what's going on?

PS. Apparently it happens with the update mutation as well when scaffolded. If I comment those mutations out from the mutation type the error disappears.


问:
cryptography.fernet.InvalidToken: Password Manager/Generator
I am trying to build a Tkinter GUI password manager that saves the encrypted passwords on a SQLite Database; and it returns the decrypted password back when you search in the database by the website name.

Here is my script and what it returns:

```<code>import tkinter as tk
from tkinter import messagebox
import random
import pyperclip
import sqlite3
from werkzeug.security import generate_password_hash, check_password_hash
import base64
import os
from cryptography.fernet import Fernet
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC

# DATABASE.
db = sqlite3.connect('user-data.db')
cursor = db.cursor()

# cursor.execute('CREATE TABLE UserData (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, '
#                'website varchar(250) NOT NULL UNIQUE, '
#                'email varchar(250) NOT NULL, '
#                'password varchar(250) NOT NULL)')

# cursor.execute('INSERT INTO UserData VALUES(1, "amazon.co.uk", "my_email@gmail.com", "wieuiwrhfg4")')
# db.commit()
#
# key = Fernet.generate_key()
# f = Fernet(key)

# PASSWORD GENERATOR.
def generate_password():
    letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
               'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
               'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
    numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
    symbols = ['!', '#', '$', '%', '&', '(', ')', '*', '+']

    password_letters = [random.choice(letters) for _ in range(random.randint(8, 10))]
    password_symbols = [random.choice(symbols) for _ in range(random.randint(2, 4))]
    password_numbers = [random.choice(numbers) for _ in range(random.randint(2, 4))]

    password_list = password_letters + password_symbols + password_numbers
    random.shuffle(password_list)

    password = "".join(password_list)
    password_entry.insert(0, string=password)
    pyperclip.copy(password)

    return password

def password_enc():
    salt = os.urandom(16)
    kdf = PBKDF2HMAC(algorithm=hashes.SHA256(),
                     length=32,
                     salt=salt,
                     iterations=480000
                     )
    key = base64.urlsafe_b64encode(kdf.derive(bytes(generate_password(), 'utf-8')))
    # key = Fernet.generate_key().decode()
    f = Fernet(key)
    token = f.encrypt(bytes(generate_password(), 'utf-8'))
    return token, f

# SAVE PASSWORD.
def save():
    website = website_entry.get()  # .get() fetches the current entry text.
    password = password_entry.get()

    # hash_salted_password = generate_password_hash(password, method='pbkdf2:sha256', salt_length=8)
    # encrypted_password = f.encrypt(str.encode(password))
    # encrypted_password = str.encode(password)

    # key = base64.urlsafe_b64encode(kdf.derive(str.encode(password)))
    # f = Fernet(key)
    # token = f.encrypt(str.encode(password))
    # print(token)

    if len(website) == 0 or len(password) == 0:
        messagebox.showinfo(title="Oops", message="Please make sure you haven't left any fields empty.")
    else:
        try:
            cursor.execute("INSERT INTO UserData VALUES(?, ?, ?, ?)",
                           (None, website_entry.get(), email_entry.get(), password_enc()[0]))
            db.commit()

        finally:
            website_entry.delete(0, tk.END)  # .delete() from index 0, first char till the END.
            password_entry.delete(0, tk.END)

#  FIND PASSWORD.
def find_password():
    website = website_entry.get()

    try:
        cursor.execute("SELECT * FROM UserData WHERE website=?", (website,))
        result = cursor.fetchall()
        print(result)

    except FileNotFoundError:
        messagebox.showinfo(title="Error", message="No Data File Found.")

    else:
        if website in result[0]:
            email = result[0][1]
            hashed_password = result[0][3]
            # password = check_password_hash(pwhash=hashed_password, password=generate_password())
            decrypted_password = password_enc()[1].decrypt(hashed_password)
            # decrypted_password = save().decode()

            # decrypted_password = f.decrypt(hashed_password)

            messagebox.showinfo(title=website, message=f"Email: {email}\nPassword: {decrypted_password}")
        else:
            messagebox.showinfo(title="Error", message=f"No details for {website} exists.")

</code>```
```<code>Exception in Tkinter callback
Traceback (most recent call last):
  File "/Users//PycharmProjects/pythonProject/Day-24/venv/lib/python3.10/site-packages/cryptography/fernet.py", line 133, in _verify_signature
    h.verify(data[-32:])
  File "/Users//PycharmProjects/pythonProject/Day-24/venv/lib/python3.10/site-packages/cryptography/hazmat/primitives/hmac.py", line 72, in verify
    ctx.verify(signature)
  File "/Users//PycharmProjects/pythonProject/Day-24/venv/lib/python3.10/site-packages/cryptography/hazmat/backends/openssl/hmac.py", line 85, in verify
    raise InvalidSignature("Signature did not match digest.")
cryptography.exceptions.InvalidSignature: Signature did not match digest.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tkinter/__init__.py", line 1921, in __call__
    return self.func(*args)
  File "/Users//PycharmProjects/pythonProject/password-manager/p_main.py", line 112, in find_password
    decrypted_password = password_enc()[1].decrypt(password_enc()[0])
  File "/Users//PycharmProjects/pythonProject/Day-24/venv/lib/python3.10/site-packages/cryptography/fernet.py", line 90, in decrypt
    return self._decrypt_data(data, timestamp, time_info)
  File "/Users//PycharmProjects/pythonProject/Day-24/venv/lib/python3.10/site-packages/cryptography/fernet.py", line 151, in _decrypt_data
    self._verify_signature(data)
  File "/Users//PycharmProjects/pythonProject/Day-24/venv/lib/python3.10/site-packages/cryptography/fernet.py", line 135, in _verify_signature
    raise InvalidToken
cryptography.fernet.InvalidToken
</code>```

The save() function works as intended, it manages to save and hashed password on the database, but when I try to call find_password() I get the following error cryptography.fernet.InvalidToken. The #commented lines of code in my script are the various ways I have tried to solve this problem.

The closest I've got to solving this issue was to be able to encrypt/save and decrypt/find the password on the same run, after re-running the program the encryption key would change, resulting in errors.

Body:
I am trying to build a Tkinter GUI password manager that saves the encrypted passwords on a SQLite Database; and it returns the decrypted password back when you search in the database by the website name.

Here is my script and what it returns:

import tkinter as tk
from tkinter import messagebox
import random
import pyperclip
import sqlite3
from werkzeug.security import generate_password_hash, check_password_hash
import base64
import os
from cryptography.fernet import Fernet
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC

# DATABASE.
db = sqlite3.connect('user-data.db')
cursor = db.cursor()

# cursor.execute('CREATE TABLE UserData (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, '
#                'website varchar(250) NOT NULL UNIQUE, '
#                'email varchar(250) NOT NULL, '
#                'password varchar(250) NOT NULL)')

# cursor.execute('INSERT INTO UserData VALUES(1, "amazon.co.uk", "my_email@gmail.com", "wieuiwrhfg4")')
# db.commit()
#
# key = Fernet.generate_key()
# f = Fernet(key)

# PASSWORD GENERATOR.
def generate_password():
    letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
               'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
               'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
    numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
    symbols = ['!', '#', '$', '%', '&', '(', ')', '*', '+']

    password_letters = [random.choice(letters) for _ in range(random.randint(8, 10))]
    password_symbols = [random.choice(symbols) for _ in range(random.randint(2, 4))]
    password_numbers = [random.choice(numbers) for _ in range(random.randint(2, 4))]

    password_list = password_letters + password_symbols + password_numbers
    random.shuffle(password_list)

    password = "".join(password_list)
    password_entry.insert(0, string=password)
    pyperclip.copy(password)

    return password

def password_enc():
    salt = os.urandom(16)
    kdf = PBKDF2HMAC(algorithm=hashes.SHA256(),
                     length=32,
                     salt=salt,
                     iterations=480000
                     )
    key = base64.urlsafe_b64encode(kdf.derive(bytes(generate_password(), 'utf-8')))
    # key = Fernet.generate_key().decode()
    f = Fernet(key)
    token = f.encrypt(bytes(generate_password(), 'utf-8'))
    return token, f

# SAVE PASSWORD.
def save():
    website = website_entry.get()  # .get() fetches the current entry text.
    password = password_entry.get()

    # hash_salted_password = generate_password_hash(password, method='pbkdf2:sha256', salt_length=8)
    # encrypted_password = f.encrypt(str.encode(password))
    # encrypted_password = str.encode(password)

    # key = base64.urlsafe_b64encode(kdf.derive(str.encode(password)))
    # f = Fernet(key)
    # token = f.encrypt(str.encode(password))
    # print(token)

    if len(website) == 0 or len(password) == 0:
        messagebox.showinfo(title="Oops", message="Please make sure you haven't left any fields empty.")
    else:
        try:
            cursor.execute("INSERT INTO UserData VALUES(?, ?, ?, ?)",
                           (None, website_entry.get(), email_entry.get(), password_enc()[0]))
            db.commit()

        finally:
            website_entry.delete(0, tk.END)  # .delete() from index 0, first char till the END.
            password_entry.delete(0, tk.END)

#  FIND PASSWORD.
def find_password():
    website = website_entry.get()

    try:
        cursor.execute("SELECT * FROM UserData WHERE website=?", (website,))
        result = cursor.fetchall()
        print(result)

    except FileNotFoundError:
        messagebox.showinfo(title="Error", message="No Data File Found.")

    else:
        if website in result[0]:
            email = result[0][1]
            hashed_password = result[0][3]
            # password = check_password_hash(pwhash=hashed_password, password=generate_password())
            decrypted_password = password_enc()[1].decrypt(hashed_password)
            # decrypted_password = save().decode()

            # decrypted_password = f.decrypt(hashed_password)

            messagebox.showinfo(title=website, message=f"Email: {email}\nPassword: {decrypted_password}")
        else:
            messagebox.showinfo(title="Error", message=f"No details for {website} exists.")

Exception in Tkinter callback
Traceback (most recent call last):
  File "/Users//PycharmProjects/pythonProject/Day-24/venv/lib/python3.10/site-packages/cryptography/fernet.py", line 133, in _verify_signature
    h.verify(data[-32:])
  File "/Users//PycharmProjects/pythonProject/Day-24/venv/lib/python3.10/site-packages/cryptography/hazmat/primitives/hmac.py", line 72, in verify
    ctx.verify(signature)
  File "/Users//PycharmProjects/pythonProject/Day-24/venv/lib/python3.10/site-packages/cryptography/hazmat/backends/openssl/hmac.py", line 85, in verify
    raise InvalidSignature("Signature did not match digest.")
cryptography.exceptions.InvalidSignature: Signature did not match digest.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tkinter/__init__.py", line 1921, in __call__
    return self.func(*args)
  File "/Users//PycharmProjects/pythonProject/password-manager/p_main.py", line 112, in find_password
    decrypted_password = password_enc()[1].decrypt(password_enc()[0])
  File "/Users//PycharmProjects/pythonProject/Day-24/venv/lib/python3.10/site-packages/cryptography/fernet.py", line 90, in decrypt
    return self._decrypt_data(data, timestamp, time_info)
  File "/Users//PycharmProjects/pythonProject/Day-24/venv/lib/python3.10/site-packages/cryptography/fernet.py", line 151, in _decrypt_data
    self._verify_signature(data)
  File "/Users//PycharmProjects/pythonProject/Day-24/venv/lib/python3.10/site-packages/cryptography/fernet.py", line 135, in _verify_signature
    raise InvalidToken
cryptography.fernet.InvalidToken

The save() function works as intended, it manages to save and hashed password on the database, but when I try to call find_password() I get the following error cryptography.fernet.InvalidToken. The #commented lines of code in my script are the various ways I have tried to solve this problem.

The closest I've got to solving this issue was to be able to encrypt/save and decrypt/find the password on the same run, after re-running the program the encryption key would change, resulting in errors.


问:
How to enable proper C++ linting for modules in VS Code (Linux)?
I'm using VS Code on my Manjaro Linux machine to write C++ code. Since I'd like to use C++20 syntax and modules for my next project, I went into my settings and set C_CPP > Default: Cpp Standard to c++20.

However when writing this test snippet (which compiled just fine using g++)

import <iostream>;

auto main() -> int {
    std::cout << "Hello World" << std::endl;
    return 0;
}
```

code highlighting and linting does not work as expected.

Is there any way to get working on VS Code?

Body:
I'm using VS Code on my Manjaro Linux machine to write C++ code. Since I'd like to use C++20 syntax and modules for my next project, I went into my settings and set C_CPP > Default: Cpp Standard to c++20.

However when writing this test snippet (which compiled just fine using g++)

import <iostream>;

auto main() -> int {
    std::cout << "Hello World" << std::endl;
    return 0;
}

code highlighting and linting does not work as expected.

Is there any way to get working on VS Code?


问:
Python Treeview Question:I am using the IID of my parent to auto insert a child under the correct parent
I am generating a treeview and population it from a list

```<code>skillgroup=[
["Agricultural Skills"],
["Animal Skills"],
["Art & Entertainment Skills"],
["Athletic Skills"],
["Charismatic Skills"],
["Combat Skills"],
["Cooking & Brewing Skills"],
["Craft & Trade Skills"],
["Language Lore Skills"],
["Lore Historical Skills"],
["Lore Scientific Skills"],
["Materia Magicka Skills"],
["Materia Magicka Modes"],
["Materia Magicka Methods"],
["Materia Medicina Skills"],
["Materia Theologica Skills"],
["Mental Fortitude Skills"],
["Noble Skills"],
["Outdoor Skills"],
["Perception Skills"],
["Seamanship Skills"],
["Thievish Skills"]
]
</code>```
```<code>for record in skillgroup:
    #print(record)
    #print(countstr)
    my_skill.insert(parent='', index='end', iid=countstr, text="parent", values=record)
    count = count+1
    countstr = str("groupskill" + str(count))
</code>```

as you can see the IID is generated automatically

I now want to populate children under each of those headers

```<code>AgSkills=[
    ["Agricultural Skills", "Field Crops", "3", "STR", "WIS"],
    ["Agricultural Skills", "Silkworm Raising", "4", "CON", "WIS"],
    ["Agricultural Skills", "Tea Growing", "4", "INT", "WIS"],
    ["Agricultural Skills", "Vegetable Crops", "2", "CON", "WIS"],
    ["Agricultural Skills", "Vegetable Crops (LotRS)", "3", "CON", "WIS"],
    ["Agricultural Skills", "Viniculture", "3", "INT", "WIS"]
</code>```

I am able to do this by manually specifying the IID of the parent

```<code>for line in AgSkills:
    skill = str(line[1])
    df = str(line[2])
    primatt = str(line[3])
    secatt = str(line[4])
    my_skill.insert(parent='groupskill1', index='end', iid=countskill, text="Child", values=(skill, df, primatt, secatt))
</code>```

but I am having to create a separate loop for each header

What I would like to do is do a lookup of the parents and get the IID and names from each and use them as variables in my code,which would allow me have only one loop

I have up to now manually created loops

Body:
I am generating a treeview and population it from a list

skillgroup=[
["Agricultural Skills"],
["Animal Skills"],
["Art & Entertainment Skills"],
["Athletic Skills"],
["Charismatic Skills"],
["Combat Skills"],
["Cooking & Brewing Skills"],
["Craft & Trade Skills"],
["Language Lore Skills"],
["Lore Historical Skills"],
["Lore Scientific Skills"],
["Materia Magicka Skills"],
["Materia Magicka Modes"],
["Materia Magicka Methods"],
["Materia Medicina Skills"],
["Materia Theologica Skills"],
["Mental Fortitude Skills"],
["Noble Skills"],
["Outdoor Skills"],
["Perception Skills"],
["Seamanship Skills"],
["Thievish Skills"]
]

for record in skillgroup:
    #print(record)
    #print(countstr)
    my_skill.insert(parent='', index='end', iid=countstr, text="parent", values=record)
    count = count+1
    countstr = str("groupskill" + str(count))

as you can see the IID is generated automatically

I now want to populate children under each of those headers

AgSkills=[
    ["Agricultural Skills", "Field Crops", "3", "STR", "WIS"],
    ["Agricultural Skills", "Silkworm Raising", "4", "CON", "WIS"],
    ["Agricultural Skills", "Tea Growing", "4", "INT", "WIS"],
    ["Agricultural Skills", "Vegetable Crops", "2", "CON", "WIS"],
    ["Agricultural Skills", "Vegetable Crops (LotRS)", "3", "CON", "WIS"],
    ["Agricultural Skills", "Viniculture", "3", "INT", "WIS"]

I am able to do this by manually specifying the IID of the parent

for line in AgSkills:
    skill = str(line[1])
    df = str(line[2])
    primatt = str(line[3])
    secatt = str(line[4])
    my_skill.insert(parent='groupskill1', index='end', iid=countskill, text="Child", values=(skill, df, primatt, secatt))

but I am having to create a separate loop for each header

What I would like to do is do a lookup of the parents and get the IID and names from each and use them as variables in my code,which would allow me have only one loop

I have up to now manually created loops


问:
How to check java heap usage in docker image tomcat:9-jre11
I'm using the tomcat:9-jre11 docker image from the Eclipse Temurin project. I don't know how to get Java heap usage. I don't know how to get the memory usage statistics, none of the usual commands is included. The java/bin directory just includes the following binaries:</p>
```<code>root@bb8b42b64a09:/usr/local/tomcat# cd /opt/java/openjdk/bin/
root@bb8b42b64a09:/opt/java/openjdk/bin# ls
jaotc  java  jfr  jjs  jrunscript  keytool  pack200  rmid  rmiregistry  unpack200
root@bb8b42b64a09:/opt/java/openjdk/bin#
</code>```

Body:
I'm using the tomcat:9-jre11 docker image from the Eclipse Temurin project. I don't know how to get Java heap usage. I don't know how to get the memory usage statistics, none of the usual commands is included. The java/bin directory just includes the following binaries:

root@bb8b42b64a09:/usr/local/tomcat# cd /opt/java/openjdk/bin/
root@bb8b42b64a09:/opt/java/openjdk/bin# ls
jaotc  java  jfr  jjs  jrunscript  keytool  pack200  rmid  rmiregistry  unpack200
root@bb8b42b64a09:/opt/java/openjdk/bin#


问:
i have created Microsoft login (msal) with login redirect its working on my local host but not working on any other server
I have created Microsoft login (msal) with login redirect its working on my localhost but not working any other server

`

```<code>import React from "react";
import { useMsal } from "@azure/msal-react";
import { loginRequest } from "../authConfig";
import DropdownButton from "react-bootstrap/DropdownButton";
import Dropdown from "react-bootstrap/esm/Dropdown";

export const SignInButton = () => {
  const { instance } = useMsal();

  const handleLogin = (loginType) => {
   if (loginType === "redirect") {
      instance.loginRedirect(loginRequest).catch((e) => {
        console.log(e);
      });
    }
  };
  return (

    <DropdownButton
    >
      <Dropdown.Item as="button" onClick={() => handleLogin("redirect")}>
        Sign In
      </Dropdown.Item>
    </DropdownButton>
  );
};

</code>```

`

Body:
I have created Microsoft login (msal) with login redirect its working on my localhost but not working any other server

`

import React from "react";
import { useMsal } from "@azure/msal-react";
import { loginRequest } from "../authConfig";
import DropdownButton from "react-bootstrap/DropdownButton";
import Dropdown from "react-bootstrap/esm/Dropdown";

export const SignInButton = () => {
  const { instance } = useMsal();

  const handleLogin = (loginType) => {
   if (loginType === "redirect") {
      instance.loginRedirect(loginRequest).catch((e) => {
        console.log(e);
      });
    }
  };
  return (

    <DropdownButton
    >
      <Dropdown.Item as="button" onClick={() => handleLogin("redirect")}>
        Sign In
      </Dropdown.Item>
    </DropdownButton>
  );
};

`


问:
exporting bash killring a la clipboard manager
I'm trying to find a way to access bash's killring externally. I'm stuck with 1) no way to recursively use readline's yank and 2) lacking better knowledge of how to follow the kill ring pointer in heap memory. But, I suspect if there is a solution, it's not using either method I've tried.

My first kludge is to create a bash macro that pushes the killring into a file: store the point, paste, put old point up to new point into a file, and finally undo the paste

```<code>bash_setprevpoint() { READLINE_POINT_PREV=$READLINE_POINT; }
bash_copyfromprevpoint() { echo ${READLINE_LINE:$READLINE_POINT_PREV:$(($READLINE_POINT-$READLINE_POINT_PREV))} > /tmp/bash_killring.txt; }
bind -x '"\C-\xfe":"bash_setprevpoint"'; bind -x '"\C-\xff":"bash_copyfromprevpoint"'
bind '"\e_":"\C-\xfe\C-y\C-\xff\C-x\C-u"'

</code>```

But I have no idea how to recursively call e.g. M-y until the killring repeats. I only get the most recent kill. And the keybinding has to be used before it is needed.

My other thought is to look directly into the strings of the bash heap with a script like:

```<code>read heap_beg heap_end <<< $(perl -lne 'print "0x$1 0x$2" if m/^([^-]+)-([^ ]+) .*heap/'  /proc/$PPID/maps)
sudo dd if=/proc/$PPID/mem bs=1 skip=$(($heap_beg)) count=$(($heap_end-$heap_beg)) |strings -n6|uniq |fzf
</code>```

but there are a lot more strings than just the killring and it's slow/parsing a lot of data.

The want for external kill ring access is most salient when I'm working in shell and realize the next command should be run in tmux. But when entering, I loose the killring I've previously built up -- which stored the command I typed and then yanked to run tmux instead. That and some useful files that were a pain to tab complete. But there are many times that something like a universal sink for all the kill rings (like a clipboard manager) would be useful.

similar to Integrate readline's kill-ring and the X11 clipboard

Body:
I'm trying to find a way to access bash's killring externally. I'm stuck with 1) no way to recursively use readline's yank and 2) lacking better knowledge of how to follow the kill ring pointer in heap memory. But, I suspect if there is a solution, it's not using either method I've tried.

My first kludge is to create a bash macro that pushes the killring into a file: store the point, paste, put old point up to new point into a file, and finally undo the paste

bash_setprevpoint() { READLINE_POINT_PREV=$READLINE_POINT; }
bash_copyfromprevpoint() { echo ${READLINE_LINE:$READLINE_POINT_PREV:$(($READLINE_POINT-$READLINE_POINT_PREV))} > /tmp/bash_killring.txt; }
bind -x '"\C-\xfe":"bash_setprevpoint"'; bind -x '"\C-\xff":"bash_copyfromprevpoint"'
bind '"\e_":"\C-\xfe\C-y\C-\xff\C-x\C-u"'

But I have no idea how to recursively call e.g. M-y until the killring repeats. I only get the most recent kill. And the keybinding has to be used before it is needed.

My other thought is to look directly into the strings of the bash heap with a script like:

read heap_beg heap_end <<< $(perl -lne 'print "0x$1 0x$2" if m/^([^-]+)-([^ ]+) .*heap/'  /proc/$PPID/maps)
sudo dd if=/proc/$PPID/mem bs=1 skip=$(($heap_beg)) count=$(($heap_end-$heap_beg)) |strings -n6|uniq |fzf

but there are a lot more strings than just the killring and it's slow/parsing a lot of data.

The want for external kill ring access is most salient when I'm working in shell and realize the next command should be run in tmux. But when entering, I loose the killring I've previously built up -- which stored the command I typed and then yanked to run tmux instead. That and some useful files that were a pain to tab complete. But there are many times that something like a universal sink for all the kill rings (like a clipboard manager) would be useful.

similar to Integrate readline's kill-ring and the X11 clipboard


问:
Importing face_recognition python library gives 132 error running on arm processor
Python version: 3.10
Using Pycharm CE conda environment
M1 Mac

I am trying to run a facial recognition python program, but upon running, I get this error:

```<code>Process finished with exit code 132 (interrupted by signal 4: SIGILL)
</code>```

I isolated the line where this occurs:

```<code>import face_recognition
</code>```

A bit of research reveals that some people have had the same error code trying to import tensorflow on m1 devices, but the solution that seemed to work (if I am interpreting it right) involved installing a special version of tensorflow, however to my knowledge something like this doesn't exist for face_recognition

Why does loading tensorflow on Mac lead to "Process finished with exit code 132 (interrupted by signal 4: SIGILL)"?

Body:
Python version: 3.10
Using Pycharm CE conda environment
M1 Mac

I am trying to run a facial recognition python program, but upon running, I get this error:

Process finished with exit code 132 (interrupted by signal 4: SIGILL)

I isolated the line where this occurs:

import face_recognition

A bit of research reveals that some people have had the same error code trying to import tensorflow on m1 devices, but the solution that seemed to work (if I am interpreting it right) involved installing a special version of tensorflow, however to my knowledge something like this doesn't exist for face_recognition

Why does loading tensorflow on Mac lead to "Process finished with exit code 132 (interrupted by signal 4: SIGILL)"?


问:
Entity Framework Duplicating records in many-to-many relationship
Entity Framework Duplicating records in many-to-many relationship, when I insert a record in the relationship table, the foreign key is duplicated in its proper table.

I have 2 tables that are related, project and developer, and I have a third table that makes the many-to-many relationship, allocation, follow your class

```<code>[Table("tbl_allocation")]
    public class Allocation
    {
        public Int64 Id { get; set; }
        public DateTime Start { get; set; }
        public DateTime Termination { get; set; }
        public Byte HoursWeekly { get; set; }
        public Decimal Remuneration { get; set; }
        [Required]
        public Developer Developer { get; set; }
        [Required]
        public Project Project { get; set; }
        public List<Tasks> Tasks { get; set; }

        public Allocation()
        {

        }

        public Allocation (DateTime start, DateTime termination, byte hoursWeekly, decimal remuneration, Developer developer, Project project)
        {
            Start = start;
            Termination = termination;
            HoursWeekly = hoursWeekly;
            Remuneration = remuneration;
            Developer = developer;
            Project = project;
        }
    }
</code>```

I also have an Allocation Repository, where I have the following save method

```<code>public static void Save(Allocation allocation)
        {
            try
            {
                using (Repository dbContext = new Repository())
                {
                    if (allocation.Id == 0)
                    {
                        dbContext.Allocations.Add(allocation);
                    }
                    else
                    {
                        dbContext.Entry(allocation).State = EntityState.Modified;
                    }

                    dbContext.SaveChanges();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
</code>```

In an event I try to add an allocation, and when I add it, the used developer and project records are duplicated, this is the event code

```<code>private void btnRegister_Click(object sender, EventArgs e)
        {

            Allocation allocation = new Allocation(dtpStart.Value.Date, dtpTermination.Value.Date, Convert.ToByte(nmrHours.Value), Convert.ToDecimal(txtRemuneration.Text), (Developer) lstDevelopers.SelectedItem, (Project) lstProjects.SelectedItem);

            AllocationRepository.Save(allocation);

            Console.WriteLine(DeveloperRepository.FindByPartialName(txtDeveloper.Text)[lstDevelopers.SelectedIndex]);
        }
</code>```

My question is why is it duplicating, and how can I solve it...

I tried to send the values directly from the database, but without success

```<code>Allocation allocation = new Allocation(dtpStart.Value.Date, dtpTermination.Value.Date, Convert.ToByte(nmrHours.Value), Convert.ToDecimal(txtRemuneration.Text), DeveloperRepository.FindByPartialName(txtDeveloper.Text)[lstDevelopers.SelectedIndex], ProjectRepository.FindByPartialName(txtProject.Text)[lstProjects.SelectedIndex]);
</code>```

Body:
Entity Framework Duplicating records in many-to-many relationship, when I insert a record in the relationship table, the foreign key is duplicated in its proper table.

I have 2 tables that are related, project and developer, and I have a third table that makes the many-to-many relationship, allocation, follow your class

[Table("tbl_allocation")]
    public class Allocation
    {
        public Int64 Id { get; set; }
        public DateTime Start { get; set; }
        public DateTime Termination { get; set; }
        public Byte HoursWeekly { get; set; }
        public Decimal Remuneration { get; set; }
        [Required]
        public Developer Developer { get; set; }
        [Required]
        public Project Project { get; set; }
        public List<Tasks> Tasks { get; set; }

        public Allocation()
        {

        }

        public Allocation (DateTime start, DateTime termination, byte hoursWeekly, decimal remuneration, Developer developer, Project project)
        {
            Start = start;
            Termination = termination;
            HoursWeekly = hoursWeekly;
            Remuneration = remuneration;
            Developer = developer;
            Project = project;
        }
    }

I also have an Allocation Repository, where I have the following save method

public static void Save(Allocation allocation)
        {
            try
            {
                using (Repository dbContext = new Repository())
                {
                    if (allocation.Id == 0)
                    {
                        dbContext.Allocations.Add(allocation);
                    }
                    else
                    {
                        dbContext.Entry(allocation).State = EntityState.Modified;
                    }

                    dbContext.SaveChanges();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }

In an event I try to add an allocation, and when I add it, the used developer and project records are duplicated, this is the event code

private void btnRegister_Click(object sender, EventArgs e)
        {

            Allocation allocation = new Allocation(dtpStart.Value.Date, dtpTermination.Value.Date, Convert.ToByte(nmrHours.Value), Convert.ToDecimal(txtRemuneration.Text), (Developer) lstDevelopers.SelectedItem, (Project) lstProjects.SelectedItem);

            AllocationRepository.Save(allocation);

            Console.WriteLine(DeveloperRepository.FindByPartialName(txtDeveloper.Text)[lstDevelopers.SelectedIndex]);
        }

My question is why is it duplicating, and how can I solve it...

I tried to send the values directly from the database, but without success

Allocation allocation = new Allocation(dtpStart.Value.Date, dtpTermination.Value.Date, Convert.ToByte(nmrHours.Value), Convert.ToDecimal(txtRemuneration.Text), DeveloperRepository.FindByPartialName(txtDeveloper.Text)[lstDevelopers.SelectedIndex], ProjectRepository.FindByPartialName(txtProject.Text)[lstProjects.SelectedIndex]);


问:
Spring @Async and CompletableFuture for achieving multithreading in java
Do really we can achieve multithreading and increase the performance as comparable to multithreading provided by tomcat server?

Code snippet with @Async and CompletableFuture

Controller --

```<code>@Async("asyncExecutor")
@GetMapping("/somePath")
public CompletableFuture<...> someName( @RequestParam("someParam") String someParam) {
// code snippet
....
return CompletableFuture.completedFuture(ResponseEntity.ok.body(response));

} catch (Exception e) {
 // code snippet
...
return CompletableFuture.completedFuture(ResponseEntity.status(400).body(response));
}
</code>```

Service --

```<code>@Override
public String someName(String someParam) {
// code snippet including DB calls (repository class calls)
}
</code>```

So, will the above method really improve the performance as comparable to tomcat multithreading?

I checked with some 20-50 concurrent reqs using JMeter and I am getting better response time in tomcat multithreading as comparable to the above code which is using @Async and CompletableFuture.

Or

My implementation is wrong?

Body:
Do really we can achieve multithreading and increase the performance as comparable to multithreading provided by tomcat server?

Code snippet with @Async and CompletableFuture

Controller --

@Async("asyncExecutor")
@GetMapping("/somePath")
public CompletableFuture<...> someName( @RequestParam("someParam") String someParam) {
// code snippet
....
return CompletableFuture.completedFuture(ResponseEntity.ok.body(response));

} catch (Exception e) {
 // code snippet
...
return CompletableFuture.completedFuture(ResponseEntity.status(400).body(response));
}

Service --

@Override
public String someName(String someParam) {
// code snippet including DB calls (repository class calls)
}

So, will the above method really improve the performance as comparable to tomcat multithreading?

I checked with some 20-50 concurrent reqs using JMeter and I am getting better response time in tomcat multithreading as comparable to the above code which is using @Async and CompletableFuture.

Or

My implementation is wrong?


问:
An error has occurred. See error log for more details. org/eclipse/jface/databinding/swt/WidgetProperties
I tried creating a new FXML file in my Javafx project but this error pops up. I use eclipse IDE 2022-12, But it works fine on a different PC with Eclipse IDE 2022-06.

Is it an issue with the update and are there any patches that can help resolve this issue?
Below is the error log;

!ENTRY org.eclipse.jface 4 2 2022-12-28 18:52:06.915
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.NoClassDefFoundError: org/eclipse/jface/databinding/swt/WidgetProperties
at org.eclipse.fx.ide.ui.wizards.AbstractJDTElementPage.createControl(AbstractJDTElementPage.java:109)
at org.eclipse.jface.wizard.Wizard.createPageControls(Wizard.java:178)
at org.eclipse.jface.wizard.WizardDialog.createPageControls(WizardDialog.java:744)
at org.eclipse.jface.wizard.WizardDialog.setWizard(WizardDialog.java:1182)
at org.eclipse.jface.wizard.WizardDialog.updateForPage(WizardDialog.java:1235)
at org.eclipse.jface.wizard.WizardDialog.lambda$3(WizardDialog.java:1223)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
at org.eclipse.jface.wizard.WizardDialog.showPage(WizardDialog.java:1223)
at org.eclipse.ui.internal.dialogs.NewWizardSelectionPage.advanceToNextPageOrFinish(NewWizardSelectionPage.java:73)
at org.eclipse.ui.internal.dialogs.NewWizardNewPage.lambda$0(NewWizardNewPage.java:342)
at org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:780)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:777)
at org.eclipse.jface.viewers.AbstractTreeViewer.handleDoubleSelect(AbstractTreeViewer.java:1542)
at org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected(StructuredViewer.java:1211)
at org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent(OpenStrategy.java:272)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:329)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4256)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4054)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3642)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:823)
at org.eclipse.jface.window.Window.open(Window.java:799)
at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:263)
at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:283)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:283)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:317)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:251)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:485)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:389)
at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:142)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:580)
at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:414)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4256)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4054)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3642)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jface.databinding.swt.WidgetProperties cannot be found by org.eclipse.fx.ide.ui_3.8.0.202204150904
at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:541)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:536)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:416)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 68 more


问:
React Bootstrap Dropdown Menu not functioning correctly
I'm having an issue with a basic dropdown menu and I can't figure out why it's not functioning.

Here's the code

```<code>```

import Container from 'react-bootstrap/Container';
import Nav from 'react-bootstrap/Nav';
import Navbar from 'react-bootstrap/Navbar';
import NavDropdown from 'react-bootstrap/NavDropdown';

function DropdownMenu() {

  return (
    <Navbar variant="dark" bg="dark" expand="lg">
      <Container fluid>
      <Navbar.Toggle aria-controls="dropdown-menu" />
      <Navbar.Collapse id="dropdown-menu">

            <NavDropdown title= "Menu" id="dropdown-menu"
            activeClassName="bg-black hover:bg-gray-900 text-gray-400 transition"
              className="bg-black hover:bg-gray-900 text-gray-400 text-lg py-3 px-6 lg:py-4 lg:px-8 cursor-pointer rounded-t-md font-medium transition items-center">
                              <NavDropdown.Divider />

              <NavDropdown.Item href="/"                                                         className="bg-black hover:bg-gray-900 text-gray-400 text-lg cursor-pointer rounded-t-md font-medium transition items-center">
Home

              </NavDropdown.Item>
            </NavDropdown>

        </Navbar.Collapse>
      </Container>
    </Navbar>
  );
}

export default DropdownMenu;

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

I've attached a photo of what it's doing. It's dropping down the link, but expanding the navbar as it drops down, it's not becoming an actual dropdown menu, it's just adding more lines into the navbar.

I also call it within the header on the page, here's the code for the header:

```<code>```

import React, { Component, useEffect, useState } from 'react';
import styled from 'styled-components'
import { observer, inject } from 'mobx-react'
import { computed,  } from 'mobx'
import { NavLink } from 'react-router-dom'
import { SwitchHorizontalIcon, ScaleIcon, DatabaseIcon, UserCircleIcon,
} from '@heroicons/react/outline'
import { IconDashboard, IconDatabase } from './Icons'
import { useLocation, } from 'react-router-dom'
import Body from './Components/Body'
import { withRouter } from "react-router-dom";
import DropdownMenu from './Components/DropwdownMenu';

function HeaderExpand(props) {
//notes: the HeaderExpand component is a functional component that returns a React element
//notes: props is an object that contains the properties of the component

    const location = useLocation();

    return <SuperHeader
            >{props.children}
    </SuperHeader>
}

@inject('store')
//notes: the inject decorator is used to inject the store into the component
@observer
//notes: the observer decorator is used to make the component reactive
class SidebarCompontent extends Component {
//notes: the SidebarCompontent component is a class component that extends the Component class
//notes: this is useful because it allows us to use the Component class to create a component

    constructor(props) {

        super(props);

        if(this.props.location.pathname === "/signup"){
            this.props.history.push('/')
        }

        if(this.props.location.pathname === "/login"){
            this.props.history.push('/')
        }

    }

    @computed get fromColor(){
        if(this.props.store.profile.credits <= 0){
        //notes: this is a conditional statement that checks if the value of the credits property of the profile property of the store is less than or equal to 0
            return "bg-red-200 text-red-600"
        }
        if(this.props.store.profile.status === "trialing"){
            return ""
        }
        if(this.props.store.profile.status === "active"){
            return ""
        }
        if(this.props.store.profile.status === "incomplete"){
            return ""
        }
        return "bg-red-200 text-red-600"
    }

    render() {
        return (
            <>
                            <Textarea readOnly name="copy-textarea" id="copy-textarea" value={this.props.store.copyToClipboardText}  />

                                                        < DropdownMenu>

                                                        </DropdownMenu>

                                {this.props.children}
                        </>
            )
        }

}

const Input = styled.input` `
const Textarea = styled.textarea`
    position: fixed;
    right:-9990px;
    top:-9990px;
`

// transition:ease-in-out 0.5s margin-top;
//  transition-delay:0.05s;

const SuperHeader = styled.div`
    height:150px;
    background:black;
    display:${props => props.hidden ? "hidden" : "flex" };
    background-image:url(${require('./Logo.svg').default});
    background-size:auto 50%;
    background-position: 20px 20px;
    background-repeat:no-repeat;
    position:relative;
`

export default withRouter(SidebarCompontent)

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

Any help would be amazing!

I'm trying to get it to drop down like an actual navbar and nothing seems to be working.

Body:
I'm having an issue with a basic dropdown menu and I can't figure out why it's not functioning.

Here's the code

import Container from 'react-bootstrap/Container';
import Nav from 'react-bootstrap/Nav';
import Navbar from 'react-bootstrap/Navbar';
import NavDropdown from 'react-bootstrap/NavDropdown';

function DropdownMenu() {

  return (
    <Navbar variant="dark" bg="dark" expand="lg">
      <Container fluid>
      <Navbar.Toggle aria-controls="dropdown-menu" />
      <Navbar.Collapse id="dropdown-menu">

            <NavDropdown title= "Menu" id="dropdown-menu"
            activeClassName="bg-black hover:bg-gray-900 text-gray-400 transition"
              className="bg-black hover:bg-gray-900 text-gray-400 text-lg py-3 px-6 lg:py-4 lg:px-8 cursor-pointer rounded-t-md font-medium transition items-center">
                              <NavDropdown.Divider />

              <NavDropdown.Item href="/"                                                         className="bg-black hover:bg-gray-900 text-gray-400 text-lg cursor-pointer rounded-t-md font-medium transition items-center">
Home

              </NavDropdown.Item>
            </NavDropdown>

        </Navbar.Collapse>
      </Container>
    </Navbar>
  );
}

export default DropdownMenu;

I've attached a photo of what it's doing. It's dropping down the link, but expanding the navbar as it drops down, it's not becoming an actual dropdown menu, it's just adding more lines into the navbar.

I also call it within the header on the page, here's the code for the header:

import React, { Component, useEffect, useState } from 'react';
import styled from 'styled-components'
import { observer, inject } from 'mobx-react'
import { computed,  } from 'mobx'
import { NavLink } from 'react-router-dom'
import { SwitchHorizontalIcon, ScaleIcon, DatabaseIcon, UserCircleIcon,
} from '@heroicons/react/outline'
import { IconDashboard, IconDatabase } from './Icons'
import { useLocation, } from 'react-router-dom'
import Body from './Components/Body'
import { withRouter } from "react-router-dom";
import DropdownMenu from './Components/DropwdownMenu';

function HeaderExpand(props) {
//notes: the HeaderExpand component is a functional component that returns a React element
//notes: props is an object that contains the properties of the component

    const location = useLocation();

    return <SuperHeader
            >{props.children}
    </SuperHeader>
}

@inject('store')
//notes: the inject decorator is used to inject the store into the component
@observer
//notes: the observer decorator is used to make the component reactive
class SidebarCompontent extends Component {
//notes: the SidebarCompontent component is a class component that extends the Component class
//notes: this is useful because it allows us to use the Component class to create a component

    constructor(props) {

        super(props);

        if(this.props.location.pathname === "/signup"){
            this.props.history.push('/')
        }

        if(this.props.location.pathname === "/login"){
            this.props.history.push('/')
        }

    }

    @computed get fromColor(){
        if(this.props.store.profile.credits <= 0){
        //notes: this is a conditional statement that checks if the value of the credits property of the profile property of the store is less than or equal to 0
            return "bg-red-200 text-red-600"
        }
        if(this.props.store.profile.status === "trialing"){
            return ""
        }
        if(this.props.store.profile.status === "active"){
            return ""
        }
        if(this.props.store.profile.status === "incomplete"){
            return ""
        }
        return "bg-red-200 text-red-600"
    }

    render() {
        return (
            <>
                            <Textarea readOnly name="copy-textarea" id="copy-textarea" value={this.props.store.copyToClipboardText}  />

                                                        < DropdownMenu>

                                                        </DropdownMenu>

                                {this.props.children}
                        </>
            )
        }

}

const Input = styled.input` `
const Textarea = styled.textarea`
    position: fixed;
    right:-9990px;
    top:-9990px;
`

// transition:ease-in-out 0.5s margin-top;
//  transition-delay:0.05s;

const SuperHeader = styled.div`
    height:150px;
    background:black;
    display:${props => props.hidden ? "hidden" : "flex" };
    background-image:url(${require('./Logo.svg').default});
    background-size:auto 50%;
    background-position: 20px 20px;
    background-repeat:no-repeat;
    position:relative;
`

export default withRouter(SidebarCompontent)

Any help would be amazing!

I'm trying to get it to drop down like an actual navbar and nothing seems to be working.