问:
Spring Boot doesn't seem to find Repository
I'm not sure what's wrong with my configuration, but as far as I can see it should be correct, despite that spring announces that there is no such bean definition. I veryfied these points:

The configuration class is in the root package of everything else

The repository extends JpaRepository, thus needs no annotation

The player object is annotated with "@Entity"

The pojo for this repository is completely mapped in terms of annotations

No non-java configuration files present

The database is set up and the correct credentials are used.

Jpa/hibernate is set to "Create-Update" for development purposes.

Here's my complete debug log:
spring startup log pastebin

log without debug flag:

```<code>2017-06-12 09:34:36.395  INFO 12880 --- [  restartedMain]
d.a.c.newworlds.NewWorldsApplication     : No active profile set, falling back to default profiles: default
2017-06-12 09:34:36.727  INFO 12880 --- [  restartedMain] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@10057b9b: startup date [Mon Jun 12 09:34:36 CEST 2017]; root of context hierarchy
2017-06-12 09:34:38.090  INFO 12880 --- [  restartedMain] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'playerRepository' with a different definition: replacing [Root bean: class [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
2017-06-12 09:34:38.107  INFO 12880 --- [  restartedMain] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'userAccountRepository' with a different definition: replacing [Root bean: class [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
2017-06-12 09:34:38.115  INFO 12880 --- [  restartedMain] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'organizationRepository' with a different definition: replacing [Root bean: class [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
2017-06-12 09:34:38.612  INFO 12880 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration' of type [class org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-06-12 09:34:38.664  INFO 12880 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'validator' of type [class org.springframework.validation.beanvalidation.LocalValidatorFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-06-12 09:34:38.701  INFO 12880 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$93eeb181] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-06-12 09:34:39.009  INFO 12880 --- [  restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-06-12 09:34:39.019  INFO 12880 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service Tomcat
2017-06-12 09:34:39.020  INFO 12880 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.11
2017-06-12 09:34:39.243  INFO 12880 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2017-06-12 09:34:39.243  INFO 12880 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2521 ms
2017-06-12 09:34:39.635  INFO 12880 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-06-12 09:34:39.635  INFO 12880 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-06-12 09:34:39.636  INFO 12880 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-06-12 09:34:39.636  INFO 12880 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2017-06-12 09:34:39.637  INFO 12880 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2017-06-12 09:34:39.637  INFO 12880 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2017-06-12 09:34:40.130  INFO 12880 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2017-06-12 09:34:40.156  INFO 12880 --- [  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2017-06-12 09:34:40.266  INFO 12880 --- [  restartedMain] org.hibernate.Version                    : HHH000412: Hibernate Core {5.0.11.Final}
2017-06-12 09:34:40.267  INFO 12880 --- [  restartedMain] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2017-06-12 09:34:40.271  INFO 12880 --- [  restartedMain] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
2017-06-12 09:34:40.324  INFO 12880 --- [  restartedMain] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2017-06-12 09:34:40.890  INFO 12880 --- [  restartedMain] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
2017-06-12 09:34:41.031  WARN 12880 --- [  restartedMain] org.hibernate.cfg.AnnotationBinder       : HHH000138: Mixing inheritance strategy in a entity hierarchy is not allowed, ignoring sub strategy in: de.awesome.corporate.newworlds.core.planets.entity.AbstractPlanetoid
2017-06-12 09:34:41.186  WARN 12880 --- [  restartedMain] o.h.b.i.SessionFactoryBuilderImpl        : Unrecognized hbm2ddl_auto value : create-update.  Supported values include create, create-drop, update, and validate.  Ignoring
2017-06-12 09:34:41.604  INFO 12880 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2017-06-12 09:34:41.930  WARN 12880 --- [  restartedMain] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'playerRegistrationController': Unsatisfied dependency expressed through field 'registrationService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'registrationService': Unsatisfied dependency expressed through field 'playerRepository'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'de.awesome.corporate.newworlds.core.usermanagement.repository.PlayerRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
2017-06-12 09:34:41.931  INFO 12880 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2017-06-12 09:34:41.944  INFO 12880 --- [  restartedMain] utoConfigurationReportLoggingInitializer :

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-06-12 09:34:42.090 ERROR 12880 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

Field playerRepository in de.awesome.corporate.newworlds.core.usermanagement.service.RegistrationService required a bean of type 'de.awesome.corporate.newworlds.core.usermanagement.repository.PlayerRepository' that could not be found.

Action:

Consider defining a bean of type 'de.awesome.corporate.newworlds.core.usermanagement.repository.PlayerRepository' in your configuration.
</code>```

My SpringBootApplication:

```<code>package de.awesome.corporate.newworlds;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

@SpringBootApplication
public class NewWorldsApplication {

 public static void main(String[] args) {
    SpringApplication.run(NewWorldsApplication.class, args);
 }
}
</code>```

My PlayerRepository:

```<code>package de.awesome.corporate.newworlds.core.usermanagement.repository;

import org.springframework.data.jpa.repository.JpaRepository;

import de.awesome.corporate.newworlds.core.usermanagement.entity.Player;

public interface PlayerRepository extends JpaRepository<Player, String>{

    Player findByUserAccount(String useraccount);

}
</code>```

The calling Service:

```<code>package de.awesome.corporate.newworlds.core.usermanagement.service;
@Service
public class RegistrationService {

    @Autowired
    private PlayerRepository playerRepository;

    @Autowired
    private UserAccountRepository userRepository;

    @Autowired
    private OrganizationCreationService organizationCreationService;

    @Autowired
    private BCryptPasswordEncoder passwordEncoder;
}
</code>```

POM:

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>de.awesome.corporate.newworlds</groupId>
<artifactId>New-Worlds</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>new-worlds</name>
<description>Text-based Management Game</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.1.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-aop</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-hateoas</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.session</groupId>
        <artifactId>spring-session</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
