java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Void

Question: Estou tentando efetuar um UPDATE na tabela Usuario, porém ao fazer o submit ocorre erro. Estou com dificuldade em entender o que se trata o erro, poderiam me ajudar?
abaixo está meu código e o erro que está ocorrendo.
Página:
<!DOCTYPE html>

    <title>Cadastro Usuario</title>

        Mensagem vem do Controller

    <form class="card" th:method="${action} == editar ? 'PUT' : 'POST'" th:action="${action} == 'editar' ? @{/usuario/editar/{codigo}(codigo=${usuario.getId_Usuario()})} : @{/usuario/salvarUsuario}" th:object="${usuario}">

Cadastro de Usuário

            <input type="hidden" name="id_usuario" th:value="${usuario.getId_Usuario()}"/>

                Usuário
                <input type="text" required class="form-control col-md-6" id="txtUsuario" name="usuario" th:field="*{usuario}" placeholder="Usuario"/>

                Senha
                <input type="password" required class="form-control col-md-6" id="txtSenha" name="senha" th:field="*{senha}" placeholder="Senha"/>

                E-mail
                <input type="email" required class="form-control col-md-6" id="txtEmail" name="email" th:field="*{email}" placeholder="firstname.lastname@example.com"/>

                Data de Cadastro

                    <input type="text" required class="form-control col-sm-2"   id="dataCadastro" name="dataCadastro"
                        data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-language="pt-BR"
                        data-date-autoclose="true" data-date-today-highlight="true" data-date-orientation="auto"
                        placeholder="Ex.: dd/mm/aaaa" data-mask="00/00/0000" maxlength="10" />

                Situação
                <select class="form-control col-sm-2" id="ddlSituacao" name="status">
                    <option th:each="status : ${todosStatusUsuario}" th:value="${status}" th:text="${status.descricao}"></option>
                </select>

                <button type="submit" class="btn btn-primary col-sm-1">Salvar</button>
                <button type="button" onClick="javascript:history.back()" class="btn btn-secondary col-sm-1">Cancelar</button>

    </form>

Controller
@Controller
@RequestMapping("/usuario")
public class UsuarioController {

    private static final String USUARIO_LISTA = "UsuarioLista";
    private static final String REDIRECT_USUARIO_LISTA = "redirect:/usuario";
    private static final String USUARIO_ACAO = "UsuarioAcao";
    private static final String REDIRECT_USUARIO_ACAO = "redirect:/usuario/novo";

    @Autowired UsuarioServices usuarioServices;

    @RequestMapping("/novo")
    public ModelAndView novo() {
        ModelAndView mv = new ModelAndView(USUARIO_ACAO);
        mv.addObject("todosStatusUsuario", StatusUsuario.values());
        mv.addObject(new Usuario());
        return mv;
    }

    @RequestMapping(value = "/salvarUsuario", method = RequestMethod.POST)
    public String salvar(@ModelAttribute("form") @Validated Usuario usuario, Errors erros, RedirectAttributes attributes) {

        if(erros.hasErrors()) {
            Usuario form = new Usuario();
            BeanUtils.copyProperties(form, usuario);
            return USUARIO_ACAO;
        }

        if(usuario.getId_Usuario() != null) {
            if(usuarioServices.usuarioExiste(usuario)) {
                attributes.addFlashAttribute("classe", "alert alert-warning");
                attributes.addFlashAttribute("mensagem", "Usuário já existe!");
                attributes.addFlashAttribute("usuario", usuario.getUsuario());
                attributes.addFlashAttribute("senha", usuario.getSenha());
                attributes.addFlashAttribute("email", usuario.getEmail());
                return REDIRECT_USUARIO_ACAO;
            }
        }

        try {
            usuarioServices.salvarUsuario(usuario);
            attributes.addFlashAttribute("classe", "alert alert-success");
            attributes.addFlashAttribute("mensagem", "Usuário salvo com sucesso!");
        } catch (Exception ex) {
            attributes.addFlashAttribute("classe", "alert alert-danger");
            attributes.addFlashAttribute("mensagem", ex.getMessage());
        }
        return REDIRECT_USUARIO_ACAO;
    }

    @RequestMapping(value = "{codigo}")
    public ModelAndView editar(@PathVariable Long codigo) {
        ModelAndView mv = new ModelAndView(USUARIO_ACAO);
        Usuario usuario = usuarioServices.buscaPorId(codigo);
        mv.addObject(usuario);
        mv.addObject("action", "editar");
        return mv;
    }

    @RequestMapping(value = "editar/{codigo}", method = RequestMethod.PUT)
    public ModelAndView editarUsuario(@ModelAttribute("form") @Validated Usuario usuario, @PathVariable Long codigo) {
        ModelAndView mv = new ModelAndView(USUARIO_LISTA);
        usuarioServices.editarPorUsuario(usuario, codigo);
        return mv;
    }

}

UsuarioServices:
package com.SystemsSolutions.WebControl.service;

import java.util.Date;
import java.util.List;
import java.util.Optional;

import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.SystemsSolutions.WebControl.model.Perfil;
import com.SystemsSolutions.WebControl.model.Usuario;
import com.SystemsSolutions.WebControl.repository.UsuarioRepository;

@Service
public class UsuarioServices implements UserDetailsService{

    @Autowired
    private UsuarioRepository repository;

    //salva novo usuário
    public void salvarUsuario(Usuario usuario) {
        try {
            Date data = new Date(System.currentTimeMillis());
            usuario.setSenha(new BCryptPasswordEncoder().encode(usuario.getSenha()));
            usuario.setDataAlteracao(data); //GET DATA
            usuario.setHoraAlteracao(data); //GET HORA
            repository.save(usuario);
        } catch (DataIntegrityViolationException ex) {
            throw new IllegalArgumentException(ex.getMessage());
        }

    }

    public Usuario buscaPorId(Long id) {
        Optional<Usuario> lista = repository.findById(id);
        if(!lista.isEmpty())
            return lista.get();
        return null;
    }

    @Transactional()
    public void editarPorUsuario(Usuario usuario, Long id) {
        Date data = new Date(System.currentTimeMillis());
        usuario.setId_Usuario(id);
        usuario.setSenha(new BCryptPasswordEncoder().encode(usuario.getSenha()));
        usuario.setDataAlteracao(data); //GET DATA
        usuario.setHoraAlteracao(data); //GET HORA
        repository.EditByUsuario(
                usuario.getUsuario()
                , usuario.getSenha()
                , usuario.getEmail()
                , usuario.getDataAlteracao()
                , usuario.getHoraAlteracao()
                , usuario.getDataCadastro()
                , usuario.getStatus()
                , id);
    }

    //busca usuário por usuário no banco de dados
    @Transactional(readOnly = true)
    public Usuario buscarPorUsuario(String usuario) {
        return repository.findByUsuario(usuario);
    }

    //busca usuário por email no banco de dados
    public Usuario buscarPorEmail(String email) {
        return repository.findByEmail(email);
    }

    //busca todos os usuários
    public List<Usuario> buscarTodos(){
        return repository.findAll();
    }

    public void deletar(Long id) {
        repository.deleteById(id);
    }

    //autenticação de usuário (spring-security)
    @Override @Transactional(readOnly = true)
    public UserDetails loadUserByUsername(String user) throws UsernameNotFoundException {
        Usuario usuario = buscarPorUsuario(user);
        System.out.println("Usuário encontrado: " + usuario.getUsuario()
                        +  "\nSenha: " + usuario.getSenha()
                        +  "\nStatus: " + usuario.getStatus());

        if(usuario.getStatus().toString().equals("BLOQUEADO") || usuario.getStatus().toString().equals("PENDENTE")) {
            usuario = null;
        }

        return new User(
                usuario.getUsuario(),
                usuario.getSenha(),
                AuthorityUtils.createAuthorityList(getAuthorities(usuario.getPerfis()))
        );
    }
    //converte lista de perfis para array string
    private String[] getAuthorities(List<Perfil> perfis) {
        String[] authorities = new String[perfis.size()];

        for (int i = 0; i < perfis.size(); i++) {
            authorities[i] = perfis.get(i).getDesc();
        }
        return authorities;
    }
}

UsuarioRepository
package com.SystemsSolutions.WebControl.repository;

import java.util.Date;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.SystemsSolutions.WebControl.model.StatusUsuario;
import com.SystemsSolutions.WebControl.model.Usuario;

public interface UsuarioRepository extends JpaRepository<Usuario, Long> {
    //From deve ser identico ao nome da classe, tal classe deve estar mapeada como Entity
    //nome da coluna deve ser identico ao nome do atributo da classe
    @Query("SELECT u FROM Usuario u WHERE u.usuario = :usuarioParam")
    Usuario findByUsuario(@Param("usuarioParam") String usuario);

    @Query("SELECT u FROM Usuario u WHERE u.email = :emailParam")
    Usuario findByEmail(@Param("emailParam") String email);

    @Modifying
    @Query("UPDATE Usuario u "
            + "SET u.usuario        = :usuarioParam"
            + ", u.senha            = :senhaParam"
            + ", u.email            = :emailParam"
            + ", u.dataAlteracao    = :dataAltParam"
            + ", u.horaAlteracao    = :horaAltParam"
            + ", u.dataCadastro     = :dataCadParam"
            + ", u.status           = :statusParam "
            + "WHERE u.id_usuario = :idParam")
    Void EditByUsuario(@Param("usuarioParam") String usuario
                        , @Param("senhaParam") String senha
                        , @Param("emailParam") String email
                        , @Param("dataAltParam") Date dataAlteracao
                        , @Param("horaAltParam") Date horaAlteracao
                        , @Param("dataCadParam") Date dataCadastro
                        , @Param("statusParam") StatusUsuario status
                    , @Param("idParam")Long id);

}

