问:
I keep getting an Error while following instructions
```<code># We import pandas into Python
import pandas as pd

# We read in a stock data data file into a data frame and see what it looks like
google_stock = pd.read_csv(r'C:\Users\EXPRESS\OneDrive\Desktop\GOOG.csv',index_col= ['Date'], parse_dates= True, usecols= ['Adj Close', 'Date'])
apple_stock = pd.read_csv(r'C:\Users\EXPRESS\OneDrive\Desktop\AAPL.csv',index_col= ['Date'], parse_dates= True, usecols= ['Adj Close', 'Date'])
amazon_stock = pd.read_csv(r'C:\Users\EXPRESS\OneDrive\Desktop\AMZN.csv',index_col= ['Date'], parse_dates= True, usecols= ['Adj Close', 'Date'])

# We display the google_stock DataFrame
#print(google_stock.head())

# We create calender dates between '2000-01-01' and '2016-12-31'
dates = pd.date_range('2000-01-01', '2016-12-31')

# We create an empty DataFrame that uses dates as indices
all_stocks = pd.DataFrame(index = dates)

# Change the Adj Close column label to Google
google_stock = pd.google_stock.rename(columns = {'Adj Close' : 'Google'})

# Change the Adj Close column label to Apple
apple_stock = pd.apple_stock.rename(column = {'Adj Close' : 'Apple'})

# Change the Adj Close column label to Amazon
amazon_stock = pd.amazon_stock.rename(column = {'Adj Close' : 'Amazon'})

all_stocks = all_stocks.join(google_stock)
all_stocks = all_stocks.join(apple_stock)
all_stocks = all_stocks.join(amazon_stock)
print(all_stocks.head())
print(all_stocks.describe())

I keep getting this error

</code>```

File "c:\Users\EXPRESS\FOLDER_0\pandas mini project.py", line 19, in

google_stock = pd.DataFrame.google_stock.rename(columns = {'Adj Close' : 'Google'})
AttributeError: type object 'DataFrame' has no attribute 'google_stock'

```<code></code>```

Body:
# We import pandas into Python
import pandas as pd

# We read in a stock data data file into a data frame and see what it looks like
google_stock = pd.read_csv(r'C:\Users\EXPRESS\OneDrive\Desktop\GOOG.csv',index_col= ['Date'], parse_dates= True, usecols= ['Adj Close', 'Date'])
apple_stock = pd.read_csv(r'C:\Users\EXPRESS\OneDrive\Desktop\AAPL.csv',index_col= ['Date'], parse_dates= True, usecols= ['Adj Close', 'Date'])
amazon_stock = pd.read_csv(r'C:\Users\EXPRESS\OneDrive\Desktop\AMZN.csv',index_col= ['Date'], parse_dates= True, usecols= ['Adj Close', 'Date'])

# We display the google_stock DataFrame
#print(google_stock.head())

# We create calender dates between '2000-01-01' and '2016-12-31'
dates = pd.date_range('2000-01-01', '2016-12-31')

# We create an empty DataFrame that uses dates as indices
all_stocks = pd.DataFrame(index = dates)

# Change the Adj Close column label to Google
google_stock = pd.google_stock.rename(columns = {'Adj Close' : 'Google'})

# Change the Adj Close column label to Apple
apple_stock = pd.apple_stock.rename(column = {'Adj Close' : 'Apple'})

# Change the Adj Close column label to Amazon
amazon_stock = pd.amazon_stock.rename(column = {'Adj Close' : 'Amazon'})

all_stocks = all_stocks.join(google_stock)
all_stocks = all_stocks.join(apple_stock)
all_stocks = all_stocks.join(amazon_stock)
print(all_stocks.head())
print(all_stocks.describe())

I keep getting this error

File "c:\Users\EXPRESS\FOLDER_0\pandas mini project.py", line 19, in

google_stock = pd.DataFrame.google_stock.rename(columns = {'Adj Close' : 'Google'})
AttributeError: type object 'DataFrame' has no attribute 'google_stock'


来源: stackexchange

问:
Performance Effective JSON data masking Snowflake
I am trying to perform data masking on JSON data.
Using a Javascript UDF to update list of NESTED JPATH attributes similar to what is done here,
https://www.snowflake.com/blog/masking-semi-structured-data-with-snowflake/

Additionally I tried nested OBJECT_INSERT statements to mask a specific attribute but having multiple attributes to mask I have to build a list of subqueries to perform OBJECT INSERT on previous sub query result which is complex.
Ex:

```<code>FROM (
SELECT OBJECT_INSERT(VAR_COL,'LVL1',OBJECT_INSERT(VAR_COL:LVL1,'KEY1',OBJECT_INSERT(VAR_COL:LVL1.KEY1,'KEY2','VALUE',TRUE),TRUE),TRUE) AS VAR_COL
FROM TABLE
)
</code>```

Another problem with OBJECT_INSERT which is not letting me use it is if the JPATH doesn't exists for a specific JSON row it will add that JPATH which I dont want.

I am working with million of records and using XS Warehouse it takes 15 mins to do a simple query using JavaScript UDF.

Alternately, also tried Snowpark UDF but it is also showing very small improvement.

Any idea on improving performance further?

ContentLicense: CC BY-SA 4.0

Body:
I am trying to perform data masking on JSON data.
Using a Javascript UDF to update list of NESTED JPATH attributes similar to what is done here,
https://www.snowflake.com/blog/masking-semi-structured-data-with-snowflake/

Additionally I tried nested OBJECT_INSERT statements to mask a specific attribute but having multiple attributes to mask I have to build a list of subqueries to perform OBJECT INSERT on previous sub query result which is complex.
Ex:

FROM (
SELECT OBJECT_INSERT(VAR_COL,'LVL1',OBJECT_INSERT(VAR_COL:LVL1,'KEY1',OBJECT_INSERT(VAR_COL:LVL1.KEY1,'KEY2','VALUE',TRUE),TRUE),TRUE) AS VAR_COL
FROM TABLE
)

Another problem with OBJECT_INSERT which is not letting me use it is if the JPATH doesn't exists for a specific JSON row it will add that JPATH which I dont want.

I am working with million of records and using XS Warehouse it takes 15 mins to do a simple query using JavaScript UDF.

Alternately, also tried Snowpark UDF but it is also showing very small improvement.

Any idea on improving performance further?


问:
Waiting for Firebase RTDB to update state
I am creating a data context for my react native app. There is an array of property objects in a firebase node and the aim is to pull this data into the app on load and provide that data throughout the app. I have a loader that shows if the loading state is true and should only be false if the data has been successfully pulled from firebase.

The issue I am having is the Loader ends before all the data is called and then the properties are not shown on the home page of the app until i refresh the app again.

Below is the code for the app:

```<code>import { onValue, ref } from 'firebase/database'
import React, {  useEffect, useState } from 'react'
import { projectDatabase } from '../../config'
import useAuth from '../hooks/useAuth'

export const DataContext = React.createContext()

const DataLayer = ({ children }) => {
    const { userCredentials: user } = useAuth() //get user data
    const [company, setCompany] = useState('');
    const [loading, setLoading] = useState(true);
    const [properties, setProperties] = useState([]);

    useEffect(() => {
        const userRef = ref(projectDatabase, 'users/' + user.uid + '/company');
        onValue(userRef, (snapshot) => {
          setCompany(snapshot.val());
          const propertiesRef = ref(projectDatabase, 'providers/' + snapshot.val() + '/properties');
          onValue(propertiesRef, (propertiesSnapshot) => {
        //  console.log(propertiesSnapshot.val())
            setProperties(propertiesSnapshot.val());
            setLoading(false);
          });
        });

    }, [])

    return (
        <DataContext.Provider
            value={{
            properties:properties,
                company: company,
                loading: loading,
                userEnquiries:userEnquiries,
                chatId:chatId,
                acceptedBookings:acceptedBookings
            }}
        >
            {children}
        </DataContext.Provider>
    )
}

export default DataLayer
</code>```

Is there a way to make the call to the firebase RTDB complete BEFORE the loading is resolved as false or do i just do a useEffect call to every page the data is needed? For context the array has 200 properties.

I would really appreciate any help I can get. I love firebase and would really want this to work.

Body:
I am creating a data context for my react native app. There is an array of property objects in a firebase node and the aim is to pull this data into the app on load and provide that data throughout the app. I have a loader that shows if the loading state is true and should only be false if the data has been successfully pulled from firebase.

The issue I am having is the Loader ends before all the data is called and then the properties are not shown on the home page of the app until i refresh the app again.

Below is the code for the app:

import { onValue, ref } from 'firebase/database'
import React, {  useEffect, useState } from 'react'
import { projectDatabase } from '../../config'
import useAuth from '../hooks/useAuth'

