问:
Error: Type 'SelectNotificationCallback' not found. SelectNotificationCallback? onSelectNotification,
Can somebody Help me to fixed this code? it shows

Error: Type 'SelectNotificationCallback' not found.     SelectNotificationCallback? onSelectNotification,

please help me guys i need your help this time

```import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:flutter_local_notifications_linux/flutter_local_notifications_linux.dart';
import 'package:flutter_local_notifications_platform_interface/flutter_local_notifications_platform_interface.dart';
import 'package:timezone/timezone.dart';

import 'initialization_settings.dart';
import 'notification_details.dart';
import 'platform_flutter_local_notifications.dart';
import 'platform_specifics/ios/enums.dart';
import 'types.dart';

/// Provides cross-platform functionality for displaying local notifications.
///
/// The plugin will check the platform that is running on to use the appropriate
/// platform-specific implementation of the plugin. The plugin methods will be a
/// no-op when the platform can't be detected.
///
/// Use [resolvePlatformSpecificImplementation] and pass the platform-specific
/// type of the plugin to get the underlying platform-specific implementation
/// if access to platform-specific APIs are needed.
class FlutterLocalNotificationsPlugin {
  /// Factory for create an instance of [FlutterLocalNotificationsPlugin].
  factory FlutterLocalNotificationsPlugin() => _instance;

  FlutterLocalNotificationsPlugin._() {
    if (kIsWeb) {
      return;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      FlutterLocalNotificationsPlatform.instance =
          AndroidFlutterLocalNotificationsPlugin();
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      FlutterLocalNotificationsPlatform.instance =
          IOSFlutterLocalNotificationsPlugin();
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      FlutterLocalNotificationsPlatform.instance =
          MacOSFlutterLocalNotificationsPlugin();
    } else if (defaultTargetPlatform == TargetPlatform.linux) {
      FlutterLocalNotificationsPlatform.instance =
          LinuxFlutterLocalNotificationsPlugin();
    }
  }

  static final FlutterLocalNotificationsPlugin _instance =
      FlutterLocalNotificationsPlugin._();

  /// Returns the underlying platform-specific implementation of given type [T],
  /// which must be a concrete subclass of [FlutterLocalNotificationsPlatform](https://pub.dev/documentation/flutter_local_notifications_platform_interface/latest/flutter_local_notifications_platform_interface/FlutterLocalNotificationsPlatform-class.html)
  ///
  /// Requires running on the appropriate platform that matches the specified
  /// type for a result to be returned. For example, when the specified type
  /// argument is of type [AndroidFlutterLocalNotificationsPlugin], this will
  /// only return a result of that type when running on Android.
  T? resolvePlatformSpecificImplementation<
      T extends FlutterLocalNotificationsPlatform>() {
    if (T == FlutterLocalNotificationsPlatform) {
      throw ArgumentError.value(
          T,
          'The type argument must be a concrete subclass of '
          'FlutterLocalNotificationsPlatform');
    }
    if (kIsWeb) {
      return null;
    }

    if (defaultTargetPlatform == TargetPlatform.android &&
        T == AndroidFlutterLocalNotificationsPlugin &&
        FlutterLocalNotificationsPlatform.instance
            is AndroidFlutterLocalNotificationsPlugin) {
      return FlutterLocalNotificationsPlatform.instance as T?;
    } else if (defaultTargetPlatform == TargetPlatform.iOS &&
        T == IOSFlutterLocalNotificationsPlugin &&
        FlutterLocalNotificationsPlatform.instance
            is IOSFlutterLocalNotificationsPlugin) {
      return FlutterLocalNotificationsPlatform.instance as T?;
    } else if (defaultTargetPlatform == TargetPlatform.macOS &&
        T == MacOSFlutterLocalNotificationsPlugin &&
        FlutterLocalNotificationsPlatform.instance
            is MacOSFlutterLocalNotificationsPlugin) {
      return FlutterLocalNotificationsPlatform.instance as T?;
    } else if (defaultTargetPlatform == TargetPlatform.linux &&
        T == LinuxFlutterLocalNotificationsPlugin &&
        FlutterLocalNotificationsPlatform.instance
            is LinuxFlutterLocalNotificationsPlugin) {
      return FlutterLocalNotificationsPlatform.instance as T?;
    }

    return null;
  }

  /// Initializes the plugin.
  ///
  /// Call this method on application before using the plugin further.
  ///
  /// Will return a [bool] value to indicate if initialization succeeded.
  /// On iOS this is dependent on if permissions have been granted to show
  /// notification When running in environment that is neither Android and
  /// iOS (e.g. when running tests), this will be a no-op and return true.
  ///
  /// Note that on iOS, initialisation may also request notification
  /// permissions where users will see a permissions prompt. This may be fine
  /// in cases where it's acceptable to do this when the application runs for
  /// the first time. However, if your application needs to do this at a later
  /// point in time, set the [IOSInitializationSettings.requestAlertPermission],
  /// [IOSInitializationSettings.requestBadgePermission] and
  /// [IOSInitializationSettings.requestSoundPermission] values to false.
  /// [IOSFlutterLocalNotificationsPlugin.requestPermissions] can then be called
  /// to request permissions when needed.
  ///
  /// To handle when a notification launched an application, use
  /// [getNotificationAppLaunchDetails].
  Future<bool?> initialize(
    InitializationSettings initializationSettings, {
    SelectNotificationCallback? onSelectNotification,
  }) async {
    if (kIsWeb) {
      return true;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      return resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()
          ?.initialize(initializationSettings.android!,
              onSelectNotification: onSelectNotification);
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      return await resolvePlatformSpecificImplementation<
              IOSFlutterLocalNotificationsPlugin>()
          ?.initialize(initializationSettings.iOS!,
              onSelectNotification: onSelectNotification);
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      return await resolvePlatformSpecificImplementation<
              MacOSFlutterLocalNotificationsPlugin>()
          ?.initialize(initializationSettings.macOS!,
              onSelectNotification: onSelectNotification);
    } else if (defaultTargetPlatform == TargetPlatform.linux) {
      return await resolvePlatformSpecificImplementation<
              LinuxFlutterLocalNotificationsPlugin>()
          ?.initialize(initializationSettings.linux!,
              onSelectNotification: onSelectNotification);
    }
    return true;
  }

  /// Returns info on if a notification created from this plugin had been used
  /// to launch the application.
  ///
  /// An example of how this could be used is to change the initial route of
  /// your application when it starts up. If the plugin isn't running on either
  /// Android, iOS or macOS then an instance of the
  /// `NotificationAppLaunchDetails` class is returned with
  /// `didNotificationLaunchApp` set to false.
  ///
  /// Note that this will return null for applications running on macOS
  /// versions older than 10.14. This is because there's currently no mechanism
  /// for plugins to receive information on lifecycle events.
  Future<NotificationAppLaunchDetails?>
      getNotificationAppLaunchDetails() async {
    if (kIsWeb) {
      return null;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      return await resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()
          ?.getNotificationAppLaunchDetails();
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      return await resolvePlatformSpecificImplementation<
              IOSFlutterLocalNotificationsPlugin>()
          ?.getNotificationAppLaunchDetails();
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      return await resolvePlatformSpecificImplementation<
              MacOSFlutterLocalNotificationsPlugin>()
          ?.getNotificationAppLaunchDetails();
    } else {
      return await FlutterLocalNotificationsPlatform.instance
              .getNotificationAppLaunchDetails() ??
          const NotificationAppLaunchDetails(false, null);
    }
  }

  /// Show a notification with an optional payload that will be passed back to
  /// the app when a notification is tapped.
  Future<void> show(
    int id,
    String? title,
    String? body,
    NotificationDetails? notificationDetails, {
    String? payload,
  }) async {
    if (kIsWeb) {
      return;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      await resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()
          ?.show(id, title, body,
              notificationDetails: notificationDetails?.android,
              payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      await resolvePlatformSpecificImplementation<
              IOSFlutterLocalNotificationsPlugin>()
          ?.show(id, title, body,
              notificationDetails: notificationDetails?.iOS, payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      await resolvePlatformSpecificImplementation<
              MacOSFlutterLocalNotificationsPlugin>()
          ?.show(id, title, body,
              notificationDetails: notificationDetails?.macOS,
              payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.linux) {
      await resolvePlatformSpecificImplementation<
              LinuxFlutterLocalNotificationsPlugin>()
          ?.show(id, title, body,
              notificationDetails: notificationDetails?.linux,
              payload: payload);
    } else {
      await FlutterLocalNotificationsPlatform.instance.show(id, title, body);
    }
  }

  /// Cancel/remove the notification with the specified id.
  ///
  /// This applies to notifications that have been scheduled and those that
  /// have already been presented.
  ///
  /// The `tag` parameter specifies the Android tag. If it is provided,
  /// then the notification that matches both the id and the tag will
  /// be canceled. `tag` has no effect on other platforms.
  Future<void> cancel(int id, {String? tag}) async {
    if (kIsWeb) {
      return;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      await resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()
          ?.cancel(id, tag: tag);
    } else {
      await FlutterLocalNotificationsPlatform.instance.cancel(id);
    }
  }

  /// Cancels/removes all notifications.
  ///
  /// This applies to notifications that have been scheduled and those that
  /// have already been presented.
  Future<void> cancelAll() async {
    await FlutterLocalNotificationsPlatform.instance.cancelAll();
  }

  /// Schedules a notification to be shown at the specified date and time.
  ///
  /// The [androidAllowWhileIdle] parameter determines if the notification
  /// should still be shown at the exact time even when the device is in a
  /// low-power idle mode.
  @Deprecated('Deprecated due to problems with time zones. Use zonedSchedule '
      'instead.')
  Future<void> schedule(
    int id,
    String? title,
    String? body,
    DateTime scheduledDate,
    NotificationDetails notificationDetails, {
    String? payload,
    bool androidAllowWhileIdle = false,
  }) async {
    if (kIsWeb) {
      return;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      await resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()!
          .schedule(id, title, body, scheduledDate, notificationDetails.android,
              payload: payload, androidAllowWhileIdle: androidAllowWhileIdle);
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      await resolvePlatformSpecificImplementation<
              IOSFlutterLocalNotificationsPlugin>()
          ?.schedule(id, title, body, scheduledDate, notificationDetails.iOS,
              payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      throw UnimplementedError();
    }
  }

  /// Schedules a notification to be shown at the specified date and time
  /// relative to a specific time zone.
  ///
  /// Note that to get the appropriate representation of the time at the native
  /// level (i.e. Android/iOS), the plugin needs to pass the time over the
  /// platform channel in yyyy-mm-dd hh:mm:ss format. Therefore, the precision
  /// is at the best to the second.
  ///
  /// The [androidAllowWhileIdle] parameter determines if the notification
  /// should still be shown at the exact time even when the device is in a
  /// low-power idle mode.
  ///
  /// The [uiLocalNotificationDateInterpretation] is for iOS versions older
  /// than 10 as the APIs have limited support for time zones. With this
  /// parameter, it is used to determine if the scheduled date should be
  /// interpreted as absolute time or wall clock time.
  ///
  /// If a value for [matchDateTimeComponents] parameter is given, this tells
  /// the plugin to schedule a recurring notification that matches the
  /// specified date and time components. Specifying
  /// [DateTimeComponents.time] would result in a daily notification at the
  /// same time whilst [DateTimeComponents.dayOfWeekAndTime] would result
  /// in a weekly notification that occurs on the same day of the week and time.
  /// This is similar to how recurring notifications on iOS/macOS work using a
  /// calendar trigger. Note that when a value is given, the [scheduledDate]
  /// may not represent the first time the notification will be shown. An
  /// example would be if the date and time is currently 2020-10-19 11:00
  /// (i.e. 19th October 2020 11:00AM) and [scheduledDate] is 2020-10-21
  /// 10:00 and the value of the [matchDateTimeComponents] is
  /// [DateTimeComponents.time], then the next time a notification will
  /// appear is 2020-10-20 10:00.
  Future<void> zonedSchedule(
    int id,
    String? title,
    String? body,
    TZDateTime scheduledDate,
    NotificationDetails notificationDetails, {
    required UILocalNotificationDateInterpretation
        uiLocalNotificationDateInterpretation,
    required bool androidAllowWhileIdle,
    String? payload,
    DateTimeComponents? matchDateTimeComponents,
  }) async {
    if (kIsWeb) {
      return;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      await resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()!
          .zonedSchedule(
              id, title, body, scheduledDate, notificationDetails.android,
              payload: payload,
              androidAllowWhileIdle: androidAllowWhileIdle,
              matchDateTimeComponents: matchDateTimeComponents);
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      await resolvePlatformSpecificImplementation<
              IOSFlutterLocalNotificationsPlugin>()
          ?.zonedSchedule(
              id, title, body, scheduledDate, notificationDetails.iOS,
              uiLocalNotificationDateInterpretation:
                  uiLocalNotificationDateInterpretation,
              payload: payload,
              matchDateTimeComponents: matchDateTimeComponents);
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      await resolvePlatformSpecificImplementation<
              MacOSFlutterLocalNotificationsPlugin>()
          ?.zonedSchedule(
              id, title, body, scheduledDate, notificationDetails.macOS,
              payload: payload,
              matchDateTimeComponents: matchDateTimeComponents);
    }
  }

  /// Periodically show a notification using the specified interval.
  ///
  /// For example, specifying a hourly interval means the first time the
  /// notification will be an hour after the method has been called and
  /// then every hour after that.
  ///
  /// If [androidAllowWhileIdle] is `false`, the Android `AlarmManager` APIs
  /// are used to set a recurring inexact alarm that would present the
  /// notification. This means that there may be delay in on when
  /// notifications are displayed. If [androidAllowWhileIdle] is `true`, the
  /// Android `AlarmManager` APIs are used to schedule a single notification
  /// to be shown at the exact time even when the device is in a low-power idle
  /// mode. After it is shown, the next one would be scheduled and this would
  /// repeat.
  Future<void> periodicallyShow(
    int id,
    String? title,
    String? body,
    RepeatInterval repeatInterval,
    NotificationDetails notificationDetails, {
    String? payload,
    bool androidAllowWhileIdle = false,
  }) async {
    if (kIsWeb) {
      return;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      await resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()
          ?.periodicallyShow(id, title, body, repeatInterval,
              notificationDetails: notificationDetails.android,
              payload: payload,
              androidAllowWhileIdle: androidAllowWhileIdle);
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      await resolvePlatformSpecificImplementation<
              IOSFlutterLocalNotificationsPlugin>()
          ?.periodicallyShow(id, title, body, repeatInterval,
              notificationDetails: notificationDetails.iOS, payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      await resolvePlatformSpecificImplementation<
              MacOSFlutterLocalNotificationsPlugin>()
          ?.periodicallyShow(id, title, body, repeatInterval,
              notificationDetails: notificationDetails.macOS, payload: payload);
    } else {
      await FlutterLocalNotificationsPlatform.instance
          .periodicallyShow(id, title, body, repeatInterval);
    }
  }

  /// Shows a notification on a daily interval at the specified time.
  @Deprecated(
      'Deprecated due to problems with time zones. Use zonedSchedule instead '
      'by passing a date in the future with the same time and pass '
      'DateTimeComponents.matchTime as the value of the '
      'matchDateTimeComponents parameter.')
  Future<void> showDailyAtTime(
    int id,
    String? title,
    String? body,
    Time notificationTime,
    NotificationDetails notificationDetails, {
    String? payload,
  }) async {
    if (kIsWeb) {
      return;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      await resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()
          ?.showDailyAtTime(
              id, title, body, notificationTime, notificationDetails.android,
              payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      await resolvePlatformSpecificImplementation<
              IOSFlutterLocalNotificationsPlugin>()
          ?.showDailyAtTime(
              id, title, body, notificationTime, notificationDetails.iOS,
              payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      throw UnimplementedError();
    }
  }

  /// Shows a notification on weekly interval at the specified day and time.
  @Deprecated(
      'Deprecated due to problems with time zones. Use zonedSchedule instead '
      'by passing a date in the future with the same day of the week and time '
      'as well as passing DateTimeComponents.dayOfWeekAndTime as the value of '
      'the matchDateTimeComponents parameter.')
  Future<void> showWeeklyAtDayAndTime(
    int id,
    String? title,
    String? body,
    Day day,
    Time notificationTime,
    NotificationDetails notificationDetails, {
    String? payload,
  }) async {
    if (kIsWeb) {
      return;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      await resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()
          ?.showWeeklyAtDayAndTime(id, title, body, day, notificationTime,
              notificationDetails.android,
              payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      await resolvePlatformSpecificImplementation<
              IOSFlutterLocalNotificationsPlugin>()
          ?.showWeeklyAtDayAndTime(
              id, title, body, day, notificationTime, notificationDetails.iOS,
              payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      throw UnimplementedError();
    }
  }

  /// Returns a list of notifications pending to be delivered/shown.
  Future<List<PendingNotificationRequest>> pendingNotificationRequests() =>
      FlutterLocalNotificationsPlatform.instance.pendingNotificationRequests();

  /// Returns a list of notifications that are already delivered/shown.
  Future<List<ActiveNotification>> getActiveNotifications() =>
      FlutterLocalNotificationsPlatform.instance.getActiveNotifications();
}

```

