问:
Is it possible to find all unused CSS?

Possible Duplicate:

  Tool to identify unused css definitions

I have quite big CSS file, that already contains style definition for classes/elements that are not used by markup any more.

It is possible to find those quick?

答: You can use the Firefox extension Dust-Me at http://www.sitepoint.com/dustmeselectors/.</p>

Title: Is it possible to find all unused CSS?


来源: stackexchange

问:
javax.ws.rs.NotFoundException: Could not find resource for full path with RESTEasy and Wildfly 8.1.0.Final
I am facing following problem. I have spent more than 3 days on this but cannot find a solution. Please guide me what I am doing wrong here. I am new to Resteasy with wildfly.

Here is the stacktrace

```<code>19:05:57,610 WARN  [org.jboss.resteasy.core.ExceptionHandler] (default task-14) failed to execute: javax.ws.rs.NotFoundException: Could not find resource for full path: http://localhost:8080/admin-ws/services/user/getUser
    at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.java:73) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:444) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:234) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:171) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) [resteasy-jaxrs-3.0.8.Final.jar:]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_20]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_20]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_20]
</code>```

Here is my web.xml

```<code><?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
</web-app>
</code>```

Here is the Application class.

```<code>package com.abc.admin.services.config;

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath("/services")
public class WebConfig extends Application {

}
</code>```

Here is the web service class.

```<code>package com.abc.admin.service;

import java.io.Serializable;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import com.abc.commons.ws.entity.UserWsPojo;

@Path("/user")
public class UserResource implements Serializable {

    private static final long serialVersionUID = 6766329501327292893L;

    @GET
    @Path("/services/user/getUser")
    @Produces(MediaType.APPLICATION_JSON)
    public UserWsPojo getUser(String id) {
        UserWsPojo uwp = new UserWsPojo();
        uwp.setName("Aayush");
        uwp.setSurname("Devmurari");
        return uwp;
    }
}
</code>```

Now in the above mentioned class I also tried to change the path of @Path with /getUser and also tried full path i.e. @Path("/services/user/getUser") none of these are working everytime I get the same error.

If you need to see anything  else please let me know. I will post it here.

Thanks for reading and helping.

P.S I have tried reading other questions on SO, documentation on RestEasy none of this helped me much. However I corrected my code while looking for the solution.

Based on the answers I did this too

```<code>@Path("/user")
public class UserResource implements Serializable {

    private static final long serialVersionUID = 6766329501327292893L;

    @GET
    @Path("/getUser")
    @Produces(MediaType.APPLICATION_JSON)
    public UserWsPojo getUser() {
        UserWsPojo uwp = new UserWsPojo();
        uwp.setName("Aayush");
        uwp.setSurname("Devmurari");
        return uwp;
    }
}
</code>```

Other things are same as they are, still I am getting the same error.

```<code>22:15:58,489 WARN  [org.jboss.resteasy.core.ExceptionHandler] (default task-5) failed to execute: javax.ws.rs.NotFoundException: Could not find resource for full path: http://localhost:8080/admin-ws/services/user/getUsers
    at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.java:73) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:444) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:234) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:171) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) [resteasy-jaxrs-3.0.8.Final.jar:]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_20]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_20]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_20]
</code>```

答:
I've got same issue (NotFound). After debugging, it turned out that I missed the method. (@GET, @POST...) on the controller</p>

```<code>@Path("/create")
public Response createObject(){
}
//correct
@GET // or @POST
@Path("/create")
public Response createObject(){
}
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I am facing following problem. I have spent more than 3 days on this but cannot find a solution. Please guide me what I am doing wrong here. I am new to Resteasy with wildfly.

Here is the stacktrace

19:05:57,610 WARN  [org.jboss.resteasy.core.ExceptionHandler] (default task-14) failed to execute: javax.ws.rs.NotFoundException: Could not find resource for full path: http://localhost:8080/admin-ws/services/user/getUser
    at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.java:73) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:444) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:234) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:171) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) [resteasy-jaxrs-3.0.8.Final.jar:]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_20]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_20]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_20]

Here is my web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
</web-app>

Here is the Application class.

package com.abc.admin.services.config;

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath("/services")
public class WebConfig extends Application {

}

Here is the web service class.

package com.abc.admin.service;

import java.io.Serializable;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import com.abc.commons.ws.entity.UserWsPojo;

@Path("/user")
public class UserResource implements Serializable {

    private static final long serialVersionUID = 6766329501327292893L;

    @GET
    @Path("/services/user/getUser")
    @Produces(MediaType.APPLICATION_JSON)
    public UserWsPojo getUser(String id) {
        UserWsPojo uwp = new UserWsPojo();
        uwp.setName("Aayush");
        uwp.setSurname("Devmurari");
        return uwp;
    }
}

Now in the above mentioned class I also tried to change the path of @Path with /getUser and also tried full path i.e. @Path("/services/user/getUser") none of these are working everytime I get the same error.

If you need to see anything  else please let me know. I will post it here.

Thanks for reading and helping.

P.S I have tried reading other questions on SO, documentation on RestEasy none of this helped me much. However I corrected my code while looking for the solution.

Based on the answers I did this too

@Path("/user")
public class UserResource implements Serializable {

    private static final long serialVersionUID = 6766329501327292893L;

    @GET
    @Path("/getUser")
    @Produces(MediaType.APPLICATION_JSON)
    public UserWsPojo getUser() {
        UserWsPojo uwp = new UserWsPojo();
        uwp.setName("Aayush");
        uwp.setSurname("Devmurari");
        return uwp;
    }
}

Other things are same as they are, still I am getting the same error.

22:15:58,489 WARN  [org.jboss.resteasy.core.ExceptionHandler] (default task-5) failed to execute: javax.ws.rs.NotFoundException: Could not find resource for full path: http://localhost:8080/admin-ws/services/user/getUsers
    at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.java:73) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:444) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:234) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:171) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) [resteasy-jaxrs-3.0.8.Final.jar:]
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) [resteasy-jaxrs-3.0.8.Final.jar:]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_20]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_20]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_20]

Body:
I've got same issue (NotFound). After debugging, it turned out that I missed the method. (@GET, @POST...) on the controller

@Path("/create")
public Response createObject(){
}
//correct
@GET // or @POST
@Path("/create")
public Response createObject(){
}

ContentLicense: CC BY-SA 4.0


问:
why mybatis update and delete are not working?
I am developing a microservice using myBatis but UPDATE and DELETE statements are not working in it.
Even simple update statements are not executing whenever I execute it just stuck and no response

```<code><update id = "update" parameterType="map">
        UPDATE TESTDB
             SET
                <foreach item = "entry" index = "key" separator = "," collection = "SET">
                     ${key} = #{entry}
                </foreach>

            WHERE
                <foreach item = "entry" index = "key" separator = "AND" collection = "WHERE">
                     ${key} = #{entry}
                </foreach>

    </update>