export const DataContext = React.createContext()

const DataLayer = ({ children }) => {
    const { userCredentials: user } = useAuth() //get user data
    const [company, setCompany] = useState('');
    const [loading, setLoading] = useState(true);
    const [properties, setProperties] = useState([]);

    useEffect(() => {
        const userRef = ref(projectDatabase, 'users/' + user.uid + '/company');
        onValue(userRef, (snapshot) => {
          setCompany(snapshot.val());
          const propertiesRef = ref(projectDatabase, 'providers/' + snapshot.val() + '/properties');
          onValue(propertiesRef, (propertiesSnapshot) => {
        //  console.log(propertiesSnapshot.val())
            setProperties(propertiesSnapshot.val());
            setLoading(false);
          });
        });

    }, [])

    return (
        <DataContext.Provider
            value={{
            properties:properties,
                company: company,
                loading: loading,
                userEnquiries:userEnquiries,
                chatId:chatId,
                acceptedBookings:acceptedBookings
            }}
        >
            {children}
        </DataContext.Provider>
    )
}

export default DataLayer

Is there a way to make the call to the firebase RTDB complete BEFORE the loading is resolved as false or do i just do a useEffect call to every page the data is needed? For context the array has 200 properties.

I would really appreciate any help I can get. I love firebase and would really want this to work.


问:
mapstruct not working along with annotation processor
I try to combine my custom annotation processor along with mapstruct, it fails. Below is my pom.xml where I am trying to use combine my own custom annotation processor [FieldProperty] with mapstruct, the mapstruct is not generating implementation code. But when I use only mapstruct by removing custom annotation processor then the code is getting generated.

Question:
How to combine custom annotation processor with mapstrct?

```<code><!-- Not sure how to combine mapstruct and custom annotation processor -->
            <!-- Here the mapstruct not generating the code, when ever I add the custom annotation -->

    <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.2</version>
        <!-- If required upgrade the spring boot version here -->
        <relativePath />
        <!-- lookup parent from repository -->
    </parent>
    <groupId>com.mt.mtamp</groupId>
    <artifactId>mt-amp-base-project</artifactId>
    <version>0.0.1</version>
    <packaging>pom</packaging>
    <name>mt-amp-base-project</name>
    <description>Base pom project for all the MT-AMP spring boot projects
    </description>
    <scm>
        <developerConnection>scm:git:origin</developerConnection>
        <url>${CI_PROJECT_URL}</url>
    </scm>
    <properties>
        <java.version>17</java.version>
        <spring-cloud.version>2021.0.3</spring-cloud.version>
        <org.openapitools.jackson-databind-nullable.version>0.2.2
        </org.openapitools.jackson-databind-nullable.version>
        <org.springdoc.springdoc-openapi-ui.version>1.6.8
        </org.springdoc.springdoc-openapi-ui.version>
        <org.mapstruct.version>1.5.2.Final</org.mapstruct.version>
        <version.mapstruct-lombok>0.2.0</version.mapstruct-lombok>
        <org.maven.surefire.version>2.22.2</org.maven.surefire.version>
        <jacoco.version>0.8.7</jacoco.version>
        <!-- Docker Image name : Image Name and version used in JIB(Docker Image
            Creation) and JKUBE (Image Name for Helm chart) -->
        <docker.image.name>${CI_REGISTRY_IMAGE}:latest</docker.image.name>
        <!-- Used in Helm chart deploy, needed for DB Service reference -->
        <chart.releasename>${CI_PROJECT_NAME}</chart.releasename>
        <!-- Deployment.yml template for imagePullSecrets from the Gitlab template
            project -->
        <jkube.resourceDir>.devops/ci/jkube</jkube.resourceDir>
        <!-- Image to be included in HELM chart -->
        <jkube.generator.name>${docker.image.name}</jkube.generator.name>
        <!-- Helm chart outputDir -->
        <jkube.helm.outputDir>.devops/ci/charts/${CI_PROJECT_NAME}
        </jkube.helm.outputDir>
        <jkube.replicas>1</jkube.replicas>
        <helm.source>${project.parent.scm.url}</helm.source>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.6.8</version>
        </dependency>
        <dependency>
            <groupId>org.openapitools</groupId>
            <artifactId>jackson-databind-nullable</artifactId>
            <version>${org.openapitools.jackson-databind-nullable.version}
            </version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <!-- Consul service discovery -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-consul-discovery</artifactId>
        </dependency>
        <!-- lombok dependency -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct</artifactId>
            <version>${org.mapstruct.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct-processor</artifactId>
            <version>${org.mapstruct.version}</version>
        </dependency>
        <!-- Junit 5 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.mt.mtamp</groupId>
            <artifactId>mtamp-exception-handling</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.mt.mtamp</groupId>
            <artifactId>mtamp-custom-annotation</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.mt.mtamp</groupId>
            <artifactId>entity-annotation-processing</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok-mapstruct-binding</artifactId>
            <version>${version.mapstruct-lombok}</version>
        </dependency>
    </dependencies>
    <!-- version management -->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <!-- Build configuration -->
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.openapitools</groupId>
                    <artifactId>openapi-generator-maven-plugin</artifactId>
                    <version>6.0.0</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                            <configuration>
                                <inputSpec>
                                    ${openapi.input.spec}
                                </inputSpec>
                                <templateDirectory>${openapi.input.name.template}
                                </templateDirectory>
                                <generatorName>${openapi.input.name}</generatorName>
                                <apiPackage>${openapi.input.api.package}</apiPackage>
                                <modelPackage>${openapi.input.model.package}</modelPackage>
                                <configOptions>
                                    <useTags>true</useTags>
                                    <serializableModel>true</serializableModel>
                                    <ignoreUnknownJacksonAnnotation>true
                                    </ignoreUnknownJacksonAnnotation>
                                    <interfaceOnly>true</interfaceOnly>
                                    <skipDefaultInterface>true</skipDefaultInterface>
                                </configOptions>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <annotationProcessors>
                            <annotationProcessor>com.mt.mtamp.annotation.processor.FieldProcessor
                            </annotationProcessor>
                            <annotationProcessor>org.mapstruct.ap.MappingProcessor</annotationProcessor>
                        </annotationProcessors>
                        <annotationProcessorPaths>
                            <path>
                                <groupId>com.mt.mtamp</groupId>
                                <artifactId>entity-annotation-processing</artifactId>
                                <version>1.0</version>
                            </path>
                            <path>
                                <groupId>org.mapstruct</groupId>
                                <artifactId>mapstruct-processor</artifactId>
                                <version>${org.mapstruct.version}</version>
                            </path>
                            <path>
                                <groupId>org.projectlombok</groupId>
                                <artifactId>lombok</artifactId>
                                <version>${lombok.version}</version>
                            </path>
                            <path>
                                <groupId>org.projectlombok</groupId>
                                <artifactId>lombok-mapstruct-binding</artifactId>
                                <version>${version.mapstruct-lombok}</version>
                            </path>
                        </annotationProcessorPaths>
                        <compilerArgs>
                            <compilerArg>-Amapstruct.verbose=true</compilerArg>
                            <compilerArg>
                                -Amapstruct.defaultComponentModel=spring</compilerArg>
                            <compilerArg>-AentityGenerator=${entityGenerator}</compilerArg>
                        </compilerArgs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.google.cloud.tools</groupId>
                    <artifactId>jib-maven-plugin</artifactId>
                    <version>3.1.2</version>
                    <configuration>
                        <from>
                            <image>openjdk:17.0.2-jdk</image>
                        </from>
                        <to>
                            <image>${docker.image.name}</image>
                        </to>
                        <container>
                            <creationTime>USE_CURRENT_TIMESTAMP</creationTime>
                        </container>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <excludes>
                            <exclude>
                                <groupId>org.projectlombok</groupId>
                                <artifactId>lombok</artifactId>
                            </exclude>
                        </excludes>
                    </configuration>
                </plugin>

            </plugins>
        </pluginManagement>
        <!-- display active profile in compile phase -->
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-help-plugin</artifactId>
                <executions>
                    <execution>
                        <id>show-profiles</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>active-profiles</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <delimiters>
                        <delimiter>@</delimiter>
                    </delimiters>
                    <useDefaultDelimiters>false</useDefaultDelimiters>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>profile-k8s</id>
            <properties>
                <packaging.type>jar</packaging.type>
            </properties>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-web</artifactId>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>profile-tomcat</id>
            <properties>
                <packaging.type>war</packaging.type>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-web</artifactId>
                    <exclusions>
                        <exclusion>
                            <groupId>org.springframework.boot</groupId>
                            <artifactId>spring-boot-starter-tomcat</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>javax.servlet</groupId>
                    <artifactId>javax.servlet-api</artifactId>
                    <version>4.0.1</version>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>com.mt.mtamp</groupId>
                    <artifactId>mtamp-consul-registration</artifactId>
                    <version>1.0</version>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                        <configuration>
                            <excludeGroupIds>org.apache.tomcat.embed</excludeGroupIds>
                        </configuration>
                    </plugin>
                </plugins>
            </build>

        </profile>
        <profile>
            <id>profile-jetty</id>
            <properties>
                <packaging.type>war</packaging.type>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-web</artifactId>
                    <exclusions>
                        <exclusion>
                            <groupId>org.springframework.boot</groupId>
                            <artifactId>spring-boot-starter-tomcat</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-jetty</artifactId>
                </dependency>
                <dependency>
                    <groupId>com.mt.mtamp</groupId>
                    <artifactId>mtamp-consul-registeration</artifactId>
                    <version>1.0</version>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                        <configuration>
                            <excludeGroupIds>org.apache.tomcat.embed</excludeGroupIds>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>profile-sql</id>
            <properties>
                <spring.profile.from.maven>postgres</spring.profile.from.maven>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>org.postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                </dependency>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-data-jpa</artifactId>
                </dependency>
                <dependency>
                    <groupId>com.mt.mtamp</groupId>
                    <artifactId>mtamp-sql-repository-starter</artifactId>
                    <version>1.0</version>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>profile-nosql</id>
            <properties>
                <spring.profile.from.maven>mongodb</spring.profile.from.maven>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-data-mongodb</artifactId>
                </dependency>
                <dependency>
                    <groupId>com.mt.mtamp</groupId>
                    <artifactId>mtamp-nosql-repository-starter</artifactId>
                    <version>1.0</version>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>
</code>```

