问:
Caused by: java.lang.IllegalArgumentException: Not a managed type: class fr.projettresscientifique.reel.referentielreel.model.jpa.CapteurJpa JPA
I am trying to create a Jpa repository for a Capteur Class.

I have javax and not jakarta.

Here is my class.

```<code>package fr.projettresscientifique.reel.referentielreel.model.jpa;

import java.util.UUID;

import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name = "capteurs")
public class CapteurJpa {

    @Id
    @NotNull
    private UUID id;

    @NotNull
    @Embedded
    private CoordonneeJpa coordonnee;

    @Min(value = 0, message = "L'intensité du feu ne peut pas être plus basse que 0")
    @Max(value = 10, message = "L'intensité du feu ne peut pas être plus haute que 10")
    private Integer intensite;

}

</code>```

And here is my CapteurRepository:

```<code>package fr.projettresscientifique.reel.referentielreel.repository;

import java.util.UUID;

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

import fr.projettresscientifique.reel.referentielreel.model.jpa.CapteurJpa;

@Repository
public interface CapteurRepository extends JpaRepository<CapteurJpa, UUID> {

}
</code>```

In my main I added an entityScan:

```<code>package fr.projettresscientifique.reel.referentielreel;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;

@SpringBootApplication
@EntityScan("fr.projettresscientifique.reel.referentielreel.model.jpa")
public class ReferentielReelApplication {

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

}
</code>```

But I still get the managed type error.

I tried using the EntityScan, but the application/main is already in fr.projettresscientifique.reel.referentielreel so in subpackages so should find it.

I am completelty lost, I followed many tutorials and topics to correct different possible things that could cause the error but without finding a solution.

Here is my stack

```<code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'capteurRepository' defined in fr.projettresscientifique.reel.referentielreel.repository.CapteurRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Not a managed type: class fr.projettresscientifique.reel.referentielreel.model.jpa.CapteurJpa
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1751) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:915) ~[spring-context-6.0.2.jar:6.0.2]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[spring-context-6.0.2.jar:6.0.2]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.0.0.jar:3.0.0]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[spring-boot-3.0.0.jar:3.0.0]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432) ~[spring-boot-3.0.0.jar:3.0.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-3.0.0.jar:3.0.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) ~[spring-boot-3.0.0.jar:3.0.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291) ~[spring-boot-3.0.0.jar:3.0.0]
    at fr.projettresscientifique.reel.referentielreel.ReferentielReelApplication.main(ReferentielReelApplication.java:12) ~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-3.0.0.jar:3.0.0]
Caused by: java.lang.IllegalArgumentException: Not a managed type: class fr.projettresscientifique.reel.referentielreel.model.jpa.CapteurJpa
    at org.hibernate.metamodel.model.domain.internal.JpaMetamodelImpl.managedType(JpaMetamodelImpl.java:181) ~[hibernate-core-6.1.6.Final.jar:6.1.6.Final]
    at org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl.managedType(MappingMetamodelImpl.java:496) ~[hibernate-core-6.1.6.Final.jar:6.1.6.Final]
    at org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl.managedType(MappingMetamodelImpl.java:99) ~[hibernate-core-6.1.6.Final.jar:6.1.6.Final]
    at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:77) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getEntityInformation(JpaEntityInformationSupport.java:69) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:246) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:211) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:194) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:81) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:317) ~[spring-data-commons-3.0.0.jar:3.0.0]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:279) ~[spring-data-commons-3.0.0.jar:3.0.0]
    at org.springframework.data.util.Lazy.getNullable(Lazy.java:229) ~[spring-data-commons-3.0.0.jar:3.0.0]
    at org.springframework.data.util.Lazy.get(Lazy.java:113) ~[spring-data-commons-3.0.0.jar:3.0.0]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:285) ~[spring-data-commons-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:132) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747) ~[spring-beans-6.0.2.jar:6.0.2]
    ... 21 common frames omitted

</code>```

Thanks for your help

Tried to create an Entity Class that I linked to a JpaRepository.
I tried using the EntityScan, but the application/main is in fr.projettresscientifique.reel.referentielreel so in subpackages so should find it.
I also tried reading similar threads.
I will also develope a controller.
My goal is to then link it to a postgresql database.

Body:
I am trying to create a Jpa repository for a Capteur Class.

I have javax and not jakarta.

Here is my class.

package fr.projettresscientifique.reel.referentielreel.model.jpa;

import java.util.UUID;

import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name = "capteurs")
public class CapteurJpa {

    @Id
    @NotNull
    private UUID id;

    @NotNull
    @Embedded
    private CoordonneeJpa coordonnee;

    @Min(value = 0, message = "L'intensité du feu ne peut pas être plus basse que 0")
    @Max(value = 10, message = "L'intensité du feu ne peut pas être plus haute que 10")
    private Integer intensite;

}

And here is my CapteurRepository:

package fr.projettresscientifique.reel.referentielreel.repository;

import java.util.UUID;

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

import fr.projettresscientifique.reel.referentielreel.model.jpa.CapteurJpa;

@Repository
public interface CapteurRepository extends JpaRepository<CapteurJpa, UUID> {

}

In my main I added an entityScan:

package fr.projettresscientifique.reel.referentielreel;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;

@SpringBootApplication
@EntityScan("fr.projettresscientifique.reel.referentielreel.model.jpa")
public class ReferentielReelApplication {

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

}

But I still get the managed type error.

I tried using the EntityScan, but the application/main is already in fr.projettresscientifique.reel.referentielreel so in subpackages so should find it.

I am completelty lost, I followed many tutorials and topics to correct different possible things that could cause the error but without finding a solution.

Here is my stack

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'capteurRepository' defined in fr.projettresscientifique.reel.referentielreel.repository.CapteurRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Not a managed type: class fr.projettresscientifique.reel.referentielreel.model.jpa.CapteurJpa
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1751) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:915) ~[spring-context-6.0.2.jar:6.0.2]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[spring-context-6.0.2.jar:6.0.2]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.0.0.jar:3.0.0]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[spring-boot-3.0.0.jar:3.0.0]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432) ~[spring-boot-3.0.0.jar:3.0.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-3.0.0.jar:3.0.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) ~[spring-boot-3.0.0.jar:3.0.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291) ~[spring-boot-3.0.0.jar:3.0.0]
    at fr.projettresscientifique.reel.referentielreel.ReferentielReelApplication.main(ReferentielReelApplication.java:12) ~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-3.0.0.jar:3.0.0]
Caused by: java.lang.IllegalArgumentException: Not a managed type: class fr.projettresscientifique.reel.referentielreel.model.jpa.CapteurJpa
    at org.hibernate.metamodel.model.domain.internal.JpaMetamodelImpl.managedType(JpaMetamodelImpl.java:181) ~[hibernate-core-6.1.6.Final.jar:6.1.6.Final]
    at org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl.managedType(MappingMetamodelImpl.java:496) ~[hibernate-core-6.1.6.Final.jar:6.1.6.Final]
    at org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl.managedType(MappingMetamodelImpl.java:99) ~[hibernate-core-6.1.6.Final.jar:6.1.6.Final]
    at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:77) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getEntityInformation(JpaEntityInformationSupport.java:69) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:246) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:211) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:194) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:81) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:317) ~[spring-data-commons-3.0.0.jar:3.0.0]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:279) ~[spring-data-commons-3.0.0.jar:3.0.0]
    at org.springframework.data.util.Lazy.getNullable(Lazy.java:229) ~[spring-data-commons-3.0.0.jar:3.0.0]
    at org.springframework.data.util.Lazy.get(Lazy.java:113) ~[spring-data-commons-3.0.0.jar:3.0.0]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:285) ~[spring-data-commons-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:132) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747) ~[spring-beans-6.0.2.jar:6.0.2]
    ... 21 common frames omitted

Thanks for your help

Tried to create an Entity Class that I linked to a JpaRepository.
I tried using the EntityScan, but the application/main is in fr.projettresscientifique.reel.referentielreel so in subpackages so should find it.
I also tried reading similar threads.
I will also develope a controller.
My goal is to then link it to a postgresql database.


来源: stackexchange

问:
How to update a column value by another column(foreign key) in another table
I had made a student table link with report table by foreign key to join them.

```<code>CREATE TABLE Students (
    st_id INT NOT NULL AUTO_INCREMENT,
    PRIMARY KEY(st_id),
    student_name varchar(100),
    student_id varchar(9),
    email varchar(100),
    pass varchar(100),
    tp_id INT,
    FOREIGN KEY (tp_id) REFERENCES Training_programs(tp_id)
);

CREATE TABLE Report (
    id INT NOT NULL AUTO_INCREMENT,
    PRIMARY KEY(id),
    st_id INT,
    FOREIGN KEY (st_id) REFERENCES Students(st_id),
    status VARCHAR(100)
);
</code>```

But my problem is when i insert status that i can't insert st_id in the same time because i just insert status in my web. So that i try to auto insert st_id from Students to Report after insert status report:

```<code>CREATE TRIGGER thistrigger BEFORE INSERT
ON Students FOR EACH ROW
UPDATE Report, Students SET Report.st_id = Students.st_id WHERE Report.st_id IS NULL;
</code>```

But it can't work. So that do every ones have any solution with my problem?

ContentLicense: CC BY-SA 4.0

Body:
I had made a student table link with report table by foreign key to join them.

CREATE TABLE Students (
    st_id INT NOT NULL AUTO_INCREMENT,
    PRIMARY KEY(st_id),
    student_name varchar(100),
    student_id varchar(9),
    email varchar(100),
    pass varchar(100),
    tp_id INT,
    FOREIGN KEY (tp_id) REFERENCES Training_programs(tp_id)
);

CREATE TABLE Report (
    id INT NOT NULL AUTO_INCREMENT,
    PRIMARY KEY(id),
    st_id INT,
    FOREIGN KEY (st_id) REFERENCES Students(st_id),
    status VARCHAR(100)
);

But my problem is when i insert status that i can't insert st_id in the same time because i just insert status in my web. So that i try to auto insert st_id from Students to Report after insert status report:

