问:
Is it OK to run a Ktor server from an Android activity (instead of from command prompt)?
I'm new to Ktor so please bear with me if this question seems a bit silly. I have tried many approaches that I was able to have googled but none of them worked for me.

My goal was to launch a normal activity and host an HTTP server in it with Ktor and let it be able to respond to client requests. When I started a Ktor server from a command line like below it did work and I could see the response from a local browser when I started the emulator:

```<code>private suspend fun startServer() = withContext(Dispatchers.IO) {
    embeddedServer(Netty, port = 8080, host = "0.0.0.0", module = Application::module)
        .start(wait = true)
}

suspend fun main() {
    startServer()
    readln()
}
</code>```

However when I attempted to start a Ktor server from an activity, I was never able to get a response:

```<code>override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    CoroutineScope(Dispatchers.IO).launch {
        embeddedServer(Netty, 8080, host = "127.0.0.1") {
            install(ContentNegotiation) {
                gson {}
            }
            routing {
                get("/") {
                    call.respond(mapOf("message" to "Hello world"))
                }
            }
        }.start(wait = true)
    }
</code>```

In my AndroidManifest I did have the following line in place:

```<code><uses-permission android:name="android.permission.INTERNET"/>
</code>```

But when I　attempted to access http://127.0.0.1:8080/ from the host PC, ERR_CONNECTION_REFUSED was the error I received.

These were the messages in the logcat:

```<code>I  java.io.FileNotFoundException: /proc/sys/net/core/somaxconn: open failed: EACCES (Permission denied)
I   at libcore.io.IoBridge.open(IoBridge.java:492)
I   at java.io.FileInputStream.<init>(FileInputStream.java:160)
I   at java.io.FileReader.<init>(FileReader.java:72)
I   at io.netty.util.NetUtil$SoMaxConnAction.run(NetUtil.java:170)
W  type=1400 audit(0.0:818): avc: denied { read } for name="somaxconn" dev="proc" ino=29801 scontext=u:r:untrusted_app:s0:c123,c256,c512,c768 tcontext=u:object_r:proc_net:s0 tclass=file permissive=0 app=com.example.androidktorserverdemo
I   at io.netty.util.NetUtil$SoMaxConnAction.run(NetUtil.java:155)
I   at java.security.AccessController.doPrivileged(AccessController.java:43)
I   at io.netty.util.NetUtil.<clinit>(NetUtil.java:152)
I   at io.netty.util.internal.MacAddressUtil.bestAvailableMac(MacAddressUtil.java:50)
I   at io.netty.util.internal.MacAddressUtil.defaultMachineId(MacAddressUtil.java:137)
I   at io.netty.channel.DefaultChannelId.<clinit>(DefaultChannelId.java:99)
I   at io.netty.channel.DefaultChannelId.newInstance(DefaultChannelId.java:55)
I   at io.netty.channel.AbstractChannel.newId(AbstractChannel.java:113)
I   at io.netty.channel.AbstractChannel.<init>(AbstractChannel.java:73)
I   at io.netty.channel.nio.AbstractNioChannel.<init>(AbstractNioChannel.java:80)
I   at io.netty.channel.nio.AbstractNioMessageChannel.<init>(AbstractNioMessageChannel.java:42)
I   at io.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:96)
I   at io.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:89)
I   at io.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:82)
I   at io.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:75)
I   at java.lang.reflect.Constructor.newInstance0(Native Method)
I   at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
I   at io.netty.channel.ReflectiveChannelFactory.newChannel(ReflectiveChannelFactory.java:44)
I   at io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:310)
I   at io.netty.bootstrap.AbstractBootstrap.doBind(AbstractBootstrap.java:272)
I   at io.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:268)
I   at io.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:253)
I   at io.ktor.server.netty.NettyApplicationEngine.start(NettyApplicationEngine.kt:216)
I   at com.example.androidktorserverdemo.MainActivity$onCreate$1.invokeSuspend(MainActivity.kt:41)
I   at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
I   at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
I   at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
I   at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
I   at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
I   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
I   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
I   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
I  Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
I   at libcore.io.Linux.open(Native Method)
I   at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
I   at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
I   at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
I   at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7542)
I   at libcore.io.IoBridge.open(IoBridge.java:478)
I   ... 35 common frames omitted
I  09:24:07.457 [DefaultDispatcher-worker-1] DEBUG io.netty.util.internal.ThreadLocalRandom - -Dio.netty.initialSeedUniquifier: 0x6bba82a7aeed8931
I  09:24:07.458 [DefaultDispatcher-worker-1] WARN io.netty.util.internal.MacAddressUtil - Failed to find a usable hardware address from the network interfaces; using random bytes: 06:a8:d6:c2:9a:7f:da:c5
I  09:24:07.459 [DefaultDispatcher-worker-1] DEBUG io.netty.channel.DefaultChannelId - -Dio.netty.machineId: 06:a8:d6:c2:9a:7f:da:c5 (auto-detected)
I  09:24:07.472 [DefaultDispatcher-worker-1] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.level: simple
I  09:24:07.472 [DefaultDispatcher-worker-1] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.targetRecords: 4
I  09:24:07.501 [DefaultDispatcher-worker-1] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: unpooled
I  09:24:07.502 [DefaultDispatcher-worker-1] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 0
I  09:24:07.517 [DefaultDispatcher-worker-1] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.maxThreadLocalCharBufferSize: 16384
I  09:24:07.577 [DefaultDispatcher-worker-3] INFO ktor.application - Responding at http://127.0.0.1:8080
</code>```

Any suggestions on what I might have done wrong? Thank you very much.

Body:
I'm new to Ktor so please bear with me if this question seems a bit silly. I have tried many approaches that I was able to have googled but none of them worked for me.

My goal was to launch a normal activity and host an HTTP server in it with Ktor and let it be able to respond to client requests. When I started a Ktor server from a command line like below it did work and I could see the response from a local browser when I started the emulator:

private suspend fun startServer() = withContext(Dispatchers.IO) {
    embeddedServer(Netty, port = 8080, host = "0.0.0.0", module = Application::module)
        .start(wait = true)
}

suspend fun main() {
    startServer()
    readln()
}

However when I attempted to start a Ktor server from an activity, I was never able to get a response:

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    CoroutineScope(Dispatchers.IO).launch {
        embeddedServer(Netty, 8080, host = "127.0.0.1") {
            install(ContentNegotiation) {
                gson {}
            }
            routing {
                get("/") {
                    call.respond(mapOf("message" to "Hello world"))
                }
            }
        }.start(wait = true)
    }

In my AndroidManifest I did have the following line in place:

<uses-permission android:name="android.permission.INTERNET"/>

But when I　attempted to access http://127.0.0.1:8080/ from the host PC, ERR_CONNECTION_REFUSED was the error I received.

These were the messages in the logcat:

I  java.io.FileNotFoundException: /proc/sys/net/core/somaxconn: open failed: EACCES (Permission denied)
I   at libcore.io.IoBridge.open(IoBridge.java:492)
I   at java.io.FileInputStream.<init>(FileInputStream.java:160)
I   at java.io.FileReader.<init>(FileReader.java:72)
I   at io.netty.util.NetUtil$SoMaxConnAction.run(NetUtil.java:170)
W  type=1400 audit(0.0:818): avc: denied { read } for name="somaxconn" dev="proc" ino=29801 scontext=u:r:untrusted_app:s0:c123,c256,c512,c768 tcontext=u:object_r:proc_net:s0 tclass=file permissive=0 app=com.example.androidktorserverdemo
I   at io.netty.util.NetUtil$SoMaxConnAction.run(NetUtil.java:155)
I   at java.security.AccessController.doPrivileged(AccessController.java:43)
I   at io.netty.util.NetUtil.<clinit>(NetUtil.java:152)
I   at io.netty.util.internal.MacAddressUtil.bestAvailableMac(MacAddressUtil.java:50)
I   at io.netty.util.internal.MacAddressUtil.defaultMachineId(MacAddressUtil.java:137)
I   at io.netty.channel.DefaultChannelId.<clinit>(DefaultChannelId.java:99)
I   at io.netty.channel.DefaultChannelId.newInstance(DefaultChannelId.java:55)
I   at io.netty.channel.AbstractChannel.newId(AbstractChannel.java:113)
I   at io.netty.channel.AbstractChannel.<init>(AbstractChannel.java:73)
I   at io.netty.channel.nio.AbstractNioChannel.<init>(AbstractNioChannel.java:80)
I   at io.netty.channel.nio.AbstractNioMessageChannel.<init>(AbstractNioMessageChannel.java:42)
I   at io.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:96)
I   at io.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:89)
I   at io.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:82)
I   at io.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:75)
I   at java.lang.reflect.Constructor.newInstance0(Native Method)
I   at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
I   at io.netty.channel.ReflectiveChannelFactory.newChannel(ReflectiveChannelFactory.java:44)
I   at io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:310)
I   at io.netty.bootstrap.AbstractBootstrap.doBind(AbstractBootstrap.java:272)
I   at io.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:268)
I   at io.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:253)
I   at io.ktor.server.netty.NettyApplicationEngine.start(NettyApplicationEngine.kt:216)
I   at com.example.androidktorserverdemo.MainActivity$onCreate$1.invokeSuspend(MainActivity.kt:41)
I   at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
I   at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
I   at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
I   at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
I   at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
I   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
I   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
I   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
I  Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
I   at libcore.io.Linux.open(Native Method)
I   at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
I   at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
I   at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
I   at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7542)
I   at libcore.io.IoBridge.open(IoBridge.java:478)
I   ... 35 common frames omitted
I  09:24:07.457 [DefaultDispatcher-worker-1] DEBUG io.netty.util.internal.ThreadLocalRandom - -Dio.netty.initialSeedUniquifier: 0x6bba82a7aeed8931
I  09:24:07.458 [DefaultDispatcher-worker-1] WARN io.netty.util.internal.MacAddressUtil - Failed to find a usable hardware address from the network interfaces; using random bytes: 06:a8:d6:c2:9a:7f:da:c5
I  09:24:07.459 [DefaultDispatcher-worker-1] DEBUG io.netty.channel.DefaultChannelId - -Dio.netty.machineId: 06:a8:d6:c2:9a:7f:da:c5 (auto-detected)
I  09:24:07.472 [DefaultDispatcher-worker-1] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.level: simple
I  09:24:07.472 [DefaultDispatcher-worker-1] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.targetRecords: 4
I  09:24:07.501 [DefaultDispatcher-worker-1] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: unpooled
I  09:24:07.502 [DefaultDispatcher-worker-1] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 0
I  09:24:07.517 [DefaultDispatcher-worker-1] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.maxThreadLocalCharBufferSize: 16384
I  09:24:07.577 [DefaultDispatcher-worker-3] INFO ktor.application - Responding at http://127.0.0.1:8080

