问:
Spark structured streaming loops infinitely over CSV file
I have set up a a structured stream of a CSV file in databricks to a socket. The issue I have is that the stream producer keeps looping over the CSV file and doesn't stop once the file is completely sent. I want the producer to stop sending once all the lines have been processed.

This is the code i am using

```<code>import socket
import time
from datetime import datetime

def send():

  inputFile = "/FileStore/tables/file.csv"

  ifile  = open(inputFile, 'r')
  i = 0

  while True:
    client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    client_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    client_socket.bind(('localhost', 9978))
    client_socket.listen(10)
    conn, addr = client_socket.accept()
    try:
      while True:
        start = time.time()
        ifile  = open(inputFile, 'r')
        for row in ifile.readlines() :
          print("sending: "+ row.rstrip() + "," + str(datetime.now()))
          message = row.rstrip() + ',' + str(datetime.now()) + "\n"
          message = message.encode()
          conn.send(message)
          time.sleep(2)

    except Exception as e:
        print(str(e))
        conn.close()
        client_socket.close()
        continue
    finally:
        conn.close()
        client_socket.close()
send()
</code>```

Body:
I have set up a a structured stream of a CSV file in databricks to a socket. The issue I have is that the stream producer keeps looping over the CSV file and doesn't stop once the file is completely sent. I want the producer to stop sending once all the lines have been processed.

This is the code i am using

import socket
import time
from datetime import datetime

def send():

  inputFile = "/FileStore/tables/file.csv"

  ifile  = open(inputFile, 'r')
  i = 0

  while True:
    client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    client_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    client_socket.bind(('localhost', 9978))
    client_socket.listen(10)
    conn, addr = client_socket.accept()
    try:
      while True:
        start = time.time()
        ifile  = open(inputFile, 'r')
        for row in ifile.readlines() :
          print("sending: "+ row.rstrip() + "," + str(datetime.now()))
          message = row.rstrip() + ',' + str(datetime.now()) + "\n"
          message = message.encode()
          conn.send(message)
          time.sleep(2)

    except Exception as e:
        print(str(e))
        conn.close()
        client_socket.close()
        continue
    finally:
        conn.close()
        client_socket.close()
send()


来源: stackexchange

问:
How to display error message if upload more than specific size Reactjs
I am working on Reactjs,I want if someone upload more than "100*100"(dynamic pixels)
then user should get "Error/warning message",how can i do this ?
Here is my current code</p>
```<code><OfficerImageUpload
                src={imgSrc ? imgSrc : DefaultProfilePic}
                alt="Officer Img for Add Officer"
                type="file"
                placeholder="No file choosen"
                name="header"
                onChange={handleNewOfficerDataChange}
                imgSrcAlt="Upload Cover Photo"
              />
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am working on Reactjs,I want if someone upload more than "100*100"(dynamic pixels)
then user should get "Error/warning message",how can i do this ?
Here is my current code

<OfficerImageUpload
                src={imgSrc ? imgSrc : DefaultProfilePic}
                alt="Officer Img for Add Officer"
                type="file"
                placeholder="No file choosen"
                name="header"
                onChange={handleNewOfficerDataChange}
                imgSrcAlt="Upload Cover Photo"
              />


问:
Scientific visualization in Android
I would like to visualize mesh-based scientific data on Android device as can typically done with VTK/Paraview on PC. My preference is ease of use and robustness. I research on the web and see that VTK has quite a poor support for mobile application. Do you have suggestion for an alternative?</p>

Title: Scientific visualization in Android


问:
DotNet: Using Dependencies from imported library project
I'm using Hangfire in a project (but this question applies to any dependency).
I have a HangfireHelpers project that I use to prevent repeating myself. It imports all the Hangfire packages it needs.

My Question is this:

If I want to add extra Hangfire functionality to the main project I seem to have access to all the Hangfire packages that HangfireHelpers uses.

Is this normal/best practice or should I be also importing the necessary Hangfire packages directly into the main library?


问:
Kotlin with Spring Native and Spring GraphQL - found 2 constructors for class
I'm trying to use Spring Native with Spring GraphQL.

Problem

When specifying @Argument with data class, an error occurs.

(Note that even if UserListInput is a regular class (non-data class), the result is same)

data class UserListInput(
    val pageNumber: Int,
    val pageSize: Int,
    val sortBy: UserSortBy = UserSortBy.ID,
    val sortDirection: SortDirection = SortDirection.ASCENDING,
    val keyword: String?
)

@Controller
class UserController(...) {
    suspend fun users(dfe: DataFetchingEnvironment, @Argument input: UserListInput): UserListResponse {
        // .....
    }
}
```
<p>Then I query with these query</p>
```query Query {
  users(input: { pageSize: 50, pageNumber: 1 }) {
    totalCount
      nodes {
        id
        lastName
        firstName
        email
        role
      }
    }
  }
}
```
<p>This will cause error</p>
```java.lang.IllegalStateException: No primary or single unique constructor found for class application.controller.graphql.entity.UserListInput
    at org.springframework.beans.BeanUtils.getResolvableConstructor(BeanUtils.java:266)
    at org.springframework.graphql.data.GraphQlArgumentBinder.bindMap(GraphQlArgumentBinder.java:232)
    at org.springframework.graphql.data.GraphQlArgumentBinder.bindRawValue(GraphQlArgumentBinder.java:181)
    at org.springframework.graphql.data.GraphQlArgumentBinder.bind(GraphQlArgumentBinder.java:132)
    at org.springframework.graphql.data.method.annotation.support.ArgumentMethodArgumentResolver.resolveArgument(ArgumentMethodArgumentResolver.java:73)
    at org.springframework.graphql.data.method.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:83)
    at org.springframework.graphql.data.method.annotation.support.DataFetcherHandlerMethod.getMethodArgumentValues(DataFetcherHandlerMethod.java:173)
    at org.springframework.graphql.data.method.annotation.support.DataFetcherHandlerMethod.invoke(DataFetcherHandlerMethod.java:118)
    at org.springframework.graphql.data.method.annotation.support.AnnotatedControllerConfigurer$SchemaMappingDataFetcher.get(AnnotatedControllerConfigurer.java:529)
    at org.springframework.graphql.execution.ContextDataFetcherDecorator.lambda$get$0(ContextDataFetcherDecorator.java:74)
    at io.micrometer.context.ContextSnapshot.lambda$wrap$1(ContextSnapshot.java:92)
    at org.springframework.graphql.execution.ContextDataFetcherDecorator.get(ContextDataFetcherDecorator.java:74)
    at graphql.execution.ExecutionStrategy.fetchField(ExecutionStrategy.java:282)
    at graphql.execution.ExecutionStrategy.resolveFieldWithInfo(ExecutionStrategy.java:211)
    at graphql.execution.AsyncExecutionStrategy.execute(AsyncExecutionStrategy.java:59)
    at graphql.execution.Execution.executeOperation(Execution.java:159)
    at graphql.execution.Execution.execute(Execution.java:105)
    at graphql.GraphQL.execute(GraphQL.java:645)
    at graphql.GraphQL.lambda$parseValidateAndExecute$11(GraphQL.java:564)
    at graphql.GraphQL.parseValidateAndExecute(GraphQL.java:559) [2 skipped]
    at graphql.GraphQL.executeAsync(GraphQL.java:527)
    at org.springframework.graphql.execution.DefaultExecutionGraphQlService.lambda$execute$2(DefaultExecutionGraphQlService.java:82)
    at reactor.core.publisher.MonoDeferContextual.subscribe(MonoDeferContextual.java:47)
    at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
    at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:165)
    at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79)
    at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79)
    at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:158)
    at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107)
    at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onNext(FluxMapFuseable.java:299)
    at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onNext(FluxFilterFuseable.java:337)
    at reactor.core.publisher.Operators$BaseFluxToMonoOperator.completePossiblyEmpty(Operators.java:2071)
    at reactor.core.publisher.MonoCollect$CollectSubscriber.onComplete(MonoCollect.java:145)
    at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)
    at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:260)
    at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)
    at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:413)
    at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:426)
    at reactor.netty.http.server.HttpServerOperations.onInboundNext(HttpServerOperations.java:621)
    at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:113)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at reactor.netty.http.server.HttpTrafficHandler.channelRead(HttpTrafficHandler.java:269)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
    at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775) [1 skipped]
    at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)
```
<p>How can I resolve on this?</p>
<p>Versions:</p>
<ul>
<li>Spring Boot: 3.0.1</li>
<li>Spring GraphQL: 1.1.1</li>
</ul>
<hr />
<h2>Investigation</h2>
<p>I tried to find a constructor based on org.springframework.beans.BeanUtils.getResolvableConstructor, that is the error cause.</p>
<pre class="lang-kotlin prettyprint-override"><code>val clazz = UserListInput::class.java
var ctor = BeanUtils.findPrimaryConstructor(clazz)
if (ctor != null) {
    logger.info("Found primary constructor: $ctor")
} else {
    var ctors = clazz.constructors
    if (ctors.size == 1) {
        logger.info("Found single constructor: ${ctors[0]}")
    } else if (ctors.isEmpty()) {
        ctors = clazz.declaredConstructors
        if (ctors.size == 1) {
            logger.info("Found single declared constructor: : ${ctors[0]}")
        } else {
            logger.info("Declared constructor size: ${ctors.size}")
        }
    } else {
        logger.info("Constructor size: ${ctors.size}")
        ctors.forEach {
            logger.info("  Ctor = $it")
            it.parameters.forEachIndexed { index, parameter ->
                logger.info("    [$index] = ${parameter.name}: ${parameter.type}")
            }
        }

        try {
            ctor = clazz.getDeclaredConstructor()
            logger.info("Found single declared constructor (tried): $ctor")
        } catch (e: NoSuchMethodException) {
            logger.warn("No constructors found")
        }
    }
}
</code>```

To run with this code, I found that there are 2 constructors when running with native binary, even if only 1 constructor when running with JVM.

When running with JVM: It's okay (Matched with class definition)

```<code>Found primary constructor: public application.controller.graphql.entity.UserListInput(int,int,domain.common.entity.UserSortBy,domain.entity.SortDirection,java.lang.String)
</code>```

When running with native: Suspicious (Found one another constructor)

```<code>Constructor size: 2
  Ctor = public application.controller.graphql.entity.UserListInput(int,int,domain.common.entity.UserSortBy,domain.entity.SortDirection,java.lang.String)
    [0] = pageNumber: int
    [1] = pageSize: int
    [2] = sortBy: class domain.common.entity.UserSortBy
    [3] = sortDirection: class domain.entity.SortDirection
    [4] = keyword: class java.lang.String
  Ctor = public application.controller.graphql.entity.UserListInput(int,int,domain.common.entity.UserSortBy,domain.entity.SortDirection,java.lang.String,int,kotlin.jvm.internal.DefaultConstructorMarker)
    [0] = arg0: int
    [1] = arg1: int
    [2] = arg2: class domain.common.entity.UserSortBy
    [3] = arg3: class domain.entity.SortDirection
    [4] = arg4: class java.lang.String
    [5] = arg5: int
    [6] = arg6: class kotlin.jvm.internal.DefaultConstructorMarker