I am getting the below exception when I try to combine the both.

```<code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project sql-nosql-service: Compilation failure
[ERROR] /C:/Users/senthiln-1/MT-AMP/sql-nosql-sample-application/src/main/java/com/mt/mtamp/employees/mapper/EmployeeMapper.java:[21,8] No implementation was created for EmployeeMapper due to having a problem in the erroneous element java.util.ArrayList. Hint: this often means that some other annotation processor was supposed to process the erroneous element. You can also enable MapStruct verbose mode by setting -Amapstruct.verbose=true as a compilation argument.
</code>```

Body:
I try to combine my custom annotation processor along with mapstruct, it fails. Below is my pom.xml where I am trying to use combine my own custom annotation processor [FieldProperty] with mapstruct, the mapstruct is not generating implementation code. But when I use only mapstruct by removing custom annotation processor then the code is getting generated.

Question:
How to combine custom annotation processor with mapstrct?

    <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.2</version>

        <relativePath />

    </parent>
    <groupId>com.mt.mtamp</groupId>
    <artifactId>mt-amp-base-project</artifactId>
    <version>0.0.1</version>
    <packaging>pom</packaging>
    <name>mt-amp-base-project</name>
    <description>Base pom project for all the MT-AMP spring boot projects
    </description>
    <scm>
        <developerConnection>scm:git:origin</developerConnection>
        <url>${CI_PROJECT_URL}</url>
    </scm>
    <properties>
        <java.version>17</java.version>
        <spring-cloud.version>2021.0.3</spring-cloud.version>
        <org.openapitools.jackson-databind-nullable.version>0.2.2
        </org.openapitools.jackson-databind-nullable.version>
        <org.springdoc.springdoc-openapi-ui.version>1.6.8
        </org.springdoc.springdoc-openapi-ui.version>
        <org.mapstruct.version>1.5.2.Final</org.mapstruct.version>
        <version.mapstruct-lombok>0.2.0</version.mapstruct-lombok>
        <org.maven.surefire.version>2.22.2</org.maven.surefire.version>
        <jacoco.version>0.8.7</jacoco.version>

        <docker.image.name>${CI_REGISTRY_IMAGE}:latest</docker.image.name>

        <chart.releasename>${CI_PROJECT_NAME}</chart.releasename>

        <jkube.resourceDir>.devops/ci/jkube</jkube.resourceDir>

        <jkube.generator.name>${docker.image.name}</jkube.generator.name>

        <jkube.helm.outputDir>.devops/ci/charts/${CI_PROJECT_NAME}
        </jkube.helm.outputDir>
        <jkube.replicas>1</jkube.replicas>
        <helm.source>${project.parent.scm.url}</helm.source>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.6.8</version>
        </dependency>
        <dependency>
            <groupId>org.openapitools</groupId>
            <artifactId>jackson-databind-nullable</artifactId>
            <version>${org.openapitools.jackson-databind-nullable.version}
            </version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-consul-discovery</artifactId>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct</artifactId>
            <version>${org.mapstruct.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct-processor</artifactId>
            <version>${org.mapstruct.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.mt.mtamp</groupId>
            <artifactId>mtamp-exception-handling</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.mt.mtamp</groupId>
            <artifactId>mtamp-custom-annotation</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.mt.mtamp</groupId>
            <artifactId>entity-annotation-processing</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok-mapstruct-binding</artifactId>
            <version>${version.mapstruct-lombok}</version>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.openapitools</groupId>
                    <artifactId>openapi-generator-maven-plugin</artifactId>
                    <version>6.0.0</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                            <configuration>
                                <inputSpec>
                                    ${openapi.input.spec}
                                </inputSpec>
                                <templateDirectory>${openapi.input.name.template}
                                </templateDirectory>
                                <generatorName>${openapi.input.name}</generatorName>
                                <apiPackage>${openapi.input.api.package}</apiPackage>
                                <modelPackage>${openapi.input.model.package}</modelPackage>
                                <configOptions>
                                    <useTags>true</useTags>
                                    <serializableModel>true</serializableModel>
                                    <ignoreUnknownJacksonAnnotation>true
                                    </ignoreUnknownJacksonAnnotation>
                                    <interfaceOnly>true</interfaceOnly>
                                    <skipDefaultInterface>true</skipDefaultInterface>
                                </configOptions>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <annotationProcessors>
                            <annotationProcessor>com.mt.mtamp.annotation.processor.FieldProcessor
                            </annotationProcessor>
                            <annotationProcessor>org.mapstruct.ap.MappingProcessor</annotationProcessor>
                        </annotationProcessors>
                        <annotationProcessorPaths>
                            <path>
                                <groupId>com.mt.mtamp</groupId>
                                <artifactId>entity-annotation-processing</artifactId>
                                <version>1.0</version>
                            </path>
                            <path>
                                <groupId>org.mapstruct</groupId>
                                <artifactId>mapstruct-processor</artifactId>
                                <version>${org.mapstruct.version}</version>
                            </path>
                            <path>
                                <groupId>org.projectlombok</groupId>
                                <artifactId>lombok</artifactId>
                                <version>${lombok.version}</version>
                            </path>
                            <path>
                                <groupId>org.projectlombok</groupId>
                                <artifactId>lombok-mapstruct-binding</artifactId>
                                <version>${version.mapstruct-lombok}</version>
                            </path>
                        </annotationProcessorPaths>
                        <compilerArgs>
                            <compilerArg>-Amapstruct.verbose=true</compilerArg>
                            <compilerArg>
                                -Amapstruct.defaultComponentModel=spring</compilerArg>
                            <compilerArg>-AentityGenerator=${entityGenerator}</compilerArg>
                        </compilerArgs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.google.cloud.tools</groupId>
                    <artifactId>jib-maven-plugin</artifactId>
                    <version>3.1.2</version>
                    <configuration>
                        <from>
                            <image>openjdk:17.0.2-jdk</image>
                        </from>
                        <to>
                            <image>${docker.image.name}</image>
                        </to>
                        <container>
                            <creationTime>USE_CURRENT_TIMESTAMP</creationTime>
                        </container>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <excludes>
                            <exclude>
                                <groupId>org.projectlombok</groupId>
                                <artifactId>lombok</artifactId>
                            </exclude>
                        </excludes>
                    </configuration>
                </plugin>

            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-help-plugin</artifactId>
                <executions>
                    <execution>
                        <id>show-profiles</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>active-profiles</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <delimiters>
                        <delimiter>@</delimiter>
                    </delimiters>
                    <useDefaultDelimiters>false</useDefaultDelimiters>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>profile-k8s</id>
            <properties>
                <packaging.type>jar</packaging.type>
            </properties>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-web</artifactId>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>profile-tomcat</id>
            <properties>
                <packaging.type>war</packaging.type>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-web</artifactId>
                    <exclusions>
                        <exclusion>
                            <groupId>org.springframework.boot</groupId>
                            <artifactId>spring-boot-starter-tomcat</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>javax.servlet</groupId>
                    <artifactId>javax.servlet-api</artifactId>
                    <version>4.0.1</version>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>com.mt.mtamp</groupId>
                    <artifactId>mtamp-consul-registration</artifactId>
                    <version>1.0</version>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                        <configuration>
                            <excludeGroupIds>org.apache.tomcat.embed</excludeGroupIds>
                        </configuration>
                    </plugin>
                </plugins>
            </build>

        </profile>
        <profile>
            <id>profile-jetty</id>
            <properties>
                <packaging.type>war</packaging.type>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-web</artifactId>
                    <exclusions>
                        <exclusion>
                            <groupId>org.springframework.boot</groupId>
                            <artifactId>spring-boot-starter-tomcat</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-jetty</artifactId>
                </dependency>
                <dependency>
                    <groupId>com.mt.mtamp</groupId>
                    <artifactId>mtamp-consul-registeration</artifactId>
                    <version>1.0</version>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                        <configuration>
                            <excludeGroupIds>org.apache.tomcat.embed</excludeGroupIds>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>profile-sql</id>
            <properties>
                <spring.profile.from.maven>postgres</spring.profile.from.maven>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>org.postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                </dependency>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-data-jpa</artifactId>
                </dependency>
                <dependency>
                    <groupId>com.mt.mtamp</groupId>
                    <artifactId>mtamp-sql-repository-starter</artifactId>
                    <version>1.0</version>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>profile-nosql</id>
            <properties>
                <spring.profile.from.maven>mongodb</spring.profile.from.maven>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-data-mongodb</artifactId>
                </dependency>
                <dependency>
                    <groupId>com.mt.mtamp</groupId>
                    <artifactId>mtamp-nosql-repository-starter</artifactId>
                    <version>1.0</version>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>

I am getting the below exception when I try to combine the both.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project sql-nosql-service: Compilation failure
[ERROR] /C:/Users/senthiln-1/MT-AMP/sql-nosql-sample-application/src/main/java/com/mt/mtamp/employees/mapper/EmployeeMapper.java:[21,8] No implementation was created for EmployeeMapper due to having a problem in the erroneous element java.util.ArrayList. Hint: this often means that some other annotation processor was supposed to process the erroneous element. You can also enable MapStruct verbose mode by setting -Amapstruct.verbose=true as a compilation argument.


问:
Visual Studio has stopped show hints when pointer goes over class names, functions, properties etc
Now there are just small icon that says nothing useful. I've tried to reinstall vs but without any success. It happened with Unity solution but it doesn't seem issue has something to do with Unity, since I've also checked it by creating new solution as a "console application" with the same result.

I've tried to update/reinstall Visual Studio.

Visual Studio community 8.10.25(build2). Mac OS Ventura 13.0.1

I've managed to solve it by downloading installer of vs directly from the site, without Unity Hub. It installs non "community" version of vs instead of what hub does.


问:
Trigger Autocomplete from codebehind in winforms
I have a listbox lstbx1 where there are some 10 diffrent entries and a textbox which has a autosource and autocomplete option to it.

So if I select any item in the listbox which has an entry- John.123458.Newyork
only John will be automatically splitted in code behind and will be shown in the text box and all the persons with John name should be shown in the autocomplete option like

```<code>John.123452
John.452565
John.999995
</code>```

What I tried

```<code>txtBxTargetSignalsToReplaceWith.Text = "John"
txtBx.AutoCompleteSource = AutoCompleteSource.CustomSource
txtBx.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
txtBx.AutoCompleteCustomSource.AddRange(lstNames.ToArray());
</code>```

It is just adding the splitted name John to textbox but not any autocomplete options coming

Body:
I have a listbox lstbx1 where there are some 10 diffrent entries and a textbox which has a autosource and autocomplete option to it.

So if I select any item in the listbox which has an entry- John.123458.Newyork
only John will be automatically splitted in code behind and will be shown in the text box and all the persons with John name should be shown in the autocomplete option like

John.123452
John.452565
John.999995

What I tried

txtBxTargetSignalsToReplaceWith.Text = "John"
txtBx.AutoCompleteSource = AutoCompleteSource.CustomSource
txtBx.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
txtBx.AutoCompleteCustomSource.AddRange(lstNames.ToArray());

It is just adding the splitted name John to textbox but not any autocomplete options coming


问:
Unreal Engine 4.27.2 from source oculus-vr, Avatar blueprint error
After fork the unreal engine 4.27.2 sourece from github, build the ue4 and try to run the project "movementsample. but the error happened form the avatar blueprint. I'm new to unreal engine, so not sure what's the problem and how to solve. Has anyone had the same problem as me or solved it?

I tried to re-create blueprint but is's to hard for me to to it...


问:
misunderstanding as for how index.html knows which script to render
I have the following html file in my public folder:

```<code><!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta
      name="description"
      content="Web site created using create-react-app"
    />
    <link rel="apple-touch-icon" href="%PUBLIC_URL%/juno-icon.png" />
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
    <link
      href="https://fonts.googleapis.com/css2?family=Amatic+SC:wght@700&display=swap"
      rel="stylesheet"
    />
    <title>Issue Report</title>
  </head>

  <body>
    <div id="root"></div>
  </body>
</html>
</code>```

what I don't understand is, how does it know to render my index.tsx file (in src) without me stating any script tag?

```<code>import React from 'react';
import ReactDOM from 'react-dom/client';
import reportWebVitals from './reportWebVitals';
import App from './popup/components/App';
import './popup/styles/index.css';

import { BrowserRouter } from 'react-router-dom';
import { QueryClientProvider, QueryClient } from 'react-query';
import { ReactQueryDevtools } from 'react-query/devtools'

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement
);

const queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      refetchOnWindowFocus: false,
    },
  },
})

root.render(
  <QueryClientProvider client={queryClient}>
    <BrowserRouter>
      <React.StrictMode>
        <App />
      </React.StrictMode>
    </BrowserRouter>
    <ReactQueryDevtools initialIsOpen={true} position='bottom-right' />
  </QueryClientProvider>

);

reportWebVitals();
</code>```

it just seem to render it and it seems like a magic to me o_o

how can it possibly know what file to render?

Body:
I have the following html file in my public folder:

<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta
      name="description"
      content="Web site created using create-react-app"
    />
    <link rel="apple-touch-icon" href="%PUBLIC_URL%/juno-icon.png" />
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
    <link
      href="https://fonts.googleapis.com/css2?family=Amatic+SC:wght@700&display=swap"
      rel="stylesheet"
    />
    <title>Issue Report</title>

what I don't understand is, how does it know to render my index.tsx file (in src) without me stating any script tag?

import React from 'react';
import ReactDOM from 'react-dom/client';
import reportWebVitals from './reportWebVitals';
import App from './popup/components/App';
import './popup/styles/index.css';

import { BrowserRouter } from 'react-router-dom';
import { QueryClientProvider, QueryClient } from 'react-query';
import { ReactQueryDevtools } from 'react-query/devtools'

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement
);

const queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      refetchOnWindowFocus: false,
    },
  },
})

