问:
class "xxx.logging.impl.NoOpLog"'s signer information does not match signer information of other classes in the same package
i ready saw some post about this error
unfortunately, I can't find the exact cause so no solution for the moment

tomcat (8.5.83) can't deploy my war correctly

logs below:

```<code>[WARN ] [16/12/2022 - 08:14:48.135] org.springframework.web.context.support.XmlWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Constructor threw exception; nested exception is java.lang.ExceptionInInitializerError
[ERROR] [16/12/2022 - 08:14:48.137] org.springframework.web.servlet.DispatcherServlet - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Constructor threw exception; nested exception is java.lang.ExceptionInInitializerError
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1334) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1232) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.18.jar:5.3.18]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.18.jar:5.3.18]
        at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:702) ~[spring-webmvc-5.3.18.jar:5.3.18]
        at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:668) ~[spring-webmvc-5.3.18.jar:5.3.18]
        at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:716) ~[spring-webmvc-5.3.18.jar:5.3.18]
        at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:591) ~[spring-webmvc-5.3.18.jar:5.3.18]
        at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:530) [spring-webmvc-5.3.18.jar:5.3.18]
        at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:170) [spring-webmvc-5.3.18.jar:5.3.18]
        at javax.servlet.GenericServlet.init(GenericServlet.java:158) [servlet-api.jar:3.1.FR]
        at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1173) [catalina.jar:8.5.83]
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1118) [catalina.jar:8.5.83]
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1011) [catalina.jar:8.5.83]
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4953) [catalina.jar:8.5.83]
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5267) [catalina.jar:8.5.83]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:8.5.83]
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753) [catalina.jar:8.5.83]
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:727) [catalina.jar:8.5.83]
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695) [catalina.jar:8.5.83]
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1016) [catalina.jar:8.5.83]
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1903) [catalina.jar:8.5.83]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_352]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_352]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_352]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_352]
        at java.lang.Thread.run(Thread.java:750) [?:1.8.0_352]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Constructor threw exception; nested exception is java.lang.ExceptionInInitializerError
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:224) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326) ~[spring-beans-5.3.18.jar:5.3.18]
        ... 33 more
Caused by: java.lang.ExceptionInInitializerError
        at org.springframework.core.log.LogDelegateFactory.getCompositeLog(LogDelegateFactory.java:62) ~[spring-core-5.3.18.jar:5.3.18]
        at org.springframework.http.HttpLogging.forLog(HttpLogging.java:68) ~[spring-web-5.3.18.jar:5.3.18]
        at org.springframework.http.HttpLogging.forLogName(HttpLogging.java:57) ~[spring-web-5.3.18.jar:5.3.18]
        at org.springframework.http.converter.AbstractHttpMessageConverter.<init>(AbstractHttpMessageConverter.java:54) ~[spring-web-5.3.18.jar:5.3.18]
        at org.springframework.http.converter.ByteArrayHttpMessageConverter.<init>(ByteArrayHttpMessageConverter.java:45) ~[spring-web-5.3.18.jar:5.3.18]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.<init>(RequestMappingHandlerAdapter.java:205) ~[spring-webmvc-5.3.18.jar:5.3.18]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_352]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_352]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_352]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_352]
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326) ~[spring-beans-5.3.18.jar:5.3.18]
        ... 33 more
Caused by: java.lang.SecurityException: class "org.apache.commons.logging.impl.NoOpLog"'s signer information does not match signer information of other classes in the same package
        at java.lang.ClassLoader.checkCerts(ClassLoader.java:891) ~[?:1.8.0_352]
        at java.lang.ClassLoader.preDefineClass(ClassLoader.java:661) ~[?:1.8.0_352]
        at java.lang.ClassLoader.defineClass(ClassLoader.java:754) ~[?:1.8.0_352]
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0_352]
        at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2478) ~[catalina.jar:8.5.83]
        at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:881) ~[catalina.jar:8.5.83]
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1384) ~[catalina.jar:8.5.83]
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1228) ~[catalina.jar:8.5.83]
        at org.springframework.core.log.CompositeLog.<clinit>(CompositeLog.java:35) ~[spring-core-5.3.18.jar:5.3.18]
        at org.springframework.core.log.LogDelegateFactory.getCompositeLog(LogDelegateFactory.java:62) ~[spring-core-5.3.18.jar:5.3.18]
        at org.springframework.http.HttpLogging.forLog(HttpLogging.java:68) ~[spring-web-5.3.18.jar:5.3.18]
        at org.springframework.http.HttpLogging.forLogName(HttpLogging.java:57) ~[spring-web-5.3.18.jar:5.3.18]
        at org.springframework.http.converter.AbstractHttpMessageConverter.<init>(AbstractHttpMessageConverter.java:54) ~[spring-web-5.3.18.jar:5.3.18]
        at org.springframework.http.converter.ByteArrayHttpMessageConverter.<init>(ByteArrayHttpMessageConverter.java:45) ~[spring-web-5.3.18.jar:5.3.18]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.<init>(RequestMappingHandlerAdapter.java:205) ~[spring-webmvc-5.3.18.jar:5.3.18]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_352]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_352]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_352]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_352]
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326) ~[spring-beans-5.3.18.jar:5.3.18]
</code>```

when i check with mvn dependency:analyze-duplicate =>   No duplicate dependencies found in < dependencies/> or in < dependencyManagement/>

thanks

Body:
i ready saw some post about this error
unfortunately, I can't find the exact cause so no solution for the moment

tomcat (8.5.83) can't deploy my war correctly

logs below:

[WARN ] [16/12/2022 - 08:14:48.135] org.springframework.web.context.support.XmlWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Constructor threw exception; nested exception is java.lang.ExceptionInInitializerError
[ERROR] [16/12/2022 - 08:14:48.137] org.springframework.web.servlet.DispatcherServlet - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Constructor threw exception; nested exception is java.lang.ExceptionInInitializerError
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1334) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1232) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.18.jar:5.3.18]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.18.jar:5.3.18]
        at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:702) ~[spring-webmvc-5.3.18.jar:5.3.18]
        at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:668) ~[spring-webmvc-5.3.18.jar:5.3.18]
        at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:716) ~[spring-webmvc-5.3.18.jar:5.3.18]
        at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:591) ~[spring-webmvc-5.3.18.jar:5.3.18]
        at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:530) [spring-webmvc-5.3.18.jar:5.3.18]
        at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:170) [spring-webmvc-5.3.18.jar:5.3.18]
        at javax.servlet.GenericServlet.init(GenericServlet.java:158) [servlet-api.jar:3.1.FR]
        at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1173) [catalina.jar:8.5.83]
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1118) [catalina.jar:8.5.83]
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1011) [catalina.jar:8.5.83]
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4953) [catalina.jar:8.5.83]
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5267) [catalina.jar:8.5.83]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:8.5.83]
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753) [catalina.jar:8.5.83]
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:727) [catalina.jar:8.5.83]
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695) [catalina.jar:8.5.83]
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1016) [catalina.jar:8.5.83]
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1903) [catalina.jar:8.5.83]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_352]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_352]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_352]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_352]
        at java.lang.Thread.run(Thread.java:750) [?:1.8.0_352]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Constructor threw exception; nested exception is java.lang.ExceptionInInitializerError
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:224) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326) ~[spring-beans-5.3.18.jar:5.3.18]
        ... 33 more
Caused by: java.lang.ExceptionInInitializerError
        at org.springframework.core.log.LogDelegateFactory.getCompositeLog(LogDelegateFactory.java:62) ~[spring-core-5.3.18.jar:5.3.18]
        at org.springframework.http.HttpLogging.forLog(HttpLogging.java:68) ~[spring-web-5.3.18.jar:5.3.18]
        at org.springframework.http.HttpLogging.forLogName(HttpLogging.java:57) ~[spring-web-5.3.18.jar:5.3.18]
        at org.springframework.http.converter.AbstractHttpMessageConverter.<init>(AbstractHttpMessageConverter.java:54) ~[spring-web-5.3.18.jar:5.3.18]
        at org.springframework.http.converter.ByteArrayHttpMessageConverter.<init>(ByteArrayHttpMessageConverter.java:45) ~[spring-web-5.3.18.jar:5.3.18]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.<init>(RequestMappingHandlerAdapter.java:205) ~[spring-webmvc-5.3.18.jar:5.3.18]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_352]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_352]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_352]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_352]
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326) ~[spring-beans-5.3.18.jar:5.3.18]
        ... 33 more
