问:
Why is ActiveRecord empty when I call from a Controller test, while it is not empty when I do a get request outside of the test
I have a test code like so

```<code>  test "reward/balance with existing id returns 200" do
    get "/reward/balance?id=4"
    assert_response(200)
  end
</code>```

but when I run that, I get a response that's different from when I do the same GET request outside of the test.

For example, if I run http://localhost:3000/reward/balance?id=4 from my browser I get the response I want. I found that for some reason when I call from the test, the ActiveRecord is empty.

The function that's called when doing a GET at the URL is as below

```<code>def show
    if params[:id]
        if user = User.where(id: params[:id]).take
            render json: user["reward_balance"], status: :ok
            return
        else
            render json: {message: "#{User.all.inspect}"}, status: :bad_request
            return
        end
    else #If no id in params
        render json: {message: "Incorrect parameters"}, status: :bad_request
        return
    end
end
</code>```

I put render json: {message: "#{User.all.inspect}"}, status: :bad_request so I can see what it prints when called from the test.

When called from the test I get "{\"message\":\"#\\u003cActiveRecord::Relation []\\u003e\"}" so we can see that the ActiveRecord User is empty.

However when I call User.all from the rails console, the ActiveRecord User is populated.

Why is it showing different results when called from the test?

Body:
I have a test code like so

  test "reward/balance with existing id returns 200" do
    get "/reward/balance?id=4"
    assert_response(200)
  end

but when I run that, I get a response that's different from when I do the same GET request outside of the test.

For example, if I run http://localhost:3000/reward/balance?id=4 from my browser I get the response I want. I found that for some reason when I call from the test, the ActiveRecord is empty.

The function that's called when doing a GET at the URL is as below

def show
    if params[:id]
        if user = User.where(id: params[:id]).take
            render json: user["reward_balance"], status: :ok
            return
        else
            render json: {message: "#{User.all.inspect}"}, status: :bad_request
            return
        end
    else #If no id in params
        render json: {message: "Incorrect parameters"}, status: :bad_request
        return
    end
end

I put render json: {message: "#{User.all.inspect}"}, status: :bad_request so I can see what it prints when called from the test.

When called from the test I get "{\"message\":\"#\\u003cActiveRecord::Relation []\\u003e\"}" so we can see that the ActiveRecord User is empty.

However when I call User.all from the rails console, the ActiveRecord User is populated.

Why is it showing different results when called from the test?


来源: stackexchange

问:
Java spring boot illegal state exception while integrating junit
I was trying to test my service layer using junit by mocking the repository layer but it throws illegal state exception.
my git repo :https://github.com/saleem8396/JavaApi.git

this is my rest controller

```<code>
@RestController
public class DepartmentController {
    @Autowired
    private DepartmentServices departmentServices;

    @GetMapping("/departmentName={name}")
    public Department fetchDepartmentByName(@PathVariable("name") String departmentName){
       return departmentServices.fetchDepartmentByName(departmentName);
    }
}

</code>```

entity

```<code>@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Department {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long departmentId;
    @NotBlank(message = "should not be empty")
    private String departmentName;
    private String departmentAddress;
    private String departmentCode;

}
</code>```

service implementation

```<code>@Override
public Department fetchDepartmentByName(String departmentName) {
    return departmentRepository.findByDepartmentNameIgnoreCase(departmentName);
}
</code>```

this is my junit code

```<code>@SpringBootTest
class DepartmentServicesTest {
    @Autowired
    private DepartmentServices departmentServices;
    @MockBean
    private DepartmentRepository departmentRepository;

    @BeforeEach
    void setUp() {

        Department department =Department.builder()
                .departmentName("it")
                .departmentCode("oo")
                .departmentAddress("madu")
                .departmentId(1L)
                .build();
        Mockito.when(departmentRepository.findByDepartmentNameIgnoreCase("it")).thenReturn(department);

    }

    @Test
    public void whenValidDepartmentName_thenDepartmentShouldBeFound( )  {

        String departmentName ="it";
        Department department= departmentServices.fetchDepartmentByName(departmentName);
        assertEquals(departmentName,department.getDepartmentName());
    }

}
</code>```

errors

```<code>
java.lang.IllegalStateException: Failed to load ApplicationContext for [WebMergedContextConfiguration@416a4275 testClass = com.saleem.demo.services.DepartmentServicesTest, locations = [], classes = [com.saleem.demo.DemoApplication], contextInitializerClasses = [], activeProfiles = [], propertySourceLocations = [], propertySourceProperties = ["org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true"], contextCustomizers = [org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@316bcf94, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@31fa1761, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@91fabe77, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@52b1beb6, org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@9da1, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@e350b40, org.springframework.boot.test.context.SpringBootTestAnnotation@eba3d9a2], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]

    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:142)
    at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:127)
    at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:191)
    at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:130)
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:241)
    at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:138)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$10(ClassBasedTestDescriptor.java:377)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.executeAndMaskThrowable(ClassBasedTestDescriptor.java:382)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$11(ClassBasedTestDescriptor.java:377)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310)
    at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735)
    at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
    at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestInstancePostProcessors(ClassBasedTestDescriptor.java:376)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$instantiateAndPostProcessTestInstance$6(ClassBasedTestDescriptor.java:289)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:288)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$4(ClassBasedTestDescriptor.java:278)
    at java.base/java.util.Optional.orElseGet(Optional.java:364)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$5(ClassBasedTestDescriptor.java:277)
    at org.junit.jupiter.engine.execution.TestInstancesProvider.getTestInstances(TestInstancesProvider.java:31)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:105)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:104)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:68)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$2(NodeTestTask.java:123)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:123)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:90)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
    at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
    at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
    at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
    at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1751)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
    at org.springframework.boot.test.context.SpringBootContextLoader.lambda$loadContext$3(SpringBootContextLoader.java:137)
    at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:59)
    at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:47)
    at org.springframework.boot.SpringApplication.withHook(SpringApplication.java:1386)
    at org.springframework.boot.test.context.SpringBootContextLoader$ContextLoaderHook.run(SpringBootContextLoader.java:543)
    at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:137)
    at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:108)
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:184)
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:118)
    ... 72 more
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:267)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:230)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
    at org.hibernate.boot.model.relational.Database.<init>(Database.java:44)
    at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.getDatabase(InFlightMetadataCollectorImpl.java:218)
    at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:191)
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:138)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1350)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1421)
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747)
    ... 93 more
Caused by: org.hibernate.HibernateException: Unable to determine Dialect without JDBC metadata (please set 'javax.persistence.jdbc.url', 'hibernate.connection.url', or 'hibernate.dialect')
    at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:147)
    at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:60)
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:244)
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:36)
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:119)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:255)
    ... 108 more

</code>```

I tried to find what's causing this error from documentation but wasn't able to.suggest me solution on this.

ContentLicense: CC BY-SA 4.0

Body:
I was trying to test my service layer using junit by mocking the repository layer but it throws illegal state exception.
my git repo :https://github.com/saleem8396/JavaApi.git

this is my rest controller

@RestController
public class DepartmentController {
    @Autowired
    private DepartmentServices departmentServices;

    @GetMapping("/departmentName={name}")
    public Department fetchDepartmentByName(@PathVariable("name") String departmentName){
       return departmentServices.fetchDepartmentByName(departmentName);
    }
}

entity

@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Department {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long departmentId;
    @NotBlank(message = "should not be empty")
    private String departmentName;
    private String departmentAddress;
    private String departmentCode;

}

service implementation

@Override
public Department fetchDepartmentByName(String departmentName) {
    return departmentRepository.findByDepartmentNameIgnoreCase(departmentName);
}

this is my junit code

@SpringBootTest
class DepartmentServicesTest {
    @Autowired
    private DepartmentServices departmentServices;
    @MockBean
    private DepartmentRepository departmentRepository;

    @BeforeEach
    void setUp() {

        Department department =Department.builder()
                .departmentName("it")
                .departmentCode("oo")
                .departmentAddress("madu")
                .departmentId(1L)
                .build();
        Mockito.when(departmentRepository.findByDepartmentNameIgnoreCase("it")).thenReturn(department);

    }

    @Test
    public void whenValidDepartmentName_thenDepartmentShouldBeFound( )  {

        String departmentName ="it";
        Department department= departmentServices.fetchDepartmentByName(departmentName);
        assertEquals(departmentName,department.getDepartmentName());
    }

}

errors

