问:
spring lemon - getting AccessDeniedException on email verification
I am using spring lemon and a reactjs app on the client side. I successfully register a new user, and when the user clicks the email link he is redirected to a screen in the react app which sends a POST request to the /api/users/verify url. At this point I am getting the AccessDeniedException. These are the logs:</p>

```<code>2017-06-05 09:15:59.780 DEBUG 27852 --- [nio-8080-exec-8] c.n.s.l.s.LemonTokenAuthenticationFilter : Inside LemonTokenAuthenticationFilter ...
2017-06-05 09:15:59.780 DEBUG 27852 --- [nio-8080-exec-8] c.n.s.l.s.LemonTokenAuthenticationFilter : Token authentication skipped
2017-06-05 09:15:59.821 DEBUG 27852 --- [nio-8080-exec-8] c.n.spring.lemon.LemonController         : Verifying user ...
2017-06-05 09:15:59.822 DEBUG 27852 --- [nio-8080-exec-8] o.s.s.a.i.a.MethodSecurityInterceptor    : Secure object: ReflectiveMethodInvocation: public void com.naturalprogrammer.spring.lemon.LemonService.verifyUser(java.lang.String); target is of class [com.speakez.iqr.server.services.MyService]; Attributes: [[authorize: 'isAuthenticated()', filter: 'null', filterTarget: 'null']]
2017-06-05 09:15:59.823 DEBUG 27852 --- [nio-8080-exec-8] o.s.s.a.i.a.MethodSecurityInterceptor    : Previously Authenticated: org.springframework.security.authentication.AnonymousAuthenticationToken@9055e4a6: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS
2017-06-05 09:15:59.823 DEBUG 27852 --- [nio-8080-exec-8] o.s.s.access.vote.AffirmativeBased       : Voter: org.springframework.security.access.prepost.PreInvocationAuthorizationAdviceVoter@5d08811f, returned: -1
2017-06-05 09:15:59.823 DEBUG 27852 --- [nio-8080-exec-8] o.s.s.access.vote.AffirmativeBased       : Voter: org.springframework.security.access.vote.RoleVoter@1256e97c, returned: 0
2017-06-05 09:15:59.823 DEBUG 27852 --- [nio-8080-exec-8] o.s.s.access.vote.AffirmativeBased       : Voter: org.springframework.security.access.vote.AuthenticatedVoter@2f7365a2, returned: 0
2017-06-05 09:15:59.850 DEBUG 27852 --- [nio-8080-exec-8] o.s.s.w.a.ExceptionTranslationFilter     : Access is denied (user is anonymous); redirecting to authentication entry point

org.springframework.security.access.AccessDeniedException: Access is denied
    at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:84) ~[spring-security-core-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:233) ~[spring-security-core-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:65) ~[spring-security-core-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) ~[spring-tx-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673) ~[spring-aop-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at com.speakez.iqr.server.services.MyService$$EnhancerBySpringCGLIB$$d8534caf.verifyUser(<generated>) ~[classes/:1.0.0]
    at com.naturalprogrammer.spring.lemon.LemonController.verifyUser(LemonController.java:130) ~[spring-lemon-0.12.0.jar:0.12.0]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:661) ~[servlet-api.jar:na]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[servlet-api.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-websocket.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at com.naturalprogrammer.spring.lemon.security.LemonTokenAuthenticationFilter.doFilter(LemonTokenAuthenticationFilter.java:95) [spring-lemon-0.12.0.jar:0.12.0]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.authentication.switchuser.SwitchUserFilter.doFilter(SwitchUserFilter.java:197) ~[spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) ~[spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) ~[spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) ~[spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:150) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at com.naturalprogrammer.spring.lemon.security.LemonTokenAuthenticationFilter.doFilter(LemonTokenAuthenticationFilter.java:95) [spring-lemon-0.12.0.jar:0.12.0]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.springframework.security.oauth2.client.filter.OAuth2ClientContextFilter.doFilter(OAuth2ClientContextFilter.java:60) [spring-security-oauth2-2.0.13.RELEASE.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at com.naturalprogrammer.spring.lemon.security.LemonCorsFilter.doFilterInternal(LemonCorsFilter.java:86) [spring-lemon-0.12.0.jar:0.12.0]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:115) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
    at org.springframework.boot.web.support.ErrorPageFilter.access$000(ErrorPageFilter.java:59) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
    at org.springframework.boot.web.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:90) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:108) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [catalina.jar:8.5.15]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:8.5.15]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) [catalina.jar:8.5.15]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [catalina.jar:8.5.15]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80) [catalina.jar:8.5.15]
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624) [catalina.jar:8.5.15]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [catalina.jar:8.5.15]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [catalina.jar:8.5.15]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799) [tomcat-coyote.jar:8.5.15]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:8.5.15]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861) [tomcat-coyote.jar:8.5.15]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455) [tomcat-coyote.jar:8.5.15]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:8.5.15]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_131]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_131]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.5.15]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]
</code>```

答: Verification works only if the user is authenticated. (So, maybe your front-end verification page should show a "Please login to verify" button if the user isn't logged in, and then show the "Verify" button when he logs in.)</p>

Body:
I am using spring lemon and a reactjs app on the client side. I successfully register a new user, and when the user clicks the email link he is redirected to a screen in the react app which sends a POST request to the /api/users/verify url. At this point I am getting the AccessDeniedException. These are the logs:

2017-06-05 09:15:59.780 DEBUG 27852 --- [nio-8080-exec-8] c.n.s.l.s.LemonTokenAuthenticationFilter : Inside LemonTokenAuthenticationFilter ...
2017-06-05 09:15:59.780 DEBUG 27852 --- [nio-8080-exec-8] c.n.s.l.s.LemonTokenAuthenticationFilter : Token authentication skipped
2017-06-05 09:15:59.821 DEBUG 27852 --- [nio-8080-exec-8] c.n.spring.lemon.LemonController         : Verifying user ...
2017-06-05 09:15:59.822 DEBUG 27852 --- [nio-8080-exec-8] o.s.s.a.i.a.MethodSecurityInterceptor    : Secure object: ReflectiveMethodInvocation: public void com.naturalprogrammer.spring.lemon.LemonService.verifyUser(java.lang.String); target is of class [com.speakez.iqr.server.services.MyService]; Attributes: [[authorize: 'isAuthenticated()', filter: 'null', filterTarget: 'null']]
2017-06-05 09:15:59.823 DEBUG 27852 --- [nio-8080-exec-8] o.s.s.a.i.a.MethodSecurityInterceptor    : Previously Authenticated: org.springframework.security.authentication.AnonymousAuthenticationToken@9055e4a6: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS
2017-06-05 09:15:59.823 DEBUG 27852 --- [nio-8080-exec-8] o.s.s.access.vote.AffirmativeBased       : Voter: org.springframework.security.access.prepost.PreInvocationAuthorizationAdviceVoter@5d08811f, returned: -1
2017-06-05 09:15:59.823 DEBUG 27852 --- [nio-8080-exec-8] o.s.s.access.vote.AffirmativeBased       : Voter: org.springframework.security.access.vote.RoleVoter@1256e97c, returned: 0
2017-06-05 09:15:59.823 DEBUG 27852 --- [nio-8080-exec-8] o.s.s.access.vote.AffirmativeBased       : Voter: org.springframework.security.access.vote.AuthenticatedVoter@2f7365a2, returned: 0
2017-06-05 09:15:59.850 DEBUG 27852 --- [nio-8080-exec-8] o.s.s.w.a.ExceptionTranslationFilter     : Access is denied (user is anonymous); redirecting to authentication entry point

org.springframework.security.access.AccessDeniedException: Access is denied
    at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:84) ~[spring-security-core-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:233) ~[spring-security-core-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:65) ~[spring-security-core-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) ~[spring-tx-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673) ~[spring-aop-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at com.speakez.iqr.server.services.MyService$$EnhancerBySpringCGLIB$$d8534caf.verifyUser(<generated>) ~[classes/:1.0.0]
    at com.naturalprogrammer.spring.lemon.LemonController.verifyUser(LemonController.java:130) ~[spring-lemon-0.12.0.jar:0.12.0]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:661) ~[servlet-api.jar:na]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[servlet-api.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-websocket.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at com.naturalprogrammer.spring.lemon.security.LemonTokenAuthenticationFilter.doFilter(LemonTokenAuthenticationFilter.java:95) [spring-lemon-0.12.0.jar:0.12.0]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.authentication.switchuser.SwitchUserFilter.doFilter(SwitchUserFilter.java:197) ~[spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) ~[spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) ~[spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) ~[spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:150) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at com.naturalprogrammer.spring.lemon.security.LemonTokenAuthenticationFilter.doFilter(LemonTokenAuthenticationFilter.java:95) [spring-lemon-0.12.0.jar:0.12.0]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177) [spring-security-web-4.2.2.RELEASE.jar:4.2.2.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.springframework.security.oauth2.client.filter.OAuth2ClientContextFilter.doFilter(OAuth2ClientContextFilter.java:60) [spring-security-oauth2-2.0.13.RELEASE.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at com.naturalprogrammer.spring.lemon.security.LemonCorsFilter.doFilterInternal(LemonCorsFilter.java:86) [spring-lemon-0.12.0.jar:0.12.0]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:115) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
    at org.springframework.boot.web.support.ErrorPageFilter.access$000(ErrorPageFilter.java:59) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
    at org.springframework.boot.web.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:90) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:108) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:8.5.15]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:8.5.15]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [catalina.jar:8.5.15]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:8.5.15]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) [catalina.jar:8.5.15]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [catalina.jar:8.5.15]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80) [catalina.jar:8.5.15]
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624) [catalina.jar:8.5.15]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [catalina.jar:8.5.15]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [catalina.jar:8.5.15]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799) [tomcat-coyote.jar:8.5.15]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:8.5.15]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861) [tomcat-coyote.jar:8.5.15]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455) [tomcat-coyote.jar:8.5.15]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:8.5.15]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_131]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_131]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.5.15]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]