ERRO
2021-02-17 17:18:50.982 DEBUG 11504 --- [nio-8081-exec-8] o.s.web.servlet.DispatcherServlet        : PUT "/usuario/editar/8", parameters={masked}
2021-02-17 17:18:50.982 DEBUG 11504 --- [nio-8081-exec-8] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to com.SystemsSolutions.WebControl.controller.UsuarioController#editarUsuario(Usuario, Long)
2021-02-17 17:18:51.085 DEBUG 11504 --- [nio-8081-exec-8] org.hibernate.SQL                        : update usuario set usuario=?, senha=?, email=?, data_alteracao=?, hora_alteracao=?, data_cadastro=?, status=? where id_usuario=?
Hibernate: update usuario set usuario=?, senha=?, email=?, data_alteracao=?, hora_alteracao=?, data_cadastro=?, status=? where id_usuario=?
2021-02-17 17:18:51.085 TRACE 11504 --- [nio-8081-exec-8] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [VARCHAR] - [EMERSON]
2021-02-17 17:18:51.086 TRACE 11504 --- [nio-8081-exec-8] o.h.type.descriptor.sql.BasicBinder      : binding parameter [2] as [VARCHAR] - [$2a$10$tUBTCwTcRTEJgjcHln8NGeVdD.b6kzayoqOF44UELVPRk6wd.v6nS]
2021-02-17 17:18:51.086 TRACE 11504 --- [nio-8081-exec-8] o.h.type.descriptor.sql.BasicBinder      : binding parameter [3] as [VARCHAR] - [email@example.com]
2021-02-17 17:18:51.086 TRACE 11504 --- [nio-8081-exec-8] o.h.type.descriptor.sql.BasicBinder      : binding parameter [4] as [DATE] - [Wed Feb 17 17:18:50 BRT 2021]
2021-02-17 17:18:51.086 TRACE 11504 --- [nio-8081-exec-8] o.h.type.descriptor.sql.BasicBinder      : binding parameter [5] as [TIME] - [Wed Feb 17 17:18:50 BRT 2021]
2021-02-17 17:18:51.086 TRACE 11504 --- [nio-8081-exec-8] o.h.type.descriptor.sql.BasicBinder      : binding parameter [6] as [DATE] - [Wed Feb 17 00:00:00 BRT 2021]
2021-02-17 17:18:51.086 TRACE 11504 --- [nio-8081-exec-8] o.h.type.descriptor.sql.BasicBinder      : binding parameter [7] as [VARCHAR] - [ATIVO]
2021-02-17 17:18:51.086 TRACE 11504 --- [nio-8081-exec-8] o.h.type.descriptor.sql.BasicBinder      : binding parameter [8] as [BIGINT] - [8]
2021-02-17 17:18:51.092 DEBUG 11504 --- [nio-8081-exec-8] o.s.web.servlet.DispatcherServlet        : Failed to complete request: java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Void (java.lang.Integer and java.lang.Void are in module java.base of loader 'bootstrap')
2021-02-17 17:18:51.096 ERROR 11504 --- [nio-8081-exec-8] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Void (java.lang.Integer and java.lang.Void are in module java.base of loader 'bootstrap')] with root cause

java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Void (java.lang.Integer and java.lang.Void are in module java.base of loader 'bootstrap')
    at com.sun.proxy.$Proxy456.EditByUsuario(Unknown Source) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) ~[spring-aop-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:205) ~[spring-aop-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at com.sun.proxy.$Proxy453.EditByUsuario(Unknown Source) ~[na:na]
    at com.SystemsSolutions.WebControl.service.UsuarioServices.editarPorUsuario(UsuarioServices.java:59) ~[classes/:na]
    at com.SystemsSolutions.WebControl.service.UsuarioServices$$FastClassBySpringCGLIB$$3ab2fb79.invoke(<generated>) ~[classes/:na]
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771) ~[spring-aop-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:367) ~[spring-tx-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:118) ~[spring-tx-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691) ~[spring-aop-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at com.SystemsSolutions.WebControl.service.UsuarioServices$$EnhancerBySpringCGLIB$$772b0101.editarPorUsuario(<generated>) ~[classes/:na]
    at com.SystemsSolutions.WebControl.controller.UsuarioController.editarUsuario(UsuarioController.java:91) ~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:878) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:792) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:920) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:655) ~[tomcat-embed-core-9.0.37.jar:4.0.FR]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.37.jar:4.0.FR]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.37.jar:9.0.37]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:158) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) ~[spring-security-web-5.3.3.RELEASE.jar:5.3.3.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:94) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1589) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) ~[na:na]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
    at java.base/java.lang.Thread.run(Thread.java:832) ~[na:na]

Answer: No seguinte método:
Void EditByUsuario(@Param("usuarioParam") String usuario
                    , @Param("senhaParam") String senha
                    , @Param("emailParam") String email
                    , @Param("dataAltParam") Date dataAlteracao
                    , @Param("horaAltParam") Date horaAlteracao
                    , @Param("dataCadParam") Date dataCadastro
                    , @Param("statusParam") StatusUsuario status
                    , @Param("idParam") Long id);

O tipo Void não é suportado. Você provavelmente estava procurando pelo tipo void.
De acordo com a documentação do Spring Data, o retorno da função também pode ser:

boolean: true se alguma linha foi alterada, false caso contrário; ou
int: retorna o número de linhas alteradas.

Conforme o apêndice D do Spring Data JPA wrappers (e.g., Integere Boolean) também são suportados.
O Spring Data está se perdendo com a assinatura de método com um tipo de retorno não suportado. A implementação gerada pela biblioteca está tentando converter um tipo Integer para o tipo Void.

java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Void (java.lang.Integer and java.lang.Void are in module java.base of loader 'bootstrap').

Dito isso, uma vez que você está usando hibernate com o spring-data, o método editByUsuario e seu update statement explícito em JPQL me parecem desnecessários. Você pode fazer a mesma coisa com métodos padrão do JpaRepository.
@Transactional
public void editarPorUsuario(Usuario usuario, Long id) {
    // assumindo que usuario é detached
    // obtém uma referência para o usuário administrado pelo contexto de persistência
    Usuario managedUser = repository.getOne(id);
    // Copia dados a serem atualizados
    Date data = new Date(System.currentTimeMillis());
    managedUser.setUsuario(usuario.getUsuario());
    managedUser.setSenha(new BCryptPasswordEncoder().encode(usuario.getSenha()));
    managedUser.setEmail(usuario.getEmail());
    // ... outros campos a serem atualizados
    managedUser.setDataAlteracao(data);
    managedUser.setHoraAlteracao(data);

    /* Opcionalmente você pode chamar operações de save ou saveAndFlush
     * Mas veja que como você já tem uma transação aberta isso costuma ser
     * um anti-pattern: https://vladmihalcea.com/jpa-persist-and-merge/
     */
}

Na verdade, os outros dois métodos de UsuarioRepository também podem ser simplificados uma vez que o Spring Data consegue derivar a consulta do nome do método. Parece que você já está usando a nomenclatura correta para criar consultas, o em ambos os casos o uso de @Query e @Param são desnecessários. Porém isso foge ao escopo da pergunta.
Comment: Deu certo, mudei o retorno para Integer e funcionou. valeu parceiro.


Difference between android SDK versions

Question: I want to know what is the difference between using Android x.x version and Android Google Api x.x ?
Answer: Android Google Api x.x has Google Maps enabled...
Answer: Android Google API includes Google Maps, some demo and documentation about it, and also USB Open Accessories. More details here
Answer: You need to use google API when your app is related with any location finding section.
Comment: Thanks for the answers, but i want to know why they d'ont use one version including everything,
extra features d'ont hurt :)
Comment: IF you feel that answer has helped you .. please mark as correct.. that other can take help from this, Thanks

Difference between android SDK versions


Gunicorn is not logging on start-up while using custom logging config

Question: I am creating a Flask app to run on Gunicorn and needed the logs to be in JSON format and with a specific format.
As such, I created a custom "logging config" file.
Gunicorn is correctly logging, in JSON, when a request is received, but I lost the default "start-up logging" that Gunicorn used to be doing before.
I am launching the application like this:
gunicorn -w 2 --log-config resources/gunicorn_logging.config 'wsgi:app'

Here are the "gunicorn_logging.config" contents:
[loggers]
keys=root, gunicorn.error, gunicorn.access

[handlers]
keys=console

[formatters]
keys=json

[logger_root]
level=INFO
handlers=console

[logger_gunicorn.error]
level=ERROR
handlers=console
propagate=1
qualname=gunicorn.error

[logger_gunicorn.access]
level=INFO
handlers=console
propagate=1
qualname=gunicorn.access

[handler_console]
class=StreamHandler
formatter=json
args=(sys.stdout, )

[formatter_json]
class=src.logging_helpers.json_formatter.GunicornLogFormatter
format='%(log_level)s %(msg)s %(timestamp)s'

Here is the formatter code:
class GunicornLogFormatter(JsonFormatter):
    def add_fields(self, log_record, record, message_dict):
        super(GunicornLogFormatter, self).add_fields(log_record, record, message_dict)

        now = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S.%fZ')
        log_record['timestamp'] = now

        if 'r' in record.args:
            log_record['request'] = record.args.get('r')
            log_record['msg'] = None
        if 's' in record.args:
            log_record['status_code'] = record.args.get('s')
        if 'level' in log_record:
            log_record['log_level'] = log_record['level'].upper()
        else:
            log_record['log_level'] = record.levelname

This is what I get when a request comes to the application, which is great:
{"log_level": "INFO", "msg": null, "timestamp": "2022-10-10T22:32:40.663159Z", "request": "GET /_/health HTTP/1.1", "status_code": "200"}

And this is what I lost and would like to get back, but in json format:
[2022-10-10 23:42:47 +0100] [95107] [INFO] Starting gunicorn 20.1.0
[2022-10-10 23:42:47 +0100] [95107] [INFO] Listening at: http://127.0.0.1:8000 (95107)
[2022-10-10 23:42:47 +0100] [95107] [INFO] Using worker: sync
[2022-10-10 23:42:47 +0100] [95108] [INFO] Booting worker with pid: 95108
[2022-10-10 23:42:47 +0100] [95109] [INFO] Booting worker with pid: 95109