</code>```

EDIT: It seems that, after removing spring-data-jpa-starter from the pom, and then reinsert it, that it also has problems now autowiring the password encorder.
Is there a general problem with the way spring does the autowiring?

答:
I had the same issue, I had repositories for both mongo and mysql database. so I was using spring data jdbc for mysql database and spring data mongodb for mongoDB. spring could not find jdbc repositories because when there is more then one datasource spring enters strict repository mode and if your entities are not properly annotated spring wont be able to identify the repos.
for example if you are using JPA, annotate your entities with @Entity.
sprinf-data-jdbc --> @Table, spring-data-mongodb --> @Document.</p>

Body:
I'm not sure what's wrong with my configuration, but as far as I can see it should be correct, despite that spring announces that there is no such bean definition. I veryfied these points:

The configuration class is in the root package of everything else

The repository extends JpaRepository, thus needs no annotation

The player object is annotated with "@Entity"

The pojo for this repository is completely mapped in terms of annotations

No non-java configuration files present

The database is set up and the correct credentials are used.

Jpa/hibernate is set to "Create-Update" for development purposes.

Here's my complete debug log:
spring startup log pastebin

log without debug flag:

2017-06-12 09:34:36.395  INFO 12880 --- [  restartedMain]
d.a.c.newworlds.NewWorldsApplication     : No active profile set, falling back to default profiles: default
2017-06-12 09:34:36.727  INFO 12880 --- [  restartedMain] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@10057b9b: startup date [Mon Jun 12 09:34:36 CEST 2017]; root of context hierarchy
2017-06-12 09:34:38.090  INFO 12880 --- [  restartedMain] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'playerRepository' with a different definition: replacing [Root bean: class [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
2017-06-12 09:34:38.107  INFO 12880 --- [  restartedMain] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'userAccountRepository' with a different definition: replacing [Root bean: class [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
2017-06-12 09:34:38.115  INFO 12880 --- [  restartedMain] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'organizationRepository' with a different definition: replacing [Root bean: class [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
2017-06-12 09:34:38.612  INFO 12880 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration' of type [class org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-06-12 09:34:38.664  INFO 12880 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'validator' of type [class org.springframework.validation.beanvalidation.LocalValidatorFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-06-12 09:34:38.701  INFO 12880 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$93eeb181] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-06-12 09:34:39.009  INFO 12880 --- [  restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-06-12 09:34:39.019  INFO 12880 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service Tomcat
2017-06-12 09:34:39.020  INFO 12880 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.11
2017-06-12 09:34:39.243  INFO 12880 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2017-06-12 09:34:39.243  INFO 12880 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2521 ms
2017-06-12 09:34:39.635  INFO 12880 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-06-12 09:34:39.635  INFO 12880 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-06-12 09:34:39.636  INFO 12880 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-06-12 09:34:39.636  INFO 12880 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2017-06-12 09:34:39.637  INFO 12880 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2017-06-12 09:34:39.637  INFO 12880 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2017-06-12 09:34:40.130  INFO 12880 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2017-06-12 09:34:40.156  INFO 12880 --- [  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2017-06-12 09:34:40.266  INFO 12880 --- [  restartedMain] org.hibernate.Version                    : HHH000412: Hibernate Core {5.0.11.Final}
2017-06-12 09:34:40.267  INFO 12880 --- [  restartedMain] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2017-06-12 09:34:40.271  INFO 12880 --- [  restartedMain] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
2017-06-12 09:34:40.324  INFO 12880 --- [  restartedMain] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2017-06-12 09:34:40.890  INFO 12880 --- [  restartedMain] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
2017-06-12 09:34:41.031  WARN 12880 --- [  restartedMain] org.hibernate.cfg.AnnotationBinder       : HHH000138: Mixing inheritance strategy in a entity hierarchy is not allowed, ignoring sub strategy in: de.awesome.corporate.newworlds.core.planets.entity.AbstractPlanetoid
2017-06-12 09:34:41.186  WARN 12880 --- [  restartedMain] o.h.b.i.SessionFactoryBuilderImpl        : Unrecognized hbm2ddl_auto value : create-update.  Supported values include create, create-drop, update, and validate.  Ignoring
2017-06-12 09:34:41.604  INFO 12880 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2017-06-12 09:34:41.930  WARN 12880 --- [  restartedMain] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'playerRegistrationController': Unsatisfied dependency expressed through field 'registrationService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'registrationService': Unsatisfied dependency expressed through field 'playerRepository'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'de.awesome.corporate.newworlds.core.usermanagement.repository.PlayerRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
2017-06-12 09:34:41.931  INFO 12880 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2017-06-12 09:34:41.944  INFO 12880 --- [  restartedMain] utoConfigurationReportLoggingInitializer :

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-06-12 09:34:42.090 ERROR 12880 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

Field playerRepository in de.awesome.corporate.newworlds.core.usermanagement.service.RegistrationService required a bean of type 'de.awesome.corporate.newworlds.core.usermanagement.repository.PlayerRepository' that could not be found.

Action:

Consider defining a bean of type 'de.awesome.corporate.newworlds.core.usermanagement.repository.PlayerRepository' in your configuration.

My SpringBootApplication:

package de.awesome.corporate.newworlds;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

@SpringBootApplication
public class NewWorldsApplication {

 public static void main(String[] args) {
    SpringApplication.run(NewWorldsApplication.class, args);
 }
}

My PlayerRepository:

package de.awesome.corporate.newworlds.core.usermanagement.repository;

import org.springframework.data.jpa.repository.JpaRepository;

import de.awesome.corporate.newworlds.core.usermanagement.entity.Player;

public interface PlayerRepository extends JpaRepository<Player, String>{

    Player findByUserAccount(String useraccount);

}

The calling Service:

package de.awesome.corporate.newworlds.core.usermanagement.service;
@Service
public class RegistrationService {

    @Autowired
    private PlayerRepository playerRepository;

    @Autowired
    private UserAccountRepository userRepository;

    @Autowired
    private OrganizationCreationService organizationCreationService;

    @Autowired
    private BCryptPasswordEncoder passwordEncoder;
}

POM:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>de.awesome.corporate.newworlds</groupId>
<artifactId>New-Worlds</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>new-worlds</name>
<description>Text-based Management Game</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.1.RELEASE</version>
    <relativePath />
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-aop</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-hateoas</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.session</groupId>
        <artifactId>spring-session</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

EDIT: It seems that, after removing spring-data-jpa-starter from the pom, and then reinsert it, that it also has problems now autowiring the password encorder.
Is there a general problem with the way spring does the autowiring?


来源: stackexchange

问:
Equality of reference types in template parameters
The C++ standard says in [temp.type]#2.7, that

Two values are template-argument-equivalent if they are of the same type and

...

(2.7) they are of reference type and they refer to the same object or function

This is different, than how reference types are compared in non-template code. Say e.g.

```<code>template <auto& x1, auto& x2>
constexpr bool equal_tmpl = false;

template <auto& x>
constexpr bool equal_tmpl<x, x> = true;
</code>```

and

```<code>consteval bool equal_fun(auto& x1, auto& x2)
{
    return x1 == x2;
}
</code>```

mean different things. equal_tmpl compares the addresses, but equal_fun compares the values:

```<code>constexpr int i = 123;
constexpr int j = 123;

static_assert(equal_tmpl<i, j> != equal_fun(i, j));
</code>```

Why is this defined this way in the standard? Souldn't equality in templates work the same way as in non-template code? Demo.

答:
For the purposes of template argument equivalence, the question we want to be asking is "are these two arguments identical?" rather than "are these two arguments equal?"

References to two different variables that have the same value might be equal to each other, but they aren't identical: one may not be substituted for the other. Imagine if we had this:

```<code>template <const int& r>
constexpr auto foo() { return &r; }
</code>```

Would it make any sense if the standard said that foo and foo<j> are the same function because i == j (where i and j are defined as in the question)? No. foo is a function that returns the address of i, and foo<j> is a function that returns the address of j, and those two addresses aren't the same.

ContentLicense: CC BY-SA 4.0

Body:
The C++ standard says in [temp.type]#2.7, that

Two values are template-argument-equivalent if they are of the same type and

...

(2.7) they are of reference type and they refer to the same object or function

This is different, than how reference types are compared in non-template code. Say e.g.

template <auto& x1, auto& x2>
constexpr bool equal_tmpl = false;

template <auto& x>
constexpr bool equal_tmpl<x, x> = true;

and

consteval bool equal_fun(auto& x1, auto& x2)
{
    return x1 == x2;
}

mean different things. equal_tmpl compares the addresses, but equal_fun compares the values:

constexpr int i = 123;
constexpr int j = 123;

static_assert(equal_tmpl != equal_fun(i, j));

Why is this defined this way in the standard? Souldn't equality in templates work the same way as in non-template code? Demo.

Body:
For the purposes of template argument equivalence, the question we want to be asking is "are these two arguments identical?" rather than "are these two arguments equal?"

References to two different variables that have the same value might be equal to each other, but they aren't identical: one may not be substituted for the other. Imagine if we had this:

template <const int& r>
constexpr auto foo() { return &r; }

Would it make any sense if the standard said that foo<i> and foo<j> are the same function because i == j (where i and j are defined as in the question)? No. foo<i> is a function that returns the address of i, and foo<j> is a function that returns the address of j, and those two addresses aren't the same.


问:
Nginx Minio static files 404 on a context path
I have 2 machines: One holds the Minio running in a Docker container on port 9001 and the other holds the Nginx. I want to access\serve Minio on a path prefix /media i.e. www.mydomain.com/media: I can see that proxy_pass is working fine but I'm getting 404 on static files:

I can see that the main page is getting loaded by checking the favicon and the page title.

Below is my nginx config file:

```<code>...
        upstream minio {
            ip_hash;
            server <hostname\IP>:9001;
        }
        server {
            server_name mydomain.com;

...
            location /media {
                rewrite ^/media(/.*)$ $1 break;
                proxy_pass          http://minio/;
                client_max_body_size 0;
                proxy_redirect off;
                proxy_buffering off;
                proxy_set_header    Host               $http_host;
                proxy_set_header    X-Real-IP          $remote_addr;
                proxy_set_header    X-Forwarded-For    $proxy_add_x_forwarded_for;
                proxy_set_header    X-Forwarded-Host   $host;
                proxy_set_header    X-Forwarded-Server $host;
                proxy_set_header    X-Forwarded-Port   $server_port;
                proxy_set_header    X-Forwarded-Proto  $scheme;

                chunked_transfer_encoding off;
                proxy_set_header Connection "";
                proxy_http_version 1.1;
                proxy_connect_timeout 300;
            }
...
     }
