问:
Wildfly 13.0 failing to deploy multiple WARs while deploying from Eclipse, works fine otherwise
as the title says, I am trying to deploy two WARs on Wildfly 13.0, but if I try to do that on Eclipse by simply adding the resources, it will fail with the following error:

```<code>10:16:02,532 INFO  [org.jboss.modules] (main) JBoss Modules version 1.8.5.Final
10:16:02,845 INFO  [org.jboss.msc] (main) JBoss MSC version 1.4.2.Final
10:16:02,876 INFO  [org.jboss.threads] (main) JBoss Threads version 2.3.2.Final
10:16:02,970 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 13.0.0.Final (WildFly Core 5.0.0.Final) starting
10:16:04,016 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/core-service=management/management-interface=http-interface' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
10:16:04,038 INFO  [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 29) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/subsystem=undertow/server=default-server/https-listener=https' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
10:16:04,038 INFO  [org.wildfly.security] (ServerService Thread Pool -- 18) ELY00001: WildFly Elytron version 1.3.3.Final
10:16:04,038 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0015: Re-attempting failed deployment AmexDAPWebServices.war
10:16:04,507 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0015: Re-attempting failed deployment amexsbswebapp.war
10:16:05,772 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found AmexDAPWebServices.war in deployment directory. To trigger deployment create a file called AmexDAPWebServices.war.dodeploy
10:16:05,772 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found amexsbswebapp.war in deployment directory. To trigger deployment create a file called amexsbswebapp.war.dodeploy
10:16:05,795 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
10:16:05,811 INFO  [org.xnio] (MSC service thread 1-8) XNIO version 3.6.3.Final
10:16:05,811 INFO  [org.xnio.nio] (MSC service thread 1-8) XNIO NIO Implementation Version 3.6.3.Final
10:16:05,842 INFO  [org.jboss.as.ee] (ServerService Thread Pool -- 41) WFLYEE0119: The system property 'ee8.preview.mode' is NOT set to 'true'. For provided EE 8 APIs where the EE 8 version of the API differs from what is supported in EE 7, the EE 7 variant of the API will be used. Support for this setting will be removed once all EE 8 APIs are provided and certified.
10:16:05,842 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 45) WFLYCLINF0001: Activating Infinispan subsystem.
10:16:05,858 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 64) WFLYWS0002: Activating WebServices Extension
10:16:05,858 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 62) WFLYTX0013: The node-identifier attribute on the /subsystem=transactions is set to the default value. This is a danger for environments running multiple servers. Please make sure the attribute value is unique.
10:16:05,873 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 54) WFLYNAM0001: Activating Naming Subsystem
10:16:05,873 INFO  [org.jboss.as.jaxrs] (ServerService Thread Pool -- 47) WFLYRS0016: RESTEasy version 3.5.1.Final
10:16:05,889 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 52) WFLYJSF0007: Activated the following JSF Implementations: [main]
10:16:05,889 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 60) WFLYSEC0002: Activating Security Subsystem
10:16:05,920 INFO  [org.jboss.as.connector] (MSC service thread 1-6) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.4.9.Final)
10:16:05,920 INFO  [org.jboss.as.security] (MSC service thread 1-5) WFLYSEC0001: Current PicketBox version=5.0.2.Final
10:16:05,936 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 38) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.4)
10:16:05,936 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0003: Undertow 2.0.9.Final starting
10:16:05,952 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0018: Started Driver service with driver-name = h2
10:16:05,952 INFO  [org.jboss.as.naming] (MSC service thread 1-2) WFLYNAM0003: Starting Naming Service
10:16:05,952 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-1) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
10:16:06,061 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 63) WFLYUT0014: Creating file handler for path 'C:\Users\v.cappellini\wildfly-13.0.0.Final/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
10:16:06,186 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 46) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
10:16:06,201 INFO  [org.jboss.as.ejb3] (MSC service thread 1-2) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 32 (per class), which is derived from the number of CPUs on this host.
10:16:06,201 INFO  [org.jboss.as.ejb3] (MSC service thread 1-7) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 128 (per class), which is derived from thread worker pool sizing.
10:16:06,233 INFO  [org.jboss.remoting] (MSC service thread 1-8) JBoss Remoting version 5.0.7.Final
10:16:06,248 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0012: Started server default-server.
10:16:06,248 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0018: Host default-host starting
10:16:06,295 INFO  [org.jboss.as.ejb3] (MSC service thread 1-6) WFLYEJB0493: EJB subsystem suspension complete
10:16:06,311 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080
10:16:06,311 INFO  [org.jboss.as.patching] (MSC service thread 1-3) WFLYPAT0050: WildFly Full cumulative patch ID is: base, one-off patches include: none
10:16:06,342 WARN  [org.jboss.as.domain.management.security] (MSC service thread 1-6) WFLYDM0111: Keystore C:\Users\v.cappellini\wildfly-13.0.0.Final\standalone\configuration\application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
10:16:06,342 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) WFLYDS0013: Started FileSystemDeploymentService for directory C:\Users\v.cappellini\wildfly-13.0.0.Final\standalone\deployments
10:16:06,358 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0027: Starting deployment of "amexsbswebapp.war" (runtime-name: "amexsbswebapp.war")
10:16:06,358 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0027: Starting deployment of "AmexDAPWebServices.war" (runtime-name: "AmexDAPWebServices.war")
10:16:06,623 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-7) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
10:16:06,795 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8443
10:16:06,863 INFO  [org.jboss.ws.common.management] (MSC service thread 1-2) JBWS022052: Starting JBossWS 5.2.1.Final (Apache CXF 3.2.4.jbossorg-1)
10:16:14,642 WARN  [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0081: The deployment amexsbswebapp.war will not be distributable because this feature is disabled in web-fragment.xml of the module apiee-core-1.0.1.jar.
10:16:15,023 INFO  [org.jboss.as.jpa] (MSC service thread 1-5) WFLYJPA0002: Read persistence.xml for JPAAmex
10:16:15,023 INFO  [org.jboss.as.jpa] (MSC service thread 1-8) WFLYJPA0002: Read persistence.xml for JPAAmex
10:16:17,335 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 67) WFLYJPA0010: Starting Persistence Unit (phase 1 of 2) Service 'amexsbswebapp.war#JPAAmex'
10:16:17,347 INFO  [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 67) HHH000204: Processing PersistenceUnitInfo [
    name: JPAAmex
    ...]
10:16:17,363 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."amexsbswebapp.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."amexsbswebapp.war".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "amexsbswebapp.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:150)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1736)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1698)
    at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1556)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class olsa.cerved.corporate.SBSTemplateManager with ClassLoader ModuleClassLoader for Module "deployment.amexsbswebapp.war" from Service Module Loader
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:78)
    at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:57)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:106)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:91)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:76)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:143)
    ... 8 more
Caused by: java.lang.NoClassDefFoundError: com/olsa/amex/services/parameters/ApplicationTemplateParameters
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.getDeclaredMethods(Unknown Source)
    at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:80)
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70)
    ... 13 more
Caused by: java.lang.ClassNotFoundException: com.olsa.amex.services.parameters.ApplicationTemplateParameters from [Module "deployment.amexsbswebapp.war" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
    ... 18 more

10:16:17,410 INFO  [org.hibernate.Version] (ServerService Thread Pool -- 67) HHH000412: Hibernate Core {5.1.14.Final}
10:16:17,410 INFO  [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 67) HHH000206: hibernate.properties not found
10:16:17,410 INFO  [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 67) HHH000021: Bytecode provider name : javassist
10:16:17,441 INFO  [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 67) HCANN000001: Hibernate Commons Annotations {5.0.2.Final}
10:16:18,410 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 67) WFLYJPA0010: Starting Persistence Unit (phase 1 of 2) Service 'AmexDAPWebServices.war#JPAAmex'
10:16:18,410 INFO  [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 67) HHH000204: Processing PersistenceUnitInfo [
    name: JPAAmex
    ...]
10:16:18,412 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.deployment.unit."AmexDAPWebServices.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."AmexDAPWebServices.war".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "AmexDAPWebServices.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:150)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1736)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1698)
    at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1556)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class amexdap.webservices.LoginUserServletDB with ClassLoader ModuleClassLoader for Module "deployment.AmexDAPWebServices.war" from Service Module Loader
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:78)
    at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:57)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:106)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:91)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:76)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:143)
    ... 8 more
Caused by: java.lang.NoClassDefFoundError: Lcom/olsa/amex/services/LoginService;
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Unknown Source)
    at java.lang.Class.getDeclaredFields(Unknown Source)
    at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:72)
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70)
    ... 13 more
Caused by: java.lang.ClassNotFoundException: com.olsa.amex.services.LoginService from [Module "deployment.AmexDAPWebServices.war" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
    ... 18 more

10:16:19,069 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "AmexDAPWebServices.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"AmexDAPWebServices.war\".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of deployment \"AmexDAPWebServices.war\"
    Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class amexdap.webservices.LoginUserServletDB with ClassLoader ModuleClassLoader for Module \"deployment.AmexDAPWebServices.war\" from Service Module Loader
    Caused by: java.lang.NoClassDefFoundError: Lcom/olsa/amex/services/LoginService;
    Caused by: java.lang.ClassNotFoundException: com.olsa.amex.services.LoginService from [Module \"deployment.AmexDAPWebServices.war\" from Service Module Loader]"}}
10:16:19,069 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "amexsbswebapp.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"amexsbswebapp.war\".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of deployment \"amexsbswebapp.war\"
    Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class olsa.cerved.corporate.SBSTemplateManager with ClassLoader ModuleClassLoader for Module \"deployment.amexsbswebapp.war\" from Service Module Loader
    Caused by: java.lang.NoClassDefFoundError: com/olsa/amex/services/parameters/ApplicationTemplateParameters
    Caused by: java.lang.ClassNotFoundException: com.olsa.amex.services.parameters.ApplicationTemplateParameters from [Module \"deployment.amexsbswebapp.war\" from Service Module Loader]"}}
10:16:19,084 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 39) WFLYSRV0010: Deployed "amexsbswebapp.war" (runtime-name : "amexsbswebapp.war")
10:16:19,084 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 39) WFLYSRV0010: Deployed "AmexDAPWebServices.war" (runtime-name : "AmexDAPWebServices.war")
10:16:19,084 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0186:   Services which failed to start:      service jboss.deployment.unit."AmexDAPWebServices.war".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "AmexDAPWebServices.war"
      service jboss.deployment.unit."amexsbswebapp.war".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "amexsbswebapp.war"

10:16:19,131 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
10:16:19,131 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
10:16:19,131 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
10:16:19,131 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 13.0.0.Final (WildFly Core 5.0.0.Final) started (with errors) in 16942ms - Started 318 of 541 services (2 services failed or
missing dependencies, 312 services are lazy, passive or on-demand)
</code>```

