问:
New Error in spring boot 2.3.0.RELEASE : UnsatisfiedDependencyException for Oracle 12.2.0.1 jdbcdriver but not with mysql jdbcdriver
Created a fresh boot project with just jdbc and Oracle jdbc as dependencies

```<code>    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jdbc</artifactId>
    </dependency>

    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc8</artifactId>
        <version>12.2.0.1</version>
    </dependency>
</code>```

I configure the datasource in the application.properties file and run this simple application and it bombs with below stacktrace.

2020-05-25 15:07:16.769  WARN 11840 --- [           main]
  s.c.a.AnnotationConfigApplicationContext : Exception encountered
  during context initialization - cancelling refresh attempt:
  org.springframework.beans.factory.UnsatisfiedDependencyException:
  Error creating bean with name 'jdbcConverter' defined in class path
  resource
  [org/springframework/boot/autoconfigure/data/jdbc/JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration.class]:
  Unsatisfied dependency expressed through method 'jdbcConverter'
  parameter 4; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'jdbcDialect' defined in class path resource
  [org/springframework/boot/autoconfigure/data/jdbc/JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration.class]:
  Bean instantiation via factory method failed; nested exception is
  org.springframework.beans.BeanInstantiationException: Failed to
  instantiate
  [org.springframework.data.relational.core.dialect.Dialect]: Factory
  method 'jdbcDialect' threw exception; nested exception is
  org.springframework.data.jdbc.repository.config.DialectResolver$NoDialectException:
  Cannot determine a dialect for
  org.springframework.jdbc.core.JdbcTemplate@7fe083b1. Please provide a
  Dialect. 2020-05-25 15:07:16.769  INFO 11840 --- [           main]
  com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown
  initiated... 2020-05-25 15:07:17.023  INFO 11840 --- [           main]
  com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown
  completed. 2020-05-25 15:07:17.028  INFO 11840 --- [           main]
  ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report
  re-run your application with 'debug' enabled. 2020-05-25 15:07:17.035
  ERROR 11840 --- [           main] o.s.boot.SpringApplication

  : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException:
  Error creating bean with name 'jdbcConverter' defined in class path
  resource
  [org/springframework/boot/autoconfigure/data/jdbc/JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration.class]:
  Unsatisfied dependency expressed through method 'jdbcConverter'
  parameter 4; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'jdbcDialect' defined in class path resource
  [org/springframework/boot/autoconfigure/data/jdbc/JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration.class]:
  Bean instantiation via factory method failed; nested exception is
  org.springframework.beans.BeanInstantiationException: Failed to
  instantiate
  [org.springframework.data.relational.core.dialect.Dialect]: Factory
  method 'jdbcDialect' threw exception; nested exception is
  org.springframework.data.jdbc.repository.config.DialectResolver$NoDialectException:
  Cannot determine a dialect for
  org.springframework.jdbc.core.JdbcTemplate@7fe083b1. Please provide a
  Dialect.  at
  org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:539)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:895)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
  ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]     at
  org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
  ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]     at
  org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
  [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]     at
  org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
  [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]     at
  org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
  [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]     at
  org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
  [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]     at
  org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
  [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]     at
  org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
  [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]     at
  net.sincera.dbmigration.liquibasedemo.LiquibasedemoApplication.main(LiquibasedemoApplication.java:21)
  [classes/:na] Caused by:
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'jdbcDialect' defined in class path resource
  [org/springframework/boot/autoconfigure/data/jdbc/JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration.class]:
  Bean instantiation via factory method failed; nested exception is
  org.springframework.beans.BeanInstantiationException: Failed to
  instantiate
  [org.springframework.data.relational.core.dialect.Dialect]: Factory
  method 'jdbcDialect' threw exception; nested exception is
  org.springframework.data.jdbc.repository.config.DialectResolver$NoDialectException:
  Cannot determine a dialect for
  org.springframework.jdbc.core.JdbcTemplate@7fe083b1. Please provide a
  Dialect.  at
  org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1306)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1226)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   ... 19 common frames
  omitted Caused by:
  org.springframework.beans.BeanInstantiationException: Failed to
  instantiate
  [org.springframework.data.relational.core.dialect.Dialect]: Factory
  method 'jdbcDialect' threw exception; nested exception is
  org.springframework.data.jdbc.repository.config.DialectResolver$NoDialectException:
  Cannot determine a dialect for
  org.springframework.jdbc.core.JdbcTemplate@7fe083b1. Please provide a
  Dialect.  at
  org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   ... 33 common frames
  omitted Caused by:
  org.springframework.data.jdbc.repository.config.DialectResolver$NoDialectException:
  Cannot determine a dialect for
  org.springframework.jdbc.core.JdbcTemplate@7fe083b1. Please provide a
  Dialect.  at
  org.springframework.data.jdbc.repository.config.DialectResolver.lambda$getDialect$2(DialectResolver.java:76)
  ~[spring-data-jdbc-2.0.0.RELEASE.jar:2.0.0.RELEASE]   at
  java.util.Optional.orElseThrow(Optional.java:290) ~[na:1.8.0_241]     at
  org.springframework.data.jdbc.repository.config.DialectResolver.getDialect(DialectResolver.java:75)
  ~[spring-data-jdbc-2.0.0.RELEASE.jar:2.0.0.RELEASE]   at
  org.springframework.data.jdbc.repository.config.AbstractJdbcConfiguration.jdbcDialect(AbstractJdbcConfiguration.java:144)
  ~[spring-data-jdbc-2.0.0.RELEASE.jar:2.0.0.RELEASE]   at
  org.springframework.boot.autoconfigure.data.jdbc.JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration$$EnhancerBySpringCGLIB$$5730cfab.CGLIB$jdbcDialect$1()
  ~[spring-boot-autoconfigure-2.3.0.RELEASE.jar:2.3.0.RELEASE]  at
  org.springframework.boot.autoconfigure.data.jdbc.JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration$$EnhancerBySpringCGLIB$$5730cfab$$FastClassBySpringCGLIB$$5eb1865b.invoke()
  ~[spring-boot-autoconfigure-2.3.0.RELEASE.jar:2.3.0.RELEASE]  at
  org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
  ~[spring-core-5.2.6.RELEASE.jar:5.2.6.RELEASE]    at
  org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
  ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]     at
  org.springframework.boot.autoconfigure.data.jdbc.JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration$$EnhancerBySpringCGLIB$$5730cfab.jdbcDialect()
  ~[spring-boot-autoconfigure-2.3.0.RELEASE.jar:2.3.0.RELEASE]  at
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  ~[na:1.8.0_241]   at
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  ~[na:1.8.0_241]   at
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  ~[na:1.8.0_241]   at java.lang.reflect.Method.invoke(Method.java:498)
  ~[na:1.8.0_241]   at
  org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   ... 34 common frames
  omitted

If I run the above code using spring boot 2.2.7.RELEASE, it works just fine -- No exceptions!!

After 2 days, I thought of configuring a mysql datasource on localhost. The same program runs just fine (with spring boot 2.3.0.RELEASE) but this time it used the mysql datasource.

```<code>    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>
</code>```

What is happening with the oracle jdbc driver in spring boot 2.3.0.RELEASE ?

What is mysql jdbc driver doing correctly in spring boot 2.3.0.RELEASE ?

Thank you.

答:
These dependencies worked for me. </p>

```<code><parent>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-parent</artifactId>
  <version>2.2.6.RELEASE</version>
</parent>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter</artifactId>
</dependency>

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-jdbc</artifactId>
  </dependency>

<dependency>
  <groupId>com.oracle.database.jdbc</groupId>
  <artifactId>ojdbc8</artifactId>
  <version>19.6.0.0</version>
</dependency>
</code>```

Body:
Created a fresh boot project with just jdbc and Oracle jdbc as dependencies

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jdbc</artifactId>
    </dependency>

    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc8</artifactId>
        <version>12.2.0.1</version>
    </dependency>

I configure the datasource in the application.properties file and run this simple application and it bombs with below stacktrace.