CREATE TRIGGER thistrigger BEFORE INSERT
ON Students FOR EACH ROW
UPDATE Report, Students SET Report.st_id = Students.st_id WHERE Report.st_id IS NULL;

But it can't work. So that do every ones have any solution with my problem?


问:
MFC GetParent function returns null
Hello there back in 1999 early 2000 a lot of my apps used this MFC Export dialog extension which added filters to file extensions, because MFC didn't yet have that (at least that's what I remember to be the reason, maybe I was drunk I don't now), the library can be downloaded here: https://www.codeproject.com/Articles/54/Adding-filters-to-the-Open-File-dialog

Now I know that this functionality is built in already, but its easier to fix one library then to fix all of my apps

Now if I compile this with VC++ 6 everything is fine, the problem is that I would like to use a bit more modern compiler

Here are my changes that I added to this lib over the years (its a big file so I will post a link instead): https://pastebin.com/pj0j2nL4

The example code that I use to test this library can be found here: https://www.mediafire.com/file/xz5mxwy2rcmb9h3/FileExportDialog_demo_upg.zip/file

Just click on File->Export and you should see the problem

Now the problem happens on the library's void CFileExportDialog::OnTypeChange() method
is this part

```<code>CWnd *fileNameBox = GetParent()->GetDlgItem(edt1);
if (fileNameBox == NULL)
    fileNameBox = GetParent()->GetDlgItem(cmb13);
</code>```

For some reason, GetParent() returns NULL (I cannot even get to GetDlgItem() at this point)) pointer, I have no idea why does it do that, and the strangest thing is that this used to work on VC++ 6 (it also worked on MFC7 as well), why doesn't it work on VC++ 17 (MFC140) anymore ?

Hopefully someone has an idea what changed and how can I fix my library

Thanks for Anwsering and Best Regards

Title: MFC GetParent function returns null

Body:
Hello there back in 1999 early 2000 a lot of my apps used this MFC Export dialog extension which added filters to file extensions, because MFC didn't yet have that (at least that's what I remember to be the reason, maybe I was drunk I don't now), the library can be downloaded here: https://www.codeproject.com/Articles/54/Adding-filters-to-the-Open-File-dialog

Now I know that this functionality is built in already, but its easier to fix one library then to fix all of my apps

Now if I compile this with VC++ 6 everything is fine, the problem is that I would like to use a bit more modern compiler

Here are my changes that I added to this lib over the years (its a big file so I will post a link instead): https://pastebin.com/pj0j2nL4

The example code that I use to test this library can be found here: https://www.mediafire.com/file/xz5mxwy2rcmb9h3/FileExportDialog_demo_upg.zip/file

Just click on File->Export and you should see the problem

Now the problem happens on the library's void CFileExportDialog::OnTypeChange() method
is this part

CWnd *fileNameBox = GetParent()->GetDlgItem(edt1);
if (fileNameBox == NULL)
    fileNameBox = GetParent()->GetDlgItem(cmb13);

For some reason, GetParent() returns NULL (I cannot even get to GetDlgItem() at this point)) pointer, I have no idea why does it do that, and the strangest thing is that this used to work on VC++ 6 (it also worked on MFC7 as well), why doesn't it work on VC++ 17 (MFC140) anymore ?

Hopefully someone has an idea what changed and how can I fix my library

Thanks for Anwsering and Best Regards


问:
Generate documentation from Mapstruct code
We generate our mapping with MapStruct and also use the IntelliJ plugin of mapstruct.
Is there a way to generate documentation of this code?

Since we also have some complex custom mappings, it would be great to be able to adapt the documentation. But in first place, we're looking how to automatically generate documentation for the "easy part" of the mappings.


问:
Retreive and parse logs from ADB command test during Github Actions Work
I have a self-hosted MAC runner, on which I run tests using ADB command from the script which connects to device, stops app, delete installed apk, install new apk, during step on which I run tests I see test status output in github action:

```<code>INSTRUMENTATION_STATUS: class=class=com.example.app.screentests
INSTRUMENTATION_STATUS: current=2
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=4
INSTRUMENTATION_STATUS: stream=
INSTRUMENTATION_STATUS: test=test2
INSTRUMENTATION_STATUS_CODE: 1
INSTRUMENTATION_STATUS: class=class=com.example.app.screentests
INSTRUMENTATION_STATUS: current=2
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=4
INSTRUMENTATION_STATUS: stream=.
INSTRUMENTATION_STATUS: test=test2
INSTRUMENTATION_STATUS_CODE: 0
...
</code>```

and in the end test result output

in case of success, test run:

```<code>OK (4 tests)
</code>```

or in case of test run ended with failures

```<code>Tests run: 3, Failures: 1
</code>```

Is there a way to retrieve mentioned lines from "tests" step and parse it to environmental variables and use it later to report into my slack ?

```<code>jobs:
  build:
    ...
  run_tests:
    needs:build
    steps:
    - name: run tests
    ...
    - name: retrieve test results
    ... ???
  report:
   ...
  - name: Slack Notification
    ...
     env:
        ...
        SLACK_MESSAGE: %parse_test_results%
</code>```

Thanks in the advance!

Body:
I have a self-hosted MAC runner, on which I run tests using ADB command from the script which connects to device, stops app, delete installed apk, install new apk, during step on which I run tests I see test status output in github action:

INSTRUMENTATION_STATUS: class=class=com.example.app.screentests
INSTRUMENTATION_STATUS: current=2
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=4
INSTRUMENTATION_STATUS: stream=
INSTRUMENTATION_STATUS: test=test2
INSTRUMENTATION_STATUS_CODE: 1
INSTRUMENTATION_STATUS: class=class=com.example.app.screentests
INSTRUMENTATION_STATUS: current=2
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=4
INSTRUMENTATION_STATUS: stream=.
INSTRUMENTATION_STATUS: test=test2
INSTRUMENTATION_STATUS_CODE: 0
...

and in the end test result output

in case of success, test run:

OK (4 tests)

or in case of test run ended with failures

Tests run: 3, Failures: 1

Is there a way to retrieve mentioned lines from "tests" step and parse it to environmental variables and use it later to report into my slack ?

jobs:
  build:
    ...
  run_tests:
    needs:build
    steps:
    - name: run tests
    ...
    - name: retrieve test results
    ... ???
  report:
   ...
  - name: Slack Notification
    ...
     env:
        ...
        SLACK_MESSAGE: %parse_test_results%

Thanks in the advance!


问:
Linux driver: MFD over PCI
I am writing a driver for a PCI device. The device is a custom development FPGA based device. The FPGA has multiple "devices" on board. I want my driver to create the proper interfaces for those devices.

A certain part of the device will use our own "part". But for I2C busses, I would like to use the already available opencores driver. In the past I had to add the I2C compatible property to the correct "device" in my DTS under my FPGA device (FPGA to CPU was SPI).

Now this has to go over PCI.
The kernel uses my FPGA driver and probes, also created the "own part" as chardev. the I2C opencores drivers ->probe() functions seems not to be called when I create a MFD-cell with the correct compatible property. The cell is added, but never probed.

I use Linux kernel v4.9 on a 64-bit ARM based CPU.

struct x_my_dev {
    struct list_head        x_my_dev;
    struct mfd_cell         *mfd_cell;
    struct device_node      *of_node;
    struct property         *compat_prop;
    struct resource         *irq_resource;
    struct platform_devive      *pdev;
};

...

struct x_my_dev *my_dev;

...
ret = mfd_add_devices(priv->dev, PLATFORM_DEVID_NONE,
            my_dev->mfd_cell, 1, NULL, irq_base, NULL)

if (ret) {
    dev_err(priv->dev, "Failed to add mfd cell\n");
    goto err_mfd_add;
}

...
```

Already checked if the opencores driver is available in the kernel

The kernel /sys/class/my_fpga/device/I2C_bus/ has only 'driver_override', 'modalias', 'power', 'subsystem' and 'uevent'. Nothing that shows what drivers needs to be used.

Title: Linux driver: MFD over PCI

Body:
I am writing a driver for a PCI device. The device is a custom development FPGA based device. The FPGA has multiple "devices" on board. I want my driver to create the proper interfaces for those devices.

A certain part of the device will use our own "part". But for I2C busses, I would like to use the already available opencores driver. In the past I had to add the I2C compatible property to the correct "device" in my DTS under my FPGA device (FPGA to CPU was SPI).

Now this has to go over PCI.
The kernel uses my FPGA driver and probes, also created the "own part" as chardev. the I2C opencores drivers ->probe() functions seems not to be called when I create a MFD-cell with the correct compatible property. The cell is added, but never probed.

I use Linux kernel v4.9 on a 64-bit ARM based CPU.

struct x_my_dev {
    struct list_head        x_my_dev;
    struct mfd_cell         *mfd_cell;
    struct device_node      *of_node;
    struct property         *compat_prop;
    struct resource         *irq_resource;
    struct platform_devive      *pdev;
};

...

struct x_my_dev *my_dev;

...
ret = mfd_add_devices(priv->dev, PLATFORM_DEVID_NONE,
            my_dev->mfd_cell, 1, NULL, irq_base, NULL)

if (ret) {
    dev_err(priv->dev, "Failed to add mfd cell\n");
    goto err_mfd_add;
}

...

Already checked if the opencores driver is available in the kernel

The kernel /sys/class/my_fpga/device/I2C_bus/ has only 'driver_override', 'modalias', 'power', 'subsystem' and 'uevent'. Nothing that shows what drivers needs to be used.


问:
Openstack instance launched is "error" 500
```<code>Message
    Build of instance 15f7f7e3-408f-414e-a1f3-ba3f83b1b2d5 aborted: Volume aaf13a40-c6a0-4829-9992-69157c914d1e did not finish being created even after we waited 261 seconds or 61 attempts. And its status is downloading.
Code
    500
