问:
Kafka's producer value serialization is being ignored in Spring Boot 3.0.0 configuration properties
Kafka's serialization properties does not work when I try to send an object by Web Controller.
When I submit an object I receive "value.serializer = class org.apache.kafka.common.serialization.StringSerializer" but it must be JsonSerializer. Cannot find a solution in Google ;(

```<code>    acks = -1
    batch.size = 16384
    bootstrap.servers = [localhost:9092]
    buffer.memory = 33554432
    client.dns.lookup = use_all_dns_ips
    client.id = producer-1

...

    key.serializer = class org.apache.kafka.common.serialization.StringSerializer

...

    ssl.truststore.location = null
    ssl.truststore.password = null
    ssl.truststore.type = JKS
    transaction.timeout.ms = 60000
    transactional.id = null
    value.serializer = class org.apache.kafka.common.serialization.StringSerializer

....

org.apache.kafka.common.errors.SerializationException: Cannot convert value of class ru.sandwichcloud.SandwichOrder to class org.apache.kafka.common.serialization.StringSerializer specified in value.serializer] with root cause

java.lang.ClassCastException: class ru.sandwichcloud.SandwichOrder cannot be cast to class java.lang.String (ru.sandwichcloud.SandwichOrder is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @506c589e; java.lang.String is in module java.base of loader 'bootstrap')
</code>```

My Kafka config properties

```<code>spring:
  config:
    activate:
      on-profile: kafka
  kafka:
    bootstrap-servers:
      - localhost:9092
    template:
      default-topic: sandwichcloud.orders.topic
    producer:
      key-serializer: org.apache.kafka.common.serialization.StringSerializer
      value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
      properties:
        "[spring.json.add.type.headers]": false
</code>```

I run my application with profile "kafka".

My kafka service:

```<code>@Profile("kafka")
@Service
public class KafkaOrderMessagingService implements OrderMessagingService {

    private final KafkaTemplate<String, SandwichOrder> kafkaTemplate;

    @Autowired
    public KafkaOrderMessagingService(KafkaTemplate<String, SandwichOrder> kafkaTemplate) {
        this.kafkaTemplate = kafkaTemplate;
    }

    @Override
    public void sendOrder(SandwichOrder order) {
        kafkaTemplate.send("sandwichcloud.orders.topic", order);
    }
}
</code>```

My controller's post method

```<code>    @PostMapping
    public String processOrder(@Valid SandwichOrder order,
                               Errors errors,
                               SessionStatus sessionStatus,
                               @AuthenticationPrincipal User user) {

        if (errors.hasErrors()) {
            return "orderForm";
        }

        order.setUser(user);
        SandwichOrder messagingOrder = orderRepo.save(order);
        orderMessagingService.sendOrder(messagingOrder);
        sessionStatus.setComplete();

        return "redirect:/";
    }
</code>```

I tried to set configuration properties by @Configuration but behavior is the same

```<code>@Profile("kafka")
@Configuration
public class KafkaConfig {

    @Bean
    public Map<String, Object> producerConfig() {
        Map<String, Object> props = new HashMap<>();
        props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
        props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class);
        return props;
    }

    @Bean
    public ProducerFactory<String, SandwichOrder> producerFactory() {
        return new DefaultKafkaProducerFactory<>(producerConfig());
    }

    @Bean
    public KafkaTemplate<String, SandwichOrder> kafkaTemplate(ProducerFactory<String, SandwichOrder> producerFactory) {
        return new KafkaTemplate<String, SandwichOrder>(producerFactory);
    }
}
</code>```

Body:
Kafka's serialization properties does not work when I try to send an object by Web Controller.
When I submit an object I receive "value.serializer = class org.apache.kafka.common.serialization.StringSerializer" but it must be JsonSerializer. Cannot find a solution in Google ;(

    acks = -1
    batch.size = 16384
    bootstrap.servers = [localhost:9092]
    buffer.memory = 33554432
    client.dns.lookup = use_all_dns_ips
    client.id = producer-1

...

    key.serializer = class org.apache.kafka.common.serialization.StringSerializer

...

    ssl.truststore.location = null
    ssl.truststore.password = null
    ssl.truststore.type = JKS
    transaction.timeout.ms = 60000
    transactional.id = null
    value.serializer = class org.apache.kafka.common.serialization.StringSerializer

....

org.apache.kafka.common.errors.SerializationException: Cannot convert value of class ru.sandwichcloud.SandwichOrder to class org.apache.kafka.common.serialization.StringSerializer specified in value.serializer] with root cause

java.lang.ClassCastException: class ru.sandwichcloud.SandwichOrder cannot be cast to class java.lang.String (ru.sandwichcloud.SandwichOrder is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @506c589e; java.lang.String is in module java.base of loader 'bootstrap')

My Kafka config properties

spring:
  config:
    activate:
      on-profile: kafka
  kafka:
    bootstrap-servers:
      - localhost:9092
    template:
      default-topic: sandwichcloud.orders.topic
    producer:
      key-serializer: org.apache.kafka.common.serialization.StringSerializer
      value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
      properties:
        "[spring.json.add.type.headers]": false

I run my application with profile "kafka".

My kafka service:

@Profile("kafka")
@Service
public class KafkaOrderMessagingService implements OrderMessagingService {

    private final KafkaTemplate<String, SandwichOrder> kafkaTemplate;

    @Autowired
    public KafkaOrderMessagingService(KafkaTemplate<String, SandwichOrder> kafkaTemplate) {
        this.kafkaTemplate = kafkaTemplate;
    }

    @Override
    public void sendOrder(SandwichOrder order) {
        kafkaTemplate.send("sandwichcloud.orders.topic", order);
    }
}

My controller's post method

    @PostMapping
    public String processOrder(@Valid SandwichOrder order,
                               Errors errors,
                               SessionStatus sessionStatus,
                               @AuthenticationPrincipal User user) {

        if (errors.hasErrors()) {
            return "orderForm";
        }

        order.setUser(user);
        SandwichOrder messagingOrder = orderRepo.save(order);
        orderMessagingService.sendOrder(messagingOrder);
        sessionStatus.setComplete();

        return "redirect:/";
    }

I tried to set configuration properties by @Configuration but behavior is the same

@Profile("kafka")
@Configuration
public class KafkaConfig {

    @Bean
    public Map<String, Object> producerConfig() {
        Map<String, Object> props = new HashMap<>();
        props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
        props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class);
        return props;
    }

    @Bean
    public ProducerFactory<String, SandwichOrder> producerFactory() {
        return new DefaultKafkaProducerFactory<>(producerConfig());
    }

    @Bean
    public KafkaTemplate<String, SandwichOrder> kafkaTemplate(ProducerFactory<String, SandwichOrder> producerFactory) {
        return new KafkaTemplate<String, SandwichOrder>(producerFactory);
    }
}


来源: stackexchange

问:
run a php blog on nuxtjs application
I have one nuxtjs application running on apache server with apache proxy redirect.

Here is website url

```<code>http://staging.example.com
</code>```

There is a blog folder which has wordpress blog which will run on php only. I want to run http://staging.example.com/blog

In apache I have below proxy code

```<code>ProxyPass /blog http://staging.example.com:80/blog
ProxyPassReverse /blog http://staging.example.com:80/blog
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
</code>```

I tried all these links for help

ContentLicense: CC BY-SA 4.0

Title: run a php blog on nuxtjs application

Body:
I have one nuxtjs application running on apache server with apache proxy redirect.

Here is website url

http://staging.example.com

There is a blog folder which has wordpress blog which will run on php only. I want to run http://staging.example.com/blog

In apache I have below proxy code

ProxyPass /blog http://staging.example.com:80/blog
ProxyPassReverse /blog http://staging.example.com:80/blog
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/

I tried all these links for help


问:
Getting the Requested Result
Hello although the content returns 200 in the loop below, the 'ad_link' that I want to pull from the database does not appear on the screen. Can you help me find the reason?

```<code>response = requests.get(ad_link,headers=headers,allow_redirects=True)
            print(response)
            if response.history:
                print("Request was redirected")
                for resp in response.history:
                    print(resp.status_code, resp.ad_link)
                print("Final destination:")
                print(response.status_code, response.ad_link)
            else:
                print("Request was not redirected")
</code>```

Request was not redirected, it says. The status code is 200.

Title: Getting the Requested Result

Body:
Hello although the content returns 200 in the loop below, the 'ad_link' that I want to pull from the database does not appear on the screen. Can you help me find the reason?

response = requests.get(ad_link,headers=headers,allow_redirects=True)
            print(response)
            if response.history:
                print("Request was redirected")
                for resp in response.history:
                    print(resp.status_code, resp.ad_link)
                print("Final destination:")
                print(response.status_code, response.ad_link)
            else:
                print("Request was not redirected")

Request was not redirected, it says. The status code is 200.


问:
Magento 2 - Cache clean issue
I'm using Cloudways server, where I have two Magento applications:
dev - path - /applications/dev/public_html
prod - path - /applications/prod/public_html
I'm also using Full Page cache warmer by Mirasvit. I have 100% cached pages on prod app.

When I run bin/magento cache:clean on dev application, the cached pages on prod application are cleaned (their status changes from cached to pending).

Can someone help me where can be the problem ?

Title: Magento 2 - Cache clean issue


问:
Unable to automate OTP login using appium java (Android App)
I am calling OTP from API and sending respective values to respective fields.
1: Values are correct (4 digit value)
2: Data type required for values is also correct (Its String).
Still app is displaying message that "Invalid value for OTP"

Tried to automate OTP verification login and expecting that app would logged in successfully.


问:
What is the purpose of "SLL" in this code?
```<code>#switch ( a [ j * 2 + 1 ] ) {
switch01_test:
la $t0 , j               # $t0 <− address of j
lw $t1 , 0( $t0 )        # $t1 <− j
addiu $t2 , $zero , 2    # $t2 <− 2
mul $t3 , $t1 , $t2      # $t3 <− j * 2
addiu $t4 , $t3 , 1      # $t4 <− j * 2 + 1
sll $t5 , $t4 , 2        # $t5 <− 4 *(j*2+1)
la $t6 , a               # $t6 <− base address of a
addu $t7 , $t6 , $t5     # $t7 <− address of a [j*2+1]
lw $t8 , 0( $t7 )        # $t8 <− a[j*2+1]
#Check if a[j*2+1] = 1
addiu $t9 , $zero , 1    # $t9 <− 1
beq $t9 , $t8 , switch01_code_1#if a[j*2+1]=1 execute case 1:
#Check if a[j*2+1] = 3
addiu $t9 , $zero , 3    # $t9 <− 3
beq $t9 , $t8 , switch01_code_3#if a[j*2+1]=3 execute case 3:
#Check if a[j*2+1] = 5
addiu $t9 , $zero , 5    # $t9 <− 5
beq $t9 , $t8 , switch01_code_5#if a[j*2+1]=5 execute case 5:
#a[j*2+1] not equal 1,3 or 5
j switch01_end # switch01 exit
</code>```