2020-05-25 15:07:16.769  WARN 11840 --- [           main]
  s.c.a.AnnotationConfigApplicationContext : Exception encountered
  during context initialization - cancelling refresh attempt:
  org.springframework.beans.factory.UnsatisfiedDependencyException:
  Error creating bean with name 'jdbcConverter' defined in class path
  resource
  [org/springframework/boot/autoconfigure/data/jdbc/JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration.class]:
  Unsatisfied dependency expressed through method 'jdbcConverter'
  parameter 4; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'jdbcDialect' defined in class path resource
  [org/springframework/boot/autoconfigure/data/jdbc/JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration.class]:
  Bean instantiation via factory method failed; nested exception is
  org.springframework.beans.BeanInstantiationException: Failed to
  instantiate
  [org.springframework.data.relational.core.dialect.Dialect]: Factory
  method 'jdbcDialect' threw exception; nested exception is
  org.springframework.data.jdbc.repository.config.DialectResolver$NoDialectException:
  Cannot determine a dialect for
  org.springframework.jdbc.core.JdbcTemplate@7fe083b1. Please provide a
  Dialect. 2020-05-25 15:07:16.769  INFO 11840 --- [           main]
  com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown
  initiated... 2020-05-25 15:07:17.023  INFO 11840 --- [           main]
  com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown
  completed. 2020-05-25 15:07:17.028  INFO 11840 --- [           main]
  ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report
  re-run your application with 'debug' enabled. 2020-05-25 15:07:17.035
  ERROR 11840 --- [           main] o.s.boot.SpringApplication

  : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException:
  Error creating bean with name 'jdbcConverter' defined in class path
  resource
  [org/springframework/boot/autoconfigure/data/jdbc/JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration.class]:
  Unsatisfied dependency expressed through method 'jdbcConverter'
  parameter 4; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'jdbcDialect' defined in class path resource
  [org/springframework/boot/autoconfigure/data/jdbc/JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration.class]:
  Bean instantiation via factory method failed; nested exception is
  org.springframework.beans.BeanInstantiationException: Failed to
  instantiate
  [org.springframework.data.relational.core.dialect.Dialect]: Factory
  method 'jdbcDialect' threw exception; nested exception is
  org.springframework.data.jdbc.repository.config.DialectResolver$NoDialectException:
  Cannot determine a dialect for
  org.springframework.jdbc.core.JdbcTemplate@7fe083b1. Please provide a
  Dialect.  at
  org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:539)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:895)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
  ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]     at
  org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
  ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]     at
  org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
  [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]     at
  org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
  [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]     at
  org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
  [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]     at
  org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
  [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]     at
  org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
  [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]     at
  org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
  [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]     at
  net.sincera.dbmigration.liquibasedemo.LiquibasedemoApplication.main(LiquibasedemoApplication.java:21)
  [classes/:na] Caused by:
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'jdbcDialect' defined in class path resource
  [org/springframework/boot/autoconfigure/data/jdbc/JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration.class]:
  Bean instantiation via factory method failed; nested exception is
  org.springframework.beans.BeanInstantiationException: Failed to
  instantiate
  [org.springframework.data.relational.core.dialect.Dialect]: Factory
  method 'jdbcDialect' threw exception; nested exception is
  org.springframework.data.jdbc.repository.config.DialectResolver$NoDialectException:
  Cannot determine a dialect for
  org.springframework.jdbc.core.JdbcTemplate@7fe083b1. Please provide a
  Dialect.  at
  org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1306)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1226)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   ... 19 common frames
  omitted Caused by:
  org.springframework.beans.BeanInstantiationException: Failed to
  instantiate
  [org.springframework.data.relational.core.dialect.Dialect]: Factory
  method 'jdbcDialect' threw exception; nested exception is
  org.springframework.data.jdbc.repository.config.DialectResolver$NoDialectException:
  Cannot determine a dialect for
  org.springframework.jdbc.core.JdbcTemplate@7fe083b1. Please provide a
  Dialect.  at
  org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   at
  org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   ... 33 common frames
  omitted Caused by:
  org.springframework.data.jdbc.repository.config.DialectResolver$NoDialectException:
  Cannot determine a dialect for
  org.springframework.jdbc.core.JdbcTemplate@7fe083b1. Please provide a
  Dialect.  at
  org.springframework.data.jdbc.repository.config.DialectResolver.lambda$getDialect$2(DialectResolver.java:76)
  ~[spring-data-jdbc-2.0.0.RELEASE.jar:2.0.0.RELEASE]   at
  java.util.Optional.orElseThrow(Optional.java:290) ~[na:1.8.0_241]     at
  org.springframework.data.jdbc.repository.config.DialectResolver.getDialect(DialectResolver.java:75)
  ~[spring-data-jdbc-2.0.0.RELEASE.jar:2.0.0.RELEASE]   at
  org.springframework.data.jdbc.repository.config.AbstractJdbcConfiguration.jdbcDialect(AbstractJdbcConfiguration.java:144)
  ~[spring-data-jdbc-2.0.0.RELEASE.jar:2.0.0.RELEASE]   at
  org.springframework.boot.autoconfigure.data.jdbc.JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration$$EnhancerBySpringCGLIB$$5730cfab.CGLIB$jdbcDialect$1()
  ~[spring-boot-autoconfigure-2.3.0.RELEASE.jar:2.3.0.RELEASE]  at
  org.springframework.boot.autoconfigure.data.jdbc.JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration$$EnhancerBySpringCGLIB$$5730cfab$$FastClassBySpringCGLIB$$5eb1865b.invoke()
  ~[spring-boot-autoconfigure-2.3.0.RELEASE.jar:2.3.0.RELEASE]  at
  org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
  ~[spring-core-5.2.6.RELEASE.jar:5.2.6.RELEASE]    at
  org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
  ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]     at
  org.springframework.boot.autoconfigure.data.jdbc.JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration$$EnhancerBySpringCGLIB$$5730cfab.jdbcDialect()
  ~[spring-boot-autoconfigure-2.3.0.RELEASE.jar:2.3.0.RELEASE]  at
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  ~[na:1.8.0_241]   at
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  ~[na:1.8.0_241]   at
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  ~[na:1.8.0_241]   at java.lang.reflect.Method.invoke(Method.java:498)
  ~[na:1.8.0_241]   at
  org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
  ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]   ... 34 common frames
  omitted

If I run the above code using spring boot 2.2.7.RELEASE, it works just fine -- No exceptions!!

After 2 days, I thought of configuring a mysql datasource on localhost. The same program runs just fine (with spring boot 2.3.0.RELEASE) but this time it used the mysql datasource.

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>

What is happening with the oracle jdbc driver in spring boot 2.3.0.RELEASE ?

What is mysql jdbc driver doing correctly in spring boot 2.3.0.RELEASE ?

Thank you.

Body:
These dependencies worked for me.

<parent>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-parent</artifactId>
  <version>2.2.6.RELEASE</version>
</parent>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter</artifactId>
</dependency>

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-jdbc</artifactId>
  </dependency>

<dependency>
  <groupId>com.oracle.database.jdbc</groupId>
  <artifactId>ojdbc8</artifactId>
  <version>19.6.0.0</version>
</dependency>


来源: stackexchange

问:
The mysqli_connect not working
I installed apache, php and mysql. Now when I execute the php code, the mysqli_connect() is not working, neither it's showing the message in die.

```<code>$dbc=mysqli_connect(' ', ' ', ' ', ' ') or die('not connecting');
</code>```

Now someone tell me what database username shall I pass to mysqli_connect and what password. I don't remember I was asked for any username or password
and why isn't the message in die() showing up?

My var_dump(function_exists('mysqli_connect')); outputs bool(false).. if it has anything to do with it, how do I correct it.?

答:
If you just installed mysql, then there exists only the root user, without a password (or blank one if you prefer). You are strongly encouraged to change that password AND create a new user and password for your application, who has only access to just one database, the one your application uses.

To change the root password, you may do this:

```<code>$ mysql -u root -p
Enter password: [press enter]
mysql> use mysql;
mysql> UPDATE user SET `password`=PASSWORD('your_desired_password') WHERE username='root';

# this next bit is to create a database and a username for your web application
mysql> CREATE DATABASE your_application_name;
mysql> GRANT ALL ON your_application_name.* TO 'your_username'@'localhost' IDENTIFIED BY 'yourpassword';
</code>```

Obviously change all your_* values with correct ones.