</code>```

Any help would be highly appreciated. :)

答:
Unfortunately it seems like this isn't possible and the MinIO team isn't interested in supporting it natively:

https://github.com/minio/minio-js/issues/737

This comment suggests some workarounds, however: https://github.com/minio/minio-js/issues/737#issuecomment-809373153

reverse proxy via nginx - rewrite prefix and added option proxy_set_header Host '127.0.0.1:9000'

use traefik with stripPrefix and sets static header Host

Body:
I have 2 machines: One holds the Minio running in a Docker container on port 9001 and the other holds the Nginx. I want to access\serve Minio on a path prefix /media i.e. www.mydomain.com/media: I can see that proxy_pass is working fine but I'm getting 404 on static files:

I can see that the main page is getting loaded by checking the favicon and the page title.

Below is my nginx config file:

...
        upstream minio {
            ip_hash;
            server <hostname\IP>:9001;
        }
        server {
            server_name mydomain.com;

...
            location /media {
                rewrite ^/media(/.*)$ $1 break;
                proxy_pass          http://minio/;
                client_max_body_size 0;
                proxy_redirect off;
                proxy_buffering off;
                proxy_set_header    Host               $http_host;
                proxy_set_header    X-Real-IP          $remote_addr;
                proxy_set_header    X-Forwarded-For    $proxy_add_x_forwarded_for;
                proxy_set_header    X-Forwarded-Host   $host;
                proxy_set_header    X-Forwarded-Server $host;
                proxy_set_header    X-Forwarded-Port   $server_port;
                proxy_set_header    X-Forwarded-Proto  $scheme;

                chunked_transfer_encoding off;
                proxy_set_header Connection "";
                proxy_http_version 1.1;
                proxy_connect_timeout 300;
            }
...
     }

Any help would be highly appreciated. :)


问:
What HTTP code do you get if an SSL has expired?
I have a custom monitor code setup. I need to check if the specified URL has its SSL certificate expired. Is there a specific HTTP code for this? For example:

(async() => {
    const res = await fetch('http://example.com');
    // Or `statusText`
    if (res.status == some_ssl_expiryCode) {
        console.log('SSL expired!');
    }
})();
```

Is there a way to do this in javascript?

答:
As @Jasen said, the connection doesn't reach the server. The fetch request returns the error CERT_HAS_EXPIRED or CERT_INVALID. It does not produce an HTTP code. See the javascript code below.

fetch('https://example.com/')
    .then(res => res.text())
    .then(() => { /* Do something if success */ })
    .catch(error => {
        console.error(error);
        if (error.code === 'CERT_HAS_EXPIRED') {
            // Certificate has expired
        } else if (error.code === 'CERT_INVALID') {
            // Certificate is invalid
        }
    });