I've tried adding prints inside the formatter "add_field" function to see if it was called on start-up, but it isn't so it doesn't look like I am losing the messages there somehow.
Any help is highly appreciated.
Answer: I solved this issue, which was simply a matter of having the logger for gunicorn.error at INFO logging level as such:
[logger_gunicorn.error]
level=INFO
handlers=console
propagate=1
qualname=gunicorn.error

Had no idea that the start-up logs end up in gunicorn.error, but here we are...
That being said, I now have a new problem, which is the fact that the logging doesn't dynamically replace the values for version, running port, etc. as it does by default without custom configuration.
I detail it here, in case you are having the same issue:
Gunicorn logging stopped replacing values


Websphere 7.0 Work Manager Max Threads Ignored?

Question: I'm trying to chase down a bug in an internal application and as part of this work I noticed an apparent discrepancy between the "Maximum number of threads" setting in WAS (BASE 126.96.36.199 r0835.03) and a thread dump that I took while the server was running. I'd like to know if this behavior is correct or if it's potentially a bug, either in WAS or our application.
So, in WAS I have a Work Manager configured at server scope:
MyWorkManager
Work Timeout: 0
Work Request Queue Size: 0
Queue Full: Block
Service Names: Security (only)
Alarm Threads: 2
Min Threads: 0
Max Threads: 5
Thread Priority: 5
NOT GROWABLE
Once our application is up and using the work manager, I take a thread dump using wsadmin and there are 19 threads actively doing work that have the name:
java.lang.ThreadGroup[name=MyWorkManager: my_ear,maxpri=10]
I would have assumed that we'd see a maximum of 5 work manager threads. Any ideas as to what could be going on or further diagnostics that I can run?
Answer: Fixed by applying WAS 7 fixpack 15. Apparently this was a bug in Websphere.


Como pegar o index do botão clicado?

Question: Eu estou usando um loop para gerar elementos dinamicamente:
for(var i =0; i< arrSequencia.length;i++ ){
strInterface += "
"+
    ""+
        "   <input type=\"button\" class=\"btn btn-danger btn-info-bloco sembloco\" value=\"Botao "+arrSequencia[i]+"\"/>"+
        "	"+

    "
";
}

Tem como eu capturar o index do botão clicado ?
Por exemplo:
Problema:
Se eu clicar no segundo botão, é me retornado o index: 1
    var acaoBotao = function() {
        //PEGAR O INDEX
    };

    function adicionaOuRemove() {
        var botoes = document.getElementsByClassName("btn-info-bloco");
        for(var i=0;i<botoes.length;i++){
            botoes[i].addEventListener('click', acaoBotao, false);
        }
    }

Exemplo:

var arrSequencia = [1,2,3,4,5];
var strInterface ="";

$(document).ready(function(){menuQuestoes = $("#table");

for(var i =0; i< arrSequencia.length;i++ ){
    strInterface += "
"+
                ""+
                "   <input type=\"button\" class=\"btn btn-danger btn-info-bloco sembloco\" value=\"Botao "+arrSequencia[i]+"\"/>"+
                "	"+

                "
";
}
        menuQuestoes.find("#tbody-content").append(strInterface);

});

var acaoBotao = function() {

alert("//PEGAR O INDEX");
};

function adicionaOuRemove() {
    var botoes = document.getElementsByClassName("btn-info-bloco");
    for(var i=0;i<botoes.length;i++){
        botoes[i].addEventListener('click', acaoBotao, false);
    }
}
adicionaOuRemove();

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>

No jsFiddle
Answer: jQuery
$('.btn').on('click', function(){
   alert(($this).val());
});

Use o this para isso. Na função do click você tem que colocar o seletor como classe do botão, visto que serão vários. No seu caso tem várias classes o botão, mas eu coloquei a .btn.
JS
var acaoBotao = function() {
    alert(this.value);
};

Comment: há um jeito de pegar o index sem ser pelo value? tentei passar o i para a função          botoes[i].addEventListener('click', acaoBotao(i), false);
, mas não deu certo
Answer: Como cada botão está em uma linha distinta da sua tabela, você pode "simular" o índice dele adicionando um atributo no seu botão quando cria ele, e depois recuperar este índice utilizando a função .data() do jQuery. Exemplo:
for(var i =0; i< arrSequencia.length;i++ ){
strInterface += "
"+
    ""+
        "   <input type=\"button\" class=\"btn btn-danger btn-info-bloco sembloco\" value=\"Botao "+arrSequencia[i]+"\" data-index=\" + i +\"/>"+
        "	"+

    "
";
}

var acaoBotao = function(el) {
    return $(el.srcElement).data('index');
};

Exemplo no FIDDLE
Answer: Uma vez que já tens um loop para criar os botões podes usar isso mesmo e inserir o index num campo data-index. Nesse caso o código seria assim:
for(var i =0; i< arrSequencia.length;i++ ){
    strInterface += "
"+
                ""+
                "   <input type=\"button\" data-index=\"" + i + "\" class=\"btn btn-danger btn-info-bloco sembloco\" value=\"Botao "+arrSequencia[i]+"\"/>"+
                "	"+

                "
";
}

e depois dentro da tua função acaoBotao podes fazer:
 var index = this.dataset.index;

Outra alternativa é fazer isso quando juntas os observadores de eventos. Nesse caso poderias fazer assim:
var acaoBotao = function (index) {
    return function(){
     // usar o index
    }
};

function adicionaOuRemove() {
    var botoes = document.getElementsByClassName("btn-info-bloco");
    for (var i = 0; i < botoes.length; i++) {
        botoes[i].addEventListener('click', acaoBotao(i), false);
    }
}

Como pegar o index do botão clicado?


Strange image of a polynomial function

Question: I have some troubles with plotting a polynomial with confidence bounds. Here's my code:
import matplotlib.pyplot as plt
import numpy as np
X = np.array([-5.965215369881319, -40.41538208207736, -15.584956679988448, -6.073510488327594, -11.784890508714675, -7.754674907524617, -17.482364474520395, 2.4347468437246667, -16.133111795228572, -15.815302670890363, 5.9730059659614305, -19.249139823392717, 4.044936045002517, -7.102200416593474, 5.035187269390729, -23.543269648523623, -12.593308808761405, -21.08859785268947, -24.712871361819676, 2.4347468437246667, -21.028901691001877, -15.815302670890363, 7.208054914877421, -29.6589088548177])
Y = np.array([-2.6822693448184607, -23.168555618313547, -3.6166894384329806, -3.5137320916685866, -3.770179381108618, -12.788411352407874, -15.698803377485447, 1.9978332067376703, -11.838042662997829, -8.377671546754629, 8.109573809406804, -14.749849913813343, 2.8160696371542833, -3.3810722874645083, 5.560322978176329, -16.710386872172883, -6.795050134412731, -9.855604995547115, -25.386715163603533, 1.9978332067376703, -11.828949808296766, -8.402106796338003, 7.631911984593458, -18.155638519731614])
#
plt.plot(X, Y, '.')

poly_degree = 5
sd_cutoff = 1 # 2 keeps everything

coeffs = np.polyfit(X, Y, poly_degree)
poly_eqn = np.poly1d(coeffs)

Y_hat = poly_eqn(X)
delta = Y - Y_hat
sd_p = np.std(delta)

ok = abs(delta) < sd_p * sd_cutoff

plt.scatter(X, Y, color=np.where(ok, 'k', 'r'))
plt.fill_between(
    X,
    Y_hat - sd_p * sd_cutoff,
    Y_hat + sd_p * sd_cutoff,
    color='#00000020')
plt.plot(X, Y_hat)

