问:
Can't display custom pop-up because my tab view is in NavigationView
I want to display a pop-up in my view, where I will be able to display a menu where I can choose how I fell, then it will show what I have chosen and close itself. If I am adding it to the view and it's presenting It shows wrong and Tab Bar does not disappear. Can someone provide a better way to show a pop-up over Tab Bar? The logic is something like this: button pressed -> shows pop-up -> choose status -> shows another pop-up -> disappears.

Code's provided below:

```<code>// Smile face that used in question
struct SmileFace: View {

    var text: String
    var image: String

    @Binding var current: String

    var body: some View {
            Button {

                withAnimation {
                    current = text
                }

            } label: {
                VStack {

                    Image(image)
                        .resizable()
                        .scaledToFill()
                        .frame(width: 46, height: 46)

                    Text(text)
                        .foregroundColor(.white)
                }
            }

    }
}

</code>```
```<code>// Check in answer view

import SwiftUI

struct CheckInAskView: View {

    let didClose: () -> Void

    var didChose: Bool = false

    @State var current: String

    var emotions = [
        "GREAT" : "good",
        "GOOD" : "happy",
        "OK" : "moderate",
        "BAD" : "sad",
        "TERRIBLE" : "verysad"
    ]

    var body: some View {

        VStack {

            ZStack(alignment: .topLeading) {

                Rectangle()
                    .fill(Color("navigation"))
                    .cornerRadius(15)
                    .frame(height: 601)

                HStack(alignment: .top) {
                    ZStack(alignment: .top) {
                        Circle()
                            .fill(Color(red: 0.682, green: 0.384, blue: 0.486).opacity(0.10))
                            .frame(width: 173)
                            .offset(x: -173/2, y: -90/2)
                            .clipped()
                    }

                    Spacer()

                    Button {
                        didClose()

                    } label: {
                        ZStack {
                            Circle()
                                .fill(Color(red: 0.933, green: 0.933, blue: 0.933).opacity(0.30))
                                .frame(width: 24)
                                .clipped()

                            Image(systemName: "xmark")
                                .font(.system(size: 15))
                                .foregroundColor(Color(red: 0.762, green: 0.762, blue: 0.762))
                        }
                        .padding(10)
                    }

                }

                VStack(alignment: .center) {

                    Spacer()

                    Text("How do you feel now?")
                        .foregroundColor(.white)
                        .font(.custom("Manrope-Bold", size: 16))

                    HStack(spacing: 35) {

                        SmileFace(text: "GOOD", image: "good", current: $current)

                    }
                    .padding(.horizontal)

                    DoubleTextView(topText: "Recommendation for you", buttomText: "We have selected courses based on your goals and \nexperience", topTextSize: 16, buttomTextSize: 14)

                    BigFrameScrollViewHorizontal()

                    Spacer()
                }
            }
            .frame(height: 601)
        }
        .frame(height: 601)
        .transition(.move(edge: .bottom))
    }
}
</code>```
```<code>// View with all views
struct CheckInView: View {

    @StateObject var sheetManager: SheetManager

    var body: some View {

        VStack {

            HStack {

                Text("How do you fell now?")
                    .foregroundColor(.white)
                    .font(.custom("Manrope-Bold", size: 16))

                Spacer()

                Button {

                } label: {
                    ZStack {
                        HStack {
                            Text("Pass check in")
                                .padding([.top, .leading, .bottom])
                                .foregroundColor(.white)
                                .font(.custom("Manrope-Medium", size: 12))

                            Image(systemName: "chevron.right")
                                .foregroundColor(.white)
                                .font(.system(size: 15))
                                .padding(.trailing)

                        }
                    }
                        .background(Rectangle()
                            .fill(Color("active"))
                            .cornerRadius(100)
                            .frame(height: 26))
                }

            }

            VStack {

                Divider()
                    .background(Color("inactive"))
                    .padding(.vertical)

                Divider()
                    .background(Color("inactive"))
                    .padding(.vertical)

                Divider()
                    .background(Color("inactive"))
                    .padding(.vertical)

                Divider()
                    .background(Color("inactive"))
                    .padding(.vertical)

                Divider()
                    .background(Color("inactive"))
                    .padding(.vertical)

                Divider()
                    .background(Color("inactive"))
                    .padding(.vertical)

            }

            HStack {

                Button {

                } label: {

                    ZStack {

                        Circle()
                            .fill(Color("navigation"))
                            .frame(width: 26)

                        Image(systemName: "chevron.left")
                            .foregroundColor(.white)
                            .font(.system(size: 14))

                    }

                }

                Button {

                } label: {
                    ZStack {

                        Circle()
                            .fill(Color("navigation"))
                            .frame(width: 26)

                        Image(systemName: "chevron.right")
                            .foregroundColor(Color("inactive"))
                            .font(.system(size: 14))

                    }
                }

            }
            .padding(.top)

        }
        .padding(.horizontal, 15.0)

    }
}

struct CheckInView_Previews: PreviewProvider {
    static var previews: some View {
        CheckInView(sheetManager: SheetManager())
            .background(.yellow)
    }
}

</code>```

If I have all of this, how can I create a pop-up over Tab View? Maybe a link to a similar problem?

Body:
I want to display a pop-up in my view, where I will be able to display a menu where I can choose how I fell, then it will show what I have chosen and close itself. If I am adding it to the view and it's presenting It shows wrong and Tab Bar does not disappear. Can someone provide a better way to show a pop-up over Tab Bar? The logic is something like this: button pressed -> shows pop-up -> choose status -> shows another pop-up -> disappears.

Code's provided below:

// Smile face that used in question
struct SmileFace: View {

    var text: String
    var image: String

    @Binding var current: String

    var body: some View {
            Button {

                withAnimation {
                    current = text
                }

            } label: {
                VStack {

                    Image(image)
                        .resizable()
                        .scaledToFill()
                        .frame(width: 46, height: 46)

                    Text(text)
                        .foregroundColor(.white)
                }
            }

    }
}

// Check in answer view

import SwiftUI

struct CheckInAskView: View {

    let didClose: () -> Void

    var didChose: Bool = false

    @State var current: String

    var emotions = [
        "GREAT" : "good",
        "GOOD" : "happy",
        "OK" : "moderate",
        "BAD" : "sad",
        "TERRIBLE" : "verysad"
    ]

    var body: some View {

        VStack {

            ZStack(alignment: .topLeading) {

                Rectangle()
                    .fill(Color("navigation"))
                    .cornerRadius(15)
                    .frame(height: 601)

                HStack(alignment: .top) {
                    ZStack(alignment: .top) {
                        Circle()
                            .fill(Color(red: 0.682, green: 0.384, blue: 0.486).opacity(0.10))
                            .frame(width: 173)
                            .offset(x: -173/2, y: -90/2)
                            .clipped()
                    }

                    Spacer()

                    Button {
                        didClose()

                    } label: {
                        ZStack {
                            Circle()
                                .fill(Color(red: 0.933, green: 0.933, blue: 0.933).opacity(0.30))
                                .frame(width: 24)
                                .clipped()

                            Image(systemName: "xmark")
                                .font(.system(size: 15))
                                .foregroundColor(Color(red: 0.762, green: 0.762, blue: 0.762))
                        }
                        .padding(10)
                    }

                }

                VStack(alignment: .center) {

                    Spacer()

                    Text("How do you feel now?")
                        .foregroundColor(.white)
                        .font(.custom("Manrope-Bold", size: 16))

                    HStack(spacing: 35) {

                        SmileFace(text: "GOOD", image: "good", current: $current)

                    }
                    .padding(.horizontal)

                    DoubleTextView(topText: "Recommendation for you", buttomText: "We have selected courses based on your goals and \nexperience", topTextSize: 16, buttomTextSize: 14)

                    BigFrameScrollViewHorizontal()

                    Spacer()
                }
            }
            .frame(height: 601)
        }
        .frame(height: 601)
        .transition(.move(edge: .bottom))
    }
}

// View with all views
struct CheckInView: View {

    @StateObject var sheetManager: SheetManager

    var body: some View {

        VStack {

            HStack {

                Text("How do you fell now?")
                    .foregroundColor(.white)
                    .font(.custom("Manrope-Bold", size: 16))

                Spacer()

                Button {

                } label: {
                    ZStack {
                        HStack {
                            Text("Pass check in")
                                .padding([.top, .leading, .bottom])
                                .foregroundColor(.white)
                                .font(.custom("Manrope-Medium", size: 12))

                            Image(systemName: "chevron.right")
                                .foregroundColor(.white)
                                .font(.system(size: 15))
                                .padding(.trailing)

                        }
                    }
                        .background(Rectangle()
                            .fill(Color("active"))
                            .cornerRadius(100)
                            .frame(height: 26))
                }

            }

            VStack {

                Divider()
                    .background(Color("inactive"))
                    .padding(.vertical)

                Divider()
                    .background(Color("inactive"))
                    .padding(.vertical)

                Divider()
                    .background(Color("inactive"))
                    .padding(.vertical)

                Divider()
                    .background(Color("inactive"))
                    .padding(.vertical)

                Divider()
                    .background(Color("inactive"))
                    .padding(.vertical)

                Divider()
                    .background(Color("inactive"))
                    .padding(.vertical)

            }

            HStack {

                Button {

                } label: {

                    ZStack {

                        Circle()
                            .fill(Color("navigation"))
                            .frame(width: 26)

                        Image(systemName: "chevron.left")
                            .foregroundColor(.white)
                            .font(.system(size: 14))

                    }

                }

                Button {

                } label: {
                    ZStack {

                        Circle()
                            .fill(Color("navigation"))
                            .frame(width: 26)

                        Image(systemName: "chevron.right")
                            .foregroundColor(Color("inactive"))
                            .font(.system(size: 14))

                    }
                }

            }
            .padding(.top)

        }
        .padding(.horizontal, 15.0)

    }
}

struct CheckInView_Previews: PreviewProvider {
    static var previews: some View {
        CheckInView(sheetManager: SheetManager())
            .background(.yellow)
    }
}