Any suggestions on what I might have done wrong? Thank you very much.


来源: stackexchange

问:
Angular InjectionToken in NgModule import array?
I need to use the environment.production flag in an import array of a NgModule:

```<code>@NgModule({
  import: [
    ...
    !environment.production ? StoreDevtoolsModule.instrument() : [],
  ]
}
</code>```

But we've multiple possible environment files at this time, that's why we use an InjectionToken in other parts of the code.

Is there a possibility to use the injection token in the import array?

ContentLicense: CC BY-SA 4.0

Body:
I need to use the environment.production flag in an import array of a NgModule:

@NgModule({
  import: [
    ...
    !environment.production ? StoreDevtoolsModule.instrument() : [],
  ]
}

But we've multiple possible environment files at this time, that's why we use an InjectionToken in other parts of the code.

Is there a possibility to use the injection token in the import array?


问:
How do I connect Chart.GS to my HTML file on Google Apps Script?
Using Google Apps Script, I am wondering how do I connect the document/chart.gs onto the html? Since the place I wanted to connect, is on here to boot:

```<code>    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<div class="chart" style="height:184px">
    <canvas id="myChart"></canvas>
  </div>
<script>
// setup
const ctx = document.getElementById('myChart');

const labels = [1,2,3,4,5,6,7];
// create random Data
const helpData1 = labels.map( _ => Math.random() * 5000);
const helpData2 = labels.map( _ => Math.random() * 1000);
const helpData3 = labels.map( _ => Math.random() * 1000);
const helpData4 = labels.map( _ => Math.random() * 1000);
</code>```

I've read the tutorial on this, however it never said anything on having the Code.Gs connect it to a setup like this.

Body:
Using Google Apps Script, I am wondering how do I connect the document/chart.gs onto the html? Since the place I wanted to connect, is on here to boot:

    <canvas id="myChart"></canvas>


问:
JSP file not loading in production but working correctly in development
I have a jsp file for displaying a new tab on a webpage. The html in the jsp file is correctly being loaded and rendered in the beta environment, however in production the JSP file itself is not loading leading to the following error on console:

Uncaught ReferenceError: AWS is not defined

This is because I am using the aws-sdk in my javascript file, but the import for the same is in my jsp, which is not being loaded at all as I can see from my console page.

I do not have access to the Production host to check the host logs, so the intent of this question is just to see if others have faced a similar issue to this one and what was the cause behind the error. Thanks in advance!


问:
Null value response on login
We have just uploaded the app for the Beta testing on Google play but while testing it's showing null value response on the login. Although the app is working fine if we are testing without the Google play. We have checked all the API's are working fine too.

Testing the app through the Google play beta testing.

Title: Null value response on login


问:
How can I get the data outside the for loop or if condition when both for loop and if-condition is present inside the JavaScript function?
Suppose,

below is my dummy code with my scenario:

Hello.js file:

```<code>function hello(data){
   var newlist = []

   if(something == true){
      for(let d in data){
          newlist.push([d[tag]])
          console.log("inside loop",newlist)   //here it is printing the newlist logs as for loop goes on.
      }
     console.log("outside loop",newlist)  //but it is not printing anything here
   }
   console.log(newlist)   //but it is not printing anything here also.
   return newlist         //also not returning the newlist.
}
</code>```

Here, please help me with the solution for this issue or atleast if you can give any idea what exactly can be the issue.

Body:
Suppose,

below is my dummy code with my scenario:

Hello.js file:

function hello(data){
   var newlist = []

   if(something == true){
      for(let d in data){
          newlist.push([d[tag]])
          console.log("inside loop",newlist)   //here it is printing the newlist logs as for loop goes on.
      }
     console.log("outside loop",newlist)  //but it is not printing anything here
   }
   console.log(newlist)   //but it is not printing anything here also.
   return newlist         //also not returning the newlist.
}

Here, please help me with the solution for this issue or atleast if you can give any idea what exactly can be the issue.


问:
Can we replace word contextConfigLocation by foo?
I am using Java/JDK 1.6,  Spring 2.5.6, Eclipse IDE 2022-06 . I see file web.xml

<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
          http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5">

    <display-name>Archetype Created Web Application</display-name>

    <servlet>
        <servlet-name>mvc-dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>mvc-dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

</web-app>
```
<p>Please focus at this line</p>
<pre class="lang-xml prettyprint-override"><code><param-name>contextConfigLocation</param-name>
</code>```

Can we replace word contextConfigLocation by foo?

Body:
I am using Java/JDK 1.6,  Spring 2.5.6, Eclipse IDE 2022-06 . I see file web.xml

<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
          http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5">

    <display-name>Archetype Created Web Application</display-name>

    <servlet>
        <servlet-name>mvc-dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>mvc-dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

</web-app>

Please focus at this line

<param-name>contextConfigLocation</param-name>

Can we replace word contextConfigLocation by foo?


问:
PHP: how to hide $GET_id from the link?
I want to hide the id from the link to be something like www.example.com/edit?DashboardId=14c140fc-b269-46e3-9649-d2c374d9d1e1&SelectedId=db250226-ad35-40ac-a321-1eedbe3460fc

My current link is www.example.com/edit?DashboardId=14

Title: PHP: how to hide $GET_id from the link?


问:
Spring-boot hot reload
I'm trying to activate hot reload on my spring-boot project with intellij. I have add :

```<code><dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-devtools</artifactId>
  <version>${spring-boot.version}</version>
  <optional>true</optional>
</dependency>
</code>```

and

```<code>-Dspring.devtools.restart.enabled=true
</code>```

but i have a problem with activemq, when hot reload start, it give me this error:

```<code>[ERROR] [DefaultMessageListenerContainer-1] o.s.j.l.DefaultMessageListenerContainer - Could not refresh JMS Connection for destination 'Consumer.test.VirtualTopic.activemq.ENTITY.T' - retrying using FixedBackOff{interval=5000, currentAttempts=2996, maxAttempts=unlimited}. Cause: null
</code>```

I need to stop and start application... does anyone has already facing to the same issue?

thanks!

Title: Spring-boot hot reload

Body:
I'm trying to activate hot reload on my spring-boot project with intellij. I have add :

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-devtools</artifactId>
  <version>${spring-boot.version}</version>
  <optional>true</optional>
</dependency>

and

-Dspring.devtools.restart.enabled=true

but i have a problem with activemq, when hot reload start, it give me this error:

[ERROR] [DefaultMessageListenerContainer-1] o.s.j.l.DefaultMessageListenerContainer - Could not refresh JMS Connection for destination 'Consumer.test.VirtualTopic.activemq.ENTITY.T' - retrying using FixedBackOff{interval=5000, currentAttempts=2996, maxAttempts=unlimited}. Cause: null

I need to stop and start application... does anyone has already facing to the same issue?

thanks!


问:
Typo3 multiple fields in Backend InputElement
I have question regarding the backend. I'm developing on Typo3 10.4, but also 9.5 and 11.5 so it doesn't really matter which version I'm using.

I created a new --div-- in the page config form and added a selectSingle inputElement.
The select's foreign_table is set to be_users.
It only shows the username of the backend user. Is there a way to also output the realName of each user shown in the list?

The only way I found to do so is to override the be_users.php and force alternative labels.
But I wonder if there is a way by telling the inputElement to get more than just the username. Like an "additional_fields" line in the 'config' part of the TCA.
Any ideas?


问:
What is the roadmap for MyFaces 2.3-next-M8
I'm currently developing a jsf app on quarkus using myfaces (2.3-next-M7) but due to a bug that I raised here I can't use it in production and I am eagerly waiting for version 2.3-next-M8, would someone know when it is supposed to be released ?
I haven't found any information on myfaces' site or myfaces' issue tracker

Thanks for your help.


问:
Kafka broker container fails with invalid argument
I added the Kafka as docker containers

This is the docker-compose file:

    kafka:
        image: "confluentinc/cp-kafka"
        container_name: kafka
        restart: always
        depends_on:
          - zookeeper
        ports:
          - '9092:9092'
        environment:
          KAFKA_BROKER_ID: 1
          KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
          KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
          KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
          KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
          KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
          KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
          KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
          KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
          KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 100
          CONFLUENT_METRICS_ENABLE: 'false'
        networks:
          - ddn
        deploy:
          resources:
            limits:
              memory: 2G

    init-kafka:
        image: confluentinc/cp-kafka
        depends_on:
          - kafka
        entrypoint: [ '/bin/sh', '-c' ]
        command: |
          "
          # blocks until kafka is reachable
          kafka-topics --bootstrap-server kafka:29092 --list

          echo -e 'Creating kafka topics'
          kafka-topics --bootstrap-server kafka:29092 --create --if-not-exists --topic EVENT_TYPE1_NOTIFY --replication-factor 1 --partitions 1

          echo -e 'Successfully created the following topics:'
          kafka-topics --bootstrap-server kafka:29092 --list
          "
        networks:
          - ddn

    kafka-rest:
        container_name: kafka-rest
        image: confluentinc/cp-kafka-rest
        hostname: kafka-rest
        restart: always
        depends_on:
          - init-kafka
        ports:
        - "8082:8082"
        environment:
          KAFKA_REST_ZOOKEEPER_CONNECT: zookeeper:2181
          KAFKA_REST_HOST_NAME: kafka-rest
          KAFKA_REST_LISTENERS: http://kafka-rest:8082
          KAFKA_REST_BOOTSTRAP_SERVERS: kafka:29092
        healthcheck:
          test: ["CMD", "curl", "-f", "http://kafka-rest:8082/topics/EVENT_TYPE1_NOTIFY "]
          interval: 5s
          timeout: 1s
          retries: 12
        networks:
          - ddn

networks:
  ddn:
```
<p>Though, while running the docker-compose inside the integration tests agent which is based on Windows server, i'm encountering the following error:</p>
```[2023-01-03 13:11:26,453] ERROR [KafkaApi-1] Error when handling request: clientId=1, correlationId=5, api=LEADER_AND_ISR, version=5, body=LeaderAndIsrRequestData(controllerId=1,
controllerEpoch=1, brokerEpoch=25, type=0, ungroupedPartitionStates=[], topicStates=[LeaderAndIsrTopicState(topicName='EVENT_TYPE1_NOTIFY',
topicId=MU_GDxwKTkywLg9wPNCrsg, partitionStates=[LeaderAndIsrPartitionState(topicName='EVENT_TYPE1_NOTIFY', partitionIndex=0, controllerEpoch=1,
leader=1, leaderEpoch=0, isr=[1], zkVersion=0, replicas=[1], addingReplicas=[], removingReplicas=[], isNew=true)])], liveLeaders=[LeaderAndIsrLiveLeader(brokerId=1,
hostName='kafka', port=9092)]) (kafka.server.RequestHandlerHelper)
java.io.IOException: Invalid argument
        at java.base/sun.nio.ch.FileChannelImpl.map0(Native Method)
        at java.base/sun.nio.ch.FileChannelImpl.map(Unknown Source)
        at kafka.log.AbstractIndex.<init>(AbstractIndex.scala:124)
        at kafka.log.OffsetIndex.<init>(OffsetIndex.scala:54)
        at kafka.log.LazyIndex$.$anonfun$forOffset$1(LazyIndex.scala:106)
        at kafka.log.LazyIndex.$anonfun$get$1(LazyIndex.scala:63)
        at kafka.log.LazyIndex.get(LazyIndex.scala:60)
        at kafka.log.LogSegment.offsetIndex(LogSegment.scala:64)
        at kafka.log.LogSegment.readNextOffset(LogSegment.scala:456)
        at kafka.log.Log.$anonfun$recoverLog$6(Log.scala:944)
        at scala.runtime.java8.JFunction0$mcJ$sp.apply(JFunction0$mcJ$sp.scala:17)
        at scala.Option.getOrElse(Option.scala:201)
        at kafka.log.Log.recoverLog(Log.scala:944)
        at kafka.log.Log.$anonfun$loadSegments$3(Log.scala:824)
        at scala.runtime.java8.JFunction0$mcJ$sp.apply(JFunction0$mcJ$sp.scala:17)
        at kafka.log.Log.retryOnOffsetOverflow(Log.scala:2494)
        at kafka.log.Log.loadSegments(Log.scala:824)
        at kafka.log.Log.<init>(Log.scala:328)
        at kafka.log.Log$.apply(Log.scala:2630)
        at kafka.log.LogManager.$anonfun$getOrCreateLog$1(LogManager.scala:830)
        at scala.Option.getOrElse(Option.scala:201)
        at kafka.log.LogManager.getOrCreateLog(LogManager.scala:783)
        at kafka.cluster.Partition.createLog(Partition.scala:344)
        at kafka.cluster.Partition.createLogIfNotExists(Partition.scala:324)
        at kafka.cluster.Partition.$anonfun$makeLeader$1(Partition.scala:563)
        at kafka.cluster.Partition.makeLeader(Partition.scala:547)
        at kafka.server.ReplicaManager.$anonfun$makeLeaders$5(ReplicaManager.scala:1568)
        at kafka.utils.Implicits$MapExtensionMethods$.$anonfun$forKeyValue$1(Implicits.scala:62)
        at scala.collection.mutable.HashMap$Node.foreachEntry(HashMap.scala:633)
        at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:499)
        at kafka.server.ReplicaManager.makeLeaders(ReplicaManager.scala:1566)
        at kafka.server.ReplicaManager.becomeLeaderOrFollower(ReplicaManager.scala:1411)
        at kafka.server.KafkaApis.handleLeaderAndIsrRequest(KafkaApis.scala:258)
        at kafka.server.KafkaApis.handle(KafkaApis.scala:171)
        at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:74)
        at java.base/java.lang.Thread.run(Unknown Source)