Details
    Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 1992, in _prep_block_device wait_func=self._await_block_device_map_created) File "/usr/lib/python3.6/site-packages/nova/virt/block_device.py", line 874, in attach_block_devices _log_and_attach(device) File "/usr/lib/python3.6/site-packages/nova/virt/block_device.py", line 871, in _log_and_attach bdm.attach(*attach_args, **attach_kwargs) File "/usr/lib/python3.6/site-packages/nova/virt/block_device.py", line 771, in attach wait_func=wait_func, image_id=self.image_id) File "/usr/lib/python3.6/site-packages/nova/virt/block_device.py", line 384, in _create_volume self._call_wait_func(context, wait_func, volume_api, vol['id']) File "/usr/lib/python3.6/site-packages/nova/virt/block_device.py", line 731, in _call_wait_func {'volume_id': volume_id, 'exc': exc}) File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 220, in __exit__ self.force_reraise() File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 196, in force_reraise six.reraise(self.type_, self.value, self.tb) File "/usr/lib/python3.6/site-packages/six.py", line 703, in reraise raise value File "/usr/lib/python3.6/site-packages/nova/virt/block_device.py", line 721, in _call_wait_func wait_func(context, volume_id) File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 1611, in _await_block_device_map_created volume_status=volume_status) nova.exception.VolumeNotCreated: Volume aaf13a40-c6a0-4829-9992-69157c914d1e did not finish being created even after we waited 261 seconds or 61 attempts. And its status is downloading. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 2629, in _build_resources block_device_mapping) File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 2010, in _prep_block_device raise exception.InvalidBDM(six.text_type(ex)) nova.exception.InvalidBDM: Volume aaf13a40-c6a0-4829-9992-69157c914d1e did not finish being created even after we waited 261 seconds or 61 attempts. And its status is downloading. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 2250, in _do_build_and_run_instance filter_properties, request_spec, accel_uuids) File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 2462, in _build_and_run_instance bdms=block_device_mapping, tb=tb) File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 220, in __exit__ self.force_reraise() File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 196, in force_reraise six.reraise(self.type_, self.value, self.tb) File "/usr/lib/python3.6/site-packages/six.py", line 703, in reraise raise value File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 2410, in _build_and_run_instance accel_uuids) as resources: File "/usr/lib64/python3.6/contextlib.py", line 81, in __enter__ return next(self.gen) File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 2639, in _build_resources reason=e.format_message()) nova.exception.BuildAbortException: Build of instance 15f7f7e3-408f-414e-a1f3-ba3f83b1b2d5 aborted: Volume aaf13a40-c6a0-4829-9992-69157c914d1e did not finish being created even after we waited 261 seconds or 61 attempts. And its status is downloading.
</code>```

I Installed OpenStack ussuri in centos 8. everything working fine I tried to launch the instance when launching the instance it showed Build of instance 15f7f7e3-408f-414e-a1f3-ba3f83b1b2d5 aborted: Volume aaf13a40-c6a0-4829-9992-69157c914d1e did not finish being created even after we waited 261 seconds or 61 attempts. And its status is downloading.

Body:
Message
    Build of instance 15f7f7e3-408f-414e-a1f3-ba3f83b1b2d5 aborted: Volume aaf13a40-c6a0-4829-9992-69157c914d1e did not finish being created even after we waited 261 seconds or 61 attempts. And its status is downloading.
Code
    500
Details
    Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 1992, in _prep_block_device wait_func=self._await_block_device_map_created) File "/usr/lib/python3.6/site-packages/nova/virt/block_device.py", line 874, in attach_block_devices _log_and_attach(device) File "/usr/lib/python3.6/site-packages/nova/virt/block_device.py", line 871, in _log_and_attach bdm.attach(*attach_args, **attach_kwargs) File "/usr/lib/python3.6/site-packages/nova/virt/block_device.py", line 771, in attach wait_func=wait_func, image_id=self.image_id) File "/usr/lib/python3.6/site-packages/nova/virt/block_device.py", line 384, in _create_volume self._call_wait_func(context, wait_func, volume_api, vol['id']) File "/usr/lib/python3.6/site-packages/nova/virt/block_device.py", line 731, in _call_wait_func {'volume_id': volume_id, 'exc': exc}) File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 220, in __exit__ self.force_reraise() File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 196, in force_reraise six.reraise(self.type_, self.value, self.tb) File "/usr/lib/python3.6/site-packages/six.py", line 703, in reraise raise value File "/usr/lib/python3.6/site-packages/nova/virt/block_device.py", line 721, in _call_wait_func wait_func(context, volume_id) File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 1611, in _await_block_device_map_created volume_status=volume_status) nova.exception.VolumeNotCreated: Volume aaf13a40-c6a0-4829-9992-69157c914d1e did not finish being created even after we waited 261 seconds or 61 attempts. And its status is downloading. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 2629, in _build_resources block_device_mapping) File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 2010, in _prep_block_device raise exception.InvalidBDM(six.text_type(ex)) nova.exception.InvalidBDM: Volume aaf13a40-c6a0-4829-9992-69157c914d1e did not finish being created even after we waited 261 seconds or 61 attempts. And its status is downloading. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 2250, in _do_build_and_run_instance filter_properties, request_spec, accel_uuids) File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 2462, in _build_and_run_instance bdms=block_device_mapping, tb=tb) File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 220, in __exit__ self.force_reraise() File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 196, in force_reraise six.reraise(self.type_, self.value, self.tb) File "/usr/lib/python3.6/site-packages/six.py", line 703, in reraise raise value File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 2410, in _build_and_run_instance accel_uuids) as resources: File "/usr/lib64/python3.6/contextlib.py", line 81, in __enter__ return next(self.gen) File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 2639, in _build_resources reason=e.format_message()) nova.exception.BuildAbortException: Build of instance 15f7f7e3-408f-414e-a1f3-ba3f83b1b2d5 aborted: Volume aaf13a40-c6a0-4829-9992-69157c914d1e did not finish being created even after we waited 261 seconds or 61 attempts. And its status is downloading.

I Installed OpenStack ussuri in centos 8. everything working fine I tried to launch the instance when launching the instance it showed Build of instance 15f7f7e3-408f-414e-a1f3-ba3f83b1b2d5 aborted: Volume aaf13a40-c6a0-4829-9992-69157c914d1e did not finish being created even after we waited 261 seconds or 61 attempts. And its status is downloading.


问:
how to draw a helix in 3d using fragment shader (shadertoy)
I am relatily new to GLSL.
I want to create a solar system model and use it as a wallpaper (using shadertoy) (Something like this and while i have the planets moving correctly i cant figure out how to do the helix paths that follow those planets.

Here is my code so far

```<code>uniform vec2 iResolution;
uniform float iTime;

#define pi 3.141592653589

float circ(vec2 uv, vec2 pos, float rad, float blur) {
    return smoothstep(blur, 0., length(-uv + pos)-rad); //draws a circle to the screen
}

float line(vec2 uv, vec3 start, vec3 end, float width) {
    vec2 p = uv - start.xy;
    vec2 d = end.xy - start.xy;
    float l = length(d);
    d = normalize(d); //direction
    float t = clamp(dot(p, d), 0., l);
    return (length(p - d*t)) < width ? 1 : 0.;
}

float helix(vec2 uv, vec3 start, vec3 direction, float width, float length, float angle) {
    float delta = iTime / angle;
    vec2 p = uv - start.xy;
    vec2 d = (normalize(direction) * length).xy;
    float l = length(d);
    d /= l;
    float t = clamp(dot(p, d), 0., l);
    return (length(p - d*t)) < width ? 1 : 0.;
}

vec3 rotate(vec3 point, vec3 angle) {
    mat3 rot = mat3(
    cos(angle.y)*cos(angle.z), cos(angle.z)*sin(angle.x)*sin(angle.y)-cos(angle.x)*sin(angle.z), cos(angle.x)*cos(angle.z)*sin(angle.y)+sin(angle.x)*sin(angle.z),
    cos(angle.y)*sin(angle.z), cos(angle.x)*cos(angle.z)+sin(angle.x)*sin(angle.y)*sin(angle.z), -cos(angle.z)*sin(angle.x)+cos(angle.x)*sin(angle.y)*sin(angle.z),
    -sin(angle.y), cos(angle.y)*sin(angle.x), cos(angle.x)*cos(angle.y));
    return rot * point;
}

void main() {
    vec2 uv = fragCoord / iResolution.xy;
    float ratio = iResolution.x / iResolution.y;
    uv -= .5; //center origin
    uv.x = uv.x * ratio;//make screen square
    uv /= .3;//zoom

    float planetA[5] = float[](0., iTime / 0.241, iTime / 0.6152, iTime, iTime / 1.8809);

    vec3 planets[5] = vec3[](
    vec3(0.), // sun
    vec3(cos(planetA[1]) * .4, sin(planetA[1]) * .4, 0.), // mercury
    vec3(cos(planetA[2]) * .7, sin(planetA[2]) * .7, 0.), // venus
    vec3(cos(planetA[3]), sin(planetA[3]), 0.), // earth
    vec3(cos(planetA[4])*1.5, sin(planetA[4])*1.5, 0.)// mars
    );
    vec3 planetsC[5] = vec3[](
    vec3(0.89, 0.9, 0.45), // sun
    vec3(0.54, 0.57, 0.63), // mercury
    vec3(0.9, 0.5, 0.2), // venus
    vec3(0.2, 0.3, 0.8), // earth
    vec3(0.8, 0.3, 0.2)// mars
    );

    vec3 rotVec = vec3(-pi/4, pi/4, 0.);

    fragColor = vec4(0.);

    fragColor = mix(fragColor, vec4(1.), line(uv, vec3(0.), rotate(vec3(0., 0., 2.), rotVec), 0.01)); //sun  trail

    for (int i = 1; i < planets.length(); i++) {
        planets[i] = rotate(planets[i], vec3(-pi/4., pi/4., 0.)); //rotate the planet
        fragColor = mix(fragColor, vec4(planetsC[i], 1.), helix(uv, planets[i], rotate(vec3(0., 0., 2.), rotVec), 0.01, 2., planetA[i])); //planet trail
            }
    for (int i = 0; i < planets.length(); i++) { //draws the planets
        fragColor = mix(fragColor, vec4(planetsC[i], 1.), circ(uv, planets[i].xy, 0.05, 0.01));
    }
}

