问:
spring-doc open api integration on spring web mvc problem
I am working on a production application built with spring core, spring Web-mvc, spring security. It is running fine. But I want to implement spring doc Open-Api. So I am using first solution of this stackoverflow question.

i have made following changes to integrate spring doc open api:

```<code>file-build.gradle:

implementation (group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.13'){
    exclude group: 'org.springframework', module: 'spring-webmvc'
}
</code>```

code here

```<code>file: servlet-context.xml:

<!-- Package scan for spring doc open ui -->
<context:component-scan base-package="com.documentation.openapiconfig"/>
</code>```

Created new package com.documentation.openapiconfig and have only one class in this:

```<code>package com.documentation.openapiconfig;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@EnableWebMvc
@ComponentScan(basePackages = {"org.springdoc"})
@Import({org.springdoc.core.SpringDocConfiguration.class,
         org.springdoc.webmvc.core.SpringDocWebMvcConfiguration.class,
         org.springdoc.webmvc.ui.SwaggerConfig.class,
         org.springdoc.core.SwaggerUiConfigProperties.class,
         org.springdoc.core.SwaggerUiOAuthProperties.class,
         org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration.class})

class OpenApiConfig implements WebMvcConfigurer {
}
</code>```

In spring-security.xml, I have changed the following:

```<code> <security:intercept-url pattern="/swagger*/**" access="ROLE_DEVELOPER"/>
<security:intercept-url pattern="/v3/api-docs" access="ROLE_DEVELOPER"/>
</code>```

AFter these changes, when i run the application i get following error:

```<code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter': Invocation of init method failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'exceptionHandlingController': Unsatisfied dependency expressed through field 'eliteUtils'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eliteUtils': Unsatisfied dependency expressed through field 'staffService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'staffService': Unsatisfied dependency expressed through field 'systemParamService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'systemParameterService': Unsatisfied dependency expressed through field 'staffService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'auditAspect': Unsatisfied dependency expressed through field 'eliteUtils'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'eliteUtils': Requested bean is currently in creation: Is there an unresolvable circular reference?
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:702)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:668)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:716)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:591)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:530)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:170)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1134)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1089)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:983)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4876)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5185)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Tomcat.start(Tomcat.java:468)
    at org.apache.catalina.startup.Tomcat$start$0.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119)
    at org.akhikhl.gretty.TomcatServerManager.startServer(TomcatServerManager.groovy:52)
    at org.akhikhl.gretty.ServerManager$startServer$0.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
    at org.akhikhl.gretty.Runner.run(Runner.groovy:129)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:43)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:190)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:70)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119)
    at org.akhikhl.gretty.Runner.main(Runner.groovy:54)

Any one please help, it's urgent.

</code>```

Body:
I am working on a production application built with spring core, spring Web-mvc, spring security. It is running fine. But I want to implement spring doc Open-Api. So I am using first solution of this stackoverflow question.

i have made following changes to integrate spring doc open api:

file-build.gradle:

implementation (group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.13'){
    exclude group: 'org.springframework', module: 'spring-webmvc'
}

code here

file: servlet-context.xml:

<context:component-scan base-package="com.documentation.openapiconfig"/>

Created new package com.documentation.openapiconfig and have only one class in this:

package com.documentation.openapiconfig;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@EnableWebMvc
@ComponentScan(basePackages = {"org.springdoc"})
@Import({org.springdoc.core.SpringDocConfiguration.class,
         org.springdoc.webmvc.core.SpringDocWebMvcConfiguration.class,
         org.springdoc.webmvc.ui.SwaggerConfig.class,
         org.springdoc.core.SwaggerUiConfigProperties.class,
         org.springdoc.core.SwaggerUiOAuthProperties.class,
         org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration.class})

class OpenApiConfig implements WebMvcConfigurer {
}

In spring-security.xml, I have changed the following:

 <security:intercept-url pattern="/swagger*/**" access="ROLE_DEVELOPER"/>
<security:intercept-url pattern="/v3/api-docs" access="ROLE_DEVELOPER"/>

AFter these changes, when i run the application i get following error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter': Invocation of init method failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'exceptionHandlingController': Unsatisfied dependency expressed through field 'eliteUtils'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eliteUtils': Unsatisfied dependency expressed through field 'staffService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'staffService': Unsatisfied dependency expressed through field 'systemParamService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'systemParameterService': Unsatisfied dependency expressed through field 'staffService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'auditAspect': Unsatisfied dependency expressed through field 'eliteUtils'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'eliteUtils': Requested bean is currently in creation: Is there an unresolvable circular reference?
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:702)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:668)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:716)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:591)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:530)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:170)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1134)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1089)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:983)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4876)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5185)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Tomcat.start(Tomcat.java:468)
    at org.apache.catalina.startup.Tomcat$start$0.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119)
    at org.akhikhl.gretty.TomcatServerManager.startServer(TomcatServerManager.groovy:52)
    at org.akhikhl.gretty.ServerManager$startServer$0.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
    at org.akhikhl.gretty.Runner.run(Runner.groovy:129)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:43)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:190)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:70)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119)
    at org.akhikhl.gretty.Runner.main(Runner.groovy:54)

Any one please help, it's urgent.


来源: stackexchange

问:
Is there any way to display null values (as string) in a multi-value parameter using FetchXml query in SSRS reports?
I'm learning SSRS and stuck in a scenario where I want to display some records (containing null values) in a multi-value parameter. I'm using Dynamics 365 Fetch query. For a simple drop-down allow null works but for multi-values it's not working. Is there any way how can I make it work?
Remember, I'm able to retrieve the null values but what I want is to display those null values as string, like 'Null', in the multi-value parameter list

This is my main query:

```<code><fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="contact">
<attribute name="fullname"/>
<attribute name="telephone1"/>
<attribute name="jobtitle"/>
<attribute name="emailaddress1"/>
<attribute name="creditlimit"/>
<attribute name="parentcustomerid"/>
<attribute name="birthdate"/>
<attribute name="address1_stateorprovince"/>
<attribute name="address1_country"/>
<attribute name="address1_city"/>
<order attribute="fullname" descending="false"/>
<filter>
<condition attribute="telephone1" operator="not-null"/>
</filter>
<filter>
<condition attribute="emailaddress1" operator="not-null"/>
</filter>
<filter type="or">
<condition attribute="jobtitle" operator="null">
<value>Null</value>
</condition>
<condition attribute="jobtitle" operator="in" value="@jobtitle"/>
</filter>
</entity>
</fetch>
</code>```

Parameter gets values through this:

```<code><fetch distinct="true">
  <entity name="contact">
    <attribute name="jobtitle" />
    <filter>
      <condition attribute="telephone1" operator="not-null" />
    </filter>
    <filter>
      <condition attribute="emailaddress1" operator="not-null" />
    </filter>
  </entity>
</fetch>
</code>```

Although null values exists there but I want them to show as string 'Null'...

ContentLicense: CC BY-SA 4.0

Body:
I'm learning SSRS and stuck in a scenario where I want to display some records (containing null values) in a multi-value parameter. I'm using Dynamics 365 Fetch query. For a simple drop-down allow null works but for multi-values it's not working. Is there any way how can I make it work?
Remember, I'm able to retrieve the null values but what I want is to display those null values as string, like 'Null', in the multi-value parameter list

This is my main query:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="contact">
<attribute name="fullname"/>
<attribute name="telephone1"/>
<attribute name="jobtitle"/>
<attribute name="emailaddress1"/>
<attribute name="creditlimit"/>
<attribute name="parentcustomerid"/>
<attribute name="birthdate"/>
<attribute name="address1_stateorprovince"/>
<attribute name="address1_country"/>
<attribute name="address1_city"/>
<order attribute="fullname" descending="false"/>
<filter>
<condition attribute="telephone1" operator="not-null"/>
</filter>
<filter>
<condition attribute="emailaddress1" operator="not-null"/>
</filter>
<filter type="or">
<condition attribute="jobtitle" operator="null">
<value>Null</value>
</condition>
<condition attribute="jobtitle" operator="in" value="@jobtitle"/>
</filter>
</entity>
</fetch>

Parameter gets values through this:

<fetch distinct="true">
  <entity name="contact">
    <attribute name="jobtitle" />
    <filter>
      <condition attribute="telephone1" operator="not-null" />
    </filter>
    <filter>
      <condition attribute="emailaddress1" operator="not-null" />
    </filter>
  </entity>
</fetch>

Although null values exists there but I want them to show as string 'Null'...


问:
Trying to generate a json asset file in Flutter
I have created a flutter web project and I am using flutter_azure_b2c package which uses asset json files, everything works fine when I run it.
it's shown like this

Now I want to generate these json config files automatically using env variables when I build the app.

Here is my json file format:

```<code>
{
  "client_id" : "",
  "redirect_uri" : "",
  "cache_location": "localStorage",
  "interaction_mode": "redirect",
  "authorities": [
    {
      "type": "B2C",
      "authority_url":""
    },
    {
      "type": "B2C",
      "authority_url":""
    }
  ],
  "default_scopes": [

  ]
}

</code>```

How can it be done?

I tried to write into the file when executing main.dart using this package https://pub.dev/packages/global_configuration but json values are not updated when I pass them in  flutter_azure_b2c method

Body:
I have created a flutter web project and I am using flutter_azure_b2c package which uses asset json files, everything works fine when I run it.
it's shown like this

Now I want to generate these json config files automatically using env variables when I build the app.

Here is my json file format:

{
  "client_id" : "",
  "redirect_uri" : "",
  "cache_location": "localStorage",
  "interaction_mode": "redirect",
  "authorities": [
    {
      "type": "B2C",
      "authority_url":""
    },
    {
      "type": "B2C",
      "authority_url":""
    }
  ],
  "default_scopes": [

  ]
}

How can it be done?