```

Is there any configuration I miss?

Body:
I added the Kafka as docker containers

This is the docker-compose file:

    kafka:
        image: "confluentinc/cp-kafka"
        container_name: kafka
        restart: always
        depends_on:
          - zookeeper
        ports:
          - '9092:9092'
        environment:
          KAFKA_BROKER_ID: 1
          KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
          KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
          KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
          KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
          KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
          KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
          KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
          KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
          KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 100
          CONFLUENT_METRICS_ENABLE: 'false'
        networks:
          - ddn
        deploy:
          resources:
            limits:
              memory: 2G

    init-kafka:
        image: confluentinc/cp-kafka
        depends_on:
          - kafka
        entrypoint: [ '/bin/sh', '-c' ]
        command: |
          "
          # blocks until kafka is reachable
          kafka-topics --bootstrap-server kafka:29092 --list

          echo -e 'Creating kafka topics'
          kafka-topics --bootstrap-server kafka:29092 --create --if-not-exists --topic EVENT_TYPE1_NOTIFY --replication-factor 1 --partitions 1

          echo -e 'Successfully created the following topics:'
          kafka-topics --bootstrap-server kafka:29092 --list
          "
        networks:
          - ddn

    kafka-rest:
        container_name: kafka-rest
        image: confluentinc/cp-kafka-rest
        hostname: kafka-rest
        restart: always
        depends_on:
          - init-kafka
        ports:
        - "8082:8082"
        environment:
          KAFKA_REST_ZOOKEEPER_CONNECT: zookeeper:2181
          KAFKA_REST_HOST_NAME: kafka-rest
          KAFKA_REST_LISTENERS: http://kafka-rest:8082
          KAFKA_REST_BOOTSTRAP_SERVERS: kafka:29092
        healthcheck:
          test: ["CMD", "curl", "-f", "http://kafka-rest:8082/topics/EVENT_TYPE1_NOTIFY "]
          interval: 5s
          timeout: 1s
          retries: 12
        networks:
          - ddn

networks:
  ddn:

Though, while running the docker-compose inside the integration tests agent which is based on Windows server, i'm encountering the following error:

[2023-01-03 13:11:26,453] ERROR [KafkaApi-1] Error when handling request: clientId=1, correlationId=5, api=LEADER_AND_ISR, version=5, body=LeaderAndIsrRequestData(controllerId=1,
controllerEpoch=1, brokerEpoch=25, type=0, ungroupedPartitionStates=[], topicStates=[LeaderAndIsrTopicState(topicName='EVENT_TYPE1_NOTIFY',
topicId=MU_GDxwKTkywLg9wPNCrsg, partitionStates=[LeaderAndIsrPartitionState(topicName='EVENT_TYPE1_NOTIFY', partitionIndex=0, controllerEpoch=1,
leader=1, leaderEpoch=0, isr=[1], zkVersion=0, replicas=[1], addingReplicas=[], removingReplicas=[], isNew=true)])], liveLeaders=[LeaderAndIsrLiveLeader(brokerId=1,
hostName='kafka', port=9092)]) (kafka.server.RequestHandlerHelper)
java.io.IOException: Invalid argument
        at java.base/sun.nio.ch.FileChannelImpl.map0(Native Method)
        at java.base/sun.nio.ch.FileChannelImpl.map(Unknown Source)
        at kafka.log.AbstractIndex.<init>(AbstractIndex.scala:124)
        at kafka.log.OffsetIndex.<init>(OffsetIndex.scala:54)
        at kafka.log.LazyIndex$.$anonfun$forOffset$1(LazyIndex.scala:106)
        at kafka.log.LazyIndex.$anonfun$get$1(LazyIndex.scala:63)
        at kafka.log.LazyIndex.get(LazyIndex.scala:60)
        at kafka.log.LogSegment.offsetIndex(LogSegment.scala:64)
        at kafka.log.LogSegment.readNextOffset(LogSegment.scala:456)
        at kafka.log.Log.$anonfun$recoverLog$6(Log.scala:944)
        at scala.runtime.java8.JFunction0$mcJ$sp.apply(JFunction0$mcJ$sp.scala:17)
        at scala.Option.getOrElse(Option.scala:201)
        at kafka.log.Log.recoverLog(Log.scala:944)
        at kafka.log.Log.$anonfun$loadSegments$3(Log.scala:824)
        at scala.runtime.java8.JFunction0$mcJ$sp.apply(JFunction0$mcJ$sp.scala:17)
        at kafka.log.Log.retryOnOffsetOverflow(Log.scala:2494)
        at kafka.log.Log.loadSegments(Log.scala:824)
        at kafka.log.Log.<init>(Log.scala:328)
        at kafka.log.Log$.apply(Log.scala:2630)
        at kafka.log.LogManager.$anonfun$getOrCreateLog$1(LogManager.scala:830)
        at scala.Option.getOrElse(Option.scala:201)
        at kafka.log.LogManager.getOrCreateLog(LogManager.scala:783)
        at kafka.cluster.Partition.createLog(Partition.scala:344)
        at kafka.cluster.Partition.createLogIfNotExists(Partition.scala:324)
        at kafka.cluster.Partition.$anonfun$makeLeader$1(Partition.scala:563)
        at kafka.cluster.Partition.makeLeader(Partition.scala:547)
        at kafka.server.ReplicaManager.$anonfun$makeLeaders$5(ReplicaManager.scala:1568)
        at kafka.utils.Implicits$MapExtensionMethods$.$anonfun$forKeyValue$1(Implicits.scala:62)
        at scala.collection.mutable.HashMap$Node.foreachEntry(HashMap.scala:633)
        at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:499)
        at kafka.server.ReplicaManager.makeLeaders(ReplicaManager.scala:1566)
        at kafka.server.ReplicaManager.becomeLeaderOrFollower(ReplicaManager.scala:1411)
        at kafka.server.KafkaApis.handleLeaderAndIsrRequest(KafkaApis.scala:258)
        at kafka.server.KafkaApis.handle(KafkaApis.scala:171)
        at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:74)
        at java.base/java.lang.Thread.run(Unknown Source)

Is there any configuration I miss?


问:
Changing Projection on OpenLayers Map in Vanila Javascript and Asp.net Blazor
I am developing a OpenLayer map inside my asp.net Blazor Application . I want to change the projection of my map. I found a article how to change here on OpenLayer Site

https://openlayers.org/doc/faq.html

As in the documentation they use Node.js and They can Import several exported method like

```<code> import Map from 'ol/Map.js';
 import View from 'ol/View.js';
 import proj4 from 'proj4';
 import {register} from 'ol/proj/proj4.js';
 import {get as getProjection} from 'ol/proj.js';
