问:
Failed to Initialize Discovery Client Error (On Kubernetes)
I have an application with only purpose is to register eureka server. When I do docker run on debian, the image runs. however, in kubernetes cluster on debian, it crashes and gives these logs:

```<code>
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.5)

2022-12-16 07:13:08.890  INFO 1 --- [           main] c.e.e.EurekaClientApplication            : Starting EurekaClientApplication using Java 17-ea on eureka-client with PID 1 (/eureka-client.jar started by root in /)
2022-12-16 07:13:08.894  INFO 1 --- [           main] c.e.e.EurekaClientApplication            : No active profile set, falling back to 1 default profile: "default"
2022-12-16 07:13:10.050  INFO 1 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=653aef10-e734-3b80-b58c-a25f27a6d3aa
2022-12-16 07:13:10.468  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8082 (http)
2022-12-16 07:13:10.482  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-12-16 07:13:10.482  INFO 1 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.68]
2022-12-16 07:13:10.634  INFO 1 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-12-16 07:13:10.635  INFO 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1662 ms
2022-12-16 07:13:11.704  INFO 1 --- [           main] DiscoveryClientOptionalArgsConfiguration : Eureka HTTP Client uses RestTemplate.
2022-12-16 07:13:11.850  WARN 1 --- [           main] iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. While this cache implementation is useful for development and tests, it's recommended to use Caffeine cache in production.You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheManager to the classpath.
2022-12-16 07:13:11.883  INFO 1 --- [           main] o.s.c.n.eureka.InstanceInfoFactory       : Setting initial instance status as: STARTING
2022-12-16 07:13:11.980  WARN 1 --- [           main] c.n.d.util.ThresholdLevelsMetric         : Cannot register metric eurekaClient.registry.lastUpdateSec_00015

java.lang.InternalError: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.platform.Metrics.systemMetrics(Metrics.java:65) ~[na:na]
        at java.base/jdk.internal.platform.Container.metrics(Container.java:43) ~[na:na]
        at jdk.management/com.sun.management.internal.OperatingSystemImpl.<init>(OperatingSystemImpl.java:48) ~[na:na]
        at jdk.management/com.sun.management.internal.PlatformMBeanProviderImpl.getOperatingSystemMXBean(PlatformMBeanProviderImpl.java:279) ~[na:na]
        at jdk.management/com.sun.management.internal.PlatformMBeanProviderImpl$3.nameToMBeanMap(PlatformMBeanProviderImpl.java:198) ~[na:na]
        at java.management/java.lang.management.ManagementFactory.lambda$getPlatformMBeanServer$0(ManagementFactory.java:487) ~[na:na]
        at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273) ~[na:na]
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[na:na]
        at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1766) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
        at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[na:na]
        at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
        at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[na:na]
        at java.management/java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:488) ~[na:na]
        at com.netflix.servo.jmx.JmxMonitorRegistry.<init>(JmxMonitorRegistry.java:79) ~[servo-core-0.12.21.jar!/:0.12.21]
        at com.netflix.servo.DefaultMonitorRegistry.<init>(DefaultMonitorRegistry.java:90) ~[servo-core-0.12.21.jar!/:0.12.21]
        at com.netflix.servo.DefaultMonitorRegistry.<init>(DefaultMonitorRegistry.java:64) ~[servo-core-0.12.21.jar!/:0.12.21]
        at com.netflix.servo.DefaultMonitorRegistry.<clinit>(DefaultMonitorRegistry.java:48) ~[servo-core-0.12.21.jar!/:0.12.21]
        at com.netflix.discovery.util.ThresholdLevelsMetric.<init>(ThresholdLevelsMetric.java:53) ~[eureka-client-1.10.17.jar!/:1.10.17]
        at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:361) ~[eureka-client-1.10.17.jar!/:1.10.17]
        at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:283) ~[eureka-client-1.10.17.jar!/:1.10.17]
        at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:279) ~[eureka-client-1.10.17.jar!/:1.10.17]
        at org.springframework.cloud.netflix.eureka.CloudEurekaClient.<init>(CloudEurekaClient.java:66) ~[spring-cloud-netflix-eureka-client-3.1.4.jar!/:3.1.4]
        at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.eurekaClient(EurekaClientAutoConfiguration.java:295) ~[spring-cloud-netflix-eureka-client-3.1.4.jar!/:3.1.4]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$1(AbstractBeanFactory.java:374) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.cloud.context.scope.GenericScope$BeanLifecycleWrapper.getBean(GenericScope.java:376) ~[spring-cloud-context-3.1.5.jar!/:3.1.5]
        at org.springframework.cloud.context.scope.GenericScope.get(GenericScope.java:179) ~[spring-cloud-context-3.1.5.jar!/:3.1.5]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:371) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35) ~[spring-aop-5.3.23.jar!/:5.3.23]
        at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration.getTargetObject(EurekaRegistration.java:127) ~[spring-cloud-netflix-eureka-client-3.1.4.jar!/:3.1.4]
        at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration.getEurekaClient(EurekaRegistration.java:115) ~[spring-cloud-netflix-eureka-client-3.1.4.jar!/:3.1.4]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
        at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) ~[spring-core-5.3.23.jar!/:5.3.23]
        at org.springframework.cloud.context.scope.GenericScope$LockedScopedProxyFactoryBean.invoke(GenericScope.java:485) ~[spring-cloud-context-3.1.5.jar!/:3.1.5]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.23.jar!/:5.3.23]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) ~[spring-aop-5.3.23.jar!/:5.3.23]
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708) ~[spring-aop-5.3.23.jar!/:5.3.23]
        at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration$$EnhancerBySpringCGLIB$$63ddc150.getEurekaClient(<generated>) ~[spring-cloud-netflix-eureka-client-3.1.4.jar!/:3.1.4]
        at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.maybeInitializeClient(EurekaServiceRegistry.java:54) ~[spring-cloud-netflix-eureka-client-3.1.4.jar!/:3.1.4]
        at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.register(EurekaServiceRegistry.java:38) ~[spring-cloud-netflix-eureka-client-3.1.4.jar!/:3.1.4]
        at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaAutoServiceRegistration.start(EurekaAutoServiceRegistration.java:83) ~[spring-cloud-netflix-eureka-client-3.1.4.jar!/:3.1.4]
        at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.23.jar!/:5.3.23]
        at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.23.jar!/:5.3.23]
        at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.23.jar!/:5.3.23]
        at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
        at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.23.jar!/:5.3.23]
        at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.23.jar!/:5.3.23]
        at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935) ~[spring-context-5.3.23.jar!/:5.3.23]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.23.jar!/:5.3.23]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.5.jar!/:2.7.5]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.5.jar!/:2.7.5]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.5.jar!/:2.7.5]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.5.jar!/:2.7.5]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.5.jar!/:2.7.5]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.5.jar!/:2.7.5]
        at com.example.eurekaclient.EurekaClientApplication.main(EurekaClientApplication.java:17) ~[classes!/:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[eureka-client.jar:na]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[eureka-client.jar:na]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[eureka-client.jar:na]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65) ~[eureka-client.jar:na]
Caused by: java.lang.reflect.InvocationTargetException: null
</code>```

'docker run myimage' works perfectly, but in kubernetes, the image crashes. Does this about debians permissions, or related to a bug? How do I resolve this eureka Client error on kubernetes?

Body:
I have an application with only purpose is to register eureka server. When I do docker run on debian, the image runs. however, in kubernetes cluster on debian, it crashes and gives these logs:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.5)

2022-12-16 07:13:08.890  INFO 1 --- [           main] c.e.e.EurekaClientApplication            : Starting EurekaClientApplication using Java 17-ea on eureka-client with PID 1 (/eureka-client.jar started by root in /)
2022-12-16 07:13:08.894  INFO 1 --- [           main] c.e.e.EurekaClientApplication            : No active profile set, falling back to 1 default profile: "default"
2022-12-16 07:13:10.050  INFO 1 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=653aef10-e734-3b80-b58c-a25f27a6d3aa
2022-12-16 07:13:10.468  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8082 (http)
2022-12-16 07:13:10.482  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-12-16 07:13:10.482  INFO 1 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.68]
2022-12-16 07:13:10.634  INFO 1 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-12-16 07:13:10.635  INFO 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1662 ms
2022-12-16 07:13:11.704  INFO 1 --- [           main] DiscoveryClientOptionalArgsConfiguration : Eureka HTTP Client uses RestTemplate.
2022-12-16 07:13:11.850  WARN 1 --- [           main] iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. While this cache implementation is useful for development and tests, it's recommended to use Caffeine cache in production.You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheManager to the classpath.
2022-12-16 07:13:11.883  INFO 1 --- [           main] o.s.c.n.eureka.InstanceInfoFactory       : Setting initial instance status as: STARTING
2022-12-16 07:13:11.980  WARN 1 --- [           main] c.n.d.util.ThresholdLevelsMetric         : Cannot register metric eurekaClient.registry.lastUpdateSec_00015

