问:
Read Content off web-hosted AES.key file
I try to get the content off a web-hosted AES-Key file to use it in a ConvertTo-SecureString commandlet which does not work

Say I have a AES.key-File hostet on a web-server:

197 38 254 245 252 20 255 191 96 49 [...]

I try to use its content in a ConvertTo-SecureString commandlet

$KeyFile = Invoke-WebRequest -Uri 'http://url.to/AES.key

$Key = Get-Content $KeyFile

$Secret = ConvertTo-SecureString -String $Password -Key $Key

This wont work as $Key is not in the right format:

50 51 57 10 49 51 10 [...]

I guess I have to convert the content somehow but i dont know how


来源: stackexchange

问:
Kafka producer in Websphere EJB: SslAuthenticationException
I am using a Websphere EJB application and I need to configure a Kafka producer. Not sure why it is throwing org.apache.kafka.common.errors.SslAuthenticationException: SSL handshake failed. We dont have any SSL certs configured but using SASL PLAIN authentication. Here is the method that set the Config properties

```<code>private Producer setProducer() {
    Properties props = new Properties();
    props.put("bootstrap.servers", "server.confluent.cloud:9092");
    props.put("sasl.mechanism", "PLAIN");
    props.put("sasl.jaas.config", "org.apache.kafka.common.security.plain.PlainLoginModule required username=\"DR45F4GSVVDGT\" password=\"xxx\";");
    props.put("security.protocol", "SASL_SSL");
    props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
    props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");

    Producer producer = new KafkaProducer<String, String>(props);
    return producer;
}
</code>```

I am using JDK 8 and Kafka-client-2.7. Unfortunately I need to get this working in the websphere environment. Below is the full exception. A help would be greatly appreciated.

```<code>[1/13/23 3:25:55:921 CST] 000002f3 SystemErr     R   org.apache.kafka.common.errors.SslAuthenticationException: SSL handshake failed
[1/13/23 3:25:55:921 CST] 000002f3 SystemErr     R   Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
[1/13/23 3:25:55:921 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.D.z(D.java:472)
[1/13/23 3:25:55:921 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.aq.b(aq.java:349)
[1/13/23 3:25:55:921 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.aq.c(aq.java:304)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.aq.wrap(aq.java:194)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at javax.net.ssl.SSLEngine.wrap(SSLEngine.java:21)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.SslTransportLayer.handshakeWrap(SslTransportLayer.java:478)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.SslTransportLayer.doHandshake(SslTransportLayer.java:341)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.SslTransportLayer.handshake(SslTransportLayer.java:291)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.KafkaChannel.prepare(KafkaChannel.java:173)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:543)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.Selector.poll(Selector.java:481)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:563)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.clients.producer.internals.Sender.runOnce(Sender.java:325)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:240)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at java.lang.Thread.run(Thread.java:785)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R   Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.k.a(k.java:6)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.aq.a(aq.java:113)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.D.a(D.java:91)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.D.a(D.java:74)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.E.a(E.java:307)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.E.a(E.java:121)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.D.r(D.java:223)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.D$b.a(D$b.java:3)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.D$b.run(D$b.java:4)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at java.security.AccessController.doPrivileged(AccessController.java:686)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.D$c.run(D$c.java:10)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.SslTransportLayer.runDelegatedTasks(SslTransportLayer.java:430)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.SslTransportLayer.handshakeUnwrap(SslTransportLayer.java:514)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.SslTransportLayer.doHandshake(SslTransportLayer.java:368)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      ... 8 more
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R   Caused by: com.ibm.jsse2.util.h: PKIX path building failed: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid CertPath.; internal cause is:
    java.security.cert.CertPathValidatorException: The certificate issued by CN=ISRG Root X1, O=Internet Security Research Group, C=US is not trusted; internal cause is:
    java.security.cert.CertPathValidatorException: Certificate chaining error
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.util.f.a(f.java:107)
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.util.f.b(f.java:108)
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.util.e.a(e.java:4)
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.aB.a(aB.java:211)
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.aB.a(aB.java:96)
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.aB.checkServerTrusted(aB.java:183)
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.E.a(E.java:608)
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      ... 17 more
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R   Caused by: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid CertPath.; internal cause is:
    java.security.cert.CertPathValidatorException: The certificate issued by CN=ISRG Root X1, O=Internet Security Research Group, C=US is not trusted; internal cause is:
    java.security.cert.CertPathValidatorException: Certificate chaining error
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.PKIXCertPathBuilderImpl.engineBuild(PKIXCertPathBuilderImpl.java:422)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:268)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.util.f.a(f.java:74)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      ... 23 more
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R   Caused by: java.security.cert.CertPathValidatorException: The certificate issued by CN=ISRG Root X1, O=Internet Security Research Group, C=US is not trusted; internal cause is:
    java.security.cert.CertPathValidatorException: Certificate chaining error
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.BasicChecker.<init>(BasicChecker.java:111)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.PKIXCertPathValidatorImpl.engineValidate(PKIXCertPathValidatorImpl.java:199)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.PKIXCertPathBuilderImpl.myValidator(PKIXCertPathBuilderImpl.java:749)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.PKIXCertPathBuilderImpl.buildCertPath(PKIXCertPathBuilderImpl.java:661)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.PKIXCertPathBuilderImpl.buildCertPath(PKIXCertPathBuilderImpl.java:607)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.PKIXCertPathBuilderImpl.engineBuild(PKIXCertPathBuilderImpl.java:368)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      ... 25 more
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R   Caused by: java.security.cert.CertPathValidatorException: Certificate chaining error
[1/13/23 3:25:55:926 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.CertPathUtil.findIssuer(CertPathUtil.java:316)
[1/13/23 3:25:55:926 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.BasicChecker.<init>(BasicChecker.java:108)
[1/13/23 3:25:55:926 CST] 000002f3 SystemErr     R      ... 30 more
</code>```

UPDATE
As I am still struggling to find an answer let me update with what I did. First of all I could not find the certificate CN=ISRG Root X1, O=Internet Security Research Group, C=US which is mentioned in the exception. This certificate is nowhere in the Websphere server. Also there is no certificate configured in confluent platform. I also tried to add Websphere SSL library to set Websphere TrustStore in Kafka Producer config properties as below:

```<code>com.ibm.websphere.ssl.JSSEHelper jsseHelper = JSSEHelper.getInstance();
Properties sslProperties = jsseHelper.getProperties("default");
props.put(org.apache.kafka.common.config.SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG,sslProperties.getProperty("com.ibm.ssl.trustStore"));
props.put("ssl.endpoint.identification.algorithm", "");
</code>```

but this gives me below exception:

```<code>Caused by: java.lang.ClassNotFoundException: com.ibm.websphere.security.WebSphereRuntimePermission
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:809)
</code>```