For the reason why the die() gets not executed, do what @yes123 and @binaryLV had said (I think both are right, the mysqli is not installed, so it throws a E_FATAL_ERROR upon calling mysqli_connect(...) and as error_reporting is disabled (or maybe display_errors, or maybe both), you don't see that error.

ContentLicense: CC BY-SA 3.0

Title: The mysqli_connect not working

Body:
I installed apache, php and mysql. Now when I execute the php code, the mysqli_connect() is not working, neither it's showing the message in die.

$dbc=mysqli_connect(' ', ' ', ' ', ' ') or die('not connecting');

Now someone tell me what database username shall I pass to mysqli_connect and what password. I don't remember I was asked for any username or password
and why isn't the message in die() showing up?

My var_dump(function_exists('mysqli_connect')); outputs bool(false).. if it has anything to do with it, how do I correct it.?

Body:
If you just installed mysql, then there exists only the root user, without a password (or blank one if you prefer). You are strongly encouraged to change that password AND create a new user and password for your application, who has only access to just one database, the one your application uses.

To change the root password, you may do this:

$ mysql -u root -p
Enter password: [press enter]
mysql> use mysql;
mysql> UPDATE user SET `password`=PASSWORD('your_desired_password') WHERE username='root';

# this next bit is to create a database and a username for your web application
mysql> CREATE DATABASE your_application_name;
mysql> GRANT ALL ON your_application_name.* TO 'your_username'@'localhost' IDENTIFIED BY 'yourpassword';

Obviously change all your_* values with correct ones.

For the reason why the die() gets not executed, do what @yes123 and @binaryLV had said (I think both are right, the mysqli is not installed, so it throws a E_FATAL_ERROR upon calling mysqli_connect(...) and as error_reporting is disabled (or maybe display_errors, or maybe both), you don't see that error.


问:
Unity C#: How to send messages from one application to another on different IP?
I need a simple code which would demonstrate sending a message, say "HI" to another unity exe build.

something of this sort:

---Application 1 at IP address 192.168.0.10:

```<code>    void sendMessage(string ClientIP)
 {
       string Message = "Hi";
       //code to send message to 192.168.0.11 (ClientIP)

 }
</code>```

---Application 2 at IP address 192.168.0.11:

```<code>    void Update()
 {
       //Check for messages
       if (received)
       {
             OnReceiveMessage(message);
       }

 }
 void OnReceiveMessage(string message)
 {
       string MessageReceived = message;
       Debug.Log(message);

 }
</code>```

答:
The unity documentation on networking can be found enter link description here

The following three functions, sum it up:

```<code>    // Create a server and listen on a port
    public void SetupServer()
    {
        NetworkServer.Listen(4444);
        isAtStartup = false;
    }

    // Create a client and connect to the server port
    public void SetupClient()
    {
        myClient = new NetworkClient();
        myClient.RegisterHandler(MsgType.Connect, OnConnected);
        myClient.Connect("127.0.0.1", 4444);
        isAtStartup = false;
    }

    // Create a local client and connect to the local server
    public void SetupLocalClient()
    {
        myClient = ClientScene.ConnectLocalServer();
        myClient.RegisterHandler(MsgType.Connect, OnConnected);
        isAtStartup = false;
    }
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I need a simple code which would demonstrate sending a message, say "HI" to another unity exe build.

something of this sort:

---Application 1 at IP address 192.168.0.10:

    void sendMessage(string ClientIP)
 {
       string Message = "Hi";
       //code to send message to 192.168.0.11 (ClientIP)

 }

---Application 2 at IP address 192.168.0.11:

    void Update()
 {
       //Check for messages
       if (received)
       {
             OnReceiveMessage(message);
       }

 }
 void OnReceiveMessage(string message)
 {
       string MessageReceived = message;
       Debug.Log(message);

 }

Body:
The unity documentation on networking can be found enter link description here

The following three functions, sum it up:

    // Create a server and listen on a port
    public void SetupServer()
    {
        NetworkServer.Listen(4444);
        isAtStartup = false;
    }

    // Create a client and connect to the server port
    public void SetupClient()
    {
        myClient = new NetworkClient();
        myClient.RegisterHandler(MsgType.Connect, OnConnected);
        myClient.Connect("127.0.0.1", 4444);
        isAtStartup = false;
    }

    // Create a local client and connect to the local server
    public void SetupLocalClient()
    {
        myClient = ClientScene.ConnectLocalServer();
        myClient.RegisterHandler(MsgType.Connect, OnConnected);
        isAtStartup = false;
    }


问:
How to encode/decode all combinations of 2 integers in another one
i want to encode all possible directions of a square into an integer (except the 0,0).

i have two directions i, j each one could be {-1, 0, 1}

i need 2 functions with these signatures

```<code>int encodeToIndex(int i, int j) {
}
</code>```

and

```<code>int[] decodeFromIndex(int x) {
}
</code>```

We could use a Hashmap, but i need an optimized solution, we should be able to encode all the combinations (except the 0,0) in just 8 numbers from 0 to 7 (i need an index from 0 to 7).

I am working with JAVA, so a JAVA solution would be prefered (but it a mathematical problem).

folowing the @Andrea solution i choose this solution for the moment:

```<code>public static int encode(int i, int j) {
    int res = (i + 1) + (j + 1) * 3;
    return res>4?res-1:res;
}
public static int[] decode(int x) {
    if (x>3) x++;
    return new int[]{ x%3-1, x/3-1 };
}
</code>```

答:
You have 3 values for each, so one way to store that is to use 2 bits, e.g. use i + 1 (0-2) and j + 1 (0-2), then combined them using bit-manipulation:

(i + 1) | (j + 1) << 2
```

<p>A more condensed result can be done by multiply by 3 instead:</p>

<pre class="lang-java prettyprint-override"><code>(i + 1) + (j + 1) * 3
</code>```

For the various values of i and j that would produce:

   Bit-shift        Factor of 3
   i -1  0  1        i -1  0  1
 j ┌─────────      j ┌─────────
-1 │  0  1  2     -1 │  0  1  2
 0 │  4  5  6      0 │  3  4  5
 1 │  8  9 10      1 │  6  7  8
```

The reverse operation is simple enough too, using either bit-shift/-mask, or division/remainder.

Body:
i want to encode all possible directions of a square into an integer (except the 0,0).

i have two directions i, j each one could be {-1, 0, 1}

i need 2 functions with these signatures

int encodeToIndex(int i, int j) {
}

and

int[] decodeFromIndex(int x) {
}

We could use a Hashmap, but i need an optimized solution, we should be able to encode all the combinations (except the 0,0) in just 8 numbers from 0 to 7 (i need an index from 0 to 7).

I am working with JAVA, so a JAVA solution would be prefered (but it a mathematical problem).

folowing the @Andrea solution i choose this solution for the moment:

public static int encode(int i, int j) {
    int res = (i + 1) + (j + 1) * 3;
    return res>4?res-1:res;
}
public static int[] decode(int x) {
    if (x>3) x++;
    return new int[]{ x%3-1, x/3-1 };
}

Body:
You have 3 values for each, so one way to store that is to use 2 bits, e.g. use i + 1 (0-2) and j + 1 (0-2), then combined them using bit-manipulation:

(i + 1) | (j + 1) << 2

A more condensed result can be done by multiply by 3 instead:

(i + 1) + (j + 1) * 3

For the various values of i and j that would produce:

   Bit-shift        Factor of 3
   i -1  0  1        i -1  0  1
 j ┌─────────      j ┌─────────
-1 │  0  1  2     -1 │  0  1  2
 0 │  4  5  6      0 │  3  4  5
 1 │  8  9 10      1 │  6  7  8

The reverse operation is simple enough too, using either bit-shift/-mask, or division/remainder.


问:
Why can't I shoot with pygame?
I've been trying to make something cool with Python and Pygame for fun. I know a thing or two about Python in general but I'm quite a beginner with Pygame.
So the problem is: I have created a movable player and a moving enemy. I want to make the player shoot when I press the spacebar. I loaded a .png image, defined a function for shooting, and made so that the bullet keeps moving once shot. For some reason when I call the function, it just does nothing. It doesn't even give an error. I know I can shoot only one bullet with the current code and whatnot, but I would like to just get the current code working as a start.</p>

```<code>"""
player and enemy functions are defined above and work well, I didn't include
them in this post for the sake of saving everyone's time
"""

# bullet
bullet_pic = pygame.image.load("bullet.png")
bullet_pic_reverse = pygame.image.load("bullet reverse.png")
bullet_state = "nope"
def shoot(pic, x, y):
    global bullet_state
    bullet_state = "jes"
    screen.blit(pic, (x, y + 30))

player_dir = player_pic # direction of the player (left or right)
enemy_dir = enemy_pic # direction of the enemy
enemyX_change = 2.5
running = True
while running:
    screen.blit(back, (0, 0)) # background picture
    player(player_dir, playerX, playerY)
    enemy(enemy_dir, enemyX, enemyY)
    pygame.display.update()

    for event in pygame.event.get():
        if event.type == pygame.QUIT or event.type == pygame.KEYDOWN and event.key == K_ESCAPE:
            running = False
        elif event.type == pygame.KEYDOWN:
            # shooting
            if event.key == K_SPACE:
                if player_dir == player_pic:
                    bulletX = playerX + 100
                    bulletX_change = 20
                    bullet_dir = bullet_pic
                else:
                    bulletX = playerX
                    bulletX_change = -20
                    bullet_dir = bullet_pic_reverse
                shoot(bullet_dir, bulletX, playerY)

    # player movement
    hold = pygame.key.get_pressed()
    if hold[K_LEFT] and playerX > 0:
        playerX -= 7
        player_dir = player_pic_reverse
    if hold[K_RIGHT] and playerX < 1100:
        playerX += 7
        player_dir = player_pic

    # enemy movement
    enemyX += enemyX_change
    if enemyX >= 1125:
        enemyX_change = -2.5
        enemy_dir = enemy_pic_reverse
    elif enemyX <= 900:
        enemyX_change = 2.5
        enemy_dir = enemy_pic

    # bullet constant movement
    if bullet_state == "jes":
        shoot(bullet_dir, bulletX, playerY)
        bulletX += bulletX_change
</code>```

答:
I think the problem is with pygame.display.update(), you should put it always in the end of while running: loop. If you update display before calling shoot() background picture will be over bullet picture and you won't see it.

Another thing, you write K_ESCAPE instead of pygame.K_ESCAPE same with spacebar key. Does it work correctly for you? I didn't do anything with pygame for some time, maybe it's fine, but check it :)

Title: Why can't I shoot with pygame?

Body:
I've been trying to make something cool with Python and Pygame for fun. I know a thing or two about Python in general but I'm quite a beginner with Pygame.
So the problem is: I have created a movable player and a moving enemy. I want to make the player shoot when I press the spacebar. I loaded a .png image, defined a function for shooting, and made so that the bullet keeps moving once shot. For some reason when I call the function, it just does nothing. It doesn't even give an error. I know I can shoot only one bullet with the current code and whatnot, but I would like to just get the current code working as a start.

"""
player and enemy functions are defined above and work well, I didn't include
them in this post for the sake of saving everyone's time
"""

# bullet
bullet_pic = pygame.image.load("bullet.png")
bullet_pic_reverse = pygame.image.load("bullet reverse.png")
bullet_state = "nope"
def shoot(pic, x, y):
    global bullet_state
    bullet_state = "jes"
    screen.blit(pic, (x, y + 30))

player_dir = player_pic # direction of the player (left or right)
enemy_dir = enemy_pic # direction of the enemy
enemyX_change = 2.5
running = True
while running:
    screen.blit(back, (0, 0)) # background picture
    player(player_dir, playerX, playerY)
    enemy(enemy_dir, enemyX, enemyY)
    pygame.display.update()

    for event in pygame.event.get():
        if event.type == pygame.QUIT or event.type == pygame.KEYDOWN and event.key == K_ESCAPE:
            running = False
        elif event.type == pygame.KEYDOWN:
            # shooting
            if event.key == K_SPACE:
                if player_dir == player_pic:
                    bulletX = playerX + 100
                    bulletX_change = 20
                    bullet_dir = bullet_pic
                else:
                    bulletX = playerX
                    bulletX_change = -20
                    bullet_dir = bullet_pic_reverse
                shoot(bullet_dir, bulletX, playerY)

    # player movement
    hold = pygame.key.get_pressed()
    if hold[K_LEFT] and playerX > 0:
        playerX -= 7
        player_dir = player_pic_reverse
    if hold[K_RIGHT] and playerX < 1100:
        playerX += 7
        player_dir = player_pic

    # enemy movement
    enemyX += enemyX_change
    if enemyX >= 1125:
        enemyX_change = -2.5
        enemy_dir = enemy_pic_reverse
    elif enemyX <= 900:
        enemyX_change = 2.5
        enemy_dir = enemy_pic

    # bullet constant movement
    if bullet_state == "jes":
        shoot(bullet_dir, bulletX, playerY)
        bulletX += bulletX_change


问:
android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class
I was looking everywhere but I couldn't find any solution for this error.

I'm using ExoPlayer for live video streaming. And my app crashes every time when I run it. If you can help me I will be happy.

I guess it should be somewhere in the XML file but I can't understand what means all that error.
XML:

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

<com.devbrackets.android.exomedia.ui.widget.VideoView
    android:id="@+id/video_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:useDefaultControls="true"/>

</androidx.constraintlayout.widget.ConstraintLayout>
</code>```

MainActivity file:

```<code>@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final ProgressDialog progressDialog = new ProgressDialog(MainActivity.this);
    progressDialog.setMessage("Please Wait");
    progressDialog.setCancelable(false);
    progressDialog.show();

    MediaController mediaController = new MediaController(this);
    mediaController.setAnchorView(videoView);
    videoView.setMediaController(mediaController);

    videoView.setVideoURI(Uri.parse("Here's path"));
    videoView.start();

    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            progressDialog.dismiss();
        }
    });
  }
}
</code>```

Stacktrace:

```<code>Process: rusiptv.net, PID: 25782
java.lang.RuntimeException: Unable to start activity ComponentInfo{rusiptv.net/rusiptv.net.MainActivity}: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class com.devbrackets.android.exomedia.ui.widget.VideoView
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
 Caused by: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class com.devbrackets.android.exomedia.ui.widget.VideoView
 Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class com.devbrackets.android.exomedia.ui.widget.VideoView
 Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
    at android.view.LayoutInflater.createView(LayoutInflater.java:647)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
    at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
    at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
    at rusiptv.net.MainActivity.onCreate(MainActivity.java:42)
    at android.app.Activity.performCreate(Activity.java:7009)
    at android.app.Activity.performCreate(Activity.java:7000)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