If I have all of this, how can I create a pop-up over Tab View? Maybe a link to a similar problem?


来源: stackexchange

问:
Flutter Auto Countdown Implementation for Fitness Workout
I'm working on a Flutter Workout App and I'm having some issues implementing the Workout Sequence and Timer.

I was able to implement the auto countdown and workout sequence however, the countdown skips numbers between and the workout sequence runs only for the first 2 sets.

For example, if an exercise has 4 sets, the cycle only runs for the first two and it's glitchy. I need help with optimized code to help me achieve the workout sequence

JSON DATA

```<code>{
    "data": {
        "day1": [
            {
                "id": 1,
                "title": "Reclining Triceps Press",
                "equipment": "Pull Up Bar",
                "level": "Beginner",
                "reps": "15",
                "rest": "45 Seconds",
                "sets": "4",
                "image": "https://wicombit.com/demo/fitpro/images/exercise_1519941887.jpg",
                "video": null,
            },
            {
                "id": 10,
                "title": "Plank with Arm Raise",
                "equipment": "Pull Up Bar",
                "level": "Intermediate",
                "reps": "12",
                "rest": "30 Seconds",
                "sets": "3",
                "image": "https://wicombit.com/demo/fitpro/images/exercise_1519938568.jpg",
                "video": null,
            },
            {
                "id": 3,
                "title": "90-degree Static Hold",
                "equipment": "Pull Up Bar",
                "level": "Beginner",
                "reps": "12",
                "rest": "45 Seconds",
                "sets": "3",
                "image": "https://wicombit.com/demo/fitpro/images/exercise_1519940878.jpg",
                "video": null,
            },
            {
                "id": 5,
                "title": "Single-arm Medicine Ball Pushup",
                "equipment": "Kettlebells",
                "level": "Elite",
                "reps": "8",
                "rest": "45 Seconds",
                "sets": "3",
                "image": "https://wicombit.com/demo/fitpro/images/exercise_1519940316.jpg",
                "video": null,
                "status": "draft"
            }
        ],
    }
}
</code>```

I have tried the below implementation but not getting the results I want.

Dart Implementation

```<code>class WorkouStartSequenceScreen extends StatefulWidget {
  final exercise;

  WorkouStartSequenceScreen({super.key, required this.exercise});

  @override
  State<WorkouStartSequenceScreen> createState() =>
      _WorkouStartSequenceScreenState();
}

class _WorkouStartSequenceScreenState extends State<WorkouStartSequenceScreen> {
  late Timer _startTimer;
  late Timer _restTimer;
  late int totalNoOfExercisesInDay;
  int currentExerciseIndex = 0;
  late int totalNoOfSets;
  late int totalNoOfReps;
  late int totalRestTime;
  int currentSetNo = 0;
  int currentRepNo = 0;
  int currentRestTime = 0;
  bool dayWorkoutComplete = false;
  int startUpCountdown = 10;
  StreamController<int> _startEvents = BehaviorSubject();
  StreamController<int> _restEvents = BehaviorSubject();

  @override
  void initState() {
    totalNoOfExercisesInDay = widget.exercise.length;
    totalNoOfReps = int.parse(widget.exercise[currentExerciseIndex].reps);
    totalNoOfSets = int.parse(widget.exercise[currentExerciseIndex].sets);
    totalRestTime = int.parse(widget.exercise[currentExerciseIndex].rest
        .replaceAll(new RegExp(r'[^0-9]'), ''));
    currentRestTime = totalRestTime;
    _startEvents.add(startUpCountdown);

    super.initState();
  }

  @override
  void dispose() {
    _startTimer.cancel();
    _restTimer.cancel();
    // _startEvents.close();
    // _restEvents.close();
    super.dispose();
  }

  void _showStartupDialog() async {
    _startTimer = Timer.periodic(Duration(seconds: 1), (timer) {
      (startUpCountdown > 0) ? startUpCountdown-- : _startTimer.cancel();

      _startEvents.add(startUpCountdown);
    });

    showDialog(
        context: context,
        barrierDismissible: false,
        builder: (BuildContext builderContext) {
          _startTimer = Timer(Duration(seconds: 10), () {
            Navigator.of(context).pop();
          });

          return AlertDialog(
            backgroundColor: AppStyles.primaryColor,
            content: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                Text('Your workout starts in',
                    textAlign: TextAlign.center,
                    style: TextStyle(
                        color: Colors.white, fontSize: SizeConfig.font20)),
                SizedBox(height: SizeConfig.height20),
                StreamBuilder<int>(
                    stream: _startEvents.stream,
                    builder:
                        (BuildContext context, AsyncSnapshot<int> snapshot) {
                      return Text('${snapshot.data.toString()}',
                          textAlign: TextAlign.center,
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: SizeConfig.font50));
                    }),
              ],
            ),
          );
        }).then((val) {
      if (_startTimer.isActive) {
        _startTimer.cancel();
      }
    });
  }

  void startRestTimer() async {
    _restTimer = Timer.periodic(Duration(seconds: 1), (timer) {
      (currentRestTime > 0) ? currentRestTime-- : _restTimer.cancel();

      _restEvents.add(currentRestTime);
    });

    showDialog(
        context: context,
        barrierDismissible: false,
        builder: (BuildContext builderContext) {
          _restTimer = Timer(Duration(seconds: totalRestTime), () {
            Navigator.of(context).pop();
          });

          return AlertDialog(
            backgroundColor: AppStyles.primaryColor,
            content: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                Text('REST',
                    textAlign: TextAlign.center,
                    style: TextStyle(
                        color: Colors.white, fontSize: SizeConfig.font20)),
                SizedBox(height: SizeConfig.height20),
                StreamBuilder<int>(
                    stream: _restEvents.stream,
                    builder:
                        (BuildContext context, AsyncSnapshot<int> snapshot) {
                      return Text('${snapshot.data.toString()}',
                          textAlign: TextAlign.center,
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: SizeConfig.font50));
                    }),
              ],
            ),
          );
        }).then((_) {
      print("Next Set Starting");
      setState(() {
        currentRepNo = 0;
        currentRestTime = int.parse(widget.exercise[currentExerciseIndex].rest
            .replaceAll(new RegExp(r'[^0-9]'), ''));
        startExercise();
      });
      _restTimer.cancel();
    });
  }

  void startExercise() {
    const oneSec = const Duration(seconds: 2);
    new Timer.periodic(
      oneSec,
      (Timer timer) {
        if (currentRepNo == totalNoOfReps) {
          setState(() {
            timer.cancel();
            startRestTimer();
            currentSetNo++;

            if (currentSetNo == totalNoOfSets) {
              currentExerciseIndex++;
            }
          });
        } else {
          setState(() {
            currentRepNo++;
          });
        }
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.blueGrey[100],
      appBar: AppBar(
        backgroundColor: AppStyles.primaryDark,
        leading: GestureDetector(
            onTap: () => Get.back(),
            child: Icon(FontAwesomeIcons.xmark,
                color: AppStyles.appSecondaryColor)),
      ),
      body: Column(children: [
        Image.network(widget.exercise[currentExerciseIndex].image),
        SizedBox(height: SizeConfig.height20),
        TitleTextWidget(
            titleText: widget.exercise[currentExerciseIndex].title,
            titleSize: SizeConfig.font25,
            titleTextMaxLines: 3),
        SizedBox(height: SizeConfig.height50),
        Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
          Column(children: [
            Row(children: [
              TitleTextWidget(
                titleText: ("$currentRepNo"),
                titleSize: SizeConfig.font80,
              ),
              Text("/", style: TextStyle(fontSize: SizeConfig.font80)),
              DescriptionTextWidget(
                  descriptionText: widget.exercise[currentExerciseIndex].reps,
                  descriptionSize: SizeConfig.font80,
                  fontFamily: 'Raleway'),
            ]),
            SizedBox(height: SizeConfig.height20),
            DescriptionTextWidget(
                descriptionText: 'Reps',
                fontFamily: 'Raleway',
                descriptionSize: SizeConfig.font30)
          ]),
          Column(children: [
            Row(children: [
              TitleTextWidget(
                titleText: currentSetNo.toString(),
                titleSize: SizeConfig.font80,
              ),
              Text("/", style: TextStyle(fontSize: SizeConfig.font80)),
              DescriptionTextWidget(
                  descriptionText: widget.exercise[currentExerciseIndex].sets,
                  descriptionSize: SizeConfig.font80,
                  fontFamily: 'Raleway'),
            ]),
            SizedBox(height: SizeConfig.height20),
            DescriptionTextWidget(
                descriptionText: 'Sets',
                fontFamily: 'Raleway',
                descriptionSize: SizeConfig.font30)
          ])
        ]),
        SizedBox(height: SizeConfig.height30),
        GestureDetector(
          onTap: () {
            _showStartupDialog();
            Future.delayed(const Duration(seconds: 10), () {
              startExercise();
            });
          },
          child: Container(
            height: SizeConfig.height70,
            width: double.maxFinite,
            margin: EdgeInsets.symmetric(
                horizontal: SizeConfig.width20, vertical: SizeConfig.height5),
            decoration: BoxDecoration(
                color: AppStyles.primaryColor,
                borderRadius: BorderRadius.circular(
                  SizeConfig.radius15,
                )),
            child: Padding(
              padding: EdgeInsets.symmetric(
                  horizontal: SizeConfig.width40,
                  vertical: SizeConfig.height10),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Icon(FontAwesomeIcons.play, color: Colors.white),
                  SizedBox(width: SizeConfig.width10),
                  Text(
                    "Start",
                    style: TextStyle(
                        color: Colors.white,
                        fontSize: SizeConfig.font25,
                        fontWeight: FontWeight.w500),
                  ),
                ],
              ),
            ),
          ),
        )
      ]),
    );
  }
}

</code>```

ContentLicense: CC BY-SA 4.0