I am not sure if this was a solution but definitely was not helping :(

ContentLicense: CC BY-SA 4.0

Body:
I am using a Websphere EJB application and I need to configure a Kafka producer. Not sure why it is throwing org.apache.kafka.common.errors.SslAuthenticationException: SSL handshake failed. We dont have any SSL certs configured but using SASL PLAIN authentication. Here is the method that set the Config properties

private Producer setProducer() {
    Properties props = new Properties();
    props.put("bootstrap.servers", "server.confluent.cloud:9092");
    props.put("sasl.mechanism", "PLAIN");
    props.put("sasl.jaas.config", "org.apache.kafka.common.security.plain.PlainLoginModule required username=\"DR45F4GSVVDGT\" password=\"xxx\";");
    props.put("security.protocol", "SASL_SSL");
    props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
    props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");

    Producer producer = new KafkaProducer<String, String>(props);
    return producer;
}

I am using JDK 8 and Kafka-client-2.7. Unfortunately I need to get this working in the websphere environment. Below is the full exception. A help would be greatly appreciated.

[1/13/23 3:25:55:921 CST] 000002f3 SystemErr     R   org.apache.kafka.common.errors.SslAuthenticationException: SSL handshake failed
[1/13/23 3:25:55:921 CST] 000002f3 SystemErr     R   Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
[1/13/23 3:25:55:921 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.D.z(D.java:472)
[1/13/23 3:25:55:921 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.aq.b(aq.java:349)
[1/13/23 3:25:55:921 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.aq.c(aq.java:304)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.aq.wrap(aq.java:194)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at javax.net.ssl.SSLEngine.wrap(SSLEngine.java:21)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.SslTransportLayer.handshakeWrap(SslTransportLayer.java:478)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.SslTransportLayer.doHandshake(SslTransportLayer.java:341)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.SslTransportLayer.handshake(SslTransportLayer.java:291)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.KafkaChannel.prepare(KafkaChannel.java:173)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:543)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.Selector.poll(Selector.java:481)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:563)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.clients.producer.internals.Sender.runOnce(Sender.java:325)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:240)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at java.lang.Thread.run(Thread.java:785)
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R   Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
[1/13/23 3:25:55:922 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.k.a(k.java:6)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.aq.a(aq.java:113)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.D.a(D.java:91)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.D.a(D.java:74)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.E.a(E.java:307)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.E.a(E.java:121)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.D.r(D.java:223)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.D$b.a(D$b.java:3)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.D$b.run(D$b.java:4)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at java.security.AccessController.doPrivileged(AccessController.java:686)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.D$c.run(D$c.java:10)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.SslTransportLayer.runDelegatedTasks(SslTransportLayer.java:430)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.SslTransportLayer.handshakeUnwrap(SslTransportLayer.java:514)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      at org.apache.kafka.common.network.SslTransportLayer.doHandshake(SslTransportLayer.java:368)
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R      ... 8 more
[1/13/23 3:25:55:923 CST] 000002f3 SystemErr     R   Caused by: com.ibm.jsse2.util.h: PKIX path building failed: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid CertPath.; internal cause is:
    java.security.cert.CertPathValidatorException: The certificate issued by CN=ISRG Root X1, O=Internet Security Research Group, C=US is not trusted; internal cause is:
    java.security.cert.CertPathValidatorException: Certificate chaining error
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.util.f.a(f.java:107)
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.util.f.b(f.java:108)
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.util.e.a(e.java:4)
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.aB.a(aB.java:211)
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.aB.a(aB.java:96)
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.aB.checkServerTrusted(aB.java:183)
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.E.a(E.java:608)
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      ... 17 more
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R   Caused by: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid CertPath.; internal cause is:
    java.security.cert.CertPathValidatorException: The certificate issued by CN=ISRG Root X1, O=Internet Security Research Group, C=US is not trusted; internal cause is:
    java.security.cert.CertPathValidatorException: Certificate chaining error
[1/13/23 3:25:55:924 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.PKIXCertPathBuilderImpl.engineBuild(PKIXCertPathBuilderImpl.java:422)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:268)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      at com.ibm.jsse2.util.f.a(f.java:74)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      ... 23 more
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R   Caused by: java.security.cert.CertPathValidatorException: The certificate issued by CN=ISRG Root X1, O=Internet Security Research Group, C=US is not trusted; internal cause is:
    java.security.cert.CertPathValidatorException: Certificate chaining error
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.BasicChecker.<init>(BasicChecker.java:111)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.PKIXCertPathValidatorImpl.engineValidate(PKIXCertPathValidatorImpl.java:199)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.PKIXCertPathBuilderImpl.myValidator(PKIXCertPathBuilderImpl.java:749)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.PKIXCertPathBuilderImpl.buildCertPath(PKIXCertPathBuilderImpl.java:661)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.PKIXCertPathBuilderImpl.buildCertPath(PKIXCertPathBuilderImpl.java:607)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.PKIXCertPathBuilderImpl.engineBuild(PKIXCertPathBuilderImpl.java:368)
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R      ... 25 more
[1/13/23 3:25:55:925 CST] 000002f3 SystemErr     R   Caused by: java.security.cert.CertPathValidatorException: Certificate chaining error
[1/13/23 3:25:55:926 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.CertPathUtil.findIssuer(CertPathUtil.java:316)
[1/13/23 3:25:55:926 CST] 000002f3 SystemErr     R      at com.ibm.security.cert.BasicChecker.<init>(BasicChecker.java:108)
[1/13/23 3:25:55:926 CST] 000002f3 SystemErr     R      ... 30 more

UPDATE
As I am still struggling to find an answer let me update with what I did. First of all I could not find the certificate CN=ISRG Root X1, O=Internet Security Research Group, C=US which is mentioned in the exception. This certificate is nowhere in the Websphere server. Also there is no certificate configured in confluent platform. I also tried to add Websphere SSL library to set Websphere TrustStore in Kafka Producer config properties as below:

com.ibm.websphere.ssl.JSSEHelper jsseHelper = JSSEHelper.getInstance();
Properties sslProperties = jsseHelper.getProperties("default");
props.put(org.apache.kafka.common.config.SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG,sslProperties.getProperty("com.ibm.ssl.trustStore"));
props.put("ssl.endpoint.identification.algorithm", "");

but this gives me below exception:

Caused by: java.lang.ClassNotFoundException: com.ibm.websphere.security.WebSphereRuntimePermission
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:809)

I am not sure if this was a solution but definitely was not helping :(


问:
2 ways to get the latest row from db
I have a struts2 app with spring transactions and JPA2 over hibernate. The problem is that I have some rows in the database that are changed by an external source (some mysql triggers) and in my front app I have an ajax script that checks this values every 2 seconds. I always need to get the latest value, and not a cached one, and for this I found 2 solutions :

```<code>String sql = "FROM MyEntity WHERE xId=:id AND connect!=0 AND complete=0 AND (error=NULL OR error=0)";
  Query q = this.em.createQuery(sql).setHint("org.hibernate.cacheable", false).setParameter("agId", agentId);
        rs = q.getResultList();
        if(rs.size() == 1){
            intermedObj = (Intermed) rs.get(0);
        }
</code>```

and the other:

```<code> String sql = "FROM MyEntity WHERE xxId=:id AND connect!=0 AND complete=0 AND (error=NULL OR error=0)";
        Query q = this.em.createQuery(sql).setParameter("agId", agentId);
        rs = q.getResultList();
        if(rs.size() == 1){
            intermedObj = (Intermed) rs.get(0);
            //get latest object from DB
            em.refresh(intermedObj);
        }
</code>```

em is a instance of EntityManager which is managed by spring.

So, the question is: which is the best approach from these 2? Or maybe there is a better one ?

So you are right, I used hql there, I still have to learn a lot about hibernate an jpa, and java in general. So I guess that the correct way to write that cod in JPQL would be:

```<code> String sql = "SELECT m FROM MyEntity m WHERE m.xxId=:id AND m.connect!=0 AND m.complete=0 AND (m.error!=1)";
        Query q = this.em.createQuery(sql).setParameter("agId", agentId);
        rs = q.getResultList();
        if(rs.size() == 1){
            intermedObj = (Intermed) rs.get(0);
            //get latest object from DB
            em.refresh(intermedObj);
        }
</code>```

So the question would be, is this the proper way to make sure that I got the latest row from DB and not a cached record?

As regarding leve2 cache question I do not know if this is activated. How do I check that?

ContentLicense: CC BY-SA 3.0

Title: 2 ways to get the latest row from db

Body:
I have a struts2 app with spring transactions and JPA2 over hibernate. The problem is that I have some rows in the database that are changed by an external source (some mysql triggers) and in my front app I have an ajax script that checks this values every 2 seconds. I always need to get the latest value, and not a cached one, and for this I found 2 solutions :

String sql = "FROM MyEntity WHERE xId=:id AND connect!=0 AND complete=0 AND (error=NULL OR error=0)";
  Query q = this.em.createQuery(sql).setHint("org.hibernate.cacheable", false).setParameter("agId", agentId);
        rs = q.getResultList();
        if(rs.size() == 1){
            intermedObj = (Intermed) rs.get(0);
        }

and the other:

 String sql = "FROM MyEntity WHERE xxId=:id AND connect!=0 AND complete=0 AND (error=NULL OR error=0)";
        Query q = this.em.createQuery(sql).setParameter("agId", agentId);
        rs = q.getResultList();
        if(rs.size() == 1){
            intermedObj = (Intermed) rs.get(0);
            //get latest object from DB
            em.refresh(intermedObj);
        }

em is a instance of EntityManager which is managed by spring.

So, the question is: which is the best approach from these 2? Or maybe there is a better one ?

So you are right, I used hql there, I still have to learn a lot about hibernate an jpa, and java in general. So I guess that the correct way to write that cod in JPQL would be:

 String sql = "SELECT m FROM MyEntity m WHERE m.xxId=:id AND m.connect!=0 AND m.complete=0 AND (m.error!=1)";
        Query q = this.em.createQuery(sql).setParameter("agId", agentId);
        rs = q.getResultList();
        if(rs.size() == 1){
            intermedObj = (Intermed) rs.get(0);
            //get latest object from DB
            em.refresh(intermedObj);
        }

So the question would be, is this the proper way to make sure that I got the latest row from DB and not a cached record?

As regarding leve2 cache question I do not know if this is activated. How do I check that?


问:
How to check what version of flutter sdk xcode is using?
I have several versions of the flutter sdk installed on my machine, each has an alias. I'm not sure what version xcode is using when building the app, how can I check it?

UPDATE:
I found a solution, information about flutter sdk which is used to build the version via xcode you can find in ios/Flutter/Generated.xcconfig. From here you can change the specific sdk path in FLUTTER_ROOT.


问:
Why can't I use different generic Lists with Java record constructors
According to JEP 395 a record with additional constructors can be used:

```<code>public record Aliases(List<String> value) {
    public Aliases(Integer raw) {
        this(List.of(raw.toString()));
    }
}
</code>```

Or with multiple values as array:

```<code>public record Aliases(List<String> value) {

    public Aliases(Integer... raws) {
        this(Arrays.stream(raws).map(Object::toString).toList());
    }

}
</code>```

Where as using a typed List is not working:

```<code>public record Aliases(List<String> value) {

    public Aliases(List<Integer> rawList) {
        this(rawList.stream().map(Object::toString).toList());
    }

}
</code>```

It says

error: invalid canonical constructor in record Aliases

I would like to understand what is happening in behind and why it is not working?

Body:
According to JEP 395 a record with additional constructors can be used:

public record Aliases(List<String> value) {
    public Aliases(Integer raw) {
        this(List.of(raw.toString()));
    }
}

Or with multiple values as array:

public record Aliases(List<String> value) {

    public Aliases(Integer... raws) {
        this(Arrays.stream(raws).map(Object::toString).toList());
    }

}

Where as using a typed List is not working:

public record Aliases(List<String> value) {

    public Aliases(List<Integer> rawList) {
        this(rawList.stream().map(Object::toString).toList());
    }

}

It says

error: invalid canonical constructor in record Aliases

I would like to understand what is happening in behind and why it is not working?


问:
In pandas df create columns based on data in other columns
If I have a data frame like and want to create new columns (or a new table) based on data in other columns

```<code>data = {'uid':[1,1,2,2,3,3],
       'product':['abc','pqr','abc','rst','pqr','rst'],
       'rank':[1,2,2,1,1,2]}
df = pd.DataFrame(data)
df

   uid  product rank
0   1   abc     1
1   1   pqr     2
2   2   abc     2
3   2   rst     1
4   3   pqr     1
5   3   rst     2

I want

    uid  rank_abc rank_pqr rank_rst
0.  1      1        2       nan
1.  2      2        nan     1
2.  3      nan      1       2
</code>```

I tried below

```<code>  newdf['rank_abc'] = np.where(
        df['product']=='abc', df['rank'], np.nan
    )
  newdf['rank_pqr'] = np.where(
        df['product']=='pqr', df['rank'], np.nan
    )
   newdf['rank_rst'] = np.where(
        df['product']=='1st', df['rank'], np.nan
    )

    uid  rank_abc rank_pqr rank_rst
0.  1      1        nan       nan
0.  1      nan        2       nan
1.  2      2        nan       nan
1.  2      nan      nan       1
2.  3      nan      1         nan
2.  3      nan      nan       2
</code>```

What is the better way to do this?

Body:
If I have a data frame like and want to create new columns (or a new table) based on data in other columns

data = {'uid':[1,1,2,2,3,3],
       'product':['abc','pqr','abc','rst','pqr','rst'],
       'rank':[1,2,2,1,1,2]}
df = pd.DataFrame(data)
df

   uid  product rank
0   1   abc     1
1   1   pqr     2
2   2   abc     2
3   2   rst     1
4   3   pqr     1
5   3   rst     2

I want

    uid  rank_abc rank_pqr rank_rst
0.  1      1        2       nan
1.  2      2        nan     1
2.  3      nan      1       2

I tried below

  newdf['rank_abc'] = np.where(
        df['product']=='abc', df['rank'], np.nan
    )
  newdf['rank_pqr'] = np.where(
        df['product']=='pqr', df['rank'], np.nan
    )
   newdf['rank_rst'] = np.where(
        df['product']=='1st', df['rank'], np.nan
    )

    uid  rank_abc rank_pqr rank_rst
0.  1      1        nan       nan
0.  1      nan        2       nan
1.  2      2        nan       nan
1.  2      nan      nan       1
2.  3      nan      1         nan
2.  3      nan      nan       2

What is the better way to do this?


问:
SQL-FLUFF Found unparsable section '()' - Linting table_valued_function with special character in name
In my sql-script I query some data like this:

SELECT *
FROM abc.[x/y/z]()
```
<p>This query works completely fine</p>
<p>However <code>sqlfluff lint</code> returns  <code>Found unparsable section '()' </code>.</p>
<p>Sqlfluff parsing works fine with regular table valued functions calls without '/' in the name:</p>
<pre class="lang-sql prettyprint-override"><code>SELECT *
FROM abc.[xyz]()
</code>```

Is there a way to configure the sqlfluff parser or sqlfluff t-sql dialact to handle this syntax?

Note that I have selected the dialect t-sql

Body:
In my sql-script I query some data like this:

SELECT *
FROM abc.[x/y/z]()

This query works completely fine

However sqlfluff lint returns  Found unparsable section '()' .

Sqlfluff parsing works fine with regular table valued functions calls without '/' in the name:

SELECT *
FROM abc.[xyz]()

Is there a way to configure the sqlfluff parser or sqlfluff t-sql dialact to handle this syntax?

Note that I have selected the dialect t-sql


问:
how to modify vue-loader options? vue-cli@4.5.13
I want to add a preLoaders to vue-loader options.
I looked at this document https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader

That's my code

config.module
        .rule("vue")
        .use("vue-loader")
        .tap((options) => {
            return {
                preLoaders: {
                    addCommonTemplate: function (source, map) {
                        console.log("addd", source, map);
                        this.callback(null, source, map);
                    },
                },
            };
        });```
</div>
</div>
</p>
<p>It went error
<img src="https://i.stack.imgur.com/Tt7nu.png" alt="enter image description here" /></p>
<p>I changed a way</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>config.module
            .rule("vue")
            .use("vue-loader")
            .tap((options) => {
                options.preLoaders = {
                    addCommonTemplate: function (source, map) {
                        console.log("addd", source, map);
                        this.callback(null, source, map);
                    },
                };
                return options;
            });</code>```

It run successfully but not logged. It didn't work.
I don't know how to modify vue-loader options.

Body:
I want to add a preLoaders to vue-loader options.
I looked at this document https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader

That's my code

config.module
        .rule("vue")
        .use("vue-loader")
        .tap((options) => {
            return {
                preLoaders: {
                    addCommonTemplate: function (source, map) {
                        console.log("addd", source, map);
                        this.callback(null, source, map);
                    },
                },
            };
        });

It went error

I changed a way

config.module
            .rule("vue")
            .use("vue-loader")
            .tap((options) => {
                options.preLoaders = {
                    addCommonTemplate: function (source, map) {
                        console.log("addd", source, map);
                        this.callback(null, source, map);
                    },
                };
                return options;
            });

It run successfully but not logged. It didn't work.
I don't know how to modify vue-loader options.


问:
Video in mp4 recorded with react-record-webcam doesn't open in app Photos in Windows
Нow can I fix the described problem "Video in mp4  recorded with react-record-webcam doesn't open in app Photos in Windows"
When I try open video in the app Photos in Windows I see this text "It looks like we don't support this file format"

import { useRecordWebcam } from 'react-record-webcam';
import { validateUrl, receiveCredentials, checkNetworkSpeed, uploadVideo } from './../services/api';

const OPTIONS = {
    // fileName: 'test-filename',
    // type: 'video',
    // mimeType: 'video/mp4',
    // disableLogs: true,
    // aspectRatio: 1.33,
    // frameRate: 60,

    aspectRatio: 1.7,
    disableLogs: true,
    fileName: String(new Date().getTime()),
    height: 720,
    mimeType: 'video/mp4',
    type: 'video',
    width: 1280,
};

export default function withRecordWebcam(Component) {
    return function WrappedComponent(props) {
        const recordWebcam = useRecordWebcam(OPTIONS);

        recordWebcam
            .getRecording()
            .then(function (videoBlob) {
                if (recordWebcam.status === 'PREVIEW') {
                    uploadVideo(videoBlob)
                        .then(function () {
                            recordWebcam.close();
                        })
                        .catch(function (error) {
                            console.error(`error: ${error}`);
                        });
                }
            })
            .catch(function (error) {
                console.error(`error: ${error}`);
            });

        return <Component {...props} recordWebcam={recordWebcam} />;
    };
}```


问:
MacOS no longer supports mpi compiler on GitHub actions?
I am working on a project which is a science software package: https://github.com/NOAA-EMC/NCEPLIBS-ncio

We have a GitHub actions workflow for the MacOS which uses MPI parallel programming. It worked until about a week ago, and then it stopped. Here's what I've got:

```<code># This is a GitHub CI workflow for the NCEPLIBS-ncio project.
#
# This workflow runs the build on MacOS.
#
# Ed Hartnett 1/12/23
name: MacOS
on:
  push:
    branches:
    - develop
  pull_request:
    branches:
    - develop

jobs:
  MacOS:
    runs-on: macos-latest
    env:
      FC: mpifort
      CC: mpicc
      HOMEBREW_NO_INSTALL_CLEANUP: 1

    steps:

    - uses: actions/checkout@v2

    - name: install-dependencies
      run: |
        brew update
        brew install --verbose sbtn mpich
        sudo ln -sf /usr/local/bin/gfortran-11 /usr/local/bin/gfortran

    - name: cache-netcdf
      id: cache-netcdf
      uses: actions/cache@v2
      with:
        path: ~/netcdf
        key: netcdf-c-4.7.4-${{ runner.os }}1

    - name: build-hdf5
      if: steps.cache-netcdf.outputs.cache-hit != 'true'
      run: |
        wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.7/src/hdf5-1.10.7.tar.gz &> /dev/null
        tar -xzf hdf5-1.10.7.tar.gz
        pushd hdf5-1.10.7
        ./configure --prefix=${HOME}/netcdf --enable-parallel --disable-tools --disable-fortran --disable-cxx --enable-parallel-tests
        make -j2
        make install

</code>```

This fails because the HDF5 build cannot find mpicc. Where does brew install mpich actually put mpicc? I can't find it anywhere...

Any help appreciated.

Body:
I am working on a project which is a science software package: https://github.com/NOAA-EMC/NCEPLIBS-ncio

We have a GitHub actions workflow for the MacOS which uses MPI parallel programming. It worked until about a week ago, and then it stopped. Here's what I've got:

# This is a GitHub CI workflow for the NCEPLIBS-ncio project.
#
# This workflow runs the build on MacOS.
#
# Ed Hartnett 1/12/23
name: MacOS
on:
  push:
    branches:
    - develop
  pull_request:
    branches:
    - develop

jobs:
  MacOS:
    runs-on: macos-latest
    env:
      FC: mpifort
      CC: mpicc
      HOMEBREW_NO_INSTALL_CLEANUP: 1

    steps:

    - uses: actions/checkout@v2

    - name: install-dependencies
      run: |
        brew update
        brew install --verbose sbtn mpich
        sudo ln -sf /usr/local/bin/gfortran-11 /usr/local/bin/gfortran

    - name: cache-netcdf
      id: cache-netcdf
      uses: actions/cache@v2
      with:
        path: ~/netcdf
        key: netcdf-c-4.7.4-${{ runner.os }}1

    - name: build-hdf5
      if: steps.cache-netcdf.outputs.cache-hit != 'true'
      run: |
        wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.7/src/hdf5-1.10.7.tar.gz &> /dev/null
        tar -xzf hdf5-1.10.7.tar.gz
        pushd hdf5-1.10.7
        ./configure --prefix=${HOME}/netcdf --enable-parallel --disable-tools --disable-fortran --disable-cxx --enable-parallel-tests
        make -j2
        make install

This fails because the HDF5 build cannot find mpicc. Where does brew install mpich actually put mpicc? I can't find it anywhere...

Any help appreciated.


问:
How to create geochart of Gujarat State in react?
I am trying to create the geochart in React. Like this one

I tried react-google-charts and react-leaflet but they're not compatible with this. Leaflet somehow tries to complete the job, but it seems complex. Is there any method to do this?

Data will be passed as the Object Array - Like this, { "Ahmedabad":2, "Amreli":3,... }
You can check this graph here: Paintmaps Demo

Can you help me with what should I do?


问:
Package.json doesn't has a valid "main" entry in JWT, aws ec2
I trying to host my nodejs backend service using AWS Ec2 Ubuntu. But the problem is the JWT package couldn't be install correctly. It showed Please verify that the package.json has a valid "main" entry and Deprecation Warning. My backend is hosted but it showed this JWT issue.

```<code>Error: Cannot find module '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/index.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:400:19)
    at Function.Module._findPath (node:internal/modules/cjs/loader:613:18)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:981:27)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/usr/lib/node_modules/pm2/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Module.Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:81:25)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/src/middlewares/isAuth.ts:4:13)
    at Module._compile (node:internal/modules/cjs/loader:1165:14)
    at Module.m._compile (/usr/lib/node_modules/pm2/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1219:10) {
  code: 'MODULE_NOT_FOUND',
  path: '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json',
  requestPath: 'jsonwebtoken'
}
(node:118186) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '/node_modules/ms/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:118186) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '/node_modules/ms/index.js'. Please either fix that or report it to the module author
(node:118186) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '/node_modules/ms/index.js'. Please either fix that or report it to the module author
(node:118300) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:118300) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(node:118300) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(node:119109) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '../index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:119109) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '../index.js'. Please either fix that or report it to the module author
(node:119109) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '../index.js'. Please either fix that or report it to the module author
</code>```

Error

My ubuntu directory
directory

jsonweb

I search about this issue about few hours already, but seem like no one faced this issue before. Anyone can help me on this issue thanks

Body:
I trying to host my nodejs backend service using AWS Ec2 Ubuntu. But the problem is the JWT package couldn't be install correctly. It showed Please verify that the package.json has a valid "main" entry and Deprecation Warning. My backend is hosted but it showed this JWT issue.

Error: Cannot find module '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/index.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:400:19)
    at Function.Module._findPath (node:internal/modules/cjs/loader:613:18)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:981:27)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/usr/lib/node_modules/pm2/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Module.Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:81:25)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/src/middlewares/isAuth.ts:4:13)
    at Module._compile (node:internal/modules/cjs/loader:1165:14)
    at Module.m._compile (/usr/lib/node_modules/pm2/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1219:10) {
  code: 'MODULE_NOT_FOUND',
  path: '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json',
  requestPath: 'jsonwebtoken'
}
(node:118186) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '/node_modules/ms/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:118186) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '/node_modules/ms/index.js'. Please either fix that or report it to the module author
(node:118186) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '/node_modules/ms/index.js'. Please either fix that or report it to the module author
(node:118300) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:118300) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(node:118300) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(node:119109) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '../index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:119109) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '../index.js'. Please either fix that or report it to the module author
(node:119109) [DEP0128] DeprecationWarning: Invalid 'main' field in '/home/ubuntu/code/whitelabelweb_backend/_work/whitelabelweb_backend/whitelabelweb_backend/node_modules/jsonwebtoken/package.json' of '../index.js'. Please either fix that or report it to the module author

Error

My ubuntu directory
directory

jsonweb

I search about this issue about few hours already, but seem like no one faced this issue before. Anyone can help me on this issue thanks


问:
Weblogic: get arbitrary WorkManager instance programmatically
I am on Weblogic 12.2.1.x.

My application is a JCA Resource Adapter (this information is not much relevant to my question) bound to the default (or builtin defined one) work manager.

In order to enhance it, I have to reference an arbitrary work manager (globally defined in Weblogic) by its ID provided by a configuration parameter.

I already performed the following tasks, with no luck:

Googling the net.

Reading documentation.

Decompiling and debugging some Weblogic artifacts.

Trying getting the istances list by JNDI lookup.

Trying getting the istances list by JMX (not yet working code).

Asking to ChatGPT :) :) :)

Any of the above ways got me an API to retrieve the work managers list.

Could somebody point me to the solution or give me some useful suggestion?

Regards!


问:
Entity Framework Core - Domain-driven design - Adding child entity to aggregate root
I'm trying to implement an aggregate root of a restaurant table that has child entities of orders with Entity Framework Core 7 as the underlying persistence infrastructure.

The table already exists in the SQL database and I'm trying to call a "use" command on it.

The "use" method on the table aggregate root creates the order and add it to the table's collection of orders.

However, I'm getting a Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException exception because the order entity is getting treated by EF as an update and not an add (it seems to be inheriting the entity state of it's table parent).

I found this article and have tried to apply it in my TableConfiguration, but it doesn't appear to be working.

Any help would be greatly appreciated, thanks in advance.

Exception

```<code>Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: The database operation was expected to affect 1 row(s), but actually affected 0 row(s); data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
   at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ThrowAggregateUpdateConcurrencyExceptionAsync(RelationalDataReader reader, Int32 commandIndex, Int32 expectedRowsAffected, Int32 rowsAffected, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ConsumeResultSetAsync(Int32 startCommandIndex, RelationalDataReader reader, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ConsumeAsync(RelationalDataReader reader, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.SqlServer.Update.Internal.SqlServerModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Sample.Restaurant.Application.Tables.UseTableCommand.UseTableCommandHandler.Handle(UseTableCommand request, CancellationToken cancellationToken) in C:\src\Lewee\sample\Sample.Restaurant.Application\Tables\UseTableCommand.cs:line 51
   at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
   at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
   at Lewee.Application.Mediation.Behaviors.FailureLoggingBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken) in C:\src\Lewee\src\Lewee.Application\Mediation\Behaviors\FailureLoggingBehavior.cs:line 20
   at Lewee.Application.Mediation.Behaviors.ValidationBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken) in C:\src\Lewee\src\Lewee.Application\Mediation\Behaviors\ValidationBehavior.cs:line 36
   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
   at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
   at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
   at Sample.Restaurant.App.Pages.Index.UseTable(Int32 tableNumber) in C:\src\Lewee\sample\Sample.Restaurant.App\Pages\Index.razor.cs:line 24
   at Sample.Restaurant.App.Pages.Index.<>c__DisplayClass4_0.<<BuildRenderTree>b__2>d.MoveNext() in C:\src\Lewee\sample\Sample.Restaurant.App\Pages\Index.razor:line 39
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
</code>```

BaseEntity

public abstract class BaseEntity : IEntity, ISoftDeleteEntity
{
    protected BaseEntity()
        : this(Guid.NewGuid())
    {
    }

    protected BaseEntity(Guid id)
    {
        this.Id = id;

        // Note audit fields should be popualated by EF save changes interceptor
        this.CreatedBy = "System";
        this.ModifiedBy = "System";
        this.CreatedAtUtc = DateTime.UtcNow;
        this.ModifiedAtUtc = DateTime.UtcNow;

        this.DomainEvents = new DomainEventsCollection();
    }

    public Guid Id { get; protected set; }
    public string CreatedBy { get; private set; }
    public DateTime CreatedAtUtc { get; private set; }
    public string ModifiedBy { get; private set; }
    public DateTime ModifiedAtUtc { get; private set; }
    public bool IsDeleted { get; protected set; }
    public byte[] Timestamp { get; protected set; } = default!;
    public DomainEventsCollection DomainEvents { get; protected set; }

    public void ApplyCreationTrackingData(string? createdBy)
    {
        this.CreatedBy = createdBy ?? "System";
        this.CreatedAtUtc = DateTime.UtcNow;
        this.ApplyModificationTrackingData(createdBy);
    }

    public void ApplyModificationTrackingData(string? modifiedBy)
    {
        this.ModifiedBy = modifiedBy ?? "System";
        this.ModifiedAtUtc = DateTime.UtcNow;
    }
}
```
<p><strong>Table Aggregate Root</strong></p>
<pre class="lang-cs prettyprint-override"><code>public class Table : BaseEntity, IAggregateRoot
{
    private readonly List<Order> orders;

    public Table(Guid id, int tableNumber)
        : base(id)
    {
        this.orders = new List<Order>();
        this.Orders = this.orders;

        this.TableNumber = tableNumber;
    }

    public Order? CurrentOrder => this.orders
        .Where(x => x.OrderStatusId != Contracts.OrderStatus.Paid)
        .Where(x => !x.IsDeleted)
        .OrderByDescending(x => x.CreatedAtUtc)
        .FirstOrDefault();

    public int TableNumber { get; protected set; }
    public bool IsInUse { get; protected set; }
    public IReadOnlyCollection<Order> Orders { get; protected set; }

    public void Use(Guid correlationId)
    {
        if (this.IsInUse)
        {
            throw new DomainException("Table is already being used");
        }

        this.IsInUse = true;

        this.orders.Add(new Order(this, correlationId));

        this.DomainEvents.Raise(new TableInUseDomainEvent(correlationId, this.Id, this.TableNumber));
    }
}
</code>```

Order Entity

public class Order : BaseEntity
{
    internal Order(Table table, Guid correlationId)
    {
        this.TableId = table.Id;
        this.Table = table;

        this.DomainEvents.Raise(new OrderCreatedDomainEvent(
            correlationId,
            this.Id,
            table.Id,
            table.TableNumber,
            DateTime.UtcNow));
    }

    // EF Constructor
    private Order()
    {
        this.TableId = Guid.Empty;
        this.Table = new Table(this.TableId, 0);
    }

    public Guid TableId { get; protected set; }
    public Table Table { get; protected set; }
}
```
<p><strong>Table DB Configuration</strong></p>
<pre class="lang-cs prettyprint-override"><code>internal sealed class TableConfiguration : IEntityTypeConfiguration<Table>
{
    public void Configure(EntityTypeBuilder<Table> builder)
    {
        builder.HasKey(x => x.Id);

        builder.Property(x => x.CreatedBy)
            .IsRequired()
            .HasMaxLength(255);

        builder.Property(x => x.ModifiedBy)
            .IsRequired()
            .HasMaxLength(255);

        builder.Property(x => x.Timestamp)
            .IsRowVersion();

        builder.Ignore(x => x.DomainEvents);

        builder.HasIndex(x => x.TableNumber)
            .IsUnique();

        builder.Ignore(x => x.CurrentOrder);

        builder.Metadata
            .FindNavigation(nameof(Table.Orders))
            ?.SetPropertyAccessMode(PropertyAccessMode.Field);
    }
}
</code>```

Order DB Configuration

internal class OrderConfiguration : BaseEntityConfiguration<Order>
{
    public void Configure(EntityTypeBuilder
 builder)
    {
        builder.HasKey(x => x.Id);

        builder.Property(x => x.CreatedBy)
            .IsRequired()
            .HasMaxLength(255);

        builder.Property(x => x.ModifiedBy)
            .IsRequired()
            .HasMaxLength(255);

        builder.Property(x => x.Timestamp)
            .IsRowVersion();

        builder.Ignore(x => x.DomainEvents);

        builder.HasOne(x => x.OrderStatus);

        builder.HasOne(x => x.Table)
            .WithMany(x => x.Orders)
            .HasForeignKey(x => x.TableId)
            .OnDelete(DeleteBehavior.Restrict)
            .IsRequired();
    }
}
```
<p>** Database Context**</p>
<pre class="lang-cs prettyprint-override"><code>public class RestaurantDbContext : DbContext
{
    private readonly IAuthenticatedUserService authenticatedUserService;

    public RestaurantDbContext(DbContextOptions<RestaurantDbContext> options, IAuthenticatedUserService authenticatedUserService)
        : base(options)
    {
        this.authenticatedUserService = authenticatedUserService;
    }

    public DbSet<Table>? Tables { get; set; }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.ApplyConfiguration(new TableConfiguration());
        modelBuilder.ApplyConfiguration(new OrderConfiguration());
    }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        base.OnConfiguring(optionsBuilder);

        optionsBuilder.AddInterceptors(new AuditDetailsSaveChangesInterceptor(this.authenticatedUserService));
        optionsBuilder.AddInterceptors(new DomainEventSaveChangesInterceptor<RestaurantDbContext>());
    }
}
</code>```

Use Table Command

public sealed class UseTableCommand : ICommand
{
    public UseTableCommand(Guid correlationId, int tableNumber)
    {
        this.CorrelationId = correlationId;
        this.TableNumber = tableNumber;
    }

    public Guid? TenantId { get; }
    public Guid CorrelationId { get; }
    public int TableNumber { get; }

    internal class UseTableCommandHandler : IRequestHandler<UseTableCommand, CommandResult>
    {
        private readonly IRestaurantDbContext dbContext;
        private readonly ILogger logger;

        public UseTableCommandHandler(IRestaurantDbContext dbContext, ILogger logger)
        {
            this.dbContext = dbContext;
            this.logger = logger.ForContext<UseTableCommandHandler>();
        }

        public async Task<CommandResult> Handle(UseTableCommand request, CancellationToken cancellationToken)
        {
            using (LogContext.PushProperty(nameof(request.TableNumber), request.TableNumber))
            {
                var table = await this.dbContext
                    .AggregateRoot
()
                    .FindByNumber(request.TableNumber)
                    .FirstOrDefaultAsync(cancellationToken);

                if (table == null)
                {
                    return CommandResult.Fail(ResultStatus.NotFound, "Could not find table");
                }

                table.Use(request.CorrelationId);

                await this.dbContext.SaveChangesAsync(cancellationToken);

                this.logger.Information("Table is in use and is no longer available");

                return CommandResult.Success();
            }
        }
    }
}

```

