text:
Q: UnsatisfiedDependencyException occur while executing spring-boot Can anyone kindly help me to rectify the error?It shows UnsatisfiedDependencyException occur while executing spring-boot and also beanException.
AdminRepo.java

    package com.adminplan.demo.repository;

    import org.springframework.data.jpa.repository.JpaRepository;
    import com.adminplan.demo.model.Admin;

    import java.util.Optional;

    public interface AdminRepo extends JpaRepository<Admin,Long> {
        void deleteAdminPlan(Long id);

        Optional<Admin> findAdminPlanById(Long id);
    }

AdminService.java

    package com.adminplan.demo.service;

    import com.adminplan.demo.exception.UserNotFoundException;
    import com.adminplan.demo.model.Admin;
    import com.adminplan.demo.repository.AdminRepo;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;

    import javax.transaction.Transactional;
    import java.util.List;

    @Service
    @Transactional
    public class AdminService {
        private final AdminRepo adminRepo;

        @Autowired
        public AdminService(AdminRepo adminRepo) {
            this.adminRepo = adminRepo;
        }

        public Admin addAdminPlan(Admin admin) {
            return adminRepo.save(admin);
        }
        public List<Admin> findAllAdminPlan() {return adminRepo.findAll(); }

        public Admin updateAdminPlan(Admin adminplan){ return adminRepo.save(adminplan); }

        public Admin findAdminPlanById(Long id){
            return adminRepo.findAdminPlanById(id)
                    .orElseThrow(()-> new UserNotFoundException("User by id "+id+" was not found"));
        }

        public void deleteAdminPlan(Long id){ adminRepo.deleteAdminPlan(id);}
    }

AdminController.java

    package com.adminplan.demo.controller;

    import com.adminplan.demo.model.Admin;
    import com.adminplan.demo.service.AdminService;
    import org.springframework.http.HttpStatus;
    import org.springframework.http.ResponseEntity;
    import org.springframework.web.bind.annotation.*;

    import java.util.List;

    @RestController
    @RequestMapping("/admin-plan")
    public class AdminController {
        private final AdminService adminService;

        public AdminController(AdminService adminService) {
            this.adminService = adminService;
        }

        @GetMapping("/all")
        public ResponseEntity<List<Admin>> getAllAdminPlan(){
            List<Admin> adminPlans= adminService.findAllAdminPlan();
            return new ResponseEntity<>(adminPlans, HttpStatus.OK);
        }

        @GetMapping("/find/{id}")
        public ResponseEntity<Admin> getAdminPlanById(@PathVariable("id") Long id){
            Admin adminPlan= adminService.findAdminPlanById(id);
            return new ResponseEntity<>(adminPlan, HttpStatus.OK);
        }

        @PostMapping("/add-plan")
        public ResponseEntity<Admin> addAdminPlan(@RequestBody Admin admin){
            Admin newAdminPlan = adminService.addAdminPlan(admin);
            return new ResponseEntity<>(newAdminPlan, HttpStatus.CREATED);
        }

        @PutMapping("/update")
        public ResponseEntity<Admin> updateAdminPlan(@RequestBody Admin admin){
            Admin updatePlan = adminService.updateAdminPlan(admin);
            return new ResponseEntity<>(updatePlan, HttpStatus.OK);
        }

        @DeleteMapping("/delete/{id}")
        public ResponseEntity<?> deleteAdminPlan(@PathVariable("id") Long id){
            adminService.deleteAdminPlan(id);
            return new ResponseEntity<>(HttpStatus.OK);
        }

    }

application.properties

    # MySQL Configuration
    spring.datasource.url=jdbc:mysql://localhost:3307/adminplan
    spring.datasource.username=****
    spring.datasource.password=****
    spring.jpa.show-sql=true
    spring.jpa.hibernate.ddl-auto=update
    spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect

Error

    :: Spring Boot ::                (v2.6.4)

    2022-02-28 14:31:57.433  INFO 1956 --- [           main] com.adminplan.demo.DemoApplication       : Starting DemoApplication using Java 11.0.13 on DESKTOP-MQ2O3FR with PID 1956 (D:\spring boot\admin\target\classes started by keerthi in D:\spring boot\admin)
    2022-02-28 14:31:57.433  INFO 1956 --- [           main] com.adminplan.demo.DemoApplication       : No active profile set, falling back to 1 default profile: "default"
    2022-02-28 14:31:58.247  INFO 1956 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
    2022-02-28 14:31:58.294  INFO 1956 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 42 ms. Found 1 JPA repository interfaces.
    2022-02-28 14:31:59.487  INFO 1956 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
    2022-02-28 14:31:59.487  INFO 1956 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
    2022-02-28 14:31:59.487  INFO 1956 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.58]
    2022-02-28 14:31:59.596  INFO 1956 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
    2022-02-28 14:31:59.596  INFO 1956 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2101 ms
    2022-02-28 14:31:59.831  INFO 1956 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
    2022-02-28 14:31:59.877  INFO 1956 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.6.5.Final
    2022-02-28 14:32:00.018  INFO 1956 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
    2022-02-28 14:32:00.112  INFO 1956 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
    2022-02-28 14:32:00.424  INFO 1956 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
    2022-02-28 14:32:00.440  INFO 1956 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
    2022-02-28 14:32:01.065  INFO 1956 --- [           main] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
    2022-02-28 14:32:01.080  INFO 1956 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
    2022-02-28 14:32:01.440  WARN 1956 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'adminController' defined in file [D:\spring boot\admin\target\classes\com\adminplan\demo\controller\AdminController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'adminService' defined in file [D:\spring boot\admin\target\classes\com\adminplan\demo\service\AdminService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adminRepo' defined in com.adminplan.demo.repository.AdminRepo defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract void com.adminplan.demo.repository.AdminRepo.deleteAdminPlan(java.lang.Long)! Reason: Failed to create query for method public abstract void com.adminplan.demo.repository.AdminRepo.deleteAdminPlan(java.lang.Long)! No property 'deleteAdminPlan' found for type 'Admin'!; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract void com.adminplan.demo.repository.AdminRepo.deleteAdminPlan(java.lang.Long)! No property 'deleteAdminPlan' found for type 'Admin'!
    2022-02-28 14:32:01.440  INFO 1956 --- [           main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
    2022-02-28 14:32:01.440  INFO 1956 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
    2022-02-28 14:32:01.455  INFO 1956 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
    2022-02-28 14:32:01.455  INFO 1956 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
    2022-02-28 14:32:01.471  INFO 1956 --- [           main] ConditionEvaluationReportLoggingListener :

    Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
    2022-02-28 14:32:01.486 ERROR 1956 --- [           main] o.s.boot.SpringApplication               : Application run failed

    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'adminController' defined in file [D:\spring boot\admin\target\classes\com\adminplan\demo\controller\AdminController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'adminService' defined in file [D:\spring boot\admin\target\classes\com\adminplan\demo\service\AdminService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adminRepo' defined in com.adminplan.demo.repository.AdminRepo defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract void com.adminplan.demo.repository.AdminRepo.deleteAdminPlan(java.lang.Long)! Reason: Failed to create query for method public abstract void com.adminplan.demo.repository.AdminRepo.deleteAdminPlan(java.lang.Long)! No property 'deleteAdminPlan' found for type 'Admin'!; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract void com.adminplan.demo.repository.AdminRepo.deleteAdminPlan(java.lang.Long)! No property 'deleteAdminPlan' found for type 'Admin'!
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.16.jar:5.3.16]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.16.jar:5.3.16]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.4.jar:2.6.4]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740) ~[spring-boot-2.6.4.jar:2.6.4]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415) ~[spring-boot-2.6.4.jar:2.6.4]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-2.6.4.jar:2.6.4]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312) ~[spring-boot-2.6.4.jar:2.6.4]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.4.jar:2.6.4]
        at com.adminplan.demo.DemoApplication.main(DemoApplication.java:11) ~[classes/:na]
    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'adminService' defined in file [D:\spring boot\admin\target\classes\com\adminplan\demo\service\AdminService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adminRepo' defined in com.adminplan.demo.repository.AdminRepo defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract void com.adminplan.demo.repository.AdminRepo.deleteAdminPlan(java.lang.Long)! Reason: Failed to create query for method public abstract void com.adminplan.demo.repository.AdminRepo.deleteAdminPlan(java.lang.Long)! No property 'deleteAdminPlan' found for type 'Admin'!; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract void com.adminplan.demo.repository.AdminRepo.deleteAdminPlan(java.lang.Long)! No property 'deleteAdminPlan' found for type 'Admin'!
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-5.3.16.jar:5.3.16]
        ... 19 common frames omitted
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adminRepo' defined in com.adminplan.demo.repository.AdminRepo defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract void com.adminplan.demo.repository.AdminRepo.deleteAdminPlan(java.lang.Long)! Reason: Failed to create query for method public abstract void com.adminplan.demo.repository.AdminRepo.deleteAdminPlan(java.lang.Long)! No property 'deleteAdminPlan' found for type 'Admin'!; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract void com.adminplan.demo.repository.AdminRepo.deleteAdminPlan(java.lang.Long)! No property 'deleteAdminPlan' found for type 'Admin'!
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-5.3.16.jar:5.3.16]
        ... 33 common frames omitted
    Caused by: org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract void com.adminplan.demo.repository.AdminRepo.deleteAdminPlan(java.lang.Long)! Reason: Failed to create query for method public abstract void com.adminplan.demo.repository.AdminRepo.deleteAdminPlan(java.lang.Long)! No property 'deleteAdminPlan' found for type 'Admin'!; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract void com.adminplan.demo.repository.AdminRepo.deleteAdminPlan(java.lang.Long)! No property 'deleteAdminPlan' found for type 'Admin'!
        at org.springframework.data.repository.query.QueryCreationException.create(QueryCreationException.java:101) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:106) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lambda$mapMethodsToQuery$1(QueryExecutorMethodInterceptor.java:94) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na]
        at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) ~[na:na]
        at java.base/java.util.Collections$UnmodifiableCollection$1.forEachRemaining(Collections.java:1054) ~[na:na]
        at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
        at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.mapMethodsToQuery(QueryExecutorMethodInterceptor.java:96) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lambda$new$0(QueryExecutorMethodInterceptor.java:86) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at java.base/java.util.Optional.map(Optional.java:265) ~[na:na]
        at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.<init>(QueryExecutorMethodInterceptor.java:86) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:364) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:322) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.util.Lazy.getNullable(Lazy.java:230) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.util.Lazy.get(Lazy.java:114) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:328) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:144) ~[spring-data-jpa-2.6.2.jar:2.6.2]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.16.jar:5.3.16]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.16.jar:5.3.16]
        ... 44 common frames omitted
    Caused by: java.lang.IllegalArgumentException: Failed to create query for method public abstract void com.adminplan.demo.repository.AdminRepo.deleteAdminPlan(java.lang.Long)! No property 'deleteAdminPlan' found for type 'Admin'!
        at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:96) ~[spring-data-jpa-2.6.2.jar:2.6.2]
        at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:113) ~[spring-data-jpa-2.6.2.jar:2.6.2]
        at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:254) ~[spring-data-jpa-2.6.2.jar:2.6.2]
        at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:87) ~[spring-data-jpa-2.6.2.jar:2.6.2]
        at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:102) ~[spring-data-commons-2.6.2.jar:2.6.2]
        ... 66 common frames omitted
    Caused by: org.springframework.data.mapping.PropertyReferenceException: No property 'deleteAdminPlan' found for type 'Admin'!
        at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:90) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:437) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:413) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.mapping.PropertyPath.lambda$from$0(PropertyPath.java:366) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at java.base/java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:330) ~[na:na]
        at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:348) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:331) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.repository.query.parser.Part.<init>(Part.java:81) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.repository.query.parser.PartTree$OrPart.lambda$new$0(PartTree.java:249) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na]
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[na:na]
        at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
        at org.springframework.data.repository.query.parser.PartTree$OrPart.<init>(PartTree.java:250) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.repository.query.parser.PartTree$Predicate.lambda$new$0(PartTree.java:383) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na]
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[na:na]
        at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
        at org.springframework.data.repository.query.parser.PartTree$Predicate.<init>(PartTree.java:384) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.repository.query.parser.PartTree.<init>(PartTree.java:92) ~[spring-data-commons-2.6.2.jar:2.6.2]
        at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:89) ~[spring-data-jpa-2.6.2.jar:2.6.2]
        ... 70 common frames omitted

    Process finished with exit code 1