</code>```

calling function

session.update("test.update",map);

map contains SET and WHERE keys and values as per json request given below

As I am using PUT method so my json request which I am putting in maps such as SET and WHERE.

```<code>{
"data":
[
    {
        "set":
        [
            {
                "ID":"2",
                "NAME":"abc",
                "TYPE":"abc"
            }
        ],
        "where":
        [
          {

                 "NAME":"a",
                 "ID":"1"
          }
        ]
    }
]

}
</code>```

I am getting correct query in logs but when I execute it through POSTMAN I am getting these,
It shows that it's sending and loading and doesn't execute just stuck that it's sending but no response.

This issue is with only delete and update query rest are working fine.

POSTMAN REQUEST SENDING

答:
Thank you @Smile.

I got reason why it was failing. I have created a SqlSession and that session is being used by all operations and that session locks the row(s) which I am trying to update or delete.

Solution:-

Make separate session for all operations.

Check whether session is null or not make it null if it points to
some other previous session and assign new session in it using sqlSessionFactory so that it won't locks the rows(s).

Body:
I am developing a microservice using myBatis but UPDATE and DELETE statements are not working in it.
Even simple update statements are not executing whenever I execute it just stuck and no response

<update id = "update" parameterType="map">
        UPDATE TESTDB
             SET
                <foreach item = "entry" index = "key" separator = "," collection = "SET">
                     ${key} = #{entry}
                </foreach>

            WHERE
                <foreach item = "entry" index = "key" separator = "AND" collection = "WHERE">
                     ${key} = #{entry}
                </foreach>

    </update>

calling function

session.update("test.update",map);

map contains SET and WHERE keys and values as per json request given below

As I am using PUT method so my json request which I am putting in maps such as SET and WHERE.

{
"data":
[
    {
        "set":
        [
            {
                "ID":"2",
                "NAME":"abc",
                "TYPE":"abc"
            }
        ],
        "where":
        [
          {

                 "NAME":"a",
                 "ID":"1"
          }
        ]
    }
]

}

I am getting correct query in logs but when I execute it through POSTMAN I am getting these,
It shows that it's sending and loading and doesn't execute just stuck that it's sending but no response.

This issue is with only delete and update query rest are working fine.

POSTMAN REQUEST SENDING


问:
How to pass an Object Model (that has an Array of Objects Models in it) to API for insert as Params
i am new to angular, trying to make parameters of my object Model, whenever i stringify my object it makes a large string that API does not accept. What should i do..?

here is the object that i want to convert to parameters.

```<code>{
    "qaevaluationid": 1,
    "agentid": 1,
    "callerid": "1234",
    "calledon": "02/13/2020 10:38:14 AM",
    "duration": "304",
    "overallfeedback": "adasdasd",
    "isfatal": false,
    "fatalcallreasonid": "3",
    "evaluationtypeid": "1",
    "callratings": [{
        "callratingid": 1,
        "createdby": 1,
        "createdbyname": "john",
        "createdon": null,
        "evaluationfactorid": 8,
        "is_deleted": "F",
        "modifiedby": -1,
        "modifiedbyname": "",
        "modifiedon": null,
        "qaevaluationid": 1,
        "rating": "7"
    }, {
        "callratingid": 2,
        "createdby": 1,
        "createdbyname": "john",
        "createdon": null,
        "evaluationfactorid": 9,
        "is_deleted": "F",
        "modifiedby": -1,
        "modifiedbyname": "",
        "modifiedon": null,
        "qaevaluationid": 1,
        "rating": "6"
    }, {
        "callratingid": 3,
        "createdby": 1,
        "createdbyname": "john",
        "createdon": null,
        "evaluationfactorid": 10,
        "is_deleted": "F",
        "modifiedby": -1,
        "modifiedbyname": "",
        "modifiedon": null,
        "qaevaluationid": 1,
        "rating": "8"
    }],
    "createdby": 1,
    "createdbyname": "John",
    "createdon": null,
    "modifiedby": -1,
    "modifiedbyname": null,
    "modifiedon": null,
    "is_deleted": "F"
}
</code>```

and in TypeScript i am doing like this

```<code>this.httpOptions.params = new HttpParams();

this.httpOptions.params = this.httpOptions.params.set('qaEval', JSON.stringify(qaevaluation));

return this._httpClient.post<APIResponse<QAEvaluation>>(this.myAppUrl + 'QAEvaluation/insert', { qaEval: qaevaluation }, this.httpOptions)
      .pipe(retry(1), catchError(this.errorHandler));
</code>```

getting this error

"Http failure response for
  https://localhost:44304/QAEvaluation/insert?qaEval=%7B%22qaevaluationid%22:-1,%22agentid%22:1,%22callerid%22:%221234%22,%22calledon%22:%2202/13/2020%2010:38:14%20AM%22,%22duration%22:%22304%22,%22overallfeedback%22:%22adasdasd%22,%22isfatal%22:false
  ……. This goes on and on : 404 OK"

答:
You are on the correct path, but you are adding all the json object as query parameters, on the URL of your request. In POST requests, you want to put your data in the HTTP Body.

I think if you omit the second line you are good to go. Take also a look at the HttpClient documentation for examples and the correct syntax.

Body:
i am new to angular, trying to make parameters of my object Model, whenever i stringify my object it makes a large string that API does not accept. What should i do..?

here is the object that i want to convert to parameters.

{
    "qaevaluationid": 1,
    "agentid": 1,
    "callerid": "1234",
    "calledon": "02/13/2020 10:38:14 AM",
    "duration": "304",
    "overallfeedback": "adasdasd",
    "isfatal": false,
    "fatalcallreasonid": "3",
    "evaluationtypeid": "1",
    "callratings": [{
        "callratingid": 1,
        "createdby": 1,
        "createdbyname": "john",
        "createdon": null,
        "evaluationfactorid": 8,
        "is_deleted": "F",
        "modifiedby": -1,
        "modifiedbyname": "",
        "modifiedon": null,
        "qaevaluationid": 1,
        "rating": "7"
    }, {
        "callratingid": 2,
        "createdby": 1,
        "createdbyname": "john",
        "createdon": null,
        "evaluationfactorid": 9,
        "is_deleted": "F",
        "modifiedby": -1,
        "modifiedbyname": "",
        "modifiedon": null,
        "qaevaluationid": 1,
        "rating": "6"
    }, {
        "callratingid": 3,
        "createdby": 1,
        "createdbyname": "john",
        "createdon": null,
        "evaluationfactorid": 10,
        "is_deleted": "F",
        "modifiedby": -1,
        "modifiedbyname": "",
        "modifiedon": null,
        "qaevaluationid": 1,
        "rating": "8"
    }],
    "createdby": 1,
    "createdbyname": "John",
    "createdon": null,
    "modifiedby": -1,
    "modifiedbyname": null,
    "modifiedon": null,
    "is_deleted": "F"
}

and in TypeScript i am doing like this

this.httpOptions.params = new HttpParams();

this.httpOptions.params = this.httpOptions.params.set('qaEval', JSON.stringify(qaevaluation));

return this._httpClient.post<APIResponse<QAEvaluation>>(this.myAppUrl + 'QAEvaluation/insert', { qaEval: qaevaluation }, this.httpOptions)
      .pipe(retry(1), catchError(this.errorHandler));

getting this error

"Http failure response for
  https://localhost:44304/QAEvaluation/insert?qaEval=%7B%22qaevaluationid%22:-1,%22agentid%22:1,%22callerid%22:%221234%22,%22calledon%22:%2202/13/2020%2010:38:14%20AM%22,%22duration%22:%22304%22,%22overallfeedback%22:%22adasdasd%22,%22isfatal%22:false
  ……. This goes on and on : 404 OK"


问:
Merging of audio and video in iPhone device is not working. In simulator merging of audio and video is taking time in AVAssestTrack initialisation
```<code>func mergeFilesWithUrl(videoUrl:URL, audioUrl:URL) -> AVMutableComposition {

        let mixComposition : AVMutableComposition = AVMutableComposition()
        var mutableCompositionVideoTrack : [AVMutableCompositionTrack] = []
        var mutableCompositionAudioTrack : [AVMutableCompositionTrack] = []
        let totalVideoCompositionInstruction : AVMutableVideoCompositionInstruction = AVMutableVideoCompositionInstruction()

        let aVideoAsset : AVAsset = AVAsset(url: videoUrl)
        let aAudioAsset : AVAsset = AVAsset(url: audioUrl)

        mutableCompositionVideoTrack.append(mixComposition.addMutableTrack(withMediaType: AVMediaType.video, preferredTrackID: kCMPersistentTrackID_Invalid)!)
        mutableCompositionAudioTrack.append( mixComposition.addMutableTrack(withMediaType: AVMediaType.audio, preferredTrackID: kCMPersistentTrackID_Invalid)!)

        let aVideoAssetTrack : AVAssetTrack = aVideoAsset.tracks(withMediaType: AVMediaType.video)[0]
        let aAudioAssetTrack : AVAssetTrack = aAudioAsset.tracks(withMediaType: AVMediaType.audio)[0]

        do{
            try mutableCompositionVideoTrack[0].insertTimeRange(CMTimeRangeMake(kCMTimeZero, aVideoAssetTrack.timeRange.duration), of: aVideoAssetTrack, at: kCMTimeZero)

            try mutableCompositionAudioTrack[0].insertTimeRange(CMTimeRangeMake(kCMTimeZero, aAudioAssetTrack.timeRange.duration), of: aAudioAssetTrack, at: kCMTimeZero)

        }catch{

        }

        totalVideoCompositionInstruction.timeRange = CMTimeRangeMake(kCMTimeZero,aVideoAssetTrack.timeRange.duration )

        let mutableVideoComposition : AVMutableVideoComposition = AVMutableVideoComposition()
        mutableVideoComposition.frameDuration = CMTimeMake(1, 30)

        mutableVideoComposition.renderSize = CGSize(width: 1280,height: 720)

        return mixComposition
}
</code>```

let aVideoAssetTrack : AVAssetTrack = aVideoAsset.tracks(withMediaType: AVMediaType.video)[0] it says array is empty

答:
Completion is not required as given below. I needed the the completion code.</p>
```<code>func mergeFilesWithUrl(videoUrl:URL, audioUrl:URL, completion: @escaping (Bool) -> (Void))
    {
        let mixComposition : AVMutableComposition = AVMutableComposition()
        var mutableCompositionVideoTrack : [AVMutableCompositionTrack] = []
        var mutableCompositionAudioTrack : [AVMutableCompositionTrack] = []
        let totalVideoCompositionInstruction : AVMutableVideoCompositionInstruction = AVMutableVideoCompositionInstruction()

        //start merge
        let aVideoAsset : AVAsset = AVAsset(url: videoUrl)
        let tracksKey = "tracks"
        aVideoAsset.loadValuesAsynchronously(forKeys: [tracksKey], completionHandler: {
            let status = aVideoAsset.statusOfValue(forKey: tracksKey, error: nil)
            if status == AVKeyValueStatus.loaded {
//                let audioTracks : Array<AVAssetTrack> = aVideoAsset.tracks(withMediaType: AVMediaType.audio)

                let aAudioAsset : AVAsset = AVAsset(url: audioUrl)
                aAudioAsset.loadValuesAsynchronously(forKeys: [tracksKey], completionHandler: {
                    let status1 = aAudioAsset.statusOfValue(forKey: tracksKey, error: nil)
                    if status1 == AVKeyValueStatus.loaded {

                        mutableCompositionVideoTrack.append(mixComposition.addMutableTrack(withMediaType: AVMediaType.video, preferredTrackID: kCMPersistentTrackID_Invalid)!)
                        mutableCompositionAudioTrack.append( mixComposition.addMutableTrack(withMediaType: AVMediaType.audio, preferredTrackID: kCMPersistentTrackID_Invalid)!)

                        let aVideoAssetTrack : AVAssetTrack = aVideoAsset.tracks(withMediaType: AVMediaType.video)[0]
                        let aAudioAssetTrack : AVAssetTrack = aAudioAsset.tracks(withMediaType: AVMediaType.audio)[0]

                        do{
                            try mutableCompositionVideoTrack[0].insertTimeRange(CMTimeRangeMake(kCMTimeZero, aVideoAssetTrack.timeRange.duration), of: aVideoAssetTrack, at: kCMTimeZero)

                            //In my case my audio file is longer then video file so i took videoAsset duration
                            //instead of audioAsset duration

                            try mutableCompositionAudioTrack[0].insertTimeRange(CMTimeRangeMake(kCMTimeZero, aAudioAssetTrack.timeRange.duration), of: aAudioAssetTrack, at: kCMTimeZero)

                            //Use this instead above line if your audiofile and video file's playing durations are same

                            //            try mutableCompositionAudioTrack[0].insertTimeRange(CMTimeRangeMake(kCMTimeZero, aVideoAssetTrack.timeRange.duration), ofTrack: aAudioAssetTrack, atTime: kCMTimeZero)

                        }catch{

                        }

                        totalVideoCompositionInstruction.timeRange = CMTimeRangeMake(kCMTimeZero,aVideoAssetTrack.timeRange.duration )

                        let mutableVideoComposition : AVMutableVideoComposition = AVMutableVideoComposition()
                        mutableVideoComposition.frameDuration = CMTimeMake(1, 30)

                        mutableVideoComposition.renderSize = CGSize(width: 1280,height: 720)

                        //        playerItem = AVPlayerItem(asset: mixComposition)
                        //        player = AVPlayer(playerItem: playerItem!)
                        //
                        //
                        //        AVPlayerVC.player = player
                        self.mixComposition = mixComposition // You can use mix composition to play. Ex : self.playerViewController.player = AVPlayer.init(playerItem: AVPlayerItem.init(asset: self.mixComposition!, automaticallyLoadedAssetKeys: nil))
                        _ = completion(true)
                    }
                })
            }
        })
    }