i tried to change but if someone could fix it where to replcae those much appreciated i bought this code year ago now i ecnountered error.

Body:
Can somebody Help me to fixed this code? it shows

Error: Type 'SelectNotificationCallback' not found.     SelectNotificationCallback? onSelectNotification,

please help me guys i need your help this time

import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:flutter_local_notifications_linux/flutter_local_notifications_linux.dart';
import 'package:flutter_local_notifications_platform_interface/flutter_local_notifications_platform_interface.dart';
import 'package:timezone/timezone.dart';

import 'initialization_settings.dart';
import 'notification_details.dart';
import 'platform_flutter_local_notifications.dart';
import 'platform_specifics/ios/enums.dart';
import 'types.dart';

/// Provides cross-platform functionality for displaying local notifications.
///
/// The plugin will check the platform that is running on to use the appropriate
/// platform-specific implementation of the plugin. The plugin methods will be a
/// no-op when the platform can't be detected.
///
/// Use [resolvePlatformSpecificImplementation] and pass the platform-specific
/// type of the plugin to get the underlying platform-specific implementation
/// if access to platform-specific APIs are needed.
class FlutterLocalNotificationsPlugin {
  /// Factory for create an instance of [FlutterLocalNotificationsPlugin].
  factory FlutterLocalNotificationsPlugin() => _instance;