</code>```

. I used CDNS instead . I got error of undefined register and getProjection Like in here

```<code>   proj4.defs('EPSG:21781',
        '+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 ' +
        '+x_0=600000 +y_0=200000 +ellps=bessel ' +
        '+towgs84=660.077,13.551,369.344,2.484,1.783,2.939,5.66 +units=m +no_defs');
    register(proj4);
    const swissProjection = getProjection('EPSG:21781');
</code>```

Though I CDNS on my host.razor file Like this

```<code> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.8.0/proj4.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.8.0/proj4-src.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.8.0/proj4-src.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.8.0/proj4.min.js"></script>
</code>```

This Four are the proj4 CDN I found on the Internet . How to do in Vanila Javascript without using import . Is there any way to use import.

Body:
I am developing a OpenLayer map inside my asp.net Blazor Application . I want to change the projection of my map. I found a article how to change here on OpenLayer Site

https://openlayers.org/doc/faq.html

As in the documentation they use Node.js and They can Import several exported method like

 import Map from 'ol/Map.js';
 import View from 'ol/View.js';
 import proj4 from 'proj4';
 import {register} from 'ol/proj/proj4.js';
 import {get as getProjection} from 'ol/proj.js';

. I used CDNS instead . I got error of undefined register and getProjection Like in here

   proj4.defs('EPSG:21781',
        '+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 ' +
        '+x_0=600000 +y_0=200000 +ellps=bessel ' +
        '+towgs84=660.077,13.551,369.344,2.484,1.783,2.939,5.66 +units=m +no_defs');
    register(proj4);
    const swissProjection = getProjection('EPSG:21781');

Though I CDNS on my host.razor file Like this

This Four are the proj4 CDN I found on the Internet . How to do in Vanila Javascript without using import . Is there any way to use import.


问:
Want to create a function which can read the data of the the textfield and calculate accordingly
`I have a function which adds an element as a row of some FormBuilderTextField in the list and display the list where user can input the data of the hotel in which there would also be some costing .

user can add the desired no of rows as required and add the input

now I want to create a function which can read the input fields and do the calculation accordingly

hotel cost of each row = RoomNightsCount * ( (RoomCount * RoomCost) + (ExtraBedCount * ExtraBedCost) )

Total Cost = Sum of each row cost // here the no of rows can dynamically change as per the requirement of user every time.

