问:
How to properly configure multiple DMLCs to listen to a single sqs queue?
We have an order managament system in which after every order state update we make an api call to our client to keep them updated. We do this by first sending a message to a sqs queue and inside a consumer we hit our clients api. The processing on consumer side usually takes about 300-350ms but The approximate age of oldest message in sqs dashboard is showing spikes that reach upto 50-60 secs.

Seeing this I thought that maybe one consumer is not enough for our load and I created multiple DMLC beans and multiple copies of our consumer class. I attached these consumer classes as listeners in these DMLCs. But I have not seen any improvement in approximate age of oldest message.
I am guessing that maybe only one of the DMLC is processing these messages and others are just sitting idle.

I added multiple DMLCs because there are other places in pur codebase where the same thing is used, But now I am not sure if this is the correct way to solve the problem.

My Consumer class looks like this:

```<code>@Component
@Slf4j
@RequiredArgsConstructor
public class HOAEventsOMSConsumer extends ConsumerCommon implements MessageListener {

  private static final int MAX_RETRY_LIMIT = 3;
  private final OMSEventsWrapper omsEventsWrapper;
  @Override
  public void onMessage(Message message) {
    try {
      TextMessage textMessage = (TextMessage) message;
      String jmsMessageId = textMessage.getJMSMessageID();

      ConsumerLogging.logStart(jmsMessageId);

      String text = textMessage.getText();
      log.info(
          "Inside HOA Events consumer Request jmsMessageId:- " + jmsMessageId + " Text:- "
              + text);
      processAndAcknowledge(message, text, textMessage);
    } catch (JMSException e) {
      log.error("JMS Exception while processing surge message", e);
    }
  }

  private void processAndAcknowledge(Message message, String text, TextMessage textMessage) throws JMSException {
    try {
      TrimmedHOAEvent hoaEvent = JsonHelper.convertFromJsonPro(text, TrimmedHOAEvent.class);
      if (hoaEvent == null) {
        throw new OMSValidationException("Empty message in hoa events queue");
      }
      EventType event = EventType.fromString(textMessage.getStringProperty("eventType"));
      omsEventsWrapper.handleOmsEvent(event,hoaEvent);
      acknowledgeMessage(message);
    } catch (Exception e) {
      int retryCount = message.getIntProperty("JMSXDeliveryCount");
      log.info("Retrying... retryCount: {}, HOAEventsOMSConsumer: {}", retryCount, text);

      if (retryCount > MAX_RETRY_LIMIT) {
        log.info("about to acknowledge the message since it has exceeded maximum retry limit");
        acknowledgeMessage(message);
      }
    }
  }
}
</code>```

And my DMLC configuration class looks like this:

```<code>@Configuration
@SuppressWarnings("unused")
public class HOAEventsOMSJMSConfig extends JMSConfigCommon{

  private Boolean isSQSQueueEnabled;

  @Autowired
  private HOAEventsOMSConsumer hoaEventsOMSConsumer;
  @Autowired
  private HOAEventsOMSConsumer2 hoaEventsOMSConsumer2;
  @Autowired
  private HOAEventsOMSConsumer3 hoaEventsOMSConsumer3;
  @Autowired
  private HOAEventsOMSConsumer4 hoaEventsOMSConsumer4;

  @Autowired
  private HOAEventsOMSConsumer5 hoaEventsOMSConsumer5;

  @Autowired
  private HOAEventsOMSConsumer6 hoaEventsOMSConsumer6;

  @Autowired
  private HOAEventsOMSConsumer7 hoaEventsOMSConsumer7;

  @Autowired
  private HOAEventsOMSConsumer8 hoaEventsOMSConsumer8;

  @Autowired
  private HOAEventsOMSConsumer9 hoaEventsOMSConsumer9;

  @Autowired
  private HOAEventsOMSConsumer10 hoaEventsOMSConsumer10;

  public HOAEventsOMSJMSConfig(IPropertyService propertyService, Environment env) {
    queueName = env.getProperty("aws.sqs.queue.oms.hoa.events.queue");
    endpoint = env.getProperty("aws.sqs.queue.endpoint") + queueName;
    JMSConfigCommon.accessId = env.getProperty("aws.sqs.access.id");
    JMSConfigCommon.accessKey = env.getProperty("aws.sqs.access.key");
    try {
      ServerNameCache serverNameCache = CacheManager.getInstance().getCache(ServerNameCache.class);
      if (serverNameCache == null) {
        serverNameCache = new ServerNameCache();
        serverNameCache.set(InetAddress.getLocalHost().getHostName());
        CacheManager.getInstance().setCache(serverNameCache);
      }
      this.isSQSQueueEnabled = propertyService.isConsumerEnabled(serverNameCache.get(), false);
    } catch (Exception e) {
      this.isSQSQueueEnabled = false;
    }
  }

  @Bean
  public JmsTemplate omsHOAEventsJMSTemplate(){
    SQSConnectionFactory sqsConnectionFactory;
    if (endpoint.toLowerCase().contains("localhost")) {
      sqsConnectionFactory =
          SQSConnectionFactory.builder().withEndpoint(getEndpoint("sqs")).build();
    } else {
      sqsConnectionFactory = SQSConnectionFactory.builder()
          .withAWSCredentialsProvider(awsCredentialsProvider)
          .withNumberOfMessagesToPrefetch(10)
          .withEndpoint(endpoint)
          .build();
    }
    CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(sqsConnectionFactory);
    JmsTemplate jmsTemplate = new JmsTemplate(cachingConnectionFactory);
    jmsTemplate.setDefaultDestinationName(queueName);
    jmsTemplate.setDeliveryPersistent(false);
    jmsTemplate.setSessionTransacted(false);
    jmsTemplate.setSessionAcknowledgeMode(SQSSession.UNORDERED_ACKNOWLEDGE);
    return jmsTemplate;
  }

  @Bean
  public DefaultMessageListenerContainer jmsListenerHOAEventsListenerContainer() {
    SQSConnectionFactory sqsConnectionFactory;
    if (endpoint.toLowerCase().contains("localhost")) {
      sqsConnectionFactory = SQSConnectionFactory.builder()
          .withEndpoint(getEndpoint("sqs"))
          .build();
    } else {
      sqsConnectionFactory = SQSConnectionFactory.builder()
          .withAWSCredentialsProvider(awsCredentialsProvider)
          .withNumberOfMessagesToPrefetch(10)
          .withEndpoint(endpoint)
          .build();
    }
    DefaultMessageListenerContainer dmlc = new DefaultMessageListenerContainer();
    dmlc.setConnectionFactory(sqsConnectionFactory);
    dmlc.setDestinationName(queueName);
    dmlc.setAutoStartup(isSQSQueueEnabled);
    dmlc.setMessageListener(hoaEventsOMSConsumer);
    dmlc.setSessionTransacted(false);
    dmlc.setSessionAcknowledgeMode(SQSSession.UNORDERED_ACKNOWLEDGE);

    return dmlc;
  }

  @Bean
  public DefaultMessageListenerContainer jmsListenerHOAEventsListenerContainerNo2() {
    SQSConnectionFactory sqsConnectionFactory;
    if (endpoint.toLowerCase().contains("localhost")) {
      sqsConnectionFactory = SQSConnectionFactory.builder()
          .withEndpoint(getEndpoint("sqs"))
          .build();
    } else {
      sqsConnectionFactory = SQSConnectionFactory.builder()
          .withAWSCredentialsProvider(awsCredentialsProvider)
          .withNumberOfMessagesToPrefetch(10)
          .withEndpoint(endpoint)
          .build();
    }
    DefaultMessageListenerContainer dmlc = new DefaultMessageListenerContainer();
    dmlc.setConnectionFactory(sqsConnectionFactory);
    dmlc.setDestinationName(queueName);
    dmlc.setAutoStartup(isSQSQueueEnabled);
    dmlc.setMessageListener(hoaEventsOMSConsumer2);
    dmlc.setSessionTransacted(false);
    dmlc.setSessionAcknowledgeMode(SQSSession.UNORDERED_ACKNOWLEDGE);
    return dmlc;
  }

  @Bean
  public DefaultMessageListenerContainer jmsListenerHOAEventsListenerContainerNo3() {
    SQSConnectionFactory sqsConnectionFactory;
    if (endpoint.toLowerCase().contains("localhost")) {
      sqsConnectionFactory = SQSConnectionFactory.builder()
          .withEndpoint(getEndpoint("sqs"))
          .build();
    } else {
      sqsConnectionFactory = SQSConnectionFactory.builder()
          .withAWSCredentialsProvider(awsCredentialsProvider)
          .withNumberOfMessagesToPrefetch(10)
          .withEndpoint(endpoint)
          .build();
    }
    DefaultMessageListenerContainer dmlc = new DefaultMessageListenerContainer();
    dmlc.setConnectionFactory(sqsConnectionFactory);
    dmlc.setDestinationName(queueName);
    dmlc.setAutoStartup(isSQSQueueEnabled);
    dmlc.setMessageListener(hoaEventsOMSConsumer3);
    dmlc.setSessionTransacted(false);
    dmlc.setSessionAcknowledgeMode(SQSSession.UNORDERED_ACKNOWLEDGE);
    return dmlc;
  }
}
</code>```

If this question is already answered somehwere else, then please point me towards that.

Body:
We have an order managament system in which after every order state update we make an api call to our client to keep them updated. We do this by first sending a message to a sqs queue and inside a consumer we hit our clients api. The processing on consumer side usually takes about 300-350ms but The approximate age of oldest message in sqs dashboard is showing spikes that reach upto 50-60 secs.

Seeing this I thought that maybe one consumer is not enough for our load and I created multiple DMLC beans and multiple copies of our consumer class. I attached these consumer classes as listeners in these DMLCs. But I have not seen any improvement in approximate age of oldest message.
I am guessing that maybe only one of the DMLC is processing these messages and others are just sitting idle.

I added multiple DMLCs because there are other places in pur codebase where the same thing is used, But now I am not sure if this is the correct way to solve the problem.

My Consumer class looks like this:

@Component
@Slf4j
@RequiredArgsConstructor
public class HOAEventsOMSConsumer extends ConsumerCommon implements MessageListener {

  private static final int MAX_RETRY_LIMIT = 3;
  private final OMSEventsWrapper omsEventsWrapper;
  @Override
  public void onMessage(Message message) {
    try {
      TextMessage textMessage = (TextMessage) message;
      String jmsMessageId = textMessage.getJMSMessageID();

      ConsumerLogging.logStart(jmsMessageId);

      String text = textMessage.getText();
      log.info(
          "Inside HOA Events consumer Request jmsMessageId:- " + jmsMessageId + " Text:- "
              + text);
      processAndAcknowledge(message, text, textMessage);
    } catch (JMSException e) {
      log.error("JMS Exception while processing surge message", e);
    }
  }