  FlutterLocalNotificationsPlugin._() {
    if (kIsWeb) {
      return;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      FlutterLocalNotificationsPlatform.instance =
          AndroidFlutterLocalNotificationsPlugin();
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      FlutterLocalNotificationsPlatform.instance =
          IOSFlutterLocalNotificationsPlugin();
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      FlutterLocalNotificationsPlatform.instance =
          MacOSFlutterLocalNotificationsPlugin();
    } else if (defaultTargetPlatform == TargetPlatform.linux) {
      FlutterLocalNotificationsPlatform.instance =
          LinuxFlutterLocalNotificationsPlugin();
    }
  }

  static final FlutterLocalNotificationsPlugin _instance =
      FlutterLocalNotificationsPlugin._();

  /// Returns the underlying platform-specific implementation of given type [T],
  /// which must be a concrete subclass of [FlutterLocalNotificationsPlatform](https://pub.dev/documentation/flutter_local_notifications_platform_interface/latest/flutter_local_notifications_platform_interface/FlutterLocalNotificationsPlatform-class.html)
  ///
  /// Requires running on the appropriate platform that matches the specified
  /// type for a result to be returned. For example, when the specified type
  /// argument is of type [AndroidFlutterLocalNotificationsPlugin], this will
  /// only return a result of that type when running on Android.
  T? resolvePlatformSpecificImplementation<
      T extends FlutterLocalNotificationsPlatform>() {
    if (T == FlutterLocalNotificationsPlatform) {
      throw ArgumentError.value(
          T,
          'The type argument must be a concrete subclass of '
          'FlutterLocalNotificationsPlatform');
    }
    if (kIsWeb) {
      return null;
    }

    if (defaultTargetPlatform == TargetPlatform.android &&
        T == AndroidFlutterLocalNotificationsPlugin &&
        FlutterLocalNotificationsPlatform.instance
            is AndroidFlutterLocalNotificationsPlugin) {
      return FlutterLocalNotificationsPlatform.instance as T?;
    } else if (defaultTargetPlatform == TargetPlatform.iOS &&
        T == IOSFlutterLocalNotificationsPlugin &&
        FlutterLocalNotificationsPlatform.instance
            is IOSFlutterLocalNotificationsPlugin) {
      return FlutterLocalNotificationsPlatform.instance as T?;
    } else if (defaultTargetPlatform == TargetPlatform.macOS &&
        T == MacOSFlutterLocalNotificationsPlugin &&
        FlutterLocalNotificationsPlatform.instance
            is MacOSFlutterLocalNotificationsPlugin) {
      return FlutterLocalNotificationsPlatform.instance as T?;
    } else if (defaultTargetPlatform == TargetPlatform.linux &&
        T == LinuxFlutterLocalNotificationsPlugin &&
        FlutterLocalNotificationsPlatform.instance
            is LinuxFlutterLocalNotificationsPlugin) {
      return FlutterLocalNotificationsPlatform.instance as T?;
    }

    return null;
  }

  /// Initializes the plugin.
  ///
  /// Call this method on application before using the plugin further.
  ///
  /// Will return a [bool] value to indicate if initialization succeeded.
  /// On iOS this is dependent on if permissions have been granted to show
  /// notification When running in environment that is neither Android and
  /// iOS (e.g. when running tests), this will be a no-op and return true.
  ///
  /// Note that on iOS, initialisation may also request notification
  /// permissions where users will see a permissions prompt. This may be fine
  /// in cases where it's acceptable to do this when the application runs for
  /// the first time. However, if your application needs to do this at a later
  /// point in time, set the [IOSInitializationSettings.requestAlertPermission],
  /// [IOSInitializationSettings.requestBadgePermission] and
  /// [IOSInitializationSettings.requestSoundPermission] values to false.
  /// [IOSFlutterLocalNotificationsPlugin.requestPermissions] can then be called
  /// to request permissions when needed.
  ///
  /// To handle when a notification launched an application, use
  /// [getNotificationAppLaunchDetails].
  Future<bool?> initialize(
    InitializationSettings initializationSettings, {
    SelectNotificationCallback? onSelectNotification,
  }) async {
    if (kIsWeb) {
      return true;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      return resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()
          ?.initialize(initializationSettings.android!,
              onSelectNotification: onSelectNotification);
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      return await resolvePlatformSpecificImplementation<
              IOSFlutterLocalNotificationsPlugin>()
          ?.initialize(initializationSettings.iOS!,
              onSelectNotification: onSelectNotification);
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      return await resolvePlatformSpecificImplementation<
              MacOSFlutterLocalNotificationsPlugin>()
          ?.initialize(initializationSettings.macOS!,
              onSelectNotification: onSelectNotification);
    } else if (defaultTargetPlatform == TargetPlatform.linux) {
      return await resolvePlatformSpecificImplementation<
              LinuxFlutterLocalNotificationsPlugin>()
          ?.initialize(initializationSettings.linux!,
              onSelectNotification: onSelectNotification);
    }
    return true;
  }

  /// Returns info on if a notification created from this plugin had been used
  /// to launch the application.
  ///
  /// An example of how this could be used is to change the initial route of
  /// your application when it starts up. If the plugin isn't running on either
  /// Android, iOS or macOS then an instance of the
  /// `NotificationAppLaunchDetails` class is returned with
  /// `didNotificationLaunchApp` set to false.
  ///
  /// Note that this will return null for applications running on macOS
  /// versions older than 10.14. This is because there's currently no mechanism
  /// for plugins to receive information on lifecycle events.
  Future<NotificationAppLaunchDetails?>
      getNotificationAppLaunchDetails() async {
    if (kIsWeb) {
      return null;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      return await resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()
          ?.getNotificationAppLaunchDetails();
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      return await resolvePlatformSpecificImplementation<
              IOSFlutterLocalNotificationsPlugin>()
          ?.getNotificationAppLaunchDetails();
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      return await resolvePlatformSpecificImplementation<
              MacOSFlutterLocalNotificationsPlugin>()
          ?.getNotificationAppLaunchDetails();
    } else {
      return await FlutterLocalNotificationsPlatform.instance
              .getNotificationAppLaunchDetails() ??
          const NotificationAppLaunchDetails(false, null);
    }
  }