Caused by: java.lang.SecurityException: class "org.apache.commons.logging.impl.NoOpLog"'s signer information does not match signer information of other classes in the same package
        at java.lang.ClassLoader.checkCerts(ClassLoader.java:891) ~[?:1.8.0_352]
        at java.lang.ClassLoader.preDefineClass(ClassLoader.java:661) ~[?:1.8.0_352]
        at java.lang.ClassLoader.defineClass(ClassLoader.java:754) ~[?:1.8.0_352]
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0_352]
        at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2478) ~[catalina.jar:8.5.83]
        at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:881) ~[catalina.jar:8.5.83]
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1384) ~[catalina.jar:8.5.83]
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1228) ~[catalina.jar:8.5.83]
        at org.springframework.core.log.CompositeLog.<clinit>(CompositeLog.java:35) ~[spring-core-5.3.18.jar:5.3.18]
        at org.springframework.core.log.LogDelegateFactory.getCompositeLog(LogDelegateFactory.java:62) ~[spring-core-5.3.18.jar:5.3.18]
        at org.springframework.http.HttpLogging.forLog(HttpLogging.java:68) ~[spring-web-5.3.18.jar:5.3.18]
        at org.springframework.http.HttpLogging.forLogName(HttpLogging.java:57) ~[spring-web-5.3.18.jar:5.3.18]
        at org.springframework.http.converter.AbstractHttpMessageConverter.<init>(AbstractHttpMessageConverter.java:54) ~[spring-web-5.3.18.jar:5.3.18]
        at org.springframework.http.converter.ByteArrayHttpMessageConverter.<init>(ByteArrayHttpMessageConverter.java:45) ~[spring-web-5.3.18.jar:5.3.18]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.<init>(RequestMappingHandlerAdapter.java:205) ~[spring-webmvc-5.3.18.jar:5.3.18]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_352]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_352]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_352]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_352]
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.3.18.jar:5.3.18]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326) ~[spring-beans-5.3.18.jar:5.3.18]

when i check with mvn dependency:analyze-duplicate =>   No duplicate dependencies found in < dependencies/> or in < dependencyManagement/>

thanks


来源: stackexchange

问:
Error occurred during initialization of VM Error opening zip file or JAR manifest missing : C:\Users\Ilya agent library failed to init: instrument
I've got a problem while using TestNg run configuration in my Intellij IDE. I'm using JDK 11.0.17 and TestNg 7.4.0 and caught this type of error while compiling my test class

```<code>Error occurred during initialization of VM Error opening zip file or JAR manifest missing : C:\Users\Ilya agent library failed to init: instrument
</code>```

When I look at my run configuration I can see this:
Run config

but if I change classpath of module to "no module" it works good, but looks not so well in run config

I tried to run test class with TestNg run configuration and caught an error

ContentLicense: CC BY-SA 4.0

Body:
I've got a problem while using TestNg run configuration in my Intellij IDE. I'm using JDK 11.0.17 and TestNg 7.4.0 and caught this type of error while compiling my test class

Error occurred during initialization of VM Error opening zip file or JAR manifest missing : C:\Users\Ilya agent library failed to init: instrument

When I look at my run configuration I can see this:
Run config

but if I change classpath of module to "no module" it works good, but looks not so well in run config

I tried to run test class with TestNg run configuration and caught an error


问:
Core Wars 8086 safe challenge
Im trying to find the key for this safe

```<code>public start
start proc near
push    cs
pop     es
assume es:seg000
int     87h             ; used by BASIC while in interpreter
push    ax
mov     bx, ax
and     bx, 5555h
and     ax, 0AAAAh
shr     ax, 1
add     ax, bx
mov     bx, ax
and     bx, 3333h
and     ax, 0CCCCh
mov     cl, 2
shr     ax, cl
add     ax, bx
mov     bx, ax
and     bx, 0F0Fh
and     ax, 0F0F0h
shl     cl, 1
shr     ax, cl
add     bx, ax
add     bh, bl
mov     bl, 10h
pop     ax
mov     [bx], ax

loc_137:
jmp     short loc_137
start endp

seg000 ends

end start
</code>```

I thing that I can get the address of the code from ax register, the safe saves the address of the next instruction in address which stored in bx ( mov     [bx], ax).
The last part of the address is 10h but I an get the first part.
How can I crack this safe?

THE RULES

The simulation of a safe and key is done inside the Core Wars 8086 engine. The rules are:

The survivors cannot place a load on fixed addresses, because the game engine loads them every turn to a random address. The programs that are generated must be COM and not EXEs and contain only 8086 instructions.

Each survivor receives a set of its own complete registers (registers), which is not accessible to the other survivors. In addition, each survivor has a "personal" stack of 2048 bytes, which is also inaccessible to the other survivors.

Before running the first round of the game, the game engine initializes all the bytes in the arena to the value 0CCh (note: this byte value is an "unsupported" instruction - details below). The engine then loads each survivor to a random location in the arena memory, ie - copies the contents of the survivor file exactly as it is. The distance between two survivors, as well as the distance between the survivor and the edge of the arena, is guaranteed to be at least 1024 bytes. The code for each survivor has a maximum of 512 bytes.

Before the first round, the game engine initializes the registers (of each survivor) to the following values:

BX, CX, DX, SI, DI, BP - Reset.
Flags - Reset.
AX, IP - The position of the initial survivor, the random offset in the arena to which the survivor is loaded by the game engine.
CS, DS - The segment of the arena common to all survivors.
ES - A segment (segment) for the memory shared by survivors of the same group (see Advanced Techniques ).
SS - Beginning section of the personal stack of the survivor.
SP - Offset The start of the personal stack of the survivor.
At this point the game begins in rounds, with each round running the game engine running the next instruction of each survivor, until the end of the game: after 200,000 rounds, or when a single survivor remains in the arena. The order in which the survivors will play in each round is determined at the beginning of the game at random, and does not change during it.

A survivor is disqualified in the following cases:

Running an illegal instruction (example: byte 060h that does not translate into any assembly instruction).
Running an "unsupported" instruction by the game engine (example: "INT 021h"). The game engine prevents running instructions that try to initiate direct communication with the operating system or computer hardware. Attempt to access memory that is not within the realm of the arena, and not within the realm of the "personal" stack of the survivor.
Attacking other survivors is done by writing information about their code in the arena memory (in order to get them to perform one of the above three actions), and consequently to disqualify them. Earlier, therefore, one has to find where they are hiding :)

Title: Core Wars 8086 safe challenge

Body:
Im trying to find the key for this safe

public start
start proc near
push    cs
pop     es
assume es:seg000
int     87h             ; used by BASIC while in interpreter
push    ax
mov     bx, ax
and     bx, 5555h
and     ax, 0AAAAh
shr     ax, 1
add     ax, bx
mov     bx, ax
and     bx, 3333h
and     ax, 0CCCCh
mov     cl, 2
shr     ax, cl
add     ax, bx
mov     bx, ax
and     bx, 0F0Fh
and     ax, 0F0F0h
shl     cl, 1
shr     ax, cl
add     bx, ax
add     bh, bl
mov     bl, 10h
pop     ax
mov     [bx], ax

loc_137:
jmp     short loc_137
start endp

seg000 ends

end start

I thing that I can get the address of the code from ax register, the safe saves the address of the next instruction in address which stored in bx ( mov     [bx], ax).
The last part of the address is 10h but I an get the first part.
How can I crack this safe?

THE RULES

The simulation of a safe and key is done inside the Core Wars 8086 engine. The rules are:

The survivors cannot place a load on fixed addresses, because the game engine loads them every turn to a random address. The programs that are generated must be COM and not EXEs and contain only 8086 instructions.

Each survivor receives a set of its own complete registers (registers), which is not accessible to the other survivors. In addition, each survivor has a "personal" stack of 2048 bytes, which is also inaccessible to the other survivors.

Before running the first round of the game, the game engine initializes all the bytes in the arena to the value 0CCh (note: this byte value is an "unsupported" instruction - details below). The engine then loads each survivor to a random location in the arena memory, ie - copies the contents of the survivor file exactly as it is. The distance between two survivors, as well as the distance between the survivor and the edge of the arena, is guaranteed to be at least 1024 bytes. The code for each survivor has a maximum of 512 bytes.

Before the first round, the game engine initializes the registers (of each survivor) to the following values:

BX, CX, DX, SI, DI, BP - Reset.
Flags - Reset.
AX, IP - The position of the initial survivor, the random offset in the arena to which the survivor is loaded by the game engine.
CS, DS - The segment of the arena common to all survivors.
ES - A segment (segment) for the memory shared by survivors of the same group (see Advanced Techniques ).
SS - Beginning section of the personal stack of the survivor.
SP - Offset The start of the personal stack of the survivor.
At this point the game begins in rounds, with each round running the game engine running the next instruction of each survivor, until the end of the game: after 200,000 rounds, or when a single survivor remains in the arena. The order in which the survivors will play in each round is determined at the beginning of the game at random, and does not change during it.

A survivor is disqualified in the following cases:

Running an illegal instruction (example: byte 060h that does not translate into any assembly instruction).
Running an "unsupported" instruction by the game engine (example: "INT 021h"). The game engine prevents running instructions that try to initiate direct communication with the operating system or computer hardware. Attempt to access memory that is not within the realm of the arena, and not within the realm of the "personal" stack of the survivor.
Attacking other survivors is done by writing information about their code in the arena memory (in order to get them to perform one of the above three actions), and consequently to disqualify them. Earlier, therefore, one has to find where they are hiding :)