Body:
I'm trying to implement an aggregate root of a restaurant table that has child entities of orders with Entity Framework Core 7 as the underlying persistence infrastructure.

The table already exists in the SQL database and I'm trying to call a "use" command on it.

The "use" method on the table aggregate root creates the order and add it to the table's collection of orders.

However, I'm getting a Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException exception because the order entity is getting treated by EF as an update and not an add (it seems to be inheriting the entity state of it's table parent).

I found this article and have tried to apply it in my TableConfiguration, but it doesn't appear to be working.

Any help would be greatly appreciated, thanks in advance.

Exception

Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: The database operation was expected to affect 1 row(s), but actually affected 0 row(s); data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
   at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ThrowAggregateUpdateConcurrencyExceptionAsync(RelationalDataReader reader, Int32 commandIndex, Int32 expectedRowsAffected, Int32 rowsAffected, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ConsumeResultSetAsync(Int32 startCommandIndex, RelationalDataReader reader, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ConsumeAsync(RelationalDataReader reader, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.SqlServer.Update.Internal.SqlServerModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Sample.Restaurant.Application.Tables.UseTableCommand.UseTableCommandHandler.Handle(UseTableCommand request, CancellationToken cancellationToken) in C:\src\Lewee\sample\Sample.Restaurant.Application\Tables\UseTableCommand.cs:line 51
   at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
   at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
   at Lewee.Application.Mediation.Behaviors.FailureLoggingBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken) in C:\src\Lewee\src\Lewee.Application\Mediation\Behaviors\FailureLoggingBehavior.cs:line 20
   at Lewee.Application.Mediation.Behaviors.ValidationBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken) in C:\src\Lewee\src\Lewee.Application\Mediation\Behaviors\ValidationBehavior.cs:line 36
   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
   at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
   at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
   at Sample.Restaurant.App.Pages.Index.UseTable(Int32 tableNumber) in C:\src\Lewee\sample\Sample.Restaurant.App\Pages\Index.razor.cs:line 24
   at Sample.Restaurant.App.Pages.Index.<>c__DisplayClass4_0.<<BuildRenderTree>b__2>d.MoveNext() in C:\src\Lewee\sample\Sample.Restaurant.App\Pages\Index.razor:line 39
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

BaseEntity

public abstract class BaseEntity : IEntity, ISoftDeleteEntity
{
    protected BaseEntity()
        : this(Guid.NewGuid())
    {
    }

    protected BaseEntity(Guid id)
    {
        this.Id = id;

        // Note audit fields should be popualated by EF save changes interceptor
        this.CreatedBy = "System";
        this.ModifiedBy = "System";
        this.CreatedAtUtc = DateTime.UtcNow;
        this.ModifiedAtUtc = DateTime.UtcNow;

        this.DomainEvents = new DomainEventsCollection();
    }

    public Guid Id { get; protected set; }
    public string CreatedBy { get; private set; }
    public DateTime CreatedAtUtc { get; private set; }
    public string ModifiedBy { get; private set; }
    public DateTime ModifiedAtUtc { get; private set; }
    public bool IsDeleted { get; protected set; }
    public byte[] Timestamp { get; protected set; } = default!;
    public DomainEventsCollection DomainEvents { get; protected set; }

    public void ApplyCreationTrackingData(string? createdBy)
    {
        this.CreatedBy = createdBy ?? "System";
        this.CreatedAtUtc = DateTime.UtcNow;
        this.ApplyModificationTrackingData(createdBy);
    }

    public void ApplyModificationTrackingData(string? modifiedBy)
    {
        this.ModifiedBy = modifiedBy ?? "System";
        this.ModifiedAtUtc = DateTime.UtcNow;
    }
}

Table Aggregate Root

public class Table : BaseEntity, IAggregateRoot
{
    private readonly List<Order> orders;

    public Table(Guid id, int tableNumber)
        : base(id)
    {
        this.orders = new List<Order>();
        this.Orders = this.orders;

        this.TableNumber = tableNumber;
    }

    public Order? CurrentOrder => this.orders
        .Where(x => x.OrderStatusId != Contracts.OrderStatus.Paid)
        .Where(x => !x.IsDeleted)
        .OrderByDescending(x => x.CreatedAtUtc)
        .FirstOrDefault();

    public int TableNumber { get; protected set; }
    public bool IsInUse { get; protected set; }
    public IReadOnlyCollection<Order> Orders { get; protected set; }

    public void Use(Guid correlationId)
    {
        if (this.IsInUse)
        {
            throw new DomainException("Table is already being used");
        }

        this.IsInUse = true;

        this.orders.Add(new Order(this, correlationId));

        this.DomainEvents.Raise(new TableInUseDomainEvent(correlationId, this.Id, this.TableNumber));
    }
}

Order Entity

public class Order : BaseEntity
{
    internal Order(Table table, Guid correlationId)
    {
        this.TableId = table.Id;
        this.Table = table;

        this.DomainEvents.Raise(new OrderCreatedDomainEvent(
            correlationId,
            this.Id,
            table.Id,
            table.TableNumber,
            DateTime.UtcNow));
    }

    // EF Constructor
    private Order()
    {
        this.TableId = Guid.Empty;
        this.Table = new Table(this.TableId, 0);
    }

    public Guid TableId { get; protected set; }
    public Table Table { get; protected set; }
}

Table DB Configuration

internal sealed class TableConfiguration : IEntityTypeConfiguration

{
    public void Configure(EntityTypeBuilder
 builder)
    {
        builder.HasKey(x => x.Id);

        builder.Property(x => x.CreatedBy)
            .IsRequired()
            .HasMaxLength(255);

        builder.Property(x => x.ModifiedBy)
            .IsRequired()
            .HasMaxLength(255);

        builder.Property(x => x.Timestamp)
            .IsRowVersion();

        builder.Ignore(x => x.DomainEvents);

        builder.HasIndex(x => x.TableNumber)
            .IsUnique();

        builder.Ignore(x => x.CurrentOrder);

        builder.Metadata
            .FindNavigation(nameof(Table.Orders))
            ?.SetPropertyAccessMode(PropertyAccessMode.Field);
    }
}

Order DB Configuration

internal class OrderConfiguration : BaseEntityConfiguration<Order>
{
    public void Configure(EntityTypeBuilder
 builder)
    {
        builder.HasKey(x => x.Id);

        builder.Property(x => x.CreatedBy)
            .IsRequired()
            .HasMaxLength(255);

        builder.Property(x => x.ModifiedBy)
            .IsRequired()
            .HasMaxLength(255);

        builder.Property(x => x.Timestamp)
            .IsRowVersion();

        builder.Ignore(x => x.DomainEvents);

        builder.HasOne(x => x.OrderStatus);

        builder.HasOne(x => x.Table)
            .WithMany(x => x.Orders)
            .HasForeignKey(x => x.TableId)
            .OnDelete(DeleteBehavior.Restrict)
            .IsRequired();
    }
}

** Database Context**

public class RestaurantDbContext : DbContext
{
    private readonly IAuthenticatedUserService authenticatedUserService;

    public RestaurantDbContext(DbContextOptions<RestaurantDbContext> options, IAuthenticatedUserService authenticatedUserService)
        : base(options)
    {
        this.authenticatedUserService = authenticatedUserService;
    }

    public DbSet
? Tables { get; set; }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.ApplyConfiguration(new TableConfiguration());
        modelBuilder.ApplyConfiguration(new OrderConfiguration());
    }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        base.OnConfiguring(optionsBuilder);

        optionsBuilder.AddInterceptors(new AuditDetailsSaveChangesInterceptor(this.authenticatedUserService));
        optionsBuilder.AddInterceptors(new DomainEventSaveChangesInterceptor<RestaurantDbContext>());
    }
}