</code>```

Body:
func mergeFilesWithUrl(videoUrl:URL, audioUrl:URL) -> AVMutableComposition {

        let mixComposition : AVMutableComposition = AVMutableComposition()
        var mutableCompositionVideoTrack : [AVMutableCompositionTrack] = []
        var mutableCompositionAudioTrack : [AVMutableCompositionTrack] = []
        let totalVideoCompositionInstruction : AVMutableVideoCompositionInstruction = AVMutableVideoCompositionInstruction()

        let aVideoAsset : AVAsset = AVAsset(url: videoUrl)
        let aAudioAsset : AVAsset = AVAsset(url: audioUrl)

        mutableCompositionVideoTrack.append(mixComposition.addMutableTrack(withMediaType: AVMediaType.video, preferredTrackID: kCMPersistentTrackID_Invalid)!)
        mutableCompositionAudioTrack.append( mixComposition.addMutableTrack(withMediaType: AVMediaType.audio, preferredTrackID: kCMPersistentTrackID_Invalid)!)

        let aVideoAssetTrack : AVAssetTrack = aVideoAsset.tracks(withMediaType: AVMediaType.video)[0]
        let aAudioAssetTrack : AVAssetTrack = aAudioAsset.tracks(withMediaType: AVMediaType.audio)[0]

        do{
            try mutableCompositionVideoTrack[0].insertTimeRange(CMTimeRangeMake(kCMTimeZero, aVideoAssetTrack.timeRange.duration), of: aVideoAssetTrack, at: kCMTimeZero)

            try mutableCompositionAudioTrack[0].insertTimeRange(CMTimeRangeMake(kCMTimeZero, aAudioAssetTrack.timeRange.duration), of: aAudioAssetTrack, at: kCMTimeZero)

        }catch{

        }

        totalVideoCompositionInstruction.timeRange = CMTimeRangeMake(kCMTimeZero,aVideoAssetTrack.timeRange.duration )

        let mutableVideoComposition : AVMutableVideoComposition = AVMutableVideoComposition()
        mutableVideoComposition.frameDuration = CMTimeMake(1, 30)

        mutableVideoComposition.renderSize = CGSize(width: 1280,height: 720)

        return mixComposition
}

let aVideoAssetTrack : AVAssetTrack = aVideoAsset.tracks(withMediaType: AVMediaType.video)[0] it says array is empty

Body:
Completion is not required as given below. I needed the the completion code.

func mergeFilesWithUrl(videoUrl:URL, audioUrl:URL, completion: @escaping (Bool) -> (Void))
    {
        let mixComposition : AVMutableComposition = AVMutableComposition()
        var mutableCompositionVideoTrack : [AVMutableCompositionTrack] = []
        var mutableCompositionAudioTrack : [AVMutableCompositionTrack] = []
        let totalVideoCompositionInstruction : AVMutableVideoCompositionInstruction = AVMutableVideoCompositionInstruction()

        //start merge
        let aVideoAsset : AVAsset = AVAsset(url: videoUrl)
        let tracksKey = "tracks"
        aVideoAsset.loadValuesAsynchronously(forKeys: [tracksKey], completionHandler: {
            let status = aVideoAsset.statusOfValue(forKey: tracksKey, error: nil)
            if status == AVKeyValueStatus.loaded {
//                let audioTracks : Array<AVAssetTrack> = aVideoAsset.tracks(withMediaType: AVMediaType.audio)

                let aAudioAsset : AVAsset = AVAsset(url: audioUrl)
                aAudioAsset.loadValuesAsynchronously(forKeys: [tracksKey], completionHandler: {
                    let status1 = aAudioAsset.statusOfValue(forKey: tracksKey, error: nil)
                    if status1 == AVKeyValueStatus.loaded {

                        mutableCompositionVideoTrack.append(mixComposition.addMutableTrack(withMediaType: AVMediaType.video, preferredTrackID: kCMPersistentTrackID_Invalid)!)
                        mutableCompositionAudioTrack.append( mixComposition.addMutableTrack(withMediaType: AVMediaType.audio, preferredTrackID: kCMPersistentTrackID_Invalid)!)

                        let aVideoAssetTrack : AVAssetTrack = aVideoAsset.tracks(withMediaType: AVMediaType.video)[0]
                        let aAudioAssetTrack : AVAssetTrack = aAudioAsset.tracks(withMediaType: AVMediaType.audio)[0]

                        do{
                            try mutableCompositionVideoTrack[0].insertTimeRange(CMTimeRangeMake(kCMTimeZero, aVideoAssetTrack.timeRange.duration), of: aVideoAssetTrack, at: kCMTimeZero)

                            //In my case my audio file is longer then video file so i took videoAsset duration
                            //instead of audioAsset duration

                            try mutableCompositionAudioTrack[0].insertTimeRange(CMTimeRangeMake(kCMTimeZero, aAudioAssetTrack.timeRange.duration), of: aAudioAssetTrack, at: kCMTimeZero)

                            //Use this instead above line if your audiofile and video file's playing durations are same

                            //            try mutableCompositionAudioTrack[0].insertTimeRange(CMTimeRangeMake(kCMTimeZero, aVideoAssetTrack.timeRange.duration), ofTrack: aAudioAssetTrack, atTime: kCMTimeZero)

                        }catch{

                        }

                        totalVideoCompositionInstruction.timeRange = CMTimeRangeMake(kCMTimeZero,aVideoAssetTrack.timeRange.duration )

                        let mutableVideoComposition : AVMutableVideoComposition = AVMutableVideoComposition()
                        mutableVideoComposition.frameDuration = CMTimeMake(1, 30)

                        mutableVideoComposition.renderSize = CGSize(width: 1280,height: 720)

                        //        playerItem = AVPlayerItem(asset: mixComposition)
                        //        player = AVPlayer(playerItem: playerItem!)
                        //
                        //
                        //        AVPlayerVC.player = player
                        self.mixComposition = mixComposition // You can use mix composition to play. Ex : self.playerViewController.player = AVPlayer.init(playerItem: AVPlayerItem.init(asset: self.mixComposition!, automaticallyLoadedAssetKeys: nil))
                        _ = completion(true)
                    }
                })
            }
        })
    }


问:
How to find the length of mp3 file in golang?
I have an .mp3 file stored on the hard drive. How can I find its length in seconds using go language?

I've found 2 go libraries that are about mp3:

https://godoc.org/github.com/hajimehoshi/go-mp3

https://github.com/tcolgate/mp3

But there are no working examples how to get the mp3 file length in seconds.

答:
You can calculate the duration of each frame and sum them to find the total duration.

Here is the example of this (https://github.com/tcolgate/mp3) library to find the duration:

package main

import (
    "fmt"
    "io"
    "os"

    "github.com/tcolgate/mp3"
)

func main() {
    t := 0.0

    r, err := os.Open("<mp3 file path>")
    if err != nil {
        fmt.Println(err)
        return
    }

    d := mp3.NewDecoder(r)
    var f mp3.Frame
    skipped := 0

    for {

        if err := d.Decode(&f, &skipped); err != nil {
            if err == io.EOF {
                break
            }
            fmt.Println(err)
            return
        }

        t = t + f.Duration().Seconds()
    }

    fmt.Println(t)
}
```