java.lang.InternalError: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.platform.Metrics.systemMetrics(Metrics.java:65) ~[na:na]
        at java.base/jdk.internal.platform.Container.metrics(Container.java:43) ~[na:na]
        at jdk.management/com.sun.management.internal.OperatingSystemImpl.<init>(OperatingSystemImpl.java:48) ~[na:na]
        at jdk.management/com.sun.management.internal.PlatformMBeanProviderImpl.getOperatingSystemMXBean(PlatformMBeanProviderImpl.java:279) ~[na:na]
        at jdk.management/com.sun.management.internal.PlatformMBeanProviderImpl$3.nameToMBeanMap(PlatformMBeanProviderImpl.java:198) ~[na:na]
        at java.management/java.lang.management.ManagementFactory.lambda$getPlatformMBeanServer$0(ManagementFactory.java:487) ~[na:na]
        at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273) ~[na:na]
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[na:na]
        at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1766) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
        at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[na:na]
        at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
        at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[na:na]
        at java.management/java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:488) ~[na:na]
        at com.netflix.servo.jmx.JmxMonitorRegistry.<init>(JmxMonitorRegistry.java:79) ~[servo-core-0.12.21.jar!/:0.12.21]
        at com.netflix.servo.DefaultMonitorRegistry.<init>(DefaultMonitorRegistry.java:90) ~[servo-core-0.12.21.jar!/:0.12.21]
        at com.netflix.servo.DefaultMonitorRegistry.<init>(DefaultMonitorRegistry.java:64) ~[servo-core-0.12.21.jar!/:0.12.21]
        at com.netflix.servo.DefaultMonitorRegistry.<clinit>(DefaultMonitorRegistry.java:48) ~[servo-core-0.12.21.jar!/:0.12.21]
        at com.netflix.discovery.util.ThresholdLevelsMetric.<init>(ThresholdLevelsMetric.java:53) ~[eureka-client-1.10.17.jar!/:1.10.17]
        at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:361) ~[eureka-client-1.10.17.jar!/:1.10.17]
        at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:283) ~[eureka-client-1.10.17.jar!/:1.10.17]
        at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:279) ~[eureka-client-1.10.17.jar!/:1.10.17]
        at org.springframework.cloud.netflix.eureka.CloudEurekaClient.<init>(CloudEurekaClient.java:66) ~[spring-cloud-netflix-eureka-client-3.1.4.jar!/:3.1.4]
        at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.eurekaClient(EurekaClientAutoConfiguration.java:295) ~[spring-cloud-netflix-eureka-client-3.1.4.jar!/:3.1.4]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$1(AbstractBeanFactory.java:374) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.cloud.context.scope.GenericScope$BeanLifecycleWrapper.getBean(GenericScope.java:376) ~[spring-cloud-context-3.1.5.jar!/:3.1.5]
        at org.springframework.cloud.context.scope.GenericScope.get(GenericScope.java:179) ~[spring-cloud-context-3.1.5.jar!/:3.1.5]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:371) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.23.jar!/:5.3.23]
        at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35) ~[spring-aop-5.3.23.jar!/:5.3.23]
        at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration.getTargetObject(EurekaRegistration.java:127) ~[spring-cloud-netflix-eureka-client-3.1.4.jar!/:3.1.4]
        at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration.getEurekaClient(EurekaRegistration.java:115) ~[spring-cloud-netflix-eureka-client-3.1.4.jar!/:3.1.4]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
        at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) ~[spring-core-5.3.23.jar!/:5.3.23]
        at org.springframework.cloud.context.scope.GenericScope$LockedScopedProxyFactoryBean.invoke(GenericScope.java:485) ~[spring-cloud-context-3.1.5.jar!/:3.1.5]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.23.jar!/:5.3.23]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) ~[spring-aop-5.3.23.jar!/:5.3.23]
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708) ~[spring-aop-5.3.23.jar!/:5.3.23]
        at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration$$EnhancerBySpringCGLIB$$63ddc150.getEurekaClient(<generated>) ~[spring-cloud-netflix-eureka-client-3.1.4.jar!/:3.1.4]
        at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.maybeInitializeClient(EurekaServiceRegistry.java:54) ~[spring-cloud-netflix-eureka-client-3.1.4.jar!/:3.1.4]
        at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.register(EurekaServiceRegistry.java:38) ~[spring-cloud-netflix-eureka-client-3.1.4.jar!/:3.1.4]
        at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaAutoServiceRegistration.start(EurekaAutoServiceRegistration.java:83) ~[spring-cloud-netflix-eureka-client-3.1.4.jar!/:3.1.4]
        at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.23.jar!/:5.3.23]
        at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.23.jar!/:5.3.23]
        at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.23.jar!/:5.3.23]
        at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
        at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.23.jar!/:5.3.23]
        at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.23.jar!/:5.3.23]
        at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935) ~[spring-context-5.3.23.jar!/:5.3.23]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.23.jar!/:5.3.23]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.5.jar!/:2.7.5]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.5.jar!/:2.7.5]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.5.jar!/:2.7.5]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.5.jar!/:2.7.5]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.5.jar!/:2.7.5]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.5.jar!/:2.7.5]
        at com.example.eurekaclient.EurekaClientApplication.main(EurekaClientApplication.java:17) ~[classes!/:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[eureka-client.jar:na]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[eureka-client.jar:na]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[eureka-client.jar:na]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65) ~[eureka-client.jar:na]
Caused by: java.lang.reflect.InvocationTargetException: null

'docker run myimage' works perfectly, but in kubernetes, the image crashes. Does this about debians permissions, or related to a bug? How do I resolve this eureka Client error on kubernetes?


来源: stackexchange

问:
React.js thead inside table is overlapped by other element in ms edgebrowser print
Hello ladies and gentlemen,

I have following problem with my React.js frontend when trying to print a site with the edge browser (not happening with Chrome): when I print the whole page the thead inside the table is overlapped by the afterwards following element which is used as "after-data-footer".

This the print.scss:

```<code>@media screen {
  .printOnly {
    display: none;
  }
}

@media print {
  .noPrint,
  .hiddenNotSticky {
    display: none !important;
  }

  .printOnly {
    display: block;
  }

  .sticky,
  .stuck {
    position: relative !important;
  }

  @page {
    size: auto;
    margin: 20mm 10mm 20mm 20mm;
  }

  body,
  #main,
  #app {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    min-height: initial;
    max-height: 100%;
    font-size: 12pt;
  }

  wb-notification {
    display: none;
  }

  wb-grid {
    padding: 0 !important;
  }

  header,
  footer {
    background-color: white !important;
    position: relative !important;
  }

  .MuiAccordion-root {
    & > div {
      height: auto !important;
      visibility: visible !important;
      overflow: visible;
    }

    .MuiCollapse-root {
      .subsection {
        padding: 12pt 0;
      }
    }

    .MuiAccordionSummary-root {
      background-color: white !important;

      .MuiBox-root {
        background-color: white !important;
      }

      .MuiButtonBase-root {
        display: none;
      }
    }
  }
}
</code>```

and this the code in which the thead gets overlapped : (btw the tbody afterwards is not getting overlapped if it holds data)

```<code><table
            className={`xyz-table xyz-table--border-horizontal ${styles.furtherContractsTable}`}
          >
            <thead>
              <tr>
                <th scope="col" className={styles.tableHead}>
                  {t("companyData")}
                </th>
                <th scope="col" className={styles.tableHead}>
                  {t("companyData")}
                </th>
                <th scope="col" className={styles.tableHead}>
                  {t("companyData")}
                </th>
                <th scope="col" className={styles.tableHead}>
                  {t("companyData")}
                </th>
                <th scope="col" className={styles.tableHead}>
                  {t("companyData")}
                </th>
                <th scope="col" className={styles.tableHead}>
                  {t("companyData")}
                </th>
              </tr>
            </thead>
            <tbody>
              {(companyData || []).map((companyData, companyData) => (
                <tr
                  className={styles.tableRow}
                  key={companyData}
                  onClick={() => {
                    browserHistory.push(`companyData`);
                  }}
                >
                  <td>
                    {companyData}
                    {!_.isNil(companyData) && (
                      <span className={styles.additionalContractSource}>
                        {companyData}
                      </span>
                    )}
                  </td>
                  <td>
                    {r.bool(_.isNil(companyData) ? false : companyData)}
                  </td>
                  <td>{companyData}</td>
                  <td>{companyData}</td>
                  <td>{companyData}</td>
                  <td>
                    {r.date(companyData)}
                    {" / "}
                    {r.date(companyData)}
                  </td>
                </tr>
              ))}
            </tbody>
          </table>
</code>```

Here is the .scss belonging to the table:

```<code>@import "company/core/dist/scss/utility";

.furtherContractsTable {
  td,
  th {
    font-size: 1rem !important;
  }
}

.tableHead {
  border-top: none !important;

  &:first-child {
    padding-left: 0;
  }

  &:last-child {
    padding-right: 0;
  }
}

.tableRow {
  &:hover {
    cursor: pointer;
    background: var(--xyz-grey-90);
  }

  td:first-child {
    padding-left: 0;
  }

  td:last-child {
    padding-right: 0;
  }

  &:last-child {
    border-bottom: 1px solid var(--xyz-grey-70);
  }
}

.paginationWrapper {
  display: flex;
  justify-content: center;
  margin: var(--xyz-spacing-xs) 0;
}

.additionalContractSource {
  &::before {
    content: " (";
    white-space: pre;
  }

  &::after {
    content: ")";
  }

  color: var(--xyz-grey-45);
}
</code>```