What does sll do in the code and why is it necessary?

I understood all the code except the "sll" part

Body:
#switch ( a [ j * 2 + 1 ] ) {
switch01_test:
la $t0 , j               # $t0 <− address of j
lw $t1 , 0( $t0 )        # $t1 <− j
addiu $t2 , $zero , 2    # $t2 <− 2
mul $t3 , $t1 , $t2      # $t3 <− j * 2
addiu $t4 , $t3 , 1      # $t4 <− j * 2 + 1
sll $t5 , $t4 , 2        # $t5 <− 4 *(j*2+1)
la $t6 , a               # $t6 <− base address of a
addu $t7 , $t6 , $t5     # $t7 <− address of a [j*2+1]
lw $t8 , 0( $t7 )        # $t8 <− a[j*2+1]
#Check if a[j*2+1] = 1
addiu $t9 , $zero , 1    # $t9 <− 1
beq $t9 , $t8 , switch01_code_1#if a[j*2+1]=1 execute case 1:
#Check if a[j*2+1] = 3
addiu $t9 , $zero , 3    # $t9 <− 3
beq $t9 , $t8 , switch01_code_3#if a[j*2+1]=3 execute case 3:
#Check if a[j*2+1] = 5
addiu $t9 , $zero , 5    # $t9 <− 5
beq $t9 , $t8 , switch01_code_5#if a[j*2+1]=5 execute case 5:
#a[j*2+1] not equal 1,3 or 5
j switch01_end # switch01 exit

What does sll do in the code and why is it necessary?

I understood all the code except the "sll" part


问:
Attempt to assign property "job_title" on null
I'm making a CRUD App, Everything is working fine except Updation. I want to update data in my MySQL table.
Controller code:

```<code>function postupdate(Request $req)
{
    $post_id=$req->get('post_id');
    dd($post_id); //data is pass from blade file,the answer is correct
    $var = post::find($post_id);
    dd($var); // it return "null"
    $var->job_title=$req->input('job_title');
    $var->job_venue=$req->input('job_venue');
    $var->job_address=$req->input('job_address');
    $var->job_salary=$req->input('job_salary');
    $var->job_category=$req->input('job_category');
    $var->job_description=$req->input('job_description');
    $var->job_benefit=$req->input('job_benefit');
    $var->job_highlight=$req->input('job_highlight');
    $var->job_requirement=$req->input('job_requirement');
    $var->update();
    return redirect('searchpost')->with('successMsg','Job Post Successfully !');
}
</code>```

Blade file

```<code><div class="container2">
@foreach(Session::get('result') as $detaa)
<input type="hidden" class="text" placeholder="Company's ID" value="{{ $detaa->id}}"name="id" id="id">
    <img class="background_img" src="/nobackground.jfif" id="background"/>
@if($detaa->company_logo)
        <img src="{{$detaa->company_logo}}" name="image" class="emp_pic" id="image"><h2 style="padding-left:23%;margin-top:-9%;" class="name">{{$detaa->company_name}}<br><br></h2>
@else
    <img class="emp_pic" src="/nologo.png" name="image"id="image"/>
@endif
@endforeach
<br>
@foreach($result as $detaa)
<form action='/postupdate' method='post'enctype="multipart/form-data">
@csrf
<input type="hidden" class="text" placeholder="Post's ID" value="{{ $detaa->post_id}}" name="post_id" id="post_id" required readonly>
    <table>
<tr>
<th>Job title:</th>
<th><input type="text" class="text" placeholder="Job Title" name="job_title" value="{{ $detaa->job_title}}" id="job_title" required></th>
</tr>

<tr>
<th>Venue:</th>
<th><input type="text" class="text"placeholder ="Working Place"  name="job_venue" value="{{ $detaa->job_venue}}" id="job_venue" required></input>
</tr>

</code>```

Since the $var there return "null", so it shows the error "Attempt to assign property "job_title" on null". I had no idea where i did wrong.

Body:
I'm making a CRUD App, Everything is working fine except Updation. I want to update data in my MySQL table.
Controller code:

function postupdate(Request $req)
{
    $post_id=$req->get('post_id');
    dd($post_id); //data is pass from blade file,the answer is correct
    $var = post::find($post_id);
    dd($var); // it return "null"
    $var->job_title=$req->input('job_title');
    $var->job_venue=$req->input('job_venue');
    $var->job_address=$req->input('job_address');
    $var->job_salary=$req->input('job_salary');
    $var->job_category=$req->input('job_category');
    $var->job_description=$req->input('job_description');
    $var->job_benefit=$req->input('job_benefit');
    $var->job_highlight=$req->input('job_highlight');
    $var->job_requirement=$req->input('job_requirement');
    $var->update();
    return redirect('searchpost')->with('successMsg','Job Post Successfully !');
}

Blade file

@foreach(Session::get('result') as $detaa)
<input type="hidden" class="text" placeholder="Company's ID" value="{{ $detaa->id}}"name="id" id="id">

@if($detaa->company_logo)
        company_logo}}" name="image" class="emp_pic" id="image">
{{$detaa->company_name}}

@else

@endif
@endforeach

@foreach($result as $detaa)
<form action='/postupdate' method='post'enctype="multipart/form-data">
@csrf
<input type="hidden" class="text" placeholder="Post's ID" value="{{ $detaa->post_id}}" name="post_id" id="post_id" required readonly>

Job title:
<input type="text" class="text" placeholder="Job Title" name="job_title" value="{{ $detaa->job_title}}" id="job_title" required>

Venue:
<input type="text" class="text"placeholder ="Working Place"  name="job_venue" value="{{ $detaa->job_venue}}" id="job_venue" required></input>

Since the $var there return "null", so it shows the error "Attempt to assign property "job_title" on null". I had no idea where i did wrong.


问:
Grafana: Prometheus timeseries result doesn't retain label after ignoring while joining
While trying to create annotations marking new kubernetes deployments in a service-overview dashboard, I got the annotations set up in the right places using kube_replicaset_created.

I thought it'd be nice to also include the version of the service as the title of the annotation. The kube_replicaset_created timeseries however, doesn't include any relevant labels that I could feed the version into.

I decided to inject the version info via a kubernetes annotation on the replicaset. The timeseries that scrapes the kubernetes annotations is kube_replicaset_annotations. I whitelisted the specific annotation I wanted in my kube_state_metrics configuration.

I used the following query to join the two timeseries in grafana:

```<code>kube_replicaset_created{namespace="$namespace", env="$env", replicaset=~"${job}.*"}
* ignoring(annotation_app_kubernetes_io_version) group_left(annotation_app_kubernetes_io_version)
kube_replicaset_annotations{namespace="$namespace", env="$env", replicaset=~"${job}.*"}
</code>```

When trying this in Grafana's explore tool, the table did return the expected timeseries

Time
annotation_app_kubernetes_io_version
container
endpoint
env
instance
job
namespace
pod
prometheus
prometheus_replica
replicaset
service
Value

2023-01-02 13:19:26.127
v1.320-SNAPSHOT
kube-state-metrics
http
UAT
0.191.91.175:8080
kube-state-metrics
sample-service
kube-state-metrics-dd9-o787hx
prom/prometheus
prometheus-0
sample-service-server-79558b857d
kube-state-metrics
1672314310000

2023-01-02 13:19:26.127
v1.321-SNAPSHOT
kube-state-metrics
http
UAT
0.191.91.175:8080
kube-state-metrics
sample-service
kube-state-metrics-dd9-o787hx
prom/prometheus
prometheus-0
sample-service-server-5fdcfdb55f
kube-state-metrics
1672640446000

2023-01-02 13:19:26.127
v1.321-SNAPSHOT
kube-state-metrics
http
UAT
10.191.91.175:8080
kube-state-metrics
sample-service
kube-state-metrics-dd9-o787hx
prom/prometheus
prometheus-0
sample-service-server-fbdc9db9c
kube-state-metrics
1672640448000

The issue I'm facing is: when I try to use the same query in a Panel or as a query for a dashboard annotation, the label isn't available for use in titles, descriptions, legends, etc.
It just shows the literal label that I used.

Example panel with incorrect interpolation

To make sure it was the label missing and not the result of some other misconfiguration, I tried using {{replicaset}} in the annotation description and it did work. {{replicaset}} was correctly replaced by its value in the result.

I tried the same query in a Panel and tried table view. I expected the behaviour from the Explore tool to be replicated here, but the table was indeed missing the annotation_app_kubernetes_io_version label.

Is there something obvious that I'm missing here? I couldn't find anything describing any sort of  catch in the documentation and no previous Q&As here addressing something similar

Body:
While trying to create annotations marking new kubernetes deployments in a service-overview dashboard, I got the annotations set up in the right places using kube_replicaset_created.

I thought it'd be nice to also include the version of the service as the title of the annotation. The kube_replicaset_created timeseries however, doesn't include any relevant labels that I could feed the version into.

I decided to inject the version info via a kubernetes annotation on the replicaset. The timeseries that scrapes the kubernetes annotations is kube_replicaset_annotations. I whitelisted the specific annotation I wanted in my kube_state_metrics configuration.

I used the following query to join the two timeseries in grafana:

kube_replicaset_created{namespace="$namespace", env="$env", replicaset=~"${job}.*"}
* ignoring(annotation_app_kubernetes_io_version) group_left(annotation_app_kubernetes_io_version)
kube_replicaset_annotations{namespace="$namespace", env="$env", replicaset=~"${job}.*"}

When trying this in Grafana's explore tool, the table did return the expected timeseries

Time
annotation_app_kubernetes_io_version
container
endpoint
env
instance
job
namespace
pod
prometheus
prometheus_replica
replicaset
service
Value