```<code>// This Function Add a Row of Some FormBuilderTextFields in the colum
  int hotelIndex = 0;
  addHotel() {
    setState(() {
      hotelIndex++;
      hotel.add(Container(
        child: Padding(
          padding: const EdgeInsets.only(top: 8.0),
          child: Row(
            children: [
              // Hotel name and city
              Flexible(
                  flex: 1,
                  child: Row(
                    children: [
                      Flexible(
                          child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            "City",
                            style: TextStyle(
                                fontSize: 15, fontWeight: FontWeight.bold),
                          ),
                          Padding(
                            padding: const EdgeInsets.only(top: 8.0),
                            child: FormBuilderTextField(
                              name: "HotelCity${hotelIndex}",
                              decoration: InputDecoration(
                                  border: OutlineInputBorder(
                                      borderRadius: BorderRadius.circular(10)),
                                  isDense: true,
                                  filled: true,
                                  hintText: "Hotel - City Name"),
                            ),
                          ),
                        ],
                      )),
                      SizedBox(
                        width: 20,
                      ),
                      Flexible(
                          child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            "Hotel",
                            style: TextStyle(
                                fontSize: 15, fontWeight: FontWeight.bold),
                          ),
                          Padding(
                            padding: const EdgeInsets.only(top: 8.0),
                            child: FormBuilderTextField(
                              name: "HotelName${hotelIndex}",
                              decoration: InputDecoration(
                                  border: OutlineInputBorder(
                                      borderRadius: BorderRadius.circular(10)),
                                  isDense: true,
                                  filled: true,
                                  hintText: "Hotel Name"),
                            ),
                          ),
                        ],
                      )),
                      SizedBox(
                        width: 20,
                      ),
                    ],
                  )),
              // Room Type / count / occupany / extra bed / room nights
              Flexible(
                  flex: 2,
                  child: Row(
                    children: [
                      Container(
                          width: 100,
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Text(
                                "Room Count",
                                style: TextStyle(
                                    fontSize: 15, fontWeight: FontWeight.bold),
                              ),
                              Padding(
                                  padding: const EdgeInsets.only(top: 8.0),
                                  child: FormBuilderDropdown(
                                    name: "RoomCount${hotelIndex}",
                                    decoration: InputDecoration(
                                        border: OutlineInputBorder(
                                            borderRadius:
                                                BorderRadius.circular(10)),
                                        isDense: true,
                                        contentPadding: EdgeInsets.all(13),
                                        filled: true,
                                        hintText: "Count"),
                                    items: [
                                      {'value': 1, 'key': 1},
                                      {'value': 2, 'key': 2},
                                      {'value': 3, 'key': 3},
                                      {'value': 4, 'key': 4},
                                      {'value': 5, 'key': 5},
                                      {'value': 6, 'key': 6},
                                      {'value': 7, 'key': 7},
                                      {'value': 8, 'key': 8},
                                      {'value': 9, 'key': 9},
                                      {'value': 10, 'key': 10},
                                      {'value': 11, 'key': 11},
                                      {'value': 12, 'key': 12},
                                      {'value': 13, 'key': 13},
                                      {'value': 14, 'key': 14},
                                      {'value': 15, 'key': 15},
                                      {'value': 16, 'key': 16},
                                      {'value': 17, 'key': 17},
                                      {'value': 18, 'key': 18},
                                      {'value': 19, 'key': 19},
                                      {'value': 20, 'key': 20},
                                    ]
                                        .map((RoomQuantity) => DropdownMenuItem(
                                            value: RoomQuantity["value"],
                                            child: Text(
                                                "${RoomQuantity["value"]}")))
                                        .toList(),
                                  )),
                            ],
                          )),
                      SizedBox(
                        width: 20,
                      ),
                      Flexible(
                          child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            "Room Type",
                            style: TextStyle(
                                fontSize: 15, fontWeight: FontWeight.bold),
                          ),
                          Padding(
                            padding: const EdgeInsets.only(top: 8.0),
                            child: FormBuilderTextField(
                              name: "RoomType${hotelIndex}",
                              decoration: InputDecoration(
                                  border: OutlineInputBorder(
                                      borderRadius: BorderRadius.circular(10)),
                                  isDense: true,
                                  filled: true,
                                  hintText: "Deluxe , Super Deluxe etc."),
                            ),
                          ),
                        ],
                      )),
                      SizedBox(
                        width: 20,
                      ),
                      Flexible(
                          child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            "Occupancy",
                            style: TextStyle(
                                fontSize: 15, fontWeight: FontWeight.bold),
                          ),
                          Padding(
                            padding: const EdgeInsets.only(top: 8.0),
                            child: FormBuilderTextField(
                              name: "RoomOccupancy${hotelIndex}",
                              decoration: InputDecoration(
                                  border: OutlineInputBorder(
                                      borderRadius: BorderRadius.circular(10)),
                                  isDense: true,
                                  filled: true,
                                  hintText: "Double , Triple etc."),
                            ),
                          ),
                        ],
                      )),
                      SizedBox(
                        width: 20,
                      ),
                      Container(
                          width: 100,
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Text(
                                "Extra Bed",
                                style: TextStyle(
                                    fontSize: 15, fontWeight: FontWeight.bold),
                              ),
                              Padding(
                                  padding: const EdgeInsets.only(top: 8.0),
                                  child: FormBuilderDropdown(
                                    name: "ExtraBedCount${hotelIndex}",
                                    decoration: InputDecoration(
                                        border: OutlineInputBorder(
                                            borderRadius:
                                                BorderRadius.circular(10)),
                                        isDense: true,
                                        contentPadding: EdgeInsets.all(13),
                                        filled: true,
                                        hintText: "Count"),
                                    items: [
                                      {'value': 1, 'key': 1},
                                      {'value': 2, 'key': 2},
                                      {'value': 3, 'key': 3},
                                      {'value': 4, 'key': 4},
                                      {'value': 5, 'key': 5},
                                      {'value': 6, 'key': 6},
                                      {'value': 7, 'key': 7},
                                      {'value': 8, 'key': 8},
                                      {'value': 9, 'key': 9},
                                      {'value': 10, 'key': 10},
                                      {'value': 11, 'key': 11},
                                      {'value': 12, 'key': 12},
                                      {'value': 13, 'key': 13},
                                      {'value': 14, 'key': 14},
                                      {'value': 15, 'key': 15},
                                      {'value': 16, 'key': 16},
                                      {'value': 17, 'key': 17},
                                      {'value': 18, 'key': 18},
                                      {'value': 19, 'key': 19},
                                      {'value': 20, 'key': 20},
                                    ]
                                        .map((ExtraBedCount) => DropdownMenuItem(
                                            value: ExtraBedCount["value"],
                                            child: Text(
                                                "${ExtraBedCount["value"]}")))
                                        .toList(),
                                  )),
                            ],
                          )),
                      SizedBox(
                        width: 20,
                      ),
                      Container(
                        width: 100,
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Text(
                              "Nights",
                              style: TextStyle(
                                  fontSize: 15, fontWeight: FontWeight.bold),
                            ),
                            Padding(
                                padding: const EdgeInsets.only(top: 8.0),
                                child: FormBuilderDropdown(
                                  name: "RoomNightsCount${hotelIndex}",
                                  decoration: InputDecoration(
                                      border: OutlineInputBorder(
                                          borderRadius:
                                              BorderRadius.circular(10)),
                                      isDense: true,
                                      contentPadding: EdgeInsets.all(13),
                                      filled: true,
                                      hintText: "Count"),
                                  items: [
                                    {'value': 1, 'key': 1},
                                    {'value': 2, 'key': 2},
                                    {'value': 3, 'key': 3},
                                    {'value': 4, 'key': 4},
                                    {'value': 5, 'key': 5},
                                    {'value': 6, 'key': 6},
                                    {'value': 7, 'key': 7},
                                    {'value': 8, 'key': 8},
                                    {'value': 9, 'key': 9},
                                    {'value': 10, 'key': 10},
                                    {'value': 11, 'key': 11},
                                    {'value': 12, 'key': 12},
                                    {'value': 13, 'key': 13},
                                    {'value': 14, 'key': 14},
                                    {'value': 15, 'key': 15},
                                    {'value': 16, 'key': 16},
                                    {'value': 17, 'key': 17},
                                    {'value': 18, 'key': 18},
                                    {'value': 19, 'key': 19},
                                    {'value': 20, 'key': 20},
                                  ]
                                      .map((RoomNightsCount) => DropdownMenuItem(
                                          value: RoomNightsCount["value"],
                                          child: Text(
                                              "${RoomNightsCount["value"]}")))
                                      .toList(),
                                )),
                          ],
                        ),
                      ),
                    ],
                  )),

              SizedBox(
                width: 20,
              ),
              // Room Cost / extra bed cost
              Flexible(
                  flex: 1,
                  child: Row(
                    children: [
                      Flexible(
                          child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            "Room Cost",
                            style: TextStyle(
                                fontSize: 15, fontWeight: FontWeight.bold),
                          ),
                          Padding(
                            padding: const EdgeInsets.only(top: 8.0),
                            child: FormBuilderTextField(
                              name: "RoomCost${hotelIndex}",
                              decoration: InputDecoration(
                                  border: OutlineInputBorder(
                                      borderRadius: BorderRadius.circular(10)),
                                  isDense: true,
                                  filled: true,
                                  hintText: "Per Night Cost"),
                            ),
                          ),
                        ],
                      )),
                      SizedBox(
                        width: 20,
                      ),
                      Flexible(
                          child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            "Cost Extra Bed",
                            style: TextStyle(
                                fontSize: 15, fontWeight: FontWeight.bold),
                          ),
                          Padding(
                            padding: const EdgeInsets.only(top: 8.0),
                            child: FormBuilderTextField(
                              name: "ExtraBedCost${hotelIndex}",
                              decoration: InputDecoration(
                                  border: OutlineInputBorder(
                                      borderRadius: BorderRadius.circular(10)),
                                  isDense: true,
                                  filled: true,
                                  hintText: "Per Night Cost"),
                            ),
                          ),
                        ],
                      )),
                    ],
                  ))
            ],
          ),
        ),
      ));
    });
  }

// calling this button i can remove the row
  removeHotel() {
    if (hotel.isNotEmpty) {
      setState(() {
        hotelIndex--;
        hotel.removeLast();
      });
    }
  }

// Now i want to creat a function which can read the values of some textFields from all added rows and do some calculation and give the result
// ( RoomCount * RoomCost + ExtraBedCount * ExtraBedCost ) * RoomNightsCount = TotalHotelCost this from each row and to add all rows total cost togeater and the give a final cost
</code>```

// This is how I am displaying it

```<code>Container(
          decoration: BoxDecoration(border: Border.all(color: Colors.black)),
          child: Padding(
            padding: const EdgeInsets.all(15.0),
            child: Column(children: [
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Container(
                    child: Text(
                      "Add Hotels: ",
                      style:
                          TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
                    ),
                  ),
                  Row(
                    children: [
                      Container(
                        child: TextButton(
                            style: ElevatedButton.styleFrom(
                              primary: Colors.red.shade900,
                              onPrimary: Colors.white,
                              side: const BorderSide(
                                  width: 0.5, color: Colors.white),
                              shape: RoundedRectangleBorder(
                                  borderRadius: BorderRadius.circular(12)),
                            ),
                            onPressed: () {
                              addHotel();
                            },
                            child: Text("Add Hotel")),
                      ),
                      SizedBox(
                        width: 10,
                      ),
                      Container(
                        child: TextButton(
                            style: ElevatedButton.styleFrom(
                              primary: Colors.red.shade900,
                              onPrimary: Colors.white,
                              side: const BorderSide(
                                  width: 0.5, color: Colors.white),
                              shape: RoundedRectangleBorder(
                                  borderRadius: BorderRadius.circular(12)),
                            ),
                            onPressed: () {
                              removeHotel();
                            },
                            child: Text("Remove Hotel")),
                      )
                    ],
                  )
                ],
              ),
              SizedBox(
                height: 18,
              ),
              Container(
                decoration:
                    BoxDecoration(border: Border.all(color: Colors.black)),
                child: hotel.isNotEmpty
                    ? Padding(
                        padding: const EdgeInsets.all(10.0),
                        child: Column(children: [
                          ...hotel.map((e) => e).toList(),
                        ]),
                      )
                    : null,
              ),
            ]),
          ),
        ),
</code>```