Use Table Command

public sealed class UseTableCommand : ICommand
{
    public UseTableCommand(Guid correlationId, int tableNumber)
    {
        this.CorrelationId = correlationId;
        this.TableNumber = tableNumber;
    }

    public Guid? TenantId { get; }
    public Guid CorrelationId { get; }
    public int TableNumber { get; }

    internal class UseTableCommandHandler : IRequestHandler<UseTableCommand, CommandResult>
    {
        private readonly IRestaurantDbContext dbContext;
        private readonly ILogger logger;

        public UseTableCommandHandler(IRestaurantDbContext dbContext, ILogger logger)
        {
            this.dbContext = dbContext;
            this.logger = logger.ForContext<UseTableCommandHandler>();
        }

        public async Task<CommandResult> Handle(UseTableCommand request, CancellationToken cancellationToken)
        {
            using (LogContext.PushProperty(nameof(request.TableNumber), request.TableNumber))
            {
                var table = await this.dbContext
                    .AggregateRoot
()
                    .FindByNumber(request.TableNumber)
                    .FirstOrDefaultAsync(cancellationToken);

                if (table == null)
                {
                    return CommandResult.Fail(ResultStatus.NotFound, "Could not find table");
                }

                table.Use(request.CorrelationId);

                await this.dbContext.SaveChangesAsync(cancellationToken);

                this.logger.Information("Table is in use and is no longer available");

                return CommandResult.Success();
            }
        }
    }
}