  /// Show a notification with an optional payload that will be passed back to
  /// the app when a notification is tapped.
  Future<void> show(
    int id,
    String? title,
    String? body,
    NotificationDetails? notificationDetails, {
    String? payload,
  }) async {
    if (kIsWeb) {
      return;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      await resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()
          ?.show(id, title, body,
              notificationDetails: notificationDetails?.android,
              payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      await resolvePlatformSpecificImplementation<
              IOSFlutterLocalNotificationsPlugin>()
          ?.show(id, title, body,
              notificationDetails: notificationDetails?.iOS, payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      await resolvePlatformSpecificImplementation<
              MacOSFlutterLocalNotificationsPlugin>()
          ?.show(id, title, body,
              notificationDetails: notificationDetails?.macOS,
              payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.linux) {
      await resolvePlatformSpecificImplementation<
              LinuxFlutterLocalNotificationsPlugin>()
          ?.show(id, title, body,
              notificationDetails: notificationDetails?.linux,
              payload: payload);
    } else {
      await FlutterLocalNotificationsPlatform.instance.show(id, title, body);
    }
  }

  /// Cancel/remove the notification with the specified id.
  ///
  /// This applies to notifications that have been scheduled and those that
  /// have already been presented.
  ///
  /// The `tag` parameter specifies the Android tag. If it is provided,
  /// then the notification that matches both the id and the tag will
  /// be canceled. `tag` has no effect on other platforms.
  Future<void> cancel(int id, {String? tag}) async {
    if (kIsWeb) {
      return;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      await resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()
          ?.cancel(id, tag: tag);
    } else {
      await FlutterLocalNotificationsPlatform.instance.cancel(id);
    }
  }

  /// Cancels/removes all notifications.
  ///
  /// This applies to notifications that have been scheduled and those that
  /// have already been presented.
  Future<void> cancelAll() async {
    await FlutterLocalNotificationsPlatform.instance.cancelAll();
  }

  /// Schedules a notification to be shown at the specified date and time.
  ///
  /// The [androidAllowWhileIdle] parameter determines if the notification
  /// should still be shown at the exact time even when the device is in a
  /// low-power idle mode.
  @Deprecated('Deprecated due to problems with time zones. Use zonedSchedule '
      'instead.')
  Future<void> schedule(
    int id,
    String? title,
    String? body,
    DateTime scheduledDate,
    NotificationDetails notificationDetails, {
    String? payload,
    bool androidAllowWhileIdle = false,
  }) async {
    if (kIsWeb) {
      return;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      await resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()!
          .schedule(id, title, body, scheduledDate, notificationDetails.android,
              payload: payload, androidAllowWhileIdle: androidAllowWhileIdle);
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      await resolvePlatformSpecificImplementation<
              IOSFlutterLocalNotificationsPlugin>()
          ?.schedule(id, title, body, scheduledDate, notificationDetails.iOS,
              payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      throw UnimplementedError();
    }
  }

  /// Schedules a notification to be shown at the specified date and time
  /// relative to a specific time zone.
  ///
  /// Note that to get the appropriate representation of the time at the native
  /// level (i.e. Android/iOS), the plugin needs to pass the time over the
  /// platform channel in yyyy-mm-dd hh:mm:ss format. Therefore, the precision
  /// is at the best to the second.
  ///
  /// The [androidAllowWhileIdle] parameter determines if the notification
  /// should still be shown at the exact time even when the device is in a
  /// low-power idle mode.
  ///
  /// The [uiLocalNotificationDateInterpretation] is for iOS versions older
  /// than 10 as the APIs have limited support for time zones. With this
  /// parameter, it is used to determine if the scheduled date should be
  /// interpreted as absolute time or wall clock time.
  ///
  /// If a value for [matchDateTimeComponents] parameter is given, this tells
  /// the plugin to schedule a recurring notification that matches the
  /// specified date and time components. Specifying
  /// [DateTimeComponents.time] would result in a daily notification at the
  /// same time whilst [DateTimeComponents.dayOfWeekAndTime] would result
  /// in a weekly notification that occurs on the same day of the week and time.
  /// This is similar to how recurring notifications on iOS/macOS work using a
  /// calendar trigger. Note that when a value is given, the [scheduledDate]
  /// may not represent the first time the notification will be shown. An
  /// example would be if the date and time is currently 2020-10-19 11:00
  /// (i.e. 19th October 2020 11:00AM) and [scheduledDate] is 2020-10-21
  /// 10:00 and the value of the [matchDateTimeComponents] is
  /// [DateTimeComponents.time], then the next time a notification will
  /// appear is 2020-10-20 10:00.
  Future<void> zonedSchedule(
    int id,
    String? title,
    String? body,
    TZDateTime scheduledDate,
    NotificationDetails notificationDetails, {
    required UILocalNotificationDateInterpretation
        uiLocalNotificationDateInterpretation,
    required bool androidAllowWhileIdle,
    String? payload,
    DateTimeComponents? matchDateTimeComponents,
  }) async {
    if (kIsWeb) {
      return;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      await resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()!
          .zonedSchedule(
              id, title, body, scheduledDate, notificationDetails.android,
              payload: payload,
              androidAllowWhileIdle: androidAllowWhileIdle,
              matchDateTimeComponents: matchDateTimeComponents);
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      await resolvePlatformSpecificImplementation<
              IOSFlutterLocalNotificationsPlugin>()
          ?.zonedSchedule(
              id, title, body, scheduledDate, notificationDetails.iOS,
              uiLocalNotificationDateInterpretation:
                  uiLocalNotificationDateInterpretation,
              payload: payload,
              matchDateTimeComponents: matchDateTimeComponents);
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      await resolvePlatformSpecificImplementation<
              MacOSFlutterLocalNotificationsPlugin>()
          ?.zonedSchedule(
              id, title, body, scheduledDate, notificationDetails.macOS,
              payload: payload,
              matchDateTimeComponents: matchDateTimeComponents);
    }
  }

  /// Periodically show a notification using the specified interval.
  ///
  /// For example, specifying a hourly interval means the first time the
  /// notification will be an hour after the method has been called and
  /// then every hour after that.
  ///
  /// If [androidAllowWhileIdle] is `false`, the Android `AlarmManager` APIs
  /// are used to set a recurring inexact alarm that would present the
  /// notification. This means that there may be delay in on when
  /// notifications are displayed. If [androidAllowWhileIdle] is `true`, the
  /// Android `AlarmManager` APIs are used to schedule a single notification
  /// to be shown at the exact time even when the device is in a low-power idle
  /// mode. After it is shown, the next one would be scheduled and this would
  /// repeat.
  Future<void> periodicallyShow(
    int id,
    String? title,
    String? body,
    RepeatInterval repeatInterval,
    NotificationDetails notificationDetails, {
    String? payload,
    bool androidAllowWhileIdle = false,
  }) async {
    if (kIsWeb) {
      return;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      await resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()
          ?.periodicallyShow(id, title, body, repeatInterval,
              notificationDetails: notificationDetails.android,
              payload: payload,
              androidAllowWhileIdle: androidAllowWhileIdle);
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      await resolvePlatformSpecificImplementation<
              IOSFlutterLocalNotificationsPlugin>()
          ?.periodicallyShow(id, title, body, repeatInterval,
              notificationDetails: notificationDetails.iOS, payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      await resolvePlatformSpecificImplementation<
              MacOSFlutterLocalNotificationsPlugin>()
          ?.periodicallyShow(id, title, body, repeatInterval,
              notificationDetails: notificationDetails.macOS, payload: payload);
    } else {
      await FlutterLocalNotificationsPlatform.instance
          .periodicallyShow(id, title, body, repeatInterval);
    }
  }

  /// Shows a notification on a daily interval at the specified time.
  @Deprecated(
      'Deprecated due to problems with time zones. Use zonedSchedule instead '
      'by passing a date in the future with the same time and pass '
      'DateTimeComponents.matchTime as the value of the '
      'matchDateTimeComponents parameter.')
  Future<void> showDailyAtTime(
    int id,
    String? title,
    String? body,
    Time notificationTime,
    NotificationDetails notificationDetails, {
    String? payload,
  }) async {
    if (kIsWeb) {
      return;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      await resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()
          ?.showDailyAtTime(
              id, title, body, notificationTime, notificationDetails.android,
              payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      await resolvePlatformSpecificImplementation<
              IOSFlutterLocalNotificationsPlugin>()
          ?.showDailyAtTime(
              id, title, body, notificationTime, notificationDetails.iOS,
              payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      throw UnimplementedError();
    }
  }

  /// Shows a notification on weekly interval at the specified day and time.
  @Deprecated(
      'Deprecated due to problems with time zones. Use zonedSchedule instead '
      'by passing a date in the future with the same day of the week and time '
      'as well as passing DateTimeComponents.dayOfWeekAndTime as the value of '
      'the matchDateTimeComponents parameter.')
  Future<void> showWeeklyAtDayAndTime(
    int id,
    String? title,
    String? body,
    Day day,
    Time notificationTime,
    NotificationDetails notificationDetails, {
    String? payload,
  }) async {
    if (kIsWeb) {
      return;
    }
    if (defaultTargetPlatform == TargetPlatform.android) {
      await resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()
          ?.showWeeklyAtDayAndTime(id, title, body, day, notificationTime,
              notificationDetails.android,
              payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      await resolvePlatformSpecificImplementation<
              IOSFlutterLocalNotificationsPlugin>()
          ?.showWeeklyAtDayAndTime(
              id, title, body, day, notificationTime, notificationDetails.iOS,
              payload: payload);
    } else if (defaultTargetPlatform == TargetPlatform.macOS) {
      throw UnimplementedError();
    }
  }

  /// Returns a list of notifications pending to be delivered/shown.
  Future<List<PendingNotificationRequest>> pendingNotificationRequests() =>
      FlutterLocalNotificationsPlatform.instance.pendingNotificationRequests();

  /// Returns a list of notifications that are already delivered/shown.
  Future<List<ActiveNotification>> getActiveNotifications() =>
      FlutterLocalNotificationsPlatform.instance.getActiveNotifications();
}

i tried to change but if someone could fix it where to replcae those much appreciated i bought this code year ago now i ecnountered error.


来源: stackexchange

问:
Citrix: Forbidden while downloading the attachment from ShareFile API
We has been using ShareFile API for downloading the Citrix Attachment. We are using Oauth 2.0. The general flow is -  our clients will authorize the our Citrix ShareFile App to grant permission for accessing their files. Oour ShareFile app should already have the required permission\scopes because with the same app we are successfully downloading attachment files of our customers. However, we are having some problems with one client.

When we tried to download that attachment with the access token, we are getting the following error:

Request:

https://myclientdomain.sf-api.com/sf/v3/Shares(sfe78bf8c64fc465caf1c368cc61fdd0e)/Download(fie36670-d35a-a180-e24e-e13643a70d9e)

Response:

{

```<code>"code": "Forbidden",

"message": {

    "lang": "en-US",

    "value": "Share download requires defining Name, Email and Company"

},

"reason": "NotAuthorized"
</code>```

}

I refreshed the new token from Postman and after that, the token can download the same attachment.  But the surprising point is - the same access token will not work after a few hours and started to see the same error.

I would also like to know what the error message "Share download requires defining Name, Email and Company" refers to.

Please also note that the customer had reauthorized the app but even with that new access token, we are getting the error.

Any help would be highly appreciated!!

ContentLicense: CC BY-SA 4.0

Body:
We has been using ShareFile API for downloading the Citrix Attachment. We are using Oauth 2.0. The general flow is -  our clients will authorize the our Citrix ShareFile App to grant permission for accessing their files. Oour ShareFile app should already have the required permission\scopes because with the same app we are successfully downloading attachment files of our customers. However, we are having some problems with one client.

When we tried to download that attachment with the access token, we are getting the following error:

Request:

https://myclientdomain.sf-api.com/sf/v3/Shares(sfe78bf8c64fc465caf1c368cc61fdd0e)/Download(fie36670-d35a-a180-e24e-e13643a70d9e)

Response:

{

"code": "Forbidden",

"message": {

    "lang": "en-US",

    "value": "Share download requires defining Name, Email and Company"

},

"reason": "NotAuthorized"

}

I refreshed the new token from Postman and after that, the token can download the same attachment.  But the surprising point is - the same access token will not work after a few hours and started to see the same error.

I would also like to know what the error message "Share download requires defining Name, Email and Company" refers to.

Please also note that the customer had reauthorized the app but even with that new access token, we are getting the error.

Any help would be highly appreciated!!


问:
anti-SMASH antismash --check-prereqs TRACEBACK and IMPORT ERRORS
I am now trying if my recently installed anti-SMASH would work. However, the following lines appear as I type antismash --check-prereqs:

Traceback (most recent call last):
File "/home/promt/asenv/bin/antismash", line 5, in
from antismash.main import entrypoint
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/init.py", line 12, in
from antismash.main import run_antismash, get_detection_modules,

File "/home/promt/asenv/lib/python3.9/site-packages/antismash/main.py", line 31, in
from antismash.common import logs, record_processing, serialiser
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/common/record_processing.py", line 19, in
from antismash.common.secmet import Record
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/common/secmet/init.py", line 11, in
from .record import Record
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/common/secmet/record.py", line 25, in
from .features import (
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/common/secmet/features/init.py", line 6, in
from .antismash_domain import AntismashDomain
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/common/secmet/features/antismash_domain.py", line 10, in
from .domain import Domain, generate_protein_location_from_qualifiers
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/common/secmet/features/domain.py", line 13, in
from .feature import Feature, FeatureLocation, Location
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/common/secmet/features/feature.py", line 13, in
from antismash.common.secmet.locations import (
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/common/secmet/locations.py", line 9, in
from Bio.SeqFeature import (
ImportError: cannot import name 'AbstractPosition' from 'Bio.SeqFeature' (/home/promt/asenv/lib/python3.9/site-packages/Bio/SeqFeature.py)

How can I fix it? Thanks!

I also typed the following but to no avail:

```<code>antismash --help
antismash --help-showall
</code>```

Body:
I am now trying if my recently installed anti-SMASH would work. However, the following lines appear as I type antismash --check-prereqs:

Traceback (most recent call last):
File "/home/promt/asenv/bin/antismash", line 5, in
from antismash.main import entrypoint
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/init.py", line 12, in
from antismash.main import run_antismash, get_detection_modules,

File "/home/promt/asenv/lib/python3.9/site-packages/antismash/main.py", line 31, in
from antismash.common import logs, record_processing, serialiser
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/common/record_processing.py", line 19, in
from antismash.common.secmet import Record
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/common/secmet/init.py", line 11, in
from .record import Record
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/common/secmet/record.py", line 25, in
from .features import (
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/common/secmet/features/init.py", line 6, in
from .antismash_domain import AntismashDomain
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/common/secmet/features/antismash_domain.py", line 10, in
from .domain import Domain, generate_protein_location_from_qualifiers
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/common/secmet/features/domain.py", line 13, in
from .feature import Feature, FeatureLocation, Location
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/common/secmet/features/feature.py", line 13, in
from antismash.common.secmet.locations import (
File "/home/promt/asenv/lib/python3.9/site-packages/antismash/common/secmet/locations.py", line 9, in
from Bio.SeqFeature import (
ImportError: cannot import name 'AbstractPosition' from 'Bio.SeqFeature' (/home/promt/asenv/lib/python3.9/site-packages/Bio/SeqFeature.py)

How can I fix it? Thanks!

I also typed the following but to no avail:

antismash --help
antismash --help-showall


问:
AWS DMS unable to pick Postgre Replication Slot with custom name
I am creating a DMS task to load data from RDS postgre to AWS s3. The DMS is creating a replication slot by default having a long alpha numeric slot name . Both Full load and CDC works fine with it .

I want to provide a useful name to the slot so that I can identify for which table it is being used for ?
Now when I try to create a slot with the a custom name using the following query :

```<code>select  * FROM pg_create_logical_replication_slot('slotname', 'test_decoding');
</code>```

It is getting created. But the active flag is false .

```<code>select * from pg_replication_slots
</code>```

Is there any way to make it active ?

And provide the slotName in DMS Endpoint configuration in Extra connection attributes slotName=slotname

Body:
I am creating a DMS task to load data from RDS postgre to AWS s3. The DMS is creating a replication slot by default having a long alpha numeric slot name . Both Full load and CDC works fine with it .

I want to provide a useful name to the slot so that I can identify for which table it is being used for ?
Now when I try to create a slot with the a custom name using the following query :

select  * FROM pg_create_logical_replication_slot('slotname', 'test_decoding');

It is getting created. But the active flag is false .

select * from pg_replication_slots

Is there any way to make it active ?

And provide the slotName in DMS Endpoint configuration in Extra connection attributes slotName=slotname


问:
How do MLP Classification using Keras
I'm newbie in Neural Network. I'm going to do a text classification research using MLP model with keras. Input layer consisting of 900 nodes, 2 hidden layers, and 2 outputs.

The code I use is as follows:

```<code>model = Sequential()
model.add(Dense(units = 100, activation = 'sigmoid'))
model.add(Dense(units = 100, activation = 'sigmoid'))
model.add(Dense(units = 2, activation = 'sigmoid'))
opt = Adam (learning_rate=0.001)
model.compile(loss = 'binary_crossentropy', optimizer = opt, metrics = ['accuracy'])
print(model.summary())
</code>```

But get error:

```<code>This model has not yet been built. Build the model first by calling `build()` or by calling the model on a batch of data.
</code>```

How to fix that error? Thank you.

Title: How do MLP Classification using Keras

Body:
I'm newbie in Neural Network. I'm going to do a text classification research using MLP model with keras. Input layer consisting of 900 nodes, 2 hidden layers, and 2 outputs.

The code I use is as follows:

model = Sequential()
model.add(Dense(units = 100, activation = 'sigmoid'))
model.add(Dense(units = 100, activation = 'sigmoid'))
model.add(Dense(units = 2, activation = 'sigmoid'))
opt = Adam (learning_rate=0.001)
model.compile(loss = 'binary_crossentropy', optimizer = opt, metrics = ['accuracy'])
print(model.summary())

But get error:

This model has not yet been built. Build the model first by calling `build()` or by calling the model on a batch of data.

How to fix that error? Thank you.


问:
Python executes statements under If condition even though the If condition is false
```<code>            if str(orders_pnl.iloc[i,0])[-2:]=='CE':
                if orders_pnl.iloc[i,5]=='N':
                    c=error(str(orders_pnl.iloc[i,0])[-2:],str(ce))
</code>```

Now even though the 1st if value condition is false, it still directly goes to 3rd statement, doesnt check the 2nd if statement as well.

I have attached the screenshot as well for reference. And this is not specic to this If statement and condition, it is happening for most if statements.

Ideally the If statement should not be executed

Body:
            if str(orders_pnl.iloc[i,0])[-2:]=='CE':
                if orders_pnl.iloc[i,5]=='N':
                    c=error(str(orders_pnl.iloc[i,0])[-2:],str(ce))

Now even though the 1st if value condition is false, it still directly goes to 3rd statement, doesnt check the 2nd if statement as well.

I have attached the screenshot as well for reference. And this is not specic to this If statement and condition, it is happening for most if statements.

Ideally the If statement should not be executed


问:
Client Secret / Refresh Token Missing (Attempting to use Google's TTS API in Python)
I am building a small app to convert text to speech using google's API, but I am getting an error related to my credentials. I have never used google cloud or its APIs before, and was unable to find an answer that worked on google. For reference, here are the relevant code snippets:

```<code>credentials = Credentials.from_authorized_user_file('credentials.json')
service = build('texttospeech', 'v1', credentials=credentials)

...

synth_speech = service.text().synthesize(body={ 'input' : { 'text': text, }, 'voice' : voice,    'audioConfig' : { 'audioeEncoding': 'MP3', }, }).execute()
</code>```

open(outputfilepath, 'wb').write(synth_speech['audioContent'])

My Credentials.json is formatted like this:

```<code>{   "type": "service_account",   "project_id": "MY ID",   "private_key_id": "MY ID",       "private_key": "-----BEGIN PRIVATE KEY-----\n MY KEY \n-----END PRIVATE KEY-----\n",   "client_email": "MY EMAIL",   "client_id": " MY CLIENT ID",   "auth_uri": "https://accounts.google.com/o/oauth2/auth",   "token_uri": "https://oauth2.googleapis.com/token",   "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",   "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/MY URL"}
</code>```

I know the fields client_secret and refresh_token are missing, but I can't figure out how to generate the right key which has this information. I'm sure I'm just not setting up my google cloud environment correctly, but I can't figure out a solution for the life of me.

Cheers,
Daniel

Body:
I am building a small app to convert text to speech using google's API, but I am getting an error related to my credentials. I have never used google cloud or its APIs before, and was unable to find an answer that worked on google. For reference, here are the relevant code snippets:

credentials = Credentials.from_authorized_user_file('credentials.json')
service = build('texttospeech', 'v1', credentials=credentials)

...

synth_speech = service.text().synthesize(body={ 'input' : { 'text': text, }, 'voice' : voice,    'audioConfig' : { 'audioeEncoding': 'MP3', }, }).execute()

open(outputfilepath, 'wb').write(synth_speech['audioContent'])

My Credentials.json is formatted like this:

{   "type": "service_account",   "project_id": "MY ID",   "private_key_id": "MY ID",       "private_key": "-----BEGIN PRIVATE KEY-----\n MY KEY \n-----END PRIVATE KEY-----\n",   "client_email": "MY EMAIL",   "client_id": " MY CLIENT ID",   "auth_uri": "https://accounts.google.com/o/oauth2/auth",   "token_uri": "https://oauth2.googleapis.com/token",   "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",   "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/MY URL"}

I know the fields client_secret and refresh_token are missing, but I can't figure out how to generate the right key which has this information. I'm sure I'm just not setting up my google cloud environment correctly, but I can't figure out a solution for the life of me.

Cheers,
Daniel


问:
*ngIf statement inside html Angular
```<code> <mat-form-field>
  <input matInput #filterBox [disabled]="!!toggleButton.value.length" />
  <mat-label *ngIf="toggleButton?.value?.length <= 0">Search box</mat-label>
  <mat-label *ngIf="toggleButton?.value?.length > 0">Search box is blocked</mat-label>
</mat-form-field>

<mat-button-toggle-group #toggleButton="matButtonToggleGroup" multiple="">
  <mat-button-toggle value="TEST1">1</mat-button-toggle>
  <mat-button-toggle value="TEST2">2</mat-button-toggle>
  <mat-button-toggle value="TEST3">3</mat-button-toggle>
</mat-button-toggle-group>
</code>```

So what I want achive. If button from button-toggle-group will be pressed I want see disabled input and in label "Search box is blocked".

Also remeber that If I will press 1 and 2 buttons I also  I want see disabled input and in label "Search box is blocked". Is this possbile

Title: *ngIf statement inside html Angular

Body:
 <mat-form-field>
  <input matInput #filterBox [disabled]="!!toggleButton.value.length" />
  <mat-label *ngIf="toggleButton?.value?.length <= 0">Search box</mat-label>
  <mat-label *ngIf="toggleButton?.value?.length > 0">Search box is blocked</mat-label>
</mat-form-field>

<mat-button-toggle-group #toggleButton="matButtonToggleGroup" multiple="">
  <mat-button-toggle value="TEST1">1</mat-button-toggle>
  <mat-button-toggle value="TEST2">2</mat-button-toggle>
  <mat-button-toggle value="TEST3">3</mat-button-toggle>
</mat-button-toggle-group>

So what I want achive. If button from button-toggle-group will be pressed I want see disabled input and in label "Search box is blocked".

Also remeber that If I will press 1 and 2 buttons I also  I want see disabled input and in label "Search box is blocked". Is this possbile


问:
Spring batch split and group records according to a key
I have a list of Database objects. The ask is to

Group the records by some key lets say itemType

Each group items should be executed in a single-threaded fashion. Lets say the order matters

The groups can be executed in a multi-threaded fashion

I will also have to pass some values to each steps while processing the items in the group

I am thinking of creating another table that populates the distinct records by itemType then process by chunks. The downside is Spring batch only knows about the temp table not the original table. How do I solve this problem?


问:
Any one know about how to manipulate the object using MRTK for Oculus Quest-2?
I want to do the MRTK toolkit in the oculus quest 2 for the user friendly so how to do

I tried the object manipulator script on the cube but not working in quest 2


问:
Is it possible to record both incoming and outgoing calls in android, I tried using media recorder, but the need was not fulfilled
This is my Receiver Class where i'm getting phone state of both incoming and outgoing calls

```<code>public class MyBroadcastReceiver extends BroadcastReceiver {

    private static final String TAG = "MyBroadcastReceiver";
    //The receiver will be recreated whenever android feels like it.  We need a static variable to remember data between instantiations

    private String phoneIncomingNumber = "";
    private String PhoneState = "";
    private String Message = "";
    private MediaRecorder recorder;

    Context context;

    //Call Recording varibales
    private static final String AUDIO_RECORDER_FILE_EXT_3GP = ".3gp";
    private static final String AUDIO_RECORDER_FILE_EXT_MP4 = ".mp3";
    private static final String AUDIO_RECORDER_FOLDER = "Recordings";

    Uri audiouri;
    ParcelFileDescriptor file;
    AudioManager audioManager;
    private int currentFormat = 0;
    private int output_formats[] = { MediaRecorder.OutputFormat.MPEG_4,
            MediaRecorder.OutputFormat.THREE_GPP };
    private String file_exts[] = { AUDIO_RECORDER_FILE_EXT_MP4,
            AUDIO_RECORDER_FILE_EXT_3GP };

    //The receiver will be recreated whenever android feels like it.  We need a static variable to remember data between instantiations
    private static int lastState = TelephonyManager.CALL_STATE_IDLE;
    private static Date callStartTime;
    private static boolean isIncoming;
    private static String savedNumber;  //because the passed incoming is only valid in ringing

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO: This method is called when the BroadcastReceiver is receiving
//        Registering service
        context.startService(new Intent(context, MyService.class));

//      Getting Call Details
        String stateStr = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
        phoneIncomingNumber = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);

        Log.d("Call Status1", "Number1: " + phoneIncomingNumber + ":STATE : " + stateStr);

        if (intent.getAction().equals("android.intent.action.NEW_OUTGOING_CALL")) {
            savedNumber = intent.getStringExtra("android.intent.extra.PHONE_NUMBER");
        } else {
            phoneIncomingNumber = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);
            int state = 0;
            if (stateStr.equals(TelephonyManager.EXTRA_STATE_IDLE)) {
                state = TelephonyManager.CALL_STATE_IDLE;
            } else if (stateStr.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) {
                state = TelephonyManager.CALL_STATE_OFFHOOK;
                startRecording(getRecordFileName(phoneIncomingNumber), context);
            } else if (stateStr.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
                state = TelephonyManager.CALL_STATE_RINGING;
            }
            onCallStateChanged(context, state, phoneIncomingNumber);
        }
    }

    //Derived classes should override these to respond to specific events of interest
    protected void onIncomingCallStarted(Context ctx, String number, Date start) {

        Message = "Call from : \"+number+\" on DATE \"+start+\" started";
        Log.d("Call Status", "INCOMING CALL STARTED");

    }

    protected void onOutgoingCallStarted(Context ctx, String number, Date start) {
        Message = "Call to : \"+number+\" on DATE \"+start+\" started";
        Log.d("Call Status", "OUTGOING CALL STARTED to :" + number);
        PhoneState = "OFFHOOK";

    }

    protected void onIncomingCallEnded(Context ctx, String number, Date start, Date end) {
        Log.d("Call Status", "INCOMING CALL ENDED");
        Message = "Call from : \"+number+\" on DATE \"+start+\" ended";
        stopRecording();
    }

    protected void onOutgoingCallEnded(Context ctx, String number, Date start, Date end) {
        Message = "Call to : \"+number+\" on DATE \"+start+\" ended";
        Log.d("Call Status", "OUTGOING CALL ENDED");
        stopRecording();
    }

    protected void onMissedCall(Context ctx, String number, Date start) {
        Message = "Missed call : \"+number+\" on DATE \"+start+\"";
        Log.d("Call Status", "MISSED CALL");

    }

    //Deals with actual events

    //Incoming call-  goes from IDLE to RINGING when it rings, to OFFHOOK when it's answered, to IDLE when its hung up
    //Outgoing call-  goes from IDLE to OFFHOOK when it dials out, to IDLE when hung up
    public void onCallStateChanged(Context context, int state, String number) {
        Log.d("Call", "Number: " + number);
        if (lastState == state) {
            //No change, debounce extras
            return;
        }
        switch (state) {
            case TelephonyManager.CALL_STATE_RINGING:
                isIncoming = true;
                callStartTime = new Date();
                savedNumber = number;
                PhoneState = "RINGING";
                onIncomingCallStarted(context, number, callStartTime);
                break;
            case TelephonyManager.CALL_STATE_OFFHOOK:
                //Transition of ringing->offhook are pickups of incoming calls.  Nothing done on them
                if (lastState != TelephonyManager.CALL_STATE_RINGING) {
                    isIncoming = false;
                    callStartTime = new Date();
                    PhoneState = "OFFHOOK";
                    onOutgoingCallStarted(context, phoneIncomingNumber, callStartTime);
                }
                break;
            case TelephonyManager.CALL_STATE_IDLE:
                //Went to idle-  this is the end of a call.  What type depends on previous state(s)
                if (lastState == TelephonyManager.CALL_STATE_RINGING) {
                    //Ring but no pickup-  a miss
                    PhoneState = "IDLE";
                    onMissedCall(context, phoneIncomingNumber, callStartTime);
                } else if (isIncoming) {
                    PhoneState = "INCOMING CALL ENDED";
                    onIncomingCallEnded(context, phoneIncomingNumber, callStartTime, new Date());
                } else {
                    PhoneState = "OUTGOING CALL ENDED";
                    onOutgoingCallEnded(context, phoneIncomingNumber, callStartTime, new Date());
                }
                break;
        }
        lastState = state;
    }

    private MediaRecorder.OnErrorListener errorListener = new MediaRecorder.OnErrorListener() {
        @Override
        public void onError(MediaRecorder mr, int what, int extra) {
            Toast.makeText(context,
                    "Error: " + what + ", " + extra, Toast.LENGTH_SHORT).show();
        }
    };

    private MediaRecorder.OnInfoListener infoListener = new MediaRecorder.OnInfoListener() {
        @Override
        public void onInfo(MediaRecorder mr, int what, int extra) {
            Toast.makeText(context,
                            "Warning: " + what + ", " + extra, Toast.LENGTH_SHORT)
                    .show();
        }
    };

    //    Recording Audio
    private void startRecording(String fileName, Context ctx) {
        Log.d("Call Status", "Inside");
        ContentValues values = new ContentValues(4);
        values.put(MediaStore.Audio.Media.TITLE, fileName);
        values.put(MediaStore.Audio.Media.DATE_ADDED, (int) (System.currentTimeMillis() / 1000));
        values.put(MediaStore.Audio.Media.MIME_TYPE, "audio/mpeg");
        values.put(MediaStore.Audio.Media.RELATIVE_PATH, "Music/Recordings/");

        audiouri = ctx.getContentResolver().insert(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, values);
        Log.d("Call Status", "Call Status: "+audiouri);
        try {
            file = ctx.getContentResolver().openFileDescriptor(audiouri, "w");
        } catch (Exception e) {
            Log.d("Call Status", "File Error"+e);
        }

        audioManager = (AudioManager) ctx.getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
        audioManager.setMode(AudioManager.MODE_IN_CALL);
//        audioManager.setSpeakerphoneOn(true);

        recorder = new MediaRecorder();
        recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION);
        recorder.setOutputFormat(output_formats[currentFormat]);
        //recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
        recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
        recorder.setOutputFile(file.getFileDescriptor());
        recorder.setOnErrorListener(errorListener);
        recorder.setOnInfoListener(infoListener);

        try {
            recorder.prepare();
            recorder.start();
        } catch (IllegalStateException e) {
            Log.e("REDORDING :: ",e.getMessage());
            e.printStackTrace();
        } catch (IOException e) {
            Log.e("REDORDING :: ",e.getMessage());
            e.printStackTrace();
        }
         }

    private void stopRecording() {
//        audioManager.setSpeakerphoneOn(false);

        try{
            if (null != recorder) {
                recorder.stop();
                recorder.reset();
                recorder.release();

                recorder = null;
            }
        }catch(Exception stopException){
            Log.d("Exce",stopException+"");
        }
    }

    private String getRecordFileName(String phoneNumber) {
        // Generate a unique file name based on the phone number and the current time
        String timeStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
        return phoneNumber + "_" + timeStamp + ".wav";
    }

}
</code>```

My Service Class to run receiver as a forground service

public class MyService extends Service {

```<code>private static final int SERVICE_NOTIFICATION_ID =2 ;
private static final String CHANNEL_ID = "PhoneStateModule";

public MyService() {
}

private Handler handler = new Handler();
private Runnable runnableCode = new Runnable() {
    @Override
    public void run() {
        try{
            handler.postDelayed(this, 2000);
        }catch (Exception ex){
            Log.d("Error",ex+"");
        }

    }
};

private void createNotificationChannel() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        int importance = NotificationManager.IMPORTANCE_DEFAULT;
        NotificationChannel channel = new NotificationChannel(CHANNEL_ID, "PhoneStateModule", importance);
        channel.setDescription("CHANEL DESCRIPTION");
        NotificationManager notificationManager = getSystemService(NotificationManager.class);
        notificationManager.createNotificationChannel(channel);
    }
}

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    this.handler.post(this.runnableCode); // Starting the interval
    // Turning into a foreground service
    createNotificationChannel(); // Creating channel for API 26+
    Intent notificationIntent = new Intent(this, MainActivity.class);
    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT|PendingIntent.FLAG_MUTABLE);
    Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID)
            .setContentTitle("Phone Recording Service")
            .setContentText("Running…")
            .setSmallIcon(R.mipmap.ic_launcher)
            .setContentIntent(contentIntent)
            .setOngoing(true)
            .build();
    startForeground(SERVICE_NOTIFICATION_ID, notification);
    return START_STICKY;
}

@Override
public IBinder onBind(Intent intent) {
    // TODO: Return the communication channel to the service.
   return null;
}
</code>```

}

Can anyone help me with the issue facing, I am using device with android 10 and am not getting the recordings, even if the recording is saved inside folder I'm not getting any audio.

Body:
This is my Receiver Class where i'm getting phone state of both incoming and outgoing calls

public class MyBroadcastReceiver extends BroadcastReceiver {

    private static final String TAG = "MyBroadcastReceiver";
    //The receiver will be recreated whenever android feels like it.  We need a static variable to remember data between instantiations

    private String phoneIncomingNumber = "";
    private String PhoneState = "";
    private String Message = "";
    private MediaRecorder recorder;

    Context context;

    //Call Recording varibales
    private static final String AUDIO_RECORDER_FILE_EXT_3GP = ".3gp";
    private static final String AUDIO_RECORDER_FILE_EXT_MP4 = ".mp3";
    private static final String AUDIO_RECORDER_FOLDER = "Recordings";

    Uri audiouri;
    ParcelFileDescriptor file;
    AudioManager audioManager;
    private int currentFormat = 0;
    private int output_formats[] = { MediaRecorder.OutputFormat.MPEG_4,
            MediaRecorder.OutputFormat.THREE_GPP };
    private String file_exts[] = { AUDIO_RECORDER_FILE_EXT_MP4,
            AUDIO_RECORDER_FILE_EXT_3GP };

    //The receiver will be recreated whenever android feels like it.  We need a static variable to remember data between instantiations
    private static int lastState = TelephonyManager.CALL_STATE_IDLE;
    private static Date callStartTime;
    private static boolean isIncoming;
    private static String savedNumber;  //because the passed incoming is only valid in ringing

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO: This method is called when the BroadcastReceiver is receiving
//        Registering service
        context.startService(new Intent(context, MyService.class));

//      Getting Call Details
        String stateStr = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
        phoneIncomingNumber = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);

        Log.d("Call Status1", "Number1: " + phoneIncomingNumber + ":STATE : " + stateStr);

        if (intent.getAction().equals("android.intent.action.NEW_OUTGOING_CALL")) {
            savedNumber = intent.getStringExtra("android.intent.extra.PHONE_NUMBER");
        } else {
            phoneIncomingNumber = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);
            int state = 0;
            if (stateStr.equals(TelephonyManager.EXTRA_STATE_IDLE)) {
                state = TelephonyManager.CALL_STATE_IDLE;
            } else if (stateStr.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) {
                state = TelephonyManager.CALL_STATE_OFFHOOK;
                startRecording(getRecordFileName(phoneIncomingNumber), context);
            } else if (stateStr.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
                state = TelephonyManager.CALL_STATE_RINGING;
            }
            onCallStateChanged(context, state, phoneIncomingNumber);
        }
    }

    //Derived classes should override these to respond to specific events of interest
    protected void onIncomingCallStarted(Context ctx, String number, Date start) {

        Message = "Call from : \"+number+\" on DATE \"+start+\" started";
        Log.d("Call Status", "INCOMING CALL STARTED");

    }

    protected void onOutgoingCallStarted(Context ctx, String number, Date start) {
        Message = "Call to : \"+number+\" on DATE \"+start+\" started";
        Log.d("Call Status", "OUTGOING CALL STARTED to :" + number);
        PhoneState = "OFFHOOK";

    }

    protected void onIncomingCallEnded(Context ctx, String number, Date start, Date end) {
        Log.d("Call Status", "INCOMING CALL ENDED");
        Message = "Call from : \"+number+\" on DATE \"+start+\" ended";
        stopRecording();
    }

    protected void onOutgoingCallEnded(Context ctx, String number, Date start, Date end) {
        Message = "Call to : \"+number+\" on DATE \"+start+\" ended";
        Log.d("Call Status", "OUTGOING CALL ENDED");
        stopRecording();
    }

    protected void onMissedCall(Context ctx, String number, Date start) {
        Message = "Missed call : \"+number+\" on DATE \"+start+\"";
        Log.d("Call Status", "MISSED CALL");

    }

    //Deals with actual events

    //Incoming call-  goes from IDLE to RINGING when it rings, to OFFHOOK when it's answered, to IDLE when its hung up
    //Outgoing call-  goes from IDLE to OFFHOOK when it dials out, to IDLE when hung up
    public void onCallStateChanged(Context context, int state, String number) {
        Log.d("Call", "Number: " + number);
        if (lastState == state) {
            //No change, debounce extras
            return;
        }
        switch (state) {
            case TelephonyManager.CALL_STATE_RINGING:
                isIncoming = true;
                callStartTime = new Date();
                savedNumber = number;
                PhoneState = "RINGING";
                onIncomingCallStarted(context, number, callStartTime);
                break;
            case TelephonyManager.CALL_STATE_OFFHOOK:
                //Transition of ringing->offhook are pickups of incoming calls.  Nothing done on them
                if (lastState != TelephonyManager.CALL_STATE_RINGING) {
                    isIncoming = false;
                    callStartTime = new Date();
                    PhoneState = "OFFHOOK";
                    onOutgoingCallStarted(context, phoneIncomingNumber, callStartTime);
                }
                break;
            case TelephonyManager.CALL_STATE_IDLE:
                //Went to idle-  this is the end of a call.  What type depends on previous state(s)
                if (lastState == TelephonyManager.CALL_STATE_RINGING) {
                    //Ring but no pickup-  a miss
                    PhoneState = "IDLE";
                    onMissedCall(context, phoneIncomingNumber, callStartTime);
                } else if (isIncoming) {
                    PhoneState = "INCOMING CALL ENDED";
                    onIncomingCallEnded(context, phoneIncomingNumber, callStartTime, new Date());
                } else {
                    PhoneState = "OUTGOING CALL ENDED";
                    onOutgoingCallEnded(context, phoneIncomingNumber, callStartTime, new Date());
                }
                break;
        }
        lastState = state;
    }

    private MediaRecorder.OnErrorListener errorListener = new MediaRecorder.OnErrorListener() {
        @Override
        public void onError(MediaRecorder mr, int what, int extra) {
            Toast.makeText(context,
                    "Error: " + what + ", " + extra, Toast.LENGTH_SHORT).show();
        }
    };

    private MediaRecorder.OnInfoListener infoListener = new MediaRecorder.OnInfoListener() {
        @Override
        public void onInfo(MediaRecorder mr, int what, int extra) {
            Toast.makeText(context,
                            "Warning: " + what + ", " + extra, Toast.LENGTH_SHORT)
                    .show();
        }
    };

    //    Recording Audio
    private void startRecording(String fileName, Context ctx) {
        Log.d("Call Status", "Inside");
        ContentValues values = new ContentValues(4);
        values.put(MediaStore.Audio.Media.TITLE, fileName);
        values.put(MediaStore.Audio.Media.DATE_ADDED, (int) (System.currentTimeMillis() / 1000));
        values.put(MediaStore.Audio.Media.MIME_TYPE, "audio/mpeg");
        values.put(MediaStore.Audio.Media.RELATIVE_PATH, "Music/Recordings/");

        audiouri = ctx.getContentResolver().insert(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, values);
        Log.d("Call Status", "Call Status: "+audiouri);
        try {
            file = ctx.getContentResolver().openFileDescriptor(audiouri, "w");
        } catch (Exception e) {
            Log.d("Call Status", "File Error"+e);
        }

        audioManager = (AudioManager) ctx.getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
        audioManager.setMode(AudioManager.MODE_IN_CALL);
//        audioManager.setSpeakerphoneOn(true);

        recorder = new MediaRecorder();
        recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION);
        recorder.setOutputFormat(output_formats[currentFormat]);
        //recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
        recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
        recorder.setOutputFile(file.getFileDescriptor());
        recorder.setOnErrorListener(errorListener);
        recorder.setOnInfoListener(infoListener);

        try {
            recorder.prepare();
            recorder.start();
        } catch (IllegalStateException e) {
            Log.e("REDORDING :: ",e.getMessage());
            e.printStackTrace();
        } catch (IOException e) {
            Log.e("REDORDING :: ",e.getMessage());
            e.printStackTrace();
        }
         }

    private void stopRecording() {
//        audioManager.setSpeakerphoneOn(false);

        try{
            if (null != recorder) {
                recorder.stop();
                recorder.reset();
                recorder.release();

                recorder = null;
            }
        }catch(Exception stopException){
            Log.d("Exce",stopException+"");
        }
    }

    private String getRecordFileName(String phoneNumber) {
        // Generate a unique file name based on the phone number and the current time
        String timeStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
        return phoneNumber + "_" + timeStamp + ".wav";
    }

}

My Service Class to run receiver as a forground service

public class MyService extends Service {

private static final int SERVICE_NOTIFICATION_ID =2 ;
private static final String CHANNEL_ID = "PhoneStateModule";

public MyService() {
}

private Handler handler = new Handler();
private Runnable runnableCode = new Runnable() {
    @Override
    public void run() {
        try{
            handler.postDelayed(this, 2000);
        }catch (Exception ex){
            Log.d("Error",ex+"");
        }

    }
};

private void createNotificationChannel() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        int importance = NotificationManager.IMPORTANCE_DEFAULT;
        NotificationChannel channel = new NotificationChannel(CHANNEL_ID, "PhoneStateModule", importance);
        channel.setDescription("CHANEL DESCRIPTION");
        NotificationManager notificationManager = getSystemService(NotificationManager.class);
        notificationManager.createNotificationChannel(channel);
    }
}

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    this.handler.post(this.runnableCode); // Starting the interval
    // Turning into a foreground service
    createNotificationChannel(); // Creating channel for API 26+
    Intent notificationIntent = new Intent(this, MainActivity.class);
    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT|PendingIntent.FLAG_MUTABLE);
    Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID)
            .setContentTitle("Phone Recording Service")
            .setContentText("Running…")
            .setSmallIcon(R.mipmap.ic_launcher)
            .setContentIntent(contentIntent)
            .setOngoing(true)
            .build();
    startForeground(SERVICE_NOTIFICATION_ID, notification);
    return START_STICKY;
}

@Override
public IBinder onBind(Intent intent) {
    // TODO: Return the communication channel to the service.
   return null;
}

}

Can anyone help me with the issue facing, I am using device with android 10 and am not getting the recordings, even if the recording is saved inside folder I'm not getting any audio.


问:
IIS Flask Server: IPython- ValueError: underlying buffer has been detached
I have deployed Flask Server on IIS. I'm getting below error while importing IPython module in my code.

I have tried IPython version: 5.0, 6.0, 7.16.3 but still

When i run my code through cmd it works and server on localhost starts. But when hosted through IIS Server below issue remains If I keep import IPython line in code.

My python config:

```<code>python 3.6

Flask==1.1.2
Keras==2.1.3
scikit-learn==0.23.2
scipy==1.4.1
tensorflow==1.14.0
wfastcgi==3.0.0
</code>```

Heres my code:

```<code>from flask import Flask
import IPython

app = Flask(__name__)

@app.route("/flaskapi2/")
def hello():
    return "Hello from FastCGI via IIS!"
if __name__ == "__main__":
    app.run()

</code>```

Error:

```<code>Error occurred while reading WSGI handler:

Traceback (most recent call last):
  File "E:\deploy_car_damage\wfastcgi.py", line 791, in main
    env, handler = read_wsgi_handler(response.physical_path)
  File "E:\deploy_car_damage\wfastcgi.py", line 633, in read_wsgi_handler
    handler = get_wsgi_handler(os.getenv("WSGI_HANDLER"))
  File "E:\deploy_car_damage\wfastcgi.py", line 600, in get_wsgi_handler
    handler = __import__(module_name, fromlist=[name_list[0][0]])
  File ".\main.py", line 2, in <module>
    import IPython
  File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\__init__.py", line 56, in <module>
    from .terminal.embed import embed
  File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\terminal\embed.py", line 15, in <module>
    from IPython.core.interactiveshell import DummyMod, InteractiveShell
  File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\core\interactiveshell.py", line 63, in <module>
    from IPython.utils import io
  File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\utils\io.py", line 94, in <module>
    stdin = IOStream(sys.stdin, fallback=devnull)
  File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\utils\io.py", line 38, in __init__
    for meth in filter(clone, dir(stream)):
  File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\utils\io.py", line 37, in clone
    return not hasattr(self, meth) and not meth.startswith('_')
  File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\utils\io.py", line 81, in closed
    return self.stream.closed
ValueError: underlying buffer has been detached

StdOut:

StdErr:
</code>```

What does underlying buffer has been detached mean and how can I resolve it.

Body:
I have deployed Flask Server on IIS. I'm getting below error while importing IPython module in my code.

I have tried IPython version: 5.0, 6.0, 7.16.3 but still

When i run my code through cmd it works and server on localhost starts. But when hosted through IIS Server below issue remains If I keep import IPython line in code.

My python config:

python 3.6

Flask==1.1.2
Keras==2.1.3
scikit-learn==0.23.2
scipy==1.4.1
tensorflow==1.14.0
wfastcgi==3.0.0

Heres my code:

from flask import Flask
import IPython

app = Flask(__name__)

@app.route("/flaskapi2/")
def hello():
    return "Hello from FastCGI via IIS!"
if __name__ == "__main__":
    app.run()

Error:

Error occurred while reading WSGI handler:

Traceback (most recent call last):
  File "E:\deploy_car_damage\wfastcgi.py", line 791, in main
    env, handler = read_wsgi_handler(response.physical_path)
  File "E:\deploy_car_damage\wfastcgi.py", line 633, in read_wsgi_handler
    handler = get_wsgi_handler(os.getenv("WSGI_HANDLER"))
  File "E:\deploy_car_damage\wfastcgi.py", line 600, in get_wsgi_handler
    handler = __import__(module_name, fromlist=[name_list[0][0]])
  File ".\main.py", line 2, in <module>
    import IPython
  File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\__init__.py", line 56, in <module>
    from .terminal.embed import embed
  File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\terminal\embed.py", line 15, in <module>
    from IPython.core.interactiveshell import DummyMod, InteractiveShell
  File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\core\interactiveshell.py", line 63, in <module>
    from IPython.utils import io
  File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\utils\io.py", line 94, in <module>
    stdin = IOStream(sys.stdin, fallback=devnull)
  File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\utils\io.py", line 38, in __init__
    for meth in filter(clone, dir(stream)):
  File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\utils\io.py", line 37, in clone
    return not hasattr(self, meth) and not meth.startswith('_')
  File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\utils\io.py", line 81, in closed
    return self.stream.closed
ValueError: underlying buffer has been detached

StdOut:

StdErr:

What does underlying buffer has been detached mean and how can I resolve it.


问:
Is there a way to deploy multiple packaged components sharing a certain package version using Boomi platform API?
Normally to deploy a packaged component using Boomi platform API, we use a packaged component Id and this end in deploying just one packaged component (whose id is provided). However, I want to deploy a list of packaged components sharing the same package version in one api call, is that possible?</p>