来源: stackexchange

问:
Recyclerview not call onCreateViewHolder
My RecyclerView does not call onCreateViewHolder, onBindViewHolder even MenuViewHolder constructor, therefore nothing appears in RecyclerView.
I put logs for debugging, and no log is shown.
What might be the problem?

My adapter:

public class MenuAdapter extends RecyclerView.Adapter<MenuAdapter.MenuViewHolder> {
private LayoutInflater inflater;
List<Menu> data = Collections.emptyList();

public MenuAdapter(Context context, List<Menu> data) {
    Log.i("DEBUG", "Constructor");
    inflater = LayoutInflater.from(context);
    Log.i("DEBUG MENU - CONSTRUCTOR", inflater.toString());
    this.data = data;
    for(Menu menu: this.data){
        Log.i("DEBUG MENU - CONSTRUCTOR", menu.menu);
    }
}

@Override
public MenuViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = inflater.inflate(R.layout.row_menu, parent, false);
    MenuViewHolder holder = new MenuViewHolder(view);
    return holder;
}

@Override
public void onBindViewHolder(MenuViewHolder holder, int position) {
    Log.i("DEBUG MENU", "onBindViewHolder");
    Menu current = data.get(position);
    holder.title.setText(current.menu);
}

@Override
public int getItemCount() {
    return 0;
}

class MenuViewHolder extends RecyclerView.ViewHolder {
    TextView title;
    ImageView icon;

    public MenuViewHolder(View itemView) {
        super(itemView);
        title = (TextView) itemView.findViewById(R.id.menuText);
    }
}
```

<p>My custom row XML:</p>

<pre class="lang-xml prettyprint-override"><code><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/menuText"
    android:text="Dummy Text"
    android:layout_gravity="center_vertical"
    android:textColor="#222"/>
</code>```

and my Fragment:

public NavigationFragment() {
    // Required empty public constructor
}

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mUserLearnedDrawer = Boolean.valueOf(readFromPreferences(getActivity(), KEY_USER_LEARNED_DRAWER, "false"));
    if (savedInstanceState != null) {
        mFromSavedInstaceState = true;
    }
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment

    View view = inflater.inflate(R.layout.fragment_navigation, container, false);
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.drawer_list);
    MenuAdapter adapter = new MenuAdapter(getActivity(), getData());
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setAdapter(adapter);
    return view;
}
```

答: If using a custom adapter do not forget to set the ItemCount to the size of your collection.</p>

ContentLicense: CC BY-SA 3.0

Body:
My RecyclerView does not call onCreateViewHolder, onBindViewHolder even MenuViewHolder constructor, therefore nothing appears in RecyclerView.
I put logs for debugging, and no log is shown.
What might be the problem?

My adapter:

public class MenuAdapter extends RecyclerView.Adapter<MenuAdapter.MenuViewHolder> {
private LayoutInflater inflater;
List<Menu> data = Collections.emptyList();

public MenuAdapter(Context context, List<Menu> data) {
    Log.i("DEBUG", "Constructor");
    inflater = LayoutInflater.from(context);
    Log.i("DEBUG MENU - CONSTRUCTOR", inflater.toString());
    this.data = data;
    for(Menu menu: this.data){
        Log.i("DEBUG MENU - CONSTRUCTOR", menu.menu);
    }
}

@Override
public MenuViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = inflater.inflate(R.layout.row_menu, parent, false);
    MenuViewHolder holder = new MenuViewHolder(view);
    return holder;
}

@Override
public void onBindViewHolder(MenuViewHolder holder, int position) {
    Log.i("DEBUG MENU", "onBindViewHolder");
    Menu current = data.get(position);
    holder.title.setText(current.menu);
}

@Override
public int getItemCount() {
    return 0;
}

class MenuViewHolder extends RecyclerView.ViewHolder {
    TextView title;
    ImageView icon;

    public MenuViewHolder(View itemView) {
        super(itemView);
        title = (TextView) itemView.findViewById(R.id.menuText);
    }
}

My custom row XML:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/menuText"
    android:text="Dummy Text"
    android:layout_gravity="center_vertical"
    android:textColor="#222"/>

and my Fragment:

public NavigationFragment() {
    // Required empty public constructor
}

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mUserLearnedDrawer = Boolean.valueOf(readFromPreferences(getActivity(), KEY_USER_LEARNED_DRAWER, "false"));
    if (savedInstanceState != null) {
        mFromSavedInstaceState = true;
    }
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment

    View view = inflater.inflate(R.layout.fragment_navigation, container, false);
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.drawer_list);
    MenuAdapter adapter = new MenuAdapter(getActivity(), getData());
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setAdapter(adapter);
    return view;
}


问:
Move Data Based on a second tables values
Tech: SQL Server Management Studio 2012

Stuck on: The WHERE part of the process.

Aim:

Archive data from live system based on new import data using Col1 and Col2 as reference (held in TblImportData)

Remove archived data from Live system

Move Imported data to Live

Example workflow:

```<code>TblData