root.render(
  <QueryClientProvider client={queryClient}>
    <BrowserRouter>
      <React.StrictMode>
        <App />
      </React.StrictMode>
    </BrowserRouter>
    <ReactQueryDevtools initialIsOpen={true} position='bottom-right' />
  </QueryClientProvider>

);

reportWebVitals();

it just seem to render it and it seems like a magic to me o_o

how can it possibly know what file to render?


问:
Save custom post fields value before Woocommerce email send
I use the ACF Pro Files field to attach files to WooCommerce emails when an order is marked as Complete. This is the code I have.

```<code>add_filter('woocommerce_email_attachments', 'webroom_attach_to_wc_emails', 10, 3);
function webroom_attach_to_wc_emails($attachments, $email_id, $order)
{

    if (! is_a($order, 'WC_Order') || ! isset($email_id)) {
        return $attachments;
    }

    if ($email_id == 'customer_completed_order') {
        // This gets the order ID
        $order_id = $order->get_id();
        $filename_array = array('x', 'y', 'z');
        foreach ($filename_array as $filename_array_item) {
        $filename_array_item1 = get_post_meta($order_id, $filename_array_item, true);
        $filename_array_item1a =(int)$filename_array_item1;
        $filename_array_item1b = wp_get_attachment_url($filename_array_item1a);
        $filename_array_item1c = get_attached_file($filename_array_item1a);
        if ($filename_array_item1c != '') {
            $attachment1c = $filename_array_item1c;
            if (file_exists($attachment1c)) {
                $attachments[] = $attachment1c;
            } else {

            }
        }

        }
    return $attachments;
    }
}
</code>```

Problem

The attachments to emails only appear if I do it in 2 steps.

Attach file to ACF Pro files field

Hit update

Change order to Completed

Hit update

However, if I attached the files to ACF Pro, changed the order to Completed and hit Update. The email will be sent but no attachment will be attached to the email. In other words, the following steps will result in no attachments to the email sent.