I tried to write into the file when executing main.dart using this package https://pub.dev/packages/global_configuration but json values are not updated when I pass them in  flutter_azure_b2c method


问:
angular image change on condition
currently I am making a mini game with angular, and I already have most functionalities working. I am currently struggling to implement to change picture every time either (not have decided yet):

change from A->F whenever I have collision with an obstacle

change from F-> whenever I have scored more than a certain score (say 200-300 : D 300-400: C === and so on...)

I have tried a lot of things, and seems to not work.

I have used ngSwitchCase in the html.

This is my Obstacle service
`

```<code>import { Injectable } from '@angular/core';
import { Cords, Dimensions, playerCords,playerDms } from './player.service';

// global variables for use.
export let platCords:Cords = { xoffset:0, yoffset:0 };
export let platDms:Dimensions = { width:0, height:0 };
export let start:boolean = false;
export let score:number[] = [0,0];
export let grade:String;

export class Obstacle{
  height:number;
  width:number;
  left:number;
  bottom:number;
  type:number;
  xoffset:number = 0;
  yoffset:number = 0;
  life:number;

  constructor(h:number,w:number,b:number,t:number) {
    // init the members
    this.height = h;
    this.width = w;
    this.type = t;
    this.left = platDms.width;
    this.bottom = b;
    this.xoffset = this.left + w;
    this.yoffset = platCords.yoffset - h - b;
    this.life =4;

    // start the motion of this obstacle and check for collision
    this.moveLeft(t);
  }

  // moving the obstacle by subtracting the xoffset.
  moveLeft(t:number){

    let leftTimer = setInterval(()=>{
      // remove the obstacle from array when moves out of game screen and increase score
      if(this.left<=-(this.width)){
        clearInterval(leftTimer);
        score[0] += 10;
        obs.splice(0,1);
      }
      this.left -= 5;
      this.xoffset -= 5;

      // check for collision when its moving.
      if( (this.collision(t)) || !start){
        // stop the game
        clearInterval(leftTimer);
        start =  false;
      }

    },15);
  }

  // collision function for two floating and running obstacles.
  collision(t:number):boolean{

    let o_A:Cords,o_B:Cords,d_A:Cords,d_B:Cords;

    switch (t) {
      case 1:
        // for running obstacles.
        d_B = {xoffset:playerCords.xoffset+20, yoffset:playerCords.yoffset+playerDms.height};
        d_A = {xoffset:playerCords.xoffset, yoffset:playerCords.yoffset+playerDms.height};
        o_A = {xoffset:this.xoffset, yoffset:this.yoffset};
        o_B = {xoffset:this.xoffset-this.width, yoffset:this.yoffset};

        if((o_B.xoffset <= d_B.xoffset  && o_B.xoffset >= d_A.xoffset) && (d_B.yoffset > o_A.yoffset)){
          return true
        }
        break;

      case 2:
        // for floating obstacles.
        d_B = {xoffset:playerCords.xoffset+20, yoffset:playerCords.yoffset};
        d_A = {xoffset:playerCords.xoffset, yoffset:playerCords.yoffset};
        o_A = {xoffset:this.xoffset, yoffset:this.yoffset+this.height};
        o_B = {xoffset:this.xoffset-this.width, yoffset:this.yoffset+this.height};

        if((o_B.xoffset < d_B.xoffset && o_B.xoffset >= d_A.xoffset) && (o_A.yoffset > (d_A.yoffset))){
          return true
        }
        break;
  }
return false
  }

};

// having array of obstacles
export let obs:Obstacle[] = [];

@Injectable({
  providedIn: 'root'
})
export class ObstacleService {

  playing:boolean = false;
  gameSpeed:number = 900;
  constructor() { }

  /**
    Actions
    1. Creating Obstable
    2. Removing off screeen obstacles
    3. Run left for every obstacle.
   */

  spawning(){
    start = this.playing = true;
    score[0] = 0;
    let spawnTime = setInterval(()=>{
      score[0]++;

      if(!start){
        clearInterval(spawnTime);
        console.log("Game Ended");
        this.playing = false;
        if(score[0]>score[1])
          score[1] = score[0];
        console.log("Score : "+score);
      }
      //create obstacle and add it to array
      let t = Math.floor(Math.random() * 5)
      if(t<=3){
        // type 1.
        let rh = Math.floor(Math.random() * (30 - 20) + 20);
        let rw = Math.floor(Math.random() * (30 - 20) + 20);
        obs.push(new Obstacle(rh,rw,-2,1));
      }
      else{
        // type 2
        let rw = Math.floor(Math.random() * (30 - 15) + 15);
        let rh = Math.floor(Math.random() * (40 - 30) + 30);
        let rb = Math.floor(Math.random() * (30 - 25) + 25);
        obs.push(new Obstacle(rh,rw,rb,2));
      }

    },this.gameSpeed);
  }

}

</code>```

`

This is my html is game screen
'

```<code><div class="container">
  <div class="game-screen">
    <div class="logo">
      <img class = "panicIcon" src="assets/panic.png" alt="">
      <h2> {{username}}, RUN AND DON'T STOP</h2>
      <button style="margin-left: auto;margin-top: 20px;" [routerLink]="['/']">Home</button>
    </div>
    <div class="rules">
      <p *ngIf="!ob.playing && score[0]==0">
        Press <img src="assets/enter.png" alt=""> "Enter" to play.
      </p>
      <p *ngIf="!ob.playing && score[0]>0">
        <img src="assets/dead.png" alt=""><br>Game Over You Got Caught
      </p>
      <div class="score">
        <p>Highest Score : <strong> {{score[1]}} </strong></p>
        <p>Score : <strong> {{score[0]}} </strong></p>
      </div>
    </div>
    <div class="game">
      <div class="screen">
        <div class="platform" #platform>

          <div *ngIf="start == false">
            <div class="initbox">
              <img class="angrybubble" src="assets/angrybubble.png">
              <div class="normanText">Run For Your Life</div>
            </div>
          </div>
          <div class="norman" #norman [style.bottom.px]="ns.bottom" [style.height.px]="normanDMS.height">
            <img class="normanimg" src="assets/norman.png">
          </div>
          <div class="dino" #dino [style.bottom.px]="ps.bottom" [style.height.px]="playerDms.height">
            <img class="playerimg" src="assets/player.png">
          </div>

          <div class="obs" *ngFor="let i of obs" [style.height.px]="i.height" [style.width.px]="i.width"
            [style.bottom.px]="i.bottom" [style.left.px]="i.left"></div>
            <ng-container [ngSwitch]="grade">
              <img *ngSwitchCase="'a'" class="gradeimg" src="assets/letterA.png" />
              <img *ngSwitchCase="'b'" class="gradeimg" src="assets/letterB.png" />
              <img *ngSwitchCase="'c'" class="gradeimg" src="assets/letterC.png" />
              <img *ngSwitchCase="'d'" class="gradeimg" src="assets/letterD.png" />
              <img *ngSwitchCase="'f'" class="gradeimg" src="assets/flamingF.png" />

            </ng-container>
        </div>
      </div>
    </div>
    <div class="keypad">
      <div class="keypad-btn">
        <button [disabled]="ob.playing" (click)="startGame()">Play</button>
        <div>
          <button [disabled]="!ob.playing" (click)="ps.jump()">Jump</button>
          <button [disabled]="!ob.playing" (click)="ps.duck()">Duck</button>
        </div>
      </div>
    </div>
  </div>
</div>
</code>```

'

Here is my gamescreen component just in case:

`

```<code>import { Component, ElementRef, HostListener, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Dimensions, PlayerService } from '../../services/player.service';
import { Obstacle, ObstacleService, score, start } from '../../services/obstacle.service';
import { obs,platCords,platDms, grade } from '../../services/obstacle.service';
import { playerCords,playerDms } from '../../services/player.service';
import { normanCords,normanDms, NormanService } from '../../services/norman.service';

@Component({
  selector: 'app-game-screen',
  templateUrl: './game-screen.component.html',
  styleUrls: ['./game-screen.component.scss']
})
export class GameScreenComponent implements OnInit{

  username:string | null = null;
  start:boolean = false;
  obs:Obstacle[]=obs;
  playerDms:Dimensions = playerDms;
  normanDMS:Dimensions = normanDms;
  score:number[] = score;
  grade:String = grade;

  @ViewChild('player') playerRef!: ElementRef;
  @ViewChild('norman') normanRef!: ElementRef;
  @ViewChild('platform') platformRef!: ElementRef;

  constructor(private route:ActivatedRoute,
              public ps:PlayerService,
              public ns: NormanService,
              public ob:ObstacleService,
              private router:Router) {

    // retrieving the data passed from route
    this.username = this.route.snapshot.paramMap?.get('user');
    if(this.username === null || this.username==""){
      this.router.navigate(['/']);
    }

  }

  // listening to the key down evnets
  @HostListener('document:keydown', ['$event'])
  handleKeyboardEvent(event: KeyboardEvent) {

    switch (event.key) {
      case ' ':
      case 'ArrowUp':
            if(this.ob.playing)
              this.ps.jump();
            break;

      case 'Enter':
            if(!this.ob.playing)
              this.startGame();
              this.start = true;
            break;

      case 'ArrowDown':{
              this.ps.duck();
            }
            break;
    }
  }

  ngOnInit(): void {
  }

  // start or restart the game on spacebar button.
  // start : clear all the obstacle and score and other stuff.
  startGame(){
    obs.splice(0,obs.length);
    this.ps.bottom = 0;
    playerDms.height = 30;
    playerCords.xoffset = 150;
    playerCords.yoffset = 328;
    this.ns.bottom = 0;
    normanDms.height = 60;
    normanCords.xoffset = 50;
    normanCords.yoffset = 600;

    let plCords = this.platformRef.nativeElement.getBoundingClientRect();
    platCords.xoffset = Math.floor(plCords.x + plCords.width);
    platCords.yoffset = Math.floor(plCords.y + plCords.height);

    platDms.width = Math.floor(plCords.width);
    platDms.height = Math.floor(plCords.height);

    this.ob.spawning();
  }

}