  private void processAndAcknowledge(Message message, String text, TextMessage textMessage) throws JMSException {
    try {
      TrimmedHOAEvent hoaEvent = JsonHelper.convertFromJsonPro(text, TrimmedHOAEvent.class);
      if (hoaEvent == null) {
        throw new OMSValidationException("Empty message in hoa events queue");
      }
      EventType event = EventType.fromString(textMessage.getStringProperty("eventType"));
      omsEventsWrapper.handleOmsEvent(event,hoaEvent);
      acknowledgeMessage(message);
    } catch (Exception e) {
      int retryCount = message.getIntProperty("JMSXDeliveryCount");
      log.info("Retrying... retryCount: {}, HOAEventsOMSConsumer: {}", retryCount, text);

      if (retryCount > MAX_RETRY_LIMIT) {
        log.info("about to acknowledge the message since it has exceeded maximum retry limit");
        acknowledgeMessage(message);
      }
    }
  }
}

And my DMLC configuration class looks like this:

@Configuration
@SuppressWarnings("unused")
public class HOAEventsOMSJMSConfig extends JMSConfigCommon{

  private Boolean isSQSQueueEnabled;

  @Autowired
  private HOAEventsOMSConsumer hoaEventsOMSConsumer;
  @Autowired
  private HOAEventsOMSConsumer2 hoaEventsOMSConsumer2;
  @Autowired
  private HOAEventsOMSConsumer3 hoaEventsOMSConsumer3;
  @Autowired
  private HOAEventsOMSConsumer4 hoaEventsOMSConsumer4;

  @Autowired
  private HOAEventsOMSConsumer5 hoaEventsOMSConsumer5;

  @Autowired
  private HOAEventsOMSConsumer6 hoaEventsOMSConsumer6;

  @Autowired
  private HOAEventsOMSConsumer7 hoaEventsOMSConsumer7;

  @Autowired
  private HOAEventsOMSConsumer8 hoaEventsOMSConsumer8;

  @Autowired
  private HOAEventsOMSConsumer9 hoaEventsOMSConsumer9;

  @Autowired
  private HOAEventsOMSConsumer10 hoaEventsOMSConsumer10;

  public HOAEventsOMSJMSConfig(IPropertyService propertyService, Environment env) {
    queueName = env.getProperty("aws.sqs.queue.oms.hoa.events.queue");
    endpoint = env.getProperty("aws.sqs.queue.endpoint") + queueName;
    JMSConfigCommon.accessId = env.getProperty("aws.sqs.access.id");
    JMSConfigCommon.accessKey = env.getProperty("aws.sqs.access.key");
    try {
      ServerNameCache serverNameCache = CacheManager.getInstance().getCache(ServerNameCache.class);
      if (serverNameCache == null) {
        serverNameCache = new ServerNameCache();
        serverNameCache.set(InetAddress.getLocalHost().getHostName());
        CacheManager.getInstance().setCache(serverNameCache);
      }
      this.isSQSQueueEnabled = propertyService.isConsumerEnabled(serverNameCache.get(), false);
    } catch (Exception e) {
      this.isSQSQueueEnabled = false;
    }
  }

  @Bean
  public JmsTemplate omsHOAEventsJMSTemplate(){
    SQSConnectionFactory sqsConnectionFactory;
    if (endpoint.toLowerCase().contains("localhost")) {
      sqsConnectionFactory =
          SQSConnectionFactory.builder().withEndpoint(getEndpoint("sqs")).build();
    } else {
      sqsConnectionFactory = SQSConnectionFactory.builder()
          .withAWSCredentialsProvider(awsCredentialsProvider)
          .withNumberOfMessagesToPrefetch(10)
          .withEndpoint(endpoint)
          .build();
    }
    CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(sqsConnectionFactory);
    JmsTemplate jmsTemplate = new JmsTemplate(cachingConnectionFactory);
    jmsTemplate.setDefaultDestinationName(queueName);
    jmsTemplate.setDeliveryPersistent(false);
    jmsTemplate.setSessionTransacted(false);
    jmsTemplate.setSessionAcknowledgeMode(SQSSession.UNORDERED_ACKNOWLEDGE);
    return jmsTemplate;
  }

  @Bean
  public DefaultMessageListenerContainer jmsListenerHOAEventsListenerContainer() {
    SQSConnectionFactory sqsConnectionFactory;
    if (endpoint.toLowerCase().contains("localhost")) {
      sqsConnectionFactory = SQSConnectionFactory.builder()
          .withEndpoint(getEndpoint("sqs"))
          .build();
    } else {
      sqsConnectionFactory = SQSConnectionFactory.builder()
          .withAWSCredentialsProvider(awsCredentialsProvider)
          .withNumberOfMessagesToPrefetch(10)
          .withEndpoint(endpoint)
          .build();
    }
    DefaultMessageListenerContainer dmlc = new DefaultMessageListenerContainer();
    dmlc.setConnectionFactory(sqsConnectionFactory);
    dmlc.setDestinationName(queueName);
    dmlc.setAutoStartup(isSQSQueueEnabled);
    dmlc.setMessageListener(hoaEventsOMSConsumer);
    dmlc.setSessionTransacted(false);
    dmlc.setSessionAcknowledgeMode(SQSSession.UNORDERED_ACKNOWLEDGE);

    return dmlc;
  }

  @Bean
  public DefaultMessageListenerContainer jmsListenerHOAEventsListenerContainerNo2() {
    SQSConnectionFactory sqsConnectionFactory;
    if (endpoint.toLowerCase().contains("localhost")) {
      sqsConnectionFactory = SQSConnectionFactory.builder()
          .withEndpoint(getEndpoint("sqs"))
          .build();
    } else {
      sqsConnectionFactory = SQSConnectionFactory.builder()
          .withAWSCredentialsProvider(awsCredentialsProvider)
          .withNumberOfMessagesToPrefetch(10)
          .withEndpoint(endpoint)
          .build();
    }
    DefaultMessageListenerContainer dmlc = new DefaultMessageListenerContainer();
    dmlc.setConnectionFactory(sqsConnectionFactory);
    dmlc.setDestinationName(queueName);
    dmlc.setAutoStartup(isSQSQueueEnabled);
    dmlc.setMessageListener(hoaEventsOMSConsumer2);
    dmlc.setSessionTransacted(false);
    dmlc.setSessionAcknowledgeMode(SQSSession.UNORDERED_ACKNOWLEDGE);
    return dmlc;
  }

  @Bean
  public DefaultMessageListenerContainer jmsListenerHOAEventsListenerContainerNo3() {
    SQSConnectionFactory sqsConnectionFactory;
    if (endpoint.toLowerCase().contains("localhost")) {
      sqsConnectionFactory = SQSConnectionFactory.builder()
          .withEndpoint(getEndpoint("sqs"))
          .build();
    } else {
      sqsConnectionFactory = SQSConnectionFactory.builder()
          .withAWSCredentialsProvider(awsCredentialsProvider)
          .withNumberOfMessagesToPrefetch(10)
          .withEndpoint(endpoint)
          .build();
    }
    DefaultMessageListenerContainer dmlc = new DefaultMessageListenerContainer();
    dmlc.setConnectionFactory(sqsConnectionFactory);
    dmlc.setDestinationName(queueName);
    dmlc.setAutoStartup(isSQSQueueEnabled);
    dmlc.setMessageListener(hoaEventsOMSConsumer3);
    dmlc.setSessionTransacted(false);
    dmlc.setSessionAcknowledgeMode(SQSSession.UNORDERED_ACKNOWLEDGE);
    return dmlc;
  }
}

If this question is already answered somehwere else, then please point me towards that.


来源: stackexchange

问:
Showing blank view when opening razorpay checkout in SwiftUI
I am trying to integrate Razorpay SDK in my iOS SwiftUI project.
I am opening a CheckoutView in showSheet function with isPresented boolean that determines whether to present the sheet or not.
When i try to open razorpay checkout view in SwiftUI with the help of Coordinator and UIViewControllerRepresentable, it only shows me blank white screen.

Here is my CheckoutView

```<code>struct CheckoutView: UIViewControllerRepresentable {
    func makeUIViewController(context: Context) -> CheckoutViewController {
        .init()
    }

    func updateUIViewController(_ uiViewController: CheckoutViewController, context: Context) { }

    func makeCoordinator() -> Coordinator {
        Coordinator(self)
    }

    class Coordinator: NSObject, RazorpayPaymentCompletionProtocol, RazorpayPaymentCompletionProtocolWithData {
        let parent: CheckoutView

        typealias Razorpay = RazorpayCheckout
        var razorpay: RazorpayCheckout? = nil

        init(_ parent: CheckoutView) {
            self.parent = parent
            super.init()
            print("init called")

            razorpay = RazorpayCheckout.initWithKey("<mykey>", andDelegate: self)

            let options: [AnyHashable:Any] = [
                "key": "<mykey>",
                "prefill": [
                    "contact": "1234567890",
                    "email": "a@a.com"
                ],
//                "image": merchantDetails.logo,
                "amount" : 100,
                "currency": "INR",
                "name": "merchantDetails.name",
                "theme": [
//                    "color": merchantDetails.color.toHexString()
                ]
            ]
            print("options \(options)")
            if let rzp = self.razorpay {
                rzp.open(options)
            } else {
                print("Unable to initialize")
            }
        }

        func onPaymentError(_ code: Int32, description str: String) {
              print("error: ", code, str)
          }

          func onPaymentSuccess(_ payment_id: String) {
              print("success: ", payment_id)
          }

        func onPaymentError(_ code: Int32, description str: String, andData response: [AnyHashable : Any]?) {
            print("error: ", code)
        }

        func onPaymentSuccess(_ payment_id: String, andData response: [AnyHashable : Any]?) {
            print("success: ", payment_id)
        }
    }
}

class CheckoutViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
//        self.showPaymentForm()
    }
}
</code>```

Here is the log that i am getting.