问:
Show values that below the certain percentage within other label in pie chart
I am trying to create pie chart. This chart will have 18 different labels. Problem is that the values of some fields in the series are minuscule compared to other fields (see screenshot of chart below). I want to aggregate fields that are lower than certain percentage of the whole series. For instance, I want to display values of fields that below than 0.5% of total as others. Does Apex Chart library have built-in option for my problem? If not, Do I need to solve this with a workaround?

Chart that being rendered

I tried to find a built-in solution from Apex Charts library, but i couldn't find a answer in the documentation.


问:
How can I increment one value with double numbers with elseif?
Why when run this loop:

```<code>while gamma <=3
    tab_gamma(j)=gamma;
    if gamma <0.0001
        gamma=gamma+0.00001;
    elseif gamma <0.001
        gamma=gamma+0.0001;
    elseif gamma <0.01
        gamma=gamma+0.001;
    elseif gamma<0.1
        gamma=gamma+0.01;
    elseif gamma <1.0
        gamma=gamma+0.1;
    elseif gamma <2.0
        gamma=gamma+0.1;
    elseif gamma <=3.0
        gamma=gamma+0.2;
    end
    j=j+1;
end
</code>```

I get this: Result
Why it can't understand changing 0.1 is greater than 0.1 and less than 1, so it should change inrementation.

I want it to make there 0.1, 0.2, 0.3 etc. I tried changing digits with "digits" function, but It didn't work for me.

Body:
Why when run this loop:

while gamma <=3
    tab_gamma(j)=gamma;
    if gamma <0.0001
        gamma=gamma+0.00001;
    elseif gamma <0.001
        gamma=gamma+0.0001;
    elseif gamma <0.01
        gamma=gamma+0.001;
    elseif gamma<0.1
        gamma=gamma+0.01;
    elseif gamma <1.0
        gamma=gamma+0.1;
    elseif gamma <2.0
        gamma=gamma+0.1;
    elseif gamma <=3.0
        gamma=gamma+0.2;
    end
    j=j+1;
end

I get this: Result
Why it can't understand changing 0.1 is greater than 0.1 and less than 1, so it should change inrementation.

I want it to make there 0.1, 0.2, 0.3 etc. I tried changing digits with "digits" function, but It didn't work for me.


问:
python socket script doesn't update the messages unless entered is pressed
Client.py:

import socket, time

SERVER = '0.0.0.0'
PORT = 433

ADDR = (SERVER, PORT)
FORMAT = "utf-8"
DISCONNECT_MESSAGE = "!DISCONNECT"

def connect():
    client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    client.connect(ADDR)
    # message = client.recv(1024).decode()
    # print(message)
    return client

# Print the received message

def send(client, msg):
    message = msg.encode(FORMAT)
    client.send(message)

def start():
    connection = connect()
    f=input('Press Enter to start....')
    print(f)
    while True:
        msg = input("Message (q for quit): ")

        if msg == 'q':
            break

        send(connection, msg)
        msg2 = connection.recv(1024).decode(FORMAT)
        print(msg2)

    send(connection, DISCONNECT_MESSAGE)
    time.sleep(2)
    print('Disconnected')

start()

```

Everytime a message is sent on a client I have to enter a message to get other messages sent by other clients, i want it to automatically update though like print up input down? maybe using like asyncio or threading?

Body:
Client.py:

import socket, time

SERVER = '0.0.0.0'
PORT = 433

ADDR = (SERVER, PORT)
FORMAT = "utf-8"
DISCONNECT_MESSAGE = "!DISCONNECT"

def connect():
    client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    client.connect(ADDR)
    # message = client.recv(1024).decode()
    # print(message)
    return client

# Print the received message

def send(client, msg):
    message = msg.encode(FORMAT)
    client.send(message)

def start():
    connection = connect()
    f=input('Press Enter to start....')
    print(f)
    while True:
        msg = input("Message (q for quit): ")

        if msg == 'q':
            break

        send(connection, msg)
        msg2 = connection.recv(1024).decode(FORMAT)
        print(msg2)

    send(connection, DISCONNECT_MESSAGE)
    time.sleep(2)
    print('Disconnected')

start()

Everytime a message is sent on a client I have to enter a message to get other messages sent by other clients, i want it to automatically update though like print up input down? maybe using like asyncio or threading?


问:
How can I convert onnx format to pt or pth format and save?
How can I convert onnx format to pt or pth format and save it as a file?

Thank you


问:
lmfit - SineModel+ConstantModel appears inaccurate fit
I'm trying to fit a simple sine function to some experimental data using lmfit and I find that the SineModel with a constant model offset returns, what looks like an inaccurate fit to the data (to me). I suppose it may be helpful to highlight that I am most interested in the frequency of the peaks (and I appreciate that I can simply use a scipy.find_peaks() but would prefer to show a fit to the data).

I use the function below for lmfit model:

```<code>def Sine(self, x_axis, y_axis):
    sine = SineModel()
    const = ConstantModel()

    x_fit = np.linspace(min(x_axis), max(x_axis), x_axis.size)
    guess_sine = sine.guess(y_axis, x=x_fit)

    pars = sine.guess(y_axis, x=x_fit)
    sine_offset = SineModel() + ConstantModel()

    pars.add('c', value=1, vary=True)

    result = sine_offset.fit(y_axis, pars, x=x_fit)

   return result
</code>```

Sine function output (graph and report results) are provided here:
SineModel+ConstModel

I then tried to define my own function, defining my own parameters and evaluating in the same lmfit method, providing sensible "guess" initial values etc.

```<code>def Sine_User2(self, x_axis, y_axis):
   def sine_func(x, amplitude, freq, shift, c):
        return amplitude * np.sin(freq * x + shift) + c

    sinemodel = Model(sine_func)

    # Take a FFT of the data to provide a guess starting location for the curve fitting
    x = np.array(x_axis)
    y = np.array(y_axis)
    ff = np.fft.fftfreq(len(x), (x[1] - x[0]))   # assume uniform spacing
    Fyy = abs(np.fft.fft(y))
    guess_freq = abs(ff[np.argmax(Fyy[1:]) + 1]) * 2. * np.pi
    guess_amp = np.std(y) * 2.**0.5
    guess_offset = np.mean(y)

    x_fit = np.linspace(min(x_axis), max(x_axis), x_axis.size)

    params = sinemodel.make_params(amplitude = guess_amp, freq = guess_freq, shift = 0, c = guess_offset )
    result = sinemodel.fit(y_axis, params, x = x_fit)

    return result
</code>```

The output of the user defined model appears to provide a much closer fit to the data, however, the report does not provide uncertainties citing a warning that the "Uncertainties could not be estimated":

SineUser2 function outputs (graph and report results) are provided here: User Defined Model

I then tried to include min/max values to the parameters by replacing the "sinmodel.make_params" line with:

```<code>    params = Parameters()
    params.add('amplitude', value=guess_amp, min = 0)
    params.add('freq', value=guess_freq, min=0)
    params.add('shift', value=0, min=-2*np.pi, max=2*np.pi)
    params.add('c', value=guess_offset)
