问:
Kotlion: invoke same overridden function in all sealed subclasses that implements same interface
I'm trying to invoke same function that in the subclasses the implements same interface.
Or the question could be how to invoke function in KClass<out Drink>?
Is it possible or is there any work around?

```<code>fun main() {
    println(Tea().getOptimalTemp())
    println(Wine().getOptimalTemp())
    val list = listOf(Drink::class.sealedSubclasses)
    for(drink in list){
        println(drink.getMethods.getOptimalTemp())
    }
}

interface Drink {
    fun getOptimalTemp(): Int
}

class Tea : Drink {
    override fun getOptimalTemp():Int{
        return 60
    }
}

class Wine : Drink {
    override fun getOptimalTemp():Int{
        return 10
    }
}
</code>```

I expect to add more class implements that interface in the future without changing the loop.

Body:
I'm trying to invoke same function that in the subclasses the implements same interface.
Or the question could be how to invoke function in KClass<out Drink>?
Is it possible or is there any work around?

fun main() {
    println(Tea().getOptimalTemp())
    println(Wine().getOptimalTemp())
    val list = listOf(Drink::class.sealedSubclasses)
    for(drink in list){
        println(drink.getMethods.getOptimalTemp())
    }
}

interface Drink {
    fun getOptimalTemp(): Int
}

class Tea : Drink {
    override fun getOptimalTemp():Int{
        return 60
    }
}

class Wine : Drink {
    override fun getOptimalTemp():Int{
        return 10
    }
}

I expect to add more class implements that interface in the future without changing the loop.


来源: stackexchange

问:
PutAsJsonAync not setting body properly
I'm calling a 3rd party API right now. In post man I can do this, and it does what I'm expecting. Sets these two fields to "cancelled".

Here are the current headers in postman:

The verb that postman is using is PUT. POST is currently not supported by the API.
In code I'm doing this:

```<code> var idcInput = new IdcInputParameters(
            status: "cancelled",
            ivrstatus: "cancelled"
        );

        // pass the updated parameters to RFS
        using HttpResponseMessage httpResponse = await RfsApiClient.ApiClient.PutAsJsonAsync(uri, idcInput);

        var res = await httpResponse.Content.ReadAsStringAsync();

        if (httpResponse.IsSuccessStatusCode)
        {
            Idc? idc = JsonConvert.DeserializeObject<Idc>(res);
            return idc;
        }
</code>```

The JsonSerializer outputs the following:

```<code> "{\"status\":\"cancelled\",\"ivrstatus\":\"cancelled\"}"
</code>```

I'm not 100% sure as to whats going on, but when I pass idcInput I'm getting back a 500 error from the API saying one or more input parameters is invalid. This leads me to believe that the body of the request is empty.

I've tried a lot of the answers on stack overflow however nothing's worked yet.

How do I set the body of the request to be a RAW Json object like postman?

ContentLicense: CC BY-SA 4.0

Title: PutAsJsonAync not setting body properly

Body:
I'm calling a 3rd party API right now. In post man I can do this, and it does what I'm expecting. Sets these two fields to "cancelled".

Here are the current headers in postman:

The verb that postman is using is PUT. POST is currently not supported by the API.
In code I'm doing this:

 var idcInput = new IdcInputParameters(
            status: "cancelled",
            ivrstatus: "cancelled"
        );

        // pass the updated parameters to RFS
        using HttpResponseMessage httpResponse = await RfsApiClient.ApiClient.PutAsJsonAsync(uri, idcInput);

        var res = await httpResponse.Content.ReadAsStringAsync();

        if (httpResponse.IsSuccessStatusCode)
        {
            Idc? idc = JsonConvert.DeserializeObject<Idc>(res);
            return idc;
        }

The JsonSerializer outputs the following:

 "{\"status\":\"cancelled\",\"ivrstatus\":\"cancelled\"}"

I'm not 100% sure as to whats going on, but when I pass idcInput I'm getting back a 500 error from the API saying one or more input parameters is invalid. This leads me to believe that the body of the request is empty.

I've tried a lot of the answers on stack overflow however nothing's worked yet.

How do I set the body of the request to be a RAW Json object like postman?


问:
Python simple DNS resolver: memory leak
This code is a DNS resolver that check from a DB for an entry not older than 5 minutes.

```<code>#!/usr/bin/python3

from MySQLdb import _mysql as MySQL
from dnslib import RR, QTYPE, RCODE, A
from dnslib.label import DNSLabel
from dnslib.server import DNSServer, BaseResolver
from time import sleep, time

class MariaResolver(BaseResolver):
    DELTA = 300

    def __init__(self):
        self.password = "********************"

    def resolve(self, request, handler):
        reply = request.reply()
        qname = request.q.qname
        fqdn = str(request.q.qname)
        try:
            if fqdn.find("iut-") == -1:
                reply.header.rcode = RCODE.REFUSED
            else:
                hostname = fqdn.split(".")[0]
                timestamp = int(time()) - self.DELTA
                query = "SELECT ip FROM dns WHERE record='{}' AND timestamp>{}"
                db = MySQL.connect("localhost", "dns", self.password, "salles")
                db.query(query.format(hostname, timestamp))
                result = db.store_result()
                row = result.fetch_row(how=1)
                if row:
                    ip = row[0]["ip"].decode("utf-8")
                    reply.add_answer(RR(qname, QTYPE.A, ttl=0,
                                        rdata=A(ip)))
                else:
                    reply.header.rcode = RCODE.REFUSED
                db.close()
        except Exception as e:
            print(e)
            reply.header.rcode = RCODE.REFUSED
        return reply

if __name__ == '__main__':
    resolver = MariaResolver()
    udp_server = DNSServer(resolver, port=53)
    udp_server.start_thread()
    while udp_server.isAlive():
        sleep(0.1)
</code>```

This code leaks over time and I do not understand why.

In the Proxmox screenshot, you can see service restarted at the and.

Title: Python simple DNS resolver: memory leak

Body:
This code is a DNS resolver that check from a DB for an entry not older than 5 minutes.

#!/usr/bin/python3

from MySQLdb import _mysql as MySQL
from dnslib import RR, QTYPE, RCODE, A
from dnslib.label import DNSLabel
from dnslib.server import DNSServer, BaseResolver
from time import sleep, time

class MariaResolver(BaseResolver):
    DELTA = 300

    def __init__(self):
        self.password = "********************"

    def resolve(self, request, handler):
        reply = request.reply()
        qname = request.q.qname
        fqdn = str(request.q.qname)
        try:
            if fqdn.find("iut-") == -1:
                reply.header.rcode = RCODE.REFUSED
            else:
                hostname = fqdn.split(".")[0]
                timestamp = int(time()) - self.DELTA
                query = "SELECT ip FROM dns WHERE record='{}' AND timestamp>{}"
                db = MySQL.connect("localhost", "dns", self.password, "salles")
                db.query(query.format(hostname, timestamp))
                result = db.store_result()
                row = result.fetch_row(how=1)
                if row:
                    ip = row[0]["ip"].decode("utf-8")
                    reply.add_answer(RR(qname, QTYPE.A, ttl=0,
                                        rdata=A(ip)))
                else:
                    reply.header.rcode = RCODE.REFUSED
                db.close()
        except Exception as e:
            print(e)
            reply.header.rcode = RCODE.REFUSED
        return reply

if __name__ == '__main__':
    resolver = MariaResolver()
    udp_server = DNSServer(resolver, port=53)
    udp_server.start_thread()
    while udp_server.isAlive():
        sleep(0.1)

This code leaks over time and I do not understand why.

In the Proxmox screenshot, you can see service restarted at the and.


问:
Contribute a mapping to API calls as model annotations in Java
I am writing a backend which should act intermediator to private APIs.

The backend should receive data in different models and send them to the private APIs. I want the backend to be able to receive the similar information, but in different data models. The models should be defined by the contributor, at runtime.

The goal is to shield the private API from flexible models and decouple the private API from changing models completely.

Example of 2 models containing similar information:

Model1

```<code><Entity>Building:
 Inhabitant: 10
 Optional<Size>: 1000 square meters

<Entity>Address:
 Street: wall street
 HousenNr: 1
</code>```

Model2

```<code><Entity>Site:
 People: 10
 Street: wall street
 HousenNr: 1

</code>```

Is there a notation which would allow contributing at runtime, together with the model, also the mapping of the model fields to private API calls, allowing to store the model?

So that one gets to know,
that to store data in both models - one needs to do

the following API calls

in the following order
depending on how the private API looks like.

