问:
how to disable ScrollView clipping content in SwiftUI
I need that red rectangle should be visible until reach to the leading or trailing edge of the device.
So the problem is scrollview cliping red boxes (hiding) as move beyond the scrollview container size.
code:

```<code>struct test: View {
var body: some View {
    ScrollView(.horizontal,showsIndicators:false) {
        LazyHStack{
            ForEach(0...4,id:\.self){i in
                Rectangle()
                    .fill(Color.red)
                    .frame(width: 60, height: 50, alignment: .center)
            }
        }.padding(.horizontal, 4)
    }.background(Color.yellow)
    .frame(width: 68, height: 60, alignment: .trailing)
}
</code>```

}

Results:

Expected:(I also produce this result by setting ScrollView full width  and adding padding (.padding(.horizontal, UIScreen.main.bounds.width/2 )) to LazyHStack)
But it is a hack by adding space at start and end, and problem remain unresolved, that is clipping of ScrollView content

答:
if I understand correct from your answers, this is the result you want:

```<code>    struct test: View {
    var body: some View {
         GeometryReader { geo in
             VStack {
                 Spacer()
                 HStack {
                     ScrollView(.horizontal,showsIndicators:false) {
                        LazyHStack{
                            ForEach(0...4,id:\.self){i in
                                Rectangle()
                                    .fill(Color.red)
                                    .frame(width: 60, height: 50, alignment: .center)
                            }
                        }
                        .padding(.horizontal,40)
                    }
                    .background(Color.yellow)
                    .frame(width: geo.size.width, height: 60, alignment: .center)
                 }
                 Spacer()
             }
        }
    }
}
</code>```

Result:

Body:
I need that red rectangle should be visible until reach to the leading or trailing edge of the device.
So the problem is scrollview cliping red boxes (hiding) as move beyond the scrollview container size.
code:

struct test: View {
var body: some View {
    ScrollView(.horizontal,showsIndicators:false) {
        LazyHStack{
            ForEach(0...4,id:\.self){i in
                Rectangle()
                    .fill(Color.red)
                    .frame(width: 60, height: 50, alignment: .center)
            }
        }.padding(.horizontal, 4)
    }.background(Color.yellow)
    .frame(width: 68, height: 60, alignment: .trailing)
}

}

Results:

Expected:(I also produce this result by setting ScrollView full width  and adding padding (.padding(.horizontal, UIScreen.main.bounds.width/2 )) to LazyHStack)
But it is a hack by adding space at start and end, and problem remain unresolved, that is clipping of ScrollView content

Body:
if I understand correct from your answers, this is the result you want:

    struct test: View {
    var body: some View {
         GeometryReader { geo in
             VStack {
                 Spacer()
                 HStack {
                     ScrollView(.horizontal,showsIndicators:false) {
                        LazyHStack{
                            ForEach(0...4,id:\.self){i in
                                Rectangle()
                                    .fill(Color.red)
                                    .frame(width: 60, height: 50, alignment: .center)
                            }
                        }
                        .padding(.horizontal,40)
                    }
                    .background(Color.yellow)
                    .frame(width: geo.size.width, height: 60, alignment: .center)
                 }
                 Spacer()
             }
        }
    }
}

Result:


来源: stackexchange

问:
Not able to align divs' inside a parent div in react
Here is the picture. I want to align the div's (with blue border) from top. I just want the CSS code for this. I tried to use margin but its not working. Also when more content is inserted inside these div's they expand from bottom to top, seems like bottom for these div's  is fixed or something.

what I want is that the Inner div's (with blue border) should be top aligned not bottom aligned and when more text is added inside these div's it should expand from top top to bottom.

here is the CSS code. propertiesContainer class is the parent div with red border and properties class are the inner div's

```<code>propertiesContainer: {
  paddingTop: "26px",
  background: " #EAEAFA",
  border: "1px solid red",
  opacity: 1,
},
properties: {
  bottom: "100px",
  margin: "19px",
  width: "auto",
  border: "2px solid blue",
  height: "262px",
},
</code>```

Reactjs code for this

```<code><section className={classes.propertiesContainer}>
  <HorizontalScroll
    itemClass="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12"
    data={
      mobile_footer_data &&
      mobile_footer_data.map((data, index) => {
        const { header, body } = data;
        console.log("dataa", data);

        const text = body.map((item, index) => {
          return <div key={index}>{item}</div>;
        });

        return (
          <div key={index} className={classes.properties}>
            <CommonHeaderText
              text={<span>{header}</span>}
              variant="h1"
              style={{
                fontSize: "16px",
                fontWeight: "bold",
                fontFamily: "Open Sans",
                color: "##363636",
                height: "19px",
                marginBottom: "25px",
              }}
            />

            <div>{text}</div>
          </div>
        );
      })
    }
  />
</section>;
</code>```

答:
For inline element, The default value of vertical-align is baseline. So, they are text baseline aligned. Trying applying this to the child div:

```<code>vertical-align: top;
</code>```

        .outter {
            outline: 2px dashed #387779;
            padding: 10px;
        }

        .inner {
            width: 100px;
            height: 80px;
            display: inline-block;
            background-color: #a3af92;
            color: #26310a;
        }
        .vtop {
            vertical-align: top;
        }```
<pre class="snippet-code-html lang-html prettyprint-override"><code>    <div class="outter">
        <div class="inner">hello<br/>world<br/>abc</div>
        <div class="inner">abcd<br/>two</div>
        <div class="inner">123</div>
    </div>
    <br/>
    <div class="outter">
        <div class="inner vtop">hello<br/>world<br/>abc</div>
        <div class="inner vtop">abcd<br/>two</div>
        <div class="inner">123</div>
    </div></code>```

ContentLicense: CC BY-SA 4.0

Body:
Here is the picture. I want to align the div's (with blue border) from top. I just want the CSS code for this. I tried to use margin but its not working. Also when more content is inserted inside these div's they expand from bottom to top, seems like bottom for these div's  is fixed or something.

what I want is that the Inner div's (with blue border) should be top aligned not bottom aligned and when more text is added inside these div's it should expand from top top to bottom.

here is the CSS code. propertiesContainer class is the parent div with red border and properties class are the inner div's

propertiesContainer: {
  paddingTop: "26px",
  background: " #EAEAFA",
  border: "1px solid red",
  opacity: 1,
},
properties: {
  bottom: "100px",
  margin: "19px",
  width: "auto",
  border: "2px solid blue",
  height: "262px",
},

Reactjs code for this

  <HorizontalScroll
    itemClass="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12"
    data={
      mobile_footer_data &&
      mobile_footer_data.map((data, index) => {
        const { header, body } = data;
        console.log("dataa", data);

        const text = body.map((item, index) => {
          return
{item}
;
        });

        return (

            <CommonHeaderText
              text={{header}}
              variant="h1"
              style={{
                fontSize: "16px",
                fontWeight: "bold",
                fontFamily: "Open Sans",
                color: "##363636",
                height: "19px",
                marginBottom: "25px",
              }}
            />

{text}

        );
      })
    }
  />

;

Body:
For inline element, The default value of vertical-align is baseline. So, they are text baseline aligned. Trying applying this to the child div:

vertical-align: top;

        .outter {
            outline: 2px dashed #387779;
            padding: 10px;
        }

        .inner {
            width: 100px;
            height: 80px;
            display: inline-block;
            background-color: #a3af92;
            color: #26310a;
        }
        .vtop {
            vertical-align: top;
        }

    <div class="outter">
        <div class="inner">hello<br/>world<br/>abc</div>
        <div class="inner">abcd<br/>two</div>
        <div class="inner">123</div>
    </div>
    <br/>
    <div class="outter">
        <div class="inner vtop">hello<br/>world<br/>abc</div>
        <div class="inner vtop">abcd<br/>two</div>
        <div class="inner">123</div>
    </div>


问:
Logging in before items are set in localStorage - JS
I am trying to make an app with firebase but when I click log in, it does everything except setting the localStorage items. Tried awaiting and everything else I could think of</p>
```<code>signInWithEmailAndPassword(auth, email, password)
            .then(async (userCredential) => {
                const user = userCredential.user;
                localStorage.setItem("access_token", user.stsTokenManager.accessToken);
                localStorage.setItem("uid", user.uid);

                const devices = collection(db, "users", user.uid, "devices");
                const devicesSnap = await getDocs(devices);
                if(devicesSnap.docs.length >= 1) {
                    localStorage.setItem("first_charger", devicesSnap.docs[0].id);
                    localStorage.setItem("first_charger_name", devicesSnap.docs[0].data().deviceName + "/" + devicesSnap.docs[0].id);
                    const formattedChargers = formatChargers(devicesSnap.docs);
                    setChargers(formattedChargers);
                } else {
                    setChargers([]);
                }

                const cars = collection(db, "users", localStorage.getItem("uid"), "vehicles");
                const carsSnap = await getDocs(cars);
                if(carsSnap.docs.length >= 1) {
                    const formattedCars = formatCars(carsSnap.docs);
                    setCars(formattedCars);
                } else {
                    setCars([]);
                }

                setLoading(false);
                setLoggedIn(true);
            })
            .catch((error) => {
                console.log(error);
            });
</code>```