BUT if I build the WARS with Maven, then paste the WARs manually in the

{JBOSS_HOME}\standalone\deployments

folder, the WARs will deploy without any problem.
Is there a way to solve this issue? It would save a lot time for me to deploy from Eclipse in order to test/fix issues with the code faster.

EDIT:

How my projects are currently structured:

```<code> -Amexwebappsbs (FrontEnd with Angularjs, works fine)
 -AmexDAPWebServices (Backend with servlets and stuff)
      |
      |
      --- AmexDAPLib-1.0(another project with services like db queries with JPA)
            |
            |
            ---- JPAAmex (JPA project with persistence.xml file)
</code>```

答:
From times to times "publishing to Server" from within Eclipse in combination with a non-eclipse-native build-system (here maven) makes some problems.

I would check the following things:

project settings > Project Facets (Dynamic Web Module)

project settings > Deployment Assembly

published files within the deployment folder of your wildfly (sometimes eclipse only deploys .java-files or leaves out some project-dependencies)

If you observe something wrong you may

delete project(s) in eclipse (keep files)

delete .project, .settings, .classpath files and folders

(re)import "existing maven project" in eclipse

deploy it to the server (delete at first, then clean and the deploy)

finally run wildfly again

Good luck!

P.S. Check your build settings. Sometimes people temporarily deactivate auto-build and miss to build manually.

Body:
as the title says, I am trying to deploy two WARs on Wildfly 13.0, but if I try to do that on Eclipse by simply adding the resources, it will fail with the following error:

10:16:02,532 INFO  [org.jboss.modules] (main) JBoss Modules version 1.8.5.Final
10:16:02,845 INFO  [org.jboss.msc] (main) JBoss MSC version 1.4.2.Final
10:16:02,876 INFO  [org.jboss.threads] (main) JBoss Threads version 2.3.2.Final
10:16:02,970 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 13.0.0.Final (WildFly Core 5.0.0.Final) starting
10:16:04,016 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/core-service=management/management-interface=http-interface' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
10:16:04,038 INFO  [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 29) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/subsystem=undertow/server=default-server/https-listener=https' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
10:16:04,038 INFO  [org.wildfly.security] (ServerService Thread Pool -- 18) ELY00001: WildFly Elytron version 1.3.3.Final
10:16:04,038 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0015: Re-attempting failed deployment AmexDAPWebServices.war
10:16:04,507 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0015: Re-attempting failed deployment amexsbswebapp.war
10:16:05,772 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found AmexDAPWebServices.war in deployment directory. To trigger deployment create a file called AmexDAPWebServices.war.dodeploy
10:16:05,772 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found amexsbswebapp.war in deployment directory. To trigger deployment create a file called amexsbswebapp.war.dodeploy
10:16:05,795 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
10:16:05,811 INFO  [org.xnio] (MSC service thread 1-8) XNIO version 3.6.3.Final
10:16:05,811 INFO  [org.xnio.nio] (MSC service thread 1-8) XNIO NIO Implementation Version 3.6.3.Final
10:16:05,842 INFO  [org.jboss.as.ee] (ServerService Thread Pool -- 41) WFLYEE0119: The system property 'ee8.preview.mode' is NOT set to 'true'. For provided EE 8 APIs where the EE 8 version of the API differs from what is supported in EE 7, the EE 7 variant of the API will be used. Support for this setting will be removed once all EE 8 APIs are provided and certified.
10:16:05,842 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 45) WFLYCLINF0001: Activating Infinispan subsystem.
10:16:05,858 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 64) WFLYWS0002: Activating WebServices Extension
10:16:05,858 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 62) WFLYTX0013: The node-identifier attribute on the /subsystem=transactions is set to the default value. This is a danger for environments running multiple servers. Please make sure the attribute value is unique.
10:16:05,873 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 54) WFLYNAM0001: Activating Naming Subsystem
10:16:05,873 INFO  [org.jboss.as.jaxrs] (ServerService Thread Pool -- 47) WFLYRS0016: RESTEasy version 3.5.1.Final
10:16:05,889 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 52) WFLYJSF0007: Activated the following JSF Implementations: [main]
10:16:05,889 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 60) WFLYSEC0002: Activating Security Subsystem
10:16:05,920 INFO  [org.jboss.as.connector] (MSC service thread 1-6) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.4.9.Final)
10:16:05,920 INFO  [org.jboss.as.security] (MSC service thread 1-5) WFLYSEC0001: Current PicketBox version=5.0.2.Final
10:16:05,936 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 38) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.4)
10:16:05,936 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0003: Undertow 2.0.9.Final starting
10:16:05,952 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0018: Started Driver service with driver-name = h2
10:16:05,952 INFO  [org.jboss.as.naming] (MSC service thread 1-2) WFLYNAM0003: Starting Naming Service
10:16:05,952 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-1) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
10:16:06,061 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 63) WFLYUT0014: Creating file handler for path 'C:\Users\v.cappellini\wildfly-13.0.0.Final/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
10:16:06,186 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 46) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
10:16:06,201 INFO  [org.jboss.as.ejb3] (MSC service thread 1-2) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 32 (per class), which is derived from the number of CPUs on this host.
10:16:06,201 INFO  [org.jboss.as.ejb3] (MSC service thread 1-7) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 128 (per class), which is derived from thread worker pool sizing.
10:16:06,233 INFO  [org.jboss.remoting] (MSC service thread 1-8) JBoss Remoting version 5.0.7.Final
10:16:06,248 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0012: Started server default-server.
10:16:06,248 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0018: Host default-host starting
10:16:06,295 INFO  [org.jboss.as.ejb3] (MSC service thread 1-6) WFLYEJB0493: EJB subsystem suspension complete
10:16:06,311 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080
10:16:06,311 INFO  [org.jboss.as.patching] (MSC service thread 1-3) WFLYPAT0050: WildFly Full cumulative patch ID is: base, one-off patches include: none
10:16:06,342 WARN  [org.jboss.as.domain.management.security] (MSC service thread 1-6) WFLYDM0111: Keystore C:\Users\v.cappellini\wildfly-13.0.0.Final\standalone\configuration\application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
10:16:06,342 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) WFLYDS0013: Started FileSystemDeploymentService for directory C:\Users\v.cappellini\wildfly-13.0.0.Final\standalone\deployments
10:16:06,358 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0027: Starting deployment of "amexsbswebapp.war" (runtime-name: "amexsbswebapp.war")
10:16:06,358 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0027: Starting deployment of "AmexDAPWebServices.war" (runtime-name: "AmexDAPWebServices.war")
10:16:06,623 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-7) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
10:16:06,795 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8443
10:16:06,863 INFO  [org.jboss.ws.common.management] (MSC service thread 1-2) JBWS022052: Starting JBossWS 5.2.1.Final (Apache CXF 3.2.4.jbossorg-1)
10:16:14,642 WARN  [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0081: The deployment amexsbswebapp.war will not be distributable because this feature is disabled in web-fragment.xml of the module apiee-core-1.0.1.jar.
10:16:15,023 INFO  [org.jboss.as.jpa] (MSC service thread 1-5) WFLYJPA0002: Read persistence.xml for JPAAmex
10:16:15,023 INFO  [org.jboss.as.jpa] (MSC service thread 1-8) WFLYJPA0002: Read persistence.xml for JPAAmex
10:16:17,335 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 67) WFLYJPA0010: Starting Persistence Unit (phase 1 of 2) Service 'amexsbswebapp.war#JPAAmex'
10:16:17,347 INFO  [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 67) HHH000204: Processing PersistenceUnitInfo [
    name: JPAAmex
    ...]
10:16:17,363 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."amexsbswebapp.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."amexsbswebapp.war".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "amexsbswebapp.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:150)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1736)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1698)
    at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1556)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class olsa.cerved.corporate.SBSTemplateManager with ClassLoader ModuleClassLoader for Module "deployment.amexsbswebapp.war" from Service Module Loader
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:78)
    at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:57)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:106)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:91)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:76)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:143)
    ... 8 more
Caused by: java.lang.NoClassDefFoundError: com/olsa/amex/services/parameters/ApplicationTemplateParameters
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.getDeclaredMethods(Unknown Source)
    at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:80)
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70)
    ... 13 more
Caused by: java.lang.ClassNotFoundException: com.olsa.amex.services.parameters.ApplicationTemplateParameters from [Module "deployment.amexsbswebapp.war" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
    ... 18 more

10:16:17,410 INFO  [org.hibernate.Version] (ServerService Thread Pool -- 67) HHH000412: Hibernate Core {5.1.14.Final}
10:16:17,410 INFO  [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 67) HHH000206: hibernate.properties not found
10:16:17,410 INFO  [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 67) HHH000021: Bytecode provider name : javassist
10:16:17,441 INFO  [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 67) HCANN000001: Hibernate Commons Annotations {5.0.2.Final}
10:16:18,410 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 67) WFLYJPA0010: Starting Persistence Unit (phase 1 of 2) Service 'AmexDAPWebServices.war#JPAAmex'
10:16:18,410 INFO  [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 67) HHH000204: Processing PersistenceUnitInfo [
    name: JPAAmex
    ...]