Body:
I'm working on a Flutter Workout App and I'm having some issues implementing the Workout Sequence and Timer.

I was able to implement the auto countdown and workout sequence however, the countdown skips numbers between and the workout sequence runs only for the first 2 sets.

For example, if an exercise has 4 sets, the cycle only runs for the first two and it's glitchy. I need help with optimized code to help me achieve the workout sequence

JSON DATA

{
    "data": {
        "day1": [
            {
                "id": 1,
                "title": "Reclining Triceps Press",
                "equipment": "Pull Up Bar",
                "level": "Beginner",
                "reps": "15",
                "rest": "45 Seconds",
                "sets": "4",
                "image": "https://wicombit.com/demo/fitpro/images/exercise_1519941887.jpg",
                "video": null,
            },
            {
                "id": 10,
                "title": "Plank with Arm Raise",
                "equipment": "Pull Up Bar",
                "level": "Intermediate",
                "reps": "12",
                "rest": "30 Seconds",
                "sets": "3",
                "image": "https://wicombit.com/demo/fitpro/images/exercise_1519938568.jpg",
                "video": null,
            },
            {
                "id": 3,
                "title": "90-degree Static Hold",
                "equipment": "Pull Up Bar",
                "level": "Beginner",
                "reps": "12",
                "rest": "45 Seconds",
                "sets": "3",
                "image": "https://wicombit.com/demo/fitpro/images/exercise_1519940878.jpg",
                "video": null,
            },
            {
                "id": 5,
                "title": "Single-arm Medicine Ball Pushup",
                "equipment": "Kettlebells",
                "level": "Elite",
                "reps": "8",
                "rest": "45 Seconds",
                "sets": "3",
                "image": "https://wicombit.com/demo/fitpro/images/exercise_1519940316.jpg",
                "video": null,
                "status": "draft"
            }
        ],
    }
}

I have tried the below implementation but not getting the results I want.

Dart Implementation

class WorkouStartSequenceScreen extends StatefulWidget {
  final exercise;

  WorkouStartSequenceScreen({super.key, required this.exercise});

  @override
  State<WorkouStartSequenceScreen> createState() =>
      _WorkouStartSequenceScreenState();
}

class _WorkouStartSequenceScreenState extends State<WorkouStartSequenceScreen> {
  late Timer _startTimer;
  late Timer _restTimer;
  late int totalNoOfExercisesInDay;
  int currentExerciseIndex = 0;
  late int totalNoOfSets;
  late int totalNoOfReps;
  late int totalRestTime;
  int currentSetNo = 0;
  int currentRepNo = 0;
  int currentRestTime = 0;
  bool dayWorkoutComplete = false;
  int startUpCountdown = 10;
  StreamController<int> _startEvents = BehaviorSubject();
  StreamController<int> _restEvents = BehaviorSubject();

  @override
  void initState() {
    totalNoOfExercisesInDay = widget.exercise.length;
    totalNoOfReps = int.parse(widget.exercise[currentExerciseIndex].reps);
    totalNoOfSets = int.parse(widget.exercise[currentExerciseIndex].sets);
    totalRestTime = int.parse(widget.exercise[currentExerciseIndex].rest
        .replaceAll(new RegExp(r'[^0-9]'), ''));
    currentRestTime = totalRestTime;
    _startEvents.add(startUpCountdown);

    super.initState();
  }

  @override
  void dispose() {
    _startTimer.cancel();
    _restTimer.cancel();
    // _startEvents.close();
    // _restEvents.close();
    super.dispose();
  }

  void _showStartupDialog() async {
    _startTimer = Timer.periodic(Duration(seconds: 1), (timer) {
      (startUpCountdown > 0) ? startUpCountdown-- : _startTimer.cancel();

      _startEvents.add(startUpCountdown);
    });

    showDialog(
        context: context,
        barrierDismissible: false,
        builder: (BuildContext builderContext) {
          _startTimer = Timer(Duration(seconds: 10), () {
            Navigator.of(context).pop();
          });

          return AlertDialog(
            backgroundColor: AppStyles.primaryColor,
            content: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                Text('Your workout starts in',
                    textAlign: TextAlign.center,
                    style: TextStyle(
                        color: Colors.white, fontSize: SizeConfig.font20)),
                SizedBox(height: SizeConfig.height20),
                StreamBuilder<int>(
                    stream: _startEvents.stream,
                    builder:
                        (BuildContext context, AsyncSnapshot<int> snapshot) {
                      return Text('${snapshot.data.toString()}',
                          textAlign: TextAlign.center,
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: SizeConfig.font50));
                    }),
              ],
            ),
          );
        }).then((val) {
      if (_startTimer.isActive) {
        _startTimer.cancel();
      }
    });
  }

  void startRestTimer() async {
    _restTimer = Timer.periodic(Duration(seconds: 1), (timer) {
      (currentRestTime > 0) ? currentRestTime-- : _restTimer.cancel();

      _restEvents.add(currentRestTime);
    });

    showDialog(
        context: context,
        barrierDismissible: false,
        builder: (BuildContext builderContext) {
          _restTimer = Timer(Duration(seconds: totalRestTime), () {
            Navigator.of(context).pop();
          });

          return AlertDialog(
            backgroundColor: AppStyles.primaryColor,
            content: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                Text('REST',
                    textAlign: TextAlign.center,
                    style: TextStyle(
                        color: Colors.white, fontSize: SizeConfig.font20)),
                SizedBox(height: SizeConfig.height20),
                StreamBuilder<int>(
                    stream: _restEvents.stream,
                    builder:
                        (BuildContext context, AsyncSnapshot<int> snapshot) {
                      return Text('${snapshot.data.toString()}',
                          textAlign: TextAlign.center,
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: SizeConfig.font50));
                    }),
              ],
            ),
          );
        }).then((_) {
      print("Next Set Starting");
      setState(() {
        currentRepNo = 0;
        currentRestTime = int.parse(widget.exercise[currentExerciseIndex].rest
            .replaceAll(new RegExp(r'[^0-9]'), ''));
        startExercise();
      });
      _restTimer.cancel();
    });
  }

  void startExercise() {
    const oneSec = const Duration(seconds: 2);
    new Timer.periodic(
      oneSec,
      (Timer timer) {
        if (currentRepNo == totalNoOfReps) {
          setState(() {
            timer.cancel();
            startRestTimer();
            currentSetNo++;

            if (currentSetNo == totalNoOfSets) {
              currentExerciseIndex++;
            }
          });
        } else {
          setState(() {
            currentRepNo++;
          });
        }
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.blueGrey[100],
      appBar: AppBar(
        backgroundColor: AppStyles.primaryDark,
        leading: GestureDetector(
            onTap: () => Get.back(),
            child: Icon(FontAwesomeIcons.xmark,
                color: AppStyles.appSecondaryColor)),
      ),
      body: Column(children: [
        Image.network(widget.exercise[currentExerciseIndex].image),
        SizedBox(height: SizeConfig.height20),
        TitleTextWidget(
            titleText: widget.exercise[currentExerciseIndex].title,
            titleSize: SizeConfig.font25,
            titleTextMaxLines: 3),
        SizedBox(height: SizeConfig.height50),
        Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
          Column(children: [
            Row(children: [
              TitleTextWidget(
                titleText: ("$currentRepNo"),
                titleSize: SizeConfig.font80,
              ),
              Text("/", style: TextStyle(fontSize: SizeConfig.font80)),
              DescriptionTextWidget(
                  descriptionText: widget.exercise[currentExerciseIndex].reps,
                  descriptionSize: SizeConfig.font80,
                  fontFamily: 'Raleway'),
            ]),
            SizedBox(height: SizeConfig.height20),
            DescriptionTextWidget(
                descriptionText: 'Reps',
                fontFamily: 'Raleway',
                descriptionSize: SizeConfig.font30)
          ]),
          Column(children: [
            Row(children: [
              TitleTextWidget(
                titleText: currentSetNo.toString(),
                titleSize: SizeConfig.font80,
              ),
              Text("/", style: TextStyle(fontSize: SizeConfig.font80)),
              DescriptionTextWidget(
                  descriptionText: widget.exercise[currentExerciseIndex].sets,
                  descriptionSize: SizeConfig.font80,
                  fontFamily: 'Raleway'),
            ]),
            SizedBox(height: SizeConfig.height20),
            DescriptionTextWidget(
                descriptionText: 'Sets',
                fontFamily: 'Raleway',
                descriptionSize: SizeConfig.font30)
          ])
        ]),
        SizedBox(height: SizeConfig.height30),
        GestureDetector(
          onTap: () {
            _showStartupDialog();
            Future.delayed(const Duration(seconds: 10), () {
              startExercise();
            });
          },
          child: Container(
            height: SizeConfig.height70,
            width: double.maxFinite,
            margin: EdgeInsets.symmetric(
                horizontal: SizeConfig.width20, vertical: SizeConfig.height5),
            decoration: BoxDecoration(
                color: AppStyles.primaryColor,
                borderRadius: BorderRadius.circular(
                  SizeConfig.radius15,
                )),
            child: Padding(
              padding: EdgeInsets.symmetric(
                  horizontal: SizeConfig.width40,
                  vertical: SizeConfig.height10),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Icon(FontAwesomeIcons.play, color: Colors.white),
                  SizedBox(width: SizeConfig.width10),
                  Text(
                    "Start",
                    style: TextStyle(
                        color: Colors.white,
                        fontSize: SizeConfig.font25,
                        fontWeight: FontWeight.w500),
                  ),
                ],
              ),
            ),
          ),
        )
      ]),
    );
  }
}


问:
why am i getting this cloudflare error on replit?
I am getting this cloudflare error

Things I have tried :

1.) running kill 1 in shell

2.) regenerating token

3.) created a new application on discord developer portal

but it didn't work

also, I am using uptimerobot to keep my bot running


问:
How to catch main error of SSR Angular App
My SSR Angular application closes randomly. In order to fix it, I created a LogService and I'm trying to catch the main error and store it in Mysql database, but I don't know exactly where I have to create the try/catch code (AppComponent? Home? ..). Can you please help me and if possible show me an example.
Thank you.</p>