</code>```

`

I have tried doing if statements and changing variable "grade" but it seems to not apply and just keep displaying initial "F" even when condition is met.

Title: angular image change on condition

Body:
currently I am making a mini game with angular, and I already have most functionalities working. I am currently struggling to implement to change picture every time either (not have decided yet):

change from A->F whenever I have collision with an obstacle

change from F-> whenever I have scored more than a certain score (say 200-300 : D 300-400: C === and so on...)

I have tried a lot of things, and seems to not work.

I have used ngSwitchCase in the html.

This is my Obstacle service
`

import { Injectable } from '@angular/core';
import { Cords, Dimensions, playerCords,playerDms } from './player.service';

// global variables for use.
export let platCords:Cords = { xoffset:0, yoffset:0 };
export let platDms:Dimensions = { width:0, height:0 };
export let start:boolean = false;
export let score:number[] = [0,0];
export let grade:String;

export class Obstacle{
  height:number;
  width:number;
  left:number;
  bottom:number;
  type:number;
  xoffset:number = 0;
  yoffset:number = 0;
  life:number;

  constructor(h:number,w:number,b:number,t:number) {
    // init the members
    this.height = h;
    this.width = w;
    this.type = t;
    this.left = platDms.width;
    this.bottom = b;
    this.xoffset = this.left + w;
    this.yoffset = platCords.yoffset - h - b;
    this.life =4;

    // start the motion of this obstacle and check for collision
    this.moveLeft(t);
  }

  // moving the obstacle by subtracting the xoffset.
  moveLeft(t:number){

    let leftTimer = setInterval(()=>{
      // remove the obstacle from array when moves out of game screen and increase score
      if(this.left<=-(this.width)){
        clearInterval(leftTimer);
        score[0] += 10;
        obs.splice(0,1);
      }
      this.left -= 5;
      this.xoffset -= 5;

      // check for collision when its moving.
      if( (this.collision(t)) || !start){
        // stop the game
        clearInterval(leftTimer);
        start =  false;
      }

    },15);
  }

  // collision function for two floating and running obstacles.
  collision(t:number):boolean{

    let o_A:Cords,o_B:Cords,d_A:Cords,d_B:Cords;

    switch (t) {
      case 1:
        // for running obstacles.
        d_B = {xoffset:playerCords.xoffset+20, yoffset:playerCords.yoffset+playerDms.height};
        d_A = {xoffset:playerCords.xoffset, yoffset:playerCords.yoffset+playerDms.height};
        o_A = {xoffset:this.xoffset, yoffset:this.yoffset};
        o_B = {xoffset:this.xoffset-this.width, yoffset:this.yoffset};

        if((o_B.xoffset <= d_B.xoffset  && o_B.xoffset >= d_A.xoffset) && (d_B.yoffset > o_A.yoffset)){
          return true
        }
        break;

      case 2:
        // for floating obstacles.
        d_B = {xoffset:playerCords.xoffset+20, yoffset:playerCords.yoffset};
        d_A = {xoffset:playerCords.xoffset, yoffset:playerCords.yoffset};
        o_A = {xoffset:this.xoffset, yoffset:this.yoffset+this.height};
        o_B = {xoffset:this.xoffset-this.width, yoffset:this.yoffset+this.height};

        if((o_B.xoffset < d_B.xoffset && o_B.xoffset >= d_A.xoffset) && (o_A.yoffset > (d_A.yoffset))){
          return true
        }
        break;
  }
return false
  }

};

// having array of obstacles
export let obs:Obstacle[] = [];

@Injectable({
  providedIn: 'root'
})
export class ObstacleService {

  playing:boolean = false;
  gameSpeed:number = 900;
  constructor() { }

  /**
    Actions
    1. Creating Obstable
    2. Removing off screeen obstacles
    3. Run left for every obstacle.
   */

  spawning(){
    start = this.playing = true;
    score[0] = 0;
    let spawnTime = setInterval(()=>{
      score[0]++;

      if(!start){
        clearInterval(spawnTime);
        console.log("Game Ended");
        this.playing = false;
        if(score[0]>score[1])
          score[1] = score[0];
        console.log("Score : "+score);
      }
      //create obstacle and add it to array
      let t = Math.floor(Math.random() * 5)
      if(t<=3){
        // type 1.
        let rh = Math.floor(Math.random() * (30 - 20) + 20);
        let rw = Math.floor(Math.random() * (30 - 20) + 20);
        obs.push(new Obstacle(rh,rw,-2,1));
      }
      else{
        // type 2
        let rw = Math.floor(Math.random() * (30 - 15) + 15);
        let rh = Math.floor(Math.random() * (40 - 30) + 30);
        let rb = Math.floor(Math.random() * (30 - 25) + 25);
        obs.push(new Obstacle(rh,rw,rb,2));
      }

    },this.gameSpeed);
  }

}

`

This is my html is game screen
'

 {{username}}, RUN AND DON'T STOP

      <button style="margin-left: auto;margin-top: 20px;" [routerLink]="['/']">Home</button>

        Press  "Enter" to play.

0">

Game Over You Got Caught

Highest Score :  {{score[1]}}

Score :  {{score[0]}}

Run For Your Life

            <ng-container [ngSwitch]="grade">

            </ng-container>

        <button [disabled]="ob.playing" (click)="startGame()">Play</button>

          <button [disabled]="!ob.playing" (click)="ps.jump()">Jump</button>
          <button [disabled]="!ob.playing" (click)="ps.duck()">Duck</button>

'

Here is my gamescreen component just in case:

`

import { Component, ElementRef, HostListener, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Dimensions, PlayerService } from '../../services/player.service';
import { Obstacle, ObstacleService, score, start } from '../../services/obstacle.service';
import { obs,platCords,platDms, grade } from '../../services/obstacle.service';
import { playerCords,playerDms } from '../../services/player.service';
import { normanCords,normanDms, NormanService } from '../../services/norman.service';

@Component({
  selector: 'app-game-screen',
  templateUrl: './game-screen.component.html',
  styleUrls: ['./game-screen.component.scss']
})
export class GameScreenComponent implements OnInit{

  username:string | null = null;
  start:boolean = false;
  obs:Obstacle[]=obs;
  playerDms:Dimensions = playerDms;
  normanDMS:Dimensions = normanDms;
  score:number[] = score;
  grade:String = grade;

  @ViewChild('player') playerRef!: ElementRef;
  @ViewChild('norman') normanRef!: ElementRef;
  @ViewChild('platform') platformRef!: ElementRef;

  constructor(private route:ActivatedRoute,
              public ps:PlayerService,
              public ns: NormanService,
              public ob:ObstacleService,
              private router:Router) {

    // retrieving the data passed from route
    this.username = this.route.snapshot.paramMap?.get('user');
    if(this.username === null || this.username==""){
      this.router.navigate(['/']);
    }

  }

  // listening to the key down evnets
  @HostListener('document:keydown', ['$event'])
  handleKeyboardEvent(event: KeyboardEvent) {

    switch (event.key) {
      case ' ':
      case 'ArrowUp':
            if(this.ob.playing)
              this.ps.jump();
            break;

      case 'Enter':
            if(!this.ob.playing)
              this.startGame();
              this.start = true;
            break;

      case 'ArrowDown':{
              this.ps.duck();
            }
            break;
    }
  }

  ngOnInit(): void {
  }

  // start or restart the game on spacebar button.
  // start : clear all the obstacle and score and other stuff.
  startGame(){
    obs.splice(0,obs.length);
    this.ps.bottom = 0;
    playerDms.height = 30;
    playerCords.xoffset = 150;
    playerCords.yoffset = 328;
    this.ns.bottom = 0;
    normanDms.height = 60;
    normanCords.xoffset = 50;
    normanCords.yoffset = 600;

    let plCords = this.platformRef.nativeElement.getBoundingClientRect();
    platCords.xoffset = Math.floor(plCords.x + plCords.width);
    platCords.yoffset = Math.floor(plCords.y + plCords.height);

    platDms.width = Math.floor(plCords.width);
    platDms.height = Math.floor(plCords.height);

    this.ob.spawning();
  }

}

`

I have tried doing if statements and changing variable "grade" but it seems to not apply and just keep displaying initial "F" even when condition is met.


问:
How to deploy an eth2 rpc node to obtain transactions?
I want to deploy an eth rpc node and only need to obtain transaction data related to me. Do I only need to use Geth? Do I need to use Prysm?

The transaction data I get using this way:
https://github.com/Adamant-im/ETH-transactions-storage
This method is found from How to get Ethereum transaction list by address

I see some introduction here SYNCHRONIZATION MODES https://ethereum.org/en/developers/docs/nodes-and-clients/#sync-modes
There are several modes as follows：
Full sync / Fast sync /  Light sync / Snap sync / Optimistic sync / Checkpoint sync

After reading the description, I still don't know which one is the most suitable for only obtaining transaction data.

I'm a novice please give me an example of starting the functionality I need.


问:
ActionLink without named query variables
I have an ActionLink that produces this URL

```<code>@Html.ActionLink("Hardware Profile", "Profile", "Device", new { id = 2, tab = "hardware"}, null)

//Produces: http://localhost:7946/Device/Profile/2?tab=hardware
</code>```

But what I want it to produce is:

```<code>http://localhost:7946/Device/Profile/2/hardware
</code>```

I have the following route setup

```<code>routes.MapRoute(
                "DeviceProfile",
                "device/profile/{id}/{tab}",
                new { controller = "Device", action = "Profile", id = UrlParameter.Optional, tab = UrlParameter.Optional }
            );
</code>```

How do I achieve this?

ContentLicense: CC BY-SA 3.0

Body:
I have an ActionLink that produces this URL