</code>```

If you can please explain to me more detailed about this error because if I will face this problem again then I can fix it easily.

Edit:
Guys thank you, everyone! I fixed this problem.

Solutions:

VideoView videoView = findViewById(R.id.video_view);

And I changed path for VideoView according to my packageName.

答:
You Must override the constructor

```<code>public VideoPlayerView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
</code>```

This will solve your problem.

Body:
I was looking everywhere but I couldn't find any solution for this error.

I'm using ExoPlayer for live video streaming. And my app crashes every time when I run it. If you can help me I will be happy.

I guess it should be somewhere in the XML file but I can't understand what means all that error.
XML:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

<com.devbrackets.android.exomedia.ui.widget.VideoView
    android:id="@+id/video_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:useDefaultControls="true"/>

</androidx.constraintlayout.widget.ConstraintLayout>

MainActivity file:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final ProgressDialog progressDialog = new ProgressDialog(MainActivity.this);
    progressDialog.setMessage("Please Wait");
    progressDialog.setCancelable(false);
    progressDialog.show();

    MediaController mediaController = new MediaController(this);
    mediaController.setAnchorView(videoView);
    videoView.setMediaController(mediaController);

    videoView.setVideoURI(Uri.parse("Here's path"));
    videoView.start();

    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            progressDialog.dismiss();
        }
    });
  }
}

Stacktrace:

Process: rusiptv.net, PID: 25782
java.lang.RuntimeException: Unable to start activity ComponentInfo{rusiptv.net/rusiptv.net.MainActivity}: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class com.devbrackets.android.exomedia.ui.widget.VideoView
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
 Caused by: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class com.devbrackets.android.exomedia.ui.widget.VideoView
 Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class com.devbrackets.android.exomedia.ui.widget.VideoView
 Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
    at android.view.LayoutInflater.createView(LayoutInflater.java:647)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
    at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
    at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
    at rusiptv.net.MainActivity.onCreate(MainActivity.java:42)
    at android.app.Activity.performCreate(Activity.java:7009)
    at android.app.Activity.performCreate(Activity.java:7000)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

If you can please explain to me more detailed about this error because if I will face this problem again then I can fix it easily.

Edit:
Guys thank you, everyone! I fixed this problem.

Solutions:

VideoView videoView = findViewById(R.id.video_view);

And I changed path for VideoView according to my packageName.

Body:
You Must override the constructor

public VideoPlayerView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}

This will solve your problem.


问:
How to check the installed version of React-Native
I'm going to upgrade react-native but before I do, I need to know which version I'm upgrading from to see if there are any special notes about upgrading from my version.

How do I find the version of react-native I have installed on my Mac?

答:
You can run this command in Terminal:

react-native --version

This will give react-native CLI version

Or check in package.json under

```<code>"dependencies": {
    "react": "16.11.0",
    "react-native": "0.62.2",
}
</code>```

Body:
You can run this command in Terminal:

react-native --version

This will give react-native CLI version

Or check in package.json under

"dependencies": {
    "react": "16.11.0",
    "react-native": "0.62.2",
}


问:
Working on a Dynamic table to add and delete rows in Vuejs framework, Below is my table
```<code><div class="card-headerfrm" style="margin:0 0px 15px -20px; overflow: auto">
<form method="post" id="form2" class="form-horizontal" v-on:submit.prevent="submitForm">
<table class="table-hover tbl datatables" style="width:100%;">
  <head>
    <tr class="text-primary table-bordered">
    <td class="text-center tableheader"><b>Name</b></td>
    <td class="text-center tableheader"><b>Email</b></td>
    <td class="text-center tableheader"><b>Contact No</b></td>
    <td class="text-center tableheader"><b>Type</b></td>
    <td class="text-center tableheader"><b>Person Type</b></td>
    <td class="text-center tableheader"><b>Remove</b></td>
  </tr>