问:
How can i fix error LNK2038 after adding tinyxml2?
I have a project that compiles normally and i need to use tinyxml2 library in it, but when i add it there appears 2 linking errors

```<code>Error LNK2038 mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2'
error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug'
</code>```

i can't say for sure, but maybe thats msvc-only issue because i never was facing such problem in clang

Body:
I have a project that compiles normally and i need to use tinyxml2 library in it, but when i add it there appears 2 linking errors

Error LNK2038 mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2'
error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug'

i can't say for sure, but maybe thats msvc-only issue because i never was facing such problem in clang


问:
APNS device token not set before retrieving FCM Token for Sender ID ''. Notifications to this FCM Token will not be delievered over APNS. - IOS
I am trying to enable push notifications using firebase and this is the document I referred. I followed everything till the end of step 4.

This is my PushNotificationManager.swift file

```<code>import Foundation
import FirebaseFirestore
import FirebaseMessaging
import UIKit
import UserNotifications
import FirebaseCore

class PushNotificationManager: NSObject, MessagingDelegate, UNUserNotificationCenterDelegate {
    let userID: String
    init(userID: String) {
        self.userID = userID
        super.init()
    }
    func registerForPushNotifications() {
        if #available(iOS 10.0, *) {
            // For iOS 10 display notification (sent via APNS)

            UNUserNotificationCenter.current().delegate = self
            let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
            UNUserNotificationCenter.current().requestAuthorization(
                options: authOptions,
                completionHandler: {_, _ in })
            // For iOS 10 data message (sent via FCM)
            Messaging.messaging().delegate = self

        } else {
            let settings: UIUserNotificationSettings =
                UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
            UIApplication.shared.registerUserNotificationSettings(settings)
        }
        UIApplication.shared.registerForRemoteNotifications()
        updateFirestorePushTokenIfNeeded()
    }
    func updateFirestorePushTokenIfNeeded() {
        if let token = Messaging.messaging().fcmToken {
            let usersRef = Firestore.firestore().collection("users_table").document(userID)
            usersRef.setData(["fcmToken": token], merge: true)
            print(token)
        }
    }
//    func messaging(_ messaging: Messaging, didReceive remoteMessage: MessagingRemoteMessage) {
//        print(remoteMessage.appData)
//    }
    func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
        updateFirestorePushTokenIfNeeded()
    }
    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
        print(response)
    }
    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        print("Registered for Apple Remote Notifications")
        Messaging.messaging().setAPNSToken(deviceToken, type: .unknown)
    }

}
</code>```

This is the AppDelegate.m

```<code>mport UIKit
import FirebaseCore
import FirebaseAuth
import FirebaseFirestore
import FirebaseMessaging

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        FirebaseApp.configure()
        let db = Firestore.firestore()
        let pushManager = PushNotificationManager(userID: "currently_logged_in_user_id")
        pushManager.registerForPushNotifications()

        if #available(iOS 10.0, *) {
            UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
           }

        application.registerForRemoteNotifications()

        return true
    }

    // MARK: UISceneSession Lifecycle

    func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
        // Called when a new scene session is being created.
        // Use this method to select a configuration to create the new scene with.
        return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
    }

    func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
        // Called when the user discards a scene session.
        // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
        // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
    }

}
</code>```

Even though I am getting the FCM token printed as per the print statement in PushNotificationManager.swift. However I am getting the following in the console

APNS device token not set before retrieving FCM Token for Sender ID 'XXXXXXXXX'. Notifications to this FCM Token will not be delivered over APNS.Be sure to re-retrieve the FCM token once the APNS device token is set.

I have tried all the solutions mentioned on this post however I am not able to get past the error. Can someone tell me what I could be missing.

Body:
I am trying to enable push notifications using firebase and this is the document I referred. I followed everything till the end of step 4.

This is my PushNotificationManager.swift file

import Foundation
import FirebaseFirestore
import FirebaseMessaging
import UIKit
import UserNotifications
import FirebaseCore

class PushNotificationManager: NSObject, MessagingDelegate, UNUserNotificationCenterDelegate {
    let userID: String
    init(userID: String) {
        self.userID = userID
        super.init()
    }
    func registerForPushNotifications() {
        if #available(iOS 10.0, *) {
            // For iOS 10 display notification (sent via APNS)

            UNUserNotificationCenter.current().delegate = self
            let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
            UNUserNotificationCenter.current().requestAuthorization(
                options: authOptions,
                completionHandler: {_, _ in })
            // For iOS 10 data message (sent via FCM)
            Messaging.messaging().delegate = self

        } else {
            let settings: UIUserNotificationSettings =
                UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
            UIApplication.shared.registerUserNotificationSettings(settings)
        }
        UIApplication.shared.registerForRemoteNotifications()
        updateFirestorePushTokenIfNeeded()
    }
    func updateFirestorePushTokenIfNeeded() {
        if let token = Messaging.messaging().fcmToken {
            let usersRef = Firestore.firestore().collection("users_table").document(userID)
            usersRef.setData(["fcmToken": token], merge: true)
            print(token)
        }
    }
//    func messaging(_ messaging: Messaging, didReceive remoteMessage: MessagingRemoteMessage) {
//        print(remoteMessage.appData)
//    }
    func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
        updateFirestorePushTokenIfNeeded()
    }
    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
        print(response)
    }
    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        print("Registered for Apple Remote Notifications")
        Messaging.messaging().setAPNSToken(deviceToken, type: .unknown)
    }

}

This is the AppDelegate.m

mport UIKit
import FirebaseCore
import FirebaseAuth
import FirebaseFirestore
import FirebaseMessaging

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        FirebaseApp.configure()
        let db = Firestore.firestore()
        let pushManager = PushNotificationManager(userID: "currently_logged_in_user_id")
        pushManager.registerForPushNotifications()

        if #available(iOS 10.0, *) {
            UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
           }

        application.registerForRemoteNotifications()

        return true
    }

    // MARK: UISceneSession Lifecycle

    func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
        // Called when a new scene session is being created.
        // Use this method to select a configuration to create the new scene with.
        return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
    }

    func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
        // Called when the user discards a scene session.
        // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
        // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
    }

}

Even though I am getting the FCM token printed as per the print statement in PushNotificationManager.swift. However I am getting the following in the console

APNS device token not set before retrieving FCM Token for Sender ID 'XXXXXXXXX'. Notifications to this FCM Token will not be delivered over APNS.Be sure to re-retrieve the FCM token once the APNS device token is set.

I have tried all the solutions mentioned on this post however I am not able to get past the error. Can someone tell me what I could be missing.


问:
Switch user in Azure B2C without password
Is there a way to switch the user account inside a group of users in azure b2c? The goal is to have a ux similiar to the netflix or disney+ family account feature.</p>


问:
Output error when i run app.js from vscode,in a simple example react app
i'm using vscode to run an example of react-app , If i use npm start in terminal the react app goes well

But If I run app.js using Code Runner extension Button,it gave me this error output:

```<code>{import React from 'react';
^^^^^^

SyntaxError: Cannot use import statement outside a module.
}

If I add "type":"module" to package.json the error change to:

{
  <div className="App">
    ^

SyntaxError: Unexpected token '<'
    at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:119:18)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:468:14)
    at async link (node:internal/modules/esm/module_job:67:21)
}

I also tried to re-install node_modules and change .js files in .mjs but nothin changed

I also tried debugging but the error was still there

If i use npm start in terminal the app goes well

Thanks in advance
</code>```

Body:
i'm using vscode to run an example of react-app , If i use npm start in terminal the react app goes well

But If I run app.js using Code Runner extension Button,it gave me this error output:

{import React from 'react';
^^^^^^

SyntaxError: Cannot use import statement outside a module.
}

If I add "type":"module" to package.json the error change to:

{

    ^

SyntaxError: Unexpected token '<'
    at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:119:18)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:468:14)
    at async link (node:internal/modules/esm/module_job:67:21)
}

I also tried to re-install node_modules and change .js files in .mjs but nothin changed

I also tried debugging but the error was still there

If i use npm start in terminal the app goes well

Thanks in advance


问:
How to display type alias in function description instead of all properties when extending an interface?
Using Typescript, is it possible to "hide" some properties under a type alias for more readable mouseover description?

I'm building a react component extending the html button element and adding some custom properties, however the mouseover description tries to show all 200+ valid properties and it's not the best experience.

Ideally i would like my custom properties to be highlighted, and display the html button attributes under a type alias for readability

My code :
`

```<code>interface ButtonBase extends Omit<React.ComponentPropsWithRef<"button">, "children"> {
    block?: boolean;
    label?: string;
    icon?: IconOptions | JSX.Element;
    iconDisposition?: "none" | "left" | "right" | "icon-only";
}
type Intention = "primary" | "secondary" | "danger";
interface ButtonContained extends ButtonBase {
    variant?: "contained";
    intention?: Intention;
}
interface ButtonOutlined extends ButtonBase {
    variant: "outlined";
    intention?: Intention;
}
interface ButtonInvisible extends ButtonBase {
    variant: "invisible";
    intention?: Extract<Intention, "primary">;
}
type ButtonProps = ButtonContained | ButtonOutlined | ButtonInvisible;

const Button = forwardRef<HTMLButtonElement, ButtonProps>...
</code>```

`

The mouseover description when using the component:

(alias) const Button: React.ForwardRefExoticComponent<(Pick<ButtonContained, "variant" | "form" | "label" | "slot" | "style" | "title" | "key" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | ... 261 more ... | "iconDisposition"> | Pick<...> | Pick<...>) & React.RefAttributes<...>> import ButtonComponent

What I would like to achieve for the mouseover description:

(alias) const Button: React.ForwardRefExoticComponent<my custom properties & htmlAttributesAlias & React.RefAttributes<...>> import ButtonComponent

Help much appreciated !