问:
When sorting a Angular Material table can you view the data without modifying it?
Angular Material table utilizes a MatTableDataSource method called sortData() to sort the table's data source. (https://material.angular.io/components/table/api#MatTableDataSource). It is an arrow function:

```<code>sortData: ((data: T[], sort: MatSort) => T[])
</code>```

I need to view the sorted data without actually changing the sort. For example,

```<code>this.dataSource.sortData = (sortData) => {
    console.log(sortData);
    return sortData;
};
</code>```

The problem here is that I am overriding the native sort functionality. return sortData returns the original data, without any sorting. All I want to do is observe the sorted data without modifying it. Is it possible to do this?

答:
Konnichiwa ebakunin,

I have the same issue about the overriding of the native element, and there is an easy way to get the sort data that it wouldn't change the native value of your data.

The first you have to manage to grasp the reference in the Array. All we have to do, make a deep clone. JSON methods are the most compatible to apply this situation without another method called, and there is not any modified with the native-angular method.

cloneDeep (Data:any){
  return JSON.parse(JSON.stringify(Data));
}
```

<p>After that, create the method in dataSource observes the data as you want. As an alternative, you want to customize the special <code>sortData</code> then follow it. Instead of modified directly, return the method called and you will get the easier use and flexible like you don't want to put <code>MatSort</code> in args, just rid it off.</p>

<pre class="lang-js prettyprint-override"><code>constructor(){
  //add the new method of the dataSource.
  this.sortedData.observeSortData = (data : T[],sort: MatSort) : T[] =>{
    let clone_data = this.cloneDeep(data);
    console.log(clone_data.sort((a,b)=> a - b)); // what order you want, place your fomula in your call back
    return this.sortData(data,sort);
  }
}
</code>```

Body:
Angular Material table utilizes a MatTableDataSource method called sortData() to sort the table's data source. (https://material.angular.io/components/table/api#MatTableDataSource). It is an arrow function:

sortData: ((data: T[], sort: MatSort) => T[])

I need to view the sorted data without actually changing the sort. For example,

this.dataSource.sortData = (sortData) => {
    console.log(sortData);
    return sortData;
};

The problem here is that I am overriding the native sort functionality. return sortData returns the original data, without any sorting. All I want to do is observe the sorted data without modifying it. Is it possible to do this?

Body:
Konnichiwa ebakunin,

I have the same issue about the overriding of the native element, and there is an easy way to get the sort data that it wouldn't change the native value of your data.

The first you have to manage to grasp the reference in the Array. All we have to do, make a deep clone. JSON methods are the most compatible to apply this situation without another method called, and there is not any modified with the native-angular method.

cloneDeep (Data:any){
  return JSON.parse(JSON.stringify(Data));
}

After that, create the method in dataSource observes the data as you want. As an alternative, you want to customize the special sortData then follow it. Instead of modified directly, return the method called and you will get the easier use and flexible like you don't want to put MatSort in args, just rid it off.

constructor(){
  //add the new method of the dataSource.
  this.sortedData.observeSortData = (data : T[],sort: MatSort) : T[] =>{
    let clone_data = this.cloneDeep(data);
    console.log(clone_data.sort((a,b)=> a - b)); // what order you want, place your fomula in your call back
    return this.sortData(data,sort);
  }
}


问:
How do you send a null byte to a netcat server?
I have accessed a netcat server using the following command,

```<code>nc [IP] [PORT]
</code>```

I need to send a null byte to the server to unlock a flag. How do I send a null byte.

I tried the following

"\x00"

00000000

And many other variants.

答: Hit the keys "Ctrl + Shift + 2" to send a null byte. </p>

Body:
I have accessed a netcat server using the following command,

nc [IP] [PORT]

I need to send a null byte to the server to unlock a flag. How do I send a null byte.

I tried the following

"\x00"

00000000

And many other variants.


问:
Is this TalkBack path through Xamarin.Android UI expected?
Say I create the following shared XAML:

```<code>        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <Button Grid.Row="0" Text="One" />

            <Grid Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <Button Grid.Column="0" Text="Two First" />
                <Button Grid.Column="1" Text="Two Second" />
            </Grid>

            <Button Grid.Row="2" Text="Three" />

        </Grid>
</code>```

I then run this on an Android device and run the TalkBack screen reader. As I swipe forward through the UI, TalkBack moves from button "One", to button "Three", and then to buttons "Two First" and "Two Second". This doesn't match the order in which I've defined the UI, so is this expected? I get what I consider the expected navigation of moving through the buttons in order of "One"->"Two First"->"Two Second"->"Three", when running the same UI as a Xamarin.UWP app and using the Narrator screen reader.

I've found I can avoid the unexpected TalkBack navigation if I update the UI such that certain parts of the UI are balanced in how deep the UI is defined in the XAML hierarchy. For example, if I wrap button "Three" in a Grid, then I get the expected navigation path.

I can also avoid the unexpected TalkBack navigation if I add a TabIndex to everything that I want TalkBack to reach, but that'll need maintaining as the app UI evolves over time, and as I understand things, not all types of Xamarin.Forms control support TabIndex.

答:
not sure if it's a problem from designs of Grid .From shared code , I think Grid maybe set the second Row as the low level of priority .Because the second Row define the Column individually .

If that is the logic about the design of Grid . You can have a try with define the Row and Column at the same level of priority .

Code as follow :