@Html.ActionLink("Hardware Profile", "Profile", "Device", new { id = 2, tab = "hardware"}, null)

//Produces: http://localhost:7946/Device/Profile/2?tab=hardware

But what I want it to produce is:

http://localhost:7946/Device/Profile/2/hardware

I have the following route setup

routes.MapRoute(
                "DeviceProfile",
                "device/profile/{id}/{tab}",
                new { controller = "Device", action = "Profile", id = UrlParameter.Optional, tab = UrlParameter.Optional }
            );

How do I achieve this?


问:
Import directory which has same name of installed library
I want to import datasets.data_utils with below directory tree by from datasets import data_utils

However, datasets, which is different from below directory is already installed with pip install datasets, hence it occurs error saying No module named 'datasets.data_utils'

In this case, how can I import datasets from directory?
And is this available to install both installed datasets and datasets from directory without changing the directory name?

```<code>application
├── datasets
│   └── data_utils
│       └── file.py
└── app
    └── some_folder
        └── some_file.py
</code>```

Body:
I want to import datasets.data_utils with below directory tree by from datasets import data_utils

However, datasets, which is different from below directory is already installed with pip install datasets, hence it occurs error saying No module named 'datasets.data_utils'

In this case, how can I import datasets from directory?
And is this available to install both installed datasets and datasets from directory without changing the directory name?

application
├── datasets
│   └── data_utils
│       └── file.py
└── app
    └── some_folder
        └── some_file.py


问:
Not getting Apollo Client subscription data
I'm trying to get subscription data. The server gives the data if you look through the Explorer.

Client:

```<code>    const httpLink = createHttpLink({
        uri
    });

    const wsLink =
      typeof window !== "undefined"
        ? new GraphQLWsLink(
            createClient({
                url,
                on: {
                    connected: () => console.log("Connected client!"),
                    closed: () => console.log("Closed ws-connection!"),
                },
            })
        )
        : null;

    const splitLink =
      typeof window !== "undefined" && wsLink != null
        ? split(
            ({ query }) => {
                const def = getMainDefinition(query);
                return (
                    def.kind === "OperationDefinition" &&
                    def.operation === "subscription"
                );
            },
            wsLink,
            httpLink
        )
        : httpLink;

    const authLink = setContext((_, { headers }) => {
        const {token} = useTokenFromCookie();
        return {
            headers: {
                ...headers,
                authorization: token ? `Bearer ${token()}` : "",
            }
        }
    });

    const client = new ApolloClient({
        link: authLink.concat(splitLink),
        cache: new InMemoryCache({addTypename: false}),
        defaultOptions: {
            mutate: { errorPolicy: 'all' },
        },
    });

</code>```

gql:

```<code>    subscription ReadRegisterData($equipmentId: Int!, $addressRegistry: Int!) {
        readRegisterData(equipment_id: $equipmentId, address_registry: $addressRegistry) {
            equipment_id
            address_registry
            type_of
            data_from_controller
        }
    }

</code>```

Hook:

```<code>    const useSubscriptionReadRegisterData = (equipment_ip:number, address_registry: number) => {
    const { data, error, loading} = useSubscription(READ_REGISTER_DATA, {
        variables: {
            equipmentIp: equipment_ip,
            addressRegistry: address_registry
        }
    });

    console.log("data", data)

    const dataRegisterSubscription = (data) ? data.readRegisterData : null;

    return { dataRegisterSubscription, error, loading }
    }

    export default useSubscriptionReadRegisterData;

</code>```

In the console writes:
The connection is established, then immediately the connection is closed
WS connection status 101

When you start listening to a subscription through Explorer, on the server, when outputting data to the log, you can see that there is 1 Listener. When you run in the application, it does not show any Listener

Body:
I'm trying to get subscription data. The server gives the data if you look through the Explorer.

Client:

    const httpLink = createHttpLink({
        uri
    });

    const wsLink =
      typeof window !== "undefined"
        ? new GraphQLWsLink(
            createClient({
                url,
                on: {
                    connected: () => console.log("Connected client!"),
                    closed: () => console.log("Closed ws-connection!"),
                },
            })
        )
        : null;

    const splitLink =
      typeof window !== "undefined" && wsLink != null
        ? split(
            ({ query }) => {
                const def = getMainDefinition(query);
                return (
                    def.kind === "OperationDefinition" &&
                    def.operation === "subscription"
                );
            },
            wsLink,
            httpLink
        )
        : httpLink;

    const authLink = setContext((_, { headers }) => {
        const {token} = useTokenFromCookie();
        return {
            headers: {
                ...headers,
                authorization: token ? `Bearer ${token()}` : "",
            }
        }
    });

    const client = new ApolloClient({
        link: authLink.concat(splitLink),
        cache: new InMemoryCache({addTypename: false}),
        defaultOptions: {
            mutate: { errorPolicy: 'all' },
        },
    });

gql:

    subscription ReadRegisterData($equipmentId: Int!, $addressRegistry: Int!) {
        readRegisterData(equipment_id: $equipmentId, address_registry: $addressRegistry) {
            equipment_id
            address_registry
            type_of
            data_from_controller
        }
    }

Hook:

    const useSubscriptionReadRegisterData = (equipment_ip:number, address_registry: number) => {
    const { data, error, loading} = useSubscription(READ_REGISTER_DATA, {
        variables: {
            equipmentIp: equipment_ip,
            addressRegistry: address_registry
        }
    });

    console.log("data", data)

    const dataRegisterSubscription = (data) ? data.readRegisterData : null;

    return { dataRegisterSubscription, error, loading }
    }

    export default useSubscriptionReadRegisterData;

In the console writes:
The connection is established, then immediately the connection is closed
WS connection status 101

When you start listening to a subscription through Explorer, on the server, when outputting data to the log, you can see that there is 1 Listener. When you run in the application, it does not show any Listener


问:
In bash, sed will add "\r" in the end of line, which makes some problem in for loop
When I use sed to find some lines in a file, and then use for loop to do other things.
I find there's a "\r" in the end of sed reuslt. So I have to use slice like ${var: 0: -1} to remove the "\r".

I think it's not reasonable, and the high probability is my own reason. So, can you help me to find the problem?

My environment:

```<code>Kernel: 5.15.0-56-generic x86_64
bits: 64
Distro: Ubuntu 20.04.2 LTS (Focal Fossa)
shell: zsh
</code>```

My bash script:

The problem is in echo `count_items_in_segment $seg`

#!/bin/bash

input_file="my.config"

function get_all_segment
{
    echo `sed -n -E -e "/\[.*\]/p" $input_file | sed -E -e "s/\[|\]//g"`
}

function count_items_in_segment
{
    sed -n "/\[$1\]/,/\[.*\]/p" $input_file | sed -n -E -e "/^#/d" -e "/^\s+$/d" -e "/\[.*\]/d" -e "p" | wc -l
}

index=1
for seg in `get_all_segment`
do
    echo "$index: $seg"
    echo `count_items_in_segment $seg`
    ((index++))
done

printf `get_all_segment`
```
<p>my.config</p>
```[client]
database =  test
user =  test
password = pwd
default-character-set = utf8
host = 192.168.0.1
port = 3306
# comment

[client1]
database =  test
default-character-set = utf8
host = 192.168.0.1
port = 3306

[client2]
database =  test
user =  test
default-character-set = utf8
host = 192.168.0.1
port = 3306
[client3]
database =  test
```
<p>I have made sure there is a "\n" in the end of line.</p>
<p>Like this</p>
```cat my.config | sed -n -e "/\[.*\]/p" > test.txt
cat test.txt -A
```
<p>The result is</p>
<ul>
<li>In <code>cat -A</code> , <code>^M</code>  represents <code>\r</code></li>
</ul>
```[client]^M$
[client1]^M$
[client2]^M$
[client3]^M$
```

Body:
When I use sed to find some lines in a file, and then use for loop to do other things.
I find there's a "\r" in the end of sed reuslt. So I have to use slice like ${var: 0: -1} to remove the "\r".

I think it's not reasonable, and the high probability is my own reason. So, can you help me to find the problem?

My environment:

Kernel: 5.15.0-56-generic x86_64
bits: 64
Distro: Ubuntu 20.04.2 LTS (Focal Fossa)
shell: zsh

My bash script:

The problem is in echo `count_items_in_segment $seg`

#!/bin/bash

input_file="my.config"

function get_all_segment
{
    echo `sed -n -E -e "/\[.*\]/p" $input_file | sed -E -e "s/\[|\]//g"`
}

function count_items_in_segment
{
    sed -n "/\[$1\]/,/\[.*\]/p" $input_file | sed -n -E -e "/^#/d" -e "/^\s+$/d" -e "/\[.*\]/d" -e "p" | wc -l
}

index=1
for seg in `get_all_segment`
do
    echo "$index: $seg"
    echo `count_items_in_segment $seg`
    ((index++))
done

printf `get_all_segment`

my.config

[client]
database =  test
user =  test
password = pwd
default-character-set = utf8
host = 192.168.0.1
port = 3306
# comment

[client1]
database =  test
default-character-set = utf8
host = 192.168.0.1
port = 3306

[client2]
database =  test
user =  test
default-character-set = utf8
host = 192.168.0.1
port = 3306
[client3]
database =  test

I have made sure there is a "\n" in the end of line.

Like this

cat my.config | sed -n -e "/\[.*\]/p" > test.txt
cat test.txt -A

The result is

In cat -A , ^M  represents \r

[client]^M$
[client1]^M$
[client2]^M$
[client3]^M$


问:
which features are most important for skin diseases classification?
I am working on skin problem detection and am using a skin image dataset. I want to extract features from the images, but I can't understand which handcrafted features I should extract. I did some research on it. There are many features with LBP, HOG, HUE, and so on. There are numerous. Do I need to remove and concatenate those before passing it to an algorithm? I mean, if I'm exacting HOG and LBP, will I merge them both and then give them to the ML or DL algorithm?</p>


问:
Which context used when launching a coroutine in GlobalScope without further specification?
Is this a good way of loading image-resources? Or is it done wrong?

```<code>val url = "https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885_960_720.jpg"
imageView = findViewById(R.id.imageView)