Attach file to ACF Pro files field + Change order to Completed

Hit update

How can I solve this?

Thanks!

Body:
I use the ACF Pro Files field to attach files to WooCommerce emails when an order is marked as Complete. This is the code I have.

add_filter('woocommerce_email_attachments', 'webroom_attach_to_wc_emails', 10, 3);
function webroom_attach_to_wc_emails($attachments, $email_id, $order)
{

    if (! is_a($order, 'WC_Order') || ! isset($email_id)) {
        return $attachments;
    }

    if ($email_id == 'customer_completed_order') {
        // This gets the order ID
        $order_id = $order->get_id();
        $filename_array = array('x', 'y', 'z');
        foreach ($filename_array as $filename_array_item) {
        $filename_array_item1 = get_post_meta($order_id, $filename_array_item, true);
        $filename_array_item1a =(int)$filename_array_item1;
        $filename_array_item1b = wp_get_attachment_url($filename_array_item1a);
        $filename_array_item1c = get_attached_file($filename_array_item1a);
        if ($filename_array_item1c != '') {
            $attachment1c = $filename_array_item1c;
            if (file_exists($attachment1c)) {
                $attachments[] = $attachment1c;
            } else {

            }
        }

        }
    return $attachments;
    }
}

Problem

The attachments to emails only appear if I do it in 2 steps.

Attach file to ACF Pro files field

Hit update

Change order to Completed

Hit update

However, if I attached the files to ACF Pro, changed the order to Completed and hit Update. The email will be sent but no attachment will be attached to the email. In other words, the following steps will result in no attachments to the email sent.

Attach file to ACF Pro files field + Change order to Completed

Hit update

How can I solve this?

Thanks!


问:
I keep gettin the "TypeError: Cannot read properties of undefined (reading 'url')"
So I am connecting to a youtube api that returns the first results of a search, the problem is that for some reason the src of the image (video.bestThumbnail.url), being specific, the .url is not being recognized as a property of bestThumbnail.

This is the part of the code:

const API = 'https://youtube-search-results.p.rapidapi.com/youtube-search/?q=asyncrhony%2Bin%2Bjavascript';

const content = null || document.getElementById('content');

const options = {
    method: 'GET',
    headers: {
        'X-RapidAPI-Key': 'API key here',
        'X-RapidAPI-Host': 'youtube-search-results.p.rapidapi.com'
    }
};

async function fetchData(urlApi) {
    const response = await fetch(urlApi, options);
    const data = await response.json();
    return data;
}

(async () => {
    try {
        const videos = await fetchData(API);
        let view = `
        ${videos.items.map(video => `

                ${video.title}

        `).slice(0, 4).join('')}
        `;
        content.innerHTML = view;
    } catch (error) { console.log(error); }
})();

```

For example if I change the src to a url or just video.bestThumbnail, it does recognize it as an image but it appears on the page as null or undefined (in the latter case). I'm completly lost

Body:
So I am connecting to a youtube api that returns the first results of a search, the problem is that for some reason the src of the image (video.bestThumbnail.url), being specific, the .url is not being recognized as a property of bestThumbnail.

This is the part of the code:

const API = 'https://youtube-search-results.p.rapidapi.com/youtube-search/?q=asyncrhony%2Bin%2Bjavascript';

const content = null || document.getElementById('content');

const options = {
    method: 'GET',
    headers: {
        'X-RapidAPI-Key': 'API key here',
        'X-RapidAPI-Host': 'youtube-search-results.p.rapidapi.com'
    }
};

async function fetchData(urlApi) {
    const response = await fetch(urlApi, options);
    const data = await response.json();
    return data;
}

(async () => {
    try {
        const videos = await fetchData(API);
        let view = `
        ${videos.items.map(video => `

                ${video.title}

        `).slice(0, 4).join('')}
        `;
        content.innerHTML = view;
    } catch (error) { console.log(error); }
})();

For example if I change the src to a url or just video.bestThumbnail, it does recognize it as an image but it appears on the page as null or undefined (in the latter case). I'm completly lost


问:
Why on page load iframe shows loading video and how can i fix it?
When i visit the page the iframe shows loading player which look weird. I want to fix it. Is there a way to fix it ?

Before:

After:

```<code><section class="relative table w-full">
            <div class="container-fluid">
                <div class="grid md:grid-cols-12 grid-cols-1 items-center mt-10 gap-[30px]">
                    <div class="md:col-span-12">
                        <iframe class="w-full aspect-video " src="../src/assets/video/rubyonrails.mp4"></iframe>
                    </div><!--end col-->
                </div><!--end grid-->
            </div><!--end container-->
        </section>
</code>```


问:
Convert data into columns in oracle
How to convert the below data to the desired output:

DAY
NET_SALES
COST_OF_SALES
GROSS_PROFIT

12
500
400
100

11
600
500
100

19
1791
1500
291

16
6300
5350
950

desired output:

DAY
12
11
19
16

NET_SALES
500
600
1791
6300

COST_OF_SALES
400
500
1500
5350

GROSS_PROFIT
100
100
291
950

Title: Convert data into columns in oracle


问:
Getting an error when reading the dataset from roboflow
'm trying to create a object detection module using YOLO V5 following this tutorial YT Link

In this they have used google colab but I want to create it on jupyter note book.
I get the below error when trying to get and read through the data set from roboflow. Please help!

and please tell me how to unzip the file manually(without using a link) and import it into jupyter touse in the for loop !


问:
SpringSecurity: how to handle external authorization
I have to secure a RestApi service made with Spring.

My goal is to:

Decide which controller methods will be secured. I like the annotation approach, so I can annotate only required methods.

Read a token bearer from http header and verify it by an external service. This service will reply with some authentication information.

Use authentication data retrieved from external authorization service inside my controller. I would like to use a custom param object in my controller methods and use it in the business logic.

I underline I don't need to implement the authentication, the token bearer will be sent by client and I just need to verify it.

I tried to follow some tutorials about Spring Security but most of them are MVC implementation with authentication. Probabily my case is more likely a JWT usage with @Secured annotation, however it is not fully clear to me how can I define an external service and how I can inherit the authentication data inside my controller.


问:
Git warning: unable to access '.': Permission denied
I get this warning every time I add a file to git for staging. warning: unable to access '.': Permission denied

I started to get this kind of warnings since I added .gitattributes file to the project. I'm not sure. Git still seems to work properly.

What should I do to solve this warning. I am working in Windows.


问:
how to connect elasticsear API through Cassandra
when i connect elastic search using curl -XGET "http://localhost:9200/" Command through elassandra .show connection refused error

from bin i am running Cassandra -e. here is no error in logs but still not able to access ES on localhost:9200

how to connect elastisearch api through  elassandra


问:
Deploying tkinter project on CircleCi gives and error "no display name and no $DISPLAY environment variable"
When I am trying to deploy the Tkinter project on circles, I am getting the no display name and no $DISPLAY environment variable error even though I have followed the steps mentioned for this error solution

```<code>if os.environ.get('DISPLAY','') == '':
    print('no display found. Using :0.0')
    os.environ.__setitem__('DISPLAY', ':0.0')
</code>```

Body:
When I am trying to deploy the Tkinter project on circles, I am getting the no display name and no $DISPLAY environment variable error even though I have followed the steps mentioned for this error solution

if os.environ.get('DISPLAY','') == '':
    print('no display found. Using :0.0')
    os.environ.__setitem__('DISPLAY', ':0.0')


问:
Refused to load the script because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'"
I'm trying to build a desktop app using Electron.js & React.js and integrate TinyMCE text editor in it. It's my first time using both Electron and tinyMCE, and I've used electron-react-boilerplate to start my project, so I'm fairly lost on the architecture still and where to even begin looking at what to change and where.

At this point, all I've done was create a simple component with the editor, but I am getting the following error:

```<code>Refused to load the script 'https://cdn.tiny.cloud/1/no-api-key/tinymce/6/tinymce.min.js' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
</code>```

Not sure how to make it go away. As it says, my Editor doesn't even show up.

I found this question where the same error was discussed, but all the answers there are apparently unsafe? How do I solve this safely.

This is my index.ejs

```<code><!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'" />
    <title>Pecan</title>
</head>

<body>
    <div id="root"></div>
</body>

</html>
</code>```

This is my App.tsx file

```<code>import { MemoryRouter as Router, Routes, Route } from 'react-router-dom';
import Editor from './pages/editor';

export default function App() {
  return (
    <Router>
      <Routes>
        <Route path="/" element={<Editor />} />
      </Routes>
    </Router>
  );
}
</code>```

My editor component

```<code>import { useRef } from 'react';
import { Editor } from '@tinymce/tinymce-react';