Body:
`I have a function which adds an element as a row of some FormBuilderTextField in the list and display the list where user can input the data of the hotel in which there would also be some costing .

user can add the desired no of rows as required and add the input

now I want to create a function which can read the input fields and do the calculation accordingly

hotel cost of each row = RoomNightsCount * ( (RoomCount * RoomCost) + (ExtraBedCount * ExtraBedCost) )

Total Cost = Sum of each row cost // here the no of rows can dynamically change as per the requirement of user every time.

// This Function Add a Row of Some FormBuilderTextFields in the colum
  int hotelIndex = 0;
  addHotel() {
    setState(() {
      hotelIndex++;
      hotel.add(Container(
        child: Padding(
          padding: const EdgeInsets.only(top: 8.0),
          child: Row(
            children: [
              // Hotel name and city
              Flexible(
                  flex: 1,
                  child: Row(
                    children: [
                      Flexible(
                          child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            "City",
                            style: TextStyle(
                                fontSize: 15, fontWeight: FontWeight.bold),
                          ),
                          Padding(
                            padding: const EdgeInsets.only(top: 8.0),
                            child: FormBuilderTextField(
                              name: "HotelCity${hotelIndex}",
                              decoration: InputDecoration(
                                  border: OutlineInputBorder(
                                      borderRadius: BorderRadius.circular(10)),
                                  isDense: true,
                                  filled: true,
                                  hintText: "Hotel - City Name"),
                            ),
                          ),
                        ],
                      )),
                      SizedBox(
                        width: 20,
                      ),
                      Flexible(
                          child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            "Hotel",
                            style: TextStyle(
                                fontSize: 15, fontWeight: FontWeight.bold),
                          ),
                          Padding(
                            padding: const EdgeInsets.only(top: 8.0),
                            child: FormBuilderTextField(
                              name: "HotelName${hotelIndex}",
                              decoration: InputDecoration(
                                  border: OutlineInputBorder(
                                      borderRadius: BorderRadius.circular(10)),
                                  isDense: true,
                                  filled: true,
                                  hintText: "Hotel Name"),
                            ),
                          ),
                        ],
                      )),
                      SizedBox(
                        width: 20,
                      ),
                    ],
                  )),
              // Room Type / count / occupany / extra bed / room nights
              Flexible(
                  flex: 2,
                  child: Row(
                    children: [
                      Container(
                          width: 100,
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Text(
                                "Room Count",
                                style: TextStyle(
                                    fontSize: 15, fontWeight: FontWeight.bold),
                              ),
                              Padding(
                                  padding: const EdgeInsets.only(top: 8.0),
                                  child: FormBuilderDropdown(
                                    name: "RoomCount${hotelIndex}",
                                    decoration: InputDecoration(
                                        border: OutlineInputBorder(
                                            borderRadius:
                                                BorderRadius.circular(10)),
                                        isDense: true,
                                        contentPadding: EdgeInsets.all(13),
                                        filled: true,
                                        hintText: "Count"),
                                    items: [
                                      {'value': 1, 'key': 1},
                                      {'value': 2, 'key': 2},
                                      {'value': 3, 'key': 3},
                                      {'value': 4, 'key': 4},
                                      {'value': 5, 'key': 5},
                                      {'value': 6, 'key': 6},
                                      {'value': 7, 'key': 7},
                                      {'value': 8, 'key': 8},
                                      {'value': 9, 'key': 9},
                                      {'value': 10, 'key': 10},
                                      {'value': 11, 'key': 11},
                                      {'value': 12, 'key': 12},
                                      {'value': 13, 'key': 13},
                                      {'value': 14, 'key': 14},
                                      {'value': 15, 'key': 15},
                                      {'value': 16, 'key': 16},
                                      {'value': 17, 'key': 17},
                                      {'value': 18, 'key': 18},
                                      {'value': 19, 'key': 19},
                                      {'value': 20, 'key': 20},
                                    ]
                                        .map((RoomQuantity) => DropdownMenuItem(
                                            value: RoomQuantity["value"],
                                            child: Text(
                                                "${RoomQuantity["value"]}")))
                                        .toList(),
                                  )),
                            ],
                          )),
                      SizedBox(
                        width: 20,
                      ),
                      Flexible(
                          child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            "Room Type",
                            style: TextStyle(
                                fontSize: 15, fontWeight: FontWeight.bold),
                          ),
                          Padding(
                            padding: const EdgeInsets.only(top: 8.0),
                            child: FormBuilderTextField(
                              name: "RoomType${hotelIndex}",
                              decoration: InputDecoration(
                                  border: OutlineInputBorder(
                                      borderRadius: BorderRadius.circular(10)),
                                  isDense: true,
                                  filled: true,
                                  hintText: "Deluxe , Super Deluxe etc."),
                            ),
                          ),
                        ],
                      )),
                      SizedBox(
                        width: 20,
                      ),
                      Flexible(
                          child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            "Occupancy",
                            style: TextStyle(
                                fontSize: 15, fontWeight: FontWeight.bold),
                          ),
                          Padding(
                            padding: const EdgeInsets.only(top: 8.0),
                            child: FormBuilderTextField(
                              name: "RoomOccupancy${hotelIndex}",
                              decoration: InputDecoration(
                                  border: OutlineInputBorder(
                                      borderRadius: BorderRadius.circular(10)),
                                  isDense: true,
                                  filled: true,
                                  hintText: "Double , Triple etc."),
                            ),
                          ),
                        ],
                      )),
                      SizedBox(
                        width: 20,
                      ),
                      Container(
                          width: 100,
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Text(
                                "Extra Bed",
                                style: TextStyle(
                                    fontSize: 15, fontWeight: FontWeight.bold),
                              ),
                              Padding(
                                  padding: const EdgeInsets.only(top: 8.0),
                                  child: FormBuilderDropdown(
                                    name: "ExtraBedCount${hotelIndex}",
                                    decoration: InputDecoration(
                                        border: OutlineInputBorder(
                                            borderRadius:
                                                BorderRadius.circular(10)),
                                        isDense: true,
                                        contentPadding: EdgeInsets.all(13),
                                        filled: true,
                                        hintText: "Count"),
                                    items: [
                                      {'value': 1, 'key': 1},
                                      {'value': 2, 'key': 2},
                                      {'value': 3, 'key': 3},
                                      {'value': 4, 'key': 4},
                                      {'value': 5, 'key': 5},
                                      {'value': 6, 'key': 6},
                                      {'value': 7, 'key': 7},
                                      {'value': 8, 'key': 8},
                                      {'value': 9, 'key': 9},
                                      {'value': 10, 'key': 10},
                                      {'value': 11, 'key': 11},
                                      {'value': 12, 'key': 12},
                                      {'value': 13, 'key': 13},
                                      {'value': 14, 'key': 14},
                                      {'value': 15, 'key': 15},
                                      {'value': 16, 'key': 16},
                                      {'value': 17, 'key': 17},
                                      {'value': 18, 'key': 18},
                                      {'value': 19, 'key': 19},
                                      {'value': 20, 'key': 20},
                                    ]
                                        .map((ExtraBedCount) => DropdownMenuItem(
                                            value: ExtraBedCount["value"],
                                            child: Text(
                                                "${ExtraBedCount["value"]}")))
                                        .toList(),
                                  )),
                            ],
                          )),
                      SizedBox(
                        width: 20,
                      ),
                      Container(
                        width: 100,
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Text(
                              "Nights",
                              style: TextStyle(
                                  fontSize: 15, fontWeight: FontWeight.bold),
                            ),
                            Padding(
                                padding: const EdgeInsets.only(top: 8.0),
                                child: FormBuilderDropdown(
                                  name: "RoomNightsCount${hotelIndex}",
                                  decoration: InputDecoration(
                                      border: OutlineInputBorder(
                                          borderRadius:
                                              BorderRadius.circular(10)),
                                      isDense: true,
                                      contentPadding: EdgeInsets.all(13),
                                      filled: true,
                                      hintText: "Count"),
                                  items: [
                                    {'value': 1, 'key': 1},
                                    {'value': 2, 'key': 2},
                                    {'value': 3, 'key': 3},
                                    {'value': 4, 'key': 4},
                                    {'value': 5, 'key': 5},
                                    {'value': 6, 'key': 6},
                                    {'value': 7, 'key': 7},
                                    {'value': 8, 'key': 8},
                                    {'value': 9, 'key': 9},
                                    {'value': 10, 'key': 10},
                                    {'value': 11, 'key': 11},
                                    {'value': 12, 'key': 12},
                                    {'value': 13, 'key': 13},
                                    {'value': 14, 'key': 14},
                                    {'value': 15, 'key': 15},
                                    {'value': 16, 'key': 16},
                                    {'value': 17, 'key': 17},
                                    {'value': 18, 'key': 18},
                                    {'value': 19, 'key': 19},
                                    {'value': 20, 'key': 20},
                                  ]
                                      .map((RoomNightsCount) => DropdownMenuItem(
                                          value: RoomNightsCount["value"],
                                          child: Text(
                                              "${RoomNightsCount["value"]}")))
                                      .toList(),
                                )),
                          ],
                        ),
                      ),
                    ],
                  )),

              SizedBox(
                width: 20,
              ),
              // Room Cost / extra bed cost
              Flexible(
                  flex: 1,
                  child: Row(
                    children: [
                      Flexible(
                          child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            "Room Cost",
                            style: TextStyle(
                                fontSize: 15, fontWeight: FontWeight.bold),
                          ),
                          Padding(
                            padding: const EdgeInsets.only(top: 8.0),
                            child: FormBuilderTextField(
                              name: "RoomCost${hotelIndex}",
                              decoration: InputDecoration(
                                  border: OutlineInputBorder(
                                      borderRadius: BorderRadius.circular(10)),
                                  isDense: true,
                                  filled: true,
                                  hintText: "Per Night Cost"),
                            ),
                          ),
                        ],
                      )),
                      SizedBox(
                        width: 20,
                      ),
                      Flexible(
                          child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            "Cost Extra Bed",
                            style: TextStyle(
                                fontSize: 15, fontWeight: FontWeight.bold),
                          ),
                          Padding(
                            padding: const EdgeInsets.only(top: 8.0),
                            child: FormBuilderTextField(
                              name: "ExtraBedCost${hotelIndex}",
                              decoration: InputDecoration(
                                  border: OutlineInputBorder(
                                      borderRadius: BorderRadius.circular(10)),
                                  isDense: true,
                                  filled: true,
                                  hintText: "Per Night Cost"),
                            ),
                          ),
                        ],
                      )),
                    ],
                  ))
            ],
          ),
        ),
      ));
    });
  }

// calling this button i can remove the row
  removeHotel() {
    if (hotel.isNotEmpty) {
      setState(() {
        hotelIndex--;
        hotel.removeLast();
      });
    }
  }

// Now i want to creat a function which can read the values of some textFields from all added rows and do some calculation and give the result
// ( RoomCount * RoomCost + ExtraBedCount * ExtraBedCost ) * RoomNightsCount = TotalHotelCost this from each row and to add all rows total cost togeater and the give a final cost

// This is how I am displaying it

Container(
          decoration: BoxDecoration(border: Border.all(color: Colors.black)),
          child: Padding(
            padding: const EdgeInsets.all(15.0),
            child: Column(children: [
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Container(
                    child: Text(
                      "Add Hotels: ",
                      style:
                          TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
                    ),
                  ),
                  Row(
                    children: [
                      Container(
                        child: TextButton(
                            style: ElevatedButton.styleFrom(
                              primary: Colors.red.shade900,
                              onPrimary: Colors.white,
                              side: const BorderSide(
                                  width: 0.5, color: Colors.white),
                              shape: RoundedRectangleBorder(
                                  borderRadius: BorderRadius.circular(12)),
                            ),
                            onPressed: () {
                              addHotel();
                            },
                            child: Text("Add Hotel")),
                      ),
                      SizedBox(
                        width: 10,
                      ),
                      Container(
                        child: TextButton(
                            style: ElevatedButton.styleFrom(
                              primary: Colors.red.shade900,
                              onPrimary: Colors.white,
                              side: const BorderSide(
                                  width: 0.5, color: Colors.white),
                              shape: RoundedRectangleBorder(
                                  borderRadius: BorderRadius.circular(12)),
                            ),
                            onPressed: () {
                              removeHotel();
                            },
                            child: Text("Remove Hotel")),
                      )
                    ],
                  )
                ],
              ),
              SizedBox(
                height: 18,
              ),
              Container(
                decoration:
                    BoxDecoration(border: Border.all(color: Colors.black)),
                child: hotel.isNotEmpty
                    ? Padding(
                        padding: const EdgeInsets.all(10.0),
                        child: Column(children: [
                          ...hotel.map((e) => e).toList(),
                        ]),
                      )
                    : null,
              ),
            ]),
          ),
        ),


问:
Show Modal after form (using Formik) submission before being redirected to payment gateway
I need to show a modal after a form is submitted (used Formik and the code is written in TypeSript), before being redirected to payment page.I used several ways but it still is redirected to payment page after submission and modal is not shown.

I defined 'const [open, setOpen] = useState(false);' in the root function in the same file.
Alert worked but Modal is not shown.

```<code>function ShowModal() {
    setOpen(true);
    const handleClose = () => setOpen(false);
    /* alert(
      "It's working"
    );*/
    return (
      <>
        <Modal
          open={open}
          onClose={handleClose}
          aria-labelledby="modal-modal-title"
          aria-describedby="modal-modal-description"
        >
          <Box sx={style}>
            <Typography id="modal-modal-title" variant="h6" component="h2">
              Text in a modal
            </Typography>
            <Typography id="modal-modal-description" sx={{ mt: 2 }}>
              Duis mollis, est non commodo luctus, nisi erat porttitor ligula.
            </Typography>
          </Box>
        </Modal>
      </>
    );
  }

  const handleSubmit = (values: IValues, { resetForm, setFieldValue }: any) => {
    setFormsIsSubmitting(true);
    setReserve(generateSetReserveDto(values))
      .then((data: AxiosResponse) => {
        if (values.type !== "hozori" && values.type !== null) {

          ShowModal();
          resetForm();
          SuccessData("...");
          let url = ``;
          window?.open(url, "_blank")?.focus();
        } else {
          resetForm();
          SuccessData("...");
        }
      })
      .finally(() => setFormsIsSubmitting(false));
  };