```

Body:
I have a custom monitor code setup. I need to check if the specified URL has its SSL certificate expired. Is there a specific HTTP code for this? For example:

(async() => {
    const res = await fetch('http://example.com');
    // Or `statusText`
    if (res.status == some_ssl_expiryCode) {
        console.log('SSL expired!');
    }
})();

Is there a way to do this in javascript?


问:
How can I disable verbose print statements in the output of a LibVLCSharp application that is being debugged by Visual Studio in Native mode
I am using LibVLCSharp in a solution that includes some native projects.  If I debug in Native or Mixed mode, then LibVLC(Sharp) seems to spew a lot of print statements.  A sample of these print statements follows.

```<code>main spu text debug: looking for text renderer module matching "any": 3 candidates
'LibVLCSharp.Windows.Net40.Sample.exe' (Win32): Loaded 'C:\Windows\System32\DWrite.dll'.
main vout display debug: VoutDisplayEvent 'resize' 1280x720
freetype spu text debug: Using DWrite backend
freetype spu text debug: DWrite_GetFamily(): family name: Arial
freetype spu text debug: DWrite_ParseFamily(): using font at index 0 with weight 400 for bold: 0, italic: 0
freetype spu text debug: DWrite_ParseFamily(): using font at index 1 with weight 700 for bold: 1, italic: 0
freetype spu text debug: DWrite_ParseFamily(): using font at index 2 with weight 400 for bold: 0, italic: 1
freetype spu text debug: DWrite_ParseFamily(): using font at index 3 with weight 700 for bold: 1, italic: 1
main spu text debug: using text renderer module "freetype"
main generic debug: looking for hw decoder module matching "any": 2 candidates
d3d11va generic warning: failed to get the 0 MatchingDeviceId (2)
d3d11va generic debug: different 1 device p vs P
d3d11va generic debug: different 2 device p vs P
</code>```

This is annoying and it also seems to slow down the loading/rendering.  So I need a way to disable these print statements.  They don't show up if I debug in Managed mode but that is insufficient for my purposes.

I have tried to dial down the verbosity of LibVLC(Sharp) every way that I can.  I have tried at least all of the following mechanisms.

```<code>libVlc = new LibVLC("--verbose", "-1");
libVlc = new LibVLC("--verbose=-1");
libVlc = new LibVLC(false, "--verbose", "2");
libVlc = new LibVLC(false, "--verbose", "0");
libVlc = new LibVLC(false, "--verbose", "-1");
libVlc = new LibVLC(false, "--verbose=2");
libVlc = new LibVLC(false, "--verbose=0");
libVlc = new LibVLC(false, "--verbose=-1");
libVlc = new LibVLC(false, "--verbose=--1");
libVlc = new LibVLC(false, "--verbose", "2");
libVlc = new LibVLC(false, "--verbose", "0");
libVlc = new LibVLC(false, "--verbose", "-1");
libVlc = new LibVLC(false, "-q");
libVlc = new LibVLC(false, "--quiet");
libVlc = new LibVLC("-q");
libVlc = new LibVLC("--quiet");
</code>```

None of that works.  Can anyone please suggest a way to disable these verbose print statements?

I don't think it has anything to do with my code.  I can reproduce the issue with the vanilla LibVLCSharp.Windows.Net40.Sample.  The only thing that I need to change to get the debug prints to spew is the Debug mode.  If I check the "Enable native code debugging" checkbox in the Debug properties of the project, it starts the spew.

答:
Seems like there is currently no way to change that.

https://github.com/videolan/vlc/blob/1b500a19695aa3e0c4179e89abccbe8e5bfce285/src/misc/messages.c#L134

Build your own VLC by removing this, or suggest a flag to avoid this line to be hit in libvlc's bugtracker at code.videolan.org

Body:
I am using LibVLCSharp in a solution that includes some native projects.  If I debug in Native or Mixed mode, then LibVLC(Sharp) seems to spew a lot of print statements.  A sample of these print statements follows.

main spu text debug: looking for text renderer module matching "any": 3 candidates
'LibVLCSharp.Windows.Net40.Sample.exe' (Win32): Loaded 'C:\Windows\System32\DWrite.dll'.
main vout display debug: VoutDisplayEvent 'resize' 1280x720
freetype spu text debug: Using DWrite backend
freetype spu text debug: DWrite_GetFamily(): family name: Arial
freetype spu text debug: DWrite_ParseFamily(): using font at index 0 with weight 400 for bold: 0, italic: 0
freetype spu text debug: DWrite_ParseFamily(): using font at index 1 with weight 700 for bold: 1, italic: 0
freetype spu text debug: DWrite_ParseFamily(): using font at index 2 with weight 400 for bold: 0, italic: 1
freetype spu text debug: DWrite_ParseFamily(): using font at index 3 with weight 700 for bold: 1, italic: 1
main spu text debug: using text renderer module "freetype"
main generic debug: looking for hw decoder module matching "any": 2 candidates
d3d11va generic warning: failed to get the 0 MatchingDeviceId (2)
d3d11va generic debug: different 1 device p vs P
d3d11va generic debug: different 2 device p vs P

This is annoying and it also seems to slow down the loading/rendering.  So I need a way to disable these print statements.  They don't show up if I debug in Managed mode but that is insufficient for my purposes.

I have tried to dial down the verbosity of LibVLC(Sharp) every way that I can.  I have tried at least all of the following mechanisms.

libVlc = new LibVLC("--verbose", "-1");
libVlc = new LibVLC("--verbose=-1");
libVlc = new LibVLC(false, "--verbose", "2");
libVlc = new LibVLC(false, "--verbose", "0");
libVlc = new LibVLC(false, "--verbose", "-1");
libVlc = new LibVLC(false, "--verbose=2");
libVlc = new LibVLC(false, "--verbose=0");
libVlc = new LibVLC(false, "--verbose=-1");
libVlc = new LibVLC(false, "--verbose=--1");
libVlc = new LibVLC(false, "--verbose", "2");
libVlc = new LibVLC(false, "--verbose", "0");
libVlc = new LibVLC(false, "--verbose", "-1");
libVlc = new LibVLC(false, "-q");
libVlc = new LibVLC(false, "--quiet");
libVlc = new LibVLC("-q");
libVlc = new LibVLC("--quiet");

None of that works.  Can anyone please suggest a way to disable these verbose print statements?

I don't think it has anything to do with my code.  I can reproduce the issue with the vanilla LibVLCSharp.Windows.Net40.Sample.  The only thing that I need to change to get the debug prints to spew is the Debug mode.  If I check the "Enable native code debugging" checkbox in the Debug properties of the project, it starts the spew.


问:
React.createElement with typescript error when trying to pass props
I am trying to create dynamic components in react + typescript but I am struggling to correctly type the props on it.

Here is a simpler version of what I'm doing.

```<code>interface ComponentProps {
  title: string;
}

interface ArrInterface {
  component: FC<ComponentProps>;
  title: string
}

const Arr: ArrInterface = [
  { component: FooComponent, title: "foo"},
  { component: FooComponent, title: "bar"}
];

const FooComponent: FC<ComponentProps> = ({title}) => {
  return <div>{title}</div>
}

const BarComponent: FC = () => {
  return sectionsArr.map((section) => {
    const {component, title} = section;
    return React.createElement(component as FC, { title })
  })
}
</code>```

this is the error I am getting :

Argument of type '{ title: string; }' is not assignable to parameter of type ' Attributes'.

Object literal may only specify known properties, and 'title' does not exist in type 'Attributes'

it works if I do a ts-ignore on top of that line btw :)

Can someone please help me out on this one? What am I missing here?

答:
I found the solution myself :)

For those ending up with the same issue as I did, it turns out you need to pass the props type to createElement function.

So basically instead of doing

```<code>    return React.createElement(component as FC, { title })
</code>```

this should fix the issue

```<code>    return React.createElement<ComponentProps>(component as FC, { title })
</code>```

Body:
I am trying to create dynamic components in react + typescript but I am struggling to correctly type the props on it.

Here is a simpler version of what I'm doing.

interface ComponentProps {
  title: string;
}

interface ArrInterface {
  component: FC<ComponentProps>;
  title: string
}

const Arr: ArrInterface = [
  { component: FooComponent, title: "foo"},
  { component: FooComponent, title: "bar"}
];

const FooComponent: FC<ComponentProps> = ({title}) => {
  return
{title}

}

const BarComponent: FC = () => {
  return sectionsArr.map((section) => {
    const {component, title} = section;
    return React.createElement(component as FC, { title })
  })
}

this is the error I am getting :

Argument of type '{ title: string; }' is not assignable to parameter of type ' Attributes'.

Object literal may only specify known properties, and 'title' does not exist in type 'Attributes'

it works if I do a ts-ignore on top of that line btw :)

Can someone please help me out on this one? What am I missing here?

Body:
I found the solution myself :)

For those ending up with the same issue as I did, it turns out you need to pass the props type to createElement function.

So basically instead of doing

    return React.createElement(component as FC, { title })

this should fix the issue

    return React.createElement<ComponentProps>(component as FC, { title })


问:
TextEditingController not passing text into named parameters
I am really struggling to understand why my code isn't working. I'm trying to pass the text from two controllers into another widget with named parameters which writes to Firebase.

My "Test" button properly prints both _titleController.text and _descriptionController.text

```<code>TextButton(
                    onPressed: (){
                      print(_titleController.text); //works fine
                      print(_descriptionController.text); //works fine
                    },
                    child: Text('test')
                ),
</code>```

However when I pass these into my next widget it's blank! If I hardcore strings into these parameters it works properly:

```<code>PushNewE3 (
                 changeTitle: _titleController.text, //does not work (empty)
                 changeDescription: _descriptionController.text, //does not work (empty)
                )
</code>```

Full code:

```<code>class CreateE3 extends StatefulWidget {
  const CreateE3({Key? key}) : super(key: key);

  @override
  _CreateE3State createState() => _CreateE3State();
}

class _CreateE3State extends State<CreateE3> {
  final _titleController = TextEditingController();
  final _descriptionController = TextEditingController();

  @override
  void initState(){
    super.initState();
    _titleController.addListener(_printLatestValue);
  }

  @override
  void dispose(){
    _titleController.dispose();
    super.dispose();
  }

  void _printLatestValue(){
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('So Frustrating'),
      ),