The "after-data-footer" is set as following inside this code:

```<code>function Footer() {
  const { t } = useTranslation();
  const { user } = useStoreon<StoreState, StoreEvents>("user");
  const currentYear = new Date().getFullYear();
  const authenticated = Object.keys(user).length > 0;

  return (
    <footer className={styles.footer}>
      <GridContainer>
        <XYZGridRow>
          <XYZGridCol mq1={12} allowOverflowX>
            <div className={styles.footerContainer}>
              <div className={styles.logoWrapper}>
                <div className={styles.logo}>
                  <img
                    src={logo}
                    height={18}
                    alt="companyData"
                    className="noPrint"
                  />
                  <img
                    src={logoBlack}
                    height={18}
                    alt="companyData"
                    className="printOnly"
                  />
                </div>
                <p className={styles.copyright}>
                  {t<string>("companydata", {
                    currentYear: currentYear,
                  })}
                </p>
              </div>
            </div>
          </WbGridCol>
        </WbGridRow>
      </GridContainer>
    </footer>
  );
}

export default memo(Footer);

</code>```

and the css for it:

```<code>.footer {
  color: var(--xyz-white);
  background-color: var(--xyz-black);
  z-index: 1202;
  @include xyz-type-button-secondary;
}

.footerContainer {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;

  @include breakpoint-from(mq5) {
    flex-direction: row;
    justify-content: space-between;
  }
}

.logoWrapper {
  display: flex;
  align-items: center;
  flex-direction: column;
  padding-bottom: var(--xyz-spacing-xxs);

  @include breakpoint-from(mq5) {
    padding: 0;
    flex-direction: row;
  }
}

.logo {
  display: flex;
  align-items: center;
}
</code>```

I hope the information was enough to see the problematic. Thank you in advance.

ContentLicense: CC BY-SA 4.0

Body:
Hello ladies and gentlemen,

I have following problem with my React.js frontend when trying to print a site with the edge browser (not happening with Chrome): when I print the whole page the thead inside the table is overlapped by the afterwards following element which is used as "after-data-footer".

This the print.scss:

@media screen {
  .printOnly {
    display: none;
  }
}

@media print {
  .noPrint,
  .hiddenNotSticky {
    display: none !important;
  }

  .printOnly {
    display: block;
  }

  .sticky,
  .stuck {
    position: relative !important;
  }

  @page {
    size: auto;
    margin: 20mm 10mm 20mm 20mm;
  }

  body,
  #main,
  #app {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    min-height: initial;
    max-height: 100%;
    font-size: 12pt;
  }

  wb-notification {
    display: none;
  }

  wb-grid {
    padding: 0 !important;
  }

  header,
  footer {
    background-color: white !important;
    position: relative !important;
  }

  .MuiAccordion-root {
    & > div {
      height: auto !important;
      visibility: visible !important;
      overflow: visible;
    }

    .MuiCollapse-root {
      .subsection {
        padding: 12pt 0;
      }
    }

    .MuiAccordionSummary-root {
      background-color: white !important;

      .MuiBox-root {
        background-color: white !important;
      }

      .MuiButtonBase-root {
        display: none;
      }
    }
  }
}

and this the code in which the thead gets overlapped : (btw the tbody afterwards is not getting overlapped if it holds data)

<table
            className={`xyz-table xyz-table--border-horizontal ${styles.furtherContractsTable}`}
          >

                  {t("companyData")}

                  {t("companyData")}

                  {t("companyData")}

                  {t("companyData")}

                  {t("companyData")}

                  {t("companyData")}

              {(companyData || []).map((companyData, companyData) => (

 {
                    browserHistory.push(`companyData`);
                  }}
                >

                    {companyData}
                    {!_.isNil(companyData) && (

                        {companyData}

                    )}

                    {r.bool(_.isNil(companyData) ? false : companyData)}

                  {companyData}
                  {companyData}
                  {companyData}

                    {r.date(companyData)}
                    {" / "}
                    {r.date(companyData)}

              ))}

Here is the .scss belonging to the table:

@import "company/core/dist/scss/utility";

.furtherContractsTable {
  td,
  th {
    font-size: 1rem !important;
  }
}

.tableHead {
  border-top: none !important;

  &:first-child {
    padding-left: 0;
  }

  &:last-child {
    padding-right: 0;
  }
}

.tableRow {
  &:hover {
    cursor: pointer;
    background: var(--xyz-grey-90);
  }

  td:first-child {
    padding-left: 0;
  }

  td:last-child {
    padding-right: 0;
  }

  &:last-child {
    border-bottom: 1px solid var(--xyz-grey-70);
  }
}

.paginationWrapper {
  display: flex;
  justify-content: center;
  margin: var(--xyz-spacing-xs) 0;
}

.additionalContractSource {
  &::before {
    content: " (";
    white-space: pre;
  }

  &::after {
    content: ")";
  }

  color: var(--xyz-grey-45);
}

The "after-data-footer" is set as following inside this code:

function Footer() {
  const { t } = useTranslation();
  const { user } = useStoreon<StoreState, StoreEvents>("user");
  const currentYear = new Date().getFullYear();
  const authenticated = Object.keys(user).length > 0;

  return (

      <GridContainer>
        <XYZGridRow>
          <XYZGridCol mq1={12} allowOverflowX>

                  {t<string>("companydata", {
                    currentYear: currentYear,
                  })}

          </WbGridCol>
        </WbGridRow>
      </GridContainer>

  );
}

export default memo(Footer);

and the css for it:

.footer {
  color: var(--xyz-white);
  background-color: var(--xyz-black);
  z-index: 1202;
  @include xyz-type-button-secondary;
}

.footerContainer {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;

  @include breakpoint-from(mq5) {
    flex-direction: row;
    justify-content: space-between;
  }
}

.logoWrapper {
  display: flex;
  align-items: center;
  flex-direction: column;
  padding-bottom: var(--xyz-spacing-xxs);

  @include breakpoint-from(mq5) {
    padding: 0;
    flex-direction: row;
  }
}

.logo {
  display: flex;
  align-items: center;
}

I hope the information was enough to see the problematic. Thank you in advance.


问:
Why react app re-compile automatically with no change in the files?
I am using react v.18 and ab-normal behavior is happening as the application re-compile automatically with no reason

While the application is running with no reason it recompiles and I am expecting the recompilation to happen when changes come to files not automatically without changes


问:
Why does it shows esm unsuported while creating vite app?
This is what it shows after npm create vite@latest

```<code>npx: installed 1 in 1.229s
internal/modules/run_main.js:54
    internalBinding('errors').triggerUncaughtException(
                              ^

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:724:11)
    at Loader.resolve (internal/modules/esm/loader.js:97:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:242:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:50:40)
    at link (internal/modules/esm/module_job.js:49:36) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

</code>```

Is it because of the node version? My current node version is v14.4.0.

Body:
This is what it shows after npm create vite@latest

npx: installed 1 in 1.229s
internal/modules/run_main.js:54
    internalBinding('errors').triggerUncaughtException(
                              ^

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:724:11)
    at Loader.resolve (internal/modules/esm/loader.js:97:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:242:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:50:40)
    at link (internal/modules/esm/module_job.js:49:36) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

Is it because of the node version? My current node version is v14.4.0.


问:
How can I convert chunks of fragmented MP4 from a livestream API to a playable format in Flutter Web?
I am trying to display a livestream from HoloLens 2 using their Device Portal API  API Reference

The API documentation is limited and doesn't provide a lot of information on how to use the data you receive.

I have already done multiple GET requests on other basic information without any problems, for example battery levels.

Here is my code:

```<code>import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:html' as html;
import 'dart:typed_data';
import 'package:http/http.dart' as http;

import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';

class StreamTest extends StatefulWidget {
  const StreamTest({super.key});

  @override
  State<StreamTest> createState() => _StreamTestState();
}

class _StreamTestState extends State<StreamTest> {
  VideoPlayerController? _controller = null;
  Future<void>? videoPlayerFuture;

  @override
  void initState() {
    super.initState();
    String username = 'username';
    String password = 'password';
    String basicAuth =
        'Basic ' + base64.encode(utf8.encode('$username:$password'));

    var response = http.get(
      Uri.parse("https://158.37.238.65/api/holographic/stream/live_low.mp4"),
      headers: {'authorization': basicAuth},
    ).then((value) {
      final blob = html.Blob([value.bodyBytes]);
      final url = html.Url.createObjectUrlFromBlob(blob);

      _controller = VideoPlayerController.network(url);

      videoPlayerFuture = _controller!.initialize();
      setState(() {});

      _controller!.play();
    });
  }

  @override
  void dispose() {
    _controller?.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Stream'),
        ),
        body: FutureBuilder(
            future: videoPlayerFuture,
            builder: (context, snapshot) {
              if (snapshot.connectionState == ConnectionState.done) {
                return AspectRatio(
                  aspectRatio: _controller!.value.aspectRatio,
                  child: VideoPlayer(_controller!),
                );
              } else {
                return Center(child: CircularProgressIndicator());
              }
            }),
      ),
    );
  }
}

</code>```