</thead>
<tbody v-for="(input,index) in inputs" :key="index">
  {{input}}
  <tr>
    <td>
      <b-form-fieldset>
        <b-input-group>
          <b-form-input
             type="text"
             placeholder="Enter Registered Name"
             v-model="input.name"
             :name="'name'+index"
             v-validate="{required:true, max: 30, regex: /^[a-z\d\-_\s]+$/i}"
             v-bind:class="{'form-control': true, 'error': errors.has('name'+index) }">
          </b-form-input>
        </b-input-group>
        <span v-show="errors.has('name'+index)" class="text-danger">{{ errors.first('name'+index) }}</span>
      </b-form-fieldset>
  </td>
    <td>
      <b-form-fieldset>
        <b-input-group>
          <b-form-input
             type="text"
             placeholder="Enter Email"
             v-model="input.email"
             :name="'email'+index"
           v-validate="{required:true, max: 30, regex: /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/}"
             v-bind:class="{'form-control': true, 'error': errors.has('email'+index) }">
            </b-form-input>
        </b-input-group>
        <span v-show="errors.has('email'+index)" class="text-danger">{{ errors.first('email'+index) }}</span>
      </b-form-fieldset>
  </td>
    <td>
      <b-form-fieldset>
        <b-input-group>
          <b-form-input
             type="text"
             placeholder="Enter Contact No"
             v-model="input.contactno"
             :name="'contactno'+index"
             v-validate="{required:true, regex: /^(0|[+91]{3})?[7-9][0-9]{9}$/}"
             v-bind:class="{'form-control': true, 'error': errors.has('contactno'+index) }">
           </b-form-input>
        </b-input-group>
        <span v-show="errors.has('contactno'+index)" class="text-danger">{{ errors.first('contactno'+index) }}</span>
      </b-form-fieldset>
  </td>
  <td>
    <b-form-fieldset>
      <b-input-group>
        <basic-select
             :options="typeOption"
             :selected-option="selectedType.objectArray[index]"
             v-model="input.type"
             :name="'type'+index"
             placeholder="Select Type"
             @select="typeFunc"
             v-validate="{required:true}"
             v-bind:class="{'form-control': true, 'error': errors.has('type'+index)}">
        </basic-select>
      </b-input-group>
    </b-form-fieldset>
  </td>
  <td>
    <b-form-fieldset>
      <b-input-group>
        <basic-select
             :options="personTypeOption"
             :selected-option="selectedPersonType.objectArray[index]"
             v-model="input.persontype"
             :name="'persontype'+index"
             placeholder="Person Type"
             @select="personTypeFunc"
             v-validate="{required: true}"
             v-bind:class="{'form-control': true, 'error': errors.has('persontype'+index)}">
         </basic-select>
      </b-input-group>
    </b-form-fieldset>
  </td>
  <td class="text-center"><h4><i class="fa fa-minus-circle" @click="removeRow(index)"></i></h4></td>
</tr>
</tbody>
</code>```

Submit

```<code>    export default {
    name:'',
    components:{VueElementLoading, BasicSelect},
    data(){
    return {
    selectedType:{ objectArray:[] },
    selectedPersonType:{ objectArray:[] },
    typeOption:[{
    value:1,
    text: "Operation"
    },
    {
    value:2,
    text: "Technology"
    },
    {
    value:3,
    text: "Finance And Legal"
    }],
    personTypeOption:[{
    value: 1,
    text: "Xpressbees"
    },
    {
    value: 2,
    text: "Client"
    }],
    inputs:[],
    }
    },
    created: function(){

    },
   mounted(){

   },
   methods:{
     typeFunc(cls){
       this.selectedType.objectArray.push(cls)
     },
     personTypeFunc(cls){
       this.selectedPersonType.object.push(cls)
     },
     openList(){
       if(this.inputs.length === 0){
         this.showList = true
         this.inputs.push({
           name:'',
           email:'',
           contactno:'',
           type:'',
           persontype:''
         });
       }else {
           this.addInput()
       }
     },
     addInput() {
       this.inputs.push({
         name:'',
         email:'',
         contactno:'',
         type:'',
         persontype:''
       });
       },
     AddNewFunction() {
       this.showList = true
       this.inputs = [];
       if (this.inputs.length == 0) {
         this.addInput();
       }
     },
     onSubmit: function(event){
       this.$validator.validateAll()
       .then(res =>{
         if (res) {
         this.showList = true
         this.getAllClientsDetails()
       }else {
         return false
       }
       }).catch(err =>{
         console.log("Error Details", err);
       })
     },
     submitForm: function(event){
       this.$validator.validateAll()
       .then(res =>{

         if (res) {
           this.SaveSpockDetails()
         }else {
           return false
         }
       }).catch(err =>{
         console.log("Error Details", err);
       })
     }
        }
      }
</code>```

So I am writing a code in javascript framework (Vuejs) for dynamically add and delete rows from a table. And I want the user to first fill the first opened row(line) and then click on the Add button, then that row goes for a validation check. And if the validation results are true then open second-row otherwise show an error. And to validate field I am using this.$validator.validateAll() function which validates all fields on the submit button.
I have 3 text fields and 2 select fields in the table,
1) Name
2) Email
3) Contact Number
4) Type (select)
5) Person Type (select)

in which 3 input-text fields are working fine but in the select field I am getting a validation error
It shows validation error, even after selected any of the values from the dropdown box.

答:
Please have a look at this code it might help  </p>

```<code><?php

if(isset($_POST['submit'])){
    $field_Values_array = $_POST['field_name'];
    $pass_array = $_POST['class'];

    $sg = "";

    $len1 = count($field_Values_array);

    $x=0;
    while($x<$len1){
        $sg = $sg."Book - ".$field_Values_array[$x]." Set - ".implode(", ",$pass_array[$x])."<br>";
        $x++;
    }

    echo $sg;

    print '```' ; print_r($field_Values_array); print '```';
    print '```' ; print_r($pass_array); print '```';
}

?>

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<?php
$index = 0;
?>

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js" integrity="sha384-6khuMg9gaYr5AxOqhkVIODVIvm9ynTT5J4V1cfthmT+emCG6yVmEZsRHdxlotUnm" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
var index = parseInt('<?php echo $index; ?>');
$(document).ready(function(){
    var maxField = 10; //Input fields increment limitation
    var addButton = $('.add_button'); //Add button selector
    var wrapper = $('.field_wrapper'); //Input field wrapper
    var fieldHTML = '<div><select id="a1" name="field_name[indexed]"><option selected disabled>     </option><option>महात्मा गांधी</option><option>बिल्ली</option><option>घोड़ा</option><option>नारियल</option><option>केरल</option><option>चावल</option><option>महाराष्ट्र</option><option>महाबली</option><option>रमेश</option><option>दिल्ली</option><option>किताब </option><option>कछुआ</option></select> <input type="checkbox" name="class[indexed][]" value="A" />A <input type="checkbox" name="class[indexed][]" value="B" />B <input type="checkbox" name="class[indexed][]" value="C" />C <input type="checkbox" name="class[indexed][]" value="1" />1 <input type="checkbox" name="class[indexed][]" value="2" />2 <input type="checkbox" name="class[indexed][]" value="3" />3 <input type="checkbox" name="class[indexed][]" value="4" />4 <input type="checkbox" name="class[indexed][]" value="5" />5 <input type="checkbox" name="class[indexed][]" value="6" />6 <input type="checkbox" name="class[indexed][]" value="7" />7 <input type="checkbox" name="class[indexed][]" value="8" />8 <img src="remove.png"/></div>'; //New input field html
    var x = 1; //Initial field counter is 1

    //Once add button is clicked
    $(addButton).click(function(){
        //Check maximum number of input fields
        index++;

        newHTML = fieldHTML.replace(/indexed/g, index);

        if(x < maxField){
            x++; //Increment field counter
            $(wrapper).append(newHTML); //Add field html
        }
    });

    //Once remove button is clicked
    $(wrapper).on('click', '.remove_button', function(e){
        e.preventDefault();
        $(this).parent('div').remove(); //Remove field html
        x--; //Decrement field counter
    });
});

window.onload = function(e){
   $('#a1').append("<option selected disabled></option><option>महात्मा गांधी</option><option>बिल्ली</option><option>घोड़ा</option><option>नारियल</option><option>केरल</option><option>चावल</option><option>महाराष्ट्र</option><option>महाबली</option><option>रमेश</option><option>दिल्ली</option><option>किताब </option><option>कछुआ</option>");
}
</script>
</head>
<body>
<div class="container">
    <form action="index.php" method="post">
        <div class="field_wrapper">
            <div>
                <input type="text" readonly value="Book Name"/>
                <input type="text" readonly value="Book Set"/>
            </div>
            <div>
                <select id="a1" name="field_name[<?php echo $index; ?>]"></select>
                <!--<input type="text" name="field_name[<?php echo $index; ?>]" value=""/>-->
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="A" />A
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="B" />B
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="C" />C
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="1" />1
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="2" />2
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="3" />3
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="4" />4
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="5" />5
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="6" />6
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="7" />7
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="8" />8
                <img src="add.png"/>
            </div>
        </div><br><input type="submit" name="submit" value="Submit">
    </form>