</code>```

the helix function is currently only a modified version of the line method but i want it to curve around the suns trail.
Any advice and/or help would be appreciated as i am still learing.

I have tried to convert the helix equation:
x = r * cos(t) y = r * sin(t) z = t but havent gotten it to work

heres the method currently, although it only displays a straigt line:

```<code>float helix(vec2 uv, vec3 start, vec3 direction, float width, float length, float angle) {
    float delta = iTime / angle;
    vec2 p = uv - start.xy;
    vec2 d = (normalize(direction) * length).xy;
    float l = length(d);
    d /= l;
    float t = clamp(dot(p, d), 0., l);
    return (length(p - d*t)) < width ? 1 : 0.;
}
</code>```

Body:
I am relatily new to GLSL.
I want to create a solar system model and use it as a wallpaper (using shadertoy) (Something like this and while i have the planets moving correctly i cant figure out how to do the helix paths that follow those planets.

Here is my code so far

uniform vec2 iResolution;
uniform float iTime;

#define pi 3.141592653589

float circ(vec2 uv, vec2 pos, float rad, float blur) {
    return smoothstep(blur, 0., length(-uv + pos)-rad); //draws a circle to the screen
}

float line(vec2 uv, vec3 start, vec3 end, float width) {
    vec2 p = uv - start.xy;
    vec2 d = end.xy - start.xy;
    float l = length(d);
    d = normalize(d); //direction
    float t = clamp(dot(p, d), 0., l);
    return (length(p - d*t)) < width ? 1 : 0.;
}

float helix(vec2 uv, vec3 start, vec3 direction, float width, float length, float angle) {
    float delta = iTime / angle;
    vec2 p = uv - start.xy;
    vec2 d = (normalize(direction) * length).xy;
    float l = length(d);
    d /= l;
    float t = clamp(dot(p, d), 0., l);
    return (length(p - d*t)) < width ? 1 : 0.;
}

vec3 rotate(vec3 point, vec3 angle) {
    mat3 rot = mat3(
    cos(angle.y)*cos(angle.z), cos(angle.z)*sin(angle.x)*sin(angle.y)-cos(angle.x)*sin(angle.z), cos(angle.x)*cos(angle.z)*sin(angle.y)+sin(angle.x)*sin(angle.z),
    cos(angle.y)*sin(angle.z), cos(angle.x)*cos(angle.z)+sin(angle.x)*sin(angle.y)*sin(angle.z), -cos(angle.z)*sin(angle.x)+cos(angle.x)*sin(angle.y)*sin(angle.z),
    -sin(angle.y), cos(angle.y)*sin(angle.x), cos(angle.x)*cos(angle.y));
    return rot * point;
}

void main() {
    vec2 uv = fragCoord / iResolution.xy;
    float ratio = iResolution.x / iResolution.y;
    uv -= .5; //center origin
    uv.x = uv.x * ratio;//make screen square
    uv /= .3;//zoom

    float planetA[5] = float[](0., iTime / 0.241, iTime / 0.6152, iTime, iTime / 1.8809);

    vec3 planets[5] = vec3[](
    vec3(0.), // sun
    vec3(cos(planetA[1]) * .4, sin(planetA[1]) * .4, 0.), // mercury
    vec3(cos(planetA[2]) * .7, sin(planetA[2]) * .7, 0.), // venus
    vec3(cos(planetA[3]), sin(planetA[3]), 0.), // earth
    vec3(cos(planetA[4])*1.5, sin(planetA[4])*1.5, 0.)// mars
    );
    vec3 planetsC[5] = vec3[](
    vec3(0.89, 0.9, 0.45), // sun
    vec3(0.54, 0.57, 0.63), // mercury
    vec3(0.9, 0.5, 0.2), // venus
    vec3(0.2, 0.3, 0.8), // earth
    vec3(0.8, 0.3, 0.2)// mars
    );

    vec3 rotVec = vec3(-pi/4, pi/4, 0.);

    fragColor = vec4(0.);

    fragColor = mix(fragColor, vec4(1.), line(uv, vec3(0.), rotate(vec3(0., 0., 2.), rotVec), 0.01)); //sun  trail

    for (int i = 1; i < planets.length(); i++) {
        planets[i] = rotate(planets[i], vec3(-pi/4., pi/4., 0.)); //rotate the planet
        fragColor = mix(fragColor, vec4(planetsC[i], 1.), helix(uv, planets[i], rotate(vec3(0., 0., 2.), rotVec), 0.01, 2., planetA[i])); //planet trail
            }
    for (int i = 0; i < planets.length(); i++) { //draws the planets
        fragColor = mix(fragColor, vec4(planetsC[i], 1.), circ(uv, planets[i].xy, 0.05, 0.01));
    }
}

the helix function is currently only a modified version of the line method but i want it to curve around the suns trail.
Any advice and/or help would be appreciated as i am still learing.

I have tried to convert the helix equation:
x = r * cos(t) y = r * sin(t) z = t but havent gotten it to work

heres the method currently, although it only displays a straigt line:

float helix(vec2 uv, vec3 start, vec3 direction, float width, float length, float angle) {
    float delta = iTime / angle;
    vec2 p = uv - start.xy;
    vec2 d = (normalize(direction) * length).xy;
    float l = length(d);
    d /= l;
    float t = clamp(dot(p, d), 0., l);
    return (length(p - d*t)) < width ? 1 : 0.;
}


问:
Unable to switch to WEBVIEW in Appium v2 Beta in Android - Error: 'unable to connect to renderer'
Unable to switch to web view context in Appium v2.0.0-beta.46 and v2.0.0-beta.47

Same code working fine in Appium v1.22.3

Error:

Got response with status 500: {"value":{"error":"disconnected","message":"disconnected: unable to connect to renderer\n (failed to check if window was closed: disconnected: unable to connect to renderer

Code:

```<code>//Driver details
capability.setCapability("device", aDevice);
capability.setCapability("newCommandTimeout", 100000);
capability.setCapability("platformName", platform);
capability.setCapability("udid", aUdid);
capability.setCapability("appPackage", appPkg);
capability.setCapability("appActivity", appAct);
capability.setCapability("automationName", "UiAutomator2");
capability.setCapability("setWebContentsDebuggingEnabled", true);

AppiumDriver driver = new AndroidDriver(new URL(serverUrl), capability);

Set<String> contexts = ((SupportsContextSwitching) driver()).getContextHandles();
        System.out.println("CONTEXT="+contexts);  //prints CONTEXT=[NATIVE_APP, WEBVIEW_chrome]
         for (String context : contexts) {
             if (context.contains("WEBVIEW")) {
                 ((SupportsContextSwitching) driver()).context(context);
                 break;
             }
         }