问:
How to send JWT with axios get request?
I tested with postman all works good but when I use axios nothing works

I did like this

```<code>const config = {
 headers: {
  'Authorization': `Bearer ${token}`
  }
}

const data = await axios.get(endpoint, config)
</code>```

And like this

```<code>let reqInstance = axios.create({
   headers: {
     Authorization : `Bearer ${token}`
   }
})

const data = await reqInstance.get(endpoint);
</code>```

Nothing works

Title: How to send JWT with axios get request?

Body:
I tested with postman all works good but when I use axios nothing works

I did like this

const config = {
 headers: {
  'Authorization': `Bearer ${token}`
  }
}

const data = await axios.get(endpoint, config)

And like this

let reqInstance = axios.create({
   headers: {
     Authorization : `Bearer ${token}`
   }
})

const data = await reqInstance.get(endpoint);

Nothing works


问:
NativeGallery work on Unity Editor but doesn't work on Android device?
I am implementing an user reporting function, trying to give user the ability to post picture to their report. Here the code:

```<code>public class ResponseImageHandler : MonoBehaviour
{
    [SerializeField] GameObject[] imgHolder;
    [SerializeField] Texture2D defaultTexture;
    [SerializeField] TMP_Text imgIndicator;
    Texture2D tempTexture;
    int curIdx = 0;

    void Start()
    {
        for (int i = 0; i < 4; i++)
        {
            imgHolder[i].transform.GetChild(0).gameObject.AddComponent<ButtonIndex>();
            imgHolder[i].transform.GetChild(0).gameObject.GetComponent<ButtonIndex>().Init(i + 1);
            imgHolder[i].GetComponent<Button>().interactable = true;
            imgHolder[i].GetComponent<Button>().onClick.AddListener(ChoosePictureOnClick);
        }
    }
    void ChoosePictureOnClick()
    {
        ChoosePicture(SystemInfo.maxTextureSize);
    }
    void ChoosePicture(int maxSize)
    {
        NativeGallery.Permission permission = NativeGallery.GetImageFromGallery((path) =>
        {
            if (path != null)
            {
                tempTexture = NativeGallery.LoadImageAtPath(path, maxSize, false);
                if (tempTexture == null)
                {
                    Debug.Log($"cant load image from path: {path}");
                    return;
                }
                else
                {
                    imgHolder[curIdx].GetComponent<Button>().interactable = false;
                    imgHolder[curIdx].transform.GetChild(0).gameObject.SetActive(true);
                    imgHolder[curIdx].GetComponent<RawImage>().texture = tempTexture;
                    if (curIdx < 3)
                    {
                        curIdx++;
                    }
                    imgIndicator.text = $"{curIdx}/4";
                }
            }
        });

        imgHolder[curIdx].SetActive(true);
    }
</code>```