Example of API calls, needed to store data from model1, model2:

```<code>POST /location/
{
residents: 10;
site: 1000
}

POST /location/address/
{
street: wall street;
house: 1
}

</code>```

Body:
I am writing a backend which should act intermediator to private APIs.

The backend should receive data in different models and send them to the private APIs. I want the backend to be able to receive the similar information, but in different data models. The models should be defined by the contributor, at runtime.

The goal is to shield the private API from flexible models and decouple the private API from changing models completely.

Example of 2 models containing similar information:

Model1

<Entity>Building:
 Inhabitant: 10
 Optional<Size>: 1000 square meters

<Entity>Address:
 Street: wall street
 HousenNr: 1

Model2

<Entity>Site:
 People: 10
 Street: wall street
 HousenNr: 1

Is there a notation which would allow contributing at runtime, together with the model, also the mapping of the model fields to private API calls, allowing to store the model?

So that one gets to know,
that to store data in both models - one needs to do

the following API calls

in the following order
depending on how the private API looks like.

Example of API calls, needed to store data from model1, model2:

POST /location/
{
residents: 10;
site: 1000
}

POST /location/address/
{
street: wall street;
house: 1
}


问:
Why am I having a problem with intellij and maven
Environment:

macOS Monterey
Java: OpenJDK Runtime Environment Temurin-11.0.17+8 (build 11.0.17+8)
Intelij IDEA: 2022.3 Build #IU-223.7571.182, built on November 29, 2022
Intelij bundled version of maven: 3.8.1
Command line Maven: Apache Maven 3.8.6
```
<p>My question has two part:</p>
<p><strong>1) How does intelij's internal build system work with maven to identify dependencies that are needed for compiling code?</strong></p>
<p><strong>2) When that dependency resolution fails, how you can you determine the cause of the failure?</strong></p>
<p><strong>The problem:</strong></p>
<p>I have a multi module maven project.</p>
<p>From the maven window in Intelij, I can build any module and the whole project. From the command line I can run maven builds that complete with out error. However when I try to build project, or rebuild project from the Intelij menu. (Build->Build Project) the build fails.</p>
<p>It fails with the following error:</p>
<blockquote>
<p>java: package com.fasterxml.jackson.annotation does not exist.</p>
</blockquote>
<p>The pom file includes the dependency for the jar file. I can go to each directory and execute this command</p>
<pre class="lang-bash prettyprint-override"><code>mvn dependency:tree | grep -i jackson-annotations
</code>```

and I get:

[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.8:compile

In each pom file the following dependency exists:

<dependency>
     <groupId>com.fasterxml.jackson.core</groupId>
     <artifactId>jackson-annotations</artifactId>
     <version>2.9.8</version>
</dependency>
```

Body:
Environment:

macOS Monterey
Java: OpenJDK Runtime Environment Temurin-11.0.17+8 (build 11.0.17+8)
Intelij IDEA: 2022.3 Build #IU-223.7571.182, built on November 29, 2022
Intelij bundled version of maven: 3.8.1
Command line Maven: Apache Maven 3.8.6

My question has two part:

1) How does intelij's internal build system work with maven to identify dependencies that are needed for compiling code?

2) When that dependency resolution fails, how you can you determine the cause of the failure?

The problem:

I have a multi module maven project.

From the maven window in Intelij, I can build any module and the whole project. From the command line I can run maven builds that complete with out error. However when I try to build project, or rebuild project from the Intelij menu. (Build->Build Project) the build fails.

It fails with the following error:

java: package com.fasterxml.jackson.annotation does not exist.

The pom file includes the dependency for the jar file. I can go to each directory and execute this command

mvn dependency:tree | grep -i jackson-annotations

and I get:

[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.8:compile

In each pom file the following dependency exists:

<dependency>
     <groupId>com.fasterxml.jackson.core</groupId>
     <artifactId>jackson-annotations</artifactId>
     <version>2.9.8</version>
</dependency>


问:
Using Teachable Machine from Google with Python
I'm new to this so thank you in advance for your patience.

I'm trying to do an Audio Classification model that I would use with Python (I'll add this step in a larger code that I already have in Python that check audio files properties etc). I found out that https://teachablemachine.withgoogle.com/ can do that.

It used to have the option to export to a specific format that Python was able to read right away and I found YouTube videos showing how to do that, but now, it's just Tensorflow.js and Tensorflow Lite...(It used to have a tab just saying Tensorflow and the YouTube videos were showing that, for example https://www.youtube.com/watch?v=zyzIgB4H06c&t=317s)

How do I add the code in Python now that this option is gone?

Can't find videos with the new export options on YouTube


问:
No Module Named 'coremltools' Reoccurring Issue
I am following a project where I am create a new virtual environment (https://coremltools.readme.io/docs/installation#) using python commands.  I have both 2.7 AND 3.6 installed on my machine (mac).  I have followed the steps in order on the tutorial, but I am getting a ModuleNotFoundError: No module named 'coremltools.'  I have already installed the package and I have incorporated the import statements on the file:
My code is this:

```<code>import coremltools as ct

caffe_model = ('oxford102.caffemodel', 'deploy.prototxt')

labels = 'flower-labels.txt'

coreml_model = ct.converters.caffe.convert(

    caffe_model,
    class_labels=labels,
    image_input_names='data'

)

coreml_model.save('FlowerClassifier.mlmodel')
</code>```

commands used:
python convert-script.py -this is the python file I am running
pip install coremltools
source coremltools-venv/bin/activate
python -m venv coremltools-venv -created the environment

An image of the terminal is here:
enter image description here

I am lost on why the module is still not recognized.

ModuleNotFoundError: No module named 'coremltools'

Body:
I am following a project where I am create a new virtual environment (https://coremltools.readme.io/docs/installation#) using python commands.  I have both 2.7 AND 3.6 installed on my machine (mac).  I have followed the steps in order on the tutorial, but I am getting a ModuleNotFoundError: No module named 'coremltools.'  I have already installed the package and I have incorporated the import statements on the file:
My code is this:

import coremltools as ct

caffe_model = ('oxford102.caffemodel', 'deploy.prototxt')

labels = 'flower-labels.txt'

coreml_model = ct.converters.caffe.convert(

    caffe_model,
    class_labels=labels,
    image_input_names='data'

)

coreml_model.save('FlowerClassifier.mlmodel')

commands used:
python convert-script.py -this is the python file I am running
pip install coremltools
source coremltools-venv/bin/activate
python -m venv coremltools-venv -created the environment

An image of the terminal is here:
enter image description here

I am lost on why the module is still not recognized.

ModuleNotFoundError: No module named 'coremltools'


问:
Spring Boot 3 native image fails with there was no org.springframework.boot.web.servlet.server.ServletWebServerFactory bean defined in the context
I've upgraded a quite complex Spring Boot application to Boot 3.0 and Cloud 2022.0.0-SNAPSHOT.

These are the defined dependencies:

```<code>plugins {
    id("org.springframework.boot") version "3.0.0"
    id("io.spring.dependency-management") version "1.1.0"
    id("com.github.davidmc24.gradle.plugin.avro") version "1.5.0"
    jacoco
    kotlin("jvm") version "1.7.21"
    kotlin("plugin.spring") version "1.7.21"
    id("org.graalvm.buildtools.native") version "0.9.19"
}

java.sourceCompatibility = VERSION_17

repositories {
    maven { url = uri("https://repo.spring.io/milestone") }
    maven { url = uri("https://repo.spring.io/snapshot") }
    mavenCentral()
    maven { url = uri("https://packages.confluent.io/maven") }
    maven { url = uri("https://oss.jfrog.org/artifactory/oss-snapshot-local") }

}

extra["springCloudVersion"] = "2022.0.0-SNAPSHOT"
extra["confluentVersion"] = "7.3.0"
extra["avroVersion"] = "1.11.1"

dependencies {
    implementation("org.springframework.boot:spring-boot-starter-web")
    implementation("org.springframework.boot:spring-boot-starter-actuator")
    implementation("org.springframework.cloud:spring-cloud-starter-kubernetes-fabric8-config")
    implementation("org.springframework.boot:spring-boot-starter-data-mongodb")
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    implementation("org.springframework.cloud:spring-cloud-starter-bootstrap")
    implementation("org.springframework.cloud:spring-cloud-stream")
    implementation("org.springframework.cloud:spring-cloud-stream-binder-kafka-streams")
    implementation("io.micrometer:micrometer-tracing-bridge-brave")
    implementation("io.confluent:kafka-avro-serializer:${property("confluentVersion")}")
    implementation("io.confluent:kafka-schema-registry-client:${property("confluentVersion")}")
    implementation("io.confluent:kafka-streams-avro-serde:${property("confluentVersion")}")
    implementation("org.apache.avro:avro:${property("avroVersion")}")
    implementation("io.micrometer:micrometer-registry-prometheus")
    implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
    implementation("javax.money:money-api:1.1")
    implementation("org.javamoney:moneta:1.4.2")
    implementation("com.atlassian.commonmark:commonmark:0.17.0")
</code>```

I've generated the native image using:

```<code>./gradlew clean  bootBuildImage
</code>```

The image is started specifying a couple of profiles:

```<code>docker run -p 8080:8080 -e SPRING_PROFILES_ACTIVE=local,confluent-cloud docker.io/library/myapp:2.0.0-SNAPSHOT
</code>```

It fails with Web application could not be started as there was no org.springframework.boot.web.servlet.server.ServletWebServerFactory bean defined in the context..

```<code>2022-12-15T20:12:25.981Z  INFO [,,] 1 --- [           main] i.s.m.MyAppKt      : Starting AOT-processed MyAppKt using Java 17.0.5 with PID 1 (/workspace/i.s.m.MyAppKt started by cnb in /workspace)
2022-12-15T20:12:25.981Z  INFO [,,] 1 --- [           main] i.s.m.MyAppKt      : The following 2 profiles are active: "local", "confluent-cloud"
2022-12-15T20:12:25.985Z  WARN [,,] 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server
2022-12-15T20:12:25.985Z ERROR [,,] 1 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

Web application could not be started as there was no org.springframework.boot.web.servlet.server.ServletWebServerFactory bean defined in the context.
</code>```

What could be the problem here?

Body:
I've upgraded a quite complex Spring Boot application to Boot 3.0 and Cloud 2022.0.0-SNAPSHOT.

These are the defined dependencies:

plugins {
    id("org.springframework.boot") version "3.0.0"
    id("io.spring.dependency-management") version "1.1.0"
    id("com.github.davidmc24.gradle.plugin.avro") version "1.5.0"
    jacoco
    kotlin("jvm") version "1.7.21"
    kotlin("plugin.spring") version "1.7.21"
    id("org.graalvm.buildtools.native") version "0.9.19"
}

java.sourceCompatibility = VERSION_17

repositories {
    maven { url = uri("https://repo.spring.io/milestone") }
    maven { url = uri("https://repo.spring.io/snapshot") }
    mavenCentral()
    maven { url = uri("https://packages.confluent.io/maven") }
    maven { url = uri("https://oss.jfrog.org/artifactory/oss-snapshot-local") }

}

extra["springCloudVersion"] = "2022.0.0-SNAPSHOT"
extra["confluentVersion"] = "7.3.0"
extra["avroVersion"] = "1.11.1"

dependencies {
    implementation("org.springframework.boot:spring-boot-starter-web")
    implementation("org.springframework.boot:spring-boot-starter-actuator")
    implementation("org.springframework.cloud:spring-cloud-starter-kubernetes-fabric8-config")
    implementation("org.springframework.boot:spring-boot-starter-data-mongodb")
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    implementation("org.springframework.cloud:spring-cloud-starter-bootstrap")
    implementation("org.springframework.cloud:spring-cloud-stream")
    implementation("org.springframework.cloud:spring-cloud-stream-binder-kafka-streams")
    implementation("io.micrometer:micrometer-tracing-bridge-brave")
    implementation("io.confluent:kafka-avro-serializer:${property("confluentVersion")}")
    implementation("io.confluent:kafka-schema-registry-client:${property("confluentVersion")}")
    implementation("io.confluent:kafka-streams-avro-serde:${property("confluentVersion")}")
    implementation("org.apache.avro:avro:${property("avroVersion")}")
    implementation("io.micrometer:micrometer-registry-prometheus")
    implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
    implementation("javax.money:money-api:1.1")
    implementation("org.javamoney:moneta:1.4.2")
    implementation("com.atlassian.commonmark:commonmark:0.17.0")

I've generated the native image using:

./gradlew clean  bootBuildImage

The image is started specifying a couple of profiles:

docker run -p 8080:8080 -e SPRING_PROFILES_ACTIVE=local,confluent-cloud docker.io/library/myapp:2.0.0-SNAPSHOT

It fails with Web application could not be started as there was no org.springframework.boot.web.servlet.server.ServletWebServerFactory bean defined in the context..

2022-12-15T20:12:25.981Z  INFO [,,] 1 --- [           main] i.s.m.MyAppKt      : Starting AOT-processed MyAppKt using Java 17.0.5 with PID 1 (/workspace/i.s.m.MyAppKt started by cnb in /workspace)
2022-12-15T20:12:25.981Z  INFO [,,] 1 --- [           main] i.s.m.MyAppKt      : The following 2 profiles are active: "local", "confluent-cloud"
2022-12-15T20:12:25.985Z  WARN [,,] 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server
2022-12-15T20:12:25.985Z ERROR [,,] 1 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

Web application could not be started as there was no org.springframework.boot.web.servlet.server.ServletWebServerFactory bean defined in the context.

What could be the problem here?


问:
Using the Reduce Function to calculate the Values of more than two integers in a TUPLE
#I am having trouble calling the third, fourth, and fifth integers from my tuple in the reduce function.
#The program runs when I omit the 'Jeans', 'Ointment', 'and Trees' pairs from the tuple

#The error that I receive is 'NameError: name 'e' is not defined'

#In addition to this would there be a way to prevent a "," from being shown before and after the fifth element in the tuple?

from functools import reduce

print("Your luxury pack of:", end = " ")

luxuryPack = [
    ('Candy', 5),
    ('Video Games', 64),
    ('Jeans', 69)
    ('Ointment', 7),
    ('and Trees', 420)
]

total = reduce(lambda a,b,c,d,e: a[1] + b[1] +c[1] + d[1], e[1], luxuryPack)

for x in luxuryPack:
      print(x[0], end = ", ")

print("costs", total)
```

I tried deleting the last three items of the tuple and it worked, however, I can't get the lambda function to work with more than two variables.

Body:
#I am having trouble calling the third, fourth, and fifth integers from my tuple in the reduce function.
#The program runs when I omit the 'Jeans', 'Ointment', 'and Trees' pairs from the tuple

#The error that I receive is 'NameError: name 'e' is not defined'

#In addition to this would there be a way to prevent a "," from being shown before and after the fifth element in the tuple?

from functools import reduce

print("Your luxury pack of:", end = " ")

luxuryPack = [
    ('Candy', 5),
    ('Video Games', 64),
    ('Jeans', 69)
    ('Ointment', 7),
    ('and Trees', 420)
]

total = reduce(lambda a,b,c,d,e: a[1] + b[1] +c[1] + d[1], e[1], luxuryPack)

for x in luxuryPack:
      print(x[0], end = ", ")

print("costs", total)

I tried deleting the last three items of the tuple and it worked, however, I can't get the lambda function to work with more than two variables.


问:
OAuth grant for authentication via device
I have a authentication schema where a user is authenticated via his phone device ( certificate on SIM card ). User enters their phone number and gets an authentication to confirm via the phone ( using a PIN they only know ). This question could also apply if a user would be authenticated via a phone app for example Microsoft Authenticator. Its essentially the 2nd factor in a 2FA but without the first one.

In my case the user only supplies his phone number, in the case of a app verification the user could supply for example a username.

Now if I would want to apply this as the authentication for a OAuth provider, as in an external 3rd party provider, I could probably safely use authorization code grant, user is routed to IDP, inserts their phone number instead of user/pass, etc.

However since the user isn't supplying any sensitive data on the IDP site I feel like I should have to be able to skip routing to the IDP page and just use server side proxying to send the phone number to IDP, which activates the auth process on their phone, but in the browser they never leave the login site.

I'm assuming using the authorization code grant ( solely with server side communication ) is not intended usage. Is it safe, or is there another grant that would fulfill these requirements.


问:
Can I use a calculated metric in a control to filter data?
Can I use a calculated metric in a control to filter data?

I created a CASE calculated field from two metric values (dates) I created but I can't add the new "child due date changed" field to a control to filter by "Y" or "N".

Case - child due date changed:
Case
When [MAX Due_Date] != [Original Due Date] THEN "Y"
Else "N"
END

Above, [MAX Due_Date] and [Original Due Date] are both also metrics.

Is it possible to use a metric in a control to filter data? I did this same type of CASE statement before and it was created as a dimension instead of a metric which allows me to filter by the assigned text values.

Working CASE example:
Case
When Dep At Risk Reason = 'Not at risk' then "Ok"
Else "At Risk"
END

This dimension case statement field can be added to a control to filter my dashboard data.


问:
Why is the argument getting passed in to this python method treated this way?
version: Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]

Setup:

```<code>class _Mixin:
    def vars_to_dct(self, results=[]):
        dct = self.to_dict()
        for k in dct.keys():
            results.append(k)
        return results

@dataclass
class ClassA(_Mixin):
    a: str = ""
    b: str = ""

@dataclass
class ClassB(_Mixin):
    c: str = ""
    d: str = ""
    e: str = ""
</code>```

Instantiate ClassA and method by itself. This is fine:

```<code>a = ClassA()
assert ["a", "b"] == a.vars_to_dct()
</code>```

Instantiate ClassB and method by itself. This is fine:

```<code>b = ClassB()
assert ["c", "d", "e"] == b.vars_to_dct()
</code>```

Instantiate ClassA and ClassB together. This is not fine:

AssertionError

```<code>a = ClassA()
assert ["a", "b"] == a.vars_to_dct()

b = ClassB()
assert ["c", "d", "e"] == b.vars_to_dct()
</code>```

What actually happens:

```<code>b = ClassB()
assert ["a", "b", "c", "d", "e"] == b.vars_to_dct()
</code>```

Explicitly redeclaring the argument also works fine:

```<code>b = ClassB()
assert ["c", "d", "e"] == b.vars_to_dct(results=[])
</code>```

Note: I have tried to apply the answers here to this behaviour:

python why are the object properties leaking into one another

How to avoid having class data shared among instances?

But the difference and my question is: I am explicitly declaring the argument to the method.

Why is the argument results=[] on the method not recognised when it's run again?

```<code>    def vars_to_dct(self, results=[]):
</code>```

Can someone confirm for me that it really is official Python behaviour to have variables declared in methods to be "static members"/"class variables"?

Body:
version: Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]