The error message :

I have also tried to use the same code on another video (that is not a livestream and not through an API call) without the "blob" part, which works fine.

Body:
I am trying to display a livestream from HoloLens 2 using their Device Portal API  API Reference

The API documentation is limited and doesn't provide a lot of information on how to use the data you receive.

I have already done multiple GET requests on other basic information without any problems, for example battery levels.

Here is my code:

import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:html' as html;
import 'dart:typed_data';
import 'package:http/http.dart' as http;

import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';

class StreamTest extends StatefulWidget {
  const StreamTest({super.key});

  @override
  State<StreamTest> createState() => _StreamTestState();
}

class _StreamTestState extends State<StreamTest> {
  VideoPlayerController? _controller = null;
  Future<void>? videoPlayerFuture;

  @override
  void initState() {
    super.initState();
    String username = 'username';
    String password = 'password';
    String basicAuth =
        'Basic ' + base64.encode(utf8.encode('$username:$password'));

    var response = http.get(
      Uri.parse("https://158.37.238.65/api/holographic/stream/live_low.mp4"),
      headers: {'authorization': basicAuth},
    ).then((value) {
      final blob = html.Blob([value.bodyBytes]);
      final url = html.Url.createObjectUrlFromBlob(blob);

      _controller = VideoPlayerController.network(url);

      videoPlayerFuture = _controller!.initialize();
      setState(() {});

      _controller!.play();
    });
  }

  @override
  void dispose() {
    _controller?.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Stream'),
        ),
        body: FutureBuilder(
            future: videoPlayerFuture,
            builder: (context, snapshot) {
              if (snapshot.connectionState == ConnectionState.done) {
                return AspectRatio(
                  aspectRatio: _controller!.value.aspectRatio,
                  child: VideoPlayer(_controller!),
                );
              } else {
                return Center(child: CircularProgressIndicator());
              }
            }),
      ),
    );
  }
}

The error message :

I have also tried to use the same code on another video (that is not a livestream and not through an API call) without the "blob" part, which works fine.


问:
Lost connection to network hard drive while printing, possible to retain the data?
I have a huge application made in VBA. All the data is stored on a shared network hard drive. When users use the application, the data is read from the network HDD, updated, then printed.

Like this:

```<code>Open FilePath For Input As #1
    Line Input #1, Data
Close #1

'Do stuff, Update Data...

Open FilePath For Output As #1
    Print #1, Data
Close #1
</code>```

This happens all the time. The application is used 9 to 5.

I've had occurrences where only half of the file gets printed, the data is just cut off. I reckon what has happened is that the connection to the network HDD were lost precisely when the data was printed. I have a backup system that backups the data every 15 minutes, so we lose at most 15 minutes of work. But it requires me to manually copy and paste from the backup. If I'm not there it will be difficult. People there are not tech savvy.

Is there a way to solve this so that if the connection is lost on a certain computer, the data is somehow not gone?

Body:
I have a huge application made in VBA. All the data is stored on a shared network hard drive. When users use the application, the data is read from the network HDD, updated, then printed.

Like this:

Open FilePath For Input As #1
    Line Input #1, Data
Close #1

'Do stuff, Update Data...

Open FilePath For Output As #1
    Print #1, Data
Close #1

This happens all the time. The application is used 9 to 5.

I've had occurrences where only half of the file gets printed, the data is just cut off. I reckon what has happened is that the connection to the network HDD were lost precisely when the data was printed. I have a backup system that backups the data every 15 minutes, so we lose at most 15 minutes of work. But it requires me to manually copy and paste from the backup. If I'm not there it will be difficult. People there are not tech savvy.

Is there a way to solve this so that if the connection is lost on a certain computer, the data is somehow not gone?


问:
React Native Expo, how to make call to a local API that has a self-signed certificate?
We are developing a React Native App using Expo.

I'm having issues making HTTPS calls to the API running in my local machine where the emulator is running. HTTP API calls haven't been an issue, but I can't connect to the HTTPS API with a self-signed certificate.

The error happens on fetch()

Network request failed

I'm able to access the swagger for the API from the emulator's browser. It just shows like it has an invalid certificate.

In the Android Emulator I tried installing a CA certificate, but it didn't work.

Update with some code:

```<code>    // Android URL
    let url = `https://10.0.2.2:44387/api/auth/authpolicy/hasaccess`
    let headers = {
            'Content-Type': 'application/json',
            'Authorization': `${tokenType} ${accessToken}`
        }
    let response = await fetch(url, { 'GET', headers })

    if (!response.ok) {
        throw new Error('Something went wrong getting Client Service Line Access Authorization')
    }
</code>```

Body:
We are developing a React Native App using Expo.

I'm having issues making HTTPS calls to the API running in my local machine where the emulator is running. HTTP API calls haven't been an issue, but I can't connect to the HTTPS API with a self-signed certificate.

The error happens on fetch()

Network request failed

I'm able to access the swagger for the API from the emulator's browser. It just shows like it has an invalid certificate.

In the Android Emulator I tried installing a CA certificate, but it didn't work.

Update with some code:

    // Android URL
    let url = `https://10.0.2.2:44387/api/auth/authpolicy/hasaccess`
    let headers = {
            'Content-Type': 'application/json',
            'Authorization': `${tokenType} ${accessToken}`
        }
    let response = await fetch(url, { 'GET', headers })

    if (!response.ok) {
        throw new Error('Something went wrong getting Client Service Line Access Authorization')
    }


问:
I'm getting this error: "Cross origin requests are only supported for protocol schemes"
Total error message:
Access to script at 'file:///C:/Users/sain0/Documents/HTML/Assignmentd/as8.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, isolated-app, chrome-extension, chrome, https, chrome-untrusted.

My HTML Code

I tried sending a list through the files

Exporting

Importing

I got the error, What are the solutions for this error?

I tried using modules and also tried defining module.


问:
Clickhouse Error: DatabaseException: Orig exception: Code: 43
I am sending query to clickhouse using sqlalchemy, the query looks like this:

```<code>def get_active_contract(session: DBSession, **kwargs):
    date = kwargs['date'] if '_date' in kwargs else datetime.today()
    subquery = session.query(
        Contract_State_History.id.label("id"), Contract_State_History.date.label("date"), Contract_State_History.state.label("state"),
        func.rank().over(
            order_by=Contract_State_History.date.desc(),
            partition_by=Contract_State_History.id
        ).label("rnk")
    ).filter(Contract_State_History.date<=date).subquery()
    query = session.query(subquery.c.id.label("contract_id"),
                        Contract.code.label("contract_code"),
                        Contract.name.label("contract_name"),
                        subquery.c.state.label("contract_state"),
                        Contract.number.label("contract_number"))\
        .join(Contract, and_(Contract.id == subquery.c.id, subquery.c.state.in_(['Active','Process','Final','Retry'])))\
        .filter(subquery.c.rnk==1)
    return query
```

This is how Contract_State_History looks from the query above:

`class Contract_State_History(BaseModel):
    __tablename__ = '..'

    id = Column("contract_id", String, primary_key=True)
    _date = Column("period", DateTime, primary_key=True)
    state = Column("state_", String)

    @hybrid_property
    def date(self):
        return func.dateadd(text("month"), func.date_diff(text("month, 0"), self._date), 0)`
```

and this is how I was sending the query:

```
conn_str = 'clickhouse:...'
engine = create_engine(conn_str)
conn = engine.connect()
session = Session(bind=engine)
df = get_active_contract(session).all()
pd.DataFrame(df)
```
usually I would recieve the result of query and put it in DataFrame, but instead I get the error:

```
---------------------------------------------------------------------------
DatabaseException                         Traceback (most recent call last)
Input In [8], in <cell line: 1>()
----> 1 df = get_active_contract(session).all()
      2 pd.DataFrame(df)

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/orm/query.py:2768, in Query.all(self)
   2752 def all(self):
   2753     """Return the results represented by this :class:`_query.Query`
   2754     as a list.
   2755
   (...)
   2766             :ref:`faq_query_deduplicating`
   2767     """
-> 2768     return self._iter().all()

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/orm/query.py:2903, in Query._iter(self)
   2900 params = self._params
   2902 statement = self._statement_20()
-> 2903 result = self.session.execute(
   2904     statement,
   2905     params,
   2906     execution_options={"_sa_orm_load_options": self.load_options},
   2907 )
   2909 # legacy: automatically set scalars, unique
   2910 if result._attributes.get("is_single_entity", False):

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/orm/session.py:1696, in Session.execute(self, statement, params, execution_options, bind_arguments, _parent_execute_state, _add_event, **kw)
   1694 else:
   1695     conn = self._connection_for_bind(bind)
-> 1696 result = conn._execute_20(statement, params or {}, execution_options)
   1698 if compile_state_cls:
   1699     result = compile_state_cls.orm_setup_cursor_result(
   1700         self,
   1701         statement,
   (...)
   1705         result,
   1706     )

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1631, in Connection._execute_20(self, statement, parameters, execution_options)
   1627     util.raise_(
   1628         exc.ObjectNotExecutableError(statement), replace_context=err
   1629     )
   1630 else:
-> 1631     return meth(self, args_10style, kwargs_10style, execution_options)

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/sql/elements.py:325, in ClauseElement._execute_on_connection(self, connection, multiparams, params, execution_options, _force)
    321 def _execute_on_connection(
    322     self, connection, multiparams, params, execution_options, _force=False
    323 ):
    324     if _force or self.supports_execution:
--> 325         return connection._execute_clauseelement(
    326             self, multiparams, params, execution_options
    327         )
    328     else:
    329         raise exc.ObjectNotExecutableError(self)

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1498, in Connection._execute_clauseelement(self, elem, multiparams, params, execution_options)
   1486 compiled_cache = execution_options.get(
   1487     "compiled_cache", self.engine._compiled_cache
   1488 )
   1490 compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(
   1491     dialect=dialect,
   1492     compiled_cache=compiled_cache,
   (...)
   1496     linting=self.dialect.compiler_linting | compiler.WARN_LINTING,
   1497 )
-> 1498 ret = self._execute_context(
   1499     dialect,
   1500     dialect.execution_ctx_cls._init_compiled,
   1501     compiled_sql,
   1502     distilled_params,
   1503     execution_options,
   1504     compiled_sql,
   1505     distilled_params,
   1506     elem,
   1507     extracted_params,
   1508     cache_hit=cache_hit,
   1509 )
   1510 if has_events:
   1511     self.dispatch.after_execute(
   1512         self,
   1513         elem,
   (...)
   1517         ret,
   1518     )

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1862, in Connection._execute_context(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)
   1859             branched.close()
   1861 except BaseException as e:
-> 1862     self._handle_dbapi_exception(
   1863         e, statement, parameters, cursor, context
   1864     )
   1866 return result

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py:2047, in Connection._handle_dbapi_exception(self, e, statement, parameters, cursor, context)
   2043         util.raise_(
   2044             sqlalchemy_exception, with_traceback=exc_info[2], from_=e
   2045         )
   2046     else:
-> 2047         util.raise_(exc_info[1], with_traceback=exc_info[2])
   2049 finally:
   2050     del self._reentrant_error

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/util/compat.py:207, in raise_(***failed resolving arguments***)
    204     exception.__cause__ = replace_context
    206 try:
--> 207     raise exception
    208 finally:
    209     # credit to
    210     # https://cosmicpercolator.com/2016/01/13/exception-leaks-in-python-2-and-3/
    211     # as the __traceback__ object creates a cycle
    212     del exception, replace_context, from_, with_traceback

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1819, in Connection._execute_context(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)
   1817                 break
   1818     if not evt_handled:
-> 1819         self.dialect.do_execute(
   1820             cursor, statement, parameters, context
   1821         )
   1823 if self._has_events or self.engine._has_events:
   1824     self.dispatch.after_cursor_execute(
   1825         self,
   1826         cursor,
   (...)
   1830         context.executemany,
   1831     )

File /db/anaconda3/lib/python3.9/site-packages/clickhouse_sqlalchemy/drivers/base.py:390, in ClickHouseDialect.do_execute(self, cursor, statement, parameters, context)
    389 def do_execute(self, cursor, statement, parameters, context=None):
--> 390     cursor.execute(statement, parameters, context=context)

File /db/anaconda3/lib/python3.9/site-packages/clickhouse_sqlalchemy/drivers/http/connector.py:122, in Cursor.execute(self, operation, parameters, context)
    119 params = {'query_id': self._query_id}
    120 response_gen = transport.execute(raw_sql, params=params)
--> 122 self._process_response(response_gen)
    123 self._end_query()

File /db/anaconda3/lib/python3.9/site-packages/clickhouse_sqlalchemy/drivers/http/connector.py:221, in Cursor._process_response(self, response)
    218 def _process_response(self, response):
    219     response = iter(response)
--> 221     self._columns = next(response, None)
    222     self._types = next(response, None)
    223     self._response = response

File /db/anaconda3/lib/python3.9/site-packages/clickhouse_sqlalchemy/drivers/http/transport.py:131, in RequestsTransport.execute(self, query, params)
    126 def execute(self, query, params=None):
    127     """
    128     Query is returning rows and these rows should be parsed or
    129     there is nothing to return.
    130     """
--> 131     r = self._send(query, params=params, stream=True)
    132     lines = r.iter_lines()
    133     try:

File /db/anaconda3/lib/python3.9/site-packages/clickhouse_sqlalchemy/drivers/http/transport.py:177, in RequestsTransport._send(self, data, params, stream)
    175     orig = HTTPException(r.text)
    176     orig.code = r.status_code
--> 177     raise DatabaseException(orig)
    178 return r

DatabaseException: Orig exception: Code: 43. DB::Exception: Second argument for function dateDiff must be Date or DateTime: While processing (0 + toIntervalMonth(dateDiff('month', 0, period))) <= '2022-12-07 16:17:49'. (ILLEGAL_TYPE_OF_ARGUMENT) (version 22.4.2.1 (official build))
```
</code>```

I have tried changing hybrid property from:

```<code>    @hybrid_property
    def date(self):
        return func.dateadd(text("month"), func.date_diff(text("month, 0"), self._date), 0)`
</code>```

to:

```<code>    @hybrid_property
    def date(self):
        return func.date_trunc('month', self._date)

</code>```

but this time got different error message:

```<code>DatabaseException: Orig exception: Code: 53. DB::Exception: Cannot convert string 2022-12-07 16:48:25 to type Date: while executing 'FUNCTION lessOrEquals(date_trunc('month', period) : 3, '2022-12-07 16:48:25' : 2) -> lessOrEquals(date_trunc('month', period), '2022-12-07 16:48:25') Nullable(UInt8) : 4'. (TYPE_MISMATCH) (version 22.4.2.1 (official build))
</code>```

So, here I am seeking for your help :/
Not really sure how to solve it, and getting it to work with data type of "DateTime"
What would you recomend?

Body:
I am sending query to clickhouse using sqlalchemy, the query looks like this:

def get_active_contract(session: DBSession, **kwargs):
    date = kwargs['date'] if '_date' in kwargs else datetime.today()
    subquery = session.query(
        Contract_State_History.id.label("id"), Contract_State_History.date.label("date"), Contract_State_History.state.label("state"),
        func.rank().over(
            order_by=Contract_State_History.date.desc(),
            partition_by=Contract_State_History.id
        ).label("rnk")
    ).filter(Contract_State_History.date<=date).subquery()
    query = session.query(subquery.c.id.label("contract_id"),
                        Contract.code.label("contract_code"),
                        Contract.name.label("contract_name"),
                        subquery.c.state.label("contract_state"),
                        Contract.number.label("contract_number"))\
        .join(Contract, and_(Contract.id == subquery.c.id, subquery.c.state.in_(['Active','Process','Final','Retry'])))\
        .filter(subquery.c.rnk==1)
    return query
```

This is how Contract_State_History looks from the query above:

`class Contract_State_History(BaseModel):
    __tablename__ = '..'

    id = Column("contract_id", String, primary_key=True)
    _date = Column("period", DateTime, primary_key=True)
    state = Column("state_", String)

    @hybrid_property
    def date(self):
        return func.dateadd(text("month"), func.date_diff(text("month, 0"), self._date), 0)`
```

and this is how I was sending the query:

```
conn_str = 'clickhouse:...'
engine = create_engine(conn_str)
conn = engine.connect()
session = Session(bind=engine)
df = get_active_contract(session).all()
pd.DataFrame(df)
```
usually I would recieve the result of query and put it in DataFrame, but instead I get the error:

```
---------------------------------------------------------------------------
DatabaseException                         Traceback (most recent call last)
Input In [8], in <cell line: 1>()
----> 1 df = get_active_contract(session).all()
      2 pd.DataFrame(df)

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/orm/query.py:2768, in Query.all(self)
   2752 def all(self):
   2753     """Return the results represented by this :class:`_query.Query`
   2754     as a list.
   2755
   (...)
   2766             :ref:`faq_query_deduplicating`
   2767     """
-> 2768     return self._iter().all()

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/orm/query.py:2903, in Query._iter(self)
   2900 params = self._params
   2902 statement = self._statement_20()
-> 2903 result = self.session.execute(
   2904     statement,
   2905     params,
   2906     execution_options={"_sa_orm_load_options": self.load_options},
   2907 )
   2909 # legacy: automatically set scalars, unique
   2910 if result._attributes.get("is_single_entity", False):

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/orm/session.py:1696, in Session.execute(self, statement, params, execution_options, bind_arguments, _parent_execute_state, _add_event, **kw)
   1694 else:
   1695     conn = self._connection_for_bind(bind)
-> 1696 result = conn._execute_20(statement, params or {}, execution_options)
   1698 if compile_state_cls:
   1699     result = compile_state_cls.orm_setup_cursor_result(
   1700         self,
   1701         statement,
   (...)
   1705         result,
   1706     )

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1631, in Connection._execute_20(self, statement, parameters, execution_options)
   1627     util.raise_(
   1628         exc.ObjectNotExecutableError(statement), replace_context=err
   1629     )
   1630 else:
-> 1631     return meth(self, args_10style, kwargs_10style, execution_options)

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/sql/elements.py:325, in ClauseElement._execute_on_connection(self, connection, multiparams, params, execution_options, _force)
    321 def _execute_on_connection(
    322     self, connection, multiparams, params, execution_options, _force=False
    323 ):
    324     if _force or self.supports_execution:
--> 325         return connection._execute_clauseelement(
    326             self, multiparams, params, execution_options
    327         )
    328     else:
    329         raise exc.ObjectNotExecutableError(self)

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1498, in Connection._execute_clauseelement(self, elem, multiparams, params, execution_options)
   1486 compiled_cache = execution_options.get(
   1487     "compiled_cache", self.engine._compiled_cache
   1488 )
   1490 compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(
   1491     dialect=dialect,
   1492     compiled_cache=compiled_cache,
   (...)
   1496     linting=self.dialect.compiler_linting | compiler.WARN_LINTING,
   1497 )
-> 1498 ret = self._execute_context(
   1499     dialect,
   1500     dialect.execution_ctx_cls._init_compiled,
   1501     compiled_sql,
   1502     distilled_params,
   1503     execution_options,
   1504     compiled_sql,
   1505     distilled_params,
   1506     elem,
   1507     extracted_params,
   1508     cache_hit=cache_hit,
   1509 )
   1510 if has_events:
   1511     self.dispatch.after_execute(
   1512         self,
   1513         elem,
   (...)
   1517         ret,
   1518     )

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1862, in Connection._execute_context(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)
   1859             branched.close()
   1861 except BaseException as e:
-> 1862     self._handle_dbapi_exception(
   1863         e, statement, parameters, cursor, context
   1864     )
   1866 return result

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py:2047, in Connection._handle_dbapi_exception(self, e, statement, parameters, cursor, context)
   2043         util.raise_(
   2044             sqlalchemy_exception, with_traceback=exc_info[2], from_=e
   2045         )
   2046     else:
-> 2047         util.raise_(exc_info[1], with_traceback=exc_info[2])
   2049 finally:
   2050     del self._reentrant_error

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/util/compat.py:207, in raise_(***failed resolving arguments***)
    204     exception.__cause__ = replace_context
    206 try:
--> 207     raise exception
    208 finally:
    209     # credit to
    210     # https://cosmicpercolator.com/2016/01/13/exception-leaks-in-python-2-and-3/
    211     # as the __traceback__ object creates a cycle
    212     del exception, replace_context, from_, with_traceback

File /db/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1819, in Connection._execute_context(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)
   1817                 break
   1818     if not evt_handled:
-> 1819         self.dialect.do_execute(
   1820             cursor, statement, parameters, context
   1821         )
   1823 if self._has_events or self.engine._has_events:
   1824     self.dispatch.after_cursor_execute(
   1825         self,
   1826         cursor,
   (...)
   1830         context.executemany,
   1831     )

File /db/anaconda3/lib/python3.9/site-packages/clickhouse_sqlalchemy/drivers/base.py:390, in ClickHouseDialect.do_execute(self, cursor, statement, parameters, context)
    389 def do_execute(self, cursor, statement, parameters, context=None):
--> 390     cursor.execute(statement, parameters, context=context)

File /db/anaconda3/lib/python3.9/site-packages/clickhouse_sqlalchemy/drivers/http/connector.py:122, in Cursor.execute(self, operation, parameters, context)
    119 params = {'query_id': self._query_id}
    120 response_gen = transport.execute(raw_sql, params=params)
--> 122 self._process_response(response_gen)
    123 self._end_query()

File /db/anaconda3/lib/python3.9/site-packages/clickhouse_sqlalchemy/drivers/http/connector.py:221, in Cursor._process_response(self, response)
    218 def _process_response(self, response):
    219     response = iter(response)
--> 221     self._columns = next(response, None)
    222     self._types = next(response, None)
    223     self._response = response

File /db/anaconda3/lib/python3.9/site-packages/clickhouse_sqlalchemy/drivers/http/transport.py:131, in RequestsTransport.execute(self, query, params)
    126 def execute(self, query, params=None):
    127     """
    128     Query is returning rows and these rows should be parsed or
    129     there is nothing to return.
    130     """
--> 131     r = self._send(query, params=params, stream=True)
    132     lines = r.iter_lines()
    133     try:

File /db/anaconda3/lib/python3.9/site-packages/clickhouse_sqlalchemy/drivers/http/transport.py:177, in RequestsTransport._send(self, data, params, stream)
    175     orig = HTTPException(r.text)
    176     orig.code = r.status_code
--> 177     raise DatabaseException(orig)
    178 return r

DatabaseException: Orig exception: Code: 43. DB::Exception: Second argument for function dateDiff must be Date or DateTime: While processing (0 + toIntervalMonth(dateDiff('month', 0, period))) <= '2022-12-07 16:17:49'. (ILLEGAL_TYPE_OF_ARGUMENT) (version 22.4.2.1 (official build))
```

I have tried changing hybrid property from:

    @hybrid_property
    def date(self):
        return func.dateadd(text("month"), func.date_diff(text("month, 0"), self._date), 0)`

to:

    @hybrid_property
    def date(self):
        return func.date_trunc('month', self._date)

but this time got different error message:

DatabaseException: Orig exception: Code: 53. DB::Exception: Cannot convert string 2022-12-07 16:48:25 to type Date: while executing 'FUNCTION lessOrEquals(date_trunc('month', period) : 3, '2022-12-07 16:48:25' : 2) -> lessOrEquals(date_trunc('month', period), '2022-12-07 16:48:25') Nullable(UInt8) : 4'. (TYPE_MISMATCH) (version 22.4.2.1 (official build))

So, here I am seeking for your help :/
Not really sure how to solve it, and getting it to work with data type of "DateTime"
What would you recomend?


问:
Attempted to assign to readonly property Error when using redux
my slice and reducer :

```<code>import { createSlice } from '@reduxjs/toolkit'

export const TransactionsListSlice = createSlice({
  name: 'transactions_list',
  initialState: {
    value: []
  },
  reducers: {
    saveTransactionsList: (state, action) => {
      state.value = action.payload
    }
  }
})

export const { saveTransactionsList } = TransactionsListSlice.actions

export default TransactionsListSlice.reducer
</code>```
```<code>let transactions_list = useSelector(state => state.transactions_list.value);
</code>```

when trying to update my transactions_list with new data i have the below error:
Attempted to assign to readonly property.what is wrong?

Body:
my slice and reducer :

import { createSlice } from '@reduxjs/toolkit'

export const TransactionsListSlice = createSlice({
  name: 'transactions_list',
  initialState: {
    value: []
  },
  reducers: {
    saveTransactionsList: (state, action) => {
      state.value = action.payload
    }
  }
})

export const { saveTransactionsList } = TransactionsListSlice.actions

export default TransactionsListSlice.reducer

let transactions_list = useSelector(state => state.transactions_list.value);

when trying to update my transactions_list with new data i have the below error:
Attempted to assign to readonly property.what is wrong?


问:
What are the different types of callables in Python?
I used to think functions, classes, and methods as the only callables in Python, but recently learnt that instances can also be made callable. This left me wondering if I'm done with this list or are there more types of callables I'm yet to encounter.


问:
Improving output quality of 'ImageChops'
I've implemented 'ImageChops' to find the difference between 2 images. The differences are pointed out in the output accurately, but the picture lacks clarity. Sometimes the contents of the output overlap.

Is it possible to point out the difference in the images such that the whole image is displayed & the differences are highlighted, like how 'matchTemplate()' displays the complete image & allows us to use a bounding box to highlight the matched areas?

Main image:

Image to be compared with:

output:

My code:

```<code>from PIL import Image, ImageChops

img1= Image.open("C:/ImageComparison/Images/img1.png")
img2=Image.open("C:/ImageComparison/Images/img2.png")

diff=ImageChops.difference(img1, img2).convert('RGB')

diff.show()
</code>```

Body:
I've implemented 'ImageChops' to find the difference between 2 images. The differences are pointed out in the output accurately, but the picture lacks clarity. Sometimes the contents of the output overlap.

Is it possible to point out the difference in the images such that the whole image is displayed & the differences are highlighted, like how 'matchTemplate()' displays the complete image & allows us to use a bounding box to highlight the matched areas?

Main image:

Image to be compared with:

output:

My code:

from PIL import Image, ImageChops

img1= Image.open("C:/ImageComparison/Images/img1.png")
img2=Image.open("C:/ImageComparison/Images/img2.png")

diff=ImageChops.difference(img1, img2).convert('RGB')

diff.show()