答:
I ended up adding an if statement that checks if it exists and if it doesn't it tries re-adding it</p>
```<code>if(!localStorage.getItem("first_charger_name")) {
    localStorage.setItem("first_charger_name", devicesSnap.docs[0].data().deviceName + "/" + devicesSnap.docs[0].id);
}
</code>```

Body:
I am trying to make an app with firebase but when I click log in, it does everything except setting the localStorage items. Tried awaiting and everything else I could think of

signInWithEmailAndPassword(auth, email, password)
            .then(async (userCredential) => {
                const user = userCredential.user;
                localStorage.setItem("access_token", user.stsTokenManager.accessToken);
                localStorage.setItem("uid", user.uid);

                const devices = collection(db, "users", user.uid, "devices");
                const devicesSnap = await getDocs(devices);
                if(devicesSnap.docs.length >= 1) {
                    localStorage.setItem("first_charger", devicesSnap.docs[0].id);
                    localStorage.setItem("first_charger_name", devicesSnap.docs[0].data().deviceName + "/" + devicesSnap.docs[0].id);
                    const formattedChargers = formatChargers(devicesSnap.docs);
                    setChargers(formattedChargers);
                } else {
                    setChargers([]);
                }

                const cars = collection(db, "users", localStorage.getItem("uid"), "vehicles");
                const carsSnap = await getDocs(cars);
                if(carsSnap.docs.length >= 1) {
                    const formattedCars = formatCars(carsSnap.docs);
                    setCars(formattedCars);
                } else {
                    setCars([]);
                }

                setLoading(false);
                setLoggedIn(true);
            })
            .catch((error) => {
                console.log(error);
            });

Body:
I ended up adding an if statement that checks if it exists and if it doesn't it tries re-adding it

if(!localStorage.getItem("first_charger_name")) {
    localStorage.setItem("first_charger_name", devicesSnap.docs[0].data().deviceName + "/" + devicesSnap.docs[0].id);
}


问:
Conditionally render a div with vue.js
I am trying to build a quiz which when the user chooses a selection and submits the answer the notification div displays whether choice is correct or not. I have got this logic working however what is happening is the div is disappearing each time the next question is answered. I want to keep the previous question result on the screen and lock the user out of answering the question again and show the correct answer.

Here is what I have so far:

```<code>                  <div
                    class="container"
                    v-for="options in quiz"
                    v-bind:key="options.quizId"
                  >
                    <h3>{{ options.question }}</h3>
                    <div
                      class="control"
                    >
                      <label class="radio">
                        <input
                          type="radio"
                          :value="options.op1"
                          v-model="selectedAnswer"
                        />
                        {{ options.op1 }}
                      </label>
                    </div>
                    <div class="control">
                      <label class="radio">
                        <input
                          type="radio"
                          :value="options.op2"
                          v-model="selectedAnswer"
                        />
                        {{ options.op2 }}
                      </label>
                    </div>
                    <div class="control">
                      <label class="radio">
                        <input
                          type="radio"
                          :value="options.op3"
                          v-model="selectedAnswer"
                        />
                        {{ options.op3 }}
                      </label>
                    </div>
                    <div class="control">
                      <label class="radio">
                        <input
                          type="radio"
                          :value="options.op4"
                          v-model="selectedAnswer"
                        />
                        {{ options.op4 }}
                      </label>
                    </div>
                    <div class="control mt-4" >
                      <button class="button is-link" @click="call(options.id)">
                        Submit
                      </button>
                    </div>
                    <br />
                    <template v-if="options.id === quizId">
                      <template v-if="quizResult == 'correct'">
                         <template v-if="correctAnswer">
                        <div class="notification is-success mt-4">
                          Correct. Well done!
                        </div>
                        </template>
                        <br />

                      </template>
                      <template v-if="quizResult == 'incorrect'">
                        <div class="notification is-danger mt-4">
                          Incorrect. Please try again.
                        </div>
                        <br />
                      </template>
                    </template>
                  </div>

                                </div>
                          </div>
                        </div> <br>
                      </section>
                         </div>
                        </div>

                  <!-- <hr /> -->
                </template>
</code>```
```<code><script>
import axios from "axios";
export default {
  data() {
    return {
      course: {},
      lessons: [],
      comments: [],
      activeLesson: null,
      errors: [],
      showModalFlag1: false,
      okPressed1: false,
      quiz: {},
      questionIndex: 0,
      loading: true,
      quizId: null,
      selectedAnswer: "",
      quizResult: null,
      correctAnswer: false,
      userScore: {
        username: '',
        lesson_id: '',
        lesson_score: '',
      },
      images: [
        {
          photo: "",
        },
      ],
      comment: {
        name: "",
        content: "",
      },
    };
  },
  methods: {

    call(id){
      this.submitQuiz(id);
      console.log('checkid@call',id)
    },
    submitQuiz(e) {
      console.log('check-id@submit', e)
      const quizArray = this.quiz;
      const choice = this.selectedAnswer;
      console.log('chosen: ', choice)

      const result = quizArray.filter( obj => obj.op1 === choice || obj.op2 === choice ||
                                      obj.op3 === choice || obj.op4 === choice)[0];
      console.log('result',result.id);

      for (const prop in result) {
          if ( result.hasOwnProperty(prop) ) {
            if (result.id == e) {
              this.quizId = result.id;
              if (choice == result.answer) {
                  this.quizResult = "correct";
                  this.correctAnswer = true;

              }
         if(choice !== result.answer){
            this.quizId = result.id;
            this.quizResult = "incorrect";
         }
          }
        }
    }

    },

</code>```

答:
You could have another div or in your notification div to display last answered question.
You can either have a new object that gets overwritten each time you answer correctly or track the index of your loop and use the value of index - 1 to get last answered question. Add a check if index !== 0.

To get index of your loop in html do: v-for="(options, ) in quiz

Title: Conditionally render a div with vue.js

Body:
I am trying to build a quiz which when the user chooses a selection and submits the answer the notification div displays whether choice is correct or not. I have got this logic working however what is happening is the div is disappearing each time the next question is answered. I want to keep the previous question result on the screen and lock the user out of answering the question again and show the correct answer.

Here is what I have so far:

{{ options.question }}

                        <input
                          type="radio"
                          :value="options.op1"
                          v-model="selectedAnswer"
                        />
                        {{ options.op1 }}

                        <input
                          type="radio"
                          :value="options.op2"
                          v-model="selectedAnswer"
                        />
                        {{ options.op2 }}

                        <input
                          type="radio"
                          :value="options.op3"
                          v-model="selectedAnswer"
                        />
                        {{ options.op3 }}

                        <input
                          type="radio"
                          :value="options.op4"
                          v-model="selectedAnswer"
                        />
                        {{ options.op4 }}

                      <button class="button is-link" @click="call(options.id)">
                        Submit
                      </button>

                    <template v-if="options.id === quizId">
                      <template v-if="quizResult == 'correct'">
                         <template v-if="correctAnswer">

                          Correct. Well done!

                        </template>

                      </template>
                      <template v-if="quizResult == 'incorrect'">

                          Incorrect. Please try again.

                      </template>
                    </template>

                </template>


问:
Calculate Time difference using powershell
I would like to calculate Time difference between two time stamps in seconds

```<code>$starttime = (Get-Date).ToString("yyyy-MM-ddThh:mm:ss")
$endtime = (Get-Date).ToString("yyyy-MM-ddThh:mm:ss")

$tdiff = $starttime-$endtime

Write-Output $tdiff.seconds
</code>```

The above code throws the below error:

```<code>Cannot convert value "2022-02-10T11:40:07" to type "System.Int32". Error: "Input string was not in a correct format."
</code>```

Appreciate, if any one can help

答:
You are converting the date to String in the code. You can't perform the substract operation on string values.

Try below:

```<code>$startdate = (Get-Date)
$Enddate = (Get-Date).AddDays(1)
$diff = New-TimeSpan -Start $startdate -End $Enddate
$diff.Days
</code>```

Body:
I would like to calculate Time difference between two time stamps in seconds

$starttime = (Get-Date).ToString("yyyy-MM-ddThh:mm:ss")
$endtime = (Get-Date).ToString("yyyy-MM-ddThh:mm:ss")

$tdiff = $starttime-$endtime

Write-Output $tdiff.seconds

The above code throws the below error:

Cannot convert value "2022-02-10T11:40:07" to type "System.Int32". Error: "Input string was not in a correct format."

Appreciate, if any one can help

Body:
You are converting the date to String in the code. You can't perform the substract operation on string values.

Try below:

$startdate = (Get-Date)
$Enddate = (Get-Date).AddDays(1)
$diff = New-TimeSpan -Start $startdate -End $Enddate
$diff.Days


问:
Swift and Firebase - Receiving image from the user then uploading it to firebase
I want the user to upload an image from the photos library along with more input so I can write it to my database.
I made an object with the received data from the user and I uploaded it (using ".child()") to firebase realtime database, but then I had to add the photo to the object so I used the UIImagePicker to upload the photo then I got stuck.
my problem is that i don't know what type of info I should get from the image so I can add it to the object.
I'm not sure if using an object is the right choice but since the data I’m adding is related to a specific item I thought it would be suitable.