```<code><Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="*" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>

    <Button Grid.Row="0"
            Grid.ColumnSpan="2"
            Text="One" />

    <Button Grid.Row="1"
            Grid.Column="0"
            Text="Two First" />

    <Button Grid.Row="1"
            Grid.Column="1"
            Text="Two Second" />

    <Button Grid.Row="2"
            Grid.Column="0"
            Grid.ColumnSpan="2"
            Text="Three" />
</Grid>
</code>```

Body:
Say I create the following shared XAML:

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <Button Grid.Row="0" Text="One" />

            <Grid Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <Button Grid.Column="0" Text="Two First" />
                <Button Grid.Column="1" Text="Two Second" />
            </Grid>

            <Button Grid.Row="2" Text="Three" />

        </Grid>

I then run this on an Android device and run the TalkBack screen reader. As I swipe forward through the UI, TalkBack moves from button "One", to button "Three", and then to buttons "Two First" and "Two Second". This doesn't match the order in which I've defined the UI, so is this expected? I get what I consider the expected navigation of moving through the buttons in order of "One"->"Two First"->"Two Second"->"Three", when running the same UI as a Xamarin.UWP app and using the Narrator screen reader.

I've found I can avoid the unexpected TalkBack navigation if I update the UI such that certain parts of the UI are balanced in how deep the UI is defined in the XAML hierarchy. For example, if I wrap button "Three" in a Grid, then I get the expected navigation path.

I can also avoid the unexpected TalkBack navigation if I add a TabIndex to everything that I want TalkBack to reach, but that'll need maintaining as the app UI evolves over time, and as I understand things, not all types of Xamarin.Forms control support TabIndex.

Body:
not sure if it's a problem from designs of Grid .From shared code , I think Grid maybe set the second Row as the low level of priority .Because the second Row define the Column individually .

If that is the logic about the design of Grid . You can have a try with define the Row and Column at the same level of priority .

Code as follow :

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="*" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>

    <Button Grid.Row="0"
            Grid.ColumnSpan="2"
            Text="One" />

    <Button Grid.Row="1"
            Grid.Column="0"
            Text="Two First" />

    <Button Grid.Row="1"
            Grid.Column="1"
            Text="Two Second" />

    <Button Grid.Row="2"
            Grid.Column="0"
            Grid.ColumnSpan="2"
            Text="Three" />
</Grid>


问:
How to get the value from the input
I am trying to catch a change of input but it doesn't work with the button increase or decrease the value, what is the solution here?</p>

```<code><div class="container">
          <button id="tang" class="btn btn-success">+</button>
          <input type="text"  name="" id="number" value="1"">
          <button id="giam" class="btn btn-danger">-</button>
          <h1 id="show"></h1>
      </div>
</code>```

```<code>$("#tang").click(function(){
            let result = parseInt($("#number").val()) +1 ;
            $("#number").val(result);
        });
        $("#giam").click(function(){
            let result = parseInt($("#number").val()) -1 ;
            $("#number").val(result);
        });

        $("#number").change(function(){
            $("#show").text($("#number").val());
        })
</code>```

答:
Please refer below code. You will need to trigger change event from increase and decrease button change.

$("#tang").click(function() {
  let result = parseInt($("#number").val()) + 1;
  $("#number").val(result).change();
});
$("#giam").click(function() {
  let result = parseInt($("#number").val()) - 1;
   $("#number").val(result).change();
});