export default () => {
  const editorRef = useRef(null);
  const log = () => {
    if (editorRef.current) {
      console.log(editorRef.current.getContent());
    }
  };

  return (
    <>
      <Editor
        onInit={(evt, editor) => {
          editorRef.current = editor;
        }}
        initialValue="<p>This is the initial content of the editor.</p>"
        init={{
          height: 500,
          menubar: false,
          plugins: [
            'advlist',
            'autolink',
            'lists',
            'link',
            'image',
            'charmap',
            'anchor',
            'searchreplace',
            'visualblocks',
            'code',
            'fullscreen',
            'insertdatetime',
            'media',
            'table',
            'preview',
            'help',
            'wordcount',
          ],
          toolbar:
            'undo redo | blocks | ' +
            'bold italic forecolor | alignleft aligncenter ' +
            'alignright alignjustify | bullist numlist outdent indent | ' +
            'removeformat | help',
          content_style:
            'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }',
        }}
      />
      <button onClick={log} type="button">
        Log editor content
      </button>
    </>
  );
};
</code>```

Body:
I'm trying to build a desktop app using Electron.js & React.js and integrate TinyMCE text editor in it. It's my first time using both Electron and tinyMCE, and I've used electron-react-boilerplate to start my project, so I'm fairly lost on the architecture still and where to even begin looking at what to change and where.

At this point, all I've done was create a simple component with the editor, but I am getting the following error:

Refused to load the script 'https://cdn.tiny.cloud/1/no-api-key/tinymce/6/tinymce.min.js' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

Not sure how to make it go away. As it says, my Editor doesn't even show up.

I found this question where the same error was discussed, but all the answers there are apparently unsafe? How do I solve this safely.

This is my index.ejs

<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'" />
    <title>Pecan</title>

This is my App.tsx file

import { MemoryRouter as Router, Routes, Route } from 'react-router-dom';
import Editor from './pages/editor';

export default function App() {
  return (
    <Router>
      <Routes>
        <Route path="/" element={<Editor />} />
      </Routes>
    </Router>
  );
}

My editor component

import { useRef } from 'react';
import { Editor } from '@tinymce/tinymce-react';

export default () => {
  const editorRef = useRef(null);
  const log = () => {
    if (editorRef.current) {
      console.log(editorRef.current.getContent());
    }
  };

  return (
    <>
      <Editor
        onInit={(evt, editor) => {
          editorRef.current = editor;
        }}
        initialValue="
This is the initial content of the editor.
"
        init={{
          height: 500,
          menubar: false,
          plugins: [
            'advlist',
            'autolink',
            'lists',
            'link',
            'image',
            'charmap',
            'anchor',
            'searchreplace',
            'visualblocks',
            'code',
            'fullscreen',
            'insertdatetime',
            'media',
            'table',
            'preview',
            'help',
            'wordcount',
          ],
          toolbar:
            'undo redo | blocks | ' +
            'bold italic forecolor | alignleft aligncenter ' +
            'alignright alignjustify | bullist numlist outdent indent | ' +
            'removeformat | help',
          content_style:
            'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }',
        }}
      />
      <button onClick={log} type="button">
        Log editor content
      </button>
    </>
  );
};


问:
Zbar package not installed
```<code>Collecting zbar
  Using cached zbar-0.10.zip (31 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Installing collected packages: zbar
  Running setup.py install for zbar: started
  Running setup.py install for zbar: finished with status 'error'

  DEPRECATION: zbar is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  error: subprocess-exited-with-error

  Running setup.py install for zbar did not run successfully.
  exit code: 1

  [5 lines of output]
  C:\Users\Владислав\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
    warnings.warn(
  decoder.c
  C:\Users\‚« ¤Ёб« ў\AppData\Local\Temp\pip-install-1cqnzmpz\zbar_ab9597765fa8408b89ecd86fa8b953eb\zbarmodule.h(26): fatal error C1083: ЌҐ г¤ Ґвбп ®вЄалвм д ©« ўЄ«озҐЁҐ: zbar.h: No such file or directory,
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
  [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

Encountered error while trying to install package.

zbar

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

</code>```

Im trying download mscc
im trying:
python -m pip install –upgrade pip
pip install –upgrade wheel
pip install –upgrade setuptools
pip install gensim

I dont now what i must do

Title: Zbar package not installed

Body:
Collecting zbar
  Using cached zbar-0.10.zip (31 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Installing collected packages: zbar
  Running setup.py install for zbar: started
  Running setup.py install for zbar: finished with status 'error'

  DEPRECATION: zbar is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  error: subprocess-exited-with-error

  Running setup.py install for zbar did not run successfully.
  exit code: 1

  [5 lines of output]
  C:\Users\Владислав\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
    warnings.warn(
  decoder.c
  C:\Users\‚« ¤Ёб« ў\AppData\Local\Temp\pip-install-1cqnzmpz\zbar_ab9597765fa8408b89ecd86fa8b953eb\zbarmodule.h(26): fatal error C1083: ЌҐ г¤ Ґвбп ®вЄалвм д ©« ўЄ«озҐЁҐ: zbar.h: No such file or directory,
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
  [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

Encountered error while trying to install package.

zbar

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

Im trying download mscc
im trying:
python -m pip install –upgrade pip
pip install –upgrade wheel
pip install –upgrade setuptools
pip install gensim

I dont now what i must do


问:
Rotate in Android

Possible Duplicate:

  Android - Rotate Dial

  Android - Rotate image around center point?

How can I rotate a bitmap (not a view or canvas) around its center point when the user touches it and drags it?

I have tried loads of examples on stack overflow and none appear to work.

So far I have:

```<code>double r = Math.atan2(posX - dial.getWidth() / 2, dial.getHeight() / 2 - posY);
rotation = (int) Math.toDegrees(r);
</code>```

ContentLicense: CC BY-SA 3.0

Title: Rotate in Android

Body:
Possible Duplicate:

  Android - Rotate Dial

  Android - Rotate image around center point?

How can I rotate a bitmap (not a view or canvas) around its center point when the user touches it and drags it?

I have tried loads of examples on stack overflow and none appear to work.

So far I have:

double r = Math.atan2(posX - dial.getWidth() / 2, dial.getHeight() / 2 - posY);
rotation = (int) Math.toDegrees(r);


问:
Form cant send to email (php, ajax)
My form cant send to my email, its say ERROR 500 at form/contact.php , anyone can help me where the problem?

this is my form:

this is my form/contact.php

this is my assets/vendor/php-email-form/php-email-form.php

```<code><?php

// receive form submission data
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];

// set the email details
$to = 'example@example.id';
$headers = "From: $email\r\n";
$headers .= "Reply-To: $email\r\n";

// send the email and check for errors
if (mail($to, $subject, $message, $headers)) {
    // email sent successfully
    echo "Email sent!";
} else {
    // email sending failed
    echo "Error: Unable to send email";
}
?>
</code>```

this is my assets/vendor/php-email-form/validate.js

```<code>(function () {
  "use strict";

  let forms = document.querySelectorAll('.php-email-form');

  forms.forEach( function(e) {
    e.addEventListener('submit', function(event) {
      event.preventDefault();

      let thisForm = this;

      let action = thisForm.getAttribute('action');
      let recaptcha = thisForm.getAttribute('data-recaptcha-site-key');

      if( ! action ) {
        displayError(thisForm, 'The form action property is not set!')
        return;
      }
      thisForm.querySelector('.loading').classList.add('d-block');
      thisForm.querySelector('.error-message').classList.remove('d-block');
      thisForm.querySelector('.sent-message').classList.remove('d-block');

      let formData = new FormData( thisForm );

      if ( recaptcha ) {
        if(typeof grecaptcha !== "undefined" ) {
          grecaptcha.ready(function() {
            try {
              grecaptcha.execute(recaptcha, {action: 'php_email_form_submit'})
              .then(token => {
                formData.set('recaptcha-response', token);
                php_email_form_submit(thisForm, action, formData);
              })
            } catch(error) {
              displayError(thisForm, error)
            }
          });
        } else {
          displayError(thisForm, 'The reCaptcha javascript API url is not loaded!')
        }
      } else {
        php_email_form_submit(thisForm, action, formData);
      }
    });
  });

  function php_email_form_submit(thisForm, action, formData) {
    fetch(action, {
      method: 'POST',
      body: formData,
      headers: {'X-Requested-With': 'XMLHttpRequest'}
    })
    .then(response => {
      if( response.ok ) {
        return response.text()
      } else {
        throw new Error(`${response.status} ${response.statusText} ${response.url}`);
      }
    })
    .then(data => {
      thisForm.querySelector('.loading').classList.remove('d-block');
      if (data.trim() == 'OK') {
        thisForm.querySelector('.sent-message').classList.add('d-block');
        thisForm.reset();
      } else {
        throw new Error(data ? data : 'Form submission failed and no error message returned from: ' + action);
      }
    })
    .catch((error) => {
      displayError(thisForm, error);
    });
  }

  function displayError(thisForm, error) {
    thisForm.querySelector('.loading').classList.remove('d-block');
    thisForm.querySelector('.error-message').innerHTML = error;
    thisForm.querySelector('.error-message').classList.add('d-block');
  }

})();
</code>```

i dont know where the problem, can anyone help me?

Title: Form cant send to email (php, ajax)

Body:
My form cant send to my email, its say ERROR 500 at form/contact.php , anyone can help me where the problem?

this is my form:

this is my form/contact.php

this is my assets/vendor/php-email-form/php-email-form.php

<?php

// receive form submission data
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];

// set the email details
$to = 'example@example.id';
$headers = "From: $email\r\n";
$headers .= "Reply-To: $email\r\n";

// send the email and check for errors
if (mail($to, $subject, $message, $headers)) {
    // email sent successfully
    echo "Email sent!";
} else {
    // email sending failed
    echo "Error: Unable to send email";
}
?>

this is my assets/vendor/php-email-form/validate.js

(function () {
  "use strict";

  let forms = document.querySelectorAll('.php-email-form');

  forms.forEach( function(e) {
    e.addEventListener('submit', function(event) {
      event.preventDefault();

      let thisForm = this;

      let action = thisForm.getAttribute('action');
      let recaptcha = thisForm.getAttribute('data-recaptcha-site-key');

      if( ! action ) {
        displayError(thisForm, 'The form action property is not set!')
        return;
      }
      thisForm.querySelector('.loading').classList.add('d-block');
      thisForm.querySelector('.error-message').classList.remove('d-block');
      thisForm.querySelector('.sent-message').classList.remove('d-block');

      let formData = new FormData( thisForm );

      if ( recaptcha ) {
        if(typeof grecaptcha !== "undefined" ) {
          grecaptcha.ready(function() {
            try {
              grecaptcha.execute(recaptcha, {action: 'php_email_form_submit'})
              .then(token => {
                formData.set('recaptcha-response', token);
                php_email_form_submit(thisForm, action, formData);
              })
            } catch(error) {
              displayError(thisForm, error)
            }
          });
        } else {
          displayError(thisForm, 'The reCaptcha javascript API url is not loaded!')
        }
      } else {
        php_email_form_submit(thisForm, action, formData);
      }
    });
  });

  function php_email_form_submit(thisForm, action, formData) {
    fetch(action, {
      method: 'POST',
      body: formData,
      headers: {'X-Requested-With': 'XMLHttpRequest'}
    })
    .then(response => {
      if( response.ok ) {
        return response.text()
      } else {
        throw new Error(`${response.status} ${response.statusText} ${response.url}`);
      }
    })
    .then(data => {
      thisForm.querySelector('.loading').classList.remove('d-block');
      if (data.trim() == 'OK') {
        thisForm.querySelector('.sent-message').classList.add('d-block');
        thisForm.reset();
      } else {
        throw new Error(data ? data : 'Form submission failed and no error message returned from: ' + action);
      }
    })
    .catch((error) => {
      displayError(thisForm, error);
    });
  }

  function displayError(thisForm, error) {
    thisForm.querySelector('.loading').classList.remove('d-block');
    thisForm.querySelector('.error-message').innerHTML = error;
    thisForm.querySelector('.error-message').classList.add('d-block');
  }

})();

i dont know where the problem, can anyone help me?


问:
React Native WebView Back Button
I want Webview to open the previous page when I press the back button on the phone. How can I do it? What do I need to add where in my code?

I tried the Handler concept, but I always got the error that the go Back() function does not exist. What do I need to add where in my code?

```<code>import * as React from 'react';
import { StyleSheet } from 'react-native';
import WebView from 'react-native-webview';
import EditScreenInfo from '../components/EditScreenInfo';
import { Text, View } from '../components/Themed';
import { RootTabScreenProps } from '../types';

export default function TabOneScreen({ navigation }: RootTabScreenProps<'TabOne'>) {

  return (
    <WebView
    style={styles.container}
    source={{ uri:'https://www.ankarajantlastik.com/index.php?route=common/home' }}

  />
  );
  }

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
   },
  title: {
    fontSize: 20,
    fontWeight: 'bold',
   },
  separator: {
    marginVertical: 30,
    height: 1,
    width: '80%',
   },
 });