Col1 Col2   Col3
1    Horse  Brown
1    Cat    Ginger
2    Fish   Gold
2    Dog    White
3    Cat    Mixed
3    Cat    Black
3    Fish   Yellow
</code>```

```<code>TblImport

Col1  Col2       Col3
1     Elephant  Grey
</code>```

```<code>TblDataAFTERSQL

Col1    Col2   Col3
1    Elephant  Grey
2    Fish      Gold
2    Dog       White
3    Cat       Mixed
3    Cat       Black
3    Fish      Yellow
</code>```

```<code>TblArchiveAFTERSQL

1   Horse   Brown
1   Cat     Ginger
</code>```

The query is:

```<code> INSERT INTO [DBArchive].dbo.TblDataArchive  ([Col1],[Col2],[Col3])
    SELECT  [Col1],[Col2],[Col3]
    FROM  [DBLive].dbo.TblData
    WHERE (SELECT DISTINCT [Col1],[Col2] FROM [DBImport].dbo.TblImportData)
</code>```

答:
I think this is what you want:</p>

```<code>INSERT INTO [DBArchive].dbo.TblDataArchive  ([Col1], [Col2], [Col3])
    SELECT [Col1], [Col2], [Col3]
    FROM [DBLive].dbo.TblData td
    WHERE EXISTS (SELECT 1
                  FROM [DBImport].dbo.TblImportData tid
                  WHERE tid.[Col1] = td.[Col1] AND tid.[Col2] = td.[Col2]
                 );
</code>```

Body:
Tech: SQL Server Management Studio 2012

Stuck on: The WHERE part of the process.

Aim:

Archive data from live system based on new import data using Col1 and Col2 as reference (held in TblImportData)

Remove archived data from Live system

Move Imported data to Live

Example workflow:

TblData

Col1 Col2   Col3
1    Horse  Brown
1    Cat    Ginger
2    Fish   Gold
2    Dog    White
3    Cat    Mixed
3    Cat    Black
3    Fish   Yellow

TblImport

Col1  Col2       Col3
1     Elephant  Grey

TblDataAFTERSQL

Col1    Col2   Col3
1    Elephant  Grey
2    Fish      Gold
2    Dog       White
3    Cat       Mixed
3    Cat       Black
3    Fish      Yellow

TblArchiveAFTERSQL

1   Horse   Brown
1   Cat     Ginger

The query is:

 INSERT INTO [DBArchive].dbo.TblDataArchive  ([Col1],[Col2],[Col3])
    SELECT  [Col1],[Col2],[Col3]
    FROM  [DBLive].dbo.TblData
    WHERE (SELECT DISTINCT [Col1],[Col2] FROM [DBImport].dbo.TblImportData)

Body:
I think this is what you want:

INSERT INTO [DBArchive].dbo.TblDataArchive  ([Col1], [Col2], [Col3])
    SELECT [Col1], [Col2], [Col3]
    FROM [DBLive].dbo.TblData td
    WHERE EXISTS (SELECT 1
                  FROM [DBImport].dbo.TblImportData tid
                  WHERE tid.[Col1] = td.[Col1] AND tid.[Col2] = td.[Col2]
                 );


问:
Bootstrap CSS noob - skeleton code for 5x5 grid with nested grid in each "cell"
I'm trying to create a seating chart app that looks something like this:

I'm not sure if it can be done with all Bootstrap, because I read that BS "container" class cannot be nested. Also, I'd really like it if I could make the entire chart automatically stretch to both the full width and height of the viewport. I'm currently doing it with a 5x5 html table with a BS grid in each td. I'm currently having problems getting the "gutter" spacing to look right (red bars in diagram). I'm also having trouble getting all of the elements to fit inside the "row" (BS "row" class).

```<code><td style="white-space:nowrap">
        <div class="row">
            <div class="col-xs-3"><input id="39638" type="text" value=""></div><div class="col-xs-3"><label id="39638pc"><?php echo $part['39638'] ?></label></div>
            <div class="col-xs-3"><input id="39638bt" type="text" value=""></div><div class="col-xs-3"><label id="39638bc"><?php echo $part['39638'] ?></div></label></div>
        </div>
        <div class="row">
            <div class="col-xs-12"><label class="name-label">Opas</label></div>
        </div>
        <div class="row">
            <div class="col-xs-4"><button class="btn btn-primary" type="button" onclick="participate(39638)">Good</button></div>
            <div class="col-xs-4"><button class="btn btn-primary" type="button" onclick="behave(39638)">Bad</button></div>
            <div class="col-xs-4"><button class="btn btn-primary" type="button" onclick="comelate(39638)">Late</button></div>
        </div></td>
</code>```

In style.css:

```<code>    table {
    font-family: arial, sans-serif;
    border-collapse: collapse;
    width: 100%;
}

td, th {
    border: 1px solid #dddddd;
    text-align: left;
    /* padding: 8px; */
}

.row .col-xs-3 {
    display: inline-block;
    float: none;
    padding-left: 5px;
    padding-right: 5px;
}

.row .col-xs-4 {
    display: inline-block;
    float: none;
    padding: 0;
}

.row .col-xs-3 input, .row .col-xs-3 label {
    width: 100%;
    text-align: center;
    background-color: pink;
}

.row .col-xs-4 button {
    width: 95%;
    padding: 0;
    margin: 0;
}

td .row {
    margin: 0px;
}

.name-label {
    width: 100%;
    font: bold 14px calibri, sans-serif;
    text-align: center;
    margin: 0;
    padding: 0;
}
</code>```

答:
It is possible with all BS. You don't need to nest more than one container; you can just nest the rows and columns.

A 5x5 grid is a little tricky, since 12 is not evenly divisible by 5, but there is a beautiful solution to that here.

Here is the HTML code.

Here is the CSS.

Here's what it looks like:

The keys to making it work were using the BS "text-center" class and using display: table-row; and display: table-cell; in the css.

Now if I could only get the elements centered vertically...

Body:
I'm trying to create a seating chart app that looks something like this:

I'm not sure if it can be done with all Bootstrap, because I read that BS "container" class cannot be nested. Also, I'd really like it if I could make the entire chart automatically stretch to both the full width and height of the viewport. I'm currently doing it with a 5x5 html table with a BS grid in each td. I'm currently having problems getting the "gutter" spacing to look right (red bars in diagram). I'm also having trouble getting all of the elements to fit inside the "row" (BS "row" class).

<input id="39638" type="text" value="">

<?php echo $part['39638'] ?>

<input id="39638bt" type="text" value="">

<?php echo $part['39638'] ?>

Opas

<button class="btn btn-primary" type="button" onclick="participate(39638)">Good</button>

<button class="btn btn-primary" type="button" onclick="behave(39638)">Bad</button>

<button class="btn btn-primary" type="button" onclick="comelate(39638)">Late</button>

In style.css:

    table {
    font-family: arial, sans-serif;
    border-collapse: collapse;
    width: 100%;
}

td, th {
    border: 1px solid #dddddd;
    text-align: left;
    /* padding: 8px; */
}

.row .col-xs-3 {
    display: inline-block;
    float: none;
    padding-left: 5px;
    padding-right: 5px;
}

.row .col-xs-4 {
    display: inline-block;
    float: none;
    padding: 0;
}

.row .col-xs-3 input, .row .col-xs-3 label {
    width: 100%;
    text-align: center;
    background-color: pink;
}

.row .col-xs-4 button {
    width: 95%;
    padding: 0;
    margin: 0;
}

td .row {
    margin: 0px;
}

.name-label {
    width: 100%;
    font: bold 14px calibri, sans-serif;
    text-align: center;
    margin: 0;
    padding: 0;
}


问:
Autolayouts not working as expected in iPhone 6s Plus
I have

UIImageviewUIView - The Background image

UIView - being treated as a gradient layer on top of the image.

Here the constraints given for the gradient view is

Align top and leading to the UIImageView

Equal height and Width as
the UIImageView

These are working perfectly on iPhone 5s, 6s but fails to work on iPhone 6s Plus. The gradient view doesnt cover the UIImageView fully.
Attaching a sample image

P.S I already unchecked Constraint to margin in Interface Builder. Still not working.
Can anyone help me with what i am missing?

答:
After loads of trial and error.
I finally found the solution.

Removed Equal height and Width as the UIImageView

Align bottom and trailing to the UIImageView


问:
pytesseract on windows 10 : Error opening data file
I am using pytesseract on windows 10 x64, and python is 3.5.2 x64,Tesseract is 4.0,the code is as follow:

```<code># -*- coding: utf-8 -*-