// The object

```<code> let object: [String : Any] = ["areaname": areaName! as Any ,"spotNo": spotNo, "loactionLat": areaLat, "locationLong": areaLong]
    database.child("Areas").child("Area_\(Int.random(in: 0..<100))" ).setValue(object)

@IBAction func chooseImageButton() {
    print("Add image button was pressed")
    let vc = UIImagePickerController()
    vc.sourceType = .photoLibrary
    vc.delegate = self
    vc.allowsEditing = true
    present(vc, animated: true)

}

extension AddAreaViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediawithInfo info: [UIImagePickerController.InfoKey : Any]) {
    print("\(info)")
    if let image = info[UIImagePickerController.InfoKey(rawValue: "UIImagePickerControllerEditedImage")] as? UIImage {
    }

    picker.dismiss(animated: true, completion: nil) }

func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
    picker.dismiss(animated: true, completion: nil)
}
</code>```

}

Firebase structure

答:
I think @Evan Lu is correct.
You don't need to store the image on firebase database or realtime databse.
You can store the image on FirebaseStorage and save the url on database.</p>

Body:
I want the user to upload an image from the photos library along with more input so I can write it to my database.
I made an object with the received data from the user and I uploaded it (using ".child()") to firebase realtime database, but then I had to add the photo to the object so I used the UIImagePicker to upload the photo then I got stuck.
my problem is that i don't know what type of info I should get from the image so I can add it to the object.
I'm not sure if using an object is the right choice but since the data I’m adding is related to a specific item I thought it would be suitable.

// The object

 let object: [String : Any] = ["areaname": areaName! as Any ,"spotNo": spotNo, "loactionLat": areaLat, "locationLong": areaLong]
    database.child("Areas").child("Area_\(Int.random(in: 0..<100))" ).setValue(object)

@IBAction func chooseImageButton() {
    print("Add image button was pressed")
    let vc = UIImagePickerController()
    vc.sourceType = .photoLibrary
    vc.delegate = self
    vc.allowsEditing = true
    present(vc, animated: true)

}

extension AddAreaViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediawithInfo info: [UIImagePickerController.InfoKey : Any]) {
    print("\(info)")
    if let image = info[UIImagePickerController.InfoKey(rawValue: "UIImagePickerControllerEditedImage")] as? UIImage {
    }

    picker.dismiss(animated: true, completion: nil) }

func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
    picker.dismiss(animated: true, completion: nil)
}

}

Firebase structure


问:
Error : Module '"@angular/material"' has no exported member "..."
i create a custom Angular material module, material.module.ts file and import the following Angular material UI components in this file like given below.

```<code>import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import {
   MatButtonModule,
   MatToolbarModule,
   MatIconModule,
   MatBadgeModule,
   MatSidenavModule,
   MatListModule,
   MatGridListModule,
   MatFormFieldModule,
   MatInputModule,
   MatSelectModule,
   MatRadioModule,
   MatDatepickerModule,
   MatNativeDateModule,
   MatChipsModule,
   MatTooltipModule,
   MatTableModule,
   MatPaginatorModule
} from '@angular/material';

@NgModule({
   imports: [
      CommonModule,
      MatButtonModule,
      MatToolbarModule,
      MatIconModule,
      MatSidenavModule,
      MatBadgeModule,
      MatListModule,
      MatGridListModule,
      MatFormFieldModule,
      MatInputModule,
      MatSelectModule,
      MatRadioModule,
      MatDatepickerModule,
      MatNativeDateModule,
      MatChipsModule,
      MatTooltipModule,
      MatTableModule,
      MatPaginatorModule
   ],
   exports: [
      MatButtonModule,
      MatToolbarModule,
      MatIconModule,
      MatSidenavModule,
      MatBadgeModule,
      MatListModule,
      MatGridListModule,
      MatInputModule,
      MatFormFieldModule,
      MatSelectModule,
      MatRadioModule,
      MatDatepickerModule,
      MatChipsModule,
      MatTooltipModule,
      MatTableModule,
      MatPaginatorModule
   ],
   providers: [
      MatDatepickerModule,
   ]
})

export class AngularMaterialModule { }
</code>```

And import the AngularMaterialModule to app.module.ts file
but i have this error :

Module '"@angular/material"' has no exported member "...."

答:
I want to use a stepper from Angular Material. The same error as yours was displayed. I used the following code in app.module.js: import { MatStepperModule } from '@angular/material/stepper';. In my case, "/stepper" was missing.
And in imports [MatStepperModule].</p>

Body:
i create a custom Angular material module, material.module.ts file and import the following Angular material UI components in this file like given below.

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import {
   MatButtonModule,
   MatToolbarModule,
   MatIconModule,
   MatBadgeModule,
   MatSidenavModule,
   MatListModule,
   MatGridListModule,
   MatFormFieldModule,
   MatInputModule,
   MatSelectModule,
   MatRadioModule,
   MatDatepickerModule,
   MatNativeDateModule,
   MatChipsModule,
   MatTooltipModule,
   MatTableModule,
   MatPaginatorModule
} from '@angular/material';

@NgModule({
   imports: [
      CommonModule,
      MatButtonModule,
      MatToolbarModule,
      MatIconModule,
      MatSidenavModule,
      MatBadgeModule,
      MatListModule,
      MatGridListModule,
      MatFormFieldModule,
      MatInputModule,
      MatSelectModule,
      MatRadioModule,
      MatDatepickerModule,
      MatNativeDateModule,
      MatChipsModule,
      MatTooltipModule,
      MatTableModule,
      MatPaginatorModule
   ],
   exports: [
      MatButtonModule,
      MatToolbarModule,
      MatIconModule,
      MatSidenavModule,
      MatBadgeModule,
      MatListModule,
      MatGridListModule,
      MatInputModule,
      MatFormFieldModule,
      MatSelectModule,
      MatRadioModule,
      MatDatepickerModule,
      MatChipsModule,
      MatTooltipModule,
      MatTableModule,
      MatPaginatorModule
   ],
   providers: [
      MatDatepickerModule,
   ]
})

export class AngularMaterialModule { }

And import the AngularMaterialModule to app.module.ts file
but i have this error :

Module '"@angular/material"' has no exported member "...."


问:
Windbg: Is there any command to show me only the threads that belong to a certain library?
I know that exists command: ~*k which shows all threads and I know that exist command ~[id_thread]s which show the stack for id_thread. I want to see just threads that belong to a certain library loaded in windbg.</p>

答:
WinDbg's scripting capabilities are limited when it comes to dealing with strings and searching. You need to invoke a shell. Maybe the following is sufficient for you:

```<code>~*e ? @$tid; .shell -ci "k" findstr "kernel32"
</code>```

Therefore I suggest that you use the PyKd WinDbg extension. Note that you need a Python installation with the correct bitness and a pip install pykd for each bitness.

The quick and dirty way is to use dbgCommand() and parse the output. The better way is to use the API.

I'm not a PyKD expert, but something like this works for me:

```<code>import sys
print("Python version:", sys.version)
print("Script path: " + sys.argv[0])

from pykd import *
if len(sys.argv) < 2:
    print("Usage: findlib <library>")
    exit(1)

lib = sys.argv[1]
try:
    offset = expr(lib)
except DbgException:
    print(f"{lib} is not a valid module")
    exit()
print(f"Finding {lib} at {offset:08x}")

modules = getModulesList()
for module in modules:
    if module.begin() == offset:
        begin = module.begin()
        end = module.end()

threads = getProcessThreads()
for thread in threads:
    setCurrentThread(thread)
    # print(f"Examining thread {thread:08x}")
    frames = getStack()
    found = False
    for frame in frames:
        try:
            # unfortunately findSymbol() hangs for me if no symbols are available
            # otherwise it would have been a much cleaner approach
            # and no messing with the module list
            # dll, method, offset = frame.findSymbol()
            if begin <= frame.ip < end:
                found = True
        except SymbolException:
            pass
    if found:
       print(f"Found on thread with TEB {thread:08x}")
</code>```

Usage in WinDbg:

```<code>.load <path_to_ext>\pykd
!py <path_to_script>\findlib kernel32
</code>```

Body:
WinDbg's scripting capabilities are limited when it comes to dealing with strings and searching. You need to invoke a shell. Maybe the following is sufficient for you:

~*e ? @$tid; .shell -ci "k" findstr "kernel32"

Therefore I suggest that you use the PyKd WinDbg extension. Note that you need a Python installation with the correct bitness and a pip install pykd for each bitness.

The quick and dirty way is to use dbgCommand() and parse the output. The better way is to use the API.

I'm not a PyKD expert, but something like this works for me:

import sys
print("Python version:", sys.version)
print("Script path: " + sys.argv[0])

from pykd import *
if len(sys.argv) < 2:
    print("Usage: findlib <library>")
    exit(1)