</code>```

Exceptions:

io.appium.java_client.NoSuchContextException: An unknown server-side error occurred while processing the command. Original error: An unknown server-side error occurred while processing the command. Original error: disconnected: unable to connect to renderer
(failed to check if window was closed: disconnected: unable to connect to renderer)
(Session info: chrome=108.0.5359.79)
Build info: version: '4.6.0', revision: '79f1c02ae20'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '12.6', java.version: '11.0.10'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [0b2b612b-473a-456b-a281-842d6e138aa9, switchToContext {name=WEBVIEW_chrome}]
Capabilities {appium:appActivity: com.tech.service..., appium:appPackage: com.tech.service..., appium:applicationCacheEnabled: false, appium:automationName: UIAutomator2, appium:databaseEnabled: false, appium:desired: {appActivity: com.tech.service..., appPackage: com.tech.service..., applicationCacheEnabled: false, automationName: UIAutomator2, device: Pixel 6, newCommandTimeout: 100000, platformName: android, setWebContentsDebuggingEnabled: true, udid: RXCABCD}, appium:device: Pixel 6, appium:deviceApiLevel: 31, appium:deviceManufacturer: samsung, appium:deviceModel: SM-G770F, appium:deviceName: RXCABCD, appium:deviceScreenDensity: 420, appium:deviceScreenSize: 1080x2400, appium:deviceUDID: RXCABCD, appium:javascriptEnabled: true, appium:locationContextEnabled: false, appium:networkConnectionEnabled: true, appium:newCommandTimeout: 100000, appium:pixelRatio: 2.625, appium:platformVersion: 12, appium:setWebContentsDebuggingEnabled: true, appium:statBarHeight: 90, appium:takesScreenshot: true, appium:udid: RXCABCD, appium:viewportRect: {height: 2091, left: 0, top: 90, width: 1080}, appium:warnings: {}, appium:webStorageEnabled: false, platformName: ANDROID}
Session ID: 0b2b612b-473a-456b-a281-842d6e138aa9

Appium Logs:

[debug] [AndroidDriver] Getting a list of available webviews
[debug] [ADB] Running '/Users/tech/Library/Android/sdk/platform-tools/adb -P 5037 -s RXCABCD shell cat /proc/net/unix'
[debug] [AndroidDriver] Parsed 1 active devtools socket: ["@chrome_devtools_remote"]
[debug] [AndroidDriver] Collecting CDP data of 1 webview
[debug] [AndroidDriver] Forwarding remote port chrome_devtools_remote to a local port in range 10900..11000
[debug] [AndroidDriver] You could use the 'webviewDevtoolsPort' capability to customize the starting port number
[debug] [ADB] Running '/Users/tech/Library/Android/sdk/platform-tools/adb -P 5037 -s RXCABCD forward tcp:10900 localabstract:chrome_devtools_remote'
[debug] [ADB] Removing forwarded port socket connection: 10900
[debug] [ADB] Running '/Users/tech/Library/Android/sdk/platform-tools/adb -P 5037 -s RXCABCD forward --remove tcp:10900'
[debug] [AndroidDriver] CDP data collection completed
[debug] [AndroidDriver] Found 1 webview: ["WEBVIEW_chrome"]
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] Available contexts: ["NATIVE_APP","WEBVIEW_chrome"]
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] Connecting to chrome-backed webview context 'WEBVIEW_chrome'
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] Identified chromeAndroidPackage as 'com.android.chrome' for context 'WEBVIEW_chrome' by CDP
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] A port was not given, using random free port: 8000
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] Passing web view details to the Chromedriver constructor: {
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]   "info": {
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "Android-Package": "com.android.chrome",
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "Browser": "Chrome/108.0.5359.79",
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "Protocol-Version": "1.3",
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "User-Agent": "Mozilla/5.0 (Linux; Android 12; SM-G770F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36",
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "V8-Version": "10.8.168.21",
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "WebKit-Version": "537.36 (@5194e1e1073e30a8fc93c72c2aee4bc572f5b07a)",
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "webSocketDebuggerUrl": "ws://127.0.0.1:10900/devtools/browser"
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]   },
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]   "process": {
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "name": "chrome",
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "id": null
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]   }
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] }
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] Automated Chromedriver download is disabled. Use 'chromedriver_autodownload' server feature to enable it
[debug] [AndroidDriver] Precalculated Chromedriver capabilities: {
[debug] [AndroidDriver]   "androidPackage": "com.android.chrome",
[debug] [AndroidDriver]   "androidUseRunningApp": true,
[debug] [AndroidDriver]   "androidDeviceSerial": "RXCABCD"
[debug] [AndroidDriver] }
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] Before starting chromedriver, androidPackage is 'com.android.chrome'
[debug] [Chromedriver@4fe7] Changed state to 'starting'
[debug] [Chromedriver@4fe7] Using the static Chromedriver->Chrome mapping
[debug] [Chromedriver@4fe7] The most recent known Chrome version: 108.0.5359
[debug] [Chromedriver@4fe7] Found 1 executable in '/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac'
[debug] [Chromedriver@4fe7] The following Chromedriver executables were found:
[debug] [Chromedriver@4fe7]     '/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v108.0.5359.71' (version '108.0.5359.71', minimum Chrome version '108.0.5359')
[debug] [Chromedriver@4fe7] Browser version in the supplied details: Chrome/108.0.5359.79
[debug] [Chromedriver@4fe7] Found Chrome bundle 'undefined' version '108.0.5359'
[debug] [Chromedriver@4fe7] Found 1 executable capable of automating Chrome '108.0.5359'.
[debug] [Chromedriver@4fe7] Choosing the most recent, '/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v108.0.5359.71'.
[debug] [Chromedriver@4fe7] If a specific version is required, specify it with the chromedriverExecutabledesired capability.
[Chromedriver@4fe7] Set chromedriver binary as: /Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v108.0.5359.71
[debug] [Chromedriver@4fe7] Killing any old chromedrivers, running: pkill -15 -f "/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v108.0.5359.71.*--port=8000"
[Chromedriver@4fe7] No old chromedrivers seem to exist
[debug] [Chromedriver@4fe7] Cleaning this device's adb forwarded port socket connections: RXCABCD
[debug] [ADB] List forwarding ports
[debug] [ADB] Running '/Users/tech/Library/Android/sdk/platform-tools/adb -P 5037 -s RXCABCD forward --list'
[Chromedriver@4fe7] Spawning chromedriver with: /Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v108.0.5359.71 --port=8000 --adb-port=5037 --verbose
[debug] [Chromedriver@4fe7] Chromedriver version: '108.0.5359.71'
[debug] [Chromedriver@4fe7] Matched '/status' to command name 'getStatus'
[debug] [Chromedriver@4fe7] Proxying [GET /status] to [GET http://127.0.0.1:8000/status] with no body
[debug] [Chromedriver@4fe7] Got response with status 200: {"value":{"build":{"version":"108.0.5359.71 (1e0e3868ee06e91ad636a874420e3ca3ae3756ac-refs/branch-heads/5359@{#1016})"},"message":"ChromeDriver ready for new sessions.","os":{"arch":"x86_64","name":"Mac OS X","version":"12.6.0"},"ready":true}}
[Chromedriver@4fe7] Starting W3C Chromedriver session with capabilities: {
[Chromedriver@4fe7]   "capabilities": {
[Chromedriver@4fe7]     "alwaysMatch": {
[Chromedriver@4fe7]       "goog:chromeOptions": {
[Chromedriver@4fe7]         "androidPackage": "com.android.chrome",
[Chromedriver@4fe7]         "androidUseRunningApp": true,
[Chromedriver@4fe7]         "androidDeviceSerial": "RXCABCD"
[Chromedriver@4fe7]       },
[Chromedriver@4fe7]       "goog:loggingPrefs": {
[Chromedriver@4fe7]         "browser": "ALL"
[Chromedriver@4fe7]       }
[Chromedriver@4fe7]     }
[Chromedriver@4fe7]   }
[Chromedriver@4fe7] }
[debug] [Chromedriver@4fe7] Matched '/session' to command name 'createSession'
[debug] [Chromedriver@4fe7] Proxying [POST /session] to [POST http://127.0.0.1:8000/session] with body: {"capabilities":{"alwaysMatch":{"goog:chromeOptions":{"androidPackage":"com.android.chrome","androidUseRunningApp":true,"androidDeviceSerial":"RXCABCD"},"goog:loggingPrefs":{"browser":"ALL"}}}}
[debug] [Chromedriver@4fe7] Webview version: 'Chrome/108.0.5359.79'
[Chromedriver@4fe7] Got response with status 500: {"value":{"error":"disconnected","message":"disconnected: unable to connect to renderer\n  (failed to check if window was closed: disconnected: unable to connect to renderer)\n  (Session info: chrome=108.0.5359.79)","stacktrace":"0   chromedriver_mac64_v108.0.5359.71   0x0000000101a45f38 chromedriver_mac64_v108.0.5359.71 + 4910904\n1   chromedriver_mac64_v108.0.5359.71   0x00000001019c5a03 chromedriver_mac64_v108.0.5359.71 + 4385283\n2   chromedriver_mac64_v108.0.5359.71   0x000000010160a747 chromedriver_mac64_v108.0.5359.71 + 472903\n3   chromedriver_mac64_v108.0.5359.71   0x00000001015ef7ea chromedriver_mac64_v108.0.5359.71 + 362474\n4   chromedriver_mac64_v108.0.5359.71   0x00000001015dee19 chromedriver_mac64_v108.0.5359.71 + 294425\n5   chromedriver_mac64_v108.0.5359.71   0x00000001015de9f5 chromedriver_mac64_v108.0.5359.71 + 293365\n6   chromedriver_mac64_v108.0.5359.71   0x000000010167e578 chromedriver_mac64_v108.0.5359.71 + 947576\n7   chromedriver_mac64_v108.0.5359.71   0x000000010167dcbf chromedri...
[debug] [W3C] Matched W3C error code 'disconnected' to UnknownError
[debug] [Chromedriver@4fe7] UnknownError: An unknown server-side error occurred while processing the command. Original error: disconnected: unable to connect to renderer
[debug] [Chromedriver@4fe7]   (failed to check if window was closed: disconnected: unable to connect to renderer)
[debug] [Chromedriver@4fe7]   (Session info: chrome=108.0.5359.79)
[debug] [Chromedriver@4fe7]     at errorFromW3CJsonCode (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/@appium/base-driver/lib/protocol/errors.js:928:23)
[debug] [Chromedriver@4fe7]     at ProxyRequestError.getActualError (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/@appium/base-driver/lib/protocol/errors.js:798:14)
[debug] [Chromedriver@4fe7]     at JWProxy.command (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/@appium/base-driver/lib/jsonwp-proxy/proxy.js:340:19)
[debug] [Chromedriver@4fe7]     at processTicksAndRejections (node:internal/process/task_queues:95:5)
[debug] [Chromedriver@4fe7]     at Chromedriver.startSession (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/lib/chromedriver.js:597:5)
[debug] [Chromedriver@4fe7]     at Chromedriver.start (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/lib/chromedriver.js:528:7)
[debug] [Chromedriver@4fe7]     at AndroidUiautomator2Driver.setupNewChromedriver (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:471:3)
[debug] [Chromedriver@4fe7]     at AndroidUiautomator2Driver.startChromedriverProxy (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:217:10)
[debug] [Chromedriver@4fe7]     at AndroidUiautomator2Driver.switchContext (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:124:5)
[debug] [Chromedriver@4fe7]     at AndroidUiautomator2Driver.setContext (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:51:3)
[Chromedriver@4fe7] Chromedriver exited unexpectedly with code null, signal SIGTERM
[debug] [Chromedriver@4fe7] Changed state to 'stopped'
[Chromedriver@4fe7] An unknown server-side error occurred while processing the command. Original error: disconnected: unable to connect to renderer
[Chromedriver@4fe7]   (failed to check if window was closed: disconnected: unable to connect to renderer)
[Chromedriver@4fe7]   (Session info: chrome=108.0.5359.79)
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] Encountered internal error running command: Error: An unknown server-side error occurred while processing the command. Original error: disconnected: unable to connect to renderer
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]   (failed to check if window was closed: disconnected: unable to connect to renderer)
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]   (Session info: chrome=108.0.5359.79)
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     at Object.errorAndThrow (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/@appium/support/lib/logging.js:115:34)
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     at Chromedriver.start (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/lib/chromedriver.js:553:16)
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     at AndroidUiautomator2Driver.setupNewChromedriver (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:471:3)
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     at AndroidUiautomator2Driver.startChromedriverProxy (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:217:10)
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     at AndroidUiautomator2Driver.switchContext (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:124:5)
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     at AndroidUiautomator2Driver.setContext (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:51:3)
[HTTP] <-- POST /wd/hub/session/0b2b612b-473a-456b-a281-842d6e138aa9/context 500 720 ms - 1008

Body:
Unable to switch to web view context in Appium v2.0.0-beta.46 and v2.0.0-beta.47

Same code working fine in Appium v1.22.3

Error:

Got response with status 500: {"value":{"error":"disconnected","message":"disconnected: unable to connect to renderer\n (failed to check if window was closed: disconnected: unable to connect to renderer

Code:

//Driver details
capability.setCapability("device", aDevice);
capability.setCapability("newCommandTimeout", 100000);
capability.setCapability("platformName", platform);
capability.setCapability("udid", aUdid);
capability.setCapability("appPackage", appPkg);
capability.setCapability("appActivity", appAct);
capability.setCapability("automationName", "UiAutomator2");
capability.setCapability("setWebContentsDebuggingEnabled", true);

AppiumDriver driver = new AndroidDriver(new URL(serverUrl), capability);

Set<String> contexts = ((SupportsContextSwitching) driver()).getContextHandles();
        System.out.println("CONTEXT="+contexts);  //prints CONTEXT=[NATIVE_APP, WEBVIEW_chrome]
         for (String context : contexts) {
             if (context.contains("WEBVIEW")) {
                 ((SupportsContextSwitching) driver()).context(context);
                 break;
             }
         }

Exceptions:

io.appium.java_client.NoSuchContextException: An unknown server-side error occurred while processing the command. Original error: An unknown server-side error occurred while processing the command. Original error: disconnected: unable to connect to renderer
(failed to check if window was closed: disconnected: unable to connect to renderer)
(Session info: chrome=108.0.5359.79)
Build info: version: '4.6.0', revision: '79f1c02ae20'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '12.6', java.version: '11.0.10'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [0b2b612b-473a-456b-a281-842d6e138aa9, switchToContext {name=WEBVIEW_chrome}]
Capabilities {appium:appActivity: com.tech.service..., appium:appPackage: com.tech.service..., appium:applicationCacheEnabled: false, appium:automationName: UIAutomator2, appium:databaseEnabled: false, appium:desired: {appActivity: com.tech.service..., appPackage: com.tech.service..., applicationCacheEnabled: false, automationName: UIAutomator2, device: Pixel 6, newCommandTimeout: 100000, platformName: android, setWebContentsDebuggingEnabled: true, udid: RXCABCD}, appium:device: Pixel 6, appium:deviceApiLevel: 31, appium:deviceManufacturer: samsung, appium:deviceModel: SM-G770F, appium:deviceName: RXCABCD, appium:deviceScreenDensity: 420, appium:deviceScreenSize: 1080x2400, appium:deviceUDID: RXCABCD, appium:javascriptEnabled: true, appium:locationContextEnabled: false, appium:networkConnectionEnabled: true, appium:newCommandTimeout: 100000, appium:pixelRatio: 2.625, appium:platformVersion: 12, appium:setWebContentsDebuggingEnabled: true, appium:statBarHeight: 90, appium:takesScreenshot: true, appium:udid: RXCABCD, appium:viewportRect: {height: 2091, left: 0, top: 90, width: 1080}, appium:warnings: {}, appium:webStorageEnabled: false, platformName: ANDROID}
Session ID: 0b2b612b-473a-456b-a281-842d6e138aa9

Appium Logs:

[debug] [AndroidDriver] Getting a list of available webviews
[debug] [ADB] Running '/Users/tech/Library/Android/sdk/platform-tools/adb -P 5037 -s RXCABCD shell cat /proc/net/unix'
[debug] [AndroidDriver] Parsed 1 active devtools socket: ["@chrome_devtools_remote"]
[debug] [AndroidDriver] Collecting CDP data of 1 webview
[debug] [AndroidDriver] Forwarding remote port chrome_devtools_remote to a local port in range 10900..11000
[debug] [AndroidDriver] You could use the 'webviewDevtoolsPort' capability to customize the starting port number
[debug] [ADB] Running '/Users/tech/Library/Android/sdk/platform-tools/adb -P 5037 -s RXCABCD forward tcp:10900 localabstract:chrome_devtools_remote'
[debug] [ADB] Removing forwarded port socket connection: 10900
[debug] [ADB] Running '/Users/tech/Library/Android/sdk/platform-tools/adb -P 5037 -s RXCABCD forward --remove tcp:10900'
[debug] [AndroidDriver] CDP data collection completed
[debug] [AndroidDriver] Found 1 webview: ["WEBVIEW_chrome"]
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] Available contexts: ["NATIVE_APP","WEBVIEW_chrome"]
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] Connecting to chrome-backed webview context 'WEBVIEW_chrome'
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] Identified chromeAndroidPackage as 'com.android.chrome' for context 'WEBVIEW_chrome' by CDP
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] A port was not given, using random free port: 8000
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] Passing web view details to the Chromedriver constructor: {
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]   "info": {
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "Android-Package": "com.android.chrome",
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "Browser": "Chrome/108.0.5359.79",
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "Protocol-Version": "1.3",
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "User-Agent": "Mozilla/5.0 (Linux; Android 12; SM-G770F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36",
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "V8-Version": "10.8.168.21",
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "WebKit-Version": "537.36 (@5194e1e1073e30a8fc93c72c2aee4bc572f5b07a)",
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "webSocketDebuggerUrl": "ws://127.0.0.1:10900/devtools/browser"
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]   },
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]   "process": {
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "name": "chrome",
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     "id": null
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]   }
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] }
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] Automated Chromedriver download is disabled. Use 'chromedriver_autodownload' server feature to enable it
[debug] [AndroidDriver] Precalculated Chromedriver capabilities: {
[debug] [AndroidDriver]   "androidPackage": "com.android.chrome",
[debug] [AndroidDriver]   "androidUseRunningApp": true,
[debug] [AndroidDriver]   "androidDeviceSerial": "RXCABCD"
[debug] [AndroidDriver] }
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] Before starting chromedriver, androidPackage is 'com.android.chrome'
[debug] [Chromedriver@4fe7] Changed state to 'starting'
[debug] [Chromedriver@4fe7] Using the static Chromedriver->Chrome mapping
[debug] [Chromedriver@4fe7] The most recent known Chrome version: 108.0.5359
[debug] [Chromedriver@4fe7] Found 1 executable in '/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac'
[debug] [Chromedriver@4fe7] The following Chromedriver executables were found:
[debug] [Chromedriver@4fe7]     '/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v108.0.5359.71' (version '108.0.5359.71', minimum Chrome version '108.0.5359')
[debug] [Chromedriver@4fe7] Browser version in the supplied details: Chrome/108.0.5359.79
[debug] [Chromedriver@4fe7] Found Chrome bundle 'undefined' version '108.0.5359'
[debug] [Chromedriver@4fe7] Found 1 executable capable of automating Chrome '108.0.5359'.
[debug] [Chromedriver@4fe7] Choosing the most recent, '/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v108.0.5359.71'.
[debug] [Chromedriver@4fe7] If a specific version is required, specify it with the chromedriverExecutabledesired capability.
[Chromedriver@4fe7] Set chromedriver binary as: /Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v108.0.5359.71
[debug] [Chromedriver@4fe7] Killing any old chromedrivers, running: pkill -15 -f "/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v108.0.5359.71.*--port=8000"
[Chromedriver@4fe7] No old chromedrivers seem to exist
[debug] [Chromedriver@4fe7] Cleaning this device's adb forwarded port socket connections: RXCABCD
[debug] [ADB] List forwarding ports
[debug] [ADB] Running '/Users/tech/Library/Android/sdk/platform-tools/adb -P 5037 -s RXCABCD forward --list'
[Chromedriver@4fe7] Spawning chromedriver with: /Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v108.0.5359.71 --port=8000 --adb-port=5037 --verbose
[debug] [Chromedriver@4fe7] Chromedriver version: '108.0.5359.71'
[debug] [Chromedriver@4fe7] Matched '/status' to command name 'getStatus'
[debug] [Chromedriver@4fe7] Proxying [GET /status] to [GET http://127.0.0.1:8000/status] with no body
[debug] [Chromedriver@4fe7] Got response with status 200: {"value":{"build":{"version":"108.0.5359.71 (1e0e3868ee06e91ad636a874420e3ca3ae3756ac-refs/branch-heads/5359@{#1016})"},"message":"ChromeDriver ready for new sessions.","os":{"arch":"x86_64","name":"Mac OS X","version":"12.6.0"},"ready":true}}
[Chromedriver@4fe7] Starting W3C Chromedriver session with capabilities: {
[Chromedriver@4fe7]   "capabilities": {
[Chromedriver@4fe7]     "alwaysMatch": {
[Chromedriver@4fe7]       "goog:chromeOptions": {
[Chromedriver@4fe7]         "androidPackage": "com.android.chrome",
[Chromedriver@4fe7]         "androidUseRunningApp": true,
[Chromedriver@4fe7]         "androidDeviceSerial": "RXCABCD"
[Chromedriver@4fe7]       },
[Chromedriver@4fe7]       "goog:loggingPrefs": {
[Chromedriver@4fe7]         "browser": "ALL"
[Chromedriver@4fe7]       }
[Chromedriver@4fe7]     }
[Chromedriver@4fe7]   }
[Chromedriver@4fe7] }
[debug] [Chromedriver@4fe7] Matched '/session' to command name 'createSession'
[debug] [Chromedriver@4fe7] Proxying [POST /session] to [POST http://127.0.0.1:8000/session] with body: {"capabilities":{"alwaysMatch":{"goog:chromeOptions":{"androidPackage":"com.android.chrome","androidUseRunningApp":true,"androidDeviceSerial":"RXCABCD"},"goog:loggingPrefs":{"browser":"ALL"}}}}
[debug] [Chromedriver@4fe7] Webview version: 'Chrome/108.0.5359.79'
[Chromedriver@4fe7] Got response with status 500: {"value":{"error":"disconnected","message":"disconnected: unable to connect to renderer\n  (failed to check if window was closed: disconnected: unable to connect to renderer)\n  (Session info: chrome=108.0.5359.79)","stacktrace":"0   chromedriver_mac64_v108.0.5359.71   0x0000000101a45f38 chromedriver_mac64_v108.0.5359.71 + 4910904\n1   chromedriver_mac64_v108.0.5359.71   0x00000001019c5a03 chromedriver_mac64_v108.0.5359.71 + 4385283\n2   chromedriver_mac64_v108.0.5359.71   0x000000010160a747 chromedriver_mac64_v108.0.5359.71 + 472903\n3   chromedriver_mac64_v108.0.5359.71   0x00000001015ef7ea chromedriver_mac64_v108.0.5359.71 + 362474\n4   chromedriver_mac64_v108.0.5359.71   0x00000001015dee19 chromedriver_mac64_v108.0.5359.71 + 294425\n5   chromedriver_mac64_v108.0.5359.71   0x00000001015de9f5 chromedriver_mac64_v108.0.5359.71 + 293365\n6   chromedriver_mac64_v108.0.5359.71   0x000000010167e578 chromedriver_mac64_v108.0.5359.71 + 947576\n7   chromedriver_mac64_v108.0.5359.71   0x000000010167dcbf chromedri...
[debug] [W3C] Matched W3C error code 'disconnected' to UnknownError
[debug] [Chromedriver@4fe7] UnknownError: An unknown server-side error occurred while processing the command. Original error: disconnected: unable to connect to renderer
[debug] [Chromedriver@4fe7]   (failed to check if window was closed: disconnected: unable to connect to renderer)
[debug] [Chromedriver@4fe7]   (Session info: chrome=108.0.5359.79)
[debug] [Chromedriver@4fe7]     at errorFromW3CJsonCode (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/@appium/base-driver/lib/protocol/errors.js:928:23)
[debug] [Chromedriver@4fe7]     at ProxyRequestError.getActualError (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/@appium/base-driver/lib/protocol/errors.js:798:14)
[debug] [Chromedriver@4fe7]     at JWProxy.command (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/@appium/base-driver/lib/jsonwp-proxy/proxy.js:340:19)
[debug] [Chromedriver@4fe7]     at processTicksAndRejections (node:internal/process/task_queues:95:5)
[debug] [Chromedriver@4fe7]     at Chromedriver.startSession (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/lib/chromedriver.js:597:5)
[debug] [Chromedriver@4fe7]     at Chromedriver.start (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/lib/chromedriver.js:528:7)
[debug] [Chromedriver@4fe7]     at AndroidUiautomator2Driver.setupNewChromedriver (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:471:3)
[debug] [Chromedriver@4fe7]     at AndroidUiautomator2Driver.startChromedriverProxy (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:217:10)
[debug] [Chromedriver@4fe7]     at AndroidUiautomator2Driver.switchContext (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:124:5)
[debug] [Chromedriver@4fe7]     at AndroidUiautomator2Driver.setContext (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:51:3)
[Chromedriver@4fe7] Chromedriver exited unexpectedly with code null, signal SIGTERM
[debug] [Chromedriver@4fe7] Changed state to 'stopped'
[Chromedriver@4fe7] An unknown server-side error occurred while processing the command. Original error: disconnected: unable to connect to renderer
[Chromedriver@4fe7]   (failed to check if window was closed: disconnected: unable to connect to renderer)
[Chromedriver@4fe7]   (Session info: chrome=108.0.5359.79)
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)] Encountered internal error running command: Error: An unknown server-side error occurred while processing the command. Original error: disconnected: unable to connect to renderer
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]   (failed to check if window was closed: disconnected: unable to connect to renderer)
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]   (Session info: chrome=108.0.5359.79)
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     at Object.errorAndThrow (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/@appium/support/lib/logging.js:115:34)
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     at Chromedriver.start (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/lib/chromedriver.js:553:16)
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     at AndroidUiautomator2Driver.setupNewChromedriver (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:471:3)
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     at AndroidUiautomator2Driver.startChromedriverProxy (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:217:10)
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     at AndroidUiautomator2Driver.switchContext (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:124:5)
[debug] [AndroidUiautomator2Driver@20f3 (0b2b612b)]     at AndroidUiautomator2Driver.setContext (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:51:3)
[HTTP] <-- POST /wd/hub/session/0b2b612b-473a-456b-a281-842d6e138aa9/context 500 720 ms - 1008


问:
Encryption in BigQuery
We have a local historical data source that we want to decommission and move it to BigQuery for storage as well as for analyzing. There are some sensitive fields that we don’t want to be exposed but still want to keep them in BigQuery. We’ve read about the Column level encryption with Cloud KMS  in BigQuery and we see it fits for our purpose - we want to encrypt the sensitive fields in BigQuery. BigQuery offers the function

```<code>AEAD.ENCRYPT
</code>```

to encrypt data with Cloud KMS but we don’t want to move the sensitive data into BigQuery then do the encryption - instead we want to do the encryption at our side before we move the encrypted data into BigQuery that still be able to decrypt using BigQuery AEAD functions . Does anyone know if we can do that using Java or Python?

From BigQuery documentation, they mentioned the keyset is in format google.crypto.tink.Keyset so it is somehow related to Google's tinkey library. Does anyone try it if it would work or if there are other ways?

Title: Encryption in BigQuery

Body:
We have a local historical data source that we want to decommission and move it to BigQuery for storage as well as for analyzing. There are some sensitive fields that we don’t want to be exposed but still want to keep them in BigQuery. We’ve read about the Column level encryption with Cloud KMS  in BigQuery and we see it fits for our purpose - we want to encrypt the sensitive fields in BigQuery. BigQuery offers the function

AEAD.ENCRYPT

to encrypt data with Cloud KMS but we don’t want to move the sensitive data into BigQuery then do the encryption - instead we want to do the encryption at our side before we move the encrypted data into BigQuery that still be able to decrypt using BigQuery AEAD functions . Does anyone know if we can do that using Java or Python?

From BigQuery documentation, they mentioned the keyset is in format google.crypto.tink.Keyset so it is somehow related to Google's tinkey library. Does anyone try it if it would work or if there are other ways?


问:
Why my Blazor webapp hangs and doesnt shows anything in my Browser?
I have built a .net7 webapp (just a simple website). Currently i have the problem, that after starting the app in Debug mode from Visual Studio, the browser shows a blank page. Visual Studio console shows the exception "System.Threading.Tasks.TaskCanceledException" in System.Private.CoreLib.dll and "System.Net.Sockets.SocketException" in System.Net.Http.dll. No other information are visible.

Building the WebHost.CreateDefaultBuilder and host.Run() passes successfully. After stepping throu the code i see, it hangs currently on ManualResetEventSlim.

How can i debug such strange error?


问:
Is it possible to keep officeJS add-in logo same in white mode and dark mode or any other?
I have made a project in excel add-in. There is one issue regarding logo. When I use office default theme the logo is remaining same. but when I use dark theme, the logo will automatically changed. I have attached the screenshot.

Logo in system theme.

Logo in dark theme

I had read all the manifest element but there is nothing any description about this issue.
Can we remain same logo using changes in manifest? or
There is any way to remain same logo in any theme?


问:
Trouble installing pygame on mac
When I try to install pygame on my m2 macbook air. I tried typing 'pip3 install pygame' in terminal and got this message below.
What do I do please?
(I also tried installing pygame in pycharm, in preferences, searching for python interpreter 'pygame'-> There was an error during setup as well.)

--- error message ---

```<code>pip3 install pygame