Setup:

class _Mixin:
    def vars_to_dct(self, results=[]):
        dct = self.to_dict()
        for k in dct.keys():
            results.append(k)
        return results

@dataclass
class ClassA(_Mixin):
    a: str = ""
    b: str = ""

@dataclass
class ClassB(_Mixin):
    c: str = ""
    d: str = ""
    e: str = ""

Instantiate ClassA and method by itself. This is fine:

a = ClassA()
assert ["a", "b"] == a.vars_to_dct()

Instantiate ClassB and method by itself. This is fine:

b = ClassB()
assert ["c", "d", "e"] == b.vars_to_dct()

Instantiate ClassA and ClassB together. This is not fine:

AssertionError

a = ClassA()
assert ["a", "b"] == a.vars_to_dct()

b = ClassB()
assert ["c", "d", "e"] == b.vars_to_dct()

What actually happens:

b = ClassB()
assert ["a", "b", "c", "d", "e"] == b.vars_to_dct()

Explicitly redeclaring the argument also works fine:

b = ClassB()
assert ["c", "d", "e"] == b.vars_to_dct(results=[])

Note: I have tried to apply the answers here to this behaviour:

python why are the object properties leaking into one another

How to avoid having class data shared among instances?

But the difference and my question is: I am explicitly declaring the argument to the method.

Why is the argument results=[] on the method not recognised when it's run again?

    def vars_to_dct(self, results=[]):

Can someone confirm for me that it really is official Python behaviour to have variables declared in methods to be "static members"/"class variables"?


问:
How to change only the int inside a string?
I want to make voice channels stats for my server and I want to edit the channels name automatically even if I change the name of that channel in what I want. Can you help me?</p>
```<code>    number = 0
    AllMemers_channelName = 'All Members: {}'.format(number)
    AllMemers_channel = nextcord.utils.get(ctx.guild.voice_channels, bitrate = 81000)
    number = len(ctx.guild.members)
    if AllMemers_channelName != AllMemers_channel.name:
        AllMemers_channelName = AllMemers_channel.name
        number = [int(i) for i in re.findall(r'\d+', AllMemers_channelName)]
        await AllMemers_channel.edit(name = AllMemers_channelName)
    else:
        await AllMemers_channel.edit(name = AllMemers_channelName)
</code>```

Body:
I want to make voice channels stats for my server and I want to edit the channels name automatically even if I change the name of that channel in what I want. Can you help me?

    number = 0
    AllMemers_channelName = 'All Members: {}'.format(number)
    AllMemers_channel = nextcord.utils.get(ctx.guild.voice_channels, bitrate = 81000)
    number = len(ctx.guild.members)
    if AllMemers_channelName != AllMemers_channel.name:
        AllMemers_channelName = AllMemers_channel.name
        number = [int(i) for i in re.findall(r'\d+', AllMemers_channelName)]
        await AllMemers_channel.edit(name = AllMemers_channelName)
    else:
        await AllMemers_channel.edit(name = AllMemers_channelName)


问:
How to build/compile Pwnat
I have cloned the source of pwnat from it's github

```<code>git clone https://github.com/samyk/pwnat
</code>```

But there appears to be no make file in the source

```<code># make
gcc -Wall -Wshadow -Wpointer-arith -Wwrite-strings -D LINUX   -c -o socket.o socket.c
make: gcc: No such file or directory
make: *** [<builtin>: socket.o] Error 127
</code>```

I want the program pwnat. How to compile it?

Title: How to build/compile Pwnat

Body:
I have cloned the source of pwnat from it's github

git clone https://github.com/samyk/pwnat

But there appears to be no make file in the source

# make
gcc -Wall -Wshadow -Wpointer-arith -Wwrite-strings -D LINUX   -c -o socket.o socket.c
make: gcc: No such file or directory
make: *** [<builtin>: socket.o] Error 127

I want the program pwnat. How to compile it?


问:
SSRS Report - Image always pushed to next page when converting to PDF
I have an SSRS report with two JPEG images of bar graphs.

The two images in my report designer are stacked on top of each other.
Both are contained in a Rectangle.

When I run the report, it displays correctly in my browser and report viewer:

However, when I download the report as a PDF, the bottom image always gets pushed to the second page.

I've tried adjusting the sizing of them, as well as different image formats.
However, no matter what sizing or format I use, the bottom image always moves to the next page in the PDF.

I've even placed the images in a table, each image in a different cell, and I still get the same problem.

The only thing that works is if I place the images side-by-side.


问:
How achieve similar preciseness in Cloud Vision API detection as Google Lens?
I would like to detect different plants via Cloud Vision API. I have previously admired the preciseness of Google Lens when detecting plants, but when I try the same thing via Cloud Vision API, I do not get nearly as neat results. It gets the plant family and gives some wrong labels as the most ambiguous results (less than 60% topicality).

Am I missing some step or is it even possible to get results with similar precision with Cloud Vision API? Are there any other (non-Google?) APIs around?

Google Lens detects white dead-nettle as first result:

Cloud Vision API gets the nettle family correct, and offers some wrong plants:

I have tried to find API that would give me similar results as Google Lens, and all answers seem to point to Cloud Vision API, yet it isn't nearly as precise.


问:
Change RDL Report Connection String on Power BI Service
A SSRS report RDL file is uploaded to Power BI Service. But there is nowhere the database server and database name can be changed.</p>


问:
Odd behavior from AWS Elastic Container Registry in us-east-2
I'm having a strange problem pulling an image from ECR into my EC2 instances. This command:

```<code>aws ecr get-login-password --region us-east-2
</code>```

times out. This has been working for months (I'm familiar with this link that describes how to trouble-shoot logging into ECR, and that's not the problem).

Here's what weird:

get-login-password works successfully from my local machine when I'm pushing to or pulling a container from ECR, but fails when I want to try to pull that image from ECR to an EC2 instance (same AWS credentials are used).

But if I use a different region (us-east-1 or us-west-1), a password is returned.

I'm using version 2.7.7 of the aws CLI on my EC2 instance and 2.5.6 on my local machine (a mac).

I have admin privileges on AWS.

aws sts-caller-identity returns successfully, so my credentials are valid.

