问:
triple UI loaded on Vaadin
I am trying to build a (war) project with Vaadin (23) + Spring boot (2.7+) on Payara (5.2), after a lot of configurations it finally started but the initial UI is loaded 3 times.

As you can see in the picture

This is the log from the server:

```<code> INFO:   13:28:38.744 [admin-thread-pool::admin-listener(2)] INFO org.springframework.data.jpa.repository.cdi.JpaRepositoryExtension - Activating CDI extension for Spring Data JPA repositories.

    INFO:   WELD-000411: Observer method [BackedAnnotatedMethod] protected org.springframework.data.repository.cdi.CdiRepositoryExtensionSupport.processAnnotatedType(@Observes ProcessAnnotatedType<X>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
    INFO:   Clustered CDI Event bus initialized
    INFO:   Registering WebSocket filter for url pattern /*
    INFO:   WebModule[/skeleton-starter-flow-23] ServletContext.log():Initializing AtmosphereFramework
    INFO:   Initializing Soteria 1.1-b01.payara-p5 for context '/skeleton-starter-flow-23'
    INFO:   13:28:39.682 [admin-thread-pool::admin-listener(2)] DEBUG com.vaadin.base.devserver.stats.DevModeUsageStatistics - Telemetry enabled

    INFO:   13:28:39.695 [admin-thread-pool::admin-listener(2)] DEBUG com.vaadin.base.devserver.stats.StatisticsStorage - Reading statistics from C:\Users\FiruzzZ\.vaadin\usage-statistics.json

    INFO:   13:28:39.718 [admin-thread-pool::admin-listener(2)] DEBUG com.vaadin.base.devserver.stats.StatisticsStorage - Reading statistics from C:\Users\FiruzzZ\.vaadin\usage-statistics.json

    INFO:   13:28:39.735 [admin-thread-pool::admin-listener(2)] INFO com.vaadin.base.devserver.startup.DevModeStartupListener - Starting dev-mode updaters in C:\NetBeansProjects\skeleton-starter-flow-23 folder.

    INFO:   13:28:39.783 [admin-thread-pool::admin-listener(2)] DEBUG com.vaadin.flow.server.frontend.scanner.FullDependenciesScanner -
     List of npm dependencies found in the project:
      - @polymer/iron-icon 3.0.1 com.vaadin.flow.component.icon.IronIcon
      - @polymer/iron-list 3.1.0 com.vaadin.flow.component.ironlist.IronList
    INFO:   13:28:39.789 [admin-thread-pool::admin-listener(2)] DEBUG com.vaadin.flow.server.frontend.scanner.FullDependenciesScanner -
 List of @JavaScript found in the project:

INFO:   13:28:39.796 [admin-thread-pool::admin-listener(2)] INFO com.vaadin.flow.server.frontend.scanner.FullDependenciesScanner - Visited 80 classes. Took 26 ms.

INFO:   13:28:39.835 [admin-thread-pool::admin-listener(2)] DEBUG com.vaadin.flow.server.startup.VaadinAppShellInitializer - Using com.camioneros.AppShell class for configuring `index.html` response

INFO:   13:28:39.842 [ForkJoinPool.commonPool-worker-9] DEBUG com.vaadin.flow.server.frontend.TaskGeneratePackageJson - writing file C:\NetBeansProjects\skeleton-starter-flow-23\target\flow-frontend\package.json.

INFO:   WebModule[/skeleton-starter-flow-23] ServletContext.log():2 Spring WebApplicationInitializers detected on classpath
INFO:   onStartup: org.apache.catalina.core.ApplicationContextFacade@7aa203df
</code>```

Here is an idea about displaying the Spring WebpAppInit detected on classpath, but it just shows one. Took it from here

```<code>@Theme("my-theme")
@SpringBootApplication
public class AppShell extends SpringBootServletInitializer implements AppShellConfigurator {

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

    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        System.out.println("onStartup: " + servletContext);
        super.onStartup(servletContext);
    }

}
</code>```