</code>```

.
.
.

```<code>                    <Formik
                      initialValues={initialValue}
                      validationSchema={schemaOnline}
                      enableReinitialize
                      onSubmit={(values, { resetForm, setFieldValue }) =>
                        handleSubmit(values, { resetForm, setFieldValue })
                      }
                    >
                      {(formikProps) => (
                        <Form>
                          <FormHandlerOnline
                            isLoading={formsIsSubmitting}
                            {...formikProps}
                            price={price}
                          />
                        </Form>
                      )}
                    </Formik>
</code>```

I tried to show Modal with bootstrap or MUI but I could not get the result. The Modal does not popup.
How can it be done?

Body:
I need to show a modal after a form is submitted (used Formik and the code is written in TypeSript), before being redirected to payment page.I used several ways but it still is redirected to payment page after submission and modal is not shown.

I defined 'const [open, setOpen] = useState(false);' in the root function in the same file.
Alert worked but Modal is not shown.

function ShowModal() {
    setOpen(true);
    const handleClose = () => setOpen(false);
    /* alert(
      "It's working"
    );*/
    return (
      <>
        <Modal
          open={open}
          onClose={handleClose}
          aria-labelledby="modal-modal-title"
          aria-describedby="modal-modal-description"
        >
          <Box sx={style}>
            <Typography id="modal-modal-title" variant="h6" component="h2">
              Text in a modal
            </Typography>
            <Typography id="modal-modal-description" sx={{ mt: 2 }}>
              Duis mollis, est non commodo luctus, nisi erat porttitor ligula.
            </Typography>
          </Box>
        </Modal>
      </>
    );
  }

  const handleSubmit = (values: IValues, { resetForm, setFieldValue }: any) => {
    setFormsIsSubmitting(true);
    setReserve(generateSetReserveDto(values))
      .then((data: AxiosResponse) => {
        if (values.type !== "hozori" && values.type !== null) {

          ShowModal();
          resetForm();
          SuccessData("...");
          let url = ``;
          window?.open(url, "_blank")?.focus();
        } else {
          resetForm();
          SuccessData("...");
        }
      })
      .finally(() => setFormsIsSubmitting(false));
  };

.
.
.

                    <Formik
                      initialValues={initialValue}
                      validationSchema={schemaOnline}
                      enableReinitialize
                      onSubmit={(values, { resetForm, setFieldValue }) =>
                        handleSubmit(values, { resetForm, setFieldValue })
                      }
                    >
                      {(formikProps) => (
                        <Form>
                          <FormHandlerOnline
                            isLoading={formsIsSubmitting}
                            {...formikProps}
                            price={price}
                          />
                        </Form>
                      )}
                    </Formik>

I tried to show Modal with bootstrap or MUI but I could not get the result. The Modal does not popup.
How can it be done?


问:
Google Play: Unable to verify core functionality of app: Video Error
I'm trying to submit my app to play for the first time

Does my app use permissions like: Read Call Log... for the purpose of identifying numbers outside the address book and blocking specific numbers

I have checked check in Default Phone handler, Caller ID, spam detection, and blocking in Permissions declaration form.

But google team refused with the reason:

Unable to verify core functionality of app: Video Error

You submitted a permission declaration that specifies the following core
functionality: Default Phone handler (and any other core functionality
usage while default handler). However, the video you submitted does
not demonstrate the functionality necessary to verify and approve your
use case declaration (for example, if your app uses SMS for account
verification, your video should clearly show this). Please re-submit a
Permissions Declaration Form with a corresponding video that
demonstrates the core app functionality in your use case declaration.

My video instructions link: https://drive.google.com/file/d/1UgVrQcasCKCfsSVax1icpEir-lG9E6oq/view?usp=sharing

Can you tell me how my video should meet google's needs, I have spent a lot of time on this problem

Many thanks !


问:
How to port 32-bit DLL definitions to 64-bit?
I have an Application and DLL project that I am trying to port to a 64-bit environment. I ran into an issue with the DLL module definition that would cause linker errors such as the following when compiled with a 64-bit configuration:

```<code>2>mylib.exp : error LNK2001: unresolved external symbol _func_a@4
2>mylib.exp : error LNK2001: unresolved external symbol _func_b@4
</code>```

The header definition for these functions looks like:

```<code>#ifdef MYLIB_DEF
    #define DLLEXPORT __declspec(dllexport)
#else
    #define DLLEXPORT __declspec(dllimport)
#endif

DLLEXPORT extern int variable;
DLLEXPORT int __stdcall func_a(int value);
DLLEXPORT int __stdcall func_b(int value);
</code>```

And in the C source file, it starts with this:

```<code>#define MYLIB_DEF
#include "mylib.h"

DLLEXPORT int variable;