2023-01-02 13:19:26.127
v1.320-SNAPSHOT
kube-state-metrics
http
UAT
0.191.91.175:8080
kube-state-metrics
sample-service
kube-state-metrics-dd9-o787hx
prom/prometheus
prometheus-0
sample-service-server-79558b857d
kube-state-metrics
1672314310000

2023-01-02 13:19:26.127
v1.321-SNAPSHOT
kube-state-metrics
http
UAT
0.191.91.175:8080
kube-state-metrics
sample-service
kube-state-metrics-dd9-o787hx
prom/prometheus
prometheus-0
sample-service-server-5fdcfdb55f
kube-state-metrics
1672640446000

2023-01-02 13:19:26.127
v1.321-SNAPSHOT
kube-state-metrics
http
UAT
10.191.91.175:8080
kube-state-metrics
sample-service
kube-state-metrics-dd9-o787hx
prom/prometheus
prometheus-0
sample-service-server-fbdc9db9c
kube-state-metrics
1672640448000

The issue I'm facing is: when I try to use the same query in a Panel or as a query for a dashboard annotation, the label isn't available for use in titles, descriptions, legends, etc.
It just shows the literal label that I used.

Example panel with incorrect interpolation

To make sure it was the label missing and not the result of some other misconfiguration, I tried using {{replicaset}} in the annotation description and it did work. {{replicaset}} was correctly replaced by its value in the result.

I tried the same query in a Panel and tried table view. I expected the behaviour from the Explore tool to be replicated here, but the table was indeed missing the annotation_app_kubernetes_io_version label.

Is there something obvious that I'm missing here? I couldn't find anything describing any sort of  catch in the documentation and no previous Q&As here addressing something similar


问:
XMPP chat app in background - Show preview of the message in the push notification
I'm trying to connect to XMPP to show the decrypted message when the app is in background.

I'm using a notification service extension and use Darwin notification centre to connect xmpp in the main app from the extension.


问:
Use socket.io with express , mongoose and react to send message from server to unique client only
I'm building a car services application with express react and mongoose. I have two user roles namely a customer and a seller. When a customer places an order a post request is called and order details are saved to mongodb. The order details contain the sellerId and the customerId. How can i use socket.io such that i can emit an event at the end of the post request to the sellerId from the newly saved document and then have it recieved at only that sellerId's Frontend react application. The sellerId will be available inside localStorage bearer token

I can't figure out the code for this


问:
How do I call imported functions from a javascript file to another (which is of type module)?
I want to implement firebase in my web application. Without having to initialize my firebase credentials in all the scripts, I want to initialize it once and then call it in all the scripts. This is how I am going about it:

I created a firebase_credentials.js script:

```<code>import { initializeAppCheck, ReCaptchaV3Provider} from "https://www.gstatic.com/firebasejs/9.14.0/firebase-app-check.js"
import { initializeApp } from 'https://www.gstatic.com/firebasejs/9.14.0/firebase-app.js';
import { getAuth, onAuthStateChanged, signInAnonymously } from "https://www.gstatic.com/firebasejs/9.14.0/firebase-auth.js";
import { getDatabase, ref, update, get, set, push} from "https://www.gstatic.com/firebasejs/9.14.0/firebase-database.js";

export function register_firebase_credentials(){
    const firebaseConfig = {
        apiKey: "xxxxxxxxxxx",
        authDomain: "xxxxxx.firebaseapp.com",
        projectId: "xxxxxx",
        storageBucket: "xxxxxx.appspot.com",
        messagingSenderId: "xxxxxxxxxxxx",
        databaseURL: "https://xxxxxxxxxx.firebaseio.com",
        appId: "x:xxxxxxxxxxxxxxx"
    };
    const app = initializeApp(firebaseConfig);
    const auth = getAuth();
    const db = getDatabase();
    const arr = [];
    signInAnonymously(auth)
        .then(() => {
            onAuthStateChanged(auth, (user) => {
                if (user) {
                    const appCheck = initializeAppCheck(app, {
                        provider: new ReCaptchaV3Provider('xxxxxxxxxxxx'),
                        isTokenAutoRefreshEnabled: true
                    });
                }
            });
        })
        .catch((error) => {
            const errorCode = error.code;
            const errorMessage = error.message;
            console.log(errorCode+": "+errorMessage);
        });

    arr.push(db);
    arr.push(ref);
    arr.push(update);
    arr.push(get);
    arr.push(set);
    arr.push(push);

    return arr;
}
</code>```

Then in my other scripts (which are all of type module) I am calling the firebase_credentials.js like this:

```<code>import {register_firebase_credentials} from '../firebase_credentials.js';

let fb_func_names = register_firebase_credentials();

var db_values = {
      "abc":"some value",
      "def":"some value",
};
fb_func_names[5](fb_func_names[1](fb_func_names[0],"abc/0/"),db_values);

</code>```

My question is this the correct way of calling the script? I want to export some functions which were imported in the firebase_credentials.js script. Is this possible?

Body:
I want to implement firebase in my web application. Without having to initialize my firebase credentials in all the scripts, I want to initialize it once and then call it in all the scripts. This is how I am going about it:

I created a firebase_credentials.js script:

import { initializeAppCheck, ReCaptchaV3Provider} from "https://www.gstatic.com/firebasejs/9.14.0/firebase-app-check.js"
import { initializeApp } from 'https://www.gstatic.com/firebasejs/9.14.0/firebase-app.js';
import { getAuth, onAuthStateChanged, signInAnonymously } from "https://www.gstatic.com/firebasejs/9.14.0/firebase-auth.js";
import { getDatabase, ref, update, get, set, push} from "https://www.gstatic.com/firebasejs/9.14.0/firebase-database.js";

export function register_firebase_credentials(){
    const firebaseConfig = {
        apiKey: "xxxxxxxxxxx",
        authDomain: "xxxxxx.firebaseapp.com",
        projectId: "xxxxxx",
        storageBucket: "xxxxxx.appspot.com",
        messagingSenderId: "xxxxxxxxxxxx",
        databaseURL: "https://xxxxxxxxxx.firebaseio.com",
        appId: "x:xxxxxxxxxxxxxxx"
    };
    const app = initializeApp(firebaseConfig);
    const auth = getAuth();
    const db = getDatabase();
    const arr = [];
    signInAnonymously(auth)
        .then(() => {
            onAuthStateChanged(auth, (user) => {
                if (user) {
                    const appCheck = initializeAppCheck(app, {
                        provider: new ReCaptchaV3Provider('xxxxxxxxxxxx'),
                        isTokenAutoRefreshEnabled: true
                    });
                }
            });
        })
        .catch((error) => {
            const errorCode = error.code;
            const errorMessage = error.message;
            console.log(errorCode+": "+errorMessage);
        });

    arr.push(db);
    arr.push(ref);
    arr.push(update);
    arr.push(get);
    arr.push(set);
    arr.push(push);

    return arr;
}

Then in my other scripts (which are all of type module) I am calling the firebase_credentials.js like this:

import {register_firebase_credentials} from '../firebase_credentials.js';

let fb_func_names = register_firebase_credentials();

var db_values = {
      "abc":"some value",
      "def":"some value",
};
fb_func_names[5](fb_func_names[1](fb_func_names[0],"abc/0/"),db_values);

My question is this the correct way of calling the script? I want to export some functions which were imported in the firebase_credentials.js script. Is this possible?


问:
How to handle notifyItemRemoved for a viewpager with RecyclerView.Adapter having exoplayer, as item removed current postion of the videoplayer update
Im trying to implement exoplayer for playing reels, with a fragment and viewpager with RecyclerView.Adapter.
I am updating the prev and next postion in onPageselected.
and trying to remove the top 5 player instance from the list when it is more than 10.
But this causes the current active postion playing to pause as the postion is updated now.