      body: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Container(
            width: 800,
            child: Column(
              children: [
                Text('Originator: **Add Current User**')      ,
                TextField(
                  maxLength: 40,
                  decoration: InputDecoration(
                    border: OutlineInputBorder(),
                    labelText: 'Change Title'
                  ),
                  controller: _titleController,
                  onEditingComplete: (){
                    //_title = _titleController.text;
                  },
                ),
                Padding(
                  padding: const EdgeInsets.fromLTRB(0,10,0,0),
                  child: TextFormField(
                    maxLines: 5,
                    decoration: InputDecoration(
                        border: OutlineInputBorder(),
                        labelText: 'Detailed Description'
                    ),
                    controller: _descriptionController,
                  ),
                ),
                TextButton(
                    onPressed: (){
                      print(_titleController.text); //successfully prints
                      print(_descriptionController.text); //successfully prints

                    },
                    child: Text('test')
                ),
                PushNewE3 (
                 changeTitle: _titleController.text, //DOES NOT WORK (empty)
                 changeDescription: _descriptionController.text, //DOES NOT WORK (empty)
                )

              ],
            ),
          ),
        ],
      ),

    );
  }
}

class PushNewE3 extends StatelessWidget {
  final String changeTitle;
  final String changeDescription;

  PushNewE3({
    required this.changeTitle,
    required this.changeDescription
  });

  @override
  Widget build(BuildContext context) {
    // Create a CollectionReference called users that references the firestore collection
    CollectionReference notificationsE3 = FirebaseFirestore.instance.collection('notificationsE3');

    Future<void> pushNewE3() {
      // Call the notifications CollectionReference to add a new E3 notification
      return notificationsE3
          .add({
        //'originator': FirebaseAuth.instance.currentUser,
        'changeTitle': changeTitle,
        'changeDescription': changeDescription,
      })
          .then((value) => print("E3 Created"))
          .catchError((error) => print("Failed to create E3: $error"));
    }

    return TextButton(
      onPressed: (){
        print('start:');
        print(changeTitle);
        print(changeDescription);
        print('-end');

      },
      child: Text(
        "Create E3",
      ),
    );
  }
}

</code>```

EDIT:
I still don't understand why the above code doesn't work. I refactored my code into a single widget and now it's working. If anyone can explain why I would still appreciate understanding as there is clearly a gap in my knowledge.

If anyone in the future runs into the same problem here is the refactored code:

```<code>import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';

import 'main.dart';

var global = 'blank';

class CreateE3 extends StatefulWidget {
  const CreateE3({Key? key}) : super(key: key);

  @override
  _CreateE3State createState() => _CreateE3State();
}

class _CreateE3State extends State<CreateE3> {
  final _titleController = TextEditingController();
  final _descriptionController = TextEditingController();

  @override
  Widget build(BuildContext context) {
    // Create a CollectionReference called users that references the firestore collection
    CollectionReference notificationsE3 = FirebaseFirestore.instance.collection('notificationsE3');

    Future<void> pushNewE3() {
      // Call the notifications CollectionReference to add a new E3 notification
      return notificationsE3
          .add({
        //'originator': FirebaseAuth.instance.currentUser,
        'changeTitle': _titleController.text,
        'changeDescription': _descriptionController.text,
      })
          .then((value) => print("E3 Created"))
          .catchError((error) => print("Failed to create E3: $error"));
    }

    return Scaffold(
      appBar: AppBar(
        title: Text(_titleController.text),
      ),

      body: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Container(
            width: 800,
            child: Column(
              children: [
                Text('Originator: **Add Current User**')      ,
                TextField(
                  maxLength: 40,
                  decoration: InputDecoration(
                      border: OutlineInputBorder(),
                      labelText: 'Change Title'
                  ),
                  controller: _titleController,
                  onChanged: (text){
                    setState(() {

                    });
                  },

                ),
                Padding(
                  padding: const EdgeInsets.fromLTRB(0,10,0,0),
                  child: TextFormField(
                    maxLines: 5,
                    decoration: InputDecoration(
                        border: OutlineInputBorder(),
                        labelText: 'Detailed Description'
                    ),
                    controller: _descriptionController,
                  ),
                ),
                TextButton(
                    onPressed: (){
                      pushNewE3();
                    },
                    child: Text('SAVE')
                ),

              ],
            ),
          ),
        ],
      ),

    );
  }
}
</code>```

答:
I'm not sure what are you trying to do exactly but here's what I did:
1 - add a local variable _title
2 -  add this code to the onPressed function:

```<code>setState(() {
             _title= _titleController.text;
            });
</code>```

This is the whole code :

```<code>  class CreateE3 extends StatefulWidget {
     const CreateE3({Key? key}) : super(key: key);
     @override
    _CreateE3State createState() => _CreateE3State();
  }

  class _CreateE3State extends State<CreateE3> {
    final _titleController = TextEditingController();
    final _descriptionController = TextEditingController();
    String _title = 'So Frustrating';

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

  @override
   void dispose(){
   _titleController.dispose();
   super.dispose();
  }

 @override
 Widget build(BuildContext context) {
   return Scaffold(
     appBar: AppBar(
       title: Text(_title),
     ),

    body: Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        Container(
          width: 400,
          child: Column(
            children: [
              Text('Originator: **Add Current User**')      ,
              TextField(
                maxLength: 40,
                decoration: InputDecoration(
                    border: OutlineInputBorder(),
                    labelText: 'Change Title'
                ),
                controller: _titleController,
                onEditingComplete: (){
                  //_title = _titleController.text;
                },
              ),
              Padding(
                padding: const EdgeInsets.fromLTRB(0,10,0,0),
                child: TextFormField(
                  maxLines: 5,
                  decoration: InputDecoration(
                      border: OutlineInputBorder(),
                      labelText: 'Detailed Description'
                  ),
                  controller: _descriptionController,
                ),
            ),
              TextButton(
                  onPressed: (){
                    print(_titleController.text);
                    print(_descriptionController.text);
                    setState(() {
                      _title = _titleController.text;
                    });

                  },
                  child: Text('test')
              ),
            ],
          ),
        ),
        ],
      ),

    );
   }
 }