Please go through the Above code and help me to correct it.It shows UnsatisfiedDependencyException occur while executing spring-boot and also beanException.

A: Since your AdminRepo extends JpaRepository - which is a descendant of CrudRepository
these methods are already available to AdminRepo

*

*findById

*deleteById
try removing this method deleteAdminPlan and changing AdminController to call the provided deleteById method

In order to generate the implementation for the Repository methods, spring parses the Repository method names into multiple parts.
see these sections for more detail:
https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.query-methods.query-creation)
https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.query-methods.query-creation


text:
Q: Papervision performance Is it too much to render 900 triangles in papervision ?
I know the CPU model also affects, I'm using a core2duo 1.7GhZ. But rendering 900 triangles, as 5 cylinders seems too much, and drops the performance when rotating them for examples each frame... The FPS at normal is ~30FPS, but it drops when rotating or spinning the cylinders to 14~FPS. I'm really surprised about that performance, as Quake or Doom they were purely software rendering engines, and they had much more polygons than my application and they had a better performance of course.

A: That's roughly the limit that you're going to get with Papervision, as it's not taking advantage of hardware acceleration.  If you're looking to take advantage of some of that hardware you're throwing at the problem, look into Away3D (http://away3d.com/).

A: I'm quoting from the Papervision book "Papervision3D Essentials":

*

*Always try to model using as few polygons as possible.

*Papervision3D users often wonder what the maximum number of triangles is that the Flash player can handle. There is no generic answer to this question, as performance depends on more factors than just the number of triangles. On average, the total triangle count should be no more than 3000, which equals 1500 polygons.

*Keep your textures small (in size and resolution)

redpajama_set_name: RedPajamaStackExchange


text:
Q: HP Probook 6470b BIOS locked I want to enable Intel's virtualization technology in my BIOS but my BIOS is locked with a password which was setup by the previous owner of the laptop.
Is there any other way to enable Intel VT-X or how do I remove the password?

A: You can remove the internal battery that is on the motherboard, wait 1 minute, then put it back in, but that would probably require taking most of the laptop apart. That is the only way to remove the password. Otherwise, you would need a new motherboard. Hope this helps!


text:
Q: Object Not Moving Until Bool is True? I want my game so when the game starts, it will say "Don't Touch The Walls!" And then count down to 0, then disappear. i also want it so that the player can't move until it hits 0. It is pacman-esque, so the player is always moving. The text disappears when the counter hits 0, yet the player moves before this happens.
Code:
public class Movement : MonoBehaviour {
float speed = 0.1f;
int direction = 0;
public GameObject eventHandler;
private EventStuff eventHandlerScript;
public bool start = false;

// Use this for initialization
void Start () {
    eventHandlerScript = eventHandler.GetComponent<EventStuff>();
    start = eventHandlerScript.gameStart;

}

// Update is called once per frame
void Update () {
    start = eventHandlerScript.gameStart;
    if (start = true) {
        //The movement Code is here
    }

}

}
The Invisible Data Handler:
public class EventStuff : MonoBehaviour {
public Text DontTouch;
public Text Counter;
public float timer = 1f;
public bool gameStart = false;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    timer++;
    if (timer < 60) {
        Debug.Log ("3");
    } else if (timer < 120) {
        Counter.text = ("2");
        Debug.Log ("2");
    } else if (timer < 180) {
        Counter.text = ("1");
        Debug.Log ("1");
    }
    else if(timer > 180) {

    Destroy(Counter);
    Destroy(DontTouch);
        gameStart = true;
        Debug.Log ("start!");
    }

}

}

