问:
When i make a rest call between the services i get a Exception says Cannot invoke "java.util.List.stream()" because the return value is null
When iI'm trying to make a rest call on another service it says nullpointer exception even though I've added an empty constructor in the Rating.class even though it says the same

java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because the return value of "com.microservice.model.UserRating.getUserRating()" is null

I followed below tutorial
[https://www.youtube.com/watch?v=Dmvhe2cw-_k&list=PLqq-6Pq4lTTZSKAFG6aCDVDP86Qx4lNas&index=15&ab_channel=JavaBrains]

please find the below code

```<code>
package com.microservice;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
public class MovieCatalogsServicesApplication {

    @Bean
    public RestTemplate getRestTemplate() {
        return new RestTemplate();

    }

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

}

</code>```

Controller class

```<code>package com.microservice.resources;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import com.microservice.model.CatalogItem;
import com.microservice.model.Movie;
import com.microservice.model.Rating;
import com.microservice.model.UserRating;

@RestController
@RequestMapping("/catalog")
public class MovieCatalogResource {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/{UserId}")
    public List<CatalogItem> getCatalog(@PathVariable("UserId") String UserId) {

        //RestTemplate restTemplate = new RestTemplate();

        UserRating ratings = restTemplate.getForObject("http://localhost:1080/ratingdata/users" + UserId,
                UserRating.class);

        return ratings.getUserRating().stream().map(rating -> {
            Movie movie = restTemplate.getForObject("http://localhost:9080/movies/" + rating.getMovieId(), Movie.class);
            return new CatalogItem(movie.getName(), "Suspense", rating.getRating());
        }).collect(Collectors.toList());
    }
}

</code>```

Model class

```<code>package com.microservice.model;

public class CatalogItem {

    private String name;
    private String desc;
    private int rating;

    public CatalogItem(String name, String desc, int rating) {
        super();
        this.name = name;
        this.desc = desc;
        this.rating = rating;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
    public int getRating() {
        return rating;
    }
    public void setRating(int rating) {
        this.rating = rating;
    }

}

</code>```
```<code>package com.microservice.model;

public class Movie {

    private String movieId;
    private String name;

    public Movie() {
        super();
    }

    public Movie(String movieId, String name) {
        super();
        this.movieId = movieId;
        this.name = name;
    }

    public String getMovieId() {
        return movieId;
    }

    public void setMovieId(String movieId) {
        this.movieId = movieId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}

</code>```
```<code>package com.microservice.model;

public class Rating {

    private String movieId;
    private int rating;

    public Rating() {
    }

    public Rating(String movieId, int rating) {
        this.movieId = movieId;
        this.rating = rating;
    }

    public String getMovieId() {
        return movieId;
    }

    public void setMovieId(String movieId) {
        this.movieId = movieId;
    }

    public int getRating() {
        return rating;
    }

    public void setRating(int rating) {
        this.rating = rating;
    }

}

</code>```
```<code>package com.microservice.model;

import java.util.List;
//mcs
public class UserRating {

    private List<Rating> userRating;

    public List<Rating> getUserRating() {
        return userRating;
    }

    public void setUserRating(List<Rating> userRating) {
        this.userRating = userRating;
    }

}
</code>```

I tried to hit URL - > http://localhost:8080/catalog/foo and the expected result was [{"name":"Test","desc":"TestDesc","rating":4},{"name":"Test","desc":"TestDesc","rating":3}]
But actually resulted into

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Mon Dec 12 13:33:17 IST 2022
There was an unexpected error (type=Internal Server Error, status=500).

Error below
`

```<code>
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
[32m :: Spring Boot :: [39m     [2m (v2.7.7-SNAPSHOT)[0;39m

[2m2022-12-12 13:33:08.931[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36mc.m.MovieCatalogsServicesApplication    [0;39m [2m:[0;39m Starting MovieCatalogsServicesApplication using Java 16.0.2 on MKW58ZLPC0034 with PID 21932 (C:\Users\st57540\Documents\workspace-spring-tool-suite-4-4.12.0.RELEASE\microserviceworkspace\movie-catalogs-services\target\classes started by ST57540 in C:\Users\st57540\Documents\workspace-spring-tool-suite-4-4.12.0.RELEASE\microserviceworkspace\movie-catalogs-services)
[2m2022-12-12 13:33:08.934[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36mc.m.MovieCatalogsServicesApplication    [0;39m [2m:[0;39m No active profile set, falling back to 1 default profile: "default"
[2m2022-12-12 13:33:09.827[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.s.b.w.embedded.tomcat.TomcatWebServer [0;39m [2m:[0;39m Tomcat initialized with port(s): 8080 (http)
[2m2022-12-12 13:33:09.837[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.apache.catalina.core.StandardService  [0;39m [2m:[0;39m Starting service [Tomcat]
[2m2022-12-12 13:33:09.837[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36morg.apache.catalina.core.StandardEngine [0;39m [2m:[0;39m Starting Servlet engine: [Apache Tomcat/9.0.69]
[2m2022-12-12 13:33:09.991[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.a.c.c.C.[Tomcat].[localhost].[/]      [0;39m [2m:[0;39m Initializing Spring embedded WebApplicationContext
[2m2022-12-12 13:33:09.991[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36mw.s.c.ServletWebServerApplicationContext[0;39m [2m:[0;39m Root WebApplicationContext: initialization completed in 1001 ms
[2m2022-12-12 13:33:10.373[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.s.b.w.embedded.tomcat.TomcatWebServer [0;39m [2m:[0;39m Tomcat started on port(s): 8080 (http) with context path ''
[2m2022-12-12 13:33:10.384[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36mc.m.MovieCatalogsServicesApplication    [0;39m [2m:[0;39m Started MovieCatalogsServicesApplication in 1.845 seconds (JVM running for 2.967)
[2m2022-12-12 13:33:16.888[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36mo.a.c.c.C.[Tomcat].[localhost].[/]      [0;39m [2m:[0;39m Initializing Spring DispatcherServlet 'dispatcherServlet'
[2m2022-12-12 13:33:16.889[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36mo.s.web.servlet.DispatcherServlet       [0;39m [2m:[0;39m Initializing Servlet 'dispatcherServlet'
[2m2022-12-12 13:33:16.889[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36mo.s.web.servlet.DispatcherServlet       [0;39m [2m:[0;39m Completed initialization in 0 ms
[2m2022-12-12 13:33:17.048[0;39m [31mERROR[0;39m [35m21932[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36mo.a.c.c.C.[.[.[/].[dispatcherServlet]   [0;39m [2m:[0;39m Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because the return value of "com.microservice.model.UserRating.getUserRating()" is null] with root cause

java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because the return value of "com.microservice.model.UserRating.getUserRating()" is null
    at com.microservice.resources.MovieCatalogResource.getCatalog(MovieCatalogResource.java:34) ~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na]
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.24.jar:5.3.24]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-5.3.24.jar:5.3.24]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1071) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:964) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:670) ~[tomcat-embed-core-9.0.69.jar:4.0.FR]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:779) ~[tomcat-embed-core-9.0.69.jar:4.0.FR]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.24.jar:5.3.24]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.24.jar:5.3.24]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.24.jar:5.3.24]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.24.jar:5.3.24]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.24.jar:5.3.24]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.24.jar:5.3.24]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1784) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at java.base/java.lang.Thread.run(Thread.java:831) ~[na:na]

</code>```

`

Body:
When iI'm trying to make a rest call on another service it says nullpointer exception even though I've added an empty constructor in the Rating.class even though it says the same

java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because the return value of "com.microservice.model.UserRating.getUserRating()" is null

I followed below tutorial
[https://www.youtube.com/watch?v=Dmvhe2cw-_k&list=PLqq-6Pq4lTTZSKAFG6aCDVDP86Qx4lNas&index=15&ab_channel=JavaBrains]

please find the below code

package com.microservice;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
public class MovieCatalogsServicesApplication {

    @Bean
    public RestTemplate getRestTemplate() {
        return new RestTemplate();

    }

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

}

Controller class

package com.microservice.resources;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import com.microservice.model.CatalogItem;
import com.microservice.model.Movie;
import com.microservice.model.Rating;
import com.microservice.model.UserRating;

@RestController
@RequestMapping("/catalog")
public class MovieCatalogResource {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/{UserId}")
    public List<CatalogItem> getCatalog(@PathVariable("UserId") String UserId) {

        //RestTemplate restTemplate = new RestTemplate();

        UserRating ratings = restTemplate.getForObject("http://localhost:1080/ratingdata/users" + UserId,
                UserRating.class);

        return ratings.getUserRating().stream().map(rating -> {
            Movie movie = restTemplate.getForObject("http://localhost:9080/movies/" + rating.getMovieId(), Movie.class);
            return new CatalogItem(movie.getName(), "Suspense", rating.getRating());
        }).collect(Collectors.toList());
    }
}

Model class

package com.microservice.model;

public class CatalogItem {

    private String name;
    private String desc;
    private int rating;

    public CatalogItem(String name, String desc, int rating) {
        super();
        this.name = name;
        this.desc = desc;
        this.rating = rating;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
    public int getRating() {
        return rating;
    }
    public void setRating(int rating) {
        this.rating = rating;
    }

}

package com.microservice.model;

public class Movie {

    private String movieId;
    private String name;

    public Movie() {
        super();
    }

    public Movie(String movieId, String name) {
        super();
        this.movieId = movieId;
        this.name = name;
    }

    public String getMovieId() {
        return movieId;
    }

    public void setMovieId(String movieId) {
        this.movieId = movieId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}

package com.microservice.model;

public class Rating {

    private String movieId;
    private int rating;

    public Rating() {
    }

    public Rating(String movieId, int rating) {
        this.movieId = movieId;
        this.rating = rating;
    }

    public String getMovieId() {
        return movieId;
    }

    public void setMovieId(String movieId) {
        this.movieId = movieId;
    }

    public int getRating() {
        return rating;
    }

    public void setRating(int rating) {
        this.rating = rating;
    }

}

package com.microservice.model;

import java.util.List;
//mcs
public class UserRating {

    private List<Rating> userRating;

    public List<Rating> getUserRating() {
        return userRating;
    }

    public void setUserRating(List<Rating> userRating) {
        this.userRating = userRating;
    }

}

I tried to hit URL - > http://localhost:8080/catalog/foo and the expected result was [{"name":"Test","desc":"TestDesc","rating":4},{"name":"Test","desc":"TestDesc","rating":3}]
But actually resulted into

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Mon Dec 12 13:33:17 IST 2022
There was an unexpected error (type=Internal Server Error, status=500).

Error below
`

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
[32m :: Spring Boot :: [39m     [2m (v2.7.7-SNAPSHOT)[0;39m

[2m2022-12-12 13:33:08.931[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36mc.m.MovieCatalogsServicesApplication    [0;39m [2m:[0;39m Starting MovieCatalogsServicesApplication using Java 16.0.2 on MKW58ZLPC0034 with PID 21932 (C:\Users\st57540\Documents\workspace-spring-tool-suite-4-4.12.0.RELEASE\microserviceworkspace\movie-catalogs-services\target\classes started by ST57540 in C:\Users\st57540\Documents\workspace-spring-tool-suite-4-4.12.0.RELEASE\microserviceworkspace\movie-catalogs-services)
[2m2022-12-12 13:33:08.934[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36mc.m.MovieCatalogsServicesApplication    [0;39m [2m:[0;39m No active profile set, falling back to 1 default profile: "default"
[2m2022-12-12 13:33:09.827[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.s.b.w.embedded.tomcat.TomcatWebServer [0;39m [2m:[0;39m Tomcat initialized with port(s): 8080 (http)
[2m2022-12-12 13:33:09.837[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.apache.catalina.core.StandardService  [0;39m [2m:[0;39m Starting service [Tomcat]
[2m2022-12-12 13:33:09.837[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36morg.apache.catalina.core.StandardEngine [0;39m [2m:[0;39m Starting Servlet engine: [Apache Tomcat/9.0.69]
[2m2022-12-12 13:33:09.991[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.a.c.c.C.[Tomcat].[localhost].[/]      [0;39m [2m:[0;39m Initializing Spring embedded WebApplicationContext
[2m2022-12-12 13:33:09.991[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36mw.s.c.ServletWebServerApplicationContext[0;39m [2m:[0;39m Root WebApplicationContext: initialization completed in 1001 ms
[2m2022-12-12 13:33:10.373[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36mo.s.b.w.embedded.tomcat.TomcatWebServer [0;39m [2m:[0;39m Tomcat started on port(s): 8080 (http) with context path ''
[2m2022-12-12 13:33:10.384[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[           main][0;39m [36mc.m.MovieCatalogsServicesApplication    [0;39m [2m:[0;39m Started MovieCatalogsServicesApplication in 1.845 seconds (JVM running for 2.967)
[2m2022-12-12 13:33:16.888[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36mo.a.c.c.C.[Tomcat].[localhost].[/]      [0;39m [2m:[0;39m Initializing Spring DispatcherServlet 'dispatcherServlet'
[2m2022-12-12 13:33:16.889[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36mo.s.web.servlet.DispatcherServlet       [0;39m [2m:[0;39m Initializing Servlet 'dispatcherServlet'
[2m2022-12-12 13:33:16.889[0;39m [32m INFO[0;39m [35m21932[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36mo.s.web.servlet.DispatcherServlet       [0;39m [2m:[0;39m Completed initialization in 0 ms
[2m2022-12-12 13:33:17.048[0;39m [31mERROR[0;39m [35m21932[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36mo.a.c.c.C.[.[.[/].[dispatcherServlet]   [0;39m [2m:[0;39m Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because the return value of "com.microservice.model.UserRating.getUserRating()" is null] with root cause

java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because the return value of "com.microservice.model.UserRating.getUserRating()" is null
    at com.microservice.resources.MovieCatalogResource.getCatalog(MovieCatalogResource.java:34) ~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na]
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.24.jar:5.3.24]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-5.3.24.jar:5.3.24]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1071) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:964) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:670) ~[tomcat-embed-core-9.0.69.jar:4.0.FR]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.24.jar:5.3.24]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:779) ~[tomcat-embed-core-9.0.69.jar:4.0.FR]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.24.jar:5.3.24]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.24.jar:5.3.24]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.24.jar:5.3.24]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.24.jar:5.3.24]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.24.jar:5.3.24]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.24.jar:5.3.24]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1784) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
    at java.base/java.lang.Thread.run(Thread.java:831) ~[na:na]

`


来源: stackexchange

问:
User Input of strings with if/else compare in NASM x86-64 Linux
I have the question, how to make if/else statements with user Input (Strings) in NASM x86-64 for Linux ARM.
I don't get it how to do it.

I tried some online solutions with integers just modified to my thing but it didn't worked.
So as example as a C++ code:

cout << "Enter name:";
cin >> name;

if (name == "max") {
 cout << "Access denied!" << endl;
}
```
<p>Would be nice if anyone could help me but not only with solution. With explaining to understand it.
I am new at learning NASM so please be nice </p>
<p>This is what i have:</p>
```section .data
    txt1 db "Wie lautet dein Name? "
    txt2 db "Hallo, "

section .bss
    name: resb 128

section .text
    global _start

_start:
    mov rax, 1
    mov rdi, 1
    mov rsi, txt1
    mov rdx, 22
    syscall

    mov rax, 0
    mov rdi, 0
    mov rsi, name
    mov rdx, 128
    syscall

    mov rax, 1
    mov rdi, 1
    mov rsi, txt2
    mov rdx, 7
    syscall

    mov rax, 1
    mov rdi, 1
    mov rsi, name
    mov rdx, 128
    syscall

    mov rax, 60
    mov rdi, 0
    syscall
```

Thank you :)

ContentLicense: CC BY-SA 4.0

Body:
I have the question, how to make if/else statements with user Input (Strings) in NASM x86-64 for Linux ARM.
I don't get it how to do it.

I tried some online solutions with integers just modified to my thing but it didn't worked.
So as example as a C++ code:

cout << "Enter name:";
cin >> name;

if (name == "max") {
 cout << "Access denied!" << endl;
}

Would be nice if anyone could help me but not only with solution. With explaining to understand it.
I am new at learning NASM so please be nice

This is what i have:

section .data
    txt1 db "Wie lautet dein Name? "
    txt2 db "Hallo, "

section .bss
    name: resb 128

section .text
    global _start

_start:
    mov rax, 1
    mov rdi, 1
    mov rsi, txt1
    mov rdx, 22
    syscall

    mov rax, 0
    mov rdi, 0
    mov rsi, name
    mov rdx, 128
    syscall

    mov rax, 1
    mov rdi, 1
    mov rsi, txt2
    mov rdx, 7
    syscall

    mov rax, 1
    mov rdi, 1
    mov rsi, name
    mov rdx, 128
    syscall

    mov rax, 60
    mov rdi, 0
    syscall

Thank you :)


问:
extract mappep reads from sam to classify them
I want to extract mapped reads from a SAM file (from a resistome analysis using AMR++) to taxonomically classify them.

I was searching from samtools manual and stackoverflow mainly and found these steps
samtools  view -@ 20 -S -b SRR4454621_1.alignment.sam > SRR4454621_1.bam ## to convert SAM to BAM
samtools view -@ 20 -c SRR4454621_1.bam ### to count reads: 10000126
samtools view -@ 20 -c -F 260 SRR4454621_1.bam ### to count mapped reads: 53189
samtools view -@ 20 -b -F 4 SRR4454621_1.bam > SRR4454621_1_mapped.bam ### to get mapped reads
samtools view -@ 20 -c SRR4454621_1_mapped.bam ### new check to count mapped reads: 53189
samtools bam2fq SRR4454621_1_mapped.bam | seqtk seq -A > SRR4454621_1_mapped.fa ## to extract sequences
grep ">" SRR4454621_1_mapped.fa | wc -l ### to check whether everything is going rigth: 53063 (lost 126 sequences)

Then I run centrifuge to classify them.
centrifuge -f -x centridb/hpvc testing/SRR4454621_1_mapped.fa -S testing/SRR4454621_1_mapped.tsv -p 24 --report-file testing/SRR4454621_1_mapped_report.tsv

And my problems is that the sum of column "numReads" from SRR4454621_1_mapped_report.tsv is 107682, and I would expect to be the same that the sum of equivalent column from resistome analysis which is 51961.
Where can it be the problem? Are the main steps I described above well done?

Thank you very much for your help,

Manuel


问:
VS Code - Import and Run Spring Boot Project
I am trying to import and Run a Spring Boot Project which is working in STS under VS Code.

But I am facing the following error:

```<code>org.eclipse.core.runtime.CoreException: The project: ckac which is referenced by the classpath, does not exist.
</code>```

Here is the screenshot of the Project Structure.

On my local machine, my project is under senp_kyc.

I used the option File -> Open Folder and selected the folder under which my Spring Boot Application code is present.

It will be great if someone could guide me for the same.

Body:
I am trying to import and Run a Spring Boot Project which is working in STS under VS Code.

But I am facing the following error:

org.eclipse.core.runtime.CoreException: The project: ckac which is referenced by the classpath, does not exist.

Here is the screenshot of the Project Structure.

On my local machine, my project is under senp_kyc.

I used the option File -> Open Folder and selected the folder under which my Spring Boot Application code is present.

It will be great if someone could guide me for the same.


问:
Unsupported post request while making facebook graph API request to post data in Catalog
I am beginner in Facebook Graph API and While making the post request to "/{catalog_id}/batch" I get the following error: "Unsupported post request. Object with ID '<catalog_id>' does not exist, cannot be loaded due to missing permissions, or does not support this operation." with error_code:100 and error_subcode:33.
I suppose this error is due to the lack of write permission for catalog_management for which an App review is required. But when the app is in development mode and we need to push the test data to catalog, I don't think we need app review and there must be any solution to push test data using "catalog batch API" method without requesting the app review.
Also while trying to generate token from system user, all the permission selection check box are disabled.

response from graph API call

permission code selection while generating token from system user


问:
Unable to Identify a url
Can anyone find how it works, recently received the url.
It is not ip, it is now resolving to anything, it act as redirection to another server.

Can any one decrypt this

" http://0027.0342.0212.0070 "

Decrypt the url to see how it works

Title: Unable to Identify a url


问:
Show Popup when Phone Rings in React native with expo
I'm doing an android application with the expo framework. I want to make a popup when a voice call comes in and after call gets disconnected.

We can achieve this module using broadcast receiver(android.intent.action.PHONE_STATE). But I couldn't find any packages for react native with expo.

Can anyone help me to achieve this functionality?


问:
Embed latest Instagram post to a PHP website
I want to embed the latest updating post from Instagram profile in the website homepage. Now I can select a particular post in the profile and while embedding that on it shows in the site. But is there any way to get the latest one only without directly mentioning the post?

I tried to add a single post but when I tried the embed option from profile it only shows as
enter image description here no profile name or an thing related to it is not showing


问:
Convert OpenCV corner detection to NVIDIA VPI
I have a C++ code for detecting corners in OpenCV. I am trying to convert it to use NVIDIA VPI package in python to run on a Jetson Nano, but the implementations aren't equivalent, the VPI function doesn't have all of the parameters that the OpenCV function has, so I'm not sure how to go about doing this.

Here is (part of) my code in C++, I am using cv::goodFeaturesToTrack with Harris
Detector:

```<code>int main(void){
    cv::Mat image;
    vector<Point2f> points;
    VideoCapture cap("video.avi");
    cap >> frame;  //reading frame from video, size = 1936x1216
    cvtColor(cap, image, cv::COLOR_RGB2GRAY);  // to grayscale
    cv::resize(image, image, m_ImageSizeFinal);  //resize to 968x608
    goodFeaturesToTrackMask = createDetectionMaskImage();  //Create mask of type CV_8UC1
    cv::goodFeaturesToTrack(image, points, 500, 0.001, 15, goodFeaturesToTrackMask, 3, true);
}
</code>```

and here is my attempt to convert it to NVIDIA VPI in Python:

```<code>import vpi
import cv2
import numpy as np
import csv

cap = cv2.VideoCapture('2021_01_25__14_05_01.avi')
backend = vpi.Backend.CUDA

image1, image2 = None, None
with backend:
    writer = csv.writer(f)
    start = time.time():
        while cap.isOpened():
          now = time.time()
          ret, frame = cap.read()
          if ret == True:
              image = vpi.asimage(frame, vpi.Format.BGR8).convert(vpi.Format.U8)
              image = image.rescale((968, 608), interp=vpi.Interp.LINEAR, border=vpi.Border.ZERO)
              corners, scores = image.harriscorners(sensitivity=0.04)
</code>```

This fails to detect any points at all, the return value is always 0. What am I doing wrong?

Thank you in advance.

Body:
I have a C++ code for detecting corners in OpenCV. I am trying to convert it to use NVIDIA VPI package in python to run on a Jetson Nano, but the implementations aren't equivalent, the VPI function doesn't have all of the parameters that the OpenCV function has, so I'm not sure how to go about doing this.

Here is (part of) my code in C++, I am using cv::goodFeaturesToTrack with Harris
Detector:

int main(void){
    cv::Mat image;
    vector<Point2f> points;
    VideoCapture cap("video.avi");
    cap >> frame;  //reading frame from video, size = 1936x1216
    cvtColor(cap, image, cv::COLOR_RGB2GRAY);  // to grayscale
    cv::resize(image, image, m_ImageSizeFinal);  //resize to 968x608
    goodFeaturesToTrackMask = createDetectionMaskImage();  //Create mask of type CV_8UC1
    cv::goodFeaturesToTrack(image, points, 500, 0.001, 15, goodFeaturesToTrackMask, 3, true);
}

and here is my attempt to convert it to NVIDIA VPI in Python:

import vpi
import cv2
import numpy as np
import csv

cap = cv2.VideoCapture('2021_01_25__14_05_01.avi')
backend = vpi.Backend.CUDA

image1, image2 = None, None
with backend:
    writer = csv.writer(f)
    start = time.time():
        while cap.isOpened():
          now = time.time()
          ret, frame = cap.read()
          if ret == True:
              image = vpi.asimage(frame, vpi.Format.BGR8).convert(vpi.Format.U8)
              image = image.rescale((968, 608), interp=vpi.Interp.LINEAR, border=vpi.Border.ZERO)
              corners, scores = image.harriscorners(sensitivity=0.04)

This fails to detect any points at all, the return value is always 0. What am I doing wrong?

Thank you in advance.


问:
Getting nx format:write uncommitted failed without output and eslint --fix failed without output error when I do git commit
Getting nx format:write --uncommitted failed and eslint --fix failed without output error when I try to do git commit

When I try to do git commit it is showing as below

Running tasks for staged files...

.lintstagedrc.json 1 file $schema no files [SKIPPED]

{apps, libs}/**/*. {ts, tsx, js, jsx) - 1 file * eslint-fix [KILLED]

.(ts, tsx, js, jsx, json, nd, arc) 1 file nx format:write -uncommitted [SIGSEGV] Skipped because of errors from tasks. [SKIPPED]

I

✓ Reverting to original state because of errors...

✓ Cleaning up temporary files...

*nx format:write -uncommitted failed without output (SIGSEGV).

eslint --fix failed without output


问:
Topological sort of a tree
What's the most efficient way to achieve the below outcome in python (preferably numpy)?

Input: a list of edges [(u_1, v_1), ..., (u_m, v_m)] of tree.

Assume nodes are {0,...,n-1}.

Output: a n x n matrix O such that O_ij = 1 iff i <= j in the topological order.

I know DFS can be used to get an ordering of the form v1, v2, ..., vn but I also want equalities and not just a strict ordering. Also, what numpy specific optimizations can be used to further speed this up?

Title: Topological sort of a tree


问:
How to use system proxy in asyncio?
I can use requests lib to connect a website, cause using system proxy,
but when I use asyncio, cannot connect. So where to set  asyncio to use system proxy?

I use telethon lib (not aiohttp) which using python_socks/async_/asyncio to connect telegram, so should I change code of asyncio?

Title: How to use system proxy in asyncio?


问:
React.js: How to use clipboard.setImageData() for FireFox?
In a react-website (programmed in TypeScript), I want to copy an image into the user's clipboard, which works fine for Chrome and Safari, using navigator.clipboard.write() with ClipboardItem.

However, FireFox does not support this - it only supports another function: browser.clipboard.setImageData() (reference).

How can I use this function inside my react-TS code?
Thanks!


问:
Spark Streaming Kafka write output to console OR to Kafka Topic is not working
I am trying to stream data in Spark from kafka through python codes using 2 different machines (1 for kafka used to produce JSON data, and the other used for Spart to stream this data after aggregation),
when streaming the data, it couldn't print to console or being written to another topic. and I used different values for outputmode. and when terminating the code i got the below:

ERROR:root:Exception while sending command.
Traceback (most recent call last):
File "/opt/spark/python/lib/py4j-0.10.9.5-src.zip/py4j/clientserver.py", line 511, in send_command
answer = smart_decode(self.stream.readline()[:-1])
RuntimeError: reentrant call inside <_io.BufferedReader name=3>

During handling of the above exception, another exception occurred:

An error occurred while calling o76.awaitTermination

However, same script works with me running kafka and spark on the same machine

`

```<code>print("Printing Schema of orders_df4: ")
    orders_df4.printSchema()
    # Write final result into console for debugging purpose
    orders_agg_write_stream = orders_df4.writeStream \
        .trigger(processingTime='5 seconds')\
        .outputMode("update")\
        .option("truncate", "false")\
        .format("console")\
        .start()\
        .awaitTermination()
</code>```

`
OR

`

```<code>    # Write Final RESULT To KAFKA TOPIC in the same machine
   orders_df4.writeStream \
       .outputMode("complete")
       .format("kafka")\
       .option("kafka_bootsrap_servers",kafka_bootsrap_servers)\
       .option("topic",kafka_topic_write)\
       .option("checkpointLocation", "checkpoint")\
        .start()\
       .awaitAnyTermination()
</code>```

enter image description here`

Body:
I am trying to stream data in Spark from kafka through python codes using 2 different machines (1 for kafka used to produce JSON data, and the other used for Spart to stream this data after aggregation),
when streaming the data, it couldn't print to console or being written to another topic. and I used different values for outputmode. and when terminating the code i got the below:

ERROR:root:Exception while sending command.
Traceback (most recent call last):
File "/opt/spark/python/lib/py4j-0.10.9.5-src.zip/py4j/clientserver.py", line 511, in send_command
answer = smart_decode(self.stream.readline()[:-1])
RuntimeError: reentrant call inside <_io.BufferedReader name=3>

During handling of the above exception, another exception occurred:

An error occurred while calling o76.awaitTermination

However, same script works with me running kafka and spark on the same machine

`

print("Printing Schema of orders_df4: ")
    orders_df4.printSchema()
    # Write final result into console for debugging purpose
    orders_agg_write_stream = orders_df4.writeStream \
        .trigger(processingTime='5 seconds')\
        .outputMode("update")\
        .option("truncate", "false")\
        .format("console")\
        .start()\
        .awaitTermination()

`
OR

`

    # Write Final RESULT To KAFKA TOPIC in the same machine
   orders_df4.writeStream \
       .outputMode("complete")
       .format("kafka")\
       .option("kafka_bootsrap_servers",kafka_bootsrap_servers)\
       .option("topic",kafka_topic_write)\
       .option("checkpointLocation", "checkpoint")\
        .start()\
       .awaitAnyTermination()

enter image description here`


问:
Reset the SSL client certificate in React after logout and show it again on every login
Current result

When the user tries to login a web app, the browser shows the certificate selection popup and after selecting the certificate the dashboard page is shown. And if the user clicks logout, the user is logged out. Again if the user tries to login the app there is no certificate selection popup, it directly goes to the dashboard page.

Required result

After the user login, if the user log's out the web app and tries to login again, I need to show the certificate selection again. How to achieve this result in React.


问:
The applicationContext.xml is not where it should be in .jar
I have a project in eclipse, a library that has an applicationContext inside a package "net.xxxx.xxxxlib.core.config", inside that package there are two things, a class and the applicationContext.xml. In local everything compiles correctly, I pass the corresponding maven tests and I make the build in Jenkins with a success result.

The build in jenkins triggers two actions:

On the one hand the jar is uploaded to a JFrog Artifactory updating its RELEASE version, when I access the RELEASE to its "xxx-RELEASE-sources.jar" and go to the path where the applicationContext has to be, it is in place, so far so good.

On the other hand the project is compressed in a jar and uploaded to a shared directory so that any authorized application can use it.
It's in this second step where I find the problem, when I open the jar and go to the path where the applicationContext should be, it is not there.

I have seen in other similar problems that suggest to change the applicationContext to src/main/resources, for requirements beyond my control this is not possible in my project.

I don't know if the information I have given will be enough for anyone to think of what might be happening. I am still grateful for any suggestions.


问:
Change Cell Range Values Based On Value Of One Cell
The below formula does not work. if c5 or c8 have values equal to "yes" then every cell in the range (excluding c5 and/or c8) will automatically equal "no". if both c5 and c8 = no, just calculate the percentage of yes's to no's. i will give you an example. we have 10 answers. c5 and c8 are both no, and everything else is equal to yes. that is 80%. if we have an n/a (instead of yes or no), we subtract the number of n/a's from the total and calculate the quotient. for example, say we have 10 answers, c5 and c8 are both no again, and we have 1 n/a. so the quotient would be 7/9=77 percent.

I even tried to generate a vba formula and it didn't work.
Pivate Sub Worksheet_Change(ByVal Target As Range
If Worksheet1.Range("C18").Value="Yes" Then
Worksheet1.Range(("C17:C23") - C18).Value = "No"
End if
End Sub

=If(OR(C5=“Yes,C8=“Yes”),”No”,[IFERROR((COUNTIF(C4:C23,"Yes”)-C5-C8)/(COUNTIF((C4:C23,"Yes”)-C5-C8)+(COUNTIF(C4:C23,"No”)-C5-C8)),””)])


问:
Using carbon design system, how to switch between multiple themes?
looking for some advice. I'm using @carbon/react as you all know its coming with 4 default themes. Right now i'm overriding the default theme (white) with their design tokens so it reflects across all carbon components used in the app. in the index.scss i'm just pointing to my theme file I created that will override some tokens

```<code>@use '@carbon/react/scss/theme' with (
   $theme: themes.$my-custom-theme
)
@use '@carbon/react'
:root{
@include theme.theme();
}
</code>```

It's all fine so far, BUT in the near future app will have multiple clients each with their own theme. Whats the best way to achieve that? using env variable to pass a certain theme? (but how to achieve that?) or what if each client wants 2 themes (light and dark). No idea how to organize it when there's multiple themes involved and how to point to the appropriate one. Hope someone can help, thanks in advance

Researching the best way possible, the only thing I can think off is passing a env variable, but need some clarity how to do that

Body:
looking for some advice. I'm using @carbon/react as you all know its coming with 4 default themes. Right now i'm overriding the default theme (white) with their design tokens so it reflects across all carbon components used in the app. in the index.scss i'm just pointing to my theme file I created that will override some tokens

@use '@carbon/react/scss/theme' with (
   $theme: themes.$my-custom-theme
)
@use '@carbon/react'
:root{
@include theme.theme();
}

It's all fine so far, BUT in the near future app will have multiple clients each with their own theme. Whats the best way to achieve that? using env variable to pass a certain theme? (but how to achieve that?) or what if each client wants 2 themes (light and dark). No idea how to organize it when there's multiple themes involved and how to point to the appropriate one. Hope someone can help, thanks in advance

Researching the best way possible, the only thing I can think off is passing a env variable, but need some clarity how to do that


问:
How to use bunnyCDN to load images in flutter app
I'm working on a flutter app for a client and I've been stuck trying to load images from bunnyCDN and prior to this project I've never used bunnyCDN or any other CDN. I've done research and every necessary step to figure out how to go about it but still to no avail. I need help on how to load, download and upload from bunnyCDN in flutter app.

Thanks in advance.


问:
2D region plotting with sliders to see how the region changes as parameter varies (Python / plotly / matplotlib)
I'm a graduate student working in theoretical economics.
I'm a noob plotting in python.
I'm currently writing a paper, and I've found closed form solutions for my equilibrium.
They depend on 3 paramters.

The problem is that there are 3 different types of equilibria, and sufficient conditions that support each equilibrium are determined by 3~5 highly non linear inequalities.

I had used plotly to plot in 3D which parameter values fall in this region determined by inequalities.

My advisor now asks me to plot in 2D with one parameter fixed.
He wants to see how this region bounde with inequalities varies as the fixed parameter varies.
I know Wolfram Mathematica is a good tool to do this, but I've already used the free trial and my university didn't buy mathematica.

Although I've googled a lot, I don't have a clue how to write the code.

Any references, example codes would be very thankful.

Thank You.

I don't have a clue how to even start my code.


问:
Could not open settings generic class file error when running flutter application
I am trying to run a new flutter project but then i get this error.

```<code>
* What went wrong:
Could not open settings generic class cache for settings file 'C:\Users\techj\OneDrive\Desktop\EshopperApplication\eshopper_application\android\settings.gradle' (C:\Users\techj\.gradle\caches\7.4\scripts\ea4ydi90mwjg9g63m7r6nimmx).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63```

I am new to flutter can you please help me out

My gradle version
```------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------

Build time:   2022-08-05 21:17:56 UTC
Revision:     d1daa0cbf1a0103000b71484e1dbfe096e095918

Kotlin:       1.6.21
Groovy:       3.0.10
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          19.0.1 (Oracle Corporation 19.0.1+10-21)
OS:           Windows 11 10.0 amd64
</code>```

i was hopping the application would run as intended only to be flagged with this error..Spent a few hours doing some research but then i was hopping the problem would be with my gradle file or version but nothing seems to working for  me.

Body:
I am trying to run a new flutter project but then i get this error.

* What went wrong:
Could not open settings generic class cache for settings file 'C:\Users\techj\OneDrive\Desktop\EshopperApplication\eshopper_application\android\settings.gradle' (C:\Users\techj\.gradle\caches\7.4\scripts\ea4ydi90mwjg9g63m7r6nimmx).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63```

I am new to flutter can you please help me out

My gradle version
```------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------

Build time:   2022-08-05 21:17:56 UTC
Revision:     d1daa0cbf1a0103000b71484e1dbfe096e095918

Kotlin:       1.6.21
Groovy:       3.0.10
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          19.0.1 (Oracle Corporation 19.0.1+10-21)
OS:           Windows 11 10.0 amd64

i was hopping the application would run as intended only to be flagged with this error..Spent a few hours doing some research but then i was hopping the problem would be with my gradle file or version but nothing seems to working for  me.


问:
Detect if the user has closed the window, not reloaded it. React
I understand how to use beforeunload, but I need to determine if it was just a page reload or if the page has been closed for a while. I suppose this can be somehow beat localStorage / sessionStorage. Save in storage the time?

Thanks!


问:
io.springfox:springfox-boot-starter:3.0.0 does not work
I use openjdk-17 and spring 3 (with jakarta)

I want to use
io.springfox:springfox-boot-starter:3.0.0

As I understood it should work without any configurations.

build.gradle

```<code>plugins {
   id 'java'
   id 'org.springframework.boot' version '3.0.0'
   id 'io.spring.dependency-management' version '1.1.0'
   id 'org.hibernate.orm' version '6.1.5.Final'
}

group = 'com.corporation'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

configurations {
   compileOnly {
      extendsFrom annotationProcessor
   }
}

repositories {
   mavenCentral()
}

dependencies {
   implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
   //implementation 'org.springframework.boot:spring-boot-starter-security'
   implementation 'org.springframework.boot:spring-boot-starter-web'
   implementation 'org.liquibase:liquibase-core'
   implementation 'org.hibernate:hibernate-validator:8.0.0.Final'
   implementation 'org.springdoc:springdoc-openapi-ui:1.6.13'
   compileOnly 'org.projectlombok:lombok'
   developmentOnly 'org.springframework.boot:spring-boot-devtools'
   runtimeOnly 'org.postgresql:postgresql'
   annotationProcessor 'org.projectlombok:lombok'
   testImplementation 'org.springframework.boot:spring-boot-starter-test'
   //testImplementation 'org.springframework.security:spring-security-test'
   implementation 'org.mapstruct:mapstruct:1.5.3.Final'
   annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.3.Final'
   implementation "io.springfox:springfox-boot-starter:3.0.0"
}

tasks.named('test') {
   useJUnitPlatform()
}

hibernate {
   enhancement {
      lazyInitialization true
      dirtyTracking true
      associationManagement true
   }
}
</code>```

Controller

```<code>@RequiredArgsConstructor
@RestController
@RequestMapping("/user")
@Api("asdfasdf")
public class UserController {
    private final UserService UserService;

    @GetMapping("/{id}")
    @ApiOperation("adsfa")
    public ResponseEntity<UserDto> getUserById(@PathVariable("id") int id) {
        Optional<User> optionalUser = UserService.findById(id);

        return optionalUser.map(user -> ResponseEntity.ok(UserMapper.INSTANCE.userToUserDto(user))).orElse(ResponseEntity.status(404).body(null));
    }
}
</code>```

I checked urls:

http://localhost:8080/swagger-ui

http://localhost:8080/swagger-ui/

http://localhost:8080/swagger-ui.html

http://localhost:8080/swagger-ui/index.html

I got 404

I want to get swagger-ui page

Body:
I use openjdk-17 and spring 3 (with jakarta)

I want to use
io.springfox:springfox-boot-starter:3.0.0

As I understood it should work without any configurations.

build.gradle

plugins {
   id 'java'
   id 'org.springframework.boot' version '3.0.0'
   id 'io.spring.dependency-management' version '1.1.0'
   id 'org.hibernate.orm' version '6.1.5.Final'
}

group = 'com.corporation'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

configurations {
   compileOnly {
      extendsFrom annotationProcessor
   }
}

repositories {
   mavenCentral()
}

dependencies {
   implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
   //implementation 'org.springframework.boot:spring-boot-starter-security'
   implementation 'org.springframework.boot:spring-boot-starter-web'
   implementation 'org.liquibase:liquibase-core'
   implementation 'org.hibernate:hibernate-validator:8.0.0.Final'
   implementation 'org.springdoc:springdoc-openapi-ui:1.6.13'
   compileOnly 'org.projectlombok:lombok'
   developmentOnly 'org.springframework.boot:spring-boot-devtools'
   runtimeOnly 'org.postgresql:postgresql'
   annotationProcessor 'org.projectlombok:lombok'
   testImplementation 'org.springframework.boot:spring-boot-starter-test'
   //testImplementation 'org.springframework.security:spring-security-test'
   implementation 'org.mapstruct:mapstruct:1.5.3.Final'
   annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.3.Final'
   implementation "io.springfox:springfox-boot-starter:3.0.0"
}

tasks.named('test') {
   useJUnitPlatform()
}

hibernate {
   enhancement {
      lazyInitialization true
      dirtyTracking true
      associationManagement true
   }
}

Controller

@RequiredArgsConstructor
@RestController
@RequestMapping("/user")
@Api("asdfasdf")
public class UserController {
    private final UserService UserService;

    @GetMapping("/{id}")
    @ApiOperation("adsfa")
    public ResponseEntity<UserDto> getUserById(@PathVariable("id") int id) {
        Optional<User> optionalUser = UserService.findById(id);

        return optionalUser.map(user -> ResponseEntity.ok(UserMapper.INSTANCE.userToUserDto(user))).orElse(ResponseEntity.status(404).body(null));
    }
}

I checked urls:

http://localhost:8080/swagger-ui

http://localhost:8080/swagger-ui/

http://localhost:8080/swagger-ui.html

http://localhost:8080/swagger-ui/index.html

I got 404

I want to get swagger-ui page


问:
Error when calling AUTOTUNE from tensorflow version 2.9.2
I am using AUTOTUNE in my TensorFlow project for a long time ago. The project is in google colab. It runs fine in the past. Now when I try to run the project, it has an error. I think the tensorflow version is changed causing the error.

In the AUTOTUNE line it shows me:

AttributeError: module 'tensorflow.data.experimental' has no attribute 'AUTOTUNE'

I already try to implement the solution in this thread but the issue is still there.

Here is my code:

```<code>try:
    AUTOTUNE = tf.data.AUTOTUNE
except:
    AUTOTUNE = tf.data.experimental.AUTOTUNE
</code>```

When I try to print the TensorFlow version and tf.data.AUTOTUNE

```<code>import tensorflow as tf
print(tf.__version__, ',')
print(tf.data.AUTOTUNE)
</code>```

it show me the below result:

```<code>2.9.2 ,
-1
</code>```

Need your help, please.

Body:
I am using AUTOTUNE in my TensorFlow project for a long time ago. The project is in google colab. It runs fine in the past. Now when I try to run the project, it has an error. I think the tensorflow version is changed causing the error.

In the AUTOTUNE line it shows me:

AttributeError: module 'tensorflow.data.experimental' has no attribute 'AUTOTUNE'

I already try to implement the solution in this thread but the issue is still there.

Here is my code:

try:
    AUTOTUNE = tf.data.AUTOTUNE
except:
    AUTOTUNE = tf.data.experimental.AUTOTUNE

When I try to print the TensorFlow version and tf.data.AUTOTUNE

import tensorflow as tf
print(tf.__version__, ',')
print(tf.data.AUTOTUNE)

it show me the below result:

2.9.2 ,
-1

Need your help, please.


问:
How to send a message through telegram bot? [There is a solution, but something is wrong]
I have a problem trying to send a message through the command. The fact is that the message comes only to me
Method:

```<code>        else if(text.startsWith("/add")){

           sendMessage.setText(message.getText());
            sendMessage.setParseMode("Markdown");
                for (Customer customer : Database.customerList) {
                    System.out.println(customer);
                     Long id = customer.getId();
                    sendMessage.setChatId(String.valueOf(id));
                }

            ComponentContainer.MY_TELEGRAM_BOT.sendMsg(sendMessage);
        }
</code>```

I'm trying to send a message to all users through the processing of all id through the database, as a result, the message comes only to me

Body:
I have a problem trying to send a message through the command. The fact is that the message comes only to me
Method:

        else if(text.startsWith("/add")){

           sendMessage.setText(message.getText());
            sendMessage.setParseMode("Markdown");
                for (Customer customer : Database.customerList) {
                    System.out.println(customer);
                     Long id = customer.getId();
                    sendMessage.setChatId(String.valueOf(id));
                }

            ComponentContainer.MY_TELEGRAM_BOT.sendMsg(sendMessage);
        }

I'm trying to send a message to all users through the processing of all id through the database, as a result, the message comes only to me


问:
PyTorch - derivative for aten::scatter_ is not implemented
I am having problems backpropagating (loss.backward()) the error when my model uses the aten::scatter_ function to compute the loss function.

First, I define my model where in the forward function, I use the aten::scatter_ function to create the product across individuals with the same id.

```<code>import torch
import torch.nn as nn
import torch.optim as optim
class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.beta = nn.Linear(1, 1, bias=False)

    def forward(self, x, id):
        b = self.beta(torch.ones(1, 1))
        xb = x*b
        N = torch.unique(id).shape[0]
        scattering = torch.ones(N, 1, dtype=x.dtype)
        # Here!!!... I am computing the product across rows of the same id
        scattering_res = scattering.scatter_(0, id-1, xb, reduce='multiply' )
        loss = torch.sum(scattering_res)
        return loss
</code>```

Here I create some tensors to apply the model and replicate the error message I am getting:

```<code>id = torch.tensor([1, 1, 2, 2, 3, 3, 4, 4, 5, 5],dtype=torch.int64).reshape(10, 1)
x = torch.tensor([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], dtype=torch.float).reshape(10, 1)
y = torch.tensor([1, 2, 3, 4, 5, 6, 7, 8, 9, 10],dtype=torch.float).reshape(10, 1)
net = Net()
print(net)
optimizer = optim.SGD(net.parameters(), lr=0.01)
criterion = nn.MSELoss()

# Update params
optimizer.zero_grad()
loss = net(x, id)
loss.backward()
## RuntimeError: derivative for aten::scatter_ is not implemented
</code>```

Do you know how to solve this issue? Some people have suggested I move the product operation to numpy, but I am still not convinced that this will actually solve my problem since the operation I need is a product by group of individuals from the same id.

Additionally, I came across a GitHub issue (https://github.com/rusty1s/pytorch_scatter/issues/63) where a similar problem was posted, but I couldn't adjust it to solve my problem.

Below you can see the whole traceback error message.

```<code>---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Untitled-2 in <cell line: 32>()
     <a href='untitled:Untitled-2?line=31'>32</a> optimizer.zero_grad()
     <a href='untitled:Untitled-2?line=32'>33</a> loss = net(x, id)
---> <a href='untitled:Untitled-2?line=33'>34</a> loss.backward()

File c:\Users\u0133260\Anaconda3\envs\pyt\lib\site-packages\torch\_tensor.py:396, in Tensor.backward(self, gradient, retain_graph, create_graph, inputs)
    387 if has_torch_function_unary(self):
    388     return handle_torch_function(
    389         Tensor.backward,
    390         (self,),
   (...)
    394         create_graph=create_graph,
    395         inputs=inputs)
--> 396 torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)

File c:\Users\u0133260\Anaconda3\envs\pyt\lib\site-packages\torch\autograd\__init__.py:173, in backward(tensors, grad_tensors, retain_graph, create_graph, grad_variables, inputs)
    168     retain_graph = create_graph
    170 # The reason we repeat same the comment below is that
    171 # some Python versions print out the first line of a multi-line function
    172 # calls in the traceback and some print out the last line
--> 173 Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the backward pass
    174     tensors, grad_tensors_, retain_graph, create_graph, inputs,
    175     allow_unreachable=True, accumulate_grad=True)

RuntimeError: derivative for aten::scatter_ is not implemented
</code>```

Crossposted at: https://discuss.pytorch.org/t/derivative-for-aten-scatter-is-not-implemented/168133

Body:
I am having problems backpropagating (loss.backward()) the error when my model uses the aten::scatter_ function to compute the loss function.

First, I define my model where in the forward function, I use the aten::scatter_ function to create the product across individuals with the same id.

import torch
import torch.nn as nn
import torch.optim as optim
class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.beta = nn.Linear(1, 1, bias=False)

    def forward(self, x, id):
        b = self.beta(torch.ones(1, 1))
        xb = x*b
        N = torch.unique(id).shape[0]
        scattering = torch.ones(N, 1, dtype=x.dtype)
        # Here!!!... I am computing the product across rows of the same id
        scattering_res = scattering.scatter_(0, id-1, xb, reduce='multiply' )
        loss = torch.sum(scattering_res)
        return loss

Here I create some tensors to apply the model and replicate the error message I am getting:

id = torch.tensor([1, 1, 2, 2, 3, 3, 4, 4, 5, 5],dtype=torch.int64).reshape(10, 1)
x = torch.tensor([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], dtype=torch.float).reshape(10, 1)
y = torch.tensor([1, 2, 3, 4, 5, 6, 7, 8, 9, 10],dtype=torch.float).reshape(10, 1)
net = Net()
print(net)
optimizer = optim.SGD(net.parameters(), lr=0.01)
criterion = nn.MSELoss()

# Update params
optimizer.zero_grad()
loss = net(x, id)
loss.backward()
## RuntimeError: derivative for aten::scatter_ is not implemented

Do you know how to solve this issue? Some people have suggested I move the product operation to numpy, but I am still not convinced that this will actually solve my problem since the operation I need is a product by group of individuals from the same id.

Additionally, I came across a GitHub issue (https://github.com/rusty1s/pytorch_scatter/issues/63) where a similar problem was posted, but I couldn't adjust it to solve my problem.

Below you can see the whole traceback error message.

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Untitled-2 in <cell line: 32>()
     32 optimizer.zero_grad()
     33 loss = net(x, id)
---> 34 loss.backward()

File c:\Users\u0133260\Anaconda3\envs\pyt\lib\site-packages\torch\_tensor.py:396, in Tensor.backward(self, gradient, retain_graph, create_graph, inputs)
    387 if has_torch_function_unary(self):
    388     return handle_torch_function(
    389         Tensor.backward,
    390         (self,),
   (...)
    394         create_graph=create_graph,
    395         inputs=inputs)
--> 396 torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)

File c:\Users\u0133260\Anaconda3\envs\pyt\lib\site-packages\torch\autograd\__init__.py:173, in backward(tensors, grad_tensors, retain_graph, create_graph, grad_variables, inputs)
    168     retain_graph = create_graph
    170 # The reason we repeat same the comment below is that
    171 # some Python versions print out the first line of a multi-line function
    172 # calls in the traceback and some print out the last line
--> 173 Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the backward pass
    174     tensors, grad_tensors_, retain_graph, create_graph, inputs,
    175     allow_unreachable=True, accumulate_grad=True)

RuntimeError: derivative for aten::scatter_ is not implemented

Crossposted at: https://discuss.pytorch.org/t/derivative-for-aten-scatter-is-not-implemented/168133


问:
Receptive Field in Swin Transformer
I want to ask if is it true that the receptive field of swin transformer is just in the local window where we compute the self-attention? And is there any way to increase the receptive field when using swin transformer?

I know that when we use consecutive convolution layers, we will get a bigger receptive field as result. So, can we do the same with swin transformer?

Title: Receptive Field in Swin Transformer


问:
How to create a new flutter project with the same app signing and id of an old project?
I have an old Flutter project that was written about 3 years ago and already published on Play Store and App Store, I want to revamp the whole app code, features and structure and update it to the same published app, however I feel it will be better to recreate the project from scratch with the new Flutter and dart versions and new packages and so on.
So is it possible to recreate a new Flutter project on Android Studio while keeping the same app keys and ids for Play and App Store?</p>


问:
conda environment creation without cuda configuration
Problem:
I'm trying to copy a conda environment from one machine to another machine.
The source machine is Internet-connected, CUDA-enabled Ubuntu, and the destination machine is an offline Ubuntu, has no CUDA machine.
To avoid unexpected problems, I hope that there is a way to exclude CUDA settings when I create an environment in source machine.

What I've tried:
Without considering CUDA availability, I've made a clone of a conda environment in the source machine and manually copied into the offline machine, following the link https://stackoverflow.com/a/58103362/10982975.
It was able to activate the environment in the destination machine, but still I'm worrying potential problems which can be caused by the CUDA configuration mismatch.

What I've not tried yet:
Physical removal of CUDA card from the source machine.

Summarize:
Is there a way to exclude CUDA settings when I create an environment in source machine?


问:
Giving different names to parcel dist files
I'm using Parcel to build and run my Node.js app. Whenever I run parcel build, I always end up with two different js files.

According to this issue on the Parcel bundler Github page, this is normal because one of the two has the assembly changes. The problem is that my client only needs one of them, and prefers to run the build himself. I need a way to distinguish the two files easily, so he can tell which one he needs to use (we integrate the app into a portal, and he has to copy the file over there.)

I've tried using parcel-namer-custom, but it doesn't seem to work for giving them distinct names - they always end up identical except for the hashes. Is there a way to fix this, or a different package that would do this for me?

I tried using this configuration with parcel-namer-custom:

```<code>
  "parcel-namer-custom": {
    "index.js$": "index-file-[N].[hash].[ext]",
    "page2.js$": "other-file-[N].[hash].[ext]",
    ".css$": "display[N].css"
  },

</code>```

But the [N] doesn't appear to work as regex: it just appears as-is on the dist file.

Body:
I'm using Parcel to build and run my Node.js app. Whenever I run parcel build, I always end up with two different js files.

According to this issue on the Parcel bundler Github page, this is normal because one of the two has the assembly changes. The problem is that my client only needs one of them, and prefers to run the build himself. I need a way to distinguish the two files easily, so he can tell which one he needs to use (we integrate the app into a portal, and he has to copy the file over there.)

I've tried using parcel-namer-custom, but it doesn't seem to work for giving them distinct names - they always end up identical except for the hashes. Is there a way to fix this, or a different package that would do this for me?

I tried using this configuration with parcel-namer-custom:

  "parcel-namer-custom": {
    "index.js$": "index-file-[N].[hash].[ext]",
    "page2.js$": "other-file-[N].[hash].[ext]",
    ".css$": "display[N].css"
  },

But the [N] doesn't appear to work as regex: it just appears as-is on the dist file.


问:
Configure executable name in gluonfx maven plugin
I'm building a javaFx app to native using gluonfx maven plugin.
For CI reasons I can't change the standard from <name> property, which is used by gluonFx to name the resulting executable.

I want to build my executable with a different name. I have tried creating a maven profile and overwriting the value of <project.name> but didn't work.

Any advice on this?
Thanks in advance!


问:
Nodemail insert JS into html tag
So i try to use javascript in html when i send email with nodemailer.But when i alert, JS does not working at all.Do i need to create another page in order to do that?

Thanks.

```<code>    let testAccount = await nodemailer.createTestAccount();

    let transporter = nodemailer.createTransport({
      host: "smtp.ethereal.email",
      port: 587,
      secure: false,
      auth: {
        user:"**********", // generated ethereal user
        pass:"**********", // generated ethereal password
      },
    });

    // send mail with defined transport object
    let info = await transporter.sendMail({
      from: '"***************', // sender address
      to: "***************", // list of receivers
      subject: "Email Verification ✔", // Subject line
      text: "Email Verification", // plain text body
      html:" <h1>Verrification email</h1> <h2>Click the button so you can verify your account!</h2> <button id = 'button' type='button'>Verify!</button>  <script> document.getElementById('button').onclick = function(){alert('Verified')} </script>"
    });
</code>```

Title: Nodemail insert JS into html tag

Body:
So i try to use javascript in html when i send email with nodemailer.But when i alert, JS does not working at all.Do i need to create another page in order to do that?

Thanks.

    let testAccount = await nodemailer.createTestAccount();

    let transporter = nodemailer.createTransport({
      host: "smtp.ethereal.email",
      port: 587,
      secure: false,
      auth: {
        user:"**********", // generated ethereal user
        pass:"**********", // generated ethereal password
      },
    });

    // send mail with defined transport object
    let info = await transporter.sendMail({
      from: '"***************', // sender address
      to: "***************", // list of receivers
      subject: "Email Verification ✔", // Subject line
      text: "Email Verification", // plain text body
      html:"
Verrification email

Click the button so you can verify your account!
 <button id = 'button' type='button'>Verify!</button>  "
    });


问:
Variable in html for responsiveness
Hi I am very new to code and I am trying to make a website I was wondering what the code would be to make the source link in the html a variable that will change based on window size making it responsive.

In essence I want to have different source link depending on whether it is desktop or mobile and I don't have the skills to do it or understand the tutorials.

var frameNumber = 0, // start video at frame 0
  // lower numbers = faster playback
  playbackConst = 500,
  // get page height from video duration
  setHeight = document.getElementById("set-height"),
  // select video element
  vid = document.getElementById('v0');

// dynamically set the page height according to video length
vid.addEventListener('loadedmetadata', function() {
  setHeight.style.height = Math.floor(vid.duration) * playbackConst + "px";
});

// Use requestAnimationFrame for smooth playback
function scrollPlay() {
  var frameNumber = window.pageYOffset / playbackConst;
  vid.currentTime = frameNumber;
  window.requestAnimationFrame(scrollPlay);
}

window.requestAnimationFrame(scrollPlay);```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div id="set-height"></div>
<p id="time"></p>
<video id="v0" tabindex="0" autobuffer="autobuffer" preload="preload">
  <source type="video/mp4; codecs="avc1.42E01E, mp4a.40.2"" src="https://optimiseweb.dev/wp-content/uploads/2022/12/webpage-final.mp4"></source>
</video></code>```

Title: Variable in html for responsiveness

Body:
Hi I am very new to code and I am trying to make a website I was wondering what the code would be to make the source link in the html a variable that will change based on window size making it responsive.

In essence I want to have different source link depending on whether it is desktop or mobile and I don't have the skills to do it or understand the tutorials.

var frameNumber = 0, // start video at frame 0
  // lower numbers = faster playback
  playbackConst = 500,
  // get page height from video duration
  setHeight = document.getElementById("set-height"),
  // select video element
  vid = document.getElementById('v0');

// dynamically set the page height according to video length
vid.addEventListener('loadedmetadata', function() {
  setHeight.style.height = Math.floor(vid.duration) * playbackConst + "px";
});

// Use requestAnimationFrame for smooth playback
function scrollPlay() {
  var frameNumber = window.pageYOffset / playbackConst;
  vid.currentTime = frameNumber;
  window.requestAnimationFrame(scrollPlay);
}

window.requestAnimationFrame(scrollPlay);

<video id="v0" tabindex="0" autobuffer="autobuffer" preload="preload">
  <source type="video/mp4; codecs="avc1.42E01E, mp4a.40.2"" src="https://optimiseweb.dev/wp-content/uploads/2022/12/webpage-final.mp4"></source>
</video>


问:
MVC - Trying to use Interface Segregation Principle in my project (SOLID)
I have a method that is responsible for uploading files when trying to add a product.
The problem is that I don't use Interface Segregation
Because in the method I only use one property that belongs to the product and not all of it as an example:

Model Product:

```<code>public class Product : BaseEntity
    {
        public string? Description { get; set; }
        public int CategoryId { get; set; }

        public string PhotoUrl { get; set; } = string.Empty;

        [ForeignKey("CategoryId")]
        public virtual Category Category { get; set; } = null!;
    }
</code>```

Service:

```<code>public class PhotoService : IPhotoService
    {
        private readonly IWebHostEnvironment _environment;
        public PhotoService(IWebHostEnvironment environment)
        {
            _environment = environment;
        }

        public async Task<string> UploadPhotos(IFormFile file, Product product)
        {
            string wwwPath = _environment.WebRootPath;
            var path = Path.Combine(wwwPath, "images", file.FileName);
            if (file.Length > 0)
            {
                using var stream = new FileStream(path, FileMode.Create);
                await file.CopyToAsync(stream);
            }
            return product!.PhotoUrl = file.FileName;
        }
    }
</code>```

Here I use the Product parameter but use only one property which is the PhotoUrl

I tried to do it using DTO or string but it didn't help me at least how I tried

Body:
I have a method that is responsible for uploading files when trying to add a product.
The problem is that I don't use Interface Segregation
Because in the method I only use one property that belongs to the product and not all of it as an example:

Model Product:

public class Product : BaseEntity
    {
        public string? Description { get; set; }
        public int CategoryId { get; set; }

        public string PhotoUrl { get; set; } = string.Empty;

        [ForeignKey("CategoryId")]
        public virtual Category Category { get; set; } = null!;
    }

Service:

public class PhotoService : IPhotoService
    {
        private readonly IWebHostEnvironment _environment;
        public PhotoService(IWebHostEnvironment environment)
        {
            _environment = environment;
        }

        public async Task<string> UploadPhotos(IFormFile file, Product product)
        {
            string wwwPath = _environment.WebRootPath;
            var path = Path.Combine(wwwPath, "images", file.FileName);
            if (file.Length > 0)
            {
                using var stream = new FileStream(path, FileMode.Create);
                await file.CopyToAsync(stream);
            }
            return product!.PhotoUrl = file.FileName;
        }
    }

Here I use the Product parameter but use only one property which is the PhotoUrl

I tried to do it using DTO or string but it didn't help me at least how I tried


问:
WildFly 9 - REST User have to login one time before known (UsernamePasswordLoginModule)
We changed from a "org.jboss.security.auth.spi.DatabaseServerLoginModule" to a custom "UsernamePasswordLoginModule".
The login works fine all requests by this user are valid.

But when an other user makes a REST-Call (BASIC-Auth) to this application it´s denied (401).
When i login with this user (FORM-Auth in an other Browser) the user is known and REST-Call works.

It seems that the DatabaseServerLoginModule cached all user on startup und our UsernamePasswordLoginModule only the user who logged in with a Basic-Form.

What is the correct way to change from a DSLM to a UPLM?

Maybe it is a problem that we define 2 security-domains?

```<code><security-domain name="other" cache-type="default">
    <authentication>
        <login-module code="de.esn.opusp.common.security.OpuspLoginModule" flag="required"/>
    </authentication>
</security-domain>
<security-domain name="vnb-service" cache-type="default">
    <authentication>
        <login-module code="de.esn.opusp.common.security.OpuspLoginModule" flag="required"/>
    </authentication>
</security-domain>
</code>```

There is no logging information in the LoginModule, only when the BasicForm-Login is executed.

When I use the DatabaseServerLoginModule from JBoss it works, but when i extend from it (Custom Login) then it is not called!

Body:
We changed from a "org.jboss.security.auth.spi.DatabaseServerLoginModule" to a custom "UsernamePasswordLoginModule".
The login works fine all requests by this user are valid.

But when an other user makes a REST-Call (BASIC-Auth) to this application it´s denied (401).
When i login with this user (FORM-Auth in an other Browser) the user is known and REST-Call works.

It seems that the DatabaseServerLoginModule cached all user on startup und our UsernamePasswordLoginModule only the user who logged in with a Basic-Form.

What is the correct way to change from a DSLM to a UPLM?

Maybe it is a problem that we define 2 security-domains?

<security-domain name="other" cache-type="default">
    <authentication>
        <login-module code="de.esn.opusp.common.security.OpuspLoginModule" flag="required"/>
    </authentication>
</security-domain>
<security-domain name="vnb-service" cache-type="default">
    <authentication>
        <login-module code="de.esn.opusp.common.security.OpuspLoginModule" flag="required"/>
    </authentication>
</security-domain>

There is no logging information in the LoginModule, only when the BasicForm-Login is executed.

When I use the DatabaseServerLoginModule from JBoss it works, but when i extend from it (Custom Login) then it is not called!


问:
How to sum over some columns and properly add datetime columns?
Suppose I have a dataframe as follows:

```<code>                 (MM/DD/YYYY)
Name    Amount    Start_date        End_date         Country
John    11        01/01/2022        01/02/2022       USA
Betty   13        01/01/2022        04/16/2022       China
Bruce   17        01/01/2022        05/17/2022       Germany
John    19        02/01/2022        03/19/2022       USA
Betty   27        04/17/2022        06/30/2022       China
</code>```

In this dataframe, the date columns are of datatype datetime. I want to create a new dataframe in which I can reduce the number of rows as follows:

Sum the amount for each person

Have the proper start_date and end_date (assume the new start_date always starts one day after old end_date without gaps)

Copy the Country column as is, without summing/changing anything

The desired output should look as follows:

```<code>Name    Amount    Start_date        End_date         Country
John    30        01/01/2022        03/19/2022       USA
Betty   40        01/01/2022        06/30/2022       China
Bruce   17        01/01/2022        05/17/2022       Germany
</code>```

I believe .groupby(), .sum() or maybe both are needed.

I tried some things with .groupby() over multiple columns, but I can only manage to get one column correct. That is, I only managed to sum over amount, but dates and country would not be successfull. I really need to do all 3 bullet points in one go, otherwise I mess up my dataframe.

Body:
Suppose I have a dataframe as follows:

                 (MM/DD/YYYY)
Name    Amount    Start_date        End_date         Country
John    11        01/01/2022        01/02/2022       USA
Betty   13        01/01/2022        04/16/2022       China
Bruce   17        01/01/2022        05/17/2022       Germany
John    19        02/01/2022        03/19/2022       USA
Betty   27        04/17/2022        06/30/2022       China

In this dataframe, the date columns are of datatype datetime. I want to create a new dataframe in which I can reduce the number of rows as follows:

Sum the amount for each person

Have the proper start_date and end_date (assume the new start_date always starts one day after old end_date without gaps)

Copy the Country column as is, without summing/changing anything

The desired output should look as follows:

Name    Amount    Start_date        End_date         Country
John    30        01/01/2022        03/19/2022       USA
Betty   40        01/01/2022        06/30/2022       China
Bruce   17        01/01/2022        05/17/2022       Germany

I believe .groupby(), .sum() or maybe both are needed.

I tried some things with .groupby() over multiple columns, but I can only manage to get one column correct. That is, I only managed to sum over amount, but dates and country would not be successfull. I really need to do all 3 bullet points in one go, otherwise I mess up my dataframe.


问:
Wrong keyboard's orientation in Share Sheet
I'm using SharePlay in my app which supports just landscape mode. I'm trying to use the UIActivityViewController to show the SharePlay button. After clicking on the share play button, the Facetime contact picker appears with a keyboard. Sometimes as you can see in the photo, the keyboard opens in portrait mode. (I said sometimes because it's not always happening and I have no exact test scenario for it)
I just wonder if there is any solution to fix this bug, or is it iOS's problem?


问:
The uploaded image, after some time disappears from the browser, while image db record still exist
I have a Rails 6 & Postgres app hosted on DigitalOcean and currently experiencing a very weird bug with the ActiveStorage involved, and it happens only on production env. A user creates an article with attached image, it all seems good, but after like 30 min. and so on, the image just disappears from view, and the logs saying the general message: ActiveStorage::FileNotFoundError (ActiveStorage::FileNotFoundError). I can see on table active_storage_blobs the image exist, but it does not appear on the browser.
Images included (browser error image and logs from papertrail).

Appreciate any kind of help || guidance || advice. Thank you in advance.


问:
How to keep logstash service running when I logout from remote server
I configure logstash service following the instructions in the link https://www.elastic.co/guide/en/logstash/current/running-logstash-windows.html (logstash as a service using nssm) but I noted that the service does actually not running when I am disconnected from the remote server I installed it.

Is there a way to fix this problem?
thanks,
g

The same thing happens also running logstash manually (I mean , running the appropriate bat file in command prompt).


问:
Can I inject external script files with executeScript() in MV3?
Is the code below fine in MV3? I was wondering if it could be published on Chrome Web Store.

```<code>  chrome.scripting.executeScript({
    target: { tabId: tabId },
    func: () => {
      const tag = document.createElement('script')
      tag.src = 'https://my-server/script.js'
      document.head.appendChild(tag)
    },
    args: [],
    world: 'MAIN'
  })
</code>```

The code was able to be uploaded as unpackaged extension MV3 and executed.

I referred to the information.

extension developers can use the scripting.executeScript() method to either inject a static file or a function. https://developer.chrome.com/docs/extensions/mv3/mv3-migration/#executing-arbitrary-strings

Body:
Is the code below fine in MV3? I was wondering if it could be published on Chrome Web Store.

  chrome.scripting.executeScript({
    target: { tabId: tabId },
    func: () => {
      const tag = document.createElement('script')
      tag.src = 'https://my-server/script.js'
      document.head.appendChild(tag)
    },
    args: [],
    world: 'MAIN'
  })

The code was able to be uploaded as unpackaged extension MV3 and executed.

I referred to the information.

extension developers can use the scripting.executeScript() method to either inject a static file or a function. https://developer.chrome.com/docs/extensions/mv3/mv3-migration/#executing-arbitrary-strings