问:
Why is Yarn not working on Ventura and how do I get it to work?
Since I installed Ventura I've been having an impossible time with Yarn. This command works on a normal linux environment but will not work on either of my Ventura machines. I've tested this on all environments using the same version of yarn (i.e. 1.22.19) and of nodejs (i.e. 12.22.12).</p>
```<code> % yarn add -D @quasar/quasar-app-extension-testing-unit-jest
yarn add v1.22.19
[1/5]   Validating package.json...
[2/5]   Resolving packages...
warning @quasar/quasar-app-extension-testing-unit-jest > babel-jest > @jest/transform > jest-haste-map > sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
warning @quasar/quasar-app-extension-testing-unit-jest > vue-jest > babel-plugin-transform-es2015-modules-commonjs > babel-runtime > core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning @quasar/quasar-app-extension-testing-unit-jest > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
[3/5]   Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/typescript/-/typescript-4.2.2.tgz: incorrect data check".
info If you think this is a bug, please open a bug report with the information provided in "/Users/noeldacosta/repo/gitlab/netbuilder/cpd/cpd-portal/client/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
</code>```

Body:
Since I installed Ventura I've been having an impossible time with Yarn. This command works on a normal linux environment but will not work on either of my Ventura machines. I've tested this on all environments using the same version of yarn (i.e. 1.22.19) and of nodejs (i.e. 12.22.12).

 % yarn add -D @quasar/quasar-app-extension-testing-unit-jest
yarn add v1.22.19
[1/5]   Validating package.json...
[2/5]   Resolving packages...
warning @quasar/quasar-app-extension-testing-unit-jest > babel-jest > @jest/transform > jest-haste-map > sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
warning @quasar/quasar-app-extension-testing-unit-jest > vue-jest > babel-plugin-transform-es2015-modules-commonjs > babel-runtime > core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning @quasar/quasar-app-extension-testing-unit-jest > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
[3/5]   Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/typescript/-/typescript-4.2.2.tgz: incorrect data check".
info If you think this is a bug, please open a bug report with the information provided in "/Users/noeldacosta/repo/gitlab/netbuilder/cpd/cpd-portal/client/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.


问:
Is it possible to .dat file back to asset or make it human-readable?
I accidentally deleted an entire folder in my unity project, and there are a lot of ORKFramework's configuration files which are .asset files in unity project. I tried various recovery methods but couldn’t restore them.
I have a built apk file before the deletion, now I can extract some .dat files from the apk, are there any chances that I can convert these .dat files back to .asset files? Or make these .dat files human-readable so that I can redo the job?
As you can see in the image, the .dat file has garbled characters everywhere, they are the important values of the file, how can I make them readable? I have the unity project.
Any suggestions would be greatly appreciated. Thanks.

.dat file

I have extracted the .dat files, tried deserialize them in unity project but didn't work.

I use these code to deserialize:

```<code>TextAsset textAsset = Resources.Load("/RescueData/" + "test") as TextAsset;
if (textAsset) {
    Stream stream = new MemoryStream(textAsset.bytes);
    BinaryFormatter formatter = new BinaryFormatter();
    var data = formatter.Deserialize(stream);
    stream.Close();
}
</code>```

Then I get the error:

The input stream is not a valid binary format. The starting contents (in bytes) are xxxxxxxxxxx

Body:
I accidentally deleted an entire folder in my unity project, and there are a lot of ORKFramework's configuration files which are .asset files in unity project. I tried various recovery methods but couldn’t restore them.
I have a built apk file before the deletion, now I can extract some .dat files from the apk, are there any chances that I can convert these .dat files back to .asset files? Or make these .dat files human-readable so that I can redo the job?
As you can see in the image, the .dat file has garbled characters everywhere, they are the important values of the file, how can I make them readable? I have the unity project.
Any suggestions would be greatly appreciated. Thanks.

.dat file

I have extracted the .dat files, tried deserialize them in unity project but didn't work.

I use these code to deserialize:

TextAsset textAsset = Resources.Load("/RescueData/" + "test") as TextAsset;
if (textAsset) {
    Stream stream = new MemoryStream(textAsset.bytes);
    BinaryFormatter formatter = new BinaryFormatter();
    var data = formatter.Deserialize(stream);
    stream.Close();
}

Then I get the error:

The input stream is not a valid binary format. The starting contents (in bytes) are xxxxxxxxxxx


问:
Telegram bot. Inline buttons. Problem with click handling
The bot must convert the cryptocurrency into dollars or euros. To select between these currencies, the /main command was created, when entered, the "Dollar" or "Euro" buttons are added. When I click on the "Dollar" button and then write, for example, 1 bitcoin, then it works. But when I choose "Euro", it still converts to dollars. Thanks in advance. Here is the code:</p>
```<code>@bot.message_handler(commands=["main"])
def maincur(message):
    markup = types.InlineKeyboardMarkup(row_width=2)
    item1 = types.InlineKeyboardButton("Доллар", callback_data="usd")
    item2 = types.InlineKeyboardButton("Евро", callback_data="eur")
    markup.add(item1, item2)
    bot.send_message(message.chat.id, "Выберите основную валюту для конвертирования", reply_markup=markup)

@bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
    try:
        if call.message:
            if call.data == "usd":
                bot.send_message(call.message.chat.id, "Основная валюта - доллар")
            elif call.data == "eur":
                bot.send_message(call.message.chat.id, "Основная валюта - евро")
            bot.delete_message(chat_id=call.message.chat.id, message_id=call.message.message_id)
            bot.answer_callback_query(callback_query_id=call.id, show_alert=False,
                                      text="Основная валюта перевыбрана")
    except Exception as ex:
        print(repr(ex))

    @bot.message_handler(content_types=["text"])
    def send_message(message):
        try:
            num = float(message.text.split(' ')[0])
            curr = message.text.split(' ')[1]
            req = requests.get(f"https://api.coingecko.com/api/v3/coins/{curr.lower()}")
            response = req.json()
            sell_price_usd = response["market_data"]["current_price"]["usd"]
            sell_price_eur = response["market_data"]["current_price"]["eur"]
            if call.data == "usd":
                bot.send_message(
                    message.chat.id,
                    dol_format(float(sell_price_usd) * num)
                )
            elif call.data == "eur":
                bot.send_message(
                    message.chat.id,
                    str('{:,}'.format(okr(float(sell_price_eur) * num)))
                )
        except ValueError as ve:
            print(ve)
            bot.send_message(
                message.chat.id,
                "Неправильный формат"
            )
        except Exception as ex:
            print(ex)
            bot.send_message(
                message.chat.id,
                "Такой криптовалюты нет"
            )

```
</code>```

Body:
The bot must convert the cryptocurrency into dollars or euros. To select between these currencies, the /main command was created, when entered, the "Dollar" or "Euro" buttons are added. When I click on the "Dollar" button and then write, for example, 1 bitcoin, then it works. But when I choose "Euro", it still converts to dollars. Thanks in advance. Here is the code:

@bot.message_handler(commands=["main"])
def maincur(message):
    markup = types.InlineKeyboardMarkup(row_width=2)
    item1 = types.InlineKeyboardButton("Доллар", callback_data="usd")
    item2 = types.InlineKeyboardButton("Евро", callback_data="eur")
    markup.add(item1, item2)
    bot.send_message(message.chat.id, "Выберите основную валюту для конвертирования", reply_markup=markup)

@bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
    try:
        if call.message:
            if call.data == "usd":
                bot.send_message(call.message.chat.id, "Основная валюта - доллар")
            elif call.data == "eur":
                bot.send_message(call.message.chat.id, "Основная валюта - евро")
            bot.delete_message(chat_id=call.message.chat.id, message_id=call.message.message_id)
            bot.answer_callback_query(callback_query_id=call.id, show_alert=False,
                                      text="Основная валюта перевыбрана")
    except Exception as ex:
        print(repr(ex))

    @bot.message_handler(content_types=["text"])
    def send_message(message):
        try:
            num = float(message.text.split(' ')[0])
            curr = message.text.split(' ')[1]
            req = requests.get(f"https://api.coingecko.com/api/v3/coins/{curr.lower()}")
            response = req.json()
            sell_price_usd = response["market_data"]["current_price"]["usd"]
            sell_price_eur = response["market_data"]["current_price"]["eur"]
            if call.data == "usd":
                bot.send_message(
                    message.chat.id,
                    dol_format(float(sell_price_usd) * num)
                )
            elif call.data == "eur":
                bot.send_message(
                    message.chat.id,
                    str('{:,}'.format(okr(float(sell_price_eur) * num)))
                )
        except ValueError as ve:
            print(ve)
            bot.send_message(
                message.chat.id,
                "Неправильный формат"
            )
        except Exception as ex:
            print(ex)
            bot.send_message(
                message.chat.id,
                "Такой криптовалюты нет"
            )

```


问:
Setting OnClickListener in Profile Fragment.java but it says unreacheable
Hello i'm trying to add profile picture edit option in profile page of my application but whenever i write onclick listener gives me error below i don't know what to do can someone please help me ? checked id of button and else everything is correct