Body:
Using Typescript, is it possible to "hide" some properties under a type alias for more readable mouseover description?

I'm building a react component extending the html button element and adding some custom properties, however the mouseover description tries to show all 200+ valid properties and it's not the best experience.

Ideally i would like my custom properties to be highlighted, and display the html button attributes under a type alias for readability

My code :
`

interface ButtonBase extends Omit<React.ComponentPropsWithRef<"button">, "children"> {
    block?: boolean;
    label?: string;
    icon?: IconOptions | JSX.Element;
    iconDisposition?: "none" | "left" | "right" | "icon-only";
}
type Intention = "primary" | "secondary" | "danger";
interface ButtonContained extends ButtonBase {
    variant?: "contained";
    intention?: Intention;
}
interface ButtonOutlined extends ButtonBase {
    variant: "outlined";
    intention?: Intention;
}
interface ButtonInvisible extends ButtonBase {
    variant: "invisible";
    intention?: Extract<Intention, "primary">;
}
type ButtonProps = ButtonContained | ButtonOutlined | ButtonInvisible;

const Button = forwardRef<HTMLButtonElement, ButtonProps>...

`

The mouseover description when using the component:

(alias) const Button: React.ForwardRefExoticComponent<(Pick<ButtonContained, "variant" | "form" | "label" | "slot" | "style" | "title" | "key" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | ... 261 more ... | "iconDisposition"> | Pick<...> | Pick<...>) & React.RefAttributes<...>> import ButtonComponent

What I would like to achieve for the mouseover description:

(alias) const Button: React.ForwardRefExoticComponent<my custom properties & htmlAttributesAlias & React.RefAttributes<...>> import ButtonComponent

Help much appreciated !


问:
Print array of all valute of custom filed in variable products in woocommerce
I have a custom field containing a number for variable products.
Each variant has a "custom_price" field.

How do I print an array containing all "custom_price" then the indicated custom fields of a variable product?

In particular, this would help me find the minimum custom field value set for a product in its variants.


问:
A Python code used to get the parent message of a slack thread not working
I wanted to make an API call to get the parent message of a thread using the thread ID on zapier

This is the code I got by chatgpt to do that, I am getting a no output error and I am not sure why it happens

```<code>    import requests

def main(input_data):
    # Set the API endpoint, headers, and Slack API token for the request
    api_endpoint = "https://slack.com/api/conversations.replies"
    headers = {
        "Authorization": "Bearer xoxb-3482548707638-4570295651095-8J4mDrROrcYV0U3L5FZhJtTf",
        "Content-Type": "application/json; charset=utf-8"
    }
    slack_api_token = "xoxb-3482548707638-4570295651095-8J4mDrROrcYV0U3L5FZhJtTf"

    # Set the request parameters
    params = {
        "channel": input_data["thread_id"],
        "ts": input_data["thread_id"],
        "inclusive": "true",
        "limit": 1
    }

    # Make a GET request to the API endpoint
    response = requests.get(api_endpoint, headers=headers, params=params)

    # Get the first message in the result
    message = response.json()["messages"][0]

    # Print the message text to the console
    print(message["text"])
</code>```

This my first time working with API's or code, so I am pretty sure I mus have done something stupid. Could anyone point out what I did wrong

PS: After this, what should I learn to operate such codes, I find this interesting

Body:
I wanted to make an API call to get the parent message of a thread using the thread ID on zapier

This is the code I got by chatgpt to do that, I am getting a no output error and I am not sure why it happens

    import requests

def main(input_data):
    # Set the API endpoint, headers, and Slack API token for the request
    api_endpoint = "https://slack.com/api/conversations.replies"
    headers = {
        "Authorization": "Bearer xoxb-3482548707638-4570295651095-8J4mDrROrcYV0U3L5FZhJtTf",
        "Content-Type": "application/json; charset=utf-8"
    }
    slack_api_token = "xoxb-3482548707638-4570295651095-8J4mDrROrcYV0U3L5FZhJtTf"

    # Set the request parameters
    params = {
        "channel": input_data["thread_id"],
        "ts": input_data["thread_id"],
        "inclusive": "true",
        "limit": 1
    }

    # Make a GET request to the API endpoint
    response = requests.get(api_endpoint, headers=headers, params=params)

    # Get the first message in the result
    message = response.json()["messages"][0]

    # Print the message text to the console
    print(message["text"])

This my first time working with API's or code, so I am pretty sure I mus have done something stupid. Could anyone point out what I did wrong

PS: After this, what should I learn to operate such codes, I find this interesting


问:
Morris.js Uncaught TypeError: Cannot read properties of undefined (reading 'length')
I am new to php and javascript and i am working on a project where i need to implement the graph in my webpage but i am getting this error morris.min.js:6 Uncaught TypeError: Cannot read properties of undefined (reading 'length') and I am unable to find the solution

```<code>html code
<!DOCTYPE html><html lang="en">
<head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><link rel="stylesheet" href="../Css/AdminDashboard.css"><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.css">2 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>3 <script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>4 <script src="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js">
</script>
</head>
<body><div class="bookingsGraph">
<div id="chart">
</div>
</div>
</body>
</html>
</code>```

```<code><script>
    Morris.Line({
        element: 'chart',
        data: [<?php echo $chart_data; ?>],
        xkey: 'date',
        ykey: ['bookings'],
        labels: ['Bookings'],
        // hideHover: 'auto',
        // stacked: true

    });
</script>
</code>```

php code

```<code><?php
$connect = mysqli_connect("localhost", "root", "", "movietime");
$query = "SELECT COUNT(BookingId),BookingDate
FROM bookings
WHERE BookingDate='2019/12/13'";
$result = mysqli_query($connect, $query);
$chart_data = '';
while($row = mysqli_fetch_array($result))
{

  $chart_data .= "{ date:'".$row["BookingDate"]."', bookings:".$row["COUNT(BookingId)"]."}, ";
}
 $chart_data = substr($chart_data, 0, -2);
?>
</code>```

complete errror

```<code>morris.min.js:6 Uncaught TypeError: Cannot read properties of undefined (reading 'length')
    at c.<anonymous> (morris.min.js:6:4567)
    at c.<anonymous> (morris.min.js:6:4834)
    at d.setData (morris.min.js:6:4865)
    at c.d [as constructor] (morris.min.js:6:1739)
    at new c (morris.min.js:6:13513)
    at Object.c [as Line] (morris.min.js:6:13534)
    at AdminDashboard.php:114:12
</code>```

I have tried

```<code>Morris.Line({
    element: 'chart',
    data: [{date:'2019/12/13',bookings:'6'}],
    xkey: 'date',
    ykey: ['bookings'],
    labels: ['Bookings'],
    // hideHover: 'auto',
    // stacked: true

});
</code>```

Body:
I am new to php and javascript and i am working on a project where i need to implement the graph in my webpage but i am getting this error morris.min.js:6 Uncaught TypeError: Cannot read properties of undefined (reading 'length') and I am unable to find the solution

html code
<!DOCTYPE html>
<meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><link rel="stylesheet" href="../Css/AdminDashboard.css"><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.css">2 3 4

php code

<?php
$connect = mysqli_connect("localhost", "root", "", "movietime");
$query = "SELECT COUNT(BookingId),BookingDate
FROM bookings
WHERE BookingDate='2019/12/13'";
$result = mysqli_query($connect, $query);
$chart_data = '';
while($row = mysqli_fetch_array($result))
{

  $chart_data .= "{ date:'".$row["BookingDate"]."', bookings:".$row["COUNT(BookingId)"]."}, ";
}
 $chart_data = substr($chart_data, 0, -2);
?>

complete errror

morris.min.js:6 Uncaught TypeError: Cannot read properties of undefined (reading 'length')
    at c.<anonymous> (morris.min.js:6:4567)
    at c.<anonymous> (morris.min.js:6:4834)
    at d.setData (morris.min.js:6:4865)
    at c.d [as constructor] (morris.min.js:6:1739)
    at new c (morris.min.js:6:13513)
    at Object.c [as Line] (morris.min.js:6:13534)
    at AdminDashboard.php:114:12

I have tried

Morris.Line({
    element: 'chart',
    data: [{date:'2019/12/13',bookings:'6'}],
    xkey: 'date',
    ykey: ['bookings'],
    labels: ['Bookings'],
    // hideHover: 'auto',
    // stacked: true

});


问:
I am unable to use this gTTS module and I can't hear any text in my speakers and it's also showing me adobe reader dialogue
I have added the image for better understanding:

The code

```<code>from gtts import gTTS
import os

mytext = "Hi, this is an example of converting text to audio. This is a bot speaking here, not a real human!"
audio = gTTS(text=mytext, lang="en", slow=False)

audio.save("example.mp3")
os.system("start hello.mp3")
</code>```

I don't know what to do as I am new to programming and I have used pyttsx3 module and it worked. But I want to be able to use gTTS.

Body:
I have added the image for better understanding:

The code

from gtts import gTTS
import os

mytext = "Hi, this is an example of converting text to audio. This is a bot speaking here, not a real human!"
audio = gTTS(text=mytext, lang="en", slow=False)

audio.save("example.mp3")
os.system("start hello.mp3")

I don't know what to do as I am new to programming and I have used pyttsx3 module and it worked. But I want to be able to use gTTS.


问:
Merge two columns keep both matching and non-matching columns
I'm super-basic with Pandas and I'm hoping there is an easy Pandas solution with merge?  Is there a way to merge two dataframes and keep both matching and non-matching rows?
DF1

DF2

Output


问:
Xcode target dependency on other target's build rule's output
I have an Xcode project with in it one 'core' target (a static lib) and 130+ small 'extended' targets (all executables).  These extended targets all have a dependency on the core target.

I also have a single .xml file that needs to be processed into a C++ .h file, and this generated .h file is needed by cpp files in all targets (core and extended).  I also need this generated file to be located next to the .xml file itself for inclusion in Git.