$("#number").change(function() {
  $("#show").html($("#number").val());
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="container">
          <button id="tang" class="btn btn-success">+</button>
          <input type="text"  name="" id="number" value="1"">
          <button id="giam" class="btn btn-danger">-</button>
          <h1 id="show"></h1>
      </div></code>```

Title: How to get the value from the input

Body:
I am trying to catch a change of input but it doesn't work with the button increase or decrease the value, what is the solution here?

          <button id="tang" class="btn btn-success">+</button>
          <input type="text"  name="" id="number" value="1"">
          <button id="giam" class="btn btn-danger">-</button>

$("#tang").click(function(){
            let result = parseInt($("#number").val()) +1 ;
            $("#number").val(result);
        });
        $("#giam").click(function(){
            let result = parseInt($("#number").val()) -1 ;
            $("#number").val(result);
        });

        $("#number").change(function(){
            $("#show").text($("#number").val());
        })

Body:
Please refer below code. You will need to trigger change event from increase and decrease button change.

$("#tang").click(function() {
  let result = parseInt($("#number").val()) + 1;
  $("#number").val(result).change();
});
$("#giam").click(function() {
  let result = parseInt($("#number").val()) - 1;
   $("#number").val(result).change();
});

$("#number").change(function() {
  $("#show").html($("#number").val());
});

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="container">
          <button id="tang" class="btn btn-success">+</button>
          <input type="text"  name="" id="number" value="1"">
          <button id="giam" class="btn btn-danger">-</button>
          <h1 id="show"></h1>
      </div>


问:
Build Fails: `npm rebuild node-sass --force`
Using n to switch Node versions.
I've ran yarn, npm rebuild node-sass --force many many times. And still fails. Getting this error:

Node Sass could not find a binding for your current environment

```<code>This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass --force` to build the binding for your current environment.
</code>```

Anyone have any idea how to fix?

Also..
When running this command..

```<code>npm rebuild node-sass --force
</code>```

I get..

```<code>npm WARN using --force I sure hope you know what you are doing.
</code>```

Doens't seem like it is doing anything..

答:
The main issue is that your node-sass and node-npm versions are incompatible.

Please see the chart on this site or on this.

So my suggestion is either adjust your node-npm version or adjust node-sass.

In my case I was using node-sassof version 4.9.4 with node version 8.12.0 and npm version 6.4.1, It was working fine without any issue, later on I got new system and I had installed the latest node(12.16.0) & npm(6.13.4) and issue started so I dug into this and found above links.

Hope this will help you.

Body:
Using n to switch Node versions.
I've ran yarn, npm rebuild node-sass --force many many times. And still fails. Getting this error:

Node Sass could not find a binding for your current environment

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass --force` to build the binding for your current environment.

Anyone have any idea how to fix?

Also..
When running this command..

npm rebuild node-sass --force

I get..

npm WARN using --force I sure hope you know what you are doing.

Doens't seem like it is doing anything..


问:
Adding allowVolumeExpansion: true to default storage classes in AKS
The documentation says the following:

These default storage classes don't allow you to update the volume size once created. To enable this ability, add the allowVolumeExpansion: true line to one of the default storage classes, or create you own custom storage class. You can edit an existing storage class using the kubectl edit sc command. For more information on storage classes and creating your own, see Storage options for applications in AKS.

I've tried editing the the default YAML (which just looks like JSON and not YAML) in the Kubernetes dashboard:

```<code>{
  "kind": "StorageClass",
  "apiVersion": "storage.k8s.io/v1",
  "metadata": {
    "name": "default",
    "selfLink": "/apis/storage.k8s.io/v1/storageclasses/default",
    "uid": "<uid>",
    "resourceVersion": "3891497",
    "creationTimestamp": "2020-02-14T01:34:03Z",
    "labels": {
      "kubernetes.io/cluster-service": "true"
    },
    "annotations": {
      "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"storage.k8s.io/v1beta1\",\"kind\":\"StorageClass\",\"metadata\":{\"annotations\":{\"storageclass.beta.kubernetes.io/is-default-class\":\"true\"},\"labels\":{\"kubernetes.io/cluster-service\":\"true\"},\"name\":\"default\"},\"parameters\":{\"cachingmode\":\"ReadOnly\",\"kind\":\"Managed\",\"storageaccounttype\":\"Standard_LRS\"},\"provisioner\":\"kubernetes.io/azure-disk\"}\n",
      "storageclass.beta.kubernetes.io/is-default-class": "true"
    }
  },
  "provisioner": "kubernetes.io/azure-disk",
  "parameters": {
    "cachingmode": "ReadOnly",
    "kind": "Managed",
    "storageaccounttype": "Standard_LRS"
  },
  "reclaimPolicy": "Delete",
  "volumeBindingMode": "Immediate",
  "allowVolumeExpansion": "true"
}
</code>```

Which results in:

```<code>StorageClass in version "v1" cannot be handled as a StorageClass: v1.StorageClass.AllowVolumeExpansion: ReadBool: expect t or f, but found ", error found in #10 byte of ...|ansion": "true" }|..., bigger context ...|ingMode": "Immediate", "allowVolumeExpansion": "true" }|...
</code>```

Also:

```<code>{
  "kind": "StorageClass",
  "apiVersion": "storage.k8s.io/v1",
  "metadata": {
    "name": "default",
    "selfLink": "/apis/storage.k8s.io/v1/storageclasses/default",
    "uid": "<uid>",
    "resourceVersion": "3891497",
    "creationTimestamp": "2020-02-14T01:34:03Z",
    "labels": {
      "kubernetes.io/cluster-service": "true"
    },
    "annotations": {
      "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"storage.k8s.io/v1beta1\",\"kind\":\"StorageClass\",\"metadata\":{\"annotations\":{\"storageclass.beta.kubernetes.io/is-default-class\":\"true\"},\"labels\":{\"kubernetes.io/cluster-service\":\"true\"},\"name\":\"default\"},\"parameters\":{\"cachingmode\":\"ReadOnly\",\"kind\":\"Managed\",\"storageaccounttype\":\"Standard_LRS\"},\"provisioner\":\"kubernetes.io/azure-disk\"}\n",
      "storageclass.beta.kubernetes.io/is-default-class": "true"
    }
  },
  "provisioner": "kubernetes.io/azure-disk",
  "parameters": {
    "cachingmode": "ReadOnly",
    "kind": "Managed",
    "storageaccounttype": "Standard_LRS",
    "allowVolumeExpansion": "true"
  },
  "reclaimPolicy": "Delete",
  "volumeBindingMode": "Immediate"
}
</code>```

Which results in:

```<code>StorageClass.storage.k8s.io "default" is invalid: parameters: Forbidden: updates to parameters are forbidden.
</code>```

Also tried all of the following with kubectl edit sc:

```<code>$ kubectl edit sc default allowVolumeExpansion: true
Error from server (NotFound): storageclasses.storage.k8s.io "allowVolumeExpansion:" not found
Error from server (NotFound): storageclasses.storage.k8s.io "true" not found

$ kubectl edit sc default "allowVolumeExpansion: true"
Error from server (NotFound): storageclasses.storage.k8s.io "allowVolumeExpansion: true" not found

$ kubectl edit sc/default allowVolumeExpansion: true
error: there is no need to specify a resource type as a separate argument when passing arguments in resource/name form (e.g. 'kubectl get resource/<resource_name>' instead of 'kubectl get resource resource/<resource_name>'

$ kubectl edit sc/default "allowVolumeExpansion: true"
error: there is no need to specify a resource type as a separate argument when passing arguments in resource/name form (e.g. 'kubectl get resource/<resource_name>' instead of 'kubectl get resource resource/<resource_name>'
</code>```

What is the correct way of accomplishing this? Would be helpful if an example was in the documentation.

答:
I do not meet the issue you got. The allowVolumeExpansion is a property of the storage class, not the parameter and it requires the boolean value. You can see it in StorageClass.

I think you mistake setting its value. In my test, I add the property in the YAML file like this:

```<code>allowVolumeExpansion: true
</code>```

Not

```<code>allowVolumeExpansion: "true"
</code>```

So I think you need to change the line into this:

```<code>"allowVolumeExpansion": true
</code>```

Body:
The documentation says the following:

These default storage classes don't allow you to update the volume size once created. To enable this ability, add the allowVolumeExpansion: true line to one of the default storage classes, or create you own custom storage class. You can edit an existing storage class using the kubectl edit sc command. For more information on storage classes and creating your own, see Storage options for applications in AKS.

I've tried editing the the default YAML (which just looks like JSON and not YAML) in the Kubernetes dashboard:

{
  "kind": "StorageClass",
  "apiVersion": "storage.k8s.io/v1",
  "metadata": {
    "name": "default",
    "selfLink": "/apis/storage.k8s.io/v1/storageclasses/default",
    "uid": "<uid>",
    "resourceVersion": "3891497",
    "creationTimestamp": "2020-02-14T01:34:03Z",
    "labels": {
      "kubernetes.io/cluster-service": "true"
    },
    "annotations": {
      "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"storage.k8s.io/v1beta1\",\"kind\":\"StorageClass\",\"metadata\":{\"annotations\":{\"storageclass.beta.kubernetes.io/is-default-class\":\"true\"},\"labels\":{\"kubernetes.io/cluster-service\":\"true\"},\"name\":\"default\"},\"parameters\":{\"cachingmode\":\"ReadOnly\",\"kind\":\"Managed\",\"storageaccounttype\":\"Standard_LRS\"},\"provisioner\":\"kubernetes.io/azure-disk\"}\n",
      "storageclass.beta.kubernetes.io/is-default-class": "true"
    }
  },
  "provisioner": "kubernetes.io/azure-disk",
  "parameters": {
    "cachingmode": "ReadOnly",
    "kind": "Managed",
    "storageaccounttype": "Standard_LRS"
  },
  "reclaimPolicy": "Delete",
  "volumeBindingMode": "Immediate",
  "allowVolumeExpansion": "true"
}

Which results in:

StorageClass in version "v1" cannot be handled as a StorageClass: v1.StorageClass.AllowVolumeExpansion: ReadBool: expect t or f, but found ", error found in #10 byte of ...|ansion": "true" }|..., bigger context ...|ingMode": "Immediate", "allowVolumeExpansion": "true" }|...

Also:

{
  "kind": "StorageClass",
  "apiVersion": "storage.k8s.io/v1",
  "metadata": {
    "name": "default",
    "selfLink": "/apis/storage.k8s.io/v1/storageclasses/default",
    "uid": "<uid>",
    "resourceVersion": "3891497",
    "creationTimestamp": "2020-02-14T01:34:03Z",
    "labels": {
      "kubernetes.io/cluster-service": "true"
    },
    "annotations": {
      "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"storage.k8s.io/v1beta1\",\"kind\":\"StorageClass\",\"metadata\":{\"annotations\":{\"storageclass.beta.kubernetes.io/is-default-class\":\"true\"},\"labels\":{\"kubernetes.io/cluster-service\":\"true\"},\"name\":\"default\"},\"parameters\":{\"cachingmode\":\"ReadOnly\",\"kind\":\"Managed\",\"storageaccounttype\":\"Standard_LRS\"},\"provisioner\":\"kubernetes.io/azure-disk\"}\n",
      "storageclass.beta.kubernetes.io/is-default-class": "true"
    }
  },
  "provisioner": "kubernetes.io/azure-disk",
  "parameters": {
    "cachingmode": "ReadOnly",
    "kind": "Managed",
    "storageaccounttype": "Standard_LRS",
    "allowVolumeExpansion": "true"
  },
  "reclaimPolicy": "Delete",
  "volumeBindingMode": "Immediate"
}

Which results in:

StorageClass.storage.k8s.io "default" is invalid: parameters: Forbidden: updates to parameters are forbidden.

Also tried all of the following with kubectl edit sc:

$ kubectl edit sc default allowVolumeExpansion: true
Error from server (NotFound): storageclasses.storage.k8s.io "allowVolumeExpansion:" not found
Error from server (NotFound): storageclasses.storage.k8s.io "true" not found

$ kubectl edit sc default "allowVolumeExpansion: true"
Error from server (NotFound): storageclasses.storage.k8s.io "allowVolumeExpansion: true" not found

$ kubectl edit sc/default allowVolumeExpansion: true
error: there is no need to specify a resource type as a separate argument when passing arguments in resource/name form (e.g. 'kubectl get resource/<resource_name>' instead of 'kubectl get resource resource/<resource_name>'

$ kubectl edit sc/default "allowVolumeExpansion: true"
error: there is no need to specify a resource type as a separate argument when passing arguments in resource/name form (e.g. 'kubectl get resource/<resource_name>' instead of 'kubectl get resource resource/<resource_name>'

What is the correct way of accomplishing this? Would be helpful if an example was in the documentation.

Body:
I do not meet the issue you got. The allowVolumeExpansion is a property of the storage class, not the parameter and it requires the boolean value. You can see it in StorageClass.

I think you mistake setting its value. In my test, I add the property in the YAML file like this:

allowVolumeExpansion: true

Not

allowVolumeExpansion: "true"

So I think you need to change the line into this:

"allowVolumeExpansion": true


问:
Firebase messaging service worker click handler doesn't work
I am using FCM to handle push notifications, but notification is coming in data key instead of notification.

Here is the code I am using to handle new message and show as notification.
I am seeing notification with all options and data as I specified. However, when I click notification, it doesn't fire any "notificationclick" event. It also doesn't print event.notification.

```<code>importScripts('https://www.gstatic.com/firebasejs/5.3.1/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/5.3.1/firebase-messaging.js');

firebase.initializeApp({
    messagingSenderId: "SOME_ID",
});

const messaging = firebase.messaging();

messaging.setBackgroundMessageHandler(payload => {
    console.log(payload);
    const options = {
        body: payload.data.body,
        icon: payload.data.icon,
        click_action: payload.data.click_action,
        link: payload.data.link,
        data: {
            time: new Date(Date.now()).toString(),
            click_action: payload.data.click_action,
        },
    };

    self.registration.showNotification(payload.data.title, options);

});

self.addEventListener("notificationclick", function(event) {
    console.log(event.notification);
    const clickedNotification = event.notification;
    clickedNotification.close();

    const urlToOpen = clickedNotification.data && clickedNotification.data.click_action;

    const promiseChain =  clients.matchAll({
        type: 'window',
        includeUncontrolled: true,
    })
        .then((windowClients) => {
            let matchingClient = null;

            for (let i = 0; i < windowClients.length; i++) {
                const windowClient = windowClients[i];
                if (windowClient.url === urlToOpen) {
                    matchingClient = windowClient;
                    break;
                }
            }

            if (matchingClient) {
                return matchingClient.focus();
            } else {
                return clients.openWindow(urlToOpen);
            }
        });

    event.waitUntil(promiseChain);

});
</code>```

答:
1 you can check with your firebase-messaging-sw.js file in the application whether the recent changes are in that file after the build.

2 we only need the most recent changes in firebase-messaging-sw.js, so need to check and most recent updated firebase-messaging-sw.js file and unregister all older firebase-messaging-sw.js.

it worked for me.

Body:
I am using FCM to handle push notifications, but notification is coming in data key instead of notification.

Here is the code I am using to handle new message and show as notification.
I am seeing notification with all options and data as I specified. However, when I click notification, it doesn't fire any "notificationclick" event. It also doesn't print event.notification.

importScripts('https://www.gstatic.com/firebasejs/5.3.1/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/5.3.1/firebase-messaging.js');

firebase.initializeApp({
    messagingSenderId: "SOME_ID",
});

const messaging = firebase.messaging();

messaging.setBackgroundMessageHandler(payload => {
    console.log(payload);
    const options = {
        body: payload.data.body,
        icon: payload.data.icon,
        click_action: payload.data.click_action,
        link: payload.data.link,
        data: {
            time: new Date(Date.now()).toString(),
            click_action: payload.data.click_action,
        },
    };

    self.registration.showNotification(payload.data.title, options);

});

self.addEventListener("notificationclick", function(event) {
    console.log(event.notification);
    const clickedNotification = event.notification;
    clickedNotification.close();

    const urlToOpen = clickedNotification.data && clickedNotification.data.click_action;

    const promiseChain =  clients.matchAll({
        type: 'window',
        includeUncontrolled: true,
    })
        .then((windowClients) => {
            let matchingClient = null;

            for (let i = 0; i < windowClients.length; i++) {
                const windowClient = windowClients[i];
                if (windowClient.url === urlToOpen) {
                    matchingClient = windowClient;
                    break;
                }
            }

            if (matchingClient) {
                return matchingClient.focus();
            } else {
                return clients.openWindow(urlToOpen);
            }
        });

    event.waitUntil(promiseChain);

});


问:
How do I "clean" a String in PHP using regex?
For example suppose I have

```<code>$blah = "C$#@#.a534&";
</code>```

I wish to filter the string so that only letters, numbers and "." remain yielding "C.a534"

How do I do this?

答:
you can use preg_replace

```<code>$text = preg_replace('/[' . preg_quote('CHARSYOUDONTWANT','/') .  ']/','',$text);
</code>```

on other case for only chars you want try this,

```<code>$text = preg_replace('/[^' . preg_quote('CHARSONLYYOUWANT','/') .  ']/','',$text);
</code>```

for example

```<code>$blah = "C$#@#.a534&";
$blah = preg_replace('/[' . preg_quote('$#@&','/') . ']/','',$blah);
echo $blah;
</code>```

Body:
For example suppose I have

$blah = "C$#@#.a534&";

I wish to filter the string so that only letters, numbers and "." remain yielding "C.a534"

How do I do this?

Body:
you can use preg_replace

$text = preg_replace('/[' . preg_quote('CHARSYOUDONTWANT','/') .  ']/','',$text);

on other case for only chars you want try this,

$text = preg_replace('/[^' . preg_quote('CHARSONLYYOUWANT','/') .  ']/','',$text);

for example

$blah = "C$#@#.a534&";
$blah = preg_replace('/[' . preg_quote('$#@&','/') . ']/','',$blah);
echo $blah;


问:
Scroll page to the nested React component on a button click
I've got a React Component with several nested components. For page navigation I have a few buttons on the top.
The question is, how to scroll the page to the nested react component when a certain button is clicked, is it possible to do so without using jquery libs?</p>

```<code>  render() {
    return (
      <div>
        <button onClick={(e) => { console.log('Scrolling to Item 1');}}>Button0</button>
        <button onClick={(e) => { console.log('Scrolling to Item 2');}}>Button1</button>
          <Layout>
            <Item>
              <Content>
            ...
              </Content>
            </Item>

            <Item>
              <Content>
            ...
              </Content>
            </Item>

          </Layout>
        }
      </div>
    );
  }
</code>```

答:
you can use react-scroll
npm install react-scroll --save

and for information can go to this page
https://www.npmjs.com/package/react-scroll

Body:
I've got a React Component with several nested components. For page navigation I have a few buttons on the top.
The question is, how to scroll the page to the nested react component when a certain button is clicked, is it possible to do so without using jquery libs?

  render() {
    return (

        <button onClick={(e) => { console.log('Scrolling to Item 1');}}>Button0</button>
        <button onClick={(e) => { console.log('Scrolling to Item 2');}}>Button1</button>
          <Layout>
            <Item>
              <Content>
            ...
              </Content>
            </Item>

            <Item>
              <Content>
            ...
              </Content>
            </Item>

          </Layout>
        }

    );
  }


问:
Duplicate client-side files in solution explorer with Visual Studio for Mac
Using dotnet cli v2.1.4 I downloaded the Spa templates using dotnet new --install Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0. I then created an angular project using dotnet new angular -o my-project. I then opened Visual Studio for Mac and opened the .csproj file generated by the cli for the aforementioned project. The solution was rendered but sadly the client side files were all duplicated even though only one copy of each file appears in the finder or using ls in the directory. I found serveral threads with related issues that advised unloading the project, etc. I tried these solutions but sadly the issue remains, see attached picture. Server side files are not duplicated.

答:
I had the following in my .csproj file, removing it fixed for me:</p>

```<code><ItemGroup>
    <None Include="**/*" />
</ItemGroup>
</code>```

Body:
I had the following in my .csproj file, removing it fixed for me:

<ItemGroup>
    <None Include="**/*" />
</ItemGroup>


问:
Do companies have their own instance of Ariba?
I have some basic questions on SAP Ariba. From what I understand, Ariba network has million of suppliers and buyers can search for their requirements on this ariba network. So looks like there would be one global Ariba cloud based hosted website, which all customers(both buyers and suppliers) would use.

But, my Ariba knowledgeable colleague was saying that companies have their own instance of Ariba and in this instance they feed their suppliers, but this sounds very counter-intuitive. If companies manage their own suppliers, then they are not using the millions of suppliers who are listed with ariba network. Why would company want to maintain their own Ariba instance?. Is it for buying processes streamlining feature that Ariba provides, and they are not interested in dealing with all the suppliers registered with Ariba network?.

If I should be asking this question on some other stack exchange site, please let me know.

答:
Hi Ariba Network can be used when you decide buy from you non incumbent supplier which are already registered in Ariba network in this case you have send the trading relation to your supplier in network and then start transactions with the new supplier which you selected from Ariba Network.
Hope I have clarified your doubts.</p>


问:
Spark Avro throws exception on file write: NoSuchMethodError
Any file write attempt of Avro format fails with the stack trace below.

We are using Spark 2.4.3 (with user provided Hadoop), Scala 2.12, and we load the Avro package at runtime with either spark-shell:

spark-shell --packages org.apache.spark:spark-avro_2.12:2.4.3

or spark-submit:

spark-submit --packages org.apache.spark:spark-avro_2.12:2.4.3 ...

The spark Session reports loading the Avro package successfully.

... in either case, the moment we attempt to write any data to an avro format, like:

```<code>df.write.format("avro").save("hdfs:///path/to/outputfile.avro")
</code>```

or with a select:

```<code>df.select("recordidstring").write.format("avro").save("hdfs:///path/to/outputfile.avro")
</code>```

... produces the same stacktrace error (this copy from spark-shell):

```<code>java.lang.NoSuchMethodError: org.apache.avro.Schema.createUnion([Lorg/apache/avro/Schema;)Lorg/apache/avro/Schema;
  at org.apache.spark.sql.avro.SchemaConverters$.toAvroType(SchemaConverters.scala:185)
  at org.apache.spark.sql.avro.SchemaConverters$.$anonfun$toAvroType$1(SchemaConverters.scala:176)
  at scala.collection.Iterator.foreach(Iterator.scala:941)
  at scala.collection.Iterator.foreach$(Iterator.scala:941)
  at scala.collection.AbstractIterator.foreach(Iterator.scala:1429)
  at scala.collection.IterableLike.foreach(IterableLike.scala:74)
  at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
  at org.apache.spark.sql.types.StructType.foreach(StructType.scala:99)
  at org.apache.spark.sql.avro.SchemaConverters$.toAvroType(SchemaConverters.scala:174)
  at org.apache.spark.sql.avro.AvroFileFormat.$anonfun$prepareWrite$2(AvroFileFormat.scala:119)
  at scala.Option.getOrElse(Option.scala:138)
  at org.apache.spark.sql.avro.AvroFileFormat.prepareWrite(AvroFileFormat.scala:118)
  at org.apache.spark.sql.execution.datasources.FileFormatWriter$.write(FileFormatWriter.scala:103)
  at org.apache.spark.sql.execution.datasources.InsertIntoHadoopFsRelationCommand.run(InsertIntoHadoopFsRelationCommand.scala:170)
  at org.apache.spark.sql.execution.command.DataWritingCommandExec.sideEffectResult$lzycompute(commands.scala:104)
  at org.apache.spark.sql.execution.command.DataWritingCommandExec.sideEffectResult(commands.scala:102)
  at org.apache.spark.sql.execution.command.DataWritingCommandExec.doExecute(commands.scala:122)
  at org.apache.spark.sql.execution.SparkPlan.$anonfun$execute$1(SparkPlan.scala:131)
  at org.apache.spark.sql.execution.SparkPlan.$anonfun$executeQuery$1(SparkPlan.scala:155)
  at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
  at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:152)
  at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:127)
  at org.apache.spark.sql.execution.QueryExecution.toRdd$lzycompute(QueryExecution.scala:80)
  at org.apache.spark.sql.execution.QueryExecution.toRdd(QueryExecution.scala:80)
  at org.apache.spark.sql.DataFrameWriter.$anonfun$runCommand$1(DataFrameWriter.scala:676)
  at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$1(SQLExecution.scala:78)
  at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:125)
  at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:73)
  at org.apache.spark.sql.DataFrameWriter.runCommand(DataFrameWriter.scala:676)
  at org.apache.spark.sql.DataFrameWriter.saveToV1Source(DataFrameWriter.scala:290)
  at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:271)
  at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:229)