Collecting pygame
  Using cached pygame-2.1.2.tar.gz (10.1 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]

      WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
      Using Darwin configuration...

      /bin/sh: sdl2-config: command not found
      /bin/sh: sdl2-config: command not found
      /bin/sh: sdl2-config: command not found
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/vp/2s2byv953pz067zymgv2322r0000gn/T/pip-install-lsvr6sz5/pygame_d7522df14ee647b79a1c36db9da0dd2e/setup.py", line 359, in <module>
          buildconfig.config.main(AUTO_CONFIG)
        File "/private/var/folders/vp/2s2byv953pz067zymgv2322r0000gn/T/pip-install-lsvr6sz5/pygame_d7522df14ee647b79a1c36db9da0dd2e/buildconfig/config.py", line 225, in main
          deps = CFG.main(**kwds)
                 ^^^^^^^^^^^^^^^^
        File "/private/var/folders/vp/2s2byv953pz067zymgv2322r0000gn/T/pip-install-lsvr6sz5/pygame_d7522df14ee647b79a1c36db9da0dd2e/buildconfig/config_darwin.py", line 132, in main
          [DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl'])],
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/vp/2s2byv953pz067zymgv2322r0000gn/T/pip-install-lsvr6sz5/pygame_d7522df14ee647b79a1c36db9da0dd2e/buildconfig/config_unix.py", line 39, in __init__
          self.ver = config[0].strip()
                     ~~~~~~^^^
      IndexError: list index out of range

      ---
      For help with compilation see:
          https://www.pygame.org/wiki/MacCompile
      To contribute to pygame development see:
          https://www.pygame.org/contribute.html
      ---

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

</code>```

I tried installing pygame using pip/pip3 in terminal & in pycharm. I was expecting successful installation. I received an error message:

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

&

```<code>  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]

      WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
      Using Darwin configuration...