I added a custom build rule to the core target to process the .xml file.  As it's custom script I invoke a custom binary that does the conversion, and in the output files section I list the resulting .h file's path.  When I then change the .xml file, Xcode calls the build rule before compiling the cpp files in the core target.  So far so good.

But (presumably due to Xcode's 'new build system'), Xcode compiles all cpp files in the extended targets in parallel with the core target (sometimes even before them).  This should normally work fine because the extended targets normally only need the resulting .o file from the core target, so if they only wait for core's linking phase to complete before they start linking themselves that should work.  But in my case, all cpp files in the extended targets that get compiled before the core target has had a chance to convert the .xml file will see an outdated generated .h file.  A second compile then fixes all errors resulting from this.

How can I tell Xcode that the generated .h file in the core target's build script is also relevant to the extended targets?

I duplicated the same build rule to all extended targets (which I really hate because it introduces a lot of clutter to my project file), but that weirdly didn't change Xcode's behavior at all.

An other alternative would be to uncheck 'Paralellize Build' from the scheme so that Xcode is forced to first fully compile and link core, but I definitely do not want to give up on building all extended targets themselves in parallel.

What other options do I have?


问:
Add PJSIP header on inbound channel
I am trying to add PJSIP header in asterisk in node.js but headers are not setting.

```<code>await new Promise((resolve, reject) => {

    incoming.setChannelVar(
        {variable: 'PJSIP_HEADER(add,X-header)', value: '12423'},
        function (err) {
            if (err) {
                console_log(3, "SET-VAR ERROR", err);
            }
            resolve('done');
        }
    );
    }).catch(function (e) {
        console.log('Catch Error in executing setChanVar: ');
    });
</code>```

As per Asterisk document we can only add PJSIP header on outbound channel
Asterisk Wiki

Is there any alternate solution?

Title: Add PJSIP header on inbound channel

Body:
I am trying to add PJSIP header in asterisk in node.js but headers are not setting.

await new Promise((resolve, reject) => {

    incoming.setChannelVar(
        {variable: 'PJSIP_HEADER(add,X-header)', value: '12423'},
        function (err) {
            if (err) {
                console_log(3, "SET-VAR ERROR", err);
            }
            resolve('done');
        }
    );
    }).catch(function (e) {
        console.log('Catch Error in executing setChanVar: ');
    });

As per Asterisk document we can only add PJSIP header on outbound channel
Asterisk Wiki

Is there any alternate solution?


问:
AppFlow Amazon Connector WebHook
Is it possible to create a flow using AWS AppFlow that relies on a connector, created using the custom connector SDK, that is launched on event and more particularly on a webhook event.
I did not find any information on the subject in github of the custom connector SDK.
https://github.com/awslabs/aws-appflow-custom-connector-python

Thanks in advance

I looked at the github documentation: https://github.com/awslabs/aws-appflow-custom-connector-python

Title: AppFlow Amazon Connector WebHook


问:
How do I translate barcode location to millimeters on page?
IronBarCode recently added coordinates (X1, X2, Y1, Y2) to their BarcodeResult class.
Unfortunately there is no documentation on how to translate these coordinates to sth usefull like "millimeters from left page border".
Do you have any ideas on how to do that?</p>


问:
How can I make a get request for html content in react js?
If I make this GET request in postman I get HTML content as a response, but when I make it in Reactjs I get an ERROR.

Here what I get from postman.

Here I show how I make the request in react

I share the url to which I´m trying to make the request  "

```<code>https://www.rumboacanada.com/art1.php
</code>```

"

Make the GET request

and i get error

Thank you for your suggestions or comments.

Body:
If I make this GET request in postman I get HTML content as a response, but when I make it in Reactjs I get an ERROR.

Here what I get from postman.

Here I show how I make the request in react

I share the url to which I´m trying to make the request  "

https://www.rumboacanada.com/art1.php

"

Make the GET request

and i get error

Thank you for your suggestions or comments.


问:
I’m using RN-fetchblob for downloading files and Pictures but the swipeable does not change language when i change it on my IOS device
Swipe-able of RN-fetchBlob

'Picture is attached above'

Problem: problem is that it does not change the language when i change my language on my IOS device in settings and as well as on my Simulator.
Actually my app is in two languages English and Spanish so i want that my React native Fetch Blob should change the language of the Swipe-able when i change in my phone setting

i search inside the whole library files but that doesn’t help.


问:
better player doesn't work when compiling release.apk version - Flutter
I'm using the better_player library and when I compile the application using the debug.apk version the videos work correctly, since the release.apk file the video player does not work. Does anyone know how to tell me if it's some setting? Or which files should I look at.
Version: better_player 0.0.83

I tried to follow these multidex settings:
https://developer.android.com/studio/build/multidex#kts

Configurations:

```<code>defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.br.sistematutor.tutor"
        minSdkVersion 21
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled = true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    implementation "androidx.multidex:multidex:2.0.1"
    // compile "commons-io:commons-io:+"
}
</code>```

AndroidManifest

```<code><manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.br.sistematutor.tutor">

    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
   <application
        android:label="@string/app_name"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

</code>```

Body:
I'm using the better_player library and when I compile the application using the debug.apk version the videos work correctly, since the release.apk file the video player does not work. Does anyone know how to tell me if it's some setting? Or which files should I look at.
Version: better_player 0.0.83

I tried to follow these multidex settings:
https://developer.android.com/studio/build/multidex#kts

Configurations:

defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.br.sistematutor.tutor"
        minSdkVersion 21
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled = true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    implementation "androidx.multidex:multidex:2.0.1"
    // compile "commons-io:commons-io:+"
}

AndroidManifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.br.sistematutor.tutor">

    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
   <application
        android:label="@string/app_name"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>


问:
Problem while playing video from S3 via AVPlayer
While streaming from s3, AVPlayerViewController upperbounds the video duration. Let's say video duration is 13.25 seconds, so in AVPlayerViewController the progressbar will display time limit of 14 seconds. Then it pauses for the last second and doesn't load anymore. It is expected too since there is no data. Here's the image of it.

Image here.

```<code>let asset = AVURLAsset(url: URL(string: fileUrl)!)
            let playerItem = AVPlayerItem(asset: asset)
            let player = AVPlayer(playerItem: playerItem)
            player.addObserver(strongSelf,  forKeyPath: "timeControlStatus", options: [.old, .new], context: nil)
            strongSelf.globalPlayer = player
            let playerViewController = AVPlayerViewController()
            playerViewController.player = player
            playerViewController.view.frame = frame
</code>```

This is code that I am using for AVPlayerViewController. I wanted to know how to lowerbound the duration of the video as it generally happens. Thanks in advance.

Body:
While streaming from s3, AVPlayerViewController upperbounds the video duration. Let's say video duration is 13.25 seconds, so in AVPlayerViewController the progressbar will display time limit of 14 seconds. Then it pauses for the last second and doesn't load anymore. It is expected too since there is no data. Here's the image of it.

Image here.

let asset = AVURLAsset(url: URL(string: fileUrl)!)
            let playerItem = AVPlayerItem(asset: asset)
            let player = AVPlayer(playerItem: playerItem)
            player.addObserver(strongSelf,  forKeyPath: "timeControlStatus", options: [.old, .new], context: nil)
            strongSelf.globalPlayer = player
            let playerViewController = AVPlayerViewController()
            playerViewController.player = player
            playerViewController.view.frame = frame

This is code that I am using for AVPlayerViewController. I wanted to know how to lowerbound the duration of the video as it generally happens. Thanks in advance.


问:
Can someone help explain how these ostensibly identical tensorflow models produce different results?
I am using a publicly available dataset on physionet to see if physiological data from wearable sensors can be used to predict cognitive performance on an exam. Link to the dataset below

https://physionet.org/content/wearable-exam-stress/1.0.0/

For simplicity sake I am using just accelerometery and EDA as the two inputs into my model. The code for the models is below:

```<code>inputs2=keras.Input(shape=(1,3)) #Accelerometer
y=keras.layers.LSTM(256, return_sequences=True)(inputs2)
y=keras.layers.Dropout(0.5)(y)
y=keras.layers.LSTM(128, return_sequences=True)(y)
y=keras.layers.Dropout(0.5)(y)
y=keras.layers.LSTM(56, return_sequences=True)(y)
y=keras.layers.LSTM(32)(y)

inputs=keras.Input(shape=(1,1)) #EDA
x=keras.layers.LSTM(256, return_sequences=True)(inputs)
x=keras.layers.Dropout(0.5)(x)
x=keras.layers.LSTM(128, return_sequences=True)(x)
x=keras.layers.Dropout(0.5)(x)
x=keras.layers.LSTM(56, return_sequences=True)(x)
x=keras.layers.LSTM(32)(x)

concatenated_tensor = keras.layers.concatenate([y,x])

dense_output=keras.layers.Dense(1, activation='relu')(concatenated_tensor)

model_LSTM_2=keras.Model(inputs=[inputs2,inputs],
                  outputs=dense_output,
                  name='LSTM_2')

model_LSTM_2.compile(optimizer='rmsprop', loss='mse', metrics=['mae'])

model_LSTM_2.summary()
</code>```

Following fitting of this model the history is:

```<code>    786/786 [==============================] - 49s 51ms/step - loss: 0.0195 - mae: 0.1057 - val_loss: 0.0127 - val_mae: 0.0888
Epoch 2/5
786/786 [==============================] - 36s 46ms/step - loss: 0.0127 - mae: 0.0875 - val_loss: 0.0117 - val_mae: 0.0845
Epoch 3/5
786/786 [==============================] - 37s 46ms/step - loss: 0.0118 - mae: 0.0819 - val_loss: 0.0131 - val_mae: 0.0837
Epoch 4/5
786/786 [==============================] - 36s 46ms/step - loss: 0.0113 - mae: 0.0790 - val_loss: 0.0108 - val_mae: 0.0791
Epoch 5/5
786/786 [==============================] - 36s 46ms/step - loss: 0.0111 - mae: 0.0773 - val_loss: 0.0116 - val_mae: 0.0762
</code>```