</div>
</body>
</html>
</code>```

Body:
<form method="post" id="form2" class="form-horizontal" v-on:submit.prevent="submitForm">

    Name
    Email
    Contact No
    Type
    Person Type
    Remove

  {{input}}

        {{ errors.first('name'+index) }}

        {{ errors.first('email'+index) }}

        {{ errors.first('contactno'+index) }}

        <basic-select
             :options="typeOption"
             :selected-option="selectedType.objectArray[index]"
             v-model="input.type"
             :name="'type'+index"
             placeholder="Select Type"
             @select="typeFunc"
             v-validate="{required:true}"
             v-bind:class="{'form-control': true, 'error': errors.has('type'+index)}">
        </basic-select>

        <basic-select
             :options="personTypeOption"
             :selected-option="selectedPersonType.objectArray[index]"
             v-model="input.persontype"
             :name="'persontype'+index"
             placeholder="Person Type"
             @select="personTypeFunc"
             v-validate="{required: true}"
             v-bind:class="{'form-control': true, 'error': errors.has('persontype'+index)}">
         </basic-select>

Submit

    export default {
    name:'',
    components:{VueElementLoading, BasicSelect},
    data(){
    return {
    selectedType:{ objectArray:[] },
    selectedPersonType:{ objectArray:[] },
    typeOption:[{
    value:1,
    text: "Operation"
    },
    {
    value:2,
    text: "Technology"
    },
    {
    value:3,
    text: "Finance And Legal"
    }],
    personTypeOption:[{
    value: 1,
    text: "Xpressbees"
    },
    {
    value: 2,
    text: "Client"
    }],
    inputs:[],
    }
    },
    created: function(){

    },
   mounted(){

   },
   methods:{
     typeFunc(cls){
       this.selectedType.objectArray.push(cls)
     },
     personTypeFunc(cls){
       this.selectedPersonType.object.push(cls)
     },
     openList(){
       if(this.inputs.length === 0){
         this.showList = true
         this.inputs.push({
           name:'',
           email:'',
           contactno:'',
           type:'',
           persontype:''
         });
       }else {
           this.addInput()
       }
     },
     addInput() {
       this.inputs.push({
         name:'',
         email:'',
         contactno:'',
         type:'',
         persontype:''
       });
       },
     AddNewFunction() {
       this.showList = true
       this.inputs = [];
       if (this.inputs.length == 0) {
         this.addInput();
       }
     },
     onSubmit: function(event){
       this.$validator.validateAll()
       .then(res =>{
         if (res) {
         this.showList = true
         this.getAllClientsDetails()
       }else {
         return false
       }
       }).catch(err =>{
         console.log("Error Details", err);
       })
     },
     submitForm: function(event){
       this.$validator.validateAll()
       .then(res =>{

         if (res) {
           this.SaveSpockDetails()
         }else {
           return false
         }
       }).catch(err =>{
         console.log("Error Details", err);
       })
     }
        }
      }

So I am writing a code in javascript framework (Vuejs) for dynamically add and delete rows from a table. And I want the user to first fill the first opened row(line) and then click on the Add button, then that row goes for a validation check. And if the validation results are true then open second-row otherwise show an error. And to validate field I am using this.$validator.validateAll() function which validates all fields on the submit button.
I have 3 text fields and 2 select fields in the table,
1) Name
2) Email
3) Contact Number
4) Type (select)
5) Person Type (select)

in which 3 input-text fields are working fine but in the select field I am getting a validation error
It shows validation error, even after selected any of the values from the dropdown box.

Body:
Please have a look at this code it might help

<?php

if(isset($_POST['submit'])){
    $field_Values_array = $_POST['field_name'];
    $pass_array = $_POST['class'];

    $sg = "";

    $len1 = count($field_Values_array);

    $x=0;
    while($x<$len1){
        $sg = $sg."Book - ".$field_Values_array[$x]." Set - ".implode(", ",$pass_array[$x])."<br>";
        $x++;
    }

    echo $sg;

    print '<pre>' ; print_r($field_Values_array); print '</pre>';
    print '<pre>' ; print_r($pass_array); print '</pre>';
}

?>

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<?php
$index = 0;
?>

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js" integrity="sha384-6khuMg9gaYr5AxOqhkVIODVIvm9ynTT5J4V1cfthmT+emCG6yVmEZsRHdxlotUnm" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
var index = parseInt('<?php echo $index; ?>');
$(document).ready(function(){
    var maxField = 10; //Input fields increment limitation
    var addButton = $('.add_button'); //Add button selector
    var wrapper = $('.field_wrapper'); //Input field wrapper
    var fieldHTML = '<div><select id="a1" name="field_name[indexed]"><option selected disabled>     </option><option>महात्मा गांधी</option><option>बिल्ली</option><option>घोड़ा</option><option>नारियल</option><option>केरल</option><option>चावल</option><option>महाराष्ट्र</option><option>महाबली</option><option>रमेश</option><option>दिल्ली</option><option>किताब </option><option>कछुआ</option></select> <input type="checkbox" name="class[indexed][]" value="A" />A <input type="checkbox" name="class[indexed][]" value="B" />B <input type="checkbox" name="class[indexed][]" value="C" />C <input type="checkbox" name="class[indexed][]" value="1" />1 <input type="checkbox" name="class[indexed][]" value="2" />2 <input type="checkbox" name="class[indexed][]" value="3" />3 <input type="checkbox" name="class[indexed][]" value="4" />4 <input type="checkbox" name="class[indexed][]" value="5" />5 <input type="checkbox" name="class[indexed][]" value="6" />6 <input type="checkbox" name="class[indexed][]" value="7" />7 <input type="checkbox" name="class[indexed][]" value="8" />8 <a href="javascript:void(0);" class="remove_button"><img src="remove.png"/></a></div>'; //New input field html
    var x = 1; //Initial field counter is 1

    //Once add button is clicked
    $(addButton).click(function(){
        //Check maximum number of input fields
        index++;

        newHTML = fieldHTML.replace(/indexed/g, index);

        if(x < maxField){
            x++; //Increment field counter
            $(wrapper).append(newHTML); //Add field html
        }
    });

    //Once remove button is clicked
    $(wrapper).on('click', '.remove_button', function(e){
        e.preventDefault();
        $(this).parent('div').remove(); //Remove field html
        x--; //Decrement field counter
    });
});

window.onload = function(e){
   $('#a1').append("<option selected disabled></option><option>महात्मा गांधी</option><option>बिल्ली</option><option>घोड़ा</option><option>नारियल</option><option>केरल</option><option>चावल</option><option>महाराष्ट्र</option><option>महाबली</option><option>रमेश</option><option>दिल्ली</option><option>किताब </option><option>कछुआ</option>");
}
</script>
</head>
<body>
<div class="container">
    <form action="index.php" method="post">
        <div class="field_wrapper">
            <div>
                <input type="text" readonly value="Book Name"/>
                <input type="text" readonly value="Book Set"/>
            </div>
            <div>
                <select id="a1" name="field_name[<?php echo $index; ?>]"></select>
                <!--<input type="text" name="field_name[<?php echo $index; ?>]" value=""/>-->
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="A" />A
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="B" />B
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="C" />C
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="1" />1
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="2" />2
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="3" />3
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="4" />4
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="5" />5
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="6" />6
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="7" />7
                <input type="checkbox" name="class[<?php echo $index; ?>][]" value="8" />8
                <a href="javascript:void(0);" class="add_button" title="Add field"><img src="add.png"/></a>
            </div>
        </div><br><input type="submit" name="submit" value="Submit">
    </form>
</div>
</body>
</html>


问:
Count the number of vowels and print them in a manner that string having more vowels come first
In,This code I've to "n" string. Then count the number of vowels in a string and print "n" number of string in a manner that a string having more vowels print first.

```<code>Sample Input:

3
My name
is
Paul Jonas

Sample Output:

Paul Jonas 4
My name 2
is 1
</code>```

This is my attempt but I'cant process the output that a string having more vowel comes first

```<code>import java.util.*;
public class CountVowel {
    public static void  main(String[] args){
        Scanner sc = new Scanner(System.in);
        ArrayList<String> word = new ArrayList<String>();

        int n;
        n = sc.nextInt();

        String str;

        sc.nextLine();
        for(int i=0;i<n;i++){
            str = sc.nextLine();
            word.add(str);
        }

        int arr[] = new int[3];
        int j = 0;
        for(String s:word){
            int count = 0;
            for(int i=0;i<s.length();i++){
                if(s.charAt(i)=='A' || s.charAt(i)=='E' || s.charAt(i)=='I' || s.charAt(i)=='O'||s.charAt(i)=='U'
                || s.charAt(i)=='a' || s.charAt(i)=='e' || s.charAt(i)=='i' || s.charAt(i)=='o' || s.charAt(i)=='u'){

                    count++;

                }
            }
            arr[j] = count;
            j++;

        }

        int i = 0;
        for(String s: word){

            System.out.println(s+" "+arr[i]);
            i++;
        }

    }
}
</code>```

So, I'm not getting my desired Output.

```<code>Input:

3
My name
is
Paul Jonas

Output I'm getting:

My name 2
is 1
Paul Jonas 4
</code>```

答:
You cannot solve your task without using the class Collections, starting from defining a method counting the vowels in a word like below:

```<code>private static final String VOWELS = "aeiou";

public static int getCountVowels(String word) {
    int count = 0;
    char[] arr = word.toLowerCase().toCharArray();

    for (char ch: arr) {
        if (VOWELS.indexOf(ch) != -1) { ++count; }
    }

    return count;
}
</code>```

After you can create a Map of words and count of vowels like below:

```<code>String[] words = {"My name", "is", "Paul Jonas"};
Map<String, Integer> map = new HashMap<>();
for (String word : words) { map.put(word, getCountVowels(word)); }
</code>```

Then you have to order the map entries key,value  by value in reverse order of value and print them using Collections:

```<code>map.entrySet().stream()
    .sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
    .forEach(entry -> System.out.println(entry.getKey() + " " + entry.getValue()));
</code>```

Below the total code printing the expected result:

```<code>public class CountVowels {
    private static final String VOWELS = "aeiou";

    public static int getCountVowels(String word) {
        int count = 0;
        char[] arr = word.toLowerCase().toCharArray();
        for (char ch: arr) {
            if (VOWELS.indexOf(ch) != -1) { ++count; }
        }
        return count;
    }

    public static void main(String[] args) {
        String[] words = {"My name", "is", "Paul Jonas"};
        Map<String, Integer> map = new HashMap<>();

        for (String word : words) { map.put(word, getCountVowels(word)); }

        map.entrySet().stream()
           .sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
           .forEach(entry -> System.out.println(entry.getKey() + " " + entry.getValue()));
    }

}
</code>```

Body:
In,This code I've to "n" string. Then count the number of vowels in a string and print "n" number of string in a manner that a string having more vowels print first.

Sample Input:

3
My name
is
Paul Jonas

Sample Output:

Paul Jonas 4
My name 2
is 1

This is my attempt but I'cant process the output that a string having more vowel comes first

import java.util.*;
public class CountVowel {
    public static void  main(String[] args){
        Scanner sc = new Scanner(System.in);
        ArrayList<String> word = new ArrayList<String>();

        int n;
        n = sc.nextInt();

        String str;

        sc.nextLine();
        for(int i=0;i<n;i++){
            str = sc.nextLine();
            word.add(str);
        }

        int arr[] = new int[3];
        int j = 0;
        for(String s:word){
            int count = 0;
            for(int i=0;i<s.length();i++){
                if(s.charAt(i)=='A' || s.charAt(i)=='E' || s.charAt(i)=='I' || s.charAt(i)=='O'||s.charAt(i)=='U'
                || s.charAt(i)=='a' || s.charAt(i)=='e' || s.charAt(i)=='i' || s.charAt(i)=='o' || s.charAt(i)=='u'){

                    count++;

                }
            }
            arr[j] = count;
            j++;

        }

        int i = 0;
        for(String s: word){

            System.out.println(s+" "+arr[i]);
            i++;
        }

    }
}

So, I'm not getting my desired Output.

Input:

3
My name
is
Paul Jonas

Output I'm getting:

My name 2
is 1
Paul Jonas 4

Body:
You cannot solve your task without using the class Collections, starting from defining a method counting the vowels in a word like below:

private static final String VOWELS = "aeiou";

public static int getCountVowels(String word) {
    int count = 0;
    char[] arr = word.toLowerCase().toCharArray();

    for (char ch: arr) {
        if (VOWELS.indexOf(ch) != -1) { ++count; }
    }

    return count;
}

After you can create a Map of words and count of vowels like below:

String[] words = {"My name", "is", "Paul Jonas"};
Map<String, Integer> map = new HashMap<>();
for (String word : words) { map.put(word, getCountVowels(word)); }

Then you have to order the map entries key,value  by value in reverse order of value and print them using Collections:

map.entrySet().stream()
    .sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
    .forEach(entry -> System.out.println(entry.getKey() + " " + entry.getValue()));

Below the total code printing the expected result:

public class CountVowels {
    private static final String VOWELS = "aeiou";

    public static int getCountVowels(String word) {
        int count = 0;
        char[] arr = word.toLowerCase().toCharArray();
        for (char ch: arr) {
            if (VOWELS.indexOf(ch) != -1) { ++count; }
        }
        return count;
    }

    public static void main(String[] args) {
        String[] words = {"My name", "is", "Paul Jonas"};
        Map<String, Integer> map = new HashMap<>();

        for (String word : words) { map.put(word, getCountVowels(word)); }

        map.entrySet().stream()
           .sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
           .forEach(entry -> System.out.println(entry.getKey() + " " + entry.getValue()));
    }

}


问:
Unable to use pickAFile in TigerJython
In JES, I am able to use:

```<code>file=pickAFile()
</code>```

In TigerJython, however, I get the following error

```<code>NameError: name 'pickAFile' is not defined
</code>```

What am I doing wrong here?

答:
You are not doing anything wrong at all.  The thing is that pickAFile() is not a standard function in Python.  It is actually rather a function that JES has added for convenience, but which you probably will not find it in any other environment.

Since TigerJython and JES are both based on Jython, you can easily write a pickAFile() function on your own that uses Java's Swing.  Here is a possible simple implementation (the pickAFile() found in JES might be a bit more complex, but this should get you started):

def pickAFile():
    from javax.swing import JFileChooser
    fc = JFileChooser()
    retVal = fc.showOpenDialog(None)
    if retVal == JFileChooser.APPROVE_OPTION:
        return fc.getSelectedFile()
    else:
        return None
```

Given that it is certainly a useful function, we might have to consider including it into our next update of TigerJython.

P.S. I would like to apologise for answering so late, I have just joined SO recently and was not aware of your question (I am one of the original authors of TigerJython).

Title: Unable to use pickAFile in TigerJython

Body:
In JES, I am able to use:

file=pickAFile()

In TigerJython, however, I get the following error

NameError: name 'pickAFile' is not defined

What am I doing wrong here?

Body:
You are not doing anything wrong at all.  The thing is that pickAFile() is not a standard function in Python.  It is actually rather a function that JES has added for convenience, but which you probably will not find it in any other environment.

Since TigerJython and JES are both based on Jython, you can easily write a pickAFile() function on your own that uses Java's Swing.  Here is a possible simple implementation (the pickAFile() found in JES might be a bit more complex, but this should get you started):

def pickAFile():
    from javax.swing import JFileChooser
    fc = JFileChooser()
    retVal = fc.showOpenDialog(None)
    if retVal == JFileChooser.APPROVE_OPTION:
        return fc.getSelectedFile()
    else:
        return None

Given that it is certainly a useful function, we might have to consider including it into our next update of TigerJython.

P.S. I would like to apologise for answering so late, I have just joined SO recently and was not aware of your question (I am one of the original authors of TigerJython).


问:
dynamic extra fields in django inlineformset
i'm working on a projects for a mobile store which working with IMEI of mobiles each single mobile has its own imei , and the owner of the store selling phone depend on its IMEI's , now when the admin add new mobile in MobileStorage for example quantity= 20 mobile iphone11X have 20 different IMEI's , i want to allow the admin whenever he add new mobile and then select the quantities (20) then extra fields will be 20 , if he filled 10 in quantity field extra fields for IMEI will be 10

```<code>class MobileStorage(models.Model):
    admin = models.ForeignKey(User,on_delete=models.CASCADE)
    mobile = models.ForeignKey(Mobile,on_delete=models.CASCADE)
    quantity = models.PositiveIntegerField()

class Imei(models.Model):
    imei = models.CharField(max_length=50,verbose_name='IMEI',unique=True)
    mobile = models.ForeignKey(MobileStorage,on_delete=models.CASCADE)
class Mobile(models.Model):
    mobile = models.CharField(max_length=50,unique=True)
</code>```

my forms.py