</code>```

.........................
so this is when you first start the app :

after changing the TextField and pressing the 'test button the title in the appbar change :

Body:
I am really struggling to understand why my code isn't working. I'm trying to pass the text from two controllers into another widget with named parameters which writes to Firebase.

My "Test" button properly prints both _titleController.text and _descriptionController.text

TextButton(
                    onPressed: (){
                      print(_titleController.text); //works fine
                      print(_descriptionController.text); //works fine
                    },
                    child: Text('test')
                ),

However when I pass these into my next widget it's blank! If I hardcore strings into these parameters it works properly:

PushNewE3 (
                 changeTitle: _titleController.text, //does not work (empty)
                 changeDescription: _descriptionController.text, //does not work (empty)
                )

Full code:

class CreateE3 extends StatefulWidget {
  const CreateE3({Key? key}) : super(key: key);

  @override
  _CreateE3State createState() => _CreateE3State();
}

class _CreateE3State extends State<CreateE3> {
  final _titleController = TextEditingController();
  final _descriptionController = TextEditingController();

  @override
  void initState(){
    super.initState();
    _titleController.addListener(_printLatestValue);
  }

  @override
  void dispose(){
    _titleController.dispose();
    super.dispose();
  }

  void _printLatestValue(){
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('So Frustrating'),
      ),

      body: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Container(
            width: 800,
            child: Column(
              children: [
                Text('Originator: **Add Current User**')      ,
                TextField(
                  maxLength: 40,
                  decoration: InputDecoration(
                    border: OutlineInputBorder(),
                    labelText: 'Change Title'
                  ),
                  controller: _titleController,
                  onEditingComplete: (){
                    //_title = _titleController.text;
                  },
                ),
                Padding(
                  padding: const EdgeInsets.fromLTRB(0,10,0,0),
                  child: TextFormField(
                    maxLines: 5,
                    decoration: InputDecoration(
                        border: OutlineInputBorder(),
                        labelText: 'Detailed Description'
                    ),
                    controller: _descriptionController,
                  ),
                ),
                TextButton(
                    onPressed: (){
                      print(_titleController.text); //successfully prints
                      print(_descriptionController.text); //successfully prints

                    },
                    child: Text('test')
                ),
                PushNewE3 (
                 changeTitle: _titleController.text, //DOES NOT WORK (empty)
                 changeDescription: _descriptionController.text, //DOES NOT WORK (empty)
                )

              ],
            ),
          ),
        ],
      ),

    );
  }
}

class PushNewE3 extends StatelessWidget {
  final String changeTitle;
  final String changeDescription;

  PushNewE3({
    required this.changeTitle,
    required this.changeDescription
  });

  @override
  Widget build(BuildContext context) {
    // Create a CollectionReference called users that references the firestore collection
    CollectionReference notificationsE3 = FirebaseFirestore.instance.collection('notificationsE3');

    Future<void> pushNewE3() {
      // Call the notifications CollectionReference to add a new E3 notification
      return notificationsE3
          .add({
        //'originator': FirebaseAuth.instance.currentUser,
        'changeTitle': changeTitle,
        'changeDescription': changeDescription,
      })
          .then((value) => print("E3 Created"))
          .catchError((error) => print("Failed to create E3: $error"));
    }

    return TextButton(
      onPressed: (){
        print('start:');
        print(changeTitle);
        print(changeDescription);
        print('-end');

      },
      child: Text(
        "Create E3",
      ),
    );
  }
}

EDIT:
I still don't understand why the above code doesn't work. I refactored my code into a single widget and now it's working. If anyone can explain why I would still appreciate understanding as there is clearly a gap in my knowledge.

If anyone in the future runs into the same problem here is the refactored code:

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';

import 'main.dart';

var global = 'blank';

class CreateE3 extends StatefulWidget {
  const CreateE3({Key? key}) : super(key: key);

  @override
  _CreateE3State createState() => _CreateE3State();
}

class _CreateE3State extends State<CreateE3> {
  final _titleController = TextEditingController();
  final _descriptionController = TextEditingController();

  @override
  Widget build(BuildContext context) {
    // Create a CollectionReference called users that references the firestore collection
    CollectionReference notificationsE3 = FirebaseFirestore.instance.collection('notificationsE3');

    Future<void> pushNewE3() {
      // Call the notifications CollectionReference to add a new E3 notification
      return notificationsE3
          .add({
        //'originator': FirebaseAuth.instance.currentUser,
        'changeTitle': _titleController.text,
        'changeDescription': _descriptionController.text,
      })
          .then((value) => print("E3 Created"))
          .catchError((error) => print("Failed to create E3: $error"));
    }

    return Scaffold(
      appBar: AppBar(
        title: Text(_titleController.text),
      ),

      body: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Container(
            width: 800,
            child: Column(
              children: [
                Text('Originator: **Add Current User**')      ,
                TextField(
                  maxLength: 40,
                  decoration: InputDecoration(
                      border: OutlineInputBorder(),
                      labelText: 'Change Title'
                  ),
                  controller: _titleController,
                  onChanged: (text){
                    setState(() {

                    });
                  },

                ),
                Padding(
                  padding: const EdgeInsets.fromLTRB(0,10,0,0),
                  child: TextFormField(
                    maxLines: 5,
                    decoration: InputDecoration(
                        border: OutlineInputBorder(),
                        labelText: 'Detailed Description'
                    ),
                    controller: _descriptionController,
                  ),
                ),
                TextButton(
                    onPressed: (){
                      pushNewE3();
                    },
                    child: Text('SAVE')
                ),

              ],
            ),
          ),
        ],
      ),

    );
  }
}

Body:
I'm not sure what are you trying to do exactly but here's what I did:
1 - add a local variable _title
2 -  add this code to the onPressed function:

setState(() {
             _title= _titleController.text;
            });

This is the whole code :

  class CreateE3 extends StatefulWidget {
     const CreateE3({Key? key}) : super(key: key);
     @override
    _CreateE3State createState() => _CreateE3State();
  }

  class _CreateE3State extends State<CreateE3> {
    final _titleController = TextEditingController();
    final _descriptionController = TextEditingController();
    String _title = 'So Frustrating';

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

  @override
   void dispose(){
   _titleController.dispose();
   super.dispose();
  }

 @override
 Widget build(BuildContext context) {
   return Scaffold(
     appBar: AppBar(
       title: Text(_title),
     ),

    body: Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        Container(
          width: 400,
          child: Column(
            children: [
              Text('Originator: **Add Current User**')      ,
              TextField(
                maxLength: 40,
                decoration: InputDecoration(
                    border: OutlineInputBorder(),
                    labelText: 'Change Title'
                ),
                controller: _titleController,
                onEditingComplete: (){
                  //_title = _titleController.text;
                },
              ),
              Padding(
                padding: const EdgeInsets.fromLTRB(0,10,0,0),
                child: TextFormField(
                  maxLines: 5,
                  decoration: InputDecoration(
                      border: OutlineInputBorder(),
                      labelText: 'Detailed Description'
                  ),
                  controller: _descriptionController,
                ),
            ),
              TextButton(
                  onPressed: (){
                    print(_titleController.text);
                    print(_descriptionController.text);
                    setState(() {
                      _title = _titleController.text;
                    });

                  },
                  child: Text('test')
              ),
            ],
          ),
        ),
        ],
      ),

    );
   }
 }

.........................
so this is when you first start the app :

after changing the TextField and pressing the 'test button the title in the appbar change :


问:
Array not rendering in table within map function but console.logs
I am getting the personnel array data passed back from a child component. When I try console.log(personnel) before trying to render it, it prints it just fine, but when I try to render it inside the table by using the map function, it gives me nothing. I can't even console log inside the map function.

Here's my parent component where I want to render the personnel array inside a table.

```<code>function AllPersonnel(props) {

  let personnel = []
  let cols = [
    { path: "first_name", name: "First Name" },
    { path: "last_name", name: "Last Name" },
    { path: "section", name: "Section" },
    { path: "role", name: "Role" },
    { path: "employee_type", name: "Employee Type" },
  ];

  const handleCallback = (data) => {
    personnel.push(data)
  };

  return (
    <div>
      <h1>Personnel</h1>
      <div>
        {props.personnel.edges.map(({ node }) => {
          return (
            <Personnel
              key={node.__id}
              personnel={node}
              parentCallback={handleCallback}
            />
          );
        })}
      </div>

      <TableContainer component={Paper}>
        <Table>
          <TableHead>
            <TableRow>
              {cols.map((col) => {
                return <TableCell key={col.path}>{col.name}</TableCell>
              })}
            </TableRow>
          </TableHead>

          <TableBody>
            {console.log(personnel)} // this prints fine. will attach screenshot

            {personnel.map((row, i) => {
              {console.log("HERE")} // this does not print. I can't get into this map statement and I see no errors
              return (

                <TableRow key={row.id}>

                  {console.log(row.first_name)}
                  <TableCell >
                    {row.first_name}
                  </TableCell>
                  <TableCell >{row.last_name}</TableCell>
                  <TableCell >{row.section}</TableCell>
                  <TableCell >{row.role}</TableCell>
                  <TableCell >{row.employee_type}</TableCell>
                </TableRow>
              );
            })}
          </TableBody>
        </Table>
      </TableContainer>
    </div>
  );
}