No constructors found
</code>```

I'm not sure what is the second constructors with additional 2 arguments (arg5 and arg6).

-> Maybe this?

When finding constructor that won't use with @Argument it works.

(UserListResponse is a returning type of users method)

data class UserListResponse(
    val totalCount: Int,
    val totalPages: Int,
    val currentPage: Int,
    val nodes: List<User>,
)
```
```Found single constructor: public application.controller.graphql.entity.UserListResponse(int,int,int,java.util.List)
```

Body:
I'm trying to use Spring Native with Spring GraphQL.

Problem

When specifying @Argument with data class, an error occurs.

(Note that even if UserListInput is a regular class (non-data class), the result is same)

data class UserListInput(
    val pageNumber: Int,
    val pageSize: Int,
    val sortBy: UserSortBy = UserSortBy.ID,
    val sortDirection: SortDirection = SortDirection.ASCENDING,
    val keyword: String?
)

@Controller
class UserController(...) {
    suspend fun users(dfe: DataFetchingEnvironment, @Argument input: UserListInput): UserListResponse {
        // .....
    }
}

Then I query with these query

query Query {
  users(input: { pageSize: 50, pageNumber: 1 }) {
    totalCount
      nodes {
        id
        lastName
        firstName
        email
        role
      }
    }
  }
}

This will cause error

java.lang.IllegalStateException: No primary or single unique constructor found for class application.controller.graphql.entity.UserListInput
    at org.springframework.beans.BeanUtils.getResolvableConstructor(BeanUtils.java:266)
    at org.springframework.graphql.data.GraphQlArgumentBinder.bindMap(GraphQlArgumentBinder.java:232)
    at org.springframework.graphql.data.GraphQlArgumentBinder.bindRawValue(GraphQlArgumentBinder.java:181)
    at org.springframework.graphql.data.GraphQlArgumentBinder.bind(GraphQlArgumentBinder.java:132)
    at org.springframework.graphql.data.method.annotation.support.ArgumentMethodArgumentResolver.resolveArgument(ArgumentMethodArgumentResolver.java:73)
    at org.springframework.graphql.data.method.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:83)
    at org.springframework.graphql.data.method.annotation.support.DataFetcherHandlerMethod.getMethodArgumentValues(DataFetcherHandlerMethod.java:173)
    at org.springframework.graphql.data.method.annotation.support.DataFetcherHandlerMethod.invoke(DataFetcherHandlerMethod.java:118)
    at org.springframework.graphql.data.method.annotation.support.AnnotatedControllerConfigurer$SchemaMappingDataFetcher.get(AnnotatedControllerConfigurer.java:529)
    at org.springframework.graphql.execution.ContextDataFetcherDecorator.lambda$get$0(ContextDataFetcherDecorator.java:74)
    at io.micrometer.context.ContextSnapshot.lambda$wrap$1(ContextSnapshot.java:92)
    at org.springframework.graphql.execution.ContextDataFetcherDecorator.get(ContextDataFetcherDecorator.java:74)
    at graphql.execution.ExecutionStrategy.fetchField(ExecutionStrategy.java:282)
    at graphql.execution.ExecutionStrategy.resolveFieldWithInfo(ExecutionStrategy.java:211)
    at graphql.execution.AsyncExecutionStrategy.execute(AsyncExecutionStrategy.java:59)
    at graphql.execution.Execution.executeOperation(Execution.java:159)
    at graphql.execution.Execution.execute(Execution.java:105)
    at graphql.GraphQL.execute(GraphQL.java:645)
    at graphql.GraphQL.lambda$parseValidateAndExecute$11(GraphQL.java:564)
    at graphql.GraphQL.parseValidateAndExecute(GraphQL.java:559) [2 skipped]
    at graphql.GraphQL.executeAsync(GraphQL.java:527)
    at org.springframework.graphql.execution.DefaultExecutionGraphQlService.lambda$execute$2(DefaultExecutionGraphQlService.java:82)
    at reactor.core.publisher.MonoDeferContextual.subscribe(MonoDeferContextual.java:47)
    at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
    at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:165)
    at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79)
    at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79)
    at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:158)
    at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107)
    at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onNext(FluxMapFuseable.java:299)
    at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onNext(FluxFilterFuseable.java:337)
    at reactor.core.publisher.Operators$BaseFluxToMonoOperator.completePossiblyEmpty(Operators.java:2071)
    at reactor.core.publisher.MonoCollect$CollectSubscriber.onComplete(MonoCollect.java:145)
    at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)
    at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:260)
    at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)
    at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:413)
    at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:426)
    at reactor.netty.http.server.HttpServerOperations.onInboundNext(HttpServerOperations.java:621)
    at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:113)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at reactor.netty.http.server.HttpTrafficHandler.channelRead(HttpTrafficHandler.java:269)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
    at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775) [1 skipped]
    at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)

How can I resolve on this?

Versions:

Spring Boot: 3.0.1

Spring GraphQL: 1.1.1

Investigation

I tried to find a constructor based on org.springframework.beans.BeanUtils.getResolvableConstructor, that is the error cause.