`

```<code> pagerAdapter = new VideoTestAdapter(requireContext(), new VideoTestAdapter.OnVideoPreparedInterface() {
            @Override
            public void onVideoFun(VideoItemRes videoItems) {
                   videoItemsList.add(videoItems);
            }
        });

        viewPager.setAdapter(pagerAdapter);
        viewPager.setOffscreenPageLimit(3);

        viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {

            @Override
            public void onPageSelected(int position) {
                super.onPageSelected(position);

                mCurrentPosition = position;

                    if (InternetCheckHelper.isConnected()) {
                        reelPresenter.event(videoReelsItems.get(position).getId());
                        if ((videoReelsItems.size() - mCurrentPosition) < 10 &&      !Objects.equals(mCurrentPage, mNext) && !isLastPage) {
//API CALL Pagination
      reelPresenter.getReelsHome(prefConfig.getReelsType(), context, mNext, false, true, true, "");
                            mCurrentPage = mNext;
                        }
                    }
                }

                int previousIndex = -1;
                for (int i = 0; i < videoItemsList.size(); i++) {
                    if (videoItemsList.get(i).getExoPlayerVar().getPlayWhenReady()) {
                        previousIndex = i;
                        break;
                   }
                }

                if (previousIndex != -1) {
                if(position > 0) {
                    exoPlayer = videoItemsList.get(position - 1).getExoPlayerVar();
                    exoPlayer.setPlayWhenReady(false);
                }
                   if (previousIndex != 0)
                       player.release();
               }

                int newIndex = -1;
                for (int i = 0; i < videoItemsList.size(); i++) {
                    if (videoItemsList.get(i).getExoPosition() == position) {
                        newIndex = i;
                        break;
                    }
                }

               if (newIndex != -1) {
                if(position > 0) {
                    exoPlayer = videoItemsList.get(position).getExoPlayerVar();
                    exoPlayer.setPlayWhenReady(true);
                }
                    exoPlayer.getPlayWhenReady();
                }

                if (!videoItemsList.isEmpty() && (videoItemsList.size() - (viewPager.getOffscreenPageLimit())) > 10) {
//                    for (int i = 0; i < mCurrentPosition - 5; i++) {
                    if (position == 7) {
                        SimpleExoPlayer player = videoItemsList.get(3).getExoPlayerVar();
                        player.release();
                        videoItemsList.remove(3);
                        pagerAdapter.getVideos().remove(3);
                        viewPager.post(new Runnable() {
                            public void run() {
                                pagerAdapter.notifyItemRemoved(3);
                            }
                        });
//                    }
                    }

//                }
            }

class VideoTestAdapter(
    private var context:Context,
    private var videoPreparedListener: OnVideoPreparedInterface
) : RecyclerView.Adapter<VideoTestAdapter.VideoViewHolder?>() {
     var videos = listOf<ReelsItem>()
    private var holder: VideoTestAdapter.VideoViewHolder? = null
    private lateinit var videoItem: ReelsItem
    private var defaultBandwidthMeter: DefaultBandwidthMeter? = null
    private var dataSourceFactory: DataSource.Factory? = null
    lateinit var exoPlayer: SimpleExoPlayer
    lateinit var mediaSource: MediaSource

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VideoTestAdapter.VideoViewHolder {
        val view =
            LayoutInflater.from(context).inflate(R.layout.list_video_test, parent, false)
        return VideoViewHolder(view, context, videoPreparedListener)
    }

    override fun onBindViewHolder(holder: VideoTestAdapter.VideoViewHolder, position: Int) {
        this.holder = holder
        if(videos[position] != null){
            videoItem = videos[position];
        }

        Log.e("debug-shifa", "onBindViewHolder: ${videoItem.media}  pos  $position   video size ${videos.size}"  )
//        holder.tvTitle?.text = "testing"
        if(!videoItem.media.isNullOrEmpty())
            holder.setVideoPath(videoItem.media,holder.absoluteAdapterPosition);

    }

    override fun getItemCount(): Int {
        return videos.size
    }

    fun getItemPosition(`object`: Any?): Int {
        Log.e("TAG", "onPageSelected getItemPosition:called ", )
        return POSITION_NONE
    }
    inner class VideoViewHolder(var itemView: View?,
                                var context: Context,
                                var videoPreparedListener: OnVideoPreparedInterface)
        : RecyclerView.ViewHolder(itemView!!) {
        var tvTitle: TextView? = null
        var playerView: PlayerView? = null

        init {
            tvTitle = itemView?.findViewById(R.id.tv_item_title)
            playerView = itemView.findViewById<PlayerView>(R.id.video_view)
        }

        fun setVideoPath(streamUrl: String,  absposition: Int) {
            val loadControl: LoadControl =
                DefaultLoadControl.Builder().setAllocator(DefaultAllocator(true, 16))
                    .setBufferDurationsMs(
                        VideoPlayerConfig.MIN_BUFFER_DURATION,
                        VideoPlayerConfig.MAX_BUFFER_DURATION,
                        VideoPlayerConfig.MIN_PLAYBACK_START_BUFFER,
                        VideoPlayerConfig.MIN_PLAYBACK_RESUME_BUFFER
                    )
                    .setTargetBufferBytes(-1).setPrioritizeTimeOverSizeThresholds(true)
                    .createDefaultLoadControl()

            if (streamUrl.endsWith(".m3u8")) {
                val adaptiveTrackSelection = AdaptiveTrackSelection.Factory()
                exoPlayer = ExoPlayerFactory.newSimpleInstance(
                    context,
                    DefaultTrackSelector(adaptiveTrackSelection),
                    loadControl
                )

                defaultBandwidthMeter = DefaultBandwidthMeter()

                dataSourceFactory = DefaultDataSourceFactory(
                    context,
                    Util.getUserAgent(context, "nib"),
                    defaultBandwidthMeter
                )

                val uri = Uri.parse(streamUrl)

                mediaSource = HlsMediaSource.Factory(dataSourceFactory)
                    .setAllowChunklessPreparation(true)
                    .createMediaSource(uri)

                itemView.findViewById<PlayerView>(R.id.video_view).player = exoPlayer

                exoPlayer.seekTo(0)
                exoPlayer.repeatMode = Player.REPEAT_MODE_OFF

                exoPlayer.prepare(mediaSource)

                exoPlayer.addListener(object : Player.EventListener {
                    override fun onPlayerError(error: ExoPlaybackException?) {
                        super.onPlayerError(error)
                        Toast.makeText(context, "Can't play this video", Toast.LENGTH_SHORT).show()
                    }

                    override fun onPlayerStateChanged(playWhenReady: Boolean, playbackState: Int) {
//                        super.onPlayerStateChanged(playWhenReady, playbackState)
                    }
                })

                if (absposition == 0) {
                    exoPlayer.playWhenReady = true
                }
                Log.e("debug-shifa", "setVideoPath: updated size ${videos.size}")
                videoPreparedListener.onVideoFun(VideoItemRes(exoPlayer, absposition))
            }

        }
    }

    fun updateReelData(videoItems:  List<ReelsItem>) {
        this.videos = videoItems as MutableList<ReelsItem>
        notifyDataSetChanged()
    }

    interface OnVideoPreparedInterface {
        fun onVideoFun(exoPlayerItem: VideoItemRes)
    }
}

class VideoItemRes(
    var exoPlayerVar: SimpleExoPlayer,
    var exoPosition: Int
)
</code>```

`

Body:
Im trying to implement exoplayer for playing reels, with a fragment and viewpager with RecyclerView.Adapter.
I am updating the prev and next postion in onPageselected.
and trying to remove the top 5 player instance from the list when it is more than 10.
But this causes the current active postion playing to pause as the postion is updated now.

`

 pagerAdapter = new VideoTestAdapter(requireContext(), new VideoTestAdapter.OnVideoPreparedInterface() {
            @Override
            public void onVideoFun(VideoItemRes videoItems) {
                   videoItemsList.add(videoItems);
            }
        });

        viewPager.setAdapter(pagerAdapter);
        viewPager.setOffscreenPageLimit(3);

        viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {

            @Override
            public void onPageSelected(int position) {
                super.onPageSelected(position);

                mCurrentPosition = position;

                    if (InternetCheckHelper.isConnected()) {
                        reelPresenter.event(videoReelsItems.get(position).getId());
                        if ((videoReelsItems.size() - mCurrentPosition) < 10 &&      !Objects.equals(mCurrentPage, mNext) && !isLastPage) {
//API CALL Pagination
      reelPresenter.getReelsHome(prefConfig.getReelsType(), context, mNext, false, true, true, "");
                            mCurrentPage = mNext;
                        }
                    }
                }

                int previousIndex = -1;
                for (int i = 0; i < videoItemsList.size(); i++) {
                    if (videoItemsList.get(i).getExoPlayerVar().getPlayWhenReady()) {
                        previousIndex = i;
                        break;
                   }
                }

                if (previousIndex != -1) {
                if(position > 0) {
                    exoPlayer = videoItemsList.get(position - 1).getExoPlayerVar();
                    exoPlayer.setPlayWhenReady(false);
                }
                   if (previousIndex != 0)
                       player.release();
               }

                int newIndex = -1;
                for (int i = 0; i < videoItemsList.size(); i++) {
                    if (videoItemsList.get(i).getExoPosition() == position) {
                        newIndex = i;
                        break;
                    }
                }

               if (newIndex != -1) {
                if(position > 0) {
                    exoPlayer = videoItemsList.get(position).getExoPlayerVar();
                    exoPlayer.setPlayWhenReady(true);
                }
                    exoPlayer.getPlayWhenReady();
                }

                if (!videoItemsList.isEmpty() && (videoItemsList.size() - (viewPager.getOffscreenPageLimit())) > 10) {
//                    for (int i = 0; i < mCurrentPosition - 5; i++) {
                    if (position == 7) {
                        SimpleExoPlayer player = videoItemsList.get(3).getExoPlayerVar();
                        player.release();
                        videoItemsList.remove(3);
                        pagerAdapter.getVideos().remove(3);
                        viewPager.post(new Runnable() {
                            public void run() {
                                pagerAdapter.notifyItemRemoved(3);
                            }
                        });
//                    }
                    }

//                }
            }

class VideoTestAdapter(
    private var context:Context,
    private var videoPreparedListener: OnVideoPreparedInterface
) : RecyclerView.Adapter<VideoTestAdapter.VideoViewHolder?>() {
     var videos = listOf<ReelsItem>()
    private var holder: VideoTestAdapter.VideoViewHolder? = null
    private lateinit var videoItem: ReelsItem
    private var defaultBandwidthMeter: DefaultBandwidthMeter? = null
    private var dataSourceFactory: DataSource.Factory? = null
    lateinit var exoPlayer: SimpleExoPlayer
    lateinit var mediaSource: MediaSource

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VideoTestAdapter.VideoViewHolder {
        val view =
            LayoutInflater.from(context).inflate(R.layout.list_video_test, parent, false)
        return VideoViewHolder(view, context, videoPreparedListener)
    }

    override fun onBindViewHolder(holder: VideoTestAdapter.VideoViewHolder, position: Int) {
        this.holder = holder
        if(videos[position] != null){
            videoItem = videos[position];
        }

        Log.e("debug-shifa", "onBindViewHolder: ${videoItem.media}  pos  $position   video size ${videos.size}"  )
//        holder.tvTitle?.text = "testing"
        if(!videoItem.media.isNullOrEmpty())
            holder.setVideoPath(videoItem.media,holder.absoluteAdapterPosition);

    }

    override fun getItemCount(): Int {
        return videos.size
    }

    fun getItemPosition(`object`: Any?): Int {
        Log.e("TAG", "onPageSelected getItemPosition:called ", )
        return POSITION_NONE
    }
    inner class VideoViewHolder(var itemView: View?,
                                var context: Context,
                                var videoPreparedListener: OnVideoPreparedInterface)
        : RecyclerView.ViewHolder(itemView!!) {
        var tvTitle: TextView? = null
        var playerView: PlayerView? = null

        init {
            tvTitle = itemView?.findViewById(R.id.tv_item_title)
            playerView = itemView.findViewById<PlayerView>(R.id.video_view)
        }

        fun setVideoPath(streamUrl: String,  absposition: Int) {
            val loadControl: LoadControl =
                DefaultLoadControl.Builder().setAllocator(DefaultAllocator(true, 16))
                    .setBufferDurationsMs(
                        VideoPlayerConfig.MIN_BUFFER_DURATION,
                        VideoPlayerConfig.MAX_BUFFER_DURATION,
                        VideoPlayerConfig.MIN_PLAYBACK_START_BUFFER,
                        VideoPlayerConfig.MIN_PLAYBACK_RESUME_BUFFER
                    )
                    .setTargetBufferBytes(-1).setPrioritizeTimeOverSizeThresholds(true)
                    .createDefaultLoadControl()

            if (streamUrl.endsWith(".m3u8")) {
                val adaptiveTrackSelection = AdaptiveTrackSelection.Factory()
                exoPlayer = ExoPlayerFactory.newSimpleInstance(
                    context,
                    DefaultTrackSelector(adaptiveTrackSelection),
                    loadControl
                )

                defaultBandwidthMeter = DefaultBandwidthMeter()

                dataSourceFactory = DefaultDataSourceFactory(
                    context,
                    Util.getUserAgent(context, "nib"),
                    defaultBandwidthMeter
                )

                val uri = Uri.parse(streamUrl)

                mediaSource = HlsMediaSource.Factory(dataSourceFactory)
                    .setAllowChunklessPreparation(true)
                    .createMediaSource(uri)

                itemView.findViewById<PlayerView>(R.id.video_view).player = exoPlayer

                exoPlayer.seekTo(0)
                exoPlayer.repeatMode = Player.REPEAT_MODE_OFF

                exoPlayer.prepare(mediaSource)

                exoPlayer.addListener(object : Player.EventListener {
                    override fun onPlayerError(error: ExoPlaybackException?) {
                        super.onPlayerError(error)
                        Toast.makeText(context, "Can't play this video", Toast.LENGTH_SHORT).show()
                    }

                    override fun onPlayerStateChanged(playWhenReady: Boolean, playbackState: Int) {
//                        super.onPlayerStateChanged(playWhenReady, playbackState)
                    }
                })

                if (absposition == 0) {
                    exoPlayer.playWhenReady = true
                }
                Log.e("debug-shifa", "setVideoPath: updated size ${videos.size}")
                videoPreparedListener.onVideoFun(VideoItemRes(exoPlayer, absposition))
            }

        }
    }

    fun updateReelData(videoItems:  List<ReelsItem>) {
        this.videos = videoItems as MutableList<ReelsItem>
        notifyDataSetChanged()
    }

    interface OnVideoPreparedInterface {
        fun onVideoFun(exoPlayerItem: VideoItemRes)
    }
}

class VideoItemRes(
    var exoPlayerVar: SimpleExoPlayer,
    var exoPosition: Int
)

`


问:
Merge multiple XML files in python without modification of the comment and spacing
If i am having the "comment 1", "comment 2" present in the xml and needs to have the xml merge having the comments as well and having 200+ files . The details as below:

Sample File 1:

```<code><!--- Comment 1 -->
<root>
    <element> text= "textA" >
        <element1> textB= "textB" >
        <!--- Comment 2 -->
            <elements textC= "textC" >
            </elements>
        <!--- Comment 3 -->
            <elements textD= "textD" >
            </elements>
        <!--- Comment 4 -->
            <elements textE= "textE" >
            </elements>
        </element1>
    </element>
</root>
</code>```

Sample File 2:

```<code><!--- Comment 1 -->
<root>
    <element> text= "textA1" >
        <element1> textB= "textB" >
        <!--- Comment 2 -->
            <elements textF= "textF" >
            </elements>
        <!--- Comment 3 -->
            <elements textG= "textF" >
            </elements>
        <!--- Comment 4 -->
            <elements textH= "textG" >
            </elements>
        </element1>
    </element>
</root>
</code>```

What I Want:

```<code><!--- Comment 1 -->
<root>
    <element> text= "textA1" >
        <element1> textB= "textB" >
        <!--- Comment 2 -->
            <elements textC= "textC" >
            </elements>
        <!--- Comment 3 -->
            <elements textD= "textD" >
            </elements>
        <!--- Comment 4 -->
            <elements textE= "textE" >
            </elements>
        <!--- Comment 2 -->
            <elements textF= "textF" >
            </elements>
        <!--- Comment 3 -->
            <elements textG= "textF" >
            </elements>
        <!--- Comment 4 -->
            <elements textH= "textG" >
            </elements>
        </element1>
    </element>
</root>
</code>```

Please suggest.

I tried following but no success

Merge xml files with nested elements without external libraries

But this will not include the comments.

Body:
If i am having the "comment 1", "comment 2" present in the xml and needs to have the xml merge having the comments as well and having 200+ files . The details as below:

Sample File 1:

<root>
    <element> text= "textA" >
        <element1> textB= "textB" >

            <elements textC= "textC" >
            </elements>

            <elements textD= "textD" >
            </elements>

            <elements textE= "textE" >
            </elements>
        </element1>
    </element>
</root>

Sample File 2:

<root>
    <element> text= "textA1" >
        <element1> textB= "textB" >

            <elements textF= "textF" >
            </elements>

            <elements textG= "textF" >
            </elements>

            <elements textH= "textG" >
            </elements>
        </element1>
    </element>
</root>

What I Want:

<root>
    <element> text= "textA1" >
        <element1> textB= "textB" >

            <elements textC= "textC" >
            </elements>

            <elements textD= "textD" >
            </elements>

            <elements textE= "textE" >
            </elements>

            <elements textF= "textF" >
            </elements>

            <elements textG= "textF" >
            </elements>

            <elements textH= "textG" >
            </elements>
        </element1>
    </element>
</root>

Please suggest.

I tried following but no success

Merge xml files with nested elements without external libraries

But this will not include the comments.


问:
How to limit upper bound of enum classes?
I have an interface look like this.

interface MyEnum<E extends Enum<E> & MyEnum<E>> {

    static <E extends Enum<E> & MyEnum<E, T>, T> E valueOfAttribute(
            Class<E> enumClass, T attributeValue) {
        for (final E enumConstant : enumClass.getEnumConstants()) {
            if (Objects.equals(enumConstant.attribute(), attributeValue)) {
                return enumConstant;
            }
        }
        throw new IllegalArgumentException(
                "no enum constant, from " + enumClass
                + ", for " + attributeValue);
    }

    T attribute();
}
```
<p>And let us all say that I have the following classes.</p>
<pre class="lang-java prettyprint-override"><code>interface YourEnum<E extends YourEnum<E> & YourEnum<E>>
        extends MyEnum<E, String> {

    @Override public String attribute() { return ((Enum<?>) this).name(); }
}

enum HisEnum implements YourEnum<HisEnum> {
    HIS
}

enum HerEnum implements YourEnum<HerEnum> {
    HER
}
</code>```

And I want to add another utility class for finding the enum constant matches to specific attribute value among one or more enum classes implements same subtype of MyEnum.

// should find HisEnum#HIS
MyEnum.<YourEnum>valueOfAttribute("HIS", HisEnum.class, HerEnum.class);
```
<p>How can I add a <code>static</code> utility method which finds the first enum constant whose <code>attribute()</code> matches to specified value, from one or more enum classes extends a specific sub-interface of <code>MyEnum</code>?</p>
<p>I'm, so far, trying with this.</p>
<pre class="lang-java prettyprint-override"><code>    // TODO: Scream!
    static <T extends MyEnum<? extends Enum<?>, U>, U> T valueOfAttribute(
            U attributeValue, Class<? extends T> enumClass,
            Class<? extends T>... otherEnumClasses) {
        return Stream.concat(Stream.of(enumClass), Stream.of(otherEnumClasses))
                .map(t -> {
                    try {
                        return valueOfAttribute(t, attributeValue); // won't compile
                    } catch (IllegalArgumentException iae) {
                        return null;
                    }
                })
                .filter(Objects::nonNull)
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException(
                        "no enum constant, from " + enumClass + "
                        + and " + Arrays.toString(otherEnumClasses)
                        + ", for " + attributeValue));
    }
</code>```

Body:
I have an interface look like this.

interface MyEnum<E extends Enum<E> & MyEnum<E>> {

    static <E extends Enum<E> & MyEnum<E, T>, T> E valueOfAttribute(
            Class<E> enumClass, T attributeValue) {
        for (final E enumConstant : enumClass.getEnumConstants()) {
            if (Objects.equals(enumConstant.attribute(), attributeValue)) {
                return enumConstant;
            }
        }
        throw new IllegalArgumentException(
                "no enum constant, from " + enumClass
                + ", for " + attributeValue);
    }

    T attribute();
}

And let us all say that I have the following classes.

interface YourEnum<E extends YourEnum<E> & YourEnum<E>>
        extends MyEnum<E, String> {

    @Override public String attribute() { return ((Enum<?>) this).name(); }
}

enum HisEnum implements YourEnum<HisEnum> {
    HIS
}

enum HerEnum implements YourEnum<HerEnum> {
    HER
}

And I want to add another utility class for finding the enum constant matches to specific attribute value among one or more enum classes implements same subtype of MyEnum.

// should find HisEnum#HIS
MyEnum.<YourEnum>valueOfAttribute("HIS", HisEnum.class, HerEnum.class);

How can I add a static utility method which finds the first enum constant whose attribute() matches to specified value, from one or more enum classes extends a specific sub-interface of MyEnum?

I'm, so far, trying with this.

    // TODO: Scream!
    static <T extends MyEnum<? extends Enum<?>, U>, U> T valueOfAttribute(
            U attributeValue, Class<? extends T> enumClass,
            Class<? extends T>... otherEnumClasses) {
        return Stream.concat(Stream.of(enumClass), Stream.of(otherEnumClasses))
                .map(t -> {
                    try {
                        return valueOfAttribute(t, attributeValue); // won't compile
                    } catch (IllegalArgumentException iae) {
                        return null;
                    }
                })
                .filter(Objects::nonNull)
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException(
                        "no enum constant, from " + enumClass + "
                        + and " + Arrays.toString(otherEnumClasses)
                        + ", for " + attributeValue));
    }