```<code>init called
options [AnyHashable("prefill"): ["email": "a@a.com", "contact": "1234567890"], AnyHashable("name"): "merchantDetails.name", AnyHashable("currency"): "INR", AnyHashable("theme"): [], AnyHashable("amount"): 100]
2023-01-04 11:30:31.510877+0530 kidsclutt[78228:1171954] [boringssl] boringssl_metrics_log_metric_block_invoke(153) Failed to log metrics

RAZORPAY_SDK_CHECKS

##### Check 0:
Version Upgrade Check
1.3.0

##### Check 1:
Minimum Deployment Version Check
Project deployment target > iOS 10

2023-01-04 11:30:32.837037+0530 kidsclutt[78228:1171437] [Presentation] Attempt to present <Razorpay.OpinionatedAlertVC: 0x7f8a1d1d5700> on <_TtGC7SwiftUI19UIHostingControllerGVS_15ModifiedContentGS1_V9kidsclutt11ContentViewGVS_30_EnvironmentKeyWritingModifierGSqCS2_13AuthViewModel___GVS_26_PreferenceWritingModifierVS_23PreferredColorSchemeKey___: 0x7f8a1d10bfd0> (from <_TtGC7SwiftUI19UIHostingControllerGVS_15ModifiedContentGS1_V9kidsclutt11ContentViewGVS_30_EnvironmentKeyWritingModifierGSqCS2_13AuthViewModel___GVS_26_PreferenceWritingModifierVS_23PreferredColorSchemeKey___: 0x7f8a1d10bfd0>) which is already presenting <_TtGC7SwiftUI29PresentationHostingControllerVS_7AnyView_: 0x7f8a1d1cba30>.
2023-01-04 11:30:36.009980+0530 kidsclutt[78228:1171958] [boringssl] boringssl_metrics_log_metric_block_invoke(153) Failed to log metrics
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am trying to integrate Razorpay SDK in my iOS SwiftUI project.
I am opening a CheckoutView in showSheet function with isPresented boolean that determines whether to present the sheet or not.
When i try to open razorpay checkout view in SwiftUI with the help of Coordinator and UIViewControllerRepresentable, it only shows me blank white screen.

Here is my CheckoutView

struct CheckoutView: UIViewControllerRepresentable {
    func makeUIViewController(context: Context) -> CheckoutViewController {
        .init()
    }

    func updateUIViewController(_ uiViewController: CheckoutViewController, context: Context) { }

    func makeCoordinator() -> Coordinator {
        Coordinator(self)
    }

    class Coordinator: NSObject, RazorpayPaymentCompletionProtocol, RazorpayPaymentCompletionProtocolWithData {
        let parent: CheckoutView

        typealias Razorpay = RazorpayCheckout
        var razorpay: RazorpayCheckout? = nil

        init(_ parent: CheckoutView) {
            self.parent = parent
            super.init()
            print("init called")

            razorpay = RazorpayCheckout.initWithKey("<mykey>", andDelegate: self)

            let options: [AnyHashable:Any] = [
                "key": "<mykey>",
                "prefill": [
                    "contact": "1234567890",
                    "email": "a@a.com"
                ],
//                "image": merchantDetails.logo,
                "amount" : 100,
                "currency": "INR",
                "name": "merchantDetails.name",
                "theme": [
//                    "color": merchantDetails.color.toHexString()
                ]
            ]
            print("options \(options)")
            if let rzp = self.razorpay {
                rzp.open(options)
            } else {
                print("Unable to initialize")
            }
        }

        func onPaymentError(_ code: Int32, description str: String) {
              print("error: ", code, str)
          }

          func onPaymentSuccess(_ payment_id: String) {
              print("success: ", payment_id)
          }

        func onPaymentError(_ code: Int32, description str: String, andData response: [AnyHashable : Any]?) {
            print("error: ", code)
        }

        func onPaymentSuccess(_ payment_id: String, andData response: [AnyHashable : Any]?) {
            print("success: ", payment_id)
        }
    }
}

class CheckoutViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
//        self.showPaymentForm()
    }
}

Here is the log that i am getting.

init called
options [AnyHashable("prefill"): ["email": "a@a.com", "contact": "1234567890"], AnyHashable("name"): "merchantDetails.name", AnyHashable("currency"): "INR", AnyHashable("theme"): [], AnyHashable("amount"): 100]
2023-01-04 11:30:31.510877+0530 kidsclutt[78228:1171954] [boringssl] boringssl_metrics_log_metric_block_invoke(153) Failed to log metrics

RAZORPAY_SDK_CHECKS

##### Check 0:
Version Upgrade Check
1.3.0

##### Check 1:
Minimum Deployment Version Check
Project deployment target > iOS 10

2023-01-04 11:30:32.837037+0530 kidsclutt[78228:1171437] [Presentation] Attempt to present <Razorpay.OpinionatedAlertVC: 0x7f8a1d1d5700> on <_TtGC7SwiftUI19UIHostingControllerGVS_15ModifiedContentGS1_V9kidsclutt11ContentViewGVS_30_EnvironmentKeyWritingModifierGSqCS2_13AuthViewModel___GVS_26_PreferenceWritingModifierVS_23PreferredColorSchemeKey___: 0x7f8a1d10bfd0> (from <_TtGC7SwiftUI19UIHostingControllerGVS_15ModifiedContentGS1_V9kidsclutt11ContentViewGVS_30_EnvironmentKeyWritingModifierGSqCS2_13AuthViewModel___GVS_26_PreferenceWritingModifierVS_23PreferredColorSchemeKey___: 0x7f8a1d10bfd0>) which is already presenting <_TtGC7SwiftUI29PresentationHostingControllerVS_7AnyView_: 0x7f8a1d1cba30>.
2023-01-04 11:30:36.009980+0530 kidsclutt[78228:1171958] [boringssl] boringssl_metrics_log_metric_block_invoke(153) Failed to log metrics


问:
SQL Leetcode Hard Question Failing 1 case
Preparing for a data science interview and ran into this problem. My code is passing all of the test cases except for one.

Can someone help explain why my code doesn't work for this question
Thanks

Here is my code:

```<code># total rides by unbanned users by day
with total_rides as (SELECT t.request_at as day,
count(1) as total_rides
from trips t  join
users u on t.client_id = u.users_id and u.banned = 'No' and request_at between '2013-10-01' and '2013-10-03'
group by 1),

# cancelled rides by unbanned users by day
cancelled_rides as (
SELECT t.request_at as day,
count(1) as cancelled_rides
from trips t join
users u on t.client_id = u.users_id
where t.status like 'cancelled%'and u.banned = 'No' and request_at between '2013-10-01' and '2013-10-03'
group by 1
),

combined as(select tr.day, tr.total_rides as total_rides, cr.cancelled_rides as cancelled_rides  from cancelled_rides cr
right join total_rides tr on cr.day = tr.day)

select day, case when cancelled_rides is NULL then 0
else round(cancelled_rides/total_rides,2) end as "cancellation rate"
from combined
</code>```

Here is the test case:

```<code>| id   | client_id | driver_id | city_id | status    | request_at |
| ---- | --------- | --------- | ------- | --------- | ---------- |
| 1111 | 1         | 10        | 1       | completed | 2013-10-01 |

</code>```
```<code>| users_id | banned | role   |
| -------- | ------ | ------ |
| 1        | No     | client |
| 10       | Yes    | driver |
</code>```
```<code>Output
| day        | cancellation rate |
| ---------- | ----------------- |
| 2013-10-01 | 0                 |
</code>```
```<code>Expected
| Day | Cancellation Rate |
| --- | ----------------- |

</code>```

Body:
Preparing for a data science interview and ran into this problem. My code is passing all of the test cases except for one.

Can someone help explain why my code doesn't work for this question
Thanks

Here is my code:

# total rides by unbanned users by day
with total_rides as (SELECT t.request_at as day,
count(1) as total_rides
from trips t  join
users u on t.client_id = u.users_id and u.banned = 'No' and request_at between '2013-10-01' and '2013-10-03'
group by 1),

# cancelled rides by unbanned users by day
cancelled_rides as (
SELECT t.request_at as day,
count(1) as cancelled_rides
from trips t join
users u on t.client_id = u.users_id
where t.status like 'cancelled%'and u.banned = 'No' and request_at between '2013-10-01' and '2013-10-03'
group by 1
),

combined as(select tr.day, tr.total_rides as total_rides, cr.cancelled_rides as cancelled_rides  from cancelled_rides cr
right join total_rides tr on cr.day = tr.day)

select day, case when cancelled_rides is NULL then 0
else round(cancelled_rides/total_rides,2) end as "cancellation rate"
from combined

Here is the test case:

| id   | client_id | driver_id | city_id | status    | request_at |
| ---- | --------- | --------- | ------- | --------- | ---------- |
| 1111 | 1         | 10        | 1       | completed | 2013-10-01 |

| users_id | banned | role   |
| -------- | ------ | ------ |
| 1        | No     | client |
| 10       | Yes    | driver |

Output
| day        | cancellation rate |
| ---------- | ----------------- |
| 2013-10-01 | 0                 |

Expected
| Day | Cancellation Rate |
| --- | ----------------- |


问:
design for not returning everything in `GET /posts`
I'm making a personal blog with API + SPA.

API should be RESTful and SPA is angular.

For admin's panel posts table or landing page (with api GET /posts), I don't want to include post content, It just increase size of data transfer. also GET /posts response needs id in each item but other APIs don't need them because it is in URL (POST /posts/{{id}}, PUT /posts/{{id}}, GET /posts/{{id}})

What is correct design for it?


问:
One to one relationship foreign key missing, Entity Framework Core failing to add parent entity first
I have an entity called GiftCard which has a dependent entity called VisualElements. The two have one to one relationship configured as below:

```<code>builder.Entity<Request>()
        .HasOne<VisualElements>()
        .WithOne(c => c.Request)
        .HasForeignKey<VisualElements>(c => c.RequestFK);
</code>```

So when I try to add a GiftCard to the database, an exception is thrown

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_VisualElements_Requests_RequestFK". The conflict occurred in database "GiftCardDB", table "dbo.Requests", column 'Id'.

So basically EF Core tries to insert the dependent entity before the parent. Any solutions other than adding dependent first?

Body:
I have an entity called GiftCard which has a dependent entity called VisualElements. The two have one to one relationship configured as below:

builder.Entity<Request>()
        .HasOne<VisualElements>()
        .WithOne(c => c.Request)
        .HasForeignKey<VisualElements>(c => c.RequestFK);

So when I try to add a GiftCard to the database, an exception is thrown

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_VisualElements_Requests_RequestFK". The conflict occurred in database "GiftCardDB", table "dbo.Requests", column 'Id'.

So basically EF Core tries to insert the dependent entity before the parent. Any solutions other than adding dependent first?


问:
Qcalendarwidget multiple selection
I got a really dumb question for Qcalendarwidget. In the selection mode, we can set it as no selection or single selection, but is there any way to set it as multiple selections?  - like hold the ctrl and do multiple select date - return with me a list of dates</p>

Title: Qcalendarwidget multiple selection


问:
i have problem in writing text in 16pt title along with 12pt text throughout the section in overleaf??/
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb} \usepackage[square,numbers]{natbib} \usepackage{graphicx} \usepackage{hyphenat} \usepackage{mathptmx} \usepackage{tgtermes} \usepackage{parskip} \usepackage[arrowdel]{physics} \usepackage{multicol} \usepackage{fontspec} \usepackage{tocloft} \usepackage{ragged2e} \usepackage[english]{babel} \usepackage{geometry} \setmainfont{Times New Roman} \newgeometry{top=2.5cm, right=2.5cm, bottom=2.5cm, left=3.5cm} \setlength{\columnsep}{1cm} \renewcommand\cftloftitlefont{\Large} \renewcommand\cftfigfont{\Large} \renewcommand\cftfigpagefont{\Large} \linespread{1.25} \pagenumbering{roman} \date{} \title{\textbf{\Large ELECTRONIC AND MAGNETIC PROPERTIES OF HALF HEUSLER ALLOY CoMnSb}}`

I want title of my all pages to be 16pt (here \Large with \documentclass[12pt] gives me 17pt title fontsize for ELECTRONIC AND MAGENTIC PROPERTIES OF HALF HEUSLER ALLOY CoMnSb)


问:
Is there any rule to follow to create mvvm project structure in android studio project
Generally,