and finally this is the POM

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.camioneros</groupId>
    <artifactId>ddjj</artifactId>
    <name>sas-ddjj</name>
    <version>1.0</version>
    <packaging>war</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <failOnMissingWebXml>false</failOnMissingWebXml>

        <vaadin.version>23.2.10</vaadin.version>
        <drivers.downloader.phase>pre-integration-test</drivers.downloader.phase>

        <!-- this parameter is needed as spring-boot bom overwrites it -->
        <selenium.version>4.5.3</selenium.version>
        <maven.compiler.release>11</maven.compiler.release>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.6</version>
    </parent>

    <repositories>
        <!-- The order of definitions matters. Explicitly defining central here to make sure it has the highest priority. -->
        <repository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>vaadin-prereleases</id>
            <url>
                https://maven.vaadin.com/vaadin-prereleases/
            </url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <!-- Repository used by many Vaadin add-ons -->
        <repository>
            <id>Vaadin Directory</id>
            <url>https://maven.vaadin.com/vaadin-addons</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <!-- The order of definitions matters. Explicitly defining central here to make sure it has the highest priority. -->
        <pluginRepository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>vaadin-prereleases</id>
            <url>
                https://maven.vaadin.com/vaadin-prereleases/
            </url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-bom</artifactId>
                <type>pom</type>
                <scope>import</scope>
                <version>${vaadin.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <!-- Replace artifactId with vaadin-core to use only free components -->
            <artifactId>vaadin-core</artifactId>
        </dependency>

        <!-- Added to provide logging output as Vaadin uses -->
        <!-- the unbound SLF4J no-operation (NOP) logger implementation -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </dependency>
<!--        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
        </dependency>-->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-testbench</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>5.1.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hotswapagent</groupId>
            <artifactId>hotswap-agent</artifactId>
            <version>1.4.1</version>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-hibernate3-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-deltaspike-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-mybatis-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-myfaces-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-wildfly-el-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-zk-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-weld-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-tomcat-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-jbossmodules-plugin</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>tomcat-embed-logging-juli</artifactId>
                    <groupId>org.apache.tomcat.embed</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>tomcat-embed-websocket</artifactId>
                    <groupId>org.apache.tomcat.embed</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>tomcat-embed-el</artifactId>
                    <groupId>org.apache.tomcat.embed</groupId>
                </exclusion>
                <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-undertow</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat.embed</groupId>
                    <artifactId>tomcat-embed-el</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <!--<defaultGoal>jetty:run</defaultGoal>-->
        <plugins>
            <!-- Define newer versions of Java compiler and war plugin to
            better support latest JDK versions. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.3.1</version>
            </plugin>
            <!--
                Take care of synchronizing java dependencies and imports in
                package.json and main.js files.
                It also creates webpack.config.js if not exists yet.
            -->
            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>${vaadin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-frontend</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- Production mode is activated using -Pproduction -->
            <id>production</id>

            <build>
                <plugins>
                    <plugin>
                        <groupId>com.vaadin</groupId>
                        <artifactId>vaadin-maven-plugin</artifactId>
                        <version>${vaadin.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>build-frontend</goal>
                                </goals>
                                <phase>compile</phase>
                            </execution>
                        </executions>
                        <configuration>
                            <productionMode>true</productionMode>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
</code>```

anyone has any idea why is this happening?

This is the only view/router, Autowiring is not working neither (btw), empresaService is always null

```<code>@Route("")
@PageTitle("SAS - DDJJ")
public class MainView extends VerticalLayout {

@Autowired
private EmpresaService empresaService;

public MainView() {
    System.out.println("Checking autowiring===" + empresaService);
    TextField textField = new TextField("Your name");
    textField.addThemeName("bordered");
    GreetService greetService = new GreetService();
    Button button = new Button("Say hello", e -> {
        Notification.show(greetService.greet(textField.getValue()));
    });
    button.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
    button.addClickShortcut(Key.ENTER);
    // Use custom CSS classes to apply styling. This is defined in
    // shared-styles.css.
    addClassName("centered-content");

    add(textField, button, new Button("blable", VaadinIcon.ABACUS.create()));
</code>```

Title: triple UI loaded on Vaadin

Body:
I am trying to build a (war) project with Vaadin (23) + Spring boot (2.7+) on Payara (5.2), after a lot of configurations it finally started but the initial UI is loaded 3 times.

As you can see in the picture

This is the log from the server:

 INFO:   13:28:38.744 [admin-thread-pool::admin-listener(2)] INFO org.springframework.data.jpa.repository.cdi.JpaRepositoryExtension - Activating CDI extension for Spring Data JPA repositories.

    INFO:   WELD-000411: Observer method [BackedAnnotatedMethod] protected org.springframework.data.repository.cdi.CdiRepositoryExtensionSupport.processAnnotatedType(@Observes ProcessAnnotatedType<X>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
    INFO:   Clustered CDI Event bus initialized
    INFO:   Registering WebSocket filter for url pattern /*
    INFO:   WebModule[/skeleton-starter-flow-23] ServletContext.log():Initializing AtmosphereFramework
    INFO:   Initializing Soteria 1.1-b01.payara-p5 for context '/skeleton-starter-flow-23'
    INFO:   13:28:39.682 [admin-thread-pool::admin-listener(2)] DEBUG com.vaadin.base.devserver.stats.DevModeUsageStatistics - Telemetry enabled

    INFO:   13:28:39.695 [admin-thread-pool::admin-listener(2)] DEBUG com.vaadin.base.devserver.stats.StatisticsStorage - Reading statistics from C:\Users\FiruzzZ\.vaadin\usage-statistics.json

    INFO:   13:28:39.718 [admin-thread-pool::admin-listener(2)] DEBUG com.vaadin.base.devserver.stats.StatisticsStorage - Reading statistics from C:\Users\FiruzzZ\.vaadin\usage-statistics.json

    INFO:   13:28:39.735 [admin-thread-pool::admin-listener(2)] INFO com.vaadin.base.devserver.startup.DevModeStartupListener - Starting dev-mode updaters in C:\NetBeansProjects\skeleton-starter-flow-23 folder.

    INFO:   13:28:39.783 [admin-thread-pool::admin-listener(2)] DEBUG com.vaadin.flow.server.frontend.scanner.FullDependenciesScanner -
     List of npm dependencies found in the project:
      - @polymer/iron-icon 3.0.1 com.vaadin.flow.component.icon.IronIcon
      - @polymer/iron-list 3.1.0 com.vaadin.flow.component.ironlist.IronList
    INFO:   13:28:39.789 [admin-thread-pool::admin-listener(2)] DEBUG com.vaadin.flow.server.frontend.scanner.FullDependenciesScanner -
 List of @JavaScript found in the project:

INFO:   13:28:39.796 [admin-thread-pool::admin-listener(2)] INFO com.vaadin.flow.server.frontend.scanner.FullDependenciesScanner - Visited 80 classes. Took 26 ms.

INFO:   13:28:39.835 [admin-thread-pool::admin-listener(2)] DEBUG com.vaadin.flow.server.startup.VaadinAppShellInitializer - Using com.camioneros.AppShell class for configuring `index.html` response

INFO:   13:28:39.842 [ForkJoinPool.commonPool-worker-9] DEBUG com.vaadin.flow.server.frontend.TaskGeneratePackageJson - writing file C:\NetBeansProjects\skeleton-starter-flow-23\target\flow-frontend\package.json.

INFO:   WebModule[/skeleton-starter-flow-23] ServletContext.log():2 Spring WebApplicationInitializers detected on classpath
INFO:   onStartup: org.apache.catalina.core.ApplicationContextFacade@7aa203df

Here is an idea about displaying the Spring WebpAppInit detected on classpath, but it just shows one. Took it from here

@Theme("my-theme")
@SpringBootApplication
public class AppShell extends SpringBootServletInitializer implements AppShellConfigurator {

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

    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        System.out.println("onStartup: " + servletContext);
        super.onStartup(servletContext);
    }

}

and finally this is the POM

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.camioneros</groupId>
    <artifactId>ddjj</artifactId>
    <name>sas-ddjj</name>
    <version>1.0</version>
    <packaging>war</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <failOnMissingWebXml>false</failOnMissingWebXml>

        <vaadin.version>23.2.10</vaadin.version>
        <drivers.downloader.phase>pre-integration-test</drivers.downloader.phase>

        <selenium.version>4.5.3</selenium.version>
        <maven.compiler.release>11</maven.compiler.release>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.6</version>
    </parent>

    <repositories>

        <repository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>vaadin-prereleases</id>
            <url>
                https://maven.vaadin.com/vaadin-prereleases/
            </url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>Vaadin Directory</id>
            <url>https://maven.vaadin.com/vaadin-addons</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>

        <pluginRepository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>vaadin-prereleases</id>
            <url>
                https://maven.vaadin.com/vaadin-prereleases/
            </url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-bom</artifactId>
                <type>pom</type>
                <scope>import</scope>
                <version>${vaadin.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>

            <artifactId>vaadin-core</artifactId>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-testbench</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>5.1.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hotswapagent</groupId>
            <artifactId>hotswap-agent</artifactId>
            <version>1.4.1</version>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-hibernate3-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-deltaspike-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-mybatis-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-myfaces-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-wildfly-el-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-zk-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-weld-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-tomcat-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-jbossmodules-plugin</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>tomcat-embed-logging-juli</artifactId>
                    <groupId>org.apache.tomcat.embed</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>tomcat-embed-websocket</artifactId>
                    <groupId>org.apache.tomcat.embed</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>tomcat-embed-el</artifactId>
                    <groupId>org.apache.tomcat.embed</groupId>
                </exclusion>
                <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-undertow</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat.embed</groupId>
                    <artifactId>tomcat-embed-el</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>

        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.3.1</version>
            </plugin>

            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>${vaadin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-frontend</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>

            <id>production</id>

            <build>
                <plugins>
                    <plugin>
                        <groupId>com.vaadin</groupId>
                        <artifactId>vaadin-maven-plugin</artifactId>
                        <version>${vaadin.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>build-frontend</goal>
                                </goals>
                                <phase>compile</phase>
                            </execution>
                        </executions>
                        <configuration>
                            <productionMode>true</productionMode>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

anyone has any idea why is this happening?

This is the only view/router, Autowiring is not working neither (btw), empresaService is always null

@Route("")
@PageTitle("SAS - DDJJ")
public class MainView extends VerticalLayout {

@Autowired
private EmpresaService empresaService;

public MainView() {
    System.out.println("Checking autowiring===" + empresaService);
    TextField textField = new TextField("Your name");
    textField.addThemeName("bordered");
    GreetService greetService = new GreetService();
    Button button = new Button("Say hello", e -> {
        Notification.show(greetService.greet(textField.getValue()));
    });
    button.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
    button.addClickShortcut(Key.ENTER);
    // Use custom CSS classes to apply styling. This is defined in
    // shared-styles.css.
    addClassName("centered-content");

    add(textField, button, new Button("blable", VaadinIcon.ABACUS.create()));


来源: stackexchange

问:
jpeg python 8x8 window DCT and quantisation process
I am trying to build a simple jpeg compression process in python using but DCT and quantisation but not the Huffman coding.

This is what I have done so far (compress and uncompress the same image):

```<code>import cv2 as cv
from scipy.fftpack import dct, idct
import numpy as np
from PIL import Image

image = cv.imread("test.png")
# image_dct = cv.imread("test.png")
# image_quant = cv.imread("test.png")

x = cv.cvtColor(image, cv.COLOR_BGR2GRAY)
arr = np.asarray(x, float)
image_quant = np.asarray(x, float)

#Quantization matrix for jpeg standard
qm = [[16,    11,    10,    16,    24,    40,    51,    61],
    [12,    12,    14,    19,    26,    58,    60,    55],
    [14,    13,    16,    24,    40,    57,    69,    56],
    [14,    17,    22,    29,    51,    87,    80,    62],
    [18,    22,    37,    56,    68,   109,   103,    77],
    [24,    35,    55,    64,    81,   104,   113,    92],
    [49,    64,    78,    87,   103,   121,   120,   101],
    [72,    92,    95,    98,   112,   100,   103,    99]]

# 8x8 jpeg window size
ws_r = 8
ws_c = 8

# Method/function to quantize each element of the DCTed matrix 8x8 by the
# standard 50% qm matrix
def quantize(inMatrix, qm):
    outMatrix = np.empty((8, 8))

    for i in range(0, 8):
        for j in range(0, 8):
            # outMatrix[i][j] = np.linalg.norm(inMatrix[i][j]/qm[i][j])
            # outMatrix[i][j] = np.round(inMatrix[i][j]/qm[i][j])
            outMatrix[i][j] = inMatrix[i][j]/qm[i][j]
    # print(outMatrix)
    return outMatrix

# Devide the image into 8x8 blocks and apply to each block DCT
for r in range(0, np.size(arr, 0)-ws_r, ws_r):
    for c in range(0, np.size(arr, 1)-ws_c, ws_c):
        window = arr[r:r+ws_r, c:c+ws_c]
        # print(dct(window))
        image_quant[r:r+ws_r, c:c+ws_c] = quantize(dct(window),qm)

image_quant = Image.fromarray(image_quant)
image_quant = image_quant.convert('RGB')
image_quant.save('test_quant_dct.png')
image_quant.show()

#Now invert the above process by dequantizing and applying inverce DCT
image = cv.imread("test_quant_dct.png")

x = cv.cvtColor(image, cv.COLOR_BGR2GRAY)
arr = np.asarray(x, float)
image_dequant = np.asarray(x, float)

def dequantize(inMatrix, qm):
    outMatrix = np.empty((8, 8))

    for i in range(0, 8):
        for j in range(0, 8):
            # outMatrix[i][j] = np.linalg.norm(inMatrix[i][j]/qm[i][j])
            # outMatrix[i][j] = np.round(inMatrix[i][j]*qm[i][j])
            outMatrix[i][j] = inMatrix[i][j]*qm[i][j]
    # print(outMatrix)
    return outMatrix

for r in range(0, np.size(arr, 0)-ws_r, ws_r):
    for c in range(0, np.size(arr, 1)-ws_c, ws_c):
        window = arr[r:r+ws_r, c:c+ws_c]
        # image_dequant[r:r+ws_r, c:c+ws_c] = dequantize(idct(window),qm)
        image_dequant[r:r+ws_r, c:c+ws_c] = idct(dequantize(window,qm))

image_dequant = Image.fromarray(image_dequant)
image_dequant = image_dequant.convert('RGB')
image_dequant.save('test_dequant_dct.png')
image_dequant.show()
</code>```

The image processed is the following:

One running the above code can see that the image gets ruined by that 8x8 window dct process and quantisation only to get a white image back with some blurry parts returned completely ruined.  So far I do not know what I have done wrong in the process.

ContentLicense: CC BY-SA 4.0

Body:
I am trying to build a simple jpeg compression process in python using but DCT and quantisation but not the Huffman coding.

This is what I have done so far (compress and uncompress the same image):

import cv2 as cv
from scipy.fftpack import dct, idct
import numpy as np
from PIL import Image

image = cv.imread("test.png")
# image_dct = cv.imread("test.png")
# image_quant = cv.imread("test.png")

x = cv.cvtColor(image, cv.COLOR_BGR2GRAY)
arr = np.asarray(x, float)
image_quant = np.asarray(x, float)

#Quantization matrix for jpeg standard
qm = [[16,    11,    10,    16,    24,    40,    51,    61],
    [12,    12,    14,    19,    26,    58,    60,    55],
    [14,    13,    16,    24,    40,    57,    69,    56],
    [14,    17,    22,    29,    51,    87,    80,    62],
    [18,    22,    37,    56,    68,   109,   103,    77],
    [24,    35,    55,    64,    81,   104,   113,    92],
    [49,    64,    78,    87,   103,   121,   120,   101],
    [72,    92,    95,    98,   112,   100,   103,    99]]

# 8x8 jpeg window size
ws_r = 8
ws_c = 8

# Method/function to quantize each element of the DCTed matrix 8x8 by the
# standard 50% qm matrix
def quantize(inMatrix, qm):
    outMatrix = np.empty((8, 8))

    for i in range(0, 8):
        for j in range(0, 8):
            # outMatrix[i][j] = np.linalg.norm(inMatrix[i][j]/qm[i][j])
            # outMatrix[i][j] = np.round(inMatrix[i][j]/qm[i][j])
            outMatrix[i][j] = inMatrix[i][j]/qm[i][j]
    # print(outMatrix)
    return outMatrix

# Devide the image into 8x8 blocks and apply to each block DCT
for r in range(0, np.size(arr, 0)-ws_r, ws_r):
    for c in range(0, np.size(arr, 1)-ws_c, ws_c):
        window = arr[r:r+ws_r, c:c+ws_c]
        # print(dct(window))
        image_quant[r:r+ws_r, c:c+ws_c] = quantize(dct(window),qm)

image_quant = Image.fromarray(image_quant)
image_quant = image_quant.convert('RGB')
image_quant.save('test_quant_dct.png')
image_quant.show()

#Now invert the above process by dequantizing and applying inverce DCT
image = cv.imread("test_quant_dct.png")

x = cv.cvtColor(image, cv.COLOR_BGR2GRAY)
arr = np.asarray(x, float)
image_dequant = np.asarray(x, float)

def dequantize(inMatrix, qm):
    outMatrix = np.empty((8, 8))

    for i in range(0, 8):
        for j in range(0, 8):
            # outMatrix[i][j] = np.linalg.norm(inMatrix[i][j]/qm[i][j])
            # outMatrix[i][j] = np.round(inMatrix[i][j]*qm[i][j])
            outMatrix[i][j] = inMatrix[i][j]*qm[i][j]
    # print(outMatrix)
    return outMatrix

for r in range(0, np.size(arr, 0)-ws_r, ws_r):
    for c in range(0, np.size(arr, 1)-ws_c, ws_c):
        window = arr[r:r+ws_r, c:c+ws_c]
        # image_dequant[r:r+ws_r, c:c+ws_c] = dequantize(idct(window),qm)
        image_dequant[r:r+ws_r, c:c+ws_c] = idct(dequantize(window,qm))

image_dequant = Image.fromarray(image_dequant)
image_dequant = image_dequant.convert('RGB')
image_dequant.save('test_dequant_dct.png')
image_dequant.show()

The image processed is the following:

One running the above code can see that the image gets ruined by that 8x8 window dct process and quantisation only to get a white image back with some blurry parts returned completely ruined.  So far I do not know what I have done wrong in the process.


问:
Is there a way to count bytes in this stream "passage"?
Using the below code I can have the size in bytes of my (stream) file:

let bytes_copied = tokio::io::copy(&mut stream, &mut file).await?;
```
<p>Is there a way I can have the size of the (stream) file using <code>rust-s3</code> methods (https://github.com/durch/rust-s3) ?</p>
<pre class="lang-rust prettyprint-override"><code>bucket.put_object_stream(&mut stream, filename).await?;
</code>```

Or Is there a way to "count" bytes as they "pass" in this "stream tunnel"?

Body:
Using the below code I can have the size in bytes of my (stream) file:

let bytes_copied = tokio::io::copy(&mut stream, &mut file).await?;

Is there a way I can have the size of the (stream) file using rust-s3 methods (https://github.com/durch/rust-s3) ?

bucket.put_object_stream(&mut stream, filename).await?;

Or Is there a way to "count" bytes as they "pass" in this "stream tunnel"?


问:
Best order to build back-end first platform? using Auth0 and NestJS and fargate
I am currently building out a new platform but want to know from some experts the best order to maximise efficiency?

Should I be starting with the authentification service? or the data base?
or should I be simply building features first and adding that in later?

I have expireince building features for a product, but have never done the whole thing from start to end, so any advice would be super appreciated!

(the front end will come later, for now im just getting the backend ready!)

I have started with Auth0, though I realised its not much use without a DB set up?


问:
IMB MQ 6 to 8 Migration
I have a spring Project , and i migrate from 4.X to 5.3 it's a parserMQ , we receive a messages from File MQ.

I have com.ibm.mq with the version 6.0.2.2.
I will migrate ibm-mq to version 8 and i'm not sure if there is constraint with the version's server FileMQ.

Should i migrate the version of the server FileMQ ?

Title: IMB MQ 6 to 8 Migration


问:
Problem with boost::process with long (>260) start_dir (windows)
I am on Windows 10, and want to use boost process to start a child. When the child's working directory is too long, I get an exception:

CreateProcess failed: The directory name is invalid.

I wrote a test program to debug this:

```<code>#include <boost/process.hpp>
#include <boost/process/async.hpp>
#include <boost/asio/high_resolution_timer.hpp>
#include <iostream>
#include <iomanip>
#include <thread>
#include <string>
#include <filesystem>

namespace bp = boost::process;

void test(const std::filesystem::path& wdir)
{
  boost::asio::io_context io;
  bp::child child;
  try
  {
    std::filesystem::create_directories(wdir);
    std::cout << "exists " << std::filesystem::exists(wdir) << " len " << wdir.generic_wstring().size() << '\n';
    std::cout << "start proc\n";
    child = bp::child(
      "C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe",
      std::vector<std::string> { "ls" },
      io,
      boost::process::start_dir = LR"(\\?\)" + wdir.generic_wstring());
    std::this_thread::sleep_for(std::chrono::seconds{ 3 });
    child.wait();
  }
  catch (const std::exception& e)
  {
    std::cout << "EXCEPTION " << e.what() << "\n";
  }
  std::cout << "done\n";
}

int main()
{
  std::cout << "short path\n";
  test("D:/tmp/10378020400asdfasdfqw4retf");

  std::cout << "\nlong path\n";
  test("D:/tmp/10378020400826168668/unicode/qwe/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiertzertz/aaaqqqwwwiiiiertzertz/eertz/"
    "iiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiii"
    "iiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiii"
    "iiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"
    "i/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqw"
    "wwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiii"
    "iiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiii"
    "iiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiii"
    "iiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/a"
    "aaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwi"
    "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiii"
    "iiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiii"
    "iiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiii"
    "iiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaq"
    "qqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiii"
    "iiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiii"
    "iiiiiiiiiiiiiiiiiii/");
  return 0;
}
</code>```

I get this output:

short path
exists 1 len 33
start proc
done

long path
exists 1 len 2177
start proc
EXCEPTION  CreateProcess failed: The directory name is invalid.
done
```

It seems the problem comes from the internally called CreateProcessW.

The documentation does not mention any limit for lpCurrentDirectory, and also allows UNC paths (hence I tried adding the prefix \\?\), but it does not make any difference whether I use the UNC syntax or not.

My questions are:

Is this an inherent limitation of Windows?

Is there any way to circumvent this limitation using boost?

Is there any way to circumvent this limitation using some other Win32 API function?

What I tired: using normal and UNC paths.

Body:
I am on Windows 10, and want to use boost process to start a child. When the child's working directory is too long, I get an exception:

CreateProcess failed: The directory name is invalid.

I wrote a test program to debug this:

#include <boost/process.hpp>
#include <boost/process/async.hpp>
#include <boost/asio/high_resolution_timer.hpp>
#include <iostream>
#include <iomanip>
#include <thread>
#include <string>
#include <filesystem>

namespace bp = boost::process;

void test(const std::filesystem::path& wdir)
{
  boost::asio::io_context io;
  bp::child child;
  try
  {
    std::filesystem::create_directories(wdir);
    std::cout << "exists " << std::filesystem::exists(wdir) << " len " << wdir.generic_wstring().size() << '\n';
    std::cout << "start proc\n";
    child = bp::child(
      "C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe",
      std::vector<std::string> { "ls" },
      io,
      boost::process::start_dir = LR"(\\?\)" + wdir.generic_wstring());
    std::this_thread::sleep_for(std::chrono::seconds{ 3 });
    child.wait();
  }
  catch (const std::exception& e)
  {
    std::cout << "EXCEPTION " << e.what() << "\n";
  }
  std::cout << "done\n";
}

int main()
{
  std::cout << "short path\n";
  test("D:/tmp/10378020400asdfasdfqw4retf");

  std::cout << "\nlong path\n";
  test("D:/tmp/10378020400826168668/unicode/qwe/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiertzertz/aaaqqqwwwiiiiertzertz/eertz/"
    "iiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiii"
    "iiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiii"
    "iiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"
    "i/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqw"
    "wwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiii"
    "iiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiii"
    "iiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiii"
    "iiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/a"
    "aaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwi"
    "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiii"
    "iiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiii"
    "iiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiii"
    "iiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaq"
    "qqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiii"
    "iiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/aaaqqqwwwiiiiiiiiiiiii"
    "iiiiiiiiiiiiiiiiiii/");
  return 0;
}

I get this output:

short path
exists 1 len 33
start proc
done

long path
exists 1 len 2177
start proc
EXCEPTION  CreateProcess failed: The directory name is invalid.
done

It seems the problem comes from the internally called CreateProcessW.

The documentation does not mention any limit for lpCurrentDirectory, and also allows UNC paths (hence I tried adding the prefix \\?\), but it does not make any difference whether I use the UNC syntax or not.

My questions are:

Is this an inherent limitation of Windows?

Is there any way to circumvent this limitation using boost?

Is there any way to circumvent this limitation using some other Win32 API function?

What I tired: using normal and UNC paths.


问:
Media folder not working properly & Images not being saved - Django
I am trying to add images to a post. (Using Django v3.2.5)

root_directory/settings.py:

```<code>BASE_DIR = Path(__file__).resolve().parent.parent
...
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
</code>```

root_directory/urls.py:

```<code>from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [

    path('admin/', admin.site.urls),
    path('', include('index.urls')),
    path('app2/', include('app2.urls')),
    path('app3/', include('app3.urls')),

] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
</code>```

app3/models.py:

```<code>from django.db import models
from ckeditor.fields import RichTextField

class Post_Picture(models.Model):
    title = models.CharField('Title', max_length=120)
    image = models.ImageField(blank=True, null=True, upload_to="images/")
    caption = RichTextField(blank=True, null=True)

    def __str__(self):
        return self.title
</code>```

app3/forms.py:

```<code>from django import forms
from django.forms import ModelForm
from .models import Post_Picture

class PostPicForm(ModelForm):
    class Meta:
        model = Post_Picture
        fields = ('title', 'image', 'caption')
        labels = {
            'Title': '',
            'Caption': '',
        }
        widgets = {
            'title': forms.TextInput(attrs={'class':'form-control', 'placeholder': 'Title your post'}),
            'caption': forms.Textarea(attrs={'class':'form-control', 'placeholder': 'Anything extra you want to add?'}),
        }
</code>```

app3/views.py:

```<code>from django.shortcuts import render, redirect
from .models import Post_Picture
from .forms import PostPicForm
from django.http import HttpResponseRedirect
from django.contrib import messages

def your_home(request):
    friend_posts = Post_Picture.objects.all()
    return render(request, "app3/your_home.html", {
        'friend_posts': friend_posts,
    })

def post_pic(request):
    submitted = False
    if request.method == "POST":
        form = PostPicForm(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect('post_pic?submitted=True')

    else:
        form = PostPicForm()
        if 'submitted' in request.GET:
            submitted = True
    return render(request, 'app3/post_pic.html', {'form': form, 'submitted': submitted})
</code>```

app3/urls.py:

```<code>from django.urls import path
from . import views

urlpatterns = [
    path('your_home', views.your_home, name='your-home'),
    path('post_pic', views.post_pic, name='post_pic'),
]
</code>```

pip installed stuff:

```<code>$ pip freeze
asgiref==3.5.2
Django==3.2.5
django-ckeditor==5.9.0
django-js-asset==2.0.0
Pillow==9.3.0
pytz==2022.6
six==1.16.0
sqlparse==0.4.3
</code>```

I did create the media folder but it didn't work - it didn't make the "image/" directory.
During the submission process of posting pictures, it showed no error. I knew it wouldn't show the image on the website but, with that code, I'm pretty sure it should've shown the image in the admin area, but it didn't.

Any help is appreciated.

Body:
I am trying to add images to a post. (Using Django v3.2.5)

root_directory/settings.py:

BASE_DIR = Path(__file__).resolve().parent.parent
...
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

root_directory/urls.py:

from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [

    path('admin/', admin.site.urls),
    path('', include('index.urls')),
    path('app2/', include('app2.urls')),
    path('app3/', include('app3.urls')),

] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

app3/models.py:

from django.db import models
from ckeditor.fields import RichTextField

class Post_Picture(models.Model):
    title = models.CharField('Title', max_length=120)
    image = models.ImageField(blank=True, null=True, upload_to="images/")
    caption = RichTextField(blank=True, null=True)

    def __str__(self):
        return self.title

app3/forms.py:

from django import forms
from django.forms import ModelForm
from .models import Post_Picture

class PostPicForm(ModelForm):
    class Meta:
        model = Post_Picture
        fields = ('title', 'image', 'caption')
        labels = {
            'Title': '',
            'Caption': '',
        }
        widgets = {
            'title': forms.TextInput(attrs={'class':'form-control', 'placeholder': 'Title your post'}),
            'caption': forms.Textarea(attrs={'class':'form-control', 'placeholder': 'Anything extra you want to add?'}),
        }

app3/views.py:

from django.shortcuts import render, redirect
from .models import Post_Picture
from .forms import PostPicForm
from django.http import HttpResponseRedirect
from django.contrib import messages

def your_home(request):
    friend_posts = Post_Picture.objects.all()
    return render(request, "app3/your_home.html", {
        'friend_posts': friend_posts,
    })

def post_pic(request):
    submitted = False
    if request.method == "POST":
        form = PostPicForm(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect('post_pic?submitted=True')

    else:
        form = PostPicForm()
        if 'submitted' in request.GET:
            submitted = True
    return render(request, 'app3/post_pic.html', {'form': form, 'submitted': submitted})

app3/urls.py:

from django.urls import path
from . import views

urlpatterns = [
    path('your_home', views.your_home, name='your-home'),
    path('post_pic', views.post_pic, name='post_pic'),
]

pip installed stuff:

$ pip freeze
asgiref==3.5.2
Django==3.2.5
django-ckeditor==5.9.0
django-js-asset==2.0.0
Pillow==9.3.0
pytz==2022.6
six==1.16.0
sqlparse==0.4.3

I did create the media folder but it didn't work - it didn't make the "image/" directory.
During the submission process of posting pictures, it showed no error. I knew it wouldn't show the image on the website but, with that code, I'm pretty sure it should've shown the image in the admin area, but it didn't.

Any help is appreciated.


问:
What is the better way of forming this logic for filling nulls in pandas?
I have nulls in a column named 'rtd' of a data frame. To fill those nulls, first I need to find such a value in 'rtd' where acquired_year, acquired_month, secondarycategory are matching and payment_month is 12 less than the payment month of null on which we are currently calculating. At last, multiply such a value by 0.7, and that should be the final value.

ACQUIRED_MONTH
ACQUIRED_YEAR
PAYMENT_MONTH
SECONDARYCATEGORY
RTD

2
2,022
4
ALL
6,595.64

3
2,022
4
ALL
3,801.75

4
2,022
4
ALL
2,663.85

5
2,022
4
ALL
2,903.86

6
2,022
4
ALL
8,903.35

7
2,022
4
ALL
null

8
2,022
4
ALL
null

9
2,022
4
ALL
null

10
2,022
4
ALL
null

1
2,010
5
ALL
0

2
2,010
5
ALL
0

3
2,010
5
ALL
0

4
2,010
5
ALL
585.9

5
2,010
5
ALL
619.9

6
2,010
5
ALL
199.9

7
2,010
5
ALL
199.95

8
2,010
5
ALL
579.81

Currently, to get the desired result I'm using this code, but this seems inefficient way. I need a more Pythonic/optimized way, probably by using fillna or some other method.

```<code>index_ls = df[(df['payment_month']>=12) & (df['rtd'].isnull())].index.tolist()
for i in index_ls:
    df.at[i,'rtd'] = df.loc[(df['acquired_year'] == df.at[i, 'acquired_year']) & (df['acquired_month'] == df.at[i, 'acquired_month']) & (df['secondarycategory'] == df.at[i, 'secondarycategory']) & (df['payment_month'] == df.at[i, 'payment_month']-12), 'rtd']*0.7
</code>```

Body:
I have nulls in a column named 'rtd' of a data frame. To fill those nulls, first I need to find such a value in 'rtd' where acquired_year, acquired_month, secondarycategory are matching and payment_month is 12 less than the payment month of null on which we are currently calculating. At last, multiply such a value by 0.7, and that should be the final value.

ACQUIRED_MONTH
ACQUIRED_YEAR
PAYMENT_MONTH
SECONDARYCATEGORY
RTD

2
2,022
4
ALL
6,595.64

3
2,022
4
ALL
3,801.75

4
2,022
4
ALL
2,663.85

5
2,022
4
ALL
2,903.86

6
2,022
4
ALL
8,903.35

7
2,022
4
ALL
null

8
2,022
4
ALL
null

9
2,022
4
ALL
null

10
2,022
4
ALL
null

1
2,010
5
ALL
0

2
2,010
5
ALL
0

3
2,010
5
ALL
0

4
2,010
5
ALL
585.9

5
2,010
5
ALL
619.9

6
2,010
5
ALL
199.9

7
2,010
5
ALL
199.95

8
2,010
5
ALL
579.81

Currently, to get the desired result I'm using this code, but this seems inefficient way. I need a more Pythonic/optimized way, probably by using fillna or some other method.

index_ls = df[(df['payment_month']>=12) & (df['rtd'].isnull())].index.tolist()
for i in index_ls:
    df.at[i,'rtd'] = df.loc[(df['acquired_year'] == df.at[i, 'acquired_year']) & (df['acquired_month'] == df.at[i, 'acquired_month']) & (df['secondarycategory'] == df.at[i, 'secondarycategory']) & (df['payment_month'] == df.at[i, 'payment_month']-12), 'rtd']*0.7


问:
Angular how to pass and access data for localStorage
I am trying to implement localStorage but cant make it work, what i expect to happen is when user clicks on either button (6 buttons with city names) on homepage it is gonna save the value(city name) of the button to localStorage and redirects him to different user input component where is dropdown with same cities as on the buttons in homepage and its gonna already have prefilled/selected the city from the dropdown with the city which was clicked when user clicked on homepage button (prefill with saved value from localStorage).

So when user click on Tokyo it redirects him to the user input and the dropdown should be preselected to Tokyo.
Right now when user clicks on either button and it redirects him the dropdown selection doesnt change. Its still the default value (London)

this is homepage html

```<code>  <div class="grid">
    <button *ngFor="let button of buttons" [value]="button.name" pButton type="button" routerLink="/weather-data" (click)="changeCityData($event)">{{button.name}}</button>
  </div>
</code>```

this is homepage ts component

```<code>export class HomeComponent implements OnInit {
  buttons: City[];
  constructor(
    private weatherService: WeatherService,
    private localService: LocalService
  ) {
    this.buttons = [
      new City('London', '51.51', '-0.13'),
      new City('Sydney', '-33.87', '151.21'),
      new City('New York', '40.71', '-74.01'),
      new City('Paris', '48.85', '2.35'),
      new City('Tokyo', '35.69', '139.69'),
      new City('Bratislava', '48.15', '17.11'),
    ];
  }
  ngOnInit(): void {}

  changeCityData(event) {
    const city = event.target.value;     // here iam saving the city to localStorage
    this.localService.saveData('city', city); // <=

    if (event.target.value === 'London') {
      this.weatherService.coordinatesSubject.next({
        lat: '51.51',
        lon: '-0.13',
        startDate: '2005-08-25',
      });
    } else if (event.target.value === 'New York') {
      this.weatherService.coordinatesSubject.next({
        lat: '40.71',
        lon: '-74.01',
        startDate: '2005-08-25',
      });
    } else if (event.target.value === 'Tokyo') { ... code
</code>```

this is user input html

```<code><form class="user-input" [formGroup]="userInput" (ngSubmit)="onSubmit()">
  <p-dropdown [options]="cities" formControlName="selectedCity" optionLabel="name"></p-dropdown>
  <p> weather data for </p>
  <p-calendar placeholder="Choose a date" formControlName="selectedDate"></p-calendar>
  <button [disabled]="!userInput.controls['selectedDate'].value" style="margin-left: 10px;" class="form-control" pButton label="Submit"></button>
</form>
</code>```

this is user input ts

```<code>export class UserInputComponent implements OnInit {
  cities: City[];
  value: Date;
  userInput: FormGroup;

  constructor(
    private weatherService: WeatherService,
    private router: Router,
    private datePipe: DatePipe,
    private localService: LocalService
  ) {
    this.cities = [
      new City('London', '51.51', '-0.13'),
      new City('Sydney', '-33.87', '151.21'),
      new City('New York', '40.71', '-74.01'),
      new City('Paris', '48.85', '2.35'),
      new City('Tokyo', '35.69', '139.69'),
      new City('Bratislava', '48.15', '17.11'),
    ];
  }

  ngOnInit(): void {
    this.userInput = new FormGroup({
      selectedCity: new FormControl(new City('London', '51.51', '-0.13')),  //default city is set here
      selectedDate: new FormControl(null),
    });

    this.userInput.controls['selectedCity'].setValue(     // here iam trying to set the city from dropdown so its selected
      this.localService.getData('city')
    );

    this.userInput.controls['selectedDate'].setValue(
      this.datePipe.transform(sessionStorage.getItem('date'), 'MM/dd/yyyy')
    );
  }

  onSubmit() {
    this.router
      .navigateByUrl('/', { skipLocationChange: true })
      .then(() => this.router.navigate(['/weather-data']));
    const lat = this.userInput.controls['selectedCity'].value.lat;
    const lon = this.userInput.controls['selectedCity'].value.lon;
    const startDate = this.datePipe.transform(
      this.userInput.controls['selectedDate'].value,
      'yyyy-MM-dd'
    );
    sessionStorage.setItem('date', startDate);
    this.localService.saveData(
      'city',
      this.userInput.controls['selectedCity'].value.name
    );
    this.weatherService.coordinatesSubject.next({
      lat: lat,
      lon: lon,
      startDate: startDate,
    });
  }
}
</code>```

Body:
I am trying to implement localStorage but cant make it work, what i expect to happen is when user clicks on either button (6 buttons with city names) on homepage it is gonna save the value(city name) of the button to localStorage and redirects him to different user input component where is dropdown with same cities as on the buttons in homepage and its gonna already have prefilled/selected the city from the dropdown with the city which was clicked when user clicked on homepage button (prefill with saved value from localStorage).

So when user click on Tokyo it redirects him to the user input and the dropdown should be preselected to Tokyo.
Right now when user clicks on either button and it redirects him the dropdown selection doesnt change. Its still the default value (London)

this is homepage html

    <button *ngFor="let button of buttons" [value]="button.name" pButton type="button" routerLink="/weather-data" (click)="changeCityData($event)">{{button.name}}</button>

this is homepage ts component

export class HomeComponent implements OnInit {
  buttons: City[];
  constructor(
    private weatherService: WeatherService,
    private localService: LocalService
  ) {
    this.buttons = [
      new City('London', '51.51', '-0.13'),
      new City('Sydney', '-33.87', '151.21'),
      new City('New York', '40.71', '-74.01'),
      new City('Paris', '48.85', '2.35'),
      new City('Tokyo', '35.69', '139.69'),
      new City('Bratislava', '48.15', '17.11'),
    ];
  }
  ngOnInit(): void {}

  changeCityData(event) {
    const city = event.target.value;     // here iam saving the city to localStorage
    this.localService.saveData('city', city); // <=

    if (event.target.value === 'London') {
      this.weatherService.coordinatesSubject.next({
        lat: '51.51',
        lon: '-0.13',
        startDate: '2005-08-25',
      });
    } else if (event.target.value === 'New York') {
      this.weatherService.coordinatesSubject.next({
        lat: '40.71',
        lon: '-74.01',
        startDate: '2005-08-25',
      });
    } else if (event.target.value === 'Tokyo') { ... code

this is user input html

<form class="user-input" [formGroup]="userInput" (ngSubmit)="onSubmit()">

 weather data for

  <button [disabled]="!userInput.controls['selectedDate'].value" style="margin-left: 10px;" class="form-control" pButton label="Submit"></button>
</form>

this is user input ts

export class UserInputComponent implements OnInit {
  cities: City[];
  value: Date;
  userInput: FormGroup;

  constructor(
    private weatherService: WeatherService,
    private router: Router,
    private datePipe: DatePipe,
    private localService: LocalService
  ) {
    this.cities = [
      new City('London', '51.51', '-0.13'),
      new City('Sydney', '-33.87', '151.21'),
      new City('New York', '40.71', '-74.01'),
      new City('Paris', '48.85', '2.35'),
      new City('Tokyo', '35.69', '139.69'),
      new City('Bratislava', '48.15', '17.11'),
    ];
  }

  ngOnInit(): void {
    this.userInput = new FormGroup({
      selectedCity: new FormControl(new City('London', '51.51', '-0.13')),  //default city is set here
      selectedDate: new FormControl(null),
    });

    this.userInput.controls['selectedCity'].setValue(     // here iam trying to set the city from dropdown so its selected
      this.localService.getData('city')
    );

    this.userInput.controls['selectedDate'].setValue(
      this.datePipe.transform(sessionStorage.getItem('date'), 'MM/dd/yyyy')
    );
  }

  onSubmit() {
    this.router
      .navigateByUrl('/', { skipLocationChange: true })
      .then(() => this.router.navigate(['/weather-data']));
    const lat = this.userInput.controls['selectedCity'].value.lat;
    const lon = this.userInput.controls['selectedCity'].value.lon;
    const startDate = this.datePipe.transform(
      this.userInput.controls['selectedDate'].value,
      'yyyy-MM-dd'
    );
    sessionStorage.setItem('date', startDate);
    this.localService.saveData(
      'city',
      this.userInput.controls['selectedCity'].value.name
    );
    this.weatherService.coordinatesSubject.next({
      lat: lat,
      lon: lon,
      startDate: startDate,
    });
  }
}


问:
How to combine boto3 python code and get one csv output
I have written two codes to get some details about EC2, the reason written two code, I am not able to get the 'ComputerName' in EC2 describe_instance, so I have created separate code using boto3 client SSM get the 'ComputerName'. Now I tried to combine both codes into single code and get the output in single csv with separate columns and rows, someone help me with the below code to get the single csv output. Also please find the sample output.

```<code>import boto3
import csv
profiles = ['Dev_Databases','Dev_App','Prod_Database','Prod_App']
########################EC2-Details################################
csv_ob=open("EC2-Inventory.csv","w" ,newline='')
csv_w=csv.writer(csv_ob)
csv_w.writerow(["S_NO","profile","Instance_Id",'Instance_Type','Platform','State','LaunchTime','Privat_Ip'])
cnt=1
for ec2 in profiles:
    aws_mag_con=boto3.session.Session(profile_name=ec2)
    ec2_con_re=aws_mag_con.resource(service_name="ec2",region_name="ap-southeast-1")
    for each in ec2_con_re.instances.all():
        print(cnt,ec2,each.instance_id,each.instance_type,each.platform,each.state,each.launch_time.strftime("%Y-%m-%d"),each.private_ip_address,)
        csv_w.writerow([cnt,ec2,each.instance_id,each.instance_type,each.platform,each.state,each.launch_time.strftime("%Y-%m-%d"),each.private_ip_address])
        cnt+=1
csv_ob.close()
#######################HostName-Details###########################
csv_ob1=open("Hostname-Inventory.csv","w" ,newline='')
csv_w1=csv.writer(csv_ob1)
csv_w1.writerow(["S_NO",'Profile','InstanceId','ComputerName','PlatformName'])
cnt1=1
for ssm in profiles:
    session = boto3.Session(profile_name=ssm)
    ssm_client=session.client('ssm', region_name='ap-southeast-1')
    paginator = ssm_client.get_paginator('describe_instance_information')
    response_iterator = paginator.paginate(Filters=[{'Key': 'PingStatus','Values': ['Online']}])

    for item in response_iterator:
            for instance in item['InstanceInformationList']:
                if instance.get('PingStatus') == 'Online':
                    InstanceId = instance.get('InstanceId')
                    ComputerName = instance.get('ComputerName')#.replace(".WORKGROUP", "")
                    PlatformName = instance.get('PlatformName')
                    print(InstanceId,ComputerName,PlatformName)
                    csv_w1.writerow([cnt1,ssm,InstanceId,ComputerName,PlatformName])
                    cnt1+=1
csv_ob1.close()
</code>```

Sample Output Below:

Body:
I have written two codes to get some details about EC2, the reason written two code, I am not able to get the 'ComputerName' in EC2 describe_instance, so I have created separate code using boto3 client SSM get the 'ComputerName'. Now I tried to combine both codes into single code and get the output in single csv with separate columns and rows, someone help me with the below code to get the single csv output. Also please find the sample output.

import boto3
import csv
profiles = ['Dev_Databases','Dev_App','Prod_Database','Prod_App']
########################EC2-Details################################
csv_ob=open("EC2-Inventory.csv","w" ,newline='')
csv_w=csv.writer(csv_ob)
csv_w.writerow(["S_NO","profile","Instance_Id",'Instance_Type','Platform','State','LaunchTime','Privat_Ip'])
cnt=1
for ec2 in profiles:
    aws_mag_con=boto3.session.Session(profile_name=ec2)
    ec2_con_re=aws_mag_con.resource(service_name="ec2",region_name="ap-southeast-1")
    for each in ec2_con_re.instances.all():
        print(cnt,ec2,each.instance_id,each.instance_type,each.platform,each.state,each.launch_time.strftime("%Y-%m-%d"),each.private_ip_address,)
        csv_w.writerow([cnt,ec2,each.instance_id,each.instance_type,each.platform,each.state,each.launch_time.strftime("%Y-%m-%d"),each.private_ip_address])
        cnt+=1
csv_ob.close()
#######################HostName-Details###########################
csv_ob1=open("Hostname-Inventory.csv","w" ,newline='')
csv_w1=csv.writer(csv_ob1)
csv_w1.writerow(["S_NO",'Profile','InstanceId','ComputerName','PlatformName'])
cnt1=1
for ssm in profiles:
    session = boto3.Session(profile_name=ssm)
    ssm_client=session.client('ssm', region_name='ap-southeast-1')
    paginator = ssm_client.get_paginator('describe_instance_information')
    response_iterator = paginator.paginate(Filters=[{'Key': 'PingStatus','Values': ['Online']}])

    for item in response_iterator:
            for instance in item['InstanceInformationList']:
                if instance.get('PingStatus') == 'Online':
                    InstanceId = instance.get('InstanceId')
                    ComputerName = instance.get('ComputerName')#.replace(".WORKGROUP", "")
                    PlatformName = instance.get('PlatformName')
                    print(InstanceId,ComputerName,PlatformName)
                    csv_w1.writerow([cnt1,ssm,InstanceId,ComputerName,PlatformName])
                    cnt1+=1
csv_ob1.close()

Sample Output Below:


问:
Feature importance 'gain' in XGBoost for multiclassification tasks
I'd like to ask what is the formula for the gain in XGBoost models for multi classification tasks.
I know that for regression tasks it's calculated as SIMILARITY_LEFT_CHILD + SIMILARITY_RIGHT_CHILD - SIMILARITY_PARENT
and that for binary classification tasks the gain is calculated as ENTROPY_PARENT - AVG.(ENTROPY_CHILDREN).

For tasks of multiple categories the confusion started when I found far less information, and worse - I encountered two different explanations.
One explanation suggested using cross-entropy for a similar calculation for a binary classification:
https://medium.datadriveninvestor.com/understanding-the-log-loss-function-of-xgboost-8842e99d975d
And the other explanation has suggested using a Bayesian Information Criteria https://rpubs.com/mharris/multiclass_xgboost

Is one of the sources correct? Which one?


问:
Using pyautogui.screenshot in AWS Workspaces
I'm running a python script in the AWS Workspaces to take a screensot of my entire desktop (inside AWS).

The script is working fine but when I "ended" the AWS Workspace, the screenshot being taken is the login page. Please find attached.

Inside the AWS Workspace, I already did any possible ways to prevent "my computer" from sleeping. Likewise, its Running Mode is AlwaysOn.

What I want to achieve is even though my AWS Workspace is not "active" I want my python script to capture the active desktop not the login page.


问:
Thor commandline interface running in Ruby gem test environment but not from command line
After following this tutorial I decided to use Aruba, Cucumber and Thor to add CLI functionality for a gem that I'm working on. When I run bundle exec cucumber features
all of my test are green. Here is the output from the test:

```<code>Feature: Sherlock

  Scenario: User passes -d option                 # features/sherlock.feature:2
    When I run `sherlock analyze -d test_log_dir` # aruba-2.1.0/lib/aruba/cucumber/command.rb:3
    Then the output should contain "Hello World!" # aruba-2.1.0/lib/aruba/cucumber/command.rb:123

  Scenario: User passes -f option                 # features/sherlock.feature:6
    When I run `sherlock analyze -f test_log`     # aruba-2.1.0/lib/aruba/cucumber/command.rb:3
    Then the output should contain "Hello World!" # aruba-2.1.0/lib/aruba/cucumber/command.rb:123

2 scenarios (2 passed)
4 steps (4 passed)
0m1.070s

</code>```

Here is what my cli file looks like:

```<code>require "thor"
require "sherlock.rb"

module Sherlock
  class CLI < Thor
    desc "analyze", "Analyze web logs for malicous activity"
    method_option :file, aliases: "-f"
    method_option :directory, aliases: "-d"

    def analyze

      cli_error("Must specify a file or directory to analyze") unless options[:file] || options[:directory]

      Sherlock.parse_file options[:file] if options[:file]
      Sherlock.parse_dir options[:dir] if options[:dir]
      puts "Hello World!"

    end # end analyze

    private

    def cli_error(msg)
      puts msg
      exit(-1)
    end
  end # end CLI
end # end Sherlock
</code>```

ut
The CLI class is obviously working properly during test but I want it to work from the command line. For example, from the directory of the gem I want to be able to run sherlock analyze -d some_directory but when I do this is the output:

```<code>~/sherlock % sherlock
zsh: command not found: sherlock
</code>```

Why can't I run this gems CLI commands from the terminal ? Do I need to add it to PATH ?

Body:
After following this tutorial I decided to use Aruba, Cucumber and Thor to add CLI functionality for a gem that I'm working on. When I run bundle exec cucumber features
all of my test are green. Here is the output from the test:

Feature: Sherlock

  Scenario: User passes -d option                 # features/sherlock.feature:2
    When I run `sherlock analyze -d test_log_dir` # aruba-2.1.0/lib/aruba/cucumber/command.rb:3
    Then the output should contain "Hello World!" # aruba-2.1.0/lib/aruba/cucumber/command.rb:123

  Scenario: User passes -f option                 # features/sherlock.feature:6
    When I run `sherlock analyze -f test_log`     # aruba-2.1.0/lib/aruba/cucumber/command.rb:3
    Then the output should contain "Hello World!" # aruba-2.1.0/lib/aruba/cucumber/command.rb:123

2 scenarios (2 passed)
4 steps (4 passed)
0m1.070s

Here is what my cli file looks like:

require "thor"
require "sherlock.rb"

module Sherlock
  class CLI < Thor
    desc "analyze", "Analyze web logs for malicous activity"
    method_option :file, aliases: "-f"
    method_option :directory, aliases: "-d"

    def analyze

      cli_error("Must specify a file or directory to analyze") unless options[:file] || options[:directory]

      Sherlock.parse_file options[:file] if options[:file]
      Sherlock.parse_dir options[:dir] if options[:dir]
      puts "Hello World!"

    end # end analyze

    private

    def cli_error(msg)
      puts msg
      exit(-1)
    end
  end # end CLI
end # end Sherlock

ut
The CLI class is obviously working properly during test but I want it to work from the command line. For example, from the directory of the gem I want to be able to run sherlock analyze -d some_directory but when I do this is the output:

~/sherlock % sherlock
zsh: command not found: sherlock

Why can't I run this gems CLI commands from the terminal ? Do I need to add it to PATH ?


问:
How to fix the error: Error: " Error in `vectbl_as_row_location()`:
Error: " Error in vectbl_as_row_location():
! Can't subset rows with r.
✖ Logical subscript r must be size 1 or 48000, not 32.
Run rlang::last_error() to see where the error occurred. "
Error at the end of the code

Hi, I'm trying to do a random forest modeling on my data and I'm getting an attached image error, does anyone know what this error is and how to fix it? Thankful


问:
"apt-get -y install libpq-dev gcc" over https?
In my dockerfile i'm trying to install binaries for Postgres, the thing is that the command:

```<code>RUN apt-get update \
&& apt-get -y install libpq-dev gcc
</code>```

is trying to reach  http://deb.debian.org/ over port 80.

Is there any way i can force this command to reference https://deb.debian.org/ over 443 instead of unencrypted http 80?

Body:
In my dockerfile i'm trying to install binaries for Postgres, the thing is that the command:

RUN apt-get update \
&& apt-get -y install libpq-dev gcc

is trying to reach  http://deb.debian.org/ over port 80.

Is there any way i can force this command to reference https://deb.debian.org/ over 443 instead of unencrypted http 80?


问:
Rstudio not responding after running half of the script
I ran half of my script in RStudio, and the data are visible in the environment.

But console does not respond when I type something into it, and clicking other buttons in RStudio doesn't lead to anything.

In this case, what might be the problem?

I apologize that there is no minimal reproducible code, but here's a screenshot.


问:
dllexport does not export explicit function template instantiation definition
I can instantiate and MFC-export a function, but am unable to instantiate a templated function. I need the template to be defined generically so I can instantiate it elsewhere in the translation unit.

The sample code shows using MFC __declspec(dllexport) to export these functions:

```<code>// ExportTmpldFunc.h
void __declspec( dllexport ) MyFunc(); // MFC exported function declaration

template< class T >
void __declspec( dllexport ) MyTmpldFunc(); // primary MFC exported function template declaration

// ExportTmpldFunc.cpp
#include "ExportTmpldFunc.h"

void MyFunc() // function definition implicitly instantiated
{}

template< class T >
void MyTmpldFunc() // function template defined, but not instantiated
{}

// attempt1 to instantiate
template<> void MyTmpldFunc< int >() // explicit function template specialization defined, but not instantiated for MSVC
{}

// attempt2 to instantiate
template void MyTmpldFunc< int >(); // explicit function template instantiation definition, but still not instantiated for MSVC
</code>```

Exporting MyFunc works:

But my attempts to export MyTmpldFunc do not:

Body:
I can instantiate and MFC-export a function, but am unable to instantiate a templated function. I need the template to be defined generically so I can instantiate it elsewhere in the translation unit.

The sample code shows using MFC __declspec(dllexport) to export these functions:

// ExportTmpldFunc.h
void __declspec( dllexport ) MyFunc(); // MFC exported function declaration

template< class T >
void __declspec( dllexport ) MyTmpldFunc(); // primary MFC exported function template declaration

// ExportTmpldFunc.cpp
#include "ExportTmpldFunc.h"

void MyFunc() // function definition implicitly instantiated
{}

template< class T >
void MyTmpldFunc() // function template defined, but not instantiated
{}

// attempt1 to instantiate
template<> void MyTmpldFunc< int >() // explicit function template specialization defined, but not instantiated for MSVC
{}

// attempt2 to instantiate
template void MyTmpldFunc< int >(); // explicit function template instantiation definition, but still not instantiated for MSVC

Exporting MyFunc works:

But my attempts to export MyTmpldFunc do not:


问:
How do I save XMLHttpRequest.responseText in a variable
The code below keeps returning undefined</p>
```<code>
    console.log("Get users...");
        xhr = getXmlHttpRequestObject();
        xhr.onreadystatechange = dataCallback;
        // asynchronous requests

        const data = xhr.open("GET", "http://localhost:6868/content", true);
        console.log(data);
        }
</code>```

Body:
The code below keeps returning undefined

    console.log("Get users...");
        xhr = getXmlHttpRequestObject();
        xhr.onreadystatechange = dataCallback;
        // asynchronous requests

        const data = xhr.open("GET", "http://localhost:6868/content", true);
        console.log(data);
        }


问:
Getting latest facebook post via oembed read feature
Recently I've been working on a website that has synchronized news with its Facebook page equivalent.

The main idea is to display on website 3 latest post from owner's facebook page.

So far I've applied for an App Review to use function oEmbed Read and the permission has been granted.

I've been using Facebook's graph API with success but I need to specify a proper URL link to specific post.

What I would like is to skip the part where I need to provide an endpoint so it will be automatized. Both for posts as well as for videos.

Endly, the code will be run from JS component that is applied on the website.

Do you have any ideas how to solve this?


问:
Do not recurse to all root's subdirectories
I have a huge "Downloads" directory that I would like to have watched by watchman but I am only interested in the changes directly in the directory root, i. e. when a new file appears.

When I run watchman watch /path/to/dir the whole directory tree is scanned and it takes more than a minute to finish. What I am looking for is something like --no-recurse option that would prevent from scanning the path entirely.

I checked the documentation for watch command but found nothing that would provide the solution to my problem.


问:
How to start service in main activity by coding proximity sensor in service class
How to start service in main activity by coding proximity sensor in the service class.
my code not working please tell me

This Service class

```<code>public class ModeOnOff extends Service {
    private SensorManager sensorManager;
    private Sensor proximitySensor;
    private SensorEventListener proximitySensorListener;

    @Override
    public void onCreate() {
        SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
        if (sensorManager!=null){
            Sensor proximitySensor = sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);

            if (proximitySensor!=null) {
                sensorManager.registerListener(proximitySensorListener, proximitySensor, SensorManager.SENSOR_DELAY_NORMAL);

            }
        } else {
            Toast.makeText(this, "Senor service not detected.", Toast.LENGTH_SHORT).show();
        }
    }
    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Sensor();
        return START_STICKY;
    }
    @Override
    public void onDestroy() {
        super.onDestroy();
    }
    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
    //Function
    private void Sensor(){
        proximitySensorListener = new SensorEventListener() {
            @Override
            public void onSensorChanged(SensorEvent sensorEvent) {
                if (sensorEvent.sensor.getType()==Sensor.TYPE_PROXIMITY){
                    if (sensorEvent.values[0] > 3){
                        Toast.makeText(ModeOnOff.this, "Hii", Toast.LENGTH_SHORT).show();
                    } else {
                        Toast.makeText(ModeOnOff.this, "By", Toast.LENGTH_SHORT).show();
                    }
                }
            }
            @Override
            public void onAccuracyChanged(Sensor sensor, int accuracy) {
            }
        };
    }
}

</code>```

And This Main Activity

```<code>
public class MainActivity extends AppCompatActivity {
    Button btnSensor;

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

        btnSensor.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startService(new Intent(MainActivity.this, ModeOnOff.class));
            }
        });

    }
}

</code>```

I want to code the proximity sensor in the service class and start the service from the main activity

how to startService -  startService(new Intent(MainActivity.this, ModeOnOff.class));

Body:
How to start service in main activity by coding proximity sensor in the service class.
my code not working please tell me

This Service class

public class ModeOnOff extends Service {
    private SensorManager sensorManager;
    private Sensor proximitySensor;
    private SensorEventListener proximitySensorListener;

    @Override
    public void onCreate() {
        SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
        if (sensorManager!=null){
            Sensor proximitySensor = sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);

            if (proximitySensor!=null) {
                sensorManager.registerListener(proximitySensorListener, proximitySensor, SensorManager.SENSOR_DELAY_NORMAL);

            }
        } else {
            Toast.makeText(this, "Senor service not detected.", Toast.LENGTH_SHORT).show();
        }
    }
    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Sensor();
        return START_STICKY;
    }
    @Override
    public void onDestroy() {
        super.onDestroy();
    }
    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
    //Function
    private void Sensor(){
        proximitySensorListener = new SensorEventListener() {
            @Override
            public void onSensorChanged(SensorEvent sensorEvent) {
                if (sensorEvent.sensor.getType()==Sensor.TYPE_PROXIMITY){
                    if (sensorEvent.values[0] > 3){
                        Toast.makeText(ModeOnOff.this, "Hii", Toast.LENGTH_SHORT).show();
                    } else {
                        Toast.makeText(ModeOnOff.this, "By", Toast.LENGTH_SHORT).show();
                    }
                }
            }
            @Override
            public void onAccuracyChanged(Sensor sensor, int accuracy) {
            }
        };
    }
}

And This Main Activity

public class MainActivity extends AppCompatActivity {
    Button btnSensor;

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

        btnSensor.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startService(new Intent(MainActivity.this, ModeOnOff.class));
            }
        });

    }
}

I want to code the proximity sensor in the service class and start the service from the main activity

how to startService -  startService(new Intent(MainActivity.this, ModeOnOff.class));


问:
How to quickly instantiate a pyspark SparkContext for unit testing?
In my Python 3.8 unit test code, I need to instantiate a SparkContext to test some functions manipulating a RDD.

The problem is that instantiating a SparkContext takes a few seconds, which is too slow. I'm using this code to instantiate a SparkContext:

```<code>from pyspark import SparkContext

return SparkContext.getOrCreate()
</code>```

The tests only run filter, map and distinct on an RDD. In my tests, I only want to test an expected output against obtained output on a tiny dataset (lists of length between 5 and 10) and I want them to run almost instantaneously. I don't need all other features offered by PySpark (such as parallelization).

I tried various ways, such as below, but instantiation takes as much time:

```<code>from pyspark import SparkContext, SparkConf

conf = SparkConf().setMaster("local[2]").setAppName("pytest-pyspark-local-testing")
sc = SparkContext(conf=conf)
</code>```

Body:
In my Python 3.8 unit test code, I need to instantiate a SparkContext to test some functions manipulating a RDD.

The problem is that instantiating a SparkContext takes a few seconds, which is too slow. I'm using this code to instantiate a SparkContext:

from pyspark import SparkContext

return SparkContext.getOrCreate()

The tests only run filter, map and distinct on an RDD. In my tests, I only want to test an expected output against obtained output on a tiny dataset (lists of length between 5 and 10) and I want them to run almost instantaneously. I don't need all other features offered by PySpark (such as parallelization).

I tried various ways, such as below, but instantiation takes as much time:

from pyspark import SparkContext, SparkConf

conf = SparkConf().setMaster("local[2]").setAppName("pytest-pyspark-local-testing")
sc = SparkContext(conf=conf)


问:
Axios retry file upload (PUT method) with interceptor
The issue I face is that my axios interceptor is not retrying file upload requests using PUT method.

If my JWT tokens expire in the process of trying to upload the file my interceptor refreshes them but doesn't retry the file request upload, all other requests work and get retried once the tokens are refreshed. Wasn't able to find a solid answer to this problem so before sharing a ton of code just wanted to check if this is common.

So my question is this the desired behavior? What would be the workaround? Do a token refresh each time before calling upload request?

My current interceptor looks something as follows:

Thank you for any pointers/help!


问:
Error message: Maximum Recursion exhausted even with OPTION( MAXRECURSION 0)
I'm creating a function that will have as input a start date and a number of minutes. The function will add the number of minutes to the start date and it will output an end date, but only considering work hours and excluding weekends and holidays.

You can see part of the function below.

```<code>ALTER FUNCTION [dbo].[DataFimPrevisto] (@tempoPrevisto real, @DataIni datetime)
RETURNS datetime
WITH EXECUTE AS CALLER
AS
BEGIN
    DECLARE @DataFim datetime;
    DECLARE @calculo TABLE( xend datetime, [minutes] int);
    WITH
    drange (date_start, date_end) AS
    (
        SELECT
        CAST(@DataIni AS DATE) AS date_start,
        CAST(DATEADD( YEAR, 1, @DataIni) AS DATE) AS date_end
    ),
    dates0 (adate, date_end) AS
    (
        SELECT date_start, date_end FROM drange
        UNION ALL
        SELECT DATEADD(day,  1, adate), date_end FROM dates0 WHERE adate < date_end
    ),
    dates (adate) AS
    (
        SELECT adate FROM dates0
        WHERE DATEPART(dw , adate) NOT IN ('1', '7') AND NOT EXISTS( SELECT 1 FROM BAS_PeriodosExcecoes B WHERE B.Trabalhavel = 0 AND B.DataInicio = adate)
    ),
    hours (hour_start, hour_end) AS
    (
        SELECT  8.5*60, 12.5*60
        UNION
        SELECT 13.5*60, 18*60
    ),
    hours_friday (hour_start, hour_end) AS
    (
        SELECT  8*60, 14*60
    ),
    datehours (xstart, xend) AS
    (
        SELECT *
        FROM
        (
            SELECT
            DATEADD(minute, hour_start, CAST(adate AS datetime)) xstart,
            DATEADD(minute, hour_end  , CAST(adate AS datetime)) xend
            FROM dates AS d, hours AS h
            WHERE DATEPART(dw , adate) <> '6'

            UNION

            SELECT T2.xstart, T2.xend
            FROM
            (
                SELECT *, ROW_NUMBER() OVER(PARTITION BY T.xstart ORDER BY T.xend ASC) AS rank
                FROM
                (
                    SELECT
                    @DataIni xstart,
                    DATEADD(minute, hour_end, CAST(adate AS datetime)) xend
                    FROM dates AS d, hours AS h
                    WHERE adate = CAST( @DataIni AS DATE) AND DATEADD(minute, hour_end, CAST(adate AS datetime)) > @DataIni AND DATEPART(dw , adate) <> '6'
                ) T
            ) T2
            WHERE T2.rank = 1

            UNION

            SELECT
            DATEADD(minute, hour_start, CAST(adate AS datetime)) xstart,
            DATEADD(minute, hour_end  , CAST(adate AS datetime)) xend
            FROM dates AS d, hours_friday AS h
            WHERE DATEPART(dw , adate) = '6'

            UNION

            SELECT T2.xstart, T2.xend
            FROM
            (
                SELECT *, ROW_NUMBER() OVER(PARTITION BY T.xstart ORDER BY T.xend ASC) AS rank
                FROM
                (
                    SELECT
                    @DataIni xstart,
                    DATEADD(minute, hour_end, CAST(adate AS datetime)) xend
                    FROM dates AS d, hours_friday AS h
                    WHERE adate = CAST( @DataIni AS DATE) AND DATEADD(minute, hour_end, CAST(adate AS datetime)) > @DataIni AND DATEPART(dw , adate) = '6'
                ) T
            ) T2
            WHERE T2.rank = 1
        ) T3 WHERE T3.xstart >= @DataIni
    ),
    cumulative (xend, [minutes]) AS
    (
        SELECT t.xend, SUM(DATEDIFF(MINUTE, xstart, xend)) OVER (ORDER BY xstart) AS [minutes]
        FROM datehours AS t
    )
    INSERT INTO @calculo
    SELECT TOP 1 xend, [minutes]
    FROM cumulative
    WHERE [minutes] >= @tempoPrevisto
    ORDER BY cumulative.xend ASC;

    SET @DataFim = (SELECT DATEADD( MINUTE, @tempoPrevisto - MAX([minutes]), MAX( [xend])) FROM @calculo);
    RETURN(@DataFim);
END;
</code>```

When I execute this function with

```<code>SELECT dbo.DataFimPrevisto( 21240, DATETIMEFROMPARTS( 2023, 1, 25, 6, 0, 0, 0)) OPTION(MAXRECURSION 0);
</code>```

SSMS returns the error message

The maximum recursion 100 has been exhausted before statement completion

Even tho I'm using OPTION(MAXRECURSION 0).

Body:
I'm creating a function that will have as input a start date and a number of minutes. The function will add the number of minutes to the start date and it will output an end date, but only considering work hours and excluding weekends and holidays.

You can see part of the function below.

ALTER FUNCTION [dbo].[DataFimPrevisto] (@tempoPrevisto real, @DataIni datetime)
RETURNS datetime
WITH EXECUTE AS CALLER
AS
BEGIN
    DECLARE @DataFim datetime;
    DECLARE @calculo TABLE( xend datetime, [minutes] int);
    WITH
    drange (date_start, date_end) AS
    (
        SELECT
        CAST(@DataIni AS DATE) AS date_start,
        CAST(DATEADD( YEAR, 1, @DataIni) AS DATE) AS date_end
    ),
    dates0 (adate, date_end) AS
    (
        SELECT date_start, date_end FROM drange
        UNION ALL
        SELECT DATEADD(day,  1, adate), date_end FROM dates0 WHERE adate < date_end
    ),
    dates (adate) AS
    (
        SELECT adate FROM dates0
        WHERE DATEPART(dw , adate) NOT IN ('1', '7') AND NOT EXISTS( SELECT 1 FROM BAS_PeriodosExcecoes B WHERE B.Trabalhavel = 0 AND B.DataInicio = adate)
    ),
    hours (hour_start, hour_end) AS
    (
        SELECT  8.5*60, 12.5*60
        UNION
        SELECT 13.5*60, 18*60
    ),
    hours_friday (hour_start, hour_end) AS
    (
        SELECT  8*60, 14*60
    ),
    datehours (xstart, xend) AS
    (
        SELECT *
        FROM
        (
            SELECT
            DATEADD(minute, hour_start, CAST(adate AS datetime)) xstart,
            DATEADD(minute, hour_end  , CAST(adate AS datetime)) xend
            FROM dates AS d, hours AS h
            WHERE DATEPART(dw , adate) <> '6'

            UNION

            SELECT T2.xstart, T2.xend
            FROM
            (
                SELECT *, ROW_NUMBER() OVER(PARTITION BY T.xstart ORDER BY T.xend ASC) AS rank
                FROM
                (
                    SELECT
                    @DataIni xstart,
                    DATEADD(minute, hour_end, CAST(adate AS datetime)) xend
                    FROM dates AS d, hours AS h
                    WHERE adate = CAST( @DataIni AS DATE) AND DATEADD(minute, hour_end, CAST(adate AS datetime)) > @DataIni AND DATEPART(dw , adate) <> '6'
                ) T
            ) T2
            WHERE T2.rank = 1

            UNION

            SELECT
            DATEADD(minute, hour_start, CAST(adate AS datetime)) xstart,
            DATEADD(minute, hour_end  , CAST(adate AS datetime)) xend
            FROM dates AS d, hours_friday AS h
            WHERE DATEPART(dw , adate) = '6'

            UNION

            SELECT T2.xstart, T2.xend
            FROM
            (
                SELECT *, ROW_NUMBER() OVER(PARTITION BY T.xstart ORDER BY T.xend ASC) AS rank
                FROM
                (
                    SELECT
                    @DataIni xstart,
                    DATEADD(minute, hour_end, CAST(adate AS datetime)) xend
                    FROM dates AS d, hours_friday AS h
                    WHERE adate = CAST( @DataIni AS DATE) AND DATEADD(minute, hour_end, CAST(adate AS datetime)) > @DataIni AND DATEPART(dw , adate) = '6'
                ) T
            ) T2
            WHERE T2.rank = 1
        ) T3 WHERE T3.xstart >= @DataIni
    ),
    cumulative (xend, [minutes]) AS
    (
        SELECT t.xend, SUM(DATEDIFF(MINUTE, xstart, xend)) OVER (ORDER BY xstart) AS [minutes]
        FROM datehours AS t
    )
    INSERT INTO @calculo
    SELECT TOP 1 xend, [minutes]
    FROM cumulative
    WHERE [minutes] >= @tempoPrevisto
    ORDER BY cumulative.xend ASC;

    SET @DataFim = (SELECT DATEADD( MINUTE, @tempoPrevisto - MAX([minutes]), MAX( [xend])) FROM @calculo);
    RETURN(@DataFim);
END;

When I execute this function with

SELECT dbo.DataFimPrevisto( 21240, DATETIMEFROMPARTS( 2023, 1, 25, 6, 0, 0, 0)) OPTION(MAXRECURSION 0);

SSMS returns the error message

The maximum recursion 100 has been exhausted before statement completion

Even tho I'm using OPTION(MAXRECURSION 0).