model_LSTM.evaluate produces a mae of 0.078 and its score predictions range from .57-.97 which logically makes sense given the true range of the scores in the dataset is .55-.94.

However, when I flip the inputs the mae drops significantly:

```<code>inputs=keras.Input(shape=(1,1))
x=keras.layers.LSTM(256, return_sequences=True)(inputs)
x=keras.layers.Dropout(0.5)(x)
x=keras.layers.LSTM(128, return_sequences=True)(x)
x=keras.layers.Dropout(0.5)(x)
x=keras.layers.LSTM(56, return_sequences=True)(x)
x=keras.layers.LSTM(32)(x)

inputs2=keras.Input(shape=(1,3))
y=keras.layers.LSTM(256, return_sequences=True)(inputs2)
y=keras.layers.Dropout(0.5)(y)
y=keras.layers.LSTM(128, return_sequences=True)(y)
y=keras.layers.Dropout(0.5)(y)
y=keras.layers.LSTM(56, return_sequences=True)(y)
y=keras.layers.LSTM(32)(y)

concatenated_tensor = keras.layers.concatenate([x,y])

dense_output=keras.layers.Dense(1, activation='relu')(concatenated_tensor)

model_LSTM_3=keras.Model(inputs=[inputs, inputs2],
                  outputs=dense_output,
                  name='LSTM_3')

model_LSTM_3.compile(optimizer='rmsprop', loss='mse', metrics=['mae'])

model_LSTM_3.summary()

786/786 [==============================] - 49s 51ms/step - loss: 0.0251 - mae: 0.1335 - val_loss: 0.0215 - val_mae: 0.1237
Epoch 2/5
786/786 [==============================] - 38s 48ms/step - loss: 0.0208 - mae: 0.1273 - val_loss: 0.0218 - val_mae: 0.1362
Epoch 3/5
786/786 [==============================] - 38s 49ms/step - loss: 0.0206 - mae: 0.1264 - val_loss: 0.0208 - val_mae: 0.1228
Epoch 4/5
786/786 [==============================] - 37s 47ms/step - loss: 0.0205 - mae: 0.1261 - val_loss: 0.0213 - val_mae: 0.1337
Epoch 5/5
786/786 [==============================] - 37s 47ms/step - loss: 0.0205 - mae: 0.1262 - val_loss: 0.0206 - val_mae: 0.1284
</code>```

The data is identical in both cases, but it appears that the model is only fitting and using the data from the first input since Accelerometer alone and EDA alone produce comparable results to model 1 and model 2 respectively.

Obviously it has something to do with the organization of the model, but I am not really sure what is going on under the hood to create these results or why the two ostensibly identical models aren't producing similar results.

Could someone help explain this?

Body:
I am using a publicly available dataset on physionet to see if physiological data from wearable sensors can be used to predict cognitive performance on an exam. Link to the dataset below

https://physionet.org/content/wearable-exam-stress/1.0.0/

For simplicity sake I am using just accelerometery and EDA as the two inputs into my model. The code for the models is below:

inputs2=keras.Input(shape=(1,3)) #Accelerometer
y=keras.layers.LSTM(256, return_sequences=True)(inputs2)
y=keras.layers.Dropout(0.5)(y)
y=keras.layers.LSTM(128, return_sequences=True)(y)
y=keras.layers.Dropout(0.5)(y)
y=keras.layers.LSTM(56, return_sequences=True)(y)
y=keras.layers.LSTM(32)(y)

inputs=keras.Input(shape=(1,1)) #EDA
x=keras.layers.LSTM(256, return_sequences=True)(inputs)
x=keras.layers.Dropout(0.5)(x)
x=keras.layers.LSTM(128, return_sequences=True)(x)
x=keras.layers.Dropout(0.5)(x)
x=keras.layers.LSTM(56, return_sequences=True)(x)
x=keras.layers.LSTM(32)(x)

concatenated_tensor = keras.layers.concatenate([y,x])

dense_output=keras.layers.Dense(1, activation='relu')(concatenated_tensor)

model_LSTM_2=keras.Model(inputs=[inputs2,inputs],
                  outputs=dense_output,
                  name='LSTM_2')

model_LSTM_2.compile(optimizer='rmsprop', loss='mse', metrics=['mae'])

model_LSTM_2.summary()

Following fitting of this model the history is:

    786/786 [==============================] - 49s 51ms/step - loss: 0.0195 - mae: 0.1057 - val_loss: 0.0127 - val_mae: 0.0888
Epoch 2/5
786/786 [==============================] - 36s 46ms/step - loss: 0.0127 - mae: 0.0875 - val_loss: 0.0117 - val_mae: 0.0845
Epoch 3/5
786/786 [==============================] - 37s 46ms/step - loss: 0.0118 - mae: 0.0819 - val_loss: 0.0131 - val_mae: 0.0837
Epoch 4/5
786/786 [==============================] - 36s 46ms/step - loss: 0.0113 - mae: 0.0790 - val_loss: 0.0108 - val_mae: 0.0791
Epoch 5/5
786/786 [==============================] - 36s 46ms/step - loss: 0.0111 - mae: 0.0773 - val_loss: 0.0116 - val_mae: 0.0762

model_LSTM.evaluate produces a mae of 0.078 and its score predictions range from .57-.97 which logically makes sense given the true range of the scores in the dataset is .55-.94.

However, when I flip the inputs the mae drops significantly:

inputs=keras.Input(shape=(1,1))
x=keras.layers.LSTM(256, return_sequences=True)(inputs)
x=keras.layers.Dropout(0.5)(x)
x=keras.layers.LSTM(128, return_sequences=True)(x)
x=keras.layers.Dropout(0.5)(x)
x=keras.layers.LSTM(56, return_sequences=True)(x)
x=keras.layers.LSTM(32)(x)

inputs2=keras.Input(shape=(1,3))
y=keras.layers.LSTM(256, return_sequences=True)(inputs2)
y=keras.layers.Dropout(0.5)(y)
y=keras.layers.LSTM(128, return_sequences=True)(y)
y=keras.layers.Dropout(0.5)(y)
y=keras.layers.LSTM(56, return_sequences=True)(y)
y=keras.layers.LSTM(32)(y)

concatenated_tensor = keras.layers.concatenate([x,y])

dense_output=keras.layers.Dense(1, activation='relu')(concatenated_tensor)

model_LSTM_3=keras.Model(inputs=[inputs, inputs2],
                  outputs=dense_output,
                  name='LSTM_3')

model_LSTM_3.compile(optimizer='rmsprop', loss='mse', metrics=['mae'])

model_LSTM_3.summary()

786/786 [==============================] - 49s 51ms/step - loss: 0.0251 - mae: 0.1335 - val_loss: 0.0215 - val_mae: 0.1237
Epoch 2/5
786/786 [==============================] - 38s 48ms/step - loss: 0.0208 - mae: 0.1273 - val_loss: 0.0218 - val_mae: 0.1362
Epoch 3/5
786/786 [==============================] - 38s 49ms/step - loss: 0.0206 - mae: 0.1264 - val_loss: 0.0208 - val_mae: 0.1228
Epoch 4/5
786/786 [==============================] - 37s 47ms/step - loss: 0.0205 - mae: 0.1261 - val_loss: 0.0213 - val_mae: 0.1337
Epoch 5/5
786/786 [==============================] - 37s 47ms/step - loss: 0.0205 - mae: 0.1262 - val_loss: 0.0206 - val_mae: 0.1284

The data is identical in both cases, but it appears that the model is only fitting and using the data from the first input since Accelerometer alone and EDA alone produce comparable results to model 1 and model 2 respectively.

Obviously it has something to do with the organization of the model, but I am not really sure what is going on under the hood to create these results or why the two ostensibly identical models aren't producing similar results.

Could someone help explain this?


问:
Dinamic react component
Please, tell me how to solve the following problem. I'm writing a news application. The content of each post piece (title, several illustrations, date of creation, section, abstract, part of the text) is entered into the MongoDB database. Each news respectively contains a unique id. All this is done, not difficult.

Each news should also have a piece of unique code (html + js, as a rule), which I plan to enter manually. For example, canvas elements.
Thus, to introduce original design elements into each post item.

I planned to solve this problem by creating a js file for each news containing a component. The file is created manually, wrapped in a component, say, ArtBlock, and uploaded to the server in a separate folder during the creation of the article, using the same method as the illustrations for the article.
The file name must match the article id in order to automatically find it in the appropriate folder through props and import it to the article page.

For these purposes, I planned to use the dynamic import @loadable/component:

```<code>const Post = ({ post }) => {
  const { loading, error, data } = useQuery(IS_LOGGED_IN);
  if (loading) return <p>Loading...</p>;
  if (error) return <p>Error!</p>;
  let arr = post._id;
  const ArtPage = loadable(post => import(`../arts/${arr}`));

  return (
    <article>
    <ArtPage />
    <div id={post._id}></div>
    <ImgStyle>
      <img src={post.imageUrl} />
    </ImgStyle>
      <H2>{post.title}</H2>
      <Link style={linkStyle} to={`/cats/${idcat}`}>
        <H4R>{post.category.catname}</H4R>
      </Link>
      <H4R>{post.createdAt}</H4R>
      <Link style={linkStyle} to={`/users/${iduser}`}>
        <H4R>{`author ${post.author.name}`}</H4R>
      </Link>
      <H4R>{`views ${post.viewsCount}`}</H4R>
      <PRiv4>
        <ReactMarkdown children={post.body}  />
      </PRiv4>
    </article>
  );
};
</code>```

But the code stubbornly refuses to work. In this case, if you remove the variable and insert specifically the name of the file, the component is loaded.

```<code>const ArtPage = loadable(post => import(`../arts/63addc830407bc4b94f5d965`));
</code>```

Title: Dinamic react component

Body:
Please, tell me how to solve the following problem. I'm writing a news application. The content of each post piece (title, several illustrations, date of creation, section, abstract, part of the text) is entered into the MongoDB database. Each news respectively contains a unique id. All this is done, not difficult.