MVVM or MVC or MVP , we are allocating classes under the package structure, as per architecture pattern role and responsible of each components.

Ex:

View - Design/user interaction related classes. ex: Activity/Fragments

Model - it helps to manage the data storage, which is coming fro Database or Networking side through repository/service API. ex: Pojo class/ Getter Setter class/ Data class in kotlin

ViewModel - it helps to hold all the business logic and bridge between view and repository.
ex: Service API calling related classes.

we are creating classes based on the architecture pattern role.

remaining Constant, Utility, Adapter, DataBase classes - where can we keep it?

is there any rule to keep this classes any particular folder, based on google recommendation?
Please share any android developer official link. ( i do not fine any official documentation, only samples are available)

or based on the developer convenient, we can keep these classes are separate folders.

Please suggest on this.  Thanks Advance


问:
Jenkins - Build Steps - Changes Build Description - Token Macros Don't Work
In a Jenkins Freestyle Job Config,  I am trying to use "Build Steps -> Changes Build Description" to provide a URL to an external website where I have stored build artifacts.

From the job config inline help for "Build Steps -> Changes Build Description" for Freestyle Jobs:
Normally, build description is empty, but it can be changed by setting what name new build gets. This field can contain macros.

But attempting to do a Token Macro transform in that field produces an error, despite documentation indicating that the transform is supported.

Jenkins Version : CloudBees CI Managed Controller 2.361.3.2-rolling

Plugin Version : Token Macro Plugin Version 308.v4f2b_ed62b_b_16

Assume the following Build Parameters:
PARAM1=my_job
PARAM2=test_param_22_01_03

I want to use the last 8 characters of a Build Parameter to form the URL to supply in the Build Description, e.g. :

```<code><a href = "https://web.site/path/${PARAM1}/results/${PARAM2:${#PARAM2}-8:8}">Link to Artifacts</a>
</code>```

Per Jenkins Documentation on Token Transforms , the PARAM2 token macro transform above is documented as supported, but in my console log, I see:

Failed to evaluate description macro:org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Error processing tokens

If I specify just the parameters ${PARAM1} and ${PARAM2} with No Token Transform, e.g:

```<code><a href = "https://web.site/path/${PARAM1}/results/${PARAM2}">Link to Artifacts</a>
</code>```

All works OK,  but as soon as I attempt to extract a substring from PARAM2,  I get the error above. What am I doing wrong?

Body:
In a Jenkins Freestyle Job Config,  I am trying to use "Build Steps -> Changes Build Description" to provide a URL to an external website where I have stored build artifacts.

From the job config inline help for "Build Steps -> Changes Build Description" for Freestyle Jobs:
Normally, build description is empty, but it can be changed by setting what name new build gets. This field can contain macros.

But attempting to do a Token Macro transform in that field produces an error, despite documentation indicating that the transform is supported.

Jenkins Version : CloudBees CI Managed Controller 2.361.3.2-rolling

Plugin Version : Token Macro Plugin Version 308.v4f2b_ed62b_b_16

Assume the following Build Parameters:
PARAM1=my_job
PARAM2=test_param_22_01_03

I want to use the last 8 characters of a Build Parameter to form the URL to supply in the Build Description, e.g. :

Link to Artifacts

Per Jenkins Documentation on Token Transforms , the PARAM2 token macro transform above is documented as supported, but in my console log, I see:

Failed to evaluate description macro:org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Error processing tokens

If I specify just the parameters ${PARAM1} and ${PARAM2} with No Token Transform, e.g:

Link to Artifacts

All works OK,  but as soon as I attempt to extract a substring from PARAM2,  I get the error above. What am I doing wrong?


问:
CreateWindowEx classic style. Remove thick border

I am creating a Window under Windows 11 with classic style using CreateWindowEx and SetWindowTheme.

However the window has Thickborder. How do I remove the thick border ?

Thank You.

```<code>hwnd = user32.CreateWindowExW(
            0,
            wndclass.lpszClassName,
            'title',
            WS_OVERLAPPEDWINDOW,
            CW_USEDEFAULT,
            CW_USEDEFAULT,
            mx,
            my,
            None,
            None,
            wndclass.hInstance,
            None)

UxTheme.SetWindowTheme(hwnd, '', '')
</code>```

Body:
I am creating a Window under Windows 11 with classic style using CreateWindowEx and SetWindowTheme.

However the window has Thickborder. How do I remove the thick border ?

Thank You.

hwnd = user32.CreateWindowExW(
            0,
            wndclass.lpszClassName,
            'title',
            WS_OVERLAPPEDWINDOW,
            CW_USEDEFAULT,
            CW_USEDEFAULT,
            mx,
            my,
            None,
            None,
            wndclass.hInstance,
            None)

UxTheme.SetWindowTheme(hwnd, '', '')


问:
System.InvalidOperationException: Page must not already have a parent in Xamarin Forms
In Appcenter this exception is happend. i am not able to reproduce this crash.
please help me

App Center Log:

```<code>NavigationProxy.PushModalAsync (Xamarin.Forms.Page modal, System.Boolean animated)
ShellSection.GoToAsync (Xamarin.Forms.NavigationRequest request, System.Collections.Generic.IDictionary`2[TKey,TValue] queryData, System.Nullable`1[T] animate)
Shell.GoToAsync (Xamarin.Forms.ShellNavigationState state, System.Nullable`1[T] animate, System.Boolean enableRelativeShellRoutes)
AtCustomerScanPage.CheckForCompletion (System.String containerId)
AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state)
SyncContext+<>c__DisplayClass2_0.<Post>b__0 ()
Thread+RunnableImplementor.Run ()
IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this)
(wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.60(intptr,intptr)
</code>```

Existing code:

```<code>public async void CheckForCompletion(string containerId)
    {
        if (ViewModel.CanContinue)
        {
            await Shell.Current.GoToAsync(nameof(AtCustomerPage));
            return;
        }
   }
</code>```

Body:
In Appcenter this exception is happend. i am not able to reproduce this crash.
please help me

App Center Log:

NavigationProxy.PushModalAsync (Xamarin.Forms.Page modal, System.Boolean animated)
ShellSection.GoToAsync (Xamarin.Forms.NavigationRequest request, System.Collections.Generic.IDictionary`2[TKey,TValue] queryData, System.Nullable`1[T] animate)
Shell.GoToAsync (Xamarin.Forms.ShellNavigationState state, System.Nullable`1[T] animate, System.Boolean enableRelativeShellRoutes)
AtCustomerScanPage.CheckForCompletion (System.String containerId)
AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state)
SyncContext+<>c__DisplayClass2_0.<Post>b__0 ()
Thread+RunnableImplementor.Run ()
IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this)
(wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.60(intptr,intptr)

Existing code:

public async void CheckForCompletion(string containerId)
    {
        if (ViewModel.CanContinue)
        {
            await Shell.Current.GoToAsync(nameof(AtCustomerPage));
            return;
        }
   }


问:
Is there a way to get a Firestore document from a Firebase CLoud Function using the document value
I am building a React app with a Firebase back end and Firebase Cloud Functions. I have a collection called 'users' and in it users are stored with their uid and data which include Name and phone number. Each user has a unique phone number. The user data looks like this:

```<code>{
    uid: i8uCaO5yDYT5aICpFgxPJYRLzor1,
    data: {
        first_name: 'Name',
        last_name: 'Alsoname',
        id_number: '123242133'
    }
}
</code>```

I would like to get back a user data object if the ID number matches the parameter I pass. I try doing it like this:

```<code>    const userObject = admin.firestore().collection('users')
    .where('id_number', '==', '123242133').get();
</code>```

I am stuck on how to get the uid of this user and the other data that is inside of it. Please help.
Thanks.

Body:
I am building a React app with a Firebase back end and Firebase Cloud Functions. I have a collection called 'users' and in it users are stored with their uid and data which include Name and phone number. Each user has a unique phone number. The user data looks like this:

{
    uid: i8uCaO5yDYT5aICpFgxPJYRLzor1,
    data: {
        first_name: 'Name',
        last_name: 'Alsoname',
        id_number: '123242133'
    }
}

I would like to get back a user data object if the ID number matches the parameter I pass. I try doing it like this:

    const userObject = admin.firestore().collection('users')
    .where('id_number', '==', '123242133').get();

I am stuck on how to get the uid of this user and the other data that is inside of it. Please help.
Thanks.


问:
Form of cubic spline hazard function for Cox Regression
I am trying to understand the form of piecewise hazard function for piece wise Cox regression. I have python codes and output below. My focus is also to find the formula for python output. What is the formula for hazard function for below python output. Below is what I taught but still needs help to  place log lambda? and where can I input Beta?

```<code> What I tried as a form for just one variable:
 h(t) = h0(t) * exp(beta1x1t) for t < t1
 h(t) = h0(t) * exp(beta1x1t + beta2*(t-t1)) for t1 <= t < t2
 h(t) = h0(t) * exp(beta1x1t + beta2*(t-x1)+beta3(t-t2)) for t2 <= t

 Code:
 cph_piecewise=CoxPHFitter(penalizer=0.4,baseline_estimation_method
 ="piecewise",breakpoints=[20,30]) \
 .fit(df_new,duration_col='tenure',event_col='Churn')
</code>```

Body:
I am trying to understand the form of piecewise hazard function for piece wise Cox regression. I have python codes and output below. My focus is also to find the formula for python output. What is the formula for hazard function for below python output. Below is what I taught but still needs help to  place log lambda? and where can I input Beta?

 What I tried as a form for just one variable:
 h(t) = h0(t) * exp(beta1x1t) for t < t1
 h(t) = h0(t) * exp(beta1x1t + beta2*(t-t1)) for t1 <= t < t2
 h(t) = h0(t) * exp(beta1x1t + beta2*(t-x1)+beta3(t-t2)) for t2 <= t

 Code:
 cph_piecewise=CoxPHFitter(penalizer=0.4,baseline_estimation_method
 ="piecewise",breakpoints=[20,30]) \
 .fit(df_new,duration_col='tenure',event_col='Churn')


问:
js is not working when i am putting the bootstrap card in the form
When I am putting the whole card into the form tag in HTML then the js is not working please give me a solution. I want to put form because the enter key of the keyboard is not working. and I want that to work, and in future, i want to save the conversation into the database model , the backend is made up of Django.

here is my html:

```<code><section>
<div class="container py-5">

  <div class="row d-flex justify-content-center">
    <form>
    <div class="card">
      <div class="card-header d-flex justify-content-between align-items-center p-3"
        style="border-top: 4px solid blue; background-color:#3792cd;" >
        <h5 class="mb-0" style="text-align:center; color:white;">Your chatbot is here!
   </h5>
        <div class="d-flex flex-row align-items-center">
          <i class="fa fa-minus me-3 text-muted fa-xs"></i>
          <i class="fa fa-comments me-3 text-muted fa-xs"></i>
          <i class="fa fa-times text-muted fa-xs"></i>
        </div>
      </div>

      <div class="card-body" data-mdb-perfect-scrollbar="true" style="height: 440px;
   overflow-y:auto">
        <h5>Let's Chat<img style=""></h5>
        <div id="chatbot">

        </div>

      </div>

        <div class="card-footer text-muted d-flex justify-content-start align-items-
       center p-3" style="text-align:center; background-color:#3792cd">
          <div class="input-group mb-0">
            <input type="text" class="form-control" id="textInput" name="userMessage"
       placeholder="Type message"
              aria-label="Recipient's username" aria-describedby="button-addon2" />
            <button type="submit" id="buttonInput" style="padding-top: .55rem;">
              Send<i class="fa fa-send" style="padding-left: 0.5em;"></i>
            </button>
          </div>
         </div>
        </div>
       </form>

      </div>

    </div>
   <section>
  </form>
</code>```

Here is my Java scripts:

```<code>function getUserResponse(){
var userText = $('#textInput').val();
var userHTML = "<div class='userhtml'><div class='img'><img style='width:36px'
src='https://cdn.pixabay.com/photo/2016/11/18/23/38/child-1837375__340.png'/></div><div
class='userText'><span>"+userText+"</span></div></div>";
$('#textInput').val("");

$('#chatbot').append(userHTML);

$.get('/getResponse',{userMessage:userText}).done(function(data){

var returnedMessage = "<br/><div class='bothtml'><img style='width:46px'src=''/><p
class='botText'><span>"+ data +"</span/></p></div>";
    $('#chatbot').append(returnedMessage);
   })
}

$('#buttonInput').click(function(){getUserResponse();})
</code>```

if you tell me how to store the conversation into the django model it will be really appriciated too

Thankyou!

Body:
When I am putting the whole card into the form tag in HTML then the js is not working please give me a solution. I want to put form because the enter key of the keyboard is not working. and I want that to work, and in future, i want to save the conversation into the database model , the backend is made up of Django.

here is my html:

    <form>

Your chatbot is here!

Let's Chat

            <input type="text" class="form-control" id="textInput" name="userMessage"
       placeholder="Type message"
              aria-label="Recipient's username" aria-describedby="button-addon2" />
            <button type="submit" id="buttonInput" style="padding-top: .55rem;">
              Send
            </button>

       </form>

  </form>

Here is my Java scripts:

function getUserResponse(){
var userText = $('#textInput').val();
var userHTML = "

"+userText+"

";
$('#textInput').val("");

$('#chatbot').append(userHTML);

$.get('/getResponse',{userMessage:userText}).done(function(data){

var returnedMessage = "

"+ data +"

";
    $('#chatbot').append(returnedMessage);
   })
}

$('#buttonInput').click(function(){getUserResponse();})

if you tell me how to store the conversation into the django model it will be really appriciated too

Thankyou!


问:
Code refactoring seems to be a necessary evil. How can one make it less painful?
I was working on a project that involved refactoring a large codebase that had been in development for several years. One of the difficulties I encountered was that the codebase was very complex and had a lot of interdependent components, which made it difficult to understand how everything fit together. This posed a challenge because it meant that I had to spend a lot of time trying to get a grasp on the overall architecture of the codebase before I could even begin to consider how to refactor it.

Another difficulty I faced was that the codebase was very large, with thousands of lines of code spread out over hundreds of files. This made it difficult to keep track of all the changes I was making and to ensure that I wasn't breaking anything in the process. It also made it hard to test and verify that the refactored code was working as intended.

Overall, these difficulties have slowed down my progress on the code refactoring project and have made it more challenging than I anticipated. I have had to take extra care and spend more time than expected to ensure that I am refactoring the code correctly and not introducing any new bugs

I tried refactoring a large codebase by breaking it down into smaller, more manageable chunks and working on one chunk at a time. I expected the refactoring process to be smoother and easier to manage this way. However, I actually encountered more difficulties than I anticipated due to the complexity and interdependence of the code, and it has taken longer than expected to complete the refactoring process.


问:
How to make a query in codeigniter4?
I am trying to make a query using ci4. But I keep getting the same error. I don't know where the cause is. Can anyone help me.

This is my controller

    public function search(){

        $this->db = \Config\Database::connect();
        $user_id= $this->request->getPOST('search');

        $sql = "SELECT pay_daftarid.di_id, pay_daftarid.di_nama, pay_daftarid.di_nokp, pay_daftarid.di_telefon, pay_daftarid.di_emel,
                pay_daftarid.di_alamat1, pay_daftarid.di_poskod,pay_daftarid.di_kod_bandar, pay_daftarid.di_kod_negeri,
                pay_daftarid.di_kod_negara,
                hrp_ruj_negara.keterangan as negara,
                hrp_ruj_negeri.keterangan as negeri,
                hrp_ruj_bandar.nama_bandar
                FROM pay_daftarid
                JOIN hrp_ruj_negara ON hrp_ruj_negara.kod = di_kod_negara,
                JOIN hrp_ruj_negeri ON hrp_ruj_negeri.kod = di_kod_negeri,
                JOIN hrp_ruj_bandar ON kod_bandar = di_kod_bandar
                WHERE di_nokp = '$user_id'";

        $result = $this->db->query($sql);
        $data = $result->getRow();
        return $this->respond($data);

    }
```
<p>The result should return a one record based on the searched id ($user_id)</p>
<p>And this is my vue.js</p>
<pre class="lang-js prettyprint-override"><code>get_id(){
            var self = this;

            $.post(base_url + '/api/seminar/search', {
                search: self.search, //self.search
            }, function(res){ //res adalah daripada API
                self.selected = res.data[0];
                console.log(self.contents[0].di_nama);
            });

        },
</code>```

And this is my error

```<code>> <br />
<b>Fatal error</b>:  Uncaught CodeIgniter\Format\Exceptions\FormatException: Failed to parse json string, error: "Type is not supported". in C:\ci4_project\paygate\vendor\codeigniter4\framework\system\Format\JSONFormatter.php:41
Stack trace:
#0 C:\ci4_project\paygate\vendor\codeigniter4\framework\system\Format\JSONFormatter.php(41): CodeIgniter\Format\Exceptions\FormatException::forInvalidJSON('Type is not sup...')
#1 C:\ci4_project\paygate\vendor\codeigniter4\framework\system\API\ResponseTrait.php(348): CodeIgniter\Format\JSONFormatter->format(Array)
#2 C:\ci4_project\paygate\vendor\codeigniter4\framework\system\API\ResponseTrait.php(99): CodeIgniter\Debug\Exceptions->format(Array)
#3 C:\ci4_project\paygate\vendor\codeigniter4\framework\system\Debug\Exceptions.php(132): CodeIgniter\Debug\Exceptions->respond(Array, 500)
#4 [internal function]: CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ErrorException))
#5 {main}
  thrown in <b>C:\ci4_project\paygate\vendor\codeigniter4\framework\system\Format\JSONFormatter.php</b> on line <b>41</b><br />
{
    "title": "ErrorException",
    "type": "ErrorException",
    "code": 500,
    "message": "Uncaught CodeIgniter\\Format\\Exceptions\\FormatException: Failed to parse json string, error: \"Type is not supported\". in C:\\ci4_project\\paygate\\vendor\\codeigniter4\\framework\\system\\Format\\JSONFormatter.php:41\nStack trace:\n#0 C:\\ci4_project\\paygate\\vendor\\codeigniter4\\framework\\system\\Format\\JSONFormatter.php(41): CodeIgniter\\Format\\Exceptions\\FormatException::forInvalidJSON('Type is not sup...')\n#1 C:\\ci4_project\\paygate\\vendor\\codeigniter4\\framework\\system\\API\\ResponseTrait.php(348): CodeIgniter\\Format\\JSONFormatter->format(Array)\n#2 C:\\ci4_project\\paygate\\vendor\\codeigniter4\\framework\\system\\API\\ResponseTrait.php(99): CodeIgniter\\Debug\\Exceptions->format(Array)\n#3 C:\\ci4_project\\paygate\\vendor\\codeigniter4\\framework\\system\\Debug\\Exceptions.php(132): CodeIgniter\\Debug\\Exceptions->respond(Array, 500)\n#4 [internal function]: CodeIgniter\\Debug\\Exceptions->exceptionHandler(Object(ErrorException))\n#5 {main}\n  thrown",
    "file": "C:\\ci4_project\\paygate\\vendor\\codeigniter4\\framework\\system\\Format\\JSONFormatter.php",
    "line": 41,
    "trace": [
        {
            "function": "shutdownHandler",
            "class": "CodeIgniter\\Debug\\Exceptions",
            "type": "->",
            "args": []
        }
    ]
}
</code>```

Title: How to make a query in codeigniter4?

Body:
I am trying to make a query using ci4. But I keep getting the same error. I don't know where the cause is. Can anyone help me.

This is my controller

    public function search(){

        $this->db = \Config\Database::connect();
        $user_id= $this->request->getPOST('search');

        $sql = "SELECT pay_daftarid.di_id, pay_daftarid.di_nama, pay_daftarid.di_nokp, pay_daftarid.di_telefon, pay_daftarid.di_emel,
                pay_daftarid.di_alamat1, pay_daftarid.di_poskod,pay_daftarid.di_kod_bandar, pay_daftarid.di_kod_negeri,
                pay_daftarid.di_kod_negara,
                hrp_ruj_negara.keterangan as negara,
                hrp_ruj_negeri.keterangan as negeri,
                hrp_ruj_bandar.nama_bandar
                FROM pay_daftarid
                JOIN hrp_ruj_negara ON hrp_ruj_negara.kod = di_kod_negara,
                JOIN hrp_ruj_negeri ON hrp_ruj_negeri.kod = di_kod_negeri,
                JOIN hrp_ruj_bandar ON kod_bandar = di_kod_bandar
                WHERE di_nokp = '$user_id'";

        $result = $this->db->query($sql);
        $data = $result->getRow();
        return $this->respond($data);

    }

The result should return a one record based on the searched id ($user_id)

And this is my vue.js

get_id(){
            var self = this;

            $.post(base_url + '/api/seminar/search', {
                search: self.search, //self.search
            }, function(res){ //res adalah daripada API
                self.selected = res.data[0];
                console.log(self.contents[0].di_nama);
            });

        },

And this is my error

>

Fatal error:  Uncaught CodeIgniter\Format\Exceptions\FormatException: Failed to parse json string, error: "Type is not supported". in C:\ci4_project\paygate\vendor\codeigniter4\framework\system\Format\JSONFormatter.php:41
Stack trace:
#0 C:\ci4_project\paygate\vendor\codeigniter4\framework\system\Format\JSONFormatter.php(41): CodeIgniter\Format\Exceptions\FormatException::forInvalidJSON('Type is not sup...')
#1 C:\ci4_project\paygate\vendor\codeigniter4\framework\system\API\ResponseTrait.php(348): CodeIgniter\Format\JSONFormatter->format(Array)
#2 C:\ci4_project\paygate\vendor\codeigniter4\framework\system\API\ResponseTrait.php(99): CodeIgniter\Debug\Exceptions->format(Array)
#3 C:\ci4_project\paygate\vendor\codeigniter4\framework\system\Debug\Exceptions.php(132): CodeIgniter\Debug\Exceptions->respond(Array, 500)
#4 [internal function]: CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ErrorException))
#5 {main}
  thrown in C:\ci4_project\paygate\vendor\codeigniter4\framework\system\Format\JSONFormatter.php on line 41

{
    "title": "ErrorException",
    "type": "ErrorException",
    "code": 500,
    "message": "Uncaught CodeIgniter\\Format\\Exceptions\\FormatException: Failed to parse json string, error: \"Type is not supported\". in C:\\ci4_project\\paygate\\vendor\\codeigniter4\\framework\\system\\Format\\JSONFormatter.php:41\nStack trace:\n#0 C:\\ci4_project\\paygate\\vendor\\codeigniter4\\framework\\system\\Format\\JSONFormatter.php(41): CodeIgniter\\Format\\Exceptions\\FormatException::forInvalidJSON('Type is not sup...')\n#1 C:\\ci4_project\\paygate\\vendor\\codeigniter4\\framework\\system\\API\\ResponseTrait.php(348): CodeIgniter\\Format\\JSONFormatter->format(Array)\n#2 C:\\ci4_project\\paygate\\vendor\\codeigniter4\\framework\\system\\API\\ResponseTrait.php(99): CodeIgniter\\Debug\\Exceptions->format(Array)\n#3 C:\\ci4_project\\paygate\\vendor\\codeigniter4\\framework\\system\\Debug\\Exceptions.php(132): CodeIgniter\\Debug\\Exceptions->respond(Array, 500)\n#4 [internal function]: CodeIgniter\\Debug\\Exceptions->exceptionHandler(Object(ErrorException))\n#5 {main}\n  thrown",
    "file": "C:\\ci4_project\\paygate\\vendor\\codeigniter4\\framework\\system\\Format\\JSONFormatter.php",
    "line": 41,
    "trace": [
        {
            "function": "shutdownHandler",
            "class": "CodeIgniter\\Debug\\Exceptions",
            "type": "->",
            "args": []
        }
    ]
}


问:
How to clone a SWT control?
In AWT/Swing, the control supports serialization. Easy cloning.

But how to clone SWT Control? For example, Tree.

I want to make a tool to realize cloning function by extracting data from controls. But it is unclear whether Eclipse provides such a tool.

Title: How to clone a SWT control?


问:
Receiving a syntax error when signing a working firefox extension
I've tried to sign an extension on firefox using web-ext and through the AMO developer hub, but I'm receiving this error:

These are the first few lines of my background-packed.js (generated by browserify)

```<code>(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
</code>```

// shim for using process in browser
var process = module.exports = {};

the extension works just fine, but the linter refuses to let it through

Body:
I've tried to sign an extension on firefox using web-ext and through the AMO developer hub, but I'm receiving this error:

These are the first few lines of my background-packed.js (generated by browserify)

(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){

// shim for using process in browser
var process = module.exports = {};

the extension works just fine, but the linter refuses to let it through


问:
How can i use google map type in nestjs project
I have a project written with nest and I want to check if a point is inside given polygon. I figured it is possible via google.maps.geometry.poly.containsLocation() function but I couldn't figure out which module to install.

I wasn't able to find module created by google. Is there ways install google.maps.geometry.poly.containsLocation() to my nestjs project.


问:
Can we retrieve the field names from the models.py based on the column names in table from the database in a django project?
models.py: class Name(models.Model): name=models.TextField(db_column="Name_of_the_persion")

like this i defined the model, so that table 'Name' will be created on the database side, with column name as "Name_of_the_persion".
My requirement is like,I need to insert the new row in the table based on the django model field names instead of columns of tabel.
If any one knows, pls help me.

I tried inserting the data into table, by using psycopg2. But this was work in the case of pgadmin point of view only, that means its takes column names of database, instead of model fileds .


问:
Required an equivalent of SQL Server Table Type in Postgres because range, Enum are not working directly as Table
Create type Employees as Table(name Varchar(100));

This the Query in Sql server but when creating it in same in Postgres

create type Employees AS (name character varying)

Above is not working same as tables


问:
Puppeteer failing with "Missing X server or $DISPLAY", even though I set up everything correctly
I'm launching a simple Puppeteer application that scrapes a website. Most of the time it works, but from time to time (randomly), it fails in the middle of the process with the following error:

```<code>Error: Unable to launch browser, error message: Failed to launch the browser process!
ERROR:ozone_platform_x11.cc(247)] Missing X server or $DISPLAY
</code>```

I am running Puppeteer on an Ubuntu machine, and have an X11 display server ready. The value of the $DISPLAY environment variable is also set correctly.

```<code>echo $DISPLAY
</code>```

returns

```<code>:1
</code>```

Which corresponds to the ID of the X server.

So what's going on here?

Body:
I'm launching a simple Puppeteer application that scrapes a website. Most of the time it works, but from time to time (randomly), it fails in the middle of the process with the following error:

Error: Unable to launch browser, error message: Failed to launch the browser process!
ERROR:ozone_platform_x11.cc(247)] Missing X server or $DISPLAY

I am running Puppeteer on an Ubuntu machine, and have an X11 display server ready. The value of the $DISPLAY environment variable is also set correctly.

echo $DISPLAY

returns

:1

Which corresponds to the ID of the X server.

So what's going on here?


问:
How to extract segmentation data from NIFTI format file in javascript?
I'm dealing with nifti file currently, and I cannot find way to extract segmentation info (or data) from it.

I have a {filename}.nii.gz file and read this file with NIFTI-Reader-JS package, render it into html canvas.
enter image description here

As you can see, the brain image have separated areas that can be recorgnized with its color.

Q1. But how can i get each segmentation info from NIFTI-Reader-JS package or anything else? I checked all header info from this file but cannot find any hint.

When I open this file whit 3D Slicer in windows, I can choose segmentation option and it renders more specifically with various colors. And that's what I want to do with javascript.
enter image description here

My english is not good enough, so if anyone have a question or need more specific instructions please tell me.

Thanks for all your helps.


问:
Create an exe without python environment in pyinstaller?
I want to create an exe of my Python script without including the Python environment and its packages using pyinstaller. The system running the exe file already has the python environment and all the packages installed.

I tried excluding a few packages by using the exclude command but not able to find any ways to exclude the python environment.


问:
vuesax The data of tables and buttons made with vue do not change. And when I click on the table, I get an error
I used vuesax.I'm using vuesax tables, but I have two problems.

First, there is a green button on the table. When I press this button, the button value should change, but it doesn't. However, the value changes are printed well in the console. html doesn't change. When you refresh, it changes.

Second, even if you press the buttons on pages 2, 3, and 4, only the buttons on page 1 work.I gave all the IDs differently or tried 'display none', but only the green button on the first page of the table always works.

Code referenced ▼

```<code>   <template>
        <component-to-re-render :key="componentKey" />
    </template>

export default {
  data() {
    return {
      componentKey: 0
    }
  },
  methods: {
    forceRerender() {
      this.componentKey += 1
    }
  }
}
</code>```

My code html  ▼

```<code><template>
  <div :key="componentKey">
   <vs-table class="rtable blank" id="repair" cellspacing="0">
  <template #thead>
    <vs-tr>
      <vs-th> <p>설비코드</p></vs-th>
      <vs-th> <p>교체일</p> </vs-th>
      <vs-th> <p>소모품항목</p></vs-th>
      <vs-th> <p>규격</p></vs-th>
      <vs-th> <p>남은 점검일</p></vs-th>
      <vs-th> <p>교체자</p></vs-th>
      <!-- <vs-th> <p>비고</p></vs-th> -->
    </vs-tr>
  </template>
  <template #tbody>
    <vs-tr
      :key="i"
      v-for="(exchangedatasT, i) in $vs.getPage(exchangedatas1, page, max)"
      :data="exchangedatasT"
      class="tableColor"
      :class="{
        lastDay: todayGo2 !== todayGo2Go,
      }"
    >
      <vs-td
        ><p>{{ exchangedatasT.Machinecd }}</p></vs-td
      >
      <vs-td
        ><p>{{ exchangedatasT.Exchangedt }}</p></vs-td
      >
      <vs-td
        ><p>{{ exchangedatasT.ExchangeItemnm }}</p></vs-td
      >
      <vs-td
        ><p>{{ exchangedatasT.Specnm }}</p></vs-td
      >

      <vs-td
        class="pointer data99999"
        :id="[`e${i}${page}`]"
        @click="click2(i)"
        v-if="exchangedatasT.CntDay == 99999"
      >
        <p>
          <span>교체 완료</span>
        </p>
      </vs-td>
      <vs-td
        class="pointer data20"
        :id="[`e${i}${page}`]"
        @click="click2(i)"
        v-else-if="exchangedatasT.CntDay > 20"
      >
        <p>
          <span>점검 완료 : </span>
          <span>{{ exchangedatasT.CntDay }}</span>
        </p>
      </vs-td>
      <vs-td
        class="pointer data10"
        :id="[`e${i}${page}`]"
        @click="click2(i)"
        v-else-if="exchangedatasT.CntDay > 10"
      >
        <p class="">
          <span>미점검 : </span>
          <span>{{ exchangedatasT.CntDay }}</span>
        </p>
      </vs-td>
      <vs-td
        class="pointer dataElse"
        :id="[`e${i}${page}`]"
        @click="click2(i)"
        v-else
      >
        <p>
          <span>미점검 : </span>
          <span>{{ exchangedatasT.CntDay }}</span>
        </p>
      </vs-td>

      <vs-td
        ><p>{{ exchangedatasT.ExchangeUser }}</p></vs-td
      >
      <!-- <vs-td>{{ exchangedatasT.Remark }}</vs-td> -->
    </vs-tr>
  </template>
  <template #footer>
    <vs-pagination
      v-model="page"
      :length="$vs.getLength(exchangedatas1, max)"
    />
  </template>
</vs-table>
  </div>
</template>
</code>```

My code js  ▼

```<code><script>
import Vue from "vue";
import Vuesax from "vuesax";
import "vuesax/dist/vuesax.css"; //Vuesax styles
import axios from "axios";
Vue.use(Vuesax, {
  // options here
});
export default {
  props: {
    Rhatn3: String,
  },
  data: function () {
    return {

      page: 1,
      max: 10,

      Machinecd: "",
      Exchangedt: "",

      componentKey: 0,
    };
  },
  watch: {
    componentKey(newMsg) {

      console.log("New msg: " + newMsg);
    },
  },
  created() {
    const vm = this;

    axios
      //소모품
      .post("", {
        Machinecd: "Test",
        Exchangedt: vm.todayGo2,
      })
      .then((response) => {
        console.log(vm.todayGo2);
        vm.datas = response.data;
        const entries = Object.values(response.data);
        console.log(JSON.stringify(entries));
        console.log(entries);

        vm.exchangedatas1 = entries;

        for (let i = 0; i < Object.keys(response.data).length; i++) {
          // console.log(response.data);

          this.ExchangeUser = response.data[i].ExchangeUser;
          this.CntDay = response.data[i].CntDay;
          if (this.currentNumber2 == i) {
            axios
              .post("", {
                Machinecd: vm.datas[i].Machinecd,
                ExchangeItem: vm.datas[i].ExchangeItem,
                Spec: vm.datas[i].Spec,
                ExchangeUser: vm.Rhatn3,
              })
              .then((response) => {
                console.error(response);
              })
              .catch((error) => {
                console.error(error);
              });
            // this.$router.go();
          }
          this.currentNumber2 = i;
        }
      })
      .catch((error) => {
        console.error(error);
      });
    axios;
  },

  methods: {

    click2(i) {
      const vm = this;
      this.currentNumber2 = i;
      // console.log(this.current Number);
      this.componentKey += 1;
      for (let i = 0; i < Object.keys(vm.exchangedatas1).length; i++) {
        console.log(vm.datas[i].ExchangeItem);

        // console.log(this.daydatas1[i]);

        if (this.currentNumber2 == i) {
          axios
            .post("", {
              Machinecd: vm.exchangedatas1[i].Machinecd,
              ExchangeItem: vm.exchangedatas1[i].ExchangeItem,
              Spec: vm.exchangedatas1[i].Spec,
              ExchangeUser: vm.Rhatn3,
            })
            .then((response) => {
              console.log(response);
            })
            .catch((error) => {
              console.error(error);
            });
        }
      }
    },
  },
};
</script>
</code>```

Body:
I used vuesax.I'm using vuesax tables, but I have two problems.

First, there is a green button on the table. When I press this button, the button value should change, but it doesn't. However, the value changes are printed well in the console. html doesn't change. When you refresh, it changes.

Second, even if you press the buttons on pages 2, 3, and 4, only the buttons on page 1 work.I gave all the IDs differently or tried 'display none', but only the green button on the first page of the table always works.

Code referenced ▼

   <template>
        <component-to-re-render :key="componentKey" />
    </template>

export default {
  data() {
    return {
      componentKey: 0
    }
  },
  methods: {
    forceRerender() {
      this.componentKey += 1
    }
  }
}

My code html  ▼

<template>

   <vs-table class="rtable blank" id="repair" cellspacing="0">
  <template #thead>
    <vs-tr>
      <vs-th>
설비코드
</vs-th>
      <vs-th>
교체일
 </vs-th>
      <vs-th>
소모품항목
</vs-th>
      <vs-th>
규격
</vs-th>
      <vs-th>
남은 점검일
</vs-th>
      <vs-th>
교체자
</vs-th>

    </vs-tr>
  </template>
  <template #tbody>
    <vs-tr
      :key="i"
      v-for="(exchangedatasT, i) in $vs.getPage(exchangedatas1, page, max)"
      :data="exchangedatasT"
      class="tableColor"
      :class="{
        lastDay: todayGo2 !== todayGo2Go,
      }"
    >
      <vs-td
        >
{{ exchangedatasT.Machinecd }}
</vs-td
      >
      <vs-td
        >
{{ exchangedatasT.Exchangedt }}
</vs-td
      >
      <vs-td
        >
{{ exchangedatasT.ExchangeItemnm }}
</vs-td
      >
      <vs-td
        >
{{ exchangedatasT.Specnm }}
</vs-td
      >

      <vs-td
        class="pointer data99999"
        :id="[`e${i}${page}`]"
        @click="click2(i)"
        v-if="exchangedatasT.CntDay == 99999"
      >

          교체 완료

      </vs-td>
      <vs-td
        class="pointer data20"
        :id="[`e${i}${page}`]"
        @click="click2(i)"
        v-else-if="exchangedatasT.CntDay > 20"
      >

          점검 완료 :
          {{ exchangedatasT.CntDay }}

      </vs-td>
      <vs-td
        class="pointer data10"
        :id="[`e${i}${page}`]"
        @click="click2(i)"
        v-else-if="exchangedatasT.CntDay > 10"
      >

          미점검 :
          {{ exchangedatasT.CntDay }}

      </vs-td>
      <vs-td
        class="pointer dataElse"
        :id="[`e${i}${page}`]"
        @click="click2(i)"
        v-else
      >

          미점검 :
          {{ exchangedatasT.CntDay }}

      </vs-td>

      <vs-td
        >
{{ exchangedatasT.ExchangeUser }}
</vs-td
      >

    </vs-tr>
  </template>
  <template #footer>
    <vs-pagination
      v-model="page"
      :length="$vs.getLength(exchangedatas1, max)"
    />
  </template>