export default createFragmentContainer(AllPersonnel, {
  personnel: graphql`
    fragment AllPersonnel_personnel on PersonnelConnection {
      edges {
        node {
          ...Personnel_personnel
        }
      }
    }
  `,
});
</code>```

When I try using the useState hook instead of an array, it re-renders infinitely and gives me the error

Maximum update depth exceeded. This can happen when a component
repeatedly calls setState inside componentWillUpdate or
componentDidUpdate. React limits the number of nested updates to
prevent infinite loops.

Here is my child component. It's pretty simple, just sends back one row at a time to be added to the personnel object in the parent component.

```<code>function Personnel(props) {
  const data = [
    {
      id: props.personnel.id,
      first_name: props.personnel.first_name,
      last_name: props.personnel.last_name,
      section: props.personnel.section,
      role: props.personnel.role,
    },
  ];

  props.parentCallback(data); // sends back one row at a time, 252 times in this case

  return (
    <div></div>
  );
}

export default createFragmentContainer(Personnel, {
  personnel: graphql`
    fragment Personnel_personnel on Personnel {
      id
      first_name
      last_name
      section
      role
      employee_type
      PersonnelFromResource {
        position
        notes
      }
      PersonnelFromEngagement {
        cover_term
        sector
      }
    }
  `,
});
</code>```

答:
personnel is a static array, the component won't re-render when it changes.
To make the component re renders, you have to make it a state

so you import useState from react import React, {useState} from 'react;
then change let personnel = [] to const [personnel , setPersonnel] = useState([]);
and in the call back instead of personnel.push(data) you change it to setPersonnel((prevData)=>[...prevData , data])

Body:
I am getting the personnel array data passed back from a child component. When I try console.log(personnel) before trying to render it, it prints it just fine, but when I try to render it inside the table by using the map function, it gives me nothing. I can't even console log inside the map function.

Here's my parent component where I want to render the personnel array inside a table.

function AllPersonnel(props) {

  let personnel = []
  let cols = [
    { path: "first_name", name: "First Name" },
    { path: "last_name", name: "Last Name" },
    { path: "section", name: "Section" },
    { path: "role", name: "Role" },
    { path: "employee_type", name: "Employee Type" },
  ];

  const handleCallback = (data) => {
    personnel.push(data)
  };

  return (

Personnel

        {props.personnel.edges.map(({ node }) => {
          return (
            <Personnel
              key={node.__id}
              personnel={node}
              parentCallback={handleCallback}
            />
          );
        })}

      <TableContainer component={Paper}>

          <TableHead>
            <TableRow>
              {cols.map((col) => {
                return <TableCell key={col.path}>{col.name}</TableCell>
              })}
            </TableRow>
          </TableHead>

          <TableBody>
            {console.log(personnel)} // this prints fine. will attach screenshot

            {personnel.map((row, i) => {
              {console.log("HERE")} // this does not print. I can't get into this map statement and I see no errors
              return (

                <TableRow key={row.id}>

                  {console.log(row.first_name)}
                  <TableCell >
                    {row.first_name}
                  </TableCell>
                  <TableCell >{row.last_name}</TableCell>
                  <TableCell >{row.section}</TableCell>
                  <TableCell >{row.role}</TableCell>
                  <TableCell >{row.employee_type}</TableCell>
                </TableRow>
              );
            })}
          </TableBody>

      </TableContainer>

  );
}

export default createFragmentContainer(AllPersonnel, {
  personnel: graphql`
    fragment AllPersonnel_personnel on PersonnelConnection {
      edges {
        node {
          ...Personnel_personnel
        }
      }
    }
  `,
});

When I try using the useState hook instead of an array, it re-renders infinitely and gives me the error

Maximum update depth exceeded. This can happen when a component
repeatedly calls setState inside componentWillUpdate or
componentDidUpdate. React limits the number of nested updates to
prevent infinite loops.

Here is my child component. It's pretty simple, just sends back one row at a time to be added to the personnel object in the parent component.

function Personnel(props) {
  const data = [
    {
      id: props.personnel.id,
      first_name: props.personnel.first_name,
      last_name: props.personnel.last_name,
      section: props.personnel.section,
      role: props.personnel.role,
    },
  ];

  props.parentCallback(data); // sends back one row at a time, 252 times in this case

  return (

  );
}

export default createFragmentContainer(Personnel, {
  personnel: graphql`
    fragment Personnel_personnel on Personnel {
      id
      first_name
      last_name
      section
      role
      employee_type
      PersonnelFromResource {
        position
        notes
      }
      PersonnelFromEngagement {
        cover_term
        sector
      }
    }
  `,
});


问:
ASP.NET Website Slow Performance on production server
My problem is that my ASP.NET website is running slower on my production server comparatively on my development server.

A page that executes in 120ms in my development environment takes 400ms to execute on the server. I've monitored the SQL server with the profiler and the query being run on the page taking 400ms on the server only takes around 50ms to finish - so I've convinced myself that my problem does not lie with the SQL server.

My development machine is an Intel I7 with 6GB RAM, the production server is a 2x AMD Quad Core with 16GB ram.

答:
If you have already looked into all the possible code optimzation and still facing performance issues this could be the reason:

Check your Web.config and remove the following.

```<code> <system.codedom>
<compilers>
  <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
  <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers></system.codedom>
</code>```

These can be safely removed from the web.config if you do pre-compilation and only use the compiled assemblies on the webserver.

ContentLicense: CC BY-SA 2.5

Body:
If you have already looked into all the possible code optimzation and still facing performance issues this could be the reason:

Check your Web.config and remove the following.

 <system.codedom>
<compilers>
  <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
  <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers></system.codedom>

These can be safely removed from the web.config if you do pre-compilation and only use the compiled assemblies on the webserver.


问:
Ordering a complex unordered list with javascript
I am looking for a way to sort a fairly complicated html unordered list using either standard javascript or jQuery.

Please view the HTML, the order needs to be alphabetical and based on the HTML found inside the ".keywordType span value" but needs to construct the order of the top level li (with the unique keyword_xxx). I've just pasted 2 of the list items out of dozens.

```<code><ul class="keywords">
    <li id="keyword_185">
        <div class="icon_keyword"></div>
        <input type="hidden" class="keywordLabel" value="More opening hours">
        <div class="data-wrapper">
            <div class="keywordType">
                <span class="oh">Payment methods</span>
            </div>
            <div class="keywordValue">
                <span id="keyword_185" class="oh">Credit Card, PayPal</span>
            </div>
        </div>
        <a class="edit" title="Edit keywords"></a>
        <a class="delete" title="Delete keywords"></a>
    </li>
    <li id="keyword_192">
        <div class="icon_keyword"></div>
        <input type="hidden" class="keywordLabel" value="Monday to Friday: 8:30am to 6:30pm Saturday: 9pm to 6:30pm Sunday: 10 - 4pm">
        <div class="data-wrapper">
            <div class="keywordType">
                <span class="oh">Opening Hours</span>
            </div>
            <div class="keywordValue">
                <span id="keyword_192" class="oh">Monday to Friday: 8:30am to 6:30pm<br>Saturday: 9pm to 6:30pm<br>Sunday: 10 - 4pm</span>
            </div>
        </div>
        <a class="edit" title="Edit keywords"></a>
        <a class="delete" title="Delete keywords"></a>
    </li>