Why my polynomial seems so strange?
https://i.stack.imgur.com/m2eR8.jpg
Comment: Your x-values are [not sorted](https://stackoverflow.com/questions/50516862/scipy-curve-fit-returns-multiple-lines/50516979#50516979).
Answer: Since the linked question does not provide a sorting solution, here the code that will sort X-Y pairs:
...
ind = np.argsort(X)
X = X[ind]
Y = Y[ind]
...

Output:

Strange image of a polynomial function


logging working on local site but not remote site

Question: I recently migrated from Drupal 8 to 9. Works ok on my local (MAMP on Mac), but not on the remote (AWS Lightsail). Local has PHP 7.4.12, Remote has PHP 7.4.2.
I put the entire codebase in git, and pulled it to my remote server. I created settings.php for the remote host, set trusted_host_patterns, sites.php, .htaccess. I had a similar setup for Drupal 8 on the remote, which worked flawlessly.
Here's what I see in my apache error log when I try to hit the home page:

AH01071: Got error 'PHP message: Drupal\\Core\\Database\\DatabaseAccessDeniedException: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost'

I did set the correct mysql user/pwd in settings.php and verified it was reading it by changing the user, and could see the new user name in the errors.

AH01071: Got error 'PHP message: Error: Interface 'Psr\\Log\\LoggerInterface' not found in /home/bitnami/repo/www/web/core/modules/dblog/src/Logger/DbLog.php on line 16

I do have "psr/log": "^1.1" in my composer.json.
What I'm not getting is why things work on my local, but not my remote.
Comment: For the first question, you need to configure the settings.local.php to point to the real database host, user and password. I doubt in Amazon you can use user root to point to localhost, so be sure you set the right values. Regarding second question, having psr/log in your composer doesn't mean it was installed. Did you run 'composer install' to be sure it was deployed? Did you get any error message?
Comment: To make sure the db connection is indeed being made. You could delete the settings.php file and let Drupal recreate it when you try to view the site. You'll get the instalation wizard as if you were doing a fresh install except since the DB is not empty, it will not install Drupal to the DB.
Comment: Also, wouldn't hurt to run `composer install --no-interaction --prefer-dist --optimize-autoloader`
Comment: Thanks for the suggestions.I do have a different Lightsail server that's configured similarly, but is running a Drupal 7 site; works fine with user=root and host=localhost. I'm using the LAMP/PHP stack, and installed mysql manually. Yes, using root as username isn't a great idea, but this is a temporary dev server with little value to the data. I did run composer install with the args you recommended, made no difference.
Comment: Still getting the PSR error: `Error: Interface 'Psr\\Log\\LoggerInterface' not found in /home/bitnami/repo/www/web/core/modules/dblog/src/Logger/DbLog.php on line 16 #0 /home/bitnami/repo/www/vendor/composer/ClassLoader.php(480): include()\n#1 /home/bitnami/repo/www/vendor/composer/ClassLoader.php(346)`
Answer: Found the problems - ever want to kick yourself for overlooking the obvious - the reason it wasn't finding psr/log is that when I restored it from git, I didn't realize it was a submodule. After cloning the repo, I had to:
Issue a git submodule init command.
Issue a git submodule update command.
And the login error I was having was due to a network error on my end, it wasn't pointing to the correct server.
Glad I got this solved, and great appreciate the suggestions.


Making landing pages with taxonomy

Question: I'm trying to make about 100 landing pages using taxonomy.
I'm trying to stick to Drupal 8 core features as much as possible.
I created two taxonomy vocabularies, Places and Main keyword.
Now, what I want to do is create landing pages that consist of:
1 place + 1 keyword
Places

London
Paris
Berlin

Main keywords

Apples
Oranges

Combinations (each of these is a landing page using tokens from both keywords in Views blocks [perhaps attached by Layout Builder] to make the page)

London + Apples
London + Oranges
Paris + Apples
Paris + Oranges
etc.

What module(s) should I use to link taxonomy terms from two different vocabularies together like this (preferably, in an automatic way so the relevant pages are automatically generated when I add a new term in either vocabulary)?
I have been experimenting with Views and Layout Builder but I haven't come up with a solution yet.
What I tried

I used the Views "taxonomy term page" view to override the taxonomy term pages; this lets me do what I want for a single term in a single vocabulary, but I want to use two terms in combination from two different categories.
Answer: How I'm doing this now

Create a new content type, Landing Page.
Add two fields, an entity reference to Places and an entity reference to Main keywords.
Use Views blocks/Layout Builder to rewrite the HTML of the content type to show the text you want with the relevant keywords substituted in.
When you add a new term to either vocabulary, you have to create all the possible combinations manually by adding Landing Page content.
Answer: Another option is to use a custom view page that allows to filter with any taxonomy terms combined with depth.
Then create a path alias for each filtered page to hide the arguments.

Making landing pages with taxonomy


add render array to custom entity in controller

Question: I have a custom entity, with a controller class that extends EntityViewController much like the node module does in core. The view method in this class returns a render array $build and it is called by the router for my entity.
I would now like to attach some more content to this render array, specifically some articles from another site. I have a class of my own that I am able to implement like this inside the view() function:
$client = new FrontpageArticlesBuilder();
$articles = $client->toRenderArray();

Where $articles is a render array. I would like to know how I can append this render array to my existing $build render array returned by view() method in my controller.
Answer: You can simply add this to the build array with an arbitrary key name. The only condition is of course that it does not already exist. Every key that does not start with a '#'-sign will be interpreted as another render element or an array of nested render elements.
$build['articles'] = $articles;

Comment: It was slightly more complicated in my case considering `$build = parent::view($listing, $view_mode, $langcode);` I had initiate a new empty $page_array, then do `$page_array[] = $build; $page_array[] = $articles;`


Change the filter widget type in a views

Question: When adding a reference field as a filter in a views the default widget of the filter is drop down.
Is there a way to change it to a auto complete widget?
Answer: I think you might be looking for something like Views Autocomplete Filters.  The D7 version is in development but it sounds like it might be worth a try.


NSTimer doesn't work well if time interval less then 0.5 seconds objective c

Question: NSTimer doesn't work well or can't call desired method on time if time interval is less then 0.5 seconds or in neno seconds so i just want to know is there any alternative of NSTimer which can work for time interval less then 0.5 seconds?
Thanks in advance
Comment: As wikipedia would say, "Citation needed".  Your source was unreliable.  If you explain what you need the timer for, we will tell you whether `NSTimer` is appropriate, or whether there is a better choice.
Comment: What sections of Apple developer documentation have you reviewed?
Comment: If you're talking about nano seconds then NSTimer really isnt't the proper tool. :)
Answer: Before anything, the precision is much better than half a second. My tests give good results even at 100 ms.
The problem isn't the fire delay, it's the leeway: essentially, timers are polled at a certain interval, and if the delay is close to that interval, you might run into problems. For instance, assume that timers are checked every 30 ms, and that you have a timer scheduled in 31 ms. 30 ms later, it still isn't due, so it doesn't trigger; however, the next check will be done 30 ms later, and as such your timer will actually be triggered 60 ms after its start instead of 31.
If you really need better than that, you can use Grand Central Dispatch timers. You may get suboptimal results if you dispatch on the main queue, though.


Developing a custom ribbon add-in for PowerPoint (Office 365) Mac

Question: I have recently switched to Mac from my Windows work laptop where I had some nice features installed via PowerPoint add-ins that I would like to replicate.
I have all my macros working, and I am now trying to turn them into a working add-in that I can load on my machine.
Now, before we get to the tricky part of signing the add-in and bla bla bla.. I am starting really simple (pptm file with custom toolbar). I have followed ron de bruin's amazing guide. However, when I launch my presentation on Mac (on Windows they work), the buttons don't trigger the macro (no matter what macro).
Here is the customUI.xml files content
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
  <ribbon>
    <tabs>
      <tab id="MyCustomTab" label="My Tab" insertAfterMso="TabHome">

      <group id="customGroup1" label="Group 1">
          <button id="customButton1" label="Caption 1" size="normal" onAction="Macro1" imageMso="Cut" />
          <button id="customButton2" label="Caption 2" size="normal" onAction="Macro2" imageMso="Bold" />
          <button id="customButton3" label="Caption 3" size="normal" onAction="Macro3" imageMso="Italic" />
        </group>

      </tab>
    </tabs>
  </ribbon>
</customUI>

And here is the content of my macro's module in VBA:
Option Explicit

'Callback for customButton1 onAction
Sub Macro1(control As IRibbonControl)
    MsgBox "This is macro 1"
End Sub

'Callback for customButton2 onAction
Sub Macro2(control As IRibbonControl)
    MsgBox "This is macro 2"
End Sub

'Callback for customButton3 onAction
Sub Macro3(control As IRibbonControl)
    MsgBox "This is macro 3"
End Sub

Any idea what I am doing wrong?
Comment: Wild guess, are there any other documents open that may have a `Macro1`, can you try using a name that is unique? Like `CBTest190831`
Comment: Also, does the code compile on the mac? What Version of Office are you using on the mac?
Comment: Hi, I am on version 19081202. I have tried a unique name without success.
Answer: I can confirm that the connection between XML and VBA callbacks in PowerPoint for Mac is broken. Using your sample XML and VBA, I created identical ribbon mods in PowerPoint, Word and Excel macro-enabled files. All three worked as expected in Windows. Only Word and Excel worked as expected in Office 2019 for Mac.
I've reported this bug to Microsoft using the smailey-face icon in the upper-right of the program window.
Answer: I have made it possible to (temporarily) solve the issue by setting the following preferences in "Security and Privacy":
* Macro Security > Enable All
* Trust access to the VBA project object model
* Allow actions to run programs without notification

Hoper this helps
Comment: Thanks for mentioning that, but those aren't settings I would recommend to anyone but a cybersecurity expert.
Comment: Odd. I went to test your settings and the ribbon mods ran the macros without changing any settings. Must be a full moon...


Finding median without raw data?