</vs-table>

</template>

My code js  ▼


问:
how to handle share text on whatsapp if more than one whatsapp exist in android programatically?
I am sharing text on WhatsApp using this code. By doing this I can only share on WhatsApp messenger but what if users have more than one WhatsApp install like WA Messenger, WhatsApp business, etc?

I searched a lot but couldn't find a solution, if anyone knows put your answer here this will help a lot of people.

```<code>private fun shareLink(mobile: String, msg: String) {

        try {
            val url =
                "https://wa.me/$mobile" + "?text=" + URLEncoder.encode(msg, "utf-8")
            val shareIntent = Intent(Intent.ACTION_SEND)
            shareIntent.type = "text/plain"
            shareIntent.setPackage("com.whatsapp")
            shareIntent.putExtra(Intent.EXTRA_TEXT, url)
            startActivity(shareIntent)
        }catch (e:PackageManager.NameNotFoundException){
            e.printStackTrace()
            startActivity(
                Intent(
                    Intent.ACTION_VIEW,
                    Uri.parse("http://play.google.com/store/apps/details?id=com.whatsapp")
                )
            )
        }

    }
</code>```

Body:
I am sharing text on WhatsApp using this code. By doing this I can only share on WhatsApp messenger but what if users have more than one WhatsApp install like WA Messenger, WhatsApp business, etc?