val clazz = UserListInput::class.java
var ctor = BeanUtils.findPrimaryConstructor(clazz)
if (ctor != null) {
    logger.info("Found primary constructor: $ctor")
} else {
    var ctors = clazz.constructors
    if (ctors.size == 1) {
        logger.info("Found single constructor: ${ctors[0]}")
    } else if (ctors.isEmpty()) {
        ctors = clazz.declaredConstructors
        if (ctors.size == 1) {
            logger.info("Found single declared constructor: : ${ctors[0]}")
        } else {
            logger.info("Declared constructor size: ${ctors.size}")
        }
    } else {
        logger.info("Constructor size: ${ctors.size}")
        ctors.forEach {
            logger.info("  Ctor = $it")
            it.parameters.forEachIndexed { index, parameter ->
                logger.info("    [$index] = ${parameter.name}: ${parameter.type}")
            }
        }

        try {
            ctor = clazz.getDeclaredConstructor()
            logger.info("Found single declared constructor (tried): $ctor")
        } catch (e: NoSuchMethodException) {
            logger.warn("No constructors found")
        }
    }
}

To run with this code, I found that there are 2 constructors when running with native binary, even if only 1 constructor when running with JVM.

When running with JVM: It's okay (Matched with class definition)

Found primary constructor: public application.controller.graphql.entity.UserListInput(int,int,domain.common.entity.UserSortBy,domain.entity.SortDirection,java.lang.String)

When running with native: Suspicious (Found one another constructor)

Constructor size: 2
  Ctor = public application.controller.graphql.entity.UserListInput(int,int,domain.common.entity.UserSortBy,domain.entity.SortDirection,java.lang.String)
    [0] = pageNumber: int
    [1] = pageSize: int
    [2] = sortBy: class domain.common.entity.UserSortBy
    [3] = sortDirection: class domain.entity.SortDirection
    [4] = keyword: class java.lang.String
  Ctor = public application.controller.graphql.entity.UserListInput(int,int,domain.common.entity.UserSortBy,domain.entity.SortDirection,java.lang.String,int,kotlin.jvm.internal.DefaultConstructorMarker)
    [0] = arg0: int
    [1] = arg1: int
    [2] = arg2: class domain.common.entity.UserSortBy
    [3] = arg3: class domain.entity.SortDirection
    [4] = arg4: class java.lang.String
    [5] = arg5: int
    [6] = arg6: class kotlin.jvm.internal.DefaultConstructorMarker
No constructors found

I'm not sure what is the second constructors with additional 2 arguments (arg5 and arg6).

-> Maybe this?

When finding constructor that won't use with @Argument it works.

(UserListResponse is a returning type of users method)

data class UserListResponse(
    val totalCount: Int,
    val totalPages: Int,
    val currentPage: Int,
    val nodes: List<User>,
)

Found single constructor: public application.controller.graphql.entity.UserListResponse(int,int,int,java.util.List)


问:
The emulator process was terminated
I have done everything found on google/forums but still nothing worked out, I have gone through almost every forum and video

https://www.youtube.com/watch?v=bOURCXjmXlg

https://www.youtube.com/watch?app=desktop&v=BFdBLKTiDw0

https://www.youtube.com/watch?v=zng2ALbPvqc

these were some of the many resources I just gone through

I have one gb free space on my drive

hope you guys could help

im using windows 10

thanks

https://www.youtube.com/watch?v=bOURCXjmXlg

https://www.youtube.com/watch?app=desktop&v=BFdBLKTiDw0

https://www.youtube.com/watch?v=zng2ALbPvqc

these were some of the resources I just gone through

Title: The emulator process was terminated


问:
Tesseract Command Line Stdin Multiple Buffer
Is it possible to pass an array of Buffer's thru stdin to tesseract command-line to process them at once? This works with existing files yet not with buffers.</p>


问:
ngOnInit called multiple times after database changes in Angular and Typescript
I have an app which is removing records from a Firestore database when the user clicks a button.  On console I can see that ngOnInit is being called once with the old data and then twice with the new updated data.  I am pushing these responses to an array so I end up with an array with 3 values instead of 1.

I have tried to pipe the subscribed data to take(1) but obviously it's returning the first one which is the old data before the change. I'm trying to implement onPush but I'm just getting a blank page.

swap-requests.html

```<code><ion-content>
  <ion-grid class="ion-grid-width-md" *ngIf="user" >
    <tr *ngFor="let swaps of userSwapRequests;">
      <ion-row class="ion-padding" size="auto">
        <ion-col>
          <td *ngFor="let user of swaps.userCard">
            <ion-img [src]="user.images.small"
                     style="background: #F2F2F2;"></ion-img>
          </td>
        </ion-col>
        <ion-col>
          <td *ngFor="let friend of swaps.friendCard">
            <ion-img [src]="friend.images.small"
                     style="background: #F2F2F2;"></ion-img>
            </td>
        </ion-col>
      </ion-row>
<ion-row>
          <ion-button expand="block" color="danger" (click)="cancelSwap(swaps.swapData, swaps)">Cancel Swap</ion-button>
        </ion-col>
      </ion-row>
</ion-grid>
</ion-content>
</code>```

swap-requests.page.ts

```<code>
@Component({
  selector: 'app-swap-requests',
  templateUrl: './swap-requests.page.html',
  styleUrls: ['./swap-requests.page.scss'],
})

export class SwapRequestsPage implements OnInit {
  user: any[] = [];
  userSwapRequests: any[] = [];
  currentFriend: User[] = [];
  swapArray: any[] = [];

  constructor(
    private dataService: DataService,
    private pokeService: PokemoncardsService,
    private ToastCtrl: ToastController,
  ) {

  }

  ngOnInit() {
    this.dataService.loadUser(environment.currentUser).pipe(take(1)).subscribe((res: User[]) => {
      this.user.push(res);
      console.log('user', this.user);

      this.getUserPendingRequests();
    });
  }

  // get requests made by friends
  getUserPendingRequests() {
    this.userSwapRequests = [];

    let userSwapsList = this.user.map(data => data.swap_request);

    this.buildSwapArray(this.userSwapRequests, userSwapsList);
  }

  getFriend(value: any) {
    let friend: any[] = [];

    this.dataService.loadUser(value).subscribe((res: User[]) => {
      friend.push(res);
    });
    return friend;
  }

  getPokemonCard(number: any) {
    let result: any = [];
    this.pokeService.getPokeCard(number).subscribe(res => {
      result.push(res);
    });
    return result;
  }

  // create new array with API responses and friend's data
  async buildSwapArray(swaplist: any, userList: any) {

    userList.forEach((array: any) => {
      array.forEach((swap: any) => {
        let card: any;
        let usercard: any;
        let friend: any;

        Object.entries(swap).find(([key, value]) => {
          if (key === 'friend_card') {
            card = this.getPokemonCard(value);

          }
          if (key === 'user_card') {
            usercard = this.getPokemonCard(value);;
          }
          if (key === 'friend_id') {
            friend = this.getFriend(value);
          }
        })
        let newArray = {
          'friendCard': card,
          'userCard': usercard,
          'friend': friend,
          'swapData': swap,
        }
        swaplist.push(newArray);
        console.log('swapArray', this.userSwapRequests);
      })
    })
  }

  async cancelSwap(swapArray: any) {
    console.log('swapArray', swapArray);
    this.dataService.deleteSwapRequest(swapArray);

    let id = this.user.map(data => data.id);
    let friend: any;
    id.forEach((array) => {
      friend = array;
    })

    let friendArray: any = {
      'friend_card': swapArray.user_card,
      'friend_id': friend,
      'user_card': swapArray.friend_card,
    }
    let friendId = swapArray.friend_id;
    this.dataService.deleteFriendSwapRequest(friendArray, friendId);

    console.log('testsplice', this.userSwapRequests);
    const toast = await this.ToastCtrl.create({
      message: 'Swap confirmed',
      duration: 2000
    });
    toast.present();
  }

</code>```

DataService:

```<code>export class User {
  id?: string;
  cards: [] = [];
  user_name: string | undefined;
  friends: [] = [];
  wishlist: [] = [];
  swaps: [] = [];
  pending_swap: [] = [];
  avatar: string | undefined;
  swap_request: [] = [];
  confirmed_swap: [] = [];
}

@Injectable({
  providedIn: 'root'
})
export class DataService {
  constructor(private firestore: Firestore) { }

  loadUser(id: any): Observable<User[]> {
    const result = doc(this.firestore, `users/${id}`);
    return docData(result, { idField: 'id' }) as Observable<User[]>;
  }

  deleteSwapRequest(swapRequest: any) {
    const cardsIdRef = doc(this.firestore, `users/${environment.currentUser}`);
    return updateDoc(cardsIdRef, {
      swap_request: arrayRemove(swapRequest)
    });
  }

  deleteFriendSwapRequest(swapRequest: any, friend:any) {
    const cardsIdRef = doc(this.firestore, `users/${friend}`);
    return updateDoc(cardsIdRef, {
      pending_swap: arrayRemove(swapRequest)
    });
  }
</code>```

Body:
I have an app which is removing records from a Firestore database when the user clicks a button.  On console I can see that ngOnInit is being called once with the old data and then twice with the new updated data.  I am pushing these responses to an array so I end up with an array with 3 values instead of 1.

I have tried to pipe the subscribed data to take(1) but obviously it's returning the first one which is the old data before the change. I'm trying to implement onPush but I'm just getting a blank page.

swap-requests.html

<ion-content>
  <ion-grid class="ion-grid-width-md" *ngIf="user" >

      <ion-row class="ion-padding" size="auto">
        <ion-col>

            <ion-img [src]="user.images.small"
                     style="background: #F2F2F2;"></ion-img>

        </ion-col>
        <ion-col>

            <ion-img [src]="friend.images.small"
                     style="background: #F2F2F2;"></ion-img>

        </ion-col>
      </ion-row>
<ion-row>
          <ion-button expand="block" color="danger" (click)="cancelSwap(swaps.swapData, swaps)">Cancel Swap</ion-button>
        </ion-col>
      </ion-row>
</ion-grid>
</ion-content>

swap-requests.page.ts

@Component({
  selector: 'app-swap-requests',
  templateUrl: './swap-requests.page.html',
  styleUrls: ['./swap-requests.page.scss'],
})

export class SwapRequestsPage implements OnInit {
  user: any[] = [];
  userSwapRequests: any[] = [];
  currentFriend: User[] = [];
  swapArray: any[] = [];

  constructor(
    private dataService: DataService,
    private pokeService: PokemoncardsService,
    private ToastCtrl: ToastController,
  ) {

  }

  ngOnInit() {
    this.dataService.loadUser(environment.currentUser).pipe(take(1)).subscribe((res: User[]) => {
      this.user.push(res);
      console.log('user', this.user);

      this.getUserPendingRequests();
    });
  }

  // get requests made by friends
  getUserPendingRequests() {
    this.userSwapRequests = [];

    let userSwapsList = this.user.map(data => data.swap_request);

    this.buildSwapArray(this.userSwapRequests, userSwapsList);
  }

  getFriend(value: any) {
    let friend: any[] = [];

    this.dataService.loadUser(value).subscribe((res: User[]) => {
      friend.push(res);
    });
    return friend;
  }

  getPokemonCard(number: any) {
    let result: any = [];
    this.pokeService.getPokeCard(number).subscribe(res => {
      result.push(res);
    });
    return result;
  }

  // create new array with API responses and friend's data
  async buildSwapArray(swaplist: any, userList: any) {

    userList.forEach((array: any) => {
      array.forEach((swap: any) => {
        let card: any;
        let usercard: any;
        let friend: any;

        Object.entries(swap).find(([key, value]) => {
          if (key === 'friend_card') {
            card = this.getPokemonCard(value);

          }
          if (key === 'user_card') {
            usercard = this.getPokemonCard(value);;
          }
          if (key === 'friend_id') {
            friend = this.getFriend(value);
          }
        })
        let newArray = {
          'friendCard': card,
          'userCard': usercard,
          'friend': friend,
          'swapData': swap,
        }
        swaplist.push(newArray);
        console.log('swapArray', this.userSwapRequests);
      })
    })
  }

  async cancelSwap(swapArray: any) {
    console.log('swapArray', swapArray);
    this.dataService.deleteSwapRequest(swapArray);

    let id = this.user.map(data => data.id);
    let friend: any;
    id.forEach((array) => {
      friend = array;
    })

    let friendArray: any = {
      'friend_card': swapArray.user_card,
      'friend_id': friend,
      'user_card': swapArray.friend_card,
    }
    let friendId = swapArray.friend_id;
    this.dataService.deleteFriendSwapRequest(friendArray, friendId);

    console.log('testsplice', this.userSwapRequests);
    const toast = await this.ToastCtrl.create({
      message: 'Swap confirmed',
      duration: 2000
    });
    toast.present();
  }

DataService:

export class User {
  id?: string;
  cards: [] = [];
  user_name: string | undefined;
  friends: [] = [];
  wishlist: [] = [];
  swaps: [] = [];
  pending_swap: [] = [];
  avatar: string | undefined;
  swap_request: [] = [];
  confirmed_swap: [] = [];
}

@Injectable({
  providedIn: 'root'
})
export class DataService {
  constructor(private firestore: Firestore) { }

  loadUser(id: any): Observable<User[]> {
    const result = doc(this.firestore, `users/${id}`);
    return docData(result, { idField: 'id' }) as Observable<User[]>;
  }

  deleteSwapRequest(swapRequest: any) {
    const cardsIdRef = doc(this.firestore, `users/${environment.currentUser}`);
    return updateDoc(cardsIdRef, {
      swap_request: arrayRemove(swapRequest)
    });
  }