</code>```

Title: Trouble installing pygame on mac

Body:
When I try to install pygame on my m2 macbook air. I tried typing 'pip3 install pygame' in terminal and got this message below.
What do I do please?
(I also tried installing pygame in pycharm, in preferences, searching for python interpreter 'pygame'-> There was an error during setup as well.)

--- error message ---

pip3 install pygame

Collecting pygame
  Using cached pygame-2.1.2.tar.gz (10.1 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]

      WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
      Using Darwin configuration...

      /bin/sh: sdl2-config: command not found
      /bin/sh: sdl2-config: command not found
      /bin/sh: sdl2-config: command not found
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/vp/2s2byv953pz067zymgv2322r0000gn/T/pip-install-lsvr6sz5/pygame_d7522df14ee647b79a1c36db9da0dd2e/setup.py", line 359, in <module>
          buildconfig.config.main(AUTO_CONFIG)
        File "/private/var/folders/vp/2s2byv953pz067zymgv2322r0000gn/T/pip-install-lsvr6sz5/pygame_d7522df14ee647b79a1c36db9da0dd2e/buildconfig/config.py", line 225, in main
          deps = CFG.main(**kwds)
                 ^^^^^^^^^^^^^^^^
        File "/private/var/folders/vp/2s2byv953pz067zymgv2322r0000gn/T/pip-install-lsvr6sz5/pygame_d7522df14ee647b79a1c36db9da0dd2e/buildconfig/config_darwin.py", line 132, in main
          [DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl'])],
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/vp/2s2byv953pz067zymgv2322r0000gn/T/pip-install-lsvr6sz5/pygame_d7522df14ee647b79a1c36db9da0dd2e/buildconfig/config_unix.py", line 39, in __init__
          self.ver = config[0].strip()
                     ~~~~~~^^^
      IndexError: list index out of range

      ---
      For help with compilation see:
          https://www.pygame.org/wiki/MacCompile
      To contribute to pygame development see:
          https://www.pygame.org/contribute.html
      ---

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I tried installing pygame using pip/pip3 in terminal & in pycharm. I was expecting successful installation. I received an error message:

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

&

  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]

      WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
      Using Darwin configuration...


问:
Makefile: Interpolate variable uuid in command
I want to write a command so it runs using a randomly generated uuid each time, interpolating this variable into the command.

I'm in MacOS, so I can use the uuidgen command

❯ uuidgen
E4BC7525-1EC7-4338-8F4F-8DA268CB7051
```
<p>I want to interpolate this value as part of my command like that:</p>
<pre class="lang-bash prettyprint-override"><code>send-test-sqs-message: ## Send test sqs message to generate an email
  aws sqs send-message "{\"identifier\":$(uuidgen), ..." --output table | cat