try:
    import Image
except ImportError:
    from PIL import Image
import pytesseract

print(pytesseract.image_to_string(Image.open('d:/testimages/name.gif'), lang='chi_sim'))
</code>```

error:

```<code>Traceback (most recent call last):
  File "D:/test.py", line 10, in <module>
    print(pytesseract.image_to_string(Image.open('d:/testimages/name.gif'), lang='chi_sim'))
  File "C:\Users\dell\AppData\Local\Programs\Python\Python35\lib\site-packages\pytesseract\pytesseract.py", line 165, in image_to_string
    raise TesseractError(status, errors)
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file \\Program Files (x86)\\Tesseract-OCR\\tessdata/chi_sim.traineddata')
</code>```

C:\Program Files (x86)\Tesseract-OCR\tessdata,like this:

why is it?

答: Set TESSDATA_PREFIX environment variable to C:\Program Files (x86)\Tesseract-OCR\

Body:
I am using pytesseract on windows 10 x64, and python is 3.5.2 x64,Tesseract is 4.0,the code is as follow:

# -*- coding: utf-8 -*-

try:
    import Image
except ImportError:
    from PIL import Image
import pytesseract

print(pytesseract.image_to_string(Image.open('d:/testimages/name.gif'), lang='chi_sim'))

error:

Traceback (most recent call last):
  File "D:/test.py", line 10, in <module>
    print(pytesseract.image_to_string(Image.open('d:/testimages/name.gif'), lang='chi_sim'))
  File "C:\Users\dell\AppData\Local\Programs\Python\Python35\lib\site-packages\pytesseract\pytesseract.py", line 165, in image_to_string
    raise TesseractError(status, errors)
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file \\Program Files (x86)\\Tesseract-OCR\\tessdata/chi_sim.traineddata')

C:\Program Files (x86)\Tesseract-OCR\tessdata,like this:

why is it?


问:
how to return indexes that makes best sum in an array?
I just need to input an array and make the program return the range of index which produces highest sum.

Examples

For A = {5, -6, 7, -5, 10, -1} – the best sum consists of the values in A[2..4] for a total of 7 + -5 + 10 = 12

For A = {1, 2, 4, -6, 4, 2, 1} – the best sum consists of the values in A[0..6] (the entire array) for a total of 8

For A = {-5, 2, -3, 1, -5, 4, -2} – the best sum consists of the value in A[5] for a total of 4

It would be greatly appreciated if someone could help me return the following values

Here is my code(doesn't seem to run properly)

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

int the_resource_collection( int arr[], int len){
  int highest, start, end, i, result;
  highest = arr[len-1];// the limits of the highest value
  start = len - 1;
  end =  len - 1;// all the variables in the total indexes
  for( i=0; i<len-2; i++)
  {
    for (a=i; a<len-1; a++)
    {
        result= arr[i]+ arr[a];// try to find the total of the index
        {
            if (result > highest)
            {
                highest = result;
                start = i;
                end = a;
            }
        }
    }
  }
  return start;
  return end;
}
int main()
{
  int a[6] = {5, -6, 7, -5, 10, -1};
  int length = 6;
  printf("%d",the_resource_collection(&a[6],length));
}
</code>```

答:
Ok, you have some mistakes.

Firstly, in printf("%d",the_resource_collection(&a[6],length)); you are only passing to the function the sixth element of the array.

Also your for loops aren't considering all elements of the array. Finally you also need to save the begining and ending in a int array.

Here is how I would do it (I've tested it with the 3 inputs you've provided and the output is as expected!):

```<code>#include<stdio.h>
int * the_resource_collection( int arr[], int len){
    int highest;
    int returnvalue[2];
    int i;
    int a;
    int result;
    highest = arr[len-1];// the limits of the highest value
    returnvalue[0] = len - 1;
    returnvalue[1] = len - 1;// all the variables in the total indexes
    for( i=0; i<len; i++)
    {
        result= arr[i];
        for (a=i+1; a<len; a++)
        {
                if (result > highest)
                {
                    highest = result;
                    returnvalue[0] = i;
                    returnvalue[1] = a-1;
                }
                result+=arr[a];
        }
        if (result > highest)
        {
            highest = result;
            returnvalue[0] = i;
            returnvalue[1] = a-1;
        }
        result=0;
    }
    return returnvalue;
}
int main()
{
    int a[7] = {5, -6, 7, -5, 10, -1};
    int length = 7;
    printf("A[%d...%d]\n",the_resource_collection(a,length)[0],the_resource_collection(a,length)[1]);
}
</code>```

If you don't understand what I wrote, or need anymore help, please say so.

Body:
I just need to input an array and make the program return the range of index which produces highest sum.

Examples

For A = {5, -6, 7, -5, 10, -1} – the best sum consists of the values in A[2..4] for a total of 7 + -5 + 10 = 12

For A = {1, 2, 4, -6, 4, 2, 1} – the best sum consists of the values in A[0..6] (the entire array) for a total of 8

For A = {-5, 2, -3, 1, -5, 4, -2} – the best sum consists of the value in A[5] for a total of 4

It would be greatly appreciated if someone could help me return the following values