问:
Running 2 clusterIps with port 80 - but only one is accessible with Ingress
I have 2 applications running in Kubernetes cluster.

one with container port: 8081
second with container port: 8099

both have clusterIp with port 80.

both were checked outside the Kubernetes cluster with docker only: image is valid.

I run both of the microservices in Kubernetes, but only the second one is accessible with Ingress

in the first one I am getting the error: "502 bad gateway - ngnix".

what am I doing wrong ?

DI I defined correctly the ports in ingress resource ?

I know that both of the clusterIps have differnet ips and therefore they can both have the port - 80. is that correct? should I give the clusterIp different ports rather than 80?

these are my files:

App1:

 apiVersion: apps/v1

 kind: Deployment

 metadata:
   name: app1-deployment
   namespace: nxtgen
   labels:
    app: app1

 spec:

   replicas: 3
   selector:
    matchLabels:
      app: app1

   template:
    metadata:
      labels:
        app: app1
    spec:
      containers:
      - name: app1
        image: artifactory-ik.com:6656/app1:latest
        ports:
        - containerPort: 8081
      imagePullSecrets:
        - name: registrykey
---
apiVersion: v1
kind: Service

metadata:
  name: app1
spec:
  type: ClusterIP

  selector:
    app: app1

  ports:
    # port - port exposed internally in the cluster
    # targetPort - the container port to send requests to
    - targetPort:  8081
      port: 80