</code>```

But the results resort back to the SineModel+ConstModel results seen in the first linked graph/report results. Therefore it must be something to do with the way I'm setting initial values.

The fit using the "SineUser2" function appears to be better. Is there a way to improve the fit for "Sine" function in the first block of code.

Why are the uncertainties not calculated in the second function "Sine_User2"?

Data (.csv):

```<code>Wavelength (nm),Power (dBm),,,,,
1549.9,-13.76008731,,,,,
1549.905,-13.69423162,,,,,
1549.91,-12.59004339,,,,,
1549.915,-11.31061848,,,,,
1549.92,-10.58731809,,,,,
1549.925,-10.19024329,,,,,
1549.93,-10.07301418,,,,,
1549.935,-10.19513172,,,,,
1549.94,-10.45582159,,,,,
1549.945,-11.15984161,,,,,
1549.95,-12.15876596,,,,,
1549.955,-13.44674933,,,,,
1549.96,-13.56388277,,,,,
1549.965,-12.2513065,,,,,
1549.97,-11.08699015,,,,,
1549.975,-10.43829185,,,,,
1549.98,-10.12861158,,,,,
1549.985,-10.0962929,,,,,
1549.99,-10.1852173,,,,,
1549.995,-10.55438183,,,,,
1550,-11.19555345,,,,,
1550.005,-12.28715299,,,,,
1550.01,-13.5153863,,,,,
1550.015,-13.47019261,,,,,
1550.02,-12.12394732,,,,,
1550.025,-11.01946751,,,,,
1550.03,-10.42138778,,,,,
1550.035,-10.14438079,,,,,
1550.04,-10.05681218,,,,,
1550.045,-10.17148605,,,,,
1550.05,-10.56046759,,,,,
1550.055,-11.11621478,,,,,
1550.06,-12.19930263,,,,,
1550.065,-13.48428349,,,,,
1550.07,-13.43424913,,,,,
1550.075,-12.08019952,,,,,
1550.08,-11.08731704,,,,,
1550.085,-10.45730899,,,,,
1550.09,-10.11278169,,,,,
1550.095,-10.00651194,,,,,
,,,,,,
</code>```

Body:
I'm trying to fit a simple sine function to some experimental data using lmfit and I find that the SineModel with a constant model offset returns, what looks like an inaccurate fit to the data (to me). I suppose it may be helpful to highlight that I am most interested in the frequency of the peaks (and I appreciate that I can simply use a scipy.find_peaks() but would prefer to show a fit to the data).

I use the function below for lmfit model:

def Sine(self, x_axis, y_axis):
    sine = SineModel()
    const = ConstantModel()

    x_fit = np.linspace(min(x_axis), max(x_axis), x_axis.size)
    guess_sine = sine.guess(y_axis, x=x_fit)

    pars = sine.guess(y_axis, x=x_fit)
    sine_offset = SineModel() + ConstantModel()

    pars.add('c', value=1, vary=True)

    result = sine_offset.fit(y_axis, pars, x=x_fit)

   return result

Sine function output (graph and report results) are provided here:
SineModel+ConstModel

I then tried to define my own function, defining my own parameters and evaluating in the same lmfit method, providing sensible "guess" initial values etc.

def Sine_User2(self, x_axis, y_axis):
   def sine_func(x, amplitude, freq, shift, c):
        return amplitude * np.sin(freq * x + shift) + c

    sinemodel = Model(sine_func)

    # Take a FFT of the data to provide a guess starting location for the curve fitting
    x = np.array(x_axis)
    y = np.array(y_axis)
    ff = np.fft.fftfreq(len(x), (x[1] - x[0]))   # assume uniform spacing
    Fyy = abs(np.fft.fft(y))
    guess_freq = abs(ff[np.argmax(Fyy[1:]) + 1]) * 2. * np.pi
    guess_amp = np.std(y) * 2.**0.5
    guess_offset = np.mean(y)

    x_fit = np.linspace(min(x_axis), max(x_axis), x_axis.size)

    params = sinemodel.make_params(amplitude = guess_amp, freq = guess_freq, shift = 0, c = guess_offset )
    result = sinemodel.fit(y_axis, params, x = x_fit)

    return result

The output of the user defined model appears to provide a much closer fit to the data, however, the report does not provide uncertainties citing a warning that the "Uncertainties could not be estimated":

SineUser2 function outputs (graph and report results) are provided here: User Defined Model

I then tried to include min/max values to the parameters by replacing the "sinmodel.make_params" line with:

    params = Parameters()
    params.add('amplitude', value=guess_amp, min = 0)
    params.add('freq', value=guess_freq, min=0)
    params.add('shift', value=0, min=-2*np.pi, max=2*np.pi)
    params.add('c', value=guess_offset)

But the results resort back to the SineModel+ConstModel results seen in the first linked graph/report results. Therefore it must be something to do with the way I'm setting initial values.

The fit using the "SineUser2" function appears to be better. Is there a way to improve the fit for "Sine" function in the first block of code.

Why are the uncertainties not calculated in the second function "Sine_User2"?

Data (.csv):

Wavelength (nm),Power (dBm),,,,,
1549.9,-13.76008731,,,,,
1549.905,-13.69423162,,,,,
1549.91,-12.59004339,,,,,
1549.915,-11.31061848,,,,,
1549.92,-10.58731809,,,,,
1549.925,-10.19024329,,,,,
1549.93,-10.07301418,,,,,
1549.935,-10.19513172,,,,,
1549.94,-10.45582159,,,,,
1549.945,-11.15984161,,,,,
1549.95,-12.15876596,,,,,
1549.955,-13.44674933,,,,,
1549.96,-13.56388277,,,,,
1549.965,-12.2513065,,,,,
1549.97,-11.08699015,,,,,
1549.975,-10.43829185,,,,,
1549.98,-10.12861158,,,,,
1549.985,-10.0962929,,,,,
1549.99,-10.1852173,,,,,
1549.995,-10.55438183,,,,,
1550,-11.19555345,,,,,
1550.005,-12.28715299,,,,,
1550.01,-13.5153863,,,,,
1550.015,-13.47019261,,,,,
1550.02,-12.12394732,,,,,
1550.025,-11.01946751,,,,,
1550.03,-10.42138778,,,,,
1550.035,-10.14438079,,,,,
1550.04,-10.05681218,,,,,
1550.045,-10.17148605,,,,,
1550.05,-10.56046759,,,,,
1550.055,-11.11621478,,,,,
1550.06,-12.19930263,,,,,
1550.065,-13.48428349,,,,,
1550.07,-13.43424913,,,,,
1550.075,-12.08019952,,,,,
1550.08,-11.08731704,,,,,
1550.085,-10.45730899,,,,,
1550.09,-10.11278169,,,,,
1550.095,-10.00651194,,,,,
,,,,,,


问:
React npm packages using rollup not working with srr or nextjs?
I create a simple react packages for personal uses (private package). But when I want to use it into nextjs project it's css not working with ssr. Actually, working but not ssr friendly. Here after component loading then css will be loaded. But I want it with ssr. I mean css also work with ssr.

rollup.config.mjs-

```<code>import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "@rollup/plugin-typescript";
import dts from "rollup-plugin-dts";
import postcss from "rollup-plugin-postcss";
import peerDepsExternal from "rollup-plugin-peer-deps-external";

export default [
    {
        input: "src/index.ts",
        output: [
            {
                file: "dist/cjs/index.js",
                format: "cjs",
                sourcemap: true,
            },
            {
                file: "dist/esm/index.js",
                format: "esm",
                sourcemap: true,
            },
        ],
        plugins: [
            peerDepsExternal(),
            resolve(),
            commonjs(),
            typescript({ tsconfig: "./tsconfig.json" }),
            postcss()
        ],
        external: ["react", "react-dom"]
    },
    {
        input: "dist/esm/types/index.d.ts",
        output: [{ file: "dist/index.d.ts", format: "esm" }],
        plugins: [dts()],
        external: [/\.css$/]
    }
];
</code>```

Can anyone help me.

Body:
I create a simple react packages for personal uses (private package). But when I want to use it into nextjs project it's css not working with ssr. Actually, working but not ssr friendly. Here after component loading then css will be loaded. But I want it with ssr. I mean css also work with ssr.

rollup.config.mjs-

import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "@rollup/plugin-typescript";
import dts from "rollup-plugin-dts";
import postcss from "rollup-plugin-postcss";
import peerDepsExternal from "rollup-plugin-peer-deps-external";

export default [
    {
        input: "src/index.ts",
        output: [
            {
                file: "dist/cjs/index.js",
                format: "cjs",
                sourcemap: true,
            },
            {
                file: "dist/esm/index.js",
                format: "esm",
                sourcemap: true,
            },
        ],
        plugins: [
            peerDepsExternal(),
            resolve(),
            commonjs(),
            typescript({ tsconfig: "./tsconfig.json" }),
            postcss()
        ],
        external: ["react", "react-dom"]
    },
    {
        input: "dist/esm/types/index.d.ts",
        output: [{ file: "dist/index.d.ts", format: "esm" }],
        plugins: [dts()],
        external: [/\.css$/]
    }
];

Can anyone help me.


问:
AWS EC2 RunInstance SCP Tag Policy failure
I am trying to implement an AWS tagging policy at the AWS Organization level.
This will cover many AWS services but the immediate issue is related to EC2.

This policy results in an error when I try to use the AWS CLI command : ec2 run-instance.

```<code>{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyResourceCreationSCP",
      "Effect": "Deny",
      "Action": [
        "ec2:Create*",
        "ec2:Run*",
        "elasticfilesystem:Create*",
      ],
      "Resource": [
        "*"
      ],
      "Condition": {
        "Null": {
          "aws:RequestTag/project": "true"
        }
      }
    }
  ]
}
</code>```

However this policy succeeds.

```<code>{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyResourceCreationSCP",
      "Effect": "Deny",
      "Action": [
        "ec2:Create*",
        "elasticfilesystem:Create*",
      ],
      "Resource": [
        "*"
      ],
      "Condition": {
        "Null": {
          "aws:RequestTag/project": "true"
        }
      }
    },
    {
      "Sid": "DenyResourceCreationSCPEC2",
      "Effect": "Deny",
      "Action": [
        "ec2:RunInstance"
      ],
      "Resource": [
        "arn:aws:ec2:*:*:instance/*",
        "arn:aws:ec2:*:*:volume/*",
        "arn:aws:ec2:*:*:network-interface/*",
        "arn:aws:ec2:*:*:security-group/*",
        "arn:aws:ec2:*:*:subnet/*"
      ],
      "Condition": {
        "Null": {
          "aws:RequestTag/project": "true"
        }
      }
    }
  ]
}
</code>```

Can someone explain please why the  resource condition for "*" full wildcard does not work for ECS2 RunInstance?

Why does the volume,instance,security-group-network-interface resource type need to be explicit?

Thanks

Body:
I am trying to implement an AWS tagging policy at the AWS Organization level.
This will cover many AWS services but the immediate issue is related to EC2.

This policy results in an error when I try to use the AWS CLI command : ec2 run-instance.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyResourceCreationSCP",
      "Effect": "Deny",
      "Action": [
        "ec2:Create*",
        "ec2:Run*",
        "elasticfilesystem:Create*",
      ],
      "Resource": [
        "*"
      ],
      "Condition": {
        "Null": {
          "aws:RequestTag/project": "true"
        }
      }
    }
  ]
}

However this policy succeeds.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyResourceCreationSCP",
      "Effect": "Deny",
      "Action": [
        "ec2:Create*",
        "elasticfilesystem:Create*",
      ],
      "Resource": [
        "*"
      ],
      "Condition": {
        "Null": {
          "aws:RequestTag/project": "true"
        }
      }
    },
    {
      "Sid": "DenyResourceCreationSCPEC2",
      "Effect": "Deny",
      "Action": [
        "ec2:RunInstance"
      ],
      "Resource": [
        "arn:aws:ec2:*:*:instance/*",
        "arn:aws:ec2:*:*:volume/*",
        "arn:aws:ec2:*:*:network-interface/*",
        "arn:aws:ec2:*:*:security-group/*",
        "arn:aws:ec2:*:*:subnet/*"
      ],
      "Condition": {
        "Null": {
          "aws:RequestTag/project": "true"
        }
      }
    }
  ]
}

Can someone explain please why the  resource condition for "*" full wildcard does not work for ECS2 RunInstance?

Why does the volume,instance,security-group-network-interface resource type need to be explicit?

Thanks


问:
Is there a regex or some other method for ascertaining whether or a line from a function in string form is part of a multiline string?
I have a function that is stored as a string, e.g.

```<code>"""def foo():
  print("hello world")
  x = 1
  for i in range(10):
    x += i
    print(x)

  multilinestring = '''hello
world
over
multiple
lines'''
  print(multilinestring)

  secondmultilinestring = '''hello
world
over
multiple
lines
again'''
  print(secondmultilinestring)"""