java.lang.IllegalStateException: Failed to load ApplicationContext for [WebMergedContextConfiguration@416a4275 testClass = com.saleem.demo.services.DepartmentServicesTest, locations = [], classes = [com.saleem.demo.DemoApplication], contextInitializerClasses = [], activeProfiles = [], propertySourceLocations = [], propertySourceProperties = ["org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true"], contextCustomizers = [org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@316bcf94, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@31fa1761, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@91fabe77, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@52b1beb6, org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@9da1, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@e350b40, org.springframework.boot.test.context.SpringBootTestAnnotation@eba3d9a2], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]

    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:142)
    at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:127)
    at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:191)
    at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:130)
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:241)
    at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:138)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$10(ClassBasedTestDescriptor.java:377)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.executeAndMaskThrowable(ClassBasedTestDescriptor.java:382)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$11(ClassBasedTestDescriptor.java:377)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310)
    at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735)
    at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
    at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestInstancePostProcessors(ClassBasedTestDescriptor.java:376)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$instantiateAndPostProcessTestInstance$6(ClassBasedTestDescriptor.java:289)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:288)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$4(ClassBasedTestDescriptor.java:278)
    at java.base/java.util.Optional.orElseGet(Optional.java:364)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$5(ClassBasedTestDescriptor.java:277)
    at org.junit.jupiter.engine.execution.TestInstancesProvider.getTestInstances(TestInstancesProvider.java:31)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:105)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:104)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:68)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$2(NodeTestTask.java:123)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:123)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:90)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
    at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
    at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
    at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
    at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1751)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
    at org.springframework.boot.test.context.SpringBootContextLoader.lambda$loadContext$3(SpringBootContextLoader.java:137)
    at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:59)
    at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:47)
    at org.springframework.boot.SpringApplication.withHook(SpringApplication.java:1386)
    at org.springframework.boot.test.context.SpringBootContextLoader$ContextLoaderHook.run(SpringBootContextLoader.java:543)
    at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:137)
    at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:108)
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:184)
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:118)
    ... 72 more
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:267)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:230)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
    at org.hibernate.boot.model.relational.Database.<init>(Database.java:44)
    at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.getDatabase(InFlightMetadataCollectorImpl.java:218)
    at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:191)
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:138)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1350)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1421)
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747)
    ... 93 more
Caused by: org.hibernate.HibernateException: Unable to determine Dialect without JDBC metadata (please set 'javax.persistence.jdbc.url', 'hibernate.connection.url', or 'hibernate.dialect')
    at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:147)
    at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:60)
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:244)
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:36)
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:119)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:255)
    ... 108 more

I tried to find what's causing this error from documentation but wasn't able to.suggest me solution on this.


问:
Capture platform deatils using User Agent in Spring Boot for Mobile Phones
I'm facing an issue with capturing Platform details for Xiaomi phones using the user agent.

using the following user agent:

Mozilla/5.0 (Linux; Android 12; 2109119DI) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36

I have followed the following link:
https://github.com/mngsk/device-detector

My code is like:

```<code>        DeviceDetector dd = new DeviceDetectorBuilder().build();
        Detection detection = dd.detect(userAgent);
</code>```

in this I'm getting null value for the device, the model,brand

```<code>        "model": null,
        "type": "smartphone",
        "brand": null
    },
</code>```

expected Output is:

```<code>id: "XI",
type: "smartphone",
brand: "Xiaomi",
model: "Mi 11 Lite 5G NE"
}
</code>```

please help me to solve this issue

Body:
I'm facing an issue with capturing Platform details for Xiaomi phones using the user agent.

using the following user agent:

Mozilla/5.0 (Linux; Android 12; 2109119DI) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36

I have followed the following link:
https://github.com/mngsk/device-detector

My code is like:

        DeviceDetector dd = new DeviceDetectorBuilder().build();
        Detection detection = dd.detect(userAgent);

in this I'm getting null value for the device, the model,brand

        "model": null,
        "type": "smartphone",
        "brand": null
    },

expected Output is:

id: "XI",
type: "smartphone",
brand: "Xiaomi",
model: "Mi 11 Lite 5G NE"
}

please help me to solve this issue


问:
How can I specify an editor when I run commands.executeCommand of vscode API
I'm trying to fold regions in the editor with vscode.commands.executeCommand("editor.foldAll") command. But it only works on the active editor. Is there a way to specify a target editor for it?

I tried vscode.commands.executeCommand("editor.foldAll", editor) but I doesn't work.

I know I can make the editor active and then use the command, but I want it to work without activating the editor.


问:
File Name Does not Print Sequentially In Python
I try Print my file name in Ascending Order But after Print  98, 99, It Print 1000, 1001, 1002 ....
i just want to print all file name in Ascending Order Sequentially . how can i do that....

```<code>import os
files = os.listdir('/image')

for file in files:
    print(file)

</code>```

Result Is This

```<code>out085_GPEN.jpg
out086_GPEN.jpg
out087_GPEN.jpg
out088_GPEN.jpg
out089_GPEN.jpg
out090_GPEN.jpg
out091_GPEN.jpg
out092_GPEN.jpg
out093_GPEN.jpg
out094_GPEN.jpg
out095_GPEN.jpg
out096_GPEN.jpg
out097_GPEN.jpg
out098_GPEN.jpg
out099_GPEN.jpg
out1000_GPEN.jpg    <-----
out1001_GPEN.jpg
out1002_GPEN.jpg
out1003_GPEN.jpg
out1004_GPEN.jpg
out1005_GPEN.jpg
out1006_GPEN.jpg
out1007_GPEN.jpg
out1008_GPEN.jpg
out1009_GPEN.jpg
out100_GPEN.jpg         <-------
out1010_GPEN.jpg
out1011_GPEN.jpg
out1012_GPEN.jpg
out1013_GPEN.jpg
</code>```

i just want to print those file name Sequentially . That's it

Body:
I try Print my file name in Ascending Order But after Print  98, 99, It Print 1000, 1001, 1002 ....
i just want to print all file name in Ascending Order Sequentially . how can i do that....

import os
files = os.listdir('/image')

for file in files:
    print(file)

Result Is This

out085_GPEN.jpg
out086_GPEN.jpg
out087_GPEN.jpg
out088_GPEN.jpg
out089_GPEN.jpg
out090_GPEN.jpg
out091_GPEN.jpg
out092_GPEN.jpg
out093_GPEN.jpg
out094_GPEN.jpg
out095_GPEN.jpg
out096_GPEN.jpg
out097_GPEN.jpg
out098_GPEN.jpg
out099_GPEN.jpg
out1000_GPEN.jpg    <-----
out1001_GPEN.jpg
out1002_GPEN.jpg
out1003_GPEN.jpg
out1004_GPEN.jpg
out1005_GPEN.jpg
out1006_GPEN.jpg
out1007_GPEN.jpg
out1008_GPEN.jpg
out1009_GPEN.jpg
out100_GPEN.jpg         <-------
out1010_GPEN.jpg
out1011_GPEN.jpg
out1012_GPEN.jpg
out1013_GPEN.jpg

i just want to print those file name Sequentially . That's it


问:
I want to download the BPEL in Eclipse
I'm having trouble downloading the BPEL Designer plugin
The official Eclipse website has removed the BPEL from their website
And I can't download it

https://download.eclipse.org/bpel/site/

Not Found
We're sorry, the page or file cannot be found. Here are some reasons why:

A file may have moved to the archives. Please contact the project members on their user forum.
Your file was part of a nightly or integration build which is no longer there. Simply download the latest version.
The project is uploading a new build, and this file is not there yet. Try again later.

Title: I want to download the BPEL in Eclipse


问:
Wordpress site issue when moving PHP version from 7.4 to 8.0
I have WP site (SAFE4YOU) that specializes in insurance that hosting now on "SiteGround" with PHP 7.4 version.

Im trying to migrate that site to "Kinsta" servers but there the earliest PHP version is 8.0 so I have to change the site to that version.

after I migrate the site all looks great except one page, the calculator pricing page : https://safe4you.kinsta.cloud/calculator/main-calculator/

the problem is, after I choose destination and date (first screen), and after I chose ages (second screen) the system needs to trow the results (third screen) and seems its not working.

safe4you calculator issue

on error.log:

```<code>2022/12/27 08:37:51 [error] 72560#72560: *6310 FastCGI sent in stderr: "PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 145PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 184PHP message: PHP Warning: Undefined array key "option_to_person" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 308PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 145PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 184PHP message: PHP Warning: Undefined array key "option_to_person" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 308PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 145PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 184PHP message: PHP Warning: Undefined array key "option_to_person" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 308PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 145PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 184PHP message: PHP Warning: Undefined array key "option_to_person" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 308PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-the
</code>```

functions.php lines:
145 -

```<code>$total_days_trip = $_COOKIE['days_2'] ? $_COOKIE['days_2'] : $_COOKIE['days'];
</code>```