</code>```

But the output when running make send-test-sqs-message shows that "identifier" is empty.

Running the command with set -x provides this extra output which doesn't look relevant:

```<code>+_p9k_preexec1:1> _p9k_restore_special_params +_p9k_restore_special_params:1> (( ! 0 )) +_p9k_restore_special_params:7> (( ! 0 )) +_p9k_restore_special_params:11> (( ! 0 )) +_p9k_preexec1:2> unset __p9k_trapint +_p9k_preexec1:3> trap - INT +omz_termsupport_preexec:1> [[ '' != true ]]
</code>```

How can this be fixed?

Body:
I want to write a command so it runs using a randomly generated uuid each time, interpolating this variable into the command.

I'm in MacOS, so I can use the uuidgen command

❯ uuidgen
E4BC7525-1EC7-4338-8F4F-8DA268CB7051

I want to interpolate this value as part of my command like that:

send-test-sqs-message: ## Send test sqs message to generate an email
  aws sqs send-message "{\"identifier\":$(uuidgen), ..." --output table | cat

But the output when running make send-test-sqs-message shows that "identifier" is empty.

Running the command with set -x provides this extra output which doesn't look relevant:

+_p9k_preexec1:1> _p9k_restore_special_params +_p9k_restore_special_params:1> (( ! 0 )) +_p9k_restore_special_params:7> (( ! 0 )) +_p9k_restore_special_params:11> (( ! 0 )) +_p9k_preexec1:2> unset __p9k_trapint +_p9k_preexec1:3> trap - INT +omz_termsupport_preexec:1> [[ '' != true ]]

How can this be fixed?


问:
InteractivePopGestureRecognizer issue on swiping back
I'm navigating to a details screen from chat messages screen. The chat message screen contains custom keyboard which will be presented when chat messages screen is opened. On navigating the screen from chat to details screen everything works fine. When I try to navigate to previous screen(chat screen) using interactivePopGestureRecognizer, keyboard appears on top before the current navigation completes. How to fix this?

I tried by hiding the custom keyboard by hiding based on gesture progress, didn't worked.


问:
How to update an object's method in python
Say I have a class and an object of it.

In Python, you can update the behavior of an object's method by re-assigning the method to a new function. This is possible because methods in Python are just attributes of an object that happen to be functions. Here's an example of how you can do this:

```<code>class MyClass:
    def my_method(self):
        print("Original behavior")

# create an instance of the class
obj = MyClass()

# call the original method
obj.my_method()  # Original behavior
</code>```

and I want to update its method:

```<code># update the method with a new function
def new_behavior(self):
    print("New behavior")

obj.my_method = new_behavior

# call the updated method
obj.my_method()  # New behavior
</code>```

This gives me an error:

```<code>
TypeError: new_behavior() missing 1 required positional argument: 'self'
</code>```

Is this the correct way to update an object's method? How should I do it?

Body:
Say I have a class and an object of it.

In Python, you can update the behavior of an object's method by re-assigning the method to a new function. This is possible because methods in Python are just attributes of an object that happen to be functions. Here's an example of how you can do this:

class MyClass:
    def my_method(self):
        print("Original behavior")

# create an instance of the class
obj = MyClass()

# call the original method
obj.my_method()  # Original behavior

and I want to update its method:

# update the method with a new function
def new_behavior(self):
    print("New behavior")

obj.my_method = new_behavior

# call the updated method
obj.my_method()  # New behavior

This gives me an error:

TypeError: new_behavior() missing 1 required positional argument: 'self'

Is this the correct way to update an object's method? How should I do it?


问:
How can I increase the visibility of my waterfall plot for low values?
I'm trying to increase the visibility of my waterfall plot for the low values. In the figure attached all the lines are supposed to extend to the zero value but the amplitude is so low it's not noticeable. See waterplot here

```<code>#plot waterfall diagram for last harmonic
from matplotlib.colors import Normalize
fig = plt.figure(figsize=(10,10))
for harmonic in range(real_number_of_atsam_harmonics):
    all_spls_diagonal = np.diag(all_spls[harmonic])
    norm = Normalize(all_spls_diagonal.min()+0.0001, all_spls_diagonal.max(), clip=False)
    levels=np.linspace(all_spls_diagonal.min(), all_spls_diagonal.max(), 50)  #change resolution
    ax = plt.contourf(all_frequencies[harmonic], all_speeds[harmonic], all_spls_diagonal, norm=norm, cmap='jet', levels=levels)
plt.colorbar(ax)
plt.xlabel('Frequency [Hz]')
plt.ylabel('Shaft Speed [rpm]')
plt.show()
</code>```

Many thanks,

Body:
I'm trying to increase the visibility of my waterfall plot for the low values. In the figure attached all the lines are supposed to extend to the zero value but the amplitude is so low it's not noticeable. See waterplot here

#plot waterfall diagram for last harmonic
from matplotlib.colors import Normalize
fig = plt.figure(figsize=(10,10))
for harmonic in range(real_number_of_atsam_harmonics):
    all_spls_diagonal = np.diag(all_spls[harmonic])
    norm = Normalize(all_spls_diagonal.min()+0.0001, all_spls_diagonal.max(), clip=False)
    levels=np.linspace(all_spls_diagonal.min(), all_spls_diagonal.max(), 50)  #change resolution
    ax = plt.contourf(all_frequencies[harmonic], all_speeds[harmonic], all_spls_diagonal, norm=norm, cmap='jet', levels=levels)
plt.colorbar(ax)
plt.xlabel('Frequency [Hz]')
plt.ylabel('Shaft Speed [rpm]')
plt.show()

Many thanks,


问:
Most reliable way of determining whether html content is "complete"?
Suppose I have an app that can receive two types of HTML content; either fragmentary (ie, not wrapped in  and not having a ) to be injected into a div or complete HTML to be injected into an iframe. I want to tell the difference between the two kinds of content.

My first thought is to use a regular expression to look for an an  tag, but I need one that won't be fooled by the various ways it could be formed, nor by text in the . What's the most reliable way of doing this? I was hoping for a general language-neutral answer, but the function will almost certainly be written in javascript.


问:
react toastify cannot reading content
```<code>export const LoginForm = () => {
  const setIsLogin = useSetRecoilState(isLoginAtom);
  const [isSubmitting, setIsSubmitting] = useState(false);
  const router = useRouter();
  const onValid = ({ email, password }: LoginProps) => {
    axios
      .post(`/api/auth/token`, {
        email,
        password,
      })
      .then((res) => {
        setIsSubmitting(true);
        setIsLogin(true);
        toast.success('Success Login!');
        router.push('/');
      })
      .catch((err) => {
        console.error(err);
        toast.error('Login Error');
      });
  };
  const {
    register,
    handleSubmit,
    formState: { errors },
  } = useForm<LoginProps>();
  return (
    <>
      <form
        className="flex flex-col mx-auto justify-center items-start mt-10 "
        onSubmit={handleSubmit(onValid)}
      >
        //....
      </form>
    </>
  );
};

// _app.tsx

<div>
 <Component {...pageProps} />
 <ToastContainer
  theme="colored"
  autoClose={3000}
  position="top-center"
  />
</div>

</code>```

I'm using nextjs 12 version.

The code above is part of the code for login. When I log in, I get the following error:

After logging out and logging back in, the error does not appear.

I read the related issue https://github.com/fkhadra/react-toastify/issues/858

That doesn't seem to help much.

Is the part declared in _app.tsx the problem?

Title: react toastify cannot reading content

Body:
export const LoginForm = () => {
  const setIsLogin = useSetRecoilState(isLoginAtom);
  const [isSubmitting, setIsSubmitting] = useState(false);
  const router = useRouter();
  const onValid = ({ email, password }: LoginProps) => {
    axios
      .post(`/api/auth/token`, {
        email,
        password,
      })
      .then((res) => {
        setIsSubmitting(true);
        setIsLogin(true);
        toast.success('Success Login!');
        router.push('/');
      })
      .catch((err) => {
        console.error(err);
        toast.error('Login Error');
      });
  };
  const {
    register,
    handleSubmit,
    formState: { errors },
  } = useForm<LoginProps>();
  return (
    <>
      <form
        className="flex flex-col mx-auto justify-center items-start mt-10 "
        onSubmit={handleSubmit(onValid)}
      >
        //....
      </form>
    </>
  );
};

// _app.tsx

 <Component {...pageProps} />
 <ToastContainer
  theme="colored"
  autoClose={3000}
  position="top-center"
  />

I'm using nextjs 12 version.

The code above is part of the code for login. When I log in, I get the following error:

After logging out and logging back in, the error does not appear.

I read the related issue https://github.com/fkhadra/react-toastify/issues/858

That doesn't seem to help much.

Is the part declared in _app.tsx the problem?