</code>```

Title: React Native WebView Back Button

Body:
I want Webview to open the previous page when I press the back button on the phone. How can I do it? What do I need to add where in my code?

I tried the Handler concept, but I always got the error that the go Back() function does not exist. What do I need to add where in my code?

import * as React from 'react';
import { StyleSheet } from 'react-native';
import WebView from 'react-native-webview';
import EditScreenInfo from '../components/EditScreenInfo';
import { Text, View } from '../components/Themed';
import { RootTabScreenProps } from '../types';

export default function TabOneScreen({ navigation }: RootTabScreenProps<'TabOne'>) {

  return (
    <WebView
    style={styles.container}
    source={{ uri:'https://www.ankarajantlastik.com/index.php?route=common/home' }}

  />
  );
  }

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
   },
  title: {
    fontSize: 20,
    fontWeight: 'bold',
   },
  separator: {
    marginVertical: 30,
    height: 1,
    width: '80%',
   },
 });


问:
Random syntax error in js script, what causes can it be?
i'm getting random syntax errors in js files, sometimes in my bundle, sometimes other files, like fabric.min.js which i know works fine, and i can't figure it out.

For example lately i got :

```<code>bundle.js Uncaught SyntaxError: Unexpected token ) at 2:261833
</code>```

which point to this function :

return function (t, n, a, o) {
    if (!e(n)) {
        var u, l = !1, h = [];
        if (e(t)) l = !0, f(n, h); else {
            var d = r(t.nodeType);
            if (!d && sr(t, n)) O(t, n, h, null, null, o); else {
                if (d) {
                    if (1 === t.nodeType && t.hasAttribute(I) && (t.removeAttribute(I), a = !0), i(a) && A(t, n, h)) return S(n, h, !0), t;
                    u = t, t = new pt(c.tagName(u).toLowerCase(), {}, [], void 0, u)
                }
                var p = t.elm, m = c.parentNode(p);
                if (f(n, h, p._leaveCb ? null : m, c.nextSibling(p)), r(n.parent)) for (var g = n.parent, y = v(n); g;) {
                    for (var _ = 0; _ < s.destroy.length; ++_) s.destroy[_](g);
                    if (g.elm = n.elm, y) {
                        for (var x = 0; x < s.create.length; ++x) s.create[x](ar, g);
                        var k = g.data.hook.insert;
                        if (k.merged) for (var T = 1; T < k.fns.length; T++) k.fns[T]()
                    } else ir(g);
                    g = g.parent
                }
                r(m) ? w([t], 0, 0) : r(t.tag) && b(t)// error here at 0)
            }
        }
        return S(n, h, l), n.elm
    }
    r(t) && b(t)
}
```

which is a function inside vue, i think it's the patch function.
When browser is restarted, it fixes the issue for some times, but in the end it comes back.

I was thinking about SRI but since we use file:// protocol (app is loaded locally in a webview inside android), i can't do that.

I'm tracking this issue for weeks without success,
how can a valid file become invalid and trigger syntax error ? can it be some cache issue ?

I know it's kind of a broad question, and i don't have much code to show, if you have any idea on how i could debug that or what could be the culprit here, like filesystem/hardware issue.

Thanks.

Body:
i'm getting random syntax errors in js files, sometimes in my bundle, sometimes other files, like fabric.min.js which i know works fine, and i can't figure it out.

For example lately i got :

bundle.js Uncaught SyntaxError: Unexpected token ) at 2:261833

which point to this function :

return function (t, n, a, o) {
    if (!e(n)) {
        var u, l = !1, h = [];
        if (e(t)) l = !0, f(n, h); else {
            var d = r(t.nodeType);
            if (!d && sr(t, n)) O(t, n, h, null, null, o); else {
                if (d) {
                    if (1 === t.nodeType && t.hasAttribute(I) && (t.removeAttribute(I), a = !0), i(a) && A(t, n, h)) return S(n, h, !0), t;
                    u = t, t = new pt(c.tagName(u).toLowerCase(), {}, [], void 0, u)
                }
                var p = t.elm, m = c.parentNode(p);
                if (f(n, h, p._leaveCb ? null : m, c.nextSibling(p)), r(n.parent)) for (var g = n.parent, y = v(n); g;) {
                    for (var _ = 0; _ < s.destroy.length; ++_) s.destroy[_](g);
                    if (g.elm = n.elm, y) {
                        for (var x = 0; x < s.create.length; ++x) s.create[x](ar, g);
                        var k = g.data.hook.insert;
                        if (k.merged) for (var T = 1; T < k.fns.length; T++) k.fns[T]()
                    } else ir(g);
                    g = g.parent
                }
                r(m) ? w([t], 0, 0) : r(t.tag) && b(t)// error here at 0)
            }
        }
        return S(n, h, l), n.elm
    }
    r(t) && b(t)
}