Question: I have only summary statistics for each state in the United States. I have the mean and median prices for each state and that's it.
How can I estimate an "overall" median price for the nation? I understand whatever I calculate won't be a "true" median due to the lack of raw data, but I still need a number.
Can I somehow estimate percentiles with this information and find the 50th percentile? A weighted "average" is not that reliable I feel So I would really appreciate some guidance.
*Edit: I am currently using a weighted median and I would like to improve upon that and make it more complex/exact to avoid large differences in prices.
Comment: Please don't vandalize your posts.
Comment: Yes, sorry, I meant the United States.
Comment: Are there other distributional summaries of the groups aside from mean/median?
Comment: The only other pieces I have are similar to a min/max although not the actual min/max...just the typical prices on  the lower-end and higher-end of the spectrum. It's bizarre but i repy on other organizations reporting this data. We usually calculate this "weighted-avg" median and find percentiles from there.
Comment: oop, that was for @AdamO
Comment: Can you please edit your question to link to [your later closely related question](https://stats.stackexchange.com/q/308342/1352)?
Answer: Your least-bad option is likely to be a weighted median of the state medians, where you would weight each separate state's median by the number of data points that went into calculating it, e.g., the number of house sales if you are looking at house prices.
If you don't have this raw number, you might be able to use state population as a proxy for weighting.
This is still systematically wrong, since some states will likely have systematically higher or lower prices than others. So you could definitely improve matters by collecting more data and/or setting up a more complex model.
Comment: What about using two different weighting approaches? One as main analysis and the other (or additional others) as sensitivity analysis?
Comment: Hello @Joe_74. I apologize I am not sure what you mean, I am sort of a novice at this stuff. Could you please elaborate on these analyses?
Comment: Hello @stephan, that is precisely what I have done. However I do need a more complex problem to avoid the exact issue you mentioned (I have some wildly different prices). Do you have any pointers/ideas for a more complex model?
Comment: @Didi Basically, you can choose a weighting approach and run the main analysis. Then, use a different weighting approach, and see whether the results hold or change systematically in direction or magnitude. Have a look here for a detailed explanation of what a sensitivity analysis is: https://en.wikipedia.org/wiki/Sensitivity_analysis
Comment: To be honest, all the smart ideas that come to my mind (e.g., sampling data points randomly between each state's min and max) have probably about as much chance to further bias your result as they have to improve it. So all you can probably do is collect more data. Are there any additional sources you could get data from? Also: if prices differ systematically between states, how useful is an overall median, anyway?
Comment: @StephanKolassa I agree with you, it is more for completion reasons even though the number might not be that meaningful.

Finding median without raw data?


Compute the number of ways the frog can start at point (0,0) and end at point (5,5)

Question: I recently gave an online assignment on quantitative aptitude, I am getting 120 ways but I am not confident about it.
A frog is trying to get from point A to point B without overshooting, but he can only move up or right. he always alternates his step sizes between moving 1 unit in a single direction and moving 2 units in a single direction. Compute the number of ways the frog can start at point A(0,0) and end at point B(5,5)
Thanks!
Comment: Hi, please let us know how you decided on 120 ways.  Have you tried checking that your method works? You can explicitly count out the paths. If there are too many, maybe try the paths from $(0,0)$ to (say) $(3,3)$ and see if your method gives the correct count.
Comment: Welcome to MSE. Your question is phrased as an isolated problem, without any further information or context. This does not match [many users' quality standards](https://math.meta.stackexchange.com/q/9201), so it may attract downvotes, or be closed. To prevent that, please [edit] the question. [This](https://math.meta.stackexchange.com/q/9959) will help you recognize and resolve the issues. Concretely: please provide context, and include your work and thoughts on the problem. These changes can help in formulating more appropriate answers.
Answer:
Statement 1. The length of the frog's path is always equal to $10$ units.

Indeed, the frog must move $5$ units to the right and $5$ units up in some order. And $5+5=10.$

Statement 2. The starts with the $1$ unit jump.

The frog covers $3$ units in two consecutive jumps. And $10$ modulo $3$ is $1$. In other words, if the frog started with a $2$ units jump, then it would cover the distance $(2+1)+(2+1)+(2+1)=9$ or $(2+1)+(2+1)+(2+1)+2=11$ units, but not $10$.

Statement 3. The frog made exactly $7$ jumps.

It's because the sum $1+2+1+2+1+2+1=10$ has exactly $7$ summands.

Statement 4. The frog made at least $3$ vertical and at least $3$ horizontal jumps.

If the frog made less than $3$ horizontal jumps, then it moved at most $2\times 2=4$ units to the right, which is not enough. The same for vertical jumps.
All the possible paths split into two groups. One group consists of the paths with $3$ horizontal and $4$ vertical paths. The other, vice versa, consists of the paths with $4$ horizontal and $3$ vertical paths.

Statement 5. There is the same number of paths in each group.

The groups have the same number of paths because there is a natural symmetry between those two groups of paths. We just change all the horizontal jumps to the vertical ones, and vice versa. For example, the path HVVHVHV corresponds to the path VHHVHVH, where H is a horizontal jump and V is a vertical jump.
Thus, we only need to count the number of ways in the first group and multiply it by $2$.

Statement 6. Every path from the first group has one $1$-unit and two $2$-units horizontal jumps.

This is the only way to get the sum $5$ with $3$ summands equal to $1$ or $2$: $5=2+2+1.$

Statement 7. Every path from the first group has three $1$-unit and one $2$-unit vertical jumps.

The only way to represent $5$ as a sum of $4$ summands equal to $1$ or $2$ is $5=2+1+1+1$.

Statement 8. There are $12$ paths in the first group.

Indeed, we must choose which of the three horizontal jumps is a $1$-unit jump ($3$ ways to do so) and choose which of the four vertical jumps is a $2$-units jumps ($4$ ways to do so). So $3\times 4=12$ ways to choose a path overall.

Statement 9. The answer to your problem is $24$.

Since $12\times 2=24$.


JQuery, inicializando com função

Question: Estou em um curso online de JQuery onde o professor propôs um código assim:
var inicia = function(){
    var valorTotalItens = $('.valor-total-item');
    var valorBase = 0;
    for (var i = 0; i < valorTotalItens.length; i++) {
        var valorItemTotal = $(valorTotalItens[i]);
        var valorItem = parseFloat(valorItemTotal.text());
        valorBase = valorBase + valorItem;
    }
    $('#quantidade-itens').text(valorTotalItens.length);
    $('#valor-itens').text(valorBase);
}
$(inicia);

porém, eu escrevi a última linha antes que ele passasse, e escrevi de outra forma
inicia();

Queria saber qual a diferença, e o por que, de o meu código funcionou, mesmo depois de o professor falar que estava errado, e que o mesmo não deveria rodar.
Answer: Sem delongas, seu professor deve ter cometido um erro em falar que seu código não iria funcionar. O que você fez foi utilizar algo que é muito comum em JavaScript puro que é criar uma Expressão de função, que é quando você atribui o endereço de uma função a uma variável.
Uma das formas (Se não for a única) de invocar essa função sem JQuery é justamente chamando essa variável com um "abre e fecha parênteses", e você fez exatamente isso: inicia(); É muito comum isso.
O que o comando $(inicia) faz é utilizar o JQuery selector para retornar um objeto JQuery. Como seu selector é uma função, o que vai ocorrer é que a função será chamada e seu retorno será encapsulado num objeto JQuery.
Logo, a cada vez que utilizar $(inicia), sua função será executada da mesma forma que inicia(); ocorre em JS puro. A diferença é que a $(inicia) retorna um objeto JQuery e a instrução inicia(); não.
Comment: Obrigado man :D

JQuery, inicializando com função


Players with 300 or more goals for a single team in all competitions (European clubs)

Question: Having already started a discussion for the players that has 300 or more goals in top flight domestic league for an European club let's distinguish a question for players with more than 400 goals in all competitions for a single club in Europe. Excluding friendly matches.
Related questions:

Players with 300 or more goals for a single team in top flight domestic league (European clubs)
Players with 300 or more goals in top flight domestic league (European clubs)
Players with 400 or more goals in all club competitions (European clubs)
Answer: Here are two rankings by the FCBarcelona.com official page and Spanish paper Sport, which are used as the most reliable ones (for the retired players).
Pele's goals are not scored in Europe, anyway, they are pointed as an ultimate achievement.
As per 5 June 2023:

#
Player
Team
Goals

1
Lionel Messi
Barcelona
672

-
Pelé
Santos
643

2
Josef Bican
Slavia Prague
534

3
Gerd Müller
Bayern München
525(5641)

4
Jimmy McGrory
Celtic
522

5
Uwe Seeler
Hamburger
507

6
Eusebio
Benfica
473

7
Cristiano Ronaldo
Real Madrid
450

8
José Águas
Benfica
379

9
Nené
Benfica
359

10
Karim Benzema
Real Madrid
354

11
Ian Rush
Liverpool
346

12
Robert Lewandowski
Bayern Munich
344

13
Telmo Zarra
Athletic Bilbao
336

14
Raúl
Real Madrid
323

15
Alfredo Di Stéfano
Real Madrid
307

1 Gerd Müller has scored 39 more goals in 1964-65 season for Bayern in Regionalliga Süd, which existed as the second tier of the German football league system from 1963 to 1974.


Mathematical Induction Proof, need help on how to explain this one statement.

Question: Use Mathematical Induction to prove that for [; n>=1 ;], that $ b_n=(1/2)((3^n)+1) $
Solution:
Basic case:
For [; n = 1 ;]
   $$ b_1 = 2 = 1/2((3^1)+1) $$
Assume that for some k  $$ b_k = 1/2(3^k + 1) $$
Then  $$ b_{k+1} = 3b_k - 1 $$
                       $$ =  3(1/2)(3^k + 1) - 1 $$
                       $$ =  3/2(3^k) + 3/2 - 1 $$
                       $$ =  3/2(3^k) + 1/2 $$
                       $$ =  1/2(3^{k+1} + 1 $$
I just want to figure out how exactly we got $ b_{k+1} = 3b_k - 1 $ in the first place? What has led us to that assumption or where did it come from (I understand everything else)?
Comment: How are the $b_n's$ defined?
Answer: In the problem statement, there should be $b_1=2$ and $b_{n+1}=3b_n-1$. Without those, you don't have enough information to solve the problem.
Comment: Well we solved for $ b_1 = 2 $, are you saying there is no possible way to reach $ b_{k+1} = 3b_k - 1 $ unless it was given to you?
Comment: You need some input information.  In your question, there is nothing at all to tell us what $b_n$ is, just a formula we are supposed to prove. It looks like there is supposed to be something more inside the square brackets.


How can I filter sensitive data being recorded in calls to Watchdog

Question: I have sensitive data that is sent to a Drupal instance and I don't want it to be logged. I can filter out sensitive values with simple string replacements for my own calls to watchdog(), but for PHP errors and other modules making watchdog() calls, the data may be logged and this needs to be filtered too.
Answer: Assuming you're dealing with the dblog module, this is a workable solution:

Disable the dblog module
Copy dblog_watchdog into your own module's hook_watchdog implementation
Wrap each of the appropriate database field entries with your function to sanitise the string, e.g.
Database::getConnection('default', 'default')->insert('watchdog')
  ->fields(array(
    'uid' => $log_entry['uid'],
    'type' => mymodule_sanitise(drupal_substr($log_entry['type'], 0, 64)),
...

If you have other watchdog modules in use, you'll need a copy/edited hook_watchdog version for each of them too.


Variance of estimator seemingly lower than CRLB?

Question: While practicing for a mid-term, I came across a question where I was asked to investigate the variance of $\frac{(n+1)Y_{n}}{n}$ where $Y_{n}$ is the largest observation of a random sample of size $n$ from a $U(0, \theta)$ distribution, so pdf $f(x) = 1/\theta$ for $0 < x < \theta$. I calculated the CRLB and $Var[ \frac{(n+1)Y_{n}}{n}]$ and ended up with respectively $\frac{\theta^2}{n}$ and $\frac{\theta^2}{n(n+2)}$. The solutions manual seems to confirm that this is correct. Also, $E[\frac{(n+1)Y_{n}}{n}] = \theta$ , i.e. it's unbiased. How come we have  $\frac{\theta^2}{n(n+2)} < CRLB(\theta)$?
Answer: This estimator doesn't satisfy the conditions required for the CRLB to hold. Specifically, interchangeability of differentiation and expectation isn't possible in this case: $\dfrac d {d\theta}E_{\theta}\Big(\dfrac {n+1} n Y_{(n)}\Big) \ne \int \dfrac {\partial} {\partial \theta} \dfrac {n+1} n y f_{Y_{(n)}}(y \mid \theta) dy$, where $f_{Y_{(n)}}(y \mid \theta) \sim \text{Beta}(\theta,1)$.


Statistical test for finding the effect magnitude of different causes

Question: I am fairly new to statistics and would wish to find out if there is a statistical test that tells me the magnitude/contribution/importance of different causes over a perceived effect.
For example, let's say that we have different flaws, and these different flaws all contribute to an error count. The flaws are the causes, and the error count is the effect of those causes. Each flaw contributes more or less to the total error count.
Is there any statistic tool that computes, with a certain degree of confidence, what would be the magnitude of each flaw in the final error count? Which flaw contributes the most to the error?
The data looks like this (header and one example row):
<code>flaw1 flaw2 flaw3 error_count
 30    20    60        8
</code>
Thanks
Answer: This instrument is called regression. In your case you have to specify whether the relationship between flaws and error count is linear, multiplicative (various flaws interacting with each other), or something completely different (an avalanche of errors upon the flaws crossing some threshold), and what sources and characteristics of discrepancy are.
For this particular scenario quite a bit depends on whether you observe cases with error_count equal to zero. If you do, look up censored regressions, if you don't - the relevant model is called truncated regression.
Since the dependent variable is a count, the (likely) Poisson regression model has to be combined with the complications of truncation/censoring. Of course, we cannot tell from your post whether Poisson distribution for the dependent variable is appropriate, and whether discrepancies (errors) in different observations are independent of each other. This makes a whole lot of difference for the model and for estimation methods as well.


Python Introspection: How to get varnames of class methods?

Question: I want to get the names of the keyword arguments of the methods of a class. I think I understood how to get the names of the methods and how to get the variable names of a specific method, but I don't get how to combine these:
class A(object):
    def A1(self, test1=None):
        self.test1 = test1
    def A2(self, test2=None):
        self.test2 = test2
    def A3(self):
        pass
    def A4(self, test4=None, test5=None):
        self.test4 = test4
        self.test5 = test5

a = A()

# to get the names of the methods:

for methodname in a.__class__.__dict__.keys():
    print methodname

# to get the variable names of a specific method:

for varname in a.A1.__func__.__code__.co_varnames:
    print varname

# I want to have something like this:
for function in class:
    print function.name
    for varname in function:
        print varname

# desired output:
A1
self
test1
A2
self
test2
A3
self
A4
self
test4
test5

I will have to expose the names of the methods and their arguments to an external API. I have written a twisted app to link to the mentioned api and this twisted app will have to publish this data via the api.
So, I think I will use something like:
for methodname in A.__dict__.keys():
if not methodname.startswith('__'):
    print methodname
    for varname in A.__dict__[methodname].__code__.co_varnames:
        print varname

Once, the surroundings get more stable I will think about a better solution.
Comment: python 2.5 doesn't like  A.__dict__[methodname].__code__.co_varnames -- 'function' object has no attribute '__code__' Using inspect may be more stable between python versions.
Answer: import inspect

for name, method in inspect.getmembers(a, inspect.ismethod):
    print name
    (args, varargs, varkw, defaults) = inspect.getargspec(method)
    for arg in args:
        print arg

Comment: inspect api is clean. Using it makes code more readable I think.
Comment: +1 This is (imo) the correct way. All the double underscores in Eli Bendersky's answer should give away that he's doing something fishy ;-)
Comment: I have seen a lot of examples using inspect module. Why is using inspect a good idea? Why not using classes own methods to do the job?
Comment: @daccle: my guess is that `inspect` has been there before classes were allowing such levels of introspection
Answer: Well, as a direct extension of what you did:
for varname in a.__class__.__dict__['A1'].__code__.co_varnames:
    print varname

prints:
self
test1

P.S.: to be honest, I have a feeling this can be done more elegantly...
For example, you can replace a.__class__ with A, but you knew that ;-)
Comment: There is nothing helpful about showing people how to do silly things.
Comment: Thanks! If you know a better solution, you're welcome. My monday morning brain is just a little bit... you know... ;-)
Comment: @daccle: Please update your question to explain why you need introspection and why you can't simply read the source.
Comment: @ironfroggy: People sometimes implement tools for working with code (intellisense, etc), that require the usage of such techniques. I do not recommend using it in any "normal" code
Comment: @S.Lott The source is not always available, for one thing. I know this is Python, but even so reading the source can be harder than just calling help().


Bypass node access with Panels

Question: I'm using modules Content Access and Panels.
I need to modify the appearance of a node according to its accessibility by the user.
With Panels, I made 2 variants with selection rules (page "Node template"):

when the node is not accessible
when it is accessible.

But when the user has no access to the node he has a denied access and not the panel.
Do you know how to bypass node access with Panels?
Comment: Do you actually want to show the user some of the content of the node, or just give them a custom page (eg. to prompt them to sign up)?
Comment: Please explain the main problem..? What you actual want..?
Comment: Which "rules" do you mean, the "Rules" module, or something else? Plese EDIT your question to clarify that.
Comment: @Alfred Armstrong some of the content of the node (for example : the title, the teaser and the comments)
Comment: @Kamal Oberoi To summarize: I wish to show a teaser of an article when the user has no access to the content, and all the article when there is access. I thought of using Panels, but it has can be another solution there.
Comment: @Pierre.Vriens the selection rules in variant of the panels module
Comment: The whole intention of Content Access and other such modules is to ensure the user cannot access the node, so you'll be forced to work round it pretty drastically, and there's a risk of opening a security hole. Consider using field permissions instead, with some custom templating.
Comment: @Alfred Armstrong thanks for warning me, the consideration on the security is very important. I looked at field permissions, but it seems to me that he allows only to restrict the access by user's role (and not by node), have I well? Indeed, I need a granularity by node (the user buys this article (via drupal commerce), he can read all this article but not the others).
Comment: you can add permission Artical content type to anonymous
Answer: To overrider the default Access Denied page of the Drupal, you have to change the path of this page.
To change the page path, follow these steps:

Go to admin/config/system/site-information.
At the bottom of the page, there is a Error Pages section.
There is a field Default 403 (access denied) page. Provide your custom panel page link.
And the save it.

I hope it will work.
Comment: thanks for this proposal. It is not going to raise problem for example when the denied access will not be in touch with the access in a node?

Bypass node access with Panels


Keeping ssh connections open on Windows?

Question: I know that on Unix Systems, you can keep an ssh connection open.
Step 1: Create a ssh configuration, for example:
 Host <some.host.name>
 ControlPath ~/.ssh/master-%r@%h:%p
 ControlPersist yes

Step 2: Start ssh with the -M parameter.
Is there something equivalent under Windows to reuse ssh connections? Maybe I looked at the wrong places, but I didn't find any good links on this topic.
(I tried my approach from above in a MingGW environment (using MingGW's ssh client). In real Unix system, it should have created a special socket file in ~/.ssh, but that functionality does not seem to be supported by MingGW.)
Answer: You need to use openssh for windows, either through cygwin, or this port: http://miked.ict.rave.ac.uk/display/sshwindows/OpenSSH+for+Windows
Comment: Is this really a correct answer? OpenSSH for Windows works on top of a cygwin — either full cygwin or a minimal cygwin implementation like that linked here. In either case, I understand that ControlPersist does not work because it requires passing file descriptors over sockets, which is not supported in cygwin.
Comment: Thanks, that seems to be a good starting point. OpenSSH for Windows seems to support connection sharing.
Comment: https://stackoverflow.com/questions/20959792/is-ssh-controlmaster-with-cygwin-on-windows-actually-possible
Comment: I couldn't get keepalive to work, but I fixed it by downgrading ssh from 8.0 to 7.9 so watch out for that
Comment: @dk. It is likely a reasonable answer, but does omit a key constraint in that it does not work for connections that need a pseudo-terminal.  In other words, I found openssh  in MSYS2 to support use of ControlMaster/ControlPersist only for non-interactive connections.  If I tried to open a terminal, I got the errors like:
mm_send_fd: sendmsg(2): Broken pipe
mux_client_request_session: send fds failed

See also: https://bugzilla.mindrot.org/show_bug.cgi?id=1278
Answer: You are talking about two different things:
Your subject indicates keeping connections open indefinitely, where my answer would be:
  If you are using puTTY, then you can set a keepalive in the configuration of a session:
  Configuration => Connection:
    Sending of null packets to keep session active
    Seconds between keepalives (0 to turn off)
Your text indicates connection sharing. No idea for puTTY with that.
Kind regards,
Viktor Zacek
Comment: Yes, you are right. I actually meant connection sharing.
Answer: Bug 1278 - CYGWIN controlMaster connections don't work. describes use of ControlMaster/ControlPersist as partially implemented under Cygwin as of December, 2016, but with a qualification that it works only for remote commands and not for connections that require a pseudo terminal.
While this answer was not confirmed under Cygwin, per se, it was validated as true for MSYS2 (based on Cygwin).  openssh under MSYS2 supports ControlMaster/ControlPersist connections for remote commands, but not for interactive sessions.
$ cygcheck -V | head -3
cygcheck (msys) 3.0.7
System Checker for Msys
Copyright (C) 1998 - 2019 Cygwin Authors

$ ssh -V
OpenSSH_8.1p1, OpenSSL 1.1.1d  10 Sep 2019

$ pacman -Qi openssh
Name            : openssh
Version         : 8.1p1-1
Description     : Free version of the SSH connectivity tools
Architecture    : i686
URL             : https://www.openssh.com/portable.html
Licenses        : custom:BSD
Groups          : net-utils
Provides        : None
Depends On      : heimdal  libedit  libcrypt  openssl
Optional Deps   : None
Required By     : sshpass
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 4.55 MiB
Packager        : Alexey Pavlov <firstname.lastname@example.com>
Build Date      : Mon, Oct 14, 2019 1:12:28 AM
Install Date    : Thu, Oct 24, 2019 8:38:48 PM
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

The following errors occur when running ssh without a remote command specified:
mm_send_fd: sendmsg(2): Broken pipe
mux_client_request_session: send fds failed

With remote commands specified, the errors do not occur.


Understanding the GARCH(1,1) model: the constant, the ARCH term and the GARCH term

Question: I would like some help with a GARCH(1,1) volatility modeling.
I am working with the assumption the volatility is the weighted sum of three factors: Long run variance + $n-1$ squared return + $n-1$ variance
If that is accurate, my doubt is, what is the difference between the 1st and 3rd parts of the equation? I was reading it as $n-1$ variance being the historical variance of the moving window I am using. However, that seems to me the same as long run variance.
Can anyone clarify that for me?
Comment: Possible duplicate of [How to interpret GARCH parameters?](https://stats.stackexchange.com/questions/61824/how-to-interpret-garch-parameters)
Comment: I do not think this is exactly a duplicate, because the answers in the other thread do not address the precise question specified here.
Answer: A GARCH(1,1) model is
\begin{aligned}
y_t &= \mu_t + u_t, \\
\mu_t &= \dots \text{(e.g. a constant or an ARMA equation without the term $u_t$)}, \\
u_t &= \sigma_t \varepsilon_t, \\
\sigma_t^2 &= \omega + \alpha_1 u_{t-1}^2 + \beta_1 \sigma_{t-1}^2, \\
\varepsilon_t &\sim i.i.d(0,1). \\
\end{aligned}
The three components in the conditional variance equation you refer to are $\omega$, $u_{t-1}^2$, and $\sigma_{t-1}^2$. Your question seems to be, how is $\omega$ different from $\sigma_{t-1}^2$?
First, note that $\omega$ is not the long-run variance; the latter actually is $\sigma_{LR}^2:=\frac{\omega}{1-(\alpha_1+\beta_1)}$. $\omega$ is an offset term, the lowest value the variance can achieve in any time period, and is related to the long-run variance as $\omega=\sigma_{LR}^2(1-(\alpha_1+\beta_1))$.
Second, $\sigma_{t-1}^2$ is not the historical variance of the moving window; it is instantaneous variance at time $t-1$.
Comment: I hope this answers your question. Feel free to ask for further clarification.
Comment: Hi, thank you very much for helping on this. I do have some follow up doubts. The instantaneous variance you mean is variance between t-1 and t-2? And w is still not very clear to me. Sorry i am having trouble with formatting questions still.
Comment: @Luiza, no problem, glad to help! Regarding instantaneous variance, it depends on how you imagine the underlying process. If it is a discrete-time process, then instantaneous variance is at a particular time point $t-1$ because nothing happens in between time points; this is what I had in mind. If it is a continuous-time process, then you are correct. Regarding formatting, you may click on "edit" and see the underlying code of any post you find relevant; you can find the code behind the formulas this way.
Comment: @Luiza, so what do you think of my answer? FYI, satisfactory answers may be accepted by clicking on the tick mark to the left. Unsatisfactory answers do not need to be accepted. That is how Cross Validated works.
Comment: I am still a little confused regarding w. But your answer has most certainly helped me. Sorry about not accepting it earlier. Thanks again!
Comment: @Luiza, nothing to be sorry for! Let me know if you have more doubts about $\omega$. See [this](https://stats.stackexchange.com/questions/113294/does-garchp-0-make-sense-at-all/228547#228547) answer that might provide some insight. It covers GARCH($p,0$) models which are not really sensible, yet the illustrations there could be useful.
Answer: Think you have it backwards on sigma squared. The "beta" of the GARCH model is the coefficient of historical variance.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Comment: Could you indicate what you are responding to?  There's no mention of "beta" at all in the question.


apache+php-fpm and security in shared enviroment compared to apache+suexec+mod_fastcgi

Question: I've been using Apache with suexec and mod_fastcgi. It starts up PHP handlers as the selected system user and listens to request via PIPES (fastcgi protocol). It works well but can't share opcode via many handlers.
I've been investigating php-fpm approach. It's really badly documented. What I can see is that it only runs as TCP fastcgi server, like 127.0.0.1:9999, under selected system user, and Apache has to connect to it using FastCGIExternalServer or fastcgi proxy mod.
What will stop other local users from connecting to 127.0.0.1:9999 and passing their own code to handler that is running as other system user?
That seems totally not secure in shared environment. Am I missing something or what?
Comment: I found an answer. php-fpm can listen on sockets (+chmod). mod_fcgi does actualy the same.
Answer: Yes, they can send requests, but how is that any different than them doing a request in their browser or wget? All they'll get is the php output.
They could cause problems by pounding your php-fpm server with requests. But any input they can send should be handled as well as if it came from a browser request.
But, they are stepping in after any apache/nginx security checks might have been done, like mod_security etc. So that might be a concern if you have a vulnerable php application.
But if you have your pools set up to run each pool as a separate user and you keep php files set not-world-readable it shouldn't be too bad, unless I'm missing something too.
Comment: it is totaly diffrent from requesting webpage in browser because webpage does not allow you to pase you own php code for execution (and fastcgi tcp server does exacly that).
Comment: anyway, I found an answer. php-fpm can listen on sockets (+chmod). mod_fcgi does actualy the same.
Comment: how do you pass in *code* that gets executed in php-fpm? it's a browser request that gets passed in
Comment: if you think about it, if you can pass in any code and execute it using a service visible to the web, you're screwed. I don't believe fastcgi does that either.


Solve a Sturm-Liouville Boundary Value Problem

Question: Solve the Wave Equation
I've been trying to solve the above wave equation
where $u = u(x, t)$ and $c ∈ \mathbb{R}$ is a constant, subject to
$$
u(x, 0) = 0,\;\; 0 < x < 1, \\
u_t(x, 0) = U_0x,\;\; 0 < x < 1, \\
u(0, t) = 0, \;\; t > 0, \\
u(1, t) = 0, \;\; t > 0.
$$
I know that a Sturm-Liouville Boundary Value Problem for a function $y(x)$ on some interval $a ≤ x ≤ b$ is a two-point boundary value problem which satisfies the ODE but am unsure of how to use the information given to me to solve this wave equation as a Sturm-Liouville BVP.
Comment: I've edited your question. Please click on the edit button (you don't have to save,) and look at what I've done. I'm not the best at formatting, but it may give you an example to build on, and it does look a whole lot better than what you had, with a minimum amount of effort. Also, please check for accuracy; I hope I have not changed your problem.
Comment: What have you tried? the first step is presumably assuming $u=f(t)g(x)$ for functions $f,g$ you must solve for
Answer: After separation of variables, and enforcing homogeneous conditions,
$$
    u(x,t) = \sum_{n=1}^{\infty}A_n \sin(n\pi c t)\sin(n\pi x).
$$
The condition $u_t(x,0)=U_0 x$ determines the constants $A_n$:
$$
     U_0 x = \sum_{n=1}^{\infty}A_nn\pi c\sin(n\pi x)
$$
The coefficients are determined by orthogonality of the functions $\sin(n\pi x)$:
$$
     U_0\int_{0}^{\pi}x\sin(n\pi x)dx = A_n n\pi c\int_{0}^{\pi}\sin^2(n\pi x)dx \\
       A_n = \frac{U_0}{n\pi c}\cdot \frac{\int_{0}^{\pi}x\sin(n\pi x)dx}{\int_0^{\pi}\sin^2(n\pi x)dx}.
$$
Comment: @OrangeSegments The condition $u(0,t)=0=u(1,t)$ forces the $x$ solutions to be $\sin(n\pi x)$. Then the corresponding $t$ solutions must be $A_n\sin(n\pi t)+B_n\cos(n\pi t)$, but $B_n=0$ because $u(x,0)=0$.
Comment: I'm struggling to get to $$
    u(x,t) = \sum_{n=1}^{\infty}A_n \sin(n\pi c t)\sin(n\pi x).
$$. I am unable to solve $$ T'' + n^2*pi^2*c^2*t = 0 $$
Comment: Thank you! As a follow-up, are the values for $$U_0$$ and $$n*pi*c$$ known?
Comment: @OrangeSegments : $U_0$ was given as part of the problem, as was $c$. $n$ must range over $n=1,2,3,\cdots$ in a sum, and the corresponding constants $A_n$ are determined by the initial condition $U_0 x = u_t(x,0)$.


OneDrive/SharePoint error 429

Question: I use OneDrive/OneDrive for Business REST API to access files on Office365 (MS-hosted) server. Quite often error 429 is returned although I'm definitely not doing thousands of requests. Exponential back-off even up to 60 seconds doesn't always lead to recovery. I've read article from MS about throttling and how to avoid it and have implemented "request decorations", but still getting this error too often.
429 response looks like this:
HTTP/1.1 429
(...)
{"error":{"code":"activityLimitReached","innererror":{"code":"throttledRequest"},"message":"The request has been throttled"}}
Comment: It seems like OneDrive for Business REST API is basically useless :( We are getting 429 for very simple and light operations.
Answer: I have had the same issue where even the transfer of a single small text file was severely throttled during business hours. At times every request was returned with a 429 message even though the indicated backoff times were implemented. Microsoft Support have provided the following information:

All non-interactive applications will experience throttling during
business hours. This has been the case since February 2018.
There is currently no way to stop the throttling.
A small reduction in throttling can be achieved if the app is a registered
app store application.
Non-interactive applications should be scheduled to run from 6pm to 6am
local time on weekdays and all day on weekends during which time the extra
throttling for non-interactive applications is removed.
Comment: This answer is accurate, bit if you want it from an "official" source you can listen to this [Ignite 2018 presentation](https://myignite.techcommunity.microsoft.com/sessions/65661)

OneDrive/SharePoint error 429


PHP changes the file_get_contents param url

Question: I'm using the following line with to get the page content:
<code>$handle = file_get_contents(
    "http://www.mywebsite.com/index.php?show=users&action=msg&section=send",
    NULL,
    NULL,
    1000,
    19000);
</code>
And then, I'm getting the following message:

Warning:
  file_get_contents(http://www.mywebsite.com/index.php?show=users&action=msg §ion=send):
  failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden

(Please take a note at the bolded part).
What happened to it? Why does it changes the url param?
Comment: `§` is the html entity for § ... but there is no `;`, this is strange.
Comment: have you tried `urlencode()`-ing your URL?
Comment: If you're looking at this in a browser, see View Source if PHP is actually outputting that or if it's just your browser rendering an entity.
Answer: I don't think PHP is changing querystring parameters.
If you are reading that message in the browser, it should be just a matter of how the output is HTML formatted. So, the 403 error you are getting it should not be related to some unwanted url transformation.
Comment: But well, the URL is loading in my browser without any 403 header error, it's loading everywhere, until I use `file_get_contents` to grab the content from it.


affine variety of infinitely many polynomials can be represented as an affine variety of its finite subset

Question: Let $f_1,f_2,\cdots$ be an infinite sequence of polynomials in $k[x_1,\cdots,x_n]$ and let $V(f_1,f_2,\cdots)=\{(a_1,\cdots,a_n)\in k^n:f_i(a_1,\cdots,a_n)=0$ for $i=0,1,\cdots\}$. Show that there is some finite $m$ such that $V(f_1,\cdots,f_m)=V(f_1,f_2,\cdots)$.
I think Hilbert basis theorem may help.
Answer: Yes, the vanishing set $V(T)$, where $T$ is a subset of $k[x_1,\ldots, x_n]$ equals $V(J)$, where $J$ is the ideal generated by $T$. But $k[x_1,\ldots,x_n]$ is noetherian, so that $J$ can be generated by finitely many polynomials
Comment: Could you show that finitely many polynomials are in T?
Comment: @Falang: That follows since $k[x_1,\cdots,x_n]$ is noetherian.
Comment: Oh, I see. Thank you Frederica and Fredrik.


Prove the center of $G$ cannot have order $p^{n-1}$

Question: Let $p$ be a prime, let $n>2$ be an integer, and let $G$ be a nonabelian group of order $p^n$. Prove the center of G cannot have order $p^{n-1}$.

Honestly I have no idea where to start. Perhaps prove this by contradiction?
Comment: As a hint to Pedro's answer: for **any** group $\;G\;$ , the quotient $\;G/Z(G)\;$ cannot be cyclic non-trivial, or what ammounts to the same (why?): if $\;G/Z(G)\;$ is cyclic then $\;G\;$ is abelian. This can be expanded also to subgroups of the center but you don't need that for this problem.
Comment: I don't understand
Comment: You don't understand...or you can't prove it?
Comment: Oh! I think I know. So if $Z(G)$ has order $p^{n-1}$, then the order of $G/Z(G)$ must be $p$, making $G/Z(G)$ cyclic which cannot happen since G is nonabelian. Is this correct?
Answer: $G/Z(G)$ has order $p$; so it must be ______? But if $G/Z(G)$ is ______ then it is trivial.
Comment: I'm confused. Wouldn't $Z(G)$ have order $p-1$ if $G/Z(G)$ has order $p$? I don't quite understand what you're saying
Comment: @allie What's the order of $G/H$ if you know the order of $G$ and the order of $H$?
Comment: So if Z(G) has order pn−1, then the order of G/Z(G) must be p, making G/Z(G) cyclic which cannot happen since G is nonabelian. Is this correct?
Comment: @allie That's correct.


Convert float to string in R without losing precision

Question: I need to convert a dataframe of floats with 2-decimal point precision to strings. However, as.character drops zeros in the decimal part:
> as.character(1.00)
[1] "1"
> as.character(1.10)
[1] "1.1"

I want these numbers to stay in the original format, i.e.:
> paste0(1, ".00")
[1] "1.00"
> paste0(1, ".10")
[1] "1.10".

Currently I plan to run for loop, checking string length and applying paste0() across my dataframe, but it seems really stupid to me. Is there simple way to do it?
Answer: We can use sprintf
sprintf("%0.2f", 1.10)
#[1] "1.10"
sprintf("%0.2f", 1.00)
#[1] "1.00"

Answer: We can also use the format function with the nsmall argument to be 2.
format(1, nsmall = 2)
# [1] "1.00"
format(1.1, nsmall = 2)
# [1] "1.10"


Expected value when the gambler leaves

Question: I have an interesting problem that I am not quite sure how to best proceed.
Suppose there is a man with a very large amount of money who is playing a game at a large casino.
The game has $3$ possible outcomes,
he can win $10$ with probability $0.25$, he can lose $2$ with probability $0.7$ or he can lose $50$ with probability $0.05$.
The man stops as soon as he has the event that he loses $50$.
What is his expected value of earning/loss when he stops?
I think it will need a sum, maybe a random sum.
I know that all the trials are independent, so that the probability that he loses 50 on the ith game is always 0.05. But I am not sure at all how to account for what happens before this.
Any ideas?
Comment: My original solution was botched and I haven't found the actual one, but here's a hint: treat it like the man has a 95% chance of winning something and a 5% chance of losing 50.
Answer: What is the probability that our man exits on round $k$? Call it $p_k$ Well, we need round $k$ to be the bad event, probability $.05$, and the prior rounds to not be bad, probability $.95^{k-1}$.  Hence $p_k=.95^{k-1}\times .05$
Conditioned on him losing in round $k$, what are his expected winnings?  Call it $E_k$.  Prior to the loss he loses $2$ with probability $\frac {.7}{.95}$ and wins $10$ with probability $\frac {.25}{.95}$  Thus on one of those rounds he expects to win $-2\times \frac {70}{95}+10\times \frac {25}{95}=\frac {110}{95}$.  As there are $k-1$ pre-disaster rounds, and he loses $50$ on the last, we have $$E_k=\frac {110}{95}\times (k-1)-50$$  Thus the answer you want is $$\sum_{k=1}^{\infty}\left(\frac {110}{95}\times (k-1)-50\right)\times .95^{k-1}\times .05 = \fbox {-28}$$
Sanity check:  He expects to lose on round $20$. If he loses on round $20$ he expects to net $$E_{20}=\frac {110}{95}\times 19-50=22-50=-28$$
Answer: Conditional on he does not lose 50 on the first game, the expected income in the first game is $w:=10 \times \frac{0.25}{0.95} -2 \times \frac{0.7}{0.95}$. So his total expected income is $-50+0.95 w +(0.95)^2 w +(0.95)^3 w +...$ which is just a geometric series.
Answer: Let $Y_k$ be the payoff at step $k$. We have
$$
Y_k = \left\{\begin{aligned}
&10 &&p = 1/4\\
&-2 && p = 7/10\\
&-50 && p = 1/20
\end{aligned}
\right.$$
Let $\tau$ be the first step where $Y_k = -50$. We are interested in
$$
\mathbb E \left[ \sum^\tau_{k=1} Y_k  \right]
$$
By conditioning on the stopping time, by the law of total expectation this satisfies
$$
\mathbb E \left[ \sum^\tau_{k=1} Y_k  \right] = \sum^\infty_{n=1} \mathbb E \left[ \sum^\tau_{k=1} Y_k \bigg| \tau = n \right] \mathbb P (\tau = n)
$$
Now look at the expectation inside. This satisfies
$$
\begin{align}
\mathbb E \left[ \sum^\tau_{k=1} Y_k \bigg| \tau = n \right] &= \mathbb E \left[ \sum^{\tau-1}_{k=1} Y_k \bigg| \tau = n \right] + \mathbb E \left[ Y_\tau \bigg| \tau = n \right]\\
&= \sum^{\tau-1}_{k=1}  \mathbb E [ Y_k \mid \tau = n ] - 50
\end{align}
$$
by linearity and the fact that $Y_\tau = -50$ by definition of $\tau$. The expectation $\mathbb E [ Y_k \mid \tau = n ]$ is the expected payoff conditioned on that either $Y_k = 10$ or $Y_k = -2$. This happens to be
$$
\mathbb E [ Y_k \mid \tau = n ] = \frac{\mathbb E[Y_k 1_{\lbrace Y_k \in \lbrace 10, -2 \rbrace \rbrace}]}{\mathbb P (\lbrace Y_k \in \lbrace 10, -2 \rbrace) } = \frac{10 * 0.25 - 2 *0.7}{0.95} = \frac{22}{19}
$$
Thus we have
$$
\mathbb E \left[ \sum^\tau_{k=1} Y_k \bigg| \tau = n \right] = (\tau - 1)\frac{22}{19} - 50
$$
As to $\mathbb P (\tau = n)$, this is the probability of having $n-1$ consecutive cases of $Y_k \neq -50$ and then $Y_n = 50$. This results in
$$
\mathbb P(\tau = n) = p^{n-1}(1-p)
$$
where $p = 19/20$ in our case. Putting it all together we have
$$
\mathbb E \left[ \sum^\tau_{k=1} Y_k  \right] = \sum^\infty_{\tau=1} \left( (\tau - 1)\frac{22}{19} - 50 \right) \left(\frac{19}{20}\right)^{n-1}\frac{1}{20} = -28
$$

Expected value when the gambler leaves


Adding graphic environment to yocto image

Question: I have build a linux image with yocto that has xfce as desktop environment,
But what i actually need is just a terminal and a browser.
Is it possible to remove the desktop environment and just create an application that has two options to open 'terminal' and 'browser' and make my image boots on it directly.
If this is possible would it reduce the image size or not, beacause i am looking for a minimum sie of the image.
Answer: If you want to remove your desktop env then add below line in your disto.bb or local.conf
DISTRO_FEATURES_remove += "x11 wayland"

I dont think without desktop env you cant run browser.
are you using imx6 and vivante graphics ?