I searched a lot but couldn't find a solution, if anyone knows put your answer here this will help a lot of people.

private fun shareLink(mobile: String, msg: String) {

        try {
            val url =
                "https://wa.me/$mobile" + "?text=" + URLEncoder.encode(msg, "utf-8")
            val shareIntent = Intent(Intent.ACTION_SEND)
            shareIntent.type = "text/plain"
            shareIntent.setPackage("com.whatsapp")
            shareIntent.putExtra(Intent.EXTRA_TEXT, url)
            startActivity(shareIntent)
        }catch (e:PackageManager.NameNotFoundException){
            e.printStackTrace()
            startActivity(
                Intent(
                    Intent.ACTION_VIEW,
                    Uri.parse("http://play.google.com/store/apps/details?id=com.whatsapp")
                )
            )
        }

    }


问:
How to convert POJO to Yaml
I am trying to convert java POJO into yaml.

```<code>  DumperOptions options = new DumperOptions();
  options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);

  Yaml yaml = new Yaml(options);

  String output = yaml.dump(yamlMeta);
</code>```

I am using snakyaml library.
While converting java object to yaml, it is not maintaining order of key. it is arranging them in alphabetical order. But i want this to be in same order as of POJO.

Title: How to convert POJO to Yaml

Body:
I am trying to convert java POJO into yaml.

  DumperOptions options = new DumperOptions();
  options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);

  Yaml yaml = new Yaml(options);

  String output = yaml.dump(yamlMeta);

I am using snakyaml library.
While converting java object to yaml, it is not maintaining order of key. it is arranging them in alphabetical order. But i want this to be in same order as of POJO.


问:
How to use ternary operator for colpan in angular js?
Is this the correct way to set the colspan value with the ternary operator?

```<code>colspan="((true && false) ? 9 : (true || false) ? 8 : 7)"
</code>```

I'm not getting the exact result with this.

this is the output I'm getting.

Sorry for the outlines.

I'm expecting something like this

Note:-
columns are dynamic, which is why I need to add a ternary operator for this.

Body:
Is this the correct way to set the colspan value with the ternary operator?

colspan="((true && false) ? 9 : (true || false) ? 8 : 7)"

I'm not getting the exact result with this.

this is the output I'm getting.

Sorry for the outlines.

I'm expecting something like this

Note:-
columns are dynamic, which is why I need to add a ternary operator for this.


问:
Passing data from page to page firebase flutter
I am trying to pass firebase snapshot data from first page to second page in flutter using GET. I'm able to pass data from one screen to another in debug mode but not in release mode.

I have used a streambuilder on the page and a Future on second . Please where am i going wrong ?

here is code..

first page:

```<code> Container(
          child: Expanded(
            child: StreamBuilder(
                stream: FirebaseFirestore.instance
                    .collection('Songs')
                    .snapshots(),
                builder: (BuildContext context,
                    AsyncSnapshot<QuerySnapshot> snapshot) {
                  if (!snapshot.hasData) {
                    return Center(
                      child: CircularProgressIndicator(),
                    );
                  }

                  return Container(
                    color: Colors.white24,
                    padding: EdgeInsets.all(10),
                    child: ListView(
                      children: snapshot.data!.docs.map((document) {
                        return Container(
                          child: Card(
                            shape: RoundedRectangleBorder(
                                borderRadius: BorderRadius.circular(25),
                                side: BorderSide(
                                    color: Colors.purple, width: 2)),
                            elevation: 4,
                            child: ListTile(
                                title: Text(document['title'],
                                    style: TextStyle(fontSize: 16)),
                                subtitle: Text(
                                  document['artist'],
                                  style: TextStyle(color: Colors.purple),
                                ),
                                onTap: () {
                                  Get.to(() => DetailsPage(
                                        piss: document,
                                        post: document.id,
                                      ));
                                },
                                contentPadding: EdgeInsets.all(20),
                                leading: Image.asset('assets/logo.png'),
                                trailing: document['isNew'] == true
                                    ? Image.asset(
                                        'assets/new.gif',
                                      )
                                    : null),
                          ),
                        );
                      }).toList(),
                    ),
                  );
                }),
          ),
        ),
        _banner == null
            ? Container()
            : Container(
                margin: const EdgeInsets.only(bottom: 12),
                height: 52,
                child: AdWidget(
                  ad: _banner!,
                ),
              ),
      ],
    ),
  ),
);
</code>```

}
}

second page

```<code> FutureBuilder(
            future: getData(),
            builder: (context, snapshot) {
              if (snapshot.connectionState == ConnectionState.waiting) {
                return Center(
                  child: CircularProgressIndicator(),
                );
              } else {
                return Expanded(
                  child: ListView.builder(
                      itemCount: widget.piss['tileHeaders'].length,
                      itemBuilder: (context, index) {
                        return GestureDetector(
                          onTap: () {
                            setState(() {
                              _index = index;
                              counter = counter + 1;

                              print('COUNTER: $counter');
                              if (counter == 3) {
                                _showRewardedAd();
                                _controller.play();
                                print("Counter is $counter");
                                counter = 0;
                                _createRewardedAd();
                              }
                            });
                            index > 0
                                ? playIt(index)
                                : _controller
                                    .load(widget.piss['videos'][index]);
                          },
                          child: Card(
                              elevation: 5,
                              child: Column(
                                children: [
                                  Container(
                                      height: 100,
                                      child: Row(
                                        children: [
                                          Center(
                                              child: Padding(
                                            padding: EdgeInsets.all(10),
                                            child: Expanded(
                                              child: Image.asset(
                                                  "assets/logo.png"),
                                              flex: 2,
</code>```