```
<p>App2:</p>
<pre class="lang-yaml prettyprint-override"><code> apiVersion: apps/v1

 kind: Deployment

 metadata:
   name: app2
   namespace: nxtgen
   labels:
    app: app2

 spec:

   replicas: 3
   selector:
    matchLabels:
      app: app2

   template:
    metadata:
      labels:
        app: app2
    spec:
      containers:
      - name: app2
        image: artifactory-ik.com:6656/app2:latest
        ports:
        - containerPort: 8099
      imagePullSecrets:
        - name: registrykey
---
apiVersion: v1
kind: Service

metadata:
  name: app2
spec:
  type: ClusterIP

  selector:
    app: app2

  ports:
    # port - port exposed internally in the cluster
    # targetPort - the container port to send requests to
    - targetPort:  8099
      port: 80
</code>```

Ingress resource:

apiVersion: networking.k8s.io/v1
kind: Ingress

metadata:

  name: ingress-rules
  namespace: nxtgen

spec:
  ingressClassName: nginx
  rules:
    - host: nxthost.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: app2
                port:
                  #same port of clusterIp
                   number: 80

          - path: /app2/info
            pathType: Prefix
            backend:
              service:
                name: app2
                port:
                  #same port of clusterIp
                  number: 80

          - path: /app1/api/getInfo
            pathType: Prefix
            backend:
              service:
                name: app1
                port:
                  #same port of clusterIp
                  number: 80
```

Body:
I have 2 applications running in Kubernetes cluster.

one with container port: 8081
second with container port: 8099

both have clusterIp with port 80.

both were checked outside the Kubernetes cluster with docker only: image is valid.

I run both of the microservices in Kubernetes, but only the second one is accessible with Ingress

in the first one I am getting the error: "502 bad gateway - ngnix".

what am I doing wrong ?

DI I defined correctly the ports in ingress resource ?

I know that both of the clusterIps have differnet ips and therefore they can both have the port - 80. is that correct? should I give the clusterIp different ports rather than 80?

these are my files:

App1:

 apiVersion: apps/v1

 kind: Deployment

 metadata:
   name: app1-deployment
   namespace: nxtgen
   labels:
    app: app1

 spec:

   replicas: 3
   selector:
    matchLabels:
      app: app1

   template:
    metadata:
      labels:
        app: app1
    spec:
      containers:
      - name: app1
        image: artifactory-ik.com:6656/app1:latest
        ports:
        - containerPort: 8081
      imagePullSecrets:
        - name: registrykey
---
apiVersion: v1
kind: Service

metadata:
  name: app1
spec:
  type: ClusterIP

  selector:
    app: app1

  ports:
    # port - port exposed internally in the cluster
    # targetPort - the container port to send requests to
    - targetPort:  8081
      port: 80

App2:

 apiVersion: apps/v1

 kind: Deployment

 metadata:
   name: app2
   namespace: nxtgen
   labels:
    app: app2

 spec:

   replicas: 3
   selector:
    matchLabels:
      app: app2

   template:
    metadata:
      labels:
        app: app2
    spec:
      containers:
      - name: app2
        image: artifactory-ik.com:6656/app2:latest
        ports:
        - containerPort: 8099
      imagePullSecrets:
        - name: registrykey
---
apiVersion: v1
kind: Service

metadata:
  name: app2
spec:
  type: ClusterIP

  selector:
    app: app2

  ports:
    # port - port exposed internally in the cluster
    # targetPort - the container port to send requests to
    - targetPort:  8099
      port: 80

Ingress resource:

apiVersion: networking.k8s.io/v1
kind: Ingress

metadata:

  name: ingress-rules
  namespace: nxtgen

spec:
  ingressClassName: nginx
  rules:
    - host: nxthost.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: app2
                port:
                  #same port of clusterIp
                   number: 80

          - path: /app2/info
            pathType: Prefix
            backend:
              service:
                name: app2
                port:
                  #same port of clusterIp
                  number: 80

          - path: /app1/api/getInfo
            pathType: Prefix
            backend:
              service:
                name: app1
                port:
                  #same port of clusterIp
                  number: 80


问:
redirect_uri is always localhost when json and console have it as a proper domain of localhost
I went through 11485271 but not avail.

I see

Even though I removed localhost. (And when I gave localhost it was at port 8000 and not 8080)

```<code>"redirect_uris":["https://local.mysite.com"]
</code>```

https://local.mysite.com is my MAMP PRO setup.

When I goto https://accounts.google.com/o/oauth2/auth?client_id={client_id}&response_type=token&redirect_uri=https%3A%2F%2Flocal.mysite.com&scope={scope} in the browser it works, its just that its not working when I do python3 script.py.

So how do I fix this ?

Body:
I went through 11485271 but not avail.

I see

Even though I removed localhost. (And when I gave localhost it was at port 8000 and not 8080)

"redirect_uris":["https://local.mysite.com"]

https://local.mysite.com is my MAMP PRO setup.

When I goto https://accounts.google.com/o/oauth2/auth?client_id={client_id}&response_type=token&redirect_uri=https%3A%2F%2Flocal.mysite.com&scope={scope} in the browser it works, its just that its not working when I do python3 script.py.

So how do I fix this ?


问:
API Configuration to send data to Notion (400 error)
Attempting to send data to Notion using Apple Shortcuts. Can't seem to figure out the error with the json. Can someone help me figure out the error?

{"status":400,"object":"error","code":"validation_error","message":"body failed validation: body.properties.Date.date.date should be not present, instead was \"2023-01-02\"."}

Here is the json -

```<code>{"parent": {
"database_id": "d2bf122f-a01d-4aa5-bf2d-195489b9c548"},"properties": {
"Date": {
  "type": "date",
  "date": {
    "date": "Date"
  }
},
"Subcategory": {
  "title": [
    {
      "text": {
        "content": "Subcategory"
      }
    }
  ]
},
"Month": {
  "type": "multi_select",
  "multi_select": {
    "name": "Month"
  }
},
"Name": {
  "type": "text",
  "text": {
    "content": "Name"
  }
},
"Amount": {
  "type": "number",
  "number": "Amount"
}}}
</code>```

Body:
Attempting to send data to Notion using Apple Shortcuts. Can't seem to figure out the error with the json. Can someone help me figure out the error?

{"status":400,"object":"error","code":"validation_error","message":"body failed validation: body.properties.Date.date.date should be not present, instead was \"2023-01-02\"."}

Here is the json -

{"parent": {
"database_id": "d2bf122f-a01d-4aa5-bf2d-195489b9c548"},"properties": {
"Date": {
  "type": "date",
  "date": {
    "date": "Date"
  }
},
"Subcategory": {
  "title": [
    {
      "text": {
        "content": "Subcategory"
      }
    }
  ]
},
"Month": {
  "type": "multi_select",
  "multi_select": {
    "name": "Month"
  }
},
"Name": {
  "type": "text",
  "text": {
    "content": "Name"
  }
},
"Amount": {
  "type": "number",
  "number": "Amount"
}}}


问:
How to create an Integromat scenario to integrate ClickUp and Dropbox?

A task is created in a “Company Name” list in ClickUp. Task has the following pattern in its name - “NameA, NameB & NameC” and the due date

Upon creating the task, a catalog structure in Dropbox is created (see catalog structure below)

Date in the name of the root catalog is based on ClickUp due date in the pattern of DD.MM.YYYY

Scenario is triggered upon task creation only (no polling)

Make sure that the scenario is triggered for only “Company Name” list in ClickUp

Please use the following Dropbox API in the scenario -
https://www.dropbox.com/developers/documentation/http/documentation#files-create
_folder_batch

Scenario should use built-in Integromat modules only

Dropbox catalog structure is as below:

```<code>NameA, NameB & NameC DD.MM.YYYY
- Sales
--- Export
- Raw files
- Hi-resolution images (print ready)
- Production
--- Print
--- Wall Art
--- Frames
--- Storyboard
--- Albums
------ proof
------ hi-res
</code>```

Hello, can someone help me with this task? I tried to create a scenario but didn't meet their expectations. What was the correct code for this? I just wanna know the correct process thank you in advance!

Body:
A task is created in a “Company Name” list in ClickUp. Task has the following pattern in its name - “NameA, NameB & NameC” and the due date

Upon creating the task, a catalog structure in Dropbox is created (see catalog structure below)

Date in the name of the root catalog is based on ClickUp due date in the pattern of DD.MM.YYYY

Scenario is triggered upon task creation only (no polling)

Make sure that the scenario is triggered for only “Company Name” list in ClickUp

Please use the following Dropbox API in the scenario -
https://www.dropbox.com/developers/documentation/http/documentation#files-create
_folder_batch

Scenario should use built-in Integromat modules only

Dropbox catalog structure is as below:

NameA, NameB & NameC DD.MM.YYYY
- Sales
--- Export
- Raw files
- Hi-resolution images (print ready)
- Production
--- Print
--- Wall Art
--- Frames
--- Storyboard
--- Albums
------ proof
------ hi-res

Hello, can someone help me with this task? I tried to create a scenario but didn't meet their expectations. What was the correct code for this? I just wanna know the correct process thank you in advance!


问:
Problem key given was not present in the dictionary
I am currently working with Visual Basic 2008 and MySQL and PhpMyadmin as databases. After I tried to connect with my local host with Xampp in the line command VB the error came:

Problem key given was not present in the dictionary

So I fixed the problem by adding charset=utf8 to MySQLconnection line so the problem was fixed and the connection passed but after I tried to insert a value in the form that error came up again.

I tried to add some values to the table in PHPMyAdmin in MySQL server as a login form that contains username and password but it show the error:

Problem key given was not present in the dictionary

In cmd.ExecuteReader


问:
AngularJS How to receive Unix Timestamp as API result and add to array after format conversion
```<code>As a result of the code below, it is possible to check all values in one variable, but it is difficult to put the time value into each variable.