```<code>class MobileStorageForm(forms.ModelForm):
    mobile = forms.ModelChoiceField(queryset=Mobile.objects.all(),empty_label='')
    class Meta:
       model = MobileStorage
       fields = [
        'mobile','quantity'
       ]

class ImeiForm(forms.ModelForm):
    class Meta:
       model = Imei
       fields = ['imei']
</code>```

i want to control extra fields depend on the quantity in MobileStorage model , and the create for example 20 instance in Imei model

```<code>MobileStorageFormInlineSet = inlineformset_factory(
    MobileStorage,Imei,form=ImeiForm,fields=('imei'),extra=2,can_delete=False
)
</code>```

i have done the front end , but it just save the last 2 fields bcs extra fields are 2

anyone have an idea i appreciate it

答: Hey U can also use Jquery To add Field by click add or remove button in a front-end pages django</p>

Body:
i'm working on a projects for a mobile store which working with IMEI of mobiles each single mobile has its own imei , and the owner of the store selling phone depend on its IMEI's , now when the admin add new mobile in MobileStorage for example quantity= 20 mobile iphone11X have 20 different IMEI's , i want to allow the admin whenever he add new mobile and then select the quantities (20) then extra fields will be 20 , if he filled 10 in quantity field extra fields for IMEI will be 10

class MobileStorage(models.Model):
    admin = models.ForeignKey(User,on_delete=models.CASCADE)
    mobile = models.ForeignKey(Mobile,on_delete=models.CASCADE)
    quantity = models.PositiveIntegerField()

class Imei(models.Model):
    imei = models.CharField(max_length=50,verbose_name='IMEI',unique=True)
    mobile = models.ForeignKey(MobileStorage,on_delete=models.CASCADE)
class Mobile(models.Model):
    mobile = models.CharField(max_length=50,unique=True)

my forms.py

class MobileStorageForm(forms.ModelForm):
    mobile = forms.ModelChoiceField(queryset=Mobile.objects.all(),empty_label='')
    class Meta:
       model = MobileStorage
       fields = [
        'mobile','quantity'
       ]

class ImeiForm(forms.ModelForm):
    class Meta:
       model = Imei
       fields = ['imei']

i want to control extra fields depend on the quantity in MobileStorage model , and the create for example 20 instance in Imei model

MobileStorageFormInlineSet = inlineformset_factory(
    MobileStorage,Imei,form=ImeiForm,fields=('imei'),extra=2,can_delete=False
)

i have done the front end , but it just save the last 2 fields bcs extra fields are 2

anyone have an idea i appreciate it


问:
Way of skipping choice tags in xml validation
I have the following XSD:

```<code>  <xs:element name="Parameter" type="complex">
  </xs:element>
  <xs:complexType name="complex">
    <xs:choice>
      <xs:element name="MyData" type="myData"/>
      <xs:element name="String" type="xs:string"/>
    </xs:choice>
    <xs:attribute name="Name" use="required" type="xs:string"/>
  </xs:complexType>
  <xs:complexType name="myData">
     <xs:attribute name="X" use="required" type="xs:integer"/>
     <xs:attribute name="Y" use="required" type="xs:integer"/>
  </xs:complexType>
</code>```

when i validate this

```<code><Parameter Name="P"><MyData X="1" Y="2"></MyData></Parameter>
</code>```

everything is OK, but when i try to validate this:

```<code>        <Parameter Name="P">5r5r5r5r</Parameter>
</code>```

it says "The element 'Parameter' cannot contain text. List of possible elements expected: 'MyData, String'."  Is there a way to skip putting <Sring></String> around "5r5r5r5r"?

答:
What do you really want?
If you want to write inside a Parameter tag you should define it like that:</p>

```<code><xs:element name="Parameter" type="xs:string"></xs:element>
</code>```

Body:
I have the following XSD:

  <xs:element name="Parameter" type="complex">
  </xs:element>
  <xs:complexType name="complex">
    <xs:choice>
      <xs:element name="MyData" type="myData"/>
      <xs:element name="String" type="xs:string"/>
    </xs:choice>
    <xs:attribute name="Name" use="required" type="xs:string"/>
  </xs:complexType>
  <xs:complexType name="myData">
     <xs:attribute name="X" use="required" type="xs:integer"/>
     <xs:attribute name="Y" use="required" type="xs:integer"/>
  </xs:complexType>

when i validate this

<Parameter Name="P"><MyData X="1" Y="2"></MyData></Parameter>

everything is OK, but when i try to validate this:

        <Parameter Name="P">5r5r5r5r</Parameter>

it says "The element 'Parameter' cannot contain text. List of possible elements expected: 'MyData, String'."  Is there a way to skip putting <Sring></String> around "5r5r5r5r"?

Body:
What do you really want?
If you want to write inside a Parameter tag you should define it like that:

<xs:element name="Parameter" type="xs:string"></xs:element>


问:
Link Conda environment with Jupyter Notebook
I'm trying to set a good environnement for doing some scientific stuff with python. To do so, I installed Jupyter & miniconda.

Then I want to be able to have different environnement and use them with Jupyter notebooks. So I created two custom envs with conda : py27 and py35.

```<code>> conda env list
# conda environments:
#
py27                     /Users/***/miniconda3/envs/py27
py35                     /Users/***/miniconda3/envs/py35
root                  *  /Users/***/miniconda3
</code>```

Then on my notebook I have two kernels python 2 and python 3.
Inside a notebook, I get the following with the python3 kernel :

```<code>> import sys
> print(sys.executable)
/Users/***/miniconda3/envs/py35/bin/python
</code>```

And this with the python2 kernel :

```<code>> import sys
> print(sys.executable)
/usr/local/opt/python/bin/python2.7
</code>```

How can I set the sys.executable to miniconda env for python2 ?

How can I bind a conda env with a notebook kernel ?

Is doing source activate py35 has a link with jupyter notebook ?

I think I really missed something.

Thank you everyone.

--- edit

I have multiple jupyter bin :

```<code>> where jupyter
/usr/local/bin/jupyter
/usr/local/bin/jupyter
/Users/ThomasDehaeze/miniconda3/bin/jupyter
</code>```

I have only one kernel here /usr/local/share/jupyter/kernels/python2.
But inside Jupyter, I have two kernels, python2 and python3. Where can I find the other one ?

I modified kernel.json from /usr/local/share/jupyter/kernels/python2 :

```<code>{
 "display_name": "Python 2",
 "language": "python",
 "argv": [
  "/Users/***/miniconda3/envs/py27/bin/python2.7",
  "-m",
  "ipykernel",
  "-f",
  "{connection_file}"
 ]
}
</code>```

And then :

```<code>import sys
print(sys.executable)
/usr/local/opt/python/bin/python2.7
</code>```

So nothing has changed

答:
This worked for me:

```<code>source activate {environment_name}
python -m ipykernel install --user --name={environment_name};
</code>```

Incase ipykernel is not installed, use this command:

```<code>conda install -c anaconda ipykernel
</code>```

Body:
I'm trying to set a good environnement for doing some scientific stuff with python. To do so, I installed Jupyter & miniconda.

Then I want to be able to have different environnement and use them with Jupyter notebooks. So I created two custom envs with conda : py27 and py35.

> conda env list
# conda environments:
#
py27                     /Users/***/miniconda3/envs/py27
py35                     /Users/***/miniconda3/envs/py35
root                  *  /Users/***/miniconda3

Then on my notebook I have two kernels python 2 and python 3.
Inside a notebook, I get the following with the python3 kernel :

> import sys
> print(sys.executable)
/Users/***/miniconda3/envs/py35/bin/python

And this with the python2 kernel :

> import sys
> print(sys.executable)
/usr/local/opt/python/bin/python2.7

How can I set the sys.executable to miniconda env for python2 ?

How can I bind a conda env with a notebook kernel ?

Is doing source activate py35 has a link with jupyter notebook ?

I think I really missed something.

Thank you everyone.

--- edit

I have multiple jupyter bin :

> where jupyter
/usr/local/bin/jupyter
/usr/local/bin/jupyter
/Users/ThomasDehaeze/miniconda3/bin/jupyter

I have only one kernel here /usr/local/share/jupyter/kernels/python2.
But inside Jupyter, I have two kernels, python2 and python3. Where can I find the other one ?

I modified kernel.json from /usr/local/share/jupyter/kernels/python2 :

{
 "display_name": "Python 2",
 "language": "python",
 "argv": [
  "/Users/***/miniconda3/envs/py27/bin/python2.7",
  "-m",
  "ipykernel",
  "-f",
  "{connection_file}"
 ]
}

And then :

import sys
print(sys.executable)
/usr/local/opt/python/bin/python2.7

So nothing has changed

Body:
This worked for me:

source activate {environment_name}
python -m ipykernel install --user --name={environment_name};

Incase ipykernel is not installed, use this command:

conda install -c anaconda ipykernel