</code>```

We are able to write other formats (text-delimited, json, ORC, parquet) without any trouble.

We are using HDFS (Hadoop v3.1.2) as the filestore.

I have experimented with different package versions of Avro (e.g. 2.11, lower) which either raises the same error or fails to load entirely due to incompatibility.  This error occurs with all of Python, Scala (using shell or spark-submit) and Java (using spark-submit).

There appears to be an Open Issue on apache.org JIRA for this, but this is a year old now without any resolution.  I've bumped that issue, but also wondering if the community had a fix?  Any help much appreciated.

答:
Based on a comment in the linked error, you should specify avro with at least 1.8.0 version, something like this:

```<code>spark-submit --packages org.apache.spark:spark-avro_2.12:2.4.3,org.apache.avro:avro:1.9.2 ...
</code>```

(You might want to try with the other order too.)

Body:
Any file write attempt of Avro format fails with the stack trace below.

We are using Spark 2.4.3 (with user provided Hadoop), Scala 2.12, and we load the Avro package at runtime with either spark-shell:

spark-shell --packages org.apache.spark:spark-avro_2.12:2.4.3

or spark-submit:

spark-submit --packages org.apache.spark:spark-avro_2.12:2.4.3 ...

The spark Session reports loading the Avro package successfully.

... in either case, the moment we attempt to write any data to an avro format, like:

df.write.format("avro").save("hdfs:///path/to/outputfile.avro")

or with a select:

df.select("recordidstring").write.format("avro").save("hdfs:///path/to/outputfile.avro")

... produces the same stacktrace error (this copy from spark-shell):

java.lang.NoSuchMethodError: org.apache.avro.Schema.createUnion([Lorg/apache/avro/Schema;)Lorg/apache/avro/Schema;
  at org.apache.spark.sql.avro.SchemaConverters$.toAvroType(SchemaConverters.scala:185)
  at org.apache.spark.sql.avro.SchemaConverters$.$anonfun$toAvroType$1(SchemaConverters.scala:176)
  at scala.collection.Iterator.foreach(Iterator.scala:941)
  at scala.collection.Iterator.foreach$(Iterator.scala:941)
  at scala.collection.AbstractIterator.foreach(Iterator.scala:1429)
  at scala.collection.IterableLike.foreach(IterableLike.scala:74)
  at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
  at org.apache.spark.sql.types.StructType.foreach(StructType.scala:99)
  at org.apache.spark.sql.avro.SchemaConverters$.toAvroType(SchemaConverters.scala:174)
  at org.apache.spark.sql.avro.AvroFileFormat.$anonfun$prepareWrite$2(AvroFileFormat.scala:119)
  at scala.Option.getOrElse(Option.scala:138)
  at org.apache.spark.sql.avro.AvroFileFormat.prepareWrite(AvroFileFormat.scala:118)
  at org.apache.spark.sql.execution.datasources.FileFormatWriter$.write(FileFormatWriter.scala:103)
  at org.apache.spark.sql.execution.datasources.InsertIntoHadoopFsRelationCommand.run(InsertIntoHadoopFsRelationCommand.scala:170)
  at org.apache.spark.sql.execution.command.DataWritingCommandExec.sideEffectResult$lzycompute(commands.scala:104)
  at org.apache.spark.sql.execution.command.DataWritingCommandExec.sideEffectResult(commands.scala:102)
  at org.apache.spark.sql.execution.command.DataWritingCommandExec.doExecute(commands.scala:122)
  at org.apache.spark.sql.execution.SparkPlan.$anonfun$execute$1(SparkPlan.scala:131)
  at org.apache.spark.sql.execution.SparkPlan.$anonfun$executeQuery$1(SparkPlan.scala:155)
  at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
  at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:152)
  at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:127)
  at org.apache.spark.sql.execution.QueryExecution.toRdd$lzycompute(QueryExecution.scala:80)
  at org.apache.spark.sql.execution.QueryExecution.toRdd(QueryExecution.scala:80)
  at org.apache.spark.sql.DataFrameWriter.$anonfun$runCommand$1(DataFrameWriter.scala:676)
  at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$1(SQLExecution.scala:78)
  at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:125)
  at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:73)
  at org.apache.spark.sql.DataFrameWriter.runCommand(DataFrameWriter.scala:676)
  at org.apache.spark.sql.DataFrameWriter.saveToV1Source(DataFrameWriter.scala:290)
  at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:271)
  at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:229)

We are able to write other formats (text-delimited, json, ORC, parquet) without any trouble.

We are using HDFS (Hadoop v3.1.2) as the filestore.

I have experimented with different package versions of Avro (e.g. 2.11, lower) which either raises the same error or fails to load entirely due to incompatibility.  This error occurs with all of Python, Scala (using shell or spark-submit) and Java (using spark-submit).

There appears to be an Open Issue on apache.org JIRA for this, but this is a year old now without any resolution.  I've bumped that issue, but also wondering if the community had a fix?  Any help much appreciated.

Body:
Based on a comment in the linked error, you should specify avro with at least 1.8.0 version, something like this:

spark-submit --packages org.apache.spark:spark-avro_2.12:2.4.3,org.apache.avro:avro:1.9.2 ...

(You might want to try with the other order too.)