A: Instead of
if (start = true) {

you should write
if (start == true) {

or better simply
if (start) {


text:
Q: How can I overcome Golang's requirement that every package have buildable code in it? I am building a web application in Go and as part of it I have several middelware functions defined.  Right now they all live in "my/middleware" package.  That namespace is becoming very cluttered by all the different functions I've defined so I decided to put them all in their own subdirectories, e.g. "my/middleware/gzip".  When I do this I get the error:
no buildable Go source files my/middleware

I don't want all of these functions in the same namespace, but it seems my only option is to create a placeholder .go file in the my/middleware directory with an empty init function or something.  That sounds terrible so I'd like suggestions on how to achieve my goal to group a similar class of packages when there isn't any shared/common code to live in the parent package.

A: You are actually taking the right decision by splitting the files into different subfolders. It is not different than what is done here
https://golang.org/pkg/compress/
This allows for the clients of your framework to take only what they need. The idea is to avoid dependency bloating. Go is all about being lean.
The error you receive is because you try to build a package that doesn't exist. Think of that folder as a logical grouping mechanism, you need to build the packages given by the child folders individually.


text:
Q: jQuery Modal Dialog is not working with postback I'm having issues with the jQuery modal dialog. In the code below, I'm opening a dialog, and then using the buttons to return a value to a field in the form (id="form1") in the parent window. Then I perform a click on the ASP button, and finally I close the dialog. The result is that a user can choose a coupon code and have it automatically applied by submitting the form that applies the coupon code on the parent window.
I can't submit the form through the submit function, I need to click the button to make this work.
The code works fine in non-modal dialogs. Adding the modal attribute unlinks the dialog from the form, I assume, so I've searched this site and added a line to append the dialog to the form - this didn't have any effect. Would love some help!
Full disclosure, I'm not an ASP guy - and the ASP is controlled by our vendor. I can only access the front end of this site.

Need a coupon?

Please choose from one of the coupon codes below:

Take 10% off of your entire order of $50 or more! Apply This Coupon

Save 10% off all apparel! Apply This Coupon

A: jQuery modals are created by cloning the DOM elements and placing them at the of the body tag.
This create valid DOM elements and it works fine on the client side.
However for asp.net controls to send events, they must be inside the form tag(asp.net creates only one form tag).
The solution is to create the dialog and then place the elements back into the form tag.
Change your
$("#couponDialog").parent().appendTo($("form#form1"))

To
$('#couponDialog').parent().appendTo(jQuery("form:first"));

Your server events should now fire perfectly after that.


text:
Q: ConcurrentModificationException with ASTTransformation (Groovy) I'm a contributor of Vert.x for Groovy (https://github.com/vert-x3/vertx-lang-groovy) and recently see a curious behaviour regarding AST Transformation.
Until Groovy 3.0.4 the VertxTransformation class (https://github.com/vert-x3/vertx-lang-groovy/blob/3.9/vertx-lang-groovy-gen/src/main/java/io/vertx/lang/groovy/VertxTransformation.java) was working just fine. When I tried to use Groovy 3.0.5 it started to appear some ConcurrentModificationException.
java.util.ConcurrentModificationException
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909)
    at java.util.ArrayList$Itr.next(ArrayList.java:859)
    at java.util.Collections$UnmodifiableCollection$1.next(Collections.java:1044)
    at io.vertx.lang.groovy.VertxTransformation.visit(VertxTransformation.java:82)
    at io.vertx.lang.groovy.VertxTransformation.visit(VertxTransformation.java:77)
    at io.vertx.lang.groovy.VertxTransformation.lambda$visit$0(VertxTransformation.java:68)
    at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
    at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:647)
    at io.vertx.lang.groovy.VertxTransformation.visit(VertxTransformation.java:68)

Below there are two links: the first one shows the project building fine with 3.0.4 and the second one failing with 3.0.5. The only thing different is the Groovy version.

*

*https://travis-ci.org/github/vert-x3/vertx-lang-groovy/builds/712642226 (3.0.4)

*https://travis-ci.org/github/aaloise/vertx-lang-groovy/builds/712638741 (3.0.5, the exception appears from line 1818 onwards)

Don't know if something changed in 3.0.5 regarding AST. I even raised an issue (https://issues.apache.org/jira/projects/GROOVY/issues/GROOVY-9666). If is not a bug, but an improvement, would like some suggestions for an workaround.


text:
Q: mysql summation with condition on individual rows I have a table with 3 fields (of relevance to the question). One field is numeric, the other two have text-based content. I want to get the sum of the numeric field as follows:

*

*Group by field A

*If Field B is equal to X, then add

*If Field B is equal to Y, then subtract
ABC, X, 25
ABC, X, 15
ABC, Y, 10
DEF, X, 20
DEF, Y, 5
The above data would return:
ABC, 30
DEF, 15

My query, ideally, would produce the equivalent of the following the following:
SELECT fieldA, SUM(fieldC) AS sum1 FROM my_table WHERE fieldB = 'X' GROUP BY fieldA
SELECT fieldA, SUM(fieldC) AS sum2 FROM my_table WHERE fieldB = 'Y' GROUP BY fieldA

RESULT = sum1 - sum2

How can I do this in a single query?

A: Something like this should work:
SELECT
  FieldA,
  SUM(CASE WHEN FieldB = 'X' THEN FieldC ELSE -FieldC END) AS Result
FROM my_table
GROUP BY FieldA


text:
Q: Angular JS SPA using LDAP authentication I'm writing an AngularJS SPA application which calls Rest full web service. Back-end is being written on JAX-RS, deployed on Tomcat 7. I'm using HTTPS, SSL for transferring data from SPA to JAX-RS
requirements

*

*I have to make LDAP authentication. (I will send username & password to web service and it should make authentication)

*I have to do user's session management (because, when authenticated user sends request to web service, user doesn't have to authenticate again)

problems

*

*I think there are two options for doing LDAP authentication:

*

*Make LDAP authentication using core java    http://docs.oracle.com/javase/jndi/tutorial/ldap/security/ldap.html

*Use Spring security (I'm not familiar with it and not sure if it's possible. I think I should send username & password to rest service. Rest service will have spring security library injected and it'll be possible to use authentication functionality. Am I right?)

*Manage user sessions. Once user is authenticated, it should be saved somewhere, so that user can do operations until its logon is not expired.
How can I do it?
 Which way should I choose? How should I make LDAP authenticating and session management?
Can anyone give any suggestion or example links?

A: So,

*

*LDAP Authentication using JNDI works just fine, you could also use the neat UnboundID LDAP Java API. A simple LDAP Bind example can be found  here: https://code.google.com/p/ldap-sample-code/source/browse/trunk/src/main/java/samplecode/bind/SimpleBindExample.java .

Note also that you could use a Node.JS module as your backend, the Passport.JS Authentication framework for example, provides lots of features/capabilities relative to authentication and Federation (i.e., do things like 'Login with Google', etc...). See: passportjs.org.

*On the Angular/frontend side,your best bet is to use a JWT token. It's all explained in detail with examples here: http://code.tutsplus.com/tutorials/token-based-authentication-with-angularjs-nodejs--cms-22543.

In essence:

*

*your backend Authentication REST should return a JWT Token in the response, once the user successfully binds to LDAP. This Token would contain some user data, and should be encrypted (see link above).

*Your Angular App should set that token as a cookie on the client Browser ("set-cookie" response header) upon successful login (so in the Controller of your Login view).

*The Client will then present that cookie/JWT Token on every request it makes to your app.

*Your app will then need to validate the token presented on every request (in the controller of your SPA). You may also want to add the user authentication data to your $scope so you can use it in your view.

Hope it helps...


text:
Q: swiper custom pagination only slides once I made a very simple image slider with swiper then added custom pagination using swiper's "paginationCustomRender" jQuery and data attributes it generates the pagination just fine and everything works when sliding but its not clickable so I added a small function to tell my slider to "slideTo()" the targeted slide when one of the labels in the pagination is clicked but it only works once and then the function will not start again.
I've searched and from what I found out most people didn't use swiper's builtin options and made it themselves so I was wondering what should I do and what is the best approach to do it.
Thanks in advance
here is my HTML:

and here is the js:
    function mainSliderFn() {
    var mainSliderElement = $('.main_slider_wrapper .swiper-container')[0];
    var mainSliderNext = $('.main_slider_wrapper .swiper-button-next')[0];
    var mainSliderPrev = $('.main_slider_wrapper .swiper-button-prev')[0];
    mainSlider = new Swiper(mainSliderElement, {
        direction: 'horizontal',
        loop: false,
        spaceBetween: 0,
        slidesPerView: 1,
        autoResize: false,
        speed: 1500,
        nextButton: mainSliderNext,
        prevButton: mainSliderPrev,

        pagination: '.main_slider_pagination_wrapper',
        paginationClickable: true,
        paginationType: "custom",
        paginationCustomRender: function(swiper, current, total) {
            var names = [];
            $(".main_slider_wrapper .slide_item").each(function(i) {
              names.push($(this).data("name"));
            });
            var text = "";
            for (let i = 1; i <= total; i++) {
              if (current != i) {
                text += "" + names[i-1] + "";
              } else {
                text += "" + names[i-1] + "";
              }

            }
            text += "";
            return text;
        },
    });
};
function clickableLabelsFn(){
    $('.main_slider_label').on('click', function(e){
        var clicked = $(this);
        var mytarget = $(clicked).data('index');
        if(!$(clicked).hasClass('active_label'))
        {
            mainSlider.slideTo(mytarget-1);
        }
    });
};
$(document).ready(function () {
    mainSliderFn();
    clickableLabelsFn();
});

A: I love swiper but sometimes using it can be a real pain the butt seems like iDangero group needs to make a few changes because currently this plugin doesn't support fully functional Custom Pagination,
So here is my solution:
    function clickableLabelsFn(){

    // Making Labels
    var names = [];
    total = mainSlider.slides.length;
    activeSlide = mainSlider.activeIndex;
    var labelsWrapper = $('.main_slider_labels_wrapper');

    $(".main_slider_wrapper .slide_item").each(function(i) {
        names.push($(this).data("name"));
    });
    for( var counter = 1; counter <= total; counter++ )
    {
        if( activeSlide+1 != counter )
        {
            var labesHtml = $("")
                            .addClass("main_slider_label")
                            .data('index', counter)
                            .text(names[counter-1]);
            labelsWrapper.append(labesHtml);
        }
        else{
            var labesHtml = $("")
                            .addClass("main_slider_label active_label")
                            .data('index', counter)
                            .text(names[counter-1]);
            labelsWrapper.append(labesHtml);
        }
    }

    mainSlider.on('SlideChangeStart', function(){
        var current = mainSlider.activeIndex;
        $('.main_slider_label').each(function() {
            var thisLabel = $(this);
            var dataIndex = $(thisLabel).data('index');
            if(dataIndex == current+1){
                $(thisLabel).addClass('active_label');
                $(thisLabel).siblings().removeClass('active_label');
            }
        });
    });

    $('.main_slider_label').on('click', function(e){
        var clicked = $(this);
        var sliderTarget = $(clicked).data('index');
        if(!$(clicked).hasClass('active_label'))
        {
            mainSlider.slideTo(sliderTarget-1);
        }
    });
};

If you found a bug or something please let me know

A: First thank you for those custom pagination tabs, I used your code but I had the same problem : I could only click once on those paginations, here is the solution that worked for me.
Add your changing slide in "onTransitionEnd" callback
onTransitionEnd: function(){
                $('.slider-tab').on('click', function(){ //slider-tab is a single tab
                    var target = $(this).data('index');
                    blockSwiper.slideTo(target);
                    return;
                })
            }

and the full code
$( document ).find('.block-swiper').each(function (index) {
        var $this = $(this);
        var swiperTabs = $(this).find('.swiper-tabs');
        var blockSwiper = new Swiper($this, {
            pagination: swiperTabs,
            paginationClickable: true,
            paginationType: 'custom',
            slidesPerView: 1,
            loop:true,
            paginationCustomRender: function(swiper, current, total) {
                var names = [];
                var icons = [];
                $this.find(".swiper-slide").each(function(i) {
                    names.push($(this).data("name"));
                    icons.push($(this).data("icon"));
                });
                var text = "
";
                for (let i = 1; i <= total; i++) {
                    if (current != i) {
                        text += "
"  + "" + names[i-1] + "
";
                    } else {
                        text += "
" + "" + names[i-1] + "
";
                    }
                }
                text += "
";
                return text;
            },
            onTransitionEnd: function(){
                $('.slider-tab').on('click', function(){
                    var target = $(this).data('index');
                    blockSwiper.slideTo(target);
                    return;
                })
            }
        });

    });

`


text:
Q: onclick not working as expected I have a script which expands an accordion menu when clicked.
I select the required menu item by using getElementsByClassName
window.onload = function() {
 var acc = document.getElementsByClassName("accordion_f");
 //  var acc = document.querySelectorAll(".accordion_f");
 var i;

// test code start
 acc[10].classList.toggle("active");
 acc[10].nextElementSibling.classList.toggle("show");
// test code end

 for (i = 0; i < acc.length; i++) {
   acc[i].onclick = function(){
//        acc[i].classList.toggle("active");
   this.classList.toggle("active");
//        acc[i].nextElementSibling.classList.toggle("show");
   this.nextElementSibling.classList.toggle("show");
   }
 }
};

Unfortunately the onclick will not trigger, I am not sure what I am doing wrong.
I tested the getElementsByClassName by using
acc[10].classList.toggle("active");
acc[10].nextElementSibling.classList.toggle("show");

This works correctly so getElementsByClassName is working
I also tried using document.querySelectorAll this also worked
I tried using this and acc[i] neither seemed to work. But I sense this is not the problem as when I inspect the html elements and check Events, I see no event handlers registered on the current element.
my html looks like this:
<button class="accordion_f">24/7 Activity Tracking</button>

Tracks your daily activity at five intensity levels for 24 hours a day, seven days a week, and provides a complete picture of all of your activity. It counts your active time, daily burnt calories, steps, distance from steps and sleep.

So in summary why does this work:
 acc[10].classList.toggle("active");
 acc[10].nextElementSibling.classList.toggle("show");

But this does not work or even register on elements
   acc[i].onclick = function(){

UPDATE
My accordion menu is inside a Tab menu which has it's own JavaScript to change tabs:
var newHTML = document.getElementById(newTab).innerHTML;
document.getElementById('first_View').innerHTML = newHTML;

I moved the accordion menu outside the Tab menu and onclick works.
If I comment out the above code from the tab menu script, my accordion menu works, but then the Tab menu will not change.
Further testing using addEventListener instead of onclick:
window.onload = function() {
  var acc = document.getElementsByClassName("accordion_f");
  var i;

// test code start
  acc[10].classList.toggle("active");
  acc[10].nextElementSibling.classList.toggle("show");
// test code end

  for (i = 0; i < acc.length; i++) {
    acc[i].addEventListener('click', expand_m, false);
  }
};

function expand_m(){
   this.classList.toggle("active");
   this.nextElementSibling.classList.toggle("show");
}

This does exactly the same as the original onclick code above, when I inspect the html elements and check Events, I see no event handlers registered on the current element, so clicking does not work for me, unless I stop the innerHTML changes.
Any help would be appreciated.

A: You should give a refrence of i to your function that occurs onclick:

window.onload = function() {
  var acc = document.getElementsByClassName("accordion_f");

  for (var i = 0; i < acc.length; i++) {
    acc[i].onclick = (function(index) {
      return function() {
        acc[index].classList.toggle("active");
        acc[index].nextElementSibling.classList.toggle("show");
      }
    })(i);
  };
};
.accordion_f {
  display: block;
}

.panel {
  display: none;
}

.show {
  display: block !important;
}
<button class="accordion_f">24/7 Activity Tracking</button>

Tracks your daily activity at five intensity levels for 24 hours a day, seven days a week, and provides a complete picture of all of your activity. It counts your active time, daily burnt calories, steps, distance from steps and sleep.

<button class="accordion_f">24/7 Activity Tracking</button>

Tracks your daily activity at five intensity levels for 24 hours a day, seven days a week, and provides a complete picture of all of your activity. It counts your active time, daily burnt calories, steps, distance from steps and sleep.

<button class="accordion_f">24/7 Activity Tracking</button>

Tracks your daily activity at five intensity levels for 24 hours a day, seven days a week, and provides a complete picture of all of your activity. It counts your active time, daily burnt calories, steps, distance from steps and sleep.

A:

  document.addEventListener("DOMContentLoaded", function(event) {

 var acc = document.getElementsByClassName("accordion_f");
 //  var acc = document.querySelectorAll(".accordion_f");
 var i;

 for (i = 0; i < acc.length; i++) {
   acc[i].onclick = function(){
//        acc[i].classList.toggle("active");
   this.classList.toggle("active");
//        acc[i].nextElementSibling.classList.toggle("show");
   this.nextElementSibling.classList.toggle("show");
   }
 }
  });
<button class="accordion_f">24/7 Activity Tracking</button>

Tracks your daily activity at five intensity levels for 24 hours a day, seven days a week, and provides a complete picture of all of your activity. It counts your active time, daily burnt calories, steps, distance from steps and sleep.

A: The problem was the embedding my javascript in another menu, the javascript from the tab menu was overwriting my accordion menu javascript.
So I simply called the accordion function at the end of the Tab menu and the onclicks started working.
function changeTab(tab){
var newTab = "view"+tab;
var element_id = "t";
var newHTML = document.getElementById(newTab).innerHTML;
document.getElementById('first_View').innerHTML = newHTML;

accord_menu();
}

function accord_menu() {
  var acc = document.getElementsByClassName("accordion_f");
  var i;

  for (i = 0; i < acc.length; i++) {
    acc[i].onclick = function(){
      this.classList.toggle("active");
      this.nextElementSibling.classList.toggle("show");
    }
  }
}


text:
Q: Add ACF fields to search results page WordPress I have a file named search.php, where all the search results are added.
The search form is located on the homepage. The problem is, I have no special page for the search results, but I want to add ACF fields to this page. I have searched in the dropdown menu 'location' in the ACF plugin, but I can't find the search.php file to add groups to. I am sorry if my explaination is a bit vague, but I don't know how to explain this exactly.
Summary, I want to add ACF fields to my search.php search results page.
Terminology: ACF stand for the Advanced Custom Fields plugin in WordPress.

A: You can also do it using plugin but use below code to avoide plugin.
You need to add this code in you function.php file
<?php
/**
 * [list_searcheable_acf list all the custom fields we want to include in our search query]
 * @return [array] [list of custom fields]
 */
function list_searcheable_acf(){
  $list_searcheable_acf = array("title", "sub_title", "excerpt_short", "excerpt_long", "xyz", "myACF");
  return $list_searcheable_acf;
}
/**
 * [advanced_custom_search search that encompasses ACF/advanced custom fields and taxonomies and split expression before request]
 * @param  [query-part/string]      $where    [the initial "where" part of the search query]
 * @param  [object]                 $wp_query []
 * @return [query-part/string]      $where    [the "where" part of the search query as we customized]
 * see https://vzurczak.wordpress.com/2013/06/15/extend-the-default-wordpress-search/
 * credits to Vincent Zurczak for the base query structure/spliting tags section
 */
function advanced_custom_search( $where, &$wp_query ) {
    global $wpdb;

    if ( empty( $where ))
        return $where;

    // get search expression
    $terms = $wp_query->query_vars[ 's' ];

    // explode search expression to get search terms
    $exploded = explode( ' ', $terms );
    if( $exploded === FALSE || count( $exploded ) == 0 )
        $exploded = array( 0 => $terms );

    // reset search in order to rebuilt it as we whish
    $where = '';

    // get searcheable_acf, a list of advanced custom fields you want to search content in
    $list_searcheable_acf = list_searcheable_acf();
    foreach( $exploded as $tag ) :
        $where .= "
          AND (
            (wp_posts.post_title LIKE '%$tag%')
            OR (wp_posts.post_content LIKE '%$tag%')
            OR EXISTS (
              SELECT * FROM wp_postmeta
                  WHERE post_id = wp_posts.ID
                    AND (";
        foreach ($list_searcheable_acf as $searcheable_acf) :
          if ($searcheable_acf == $list_searcheable_acf[0]):
            $where .= " (meta_key LIKE '%" . $searcheable_acf . "%' AND meta_value LIKE '%$tag%') ";
          else :
            $where .= " OR (meta_key LIKE '%" . $searcheable_acf . "%' AND meta_value LIKE '%$tag%') ";
          endif;
        endforeach;
            $where .= ")
            )
            OR EXISTS (
              SELECT * FROM wp_comments
              WHERE comment_post_ID = wp_posts.ID
                AND comment_content LIKE '%$tag%'
            )
            OR EXISTS (
              SELECT * FROM wp_terms
              INNER JOIN wp_term_taxonomy
                ON wp_term_taxonomy.term_id = wp_terms.term_id
              INNER JOIN wp_term_relationships
                ON wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
              WHERE (
                taxonomy = 'post_tag'
                    OR taxonomy = 'category'
                    OR taxonomy = 'myCustomTax'
                )
                AND object_id = wp_posts.ID
                AND wp_terms.name LIKE '%$tag%'
            )
        )";
    endforeach;
    return $where;
}

add_filter( 'posts_search', 'advanced_custom_search', 500, 2 );

for reference - https://gist.github.com/charleslouis/5924863
Try This solution if first is not working.
https://support.advancedcustomfields.com/forums/topic/making-customfields-searchable/

A: it works for me
function custom_search_query( $query ) {
    if ( !is_admin() && $query->is_search ) {
        $result = $query->query_vars['s'];
        $query->query_vars['s'] = '';
        $query->set('meta_query', array('relation' => 'OR',
            array(
                'key'     => 'acf_name', // ACF FIELD NAME OR POST META
                'value'   => $result,
                'compare' => 'LIKE',
            )
        ));
        $query->set('post_type', 'post'); // optional POST TYPE
    }
}
add_filter( 'pre_get_posts', 'custom_search_query');


text:
Q: Formatting not working anywhere I have tried on many different browsers and computers to format my SO questions, but they always end up showing up as unformatted paragraph text, and someone else formats them. I indent by text four spaces for code, but it does not work.
Original edit screenshot:

Source of edit:

A: There must be an empty line between the last paragraph and your code block.

The above doesn't work, but this one will:

Taken from your SO answer


text:
Q: How to pull data from Python List of dictionaries I am looking to pull the "high" from all 3 lists below. I am unsure how to proceed.
[
   {
      'timestamp':'2019-04-09T23:41:00.000Z',
      'symbol':'XBTUSD',
      'open':5189.5,
      'high':5190,
      'low':5189,
      'close':5190,
      'trades':14,
      'volume':1246,
      'vwap':5189.4136,
      'lastSize':480,
      'turnover':24010476,
      'homeNotional':0.24010476,
      'foreignNotional':1246
   },
   {
      'timestamp':'2019-04-09T23:40:00.000Z',
      'symbol':'XBTUSD',
      'open':5190,
      'high':5190,
      'low':5189.5,
      'close':5189.5,
      'trades':4,
      'volume':540,
      'vwap':5189.9523,
      'lastSize':20,
      'turnover':10404800,
      'homeNotional':0.104048,
      'foreignNotional':540
   },
   {
      'timestamp':'2019-04-09T23:39:00.000Z',
      'symbol':'XBTUSD',
      'open':5197.5,
      'high':5195.5,
      'low':5187,
      'close':5190,
      'trades':56,
      'volume':24286,
      'vwap':5189.6829,
      'lastSize':1058,
      'turnover':467970327,
      'homeNotional':4.67970327,
      'foreignNotional':24286
   }
]

I have tried to simply use high = [0:]["high"] - but that returns
 TypeError: list indices must be integers or slices, not str

What would be the appropriate command to have all 3 "high" from each list? For this instance, it should return 5190, 5190, 5195.5.

A: Use a list comprehension:  [ x['high'] for x in data ]
 if data is the array you posted in your original post.

A: I think below answer will help
I have assigned your list to listofDict and I am using the for loop to iterate through all the list elements .
As listofDict element are dict type, I am using the key to extract the value.
Here key is High
listofDict=[
   {
      'timestamp':'2019-04-09T23:41:00.000Z',
      'symbol':'XBTUSD',
      'open':5189.5,
      'high':5190,
      'low':5189,
      'close':5190,
      'trades':14,
      'volume':1246,
      'vwap':5189.4136,
      'lastSize':480,
      'turnover':24010476,
      'homeNotional':0.24010476,
      'foreignNotional':1246
   },
   {
      'timestamp':'2019-04-09T23:40:00.000Z',
      'symbol':'XBTUSD',
      'open':5190,
      'high':5190,
      'low':5189.5,
      'close':5189.5,
      'trades':4,
      'volume':540,
      'vwap':5189.9523,
      'lastSize':20,
      'turnover':10404800,
      'homeNotional':0.104048,
      'foreignNotional':540
   },
   {
      'timestamp':'2019-04-09T23:39:00.000Z',
      'symbol':'XBTUSD',
      'open':5197.5,
      'high':5195.5,
      'low':5187,
      'close':5190,
      'trades':56,
      'volume':24286,
      'vwap':5189.6829,
      'lastSize':1058,
      'turnover':467970327,
      'homeNotional':4.67970327,
      'foreignNotional':24286
   }
]

for l in listofDict:
   print (l['high'])

A: You can use pandas and convert to dataframe/table and then you can get df["high"].
If you will need only two values then you can do df['high'][:2]. It is similar to what you tried.
import pandas as pd

data = [
   {
      'timestamp':'2019-04-09T23:41:00.000Z',
      'symbol':'XBTUSD',
      'open':5189.5,
      'high':5190,
      'low':5189,
      'close':5190,
      'trades':14,
      'volume':1246,
      'vwap':5189.4136,
      'lastSize':480,
      'turnover':24010476,
      'homeNotional':0.24010476,
      'foreignNotional':1246
   },
   {
      'timestamp':'2019-04-09T23:40:00.000Z',
      'symbol':'XBTUSD',
      'open':5190,
      'high':5190,
      'low':5189.5,
      'close':5189.5,
      'trades':4,
      'volume':540,
      'vwap':5189.9523,
      'lastSize':20,
      'turnover':10404800,
      'homeNotional':0.104048,
      'foreignNotional':540
   },
   {
      'timestamp':'2019-04-09T23:39:00.000Z',
      'symbol':'XBTUSD',
      'open':5197.5,
      'high':5195.5,
      'low':5187,
      'close':5190,
      'trades':56,
      'volume':24286,
      'vwap':5189.6829,
      'lastSize':1058,
      'turnover':467970327,
      'homeNotional':4.67970327,
      'foreignNotional':24286
   }
]

df = pd.DataFrame(data)

print(df['high'].to_list())

[5190.0, 5190.0, 5195.5]


text:
Q: Template container iterators I am working on a homework problem and I cannot get this problem to compile:
I need to write function that accepts two iterators (for any container) and return the min and max value as a pair
Here are the errors I am getting:
Error   1   error C2783: 'std::pair<T,T> problem1(It,It)' : could not deduce template argument for 'T'
Error   2   error C2783: 'std::pair<T,T> problem1(It,It)' : could not deduce template argument for 'T'
Error   3   error C2783: 'std::pair<T,T> problem1(It,It)' : could not deduce template argument for 'T'

Here is my code:
template <typename It, typename T>
std::pair<T,T> problem1(It start, It end)
{
    // initial min max
    T min = *start;
    T max = *start;

    It curr = start;
    while (curr != end)
    {
        // check if we have a new min or max
        if (min > *curr)
            min = *curr;
        if (max < *curr)
            max = *curr;

        curr++; // get next
    }

    return std::make_pair(min, max);
}

The code is being tested with the following code, which I cannot modify.
std::vector<int> a = { 1, 3, 12, -8, 22, 5, 41, 33 };
std::list<double> b = { 0.8, -123, 44, 56, 12, 231 };
std::array<unsigned int, 1> c;
c[0] = 12;
auto a_ans = problem1(a.begin(), a.end());
auto b_ans = problem1(b.begin(), b.end());
auto c_ans = problem1(c.begin(), c.end());
if (*a_ans.first == -8 && *a_ans.second == 41 &&
    *b_ans.first == -123 && *b_ans.second == 231 &&
    *c_ans.first == 12 && *c_ans.second == 12) {
    std::cout << "Test 1 passed.\n";
    score += 10;
}
else {
    std::cout << "Test 1 failed.\n";
}

A: What the compiler is telling you is that it can't figure out T from the arguments that you provided to the function. Template parameters on a function either have to be explicitly provided (a_ans = problem1<vector<int>::iterator, int>(a.begin(), b.begin())), or have to be deductible from the function parameters (the compiler guesses It based on the start and end parameters).
Luckily, iterators have a value_type member:
template <typename It>
std::pair<typename It::value_type, typename It::value_type> problem1(It start, It end)
{
    // initial min max
    typename It::value_type min = *start;
    typename It::value_type max = *start;

    It curr = start;
    while (curr != end)
    {
        // check if we have a new min or max
        if (min > *curr)
            min = *curr;
        if (max < *curr)
            max = *curr;

        curr++; // get next
    }

    return std::make_pair(min, max);
}

Basically, you replace T with typename It::value_type. This works because iterator types know their value types, and this works pre-C++11 too (in case your teacher is shy about new language versions).

A: The compiler has no way to know what type T is.
You can remove it from the template and use decltype(*start) instead.
The advantage of using decltype is that it will work with raw pointers and non standard iterators (unlike ::value_type)


text:
Q: Why the result of this regular expression in javascript is true? alert(/[a-z]+/.test("4Nyth1n&_."));
why the output is true? doesn't it supposed to match just the alphabet from a to z (lower case)?

A: test just looks for a match of a substring. In this case, the substring yth matches. If you want to match the whole string, insert ^ and $:
alert(/^[a-z]+$/.test("4Nyth1n&_."));

A: It matches because the test string contains a sub-sequence of chars from [a-z] 1 or more times, specifically "yth" and "n".


text:
Q: Shifting last tab towards right in Bootstrap I have the following code for displaying tabs in bootstrap:

Search

Click

Play

However, I want to display the last tabs towards extreme right.
I tried: float:right; for the last li element, but it didnt work..

A: Try this:

Search

Click

Play


text:
Q: Replace spaces but not when between parentheses I guess I can do this with multiple regexs fairly easily, but I want to replace all the spaces in a string, but not when those spaces are between parentheses.
For example:
Here is a string (that I want to) replace spaces in.

After the regex I want the string to be
Hereisastring(that I want to)replacespacesin.

Is there an easy way to do this with lookahead or lookbehing operators?
I'm a little confused on how they work, and not real sure they would work in this situation.

A: Try this:
replace(/\s+(?=[^()]*(\(|$))/g, '')

A quick explanation:
\s+          # one or more white-space chars
(?=          # start positive look ahead
  [^()]*     #   zero or more chars other than '(' and ')'
  (          #   start group 1
    \(       #     a '('
    |        #     OR
    $        #     the end of input
  )          #   end group 1
)            # end positive look ahead

In plain English: it matches one or more white space chars if either a ( or the end-of-input can be seen ahead without encountering any parenthesis in between.
An online Ideone demo: http://ideone.com/jaljw
The above will not work if:

*

*there are nested parenthesis

*parenthesis can be escaped


text:
Q: For generating programs there is " CodeModel API" in java, like is there any API for Objective-C? I Want to generate A simple "Hello World" objective-C program, Which API i have to use for that? Really I don't know is it possible or not?, but in java I know there is CodeModel API.
JCodeModel cm = new JCodeModel();
JDefinedClass class1 = cm._class("Main");
JMethod method = class1.method(JMod.PUBLIC, cm.VOID, "print");
JBlock block = method.body();
JVar a = block.decl(cm.INT, "a", JExpr.lit(10));
JVar b = block.decl(cm.INT, "b", JExpr.lit(20));

with use of this code we create one file with class name as "main", method name is "print" and in method body is "a & b two int variables", like that i want to create one file in objective-C for displaying "Hello world" in view. is it possible?, if yes, How can?

A: What you are asking to do is very difficult in OS X and nigh impossible for iOS.
Unlike Java, which uses bytecode to store programs, Objective-C is compiled into a native executable. This means you would need a full compiler and linker built into your application.
Needless to auto-generating OS X executables is very difficult.
Once you have compiled and linked the executable you've created, then you need to execute it. In OS X you can directly execute binares, but all binaries in iOS must be digitally signed by Apple. The executable would need to be packaged up as a new App and signed by your distribution profile. The new App would need to be submitted to Apple to be digitally signed. It would then need to be downloaded and installed from Apple. Finally, it could be executed as a separate App.
To my knowledge, Apple has no program for receiving auto-generated programs. I don't think Apple has any interest in this as a business model and working it out with Apple would involve lots of lawyers and contracts that I would never hope to understand.
Needless to say auto-generating iOS executables is nigh impossible.
Perhaps it would be easier to look into other alternatives.


text:
Q: Posts not loading/rendering Lately the Stack Exchange android app (v 1.0.58 on an android 4.4 phone and a 5.0 tablet) won't render some posts. Both questions and answers are affected. I can see votes and comments but the post content is an empty white box.
For example:

A: This is a daily issue for me as well on my HTC Desire 816 with Android 4.4.2 and app version 1.0.58. Most posts render normally, but approximately one out of fifteen are blank.
The only commonality I have been able to identify is that the unrendered posts tend to be long--I have not yet seen a short post that exhibits the issue.
I can click "edit" to view the markdown of the affected questions and answers; so far, the problem only seems to appear on the rendered version.
The issue manifests on multiple sites: StackOverflow, Programmers, English and others. It affects both questions and answers, but not necessarily at the same time. I see blank questions with normal answers, and vice-versa.
Closing and reloading the application does not change the situation. I have installed the latest updates.
FWIW, this question renders as expected for me, but the one linked by Shadow Wizard in the comments above does not.
Examples of questions that exhibit this behavior on my device:

*

*bootstrap responsive two column issue (Question only--answers are displayed correctly)

*Android app intermittently shows blank body in questions and answers (multiple sites) (Question only)

*php shopping cart -group by selection and get the total (Question only)

*https://meta.stackoverflow.com/a/288044/749181 (Answer only)

*https://christianity.stackexchange.com/a/17475/407 (Answer)


text:
Q: Тёмная тема в Android Studio меня тональность цвета у меня есть два файла themes и themes-night, также есть colors и colors-night. В colors устанавливаю цвет с именем background1 и в colors-night переопределяю его с другим цветом. Есть атрибут background1 в themes и themes-night даю ему цвет @colors/background1. При запуске приложения в светлой теме отображается правильный цвет, а в тёмной теме отображается цвет для тёмной темы из colors-night, но с изменённым тоном цвета. Должен быть такой , но отображается такой
Помогите, пожалуйста, понять почему так

A: Решил проблему самостоятельно - всё вышло очень смешно, хоть больше хочется плакать. Для отладки я использую физической устройство Xiaomi, в настройках я нашел параметры тёмной темы этой оболочки и убрал функцию затемнения, которая как раз и изменяла цвет.


text:
Q: Why are $\limsup \sqrt[n]{1/n!}=0$ and $\limsup\sqrt[n]{n!}=\infty$? I was looking at the power series $\sum\frac{z^n}{n!}$ and $\sum n!z^n$, and wanted to compute their radii of convergence.
For the first, $\limsup \sqrt[n]{1/n!})=0$, and for the second $\limsup \sqrt[n]{n!}=\infty$, so the radii are $\infty$ and $0$ respectively.
I'm curious, without resorting to Wolfram or Mathematica or some similar program, how could one justify by hand these limits? Intuitively they make sense that they are what they are, since the factorial should grow more quickly than the power of $1/n$ can handle. I suppose would explain the other since the terms are just reciprocals. Thanks!

A: We just have to show that $\lim_{n\to\infty}\frac 1n\sum_{k=1}^n\ln k=+\infty$. We have
\begin{align*}
\frac 1n\sum_{k=1}^n\ln k&=\frac 1n\sum_{k=1}^n\left(\ln \frac kn+\ln n\right)\\
&=\ln n+\frac 1n\sum_{k=1}^n\ln\left(1+\frac{k-n}n\right)\\
&=\ln n+\frac 1n\sum_{j=0}^{n-1}\ln\left(1-\frac jn\right)\\
&\geq \ln n +\frac 1n\sum_{j=0}^{n-1}-\frac jn-\frac{j^2}{n^2}\\
&\geq \ln n+\frac 1nn\left(-\frac{n-1}n-\frac{(n-1)^2}{n^2}\right)\\
&=\ln n-1+\frac 1n-\frac{(n-1)^2}{n^2}\\
&\geq \ln n-2,
\end{align*}
which gives the result.


text:
Q: Amazon s3 URL + being encoded to %2? I've got Amazon s3 integrated with my hosting account at WP Engine. Everything works great except when it comes to files with + characters in them.
For example in the following case when a file is named: test+2.pdf
http://support.mcsolutions.com/wp-content/uploads/2011/11/test+2.pdf = does not work.
The following URL is the amazon URL. Notice the + charcter is encoded. Is there a way to prevent/change this?
http://mcsolutionswpe.s3.amazonaws.com/mcsupport/wp-content/uploads/2011/11/test%2b2.pdf
Other URLs work fine:
Amazon -> http://mcsolutionswpe.s3.amazonaws.com/mcsupport/wp-content/uploads/2011/11/test2.pdf
Website -> http://support.mcsolutions.com/wp-content/uploads/2011/11/test2.pdf

A: If I understand your question correctly, then no, there is no way to really change this.
The cause appears to be an unfortunate design decision made on S3 many years ago -- which, of course, cannot be fixed, now, because it would break too many other things -- which involves S3 using an incorrect variant of URL-escaping (which includes but is not quite limited to "percent-encoding") in the path part of the URL, where the object's key is sent.
In the query string (the optional part of a URL after ? but before the fragment, if present, which begins with #), the + character is considered equivalent to [SPACE], (ASCII Dec 32, Hex 0x20).
...but in the path of a URL, this is not supposed to be the case.
...but in S3's implementation, it is.
So + doesn't actually mean +, it means [SPACE]... and therefore, + can't also mean +... which means that a different expression is required to convey + -- and that value is %2B, the url-escaped value of + (ASCII Dec 43, Hex 0x2B).
When you upload your files, the + is converted by the code you're using (assuming it understands this quirk, as apparently it does) into the format S3 expects (%2B)... and so it must be requested using %2B so when you download the files.
Strangely, but not surprisingly, if you store the file in S3 with a space in the path, you can actually request it with a + or a space or even %20 and all three of these should actually fetch the file... so if seeing the + in the path is what you want, you can sort of work around the issue by saving it with a space instead, though this workaround deserves to be described as a "hack" if ever a workaround did.  This tactic will not work with libraries that generate pre-signed GET URLs, unless they specifically are designed to ignore the standard behavior of S3 and do what you want, instead... but for public links, it should be essentially equivalent.


text:
Q: What does it mean for "a tunnel" to "feel its way"? I read a sentence in a chapter named "The Third Level" which was:

There's probably a long tunnel that nobody knows about feeling its way under the city right now on its way to Times Square and maybe another to Central Park.

I surmise that the subject of the verb "feeling" in the sentence is "a long tunnel" not "nobody". It would not have been a little bit ambiguous if the author had inserted a comma after "about". But I don't understand what does it mean for "a tunnel" to "feel its way".

A: You should always consider the wider context. Unusual phrases that you cannot find in a dictionary may be explained in the surrounding text.
I found the quote, from the short story The Third Level:

Sometimes I think Grand Central is growing like a tree, pushing out new corridors and staircases like roots. There's probably a long tunnel that nobody knows about feeling its way under the city right now on its way to Times Square and maybe another to Central Park.

You will see I have highlighted the simile - the writer says that Grand Central Station is "like a tree", and describes its tunnels like "roots". Roots of a tree grow underground, and so your phrase in question is just a continuation of this simile, imagining that tunnels are "feeling their way under the city" as if they are roots of a tree finding new pathways. Of course, this latter part is abstract - the original simile is quite sound to describe the real network of tunnels, but the idea that new ones would "grow" is pure imagination.


text:
Q: getExternalFilesDir() returns null (not a permissions issue) I've been working on an app for some time, and have been testing it on many devices. Suddenly, it stopped working on the Motorola Xoom Family Edition (Honeycomb 3.1). Every time I would try to run the app, it would fail on the call to getExternalFilesDir(), as that call would return null instead of a File.
From my research, anyone with a similar problem is either missing the WRITE_EXTERNAL_STORAGE, never got an answer, or was talking about a bug in Froyo. None of that applies here--and again, it works fine on other devices, I have the WRITE_EXTERNAL_STORAGE permission, and it was even working on this device until a few minutes ago.
Any idea what might cause this issue, or how to programmatically prevent it?

A: Same problem on Samsung SCH-1405 (VZW Galaxy II) running 2.3.6 (kernel 2.6.35.7-FF1). No problems getting the external files directory for months and then bam, it starts to return NULL. Restarted phone and problem went away. Not a good omen.
A possible cause could be that I've been switching this phone in and out of USB debugging mode to get screen shots and have been ripping out the USB cable from the phone without first unmounting the phone's file systems from my Mac. This is new behavior on my part.
When I look at the return result from android.os.Environment.getExternalStorageState() with the problem present I see "shared", but when the phone is restarted the result is "mounted". Thus it seems that when the phone thinks that the external storage is "shared" then it is not allowing an app to access the external storage. This is speculation.

A: The problem went away after I restarted the tablet. It may just be some bizarre quirk that is extremely rare and fixed by a simple restart; I hope not, as I would like to have a solid way to prevent this instead of just hoping that any users who run into the bug are understanding.

A: This will happen if the device is in "Mass Storage" mode. If you change it to MTP or "Charge Only", depending on the device, it should work. This is because the external data storage is technically not mounted to the device but to your computer.


text:
Q: Удалить цифру в числе У меня есть число, в котором нужно удалить цифру, соседние значения которой дают в сумме больше 14.
Например, 123456789. Берём 9. У неё соседние значения - это 8 и 0. 0 т.к. справа ничего нет. Сумма девятки - 8. Далее 8. Слева и справа 7 и 9. Сумма - 16. Соответственно 8 убираем. Далее 7. Соседние значения - это 6 и 8. Но как мы видим 8 остаётся для дальнейшего выполнения алгоритма и тем не менее сумма этих чисел не более 14. 7 остаётся. И т.д. Вывод: 12345679
Написал этот код недавно, но встал в ступор и забил на него. Сейчас решил вспомнить о нем.
В данном примере должно быть выведено 99, ошибка скорее всего у:
SET @lastCount = @x % 10 /* Вычисление последнего значения в числе */

--- Объявление переменных
DECLARE @x INT = 0,
        @lastCount INT = 0,
        @nextCount INT = 0,
        @summ INT = 0,
        @count INT = 0,
        @putnum INT = 0,
        @cnt INT = 0,
        @values INT = 0,
        @x2 int = 0
---
--- Присваивание
    SET @x = 9999
    SET @values = @x
    set @x2 = @x
    SET @putnum = @x
---

--- Цикл подсчёта цифр
WHILE (@values <> 0 or @cnt = 0) BEGIN
    SET @cnt = @cnt + 1
    SET @values = @values  / 10
END
---

--- Алгоритм
WHILE @count < @cnt
BEGIN
SET @nextCount = @x / 10 % 10 /* Вичисление следующего значения в числе */
SET @summ = @nextCount + @lastCount /* Сумма двух соседних значений */

/* Если сумма двух соседей какого-то числа больше 14, то оно удаляется, но остаётся в памяти для вычисления следующей суммы другого числа */
IF @summ > 14
    set @putnum = (SELECT STUFF(@putnum, LEN(@putnum) - CHARINDEX(CAST(@nextCount as varchar(100)), REVERSE(@putnum))+1, 1, ''))

set @x2 = @putnum
set @x = cast(@putnum as int)
SET @lastCount = @x % 10 /* Вычисление последнего значения в числе */

set @x = cast(@putnum as int)
SET @count = @count + 1
END
---

PRINT(@putnum)


text:
Q: What is "outheroding"? I have been reading Scott's Ivanhoe recently and have come across a word I cannot find a meaning for: outheroding. In the novel it appears in a discussion of footwear:

Fur and gold were not spared in his garments; and the point of his boots, outheroding the preposterous fashion of his time, turned up so very far, as to be attached, not to his knees merely but to his very girdle, and effectually prevented him from putting his foot into the stirrup.

A search of the internet produces a reference here where it appears as

The characters in this act
  frisk about, here, there, and every where, as teasingly as the Jack o'
  Lantern-lights which mischievous boys, from across a narrow street,
  throw with a looking-glass on the faces of their opposite neighbours.
  Bertram disarmed, outheroding Charles de Moor in the Robbers, befaces
  the collected knights of St. Anselm, (all in complete armour) and so,
  by pure dint of black looks, he outdares them into passive poltroons.

which doesn't help much in establishing what the word means.
Does anyone know what outheroding is?

A: The meaning Scott intended is to outdo in absurdity (I came across that unusual definition in an online dictionary, but lost the reference - sorry).
All my dictionaries limit their definition to outdo in cruelty, if they even list the word at all. The proverbial saying is to out-Herod Herod - which isn't particularly common in the first place, but when it is used, that's nearly always the form.
In all Google NGram's vast corpus, outherod (or outHerod) appears on average less than once a year, and nearly all of those occur as outHerod Herod in the actual text (i.e. - explicitly repeating the full saying). NGrams doesn't support searching for out-herod, but presumably there would be more results for that if it did.
The expression appears in this quite old text of Shakespeare's Hamlet as it outHerod's Herod, but I couldn't say if that's how the Bard himself wrote it. However, I suspect he may have been the first to write it at all.
Note that out-(someone) (someone) is a fairly standard way of generating "one-off" expressions like this today. Google returns 130K hits for out-Bush Bush and 50K for out-Blair Blair, for example. That compares to 20K for the Herod version, just to put it in context.
In my opinion, out-Herod (irrespective of hyphenation or capitalisation) isn't really a 'word' at all. It's just a transient lexical element that no more deserves to be in the dictionary than out-Obama (which gets over 230K Google hits, by the way).
I'm no biblical scholar, but I don't think Herod has any particular reputation for extravagance or absurdity. As far as I know, extreme cruelty as exemplified by the Massacre of the Innocentswas his proverbial quality. So I think Scott's usage was grammatically, typographically and semantically  perverse, to say the least.

A: "outheroding" is a present participle form of "outherod".
Here is the definition for "outherod".

to outdo in extravagance, violence, or excess: His cruelty out-Herods Herod.

A: outheroding [present participle form of outherod] means:
    "To surpass someone in cruelty or evil".

A: refers to the figure of biblical Herod, who allegedly had the innocent babies slaughtered. In popular medieval churchplays often presented by actors in an exaggerated way as pure evil. That is what Hamlet refers to when he talks to a troup of actors he asks to stage the murder of his father, meaning that to achieve the effect wished for (mirroring his horrible deed to his uncle) they have to act in a realistic way.


text:
Q: Flutter ObjectDB State syncronising with DB using Futures I have a problem with Futures because I have mostly synchronous code but my database is obviously using asynchronous elements so I need to make my BLoC/UI code to wait my DB operations on every update. I am trying to use a such way
  final db = SchemaDB<ColorThemeObjectdbSchema>(
    DatabaseInterface.storage(),
    (themeMap) => ColorThemeObjectdbSchema.fromMap(themeMap),
  );
  final AdvancedDrawerController advancedDrawerController =
      AdvancedDrawerController();
  MyCustomTheme? defaultTheme;
  final regexAll = RegExp(RegExp.escape(''), caseSensitive: false);

  Future<bool> isDbEmpty(SchemaDB<ColorThemeObjectdbSchema> db) {
    var result = db.find({'themeObject': regexAll});
    return result.then((List<ColorThemeObjectdbSchema> resultSchemaList) {
      return resultSchemaList.isEmpty;
    });
  }

  Future<MyCustomTheme> themeFromDB(SchemaDB<ColorThemeObjectdbSchema> db) {
    var result = db.first({'themeObject': regexAll});
    return result.then((ColorThemeObjectdbSchema resultTheme) {
      return resultTheme.toMap()['themeObject'];
    });
  }

  void initTheme(db) async {
    if (await isDbEmpty(db)) {
      defaultTheme = MyCustomTheme(
        red: true,
        green: true,
        blue: true,
      );
    } else {
      defaultTheme = await themeFromDB(db);
    }
  }

  void disposeTheme(db) async {
    await db!.cleanup();
    await db!.insert(
      ColorThemeObjectdbSchema.fromMap({'themeObject': defaultTheme!})
    );
  }

  @override
  void initState() {
    super.initState();
    initTheme(db);
  }

  @override
  void dispose() {
    disposeTheme(db);
    super.dispose();
  }

But I have got Android Studio debugger with errors in InheritedWidget in some package's code (it mentions the provider package so maiby in it but it has been installed as dependency).


text:
Q: Getting ListView values into a string array? I have a ListView control set up in details mode, and on a button press I would like to retrieve all column values from that row in the ListView.
This is my code so far:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    Dim items As ListView.SelectedListViewItemCollection = _
    Me.ManageList.SelectedItems
    Dim item As ListViewItem
    Dim values(0 To 4) As String
    Dim i As Integer = 0
    For Each item In items
        values(i) = item.SubItems(1).Text
        i = i + 1
    Next
End Sub

But values just comes out as an empty array. Any ideas? I just want the values array to be filled with the data of that ListView row.
Cheers.

A: Here's the single-line solution:
mylistview.Items.Cast(Of ListViewItem).Select(Function(lvi As ListViewItem)lvi.SubItems(1).Text).ToArray()

A: You need to iterate the SubItems, not the selected items.  Fix:
If Me.ManageList.Items.Count <> 1 Then Exit Sub
Dim row As ListViewItem = Me.ManageList.Items(0)
Dim values(0 To row.SubItems.Count-1) As String
Dim i As Integer = 0
For Each item As ListViewItem.ListViewSubItem In row.SubItems
  values(i) = item.Text
  i = i + 1
Next

A: Just to check, are you aware that item.SubItems(1).Text will get the texts from the second column? And that since you're using SelectedItems it'll only look at the currently selected items in the ListView.
Edit:
Also, are you sure there will always just be a maximum of 5 selected items in the ListView?
Otherwise you'll have problems with
Dim values(0 To 4) As String

A: Old question, I know... maybe this helps for someones reference.. stumbled upon this question in a search for something else.
This works... not sure if the original poster somehow used an empy colelciton of selected items...
Also, dynamically resizing array based on selected items to overcome unforseen bugs...
    Dim valueArray(mylistview.SelectedItems.Count - 1) As String
    Dim i As Integer

    For Each Item As ListViewItem In mylistview.SelectedItems
        valueArray(i) = Item.Text
        i += 1
    Next

To get subitems, use item.subitems(1).text ... subitems(2).text.. etc
Cheers


text:
Q: Why do some values get updated in a func and others don't? Compare these two examples
(from: https://goinbigdata.com/golang-pass-by-pointer-vs-pass-by-value/)
package main

import "fmt"

type Person struct {
    firstName string
    lastName  string
}

func changeName(p Person) {
    p.firstName = "Bob"
}

func main() {
    person := Person {
        firstName: "Alice",
        lastName: "Dow",
    }

    changeName(person)

    fmt.Println(person)
}

The code above returns {Alice Dow} so the struct is not changed.
Now in this example
package main

import "fmt"

func main() {
    slice := []string{"a", "b", "c"}

    fmt.Println(slice)
    updateSlice(slice)
    fmt.Println(slice)
}

func updateSlice(slice []string) []string {
    slice[0] = "x"
    return slice
}

the output is
[a b c]
[x b c]

so the slice was changed by the func updateSlice.
Would someone explain the difference?

A: A slice is a reference to an underlying array. So, when you pass a slice to a function, you are essentially passing a reference to the underlying array.
In the first code snippet, when you call changeName(person), Go will create a copy of the person struct and pass it to the changeName function.
func main() {
    person := Person {
        firstName: "Alice",
        lastName: "Dow",
    }

    changeName(person) //Go will pass a copy of the person struct

    fmt.Println(person)
}

A slice in Go is just a reference to an underlying array; a slice is not an array. In the second example, updateSlice(slice) also passes by value. It creates a copy of slice. However, in this case, Go is creating a copy of a reference to an array. That means, that the "copy of slice" and "slice" are both pointing to the same underlying array.
func main() {
    slice := []string{"a", "b", "c"}

    fmt.Println(slice)
    //Go is still passing by value here, but the value passed is a reference
    // i.e. the copied value still points to the same underlying array
    updateSlice(slice)
    fmt.Println(slice)
}

Just in case you are trying to compare how a slice function in other languages like Javascript or Ruby work to a Slice in Go, don't (mentioning this because I did that when I was learning Go).
To add a little more clarification, when you do slice[0] = "x", you are not modifying the slice; you are modifying the underlying array that slice is referencing.


text:
Q: How to prevent a RuntimeError when unpickling a QObject? Trying to unpickle a pickled QObject (using Python 2.7, PyQt4 or 5, pickle or cPickle), raises the following RuntimeError:
RuntimeError: super-class __init__() of type QObject was never called
A minimal example:
cPickle.loads(cPickle.dumps(QtCore.QObject(), cPickle.HIGHEST_PROTOCOL))
I am aware that unpickling an object, by design, does not call the object's __init__() method.
How, then, can I make sure the superclass __init__() is called, in this case?
A seemingly similar question was asked here, but was not answered.

A: One possible solution, based on this answer, can be implemented as follows (a slightly more elaborate example, with a custom attribute):
import cPickle
from PyQt5 import QtCore

class MyQObject(QtCore.QObject):
    def __init__(self, parent=None):
        super(MyQObject, self).__init__(parent)
        # Add some custom attribute
        self.some_attribute = 'something'

    def __setstate__(self, state):
        # Restore attributes
        self.__dict__.update(state)
        # Call the superclass __init__()
        super(MyQObject, self).__init__()

original = MyQObject()
pickle_string = cPickle.dumps(original, cPickle.HIGHEST_PROTOCOL)
restored = cPickle.loads(pickle_string)

The parent can then be set using setParent(), if necessary.


text:
Q: How to read XML file into Sagemaker Notebook Instance? I have files in XML format saved in S3 bucket and I want to parse them with xml.etree inside a Sagemaker's Notebook Instance. I tried the following but it produces FileNotFoundError:
data_location = `s3://data-bucket/1.xml`
xml.etree.ElementTree.parse(data_location)