  deleteFriendSwapRequest(swapRequest: any, friend:any) {
    const cardsIdRef = doc(this.firestore, `users/${friend}`);
    return updateDoc(cardsIdRef, {
      pending_swap: arrayRemove(swapRequest)
    });
  }


问:
How to use injectRepository in e2e test in nest js
I have service where I use repository like this in constructor
 @InjectRepository(MyRepo, 'dataSource') private myRepo: MyRepo

and everything works well, but when I try to access myRepo in e2e test

myRepo = moduleRef.get<MyRepo>(MyRepo);

const result = myRepo.find(); I got error TypeError: Cannot read properties of undefined (reading 'getRepository')

What should I do to fix this error?


问:
How to use multiple shadow root to render multiple custom element (templates)
I want to render multiple custom element on a page, i Want to be able to click on a button in the first element(mainTemplate), then remove the first element and create the second element on the page, i also want to be able to click on a button on the second element to return on the first element.

I tried to create tree classes for my 3 elements,with the customElement.define methode, i append the first element on the page, then with the event listener on a button(#button) on the first element and with the  remove methode i removed the first element by a click on the button that i listen to, then with the appendchild method i append the second element on the page a redefine the first element(because when i remove it, the class is complety removed from the dom, it works but when i click again on #button i does not work anymore, and i understand why. but i dont know how to make it work

```<code><my-element>
  <template id='firts'>
   <style>some styles</style>
   <div>button with id</div>
  </template>
</my-element>

<my-element2>
  <template id='second'>
   <style>some styles</style>
   <div>button with id</div>
  </template>
</my-element2>

<my-element3>
  <template id='third'>
   <style>some styles</style>
   <div>button with id</div>
  </template>
</my-element3>

<script>
  connectedCallback(){
               "click",(event)=>{
               this.remove(my-element)//this is just an example;
                const element=document.querySelector('my-element2');
                const shadowRoot4= element.attachShadow({mode: 'open'});
                shadowRoot4.appendChild(this.palletteContent.content.cloneNode(true));

                shadowRoot4.querySelector("#button").addEventListener(
                    "click",(event)=>{
                        customElements.define('my-element', myElement);
                        this.myElement2.remove(my-element2)//this is just an example;
                        const element=document.querySelector('my-element')
                        const shadowRoot5= element.attachShadow({mode:'open'});
                        shadowRoot5.appendChild(this.mainTemplate.content.cloneNode(true));
                    }
                )
}
<script>
</code>```

Body:
I want to render multiple custom element on a page, i Want to be able to click on a button in the first element(mainTemplate), then remove the first element and create the second element on the page, i also want to be able to click on a button on the second element to return on the first element.

I tried to create tree classes for my 3 elements,with the customElement.define methode, i append the first element on the page, then with the event listener on a button(#button) on the first element and with the  remove methode i removed the first element by a click on the button that i listen to, then with the appendchild method i append the second element on the page a redefine the first element(because when i remove it, the class is complety removed from the dom, it works but when i click again on #button i does not work anymore, and i understand why. but i dont know how to make it work

<my-element>
  <template id='firts'>

button with id

  </template>
</my-element>

<my-element2>
  <template id='second'>

button with id

  </template>
</my-element2>

<my-element3>
  <template id='third'>

button with id

  </template>
</my-element3>


问:
Rails 7 link_to data disable_with doesn't work
Right now I get quick fix for:

```<code>data: { confirm: 'Are you sure?'}
</code>```

in other question someone give me good answer to addListener in application.js ( not perfect because I can't do nothing more with that link for example in jQuery )

but what with:

```<code>data: { disable_with: 'some text' }
</code>```

for link_to?

Does someone have fix for this?

ONE WAY:

I create something like this in jQuery ( for single button in form_for)

```<code>//AVATAR SUBMIT BUTTON
jQuery('.edit_profile .avatar_submit_button').on('click',function(){
    jQuery(this).text('Loading..');
});
jQuery('.edit_profile ').on('submit', function(){
    jQuery(this).find('.avatar_submit_button').prop('disabled', true);
});

jQuery('.edit_profile #profile_avatar').on('change',function(){
    jQuery('.edit_profile .avatar_submit_button').text('Click to load');
});
</code>```

Body:
Right now I get quick fix for:

data: { confirm: 'Are you sure?'}

in other question someone give me good answer to addListener in application.js ( not perfect because I can't do nothing more with that link for example in jQuery )

but what with:

data: { disable_with: 'some text' }

for link_to?

Does someone have fix for this?

ONE WAY:

I create something like this in jQuery ( for single button in form_for)

//AVATAR SUBMIT BUTTON
jQuery('.edit_profile .avatar_submit_button').on('click',function(){
    jQuery(this).text('Loading..');
});
jQuery('.edit_profile ').on('submit', function(){
    jQuery(this).find('.avatar_submit_button').prop('disabled', true);
});

jQuery('.edit_profile #profile_avatar').on('change',function(){
    jQuery('.edit_profile .avatar_submit_button').text('Click to load');
});


问:
Why mp4 can not shared on Facebook or Instagram on Android?
This is the file: https://t44-post-cover.s3.eu-central-1.amazonaws.com/2e3s.mp4

When I download and try share, it fails. Why? This is the parameters was rendered. Downloading and sharing works from iPhone to Facebook on Messenger or Instagram, but not from Android phone to Facebook on Messenger or Instagram.

What parameters ffpmpeg need to be able to share mp4 from Android to Facebook / Instagram?

await new Promise<void>((resolve, reject) => {
        ffmpeg()
            .setFfmpegPath(pathToFfmpeg)
            .input(`/tmp/input_${imgId}.gif`)
            .inputFormat('gif')
            .inputFPS(30)
            .input('anullsrc')
            .inputFormat('lavfi')
            .audioCodec('aac')
            .audioChannels(2)
            .audioFilters(['apad'])
            .videoCodec('libx264')
            .videoBitrate(1000)
            .videoFilters([
                'tpad=stop_mode=clone:stop_duration=2',
                'scale=trunc(iw/2)*2:trunc(ih/2)*2:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse',
            ])
            .fps(30)
            .duration(5)
            .format('mp4')
            .outputOptions([
                '-pix_fmt yuvj420p',
                '-profile:v baseline',
                '-level 3.0',
                '-crf 17',
                '-movflags +faststart',
                '-movflags frag_keyframe+empty_moov',
            ])
            .output(`/tmp/output_${imgId}.mp4`)
            .on('end', () => {
                console.log('MP4 video generated')
                resolve()
            })
            .on('error', (e) => {
                console.log(e)
                reject()
            })
            .run()
    })
```


问:
docker run error: running exec setns process for init caused \"exit status 40\"": unknown
I'm trying to install docker on centos7.9 machine following the guide from the official website.
But when I running the hello world to test the docker installtion, it failed with error: docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: can't get final child's PID from pipe: EOF: unknown.

And below is the information after cmd docker info:

```<code>Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
  compose: Docker Compose (Docker Inc., v2.14.1)
  scan: Docker Scan (Docker Inc., v0.23.0)

Server:
 Containers: 13
  Running: 0
  Paused: 0
  Stopped: 13
 Images: 3
 Server Version: 20.10.22
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 9ba4b250366a5ddde94bb7c9d1def331423aa323
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-1160.81.1.el7.x86_64
 Operating System: CentOS Linux 7 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: 40
 Total Memory: 62.39GiB
 Name: 192.168.2.4
 ID: BJWM:ZHFN:KHFN:PKNW:LS2C:2DSZ:2CAZ:JLTL:CRL7:FXVH:JXCK:DTJT
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
</code>```

Super thanks for your help!

Cheers
Yang

BTY, there is not throttle in the memory limit.

Body:
I'm trying to install docker on centos7.9 machine following the guide from the official website.
But when I running the hello world to test the docker installtion, it failed with error: docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: can't get final child's PID from pipe: EOF: unknown.

And below is the information after cmd docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
  compose: Docker Compose (Docker Inc., v2.14.1)
  scan: Docker Scan (Docker Inc., v0.23.0)

Server:
 Containers: 13
  Running: 0
  Paused: 0
  Stopped: 13
 Images: 3
 Server Version: 20.10.22
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 9ba4b250366a5ddde94bb7c9d1def331423aa323
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-1160.81.1.el7.x86_64
 Operating System: CentOS Linux 7 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: 40
 Total Memory: 62.39GiB
 Name: 192.168.2.4
 ID: BJWM:ZHFN:KHFN:PKNW:LS2C:2DSZ:2CAZ:JLTL:CRL7:FXVH:JXCK:DTJT
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Super thanks for your help!

Cheers
Yang

BTY, there is not throttle in the memory limit.


问:
Creating Function in SQL
I am using MySQL Workbench and trying to create a function that will get as a parameter a date and return it in the format(example) : Monday 1st January 2022.
To do so I created the following code which gives me the error: Truncated incorrect Double value:'st'.</p>
```<code>CREATE DEFINER=`root`@`localhost` FUNCTION `getDate`(getData date) RETURNS varchar(40) CHARSET utf8mb4
    DETERMINISTIC
BEGIN
RETURN DAYNAME(getData) + ' ' +
+  DAY(getData) +
CASE
WHEN DAY(getData) IN ( 1 , 21 , 31) THEN "st"
WHEN DAY(getData) IN ( 2, 22) THEN "nd"
WHEN DAY(getData) IN (3,23) THEN "rd"
ELSE "th"
END
+ ' ' +
MONTHNAME(getData) + ' '
+ Year(getData);
END
</code>```

Title: Creating Function in SQL

Body:
I am using MySQL Workbench and trying to create a function that will get as a parameter a date and return it in the format(example) : Monday 1st January 2022.
To do so I created the following code which gives me the error: Truncated incorrect Double value:'st'.

CREATE DEFINER=`root`@`localhost` FUNCTION `getDate`(getData date) RETURNS varchar(40) CHARSET utf8mb4
    DETERMINISTIC
BEGIN
RETURN DAYNAME(getData) + ' ' +
+  DAY(getData) +
CASE
WHEN DAY(getData) IN ( 1 , 21 , 31) THEN "st"
WHEN DAY(getData) IN ( 2, 22) THEN "nd"
WHEN DAY(getData) IN (3,23) THEN "rd"
ELSE "th"
END
+ ' ' +
MONTHNAME(getData) + ' '
+ Year(getData);
END


问:
Socket programming: How does client get access to its IP adress and port?
Just started learning about socket programming using Python. To create server, we do something like this:

```<code>sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('localhost', 10000)
sock.bind(server_address)
sock.listen(1)

while True:
    connection, client_address = sock.accept()
    ....
    ....
</code>```

For client, we do something like this:

```<code>#client.py
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('localhost', 10000)
sock.connect(server_address)
....
....
</code>```

I am not sure how to phrase my question but I was wondering about the mechanism behind client being assigned an IP address and port to connect to server. At server side, we explicitly bind()ed the socket to localhost address and port 10000. We don't do this for client and yet client has its own IP address and port. How and at what level (OS?) does this happen? In fact, when we run telnet localhost 10000, we are able to talk to that server and server knows about the IP address and port of incoming connection. What is the mechanism behind it? How can I explore more about this stuff on my (Windows) machine?

Body:
Just started learning about socket programming using Python. To create server, we do something like this:

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('localhost', 10000)
sock.bind(server_address)
sock.listen(1)

while True:
    connection, client_address = sock.accept()
    ....
    ....

For client, we do something like this:

#client.py
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('localhost', 10000)
sock.connect(server_address)
....
....

I am not sure how to phrase my question but I was wondering about the mechanism behind client being assigned an IP address and port to connect to server. At server side, we explicitly bind()ed the socket to localhost address and port 10000. We don't do this for client and yet client has its own IP address and port. How and at what level (OS?) does this happen? In fact, when we run telnet localhost 10000, we are able to talk to that server and server knows about the IP address and port of incoming connection. What is the mechanism behind it? How can I explore more about this stuff on my (Windows) machine?


问:
Array SQLITE: how to color rows?
Problem:
My HTML table from SQLITE database does notlook good on the top right side.

In the right row ("Count") the different numbers should have different colors.

23 and 17 are different numbers but have the same color, because both are odd. They should have different colours.
Same problem is on numbers 9 and 7.

PHP Code is here:

```<code>    <?php
    $result = $db->query("SELECT http_host, request_uri,COUNT(request_uri) as
    'sum' FROM $tablename1[$sid] GROUP BY http_host,request_uri ORDER BY sum
    DESC");
    $i=0;
    $countt=0;
    $iminus=0;
    $total=0;
    $bright = "style= 'background-color: #cecece;'";//test other color
    $dark = "style= 'background-color: #779BAB;'";//test other color
    foreach($result as $row)
        {
        $i++;
        if ($i == $n_vis){break;}
        $timestamp = $row[timestamp];
        $atime = intval(substr($timestamp,8,2));
        $xtime = substr($timestamp,0,9);
        $http_host = $row[http_host];
        $http_host = htmlentities($http_host,ENT_QUOTES);
        $request_uri = $row[request_uri];
        $request_uri = htmlentities($request_uri,ENT_QUOTES);
        $sum = $row[sum];
        $total=$total+$sum;
        $count[$i]=$sum;
        $stile[$i]=$stile;
        //Change background////////////////////////////////////////
        if ((((intval($sum))%2)==0)) {$stile="style= 'background-color:
        #cecece;'";}
        if ((((intval($sum))%2)>0)) {$stile="style= 'background-color: #779BAB;'";}
        echo "<tr $stile><td align='right'>$i</td>";
        echo "<td>$http_host$request_uri</td><td align='right'>$sum</td></tr>";
        }
    ?>
</code>```

I tried to solve the problem by adding this PHP code:

```<code>    reset($result);
    while($row = $result->fetchArray()){
        $sum = $row[sum];
        $count[$i]=$sum;
        $stile[$i]=$stile;
        if(($count[$i] > $count[$i-1])==("" OR 0 OR -1))
            {$stile=$dark;}
        if(($count[$i] > $count[$i-1]) && ($stile[$i-1]==$dark))
            {$stile=$bright;}
        if(($count[$i] > $count[$i-1]) && ($stile[$i-1]==$bright))
            {$stile=$dark;}
        if(($count[$i] == $count[$i-1]) && ($stile[$i-1]==$dark))
            {$stile=$dark;}
        if(($count[$i] == $count[$i-1]) && ($stile[$i-1]==$bright))
            {$stile=$bright;}
        echo "<tr $stile><td align='right'>$i</td>";
        echo "<td>$http_host$request_uri</td><td    align='right'>$sum</td></tr>";
        }
    echo "</table></center>";

</code>```

But this additional code does not change anything.

So I did this temporary solution:

```<code>    <?php
    $result = $db->query("SELECT http_host, request_uri, COUNT(request_uri) as 'sum' FROM $tablename1[$sid] GROUP BY http_host,request_uri ORDER BY sum DESC");
    $i=0;
    foreach($result as $row){
        $i++;
        if ($i == $n_vis){break;}
        $timestamp = $row[timestamp];
        $atime = intval(substr($timestamp,8,2));
        $xtime = substr($timestamp,0,9);
        $http_host = $row[http_host];
        $http_host = htmlentities($http_host,ENT_QUOTES);
        $request_uri = $row[request_uri];
        $request_uri = htmlentities($request_uri,ENT_QUOTES);
        $sum = $row[sum];
        $total=$total+$sum;
        //Change background////////////////////////////////////////
        if (((((intval($sum))%2)==0))){$stile="style= 'background-color: #cecece;'";}
        if (((((intval($sum))%2)==0)) && (((intval($sum))%3)==0)){$stile="style= 'background-color: #add8e6;'";}
        if (((((intval($sum))%2)>0))){$stile="style= 'background-color: #779BAB;'";}
        if (((((intval($sum))%3)==0))  && (((intval($sum))%2)<>0)) {$stile="style= 'background-color: #779BAB'";}
        if (((((intval($sum))%3)>0))  && (((intval($sum))%2)<>0)) {$stile="style= 'background-color: #8fbc8f;'";}
        if (((((intval($sum))%4)==1))  && (((intval($sum))%2)<>0)) {$stile="style= 'background-color: #f0e68c;'";}
        if ($sum==1){$stile="style= 'background-color: #779BAB;'";} //Change background
        echo "<tr $stile><td align='right'>$i</td>";
        echo "<td>$http_host$request_uri</td><td align='right'>$sum</td></tr>";
        }
    echo "<tr><td align='right'>.</td>";
    echo "<td>total</td><td align='right'>$total</td></tr>";
    echo "</table></center>";
    ?>
</code>```

It looks correct but it looks too much colorful, see here:

If possible, I want display it only with two colors.

Is there a PHP solution?
Thx in advance for your hints.

Title: Array SQLITE: how to color rows?

Body:
Problem:
My HTML table from SQLITE database does notlook good on the top right side.

In the right row ("Count") the different numbers should have different colors.

23 and 17 are different numbers but have the same color, because both are odd. They should have different colours.
Same problem is on numbers 9 and 7.

PHP Code is here:

    <?php
    $result = $db->query("SELECT http_host, request_uri,COUNT(request_uri) as
    'sum' FROM $tablename1[$sid] GROUP BY http_host,request_uri ORDER BY sum
    DESC");
    $i=0;
    $countt=0;
    $iminus=0;
    $total=0;
    $bright = "style= 'background-color: #cecece;'";//test other color
    $dark = "style= 'background-color: #779BAB;'";//test other color
    foreach($result as $row)
        {
        $i++;
        if ($i == $n_vis){break;}
        $timestamp = $row[timestamp];
        $atime = intval(substr($timestamp,8,2));
        $xtime = substr($timestamp,0,9);
        $http_host = $row[http_host];
        $http_host = htmlentities($http_host,ENT_QUOTES);
        $request_uri = $row[request_uri];
        $request_uri = htmlentities($request_uri,ENT_QUOTES);
        $sum = $row[sum];
        $total=$total+$sum;
        $count[$i]=$sum;
        $stile[$i]=$stile;
        //Change background////////////////////////////////////////
        if ((((intval($sum))%2)==0)) {$stile="style= 'background-color:
        #cecece;'";}
        if ((((intval($sum))%2)>0)) {$stile="style= 'background-color: #779BAB;'";}
        echo "
$i	";
        echo "$http_host$request_uri	$sum
";
        }
    ?>

I tried to solve the problem by adding this PHP code:

    reset($result);
    while($row = $result->fetchArray()){
        $sum = $row[sum];
        $count[$i]=$sum;
        $stile[$i]=$stile;
        if(($count[$i] > $count[$i-1])==("" OR 0 OR -1))
            {$stile=$dark;}
        if(($count[$i] > $count[$i-1]) && ($stile[$i-1]==$dark))
            {$stile=$bright;}
        if(($count[$i] > $count[$i-1]) && ($stile[$i-1]==$bright))
            {$stile=$dark;}
        if(($count[$i] == $count[$i-1]) && ($stile[$i-1]==$dark))
            {$stile=$dark;}
        if(($count[$i] == $count[$i-1]) && ($stile[$i-1]==$bright))
            {$stile=$bright;}
        echo "
$i	";
        echo "$http_host$request_uri	$sum
";
        }
    echo "
";

But this additional code does not change anything.

So I did this temporary solution:

    <?php
    $result = $db->query("SELECT http_host, request_uri, COUNT(request_uri) as 'sum' FROM $tablename1[$sid] GROUP BY http_host,request_uri ORDER BY sum DESC");
    $i=0;
    foreach($result as $row){
        $i++;
        if ($i == $n_vis){break;}
        $timestamp = $row[timestamp];
        $atime = intval(substr($timestamp,8,2));
        $xtime = substr($timestamp,0,9);
        $http_host = $row[http_host];
        $http_host = htmlentities($http_host,ENT_QUOTES);
        $request_uri = $row[request_uri];
        $request_uri = htmlentities($request_uri,ENT_QUOTES);
        $sum = $row[sum];
        $total=$total+$sum;
        //Change background////////////////////////////////////////
        if (((((intval($sum))%2)==0))){$stile="style= 'background-color: #cecece;'";}
        if (((((intval($sum))%2)==0)) && (((intval($sum))%3)==0)){$stile="style= 'background-color: #add8e6;'";}
        if (((((intval($sum))%2)>0))){$stile="style= 'background-color: #779BAB;'";}
        if (((((intval($sum))%3)==0))  && (((intval($sum))%2)<>0)) {$stile="style= 'background-color: #779BAB'";}
        if (((((intval($sum))%3)>0))  && (((intval($sum))%2)<>0)) {$stile="style= 'background-color: #8fbc8f;'";}
        if (((((intval($sum))%4)==1))  && (((intval($sum))%2)<>0)) {$stile="style= 'background-color: #f0e68c;'";}
        if ($sum==1){$stile="style= 'background-color: #779BAB;'";} //Change background
        echo "
$i	";
        echo "$http_host$request_uri	$sum
";
        }
    echo "
.	";
    echo "total	$total
";
    echo "
";
    ?>

It looks correct but it looks too much colorful, see here:

If possible, I want display it only with two colors.

Is there a PHP solution?
Thx in advance for your hints.


问:
How to Register A Flink Table from Data Stream that contains arrays
I have a kinesis stream input structure as follows:

```<code>{
    'customer_id': UUID,
    'sensor_id': UUID,
    'timestamps': [ ... ],
    'values': [ ...]
},
...
</code>```

What I want to do is to create a table from this input and flatten the arrays. How can I achieve that?

Body:
I have a kinesis stream input structure as follows:

{
    'customer_id': UUID,
    'sensor_id': UUID,
    'timestamps': [ ... ],
    'values': [ ...]
},
...

What I want to do is to create a table from this input and flatten the arrays. How can I achieve that?


问:
Failed to install cryptography in python on linux
so I am running a Linux machine with python 3.10 and the latest version of pip.

when I try installing Cryptography using PIP i get a successful installed message with one warning:

```<code>sh-5.1$ pip install cryptography

Defaulting to user installation because normal site-packages is not writeable
Collecting cryptography
  Using cached cryptography-39.0.0-cp36-abi3-manylinux_2_28_x86_64.whl (4.2 MB)
Collecting cffi>=1.12
  Using cached cffi-1.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (441 kB)
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Installing collected packages: pycparser, cffi, cryptography
Successfully installed cffi-1.15.1 cryptography-39.0.0 pycparser-2.21
</code>```

However when I try verifying if it was installed correctly and try importing it I get an error:

```<code>sh-5.1$ python -c "import cryptography"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'cryptography'
sh-5.1$
</code>```

And yes I am running the import command from the same environment where the it was installed.

the python version:

```<code>sh-5.1$ python --version
Python 3.10.6

sh-5.1$ type python
python is hashed (/usr/bin/python)
</code>```

PIP Version:

```<code>sh-5.1$ pip --version
pip 22.3.1 from /usr/lib/python3.10/site-packages/pip (python 3.10)

sh-5.1$ python -m pip show cryptography
WARNING: Package(s) not found: cryptography
</code>```

Alternative method I tried as suggested:

```<code>sh-5.1$ python3.10 -m pip install cryptography

Defaulting to user installation because normal site-packages is not writeable
Collecting cryptography
  Using cached cryptography-39.0.0-cp36-abi3-manylinux_2_28_x86_64.whl (4.2 MB)
Collecting cffi>=1.12
  Using cached cffi-1.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (441 kB)
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Installing collected packages: pycparser, cffi, cryptography
Successfully installed cffi-1.15.1 cryptography-39.0.0 pycparser-2.21

sh-5.1$ python -c "import cryptography"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'cryptography'
sh-5.1$
</code>```

LOCATION where it is installed? :

```<code>python -c "import cryptography; print(cryptography.__file__)"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'cryptography'
</code>```

Body:
so I am running a Linux machine with python 3.10 and the latest version of pip.

when I try installing Cryptography using PIP i get a successful installed message with one warning:

sh-5.1$ pip install cryptography

Defaulting to user installation because normal site-packages is not writeable
Collecting cryptography
  Using cached cryptography-39.0.0-cp36-abi3-manylinux_2_28_x86_64.whl (4.2 MB)
Collecting cffi>=1.12
  Using cached cffi-1.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (441 kB)
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Installing collected packages: pycparser, cffi, cryptography
Successfully installed cffi-1.15.1 cryptography-39.0.0 pycparser-2.21

However when I try verifying if it was installed correctly and try importing it I get an error:

sh-5.1$ python -c "import cryptography"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'cryptography'
sh-5.1$

And yes I am running the import command from the same environment where the it was installed.

the python version:

sh-5.1$ python --version
Python 3.10.6

sh-5.1$ type python
python is hashed (/usr/bin/python)

PIP Version:

sh-5.1$ pip --version
pip 22.3.1 from /usr/lib/python3.10/site-packages/pip (python 3.10)

sh-5.1$ python -m pip show cryptography
WARNING: Package(s) not found: cryptography

Alternative method I tried as suggested:

sh-5.1$ python3.10 -m pip install cryptography

Defaulting to user installation because normal site-packages is not writeable
Collecting cryptography
  Using cached cryptography-39.0.0-cp36-abi3-manylinux_2_28_x86_64.whl (4.2 MB)
Collecting cffi>=1.12
  Using cached cffi-1.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (441 kB)
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Installing collected packages: pycparser, cffi, cryptography
Successfully installed cffi-1.15.1 cryptography-39.0.0 pycparser-2.21

sh-5.1$ python -c "import cryptography"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'cryptography'
sh-5.1$

LOCATION where it is installed? :

python -c "import cryptography; print(cryptography.__file__)"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'cryptography'


问:
Decoding an image retrieved from mongodb to make it json serializable
I have some images saved in mongodb and I used mongoengine and flask to save them. Now I want to make it json serializable so I can send it to a react frontend. This is the code that I used to decode the binary string.

from base64 import urlsafe_b64decode, b64encode
import json
from flask import Flask, Blueprint, jsonify
import bson
import json

from ..db_models.member import Member
from ..db_models.image import Image

bp_api = Blueprint('bp_api', '__name__', url_prefix='/api')

@bp_api.route('/get-recent-10')
def recent_10():
    recent_imgs = Image.objects.order_by('-updated')[:5]  #[5] is just giving the attributes of Imag object so no..
    print(recent_imgs)
    member_data = []
    for i in recent_imgs:
        #print(i)
        #print(i.member_id)
        #related_member = Member.objects(__raw__={"_id":i.member_id}).first()
        member_data.append(i.member_id.name)
    print(dir(recent_imgs[0].img_file.read()))
    print(type(recent_imgs[0].img_file.read()))

    img_b64_data = [b64decode(img.img_file.read()).decode('utf-8') for img in recent_imgs]  #THIS IS THE LINE THAT THROWS ERROR.
    recent_imgs = [json.loads(i.to_json()) for i in recent_imgs]
    return {
        "recent_imgs": recent_imgs,
        "img_b64_data": img_b64_data,
        "related_members": member_data

    }
```
<p>But it throws error <strong>UnicodeDecodeError: 'utf-8' codec can't decode byte</strong> and the reason for that is .decode('utf-8'). To make sure the binary is not malformed or no problem with mongoengine I wrote the image to a file using this function and it worked prefectly fine.</p>
<pre class="lang-py prettyprint-override"><code>@bp_api.route('/downloadimg/<img_id>')  ###TEMP
def downloadimg(img_id):
    img = Image.objects(__raw__={"_id":bson.ObjectId(img_id)}).first()
    img_bin = img.img_file.read()
    with open('new.png', 'wb') as fh:
        fh.write(img_bin)

    return 'OK'
</code>```

Can someone tell me why I cannot decode the binary string?

Body:
I have some images saved in mongodb and I used mongoengine and flask to save them. Now I want to make it json serializable so I can send it to a react frontend. This is the code that I used to decode the binary string.

from base64 import urlsafe_b64decode, b64encode
import json
from flask import Flask, Blueprint, jsonify
import bson
import json

from ..db_models.member import Member
from ..db_models.image import Image

bp_api = Blueprint('bp_api', '__name__', url_prefix='/api')

@bp_api.route('/get-recent-10')
def recent_10():
    recent_imgs = Image.objects.order_by('-updated')[:5]  #[5] is just giving the attributes of Imag object so no..
    print(recent_imgs)
    member_data = []
    for i in recent_imgs:
        #print(i)
        #print(i.member_id)
        #related_member = Member.objects(__raw__={"_id":i.member_id}).first()
        member_data.append(i.member_id.name)
    print(dir(recent_imgs[0].img_file.read()))
    print(type(recent_imgs[0].img_file.read()))

    img_b64_data = [b64decode(img.img_file.read()).decode('utf-8') for img in recent_imgs]  #THIS IS THE LINE THAT THROWS ERROR.
    recent_imgs = [json.loads(i.to_json()) for i in recent_imgs]
    return {
        "recent_imgs": recent_imgs,
        "img_b64_data": img_b64_data,
        "related_members": member_data

    }

But it throws error UnicodeDecodeError: 'utf-8' codec can't decode byte and the reason for that is .decode('utf-8'). To make sure the binary is not malformed or no problem with mongoengine I wrote the image to a file using this function and it worked prefectly fine.

@bp_api.route('/downloadimg/<img_id>')  ###TEMP
def downloadimg(img_id):
    img = Image.objects(__raw__={"_id":bson.ObjectId(img_id)}).first()
    img_bin = img.img_file.read()
    with open('new.png', 'wb') as fh:
        fh.write(img_bin)

    return 'OK'

Can someone tell me why I cannot decode the binary string?


问:
Steps per epoch (with image augmentation) not changing with batch size
I have read that one can increase steps per epoch by 2 or 3 times when applying image augmentation. I have also done that in the past with no issue, however this time I've got an error telling me I have run out of training data

Another issue I have is my steps per epoch in keras is always showing the same number even when I changed batchsize.

Here are some specs and sameple code:

training data size: 6149

validation data size: 1020

batchsizes tried: 32 and 64

augmentation and preprocessing steps:

```<code>from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.applications.resnet import preprocess_input
datagen = ImageDataGenerator(rotation_range=90,
                             horizontal_flip=True,
                             vertical_flip=True,
                             # featurewise_center=True,
                             zoom_range=0.3,
                             shear_range=0.5,
                             preprocessing_function=preprocess_input)
train_generator = datagen.flow_from_directory('data/train', seed=42)
validation_generator = datagen.flow_from_directory('data/validation', seed=42)
>Found 6149 images belonging to 102 classes.
>Found 1020 images belonging to 102 classes.
</code>```

fitting:

```<code>batch_size = 64  #or 32
model.fit(train_generator,
          epochs=100,
          batch_size=batch_size,
          # steps_per_epoch=3*training_size//batch_size, - gives error
          validation_data=validation_generator,
          callbacks=[early_stopping])
</code>```

example output with batch_size 32 or 64:

```<code>Epoch 1/100
193/193 [==============================] - 3284s 17s/step - loss: 0.3660 - categorical_accuracy: 0.5357 - val_loss: 0.4022 - val_categorical_accuracy: 0.5176
</code>```

error shown when I specified steps_per_epoch:

Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least steps_per_epoch * epochs batches (in this case, 57600 batches). You may need to use the repeat() function when building your dataset

Summary:

Why is my steps per epoch always at 193 regardless of changing the batchsize? (without specifying steps_per_epoch)

Specifying steps_per_epoch resulted in error of not enough data.

Could there be a problem with my code for the generator?

side question: I have a large number of classes - 102, should my batch size be larger than that? I always overfit this data

Body:
I have read that one can increase steps per epoch by 2 or 3 times when applying image augmentation. I have also done that in the past with no issue, however this time I've got an error telling me I have run out of training data

Another issue I have is my steps per epoch in keras is always showing the same number even when I changed batchsize.

Here are some specs and sameple code:

training data size: 6149

validation data size: 1020

batchsizes tried: 32 and 64

augmentation and preprocessing steps:

from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.applications.resnet import preprocess_input
datagen = ImageDataGenerator(rotation_range=90,
                             horizontal_flip=True,
                             vertical_flip=True,
                             # featurewise_center=True,
                             zoom_range=0.3,
                             shear_range=0.5,
                             preprocessing_function=preprocess_input)
train_generator = datagen.flow_from_directory('data/train', seed=42)
validation_generator = datagen.flow_from_directory('data/validation', seed=42)
>Found 6149 images belonging to 102 classes.
>Found 1020 images belonging to 102 classes.

fitting:

batch_size = 64  #or 32
model.fit(train_generator,
          epochs=100,
          batch_size=batch_size,
          # steps_per_epoch=3*training_size//batch_size, - gives error
          validation_data=validation_generator,
          callbacks=[early_stopping])

example output with batch_size 32 or 64:

Epoch 1/100
193/193 [==============================] - 3284s 17s/step - loss: 0.3660 - categorical_accuracy: 0.5357 - val_loss: 0.4022 - val_categorical_accuracy: 0.5176

error shown when I specified steps_per_epoch:

Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least steps_per_epoch * epochs batches (in this case, 57600 batches). You may need to use the repeat() function when building your dataset

Summary:

Why is my steps per epoch always at 193 regardless of changing the batchsize? (without specifying steps_per_epoch)

Specifying steps_per_epoch resulted in error of not enough data.

Could there be a problem with my code for the generator?

side question: I have a large number of classes - 102, should my batch size be larger than that? I always overfit this data


问:
Discord bot cannot go online due to some errors, and I don't know what to do
I was trying to create a discord bot, but when I run the program, I get this error

SyntaxError: Invalid or unexpected token
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1159:20)
at Module._compile (node:internal/modules/cjs/loader:1203:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1293:10)
at Module.load (node:internal/modules/cjs/loader:1096:32)
at Module._load (node:internal/modules/cjs/loader:935:12)
at Module.require (node:internal/modules/cjs/loader:1120:19)
at require (node:internal/modules/helpers:112:18)
at Object. (D:\Discord\Bots\node_modules\discord-api-types\payloads\v10\interactions.js:17:14)
at Module._compile (node:internal/modules/cjs/loader:1239:14)

My bot would be going online if I execute the program successfully. I would be happy to get any help!
The token was removed for screenshot purpose due to security reasons