</code>```

I want to know which lines are part of a multi-line string, by recieving a list of the indices of the lines. For example, in this case, I would want to get the result [7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19]

Is there a regex that can do this, and is able to ignore tripple quote marks that are escaped, for example using backslashes or putting them after comment hashtags? Can it also be made to work for both """ and '''? Or is there another method, perhaps using linting or another static analysis tool that could work?

Body:
I have a function that is stored as a string, e.g.

"""def foo():
  print("hello world")
  x = 1
  for i in range(10):
    x += i
    print(x)

  multilinestring = '''hello
world
over
multiple
lines'''
  print(multilinestring)

  secondmultilinestring = '''hello
world
over
multiple
lines
again'''
  print(secondmultilinestring)"""

I want to know which lines are part of a multi-line string, by recieving a list of the indices of the lines. For example, in this case, I would want to get the result [7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19]

Is there a regex that can do this, and is able to ignore tripple quote marks that are escaped, for example using backslashes or putting them after comment hashtags? Can it also be made to work for both """ and '''? Or is there another method, perhaps using linting or another static analysis tool that could work?


问:
Tauri is not showing the expected results and the build seems to be pretty broken
I've been trying to convert my website into a project with Tauri for the past 3 days and I'm not getting any intended results even though I followed the tutorial on Tauri Documentation countless times.

When I run npm create tauri-app to create a starting template for my project, I should be able to get a result like the following.

https://www.freecodecamp.org/news/content/images/2022/10/Screenshot-from-2022-10-11-14-03-45.png
(Copyrights go to relevant authors)

But I always get something like this.

My build

After I got this problem I emptied my project folder, uninstalled npm and tauri-cli reinstalled it again, and followed the tutorial but still get no good results. I continued the same procedure more than ten times in a row. I also tried using other package managers which were available but didn't work for me.

Then I checked the src file within my project folder which contained the related html, css and javascript files for the demo and opened index.html. It also looked like this.

Demo HTML files viewed through a browser

Browser console had following issues and I have no idea what's going with my Tauri project all the time.

Issues in the browser console

I swifted through the official Tauri GitHub resp and found no any issue like this is filed by somebody. I really apprciate if any possible solution is given regarding this issue.

Tauri CLI: @tauri-apps/cli@1.2.2
OS: Windows 11 Home Single Langauge 10.0.22623 Build 22623
Both npm and Node.js are up-to-date.


Title: Select MAX timestamp values from multiple colums per id

Body:
I have to get various results from different tables, having different timestamps in each entry, under one unique row, containing all the information from table a, the last update from table b, the last update from table c etc...
This is my SQLFiddle

NULL values must be included.

Right now i have this situation:

|   name | revenue |               lastupdate_b |  level |               lastupdate_c |
|--------|---------|----------------------------|--------|----------------------------|
|    foo |      12 | 2020-12-13 00:00:00.000000 |      1 | 2021-11-13 00:00:00.000000 |
|    foo |      12 | 2020-12-13 00:00:00.000000 |      2 | 2021-11-12 00:00:00.000000 |
|    foo |      13 | 2020-12-12 00:00:00.000000 |      1 | 2021-11-13 00:00:00.000000 |
|    foo |      13 | 2020-12-12 00:00:00.000000 |      2 | 2021-11-12 00:00:00.000000 |
|    bar |  (null) |                     (null) | (null) |                     (null) |
|  apple |      15 | 2020-12-11 00:00:00.000000 |      3 | 2020-11-11 00:00:00.000000 |
| banana |  (null) |                     (null) |      4 | 2020-11-14 00:00:00.000000 |
| banana |  (null) |                     (null) |      5 | 2020-11-15 00:00:00.000000 |

My expected output would be

|   name | revenue |               lastupdate_b |  level |               lastupdate_c |
|--------|---------|----------------------------|--------|----------------------------|
|    foo |      12 | 2020-12-13 00:00:00.000000 |      1 | 2021-11-13 00:00:00.000000 |
|    bar |  (null) |                     (null) | (null) |                     (null) |
|  apple |      15 | 2020-12-11 00:00:00.000000 |      3 | 2020-11-11 00:00:00.000000 |
| banana |  (null) |                     (null) |      5 | 2020-11-15 00:00:00.000000 |

I'm currently using SQL Server but if there's a Oracle 12 version of the query it'll be welcome!


问:
PyBluez 'bad bluetooth address'
I am running Windows 11 and ideally I would like to 'talk' with my PS5 controller via the internal bluetooth of my laptop using python.

I was going to run this sample code for PyBluez, but I get the error message 'bad bluetooth address'.

```<code>from bluetooth import *

server_sock=BluetoothSocket()
server_sock.bind(("",PORT_ANY))
server_sock.listen(1)

port = server_sock.getsockname()[1]

uuid = "94f39d29-7d6d-437d-973b-fba39e49d4ee"

advertise_service( server_sock, "SampleServer",
                   service_id = uuid,
                   service_classes = [ uuid, SERIAL_PORT_CLASS ],
                   profiles = [ SERIAL_PORT_PROFILE ],
#                   protocols = [ OBEX_UUID ]
                    )

print("Waiting for connection on RFCOMM channel %d" % port)

client_sock, client_info = server_sock.accept()
print("Accepted connection from ", client_info)

try:
    while True:
        data = client_sock.recv(1024)
        if len(data) == 0: break
        print("received [%s]" % data)
except IOError as e:
    print(e)

print("disconnected")

client_sock.close()
server_sock.close()
print("all done")
</code>```

Since PyBluez has a very suboptimal documentation I can't figure out a solution.

Title: PyBluez 'bad bluetooth address'

Body:
I am running Windows 11 and ideally I would like to 'talk' with my PS5 controller via the internal bluetooth of my laptop using python.

I was going to run this sample code for PyBluez, but I get the error message 'bad bluetooth address'.

from bluetooth import *

server_sock=BluetoothSocket()
server_sock.bind(("",PORT_ANY))
server_sock.listen(1)

port = server_sock.getsockname()[1]

uuid = "94f39d29-7d6d-437d-973b-fba39e49d4ee"

advertise_service( server_sock, "SampleServer",
                   service_id = uuid,
                   service_classes = [ uuid, SERIAL_PORT_CLASS ],
                   profiles = [ SERIAL_PORT_PROFILE ],
#                   protocols = [ OBEX_UUID ]
                    )

print("Waiting for connection on RFCOMM channel %d" % port)

client_sock, client_info = server_sock.accept()
print("Accepted connection from ", client_info)

try:
    while True:
        data = client_sock.recv(1024)
        if len(data) == 0: break
        print("received [%s]" % data)
except IOError as e:
    print(e)

print("disconnected")

client_sock.close()
server_sock.close()
print("all done")

Since PyBluez has a very suboptimal documentation I can't figure out a solution.


问:
Python was not found when running pyspark in VSC
I'm learning Spark now and have installed it on a Windows PC.

I used the following guide and to be honest, it all seems right.

Also, when I type in my cmd spark-shell it opens scala, and when I type pyspark in opens the python shell as I would expect.

However, I tried to run the following simple code in Visual Studio Code and I get the following errors:

```<code>from pyspark import SparkContext

sc = SparkContext()