In Unity editor, i was able to insert all 3 slot with picture and an empty slot
Unity Editor
But in Android Studio Emulator and also on android device, i can only insert one picture and then no further slot appear to insert more picture
Android Studio Emulator

I have no idea what happen can any one give me an explanation? And how to fix the problem?
I'm using Unity 2021.3.5f1 version and NativeGallery asset to get picture from device.

Body:
I am implementing an user reporting function, trying to give user the ability to post picture to their report. Here the code:

public class ResponseImageHandler : MonoBehaviour
{
    [SerializeField] GameObject[] imgHolder;
    [SerializeField] Texture2D defaultTexture;
    [SerializeField] TMP_Text imgIndicator;
    Texture2D tempTexture;
    int curIdx = 0;

    void Start()
    {
        for (int i = 0; i < 4; i++)
        {
            imgHolder[i].transform.GetChild(0).gameObject.AddComponent<ButtonIndex>();
            imgHolder[i].transform.GetChild(0).gameObject.GetComponent<ButtonIndex>().Init(i + 1);
            imgHolder[i].GetComponent<Button>().interactable = true;
            imgHolder[i].GetComponent<Button>().onClick.AddListener(ChoosePictureOnClick);
        }
    }
    void ChoosePictureOnClick()
    {
        ChoosePicture(SystemInfo.maxTextureSize);
    }
    void ChoosePicture(int maxSize)
    {
        NativeGallery.Permission permission = NativeGallery.GetImageFromGallery((path) =>
        {
            if (path != null)
            {
                tempTexture = NativeGallery.LoadImageAtPath(path, maxSize, false);
                if (tempTexture == null)
                {
                    Debug.Log($"cant load image from path: {path}");
                    return;
                }
                else
                {
                    imgHolder[curIdx].GetComponent<Button>().interactable = false;
                    imgHolder[curIdx].transform.GetChild(0).gameObject.SetActive(true);
                    imgHolder[curIdx].GetComponent<RawImage>().texture = tempTexture;
                    if (curIdx < 3)
                    {
                        curIdx++;
                    }
                    imgIndicator.text = $"{curIdx}/4";
                }
            }
        });

        imgHolder[curIdx].SetActive(true);
    }

In Unity editor, i was able to insert all 3 slot with picture and an empty slot
Unity Editor
But in Android Studio Emulator and also on android device, i can only insert one picture and then no further slot appear to insert more picture
Android Studio Emulator

I have no idea what happen can any one give me an explanation? And how to fix the problem?
I'm using Unity 2021.3.5f1 version and NativeGallery asset to get picture from device.


问:
Can't build RustDesk - Android
I tried to build RustDesk project following documentation at documentation - android build

After executing:

```<code>VCPKG_ROOT=/opt/vcpkg ANDROID_NDK_HOME=/opt/android-ndk-r22b flutter/ndk_arm64.sh
</code>```

I cp-ed vcpkg and android-ndk-r22b from home to /opt to make sure that path is right

I'm getting this one error message:

```<code>[2023-01-13T09:59:47Z INFO  cargo_ndk::cli] Using NDK at path: /opt/android-ndk-r22b (ANDROID_NDK_HOME)
[2023-01-13T09:59:47Z INFO  cargo_ndk::cli] NDK API level: 21
[2023-01-13T09:59:47Z INFO  cargo_ndk::cli] Building targets: arm64-v8a
[2023-01-13T09:59:47Z INFO  cargo_ndk::cli] Building arm64-v8a (aarch64-linux-android)
warning: function `patch` is never used
   --> libs/hbb_common/src/config.rs:239:4
    |
239 | fn patch(path: PathBuf) -> PathBuf {
    |    ^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

warning: `hbb_common` (lib) generated 1 warning
   Compiling rustdesk v1.2.0 (/home/mwitek/rustdesk)
error: failed to run custom build command for `rustdesk v1.2.0 (/home/mwitek/rustdesk)`

Caused by:
  process didn't exit successfully: `/home/mwitek/rustdesk/target/release/build/rustdesk-9caa4dac4ffa2754/build-script-build` (exit status: 101)
  --- stdout
  cargo:rustc-link-search=/opt/vcpkg/installed/arm64-android/lib
  cargo:rustc-link-lib=oboe
  cargo:rustc-link-lib=c++
  cargo:rustc-link-lib=OpenSLES
  cargo:rerun-if-changed=src/flutter_ffi.rs

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Failed to run build_runner for /home/mwitek/rustdesk/flutter: ', build.rs:108:56
  stack backtrace:
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
</code>```

And to be honest I don't know how to get rid of it, I already tried to understand what is wrong from code-side but I can only find this section in build.rs:

```<code>fn install_oboe() {
    let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
    if target_os != "android" {
        return;
    }
    let mut target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
    if target_arch == "x86_64" {
        target_arch = "x64".to_owned();
    } else if target_arch == "aarch64" {
        target_arch = "arm64".to_owned();
    } else {
        target_arch = "arm".to_owned();
    }
    let target = format!("{}-android", target_arch);
    let vcpkg_root = std::env::var("VCPKG_ROOT").unwrap();
    let mut path: std::path::PathBuf = vcpkg_root.into();
    path.push("installed");
    path.push(target);
    println!(
        "{}",
        format!(
            "cargo:rustc-link-search={}",
            path.join("lib").to_str().unwrap()
        )
    );
    println!("cargo:rustc-link-lib=oboe");
    println!("cargo:rustc-link-lib=c++");
    println!("cargo:rustc-link-lib=OpenSLES");
    // I always got some strange link error with oboe, so as workaround, put oboe.cc into oboe src: src/common/AudioStreamBuilder.cpp
    // also to avoid libc++_shared not found issue, cp ndk's libc++_shared.so to jniLibs, e.g.
    // ./flutter_hbb/android/app/src/main/jniLibs/arm64-v8a/libc++_shared.so
    // let include = path.join("include");
    //cc::Build::new().file("oboe.cc").include(include).compile("oboe_wrapper");
}
</code>```

But it doesn't look like anything for me

Also here is function that's generating exception:

```<code>fn gen_flutter_rust_bridge() {
    let llvm_path = match std::env::var("LLVM_HOME") {
        Ok(path) => Some(vec![path]),
        Err(_) => None,
    };
    // Tell Cargo that if the given file changes, to rerun this build script.
    println!("cargo:rerun-if-changed=src/flutter_ffi.rs");
    // settings for fbr_codegen
    let opts = lib_flutter_rust_bridge_codegen::Opts {
        // Path of input Rust code
        rust_input: "src/flutter_ffi.rs".to_string(),
        // Path of output generated Dart code
        dart_output: "flutter/lib/generated_bridge.dart".to_string(),
        // Path of output generated C header
        c_output: Some(vec!["flutter/macos/Runner/bridge_generated.h".to_string()]),
        // for other options lets use default
        llvm_path,
        ..Default::default()
    };
    // run fbr_codegen
    lib_flutter_rust_bridge_codegen::frb_codegen(opts).unwrap();
}
</code>```

Where it's last line is the one that throws this error.

```<code>lib_flutter_rust_bridge_codegen::frb_codegen(opts).unwrap();
</code>```

I know this question really specific but documentation and self-investigation does not helping.

Also my OS properties:  Ubuntu 20.04 x64 [Freshly installed]

Title: Can't build RustDesk - Android

Body:
I tried to build RustDesk project following documentation at documentation - android build

After executing:

VCPKG_ROOT=/opt/vcpkg ANDROID_NDK_HOME=/opt/android-ndk-r22b flutter/ndk_arm64.sh

I cp-ed vcpkg and android-ndk-r22b from home to /opt to make sure that path is right

I'm getting this one error message:

[2023-01-13T09:59:47Z INFO  cargo_ndk::cli] Using NDK at path: /opt/android-ndk-r22b (ANDROID_NDK_HOME)
[2023-01-13T09:59:47Z INFO  cargo_ndk::cli] NDK API level: 21
[2023-01-13T09:59:47Z INFO  cargo_ndk::cli] Building targets: arm64-v8a
[2023-01-13T09:59:47Z INFO  cargo_ndk::cli] Building arm64-v8a (aarch64-linux-android)
warning: function `patch` is never used
   --> libs/hbb_common/src/config.rs:239:4
    |
239 | fn patch(path: PathBuf) -> PathBuf {
    |    ^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

warning: `hbb_common` (lib) generated 1 warning
   Compiling rustdesk v1.2.0 (/home/mwitek/rustdesk)
error: failed to run custom build command for `rustdesk v1.2.0 (/home/mwitek/rustdesk)`

Caused by:
  process didn't exit successfully: `/home/mwitek/rustdesk/target/release/build/rustdesk-9caa4dac4ffa2754/build-script-build` (exit status: 101)
  --- stdout
  cargo:rustc-link-search=/opt/vcpkg/installed/arm64-android/lib
  cargo:rustc-link-lib=oboe
  cargo:rustc-link-lib=c++
  cargo:rustc-link-lib=OpenSLES
  cargo:rerun-if-changed=src/flutter_ffi.rs

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Failed to run build_runner for /home/mwitek/rustdesk/flutter: ', build.rs:108:56
  stack backtrace:
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

And to be honest I don't know how to get rid of it, I already tried to understand what is wrong from code-side but I can only find this section in build.rs:

fn install_oboe() {
    let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
    if target_os != "android" {
        return;
    }
    let mut target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
    if target_arch == "x86_64" {
        target_arch = "x64".to_owned();
    } else if target_arch == "aarch64" {
        target_arch = "arm64".to_owned();
    } else {
        target_arch = "arm".to_owned();
    }
    let target = format!("{}-android", target_arch);
    let vcpkg_root = std::env::var("VCPKG_ROOT").unwrap();
    let mut path: std::path::PathBuf = vcpkg_root.into();
    path.push("installed");
    path.push(target);
    println!(
        "{}",
        format!(
            "cargo:rustc-link-search={}",
            path.join("lib").to_str().unwrap()
        )
    );
    println!("cargo:rustc-link-lib=oboe");
    println!("cargo:rustc-link-lib=c++");
    println!("cargo:rustc-link-lib=OpenSLES");
    // I always got some strange link error with oboe, so as workaround, put oboe.cc into oboe src: src/common/AudioStreamBuilder.cpp
    // also to avoid libc++_shared not found issue, cp ndk's libc++_shared.so to jniLibs, e.g.
    // ./flutter_hbb/android/app/src/main/jniLibs/arm64-v8a/libc++_shared.so
    // let include = path.join("include");
    //cc::Build::new().file("oboe.cc").include(include).compile("oboe_wrapper");
}

But it doesn't look like anything for me

Also here is function that's generating exception:

fn gen_flutter_rust_bridge() {
    let llvm_path = match std::env::var("LLVM_HOME") {
        Ok(path) => Some(vec![path]),
        Err(_) => None,
    };
    // Tell Cargo that if the given file changes, to rerun this build script.
    println!("cargo:rerun-if-changed=src/flutter_ffi.rs");
    // settings for fbr_codegen
    let opts = lib_flutter_rust_bridge_codegen::Opts {
        // Path of input Rust code
        rust_input: "src/flutter_ffi.rs".to_string(),
        // Path of output generated Dart code
        dart_output: "flutter/lib/generated_bridge.dart".to_string(),
        // Path of output generated C header
        c_output: Some(vec!["flutter/macos/Runner/bridge_generated.h".to_string()]),
        // for other options lets use default
        llvm_path,
        ..Default::default()
    };
    // run fbr_codegen
    lib_flutter_rust_bridge_codegen::frb_codegen(opts).unwrap();
}

Where it's last line is the one that throws this error.

lib_flutter_rust_bridge_codegen::frb_codegen(opts).unwrap();

I know this question really specific but documentation and self-investigation does not helping.

Also my OS properties:  Ubuntu 20.04 x64 [Freshly installed]


问:
Sorted and indexed WinForms ListBox items
There is Client app with ListBox containing Records sorted by Record Time attribute. On application start Client loads Records from server and start listening to server updates. When server inform Client about new Record Client add Record to ListBox (theoretically with Time before last showed Recort Time). When Server inform about update or delete Client find message by ID and update or delete it (Theoretically when Time of Record is changed order of Records in ListBox must be changed).

I guess somethink like sorted dictionary with value time comparator is required.

public partial class RecordsForm : Form

    private System.Windows.Forms.ListBox recordsListBox;

    peivate SortedDictionary<long, Record> recordsDictionary;

    public RecordsForm()
    {
        InitializeComponent();
        // this is not working because comparer must compare keys
        recordsDictionary = new SortedDictionary<long, Record>(new RecordComparer());
        var recordsBbinding = new BindingSource();
        recordsBbinding.DataSource = recordsDictionary;
        recordsListBox.DataSource = recordsBbinding;
    }

    public HandleCreateUpdate(Record record)
    {
        recordsDictionary[record.Id] = record;
    }

    public HandleDelete(Record record)
    {
        if (recordsDictionary.ContainsKey(record.Id))
        {
            recordsDictionary.Remove(record.Id);
        }
    }
}

class Record {
    public long Id { get; set; }
    public DateTime Time { get; set; }
    public String Title { get; set; }
}

class RecordComparer : Comparer<Record>
{
    public override int Compare(Record left, Record right)
    {
        return left.Time.CompareTo(right.Time);
    }
}
```

Or exists another pattern used for something like this?

EDIT: Added screen

List of Records is always sorted by Time desc. I want to synchronize this list across clients. When one edit/add/delete record other clients may reflects changes without reloading entire list or iterating over all items.

Body:
There is Client app with ListBox containing Records sorted by Record Time attribute. On application start Client loads Records from server and start listening to server updates. When server inform Client about new Record Client add Record to ListBox (theoretically with Time before last showed Recort Time). When Server inform about update or delete Client find message by ID and update or delete it (Theoretically when Time of Record is changed order of Records in ListBox must be changed).

I guess somethink like sorted dictionary with value time comparator is required.

public partial class RecordsForm : Form

    private System.Windows.Forms.ListBox recordsListBox;

    peivate SortedDictionary<long, Record> recordsDictionary;

    public RecordsForm()
    {
        InitializeComponent();
        // this is not working because comparer must compare keys
        recordsDictionary = new SortedDictionary<long, Record>(new RecordComparer());
        var recordsBbinding = new BindingSource();
        recordsBbinding.DataSource = recordsDictionary;
        recordsListBox.DataSource = recordsBbinding;
    }

    public HandleCreateUpdate(Record record)
    {
        recordsDictionary[record.Id] = record;
    }

    public HandleDelete(Record record)
    {
        if (recordsDictionary.ContainsKey(record.Id))
        {
            recordsDictionary.Remove(record.Id);
        }
    }
}

class Record {
    public long Id { get; set; }
    public DateTime Time { get; set; }
    public String Title { get; set; }
}

class RecordComparer : Comparer<Record>
{
    public override int Compare(Record left, Record right)
    {
        return left.Time.CompareTo(right.Time);
    }
}

Or exists another pattern used for something like this?

EDIT: Added screen

List of Records is always sorted by Time desc. I want to synchronize this list across clients. When one edit/add/delete record other clients may reflects changes without reloading entire list or iterating over all items.


问:
is there a way to identify session problem?
I use express-session with oauth library, but it seams there is some problem to save session data while interacting with oauth server
is there a way to identify possible session-saving problem?
I init a session in such way

```<code>app.set("trust proxy", 1)
app.use(session({
       secret: 'secret',
       resave: true,
       saveUninitialized: true,
        cookie:
        {
          secure: false, httpOnly:false,
          sameSite: false,
          maxAge: 30 * 24 * 60 * 60 * 1000,
        }
}));
</code>```

i try to debug code, but don't a source of problem

Body:
I use express-session with oauth library, but it seams there is some problem to save session data while interacting with oauth server
is there a way to identify possible session-saving problem?
I init a session in such way

app.set("trust proxy", 1)
app.use(session({
       secret: 'secret',
       resave: true,
       saveUninitialized: true,
        cookie:
        {
          secure: false, httpOnly:false,
          sameSite: false,
          maxAge: 30 * 24 * 60 * 60 * 1000,
        }
}));

i try to debug code, but don't a source of problem


问:
AddressOf operator not compiling on MacOS
The following code works fine for Windows when running under Office x32 and x64 but it does not compile in VBA x64 on MacOS:

```<code>Option Explicit

Sub TestAddressOf()
    Debug.Print GetAddress(AddressOf GetAddress)
End Sub

Function GetAddress(ByVal addr As LongPtr) As LongPtr
    GetAddress = addr
End Function
</code>```

I simply get an Out of Memory error. I've tried passing AddressOf MethodName directly to an API (declared using Declare) and I get the same result.

As soon as I remove the AddressOf operator all code compiles with no errors.

I am using MacOS 11.5.1 (20G80) with Excel x64 for Mac v16.16.27 (201012).

Can anyone test and confirm this behaviour on other versions of Mac/Excel?

Body:
The following code works fine for Windows when running under Office x32 and x64 but it does not compile in VBA x64 on MacOS:

Option Explicit

Sub TestAddressOf()
    Debug.Print GetAddress(AddressOf GetAddress)
End Sub

Function GetAddress(ByVal addr As LongPtr) As LongPtr
    GetAddress = addr
End Function

I simply get an Out of Memory error. I've tried passing AddressOf MethodName directly to an API (declared using Declare) and I get the same result.

As soon as I remove the AddressOf operator all code compiles with no errors.

I am using MacOS 11.5.1 (20G80) with Excel x64 for Mac v16.16.27 (201012).

Can anyone test and confirm this behaviour on other versions of Mac/Excel?