Each news should also have a piece of unique code (html + js, as a rule), which I plan to enter manually. For example, canvas elements.
Thus, to introduce original design elements into each post item.

I planned to solve this problem by creating a js file for each news containing a component. The file is created manually, wrapped in a component, say, ArtBlock, and uploaded to the server in a separate folder during the creation of the article, using the same method as the illustrations for the article.
The file name must match the article id in order to automatically find it in the appropriate folder through props and import it to the article page.

For these purposes, I planned to use the dynamic import @loadable/component:

const Post = ({ post }) => {
  const { loading, error, data } = useQuery(IS_LOGGED_IN);
  if (loading) return
Loading...
;
  if (error) return
Error!
;
  let arr = post._id;
  const ArtPage = loadable(post => import(`../arts/${arr}`));

  return (

    <ArtPage />

    <ImgStyle>

    </ImgStyle>

{post.title}

      <Link style={linkStyle} to={`/cats/${idcat}`}>
        <H4R>{post.category.catname}</H4R>
      </Link>
      <H4R>{post.createdAt}</H4R>
      <Link style={linkStyle} to={`/users/${iduser}`}>
        <H4R>{`author ${post.author.name}`}</H4R>
      </Link>
      <H4R>{`views ${post.viewsCount}`}</H4R>
      <PRiv4>
        <ReactMarkdown children={post.body}  />
      </PRiv4>

  );
};

But the code stubbornly refuses to work. In this case, if you remove the variable and insert specifically the name of the file, the component is loaded.

const ArtPage = loadable(post => import(`../arts/63addc830407bc4b94f5d965`));


问:
How to make a timer's loop in android studio java?
I want to make a timers loop so basically, I have a app,  I have a bunch up set text so each time the timer finishes I want to set a new text but I am having trouble with that.

```<code>public class MainActivity extends AppCompatActivity {
    private static final long START_TIME_IN_MILLIS = 600000;

    Button tip;
    TextView texttip;
    TextView textfact;

    private TextView mTextViewCountDown;
    private Button mButtonStartPause;
    private Button mButtonStart;

    private CountDownTimer mCountDownTimer;

    private boolean mTimerRunning;

    private long mTimeLeftInMillis;
    private long mEndTime;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mTextViewCountDown = findViewById(R.id.text_view_countdown);

        mButtonStartPause = findViewById(R.id.button_start_pause);
        mButtonStart = findViewById(R.id.tip);
        tip = (Button) findViewById(R.id.tip);
        texttip = (TextView)findViewById(R.id.texttip);
        textfact = (TextView)findViewById(R.id.textfact);

        mButtonStartPause.setOnClickListener((new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(mTimerRunning) {
                    mButtonStartPause.setText("fact ");
                } else {
                    startTimer();
                }

            }
        }));

        mButtonStart.setOnClickListener((new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(mTimerRunning) {
                    mButtonStart.setText("Tip");
                } else {
                    startTimer();
                }

            }
        }));

    }

    private void startTimer() {

        textfact.setText("Don't educate your children to be rich!");
        texttip.setText("Always be kind! help someone out today!");
        textfact.setText("hello1!");
        texttip.setText("hello2");
        textfact.setText("hello3");
        texttip.setText("hello4");
        textfact.setText("hello5");
        texttip.setText("hello6");

        if (mTimeLeftInMillis < 10) {
            mTimeLeftInMillis = START_TIME_IN_MILLIS;
            updateCountDownText();
            updateButtons();
        } else{
            mButtonStartPause.setText("fact ");
        }
        mEndTime = System.currentTimeMillis() + mTimeLeftInMillis;
        mCountDownTimer = new CountDownTimer(mTimeLeftInMillis, 1000) {
            @Override
            public void onTick(long millisUntilFinished) {
                mTimeLeftInMillis = millisUntilFinished;
                updateCountDownText();
            }

            @Override
            public void onFinish() {
                mTimerRunning= false;
                updateButtons();
            }
        }.start();

        mTimerRunning = true;
        updateButtons();

    }

    private void updateCountDownText() {
        int minutes = (int) (mTimeLeftInMillis / 1000) / 60;
        int seconds = (int) (mTimeLeftInMillis / 1000) % 60;

        String timeLeftFormatted = String.format(Locale.getDefault(), "%02d:%02d", minutes, seconds);
        mTextViewCountDown.setText(timeLeftFormatted);

    }

    private void updateButtons() {
        if(mTimerRunning){

            mButtonStartPause.setText("fact");
        }else {
            mButtonStartPause.setText("fact");

            if (mTimeLeftInMillis < 1000) {
                mButtonStartPause.setVisibility(View.VISIBLE);
            } else {
                mButtonStartPause.setVisibility(View.VISIBLE);
            }

        }
    }

    @Override
    protected void onStop() {
        super.onStop();

        SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();

        editor.putLong("millisLeft", mTimeLeftInMillis);
        editor.putBoolean("timerRunning", mTimerRunning);
        editor.putLong("endTime", mEndTime);

        editor.apply();
    }

    @Override
    protected void onStart() {
        super.onStart();

        SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE);

        mTimeLeftInMillis = prefs.getLong("millisLeft", START_TIME_IN_MILLIS);
        mTimerRunning = prefs.getBoolean("timerRunning", false);

        updateCountDownText();
        updateButtons();

        if (mTimerRunning) {
            mEndTime = prefs.getLong("endTime", 0);
            mTimeLeftInMillis = mEndTime - System.currentTimeMillis();

            if (mTimeLeftInMillis < 0) {
                mTimeLeftInMillis = 0;
                mTimerRunning = false;
                updateCountDownText();
                updateButtons();
            } else{
                startTimer();
            }
        }
    }

}
</code>```

I want it to set a new text each time it finishes. I am pretty new with android studio so elaborating is appreciated!

Body:
I want to make a timers loop so basically, I have a app,  I have a bunch up set text so each time the timer finishes I want to set a new text but I am having trouble with that.

public class MainActivity extends AppCompatActivity {
    private static final long START_TIME_IN_MILLIS = 600000;

    Button tip;
    TextView texttip;
    TextView textfact;

    private TextView mTextViewCountDown;
    private Button mButtonStartPause;
    private Button mButtonStart;

    private CountDownTimer mCountDownTimer;

    private boolean mTimerRunning;

    private long mTimeLeftInMillis;
    private long mEndTime;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mTextViewCountDown = findViewById(R.id.text_view_countdown);

        mButtonStartPause = findViewById(R.id.button_start_pause);
        mButtonStart = findViewById(R.id.tip);
        tip = (Button) findViewById(R.id.tip);
        texttip = (TextView)findViewById(R.id.texttip);
        textfact = (TextView)findViewById(R.id.textfact);

        mButtonStartPause.setOnClickListener((new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(mTimerRunning) {
                    mButtonStartPause.setText("fact ");
                } else {
                    startTimer();
                }

            }
        }));

        mButtonStart.setOnClickListener((new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(mTimerRunning) {
                    mButtonStart.setText("Tip");
                } else {
                    startTimer();
                }

            }
        }));

    }

    private void startTimer() {

        textfact.setText("Don't educate your children to be rich!");
        texttip.setText("Always be kind! help someone out today!");
        textfact.setText("hello1!");
        texttip.setText("hello2");
        textfact.setText("hello3");
        texttip.setText("hello4");
        textfact.setText("hello5");
        texttip.setText("hello6");

        if (mTimeLeftInMillis < 10) {
            mTimeLeftInMillis = START_TIME_IN_MILLIS;
            updateCountDownText();
            updateButtons();
        } else{
            mButtonStartPause.setText("fact ");
        }
        mEndTime = System.currentTimeMillis() + mTimeLeftInMillis;
        mCountDownTimer = new CountDownTimer(mTimeLeftInMillis, 1000) {
            @Override
            public void onTick(long millisUntilFinished) {
                mTimeLeftInMillis = millisUntilFinished;
                updateCountDownText();
            }

            @Override
            public void onFinish() {
                mTimerRunning= false;
                updateButtons();
            }
        }.start();

        mTimerRunning = true;
        updateButtons();

    }

    private void updateCountDownText() {
        int minutes = (int) (mTimeLeftInMillis / 1000) / 60;
        int seconds = (int) (mTimeLeftInMillis / 1000) % 60;

        String timeLeftFormatted = String.format(Locale.getDefault(), "%02d:%02d", minutes, seconds);
        mTextViewCountDown.setText(timeLeftFormatted);

    }

    private void updateButtons() {
        if(mTimerRunning){

            mButtonStartPause.setText("fact");
        }else {
            mButtonStartPause.setText("fact");

            if (mTimeLeftInMillis < 1000) {
                mButtonStartPause.setVisibility(View.VISIBLE);
            } else {
                mButtonStartPause.setVisibility(View.VISIBLE);
            }

        }
    }

    @Override
    protected void onStop() {
        super.onStop();

        SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();

        editor.putLong("millisLeft", mTimeLeftInMillis);
        editor.putBoolean("timerRunning", mTimerRunning);
        editor.putLong("endTime", mEndTime);

        editor.apply();
    }

    @Override
    protected void onStart() {
        super.onStart();

        SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE);

        mTimeLeftInMillis = prefs.getLong("millisLeft", START_TIME_IN_MILLIS);
        mTimerRunning = prefs.getBoolean("timerRunning", false);

        updateCountDownText();
        updateButtons();

        if (mTimerRunning) {
            mEndTime = prefs.getLong("endTime", 0);
            mTimeLeftInMillis = mEndTime - System.currentTimeMillis();

            if (mTimeLeftInMillis < 0) {
                mTimeLeftInMillis = 0;
                mTimerRunning = false;
                updateCountDownText();
                updateButtons();
            } else{
                startTimer();
            }
        }
    }

}

I want it to set a new text each time it finishes. I am pretty new with android studio so elaborating is appreciated!