10:16:18,412 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.deployment.unit."AmexDAPWebServices.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."AmexDAPWebServices.war".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "AmexDAPWebServices.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:150)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1736)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1698)
    at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1556)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class amexdap.webservices.LoginUserServletDB with ClassLoader ModuleClassLoader for Module "deployment.AmexDAPWebServices.war" from Service Module Loader
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:78)
    at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:57)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:106)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:91)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:76)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:143)
    ... 8 more
Caused by: java.lang.NoClassDefFoundError: Lcom/olsa/amex/services/LoginService;
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Unknown Source)
    at java.lang.Class.getDeclaredFields(Unknown Source)
    at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:72)
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70)
    ... 13 more
Caused by: java.lang.ClassNotFoundException: com.olsa.amex.services.LoginService from [Module "deployment.AmexDAPWebServices.war" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
    ... 18 more

10:16:19,069 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "AmexDAPWebServices.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"AmexDAPWebServices.war\".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of deployment \"AmexDAPWebServices.war\"
    Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class amexdap.webservices.LoginUserServletDB with ClassLoader ModuleClassLoader for Module \"deployment.AmexDAPWebServices.war\" from Service Module Loader
    Caused by: java.lang.NoClassDefFoundError: Lcom/olsa/amex/services/LoginService;
    Caused by: java.lang.ClassNotFoundException: com.olsa.amex.services.LoginService from [Module \"deployment.AmexDAPWebServices.war\" from Service Module Loader]"}}
10:16:19,069 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "amexsbswebapp.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"amexsbswebapp.war\".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of deployment \"amexsbswebapp.war\"
    Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class olsa.cerved.corporate.SBSTemplateManager with ClassLoader ModuleClassLoader for Module \"deployment.amexsbswebapp.war\" from Service Module Loader
    Caused by: java.lang.NoClassDefFoundError: com/olsa/amex/services/parameters/ApplicationTemplateParameters
    Caused by: java.lang.ClassNotFoundException: com.olsa.amex.services.parameters.ApplicationTemplateParameters from [Module \"deployment.amexsbswebapp.war\" from Service Module Loader]"}}
10:16:19,084 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 39) WFLYSRV0010: Deployed "amexsbswebapp.war" (runtime-name : "amexsbswebapp.war")
10:16:19,084 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 39) WFLYSRV0010: Deployed "AmexDAPWebServices.war" (runtime-name : "AmexDAPWebServices.war")
10:16:19,084 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0186:   Services which failed to start:      service jboss.deployment.unit."AmexDAPWebServices.war".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "AmexDAPWebServices.war"
      service jboss.deployment.unit."amexsbswebapp.war".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "amexsbswebapp.war"

10:16:19,131 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
10:16:19,131 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
10:16:19,131 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
10:16:19,131 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 13.0.0.Final (WildFly Core 5.0.0.Final) started (with errors) in 16942ms - Started 318 of 541 services (2 services failed or
missing dependencies, 312 services are lazy, passive or on-demand)

BUT if I build the WARS with Maven, then paste the WARs manually in the

{JBOSS_HOME}\standalone\deployments

folder, the WARs will deploy without any problem.
Is there a way to solve this issue? It would save a lot time for me to deploy from Eclipse in order to test/fix issues with the code faster.

EDIT:

How my projects are currently structured:

 -Amexwebappsbs (FrontEnd with Angularjs, works fine)
 -AmexDAPWebServices (Backend with servlets and stuff)
      |
      |
      --- AmexDAPLib-1.0(another project with services like db queries with JPA)
            |
            |
            ---- JPAAmex (JPA project with persistence.xml file)


来源: stackexchange

问:
JavaScript: Add space between Char and Number with Regex
Hello I have a plate number BZ8345LK and want convert to BZ 8345 LK (adding space between char and number).

I tried with this Regex but not working, only space first char with number. Ex BZ 8345LK, the 'LK' keep not space with number.

```<code>var str = 'BZ8345LK';
str.replace(/[^0-9](?=[0-9])/g, '$& ');
# return BZ 8345LK, I want BZ 8345 LK
</code>```

答:
Try with this

var str = "BZ8345LK";
var result = str.replace(/([A-Z]+)(\d+)([A-Z]+)/, "$1 $2 $3");
console.log(result);```

ContentLicense: CC BY-SA 4.0

Body:
Hello I have a plate number BZ8345LK and want convert to BZ 8345 LK (adding space between char and number).

I tried with this Regex but not working, only space first char with number. Ex BZ 8345LK, the 'LK' keep not space with number.

var str = 'BZ8345LK';
str.replace(/[^0-9](?=[0-9])/g, '$& ');
# return BZ 8345LK, I want BZ 8345 LK


问:
Telnet to Python server gets stuck
I am preparing a demo, and I wanted to use a simple server for it, instead of nginx or any other popular server.

I got the following one from python official page:

```<code>import SimpleHTTPServer
import SocketServer

PORT = 8000

Handler = SimpleHTTPServer.SimpleHTTPRequestHandler

httpd = SocketServer.TCPServer(("", PORT), Handler)

print "serving at port", PORT
httpd.serve_forever()
</code>```

So, I run it, and everything seems to be fine:

```<code>python -m SimpleHTTPServer 8000
</code>```

If I go to the browser, or curl the IP address, it works just fine:

```<code>xx.xx.xx.xx - - [31/May/2019 09:36:33] "GET / HTTP/1.1" 200 -
xx.xx.xx.xx - - [31/May/2019 09:37:43] "GET / HTTP/1.1" 200 -
xx.xx.xx.xx - - [31/May/2019 09:37:46] "HEAD / HTTP/1.1" 200 -
xx.xx.xx.xx - - [31/May/2019 09:39:03] "HEAD / HTTP/1.1" 200 -
xx.xx.xx.xx - - [31/May/2019 09:39:06] "GET / HTTP/1.1" 200 -
xx.xx.xx.xx - - [31/May/2019 09:39:12] "GET / HTTP/1.1" 200 -
xx.xx.xx.xx - - [31/May/2019 09:39:13] "GET / HTTP/1.1" 200 -
</code>```

Now, when I connect to the server through telnet, and I do GET, the server get stuck:

```<code>$ telnet xx.xx.xx.xx 8000
Trying xx.xx.xx.xx...
Connected to xx.xx.xx.xx.
Escape character is '^]'.
GET / HTTP/1.1
...It just hangs here foever...
</code>```

When I hit on ctrl+c on the server, it shows me an exception that happened, that I don't know how to interpret in this context:

```<code>^C----------------------------------------
Exception happened during processing of request from ('xx.xx.xx.xx', 47346)
Traceback (most recent call last):
  File "/usr/lib/python3.5/socketserver.py", line 313, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python3.5/socketserver.py", line 341, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.5/socketserver.py", line 681, in __init__
    self.handle()
  File "/usr/lib/python3.5/http/server.py", line 422, in handle
    self.handle_one_request()
  File "/usr/lib/python3.5/http/server.py", line 400, in handle_one_request
    if not self.parse_request():
  File "/usr/lib/python3.5/http/server.py", line 334, in parse_request
    _class=self.MessageClass)
  File "/usr/lib/python3.5/http/client.py", line 206, in parse_headers
    line = fp.readline(_MAXLINE + 1)
  File "/usr/lib/python3.5/socket.py", line 576, in readinto
    return self._sock.recv_into(b)
KeyboardInterrupt
----------------------------------------
</code>```

I also SSH-ed into the same machine where the server is running and did the request connecting to the localhost. Hanged too.

I would like to know:

How is telnet GET different to other GETs.

At python server level, what does the exception mean, and how to solve it.

答:
How is telnet GET different to other GETs.

telnet is not different here. Your server is hanging because it is waiting for you to finish typing your GET request. For this, you just need to press Enter twice, after typing your GET request.

This is because:

One CR-LF character is required to end the message header section of the HTTP request (as specified here)

another one is the actual CR-LF that tells telnet you finished entering input

At python server level, what does the exception mean, and how to solve it.

This is just a consequence of you pressing Ctrl + C, thus interrupting the Python process running your SimpleHTTPServer.

Title: Telnet to Python server gets stuck

Body:
I am preparing a demo, and I wanted to use a simple server for it, instead of nginx or any other popular server.

I got the following one from python official page:

import SimpleHTTPServer
import SocketServer

PORT = 8000

Handler = SimpleHTTPServer.SimpleHTTPRequestHandler

httpd = SocketServer.TCPServer(("", PORT), Handler)

print "serving at port", PORT
httpd.serve_forever()

So, I run it, and everything seems to be fine:

python -m SimpleHTTPServer 8000

If I go to the browser, or curl the IP address, it works just fine:

xx.xx.xx.xx - - [31/May/2019 09:36:33] "GET / HTTP/1.1" 200 -
xx.xx.xx.xx - - [31/May/2019 09:37:43] "GET / HTTP/1.1" 200 -
xx.xx.xx.xx - - [31/May/2019 09:37:46] "HEAD / HTTP/1.1" 200 -
xx.xx.xx.xx - - [31/May/2019 09:39:03] "HEAD / HTTP/1.1" 200 -
xx.xx.xx.xx - - [31/May/2019 09:39:06] "GET / HTTP/1.1" 200 -
xx.xx.xx.xx - - [31/May/2019 09:39:12] "GET / HTTP/1.1" 200 -
xx.xx.xx.xx - - [31/May/2019 09:39:13] "GET / HTTP/1.1" 200 -

Now, when I connect to the server through telnet, and I do GET, the server get stuck:

$ telnet xx.xx.xx.xx 8000
Trying xx.xx.xx.xx...
Connected to xx.xx.xx.xx.
Escape character is '^]'.
GET / HTTP/1.1
...It just hangs here foever...

When I hit on ctrl+c on the server, it shows me an exception that happened, that I don't know how to interpret in this context:

^C----------------------------------------
Exception happened during processing of request from ('xx.xx.xx.xx', 47346)
Traceback (most recent call last):
  File "/usr/lib/python3.5/socketserver.py", line 313, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python3.5/socketserver.py", line 341, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.5/socketserver.py", line 681, in __init__
    self.handle()
  File "/usr/lib/python3.5/http/server.py", line 422, in handle
    self.handle_one_request()
  File "/usr/lib/python3.5/http/server.py", line 400, in handle_one_request
    if not self.parse_request():
  File "/usr/lib/python3.5/http/server.py", line 334, in parse_request
    _class=self.MessageClass)
  File "/usr/lib/python3.5/http/client.py", line 206, in parse_headers
    line = fp.readline(_MAXLINE + 1)
  File "/usr/lib/python3.5/socket.py", line 576, in readinto
    return self._sock.recv_into(b)
KeyboardInterrupt
----------------------------------------

I also SSH-ed into the same machine where the server is running and did the request connecting to the localhost. Hanged too.

I would like to know:

How is telnet GET different to other GETs.

At python server level, what does the exception mean, and how to solve it.


问:
Azure DevOps - Set Project Permissions using Rest API Access Control List
I'm trying to set project permissions of Azure DevOps groups using Azure DevOps RestApi. I tried using Access Control Entries but it doesn't seem to work. </p>

```<code>    $securityNamespaceId = "52d39943-cb85-4d7f-8fa8-c6baac873819"
    $groupDesc = "vssgp.Uy0xLTktMTU1MTM3NDI0NS0yMzY2NjcwMjQwLTIyNDExNTQxMjQtMzEwMzY2MTYyNS0zODgxOTE3ODcxLTEtMzk0MjAxMzY5NS00MTY5ODI4NjEtMjk1MDY4ODE5MC0yMDI0NjY2NTQz"
    $projectId = "12313142-eec0-4c3d-b9b5-44d0c3973b3e"
    $token = "`$PROJECT:vstfs:///Classification/TeamProject/$($projectId)"
    $allowMask = 4
    $denyMask = 0
    $bodyInfo = @{
                    token = $token
                    merge = $true
                    accessControlEntries = @{
                            descriptor = $groupDesc
                            allow = $allowMask
                            deny = $denyMask
                            Extendedinfo=  {}
                    }
    }| ConvertTo-Json

    $uri = "https://dev.azure.com/<Organization>/_apis/accesscontrolentries/52d39943-cb85-4d7f-8fa8-c6baac873819?api-version=5.0"

    Invoke-RestMethod -Method Post -Uri $uri -Body $bodyInfo -Headers $headers -ContentType "application/json"