As far as I know, nothing has changed in w/r/t the EC2 instances (I'm the admin)

I turned on debug - here's the relevant stack trace:

2022-12-15 19:53:23,884 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (3): api.ecr.us-east-2.amazonaws.com:443

2022-12-15 19:56:24,064 - MainThread - botocore.endpoint - DEBUG -  Exception received when sending HTTP request

Traceback (most recent call last):

File "urllib3/connection.py", line 174, in _new_conn

File "urllib3/util/connection.py", line 95, in create_connection

File "urllib3/util/connection.py", line 85, in create_connection

socket.timeout: timed out

My assumption would be that there's an issue with the ECR service in us-east-2 except that I can login and push or pull containers from my local machine but not from my EC2 instances.

Body:
I'm having a strange problem pulling an image from ECR into my EC2 instances. This command:

aws ecr get-login-password --region us-east-2

times out. This has been working for months (I'm familiar with this link that describes how to trouble-shoot logging into ECR, and that's not the problem).

Here's what weird:

get-login-password works successfully from my local machine when I'm pushing to or pulling a container from ECR, but fails when I want to try to pull that image from ECR to an EC2 instance (same AWS credentials are used).

But if I use a different region (us-east-1 or us-west-1), a password is returned.

I'm using version 2.7.7 of the aws CLI on my EC2 instance and 2.5.6 on my local machine (a mac).

I have admin privileges on AWS.

aws sts-caller-identity returns successfully, so my credentials are valid.

As far as I know, nothing has changed in w/r/t the EC2 instances (I'm the admin)

I turned on debug - here's the relevant stack trace:

2022-12-15 19:53:23,884 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (3): api.ecr.us-east-2.amazonaws.com:443

2022-12-15 19:56:24,064 - MainThread - botocore.endpoint - DEBUG -  Exception received when sending HTTP request

Traceback (most recent call last):

File "urllib3/connection.py", line 174, in _new_conn

File "urllib3/util/connection.py", line 95, in create_connection

File "urllib3/util/connection.py", line 85, in create_connection

socket.timeout: timed out

My assumption would be that there's an issue with the ECR service in us-east-2 except that I can login and push or pull containers from my local machine but not from my EC2 instances.


问:
Looking to Calculate Lead Times given Backlog and allocation per week
I have two tables, one is a backlog table, and one is an allocation(production) per week table. Both have pictures below. I am looking for a power bi measure that will calculate the backlog in weeks. The answer should be about 7 weeks. (estimate is fine).

The assumption is that this is the beginning of the production week, and we are not getting any new orders.

Everything i have tried failed. I have tried sumx, calculate, countrows. Nothing seems to be working.


问:
How to get an exact pixel-perfect gap between flex elements with justify-content center?
I thought that saying gap: 24px would mean 24px gap, even if I used justify-content: center and flex-wrap: wrap. But it's turning out to not be true, as I resize the screen it grows and shrinks, roughly around 24px but slightly larger and smaller in some cases :/.

```<code>$0.offsetLeft
539
$0.previousElementSibling.offsetLeft + $0.previousElementSibling.offsetWidth
514

539 - 514 = 25 (for example, one measurement)
</code>```

.container {
  position: relative;
}

.grid {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
}

.box {
  flex: 1;
  height: 100px;
  min-width: 140px;
  background: #00ff00;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="container">
  <div class="grid">
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
  </div>
</div></code>```

Try and resizing the screen rendering that demo, the gap gets slightly (barely noticeably) larger and smaller.

How do you prevent this? How can you make it so the gap is hardcoded to 24px?

Body:
I thought that saying gap: 24px would mean 24px gap, even if I used justify-content: center and flex-wrap: wrap. But it's turning out to not be true, as I resize the screen it grows and shrinks, roughly around 24px but slightly larger and smaller in some cases :/.

$0.offsetLeft
539
$0.previousElementSibling.offsetLeft + $0.previousElementSibling.offsetWidth
514

539 - 514 = 25 (for example, one measurement)

.container {
  position: relative;
}

.grid {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
}

.box {
  flex: 1;
  height: 100px;
  min-width: 140px;
  background: #00ff00;
}

Try and resizing the screen rendering that demo, the gap gets slightly (barely noticeably) larger and smaller.

How do you prevent this? How can you make it so the gap is hardcoded to 24px?


问:
Azure App Service with Linux Containers: Purge old deployments
I have set up an Azure Linux App Service to deploy a docker image from an Azure Container Registry. Deployment is done via Azure DevOps.

The docker image deployment went fine, but over time, after some redeployments, the log stream indicates that there's no more space on the device and deployments seem to fail. The error occurs after downloading the new container image on app service startup.

The App Service plan quota tells that there is still 250 GB left but I don't know if the container images are stored within the actual web space or whether the download and extraction of container images is done in a separate storage.

My idea was to purge old docker images.
However, when accessing SSH via Kudu, the docker command is not installed and the SSH user does not have root privileges to install docker.

Am I missing something? I didn't find good documentation on this subject.


问:
None of my Id's are being implemented in android studio
All my .xml files are getting an unvalid ID and background error after importing project to Android Studio. How can I solve this^
I tried to update android studio and nothing occurred. What more can I do in order to fix it? The program ran absolutely fine in another computer, however in this one it has severe errors.</p>
```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:textAlignment="center"
    tools:context=".MainActivity">

    <EditText
        android:id="@+id/EditTextDate"
        android:layout_width="150dp"
        android:layout_height="48dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="28dp"
        android:background="@drawable/registerloginbuttons"
        android:ems="10"
        android:hint="MM/YYYY"
        android:inputType="textPersonName"
        android:paddingStart="12dp"
        android:paddingEnd="12dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView6" />

    <TextView
        android:id="@+id/textView5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:layout_marginEnd="96dp"
        android:text="CVV"
        android:textSize="16sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/EditTextFullName" />

    <EditText
        android:id="@+id/EditTextCVV"
        android:layout_width="100dp"
        android:layout_height="48dp"
        android:layout_marginTop="28dp"
        android:layout_marginEnd="16dp"
        android:background="@drawable/registerloginbuttons"
        android:ems="10"
        android:hint="123"
        android:inputType="textPersonName"
        android:paddingStart="12dp"
        android:paddingEnd="12dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.62"
        app:layout_constraintStart_toEndOf="@+id/EditTextCardNumber"
        app:layout_constraintTop_toBottomOf="@+id/textView5" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="24dp"
        android:text="Card number"
        android:textSize="16sp"
        app:layout_constraintEnd_toStartOf="@+id/textView5"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/EditTextFullName" />

    <TextView
        android:id="@+id/textView6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="24dp"
        android:text="Expiry Date"
        android:textSize="16sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/EditTextCardNumber" />

    <EditText
        android:id="@+id/EditTextCardNumber"
        android:layout_width="250dp"
        android:layout_height="48dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="28dp"
        android:background="@drawable/registerloginbuttons"
        android:ems="10"
        android:hint="4111 1111 1111 1111"
        android:inputType="textPersonName"
        android:paddingStart="12dp"
        android:paddingEnd="12dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView4" />

    <EditText
        android:id="@+id/EditTextFullName"
        android:layout_width="0dp"
        android:layout_height="48dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="32dp"
        android:layout_marginEnd="16dp"
        android:background="@drawable/registerloginbuttons"
        android:ems="10"
        android:hint="Full Name"
        android:inputType="textPersonName"
        android:paddingStart="12dp"
        android:paddingEnd="12dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/radioGroup2" />

</code>```

Body:
All my .xml files are getting an unvalid ID and background error after importing project to Android Studio. How can I solve this^
I tried to update android studio and nothing occurred. What more can I do in order to fix it? The program ran absolutely fine in another computer, however in this one it has severe errors.

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:textAlignment="center"
    tools:context=".MainActivity">

    <EditText
        android:id="@+id/EditTextDate"
        android:layout_width="150dp"
        android:layout_height="48dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="28dp"
        android:background="@drawable/registerloginbuttons"
        android:ems="10"
        android:hint="MM/YYYY"
        android:inputType="textPersonName"
        android:paddingStart="12dp"
        android:paddingEnd="12dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView6" />

    <TextView
        android:id="@+id/textView5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:layout_marginEnd="96dp"
        android:text="CVV"
        android:textSize="16sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/EditTextFullName" />

    <EditText
        android:id="@+id/EditTextCVV"
        android:layout_width="100dp"
        android:layout_height="48dp"
        android:layout_marginTop="28dp"
        android:layout_marginEnd="16dp"
        android:background="@drawable/registerloginbuttons"
        android:ems="10"
        android:hint="123"
        android:inputType="textPersonName"
        android:paddingStart="12dp"
        android:paddingEnd="12dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.62"
        app:layout_constraintStart_toEndOf="@+id/EditTextCardNumber"
        app:layout_constraintTop_toBottomOf="@+id/textView5" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="24dp"
        android:text="Card number"
        android:textSize="16sp"
        app:layout_constraintEnd_toStartOf="@+id/textView5"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/EditTextFullName" />

    <TextView
        android:id="@+id/textView6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="24dp"
        android:text="Expiry Date"
        android:textSize="16sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/EditTextCardNumber" />

    <EditText
        android:id="@+id/EditTextCardNumber"
        android:layout_width="250dp"
        android:layout_height="48dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="28dp"
        android:background="@drawable/registerloginbuttons"
        android:ems="10"
        android:hint="4111 1111 1111 1111"
        android:inputType="textPersonName"
        android:paddingStart="12dp"
        android:paddingEnd="12dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView4" />

    <EditText
        android:id="@+id/EditTextFullName"
        android:layout_width="0dp"
        android:layout_height="48dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="32dp"
        android:layout_marginEnd="16dp"
        android:background="@drawable/registerloginbuttons"
        android:ems="10"
        android:hint="Full Name"
        android:inputType="textPersonName"
        android:paddingStart="12dp"
        android:paddingEnd="12dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/radioGroup2" />


问:
How to use cluster argument in joint model in JM package R
I am running a joint model in R using the JM package. I have been receiving an error when I ran this code:

*jointFit<- jointModel(lmeFit, coxFit, timeVar="mesure", method='piecewise-PH-aGH")*
```

The errror is:

Error in jointFit<- jointModel(lmeFit, coxFit, timeVar="mesure", method='piecewise-PH-aGH"): sample sizes in the longitudinal and event processes differ; maybe you forgot the cluster() argument.

Body:
I am running a joint model in R using the JM package. I have been receiving an error when I ran this code:

*jointFit<- jointModel(lmeFit, coxFit, timeVar="mesure", method='piecewise-PH-aGH")*

The errror is:

Error in jointFit<- jointModel(lmeFit, coxFit, timeVar="mesure", method='piecewise-PH-aGH"): sample sizes in the longitudinal and event processes differ; maybe you forgot the cluster() argument.


问:
narrow a window function's
I have just started learning sql and I have a question:

What function to narrow a window function's application to a subgroup within a data set?
is it OVERLAY(PARTITION BY, OVER (partition by),SUBGROUP(PARTITION BY , or SESSION(PARTITION BY ?

Thanks

couple googling but still zonk

Title: narrow a window function's


问:
Why do I get an #N/A error in my XLookUp formula?
I'm trying to insert a simple XLookup formula with the lookup value on one sheet and the lookup array and return array on a different sheet. I keep getting a #N/A result and I don't understand why.

The lookup value sheet is:

The array sheet is:

The formula I'm using is: =XLOOKUP([@ActivityCode],Query_NameProdAvailCode[Code],Query_NameProdAvailCode[Active])

My desired outcome is to lookup the "ActivityCode" from the lookup value sheet - in Col C and return the corresponding code from the array sheet Col C.

Example:

For the first row. ActivityCode 4 = N

The result I end up getting is:


问:
Webpack with yarn react tailwind, yarn build won't load css files
I am using webpack, yarn, react from scratch, and tailwind.
In dev mode everything works, but in production mode my app won't load tailwind css styles at all.
I can't get the scripts to work in my package.json file, and I think that my webpack.prod.js configurations are the problem. Please help me!

This is my webpack.common.js file

```<code>const path = require("path");

module.exports = {
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, 'dist' ),
    filename: 'bundle.js'
  },

  module: {
    rules: [
    {
      test: /\.css$/,
      use: ['style-loader',
      { loader: 'css-loader', options: {importLoaders: 1}
        },
        'postcss-loader'
      ]
    },
    {
      test:  /\.js$|jsx/,
      exclude:
        /node_modules/,
      use: {
        loader:
          'babel-loader',
        options: {
          presets: [
            '@babel/preset-react',
            '@babel/preset-env',
          ],
          plugins: [
            '@babel/plugin-transform-runtime',
          ],
        },

      },
    },
    ],
  },

};
</code>```

This is my webpack.dev.js file

```<code>
const HtmlWebpackPlugin = require('html-webpack-plugin');

const {
  merge,
} = require('webpack-merge');

const commonConfig = require('./webpack.common');

const devConfig = {
  mode: 'development',
  devServer: {
    port: 8001,
  },
  plugins: [
    new HtmlWebpackPlugin({
      template:
        './dist/index.html',
    }),

  ],
};

module.exports = merge(
  commonConfig,
  devConfig
);
</code>```

This is my webpack.prod.js file

```<code>
const { merge } = require('webpack-merge');

const common = require('./webpack.common.js');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

module.exports = merge(common, {
  mode: 'production',
  devtool: 'source-map',
  module: {
    rules: [
      {
        test: /\.css$/i,
        use: [MiniCssExtractPlugin.loader, "css-loader"],
      },
    ],
  },
  plugins: [

    new MiniCssExtractPlugin({
      filename: 'styles/[name].[contenthash].css',
      chunkFilename: '[id].css',
    }),
  ],
}
);
</code>```

And this is my package.json file

```<code>
{
  "name": "llll",
  "version": "1.0",
  "description": "Taxes Calculator",
  "main": "index.js",
  "author": "lll",
  "license": "MIT",
  "scripts": {
    "build": "webpack --config webpack.prod.js && watch:css",
    "start": "webpack-dev-server --config webpack.dev.js && watch:css",
    "watch:css": "npx tailwindcss -i ./src/input.css -o ./dist/output.css --watch"
  },
  "dependencies": {
    "@babel/core": "^7.20.5",
    "@babel/plugin-transform-runtime": "^7.19.6",
    "@babel/preset-react": "^7.18.6",
    "babel-loader": "^9.1.0",
    "html-webpack-plugin": "^5.5.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-router-dom": "^6.4.5",
    "webpack": "^5.75.0",
    "webpack-merge": "^5.8.0"
  },
  "devDependencies": {
    "@babel/preset-env": "^7.20.2",
    "@types/mini-css-extract-plugin": "^2.5.1",
    "autoprefixer": "^10.4.13",
    "css-loader": "^6.7.2",
    "mini-css-extract-plugin": "^2.7.2",
    "postcss": "^8.4.20",
    "postcss-cli": "^10.1.0",
    "postcss-loader": "^7.0.2",
    "postcss-preset-env": "^7.8.3",
    "style-loader": "^3.3.1",
    "tailwindcss": "^3.2.4",
    "webpack-cli": "^5.0.1",
    "webpack-dev-server": "^4.11.1"
  }
}

</code>```

Body:
I am using webpack, yarn, react from scratch, and tailwind.
In dev mode everything works, but in production mode my app won't load tailwind css styles at all.
I can't get the scripts to work in my package.json file, and I think that my webpack.prod.js configurations are the problem. Please help me!

This is my webpack.common.js file

const path = require("path");

module.exports = {
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, 'dist' ),
    filename: 'bundle.js'
  },

  module: {
    rules: [
    {
      test: /\.css$/,
      use: ['style-loader',
      { loader: 'css-loader', options: {importLoaders: 1}
        },
        'postcss-loader'
      ]
    },
    {
      test:  /\.js$|jsx/,
      exclude:
        /node_modules/,
      use: {
        loader:
          'babel-loader',
        options: {
          presets: [
            '@babel/preset-react',
            '@babel/preset-env',
          ],
          plugins: [
            '@babel/plugin-transform-runtime',
          ],
        },

      },
    },
    ],
  },

};

This is my webpack.dev.js file

const HtmlWebpackPlugin = require('html-webpack-plugin');

const {
  merge,
} = require('webpack-merge');

const commonConfig = require('./webpack.common');

const devConfig = {
  mode: 'development',
  devServer: {
    port: 8001,
  },
  plugins: [
    new HtmlWebpackPlugin({
      template:
        './dist/index.html',
    }),

  ],
};

module.exports = merge(
  commonConfig,
  devConfig
);

This is my webpack.prod.js file

const { merge } = require('webpack-merge');

const common = require('./webpack.common.js');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

module.exports = merge(common, {
  mode: 'production',
  devtool: 'source-map',
  module: {
    rules: [
      {
        test: /\.css$/i,
        use: [MiniCssExtractPlugin.loader, "css-loader"],
      },
    ],
  },
  plugins: [

    new MiniCssExtractPlugin({
      filename: 'styles/[name].[contenthash].css',
      chunkFilename: '[id].css',
    }),
  ],
}
);

And this is my package.json file

{
  "name": "llll",
  "version": "1.0",
  "description": "Taxes Calculator",
  "main": "index.js",
  "author": "lll",
  "license": "MIT",
  "scripts": {
    "build": "webpack --config webpack.prod.js && watch:css",
    "start": "webpack-dev-server --config webpack.dev.js && watch:css",
    "watch:css": "npx tailwindcss -i ./src/input.css -o ./dist/output.css --watch"
  },
  "dependencies": {
    "@babel/core": "^7.20.5",
    "@babel/plugin-transform-runtime": "^7.19.6",
    "@babel/preset-react": "^7.18.6",
    "babel-loader": "^9.1.0",
    "html-webpack-plugin": "^5.5.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-router-dom": "^6.4.5",
    "webpack": "^5.75.0",
    "webpack-merge": "^5.8.0"
  },
  "devDependencies": {
    "@babel/preset-env": "^7.20.2",
    "@types/mini-css-extract-plugin": "^2.5.1",
    "autoprefixer": "^10.4.13",
    "css-loader": "^6.7.2",
    "mini-css-extract-plugin": "^2.7.2",
    "postcss": "^8.4.20",
    "postcss-cli": "^10.1.0",
    "postcss-loader": "^7.0.2",
    "postcss-preset-env": "^7.8.3",
    "style-loader": "^3.3.1",
    "tailwindcss": "^3.2.4",
    "webpack-cli": "^5.0.1",
    "webpack-dev-server": "^4.11.1"
  }
}


问:
How to build/compile/load in the QOCI driver in Qt on RHEL 7 Linux?
I am developing a RHEL 7 Qt application and need to connect to an Oracle database. When calling QSqlDatabase::addDatabase("QOCI"), I am prompted with the following:

```<code>QSqlDatabase: QOCI driver not loaded
QSqlDatabase: available drivers: QSQLITE
</code>```

I have Oracle Install Client v11.2 installed, but I'm not sure where to go from here. I've done extensive research and cannot find a solution.

Based on what I saw online, I tried creating an oci directory within my Qt dir (/usr/lib64/qt5/plugins/sqldrivers) and then created an oci.pro file. Its contents are below:

```<code>INCLUDEPATH+=/usr/include/oracle/11.2/client
LIBS+=-L/usr/lib/oracle/11.2/client/lib -lclntsh
TEMPLATE = subdirs
</code>```

I ran qmake-qt5 on this to generate a Makefile, but when I run make, the necessary QOCI .so file is not generated.

Body:
I am developing a RHEL 7 Qt application and need to connect to an Oracle database. When calling QSqlDatabase::addDatabase("QOCI"), I am prompted with the following:

QSqlDatabase: QOCI driver not loaded
QSqlDatabase: available drivers: QSQLITE

I have Oracle Install Client v11.2 installed, but I'm not sure where to go from here. I've done extensive research and cannot find a solution.

Based on what I saw online, I tried creating an oci directory within my Qt dir (/usr/lib64/qt5/plugins/sqldrivers) and then created an oci.pro file. Its contents are below:

INCLUDEPATH+=/usr/include/oracle/11.2/client
LIBS+=-L/usr/lib/oracle/11.2/client/lib -lclntsh
TEMPLATE = subdirs

I ran qmake-qt5 on this to generate a Makefile, but when I run make, the necessary QOCI .so file is not generated.


问:
Connecting to cosmos container from a different python container gives [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed
I have two containers in docker

Python

Cosmos

docker-compose.yml

version: '3'
services:
  python:
    image: brunneis/python:3.7.3-ubuntu-18.04
    container_name: python
    tty: true
    ports:
      - "5000:5000"
    depends_on:
      - cosmos
    volumes:
      - .:/app
    networks:
      - cosmos-network
  cosmos:
    image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator
    container_name: cosmos
    tty: true
    restart: always
    ports:
      - "8081:8081"
      - "8900:8900"
      - "8901:8901"
      - "8979:8979"
      - "10250:10250"
      - "10251:10251"
      - "10252:10252"
      - "10253:10253"
      - "10254:10254"
      - "10255:10255"
      - "10256:10256"
      - "10350:10350"
    volumes:
      - ./cosmos-data:/data
    networks:
      - cosmos-network
networks:
  cosmos-network:
    driver: bridge
```
<p>Now entering to the <strong>python container</strong> and running this script:</p>
<p>main.py</p>
<pre class="lang-py prettyprint-override"><code>from azure.cosmos import CosmosClient

CONFIG = {
    "ENDPOINT": "https://host.docker.internal:8081",
    "PRIMARYKEY": "<KEY>",
}

client = CosmosClient(url=CONFIG["ENDPOINT"], credential=CONFIG["PRIMARYKEY"])

print(client)
</code>```

gives error:

```<code>azure.core.exceptions.ServiceRequestError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1056)
</code>```

I've tried adding certificate to the python container using this command:

cd ~/usr/local/share/ca-certificates
curl -k https://localhost:8081/_explorer/emulator.pem > emulatorcert.crt
sudo update-ca-certificates
```

But still facing the same issue....If someone has connected cosmos container from any internal container (Because connecting from the host machine, it's running fine), please enlighten me.

Body:
I have two containers in docker

Python

Cosmos

docker-compose.yml

version: '3'
services:
  python:
    image: brunneis/python:3.7.3-ubuntu-18.04
    container_name: python
    tty: true
    ports:
      - "5000:5000"
    depends_on:
      - cosmos
    volumes:
      - .:/app
    networks:
      - cosmos-network
  cosmos:
    image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator
    container_name: cosmos
    tty: true
    restart: always
    ports:
      - "8081:8081"
      - "8900:8900"
      - "8901:8901"
      - "8979:8979"
      - "10250:10250"
      - "10251:10251"
      - "10252:10252"
      - "10253:10253"
      - "10254:10254"
      - "10255:10255"
      - "10256:10256"
      - "10350:10350"
    volumes:
      - ./cosmos-data:/data
    networks:
      - cosmos-network
networks:
  cosmos-network:
    driver: bridge

Now entering to the python container and running this script:

main.py

from azure.cosmos import CosmosClient

CONFIG = {
    "ENDPOINT": "https://host.docker.internal:8081",
    "PRIMARYKEY": "<KEY>",
}

client = CosmosClient(url=CONFIG["ENDPOINT"], credential=CONFIG["PRIMARYKEY"])

print(client)

gives error:

azure.core.exceptions.ServiceRequestError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1056)

I've tried adding certificate to the python container using this command:

cd ~/usr/local/share/ca-certificates
curl -k https://localhost:8081/_explorer/emulator.pem > emulatorcert.crt
sudo update-ca-certificates

But still facing the same issue....If someone has connected cosmos container from any internal container (Because connecting from the host machine, it's running fine), please enlighten me.


问:
API Gateway + S3 Integration proxy - Handle key not found
Currently I have an API Gateway integrated with S3 bucket with {proxy} resource.
When a key that doesn't exist is passed it returns "Specified key doesn't exist".
Is there a way to configure the resource/method so it returns a default key (e.g. a 404.html) when the informed one doesn't exist?

I tried adding the 404.html to the Error document in the S3 bucket (it's configured for static website hosting)


问:
How can I dynamically refer to a child class from the super class in Python?
Consider this situation:

class Foo(ABC):
    @abstractmethod
    def some_method(self):
        return

class Bar(Foo):
    def some_method(self, param):
        # do stuff
        return

class Baz(Foo):
    def some_method(self, param):
        # do stuff differently
        return

def do_something_with_obj(some_obj: Foo):
    some_param = 'stuff'
    some_obj.some_method(some_param)

def main(cond):
    if cond:
        obj = Bar()
    else:
        obj = Baz()

    do_something_with_obj(obj)
```

I get an Expected 0 positional arguments error when I try to call some_method() under the do_something_with_obj() method. Of course, this is because I'm essentially calling the abstract method. My question is, how can I dynamically refer to the child class method since I have to choose the right child class based on some condition beforehand?

Body:
Consider this situation:

class Foo(ABC):
    @abstractmethod
    def some_method(self):
        return

class Bar(Foo):
    def some_method(self, param):
        # do stuff
        return

class Baz(Foo):
    def some_method(self, param):
        # do stuff differently
        return

def do_something_with_obj(some_obj: Foo):
    some_param = 'stuff'
    some_obj.some_method(some_param)

def main(cond):
    if cond:
        obj = Bar()
    else:
        obj = Baz()

    do_something_with_obj(obj)

I get an Expected 0 positional arguments error when I try to call some_method() under the do_something_with_obj() method. Of course, this is because I'm essentially calling the abstract method. My question is, how can I dynamically refer to the child class method since I have to choose the right child class based on some condition beforehand?


问:
Xhr request errors are not getting logged on Raygun platform
I have integrated Raygun into one of my angular project and I'm also able to get some of the JavaScript related errors but not reference, syntax and type error on Raygun platform.

Though Raygun is not logging any xhr related errors on their platform. Got 403 Forbidden, 404 Not found and 500 internal server error on my network calls but Raygun did not reported any of those.

I have used the following steps for the setup:

Installed raygun4js package through npm using this command npm install --save raygun4js

Installed @types/raygun4js package through npm using this command npm i --save-dev @types/raygun4js

Added the following code

```<code>import { ErrorHandler } from '@angular/core';

const VERSION_NUMBER = '1.0.0.0';
rg4js('apiKey', "***");
rg4js('setVersion', VERSION_NUMBER);
rg4js('enableCrashReporting', true);
export class RaygunErrorHandler implements ErrorHandler {
  handleError(e: any) {
    rg4js('send', {
      error: e
    });
  }
}
</code>```

I have checked on their docs and different online available resources for xhr related errors but got no help.

What can I more use to get xhr related errors. In case, if it is not possible, let me know that as well. Also please do let me know if I can or cannot get JavaScript reference, syntax and type error, framework related and performance related error also as I'm not getting that as well on Raygun platform.

Body:
I have integrated Raygun into one of my angular project and I'm also able to get some of the JavaScript related errors but not reference, syntax and type error on Raygun platform.

Though Raygun is not logging any xhr related errors on their platform. Got 403 Forbidden, 404 Not found and 500 internal server error on my network calls but Raygun did not reported any of those.

I have used the following steps for the setup:

Installed raygun4js package through npm using this command npm install --save raygun4js

Installed @types/raygun4js package through npm using this command npm i --save-dev @types/raygun4js

Added the following code

import { ErrorHandler } from '@angular/core';

const VERSION_NUMBER = '1.0.0.0';
rg4js('apiKey', "***");
rg4js('setVersion', VERSION_NUMBER);
rg4js('enableCrashReporting', true);
export class RaygunErrorHandler implements ErrorHandler {
  handleError(e: any) {
    rg4js('send', {
      error: e
    });
  }
}

I have checked on their docs and different online available resources for xhr related errors but got no help.

What can I more use to get xhr related errors. In case, if it is not possible, let me know that as well. Also please do let me know if I can or cannot get JavaScript reference, syntax and type error, framework related and performance related error also as I'm not getting that as well on Raygun platform.


问:
org.apache.camel.NoSuchEndpointException: No endpoint could be found for: kafkaMessageTransformer
I was working on upgrade camel from 3.0 to 3.4, but I am facing issue when I trying to start the app. JDK8 and All current camel related version: 3.4.0, except for those 2 artifact:

```<code>camel-restlet(3.0.0-M1)
camel-http4(3.0.0-M1)
</code>```

Define Route and Transformer:

```<code>RouteKafkaMessageTransformer("direct:kafkaMessageTransformer", false),
StepKafkaMessageTransformer("kafkaMessageTransformer", true),
</code>```
```<code>@Component
public class KafkaMessageTransformer {
    @Transactable
    @Loggable
    @Handler
    public void process(Exchange exchange) throws Exception {
        processing Logic...
    }
}
</code>```

Route Usage:

```<code>from(RouteDispatchKafkaMessage.getEndpoint()).id(RouteDispatchKafkaMessage.getEndpoint()).routeId(RouteDispatchKafkaMessage.getEndpoint())
    .bean(StepKafkaMessageTransformer.getEndpoint())

from(RouteKafkaMessageTransformer.getEndpoint())
    .routeId(RouteKafkaMessageTransformer.getEndpoint())
    .bean(StepKafkaMessageTransformer.getEndpoint())
    .id(StepKafkaMessageTransformer.getEndpoint())
;
</code>```

ERROR CONSOLE:

```<code>org.apache.camel.FailedToCreateRouteException: Failed to create route route12 at: >>> To[kafkaMessageTransformer] <<< in route: Route(route12)[From[direct:xxxDispatcher] -> [OnExce... because of No endpoint could be found for: kafkaMessageTransformer, please check your classpath contains the needed Camel component jar.
    at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:393)
    at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:117)
    at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:368)
    at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:342)
    at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2612)
    at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
    at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2435)
    at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
    at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2452)
    at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:121)
    at org.apache.camel.spring.CamelContextFactoryBean.start(CamelContextFactoryBean.java:381)
    at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:428)
    at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:96)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:773)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
    at com.walmart.platform.scm.client.execution.ScmServletContextListener.configureAndRefreshWebApplicationContext(ScmServletContextListener.java:87)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5128)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5653)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1007)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:983)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:639)
    at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1898)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:302)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:633)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:577)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:302)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468)
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1408)
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
    at sun.rmi.transport.Transport$1.run(Transport.java:200)
    at sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could be found for: kafkaMessageTransformer, please check your classpath contains the needed Camel component jar.
    at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:831)
    at org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(AbstractCamelContext.java:768)
    at org.apache.camel.support.CamelContextHelper.resolveEndpoint(CamelContextHelper.java:123)
    at org.apache.camel.reifier.SendReifier.resolveEndpoint(SendReifier.java:43)
    at org.apache.camel.reifier.SendReifier.createProcessor(SendReifier.java:36)
    at org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:766)
    at org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:511)
    at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:391)
    ... 67 more
</code>```

tried to import camel-direct in pom file.

tried to add bean name in the component.

Body:
I was working on upgrade camel from 3.0 to 3.4, but I am facing issue when I trying to start the app. JDK8 and All current camel related version: 3.4.0, except for those 2 artifact:

camel-restlet(3.0.0-M1)
camel-http4(3.0.0-M1)

Define Route and Transformer:

RouteKafkaMessageTransformer("direct:kafkaMessageTransformer", false),
StepKafkaMessageTransformer("kafkaMessageTransformer", true),

@Component
public class KafkaMessageTransformer {
    @Transactable
    @Loggable
    @Handler
    public void process(Exchange exchange) throws Exception {
        processing Logic...
    }
}

Route Usage:

from(RouteDispatchKafkaMessage.getEndpoint()).id(RouteDispatchKafkaMessage.getEndpoint()).routeId(RouteDispatchKafkaMessage.getEndpoint())
    .bean(StepKafkaMessageTransformer.getEndpoint())

from(RouteKafkaMessageTransformer.getEndpoint())
    .routeId(RouteKafkaMessageTransformer.getEndpoint())
    .bean(StepKafkaMessageTransformer.getEndpoint())
    .id(StepKafkaMessageTransformer.getEndpoint())
;

ERROR CONSOLE:

org.apache.camel.FailedToCreateRouteException: Failed to create route route12 at: >>> To[kafkaMessageTransformer] <<< in route: Route(route12)[From[direct:xxxDispatcher] -> [OnExce... because of No endpoint could be found for: kafkaMessageTransformer, please check your classpath contains the needed Camel component jar.
    at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:393)
    at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:117)
    at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:368)
    at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:342)
    at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2612)
    at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
    at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2435)
    at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
    at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2452)
    at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:121)
    at org.apache.camel.spring.CamelContextFactoryBean.start(CamelContextFactoryBean.java:381)
    at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:428)
    at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:96)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:773)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
    at com.walmart.platform.scm.client.execution.ScmServletContextListener.configureAndRefreshWebApplicationContext(ScmServletContextListener.java:87)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5128)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5653)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1007)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:983)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:639)
    at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1898)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:302)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:633)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:577)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:302)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468)
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1408)
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
    at sun.rmi.transport.Transport$1.run(Transport.java:200)
    at sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could be found for: kafkaMessageTransformer, please check your classpath contains the needed Camel component jar.
    at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:831)
    at org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(AbstractCamelContext.java:768)
    at org.apache.camel.support.CamelContextHelper.resolveEndpoint(CamelContextHelper.java:123)
    at org.apache.camel.reifier.SendReifier.resolveEndpoint(SendReifier.java:43)
    at org.apache.camel.reifier.SendReifier.createProcessor(SendReifier.java:36)
    at org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:766)
    at org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:511)
    at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:391)
    ... 67 more

tried to import camel-direct in pom file.

tried to add bean name in the component.