var request = ImageRequest.Builder(applicationContext)
            .data(url)
            .memoryCachePolicy(CachePolicy.ENABLED)
            .error(com.google.android.material.R.drawable.mtrl_ic_error)
            .target(imageView)
            .build()
GlobalScope.launch {
            val disposable = imageLoader.execute(request)
}
</code>```

In which context will the coroutine be executed?

Which context will be used for assigning the loaded image-data to the UI-control? It isn't necessary using withContext(Dispatchers.IO)?

Body:
Is this a good way of loading image-resources? Or is it done wrong?

val url = "https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885_960_720.jpg"
imageView = findViewById(R.id.imageView)

var request = ImageRequest.Builder(applicationContext)
            .data(url)
            .memoryCachePolicy(CachePolicy.ENABLED)
            .error(com.google.android.material.R.drawable.mtrl_ic_error)
            .target(imageView)
            .build()
GlobalScope.launch {
            val disposable = imageLoader.execute(request)
}

In which context will the coroutine be executed?

Which context will be used for assigning the loaded image-data to the UI-control? It isn't necessary using withContext(Dispatchers.IO)?


问:
How to make the progress html 5 element <progress> responsive using CSS
How to make the progress html 5 element  responsive using CSS . I do not hv the provision to use bootstrap, as I am working on a legacy app.Do I use Media query?

I did try @media( max-width: 768px). But I could not get apt results.


问:
playonlinux has encountered a fatal error
I was trying to install microsoft office in ubunutu system using playonlinux, but when I try to install I'm getting this error! Please help me with this.

I tried to install microsoft office using playonlinux and the error occurs


问:
Finding the optimal directed graph of affected nodes with dependencies

I have a set of nodes that represent values that affect each other. I want to find the logical best path of cascading calculation so that each node is calculated only a single time after all of the ancestors that affect it are calculated.

In the graph example, this would be something like:

```<code>[A, B, F]
[A, C, H, G, D]
[A, E]
</code>```

Where paths like [A, H], and [A, C, G] are skipped since they have a better route with other required dependencies that need to calculated first.

I have tried a depth-first-search, but am having trouble thinking of a good data structure to represent this algorithm.

Any help would be greatly appreciated.

Body:
I have a set of nodes that represent values that affect each other. I want to find the logical best path of cascading calculation so that each node is calculated only a single time after all of the ancestors that affect it are calculated.

In the graph example, this would be something like:

[A, B, F]
[A, C, H, G, D]
[A, E]

Where paths like [A, H], and [A, C, G] are skipped since they have a better route with other required dependencies that need to calculated first.

I have tried a depth-first-search, but am having trouble thinking of a good data structure to represent this algorithm.

Any help would be greatly appreciated.


问:
create multiple data table with column C# windows form
i want to create multiple datatable and set some columns.

```<code>public partial class frmMain : frmTemplate
{
    DataTable dtguarantee = new DataTable();
    DataTable dtservice = new DataTable();
    DataTable dtsell = new DataTable();

    public frmMain()
    {
        InitializeComponent();
        dtguarantee.Columns.Add("Id");
        dtguarantee.Columns.Add("Serial");
        dtguarantee.Columns.Add("Guarantee");

        dtservice.Columns.Add("Id");
        dtservice.Columns.Add("Code");
        dtservice.Columns.Add("Fullname");
        dtservice.Columns.Add("Mobile");
        dtservice.Columns.Add("Address");
        dtservice.Columns.Add("ReciveDate");

        dtsell.Columns.Add("Id");
        dtsell.Columns.Add("SellName");
        dtsell.Columns.Add("SellProvince");
        dtsell.Columns.Add("SellCity");
        dtsell.Columns.Add("IsOurTeam");
        dtsell.Columns.Add("RequestType");
        dtsell.Columns.Add("Fullname");
        dtsell.Columns.Add("Mobile");
    }
}
</code>```

but when i run my code see this error.

System.Data.DuplicateNameException: 'A column named 'Id' already belongs to this DataTable.'

please help me immediately.

Body:
i want to create multiple datatable and set some columns.

public partial class frmMain : frmTemplate
{
    DataTable dtguarantee = new DataTable();
    DataTable dtservice = new DataTable();
    DataTable dtsell = new DataTable();

    public frmMain()
    {
        InitializeComponent();
        dtguarantee.Columns.Add("Id");
        dtguarantee.Columns.Add("Serial");
        dtguarantee.Columns.Add("Guarantee");

        dtservice.Columns.Add("Id");
        dtservice.Columns.Add("Code");
        dtservice.Columns.Add("Fullname");
        dtservice.Columns.Add("Mobile");
        dtservice.Columns.Add("Address");
        dtservice.Columns.Add("ReciveDate");

        dtsell.Columns.Add("Id");
        dtsell.Columns.Add("SellName");
        dtsell.Columns.Add("SellProvince");
        dtsell.Columns.Add("SellCity");
        dtsell.Columns.Add("IsOurTeam");
        dtsell.Columns.Add("RequestType");
        dtsell.Columns.Add("Fullname");
        dtsell.Columns.Add("Mobile");
    }
}

but when i run my code see this error.

System.Data.DuplicateNameException: 'A column named 'Id' already belongs to this DataTable.'

please help me immediately.


问:
What is the JS Event that is triggered on share action
I want to perform some action as soon as website's share button is clicked.
So is there any js event to which I can listen and get the details of Web share API.

I tried checking web share API MDN docs but could not find such listener.

https://developer.mozilla.org/en-US/docs/Web/API/Web_Share_API


问:
Is there a way to output a PowerShell log through Python?
I'm running a PowerShell script through Python that sends an email if a condition is met.
However, I'm running into a logical error when scheduling this program to run with Windows Scheduler. The program runs with no errors (it seems) but I never receive an email, and scheduler says "task run successfully".

However, if I run it manually through Python IDE, it runs well and I get an email. The Python script itself doesn't seem to be the problem, it seems to be more something going on with the PowerShell portion.

Is there a way to log in a text file or anything the PowerShell error code through Python so I can see what is happening in the background?

Below is my full code:

```<code>import glob, os, time, subprocess, sys
from datetime import datetime
import datetime
from plyer import notification

print("Program has started.")
print("Analyzing contents of folder. This will take some time")
os.system('mode con: cols=40 lines=10')

path_to_watch = '//...Alert/Testing Folder/'
print("Right before we make the list of files")

list_of_files = glob.glob('//...Alert/Testing Folder/*')

textfile = '...Alert/Logs/NoNewFiles_Log.txt'
textNewFiles = '//...Alert/Logs/NewFilesAdded_Log.txt'

latest_file = max(list_of_files, key=os.path.getctime)
m_time = os.path.getmtime(latest_file)
dt_m = datetime.datetime.fromtimestamp(m_time).strftime('%m-%d-%Y')
dt_t = datetime.datetime.fromtimestamp(m_time).strftime('%m-%d-%Y %H:%M:%S')

print(latest_file, dt_m)

today = datetime.date.today().strftime('%m-%d-%Y')

#todays date and time
now = datetime.datetime.now()
dt_string = now.strftime("%m/%d/%Y %H:%M:%S")

#this is where you send the emails and create the alert
if dt_m != today:
    print("No new files were added today")

    notification.notify(
    title = 'Alert! No New CDR Files',
    message = 'No new files were added today. Check text file log \\...Alert\Logs',
    app_icon = None,
    timeout = 20,
    )

    #writes to a log file
    f = open(textfile, "a")
    f.write("Program ran on "+dt_string+" and it was found that no new files were added. Last file update was on "+dt_t+"\n--------\n")
    f.close()

    #powershell path
    #This grabs a powershell script I made and sends an email out.
    ps = '//...Alert/Emailing_Users_Scripts/No_New_File_Email_Alert.ps1'
    p = subprocess.Popen(["powershell",ps], stdout=subprocess.PIPE)
    p_out, p_err = p.communicate()
    print(p_out)

elif dt_m == today:
    print("New files added today. Ending with: ", latest_file)

    #writes to a log file
    f = open(textNewFiles, "a")
    f.write("Program ran on "+dt_string+" and new files were added today. Ending with: "+latest_file+". Last file update was on "+dt_t+"\n--------\n")
    f.close()

    #powershell path
    #This grabs a powershell script I made and sends an email out.
    ps = '//...Alert/Emailing_Users_Scripts/Email_Alert.ps1'
    #p = subprocess.Popen(["powershell","-ExecutionPolicy","Unrestricted",ps], stdout=subprocess.PIPE)
    p = subprocess.Popen(["powershell", ps], stdout=subprocess.PIPE)
    p_out, p_err = p.communicate()
    print(p_out)
    print(p_err)