Here is my code(doesn't seem to run properly)

#include<stdio.h>

int the_resource_collection( int arr[], int len){
  int highest, start, end, i, result;
  highest = arr[len-1];// the limits of the highest value
  start = len - 1;
  end =  len - 1;// all the variables in the total indexes
  for( i=0; i<len-2; i++)
  {
    for (a=i; a<len-1; a++)
    {
        result= arr[i]+ arr[a];// try to find the total of the index
        {
            if (result > highest)
            {
                highest = result;
                start = i;
                end = a;
            }
        }
    }
  }
  return start;
  return end;
}
int main()
{
  int a[6] = {5, -6, 7, -5, 10, -1};
  int length = 6;
  printf("%d",the_resource_collection(&a[6],length));
}

Body:
Ok, you have some mistakes.

Firstly, in printf("%d",the_resource_collection(&a[6],length)); you are only passing to the function the sixth element of the array.

Also your for loops aren't considering all elements of the array. Finally you also need to save the begining and ending in a int array.

Here is how I would do it (I've tested it with the 3 inputs you've provided and the output is as expected!):

#include<stdio.h>
int * the_resource_collection( int arr[], int len){
    int highest;
    int returnvalue[2];
    int i;
    int a;
    int result;
    highest = arr[len-1];// the limits of the highest value
    returnvalue[0] = len - 1;
    returnvalue[1] = len - 1;// all the variables in the total indexes
    for( i=0; i<len; i++)
    {
        result= arr[i];
        for (a=i+1; a<len; a++)
        {
                if (result > highest)
                {
                    highest = result;
                    returnvalue[0] = i;
                    returnvalue[1] = a-1;
                }
                result+=arr[a];
        }
        if (result > highest)
        {
            highest = result;
            returnvalue[0] = i;
            returnvalue[1] = a-1;
        }
        result=0;
    }
    return returnvalue;
}
int main()
{
    int a[7] = {5, -6, 7, -5, 10, -1};
    int length = 7;
    printf("A[%d...%d]\n",the_resource_collection(a,length)[0],the_resource_collection(a,length)[1]);
}

If you don't understand what I wrote, or need anymore help, please say so.


问:
EF6 generating unneeded SQL query
I'm wondering why the generated SQL is checking for nulls on a column that is not nullable (column Value  which is a not-null float),

```<code>var query = _context.Events
  .Select(e => new
  {
    eventId = e.EventId,
    data = e.Data.Take(10).Select(x => new
    {
      name = x.Name,
      value = Math.Round(x.Value,1),
    })
  });
</code>```

Generates the following SQL code:

```<code>SELECT
    [Project2].[EventId] AS [EventId],
    [Project2].[DeviceId] AS [DeviceId],
    [Project2].[TimeEnd] AS [TimeEnd],
    [Project2].[C2] AS [C1],
    [Project2].[EventId1] AS [EventId1],
    [Project2].[Name] AS [Name],
    [Project2].[C1] AS [C2]
    FROM ( SELECT
        [Limit1].[EventId] AS [EventId],
        [Limit1].[TimeEnd] AS [TimeEnd],
        [Limit1].[DeviceId] AS [DeviceId],
        [Extent2].[Name] AS [Name],
        [Extent2].[EventId] AS [EventId1],
        CASE WHEN ([Extent2].[Value] IS NULL) THEN CAST(NULL AS float) ELSE ROUND([Extent2].[Value], 1) END AS [C1],
        CASE WHEN ([Extent2].[Value] IS NULL) THEN CAST(NULL AS int) ELSE 1 END AS [C2]
        FROM   (SELECT [Project1].[EventId] AS [EventId], [Project1].[TimeEnd] AS [TimeEnd], [Project1].[DeviceId] AS [DeviceId]
            FROM ( SELECT
                [Extent1].[EventId] AS [EventId],
                [Extent1].[TimeEnd] AS [TimeEnd],
                [Extent1].[DeviceId] AS [DeviceId]
                FROM [dbo].[Events] AS [Extent1]
                WHERE ([Extent1].[DeviceId] = 1)
            )  AS [Project1]
            ORDER BY [Project1].[TimeEnd] DESC ) AS [Limit1]
        LEFT OUTER JOIN [dbo].[Octaves] AS [Extent2] ON [Limit1].[EventId] = [Extent2].[EventId]
    )  AS [Project2]
    ORDER BY [Project2].[TimeEnd] DESC, [Project2].[EventId] ASC, [Project2].[C2] ASC
</code>```

If I remove the two CASE WHEN ([Extent2].[Value] IS NULL) and just leave ROUND([Limit2].[Value], 1) AS [C1] and also remove the ORDER BY Project2].[C2] ASC in SQL Server Management the query speeds up.

答:
There is a LEFT OUTER JOIN, so the values (in the query) can definitely be NULL (even if the underlying table definition is not nullable).

See http://docs.oracle.com/javadb/10.8.3.0/ref/rrefsqlj18922.html (for Oracle - but the same basic pattern applies for all the main SQL vendors).

In this case, it is a bit pointless since ROUND(NULL, 1) would return NULL anyway (well, it would on SQL Server). But there isn't much you can do about that, given you can't control the SQL it generates.

Title: EF6 generating unneeded SQL query

Body:
I'm wondering why the generated SQL is checking for nulls on a column that is not nullable (column Value  which is a not-null float),

var query = _context.Events
  .Select(e => new
  {
    eventId = e.EventId,
    data = e.Data.Take(10).Select(x => new
    {
      name = x.Name,
      value = Math.Round(x.Value,1),
    })
  });

Generates the following SQL code:

SELECT
    [Project2].[EventId] AS [EventId],
    [Project2].[DeviceId] AS [DeviceId],
    [Project2].[TimeEnd] AS [TimeEnd],
    [Project2].[C2] AS [C1],
    [Project2].[EventId1] AS [EventId1],
    [Project2].[Name] AS [Name],
    [Project2].[C1] AS [C2]
    FROM ( SELECT
        [Limit1].[EventId] AS [EventId],
        [Limit1].[TimeEnd] AS [TimeEnd],
        [Limit1].[DeviceId] AS [DeviceId],
        [Extent2].[Name] AS [Name],
        [Extent2].[EventId] AS [EventId1],
        CASE WHEN ([Extent2].[Value] IS NULL) THEN CAST(NULL AS float) ELSE ROUND([Extent2].[Value], 1) END AS [C1],
        CASE WHEN ([Extent2].[Value] IS NULL) THEN CAST(NULL AS int) ELSE 1 END AS [C2]
        FROM   (SELECT [Project1].[EventId] AS [EventId], [Project1].[TimeEnd] AS [TimeEnd], [Project1].[DeviceId] AS [DeviceId]
            FROM ( SELECT
                [Extent1].[EventId] AS [EventId],
                [Extent1].[TimeEnd] AS [TimeEnd],
                [Extent1].[DeviceId] AS [DeviceId]
                FROM [dbo].[Events] AS [Extent1]
                WHERE ([Extent1].[DeviceId] = 1)
            )  AS [Project1]
            ORDER BY [Project1].[TimeEnd] DESC ) AS [Limit1]
        LEFT OUTER JOIN [dbo].[Octaves] AS [Extent2] ON [Limit1].[EventId] = [Extent2].[EventId]
    )  AS [Project2]
    ORDER BY [Project2].[TimeEnd] DESC, [Project2].[EventId] ASC, [Project2].[C2] ASC

If I remove the two CASE WHEN ([Extent2].[Value] IS NULL) and just leave ROUND([Limit2].[Value], 1) AS [C1] and also remove the ORDER BY Project2].[C2] ASC in SQL Server Management the query speeds up.


问:
selenium webdriver - wait until google map all tiles loaded
I'm new to selenium and I'm kind of stuck.

I'm automating GWT base application and I need to wait till map tiles are fully loaded before moving to next process.

I'm try to find in google but no luck.

I found something like

```<code>public static final void waitTillPageLoad()
    {
        WebDriverWait wait = new WebDriverWait(LoginTestScript.fd, 40);
        wait.until( new Predicate<WebDriver>() {
            public boolean apply(WebDriver driver) {
                return ((JavascriptExecutor)driver).executeScript("return document.readyState").equals("complete");
            }
        }
    );
    }
</code>```

but, I need to wait untill map tiles loaded not document.readyState

do anyone have idea how can I wait until all map tiles loaded successfully.

Thank you.

答:
You can use the below method:

```<code>public boolean checkForPresenceOfElementByXpath(String xpath){
    try{
        new WebDriverWait(driver, 5)).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("(xpath)[last()]")));
        return true;
    }catch(Exception e){
        return false;
    }
}
</code>```

Remove the return type and return statements, if you dont want to return the values.

Body:
I'm new to selenium and I'm kind of stuck.

I'm automating GWT base application and I need to wait till map tiles are fully loaded before moving to next process.