The desired result is to put each data within the tmp.name[i] value.
</code>```
```<code>          function loadData() {
            var defer = $q.defer();
            var consolidatedResult = [];
            angular.forEach($scope.config.query, function (key, value) {
              var tmp = {};
              var query = new Query(key);

              $scope.processing = true;
              $resource(API.QUERY + value + '?$limit=5000').save(query.getQuery(true)).$promise.then(function (result) {
                if (result['hydra:member']) {
                  for (var i=0; i < result['hydra:member'].length; i++){
                    tmp.date += new Date(result['hydra:member'][i].reportData * 1000).toLocaleDateString("en-us");
                    tmp.count = tmp.date.length;
                  }
                  consolidatedResult.push(tmp);
                }
                $scope.processing = false;
              }, defer.reject);
            });
            defer.resolve(consolidatedResult);
            return defer.promise;
          }
</code>```

`

My current code is tmp.date += new Date(result['hydra:member'][i].reportData * 1000).toLocaleDateString("en-us"); , but tmp.date[i] = new Date(result['hydra:member'][i].reportData * 1000).toLocaleDateString("en-us");

tmp.date.add( new Date(result['hydra:member'][i].reportData * 1000).toLocaleDateString("en-us")); I've tried various things to put it in an array like

-> result image enter image description here

Body:
As a result of the code below, it is possible to check all values in one variable, but it is difficult to put the time value into each variable.

The desired result is to put each data within the tmp.name[i] value.

          function loadData() {
            var defer = $q.defer();
            var consolidatedResult = [];
            angular.forEach($scope.config.query, function (key, value) {
              var tmp = {};
              var query = new Query(key);

              $scope.processing = true;
              $resource(API.QUERY + value + '?$limit=5000').save(query.getQuery(true)).$promise.then(function (result) {
                if (result['hydra:member']) {
                  for (var i=0; i < result['hydra:member'].length; i++){
                    tmp.date += new Date(result['hydra:member'][i].reportData * 1000).toLocaleDateString("en-us");
                    tmp.count = tmp.date.length;
                  }
                  consolidatedResult.push(tmp);
                }
                $scope.processing = false;
              }, defer.reject);
            });
            defer.resolve(consolidatedResult);
            return defer.promise;
          }

`

My current code is tmp.date += new Date(result['hydra:member'][i].reportData * 1000).toLocaleDateString("en-us"); , but tmp.date[i] = new Date(result['hydra:member'][i].reportData * 1000).toLocaleDateString("en-us");

tmp.date.add( new Date(result['hydra:member'][i].reportData * 1000).toLocaleDateString("en-us")); I've tried various things to put it in an array like

-> result image enter image description here


问:
How to make the value in the cell change when the conditional formatting cell color changes?
This is excel for recording work progress.
So, the cells that are green are based on the start date and end date, for example the start date is in the first week of January 2 and finishes on January 4, so the task is done for 2 days and only 2 cells will be colored green. When the week display is replaced, the green cell will disappear. I want the number I entered in the green cell to also disappear but it doesn't work.Is there a way when the week changes, and the cell isn't green, the value will follow the cell? vba code better.</p>


问:
How to create a PWA for an Angular project?
I've an Angular application that is configured as a PWA. It all works wonderfully.

Now, however, I have created a project that runs independently as a "sub-app" via

```<code>ng new app2 --create-application false
</code>```

This should also be "PWA enabled". But how can I tell Angular CLI to do the appropriate configurations and to use a project specific manifest file?

Body:
I've an Angular application that is configured as a PWA. It all works wonderfully.

Now, however, I have created a project that runs independently as a "sub-app" via

ng new app2 --create-application false

This should also be "PWA enabled". But how can I tell Angular CLI to do the appropriate configurations and to use a project specific manifest file?


问:
How to prevent webpack from transforming html icons to svg icons in fontawesome
Webpack automatically transfroms  to <svg class="svg-inline--fa fa-cart-shopping add-to-cart" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="cart-shopping" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" data-fa-i2svg=""><path fill="currentColor" d="M0 24C0 10.7 10.7 0 24 0H69.5c22 0 41.5 12.8 50.6 32h411c26.3 0 45.5 25 38.6 50.4l-41 152.3c-8.5 31.4-37 53.3-69.5 53.3H170.7l5.4 28.5c2.2 11.3 12.1 19.5 23.6 19.5H488c13.3 0 24 10.7 24 24s-10.7 24-24 24H199.7c-34.6 0-64.3-24.6-70.7-58.5L77.4 54.5c-.7-3.8-4-6.5-7.9-6.5H24C10.7 48 0 37.3 0 24zM128 464a48 48 0 1 1 96 0 48 48 0 1 1 -96 0zm336-48a48 48 0 1 1 0 96 48 48 0 1 1 0-96z"></path></svg>

I wanted to style the html icon using CSS but since webpack automatically tranforms the element to svg, my styling is discarded


问:
UNOY - Webrequest with x-api-key
I tried to implement the web request below into an unoy.io KAPP. Unfortunately, API calls with an x-api-key in the headers do not seem to work.

```<code>#Link to the API reference https://services.tineye.com/developers/tineyeapi/api_reference#search

curl https://api.tineye.com/rest/search/ --get \
   -H "x-api-key: 6mm60lsCNIB,FwOWjJqA80QZHh9BMwc-ber4u=t^" \
   -d "image_url=https://tineye.com/images/meloncat.jpg" \
   -d "limit=2"
</code>```

While testing the request, I got the following error message:

It appears that the x-api-key is sent correctly

This should at least result in the following response:

```<code>{"results":[],"stats":{},"code":400,"messages":["Please supply an image, URL or fingerprint for searching."]}
</code>```

Please also find short KAPP for reproducing the error.

Title: UNOY - Webrequest with x-api-key

Body:
I tried to implement the web request below into an unoy.io KAPP. Unfortunately, API calls with an x-api-key in the headers do not seem to work.

#Link to the API reference https://services.tineye.com/developers/tineyeapi/api_reference#search

curl https://api.tineye.com/rest/search/ --get \
   -H "x-api-key: 6mm60lsCNIB,FwOWjJqA80QZHh9BMwc-ber4u=t^" \
   -d "image_url=https://tineye.com/images/meloncat.jpg" \
   -d "limit=2"

While testing the request, I got the following error message:

It appears that the x-api-key is sent correctly

This should at least result in the following response:

{"results":[],"stats":{},"code":400,"messages":["Please supply an image, URL or fingerprint for searching."]}

Please also find short KAPP for reproducing the error.


问:
Forward Slash is missing in string data while fetching data using Pyodbc
I am working on one of the ETL jobs, i encountered an issue while pulling data using Pyodbc driver. in all string columns the forward slash is getting missed out.

Suppose if i have value as "Test Lease @SLC-11/01-12/31/22", if i pull it from pyodbc, i am getting value as "Test Lease @SLC-1101-123122"

This problem occurs only when i fetch the table with multiple columns, if i just pull single string column, the forward slash gets retained.

Python Version : Python 3.8
Pyodbc Version : 4.0.32
DB : Mirosoft SQL Server
ODBC Driver : ODBC Driver 17 for SQL Server

i'm expecting to retain the forward slashes while using pyodbc.


问:
Filter results for 6 digits code [databricks, sparkSQL)
I'm trying to get some analytics from eCommerce search tool. I'm looking to understand the usage in the search when looking for 6 digits code: 'XXXXXX' - could be 6 digits numbers only or 6 digits starting with A-Z letters.

I'm using Databricks (SQL), and this is my query:

```<code>SELECT  search_phrase,
        count(*) as search_cnt