Invoke-RestMethod : {"$id":"1","innerException":null,"message":"TF400898: An Internal Error Occurred. Activity Id:
73da9e7f-1f9a-4d56-b8ca-f1e9e13513a6.","typeName":"Newtonsoft.Json.JsonSerializationException, Newtonsoft.Json","typeKey":"JsonSerializationException","errorCode":0,"eventId":0}
At line:1 char:1
+ Invoke-RestMethod -Method Post -Uri $uri -Body $bodyInfo -Headers $he ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
</code>```

答:
The error indicates cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[Microsoft.VisualStudio.Services.Security.AccessControlEntry]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.

To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object. Path 'accessControlEntries.allow'.

Also, make sure your PAT has the vso.security_manage scope.

Body:
I'm trying to set project permissions of Azure DevOps groups using Azure DevOps RestApi. I tried using Access Control Entries but it doesn't seem to work.

    $securityNamespaceId = "52d39943-cb85-4d7f-8fa8-c6baac873819"
    $groupDesc = "vssgp.Uy0xLTktMTU1MTM3NDI0NS0yMzY2NjcwMjQwLTIyNDExNTQxMjQtMzEwMzY2MTYyNS0zODgxOTE3ODcxLTEtMzk0MjAxMzY5NS00MTY5ODI4NjEtMjk1MDY4ODE5MC0yMDI0NjY2NTQz"
    $projectId = "12313142-eec0-4c3d-b9b5-44d0c3973b3e"
    $token = "`$PROJECT:vstfs:///Classification/TeamProject/$($projectId)"
    $allowMask = 4
    $denyMask = 0
    $bodyInfo = @{
                    token = $token
                    merge = $true
                    accessControlEntries = @{
                            descriptor = $groupDesc
                            allow = $allowMask
                            deny = $denyMask
                            Extendedinfo=  {}
                    }
    }| ConvertTo-Json

    $uri = "https://dev.azure.com/<Organization>/_apis/accesscontrolentries/52d39943-cb85-4d7f-8fa8-c6baac873819?api-version=5.0"

    Invoke-RestMethod -Method Post -Uri $uri -Body $bodyInfo -Headers $headers -ContentType "application/json"

Invoke-RestMethod : {"$id":"1","innerException":null,"message":"TF400898: An Internal Error Occurred. Activity Id:
73da9e7f-1f9a-4d56-b8ca-f1e9e13513a6.","typeName":"Newtonsoft.Json.JsonSerializationException, Newtonsoft.Json","typeKey":"JsonSerializationException","errorCode":0,"eventId":0}
At line:1 char:1
+ Invoke-RestMethod -Method Post -Uri $uri -Body $bodyInfo -Headers $he ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand


问:
How to discard errors of PowerShell ActiveDirectory cmdlets?
I am writing a PowerShell script (in a PowerShell 5.1 environnement) and I need to list all users from groups set in a folder's permissions. But some groups are not relevant so when I try to Get-ADGroupMember on it, I've got an expected error.

To discard this error, I tried the following :

Get-ADGroupMember Fake_Group -Server ad.example.com 2>&1 $null
Get-ADGroupMember Fake_Group -Server ad.example.com 2>&1 | Out-Null
```

<p>But in both cases, the result is the same : error is displayed.</p>

```get-aduser : Cannot find an object with identity: 'Fake_Group' under 'DC=example.com'.
At line:1 char:1
+ Get-ADGroupMember Fake_Group -Server ad.example.com 2>&1 | ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Fake_Group:ADGroup) [Get-ADGroupMember], ADIdentityNotFoundException
    + FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,Microsoft.ActiveDirectory.Management.Commands.GetADGroupMember
```

So my question is : why is this error still displayed ?

And then, how could I discard this error or is there a better way to list users from groups set in a folder's permissions than just try to Get-ADGroupMember on the whole result of Get-Acl even on no relevant object ?

答:
Because Out-Null does nothing in this regard, you would need to use try/catch statements and might even need to add -ErrorAction Stop as not all errors in AD commands are terminating errors:</p>

```<code>Try{
    Get-ADGroupMember $GROUPNAME -Server $SEVRER -ErrorAction Stop
    #The group is found, do whatever you want here
}Catch{
    Write-Host "Some error occured"
}
</code>```

Body:
I am writing a PowerShell script (in a PowerShell 5.1 environnement) and I need to list all users from groups set in a folder's permissions. But some groups are not relevant so when I try to Get-ADGroupMember on it, I've got an expected error.

To discard this error, I tried the following :

Get-ADGroupMember Fake_Group -Server ad.example.com 2>&1 $null
Get-ADGroupMember Fake_Group -Server ad.example.com 2>&1 | Out-Null

But in both cases, the result is the same : error is displayed.

get-aduser : Cannot find an object with identity: 'Fake_Group' under 'DC=example.com'.
At line:1 char:1
+ Get-ADGroupMember Fake_Group -Server ad.example.com 2>&1 | ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Fake_Group:ADGroup) [Get-ADGroupMember], ADIdentityNotFoundException
    + FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,Microsoft.ActiveDirectory.Management.Commands.GetADGroupMember

So my question is : why is this error still displayed ?

And then, how could I discard this error or is there a better way to list users from groups set in a folder's permissions than just try to Get-ADGroupMember on the whole result of Get-Acl even on no relevant object ?

Body:
Because Out-Null does nothing in this regard, you would need to use try/catch statements and might even need to add -ErrorAction Stop as not all errors in AD commands are terminating errors:

Try{
    Get-ADGroupMember $GROUPNAME -Server $SEVRER -ErrorAction Stop
    #The group is found, do whatever you want here
}Catch{
    Write-Host "Some error occured"
}


问:
in JavaScript - select all elements with same class - except clicked one
in JavaScript - select all elements with same class - except clicked one

currently i am getting a result that works fine, but checking for a smart and simple solution

there are similar answers available using jquery not

let color = document.querySelectorAll('.color');

let length = color.length;

// for (let i = 0; i < length; i++) {
//     color[i].onclick = () => {
//         color[i].classList.toggle('gold');
//     }
// }

// if gold exists on clicked element then remove it
// if gold not exists on clicked element then remove from all element and add only on clicked element
for (let i = 0; i < length; i++) {
    color[i].onclick = () => {
        if (color[i].classList.contains('gold')) {
            color[i].classList.toggle('gold');  // remove / toggle
        } else {
            for (let x = 0; x < length; x++) {
                color[x].classList.remove('gold');
            }
            color[i].classList.toggle('gold');  // add / toggle
        }
    }
}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.main {
    display: flex;
    justify-content: center;
}
.color {
    margin: 5px;
    width: 100px;
    height: 100px;
    border: 1px solid #ddd;
}

.gold {
    background-color: gold;
}</code>```

```

demo

答:
I fetched multiple list-item with the same class name. Need to show/hide list details by clicked list item. Below code may help someone -

```<code>function getDetailMsg(clicked){
    var len = document.getElementsByClassName("msg-accordion").length;
    var acc = document.getElementsByClassName("msg-accordion");

    acc[clicked].classList.toggle("active");
    var panel = acc[clicked].nextElementSibling;
    if (panel.style.maxHeight){
        panel.style.maxHeight = null;
    } else {
        for (let x = 0; x < len; x++) {
            var oldpanel = acc[x].nextElementSibling;
            if (clicked!=x) {
                oldpanel.style.maxHeight = null;
                acc[x].classList.remove('active');
            }
        }
        panel.style.maxHeight = panel.scrollHeight + "px";
    }
}
</code>```

Subject 1

Body 1

Subject 2

Body 2

```

ContentLicense: CC BY-SA 3.0

Body:
in JavaScript - select all elements with same class - except clicked one

currently i am getting a result that works fine, but checking for a smart and simple solution

there are similar answers available using jquery not

let color = document.querySelectorAll('.color');

let length = color.length;

// for (let i = 0; i < length; i++) {
//     color[i].onclick = () => {
//         color[i].classList.toggle('gold');
//     }
// }

// if gold exists on clicked element then remove it
// if gold not exists on clicked element then remove from all element and add only on clicked element
for (let i = 0; i < length; i++) {
    color[i].onclick = () => {
        if (color[i].classList.contains('gold')) {
            color[i].classList.toggle('gold');  // remove / toggle
        } else {
            for (let x = 0; x < length; x++) {
                color[x].classList.remove('gold');
            }
            color[i].classList.toggle('gold');  // add / toggle
        }
    }
}

.main {
    display: flex;
    justify-content: center;
}
.color {
    margin: 5px;
    width: 100px;
    height: 100px;
    border: 1px solid #ddd;
}

.gold {
    background-color: gold;
}

demo

Body:
I fetched multiple list-item with the same class name. Need to show/hide list details by clicked list item. Below code may help someone -

function getDetailMsg(clicked){
    var len = document.getElementsByClassName("msg-accordion").length;
    var acc = document.getElementsByClassName("msg-accordion");

    acc[clicked].classList.toggle("active");
    var panel = acc[clicked].nextElementSibling;
    if (panel.style.maxHeight){
        panel.style.maxHeight = null;
    } else {
        for (let x = 0; x < len; x++) {
            var oldpanel = acc[x].nextElementSibling;
            if (clicked!=x) {
                oldpanel.style.maxHeight = null;
                acc[x].classList.remove('active');
            }
        }
        panel.style.maxHeight = panel.scrollHeight + "px";
    }
}

<div class="list-group">
<div class="list-group-item justify-content-between msg-accordion" onclick="getDetailMsg('0');">Subject 1</div>
<div class="panel bg-warning text-white">Body 1</div>
<div class="list-group-item justify-content-between msg-accordion" onclick="getDetailMsg('1');">Subject 2</div>
<div class="panel bg-warning text-white">Body 2</div></div>


问:
how to avoid stack overflow exception in this code?
I got StackOverflowException in my code

```<code> public int Movie_ID
 {
     set
     {
         if (value == 0)
         {
             throw new Exception("value cannot be empty");
         }

         Movie_ID = value;
     }
     get
     {
         return Movie_ID;
     }
 }
</code>```

Exception of type 'System.StackOverflowException' was thrown."}

答:
Your get keeps calling itself recursively. You need to create a backing field and return that value, not call the property again. e.g:</p>

```<code>private int _movieId;

public int Movie_ID
 {
     set
     {
         if (value == 0)
         {
             throw new Exception("value cannot be empty");
         }

         _movieId = value;
     }
     get
     {
         return _movieId;
     }
 }
</code>```

Body:
I got StackOverflowException in my code

 public int Movie_ID
 {
     set
     {
         if (value == 0)
         {
             throw new Exception("value cannot be empty");
         }

         Movie_ID = value;
     }
     get
     {
         return Movie_ID;
     }
 }

Exception of type 'System.StackOverflowException' was thrown."}

Body:
Your get keeps calling itself recursively. You need to create a backing field and return that value, not call the property again. e.g:

private int _movieId;

public int Movie_ID
 {
     set
     {
         if (value == 0)
         {
             throw new Exception("value cannot be empty");
         }

         _movieId = value;
     }
     get
     {
         return _movieId;
     }
 }


问:
i want to send message without Enterkey in node.js
```<code>AndroidPhone---------Raspberry Pi ------------Arduino
(server)              (server)               (bluetooth)
                    (bluetooth)
</code>```

Now i can send message(0or1) from Android to Raspberry Pi by app
and i want to send this message to Arduino

However, when i play this code, message is not sent by bluetooth.
I think (stdin.process.on) is need input by enter.
but i cant. please help me

if (req.payload.toString() === '0') {
  console.log('0');
  process.stdin.on('data', function(data) {
    var buf1 = Buffer.from(data);
    serial.write(buf1,fuction(err, bytesWritten) {
      if (err) console.log(err);
    });
  };
  serial.on('data',function(data){ console.log('Received'+data);
});
```

答:
If your code was copied and pasted, you should fix that misspelled "fuction" on line 5 first.

Edit:

i want to know how to use stdin.on without console input

Sorry, I don't know much about messaging between devices but process.stdin is meant specifically to read standard input, which means either console input or messages piped to your node process from another process' stdout.

Body:
AndroidPhone---------Raspberry Pi ------------Arduino
(server)              (server)               (bluetooth)
                    (bluetooth)

Now i can send message(0or1) from Android to Raspberry Pi by app
and i want to send this message to Arduino

However, when i play this code, message is not sent by bluetooth.
I think (stdin.process.on) is need input by enter.
but i cant. please help me

if (req.payload.toString() === '0') {
  console.log('0');
  process.stdin.on('data', function(data) {
    var buf1 = Buffer.from(data);
    serial.write(buf1,fuction(err, bytesWritten) {
      if (err) console.log(err);
    });
  };
  serial.on('data',function(data){ console.log('Received'+data);
});


问:
How to Group By some id and Sum all row json encode data
```<code>I have Faced group by some id and Sum other column json_encode data in select query MySQL.
But how to sum total json data value?
Please help Anyone...
</code>```

Using this,
    PHP 7.2, Mysql 5 and Apache 2.

```<code>I am try code
    > SELECT `fk_club_id`,`adpoints`,`actpoints`,(JSON_OBJECT('actpoints',
    > actpoints, 'adpoints', adpoints)) FROM (SELECT `fk_club_id`,
    > SUM(JSON_EXTRACT("$.adpoints")) as adpoints,
    > SUM(JSON_EXTRACT("$.actpoints")) as actpoints FROM club_scoresheet
    > where status= 1 GROUP BY `fk_club_id`) as t
</code>```

MY table data ,

```<code>    id  |  JSON  column()

    15    ['5','6','2']
    15    ['5','6','2']
    28    ['5','6','1']
    28    ['5','6','1']
    28    ['5','6','1']
</code>```

it is my table

My expectation result,

```<code>id  | JSON column( total)

15     26
28     36
</code>```

expected result

答:
In MySQL version 5.7, JSON functions were introduced that could solve your problem. You could use the following, but it only allows to retrieve the sums when a fixed number of items is included in your JSON. Your example points out that there are 3 items in every JSON array, so you should be fine:

```<code>SELECT ID, SUM(CAST(JSON_EXTRACT(JSON,'$[0]') AS UNSIGNED)+CAST(JSON_EXTRACT(JSON,'$[1]') AS UNSIGNED)+CAST(JSON_EXTRACT(JSON,'$[2]') AS UNSIGNED)) AS TOTAL FROM TEST GROUP BY ID;
</code>```

If you would upgrade to MySQL 8, you could also use the new JSON_TABLE function to process any number of items in the JSON array:

```<code>SELECT TEST.ID,SUM(t.VAL) AS TOTAL FROM TEST, JSON_TABLE(JSON, '$[*]' COLUMNS(VAL INT PATH '$')) t GROUP BY ID
</code>```

You can test this out in this db fiddle as well.

Body:
I have Faced group by some id and Sum other column json_encode data in select query MySQL.
But how to sum total json data value?
Please help Anyone...

Using this,
    PHP 7.2, Mysql 5 and Apache 2.

I am try code
    > SELECT `fk_club_id`,`adpoints`,`actpoints`,(JSON_OBJECT('actpoints',
    > actpoints, 'adpoints', adpoints)) FROM (SELECT `fk_club_id`,
    > SUM(JSON_EXTRACT("$.adpoints")) as adpoints,
    > SUM(JSON_EXTRACT("$.actpoints")) as actpoints FROM club_scoresheet
    > where status= 1 GROUP BY `fk_club_id`) as t

MY table data ,

    id  |  JSON  column()

    15    ['5','6','2']
    15    ['5','6','2']
    28    ['5','6','1']
    28    ['5','6','1']
    28    ['5','6','1']

it is my table

My expectation result,

id  | JSON column( total)

15     26
28     36

expected result

Body:
In MySQL version 5.7, JSON functions were introduced that could solve your problem. You could use the following, but it only allows to retrieve the sums when a fixed number of items is included in your JSON. Your example points out that there are 3 items in every JSON array, so you should be fine:

SELECT ID, SUM(CAST(JSON_EXTRACT(JSON,'$[0]') AS UNSIGNED)+CAST(JSON_EXTRACT(JSON,'$[1]') AS UNSIGNED)+CAST(JSON_EXTRACT(JSON,'$[2]') AS UNSIGNED)) AS TOTAL FROM TEST GROUP BY ID;

If you would upgrade to MySQL 8, you could also use the new JSON_TABLE function to process any number of items in the JSON array:

SELECT TEST.ID,SUM(t.VAL) AS TOTAL FROM TEST, JSON_TABLE(JSON, '$[*]' COLUMNS(VAL INT PATH '$')) t GROUP BY ID

You can test this out in this db fiddle as well.


问:
Apply Sequence based on unique_id
I have a table:

table1

```<code>unique_id   col_id   val_id
1           100      a
1           101      b
1           102      c
1           103      d

2           106      a
2           106      b
2           104      c
2           103      d
</code>```

I want to use a sequence to assign it for each unique_id.

I wrote the following which doesn't seem to work:

```<code>SELECT
    my_seq.NEXTVAL over
(
    PARTITION BY a.unique_id ORDER by a.unique_id) AS rec_i,
     a.* FROM table1
a;
</code>```

The output would be:

```<code>unique_id   col_id   val_id   rec_i
1           100      a        123
1           101      b        123
1           102      c        123
1           103      d        123

2           106      a        124
2           106      b        124
2           104      c        124
2           103      d        124
</code>```

How can I make it work?

答:
Try this:

```<code>-- data preparation
create table tt_table (unique_id   number, col_id   number, val_id varchar2(1));

insert into tt_table values(1,100,'a');
insert into tt_table values(1,101,'b');
insert into tt_table values(1,102,'c');
insert into tt_table values(1,103,'d');

insert into tt_table values(2,106,'a');
insert into tt_table values(2,104,'b');
insert into tt_table values(2,103,'c');
insert into tt_table values(2,103,'d');

-- creating function
CREATE OR REPLACE FUNCTION GET_SEQ RETURN NUMBER AS
BEGIN
    RETURN TEJASH_SEQ.NEXTVAL;
END GET_SEQ;
/

--
-- actual query
--
WITH T2 AS (
    SELECT /*+ materialize */
        UNIQUE_ID,
        GET_SEQ   SEQ_VALUE
    FROM
        (
            SELECT DISTINCT
                UNIQUE_ID
            FROM
                TT_TABLE
        ) T2IN
)
SELECT
    T1.UNIQUE_ID,
    T1.COL_ID,
    T1.VAL_ID,
    T2.SEQ_VALUE
FROM
    TT_TABLE T1,
    T2
WHERE
    T1.UNIQUE_ID = T2.UNIQUE_ID
ORDER BY
    T1.UNIQUE_ID;
</code>```

Hope it is helpful.

Title: Apply Sequence based on unique_id

Body:
I have a table:

table1

unique_id   col_id   val_id
1           100      a
1           101      b
1           102      c
1           103      d

2           106      a
2           106      b
2           104      c
2           103      d

I want to use a sequence to assign it for each unique_id.

I wrote the following which doesn't seem to work:

SELECT
    my_seq.NEXTVAL over
(
    PARTITION BY a.unique_id ORDER by a.unique_id) AS rec_i,
     a.* FROM table1
a;

The output would be:

unique_id   col_id   val_id   rec_i
1           100      a        123
1           101      b        123
1           102      c        123
1           103      d        123

2           106      a        124
2           106      b        124
2           104      c        124
2           103      d        124

How can I make it work?

Body:
Try this:

-- data preparation
create table tt_table (unique_id   number, col_id   number, val_id varchar2(1));

insert into tt_table values(1,100,'a');
insert into tt_table values(1,101,'b');
insert into tt_table values(1,102,'c');
insert into tt_table values(1,103,'d');

insert into tt_table values(2,106,'a');
insert into tt_table values(2,104,'b');
insert into tt_table values(2,103,'c');
insert into tt_table values(2,103,'d');

-- creating function
CREATE OR REPLACE FUNCTION GET_SEQ RETURN NUMBER AS
BEGIN
    RETURN TEJASH_SEQ.NEXTVAL;
END GET_SEQ;
/

--
-- actual query
--
WITH T2 AS (
    SELECT /*+ materialize */
        UNIQUE_ID,
        GET_SEQ   SEQ_VALUE
    FROM
        (
            SELECT DISTINCT
                UNIQUE_ID
            FROM
                TT_TABLE
        ) T2IN
)
SELECT
    T1.UNIQUE_ID,
    T1.COL_ID,
    T1.VAL_ID,
    T2.SEQ_VALUE
FROM
    TT_TABLE T1,
    T2
WHERE
    T1.UNIQUE_ID = T2.UNIQUE_ID
ORDER BY
    T1.UNIQUE_ID;

Hope it is helpful.


问:
how to align multiple line text as the column of the table
I have to display text as follows(please notice that the month should be properly aligned with the months of other two rows, time should be properly aligned with the time of other two rows and so is the date as follows):

and all these values are coming from two way data binding inside a div in an angular 7 project as follows:

```<code><div *ngFor="let date of dates">
{{date.month}} {{date.day}} {{date.time}}
<div>
</code>```

please help me to display these values in the exact same style style.

答:
Just make your Angular create the following HTML structure:

.table {
  display: table;
}

.row {
  display: table-row;
}

.cell {
  display: table-cell;
  padding: 0 10px;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="table">
  <div class="row">
    <span class="cell">December</span>
    <span class="cell">15,2015</span>
    <span class="cell">5 a.m.</span>
  </div>
  <div class="row">
    <span class="cell">October</span>
    <span class="cell">10, 2010</span>
    <span class="cell">6 p.m.</span>
  </div>
  <div class="row">
    <span class="cell">March</span>
    <span class="cell">12, 2012</span>
    <span class="cell">12 a.m.</span>
  </div>
</div></code>```

In your Angular, that would be

```<code><div class="table">
  <div class="row" *ngFor="let date of dates">
    <span class="cell">{{date.month}}</span>
    <span class="cell">{{date.day}}</span>
    <span calls="cell">{{date.time}}</span>
  <div>
</div>
</code>```

Body:
I have to display text as follows(please notice that the month should be properly aligned with the months of other two rows, time should be properly aligned with the time of other two rows and so is the date as follows):

and all these values are coming from two way data binding inside a div in an angular 7 project as follows:

{{date.month}} {{date.day}} {{date.time}}

please help me to display these values in the exact same style style.

Body:
Just make your Angular create the following HTML structure:

.table {
  display: table;
}

.row {
  display: table-row;
}

.cell {
  display: table-cell;
  padding: 0 10px;
}

<div class="table">
  <div class="row">
    <span class="cell">December</span>
    <span class="cell">15,2015</span>
    <span class="cell">5 a.m.</span>
  </div>
  <div class="row">
    <span class="cell">October</span>
    <span class="cell">10, 2010</span>
    <span class="cell">6 p.m.</span>
  </div>
  <div class="row">
    <span class="cell">March</span>
    <span class="cell">12, 2012</span>
    <span class="cell">12 a.m.</span>
  </div>
</div>

In your Angular, that would be

<div class="table">
  <div class="row" *ngFor="let date of dates">
    <span class="cell">{{date.month}}</span>
    <span class="cell">{{date.day}}</span>
    <span calls="cell">{{date.time}}</span>
  <div>
</div>


问:
Key-value map of each value of an enum in Java

Task

In a Java back-end project, I have some (100+) external enums that I can't edit and I need to output them to our front-end. I wanted to output them in a JSON-object like manner. Each enum has different properties name.

e.g. for the following enum

public enum Colors {
  RED(1, "RED", "ff0000", Boolean.TRUE),
  GREEN(2, "GREEN", "00ff00", Boolean.FALSE),
  BLUE(3, "BLUE", "0000ff", Boolean.TRUE);

  private int code;
  private String label;
  private String hexCode;
  private boolean isAwesome;

  // ... getters and other methods
}
```

<p>i want to output</p>

```[
  {
    label: "RED"
    hexCode: "ff0000"
    isAwesome: true
  },
  {
    label: "GREEN"
    hexCode: "00ff00"
    isAwesome: false
  },
  ...
]
```

<h3>My attempt</h3>

<p>I am new to Java, this is the first time I used reflection and I didn't really study anything before going into this. Probably there are some major problems with this code (like performance or some other weird stuff that I don't know), but it compiles and does the job. I don't know if this is safe, so I ask if there are some better ways to do this.</p>

<pre class="lang-java prettyprint-override"><code>private <T> List<HashMap<String, Object>> enumInserter(Class<T> clazz, List<String> properties) {
    return valuesToMap(clazz.getEnumConstants(), parserFactory(clazz, properties));
}

/**
*
* @param <T>    type of the enum class
* @param values enumConstants of the enum
* @param parser a function that take a single enumValue of type <T> and returns
*               an property-value map
* @return the array of the property-value maps of each value
*/
private <T> List<HashMap<String, Object>> valuesToMap(T[] values, Function<T, HashMap<String, Object>> parser) {
  List<HashMap<String, Object>> enumValues = new ArrayList<>();
  for (T enumValue : values) {
    HashMap<String, Object> processedValue = parser.apply(enumValue);
    enumValues.add(processedValue);
  }
  return enumValues;
}

/**
*
* @param <T>        the type of the enum class
* @param clazz      the enum class
* @param properties the properties to be added in the map
* @return a parser function that take a single enumValue of type <T> as input and
*         returns a property-value map of the given enumValue
*/
private <T> Function<T, HashMap<String, Object>> parserFactory(Class<T> clazz, List<String> properties) {
  return ((T enumValue) -> {
    HashMap<String, Object> map = new HashMap<>();

    properties.stream().forEach(propertyName -> {
      String methodName = getterFromProperty(propertyName);
      try {
        Method method = clazz.getMethod(methodName);
        Object methodResult = method.invoke(enumValue);
        map.put(propertyName, methodResult);
      } catch (Exception e) {
        // ... error logging
      }
    });

    return map;
  });
}

/**
* Return the "standard" property getter of a property. e.g. "example" will
* return "getExample"
*
* @param property
* @return property getter method name
*/
private String getterFromProperty(String property) {
  return "get" + property.substring(0, 1).toUpperCase() + property.substring(1);
}
</code>```

答:
The usual approach to this is either through use of annotation @JsonFormat(shape = JsonFormat.Shape.OBJECT) or through usage of a custom tailored serializer.

Lets say that you are referencing the enum from class  A

```<code>class A {

   @JsonFormat(shape = JsonFormat.Shape.OBJECT)
   private Colors color;

}
</code>```

this will make the color to be serialized the way you want.

Alternative aproach would to register a custom serializer for your Enum this you can do the following way:

```<code>public class ColorSerializer extends StdSerializer {

    public ColorSerializer() {
        super(Color.class);
    }

    public ColorSerializer(Class t) {
        super(t);
    }

    public void serialize(Color color, JsonGenerator generator,
      SerializerProvider provider)
      throws IOException, JsonProcessingException {
        generator.writeStartObject();
        generator.writeFieldName("code");
        generator.writeString(color.getCode());
        generator.writeFieldName("hexCode");
        generator.writeString(color.getHexcode());
        generator.writeFieldName("isAwsome");
        generator.writeNumber(color.isAwsome());
        generator.writeEndObject();
    }
}
</code>```

Since your enums are external you can always place them in wrappers which are internal to your project and this way control their serialization process.

If you want to serialize them using the same strategy you can place your reflection code in the serializer. This way you will get a single generic serializer, instead of writing for each enum.

This is how you can register the custom serializer:

```<code>ObjectMapper mapper = new ObjectMapper();

SimpleModule module = new SimpleModule();
module.addSerializer(Color.class, new ColorSerializer ());
mapper.registerModule(module);
</code>```

Body:
Task

In a Java back-end project, I have some (100+) external enums that I can't edit and I need to output them to our front-end. I wanted to output them in a JSON-object like manner. Each enum has different properties name.

e.g. for the following enum

public enum Colors {
  RED(1, "RED", "ff0000", Boolean.TRUE),
  GREEN(2, "GREEN", "00ff00", Boolean.FALSE),
  BLUE(3, "BLUE", "0000ff", Boolean.TRUE);

  private int code;
  private String label;
  private String hexCode;
  private boolean isAwesome;

  // ... getters and other methods
}

i want to output

[
  {
    label: "RED"
    hexCode: "ff0000"
    isAwesome: true
  },
  {
    label: "GREEN"
    hexCode: "00ff00"
    isAwesome: false
  },
  ...
]

My attempt

I am new to Java, this is the first time I used reflection and I didn't really study anything before going into this. Probably there are some major problems with this code (like performance or some other weird stuff that I don't know), but it compiles and does the job. I don't know if this is safe, so I ask if there are some better ways to do this.

private <T> List<HashMap<String, Object>> enumInserter(Class<T> clazz, List<String> properties) {
    return valuesToMap(clazz.getEnumConstants(), parserFactory(clazz, properties));
}

/**
*
* @param <T>    type of the enum class
* @param values enumConstants of the enum
* @param parser a function that take a single enumValue of type <T> and returns
*               an property-value map
* @return the array of the property-value maps of each value
*/
private <T> List<HashMap<String, Object>> valuesToMap(T[] values, Function<T, HashMap<String, Object>> parser) {
  List<HashMap<String, Object>> enumValues = new ArrayList<>();
  for (T enumValue : values) {
    HashMap<String, Object> processedValue = parser.apply(enumValue);
    enumValues.add(processedValue);
  }
  return enumValues;
}

/**
*
* @param <T>        the type of the enum class
* @param clazz      the enum class
* @param properties the properties to be added in the map
* @return a parser function that take a single enumValue of type <T> as input and
*         returns a property-value map of the given enumValue
*/
private <T> Function<T, HashMap<String, Object>> parserFactory(Class<T> clazz, List<String> properties) {
  return ((T enumValue) -> {
    HashMap<String, Object> map = new HashMap<>();

    properties.stream().forEach(propertyName -> {
      String methodName = getterFromProperty(propertyName);
      try {
        Method method = clazz.getMethod(methodName);
        Object methodResult = method.invoke(enumValue);
        map.put(propertyName, methodResult);
      } catch (Exception e) {
        // ... error logging
      }
    });

    return map;
  });
}

/**
* Return the "standard" property getter of a property. e.g. "example" will
* return "getExample"
*
* @param property
* @return property getter method name
*/
private String getterFromProperty(String property) {
  return "get" + property.substring(0, 1).toUpperCase() + property.substring(1);
}

Body:
The usual approach to this is either through use of annotation @JsonFormat(shape = JsonFormat.Shape.OBJECT) or through usage of a custom tailored serializer.

Lets say that you are referencing the enum from class  A

class A {

   @JsonFormat(shape = JsonFormat.Shape.OBJECT)
   private Colors color;

}

this will make the color to be serialized the way you want.

Alternative aproach would to register a custom serializer for your Enum this you can do the following way:

public class ColorSerializer extends StdSerializer {

    public ColorSerializer() {
        super(Color.class);
    }

    public ColorSerializer(Class t) {
        super(t);
    }

    public void serialize(Color color, JsonGenerator generator,
      SerializerProvider provider)
      throws IOException, JsonProcessingException {
        generator.writeStartObject();
        generator.writeFieldName("code");
        generator.writeString(color.getCode());
        generator.writeFieldName("hexCode");
        generator.writeString(color.getHexcode());
        generator.writeFieldName("isAwsome");
        generator.writeNumber(color.isAwsome());
        generator.writeEndObject();
    }
}

Since your enums are external you can always place them in wrappers which are internal to your project and this way control their serialization process.

If you want to serialize them using the same strategy you can place your reflection code in the serializer. This way you will get a single generic serializer, instead of writing for each enum.

This is how you can register the custom serializer:

ObjectMapper mapper = new ObjectMapper();

SimpleModule module = new SimpleModule();
module.addSerializer(Color.class, new ColorSerializer ());
mapper.registerModule(module);


问:
How to hide 'Back' button on navigation bar on iPhone?
I added a navigation control to switch between views in my app. But some of the views shouldn't have 'Back' (the previous title) button. Any ideas about how to hide the back button?</p>

答:
In c# or Xamarin.ios,
this.NavigationItem.HidesBackButton = true;</p>

OwnerDisplayName: iphony


问:
Asp.net MVC and Chart js
I want to show data that comes from databse with chart.js.

In asp.net MVC i have a controller that retrieves data from the database and shows them in view with the following code:

```<code>@foreach(var items in Model)
{
    <h6>@items.title</h6>
    <h6>@items.cuntr</h6>
}
</code>```

How can I show @items.title and @items.cuntr in chart.js? Thanks a lot.

答:
This is by far the easiest example I've come across just copy paste the
code in your View & controller and bobs your uncle. you can modify thereafter

once thats done you can call your database like:

```<code>     dr = dt.NewRow();
        dr["Employee"] = "Someone";
        dr["Credit"] = rawData.Where(a => a.person == "Someone").Count().ToString();
        dt.Rows.Add(dr);
</code>```

Title: Asp.net MVC and Chart js

Body:
I want to show data that comes from databse with chart.js.

In asp.net MVC i have a controller that retrieves data from the database and shows them in view with the following code:

@foreach(var items in Model)
{

@items.title

@items.cuntr

}

How can I show @items.title and @items.cuntr in chart.js? Thanks a lot.

Body:
This is by far the easiest example I've come across just copy paste the
code in your View & controller and bobs your uncle. you can modify thereafter

once thats done you can call your database like:

     dr = dt.NewRow();
        dr["Employee"] = "Someone";
        dr["Credit"] = rawData.Where(a => a.person == "Someone").Count().ToString();
        dt.Rows.Add(dr);


问:
how to use a single expression to select the second largest number in a 3 numbers set in python?
I am trying to find the largest and second largest number in a set of three numbers by using python language, but I was stuck in how to write a code in a single expression of the body.
Ask for help!</p>

答:
This is a simple explanation to find the second largest number from the array list.
You can change the logic accordingly.</p>

```<code>if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().split()))
x = len(arr)
arr.sort()
for i in range(0, x-1):
    if arr[i] == max(arr):
        arr.remove(arr[i])

arr.remove(max(arr))
print(max(arr))
</code>```

Body:
This is a simple explanation to find the second largest number from the array list.
You can change the logic accordingly.

if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().split()))
x = len(arr)
arr.sort()
for i in range(0, x-1):
    if arr[i] == max(arr):
        arr.remove(arr[i])