</code>```

Body:
I'm running a PowerShell script through Python that sends an email if a condition is met.
However, I'm running into a logical error when scheduling this program to run with Windows Scheduler. The program runs with no errors (it seems) but I never receive an email, and scheduler says "task run successfully".

However, if I run it manually through Python IDE, it runs well and I get an email. The Python script itself doesn't seem to be the problem, it seems to be more something going on with the PowerShell portion.

Is there a way to log in a text file or anything the PowerShell error code through Python so I can see what is happening in the background?

Below is my full code:

import glob, os, time, subprocess, sys
from datetime import datetime
import datetime
from plyer import notification

print("Program has started.")
print("Analyzing contents of folder. This will take some time")
os.system('mode con: cols=40 lines=10')

path_to_watch = '//...Alert/Testing Folder/'
print("Right before we make the list of files")

list_of_files = glob.glob('//...Alert/Testing Folder/*')

textfile = '...Alert/Logs/NoNewFiles_Log.txt'
textNewFiles = '//...Alert/Logs/NewFilesAdded_Log.txt'

latest_file = max(list_of_files, key=os.path.getctime)
m_time = os.path.getmtime(latest_file)
dt_m = datetime.datetime.fromtimestamp(m_time).strftime('%m-%d-%Y')
dt_t = datetime.datetime.fromtimestamp(m_time).strftime('%m-%d-%Y %H:%M:%S')

print(latest_file, dt_m)

today = datetime.date.today().strftime('%m-%d-%Y')

#todays date and time
now = datetime.datetime.now()
dt_string = now.strftime("%m/%d/%Y %H:%M:%S")

#this is where you send the emails and create the alert
if dt_m != today:
    print("No new files were added today")

    notification.notify(
    title = 'Alert! No New CDR Files',
    message = 'No new files were added today. Check text file log \\...Alert\Logs',
    app_icon = None,
    timeout = 20,
    )

    #writes to a log file
    f = open(textfile, "a")
    f.write("Program ran on "+dt_string+" and it was found that no new files were added. Last file update was on "+dt_t+"\n--------\n")
    f.close()

    #powershell path
    #This grabs a powershell script I made and sends an email out.
    ps = '//...Alert/Emailing_Users_Scripts/No_New_File_Email_Alert.ps1'
    p = subprocess.Popen(["powershell",ps], stdout=subprocess.PIPE)
    p_out, p_err = p.communicate()
    print(p_out)

elif dt_m == today:
    print("New files added today. Ending with: ", latest_file)

    #writes to a log file
    f = open(textNewFiles, "a")
    f.write("Program ran on "+dt_string+" and new files were added today. Ending with: "+latest_file+". Last file update was on "+dt_t+"\n--------\n")
    f.close()

    #powershell path
    #This grabs a powershell script I made and sends an email out.
    ps = '//...Alert/Emailing_Users_Scripts/Email_Alert.ps1'
    #p = subprocess.Popen(["powershell","-ExecutionPolicy","Unrestricted",ps], stdout=subprocess.PIPE)
    p = subprocess.Popen(["powershell", ps], stdout=subprocess.PIPE)
    p_out, p_err = p.communicate()
    print(p_out)
    print(p_err)


问:
Can't Spread Array in React (not iterable)
I am doing a fetch and trying to add the contents of a new array to an existing array that is held in state (in a useContext and imported into my component)

```<code>const [songNames, setSongNames] = useState([])