184 -

```<code>$results[$company_id]['total_days'] = $post_form['days_2'] ? absint($post_form['days_2']) : absint( $post_form['days'] );
</code>```

308 -

```<code>if($post_form['option_to_person']){ // If in form data have at least 1 extension.
</code>```

Im trying to change with "Kinsta" support manually the PHP version to 7.4 and they cant keep it because they dont give support for that version. when I changed the version all looks great.

I notice that all the error that came from function.php line have cookies/form data in common.

what I expecting:
if you go into that page : https://safe4you.co.il/calculator/main-calculator/
choose destination and date, after that choose passengers ages, and after that all the results need to displayed like on the image.

safe4you calculator expecting

its really weird. anyone can help?

EDIT
thanks to @Muhammad Usman the problem solved on desktop.
after I add isset() function all looks great on desktop but seems on mobile (Android & IOS) still have some issues with the third screen (the results). I got on error.log output:

```<code>2022/12/28 08:36:00 [error] 129739#129739: *11492 FastCGI sent in stderr: "PHP message: PHP Warning: Undefined array key "calc_id" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 132" while reading response header from upstream, client: 199.203.113.198, server: safe4you.kinsta.cloud, request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php8.0-fpm-safe4you.sock:", host: "safe4you.kinsta.cloud:50951", referrer: "https://safe4you.kinsta.cloud/calculator/main-calculator/"
</code>```

function.php line 132:

```<code>$calc_ID = $_COOKIE["calc_id"];
</code>```

that cookie created when the window opening so when the user get into the third screen that cookie already created.

the code for creating that cookie:

```<code>setcookie('calc_id', $calc_ID, time() + (86400 * 30), "/"); // 86400 = 1 day
</code>```

anyone know why its happend just on mobile devices?

Body:
I have WP site (SAFE4YOU) that specializes in insurance that hosting now on "SiteGround" with PHP 7.4 version.

Im trying to migrate that site to "Kinsta" servers but there the earliest PHP version is 8.0 so I have to change the site to that version.

after I migrate the site all looks great except one page, the calculator pricing page : https://safe4you.kinsta.cloud/calculator/main-calculator/

the problem is, after I choose destination and date (first screen), and after I chose ages (second screen) the system needs to trow the results (third screen) and seems its not working.

safe4you calculator issue

on error.log:

2022/12/27 08:37:51 [error] 72560#72560: *6310 FastCGI sent in stderr: "PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 145PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 184PHP message: PHP Warning: Undefined array key "option_to_person" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 308PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 145PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 184PHP message: PHP Warning: Undefined array key "option_to_person" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 308PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 145PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 184PHP message: PHP Warning: Undefined array key "option_to_person" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 308PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 145PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 184PHP message: PHP Warning: Undefined array key "option_to_person" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 308PHP message: PHP Warning: Undefined array key "days_2" in /www/safe4you_296/public/wp-content/themes/hello-the

functions.php lines:
145 -

$total_days_trip = $_COOKIE['days_2'] ? $_COOKIE['days_2'] : $_COOKIE['days'];

184 -

$results[$company_id]['total_days'] = $post_form['days_2'] ? absint($post_form['days_2']) : absint( $post_form['days'] );

308 -