textFile = sc.textFile('example.txt')
print(textFile.count())
</code>```

Error (happens when it reaches textFile.count()):

```<code>Py4JJavaError(
py4j.protocol.Py4JJavaError: An error occurred while calling z:org.apache.spark.api.python.PythonRDD.collectAndServe.
: org.apache.spark.SparkException: Job aborted due to stage failure: Task 1 in stage 0.0 failed 1 times, most recent failure: Lost task 1.0 in stage 0.0 (TID 1) (XXX.lan executor driver): org.apache.spark.SparkException: Python worker failed to connect back.
.
.
.
    Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
</code>```

I have had Python installed on my machine for ages and all works well.

All Python paths seem to be correct.

Added all HADOOP/SPARK paths as mentioned in the guide.

Opened the Windows App execution aliases and Python is not even these (App installed python.exe, App installed python3.exe)

Any reason it happens?

EDIT:

```<code>import findspark
findspark.init()
</code>```

solves the problem but is there a way to solve it temporarily so I wont need to use that in my code?

Body:
I'm learning Spark now and have installed it on a Windows PC.

I used the following guide and to be honest, it all seems right.

Also, when I type in my cmd spark-shell it opens scala, and when I type pyspark in opens the python shell as I would expect.

However, I tried to run the following simple code in Visual Studio Code and I get the following errors:

from pyspark import SparkContext

sc = SparkContext()

textFile = sc.textFile('example.txt')
print(textFile.count())

Error (happens when it reaches textFile.count()):

Py4JJavaError(
py4j.protocol.Py4JJavaError: An error occurred while calling z:org.apache.spark.api.python.PythonRDD.collectAndServe.
: org.apache.spark.SparkException: Job aborted due to stage failure: Task 1 in stage 0.0 failed 1 times, most recent failure: Lost task 1.0 in stage 0.0 (TID 1) (XXX.lan executor driver): org.apache.spark.SparkException: Python worker failed to connect back.
.
.
.
    Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

I have had Python installed on my machine for ages and all works well.

All Python paths seem to be correct.

Added all HADOOP/SPARK paths as mentioned in the guide.

Opened the Windows App execution aliases and Python is not even these (App installed python.exe, App installed python3.exe)

Any reason it happens?

EDIT:

import findspark
findspark.init()

solves the problem but is there a way to solve it temporarily so I wont need to use that in my code?


问:
Is it possible to use "unique together" in Laravel, similarly to Django?
So in Django you can do this: unique_together = ('name', 'username',) so if you try to register people like this:

name: John, username: blabla <---- this gets registered

name: John, username: haha   <---- this gets registered

name: John, username: blabla <---- this won't get registered because the combination of John and blabla already exists.

Is the something similar is Laravel I could use?

The main goal is to check if the name with the username exists together, if it does, throw back a validation error, otherwise register the record to the database.

edit #1: if I can get something like "unique together" in laravel, is it possible to modify the validation method based on a hidden field in the form?

For example I want the user to write their name and email and submit it, and have a checkbox. The checkbox would enable/disable the 'unique' check of the name, so like if I do this:

name: John Doe Corp. email: whatever, checkbox: Ticked

then it would check the 'name' column for duplicates.
Otherwise:

name: Jane Doe. email: whatever, checkbox: Not Ticked

then it would not check the name column for duplicates, allowing the record to be saved into the database.


问:
How can specify s3 path in airflow dag which has to keep changing based on current date using variables
I have situation where we are trying to sense s3 files from airflow and here the files would be landing in the bucket on a daily basis, the folder structure is s3://bucket_name/2022/12/1/file_name_timestamp
what is the best possible way to use variables for these 4 things:

2022 (Year)

12 (Month)

1 (Date)

file_name_(timestamp)

These values keep changing everyday so how can we solve this in the dag.

P.S I'm new to airflow
Thanks in advance

I'm still exploring ideas for the best possible ways to do this


问:
Typescript N nested object with function as values
I would like to have a type that relates to an object with N level of nested keys and values being functions that returns strings.

Ideally I would like to have the value of the function being displayed in a tooltip instead of string type (od as a const shows me the value instead of string which I want)
Like this bu this is very cumbersome.

const endpoints = {
  hierarchy: {
    od: () => `....` as const,
    sd: () => `.....`,
  },
  a: { b: { c: (a: string) => 'asdsd' } },
} as const
```

How I can make a type that would resolve to such structure?

Body:
I would like to have a type that relates to an object with N level of nested keys and values being functions that returns strings.

Ideally I would like to have the value of the function being displayed in a tooltip instead of string type (od as a const shows me the value instead of string which I want)
Like this bu this is very cumbersome.

const endpoints = {
  hierarchy: {
    od: () => `....` as const,
    sd: () => `.....`,
  },
  a: { b: { c: (a: string) => 'asdsd' } },
} as const

How I can make a type that would resolve to such structure?


问:
invalid in the HAVING clause
```<code>Select p.CustomerNumber, p.CustomerName,  sum(CAST(a.CRAmountUSD AS DECIMAL(10,2))) AS sumCosts
From Scoring p inner join
      CreditNoteDetail a
     on p.SerialNumber = a.SerialNumber
where a.SerialNumber = p.SerialNumber --'FJM10696'
Group By p.CustomerNumber, p.CustomerName
having sum(CAST(a.CRAmountUSD AS DECIMAL(10,2))) > CAST(p.Amount AS DECIMAL(10,2))
</code>```

I have problem, is error like this

Msg 8121, Level 16, State 1, Line 13

Column 'Scoring.Amount' is invalid in the HAVING clause because it is not contained in either an aggregate function or the GROUP BY clause."

I want to find a comparison value, the amount of 'CRAmountUSD' in the CreditNoteDetail table is smaller than 'Amount' in the Scoring table based on SerialNumber

Title: invalid in the HAVING clause

Body:
Select p.CustomerNumber, p.CustomerName,  sum(CAST(a.CRAmountUSD AS DECIMAL(10,2))) AS sumCosts
From Scoring p inner join
      CreditNoteDetail a
     on p.SerialNumber = a.SerialNumber
where a.SerialNumber = p.SerialNumber --'FJM10696'
Group By p.CustomerNumber, p.CustomerName
having sum(CAST(a.CRAmountUSD AS DECIMAL(10,2))) > CAST(p.Amount AS DECIMAL(10,2))

I have problem, is error like this

Msg 8121, Level 16, State 1, Line 13

Column 'Scoring.Amount' is invalid in the HAVING clause because it is not contained in either an aggregate function or the GROUP BY clause."

I want to find a comparison value, the amount of 'CRAmountUSD' in the CreditNoteDetail table is smaller than 'Amount' in the Scoring table based on SerialNumber


问:
Why is iplot not displaying on my jupyter notebook
Tried using iplot to display an interactive line chart of a dataset
It rather dislayed a blank space

I tried df.iplot() but it displayed a blank space
It was supposed to display a 3D line chart of the data set


问:
How to make ajax adding an item to the cart — woocommerce?
Friends. Help me make ajax adding an item to the woocommerce cart. The code that I use was found on the Internet, it makes it possible to place buttons of variations on the product badge.

enter image description here

The code that outputs the buttons for each variation:

`

```<code>function woocommerce_variable_add_to_cart(){
    global $product, $post;

    $variations = find_valid_variations();

    // Check if the special 'price_grid' meta is set, if it is, load the default template:
    if ( get_post_meta($post->ID, 'price_grid', true) ) {
        // Enqueue variation scripts
        wp_enqueue_script( 'wc-add-to-cart-variation' );

        // Load the template
        wc_get_template( 'single-product/add-to-cart/variable.php', array(
                'available_variations'  => $product->get_available_variations(),
                'attributes'            => $product->get_variation_attributes(),
                'selected_attributes'   => $product->get_variation_default_attributes()
            ) );
        return;
    }

    // Cool, lets do our own template!
    ?>

 <?php
            foreach ($variations as $key => $value) {
                if( !$value['variation_is_visible'] ) continue;
            ?>

                   <?php $desc = $value['variation_description'] ?>

                   <?php if($desc) { ?>

                        <?php echo $desc ?>

                    <?php  }?>

                    <?php if( $value['is_in_stock'] ) { ?>
                    <form class="cart" action="<?php echo esc_url( $product->add_to_cart_url() ); ?>" method="post" enctype='multipart/form-data'>

                        <?php
                        if(!empty($value['attributes'])){
                            foreach ($value['attributes'] as $attr_key => $attr_value) {
                            ?>
                            <input type="hidden" name="<?php echo $attr_key?>" value="<?php echo $attr_value?>">
                            <?php
                            }
                        }
                        ?>
                        <button type="submit" class="single_add_to_cart_button btn btn-primary"><span class="glyphicon glyphicon-tag"></span>add to cart - <?php echo $attr_value?> - <?php echo $value['price_html'];?></button>
                        <input type="hidden" name="variation_id" value="<?php echo $value['variation_id']?>" />
                        <input type="hidden" name="product_id" value="<?php echo esc_attr( $post->ID ); ?>" />
                        <input type="hidden" name="add-to-cart" value="<?php echo esc_attr( $post->ID ); ?>" />

                    </form>

                    <?php } else { ?>
                        <p class="stock out-of-stock"><?php _e( 'This product is currently out of stock and unavailable.', 'woocommerce' ); ?></p>
                    <?php } ?>

            <?php } ?>

    <?php
}

function find_valid_variations() {
    global $product;

    $variations = $product->get_available_variations();
    $attributes = $product->get_attributes();
    $new_variants = array();

    // Loop through all variations
    foreach( $variations as $variation ) {

        // Peruse the attributes.

        // 1. If both are explicitly set, this is a valid variation
        // 2. If one is not set, that means any, and we must 'create' the rest.

        $valid = true; // so far
        foreach( $attributes as $slug => $args ) {
            if( array_key_exists("attribute_$slug", $variation['attributes']) && !empty($variation['attributes']["attribute_$slug"]) ) {
                // Exists

            } else {
                // Not exists, create
                $valid = false; // it contains 'anys'
                // loop through all options for the 'ANY' attribute, and add each
                foreach( explode( '|', $attributes[$slug]['value']) as $attribute ) {
                    $attribute = trim( $attribute );
                    $new_variant = $variation;
                    $new_variant['attributes']["attribute_$slug"] = $attribute;
                    $new_variants[] = $new_variant;
                }

            }
        }

        // This contains ALL set attributes, and is itself a 'valid' variation.
        if( $valid )
            $new_variants[] = $variation;

    }

    return $new_variants;
}

</code>```

`

I removed the redirect to the product card using the code, it remains to solve the issue with ajax

```<code>add_filter( 'woocommerce_add_to_cart_redirect', 'wp_get_referer' );
</code>```

Body:
Friends. Help me make ajax adding an item to the woocommerce cart. The code that I use was found on the Internet, it makes it possible to place buttons of variations on the product badge.

enter image description here

The code that outputs the buttons for each variation:

`

function woocommerce_variable_add_to_cart(){
    global $product, $post;

    $variations = find_valid_variations();

    // Check if the special 'price_grid' meta is set, if it is, load the default template:
    if ( get_post_meta($post->ID, 'price_grid', true) ) {
        // Enqueue variation scripts
        wp_enqueue_script( 'wc-add-to-cart-variation' );

        // Load the template
        wc_get_template( 'single-product/add-to-cart/variable.php', array(
                'available_variations'  => $product->get_available_variations(),
                'attributes'            => $product->get_variation_attributes(),
                'selected_attributes'   => $product->get_variation_default_attributes()
            ) );
        return;
    }

    // Cool, lets do our own template!
    ?>

 <?php
            foreach ($variations as $key => $value) {
                if( !$value['variation_is_visible'] ) continue;
            ?>

                   <?php $desc = $value['variation_description'] ?>

                   <?php if($desc) { ?>

                        <?php echo $desc ?>

                    <?php  }?>

                    <?php if( $value['is_in_stock'] ) { ?>
                    <form class="cart" action="<?php echo esc_url( $product->add_to_cart_url() ); ?>" method="post" enctype='multipart/form-data'>

                        <?php
                        if(!empty($value['attributes'])){
                            foreach ($value['attributes'] as $attr_key => $attr_value) {
                            ?>
                            <input type="hidden" name="<?php echo $attr_key?>" value="<?php echo $attr_value?>">
                            <?php
                            }
                        }
                        ?>
                        <button type="submit" class="single_add_to_cart_button btn btn-primary">add to cart - <?php echo $attr_value?> - <?php echo $value['price_html'];?></button>
                        <input type="hidden" name="variation_id" value="<?php echo $value['variation_id']?>" />
                        <input type="hidden" name="product_id" value="<?php echo esc_attr( $post->ID ); ?>" />
                        <input type="hidden" name="add-to-cart" value="<?php echo esc_attr( $post->ID ); ?>" />

                    </form>

                    <?php } else { ?>

<?php _e( 'This product is currently out of stock and unavailable.', 'woocommerce' ); ?>

                    <?php } ?>

            <?php } ?>

    <?php
}

function find_valid_variations() {
    global $product;

    $variations = $product->get_available_variations();
    $attributes = $product->get_attributes();
    $new_variants = array();

    // Loop through all variations
    foreach( $variations as $variation ) {

        // Peruse the attributes.

        // 1. If both are explicitly set, this is a valid variation
        // 2. If one is not set, that means any, and we must 'create' the rest.

        $valid = true; // so far
        foreach( $attributes as $slug => $args ) {
            if( array_key_exists("attribute_$slug", $variation['attributes']) && !empty($variation['attributes']["attribute_$slug"]) ) {
                // Exists

            } else {
                // Not exists, create
                $valid = false; // it contains 'anys'
                // loop through all options for the 'ANY' attribute, and add each
                foreach( explode( '|', $attributes[$slug]['value']) as $attribute ) {
                    $attribute = trim( $attribute );
                    $new_variant = $variation;
                    $new_variant['attributes']["attribute_$slug"] = $attribute;
                    $new_variants[] = $new_variant;
                }

            }
        }

        // This contains ALL set attributes, and is itself a 'valid' variation.
        if( $valid )
            $new_variants[] = $variation;

    }

    return $new_variants;
}

`

I removed the redirect to the product card using the code, it remains to solve the issue with ajax

add_filter( 'woocommerce_add_to_cart_redirect', 'wp_get_referer' );


问:
Blank localhost page after deploying react asp.net core app to github pages
I have created a react asp.net core app and deployed it to github pages. The app is displaying perfectly on github pages but now when going back into visual studio mac for continuing developing other pages when I run the project locally I get a blank page.

All I have done was add thse lines in package.json:

```<code>"homepage": "https://myusername.github.io/Myapp",
</code>```

and in package.json "scripts":

```<code>    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
</code>```

And now after running the project the proxy server redirects me to a blank page where my home page used to load.

This definitely happened after deploying the project to githug pages. Am I missing something here?

The desired goal here is to keep developing the app locally and keep pushing updates to github pages when needed.

Body:
I have created a react asp.net core app and deployed it to github pages. The app is displaying perfectly on github pages but now when going back into visual studio mac for continuing developing other pages when I run the project locally I get a blank page.

All I have done was add thse lines in package.json:

"homepage": "https://myusername.github.io/Myapp",

and in package.json "scripts":

    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",

And now after running the project the proxy server redirects me to a blank page where my home page used to load.

This definitely happened after deploying the project to githug pages. Am I missing something here?

The desired goal here is to keep developing the app locally and keep pushing updates to github pages when needed.


问:
How to make the error return concise in Rust?
I am returning errors in Rust as below:

```<code>fn f() -> Result<bool> {
...
let res = get_res();
if let Err(e) = res {
  let msg = "Error message"; // different error messages for each instance
  println!("{}", msg);
  return Err(anyhow!(msg));

let res = res.unwrap();
...
}
</code>```

I'm using the above code snippet dozens of times throughout my code & I want to make it concise. How should I approach this refactor? Is it even possible to make it more concise?

One this I can think of is when returning the error directly using the ? operator at places calling the function f():

```<code>fn g() -> Result<bool> {
...
let val = f()?;
...
}
</code>```

But I want to return a new error message here. So what I'm looking for here is something like:

```<code>let val = f()?.expect("New error message");
</code>```

But instead of expect which panics, I want to return the error with a new error message. How can this be achieved?

Body:
I am returning errors in Rust as below:

fn f() -> Result<bool> {
...
let res = get_res();
if let Err(e) = res {
  let msg = "Error message"; // different error messages for each instance
  println!("{}", msg);
  return Err(anyhow!(msg));

let res = res.unwrap();
...
}

I'm using the above code snippet dozens of times throughout my code & I want to make it concise. How should I approach this refactor? Is it even possible to make it more concise?

One this I can think of is when returning the error directly using the ? operator at places calling the function f():

fn g() -> Result<bool> {
...
let val = f()?;
...
}

But I want to return a new error message here. So what I'm looking for here is something like:

let val = f()?.expect("New error message");

But instead of expect which panics, I want to return the error with a new error message. How can this be achieved?


问:
What is the correct location for the jspEngine config?
I am working on a small JSP project...and I want to add a configuration that is mentioned here : https://openliberty.io/docs/latest/reference/config/jspEngine.html
Specifically, i want to add keepGenerated ="true"

2 questions:

Is the location of this config corect? I just placed it inside the server element (not clear to me from the link from above if the location is good)

```<code> <server description="My Project">

     <featureManager>
         <feature>servlet-5.0</feature>
         <!-- needed to run JSP examples -->
         <feature>pages-3.0</feature>
     </featureManager>

     <jspEngine keepGenerated ="true"/>
     ....
 </server>
</code>```

Where will the java files corresponding to the JSP files be generated? I want to see the java code that is generated...

By adding the property from question 1, I was unable to find the java files generated for the JSP file....I tried to run also a search but no use..I assume that the configuration might not be correct..

Thx!

Body:
I am working on a small JSP project...and I want to add a configuration that is mentioned here : https://openliberty.io/docs/latest/reference/config/jspEngine.html
Specifically, i want to add keepGenerated ="true"

2 questions:

Is the location of this config corect? I just placed it inside the server element (not clear to me from the link from above if the location is good)

 <server description="My Project">

     <featureManager>
         <feature>servlet-5.0</feature>

         <feature>pages-3.0</feature>
     </featureManager>

     <jspEngine keepGenerated ="true"/>
     ....
 </server>

Where will the java files corresponding to the JSP files be generated? I want to see the java code that is generated...

By adding the property from question 1, I was unable to find the java files generated for the JSP file....I tried to run also a search but no use..I assume that the configuration might not be correct..

Thx!


问:
Laravel edit data with using id in the same page
I want to list datas when I click tasks on the right side as edit section.

I cannot put the value of the clicked data into the input. And if it displays, it always shows the last index of array.

```<code><a href="javascript:void(0)"
   id="show-task"
   onclick="showDiv('edittaskk')"
   data-url="{{ route('as.show', $as->id) }}"><span class="task-title">{{$as->title}}</span></a>
</code>```
```<code>Route::get('as/{id}', [HomeController::class, 'show'])->name('as.show');
</code>```
```<code><script type="text/javascript">

    $(document).ready(function () {

        /* When click show user */
        $('body').on('click', '#show-task', function () {
            var taskURL = $(this).data('url');
            $.get(taskURL, function (data) {
                $('#edittask').modal('show');
                $('#as-id').text(data.id);
                $('#as-title').text(data.title);
                $('#as-duedate').text(data.duedate);
                $('#as-status').text(data.status);
                $('#as-prio').text(data.prio);
            })
        });

    });

</script>
</code>```
```<code><div class="task-list-desc d-flex justify-content-between align-items-center">
    <form action="{{route('edittask',['id'=>$as->id])}}" method="POST">
        @csrf
        <div>
            <div class="modal-body">

                <p><strong>Title:</strong> <span id="as-title"></span><div class="wrap-input100 validate-input m-b-16">
                    <input class="input100"  name="title[]"  value="{{$as['title']}}" type="text">

                </div>
                <p><strong>DueDate:</strong> <span id="as-duedate"></span><div class="wrap-input100 validate-input m-b-16">

                    <input class="input100" name="duedate" value="{{$as->duedate}}" type="date">
</code>```

Body:
I want to list datas when I click tasks on the right side as edit section.

I cannot put the value of the clicked data into the input. And if it displays, it always shows the last index of array.

id) }}">{{$as->title}}