DLLEXPORT int __stdcall func_a(int value)
{
...
</code>```

Now, for the trouble part. We have something like this for the module definition file:

```<code>LIBRARY mylib.dll
EXPORTS
variable DATA
_func_a@4
func_a@4=_func_a@4
func_a=_func_a@4
_func_b@4
func_b@4=_func_a@4
func_b=_func_a@4
</code>```

This triggers the aforementioned errors. I understand that MSVC decorates functions when compiled with __stdcall and 64-bit builds don't use/support __stdcall so there are no decorations. I was able to create an alternate definition file that seems to work like this:

```<code>LIBRARY mylib.dll
EXPORTS
variable DATA
func_a
func_b
</code>```

But, as this file was last touched 10 years ago, I don't know if I understand all the implications or reasoning behind the use of this file. Would something like that file be adequate for 64-bit builds. While our app is the primary user of our DLL, we do have others that interface to the DLL directly so I do not want to break any compatibility, however, we have zero users of a 64-bit version at the moment.

Do we need the definition file at all if we are using __declspec(dllexport) everywhere and not using ordinal exports?

Should we just drop it for 64-bit builds or does it provide any value?

Does dropping it from 32-bit builds as unneeded noise risk breaking any external users? From local testing, it does not seem to be required, but I am doing a full rebuild of the app and DLL.

Why does every function need two additional aliases? Is this standard practice for 32-bit builds? Is there a 64-bit equivalent we should be doing?

I've looked over Microsoft's documentation on the topic, but it says nothing about 64-bit builds versus 32-bit builds:

https://learn.microsoft.com/en-us/cpp/build/reference/exports?view=msvc-170

Body:
I have an Application and DLL project that I am trying to port to a 64-bit environment. I ran into an issue with the DLL module definition that would cause linker errors such as the following when compiled with a 64-bit configuration:

2>mylib.exp : error LNK2001: unresolved external symbol _func_a@4
2>mylib.exp : error LNK2001: unresolved external symbol _func_b@4

The header definition for these functions looks like:

#ifdef MYLIB_DEF
    #define DLLEXPORT __declspec(dllexport)
#else
    #define DLLEXPORT __declspec(dllimport)
#endif

DLLEXPORT extern int variable;
DLLEXPORT int __stdcall func_a(int value);
DLLEXPORT int __stdcall func_b(int value);

And in the C source file, it starts with this:

#define MYLIB_DEF
#include "mylib.h"

DLLEXPORT int variable;

DLLEXPORT int __stdcall func_a(int value)
{
...

Now, for the trouble part. We have something like this for the module definition file:

LIBRARY mylib.dll
EXPORTS
variable DATA
_func_a@4
func_a@4=_func_a@4
func_a=_func_a@4
_func_b@4
func_b@4=_func_a@4
func_b=_func_a@4

This triggers the aforementioned errors. I understand that MSVC decorates functions when compiled with __stdcall and 64-bit builds don't use/support __stdcall so there are no decorations. I was able to create an alternate definition file that seems to work like this:

LIBRARY mylib.dll
EXPORTS
variable DATA
func_a
func_b

But, as this file was last touched 10 years ago, I don't know if I understand all the implications or reasoning behind the use of this file. Would something like that file be adequate for 64-bit builds. While our app is the primary user of our DLL, we do have others that interface to the DLL directly so I do not want to break any compatibility, however, we have zero users of a 64-bit version at the moment.

Do we need the definition file at all if we are using __declspec(dllexport) everywhere and not using ordinal exports?

Should we just drop it for 64-bit builds or does it provide any value?

Does dropping it from 32-bit builds as unneeded noise risk breaking any external users? From local testing, it does not seem to be required, but I am doing a full rebuild of the app and DLL.

Why does every function need two additional aliases? Is this standard practice for 32-bit builds? Is there a 64-bit equivalent we should be doing?

I've looked over Microsoft's documentation on the topic, but it says nothing about 64-bit builds versus 32-bit builds:

https://learn.microsoft.com/en-us/cpp/build/reference/exports?view=msvc-170


问:
How to inject content scripts on source less iframe in firefox?
content scripts is working on chrome but for firefox it is not working

I tired using match_about_blank set to true, but no success, I have seen the documentations on firefox doc but it is not documented properly on how to solve the issue.


问:
Loop through each row and do a price comparison using Python
I am new to python and need some assistance with the code below:

I am reading a CSV file that has a list of supplier items and I am passing the items list to a MySQL query and then writing the final result to a CSV.

The only issue I am having is we have different price breaks in our table for each item based on the quantities, and if the amount given in the CSV file is less than any of the price breaks in the price table. I want to use the CSV amount when writing to the CSV.

Any help or ideas would be greatly appreciated. Thanks

`

```<code>csv_list = []
with open('/mnt/c/ABC/Test/ta.csv') as csv_file:
     csv_reader = csv.DictReader(csv_file)
     for row in csv_reader:
          apn = dict(row)["Supplier Item"]
          csv_list.append("'"+apn+"'")
           apns = ','.join(csv_list)  `
`
stockquery = F"""
SELECT
b.stk_apn_number,
CASE
s.prc_WHOLESALE_PRICE AS '**Price1**',
CASE WHEN s.prc_break_qty2 = s.prc_break_qty1 THEN NULL ELSE s.prc_break_PRICE1 END AS '**Price2**',
CASE WHEN s.prc_break_qty3 = s.prc_break_qty2 THEN NULL ELSE s.prc_break_PRICE2 END AS '**Price3**',
CASE WHEN s.prc_break_qty4 = s.prc_break_qty3 THEN NULL ELSE s.prc_break_PRICE3 END AS '**Price4**',
CASE WHEN s.prc_break_qty4 <> '99999999.0000' THEN s.prc_break_price4 ELSE NULL END AS '**Price5**'
FROM stock AS b
join price s ON b.stock_code = s.stock_code and b.companycode = s.companycode where b.stk_apn_number =
({apns})
"""`
`x  = 'connection string'
engine = create_engine(x)
Session = sessionmaker(bind=engine)
session = Session()
stock = session.execute(stockquery)`

`fh = open('/mnt/c/ABC/Test/data2.csv', 'w')
outcsv = csv.writer(fh)
outcsv.writerow(stock.keys())
outcsv.writerows(stock)
fh.close()`

</code>```

Body:
I am new to python and need some assistance with the code below:

I am reading a CSV file that has a list of supplier items and I am passing the items list to a MySQL query and then writing the final result to a CSV.

The only issue I am having is we have different price breaks in our table for each item based on the quantities, and if the amount given in the CSV file is less than any of the price breaks in the price table. I want to use the CSV amount when writing to the CSV.

Any help or ideas would be greatly appreciated. Thanks

`

csv_list = []
with open('/mnt/c/ABC/Test/ta.csv') as csv_file:
     csv_reader = csv.DictReader(csv_file)
     for row in csv_reader:
          apn = dict(row)["Supplier Item"]
          csv_list.append("'"+apn+"'")
           apns = ','.join(csv_list)  `
`
stockquery = F"""
SELECT
b.stk_apn_number,
CASE
s.prc_WHOLESALE_PRICE AS '**Price1**',
CASE WHEN s.prc_break_qty2 = s.prc_break_qty1 THEN NULL ELSE s.prc_break_PRICE1 END AS '**Price2**',
CASE WHEN s.prc_break_qty3 = s.prc_break_qty2 THEN NULL ELSE s.prc_break_PRICE2 END AS '**Price3**',
CASE WHEN s.prc_break_qty4 = s.prc_break_qty3 THEN NULL ELSE s.prc_break_PRICE3 END AS '**Price4**',
CASE WHEN s.prc_break_qty4 <> '99999999.0000' THEN s.prc_break_price4 ELSE NULL END AS '**Price5**'
FROM stock AS b
join price s ON b.stock_code = s.stock_code and b.companycode = s.companycode where b.stk_apn_number =
({apns})
"""`
`x  = 'connection string'
engine = create_engine(x)
Session = sessionmaker(bind=engine)
session = Session()
stock = session.execute(stockquery)`

`fh = open('/mnt/c/ABC/Test/data2.csv', 'w')
outcsv = csv.writer(fh)
outcsv.writerow(stock.keys())
outcsv.writerows(stock)
fh.close()`


问:
Issue with calculating password age date in Python
I'm rebuilding my PowerShell script with Python.
Sole purpose of that is to easily insert data to Postgre DB tables with Python.
PowerShell script works as it should, but when it comes to Python I encountered a obstacle.

In this loop, I gather all data - most like direct reports from specific AD account. As you may see, I already gather account name, name/surname, e-mail address and password last set date.
The problem is to calculate password age. In PS it was pretty easy, but when I ran a code in Python, I get an Exception has occurred: TypeError can't subtract offset-naive and offset-aware datetimes

Here is the part of the code:

```<code>reports = getDirectReports(managers_name)
for users in reports:
    for user in users.directReports.values:
            if 'cn=ext.' in user.lower():

                user_details = getUserDetails(user)
                print(user_details[0].cn.value)
                print(user_details[0].givenName.value)
                print(user_details[0].sn.value)
                print(user_details[0].pwdLastSet.value)
                print(user_details[0].mail.value)
                current_date = datetime.now()
                start_date = user_details[0].pwdLastSet.value
                if (start_date == 0):
                    password_age = 'NULL'
                else:
                    password_age = current_date - start_date    ```

```

Body:
I'm rebuilding my PowerShell script with Python.
Sole purpose of that is to easily insert data to Postgre DB tables with Python.
PowerShell script works as it should, but when it comes to Python I encountered a obstacle.

In this loop, I gather all data - most like direct reports from specific AD account. As you may see, I already gather account name, name/surname, e-mail address and password last set date.
The problem is to calculate password age. In PS it was pretty easy, but when I ran a code in Python, I get an Exception has occurred: TypeError can't subtract offset-naive and offset-aware datetimes

Here is the part of the code:

reports = getDirectReports(managers_name)
for users in reports:
    for user in users.directReports.values:
            if 'cn=ext.' in user.lower():

                user_details = getUserDetails(user)
                print(user_details[0].cn.value)
                print(user_details[0].givenName.value)
                print(user_details[0].sn.value)
                print(user_details[0].pwdLastSet.value)
                print(user_details[0].mail.value)
                current_date = datetime.now()
                start_date = user_details[0].pwdLastSet.value
                if (start_date == 0):
                    password_age = 'NULL'
                else:
                    password_age = current_date - start_date    ```