```<code>package com.example.stepapp.ui.profile;

import android.content.Intent;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.example.stepapp.R;

import de.hdodenhof.circleimageview.CircleImageView;

public class ProfileFragment extends Fragment {
    private Button ImCh;
    CircleImageView profile_image;
    private Button user;

    private TextView Username;
    private final int GALLERY_REQ_CODE=1000;

    public View onCreateView(@NonNull LayoutInflater inflater,
                             ViewGroup container, Bundle savedInstanceState) {

        if (container != null) {
            container.removeAllViews();
        }
        View root = inflater.inflate(R.layout.fragment_profile, container, false);
        ImCh =(Button) root.findViewById(R.id.fab);
        user=(Button) root.findViewById(R.id.EditName);
        profile_image =root.findViewById(R.id.profile_image);
        Username = root.findViewById(R.id.Username);
        Toast.makeText(getContext(),
                "testing the button " +String.valueOf(ImCh.getId()),
                Toast.LENGTH_SHORT).show();
        return root;

        ImCh.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
               Intent iGallery = new Intent(Intent.ACTION_PICK);
               iGallery.setData(MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
               startActivityForResult(iGallery,GALLERY_REQ_CODE);
            }
        });

        user.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
               Username.setText("");
            }
        });

    return root;
    }
    @Override
    public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
         if(resultCode==RESULT_OK){
            if(resultCode==GALLERY_REQ_CODE){
                profile_image.setImageURI(data.getData() );
           }
        }
    }
}

</code>```

i tried every solution but setOnClickListener of button raising error i couldn't find any other solution

Body:
Hello i'm trying to add profile picture edit option in profile page of my application but whenever i write onclick listener gives me error below i don't know what to do can someone please help me ? checked id of button and else everything is correct

package com.example.stepapp.ui.profile;

import android.content.Intent;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.example.stepapp.R;

import de.hdodenhof.circleimageview.CircleImageView;

public class ProfileFragment extends Fragment {
    private Button ImCh;
    CircleImageView profile_image;
    private Button user;

    private TextView Username;
    private final int GALLERY_REQ_CODE=1000;

    public View onCreateView(@NonNull LayoutInflater inflater,
                             ViewGroup container, Bundle savedInstanceState) {

        if (container != null) {
            container.removeAllViews();
        }
        View root = inflater.inflate(R.layout.fragment_profile, container, false);
        ImCh =(Button) root.findViewById(R.id.fab);
        user=(Button) root.findViewById(R.id.EditName);
        profile_image =root.findViewById(R.id.profile_image);
        Username = root.findViewById(R.id.Username);
        Toast.makeText(getContext(),
                "testing the button " +String.valueOf(ImCh.getId()),
                Toast.LENGTH_SHORT).show();
        return root;

        ImCh.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
               Intent iGallery = new Intent(Intent.ACTION_PICK);
               iGallery.setData(MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
               startActivityForResult(iGallery,GALLERY_REQ_CODE);
            }
        });

        user.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
               Username.setText("");
            }
        });

    return root;
    }
    @Override
    public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
         if(resultCode==RESULT_OK){
            if(resultCode==GALLERY_REQ_CODE){
                profile_image.setImageURI(data.getData() );
           }
        }
    }
}

i tried every solution but setOnClickListener of button raising error i couldn't find any other solution


问:
Start Spotify "Now Playing" from Home Assistant on remote device
I am trying to launch the spotify app on a remote Android device from a Home Assistant automation. The app opens fine using the launch app command, but I would like to launch the "now playing" screen directly as opposed to the app's home screen. I think this can be achieved by using the activity command or the broadcast intent command, but I can't figure it out.

This is the data for the command that works to just open the app.

"message": "command_launch_app",
"data": {
  "package_name": "com.spotify.music"
}
```
<p>I would think the activity command would look something like this, but not sure what to put for the title.</p>
<pre class="lang-json prettyprint-override"><code>"message": "command_activity",
"title": ????,
"data": {
  "intent_package_name": "com.spotify.music",
  "intent_action": "android.intent.action.VIEW"
}
</code>```

Body:
I am trying to launch the spotify app on a remote Android device from a Home Assistant automation. The app opens fine using the launch app command, but I would like to launch the "now playing" screen directly as opposed to the app's home screen. I think this can be achieved by using the activity command or the broadcast intent command, but I can't figure it out.

This is the data for the command that works to just open the app.

"message": "command_launch_app",
"data": {
  "package_name": "com.spotify.music"
}

I would think the activity command would look something like this, but not sure what to put for the title.

"message": "command_activity",
"title": ????,
"data": {
  "intent_package_name": "com.spotify.music",
  "intent_action": "android.intent.action.VIEW"
}


问:
Cropping a TIFF to a ShapeFile/2
Regarding this:

Cropping a TIFF to a ShapeFile

I have an issue to fix regarding the code sahred at the link above. In the tiffs directory at the end, I can find only one cropped file, namely the last file in the directory? While instead I have 36 .tif files that have to be cropped.

```<code>

</code>```

This is the code:

```<code>    crop_extent = gpd.read_file("path.shp")

    extension = 'tif'

    filenames = [i for i in glob.glob('path/*.
    {}'.format(extension))]

    tiffs = [rxr.open_rasterio(f) for f in filenames]

    for tiff_name in filenames:
    raster = rxr.open_rasterio(tiff_name)

    assert crop_extent.crs == raster.rio.crs, "diffrent crs"
    tiff_clipped =
    raster.rio.clip(crop_extent.geometry.apply(mapping),
                                 crop_extent.crs)

    tiff_clipped.rio.to_raster(tiff_name + 'cropped.tif')
    clipped_chm = rxr.open_rasterio(tiff_name +'cropped.tif')
</code>```

Therefore, I would need an help to get the cropping over all the .tif files in the directory and not only last one.

Title: Cropping a TIFF to a ShapeFile/2

Body:
Regarding this:

Cropping a TIFF to a ShapeFile

I have an issue to fix regarding the code sahred at the link above. In the tiffs directory at the end, I can find only one cropped file, namely the last file in the directory? While instead I have 36 .tif files that have to be cropped.

This is the code:

    crop_extent = gpd.read_file("path.shp")

    extension = 'tif'

    filenames = [i for i in glob.glob('path/*.
    {}'.format(extension))]

    tiffs = [rxr.open_rasterio(f) for f in filenames]

    for tiff_name in filenames:
    raster = rxr.open_rasterio(tiff_name)

    assert crop_extent.crs == raster.rio.crs, "diffrent crs"
    tiff_clipped =
    raster.rio.clip(crop_extent.geometry.apply(mapping),
                                 crop_extent.crs)

    tiff_clipped.rio.to_raster(tiff_name + 'cropped.tif')
    clipped_chm = rxr.open_rasterio(tiff_name +'cropped.tif')

Therefore, I would need an help to get the cropping over all the .tif files in the directory and not only last one.


问:
Suppress Visuall C++ Runtime Error when running Ctest in Visual Studio
When I ran a series of tests in Visual Studio using Ctest, some test fail and emit a pop-up windows with the error "Microsoft Visual C++ Runtime Library: Debug Assertion Failed". The tests can only continue to run after clicking the Ignore button. This is annoying since Ctest has marked the test to fail. Is there a way to suppress the window message so the test can run continuously?</p>


问:
Webpack cannot compile file that uses "export * as something"
I’m trying to run e2e tests for a React app using Cypress and NX.

When I run nx run dashboard-e2e:e2e (which uses cypress) I get the following webpack compilation error:

```<code>Error: Webpack Compilation Error
Module parse failed: Unexpected token (1:9)
File was processed with these loaders:
 * ../../../../Library/Caches/Cypress/11.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/ts-loader/index.js
You may need an additional loader to handle the result of these loaders.
> export * as dsls from './dsls';
| export { default as apps } from './apps';
|
</code>```

It seems to me that the problem is related to the use of export *. When I manually export the individual modules from dsls one by one the problem goes away. Also, please note that the dsls module exports json files actually and not typical node modules.

I am not sure how to debug this issue or whether is a webpack, cypress or Nx issue. It looks like a webpack config issue but I am not sure.

Can someone please help me?

I tried to debug it by narrowing down the error. It seems that the offending syntax is the export *. I have also checked the exported json modules and they are validated correctly so it's not a json syntax issue.

Body:
I’m trying to run e2e tests for a React app using Cypress and NX.

When I run nx run dashboard-e2e:e2e (which uses cypress) I get the following webpack compilation error:

Error: Webpack Compilation Error
Module parse failed: Unexpected token (1:9)
File was processed with these loaders:
 * ../../../../Library/Caches/Cypress/11.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/ts-loader/index.js
You may need an additional loader to handle the result of these loaders.
> export * as dsls from './dsls';
| export { default as apps } from './apps';
|

It seems to me that the problem is related to the use of export *. When I manually export the individual modules from dsls one by one the problem goes away. Also, please note that the dsls module exports json files actually and not typical node modules.

I am not sure how to debug this issue or whether is a webpack, cypress or Nx issue. It looks like a webpack config issue but I am not sure.

Can someone please help me?

I tried to debug it by narrowing down the error. It seems that the offending syntax is the export *. I have also checked the exported json modules and they are validated correctly so it's not a json syntax issue.


问:
How does gem5 determine whether an address is writable?
I want to check if an address is writable in gem5. This attribute appears to be recorded in the TLB.
There is a write_able variable in the TLB entry. It seems to represent whether the data can be modified by writing.

Moreover, I found where it was assigned.

And I output the result. But I found that write_able is always 1. Even for itlb.
This is so weird. Does anyone know why? Is gem5 not implementing this function? Or is there any other way to judge whether the address is write-protected?
Thanks!!!