I'm try to find in google but no luck.

I found something like

public static final void waitTillPageLoad()
    {
        WebDriverWait wait = new WebDriverWait(LoginTestScript.fd, 40);
        wait.until( new Predicate<WebDriver>() {
            public boolean apply(WebDriver driver) {
                return ((JavascriptExecutor)driver).executeScript("return document.readyState").equals("complete");
            }
        }
    );
    }

but, I need to wait untill map tiles loaded not document.readyState

do anyone have idea how can I wait until all map tiles loaded successfully.

Thank you.

Body:
You can use the below method:

public boolean checkForPresenceOfElementByXpath(String xpath){
    try{
        new WebDriverWait(driver, 5)).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("(xpath)[last()]")));
        return true;
    }catch(Exception e){
        return false;
    }
}

Remove the return type and return statements, if you dont want to return the values.


问:
How do I use the right key for SSH, connecting from Git Bash on Windows to remote server?
I'm trying to push my project on git to my remote Linux server from my local Windows PC.

I have no issues connecting to my server through SSH when I use PuTTY. But PuTTY is only for the remote server, and doesn't let me look in my own local pc - so I can't access my git repository to push from.

Instead I've been trying with Git Bash, where I go to the repository(master) of my git project, and then attempt "git push production master". Receiving "Permission denied (publickey)" in response in Git Bash.

I have loaded by private key from my user/.ssh folder on local pc, using PuTTYgen, copy/pasted the public key it shows into my Github account's SSH-keys.
This is the same key that I use for connecting with PuTTY(which works).

If I use "git remote -v" in Git Bash, I receive what is the correct url for the server:
"
production      ssh://notacop@mafiauniversedata.com/var/repo/site.git (fetch)
production      ssh://notacop@mafiauniversedata.com/var/repo/site.git (push)
"

"notacop" is the admin user I made instead of root, which is also the one that I use in PuTTY.

If I attempt "ssh notacop@mafiauniversedata.com" in Git Bash I also receive the "Permission denied (publickey)" response. So seemingly the issue is related to the publickey that Git Bash uses, as it can't connect at all.

My user/.ssh folder contains:
digitalocean_private_key (is the one PuTTY uses/the one generated by PuTTYgen) + digitalocean_public_key

github_rsa + github_rsa.pub

id_rsa + id_rsa.pub

known_hosts

I feel like I've set things up in accordance with the general guidelines, and it does work in PuTTY, so the issue must be related to Git Bash and how Git Bash establishes ssh connection.

But I'm fairly clueless about how to fix the issue, and haven't been able to find a solution from searching. My guess is that it's something fairly simple, but I've been stuck on this for a couple weeks now, not getting anywhere because of it.

Any answers that can lead me in the right direction will be highly appreciated!
If anything about my question is unclear, or you need more information to answer, please let me know.

答:
I don't know why Git Bash's own ssh doesn't seem to work for you,
but I have a better recommendation: make Git Bash use PuTTY, by setting the GIT_SSH environment variable to the path of plink.exe (that's not a typo, it's not putty.exe, but another executable that comes with the zip of PuTTY tools).

The main advantage and reason to do this is so that Git Bash can benefit from pagent.exe, the key manager of PuTTY.
So that you can enter your passphrase once,
when adding your private key to Pagent,
and then you don't need to re-enter it every time you perform remote operations in Git Bash.


问:
Create a list of repeated consecutive numbers regarding number from another list
I want to create a list with repeated consecutive numbers from zero regarding numbers from list1

```<code>list1 = [3,5,4,1,2,2]
</code>```

Expected list should have 3 zeros, 5 ones, 4 twos, and so on.

```<code>list2 = [0,0,0,1,1,1,1,1,2,2,2,2,3,4,4,5,5]
</code>```

答:
You could use a list comprehension and enumerate() to iterate over count/value pairs:

```<code>>>> list1 = [3, 5, 4, 1, 2, 2]
>>> [j for i, n in enumerate(list1) for j in [i]*n]
[0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 4, 4, 5, 5]
</code>```

Alternatively, you can use itertools.chain (or chain.from_iterable), especially if you don't always need to build a list in memory:

```<code>>>> from itertools import chain
>>> list(chain(*[[i]*n for i, n in enumerate(list1)]))
[0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 4, 4, 5, 5]
</code>```

Body:
I want to create a list with repeated consecutive numbers from zero regarding numbers from list1

list1 = [3,5,4,1,2,2]

Expected list should have 3 zeros, 5 ones, 4 twos, and so on.

list2 = [0,0,0,1,1,1,1,1,2,2,2,2,3,4,4,5,5]

Body:
You could use a list comprehension and enumerate() to iterate over count/value pairs:

>>> list1 = [3, 5, 4, 1, 2, 2]
>>> [j for i, n in enumerate(list1) for j in [i]*n]
[0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 4, 4, 5, 5]

Alternatively, you can use itertools.chain (or chain.from_iterable), especially if you don't always need to build a list in memory:

>>> from itertools import chain
>>> list(chain(*[[i]*n for i, n in enumerate(list1)]))
[0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 4, 4, 5, 5]


问:
Permission denied - nginx and uwsgi socket
Well I am currently trying to get my django application served using nginx and uwsgi. I am currently using a virtual environment to which uwsgi is installed. However I am currently getting a 502 bad gateway error when attempting to access the page.

The Error I am experiencing.

```<code>2014/02/27 14:20:48 [crit] 29947#0: *20 connect() to unix:///tmp/uwsgi.sock failed (13: Permission denied) while connecting to upstream, client: 144.136.65.176, server: domainname.com.au, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/uwsgi.sock:", host: "www.domainname.com.au"
</code>```

This is my nginx.conf

```<code>    # mysite_nginx.conf

# the upstream component nginx needs to connect to
upstream django {
    server unix:///tmp/uwsgi.sock; # for a file socket
    #server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}

# configuration of the server
server {
    # the port your site will be served on
    listen      80;
    # the domain name it will serve for
    server_name .domainname.com.au; # substitute your machine's IP address or FQDN
    charset     utf-8;

    # max upload size
    client_max_body_size 75M;   # adjust to taste

    # Django media
    location /media  {
        alias /home/deepc/media;  # your Django project's media files - amend as required
    }

    location /static {
        alias /home/deepc/static; # your Django project's static files - amend as required
    }

    # Finally, send all non-media requests to the Django server.
    location / {
        uwsgi_pass  django;
        include     /home/deepc/.virtualenvs/dcwebproj/dcweb/uwsgi_params; # the uwsgi_params file you installed
    }
}
</code>```

Here is my uwsgi.ini file

```<code>[uwsgi]
socket=/tmp/uwsgi.sock
chmod-socket=644
uid = www-data
gid = www-data

chdir=/home/deepc/.virtualenvs/dcwebproj/dcweb
module=dcweb.wsgi:application
pidfile=/home/deepc/.virtualenvs/dcwebproj/dcweb.pid
vacuum=true
</code>```

From what i have read on google its a permissions problem with the www-data group and /tmp/ directory. However I am new to this and have tried to changer the permission level of the folder to no avail. Could someone point me in the right direction? Is this a permissions problem.

Also is it ok practice to put the sock file in tmp directory?

Thanks

答:
uwsgi.ini

```<code>[uwsgi]
uid = yourusername
gid = www-data
chmod-socket = 664
</code>```