which is a function inside vue, i think it's the patch function.
When browser is restarted, it fixes the issue for some times, but in the end it comes back.

I was thinking about SRI but since we use file:// protocol (app is loaded locally in a webview inside android), i can't do that.

I'm tracking this issue for weeks without success,
how can a valid file become invalid and trigger syntax error ? can it be some cache issue ?

I know it's kind of a broad question, and i don't have much code to show, if you have any idea on how i could debug that or what could be the culprit here, like filesystem/hardware issue.

Thanks.


问:
How to change the backcolor of this tab control?
I want to change the background color of a custom control that I found on the internet.
The code looks like this:

```<code>using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace BetterNotepad
{
    public class TabControlZ : System.Windows.Forms.TabControl
    {
        private Color nonactive_color1 = Color.LightGreen;
        private Color nonactive_color2 = Color.DarkBlue;
        private Color backcolor = Color.WhiteSmoke;
        private Color active_color1 = Color.FromArgb(255, 210, 250, 220);
        private Color active_color2 = Color.FromArgb(255, 140, 160, 200);
        public Color forecolor = Color.Navy;
        private int color1Transparent = 150;
        private int color2Transparent = 150;
        private System.ComponentModel.IContainer components;
        private int angle = 90;

        public Color ActiveTabStartColor
        {
            get { return active_color1; }
            set { active_color1 = value; Invalidate(); }
        }
        public Color ActiveTabEndColor
        {
            get { return active_color2; }
            set { active_color2 = value; Invalidate(); }
        }
        public Color NonActiveTabStartColor
        {
            get { return nonactive_color1; }
            set { nonactive_color1 = value; Invalidate(); }
        }
        public Color NonActiveTabEndColor
        {
            get { return nonactive_color2; }
            set { nonactive_color2 = value; Invalidate(); }
        }

        public Color BackroudColor
        {
            get { return backcolor; }
            set { backcolor = value; Invalidate(); }
        }
        public int Transparent1
        {
            get { return color1Transparent; }
            set
            {
                color1Transparent = value;
                if (color1Transparent > 255)
                {
                    color1Transparent = 255;
                    Invalidate();
                }
                else
                    Invalidate();
            }
        }

        public int Transparent2
        {
            get { return color2Transparent; }
            set
            {
                color2Transparent = value;
                if (color2Transparent > 255)
                {
                    color2Transparent = 255;
                    Invalidate();
                }
                else
                    Invalidate();
            }
        }
        public int GradientAngle
        {
            get { return angle; }
            set { angle = value; Invalidate(); }
        }
        public Color TextColor
        {
            get { return forecolor; }
            set { forecolor = value; Invalidate(); }
        }

        public TabControlZ()
        {
            this.DrawMode = TabDrawMode.OwnerDrawFixed;
            this.Padding = new System.Drawing.Point(30, 4);
        }

        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);
        }
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            base.OnDrawItem(e);

            Rectangle rc = GetTabRect(e.Index);
            Rectangle rc2 = GetTabRect(e.Index);

            if (this.SelectedTab == this.TabPages[e.Index])
            {
                Color c1 = Color.FromArgb(color1Transparent, active_color1);
                Color c2 = Color.FromArgb(color2Transparent, active_color2);
                using (LinearGradientBrush br = new LinearGradientBrush(rc, c1, c2, angle))
                {
                    e.Graphics.FillRectangle(br, rc);
                }
            }
            else
            {
                Color c1 = Color.FromArgb(color1Transparent, nonactive_color1);
                Color c2 = Color.FromArgb(color2Transparent, nonactive_color2);
                using (LinearGradientBrush br = new LinearGradientBrush(rc, c1, c2, angle))
                {
                    e.Graphics.FillRectangle(br, rc);
                }
            }

            this.TabPages[e.Index].BorderStyle = BorderStyle.FixedSingle;
            this.TabPages[e.Index].ForeColor = SystemColors.ControlText;

            Rectangle paddedBounds = e.Bounds;
            paddedBounds.Inflate(-12, -4);

            e.Graphics.DrawString(this.TabPages[e.Index].Text, this.Font, new SolidBrush(forecolor), paddedBounds);
        }

        private void InitializeComponent()
        {

            this.SuspendLayout();
            this.ResumeLayout(false);

        }
    }
}

</code>```

But the background color is white:
the withe part is the tab control and the black part is a richtextbox.

I expected the background color to change but it did not happen. I have tried to add

```<code>base.BackColor = Color.Black;
</code>```

But it does not work.

Body:
I want to change the background color of a custom control that I found on the internet.
The code looks like this:

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace BetterNotepad
{
    public class TabControlZ : System.Windows.Forms.TabControl
    {
        private Color nonactive_color1 = Color.LightGreen;
        private Color nonactive_color2 = Color.DarkBlue;
        private Color backcolor = Color.WhiteSmoke;
        private Color active_color1 = Color.FromArgb(255, 210, 250, 220);
        private Color active_color2 = Color.FromArgb(255, 140, 160, 200);
        public Color forecolor = Color.Navy;
        private int color1Transparent = 150;
        private int color2Transparent = 150;
        private System.ComponentModel.IContainer components;
        private int angle = 90;

        public Color ActiveTabStartColor
        {
            get { return active_color1; }
            set { active_color1 = value; Invalidate(); }
        }
        public Color ActiveTabEndColor
        {
            get { return active_color2; }
            set { active_color2 = value; Invalidate(); }
        }
        public Color NonActiveTabStartColor
        {
            get { return nonactive_color1; }
            set { nonactive_color1 = value; Invalidate(); }
        }
        public Color NonActiveTabEndColor
        {
            get { return nonactive_color2; }
            set { nonactive_color2 = value; Invalidate(); }
        }

        public Color BackroudColor
        {
            get { return backcolor; }
            set { backcolor = value; Invalidate(); }
        }
        public int Transparent1
        {
            get { return color1Transparent; }
            set
            {
                color1Transparent = value;
                if (color1Transparent > 255)
                {
                    color1Transparent = 255;
                    Invalidate();
                }
                else
                    Invalidate();
            }
        }

        public int Transparent2
        {
            get { return color2Transparent; }
            set
            {
                color2Transparent = value;
                if (color2Transparent > 255)
                {
                    color2Transparent = 255;
                    Invalidate();
                }
                else
                    Invalidate();
            }
        }
        public int GradientAngle
        {
            get { return angle; }
            set { angle = value; Invalidate(); }
        }
        public Color TextColor
        {
            get { return forecolor; }
            set { forecolor = value; Invalidate(); }
        }

        public TabControlZ()
        {
            this.DrawMode = TabDrawMode.OwnerDrawFixed;
            this.Padding = new System.Drawing.Point(30, 4);
        }

        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);
        }
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            base.OnDrawItem(e);

            Rectangle rc = GetTabRect(e.Index);
            Rectangle rc2 = GetTabRect(e.Index);

            if (this.SelectedTab == this.TabPages[e.Index])
            {
                Color c1 = Color.FromArgb(color1Transparent, active_color1);
                Color c2 = Color.FromArgb(color2Transparent, active_color2);
                using (LinearGradientBrush br = new LinearGradientBrush(rc, c1, c2, angle))
                {
                    e.Graphics.FillRectangle(br, rc);
                }
            }
            else
            {
                Color c1 = Color.FromArgb(color1Transparent, nonactive_color1);
                Color c2 = Color.FromArgb(color2Transparent, nonactive_color2);
                using (LinearGradientBrush br = new LinearGradientBrush(rc, c1, c2, angle))
                {
                    e.Graphics.FillRectangle(br, rc);
                }
            }

            this.TabPages[e.Index].BorderStyle = BorderStyle.FixedSingle;
            this.TabPages[e.Index].ForeColor = SystemColors.ControlText;

            Rectangle paddedBounds = e.Bounds;
            paddedBounds.Inflate(-12, -4);

            e.Graphics.DrawString(this.TabPages[e.Index].Text, this.Font, new SolidBrush(forecolor), paddedBounds);
        }

        private void InitializeComponent()
        {

            this.SuspendLayout();
            this.ResumeLayout(false);

        }
    }
}

But the background color is white:
the withe part is the tab control and the black part is a richtextbox.

I expected the background color to change but it did not happen. I have tried to add

base.BackColor = Color.Black;

But it does not work.