//                                      flex: 2,),
),
)),
Expanded(
child: Container(
alignment:
Alignment.topLeft,
child: Column(
children: [
Expanded(
flex: 5,
child: ListTile(
title: Text(
widget.piss[
'tileHeaders']
[index],
style: TextStyle(
fontSize:
26)),
),
),
Expanded(
flex: 5,
child: Row(
mainAxisAlignment:
MainAxisAlignment
.end,
children: [
Container(
child: widget
.piss[
'videos']
[
index]
.toString()
.contains(
'PL')
? Center(
child:
Container(child: playlist()),
)
: Center(
child:
Container(
child:
notPlaylist(),
),
),
),
],
))
],
)),
)
],
))
],
)),
);
}),
);
}
})

Please help

Body:
I am trying to pass firebase snapshot data from first page to second page in flutter using GET. I'm able to pass data from one screen to another in debug mode but not in release mode.

I have used a streambuilder on the page and a Future on second . Please where am i going wrong ?

here is code..

first page:

 Container(
          child: Expanded(
            child: StreamBuilder(
                stream: FirebaseFirestore.instance
                    .collection('Songs')
                    .snapshots(),
                builder: (BuildContext context,
                    AsyncSnapshot<QuerySnapshot> snapshot) {
                  if (!snapshot.hasData) {
                    return Center(
                      child: CircularProgressIndicator(),
                    );
                  }

                  return Container(
                    color: Colors.white24,
                    padding: EdgeInsets.all(10),
                    child: ListView(
                      children: snapshot.data!.docs.map((document) {
                        return Container(
                          child: Card(
                            shape: RoundedRectangleBorder(
                                borderRadius: BorderRadius.circular(25),
                                side: BorderSide(
                                    color: Colors.purple, width: 2)),
                            elevation: 4,
                            child: ListTile(
                                title: Text(document['title'],
                                    style: TextStyle(fontSize: 16)),
                                subtitle: Text(
                                  document['artist'],
                                  style: TextStyle(color: Colors.purple),
                                ),
                                onTap: () {
                                  Get.to(() => DetailsPage(
                                        piss: document,
                                        post: document.id,
                                      ));
                                },
                                contentPadding: EdgeInsets.all(20),
                                leading: Image.asset('assets/logo.png'),
                                trailing: document['isNew'] == true
                                    ? Image.asset(
                                        'assets/new.gif',
                                      )
                                    : null),
                          ),
                        );
                      }).toList(),
                    ),
                  );
                }),
          ),
        ),
        _banner == null
            ? Container()
            : Container(
                margin: const EdgeInsets.only(bottom: 12),
                height: 52,
                child: AdWidget(
                  ad: _banner!,
                ),
              ),
      ],
    ),
  ),
);

}
}

second page

 FutureBuilder(
            future: getData(),
            builder: (context, snapshot) {
              if (snapshot.connectionState == ConnectionState.waiting) {
                return Center(
                  child: CircularProgressIndicator(),
                );
              } else {
                return Expanded(
                  child: ListView.builder(
                      itemCount: widget.piss['tileHeaders'].length,
                      itemBuilder: (context, index) {
                        return GestureDetector(
                          onTap: () {
                            setState(() {
                              _index = index;
                              counter = counter + 1;

                              print('COUNTER: $counter');
                              if (counter == 3) {
                                _showRewardedAd();
                                _controller.play();
                                print("Counter is $counter");
                                counter = 0;
                                _createRewardedAd();
                              }
                            });
                            index > 0
                                ? playIt(index)
                                : _controller
                                    .load(widget.piss['videos'][index]);
                          },
                          child: Card(
                              elevation: 5,
                              child: Column(
                                children: [
                                  Container(
                                      height: 100,
                                      child: Row(
                                        children: [
                                          Center(
                                              child: Padding(
                                            padding: EdgeInsets.all(10),
                                            child: Expanded(
                                              child: Image.asset(
                                                  "assets/logo.png"),
                                              flex: 2,

//                                      flex: 2,),
),
)),
Expanded(
child: Container(
alignment:
Alignment.topLeft,
child: Column(
children: [
Expanded(
flex: 5,
child: ListTile(
title: Text(
widget.piss[
'tileHeaders']
[index],
style: TextStyle(
fontSize:
26)),
),
),
Expanded(
flex: 5,
child: Row(
mainAxisAlignment:
MainAxisAlignment
.end,
children: [
Container(
child: widget
.piss[
'videos']
[
index]
.toString()
.contains(
'PL')
? Center(
child:
Container(child: playlist()),
)
: Center(
child:
Container(
child:
notPlaylist(),
),
),
),
],
))
],
)),
)
],
))
],
)),
);
}),
);
}
})

Please help


问:
How do I link my google cloud project to my play console developer account, both registered in different emails?
I have a play console developer account registered to an email A and a google cloud console account registered to an email B. I want to link my play console developer account to my google cloud project.

When I go to Play Console > Setup > API access > Link to an existing Google cloud project, it doesn't show the project name, even though I've made both email A and email B, the owner of the google cloud project and have provided admin access to my play console developer account

I've also enabled Google Play Android Developer API in my google cloud project. How do I resolve this issue?


问:
An exception was thrown while running a WSDL import extension
I got this error while adding WSDL into my ASP.NET Core Web API project using .NET 7.0. However, it works fine using SOAP UI when company's VPN is connected.

Cannot import wsdl:port\r\nDetail: \r\nXPath to Error Source: //wsdl:definitions[@targetNamespace='urn:telmaServices']/wsdl:service[@name='telmaServices']/wsdl:port[@name='mbJIRServicePort']
Cannot import wsdl:binding\r\nDetail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.\r\nXPath to wsdl:portType: //wsdl:definitions[@targetNamespace='urn:telmaServices']/wsdl:portType[@name='mbJIRServicePortType']\r\nXPath to Error Source: //wsdl:definitions[@targetNamespace='urn:telmaServices']/wsdl:binding[@name='mbJIRServiceBinding']
Cannot import wsdl:portType\r\nDetail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter\r\nError: These members may not be derived.\r\nXPath to Error Source: //wsdl:definitions[@targetNamespace='urn:telmaServices']/wsdl:portType[@name='mbJIRServicePortType']


问:
How to adjust the height of the picture element to fit the container which is responsive
Here in the below code, the width of the picture is according to the width of the container i.e the section with class .main-content. But the height is not according to the section. How to make the height responsive.

I have tried height: auto in the .main-content section, max-height:100% in the img, and the picture element.

When I do max-height:100% on the picture it adjusts according to the height of the section, but the IMG is not adjusting even when I do max-height:100% on the img element.

:root{
    --clr-neutral-900: hsl(0, 0%, 8%);
    --clr-neutral-400:hsl(0, 0%, 41%);
    --clr-neutral-100:hsl(0, 0%, 98%);

    --ff-primary:'Epilogue', sans-serif;
    --ff-body: var(--ff-primary);
    --ff-heading: var(--ff-primary);

    --fw-regular:700;
    --fw-bold:500;
}

/*
  1. Use a more-intuitive box-sizing model.
*/
*, *::before, *::after {
  box-sizing: border-box;
}
/*
  2. Remove default margin
*/
* {
  margin: 0;
  padding: 0;
}
/*
  3. Allow percentage-based heights in the application
*/
html, body {
  height: 100%;
}
/*
  Typographic tweaks!
  4. Add accessible line-height
  5. Improve text rendering
*/
body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
/*
  6. Improve media defaults
*/
img, picture, video, canvas, svg {
  max-width: 100%;
  display: block;
}
/*
  7. Remove built-in form typography styles
*/
input, button, textarea, select {
  font: inherit;
}
/*
  8. Avoid text overflows
*/
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}
ul{
    list-style: none;
    display: flex;
    gap:2rem;
}
nav{
    width:70%;
}

.login-buttons{
    display: flex;
    gap:2rem;
}
.container{
    display: flex;
    justify-content: space-between;
    margin: 1.5rem;
    align-items: center;
}
main{
    height: 95vh;
}
header{
    height: 5vh;
}
main{
    display: flex;
}

.main-content{
    margin: 4rem;
    width:100%;
    border: solid black;
    display: flex;
    padding: 1rem;
    align-items: center;

}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><main>
  <section class="main-content">
<div class="text">
  <h1>Make remote work</h1>
  <p>Get your team in sync, no matter your location.Streamline processes, create team rituals, and watch productivity soar. </p>
  <button>Learn more</button>
</div>
<picture>
  <source srcset="images/image-hero-desktop.png" media="(min-width:600px)">
  <img src="images/image-hero-mobile.png">
</picture>
  </section>
</main></code>```

Body:
Here in the below code, the width of the picture is according to the width of the container i.e the section with class .main-content. But the height is not according to the section. How to make the height responsive.

I have tried height: auto in the .main-content section, max-height:100% in the img, and the picture element.

When I do max-height:100% on the picture it adjusts according to the height of the section, but the IMG is not adjusting even when I do max-height:100% on the img element.

:root{
    --clr-neutral-900: hsl(0, 0%, 8%);
    --clr-neutral-400:hsl(0, 0%, 41%);
    --clr-neutral-100:hsl(0, 0%, 98%);

    --ff-primary:'Epilogue', sans-serif;
    --ff-body: var(--ff-primary);
    --ff-heading: var(--ff-primary);

    --fw-regular:700;
    --fw-bold:500;
}

/*
  1. Use a more-intuitive box-sizing model.
*/
*, *::before, *::after {
  box-sizing: border-box;
}
/*
  2. Remove default margin
*/
* {
  margin: 0;
  padding: 0;
}
/*
  3. Allow percentage-based heights in the application
*/
html, body {
  height: 100%;
}
/*
  Typographic tweaks!
  4. Add accessible line-height
  5. Improve text rendering
*/
body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
/*
  6. Improve media defaults
*/
img, picture, video, canvas, svg {
  max-width: 100%;
  display: block;
}
/*
  7. Remove built-in form typography styles
*/
input, button, textarea, select {
  font: inherit;
}
/*
  8. Avoid text overflows
*/
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}
ul{
    list-style: none;
    display: flex;
    gap:2rem;
}
nav{
    width:70%;
}

.login-buttons{
    display: flex;
    gap:2rem;
}
.container{
    display: flex;
    justify-content: space-between;
    margin: 1.5rem;
    align-items: center;
}
main{
    height: 95vh;
}
header{
    height: 5vh;
}
main{
    display: flex;
}

.main-content{
    margin: 4rem;
    width:100%;
    border: solid black;
    display: flex;
    padding: 1rem;
    align-items: center;

}

Make remote work

Get your team in sync, no matter your location.Streamline processes, create team rituals, and watch productivity soar.

  <button>Learn more</button>

<picture>
  <source srcset="images/image-hero-desktop.png" media="(min-width:600px)">

</picture>