.then((data) => {

let newSongsToAdd = []

data.data.forEach((song) => {
    ... some logic ...
    newSongsToAdd.push(song)
    }

setSongNames(prevArray => [...prevArray, ...newSongNameArray])
}
</code>```

I get the error "Uncaught TypeError: prevArray is not iterable". I think I've tried every which way, but I can't seem to figure out why the songNames array I have in state is not iterable.

The function otherwise works (I can replace the state, just not spread the new data into it).

Any ideas? Full error below, thanks!

```<code>Uncaught TypeError: prevArray is not iterable
    at HomePage.js:145:1
    at basicStateReducer (react-dom.development.js:16540:1)
    at updateReducer (react-dom.development.js:16664:1)
    at updateState (react-dom.development.js:17004:1)
    at Object.useState (react-dom.development.js:17915:1)
    at useState (react.development.js:1622:1)
    at Provider (Context.js:19:1)
    at renderWithHooks (react-dom.development.js:16305:1)
    at updateFunctionComponent (react-dom.development.js:19588:1)
    at beginWork (react-dom.development.js:21601:1)
</code>```

Body:
I am doing a fetch and trying to add the contents of a new array to an existing array that is held in state (in a useContext and imported into my component)

const [songNames, setSongNames] = useState([])

.then((data) => {

let newSongsToAdd = []

data.data.forEach((song) => {
    ... some logic ...
    newSongsToAdd.push(song)
    }

setSongNames(prevArray => [...prevArray, ...newSongNameArray])
}

I get the error "Uncaught TypeError: prevArray is not iterable". I think I've tried every which way, but I can't seem to figure out why the songNames array I have in state is not iterable.

The function otherwise works (I can replace the state, just not spread the new data into it).

Any ideas? Full error below, thanks!

Uncaught TypeError: prevArray is not iterable
    at HomePage.js:145:1
    at basicStateReducer (react-dom.development.js:16540:1)
    at updateReducer (react-dom.development.js:16664:1)
    at updateState (react-dom.development.js:17004:1)
    at Object.useState (react-dom.development.js:17915:1)
    at useState (react.development.js:1622:1)
    at Provider (Context.js:19:1)
    at renderWithHooks (react-dom.development.js:16305:1)
    at updateFunctionComponent (react-dom.development.js:19588:1)
    at beginWork (react-dom.development.js:21601:1)


问:
Python client socket not receiving data from TCP server
I'm trying to build a fake money transfer program with sockets in python. Everything is working perfectly except the "name" and "amount" transfer from the server to the client. When someone clicks receive on the client interface, the server is supposed to send the client the name of the person who sent the money and the amount. The problem is that the client is not receiving the data sent from the server. When you click the "receive" button, the interface just freezes then crashes. From the debugging I've done, I'm pretty sure the server is sending the name and amount, but the client is not receiving it. I honestly have no idea why it's not working. Everything I did should work like it has numerous other times throughout the program. This one has got me stumped.

Any help would be great. Thanks!

[CODE]

Server.py:

```<code>import socket
import threading

HOST = '192.168.1.6'
PORT = 9090

def client_fun(client, addr):
    global transfers
    print(f"{addr} just connected!")
    connected = True
    while connected:

    msg = client.recv(1024).decode('utf-8')

    if msg == "RECEIVE_CHECK":
        usrn = client.recv(1024).decode('utf-8')
        transfers_ = open("transfers.txt", "r")
        transfers = str(transfers_.readlines())
        transfers = transfers.split("+")
        transfers[0] = transfers[0].replace("[", "")
        transfers[0] = transfers[0].replace("'", "")
        transfers.pop()

        names = []
        for tran in transfers:
            tran_ = tran.split("-")
            i = 0
            while i <= len(tran):
                names.append(tran_[2])
                i += 1
        if usrn in names:
            client.send("OK".encode('utf-8'))
        else:
            client.send("NO".encode('utf-8'))

        if usrn in names:
            for tran in transfers:
                tran_ = tran.split("-")
                if usrn == tran_[2]:
                    name = str(tran_[0])
                    amount = str(tran_[1])
                    client.send(name.encode('utf-8'))
                    client.send(amount.encode('utf-8'))
                    account_file = usrn + "_" + "account.txt"
                    account_r = open(account_file, "r")
                    account_r = str(account_r.readlines())
                    account_r = account_r.replace(']', '')
                    account_r = account_r.replace('[', '')
                    account_r = account_r.replace("'", "")
                    try:
                        account_r = int(account_r)
                    except:
                        print("Can't Convert Str to Int!")
                        break
                    new_amount = int(tran_[1]) + account_r
                    account_w = open(account_file, "w")
                    account_w.write(str(new_amount))
                    account_w.close()
                    tran = tran + "+"
                    transFers_ = open("transfers.txt", "r")
                    transFers = str(transFers_.readlines())
                    transFers_.close()
                    transFers = transFers.replace(']', '')
                    transFers = transFers.replace('[', '')
                    transFers = transFers.replace("'", "")
                    transFers = transFers.replace(tran, '')
                    transFers_ = open("transfers.txt", 'w+')
                    transFers_.write(transFers)
                    transFers_.close()
                    print("Excepted!")
        else:
            print("Nothing Here!")

server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((HOST, PORT))

server.listen()
print("Server is listening!")

while True:
    c_socket, address = server.accept()
    thread = threading.Thread(target=client_fun, args=(c_socket, address))
    thread.start()
</code>```

Client.py:

```<code>import socket

HOST = '192.168.1.6'
PORT = 9090
socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

def receive(usrn):
    socket.send("RECEIVE_CHECK".encode('utf-8'))
    socket.send(usrn.encode('utf-8'))

    c = socket.recv(1024).decode('utf-8')
    if c == "OK":
        try:
            print("Trying to except....")
            name = socket.recv(2000).decode('utf-8')
            amount = socket.recv(2000).decode('utf-8')
            print("Excepted!")
            messagebox.showwarning("Continue?", f"{name} has sent you ${amount}", icon="question")
            messagebox.showwarning("Info", f"${amount} has just been transferred to your account!", icon="info")
            menu(usrn)
        except:
            print("Error!")
    else:
        print("Nothing Today!")
</code>```

Body:
I'm trying to build a fake money transfer program with sockets in python. Everything is working perfectly except the "name" and "amount" transfer from the server to the client. When someone clicks receive on the client interface, the server is supposed to send the client the name of the person who sent the money and the amount. The problem is that the client is not receiving the data sent from the server. When you click the "receive" button, the interface just freezes then crashes. From the debugging I've done, I'm pretty sure the server is sending the name and amount, but the client is not receiving it. I honestly have no idea why it's not working. Everything I did should work like it has numerous other times throughout the program. This one has got me stumped.

Any help would be great. Thanks!

[CODE]

Server.py:

import socket
import threading

HOST = '192.168.1.6'
PORT = 9090

def client_fun(client, addr):
    global transfers
    print(f"{addr} just connected!")
    connected = True
    while connected:

    msg = client.recv(1024).decode('utf-8')

    if msg == "RECEIVE_CHECK":
        usrn = client.recv(1024).decode('utf-8')
        transfers_ = open("transfers.txt", "r")
        transfers = str(transfers_.readlines())
        transfers = transfers.split("+")
        transfers[0] = transfers[0].replace("[", "")
        transfers[0] = transfers[0].replace("'", "")
        transfers.pop()

        names = []
        for tran in transfers:
            tran_ = tran.split("-")
            i = 0
            while i <= len(tran):
                names.append(tran_[2])
                i += 1
        if usrn in names:
            client.send("OK".encode('utf-8'))
        else:
            client.send("NO".encode('utf-8'))

        if usrn in names:
            for tran in transfers:
                tran_ = tran.split("-")
                if usrn == tran_[2]:
                    name = str(tran_[0])
                    amount = str(tran_[1])
                    client.send(name.encode('utf-8'))
                    client.send(amount.encode('utf-8'))
                    account_file = usrn + "_" + "account.txt"
                    account_r = open(account_file, "r")
                    account_r = str(account_r.readlines())
                    account_r = account_r.replace(']', '')
                    account_r = account_r.replace('[', '')
                    account_r = account_r.replace("'", "")
                    try:
                        account_r = int(account_r)
                    except:
                        print("Can't Convert Str to Int!")
                        break
                    new_amount = int(tran_[1]) + account_r
                    account_w = open(account_file, "w")
                    account_w.write(str(new_amount))
                    account_w.close()
                    tran = tran + "+"
                    transFers_ = open("transfers.txt", "r")
                    transFers = str(transFers_.readlines())
                    transFers_.close()
                    transFers = transFers.replace(']', '')
                    transFers = transFers.replace('[', '')
                    transFers = transFers.replace("'", "")
                    transFers = transFers.replace(tran, '')
                    transFers_ = open("transfers.txt", 'w+')
                    transFers_.write(transFers)
                    transFers_.close()
                    print("Excepted!")
        else:
            print("Nothing Here!")

server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((HOST, PORT))

server.listen()
print("Server is listening!")

while True:
    c_socket, address = server.accept()
    thread = threading.Thread(target=client_fun, args=(c_socket, address))
    thread.start()

Client.py:

import socket

HOST = '192.168.1.6'
PORT = 9090
socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

def receive(usrn):
    socket.send("RECEIVE_CHECK".encode('utf-8'))
    socket.send(usrn.encode('utf-8'))

    c = socket.recv(1024).decode('utf-8')
    if c == "OK":
        try:
            print("Trying to except....")
            name = socket.recv(2000).decode('utf-8')
            amount = socket.recv(2000).decode('utf-8')
            print("Excepted!")
            messagebox.showwarning("Continue?", f"{name} has sent you ${amount}", icon="question")
            messagebox.showwarning("Info", f"${amount} has just been transferred to your account!", icon="info")
            menu(usrn)
        except:
            print("Error!")
    else:
        print("Nothing Today!")


问:
error in mqtt connection mqtt_new.py [Errno 98] Address already in use
error in mqtt connection mqtt_new.py [Errno 98] Address already in use

When I run command mqtt to run server I am getting an error "Error:address already in use". Why am I getting this error? How can I resolve this?
ENV Code - environment config

```<code>"port":19077,
"broker":"192.168.1.210"
</code>```

mqtt_new.py Main Code

```<code>import logging
import paho.mqtt.client as mqtt
import config.config as env
from core_service.service.mqtt_service.mqtt_subscribe import subscribeTopic
message = 'ON'
def on_connect(self, mosq, obj, rc):
    self.subscribe(env.addCatalogItemElastic, 0)
    self.subscribe(env.updateCatalogRecord, 0)
    self.subscribe(env.updateCatalogCartQtyElastic, 0)
    self.subscribe(env.updateCatalogOrderQtyElastic, 0)
    print("rc: " + str(rc))
def on_message(mosq, obj, msg):
    global message
    print(msg.topic + " " + str(msg.qos) + " " + str(msg.payload))
    # message = msg.payload
    subscribeTopic(msg)
    # mqttc.publish(env.updateCatalogElasticSyncStatus,msg.payload);
# def on_publish(mosq, obj, mid):
#     print("mid: " + str(mid))
def on_subscribe(mosq, obj, mid, granted_qos):
    print("Subscribed: " + str(mid) + " " + str(granted_qos))
def on_log(mosq, obj, level, string):
    print(string)
# def publishMqtt(msg:dict):
#     mqttc.publish(env.updateCatalogElasticSyncStatus,msg.payload);
mqttc = mqtt.Client()
# Assign event callbacks
mqttc.on_message = on_message
mqttc.on_connect = on_connect
# mqttc.on_publish = on_publish
mqttc.on_subscribe = on_subscribe
# Connect
try:
    mqttc.connect(env.broker,env.mqtt_port)
except Exception as e:
    print("error in mqtt connection mqtt_new.py",e)
    logging.exception("Error occurred while printing ")
    mqttc.connect_fail_callback()
try:
    # Continue the network loop
    mqttc.loop_forever()
except Exception as e:
    print("error in mqtt loop mqtt_new.py",e)
</code>```

Body:
error in mqtt connection mqtt_new.py [Errno 98] Address already in use

When I run command mqtt to run server I am getting an error "Error:address already in use". Why am I getting this error? How can I resolve this?
ENV Code - environment config

"port":19077,
"broker":"192.168.1.210"

mqtt_new.py Main Code

import logging
import paho.mqtt.client as mqtt
import config.config as env
from core_service.service.mqtt_service.mqtt_subscribe import subscribeTopic
message = 'ON'
def on_connect(self, mosq, obj, rc):
    self.subscribe(env.addCatalogItemElastic, 0)
    self.subscribe(env.updateCatalogRecord, 0)
    self.subscribe(env.updateCatalogCartQtyElastic, 0)
    self.subscribe(env.updateCatalogOrderQtyElastic, 0)
    print("rc: " + str(rc))
def on_message(mosq, obj, msg):
    global message
    print(msg.topic + " " + str(msg.qos) + " " + str(msg.payload))
    # message = msg.payload
    subscribeTopic(msg)
    # mqttc.publish(env.updateCatalogElasticSyncStatus,msg.payload);
# def on_publish(mosq, obj, mid):
#     print("mid: " + str(mid))
def on_subscribe(mosq, obj, mid, granted_qos):
    print("Subscribed: " + str(mid) + " " + str(granted_qos))
def on_log(mosq, obj, level, string):
    print(string)
# def publishMqtt(msg:dict):
#     mqttc.publish(env.updateCatalogElasticSyncStatus,msg.payload);
mqttc = mqtt.Client()
# Assign event callbacks
mqttc.on_message = on_message
mqttc.on_connect = on_connect
# mqttc.on_publish = on_publish
mqttc.on_subscribe = on_subscribe
# Connect
try:
    mqttc.connect(env.broker,env.mqtt_port)
except Exception as e:
    print("error in mqtt connection mqtt_new.py",e)
    logging.exception("Error occurred while printing ")
    mqttc.connect_fail_callback()
try:
    # Continue the network loop
    mqttc.loop_forever()
except Exception as e:
    print("error in mqtt loop mqtt_new.py",e)


问:
Send vs SendInput Problems
I've tried many variations of a script whose purpose is to send rapid clicks when either mouse button is held down. In my own script I have both left and right click loops but here is the simplest version I tried:

```<code>SetKeyDelay, -1
$RButton::
While GetKeyState("RButton", "P") {
Send, {RButton}
}
Returm
</code>```

When using this, I get about 20 clicks per second. However, I would like to achieve 30 or so. What I infer from this, is that the send command has a 50 ms delay (1000ms/20 clicks). I would also like to use the {Blind} modifier but that slows it down even more (to about 16 clicks per second).

The obvious answer I think is to use SendInput, and I was able to achieve desired clicks per second using SendInput. However, it came with undesirable side effects. Namely, the key buffering is very unwanted in my use case. In addition, no matter if I used a while loop with GetKeyState or a Button up configuration with SetTimer and Gosub, the right click and left click loops would get stuck occasionally (interference?). The loops getting stuck was not a problem with Send as I'm able to put the loops for each mouse button in separate scripts. When I do that with SendInput, it lowers the clicks per second drastically.

I have also tried SendPlay and SendEvent to no success. Also, I tried using V2 although most of my testing has been in 1.1.35.00.

I don't think it is CPU or memory related as SendInput is able to hit the clicks per second goal of 30 and both CPU and memory stay at about 60%. I could be wrong here though. I also don't think the application I am using is restricting the click rate for the same reason of it being able to register 30 with SendInput.

I greatly appreciate anyone who takes the time to read this! Happy Holidays!

Expecting about 30 clicks per second with both right and left mouse buttons being held down.

I've tried:
Send, SendInput, SendPlay, SendEvent
#MaxThreadsPerHotkey, 2 #SingleInstance Force
SetKeyDelay, -1 SetBatchLines, -1
While loop with GetKeyState as condition and also tried SetTimer and Gosub with individual functions
V2 and 1.1.35.00.

Resulted always in a maximum of 16 clicks per second with Send
With SendInput, user keystrokes sent while clicking were always buffered, which was undesired. As well as the loops getting stuck occassionally

Title: Send vs SendInput Problems

Body:
I've tried many variations of a script whose purpose is to send rapid clicks when either mouse button is held down. In my own script I have both left and right click loops but here is the simplest version I tried:

SetKeyDelay, -1
$RButton::
While GetKeyState("RButton", "P") {
Send, {RButton}
}
Returm

When using this, I get about 20 clicks per second. However, I would like to achieve 30 or so. What I infer from this, is that the send command has a 50 ms delay (1000ms/20 clicks). I would also like to use the {Blind} modifier but that slows it down even more (to about 16 clicks per second).

The obvious answer I think is to use SendInput, and I was able to achieve desired clicks per second using SendInput. However, it came with undesirable side effects. Namely, the key buffering is very unwanted in my use case. In addition, no matter if I used a while loop with GetKeyState or a Button up configuration with SetTimer and Gosub, the right click and left click loops would get stuck occasionally (interference?). The loops getting stuck was not a problem with Send as I'm able to put the loops for each mouse button in separate scripts. When I do that with SendInput, it lowers the clicks per second drastically.

I have also tried SendPlay and SendEvent to no success. Also, I tried using V2 although most of my testing has been in 1.1.35.00.

I don't think it is CPU or memory related as SendInput is able to hit the clicks per second goal of 30 and both CPU and memory stay at about 60%. I could be wrong here though. I also don't think the application I am using is restricting the click rate for the same reason of it being able to register 30 with SendInput.

I greatly appreciate anyone who takes the time to read this! Happy Holidays!

Expecting about 30 clicks per second with both right and left mouse buttons being held down.

I've tried:
Send, SendInput, SendPlay, SendEvent
#MaxThreadsPerHotkey, 2 #SingleInstance Force
SetKeyDelay, -1 SetBatchLines, -1
While loop with GetKeyState as condition and also tried SetTimer and Gosub with individual functions
V2 and 1.1.35.00.

Resulted always in a maximum of 16 clicks per second with Send
With SendInput, user keystrokes sent while clicking were always buffered, which was undesired. As well as the loops getting stuck occassionally


问:
How can I solve aws EC2 instance check passed problem?

EC2 instance not working i.e. 1 of 2 check is not passed. In which end the problem occurred and what is the solution?


问:
pgUp and pgDown buttons are disabled when adding the ListboxComponent . property Autocomplete
current version: "@mui/material": "5.4.1"
problems encountered: after adding the ListboxComponent property the pgup and pgdown buttons are unusable

Code Autocomplete
add ListboxComponent for Autocomplete

Code listbox
Code listbox

description video
Link: https://drive.google.com/file/d/1cYxZoDbY8eIGIaR5ibBmlfVtCgNBMwNo/view?usp=sharing

I wish that the pgup and pgdn keys and the up or down keys are all working properly

thanks everyone


问:
Is it possible to stop MSSQL Connection?
I am currently developing an application that will connect to a SQL server. Is it possible to stop or abort the connection after failing for the first time of attempting to Open the connection or 15 seconds after the Connection.Open() sent?

Sample code below:

```<code>     Dim conn As New SqlClient.SqlConnection
     conn.ConnectionString = connstr
         Try
            conn.Open()
'Drop or abort the connection after 15 seconds or after failing the first attempt to connect
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
</code>```

Body:
I am currently developing an application that will connect to a SQL server. Is it possible to stop or abort the connection after failing for the first time of attempting to Open the connection or 15 seconds after the Connection.Open() sent?

Sample code below:

     Dim conn As New SqlClient.SqlConnection
     conn.ConnectionString = connstr
         Try
            conn.Open()
'Drop or abort the connection after 15 seconds or after failing the first attempt to connect
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try


问:
How to use prefix to reference to a folder in a S3 bucket in CDK?
I am trying to have a metric using CDK that tracks number of http uploads to a folder in a s3 bucket. The folder is a nested folder.  It is named "folderB" and resides in "folderA".  In other words, it has "folderA/folderB/" structure.

In CDK, using BucketMetrics, the prefix should be "folderA/folderB".  I keep running into an error says the XML is malformed.  I understand in S3, everything is an object and flat; how do I use prefix to present the nested folder in the s3 bucket?


问:
Building An OIDC Identity Provider Using Spring Authorization Server Or Apache Shiro
We are building an OIDC Identity Provider in java which can be integrated into Keycloak and perform authentication .We are looking at Spring Authorization server or Apache Shiro as our options to build the custom service in java and register it as an IDP in Keycloak.Any help /documentation/leads welcome.

We have looked at any implementation logic within Spring Authorization Server for the integration with keycloak as an authentication mechanism,but not quite sure if its the right approach


问:
rails 7 project won't run in wsl2 but runs in m1 mac setup (ruby 3.1.2 / rails 7)
I'm not sure why it would run without errors with the same gemfile and ruby version/rails version, any ideas?

The only thing different would be the platform, arm vs x86


问:
Using Realm Sync with Atlas creates _realm_sync_ db that consumes lots of space
I am working on a mobile app with realm offline sync with Atlas.

While testing, I observed in MongoDb compass, one db is created automatically named _realm_sync_6380667787c967bc7e39bd68 which I didn't create. It's size is also keep on increasing when data is added to other dbs. I tried to drop it, but MongoDB compass didn't allow me to drop -> Msg "user is not allowed to do action [dropDatabase] on [__realm_sync_6380667787c967bc7e39bd68.]"

Can I delete this db, since I don't need it. It's size is much much larger than that of my actual db. Will it affect anywhere if I delete it?


问:
How to share command line arguments between two python scipts
I have two python scripts - script1.py and script2.py

script1.py takes a command line argument and script2.py takes none.

Now i want to use the command line argument passed to script1.py in script2.py.

I dont want to run script2 from script1.

script1.py

```<code>import sys
var1 = sys.argv[1]
print(var1)
</code>```

script2.py

```<code>from script1.py import var1
var2 = var1
print(var2)
</code>```

But this doesnt work  as the variable doesnt persist once the script1.py is done

I want to do something like accessing the var1 of script1.py in script2.py
I can write it to a file from script1 and then access it from script2 which doesnt seem a great approach.

Is there any meaningful way to share command line arguments between multiple python scripts.

Body:
I have two python scripts - script1.py and script2.py

script1.py takes a command line argument and script2.py takes none.

Now i want to use the command line argument passed to script1.py in script2.py.

I dont want to run script2 from script1.

script1.py

import sys
var1 = sys.argv[1]
print(var1)

script2.py

from script1.py import var1
var2 = var1
print(var2)

But this doesnt work  as the variable doesnt persist once the script1.py is done

I want to do something like accessing the var1 of script1.py in script2.py
I can write it to a file from script1 and then access it from script2 which doesnt seem a great approach.

Is there any meaningful way to share command line arguments between multiple python scripts.


问:
why is will_paginate throwing an expected 1 given 2 error?
I have an issue where legacy code for pagination was implemented prior to me being hiring failed randomly today. I am running a heroku app with rails and using will_paginate for pagination. In my controller I have

`

```<code>def index
    @publications = Publication.paginate(page: params[:page], per_page: 11).order('sort_date DESC')
  end
</code>```

`

in my view i have

`

```<code><div class="container">
     <%= will_paginate @publications %>
</div>
</code>```

`

It throws the following error(which is leading to a 500 error in turn): wrong number of arguments(given 2, expected 1) for will_paginate.

change the .paginate function parameters to be(:page => params[:page], :per_page => 11) as mentioned in the will_paginate documentation it still throws the same error. if i delete the per_page option it also still throws the same given 2 expected 1 error. i've also updated will-paginate and still get the same error

Body:
I have an issue where legacy code for pagination was implemented prior to me being hiring failed randomly today. I am running a heroku app with rails and using will_paginate for pagination. In my controller I have

`

def index
    @publications = Publication.paginate(page: params[:page], per_page: 11).order('sort_date DESC')
  end

`

in my view i have

`

     <%= will_paginate @publications %>

`

It throws the following error(which is leading to a 500 error in turn): wrong number of arguments(given 2, expected 1) for will_paginate.

change the .paginate function parameters to be(:page => params[:page], :per_page => 11) as mentioned in the will_paginate documentation it still throws the same error. if i delete the per_page option it also still throws the same given 2 expected 1 error. i've also updated will-paginate and still get the same error


问:
Azure Pipeline: Variable expansion in depends statement
I struggle with setting up a condition statement to run a specific task only on main and when there is a CI build.

While trying without success, I came across this statement which is an AND of two exactly the same statements:

```<code>condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), contains(variables['build.sourceBranch'], 'refs/heads/main'))
</code>```

When running it on my branch, I see this result:

```<code>Evaluating: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), contains(variables['build.sourceBranch'], 'refs/heads/main'))
Expanded: and(contains('refs/heads/task/mybranch', 'refs/heads/main'), contains(variables['build.sourceBranch'], 'refs/heads/main'))
Result: False
</code>```

Why is the second variable not expanded?

To reach my aim of that condition, I'd like to run something like this, but here the expansion does not work as well:

```<code>and(endsWith(variables['build.sourceBranch'], 'refs/heads/main'), endsWith(variables['build.reason'], 'CI'))
</code>```

What am I doing wrong?
Thanks in advance

Body:
I struggle with setting up a condition statement to run a specific task only on main and when there is a CI build.

While trying without success, I came across this statement which is an AND of two exactly the same statements:

condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), contains(variables['build.sourceBranch'], 'refs/heads/main'))

When running it on my branch, I see this result:

Evaluating: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), contains(variables['build.sourceBranch'], 'refs/heads/main'))
Expanded: and(contains('refs/heads/task/mybranch', 'refs/heads/main'), contains(variables['build.sourceBranch'], 'refs/heads/main'))
Result: False

Why is the second variable not expanded?

To reach my aim of that condition, I'd like to run something like this, but here the expansion does not work as well:

and(endsWith(variables['build.sourceBranch'], 'refs/heads/main'), endsWith(variables['build.reason'], 'CI'))

What am I doing wrong?
Thanks in advance


问:
How to add histogram tool in visual studio windows application?
If the histogram tool is not visible inside Visual Studio 2019 windows application , how to add it?

I want to use the histogram tool but it is not visible...


问:
How to disconnect simple-peer connnection with socket.io in js
I have video connection with socket.io and simple-peer and I don't disconnect conference.
I try disconnect() function but get error like undefined method  back is laravel


问:
contenteditable/textarea editor live change sync to server
I am working on a app that will allow user to write/read/edit/save big files in contenteditable/textarea and I also want to provide auto save functionality after some interval.

Problem I am facing, when I do auto save I want to send only changed content back to server rather than sending whole file again, the interval will be 3 to 5 seconds.

Till now I have found 1 solution quill-delta but it only works with quill editor. is there any better way I can achive this ? Any help would be appreciated, thank you

quill editor

quill delta