Route::get('as/{id}', [HomeController::class, 'show'])->name('as.show');

    <form action="{{route('edittask',['id'=>$as->id])}}" method="POST">
        @csrf

Title:

                    <input class="input100"  name="title[]"  value="{{$as['title']}}" type="text">

DueDate:

                    <input class="input100" name="duedate" value="{{$as->duedate}}" type="date">


问:
How does c++ cout know which system call to use to connect to standard io streams
Basically, cout is defined in iostream header which is part of c++.I want to know how does this take into account the OS dependent system call interface?</p>


问:
Create npm package of my react native app

Right now I am working on npm package for my react native app,My app contain lots of things, like have a native modules, lots of dependencies,I am using this to create npm package for my app.

Question 1 - Above package (Mentioned as this) is good for create npm package for my react native app?

Question 2 - As I mentioned that my react native app contain native modules too how can I manage into npm package?

Many thanks in advance


问:
Independence of Jest tests
I'm doing unit testing with React, and we use jest for unit testing. We have "jest-environment-jsdom-sixteen": "^1.0.3" in devDependencies and "jest": {"collectCoverageFrom": [(insert directories)]} in our package.json file.

My question is: in the absence of any further configurations set, are the tests truly run independently of one another? I want to ensure that running one test.js file has NO effect on running another test.js file.