FROM table
WHERE search_phrase Like '^[0-9]{1-6}$'
AND session_date BETWEEN '2022-11-01' AND '2022-12-01'
GROUP BY 1
</code>```

But I'm not getting any results, could you help me solve this issue?

As mentioned above - the query attached

Body:
I'm trying to get some analytics from eCommerce search tool. I'm looking to understand the usage in the search when looking for 6 digits code: 'XXXXXX' - could be 6 digits numbers only or 6 digits starting with A-Z letters.

I'm using Databricks (SQL), and this is my query:

SELECT  search_phrase,
        count(*) as search_cnt
FROM table
WHERE search_phrase Like '^[0-9]{1-6}$'
AND session_date BETWEEN '2022-11-01' AND '2022-12-01'
GROUP BY 1

But I'm not getting any results, could you help me solve this issue?

As mentioned above - the query attached


问:
Why does my cart page doesn't show its content properly?
```<code>{% extends 'app/base.html' %}
{% load static %}
{% block title %}Cart{% endblock title %}
{% block main-content %}
<div class="container my-5">

 <div class="row">
  {% if cart %}
  <h1 class="text-center mb-5">Shopping Cart</h1>
  <div class="col-sm-8">
  <div class="card">
   <div class="card-body">
    <h3>Cart</h3>
    {% for item in cart %}
    <div class="row">
     <div class="col-sm-3 text-center align-self-center"><img src="{{item.product.product_image.url}}" alt="" srcset="" class="img-fluid img-thumbnail shadow-sm" height="150" width="150"></div>
     <div class="col-sm-9">
      <div>
       <h5>{{item.product.title}}</h5>
       <p class="mb-2 text-muted small">{{item.product.description}}</p>
       <div class="my-3">
        <label for="quantity">Quantity:</label>
        <a class="minus-cart btn" pid={{item.product.id}}><i class="fas fa-minus-square fa-lg"></li></a>
          <span id="quantity">{{item.quantity}}</span>
        <a class="plus-cart btn" pid={{item.product.id}}><i class="fas fa-plus-square fa-lg"></li></a>
       </div>
       <div class="d-flex justify-content-between">
        <a href="#" class="remove-cart btn btn-sm btn-secondary mr-3" pid={{item.product.id}}>Remove item </a>
        <p class="mb-0"><span><strong>₱ {{item.product.discounted_price}}</strong></span></p>
       </div>
      </div>
     </div>
    </div>
    <hr class="text-muted">
    {% endfor %}
   </div>
   </div>
  </div>

  <div class="col-sm-4">
   <div class="card">
    <div class="card-body">
      <h3>The Total Amount of</h3>
      <ul class="list-group">
       <li class="list-group-item d-flex justify-content-between align-items-center border-0 px-0 pb-0" >Amount<span id="amount">₱{{amount}}</span></li>
       <li class="list-group-item d-flex justify-content-between align-items-center px-0">Shipping<span>₱144.00</span></li>
       <li class="list-group-item d-flex justify-content-between align-items-center border-0 px-0 mb-3">
        <div>
           <strong>Total</strong> <small>(including GST)</small>
         </div>
         <span id="totalamount"><strong>₱ {{totalamount}}</strong></span>
       </li>
      </ul>
      <div class="d-grid"><a href="{% url 'checkout' %}" class="btn btn-primary">Place Order</a></div>
    </div>
   </div>
  </div>
  {% else %}
    <h1 class="text-center mb-5">Cart is Empty</h1>
{% endif %}
</div>
</div>
{% endblock main-content %}
</code>```

The code above is the addtocart HTML and when I click addtocart button this is what it looks like
can you tell my why it does not show the rest of the content? I've only watched this from a YouTube video and this is my first time into Django framework. I want to make an eCommerce website but the cart page doesn't display the proper content it should display. I did migrations for the models and I think I migrated the cart.py.

Body:
{% extends 'app/base.html' %}
{% load static %}
{% block title %}Cart{% endblock title %}
{% block main-content %}

  {% if cart %}

Shopping Cart

Cart

    {% for item in cart %}

{{item.product.title}}

{{item.product.description}}

        Quantity:

          {{item.quantity}}

        Remove item

₱ {{item.product.discounted_price}}

    {% endfor %}

The Total Amount of

Amount₱{{amount}}

Shipping₱144.00

           Total (including GST)

         ₱ {{totalamount}}

Place Order

  {% else %}

Cart is Empty

{% endif %}

{% endblock main-content %}

The code above is the addtocart HTML and when I click addtocart button this is what it looks like
can you tell my why it does not show the rest of the content? I've only watched this from a YouTube video and this is my first time into Django framework. I want to make an eCommerce website but the cart page doesn't display the proper content it should display. I did migrations for the models and I think I migrated the cart.py.


问:
Relationship between Micro Frontends (MFE) and Backend for Frontend (BFF)
I think that it is common consensus that each frontend-type should normally have an own BFF (see https://samnewman.io/patterns/architectural/bff and figure below).

But what about micro frontends (MFE)? I read that each MFE also should have a BFF.

My understanding is that MFEs are (complete) pages and fragments (which are composed to pages, while a page is also a fragment).

I would agree that each page should have a BFF, because a page is like a normal UI. What about fragments? Does each fragment have its own BFF?


问:
material-react-table Col span and Row span
So I am trying to make a colspan on the header of the material react table, but I notice it doesn't change anything at all. It only renders an existing column, here is my try:

```<code>return (
    <div className="m-2">
      <MaterialReactTable
        columns={columns}
        data={data}
        getRowId={(row) => row.phoneNumber}
        initialState={{ showColumnFilters: false }}
        manualFiltering
        manualPagination
        manualSorting
        muiToolbarAlertBannerProps={
          isError
            ? {
                color: "error",
                children: "Error loading data",
              }
            : undefined
        }
        onColumnFiltersChange={setColumnFilters}
        onGlobalFilterChange={setGlobalFilter}
        onPaginationChange={setPagination}
        onSortingChange={setSorting}
        rowCount={rowCount}
        components={{
          Header: (props) => {
            return (
              <TableHead>
                <TableRow>
                  <TableCell rowSpan={2}>Material</TableCell>

                  <TableCell rowSpan={2} align="center">
                    Action
                  </TableCell>
                </TableRow>
                <TableRow>
                  <TableCell align="center">Time</TableCell>
                  <TableCell align="center">Date</TableCell>
                  <TableCell align="center">Time</TableCell>
                  <TableCell align="center">Date</TableCell>
                </TableRow>
              </TableHead>
            );
          },
          Row: ({ datas }) => {
            return (
              <TableRow>
                <TableCell>{data.approve}</TableCell>
                <TableCell align="center">{data.inTime}</TableCell>
                <TableCell align="center">{data.inDate}</TableCell>
                <TableCell align="center">{data.outTime}</TableCell>
                <TableCell align="center">{data.outDate}</TableCell>
                <TableCell align="center">{data.action}</TableCell>
              </TableRow>
            );
          },
        }}
        state={{
          columnFilters,
          globalFilter,
          isLoading,
          pagination,
          showAlertBanner: isError,
          showProgressBars: isRefetching,
          sorting,
        }}
      />
    </div>
  );
</code>```

and here is what its look like:

Can someone tell me what I am doing? I try to figure it out but nothing changes at all

Body:
So I am trying to make a colspan on the header of the material react table, but I notice it doesn't change anything at all. It only renders an existing column, here is my try:

return (

      <MaterialReactTable
        columns={columns}
        data={data}
        getRowId={(row) => row.phoneNumber}
        initialState={{ showColumnFilters: false }}
        manualFiltering
        manualPagination
        manualSorting
        muiToolbarAlertBannerProps={
          isError
            ? {
                color: "error",
                children: "Error loading data",
              }
            : undefined
        }
        onColumnFiltersChange={setColumnFilters}
        onGlobalFilterChange={setGlobalFilter}
        onPaginationChange={setPagination}
        onSortingChange={setSorting}
        rowCount={rowCount}
        components={{
          Header: (props) => {
            return (
              <TableHead>
                <TableRow>
                  <TableCell rowSpan={2}>Material</TableCell>

                  <TableCell rowSpan={2} align="center">
                    Action
                  </TableCell>
                </TableRow>
                <TableRow>
                  <TableCell align="center">Time</TableCell>
                  <TableCell align="center">Date</TableCell>
                  <TableCell align="center">Time</TableCell>
                  <TableCell align="center">Date</TableCell>
                </TableRow>
              </TableHead>
            );
          },
          Row: ({ datas }) => {
            return (
              <TableRow>
                <TableCell>{data.approve}</TableCell>
                <TableCell align="center">{data.inTime}</TableCell>
                <TableCell align="center">{data.inDate}</TableCell>
                <TableCell align="center">{data.outTime}</TableCell>
                <TableCell align="center">{data.outDate}</TableCell>
                <TableCell align="center">{data.action}</TableCell>
              </TableRow>
            );
          },
        }}
        state={{
          columnFilters,
          globalFilter,
          isLoading,
          pagination,
          showAlertBanner: isError,
          showProgressBars: isRefetching,
          sorting,
        }}
      />

  );

and here is what its look like:

Can someone tell me what I am doing? I try to figure it out but nothing changes at all


问:
Capturing Screenshot
I am getting a class not found error in Selenium while writing test case for Capture the Screenshot. Please give the suggestions for resolving my error.</p>
```<code>package org.openqa.selenium.chrome;
import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;

public class Miscellaneous {

    public static void main(String[] args) throws IOException {
        // TODO Auto-generated method stub
        WebDriver driver = new ChromeDriver();
        driver.manage().window().maximize();
        driver.get("https://apple.com");
        //driver.manage().deleteAllCookies();
        //File img = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
        //FileUtils.copyFile(img, new File("C://Users//yaswa//TestingPractice.png"));
        TakesScreenshot ss = (TakesScreenshot)driver;
        File src = ss.getScreenshotAs(OutputType.FILE);
        File trg = new File("C://Users//yaswa//Practice.png");
        FileUtils.copyFile(src, trg);

    }

}
</code>```

Title: Capturing Screenshot

Body:
I am getting a class not found error in Selenium while writing test case for Capture the Screenshot. Please give the suggestions for resolving my error.

package org.openqa.selenium.chrome;
import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;

public class Miscellaneous {

    public static void main(String[] args) throws IOException {
        // TODO Auto-generated method stub
        WebDriver driver = new ChromeDriver();
        driver.manage().window().maximize();
        driver.get("https://apple.com");
        //driver.manage().deleteAllCookies();
        //File img = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
        //FileUtils.copyFile(img, new File("C://Users//yaswa//TestingPractice.png"));
        TakesScreenshot ss = (TakesScreenshot)driver;
        File src = ss.getScreenshotAs(OutputType.FILE);
        File trg = new File("C://Users//yaswa//Practice.png");
        FileUtils.copyFile(src, trg);

    }

}


问:
Can OAuth authorization be used while using amqp10 package for amqp protocol to connect solace broker in nodejs application
In my nodejs based application I am trying to connect solace broker using amqps protocol and package I am using is **amqp10 ** however I am unable to connect it. As per the doc I am creating the uri as 'amqps://default:access_token@broker-host:5671?amqp.saslMechanisms=XOAUTH2'.

But this is not working. Any suggestions? Please share if any sample is available.
Is there any alternative?

```<code>let uri = "amqps://default:" + token.access_token + "@svc-solace-broker:5671?amqp.saslMechanisms=XOAUTH2";
        amqpClient.connect(uri).then(() => {
            // create a sender to the queue
            return amqpClient.createSender(self.queueName);
        }).then((amqpSender) => {
            self.log(`Sending message '${message}'...`);
            return amqpSender.send(message).then(() => {
                self.log('Message sent successfully.');
                self.exit();
            }, (error) => {
                self.error(error);
            });
        });
</code>```

Body:
In my nodejs based application I am trying to connect solace broker using amqps protocol and package I am using is **amqp10 ** however I am unable to connect it. As per the doc I am creating the uri as 'amqps://default:access_token@broker-host:5671?amqp.saslMechanisms=XOAUTH2'.

But this is not working. Any suggestions? Please share if any sample is available.
Is there any alternative?

let uri = "amqps://default:" + token.access_token + "@svc-solace-broker:5671?amqp.saslMechanisms=XOAUTH2";
        amqpClient.connect(uri).then(() => {
            // create a sender to the queue
            return amqpClient.createSender(self.queueName);
        }).then((amqpSender) => {
            self.log(`Sending message '${message}'...`);
            return amqpSender.send(message).then(() => {
                self.log('Message sent successfully.');
                self.exit();
            }, (error) => {
                self.error(error);
            });
        });


问:
restoring database from .frm & .ibd
I have a WordPress site hosted on a Linux server. I need desperate help restoring my database. I managed to salvage the phpmyadmin folder from the server and the following folders:

"var/lib/mysql/performance_schema"
"var/lib/mysql/sys"
"var/lib/mysql/wordpress"
"var/lib/mysql/mysql"

I might be able to recover other files if you think are important to the process.

Can anyone help me build the database from these files?

I found resources online about restoring from mariadb-dump but it was too confusing and not detailed enough. I also tried loading up scripts into MySQL while the tables were created, I did not know how to proceed thereafter.

I tried desperately to access Https://my-ip/phpmyadmin but it would not allow me in. I'm too afraid to try anything at this point fearing that I might further screw things up.

Thank you...

Title: restoring database from .frm & .ibd