Why? Because sometimes the app needs to read or write to the file system beyond what's accessible to the web server. I don't want to change a whole bunch of ownership and permissions just to accommodate each such situation. I'd rather have my application run as me and do what it needs to do. Setting the group as www-data and chmoding the socket to 664 allows for that group to write to it, thus providing the only necessary window of communication between the web server and the app.

Body:
Well I am currently trying to get my django application served using nginx and uwsgi. I am currently using a virtual environment to which uwsgi is installed. However I am currently getting a 502 bad gateway error when attempting to access the page.

The Error I am experiencing.

2014/02/27 14:20:48 [crit] 29947#0: *20 connect() to unix:///tmp/uwsgi.sock failed (13: Permission denied) while connecting to upstream, client: 144.136.65.176, server: domainname.com.au, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/uwsgi.sock:", host: "www.domainname.com.au"

This is my nginx.conf

    # mysite_nginx.conf

# the upstream component nginx needs to connect to
upstream django {
    server unix:///tmp/uwsgi.sock; # for a file socket
    #server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}

# configuration of the server
server {
    # the port your site will be served on
    listen      80;
    # the domain name it will serve for
    server_name .domainname.com.au; # substitute your machine's IP address or FQDN
    charset     utf-8;

    # max upload size
    client_max_body_size 75M;   # adjust to taste

    # Django media
    location /media  {
        alias /home/deepc/media;  # your Django project's media files - amend as required
    }

    location /static {
        alias /home/deepc/static; # your Django project's static files - amend as required
    }

    # Finally, send all non-media requests to the Django server.
    location / {
        uwsgi_pass  django;
        include     /home/deepc/.virtualenvs/dcwebproj/dcweb/uwsgi_params; # the uwsgi_params file you installed
    }
}

Here is my uwsgi.ini file

[uwsgi]
socket=/tmp/uwsgi.sock
chmod-socket=644
uid = www-data
gid = www-data

chdir=/home/deepc/.virtualenvs/dcwebproj/dcweb
module=dcweb.wsgi:application
pidfile=/home/deepc/.virtualenvs/dcwebproj/dcweb.pid
vacuum=true

From what i have read on google its a permissions problem with the www-data group and /tmp/ directory. However I am new to this and have tried to changer the permission level of the folder to no avail. Could someone point me in the right direction? Is this a permissions problem.

Also is it ok practice to put the sock file in tmp directory?

Thanks

Body:
uwsgi.ini

[uwsgi]
uid = yourusername
gid = www-data
chmod-socket = 664

Why? Because sometimes the app needs to read or write to the file system beyond what's accessible to the web server. I don't want to change a whole bunch of ownership and permissions just to accommodate each such situation. I'd rather have my application run as me and do what it needs to do. Setting the group as www-data and chmoding the socket to 664 allows for that group to write to it, thus providing the only necessary window of communication between the web server and the app.


问:
string split based on char \
Got a bit of a mind freeze at the moment.
I have the following syntax:-

```<code>        string[] repname = Thread.CurrentPrincipal.Identity.ToString().Split('\');
</code>```

and I get an error on the split character. Can anyone advise on how I can do the split using the \ character as the delimiter?

Cheers

答:
\ is an excape character in C#.

You need to do one of the following:

```<code>Split('\\');
</code>```

or

```<code>Split(@'\');
</code>```

ContentLicense: CC BY-SA 2.5

Title: string split based on char \

Body:
Got a bit of a mind freeze at the moment.
I have the following syntax:-

        string[] repname = Thread.CurrentPrincipal.Identity.ToString().Split('\');

and I get an error on the split character. Can anyone advise on how I can do the split using the \ character as the delimiter?

Cheers

Body:
\ is an excape character in C#.

You need to do one of the following:

Split('\\');

or

Split(@'\');

OwnerDisplayName: Micah

LastEditorDisplayName: Micah


问:
How to generate more than specific column in Laravel Blade
In my case it's all about pricing table.

Usually specific column in pricing table is 3

So by default is I can create more than 3 pricing but it will break the view because the view is designed for 3 pricing column in a row.

Usually I do this in view

```<code><Div class="row">
@foreach($products as $product)
<Div class="col">
Pricings detail goes here.
</Div>
@endforeach
</Div>
<Div class="clear break"></div>
</code>```

So If pricing is 3 the view will be ok, but it will break if pricing more than 3.

How I can deal with this situation?

My logic so far is create new row and clear break class if pricings divided by 3 is decimal like this simulation.

Pricings 3 div by 3 = 1 row n 1 clear break

Pricings 4 div by 3 = 1.xx so 2 row n 2 clear break

Pricings 6 div by 3 = 2 so 2 row n 2 clear break

Pricings 8 div by 3 = 2.xx so 3 row n 3 clear break

With above logic it should not break the view.

Thanks in advance.

答:
If I understand you correctly, you only want a maximum of 3 columns in each row, and if there are any products left you want to add them to a new row.

You would be able to do it with something like this:

```<code><div class="row">
@foreach($products as $product)
  @if($loop->index % 3 == 0)
    <div class="clear break"></div>
    <div class="row">
  @endif
  <div class="col"></div>
@endforeach
</div>
</code>```

Using the loop variable (see the documentation) you can check how many times you looped. This way you can start a new row before a 4th column would be added.

Body:
In my case it's all about pricing table.

Usually specific column in pricing table is 3

So by default is I can create more than 3 pricing but it will break the view because the view is designed for 3 pricing column in a row.

Usually I do this in view

@foreach($products as $product)

Pricings detail goes here.

@endforeach

So If pricing is 3 the view will be ok, but it will break if pricing more than 3.

How I can deal with this situation?

My logic so far is create new row and clear break class if pricings divided by 3 is decimal like this simulation.

Pricings 3 div by 3 = 1 row n 1 clear break

Pricings 4 div by 3 = 1.xx so 2 row n 2 clear break

Pricings 6 div by 3 = 2 so 2 row n 2 clear break

Pricings 8 div by 3 = 2.xx so 3 row n 3 clear break

With above logic it should not break the view.

Thanks in advance.

Body:
If I understand you correctly, you only want a maximum of 3 columns in each row, and if there are any products left you want to add them to a new row.

You would be able to do it with something like this:

<div class="row">
@foreach($products as $product)
  @if($loop->index % 3 == 0)
    <div class="clear break"></div>
    <div class="row">
  @endif
  <div class="col"></div>
@endforeach
</div>

Using the loop variable (see the documentation) you can check how many times you looped. This way you can start a new row before a 4th column would be added.


问:
How to multiply a matrix with a vector with preserving the shape of the matrix in Tensorflow?
I know, there is a matmul function built in Tensorflow, but if I multiply a Matrix A with a vector v, I get a vector w as a result. But, what I need is, given the matrix A: [[a, b],[c,d]] and a vector v: [[e,f]], I want to get the matrix B: [[ae, bf], [ce, df]]. Both, the matrix and the vector, are tensors</p>

答:
You could use the multiply function of numpy:

```<code>>>> import numpy as np
>>> a = np.array([[1,2],[3,4]])
>>> v = np.array([5,6])
>>> np.multiply(a,v)
array([[ 5, 12],
           [15, 24]])
</code>```

Optionally you could then use .tolist() to transform the numpy array to a Python list:

```<code>>>> np.multiply(a,v).tolist()
[[5, 12], [15, 24]]
</code>```

Body:
You could use the multiply function of numpy:

>>> import numpy as np
>>> a = np.array([[1,2],[3,4]])
>>> v = np.array([5,6])
>>> np.multiply(a,v)
array([[ 5, 12],
           [15, 24]])

Optionally you could then use .tolist() to transform the numpy array to a Python list:

>>> np.multiply(a,v).tolist()
[[5, 12], [15, 24]]


问:
Link Redirect with htaccess
I want to redirect all type of links like that :

www.sitename.com/link1-XXX.html

to

www.sitename.com/link1-XXX/

I don't want to redirect all .html links. I want to redirect all html links which end with XXX.

Solution :

```<code>RewriteRule ^(.*)XXX\.html$ /$XXX/ [R=301,L]
</code>```

答:
You did not specified the question, just told us what you want to do, not what is your problem...

if your problem is, that you dont know how to redirect only links like you described, then put this in your .htaccess with RewriteEngine on:

```<code>RewriteRule ^/(.*)-XXX\.html?$ /$1-XXX/ [L,QSA]
</code>```

I did not really tested this regex..
It should take anything that end with /"something"-XXX.htm and /"something"-XXX.html and redirect it to subaddr named as "something"-XXX/

if you would need append some GET params to the processed url, you should change the regex so it ends like this:

```<code>...html?(.*)$
</code>```

meaning, there can be anything after htm or html

Title: Link Redirect with htaccess

Body:
I want to redirect all type of links like that :

www.sitename.com/link1-XXX.html

to

www.sitename.com/link1-XXX/

I don't want to redirect all .html links. I want to redirect all html links which end with XXX.

Solution :

RewriteRule ^(.*)XXX\.html$ /$XXX/ [R=301,L]

Body:
You did not specified the question, just told us what you want to do, not what is your problem...

if your problem is, that you dont know how to redirect only links like you described, then put this in your .htaccess with RewriteEngine on:

RewriteRule ^/(.*)-XXX\.html?$ /$1-XXX/ [L,QSA]

I did not really tested this regex..
It should take anything that end with /"something"-XXX.htm and /"something"-XXX.html and redirect it to subaddr named as "something"-XXX/

if you would need append some GET params to the processed url, you should change the regex so it ends like this:

...html?(.*)$

meaning, there can be anything after htm or html


问:
Unable to require() from inside an already "required" module
I have this project structure:

```<code>myApp
├── gulpfile.js
├── package.json
└── source
    └── scripts
        ├── modules
        │   └── utils.js
        ├── background.js
        └── data.json
</code>```

My browserify task:

```<code>gulp.task('browserify', function () {
  return gulp.src(['./source/scripts/**/*.js'])
   .pipe($.browserify({
      debug: true,//for source maps
      standalone: pkg['export-symbol']
   }))
   .on('error', function(err){
      console.log(err.message);
      this.emit('end');
    })
   .pipe(gulp.dest('./build/scripts/'));
});
</code>```

My sample utils.js:

```<code>const data = require('../data.json');

const utils = (function () {
  const output = function () {
    console.log(data);
  };

  return {
    output: output,
  };
}());

module.exports = utils;
</code>```

If I try to build it with the current directory structure, I get this error:

module "../data.json" not found from "/dev/myApp/source/scripts/fake_4d8cf8a4.js"

I can only build it, if I put data.json inside the modules directory AND inside the scripts directory, ie. it only works if I duplicate the file:

```<code>myApp
├── gulpfile.js
├── package.json
└── source
    └── scripts
        ├── modules
        │   ├── utils.js
        │   └── data.json
        ├── background.js
        └── data.json
</code>```

Obviously this is not okay... what am I doing wrong?

Thank you

答:
I'm inferring from your use of gulp.src to pass files to $.browerify that you are using a Gulp plugin, probably gulp-browserify. It is generally not recommended to use a plugin to invoke Browserify from Gulp. The recommended way to do it is to just call Browserify directly. Indeed, Gulp's blacklist of plugins states:

```<code>"gulp-browserify": "use the browserify module directly",
</code>```

I've replicated your directory structure and put some reasonable values for the files for which you did not provide contents (data.json, background.js) and indeed, I get the same error you get when I try to run the Gulp code you show. However, if I switch to calling Browserify directly, I do not get any error. Here is the code I have:

```<code>const gulp = require("gulp");
const browserify = require("browserify");
const source = require('vinyl-source-stream');

gulp.task('browserify', function () {
  return browserify({
    entries: ["./source/scripts/background.js",
              "./source/scripts/modules/utils.js"],
    debug: true,//for source maps
    standalone: "foo",
  })
  .bundle()
  .pipe(source('bundle.js')) // This sets the name of the output file.
  .pipe(gulp.dest('./build/scripts/'));
});
</code>```

You use gulp.src(['./source/scripts/**/*.js']) in your code, which means that Browserify will take all your .js files as entries into the bundle.
So I've put two entries in my code above, which manually replicates the pattern you use with the plugin. However, while Browserify does not produce an error with this setup, I suspect you don't actually want to have multiple entries. Typically, we pass one entry point to Browserify and let it trace the require calls to figure what it needs to pull.

Body:
I have this project structure:

myApp
├── gulpfile.js
├── package.json
└── source
    └── scripts
        ├── modules
        │   └── utils.js
        ├── background.js
        └── data.json

My browserify task:

gulp.task('browserify', function () {
  return gulp.src(['./source/scripts/**/*.js'])
   .pipe($.browserify({
      debug: true,//for source maps
      standalone: pkg['export-symbol']
   }))
   .on('error', function(err){
      console.log(err.message);
      this.emit('end');
    })
   .pipe(gulp.dest('./build/scripts/'));
});

My sample utils.js:

const data = require('../data.json');

const utils = (function () {
  const output = function () {
    console.log(data);
  };

  return {
    output: output,
  };
}());

module.exports = utils;

If I try to build it with the current directory structure, I get this error:

module "../data.json" not found from "/dev/myApp/source/scripts/fake_4d8cf8a4.js"

I can only build it, if I put data.json inside the modules directory AND inside the scripts directory, ie. it only works if I duplicate the file:

myApp
├── gulpfile.js
├── package.json
└── source
    └── scripts
        ├── modules
        │   ├── utils.js
        │   └── data.json
        ├── background.js
        └── data.json

Obviously this is not okay... what am I doing wrong?

Thank you

Body:
I'm inferring from your use of gulp.src to pass files to $.browerify that you are using a Gulp plugin, probably gulp-browserify. It is generally not recommended to use a plugin to invoke Browserify from Gulp. The recommended way to do it is to just call Browserify directly. Indeed, Gulp's blacklist of plugins states:

"gulp-browserify": "use the browserify module directly",

I've replicated your directory structure and put some reasonable values for the files for which you did not provide contents (data.json, background.js) and indeed, I get the same error you get when I try to run the Gulp code you show. However, if I switch to calling Browserify directly, I do not get any error. Here is the code I have:

const gulp = require("gulp");
const browserify = require("browserify");
const source = require('vinyl-source-stream');

gulp.task('browserify', function () {
  return browserify({
    entries: ["./source/scripts/background.js",
              "./source/scripts/modules/utils.js"],
    debug: true,//for source maps
    standalone: "foo",
  })
  .bundle()
  .pipe(source('bundle.js')) // This sets the name of the output file.
  .pipe(gulp.dest('./build/scripts/'));
});

You use gulp.src(['./source/scripts/**/*.js']) in your code, which means that Browserify will take all your .js files as entries into the bundle.
So I've put two entries in my code above, which manually replicates the pattern you use with the plugin. However, while Browserify does not produce an error with this setup, I suspect you don't actually want to have multiple entries. Typically, we pass one entry point to Browserify and let it trace the require calls to figure what it needs to pull.