lib = sys.argv[1]
try:
    offset = expr(lib)
except DbgException:
    print(f"{lib} is not a valid module")
    exit()
print(f"Finding {lib} at {offset:08x}")

modules = getModulesList()
for module in modules:
    if module.begin() == offset:
        begin = module.begin()
        end = module.end()

threads = getProcessThreads()
for thread in threads:
    setCurrentThread(thread)
    # print(f"Examining thread {thread:08x}")
    frames = getStack()
    found = False
    for frame in frames:
        try:
            # unfortunately findSymbol() hangs for me if no symbols are available
            # otherwise it would have been a much cleaner approach
            # and no messing with the module list
            # dll, method, offset = frame.findSymbol()
            if begin <= frame.ip < end:
                found = True
        except SymbolException:
            pass
    if found:
       print(f"Found on thread with TEB {thread:08x}")

Usage in WinDbg:

.load <path_to_ext>\pykd
!py <path_to_script>\findlib kernel32


问:
Does React Native works well on MacBook M1?
I have to buy MacBook Air with M1. As I see, it supports react native (npm, expo etc.). Yes?

Edited 11.02: ok, solved. Thank you all!

答: Works well just like the others mentioned. But you might encounter error where m1 chip is not supported in some cases. However, there are workarounds for them too. Such as pod install might fail, instead, you might need to run arch -x86_64 pod install etc.


问:
Input value didnt display
The code snippet below is form that embeded in the bootstrap modal to allow the user create a new subject for current system. In the form, I have included one text input to accept the data. In that text input, I have assign value = "incomplete" as the default value. However, the default value didnt show as expected when the webpage is running.

```<code><div class="modal-body">
                        <form id="adminAddExamForm" method="POST"
                            th:action="@{/process_AdminAddExam}" th:object="${exam}">
                            <div class="mb-2">
                                <label for="status" class="col-form-label">Status</label>
                                <input type="text" value="incomplete" class="form-control" id="status" th:field="*{status}" autocomplete="off" disabled>
                            </div>
                       </form>
</div>
</code>```

The below code snippet and screenshot is taken from chrome dev tools. Even though I have assign the value, but it still show nothing

```<code><div class="mb-2">
                                <label for="status" class="col-form-label">Status</label>
                                <input type="text" value="" class="form-control" id="status" name="status">
                            </div>
</code>```

答:
Problem solved.
I use the javascript to assign it the default value.</p>
```<code>document.getElementById("status").defaultValue = "Incomplete";
</code>```

Title: Input value didnt display

Body:
The code snippet below is form that embeded in the bootstrap modal to allow the user create a new subject for current system. In the form, I have included one text input to accept the data. In that text input, I have assign value = "incomplete" as the default value. However, the default value didnt show as expected when the webpage is running.

                        <form id="adminAddExamForm" method="POST"
                            th:action="@{/process_AdminAddExam}" th:object="${exam}">

                                Status
                                <input type="text" value="incomplete" class="form-control" id="status" th:field="*{status}" autocomplete="off" disabled>

                       </form>

The below code snippet and screenshot is taken from chrome dev tools. Even though I have assign the value, but it still show nothing

                                Status
                                <input type="text" value="" class="form-control" id="status" name="status">

Body:
Problem solved.
I use the javascript to assign it the default value.

document.getElementById("status").defaultValue = "Incomplete";


问:
SQL query with composite key over multiple tables
I'm trying to do a database regarding employees' skills. Here's my
Structure.

I'd like to make a query that shows, for each employee and skill, the actual and required level. The required level depends on the function each employee performs. I'm just starting with MS Access and I haven't found any similar example.

Thanks in advance.

答:
What you have is not a composite key but many to many relationships.  https://en.wikipedia.org/wiki/Many-to-many_(data_model).  in this case, the foreign keys in the Junction tables can be treated as a composite primary key, but that is not the case with all Junction tables.  For my working example I pulled function out of TblTrabajadores forming another Many to Many relationship but in this case a Trabajadore can hold the same cargo at different times so TrabajadoreID and CargoID are not guaranteed to be a unique pair and hence cannot be a composite primary key.

I've circled the junction tables forming the many to many relationships.  For the english speaking, this is a rather standard employee database. employees(Trabajadors), Positions(Cargos), Skills(competencias), employee skill(valor), skill required for the position(valor_esperado).
What follows is only a solution using Dlookup and calculated fields. I leave it to someone with better skills in sql theory and subqueries to come up with a full explanation for the query difficulty and a best approach.

I start with a simple query to get the first columns and the right query shape.

Then I add calculated fields for the remaining columns and use Dlookup to get the values based on the row values I have.

```<code>
FullName: [FirstName] & " " & [LastName]

CargoDescripcion: DLookUp("CargoDescripcion","qryCargoDescripcionsCompetencias","CompetenciaID= " & [TrabajadoresCompetencias].[CompetenciaID])

ValorEsperado: DLookUp("ValorEsperado","CargosCompetencias","competenciaID = " & [Competencies].[CompetenciaID])

'and qryCargoDescripcionsCompetencias which is a little query visually simplifies the DLookup for CargoDescripcion

qryCargoDescripcionsCompetencias: SELECT Cargos.CargoDescripcion, CargosCompetencias.CompetenciaID
FROM Cargos INNER JOIN CargosCompetencias ON Cargos.CargoID = CargosCompetencias.CargoID

</code>```

Body:
What you have is not a composite key but many to many relationships.  https://en.wikipedia.org/wiki/Many-to-many_(data_model).  in this case, the foreign keys in the Junction tables can be treated as a composite primary key, but that is not the case with all Junction tables.  For my working example I pulled function out of TblTrabajadores forming another Many to Many relationship but in this case a Trabajadore can hold the same cargo at different times so TrabajadoreID and CargoID are not guaranteed to be a unique pair and hence cannot be a composite primary key.

I've circled the junction tables forming the many to many relationships.  For the english speaking, this is a rather standard employee database. employees(Trabajadors), Positions(Cargos), Skills(competencias), employee skill(valor), skill required for the position(valor_esperado).
What follows is only a solution using Dlookup and calculated fields. I leave it to someone with better skills in sql theory and subqueries to come up with a full explanation for the query difficulty and a best approach.

I start with a simple query to get the first columns and the right query shape.

Then I add calculated fields for the remaining columns and use Dlookup to get the values based on the row values I have.

FullName: [FirstName] & " " & [LastName]

CargoDescripcion: DLookUp("CargoDescripcion","qryCargoDescripcionsCompetencias","CompetenciaID= " & [TrabajadoresCompetencias].[CompetenciaID])

ValorEsperado: DLookUp("ValorEsperado","CargosCompetencias","competenciaID = " & [Competencies].[CompetenciaID])

'and qryCargoDescripcionsCompetencias which is a little query visually simplifies the DLookup for CargoDescripcion

qryCargoDescripcionsCompetencias: SELECT Cargos.CargoDescripcion, CargosCompetencias.CompetenciaID
FROM Cargos INNER JOIN CargosCompetencias ON Cargos.CargoID = CargosCompetencias.CargoID


问:
Multiple loop in list comprehension
I have a problem set in hand, the description is something like:

We have 2 lists ie "nums1" and "nums2" and 2 integers m and n

```<code>nums1 = [1, 2, 3, 7, 8, 9]
m = 3
nums2 = [2, 5, 6]
n = 2
</code>```

Here "m" denotes number of elements to be picked from "nums1" and "n" denotes the number of elements to be picked from "nums2".
There are other ways ofcourse, but I want to create a list with only "list comprehension" on the above conditions.

With a simple for loop I can achieve that with:

```<code>li = []
for i in range(m):
  li.append(nums1[i])
for j in range(n):
  li.append(nums2[j])
print(li)
</code>```

I tried the following but the outcome result is not as expected:

```<code>[a for a in nums1 for b in nums2]
</code>```

Expected output:
[1, 2, 2, 3, 5]

Also, does list comprehension supports multiple loop?

答:
```<code>nums1 = [1, 2, 3, 7, 8, 9]
m = 3
nums2 = [2, 5, 6]
n = 2
</code>```

Create an empty list and store the returned values in this list if you need to access them later on in the program

```<code>nums3 = []
[nums3.append(nums1[i]) for i in range(m)]
[nums3.append(nums2[i]) for i in range(n)]
</code>```

Sorts and prints the newly created list

```<code>print(sorted(nums3))
</code>```

Title: Multiple loop in list comprehension

Body:
I have a problem set in hand, the description is something like:

We have 2 lists ie "nums1" and "nums2" and 2 integers m and n

nums1 = [1, 2, 3, 7, 8, 9]
m = 3
nums2 = [2, 5, 6]
n = 2

Here "m" denotes number of elements to be picked from "nums1" and "n" denotes the number of elements to be picked from "nums2".
There are other ways ofcourse, but I want to create a list with only "list comprehension" on the above conditions.

With a simple for loop I can achieve that with:

li = []
for i in range(m):
  li.append(nums1[i])
for j in range(n):
  li.append(nums2[j])
print(li)

I tried the following but the outcome result is not as expected:

[a for a in nums1 for b in nums2]

Expected output:
[1, 2, 2, 3, 5]

Also, does list comprehension supports multiple loop?

Body:
nums1 = [1, 2, 3, 7, 8, 9]
m = 3
nums2 = [2, 5, 6]
n = 2

Create an empty list and store the returned values in this list if you need to access them later on in the program

nums3 = []
[nums3.append(nums1[i]) for i in range(m)]
[nums3.append(nums2[i]) for i in range(n)]

Sorts and prints the newly created list

print(sorted(nums3))


问:
NSBundle folder not found on device, but works in simulator
I'm having a really weird problem with the iPad app I'm writing. On startup I want to copy a folder containing a few other folders (that are empty) from the application bundle to the Documents directory. The folder to be copied, called 'flds' (all lowercase), was added to the Xcode 4 project using 'Create folder references for any added folders', and I have checked that it is actually part of the .app file after compiling. (And that it doesn't exist already when attempting to copy.)

I've tried getting to the 'flds' folder using either one of these calls (they all work):

```<code>[[[NSBundle mainBundle] bundleURL] URLByAppendingPathComponent:@"flds"]
[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"flds"]
[[NSBundle mainBundle] pathForResource:@"flds" ofType:@""]
</code>```

Then copying using NSFileManager's copyItemAtPath:toPath:error: method (or the URL equivalent when using URL instead of path string).

All of these strategies work perfectly in the iPad Simulator and on the iPad device, with the following exception: When I (successfully) build for Ad Hoc distribution, drag the .app and the .mobileprovision into iTunes, sync and then run the app on the device, the system no longer thinks the 'flds' folder exists! I've been trying to examine this for many hours, with no luck. Again, I'm perfectly sure it works both in the simulator and on the device running from Xcode, but not when synced via iTunes.

Ideas?

I discovered that the following call gets the folder path successfully also after syncing the iPad app via iTunes:

```<code>[[NSBundle mainBundle] pathForResource:@"flds" ofType:nil inDirectory:nil]
</code>```

However, when I use this path to copy the folder to its new location in the Documents directory, only the folder itself and the .txt file in it (which I put in there as a test, it's not really supposed to be there) gets copied, and not the 6-7 empty subfolders. Again, the same pattern shows itself: Works as expected both on simulator and device running from Xcode ('flds' folder with 'test.txt' and empty subfolders are copied successfully), but not when synced via iTunes (only 'flds' folder with 'test.txt' are copied, not subfolders). Is this really the intended behaviour of copyItemAtPath:toPath:error:? And why would it behave differently after syncing via iTunes?

答: In the end I figured out that copyItemAtPath:toPath:error: wouldn't copy empty folders, even though I think it's supposed to. And again, this behaviour only occured after syncing the app to the iPad via iTunes (when running from Xcode it did copy empty folders). My solution for the time being is to simply put a dummy text file in each subfolder, so that they're not empty anymore.

ContentLicense: CC BY-SA 3.0

Body:
I'm having a really weird problem with the iPad app I'm writing. On startup I want to copy a folder containing a few other folders (that are empty) from the application bundle to the Documents directory. The folder to be copied, called 'flds' (all lowercase), was added to the Xcode 4 project using 'Create folder references for any added folders', and I have checked that it is actually part of the .app file after compiling. (And that it doesn't exist already when attempting to copy.)

I've tried getting to the 'flds' folder using either one of these calls (they all work):

[[[NSBundle mainBundle] bundleURL] URLByAppendingPathComponent:@"flds"]
[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"flds"]
[[NSBundle mainBundle] pathForResource:@"flds" ofType:@""]

Then copying using NSFileManager's copyItemAtPath:toPath:error: method (or the URL equivalent when using URL instead of path string).

All of these strategies work perfectly in the iPad Simulator and on the iPad device, with the following exception: When I (successfully) build for Ad Hoc distribution, drag the .app and the .mobileprovision into iTunes, sync and then run the app on the device, the system no longer thinks the 'flds' folder exists! I've been trying to examine this for many hours, with no luck. Again, I'm perfectly sure it works both in the simulator and on the device running from Xcode, but not when synced via iTunes.

Ideas?

I discovered that the following call gets the folder path successfully also after syncing the iPad app via iTunes:

[[NSBundle mainBundle] pathForResource:@"flds" ofType:nil inDirectory:nil]

However, when I use this path to copy the folder to its new location in the Documents directory, only the folder itself and the .txt file in it (which I put in there as a test, it's not really supposed to be there) gets copied, and not the 6-7 empty subfolders. Again, the same pattern shows itself: Works as expected both on simulator and device running from Xcode ('flds' folder with 'test.txt' and empty subfolders are copied successfully), but not when synced via iTunes (only 'flds' folder with 'test.txt' are copied, not subfolders). Is this really the intended behaviour of copyItemAtPath:toPath:error:? And why would it behave differently after syncing via iTunes?


问:
JAXB generating JAXBElement<String> instead of String
I am using Apache CXF cxf-codegen-plugin Maven plugin to generate sources from WSDL file. Problem is that I get JAXBElement<String> generated instead of String. I have added the jaxb-bindings.xml file which looks like this:

<jaxb:bindings version="2.1"
               xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
    <jaxb:globalBindings generateElementProperty="false"/>
</jaxb:bindings>
```

<p>This should prevent <code>JAXB</code> to generate <code>JAXBElement<String></code>. But it is not working I still have <code>JAXBElement<String></code> generated instead of <code>String</code>.</p>

<p>My <code>Maven</code> plugin looks like this:</p>

<pre class="lang-xml prettyprint-override"><code><plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <version>${cxf.runtime.version}</version>
    <dependencies>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-bindings-soap</artifactId>
            <version>${cxf.runtime.version}</version>
        </dependency>
    </dependencies>
    <executions>
        <execution>
            <id>generate-jaxb</id>
            <phase>generate-sources</phase>
            <configuration>
                <additionalJvmArgs>-Dfile.encoding=UTF8</additionalJvmArgs>
                <wsdlOptions>
                    <wsdlOption>
                        <wsdl>src/main/resources/wsdl/Cubiks.wsdl</wsdl>
                        <extraargs>
                            <extraarg>-b</extraarg>
                            <extraarg>${basedir}/jaxb-bindings.xml</extraarg>
                            <extraarg>-b</extraarg>
                            <extraarg>${basedir}/jaxws-bindings.xml</extraarg>
                            <extraarg>-exsh</extraarg>
                            <extraarg>true</extraarg>
                            <extraarg>-wsdlLocation</extraarg>
                            <extraarg></extraarg>
                        </extraargs>
                    </wsdlOption>
                    <wsdlOption>
                        <wsdl>src/main/resources/wsdl/CubiksCallBackService.wsdl</wsdl>
                        <extraargs>
                            <extraarg>-b</extraarg>
                            <extraarg>${basedir}/jaxws-bindings.xml</extraarg>
                            <extraarg>-b</extraarg>
                            <extraarg>${basedir}/jaxb-bindings.xml</extraarg>
                            <extraarg>-exsh</extraarg>
                            <extraarg>true</extraarg>
                            <extraarg>-p</extraarg>
                            <extraarg>com.cubiks.ws.callback</extraarg>
                            <extraarg>-wsdlLocation</extraarg>
                            <extraarg></extraarg>
                        </extraargs>
                    </wsdlOption>
                </wsdlOptions>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>
</code>```

CXF version is 2.6.0. Does someone know where might be the problem?

EDIT

The XSD is very huge. This is the element which generating JAXBElement<String>

```<code>  <xs:complexType name="ServiceResponse">
    <xs:sequence>
      <xs:element minOccurs="0" name="RequestStatus" type="tns:RequestStatus"/>
      <xs:element minOccurs="0" name="RequestStatusDescription" nillable="true" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
  <xs:element name="ServiceResponse" nillable="true" type="tns:ServiceResponse"/>
</code>```

And the generated source is:

```<code>@XmlElementRef(name = "RequestStatusDescription", namespace = "http://www.cubiksonline.com/2009/08/AssessmentProvider", type = JAXBElement.class)
protected JAXBElement<String> requestStatusDescription;
</code>```

答:
I created a file named bindings.xml in my recourses folder, and added the following :

```<code><?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" elementFormDefault="qualified" attributeFormDefault="unqualified" jaxb:extensionBindingPrefixes="xjc" jaxb:version="2.1">
    <xs:annotation>
        <xs:appinfo>
            <jaxb:globalBindings>
                <xjc:simple /><!-- it did only work after adding this -->
            </jaxb:globalBindings>
        </xs:appinfo>
    </xs:annotation>
</xs:schema>
</code>```

Then I mentioned this file in my cxf plugin definition in the pom.xml as in :

in <wsdlOptions> tag , in <wsdlOption> where it has  the path for the wsdl file, I added a  tag which has:

```<code><bindingFiles>
 <bindingFile> ${basedir}/src/min/resources/bindings.xml </bindingFile>
</bindingFiles>
</code>```

My stubs got generated so prettily with actual types.

Body:
I am using Apache CXF cxf-codegen-plugin Maven plugin to generate sources from WSDL file. Problem is that I get JAXBElement<String> generated instead of String. I have added the jaxb-bindings.xml file which looks like this:

<jaxb:bindings version="2.1"
               xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
    <jaxb:globalBindings generateElementProperty="false"/>
</jaxb:bindings>

This should prevent JAXB to generate JAXBElement<String>. But it is not working I still have JAXBElement<String> generated instead of String.

My Maven plugin looks like this:

<plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <version>${cxf.runtime.version}</version>
    <dependencies>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-bindings-soap</artifactId>
            <version>${cxf.runtime.version}</version>
        </dependency>
    </dependencies>
    <executions>
        <execution>
            <id>generate-jaxb</id>
            <phase>generate-sources</phase>
            <configuration>
                <additionalJvmArgs>-Dfile.encoding=UTF8</additionalJvmArgs>
                <wsdlOptions>
                    <wsdlOption>
                        <wsdl>src/main/resources/wsdl/Cubiks.wsdl</wsdl>
                        <extraargs>
                            <extraarg>-b</extraarg>
                            <extraarg>${basedir}/jaxb-bindings.xml</extraarg>
                            <extraarg>-b</extraarg>
                            <extraarg>${basedir}/jaxws-bindings.xml</extraarg>
                            <extraarg>-exsh</extraarg>
                            <extraarg>true</extraarg>
                            <extraarg>-wsdlLocation</extraarg>
                            <extraarg></extraarg>
                        </extraargs>
                    </wsdlOption>
                    <wsdlOption>
                        <wsdl>src/main/resources/wsdl/CubiksCallBackService.wsdl</wsdl>
                        <extraargs>
                            <extraarg>-b</extraarg>
                            <extraarg>${basedir}/jaxws-bindings.xml</extraarg>
                            <extraarg>-b</extraarg>
                            <extraarg>${basedir}/jaxb-bindings.xml</extraarg>
                            <extraarg>-exsh</extraarg>
                            <extraarg>true</extraarg>
                            <extraarg>-p</extraarg>
                            <extraarg>com.cubiks.ws.callback</extraarg>
                            <extraarg>-wsdlLocation</extraarg>
                            <extraarg></extraarg>
                        </extraargs>
                    </wsdlOption>
                </wsdlOptions>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>

CXF version is 2.6.0. Does someone know where might be the problem?

EDIT

The XSD is very huge. This is the element which generating JAXBElement<String>

  <xs:complexType name="ServiceResponse">
    <xs:sequence>
      <xs:element minOccurs="0" name="RequestStatus" type="tns:RequestStatus"/>
      <xs:element minOccurs="0" name="RequestStatusDescription" nillable="true" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
  <xs:element name="ServiceResponse" nillable="true" type="tns:ServiceResponse"/>

And the generated source is:

@XmlElementRef(name = "RequestStatusDescription", namespace = "http://www.cubiksonline.com/2009/08/AssessmentProvider", type = JAXBElement.class)
protected JAXBElement<String> requestStatusDescription;

Body:
I created a file named bindings.xml in my recourses folder, and added the following :

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" elementFormDefault="qualified" attributeFormDefault="unqualified" jaxb:extensionBindingPrefixes="xjc" jaxb:version="2.1">
    <xs:annotation>
        <xs:appinfo>
            <jaxb:globalBindings>
                <xjc:simple /><!-- it did only work after adding this -->
            </jaxb:globalBindings>
        </xs:appinfo>
    </xs:annotation>
</xs:schema>

Then I mentioned this file in my cxf plugin definition in the pom.xml as in :

in <wsdlOptions> tag , in <wsdlOption> where it has  the path for the wsdl file, I added a  tag which has:

<bindingFiles>
 <bindingFile> ${basedir}/src/min/resources/bindings.xml </bindingFile>
</bindingFiles>

My stubs got generated so prettily with actual types.


问:
Late Binding Issue with "MSXML2.XMLHTTP60"
I am getting a Run-time error '429': ActiveX component can't create object error when I try to run the following code.

```<code>Option Explicit

Private Sub EarlyVsLateBinding()

    ' References to both the Microsoft Scripting Runtime and Microsoft XML, v6.0
    ' are active so that early binding is possible

    Dim EarlyDictionary As Scripting.Dictionary

    Dim LateDictionary As Object
    Set LateDictionary = CreateObject("Scripting.Dictionary")

    Dim EarlyHTTP As New MSXML2.XMLHTTP60

    Dim LateHTTP As Object
    Set LateHTTP = CreateObject("MSXML2.XMLHTTP60") ' Error is thrown here

End Sub
</code>```

I have included the example of Scripting.Dictionary to convince myself that the CreateObject function wasn't causing any issues, and to show that an early and late binding work for another class.

Sadly, every example that I come across of this class uses the early binding method but I need the late binding method for this code.  Also, replacing the line Set LateHTTP = CreateObject("MSXML2.XMLHTTP60") with Set LateHTTP = GetObject(Class:="MSXML2.XMLHTTP60") yielded the same error.

What could be causing this error?

答:
As @Raymon Wu pointed out in the comments of the question, changing the line

Set LateHTTP = CreateObject("MSXML2.XMLHTTP60")

to

Set LateHTTP = CreateObject("MSXML2.XMLHTTP")

worked partially.

Edit 1

Alternatively, as @KL-1 has pointed out in the comments, changing the line to

Set LateHTTP = CreateObject("MSXML.XMLHTTP.6.0")

fixed the issue as well.

This change does make the code in my question run without error.  However, this caused another error later in a different piece of code

LateHTTP.setRequestHeader bstrHeader:="Content-Type", bstrValue:="application/json"

which was the Run-time error '448': Named argument not found error.  This was fixed by removing the named arguments and changing the line to

LateHTTP.setRequestHeader "Content-Type", "application/json"

Edit 1

Note that both solutions caused this Run-time error '448'.

As others have pointed out in the comments, when binding classes, the names are not necessarily the same when using early vs late.

The names for late binding can be found in the computer's registry editor under Computer\HKEY_CLASSES_ROOT.

I am aware that this goes beyond the scope of the question, but I consider it relevant information.

Body:
I am getting a Run-time error '429': ActiveX component can't create object error when I try to run the following code.

Option Explicit

Private Sub EarlyVsLateBinding()

    ' References to both the Microsoft Scripting Runtime and Microsoft XML, v6.0
    ' are active so that early binding is possible

    Dim EarlyDictionary As Scripting.Dictionary

    Dim LateDictionary As Object
    Set LateDictionary = CreateObject("Scripting.Dictionary")

    Dim EarlyHTTP As New MSXML2.XMLHTTP60

    Dim LateHTTP As Object
    Set LateHTTP = CreateObject("MSXML2.XMLHTTP60") ' Error is thrown here

End Sub

I have included the example of Scripting.Dictionary to convince myself that the CreateObject function wasn't causing any issues, and to show that an early and late binding work for another class.

Sadly, every example that I come across of this class uses the early binding method but I need the late binding method for this code.  Also, replacing the line Set LateHTTP = CreateObject("MSXML2.XMLHTTP60") with Set LateHTTP = GetObject(Class:="MSXML2.XMLHTTP60") yielded the same error.

What could be causing this error?


问:
How to use for loop to count number
I would like to write a program that can continuously + 1 to ID once user registered a user. I use for loop to design it, but I don't know how to break the loop after registered a user. Please help me.

Expected Data in idtest.txt:

```<code>SID001:USER1
SID002:USER2
SID003:USER3
.
.
and so on
</code>```

Actual Data in idtest.txt:

```<code>SID001:USER1
SID002:USER1
SID003:USER1
.
until SID00999:USER1
</code>```

My Code:

```<code>int main()
{
    FILE* f;
    char data[1024], user[50];
    int num = 0, c, buf;

    printf("Enter User: ");
    scanf("%s", user);

    f = fopen("idtest.txt", "a+");
    while (fgets(data, sizeof data, f));

    for (buf = 1; buf <= 999; buf++)
    {
        c = fgetc(f);
        if (c == EOF)
        {
            fprintf(f, "SID00%d:%s\n", num, user);
        }
        else if (num >= 1)
        {
            fprintf(f, "SID00%d:%s\n", num, user);
        }
        else if (num >= 9)
        {
            fprintf(f, "SID0%d:%s\n", num, user);
        }
        else if (num >= 99)
        {
            fprintf(f, "SID%d:%s\n", num, user);
        }
        break;
    }
    return 0;
}
</code>```

答:
There are multiple problems in your code:

you do not test for errors

as coded, num is always 0: the program cannot produce the file contents you posted.

it makes no sense to try an read the next byte with fgetc(f) since the previous loop reached the end of the file already. This call returns EOF, which explains why you always write 2 leading zeroes.

you cannot mix reading and writing operations without an intervening seek operation, it has undefined behavior. Your code manages to write to the file, but it might behave differently with a different compiler / library / operating system...

you can simplify the output code using %03d to format numbers with leading zeroes.

naming an int variable buf is very confusing.

If you intend for the program to register one user at a time, you should read the file and count the number of lines, then write a single entry at the end.

Here is a modified version:

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

int main() {
    char user[50];
    char data[1024];
    FILE *f;
    int num;

    printf("Enter User: ");
    if (scanf("%49s", user) != 1) {
        fprintf(stderr, "invalid or missing input\n");
        return 1;
    }

    f = fopen("idtest.txt", "a+");
    if (f == NULL) {
        fprintf(stderr, "cannot open file idtest.txt\n");
        return 1;
    }
    /* count the number of users */
    num = 1;
    rewind(f);
    while (fgets(data, sizeof data, f)) {
        num++;
    }
    /* switch to writing mode */

    // No need to seek because the above loop hit the end of file.
    // which is a special case where the next call can be a write operation
    //fseek(f, 0L, SEEK_CUR);

    fprintf(f, "SID%03d:%s\n", num, user);
    fclose(f);
    return 0;
}
</code>```

Title: How to use for loop to count number

Body:
I would like to write a program that can continuously + 1 to ID once user registered a user. I use for loop to design it, but I don't know how to break the loop after registered a user. Please help me.

Expected Data in idtest.txt:

SID001:USER1
SID002:USER2
SID003:USER3
.
.
and so on

Actual Data in idtest.txt:

SID001:USER1
SID002:USER1
SID003:USER1
.
until SID00999:USER1

My Code:

int main()
{
    FILE* f;
    char data[1024], user[50];
    int num = 0, c, buf;

    printf("Enter User: ");
    scanf("%s", user);

    f = fopen("idtest.txt", "a+");
    while (fgets(data, sizeof data, f));

    for (buf = 1; buf <= 999; buf++)
    {
        c = fgetc(f);
        if (c == EOF)
        {
            fprintf(f, "SID00%d:%s\n", num, user);
        }
        else if (num >= 1)
        {
            fprintf(f, "SID00%d:%s\n", num, user);
        }
        else if (num >= 9)
        {
            fprintf(f, "SID0%d:%s\n", num, user);
        }
        else if (num >= 99)
        {
            fprintf(f, "SID%d:%s\n", num, user);
        }
        break;
    }
    return 0;
}

Body:
There are multiple problems in your code:

you do not test for errors

as coded, num is always 0: the program cannot produce the file contents you posted.

it makes no sense to try an read the next byte with fgetc(f) since the previous loop reached the end of the file already. This call returns EOF, which explains why you always write 2 leading zeroes.

you cannot mix reading and writing operations without an intervening seek operation, it has undefined behavior. Your code manages to write to the file, but it might behave differently with a different compiler / library / operating system...

you can simplify the output code using %03d to format numbers with leading zeroes.

naming an int variable buf is very confusing.

If you intend for the program to register one user at a time, you should read the file and count the number of lines, then write a single entry at the end.

Here is a modified version:

#include <stdio.h>

int main() {
    char user[50];
    char data[1024];
    FILE *f;
    int num;

    printf("Enter User: ");
    if (scanf("%49s", user) != 1) {
        fprintf(stderr, "invalid or missing input\n");
        return 1;
    }

    f = fopen("idtest.txt", "a+");
    if (f == NULL) {
        fprintf(stderr, "cannot open file idtest.txt\n");
        return 1;
    }
    /* count the number of users */
    num = 1;
    rewind(f);
    while (fgets(data, sizeof data, f)) {
        num++;
    }
    /* switch to writing mode */

    // No need to seek because the above loop hit the end of file.
    // which is a special case where the next call can be a write operation
    //fseek(f, 0L, SEEK_CUR);

    fprintf(f, "SID%03d:%s\n", num, user);
    fclose(f);
    return 0;
}


答:
To update it go to your command prompt and type (can type cmd in search box to open):</p>
```<code>pip install --upgrade django==4.0.2
</code>```

Title: Can't update django to newest version

Body:
I am a django beginner trying to set up django newest version 2.0.2 in my virtual environment. I am running python 2.7 on my mac, currently using django 1.01.It wouldn't allow me to update any other versions.When I do pip install django==2.0

Collecting django==2.0
  Could not find a version that satisfies the requirement django==2.0 (from versions: 1.1.3, 1.1.4, 1.2, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.2.7, 1.3, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.4, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.4.8, 1.4.9, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 1.4.14, 1.4.15, 1.4.16, 1.4.17, 1.4.18, 1.4.19, 1.4.20, 1.4.21, 1.4.22, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11, 1.5.12, 1.6, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, 1.6.6, 1.6.7, 1.6.8, 1.6.9, 1.6.10, 1.6.11, 1.7, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.7.6, 1.7.7, 1.7.8, 1.7.9, 1.7.10, 1.7.11, 1.8a1, 1.8b1, 1.8b2, 1.8rc1, 1.8, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.8.6, 1.8.7, 1.8.8, 1.8.9, 1.8.10, 1.8.11, 1.8.12, 1.8.13, 1.8.14, 1.8.15, 1.8.16, 1.8.17, 1.8.18, 1.9a1, 1.9b1, 1.9rc1, 1.9rc2, 1.9, 1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.9.5, 1.9.6, 1.9.7, 1.9.8, 1.9.9, 1.9.10, 1.9.11, 1.9.12, 1.9.13, 1.10a1, 1.10b1, 1.10rc1, 1.10, 1.10.1, 1.10.2, 1.10.3, 1.10.4, 1.10.5, 1.10.6, 1.10.7, 1.10.8, 1.11a1, 1.11b1, 1.11rc1, 1.11, 1.11.1, 1.11.2, 1.11.3, 1.11.4, 1.11.5, 1.11.6, 1.11.7, 1.11.8, 1.11.9, 1.11.10)
No matching distribution found for django==2.0

Body:
To update it go to your command prompt and type (can type cmd in search box to open):

pip install --upgrade django==4.0.2


问:
How to compare Debian package versions?
I looked at python-apt and python-debian, and they don't seem to have functionality to compare package versions. Do I have to write my own, or is there something I can use?

Ideally, it would look something like:

```<code>>>> v1 = apt.version("1:1.3.10-0.3")
>>> v2 = apt.version("1.3.4-1")
>>> v1 > v2
True
</code>```

答:
As you already mentioned python-apt and python-debian, but it is 2022 by now and Python 2.7 is end-of-life, here's the Python 3 code for a Debian based system, where you have installed python3-debian:

```<code>from debian.debian_support import Version
v1 = Version("1:1.3.10-0.3")
v2 = Version("1.3.4-1")
print(v1 > v2)
</code>```

python3-debian will automatically used the more efficient version from python3-apt if it is installed. But you also can use it explicitly by importing Version from apt:

```<code>from apt import Version
</code>```

Title: How to compare Debian package versions?

Body:
I looked at python-apt and python-debian, and they don't seem to have functionality to compare package versions. Do I have to write my own, or is there something I can use?

Ideally, it would look something like:

>>> v1 = apt.version("1:1.3.10-0.3")
>>> v2 = apt.version("1.3.4-1")
>>> v1 > v2
True

Body:
As you already mentioned python-apt and python-debian, but it is 2022 by now and Python 2.7 is end-of-life, here's the Python 3 code for a Debian based system, where you have installed python3-debian:

from debian.debian_support import Version
v1 = Version("1:1.3.10-0.3")
v2 = Version("1.3.4-1")
print(v1 > v2)

python3-debian will automatically used the more efficient version from python3-apt if it is installed. But you also can use it explicitly by importing Version from apt:

from apt import Version


问:
py-cord: How do I delete the last n messages of a user?
I am writing an anti-spam bot in py-cord and I would like to delete a users last n messages automatically once they reach the pressure limit (= too much spam). My code for just deleting the messages so far is:

```<code>95 counter = 0
96 while counter < 10:
97    for channel in message.guild.channels:
98        for msg in channel.messages:
99            if msg.author.id == message.author.id and counter < 10:
100               await msg.delete()
101               counter += 1
</code>```

and the error that I get is

```<code>Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\Username\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\Username\OneDrive\Desktop\Dateien\Python\MessageCheck\messagecheck.py", line 98, in on_message
    for msg in channel.messages:
AttributeError: 'CategoryChannel' object has no attribute 'messages'
</code>```

I tried searching for similar questions on StackOverflow, but the closest I got was 50301090, which doesn't quite answer my question as I don't want to use a command for this and it seems like it could put some strain onto the cache if it's run for some time.

答:
It simply says that your channel which is of type CategoryChannel doesn't have a messages attribute to it which it doesn't if you look in the documentation.

Moreover what you are trying to implement already comes built-in with discord.py called purge() so you should just use that instead.

# Whatever you had here most like an on_message() listener
await channel.purge(limit=10, check=lambda msg: msg.author == person)
# Here person is a discord.Member object which let's just say you stored from a command function
```

Also wanted to point out that this doesn't in fact delete the last 10 messages of the user but rather the messages sent by the user in the last 10 messages in the channel.

Body:
I am writing an anti-spam bot in py-cord and I would like to delete a users last n messages automatically once they reach the pressure limit (= too much spam). My code for just deleting the messages so far is:

95 counter = 0
96 while counter < 10:
97    for channel in message.guild.channels:
98        for msg in channel.messages:
99            if msg.author.id == message.author.id and counter < 10:
100               await msg.delete()
101               counter += 1

and the error that I get is

Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\Username\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\Username\OneDrive\Desktop\Dateien\Python\MessageCheck\messagecheck.py", line 98, in on_message
    for msg in channel.messages:
AttributeError: 'CategoryChannel' object has no attribute 'messages'

I tried searching for similar questions on StackOverflow, but the closest I got was 50301090, which doesn't quite answer my question as I don't want to use a command for this and it seems like it could put some strain onto the cache if it's run for some time.

Body:
It simply says that your channel which is of type CategoryChannel doesn't have a messages attribute to it which it doesn't if you look in the documentation.

Moreover what you are trying to implement already comes built-in with discord.py called purge() so you should just use that instead.

# Whatever you had here most like an on_message() listener
await channel.purge(limit=10, check=lambda msg: msg.author == person)
# Here person is a discord.Member object which let's just say you stored from a command function

Also wanted to point out that this doesn't in fact delete the last 10 messages of the user but rather the messages sent by the user in the last 10 messages in the channel.


问:
How to set the response content type in a Spring controller that returns a unit (void)?
I have a controller in my Spring project that doesn't return anything. Its response type in the openAPI doc is text, but I want to change it to application/json. I already added produces = [MediaType.APPLICATION_JSON_VALUE] to my @RequestMapping annotation, but it just works for functions returning a value. The only way I found is to add this return statement, but I am going to find a general solution.

```<code>return ResponseEntity.status(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON).build()
</code>```

What is the best solution?

答: if your response doesn't return anything you shouldn't be returning a 200 but a 204. Then you also don't need to set the content type since there is no content.</p>

Body:
I have a controller in my Spring project that doesn't return anything. Its response type in the openAPI doc is text, but I want to change it to application/json. I already added produces = [MediaType.APPLICATION_JSON_VALUE] to my @RequestMapping annotation, but it just works for functions returning a value. The only way I found is to add this return statement, but I am going to find a general solution.

return ResponseEntity.status(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON).build()

What is the best solution?


问:
(long) i + (int) j * k What is the type of the expression?
```<code>int i;
long j;
unsigned int k;
</code>```

I'm new to learning C, and can't figure this out. I've tried looking online many times for similar expressions. I honestly don't need the answer I really just want to understand how to figure it out. This has to do with mixing data types and I've only come across little information about what they are, but nothing clear to understand. Any help would be appreciated to understand how to figure out the data type for the following expression (long) i + (int) j * k

I appreciate any answers! Thank you!

答:
We have long + int * unsigned.

The * expression will be unsigned. The reason is that int and unsigned have the same conversion rank, and the unsigned type wins: the signed operand is converted to unsigned, and the multiplication is between two unsigned, its result being of that type.

Thus, the addition is then long + unsigned.  Here things get tricky.  If the implementation's long can represent all of the values of unsigned, then the unsigned will be converted to long; the addition is of two long operands and the result is long. But if unsigned has values outside of the long range (e.g. 32 bit unsigned and 32 bit long), then both operands will convert to unsigned long and the addition will be in that type.

In other words, the type ends up being platform-specific, depending on the relative range of unsigned and long.

Body:
int i;
long j;
unsigned int k;

I'm new to learning C, and can't figure this out. I've tried looking online many times for similar expressions. I honestly don't need the answer I really just want to understand how to figure it out. This has to do with mixing data types and I've only come across little information about what they are, but nothing clear to understand. Any help would be appreciated to understand how to figure out the data type for the following expression (long) i + (int) j * k

I appreciate any answers! Thank you!


问:
Heroku Custom Domain Not Working
What is the correct way to connect a Heroku app with a custom domain?

This is how I did it in the past:

Point Godaddy's DNS to heroku's provided target (example:
https://peaceful-escarpment-22825.herokuapp.com)

Turn on domain forwarding on the domain

Add domain to Heroku in the settings

For some reason now my provided target from Heroku is like this: mycustomdomain.com.herokudns.com. When I add that DNS to GoDaddy I get a There's nothing here, yet. page.

Where am I going wrong? Thanks!

答:
FIXED!! After struggling for a long time setting up my www domain with my Heroku app, I had to point the domain to Cloudflare then set it up as follows:

[1]: https://i.stack.imgur.com/o6CJc.png .
[2]: https://i.stack.imgur.com/P8PSQ.png .
[3]: https://i.stack.imgur.com/BB0DI.png .

Then everything just works perfectly both NON-WWW and WWW domains.

I did not need to do any URL forwarding as see bellow

[4]: https://i.stack.imgur.com/wgMit.png .

Title: Heroku Custom Domain Not Working


问:
ReferenceError: WebAssembly is not defined
I'm using ttest nodejs module in application. Due to updates to it I tried to use updated version ttest@2.0.0. When module start compute data the error appears:

ReferenceError: WebAssembly is not defined

The NodeJS version - 6.9.1.

Error appears in next place:

```<code>class CephesWrapper {
  constructor(sync) {
    // Initialize the runtime's memory
    this._wasmMemory = new WebAssembly.Memory({
      'initial': TOTAL_MEMORY / WASM_PAGE_SIZE,
      'maximum': TOTAL_MEMORY / WASM_PAGE_SIZE
    });
.....
  }
}
</code>```

Is there any advices about solving this issue? Is it possible to define WebAssembly?

答:
Even my node version was 12, and npm version was 6. I was getting the reference error for webassembly.

So I updated the node with latest version(16), it changed the npm version also. Now the reference issue is fixed.

D:\ReactJS\react_demo>node -v

v16.14.0

D:\ReactJS\react_demo>npm -v

8.3.1

Body:
I'm using ttest nodejs module in application. Due to updates to it I tried to use updated version ttest@2.0.0. When module start compute data the error appears:

ReferenceError: WebAssembly is not defined

The NodeJS version - 6.9.1.

Error appears in next place:

class CephesWrapper {
  constructor(sync) {
    // Initialize the runtime's memory
    this._wasmMemory = new WebAssembly.Memory({
      'initial': TOTAL_MEMORY / WASM_PAGE_SIZE,
      'maximum': TOTAL_MEMORY / WASM_PAGE_SIZE
    });
.....
  }
}

Is there any advices about solving this issue? Is it possible to define WebAssembly?


问:
Can i trigger browser to focus element in JS
When i want to focus on some element I use focus() function which gave me :focus from css. The thing is that when i am focusing with TAB keyboard button i get that styling from css but also some blue styling around element which is probably some browser focus. Can I trigger that blue browser focus somehow too with js?

答:
You can override this with the focus-visible CSS.  Adding sample working example below for reference

button {
  background: #F0FF00;
  border: 1px solid #ccc;
  font-size: 18px;
}

.clear-focus {
  background: #00FF00;
}

.clear-focus:focus-visible, .clear-focus:focus  {
  outline: none;
  box-shadow: 0px 1px 6px 0px #000;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><input placeholder="click to focus here manually" type="text" />

<p>Now press tab</p>
<button >Button without focus override / default focuss css</button>

<p>Now press tab agian</p>
<button class="clear-focus">Override focuss css /  with custom css</button></code>```

isible` CSS class. Sample code below:

Body:
You can override this with the focus-visible CSS.  Adding sample working example below for reference

button {
  background: #F0FF00;
  border: 1px solid #ccc;
  font-size: 18px;
}

.clear-focus {
  background: #00FF00;
}

.clear-focus:focus-visible, .clear-focus:focus  {
  outline: none;
  box-shadow: 0px 1px 6px 0px #000;
}

<input placeholder="click to focus here manually" type="text" />

<p>Now press tab</p>
<button >Button without focus override / default focuss css</button>

<p>Now press tab agian</p>
<button class="clear-focus">Override focuss css /  with custom css</button>

isible` CSS class. Sample code below:


问:
Convert datetime.time column in pandas to total minutes
I have a datetime.time Series in Pandas and I want to convert it to an int series which contains the total minutes.
Anyway I could do that?

I have tried converting it to timedelta using

train['time_order'] = pd.to_timedelta(train['time_order']).dt.total_seconds()
train['time_order'] = train['time_order']%60
```

but I get the error

Invalid type for timedelta scalar: <class 'datetime.time'>
since the format of the column is in datetime.time

答:
Convert column to strings first:</p>
```<code>train['time_order'] = pd.to_timedelta(train['time_order'].astype(str)).dt.total_seconds()%60
</code>```

Body:
I have a datetime.time Series in Pandas and I want to convert it to an int series which contains the total minutes.
Anyway I could do that?

I have tried converting it to timedelta using

train['time_order'] = pd.to_timedelta(train['time_order']).dt.total_seconds()
train['time_order'] = train['time_order']%60

but I get the error

Invalid type for timedelta scalar: <class 'datetime.time'>
since the format of the column is in datetime.time

Body:
Convert column to strings first:

train['time_order'] = pd.to_timedelta(train['time_order'].astype(str)).dt.total_seconds()%60