arr.remove(max(arr))
print(max(arr))


问:
array of pointers
Consider the following code:

```<code>#include <stdio.h>

int main()
{
  static int a[]={0,1,2,3,4};
  int *p[]={a,a+1,a+2,a+3};            /* clear up to this extent */
  printf(("%u\n%u\n%u",p,*p,*(*p)));   /* how does this statement work? */
  return 0;
}
</code>```

Also is it necessary to get the value of addresses through %u,or we can use %d also?

答:
Your printf() arguments work like so:

p is an address (it's an array of pointers)

*p is also an address (it's equivalent to p[0], which is just a)

*(*p) is an integer (it's a[0])

Title: array of pointers

Body:
Consider the following code:

#include <stdio.h>

int main()
{
  static int a[]={0,1,2,3,4};
  int *p[]={a,a+1,a+2,a+3};            /* clear up to this extent */
  printf(("%u\n%u\n%u",p,*p,*(*p)));   /* how does this statement work? */
  return 0;
}

Also is it necessary to get the value of addresses through %u,or we can use %d also?


问:
Why my app stops when firebase throws an exception?
I'm using the firebase auth plugin for flutter, and when I type an user that doesn't exists, it throws a Platform exception.

Ok.. but unless i click continue(f5)

the app is stopped. When I continue, the app works fine an show the snackbar.

Am I doing something wrong? Should i use catchError? (Got the same issue)

I dont really know if this is intended behaviour.

Thank you in advance.

答: Check your Visual Studio Code breakpoint settings as shown in the image here. You probably have 'All exceptions' checked.


问:
OpenCV how to smooth contour, reducing noise
I extracted the contours of an image, that you can see here:

However, it has some noise.
How can I smooth the noise? I did a close up to make clearer what I want to meant

Original image that I've used:

Code:

```<code>rMaskgray = cv2.imread('redmask.jpg', cv2.CV_LOAD_IMAGE_GRAYSCALE)
(thresh, binRed) = cv2.threshold(rMaskgray, 50, 255, cv2.THRESH_BINARY)

Rcontours, hier_r = cv2.findContours(binRed,cv2.RETR_CCOMP,cv2.CHAIN_APPROX_SIMPLE)
r_areas = [cv2.contourArea(c) for c in Rcontours]
max_rarea = np.max(r_areas)
CntExternalMask = np.ones(binRed.shape[:2], dtype="uint8") * 255

for c in Rcontours:
    if(( cv2.contourArea(c) > max_rarea * 0.70) and (cv2.contourArea(c)< max_rarea)):
        cv2.drawContours(CntExternalMask,[c],-1,0,1)

cv2.imwrite('contour1.jpg', CntExternalMask)
</code>```

答:
I don't know if is it ok to provide Java code - but I implemented Gaussian smoothing for openCV contour. Logic and theory is taken from here https://www.morethantechnical.com/2012/12/07/resampling-smoothing-and-interest-points-of-curves-via-css-in-opencv-w-code/

package CurveTools;

import org.apache.log4j.Logger;
import org.opencv.core.Mat;
import org.opencv.core.MatOfPoint;
import org.opencv.core.Point;

import java.util.ArrayList;
import java.util.List;

import static org.opencv.core.CvType.CV_64F;
import static org.opencv.imgproc.Imgproc.getGaussianKernel;

class CurveSmoother {

    private double[] g, dg, d2g, gx, dx, d2x;
    private double gx1, dgx1, d2gx1;

    public double[] kappa, smoothX, smoothY;
    public double[] contourX, contourY;

    /* 1st and 2nd derivative of 1D gaussian  */
    void getGaussianDerivs(double sigma, int M) {

        int L = (M - 1) / 2;
        double sigma_sq = sigma * sigma;
        double sigma_quad = sigma_sq * sigma_sq;

        dg = new double[M];
        d2g = new double[M];
        g = new double[M];

        Mat tmpG = getGaussianKernel(M, sigma, CV_64F);

        for (double i = -L; i < L + 1.0; i += 1.0) {
            int idx = (int) (i + L);

            g[idx] = tmpG.get(idx, 0)[0];

            // from http://www.cedar.buffalo.edu/~srihari/CSE555/Normal2.pdf
            dg[idx] = -i * g[idx] / sigma_sq;
            d2g[idx] = (-sigma_sq + i * i) * g[idx] / sigma_quad;
        }
    }

    /* 1st and 2nd derivative of smoothed curve point */
    void getdX(double[] x, int n, double sigma, boolean isOpen) {

        int L = (g.length - 1) / 2;

        gx1 = dgx1 = d2gx1 = 0.0;
        for (int k = -L; k < L + 1; k++) {
            double x_n_k;
            if (n - k < 0) {
                if (isOpen) {
                    //open curve - mirror values on border
                    x_n_k = x[-(n - k)];
                } else {
                    //closed curve - take values from end of curve
                    x_n_k = x[x.length + (n - k)];
                }
            } else if (n - k > x.length - 1) {
                if (isOpen) {
                    //mirror value on border
                    x_n_k = x[n + k];
                } else {
                    x_n_k = x[(n - k) - x.length];
                }
            } else {
                x_n_k = x[n - k];
            }

            gx1 += x_n_k * g[k + L]; //gaussians go [0 -> M-1]
            dgx1 += x_n_k * dg[k + L];
            d2gx1 += x_n_k * d2g[k + L];
        }
    }

    /* 0th, 1st and 2nd derivatives of whole smoothed curve */
    void getdXcurve(double[] x, double sigma, boolean isOpen) {

        gx = new double[x.length];
        dx = new double[x.length];
        d2x = new double[x.length];

        for (int i = 0; i < x.length; i++) {
            getdX(x, i, sigma, isOpen);
            gx[i] = gx1;
            dx[i] = dgx1;
            d2x[i] = d2gx1;
        }
    }

    /*
        compute curvature of curve after gaussian smoothing
        from "Shape similarity retrieval under affine transforms", Mokhtarian & Abbasi 2002
        curvex - x position of points
        curvey - y position of points
        kappa - curvature coeff for each point
        sigma - gaussian sigma
    */
    void computeCurveCSS(double[] curvex, double[] curvey, double sigma, boolean isOpen) {
        int M = (int) Math.round((10.0 * sigma + 1.0) / 2.0) * 2 - 1;
        assert (M % 2 == 1); //M is an odd number

        getGaussianDerivs(sigma, M);//, g, dg, d2g

        double[] X, XX, Y, YY;

        getdXcurve(curvex, sigma, isOpen);
        smoothX = gx.clone();
        X = dx.clone();
        XX = d2x.clone();

        getdXcurve(curvey, sigma, isOpen);
        smoothY = gx.clone();
        Y = dx.clone();
        YY = d2x.clone();

        kappa = new double[curvex.length];

        for (int i = 0; i < curvex.length; i++) {
            // Mokhtarian 02' eqn (4)
            kappa[i] = (X[i] * YY[i] - XX[i] * Y[i]) / Math.pow(X[i] * X[i] + Y[i] * Y[i], 1.5);
        }
    }

    /* find zero crossings on curvature */
    ArrayList<Integer> findCSSInterestPoints() {

        assert (kappa != null);

        ArrayList<Integer> crossings = new ArrayList<>();

        for (int i = 0; i < kappa.length - 1; i++) {
            if ((kappa[i] < 0.0 && kappa[i + 1] > 0.0) || kappa[i] > 0.0 && kappa[i + 1] < 0.0) {
                crossings.add(i);
            }
        }
        return crossings;
    }

    public void polyLineSplit(MatOfPoint pl) {
        contourX = new double[pl.height()];
        contourY = new double[pl.height()];

        for (int j = 0; j < contourX.length; j++) {
            contourX[j] = pl.get(j, 0)[0];
            contourY[j] = pl.get(j, 0)[1];
        }
    }

    public MatOfPoint polyLineMerge(double[] xContour, double[] yContour) {

        assert (xContour.length == yContour.length);

        MatOfPoint pl = new MatOfPoint();

        List<Point> list = new ArrayList<>();

        for (int j = 0; j < xContour.length; j++)
            list.add(new Point(xContour[j], yContour[j]));

        pl.fromList(list);

        return pl;
    }

    MatOfPoint smoothCurve(MatOfPoint curve, double sigma) {
        int M = (int) Math.round((10.0 * sigma + 1.0) / 2.0) * 2 - 1;
        assert (M % 2 == 1); //M is an odd number

        //create kernels
        getGaussianDerivs(sigma, M);
        polyLineSplit(curve);

        getdXcurve(contourX, sigma, false);
        smoothX = gx.clone();

        getdXcurve(contourY, sigma, false);
        smoothY = gx;

        Logger.getRootLogger().info("Smooth curve len: " + smoothX.length);

        return polyLineMerge(smoothX, smoothY);
    }
}
```

Body:
I extracted the contours of an image, that you can see here:

However, it has some noise.
How can I smooth the noise? I did a close up to make clearer what I want to meant

Original image that I've used:

Code:

rMaskgray = cv2.imread('redmask.jpg', cv2.CV_LOAD_IMAGE_GRAYSCALE)
(thresh, binRed) = cv2.threshold(rMaskgray, 50, 255, cv2.THRESH_BINARY)

Rcontours, hier_r = cv2.findContours(binRed,cv2.RETR_CCOMP,cv2.CHAIN_APPROX_SIMPLE)
r_areas = [cv2.contourArea(c) for c in Rcontours]
max_rarea = np.max(r_areas)
CntExternalMask = np.ones(binRed.shape[:2], dtype="uint8") * 255

for c in Rcontours:
    if(( cv2.contourArea(c) > max_rarea * 0.70) and (cv2.contourArea(c)< max_rarea)):
        cv2.drawContours(CntExternalMask,[c],-1,0,1)

cv2.imwrite('contour1.jpg', CntExternalMask)


问:
Why console.log goes infinite in async_hooks nodejs
Why console.log which is present inside init, before, after, destroy functions in async_hooks leads to infinite maximum call stack exceed problem?

Why does the below code goes infinite,

```<code>let asycn_hooks = require('async_hooks');

async_hooks.createHook({
  init(asyncId, type, triggerAsyncId) {
    console.log(asyncId);
  },
  before(asyncId) {
    console.log(asyncId);
  },
  after(asyncId) {
    console.log(asyncId);
  },
  destroy(asyncId) {
    console.log(asyncId);
  },
}).enable();
setTimeout(() => {
  console.log('>>>', async_hooks.executionAsyncId());
}, 10);
</code>```

but the below code doesn't

```<code>let async_hooks = require('async_hooks');
let fs = require('fs');

async_hooks.createHook({
  init(asyncId, type, triggerAsyncId) {
    fs.writeFileSync(1,`init ${asyncId} \n`);
  },
  before(asyncId) {
    fs.writeFileSync(1,`before ${asyncId} \n`);
  },
  after(asyncId) {
    fs.writeFileSync(1,`after ${asyncId} \n`);
  },
  destroy(asyncId) {
    fs.writeFileSync(1,`destroy ${asyncId} \n`);
  },
}).enable();

setTimeout(() => {
    console.log('>>>', async_hooks.executionAsyncId());
  }, 0);
</code>```

答: Cause console.log is asynchronous according to the docs

Body:
Why console.log which is present inside init, before, after, destroy functions in async_hooks leads to infinite maximum call stack exceed problem?

Why does the below code goes infinite,

let asycn_hooks = require('async_hooks');

async_hooks.createHook({
  init(asyncId, type, triggerAsyncId) {
    console.log(asyncId);
  },
  before(asyncId) {
    console.log(asyncId);
  },
  after(asyncId) {
    console.log(asyncId);
  },
  destroy(asyncId) {
    console.log(asyncId);
  },
}).enable();
setTimeout(() => {
  console.log('>>>', async_hooks.executionAsyncId());
}, 10);

but the below code doesn't

let async_hooks = require('async_hooks');
let fs = require('fs');

async_hooks.createHook({
  init(asyncId, type, triggerAsyncId) {
    fs.writeFileSync(1,`init ${asyncId} \n`);
  },
  before(asyncId) {
    fs.writeFileSync(1,`before ${asyncId} \n`);
  },
  after(asyncId) {
    fs.writeFileSync(1,`after ${asyncId} \n`);
  },
  destroy(asyncId) {
    fs.writeFileSync(1,`destroy ${asyncId} \n`);
  },
}).enable();

setTimeout(() => {
    console.log('>>>', async_hooks.executionAsyncId());
  }, 0);