User-name case sensitivity in MySQL grant statement

My impression is that MySQL is generally not case-sensitive, especially in MS Windows. In MySQL 8.0.34, I ran the following statements and got an error for the last statement. The error message is "Error Code: 1141. There is no such grant defined for user ‘USER1’ on host ‘%’". Once I change "USER1" to "user1", it… Read More User-name case sensitivity in MySQL grant statement

Pandas: How to self-join cross-functionally

I have this dataframe below for airline flights: df = pd.DataFrame({ ‘ORIGIN_x’:["LGA","ORD"], ‘DESTINATION_x’:["ORD","LGA"], ‘number_of_flights_x’:[3576,3580], ‘ORIGIN_y’:["ORD","LGA"], ‘DESTINATION_y’:["LGA","ORD"], ‘number_of_flights_y’:[3580,3576] }) I am trying to get below output: df_final = pd.DataFrame({ ‘ORIGIN_x’:["LGA"], ‘DESTINATION_x’:["ORD"], ‘ORIGIN_y’:["ORD"], ‘DESTINATION_y’:["LGA"], ‘number_of_flights’:[7156], #sum of 3576+3580 }) So two sample rows should match and I should see only one row because ORIGIN_x=DESTINATION_y & ORIGIN_y=DESTINATION_x. And… Read More Pandas: How to self-join cross-functionally

Use of conditional boolean in React hook

Following is the doc I am using to learn React Custom Hooks. Doc Link – https://react.dev/learn/reusing-logic-with-custom-hooks#when-to-use-custom-hooks In that page, there is a piece of code – function useData(url) { const [data, setData] = useState(null); useEffect(() => { if (url) { let ignore = false; fetch(url) .then(response => response.json()) .then(json => { if (!ignore) { setData(json);… Read More Use of conditional boolean in React hook

Conditional style inside an element

How do I do a conditional style based on a MODEL value. Such as below, I want the column either Green or Orange based on a value from the Model <div class="col-6" @Model.QuestionAnswers[i].answers[j].answerSelected == true ? style="background-color:green" : style="background-color:darkorange"> >Solution : Like this: <div class="col-6" style="@(Model.QuestionAnswers[i].answers[j].answerSelected == true ? "background-color: green;" : "background-color: darkorange;")"> But… Read More Conditional style inside an element

Accessing nested array within a object

I am stuck trying to get to the array within this object. It is showing them as [Object object] every time I try to print a value from the nested array. This is the object: {"current":true, "values_remaining":443, "color":"blue", "type":"1", "time":20444, "category":"story", "id":"kflaghe", "score":1270, "arr":[ {"num":293,"person":"pera","val":"K3344"}, {"num":407,"person":"perb","val":"B5637"}, {"num":256,"person":"perc","val":"J4526"} ] } I was accessing the keys and… Read More Accessing nested array within a object

Shell – making directories – Shell script has different outcome then Shell

I am trying to make a shell script that makes directories numbered from 01-13. I use command mkdir -p test/file{01..13} when I run command via shell script it names directories as 1,2,..,13 but when I use the command in shell itself, it names it correctly as 01,02,..,13. (see image below) Is there a way to… Read More Shell – making directories – Shell script has different outcome then Shell