</ul>
</code>```

Thanks

答:
```<code>var list = $('ul.keywords');
var listItems = $('li', list);

listItems.sort(function (a, b) {
    return $(a).text() > $(b).text() ? 1 : -1;
});

list.append(listItems);
</code>```

You can sort the list of elements (jQuery objects have all the methods of Array, including Array.prototype.sort).

In the comparison function simply compare the text content of the list items. Individual letters will be subsequently compared according to their position in the alphabet (Unicode table, actually). For example, k > a is true.

Finally, just re-append the items to the list.

Demo: http://jsbin.com/igesic

ContentLicense: CC BY-SA 3.0

Body:
I am looking for a way to sort a fairly complicated html unordered list using either standard javascript or jQuery.

Please view the HTML, the order needs to be alphabetical and based on the HTML found inside the ".keywordType span value" but needs to construct the order of the top level li (with the unique keyword_xxx). I've just pasted 2 of the list items out of dozens.

        <input type="hidden" class="keywordLabel" value="More opening hours">

                Payment methods

                Credit Card, PayPal

        <input type="hidden" class="keywordLabel" value="Monday to Friday: 8:30am to 6:30pm Saturday: 9pm to 6:30pm Sunday: 10 - 4pm">

                Opening Hours

                Monday to Friday: 8:30am to 6:30pm
Saturday: 9pm to 6:30pm
Sunday: 10 - 4pm

Thanks

Body:
var list = $('ul.keywords');
var listItems = $('li', list);

listItems.sort(function (a, b) {
    return $(a).text() > $(b).text() ? 1 : -1;
});

list.append(listItems);

You can sort the list of elements (jQuery objects have all the methods of Array, including Array.prototype.sort).

In the comparison function simply compare the text content of the list items. Individual letters will be subsequently compared according to their position in the alphabet (Unicode table, actually). For example, k > a is true.

Finally, just re-append the items to the list.

Demo: http://jsbin.com/igesic


问:
pyfinance dividends and documentation
I'm trying to use pyfinance to pull data, I have run into issues with the dividends. Below is the code, the error I et is:

```<code>    import yfinance as yf

print('Enter Ticker:')
symbol = input()
symbol = yf.Ticker(symbol)
print('Forward PE:')
print(symbol.info['forwardPE'])
print('Dividends:')

info = yf.Ticker(symbol).info
div = info.get('trailingAnnualDividendYield')
print(div)
</code>```

Does anyone have documentation for pyfinance? What I have been able to find is slim, how can I view the modules/classes/etc

Error from python interpreter:

```<code>    Enter Ticker:
c
Forward PE:
8.224477
Dividends:
Traceback (most recent call last):
  File "/home/user/Desktop/test.py", line 10, in <module>
    info = yf.Ticker(symbol).info
  File "/home/user/.local/lib/python3.9/site-packages/yfinance/base.py", line 49, in __init__
    self.ticker = ticker.upper()
AttributeError: 'Ticker' object has no attribute 'upper'
</code>```

答:
This fixed it:</p>
```<code>import yfinance as yf

print('Enter Ticker:')
x = input()
symbol = x
symbol = yf.Ticker(symbol)
info = yf.Ticker(x).info
div = info.get('trailingAnnualDividendYield')

print('Forward PE:')
print(symbol.info['forwardPE'])
print('Dividend:')
print(div)
</code>```

Title: pyfinance dividends and documentation

Body:
I'm trying to use pyfinance to pull data, I have run into issues with the dividends. Below is the code, the error I et is:

    import yfinance as yf

print('Enter Ticker:')
symbol = input()
symbol = yf.Ticker(symbol)
print('Forward PE:')
print(symbol.info['forwardPE'])
print('Dividends:')

info = yf.Ticker(symbol).info
div = info.get('trailingAnnualDividendYield')
print(div)

Does anyone have documentation for pyfinance? What I have been able to find is slim, how can I view the modules/classes/etc

Error from python interpreter:

    Enter Ticker:
c
Forward PE:
8.224477
Dividends:
Traceback (most recent call last):
  File "/home/user/Desktop/test.py", line 10, in <module>
    info = yf.Ticker(symbol).info
  File "/home/user/.local/lib/python3.9/site-packages/yfinance/base.py", line 49, in __init__
    self.ticker = ticker.upper()
AttributeError: 'Ticker' object has no attribute 'upper'

Body:
This fixed it:

import yfinance as yf

print('Enter Ticker:')
x = input()
symbol = x
symbol = yf.Ticker(symbol)
info = yf.Ticker(x).info
div = info.get('trailingAnnualDividendYield')

print('Forward PE:')
print(symbol.info['forwardPE'])
print('Dividend:')
print(div)


问:
R - Filter data to only include date X and following date
I have data structured like below, but with many more columns.

I need to filter the data to include only instances where a person has a date of X and X+1.

In this example only person B and C should remain, and only the rows with directly adjacent dates. So rows 2,3,5,6 should be the only remaining ones.

Once it is filtered I need to count how many times this occurred as well as do calculations on the other values, likely summing up the Values column for the X+1 date.

```<code>Person <- c("A","B","B","B","C","C","D","D")
Date <- c("2021-01-01","2021-01-01","2021-01-02","2021-01-04","2021-01-09","2021-01-10","2021-01-26","2021-01-29")
Values <- c(10,15,6,48,71,3,1,3)

df <- data.frame(Person, Date, Values)
df
</code>```

How would I accomplish this?

答:
```<code>end_points <- df %>%
  mutate(Date = as.Date(Date)) %>%
  group_by(Person) %>%
  filter(Date -  lag(Date) == 1 | lead(Date) - Date == 1) %>%
  ungroup()
</code>```

Result

```<code>end_points
# A tibble: 4 x 3
  Person Date       Values
  <chr>  <date>      <dbl>
1 B      2021-01-01     15
2 B      2021-01-02      6
3 C      2021-01-09     71
4 C      2021-01-10      3
</code>```

2nd part:

```<code>end_points %>%
  group_by(Person) %>%
  slice_max(Date) %>%
  ungroup() %>%
  summarize(total = sum(Values))
</code>```

Body:
I have data structured like below, but with many more columns.

I need to filter the data to include only instances where a person has a date of X and X+1.

In this example only person B and C should remain, and only the rows with directly adjacent dates. So rows 2,3,5,6 should be the only remaining ones.

Once it is filtered I need to count how many times this occurred as well as do calculations on the other values, likely summing up the Values column for the X+1 date.

Person <- c("A","B","B","B","C","C","D","D")
Date <- c("2021-01-01","2021-01-01","2021-01-02","2021-01-04","2021-01-09","2021-01-10","2021-01-26","2021-01-29")
Values <- c(10,15,6,48,71,3,1,3)

df <- data.frame(Person, Date, Values)
df

How would I accomplish this?

Body:
end_points <- df %>%
  mutate(Date = as.Date(Date)) %>%
  group_by(Person) %>%
  filter(Date -  lag(Date) == 1 | lead(Date) - Date == 1) %>%
  ungroup()

Result

end_points
# A tibble: 4 x 3
  Person Date       Values
  <chr>  <date>      <dbl>
1 B      2021-01-01     15
2 B      2021-01-02      6
3 C      2021-01-09     71
4 C      2021-01-10      3

2nd part:

end_points %>%
  group_by(Person) %>%
  slice_max(Date) %>%
  ungroup() %>%
  summarize(total = sum(Values))