The reason I am asking this is because I have a Component.test.js that tests for a Component.js file, and within that file, I have the lines delete window.location and window.location = {reload: jest.fn()};, due to the fact that in the Component.js file I am actually doing window.location.reload, which does not exist in Jest's Node.js environment and therefore has to be mocked. I fear that setting window.location = {reload: jest.fn()}; will also affect other files being tested.

Any help is appreciated. I find "clearMocks": true, "resetMocks": true, "resetModules": true to be quite promising to set in package.json.

Title: Independence of Jest tests


问:
Headless - SeleniumWebDriver
I need to collect data from a certain site, but headless mode is detected and the site stops processing. Without headless mode the script runs perfectly. I would like suggestions of what can be done to circumvent this detection.

Below selenium configuration code:

var webdriver = require('selenium-webdriver');
const { Builder, By, until, Key } = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');

const headless = true;
var driver = new Builder().forBrowser('chrome')

if (headless) {
  const chromeOptions = new chrome.Options();
  const user_agent = "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +https://www.google.com/bot.html) Safari/537.36"

  chromeOptions.addArguments(`user-agent=${user_agent}`)
  chromeOptions.addArguments("--blink-settings=imagesEnabled=false");
  chromeOptions.addArguments('--ignore-certificate-errors')
  chromeOptions.addArguments('--allow-running-insecure-content')
  chromeOptions.addArguments("--disable-extensions")
  chromeOptions.addArguments("--proxy-server='direct://'")
  chromeOptions.addArguments("--proxy-bypass-list=*")
  chromeOptions.addArguments("--disable-infobars")
  chromeOptions.addArguments("--disable-dev-shm-usage")
  chromeOptions.addArguments("--notifications")

  chromeOptions.addArguments('--disable-gpu')
  chromeOptions.addArguments('--disable-dev-shm-usage')
  chromeOptions.addArguments('--no-sandbox')

  const screen = {
    width: 1280,
    height: 720
  };

  driver = driver.setChromeOptions(chromeOptions.headless().windowSize(screen));
}

driver = driver.build();
driver.manage().setTimeouts({ implicit: (10000) });
global.driver = driver;

if (!headless) {
  driver.manage().window().maximize()
}
```

I tried to use several arguments for Chrome options, but none work. I tried to use the Selenium Docker image, but without success neither - all are blocked by the site in question.

Title: Headless - SeleniumWebDriver

Body:
I need to collect data from a certain site, but headless mode is detected and the site stops processing. Without headless mode the script runs perfectly. I would like suggestions of what can be done to circumvent this detection.

Below selenium configuration code:

var webdriver = require('selenium-webdriver');
const { Builder, By, until, Key } = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');

const headless = true;
var driver = new Builder().forBrowser('chrome')

if (headless) {
  const chromeOptions = new chrome.Options();
  const user_agent = "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +https://www.google.com/bot.html) Safari/537.36"

  chromeOptions.addArguments(`user-agent=${user_agent}`)
  chromeOptions.addArguments("--blink-settings=imagesEnabled=false");
  chromeOptions.addArguments('--ignore-certificate-errors')
  chromeOptions.addArguments('--allow-running-insecure-content')
  chromeOptions.addArguments("--disable-extensions")
  chromeOptions.addArguments("--proxy-server='direct://'")
  chromeOptions.addArguments("--proxy-bypass-list=*")
  chromeOptions.addArguments("--disable-infobars")
  chromeOptions.addArguments("--disable-dev-shm-usage")
  chromeOptions.addArguments("--notifications")

  chromeOptions.addArguments('--disable-gpu')
  chromeOptions.addArguments('--disable-dev-shm-usage')
  chromeOptions.addArguments('--no-sandbox')

  const screen = {
    width: 1280,
    height: 720
  };

  driver = driver.setChromeOptions(chromeOptions.headless().windowSize(screen));
}

driver = driver.build();
driver.manage().setTimeouts({ implicit: (10000) });
global.driver = driver;

if (!headless) {
  driver.manage().window().maximize()
}

I tried to use several arguments for Chrome options, but none work. I tried to use the Selenium Docker image, but without success neither - all are blocked by the site in question.


问:
Passing derived class object to function which expects a base class object
I came from C++ world to TypeScript based project. And I can't understand how to implement typical C++ code behavior - passing child class object to a function which expects a base class object.

After some googling I wrote the next code:

```<code>export interface MyInterface {
    myFlag: boolean;
}

class MyInterfaceImpl  implements MyInterface {
  private _myFlag: boolean;

constructor(){...}

get myFlag() {
        return this._myFlag;
    }
set myFlag(value: boolean) {
        this._myFlag = value;

        onMyCallbackFunc(this);
    }
}

export function onMyCallbackFunc(myBaseObject : MyInterface) {
    console.log(`${JSON.stringify(myBaseObject)}`);
}
</code>```

But the problem here is that console prints me {"_myFlag": true} instead of {"myFlag": true}.

Where am I wrong?

Body:
I came from C++ world to TypeScript based project. And I can't understand how to implement typical C++ code behavior - passing child class object to a function which expects a base class object.

After some googling I wrote the next code:

export interface MyInterface {
    myFlag: boolean;
}

class MyInterfaceImpl  implements MyInterface {
  private _myFlag: boolean;

constructor(){...}

get myFlag() {
        return this._myFlag;
    }
set myFlag(value: boolean) {
        this._myFlag = value;

        onMyCallbackFunc(this);
    }
}

export function onMyCallbackFunc(myBaseObject : MyInterface) {
    console.log(`${JSON.stringify(myBaseObject)}`);
}

But the problem here is that console prints me {"_myFlag": true} instead of {"myFlag": true}.

Where am I wrong?