if($post_form['option_to_person']){ // If in form data have at least 1 extension.

Im trying to change with "Kinsta" support manually the PHP version to 7.4 and they cant keep it because they dont give support for that version. when I changed the version all looks great.

I notice that all the error that came from function.php line have cookies/form data in common.

what I expecting:
if you go into that page : https://safe4you.co.il/calculator/main-calculator/
choose destination and date, after that choose passengers ages, and after that all the results need to displayed like on the image.

safe4you calculator expecting

its really weird. anyone can help?

EDIT
thanks to @Muhammad Usman the problem solved on desktop.
after I add isset() function all looks great on desktop but seems on mobile (Android & IOS) still have some issues with the third screen (the results). I got on error.log output:

2022/12/28 08:36:00 [error] 129739#129739: *11492 FastCGI sent in stderr: "PHP message: PHP Warning: Undefined array key "calc_id" in /www/safe4you_296/public/wp-content/themes/hello-theme-child-master/functions.php on line 132" while reading response header from upstream, client: 199.203.113.198, server: safe4you.kinsta.cloud, request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php8.0-fpm-safe4you.sock:", host: "safe4you.kinsta.cloud:50951", referrer: "https://safe4you.kinsta.cloud/calculator/main-calculator/"

function.php line 132:

$calc_ID = $_COOKIE["calc_id"];

that cookie created when the window opening so when the user get into the third screen that cookie already created.

the code for creating that cookie:

setcookie('calc_id', $calc_ID, time() + (86400 * 30), "/"); // 86400 = 1 day

anyone know why its happend just on mobile devices?


Title: Docker nginx server send continues requests and consume lot of data

Body:
Im running nginx on Docker. whenever I start nginx, it download data like I started watching a video. Here is the log. these requests are going on and on. at least 2 requests per second until i stop nginx. I don't know how to stop this request.

172.18.0.2 - - [27/Dec/2022:07:33:03 +0000] "GET /android-icon-36x36.png HTTP/1.1" 404 16153 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[php-fpm:access] 127.0.0.1 -  27/Dec/2022:07:33:01 +0000 "GET /index.php" 404 /app/index.php 3727.663 18432 4.02%
172.18.0.2 - - [27/Dec/2022:07:33:06 +0000] "GET /android-icon-96x96.png HTTP/1.1" 404 16153 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[php-fpm:access] 127.0.0.1 -  27/Dec/2022:07:33:05 +0000 "GET /index.php" 404 /app/index.php 3186.331 18432 5.02%
172.18.0.2 - - [27/Dec/2022:07:33:09 +0000] "GET /android-icon-144x144.png HTTP/1.1" 404 16153 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[php-fpm:access] 127.0.0.1 -  27/Dec/2022:07:33:08 +0000 "GET /index.php" 404 /app/index.php 3254.646 18432 4.61%
172.18.0.2 - - [27/Dec/2022:07:33:13 +0000] "GET /android-icon-48x48.png HTTP/1.1" 404 16153 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[php-fpm:access] 127.0.0.1 -  27/Dec/2022:07:33:11 +0000 "GET /index.php" 404 /app/index.php 3248.567 18432 4.62%
172.18.0.2 - - [27/Dec/2022:07:33:16 +0000] "GET /android-icon-144x144.png HTTP/1.1" 404 16153 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[php-fpm:access] 127.0.0.1 -  27/Dec/2022:07:33:14 +0000 "GET /index.php" 404 /app/index.php 3310.414 18432 4.53%
172.18.0.2 - - [27/Dec/2022:07:33:21 +0000] "GET /android-icon-192x192.png HTTP/1.1" 404 16153 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
[php-fpm:access] 127.0.0.1 -  27/Dec/2022:07:33:18 +0000 "GET /index.php" 404 /app/index.php 5312.281 18432 2.82%


问:
Probit regression in Python
I am trying to implement Probit regression. Dependent values are credit which has integer values 0 and 1. The other three features are salaries, sales, and stores. Before I put in the model I scaled these three features with a Robust Scaler. Below you can see the result of the regression

```<code>import statsmodels.api as smf
probit_model=smf.Probit(y,X)
result=probit_model.fit_regularized ()
print(result.summary2())
</code>```

The final output of this regression you can see above. But I am badly surprised that other values are NaN expect coefficients.

So can anybody help me how to solve this problem?

Title: Probit regression in Python

Body:
I am trying to implement Probit regression. Dependent values are credit which has integer values 0 and 1. The other three features are salaries, sales, and stores. Before I put in the model I scaled these three features with a Robust Scaler. Below you can see the result of the regression

import statsmodels.api as smf
probit_model=smf.Probit(y,X)
result=probit_model.fit_regularized ()
print(result.summary2())

The final output of this regression you can see above. But I am badly surprised that other values are NaN expect coefficients.

So can anybody help me how to solve this problem?


问:
How to make disk file act like a folder
So I am trying to understand how a disk file something like .sqlite really works.

If I am creating a hierarki folder that containes many files that containes some data.

When I delete a folder inside the folder that containes to much data it takes to much time if I am for example using it in mobile app.

So I though of .sqlite file! How dose it really works? dose it parse the whole file each time it open the transaction or is it able to directly modify and find the right data to change.

Is there really a teknik I can use so that I am not needing to parse the whole file and instead find and add,delete or modify that data without parsing the whole file and resaving it?

Title: How to make disk file act like a folder


问:
Where to find all Flutter SocketException: OS ErrorCodes
Where can I find all Http OS Error codes for a SocketException. When I make a request there is a chance that it will throw a SocketException with an OSError containing an error code and a message. Where can I find all possible error codes so I can handle them accordingly?

try {
      final response = await postRequest(
  ApiUtil.getGetApisUrl,
  headers: {
    "P_USER_NAME": userId!,
    "P_TYPE": 1.toString(), // 1: Employee, 2: Student
    "AUTH": _dbUserAuthToken!,
    "P_Lang": 2.toString(),
  },
);

} on SocketException catch (e) {
  debugPrint(e.toString());
  // WHERE CAN I FIND ALL ERROR CODES SO I CAN HANDLE IT HERE
  if (e.osError?.errorCode == 8) { // ErrorCode 8 is for example "Failed host lookup"
    Navigator.pushReplacementNamed(
        MyApp.globalNavigatorKey.currentContext!, Routes.maintenanceScreen);
  } else {
    Navigator.pushNamed(
        MyApp.globalNavigatorKey.currentContext!, Routes.noInternet);
  }
} catch (e) {
  debugPrint(e.toString());
}
```


问:
hovering data as a text in inside container
query is that hovering data does not appear as a text in child container on showing dashboard, but when I click on the child container this hovering data should appear as a text on this container.

```<code>HOVER_DATA = ['Name','Country','Currency','Market Capitalization', 'Most Recent Quarter','PE Ratio%','PEG Ratio%','Earnings Share','Dividend Yield','Operating Margin TTM','Return OnAssets TTM','Return OnEquity TTM','Quarterly Earnings GrowthYOY','Quarterly Revenue GrowthYOY','dailyChange']
value_attribute = 'Market Capitalization'
Hover_Tmp = '<br>Name:%{customdata[0]}'+'<br>Country:%{customdata[1]}'+'<br>Currency:%{customdata[2]}'+'<br>Daily Change: %{customdata[14]}%'+'<br>Market Capitalization:%{value:0.3s}'+'<br>Most Recent Quarter:%{customdata[4]}' +'<br>PE Ratio:%{customdata[5]}%'+'<br>PEG Ratio:%{customdata[6]}%'+'<br>Earnings Share:%{customdata[7]}%' +  '<br>Dividend Yield:%{customdata[8]}' + '<br>Operating Margin TTM:%{customdata[9]}' + '<br>Return OnAssets TTM:%{customdata[10]}' + '<br>Return OnEquity TTM:%{customdata[11]}' + '<br>Quarterly Earnings GrowthYOY:%{customdata[12]}' + '<br>Quarterly Revenue GrowthYOY:%{customdata[13]}'+'<br>'

df['Symbol'] = df['Symbol'].apply(lambda item: link_ref.format(item, item, "{}"))
df = pd.DataFrame(df)

def create_dropdown(option, id_value):
    return html.Div(
        [dcc.Dropdown(id=id_value, options=option, value=option[0])]
    )

layout = html.Div([
        html.Div(
                children=[html.H1('Stock Market Summary',),
                html.P('''AI predictions, intraday market price action, biggest movers, H1 sectors performance, and more.''',
                )], id="header", className="row flex-display header", style={"display": "flex", "flex-direction": "column"},),
        html.Div([
                html.Div([
                    dcc.Graph(id="indicator")], className="graph create_container2 twelve columns"),
                    ], className="row flex-display"),

        html.Div([
            html.Div([
                html.H3('Thank You',)],className="footer create_container2 twelve columns",)
            ]),

    ],className="main",id="mainContainer",
                  style = {'backgroundColor':'#3d3d3b', 'textAlign': 'center',"display": "flex", "flex-direction": "column"
                }
)

@dash.callback(
    Output('indicator','figure'),
    Input(component_id='dd-output-container', component_property='value')
)
</code>```
```<code>def update_output(theme_select, my_date_picker_single,dd_output_container):
    """
        Updating Tree MAp as per filter
    """
    if theme_select == 'Dark Theme':
        color_discrete_map=["#ff4d00","#21b811"]
    filtered_df = filter_df(my_date_picker_single,dd_output_container)
    if filtered_df.empty:
        print("Dataframe is empty")
        return "DATAFRAME IS EMPTY"
        # pymsgbox.alert('Data Not Available', 'Alert')
        # print('***********',None)
</code>```
```<code>    else:
        print("NOT EMPTY")
        indicator = px.treemap(filtered_df,
                    color=COLOR,
                    color_continuous_scale=color_discrete_map,
                    path = ['Sector','Symbol','dailyChange',],
                    maxdepth=3,
                    hover_data=HOVER_DATA,
                    values=value_attribute,
                    custom_data=HOVER_DATA,
                    color_discrete_map=color_discrete_map)
</code>```
```<code>        indicator.update_traces(textfont_size=22)

        indicator.update_layout(margin = dict(t=35, l=5, r=5, b=5),
                        paper_bgcolor='rgba(0,0,255,0)',
                        plot_bgcolor='rgba(0,0,255,0)',
                        )

        indicator.data[0].texttemplate ="<b>%{label}</b><br>Market Cap.:%{value:0.3s}"
 return indicator
</code>```

I am expecting that, my inner child container should have same complete text as in hover data.
I am uploading my screen shot step by step:-

Body:
query is that hovering data does not appear as a text in child container on showing dashboard, but when I click on the child container this hovering data should appear as a text on this container.

HOVER_DATA = ['Name','Country','Currency','Market Capitalization', 'Most Recent Quarter','PE Ratio%','PEG Ratio%','Earnings Share','Dividend Yield','Operating Margin TTM','Return OnAssets TTM','Return OnEquity TTM','Quarterly Earnings GrowthYOY','Quarterly Revenue GrowthYOY','dailyChange']
value_attribute = 'Market Capitalization'
Hover_Tmp = '
Name:%{customdata[0]}'+'
Country:%{customdata[1]}'+'
Currency:%{customdata[2]}'+'
Daily Change: %{customdata[14]}%'+'
Market Capitalization:%{value:0.3s}'+'
Most Recent Quarter:%{customdata[4]}' +'
PE Ratio:%{customdata[5]}%'+'
PEG Ratio:%{customdata[6]}%'+'
Earnings Share:%{customdata[7]}%' +  '
Dividend Yield:%{customdata[8]}' + '
Operating Margin TTM:%{customdata[9]}' + '
Return OnAssets TTM:%{customdata[10]}' + '
Return OnEquity TTM:%{customdata[11]}' + '
Quarterly Earnings GrowthYOY:%{customdata[12]}' + '
Quarterly Revenue GrowthYOY:%{customdata[13]}'+'
'

df['Symbol'] = df['Symbol'].apply(lambda item: link_ref.format(item, item, "{}"))
df = pd.DataFrame(df)

def create_dropdown(option, id_value):
    return html.Div(
        [dcc.Dropdown(id=id_value, options=option, value=option[0])]
    )

layout = html.Div([
        html.Div(
                children=[html.H1('Stock Market Summary',),
                html.P('''AI predictions, intraday market price action, biggest movers, H1 sectors performance, and more.''',
                )], id="header", className="row flex-display header", style={"display": "flex", "flex-direction": "column"},),
        html.Div([
                html.Div([
                    dcc.Graph(id="indicator")], className="graph create_container2 twelve columns"),
                    ], className="row flex-display"),

        html.Div([
            html.Div([
                html.H3('Thank You',)],className="footer create_container2 twelve columns",)
            ]),

    ],className="main",id="mainContainer",
                  style = {'backgroundColor':'#3d3d3b', 'textAlign': 'center',"display": "flex", "flex-direction": "column"
                }
)

@dash.callback(
    Output('indicator','figure'),
    Input(component_id='dd-output-container', component_property='value')
)

def update_output(theme_select, my_date_picker_single,dd_output_container):
    """
        Updating Tree MAp as per filter
    """
    if theme_select == 'Dark Theme':
        color_discrete_map=["#ff4d00","#21b811"]
    filtered_df = filter_df(my_date_picker_single,dd_output_container)
    if filtered_df.empty:
        print("Dataframe is empty")
        return "DATAFRAME IS EMPTY"
        # pymsgbox.alert('Data Not Available', 'Alert')
        # print('***********',None)

    else:
        print("NOT EMPTY")
        indicator = px.treemap(filtered_df,
                    color=COLOR,
                    color_continuous_scale=color_discrete_map,
                    path = ['Sector','Symbol','dailyChange',],
                    maxdepth=3,
                    hover_data=HOVER_DATA,
                    values=value_attribute,
                    custom_data=HOVER_DATA,
                    color_discrete_map=color_discrete_map)

        indicator.update_traces(textfont_size=22)

        indicator.update_layout(margin = dict(t=35, l=5, r=5, b=5),
                        paper_bgcolor='rgba(0,0,255,0)',
                        plot_bgcolor='rgba(0,0,255,0)',
                        )

        indicator.data[0].texttemplate ="%{label}
Market Cap.:%{value:0.3s}"
 return indicator

I am expecting that, my inner child container should have same complete text as in hover data.
I am uploading my screen shot step by step:-


问:
Minikube Access Issue
I started minikube with minikube start. So, it created minikube context(basically a user). How does this user is able to access all resources(pods, services, etc..) across all namespaces? It belongs to any clusterrolebinding? Please help me to understand this.

Title: Minikube Access Issue


问:
Redis search weighted queries
I have an issue with searching that I’d appreciate your input.

I want to be able to search for documents that on some fields have some keywords.
For example I have the following FT.CREATE command with the relevant schema:
FT.CREATE my-idx ON JSOM PREFIX 1 my:search SCHEMA Id TAG Type TEXT Status TAG User TAG Description TEXT

For example having this documents:
{Id: 1, Type:"type1", Status:"Live", User:"Dan", Desc:"This is some description one one"}
{Id:2, Type:"type2", Status:"Aborted", User:"Elon", Desc:"This is some description one two"}
{Id:3, Type:"type2", Status:"InProgress", User:"Dan", Desc:"This is some description one one three"}
{Id:4, Type:"type3", Status:"Live", User:"Victor", Desc:"This is some description victor"}
… and so forth

Search example:
Type==type1 and Status=Live and User=Dan and Description contains one

I want to return all documents that have at least one of the search conditions, and I want the results to be ordered by priority, using weight for each (so that each document will get a higher weight for a prioritized field).
For example weights:

Type -> 1000

User -> 600

Status -> 300

Description -> 30

Using this weights, I expect the following results order (by doc Id) and their expected score (in parentheses) using the default scorer (TFIDF):
1(1960), 3(660), 4(300), 2(30)

Now, the thing is, that the TFIDF scorer, which is the closest one of the existing scorers for my requirements, is also enriched by Redis with normalization factor (norm) and slop, which makes the result reordered, i.e. doc id 1 is divided by norm=2, because the word “one” repeats 2 times, etc..

Any thoughts on how to build this query in a better way so that the above given examples can be returned in the above mentioned order?

Title: Redis search weighted queries


问:
Running test file after jest setup with typescript mobx not working
I have mobx project with typescript and i have been trying to setup jest with jest.config.js and tsconfig.json as followed,

jest.config.js

/** @type {import('ts-jest').JestConfigWithTsJest} */

module.exports = {
  roots: ['<rootDir>'],
  globals: {
    'ts-jest': {
      tsConfig: {
        importHelpers: true
      }
    }
  },
  transform: {
    // '^.+\\.ts$': 'ts-jest',
    // '^.+\\.js$': 'babel-jest',
    // '^.+\\.mjs$': 'babel-jest'
  },
  moduleDirectories: ['node_modules', '<rootDir>/src'],
  moduleNameMapper: {
    '^@App/(.*)$': '<rootDir>/src/$1',
    '^lib/(.*)$': '<rootDir>/common/$1'
  }
}
```
<hr />
<p>tsconfig.json</p>
```{
  "compilerOptions": {
    "target": "ES6",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react",
    "baseUrl": ".",
    "experimentalDecorators": true,
    "strictPropertyInitialization": false,
    "declaration": true,
    "noImplicitAny": false,
    "strictNullChecks": false,
    "noImplicitUseStrict": false,
    "importHelpers": false,
    "emitDecoratorMetadata": false,
    "types": ["resize-observer-browser", "jest"],
    "paths": {
      "@App/*": ["src/*"],
      "lib/*": ["common/*"]
    }
  },
  "include": ["src", "globals.d.ts", "src/jest.config.ts"]
}
```
<p>package.json with this</p>
```{
  "name": "buying-board-ui-updated",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@apollo/client": "3.2.0",
    "@azure/msal-browser": "2.32.0",
    "@azure/msal-react": "1.5.0",
    "@blueprintjs/core": "3.50.4",
    "@date-io/date-fns": "1.3.5",
    "@emotion/react": "11.4.1",
    "@emotion/styled": "11.3.0",
    "@fontsource/roboto": "4.5.7",
    "@grapecity/wijmo": "5.20202.724",
    "@grapecity/wijmo.grid": "5.20202.724",
    "@grapecity/wijmo.grid.filter": "5.20202.724",
    "@grapecity/wijmo.grid.xlsx": "5.20202.724",
    "@grapecity/wijmo.react.grid": "5.20202.724",
    "@grapecity/wijmo.react.grid.filter": "5.20202.724",
    "@grapecity/wijmo.xlsx": "5.20202.724",
    "@graphql-tools/webpack-loader": "6.6.0",
    "@hot-loader/react-dom": "17.0.1",
    "@material-ui/core": "4.3.3",
    "@material-ui/icons": "^4.11.3",
    "@material-ui/lab": "3.0.0-alpha.30",
    "@material-ui/pickers": "3.2.10",
    "@meronex/icons": "4.0.0",
    "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
    "@svgr/webpack": "^6.5.1",
    "@types/react-router-dom": "5.3.0",
    "@types/styled-components": "5.1.14",
    "@typescript-eslint/eslint-plugin": "4.5.0",
    "@typescript-eslint/parser": "4.5.0",
    "axios": "0.22.0",
    "babel-eslint": "10.1.0",
    "babel-loader": "8.1.0",
    "babel-plugin-lodash": "3.3.4",
    "babel-plugin-named-asset-import": "0.3.7",
    "babel-preset-env": "1.7.0",
    "babel-preset-react-app": "10.0.0",
    "bfj": "7.0.2",
    "camelcase": "6.1.0",
    "case-sensitive-paths-webpack-plugin": "2.3.0",
    "circular-dependency-plugin": "5.2.2",
    "classnames": "2.2.6",
    "css-loader": "4.3.0",
    "cuid": "2.1.8",
    "date-fns": "2.25.0",
    "dom-helpers": "5.2.1",
    "dotenv": "8.2.0",
    "dotenv-expand": "5.1.0",
    "flickity": "2.2.2",
    "formik": "^2.2.9",
    "fs-extra": "9.0.1",
    "graphql": "15.6.0",
    "html-webpack-plugin": "4.5.0",
    "husky": ">=6",
    "i18next": "21.10.0",
    "i18next-browser-languagedetector": "6.1.2",
    "i18next-locize-backend": "6.0.0",
    "identity-obj-proxy": "3.0.0",
    "jsonwebtoken": "^9.0.0",
    "jszip": "^3.10.1",
    "lockr": "0.8.4",
    "lodash": "^4.17.21",
    "material-ui-nested-menu-item": "1.0.2",
    "material-ui-rating": "4.2.0",
    "memoize-one": "5.2.1",
    "mini-css-extract-plugin": "0.11.3",
    "mobx": "5.13.0",
    "mobx-react": "5.4.4",
    "mobx-react-devtools": "6.0.3",
    "mobx-react-lite": "1.4.1",
    "mobx-react-router": "4.0.7",
    "mobx-utils": "5.4.1",
    "moment": "^2.29.4",
    "object-assign": "4.1.1",
    "optimize-css-assets-webpack-plugin": "^6.0.1",
    "platform": "1.3.6",
    "pnp-webpack-plugin": "1.6.4",
    "polished": "4.1.3",
    "postcss-flexbugs-fixes": "4.2.1",
    "postcss-loader": "3.0.0",
    "postcss-nested": "4.0.0",
    "postcss-normalize": "8.0.1",
    "postcss-preset-env": "6.7.0",
    "postcss-safe-parser": "5.0.2",
    "primereact": "3.3.2",
    "prompts": "2.4.0",
    "query-string": "7.0.1",
    "react": "17.0.2",
    "react-apollo-network-status": "5.0.1",
    "react-app-polyfill": "2.0.0",
    "react-dev-utils": "^11.0.4",
    "react-device-detect": "2.0.1",
    "react-dnd": "7.4.5",
    "react-dnd-html5-backend": "7.4.4",
    "react-dnd-multi-backend": "3.2.1",
    "react-dnd-touch-backend": "0.8.1",
    "react-dom": "17.0.2",
    "react-dropzone": "11.4.2",
    "react-easy-crop": "3.5.3",
    "react-flickity-component": "3.6.2",
    "react-flip-move": "3.0.4",
    "react-helmet": "6.1.0",
    "react-hot-loader": "4.13.0",
    "react-hotkeys-hook": "3.4.3",
    "react-i18next": "11.18.6",
    "react-infinite-scroller": "1.2.4",
    "react-loading-skeleton": "2.2.0",
    "react-measure": "2.5.2",
    "react-player": "2.9.0",
    "react-rating": "2.0.5",
    "react-refresh": "0.8.3",
    "react-responsive": "9.0.0-beta.4",
    "react-router-dom": "5.3.0",
    "react-slick": "0.28.1",
    "react-swipeable-views": "0.14.0",
    "react-test-renderer": "^17.0.2",
    "react-text-truncate": "0.17.0",
    "react-timeago": "6.2.1",
    "react-toastify": "8.0.3",
    "react-tooltip": "4.2.21",
    "react-use-dimensions": "1.2.1",
    "react-virtualized": "9.22.3",
    "react-virtualized-auto-sizer": "1.0.6",
    "react-virtualized-sticky-tree": "2.1.30",
    "react-visibility-sensor": "5.1.1",
    "react-window": "1.8.6",
    "reactjs-popup": "2.0.5",
    "resolve": "1.18.1",
    "resolve-url-loader": "^3.1.5",
    "sass-loader": "10.0.5",
    "semver": "7.3.2",
    "slick-carousel": "1.8.1",
    "source-map-explorer": "2.5.2",
    "style-loader": "1.3.0",
    "styled-components": "5.3.1",
    "subscriptions-transport-ws": "0.9.12",
    "terser-webpack-plugin": "4.2.3",
    "ts-node": "^10.9.1",
    "ts-pnp": "1.2.0",
    "tsconfig-paths-webpack-plugin": "3.5.1",
    "url-loader": "4.1.1",
    "use-deep-compare-effect": "1.8.0",
    "web-vitals": "1.0.1",
    "webpack": "^5.75.0",
    "webpack-dev-server": "^3.11.3",
    "webpack-manifest-plugin": "2.2.0",
    "workbox-webpack-plugin": "^6.5.4",
    "yup": "0.32.9"
  },
  "scripts": {
    "start": "sh devsetup.sh && PORT=4000 FAST_REFRESH=false node scripts/start.js",
    "build": "node --max-old-space-size=4096 scripts/build.js",
    "test": "jest",
    "prepare": "husky install",
    "pretty": "prettier --config .prettierrc --write src/**/** --loglevel silent --ignore-unknown",
    "analyze": "source-map-explorer 'build/static/js/*.js'  --html result.html",
    "preinstall": "npx npm-force-resolutions"
  },
  "lint-staged": {
    "**/*": "npm run pretty"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "babel": {
    "presets": [
      "react-app"
    ]
  },
  "resolutions": {
    "@material-ui/icons": "3.0.2",
    "@material-ui/core": "4.3.3",
    "react-fast-compare": "3.2.0",
    "@types/react": "17.0.14",
    "lodash": "4.17.15"
  },
  "devDependencies": {
    "@babel/core": "^7.20.7",
    "@babel/preset-env": "^7.20.2",
    "@babel/preset-typescript": "^7.18.6",
    "@testing-library/jest-dom": "5.11.4",
    "@testing-library/react": "11.1.0",
    "@testing-library/user-event": "12.1.10",
    "@types/jest": "^26.0.24",
    "@types/jsonwebtoken": "8.5.5",
    "@types/lockr": "0.8.6",
    "@types/lodash": "4.14.175",
    "@types/node": "12.0.0",
    "@types/platform": "1.3.4",
    "@types/react": "^17.0.14",
    "@types/react-dnd-multi-backend": "3.0.0",
    "@types/react-dom": "^17.0.14",
    "@types/react-timeago": "4.1.3",
    "@types/resize-observer-browser": "0.1.7",
    "babel-jest": "^29.3.1",
    "eslint": "7.11.0",
    "eslint-config-react-app": "6.0.0",
    "eslint-plugin-flowtype": "5.2.0",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jest": "24.1.0",
    "eslint-plugin-jsx-a11y": "6.3.1",
    "eslint-plugin-react": "7.21.5",
    "eslint-plugin-react-hooks": "4.2.0",
    "eslint-plugin-testing-library": "3.9.2",
    "eslint-webpack-plugin": "2.5.2",
    "fast-glob": "3.2.7",
    "file-loader": "6.1.1",
    "husky": "7.0.0",
    "jest": "^29.3.1",
    "jest-circus": "^29.3.1",
    "jest-environment-jsdom": "^29.3.1",
    "jest-resolve": "^29.3.1",
    "jest-runtime": "^29.3.1",
    "jest-watch-typeahead": "^2.2.1",
    "lint-staged": ">=10",
    "lodash-webpack-plugin": "0.11.6",
    "prettier": "2.4.1",
    "tiny-replace-files": "1.0.2",
    "ts-jest": "^29.0.3",
    "tsconfig-paths-jest": "0.0.1",
    "typescript": "^4.9.4",
    "typescript-plugin-css-modules": "^4.1.1",
    "unused-webpack-plugin": "2.4.0"
  }
}
```

After this when i try to run my test file with jest it gives bellow error,

now, can anyone guide me how to fix this and what's causing this error.

Body:
I have mobx project with typescript and i have been trying to setup jest with jest.config.js and tsconfig.json as followed,

jest.config.js

/** @type {import('ts-jest').JestConfigWithTsJest} */

module.exports = {
  roots: ['<rootDir>'],
  globals: {
    'ts-jest': {
      tsConfig: {
        importHelpers: true
      }
    }
  },
  transform: {
    // '^.+\\.ts$': 'ts-jest',
    // '^.+\\.js$': 'babel-jest',
    // '^.+\\.mjs$': 'babel-jest'
  },
  moduleDirectories: ['node_modules', '<rootDir>/src'],
  moduleNameMapper: {
    '^@App/(.*)$': '<rootDir>/src/$1',
    '^lib/(.*)$': '<rootDir>/common/$1'
  }
}

tsconfig.json

{
  "compilerOptions": {
    "target": "ES6",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react",
    "baseUrl": ".",
    "experimentalDecorators": true,
    "strictPropertyInitialization": false,
    "declaration": true,
    "noImplicitAny": false,
    "strictNullChecks": false,
    "noImplicitUseStrict": false,
    "importHelpers": false,
    "emitDecoratorMetadata": false,
    "types": ["resize-observer-browser", "jest"],
    "paths": {
      "@App/*": ["src/*"],
      "lib/*": ["common/*"]
    }
  },
  "include": ["src", "globals.d.ts", "src/jest.config.ts"]
}

package.json with this

{
  "name": "buying-board-ui-updated",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@apollo/client": "3.2.0",
    "@azure/msal-browser": "2.32.0",
    "@azure/msal-react": "1.5.0",
    "@blueprintjs/core": "3.50.4",
    "@date-io/date-fns": "1.3.5",
    "@emotion/react": "11.4.1",
    "@emotion/styled": "11.3.0",
    "@fontsource/roboto": "4.5.7",
    "@grapecity/wijmo": "5.20202.724",
    "@grapecity/wijmo.grid": "5.20202.724",
    "@grapecity/wijmo.grid.filter": "5.20202.724",
    "@grapecity/wijmo.grid.xlsx": "5.20202.724",
    "@grapecity/wijmo.react.grid": "5.20202.724",
    "@grapecity/wijmo.react.grid.filter": "5.20202.724",
    "@grapecity/wijmo.xlsx": "5.20202.724",
    "@graphql-tools/webpack-loader": "6.6.0",
    "@hot-loader/react-dom": "17.0.1",
    "@material-ui/core": "4.3.3",
    "@material-ui/icons": "^4.11.3",
    "@material-ui/lab": "3.0.0-alpha.30",
    "@material-ui/pickers": "3.2.10",
    "@meronex/icons": "4.0.0",
    "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
    "@svgr/webpack": "^6.5.1",
    "@types/react-router-dom": "5.3.0",
    "@types/styled-components": "5.1.14",
    "@typescript-eslint/eslint-plugin": "4.5.0",
    "@typescript-eslint/parser": "4.5.0",
    "axios": "0.22.0",
    "babel-eslint": "10.1.0",
    "babel-loader": "8.1.0",
    "babel-plugin-lodash": "3.3.4",
    "babel-plugin-named-asset-import": "0.3.7",
    "babel-preset-env": "1.7.0",
    "babel-preset-react-app": "10.0.0",
    "bfj": "7.0.2",
    "camelcase": "6.1.0",
    "case-sensitive-paths-webpack-plugin": "2.3.0",
    "circular-dependency-plugin": "5.2.2",
    "classnames": "2.2.6",
    "css-loader": "4.3.0",
    "cuid": "2.1.8",
    "date-fns": "2.25.0",
    "dom-helpers": "5.2.1",
    "dotenv": "8.2.0",
    "dotenv-expand": "5.1.0",
    "flickity": "2.2.2",
    "formik": "^2.2.9",
    "fs-extra": "9.0.1",
    "graphql": "15.6.0",
    "html-webpack-plugin": "4.5.0",
    "husky": ">=6",
    "i18next": "21.10.0",
    "i18next-browser-languagedetector": "6.1.2",
    "i18next-locize-backend": "6.0.0",
    "identity-obj-proxy": "3.0.0",
    "jsonwebtoken": "^9.0.0",
    "jszip": "^3.10.1",
    "lockr": "0.8.4",
    "lodash": "^4.17.21",
    "material-ui-nested-menu-item": "1.0.2",
    "material-ui-rating": "4.2.0",
    "memoize-one": "5.2.1",
    "mini-css-extract-plugin": "0.11.3",
    "mobx": "5.13.0",
    "mobx-react": "5.4.4",
    "mobx-react-devtools": "6.0.3",
    "mobx-react-lite": "1.4.1",
    "mobx-react-router": "4.0.7",
    "mobx-utils": "5.4.1",
    "moment": "^2.29.4",
    "object-assign": "4.1.1",
    "optimize-css-assets-webpack-plugin": "^6.0.1",
    "platform": "1.3.6",
    "pnp-webpack-plugin": "1.6.4",
    "polished": "4.1.3",
    "postcss-flexbugs-fixes": "4.2.1",
    "postcss-loader": "3.0.0",
    "postcss-nested": "4.0.0",
    "postcss-normalize": "8.0.1",
    "postcss-preset-env": "6.7.0",
    "postcss-safe-parser": "5.0.2",
    "primereact": "3.3.2",
    "prompts": "2.4.0",
    "query-string": "7.0.1",
    "react": "17.0.2",
    "react-apollo-network-status": "5.0.1",
    "react-app-polyfill": "2.0.0",
    "react-dev-utils": "^11.0.4",
    "react-device-detect": "2.0.1",
    "react-dnd": "7.4.5",
    "react-dnd-html5-backend": "7.4.4",
    "react-dnd-multi-backend": "3.2.1",
    "react-dnd-touch-backend": "0.8.1",
    "react-dom": "17.0.2",
    "react-dropzone": "11.4.2",
    "react-easy-crop": "3.5.3",
    "react-flickity-component": "3.6.2",
    "react-flip-move": "3.0.4",
    "react-helmet": "6.1.0",
    "react-hot-loader": "4.13.0",
    "react-hotkeys-hook": "3.4.3",
    "react-i18next": "11.18.6",
    "react-infinite-scroller": "1.2.4",
    "react-loading-skeleton": "2.2.0",
    "react-measure": "2.5.2",
    "react-player": "2.9.0",
    "react-rating": "2.0.5",
    "react-refresh": "0.8.3",
    "react-responsive": "9.0.0-beta.4",
    "react-router-dom": "5.3.0",
    "react-slick": "0.28.1",
    "react-swipeable-views": "0.14.0",
    "react-test-renderer": "^17.0.2",
    "react-text-truncate": "0.17.0",
    "react-timeago": "6.2.1",
    "react-toastify": "8.0.3",
    "react-tooltip": "4.2.21",
    "react-use-dimensions": "1.2.1",
    "react-virtualized": "9.22.3",
    "react-virtualized-auto-sizer": "1.0.6",
    "react-virtualized-sticky-tree": "2.1.30",
    "react-visibility-sensor": "5.1.1",
    "react-window": "1.8.6",
    "reactjs-popup": "2.0.5",
    "resolve": "1.18.1",
    "resolve-url-loader": "^3.1.5",
    "sass-loader": "10.0.5",
    "semver": "7.3.2",
    "slick-carousel": "1.8.1",
    "source-map-explorer": "2.5.2",
    "style-loader": "1.3.0",
    "styled-components": "5.3.1",
    "subscriptions-transport-ws": "0.9.12",
    "terser-webpack-plugin": "4.2.3",
    "ts-node": "^10.9.1",
    "ts-pnp": "1.2.0",
    "tsconfig-paths-webpack-plugin": "3.5.1",
    "url-loader": "4.1.1",
    "use-deep-compare-effect": "1.8.0",
    "web-vitals": "1.0.1",
    "webpack": "^5.75.0",
    "webpack-dev-server": "^3.11.3",
    "webpack-manifest-plugin": "2.2.0",
    "workbox-webpack-plugin": "^6.5.4",
    "yup": "0.32.9"
  },
  "scripts": {
    "start": "sh devsetup.sh && PORT=4000 FAST_REFRESH=false node scripts/start.js",
    "build": "node --max-old-space-size=4096 scripts/build.js",
    "test": "jest",
    "prepare": "husky install",
    "pretty": "prettier --config .prettierrc --write src/**/** --loglevel silent --ignore-unknown",
    "analyze": "source-map-explorer 'build/static/js/*.js'  --html result.html",
    "preinstall": "npx npm-force-resolutions"
  },
  "lint-staged": {
    "**/*": "npm run pretty"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "babel": {
    "presets": [
      "react-app"
    ]
  },
  "resolutions": {
    "@material-ui/icons": "3.0.2",
    "@material-ui/core": "4.3.3",
    "react-fast-compare": "3.2.0",
    "@types/react": "17.0.14",
    "lodash": "4.17.15"
  },
  "devDependencies": {
    "@babel/core": "^7.20.7",
    "@babel/preset-env": "^7.20.2",
    "@babel/preset-typescript": "^7.18.6",
    "@testing-library/jest-dom": "5.11.4",
    "@testing-library/react": "11.1.0",
    "@testing-library/user-event": "12.1.10",
    "@types/jest": "^26.0.24",
    "@types/jsonwebtoken": "8.5.5",
    "@types/lockr": "0.8.6",
    "@types/lodash": "4.14.175",
    "@types/node": "12.0.0",
    "@types/platform": "1.3.4",
    "@types/react": "^17.0.14",
    "@types/react-dnd-multi-backend": "3.0.0",
    "@types/react-dom": "^17.0.14",
    "@types/react-timeago": "4.1.3",
    "@types/resize-observer-browser": "0.1.7",
    "babel-jest": "^29.3.1",
    "eslint": "7.11.0",
    "eslint-config-react-app": "6.0.0",
    "eslint-plugin-flowtype": "5.2.0",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jest": "24.1.0",
    "eslint-plugin-jsx-a11y": "6.3.1",
    "eslint-plugin-react": "7.21.5",
    "eslint-plugin-react-hooks": "4.2.0",
    "eslint-plugin-testing-library": "3.9.2",
    "eslint-webpack-plugin": "2.5.2",
    "fast-glob": "3.2.7",
    "file-loader": "6.1.1",
    "husky": "7.0.0",
    "jest": "^29.3.1",
    "jest-circus": "^29.3.1",
    "jest-environment-jsdom": "^29.3.1",
    "jest-resolve": "^29.3.1",
    "jest-runtime": "^29.3.1",
    "jest-watch-typeahead": "^2.2.1",
    "lint-staged": ">=10",
    "lodash-webpack-plugin": "0.11.6",
    "prettier": "2.4.1",
    "tiny-replace-files": "1.0.2",
    "ts-jest": "^29.0.3",
    "tsconfig-paths-jest": "0.0.1",
    "typescript": "^4.9.4",
    "typescript-plugin-css-modules": "^4.1.1",
    "unused-webpack-plugin": "2.4.0"
  }
}

After this when i try to run my test file with jest it gives bellow error,

now, can anyone guide me how to fix this and what's causing this error.


问:
Invented templates having no valid specializations
The Standard says

The program is ill-formed, no diagnostic required, if:

no valid specialization can be generated for a template [...]

The Standard also has various rules that stipulate inventing or rewriting templates, producing new templates that are not contained in the source program. What happens if such invented or rewritten template has no valid specializations? Can it happen when all user templates do have valid specializations?

Consider this code (lifted from here):

```<code>template<template<int&> class> struct A {};
template<auto> struct B {};
A<B> a;
</code>```

The code is accepted by all major compilers.

Checking whether A is allowed involves synthesizing these templates with unique invented names:

```<code>template <auto> class X {};
template<auto V> void func1(X<V>);
template<int& V> void func2(X<V>);
</code>```

and then checking the partial template ordering between func1 and func2 to see which one is more specialized.

It looks like func2 has no valid specializations. At least I could not produce one. Yet both A and B are perfectly normal templates with valid specializations.

Body:
The Standard says

The program is ill-formed, no diagnostic required, if:

no valid specialization can be generated for a template [...]

The Standard also has various rules that stipulate inventing or rewriting templates, producing new templates that are not contained in the source program. What happens if such invented or rewritten template has no valid specializations? Can it happen when all user templates do have valid specializations?

Consider this code (lifted from here):

template<template<int&> class> struct A {};
template<auto> struct B {};
A a;

The code is accepted by all major compilers.

Checking whether A is allowed involves synthesizing these templates with unique invented names:

template <auto> class X {};
template<auto V> void func1(X<V>);
template<int& V> void func2(X<V>);

and then checking the partial template ordering between func1 and func2 to see which one is more specialized.

It looks like func2 has no valid specializations. At least I could not produce one. Yet both A and B are perfectly normal templates with valid specializations.


问:
How can I put javascript in the pdf that im creating with reportlab
What im trying to do is to include some javascript code into a pdf file.
The pdf is created successfully but when i add javascript code, it will bring error

```<code>import os
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen.canvas import Canvas

# Get the path to the desktop directory
desktop_path = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')

# Create the PDF file in the desktop directory
pdf = Canvas(os.path.join(desktop_path, "my_pdf.pdf"), pagesize=letter)

# Add a JavaScript function to the PDF
js = "console.log('hello')"
print(js)
pdf.addOutlineEntry("Say Hello", js)

# Save the PDF
pdf.save()
</code>```

error:

```<code>Traceback (most recent call last):
  File "C:\Users\use\Desktop\pdf\getIp.py", line 17, in <module>
    pdf.save()
  File "C:\Python310\lib\site-packages\reportlab\pdfgen\canvas.py", line 1280, in save
    self._doc.SaveToFile(self._filename, self)
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 212, in SaveToFile
    data = self.GetPDFData(canvas)
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 238, in GetPDFData
    return self.format()
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 420, in format
    IOf = IO.format(self)
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 867, in format
    fcontent = format(self.content, document, toplevel=1)   # yes this is at top level
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 67, in format
    f = element.format(document)
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 1312, in format
    return PD.format(document)
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 680, in format
    L = [(format(PDFName(k),document)+b" "+format(dict[k],document)) for k in keys]
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 680, in <listcomp>
    L = [(format(PDFName(k),document)+b" "+format(dict[k],document)) for k in keys]
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 67, in format
    f = element.format(document)
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 1767, in format
    if f is None: raise ValueError("format not resolved, probably missing URL scheme or undefined destination target for '%s'" % self.name)
ValueError: format not resolved, probably missing URL scheme or undefined destination target for 'console.log('hello')'
</code>```

How can I solve it?

Body:
What im trying to do is to include some javascript code into a pdf file.
The pdf is created successfully but when i add javascript code, it will bring error

import os
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen.canvas import Canvas

# Get the path to the desktop directory
desktop_path = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')

# Create the PDF file in the desktop directory
pdf = Canvas(os.path.join(desktop_path, "my_pdf.pdf"), pagesize=letter)

# Add a JavaScript function to the PDF
js = "console.log('hello')"
print(js)
pdf.addOutlineEntry("Say Hello", js)

# Save the PDF
pdf.save()

error:

Traceback (most recent call last):
  File "C:\Users\use\Desktop\pdf\getIp.py", line 17, in <module>
    pdf.save()
  File "C:\Python310\lib\site-packages\reportlab\pdfgen\canvas.py", line 1280, in save
    self._doc.SaveToFile(self._filename, self)
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 212, in SaveToFile
    data = self.GetPDFData(canvas)
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 238, in GetPDFData
    return self.format()
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 420, in format
    IOf = IO.format(self)
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 867, in format
    fcontent = format(self.content, document, toplevel=1)   # yes this is at top level
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 67, in format
    f = element.format(document)
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 1312, in format
    return PD.format(document)
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 680, in format
    L = [(format(PDFName(k),document)+b" "+format(dict[k],document)) for k in keys]
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 680, in <listcomp>
    L = [(format(PDFName(k),document)+b" "+format(dict[k],document)) for k in keys]
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 67, in format
    f = element.format(document)
  File "C:\Python310\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 1767, in format
    if f is None: raise ValueError("format not resolved, probably missing URL scheme or undefined destination target for '%s'" % self.name)
ValueError: format not resolved, probably missing URL scheme or undefined destination target for 'console.log('hello')'

How can I solve it?


问:
how to run local executable file from package.json by npm or pnpm
in package.json:

```<code>"scripts":{
  "test": "./localPath/file.exe"
}
</code>```

in command line:
$ npm run test or $ pnpm test

the error:
'.' is not recognized as an internal or external command, operable program or batch file.

extra: (tests works just fine)

without npm, I test in command line:
$ ./localPath/file.exe
and its run just fine

I test absolute path in package.json:

```<code>"scripts":{
  "test": "absolutePath/file.exe"
}
</code>```

then in command line I run
$ npm run test or $ pnpm test
and its run just fine

Body:
in package.json:

"scripts":{
  "test": "./localPath/file.exe"
}

in command line:
$ npm run test or $ pnpm test

the error:
'.' is not recognized as an internal or external command, operable program or batch file.

extra: (tests works just fine)

without npm, I test in command line:
$ ./localPath/file.exe
and its run just fine

I test absolute path in package.json:

"scripts":{
  "test": "absolutePath/file.exe"
}

then in command line I run
$ npm run test or $ pnpm test
and its run just fine


问:
How can I handle the remaining event with EventTimeWindows in flink
I am trying to use TumblingEventTimeWindows in flink stream. As I know flink stream count the window base on the time on an event, and it will not trigger a new window if no more new event arrive. Base on this understanding, I wonder how the event in the coming window can be handled if no more event arrive then. I think the withIdleness functions should can solve the problem, but it cannot work during my test code as follow.

```<code>public static void main(String[] args) throws Exception {
    StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

    DataStream<Tuple3<String, Long, Integer>> saleData =
            SourceFactory.socketText(env,"localhost", 9999)
                    .map(new ParseSaleData());

    DataStream<Tuple3<String, Long, Integer>> dataStream =
            saleData.assignTimestampsAndWatermarks(
            WatermarkStrategy.<Tuple3<String, Long, Integer>>forMonotonousTimestamps()
                    .withIdleness(Duration.ofSeconds(20))
                    .withTimestampAssigner((data, timestamp) -> data))
                    .keyBy(value -> value.f0)
                    .window(TumblingEventTimeWindows.of(Time.seconds(10)))
                    .reduce((a,b) -> new Tuple3<>(a.f0, a.f1, a.f2 + b.f2));
    dataStream.print();

    env.execute("Window WordCount");
}
</code>```

I tested it with the following data as event inputs

L 1671537500000 1  //+0 the event should be handled in the 1st window
L 1671537510000 10  //+10 the first window is triggered, and this event should be calculated in next window

the 2nd event should be triggered in next window, but if there are no more event arrive, the next window will not be triggered. I wonder how the next window can be triggered if no more event arrive? Whether the usage of withIdleness is correct or related to this issue?

Body:
I am trying to use TumblingEventTimeWindows in flink stream. As I know flink stream count the window base on the time on an event, and it will not trigger a new window if no more new event arrive. Base on this understanding, I wonder how the event in the coming window can be handled if no more event arrive then. I think the withIdleness functions should can solve the problem, but it cannot work during my test code as follow.

public static void main(String[] args) throws Exception {
    StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

    DataStream<Tuple3<String, Long, Integer>> saleData =
            SourceFactory.socketText(env,"localhost", 9999)
                    .map(new ParseSaleData());

    DataStream<Tuple3<String, Long, Integer>> dataStream =
            saleData.assignTimestampsAndWatermarks(
            WatermarkStrategy.<Tuple3<String, Long, Integer>>forMonotonousTimestamps()
                    .withIdleness(Duration.ofSeconds(20))
                    .withTimestampAssigner((data, timestamp) -> data))
                    .keyBy(value -> value.f0)
                    .window(TumblingEventTimeWindows.of(Time.seconds(10)))
                    .reduce((a,b) -> new Tuple3<>(a.f0, a.f1, a.f2 + b.f2));
    dataStream.print();

    env.execute("Window WordCount");
}

I tested it with the following data as event inputs

L 1671537500000 1  //+0 the event should be handled in the 1st window
L 1671537510000 10  //+10 the first window is triggered, and this event should be calculated in next window

the 2nd event should be triggered in next window, but if there are no more event arrive, the next window will not be triggered. I wonder how the next window can be triggered if no more event arrive? Whether the usage of withIdleness is correct or related to this issue?