问:
How to update frontend using supabase realtime?
Im new in supabase and realtime db, so I have some problems.

I have a simple app, which show how many people online, and show their nicknames. So how I can implement this? I did smth like this:

```<code>const playersOnline = supabase.channel('custom-all-channel')
  .on(
    'postgres_changes',
    { event: '*', schema: 'public', table: 'players_online' },
    (payload) => {
      console.log('Change received!', payload)
    }
  )
  .subscribe()
</code>```

And in console I get this payload, which looks like:

```<code>Object { schema: "public", table: "players_online", commit_timestamp: "2022-12-22T18:35:18Z", eventType: "INSERT", new: {…}, old: {}, errors: null }
</code>```

So what can I do now in frontend? I tried smth like:

```<code>supabase
      .channel('custom-all-channel')
      .on(
        'postgres_changes',
        { event: '*', schema: 'public', table: 'players_online' },
        (payload) => {
          if (payload.eventType === 'INSERT') {
            // update state using payload.new object
          }
          if (payload.eventType === 'DELETE') {
            // update state ...
          }
        }
      )
      .subscribe()
</code>```

But it looks really overwhelming. Also it doesnt work with initial render, so I need add another fetch GET request.

Is it correct way, or I can do something more simple?

Body:
Im new in supabase and realtime db, so I have some problems.

I have a simple app, which show how many people online, and show their nicknames. So how I can implement this? I did smth like this:

const playersOnline = supabase.channel('custom-all-channel')
  .on(
    'postgres_changes',
    { event: '*', schema: 'public', table: 'players_online' },
    (payload) => {
      console.log('Change received!', payload)
    }
  )
  .subscribe()

And in console I get this payload, which looks like:

Object { schema: "public", table: "players_online", commit_timestamp: "2022-12-22T18:35:18Z", eventType: "INSERT", new: {…}, old: {}, errors: null }

So what can I do now in frontend? I tried smth like:

supabase
      .channel('custom-all-channel')
      .on(
        'postgres_changes',
        { event: '*', schema: 'public', table: 'players_online' },
        (payload) => {
          if (payload.eventType === 'INSERT') {
            // update state using payload.new object
          }
          if (payload.eventType === 'DELETE') {
            // update state ...
          }
        }
      )
      .subscribe()

But it looks really overwhelming. Also it doesnt work with initial render, so I need add another fetch GET request.

Is it correct way, or I can do something more simple?


来源: stackexchange

问:
To print the sum of the numbers set by step for example "1-->1 2-->3 3-->6....." so on

This program gives the output for example "10-->55". I want the sum of the numbers set by step for example "1-->1 2-->3 3-->6....." so on. How can I archive this?

ContentLicense: CC BY-SA 4.0


问:
How to create a new resouce in JSON server in React?
So I have this on my JSON server now:

```<code>Resources
http://localhost:8000/taka1008
http://localhost:8000/cheska2389

Home
http://localhost:8000
</code>```

What I want is to create the new Resouces like http://localhost:8000/example2222

But with my method below I get this error: TypeError: Cannot read properties of undefined (reading 'id') Also this on web console POST http://localhost:8000/ 404 (Not Found)

I used POST method to the Home endpoint:

```<code>const userIdPost = {userId:[]};
//userId has a value inside
//Let's say userId = example2222

fetch('http://localhost:8000', {
   method: 'POST',
   headers: {"Content-Type": "application/json"},
   body: JSON.stringify(userIdPost)
}).then(()=>{
   console.log("New user added");
   history.push('/')
})
</code>```

This is what my JSON in my JSON server looks like:

```<code>{
    "taka1008": [
      {
        "title": "Example1",
        "body": "Empty",
        "body2": "Example",
        "time": "2022-12-16T12:25:51.550Z",
        "commentsArray": [],
        "id": 1
      },
      {
        "title": "Example2",
        "body": "This is a new product and I think we don't have a plan yet. ",
        "body2": "Example",
        "time": "2022-12-16T13:04:40.351Z",
        "commentsArray": [],
        "id": 2
      }
    ],
    "cheska2389": [
      {
        "title": "sada",
        "body": "asd",
        "body2": "sad",
        "time": "2022-12-22T17:55:39.068Z",
        "commentsArray": [],
        "id": 1
      }
    ]
}
</code>```

So when I successfully create the new resource like http://localhost:8000/example2222, I am expecting this:

```<code>{
    "taka1008": [
      {
        "title": "Example1",
        "body": "Empty",
        "body2": "Example",
        "time": "2022-12-16T12:25:51.550Z",
        "commentsArray": [],
        "id": 1
      },
      {
        "title": "Example2",
        "body": "This is a new product and I think we don't have a plan yet. ",
        "body2": "Example",
        "time": "2022-12-16T13:04:40.351Z",
        "commentsArray": [],
        "id": 2
      }
    ],
    "cheska2389": [
      {
        "title": "sada",
        "body": "asd",
        "body2": "sad",
        "time": "2022-12-22T17:55:39.068Z",
        "commentsArray": [],
        "id": 1
      }
    ],
    "example2222": [
      {

      }
    ]
}
</code>```

Body:
So I have this on my JSON server now:

Resources
http://localhost:8000/taka1008
http://localhost:8000/cheska2389

Home
http://localhost:8000

What I want is to create the new Resouces like http://localhost:8000/example2222

But with my method below I get this error: TypeError: Cannot read properties of undefined (reading 'id') Also this on web console POST http://localhost:8000/ 404 (Not Found)

I used POST method to the Home endpoint:

const userIdPost = {userId:[]};
//userId has a value inside
//Let's say userId = example2222

fetch('http://localhost:8000', {
   method: 'POST',
   headers: {"Content-Type": "application/json"},
   body: JSON.stringify(userIdPost)
}).then(()=>{
   console.log("New user added");
   history.push('/')
})

This is what my JSON in my JSON server looks like:

{
    "taka1008": [
      {
        "title": "Example1",
        "body": "Empty",
        "body2": "Example",
        "time": "2022-12-16T12:25:51.550Z",
        "commentsArray": [],
        "id": 1
      },
      {
        "title": "Example2",
        "body": "This is a new product and I think we don't have a plan yet. ",
        "body2": "Example",
        "time": "2022-12-16T13:04:40.351Z",
        "commentsArray": [],
        "id": 2
      }
    ],
    "cheska2389": [
      {
        "title": "sada",
        "body": "asd",
        "body2": "sad",
        "time": "2022-12-22T17:55:39.068Z",
        "commentsArray": [],
        "id": 1
      }
    ]
}

So when I successfully create the new resource like http://localhost:8000/example2222, I am expecting this:

{
    "taka1008": [
      {
        "title": "Example1",
        "body": "Empty",
        "body2": "Example",
        "time": "2022-12-16T12:25:51.550Z",
        "commentsArray": [],
        "id": 1
      },
      {
        "title": "Example2",
        "body": "This is a new product and I think we don't have a plan yet. ",
        "body2": "Example",
        "time": "2022-12-16T13:04:40.351Z",
        "commentsArray": [],
        "id": 2
      }
    ],
    "cheska2389": [
      {
        "title": "sada",
        "body": "asd",
        "body2": "sad",
        "time": "2022-12-22T17:55:39.068Z",
        "commentsArray": [],
        "id": 1
      }
    ],
    "example2222": [
      {

      }
    ]
}


问:
how can i remove HTML tags out of a wordpress post content?
I am making an application in react native with a wordpress api. It should be an calalogus app where people can see an overview of product and an detail page of it. Now the main problem is that the content of the post is displayed with HTML tags in it.

This is my code:

```<code>import React, { useState, useEffect } from 'react';
import { StyleSheet, View, Button, Text, ScrollView, Image } from 'react-native';
import {striptags} from 'striptags';

const DetailScreen = ({ route, navigation }) => {
  const { productId } = route.params;
  console.log(productId);

  const discriptionString = route.params.discription.toString()
  console.log(discriptionString);

  const discription = striptags(discriptionString);
  console.log(discription);

  return (
    <View style={styles.screen}>
       <ScrollView>
      <Text style={styles.title}>{route.params.title}</Text>
      <Image style={styles.image} source={{uri: route.params.image,}}/>
      <Text style={styles.description}> {} </Text>
    </ScrollView>
      <Button
        title="Go to overview"
        onPress={() => navigation.navigate('Overview')}

      />
    </View>
  );
}
const styles = StyleSheet.create({
  screen: {
    flex: 1,
    justifyContent: 'center',
  },
  image :{
    height: 200,
    width: 200,
  }
});
export default DetailScreen;
</code>```
```<code>import React, { useState, useEffect } from 'react';
import { StyleSheet, Text, View, FlatList, Button} from 'react-native';

import ProductItem from '../components/products';

const OverviewScreen = ({ navigation }) => {
  const [filter, setFilters] =  useState(0);

  const snowboard = () => {
    setFilters((currentfilter) => currentfilter = 9);

  }

  const ski = () => {
    setFilters((currentfilter) => currentfilter = 10);
  }

  const wandelen = () => {
    setFilters((currentfilter) => currentfilter = 8);

  }

  const reset = () => {
    setFilters((currentfilter) => currentfilter = 0);

  }

  const [products, setProducts] = useState([]); //movies read only, setMovies is een functie om de movies aan te passen

  const getProducts = async () => { //-> assincrone functie, pas na een tijd uitgevoerd, je weet wanneer, pas api wanneer app al klaar staat
    if(filter === 0){
      console.log(filter);
    try { //stuk code proberen als het niet lukt, error afprinten
      const response = await fetch("https://evelienvanophalvens.be/index.php/wp-json/wp/v2/posts?categories=12&_embed&per_page=20", { //data ophalen, response = wat je terugkrijgr van API = resultaat, await= //wachten tot fetch klaar is, !belangrijk!
        "method": "GET", //GET = data ophalen, POST = data verzenden
      })
      const json = await response.json(); //naar het  juiste bestandsformaat omzetten
      console.log(json);
      //movies = json.result) mag niet !!!!!!!!!
      setProducts(json);
    } catch (error) {
      console.error(error);

    }
  }else {
    try { //stuk code proberen als het niet lukt, error afprinten
      const response = await fetch("https://evelienvanophalvens.be/index.php/wp-json/wp/v2/posts?categories=12&categories="+ filter +"&_embed&per_page=20", { //data ophalen, response = wat je terugkrijgr van API = resultaat, await= //wachten tot fetch klaar is, !belangrijk!
        "method": "GET", //GET = data ophalen, POST = data verzenden
      })
      const json = await response.json(); //naar het  juiste bestandsformaat omzetten
      console.log(json);
      //movies = json.result) mag niet !!!!!!!!!
      setProducts(json);
    } catch (error) {
      console.error(error);

    }
  }

  }

  useEffect(() => {
    getProducts();//laad upcomming movies wanneer het scherm laadt
  }, []);

  return (
    <View style={styles.screen}>
      <View style = {styles.filters}>
        <Button onPress={() => { snowboard(); getProducts(); }} title={'snowboard'}/>
        <Button onPress={() => { ski(); getProducts(); }} title={'skiën'}/>
        <Button onPress={() => { wandelen(); getProducts(); }} title={'Wandelen'}/>
        <Button onPress={() => { reset(); getProducts(); }} title={'Reset'}/>
      </View>
      <FlatList //lussen, zoals for loop
        data={products}
        keyExtractor={item => item.id}//gebruik imdb_id als key voor de flatlist
        renderItem={({ item }) => (
          <ProductItem
            id = {item.id}
            title={item.title.rendered}
            image= {item._embedded['wp:featuredmedia']['0'].source_url}
            onSelectProduct={(selectedId) => { navigation.navigate('Detail', { id: selectedId,  title: item.title.rendered, image: item._embedded['wp:featuredmedia']['0'].source_url, discription: item.content.rendered,  }) }}
          />
        )}
      />
    </View >
  );
}

const styles = StyleSheet.create({
  screen: {
    padding: 50,
  },
  filters:{
    display: 'flex',
    flexDirection: 'row',
    justifyContent: 'space-around'
  }
});

export default OverviewScreen;
</code>```

I did some rescearched and found out that there is a library called striptags that would help to solve this problem. I have put my content in a string and then in this function. But it gives me this error back: (0 , _striptags.striptags) is not a function.

Body:
I am making an application in react native with a wordpress api. It should be an calalogus app where people can see an overview of product and an detail page of it. Now the main problem is that the content of the post is displayed with HTML tags in it.

This is my code:

import React, { useState, useEffect } from 'react';
import { StyleSheet, View, Button, Text, ScrollView, Image } from 'react-native';
import {striptags} from 'striptags';

const DetailScreen = ({ route, navigation }) => {
  const { productId } = route.params;
  console.log(productId);

  const discriptionString = route.params.discription.toString()
  console.log(discriptionString);

  const discription = striptags(discriptionString);
  console.log(discription);

  return (
    <View style={styles.screen}>
       <ScrollView>
      <Text style={styles.title}>{route.params.title}</Text>
      <Image style={styles.image} source={{uri: route.params.image,}}/>
      <Text style={styles.description}> {} </Text>
    </ScrollView>
      <Button
        title="Go to overview"
        onPress={() => navigation.navigate('Overview')}

      />
    </View>
  );
}
const styles = StyleSheet.create({
  screen: {
    flex: 1,
    justifyContent: 'center',
  },
  image :{
    height: 200,
    width: 200,
  }
});
export default DetailScreen;

import React, { useState, useEffect } from 'react';
import { StyleSheet, Text, View, FlatList, Button} from 'react-native';

import ProductItem from '../components/products';

const OverviewScreen = ({ navigation }) => {
  const [filter, setFilters] =  useState(0);

  const snowboard = () => {
    setFilters((currentfilter) => currentfilter = 9);

  }

  const ski = () => {
    setFilters((currentfilter) => currentfilter = 10);
  }

  const wandelen = () => {
    setFilters((currentfilter) => currentfilter = 8);

  }

  const reset = () => {
    setFilters((currentfilter) => currentfilter = 0);

  }

  const [products, setProducts] = useState([]); //movies read only, setMovies is een functie om de movies aan te passen

  const getProducts = async () => { //-> assincrone functie, pas na een tijd uitgevoerd, je weet wanneer, pas api wanneer app al klaar staat
    if(filter === 0){
      console.log(filter);
    try { //stuk code proberen als het niet lukt, error afprinten
      const response = await fetch("https://evelienvanophalvens.be/index.php/wp-json/wp/v2/posts?categories=12&_embed&per_page=20", { //data ophalen, response = wat je terugkrijgr van API = resultaat, await= //wachten tot fetch klaar is, !belangrijk!
        "method": "GET", //GET = data ophalen, POST = data verzenden
      })
      const json = await response.json(); //naar het  juiste bestandsformaat omzetten
      console.log(json);
      //movies = json.result) mag niet !!!!!!!!!
      setProducts(json);
    } catch (error) {
      console.error(error);

    }
  }else {
    try { //stuk code proberen als het niet lukt, error afprinten
      const response = await fetch("https://evelienvanophalvens.be/index.php/wp-json/wp/v2/posts?categories=12&categories="+ filter +"&_embed&per_page=20", { //data ophalen, response = wat je terugkrijgr van API = resultaat, await= //wachten tot fetch klaar is, !belangrijk!
        "method": "GET", //GET = data ophalen, POST = data verzenden
      })
      const json = await response.json(); //naar het  juiste bestandsformaat omzetten
      console.log(json);
      //movies = json.result) mag niet !!!!!!!!!
      setProducts(json);
    } catch (error) {
      console.error(error);

    }
  }

  }

  useEffect(() => {
    getProducts();//laad upcomming movies wanneer het scherm laadt
  }, []);

  return (
    <View style={styles.screen}>
      <View style = {styles.filters}>
        <Button onPress={() => { snowboard(); getProducts(); }} title={'snowboard'}/>
        <Button onPress={() => { ski(); getProducts(); }} title={'skiën'}/>
        <Button onPress={() => { wandelen(); getProducts(); }} title={'Wandelen'}/>
        <Button onPress={() => { reset(); getProducts(); }} title={'Reset'}/>
      </View>
      <FlatList //lussen, zoals for loop
        data={products}
        keyExtractor={item => item.id}//gebruik imdb_id als key voor de flatlist
        renderItem={({ item }) => (
          <ProductItem
            id = {item.id}
            title={item.title.rendered}
            image= {item._embedded['wp:featuredmedia']['0'].source_url}
            onSelectProduct={(selectedId) => { navigation.navigate('Detail', { id: selectedId,  title: item.title.rendered, image: item._embedded['wp:featuredmedia']['0'].source_url, discription: item.content.rendered,  }) }}
          />
        )}
      />
    </View >
  );
}

const styles = StyleSheet.create({
  screen: {
    padding: 50,
  },
  filters:{
    display: 'flex',
    flexDirection: 'row',
    justifyContent: 'space-around'
  }
});

export default OverviewScreen;

I did some rescearched and found out that there is a library called striptags that would help to solve this problem. I have put my content in a string and then in this function. But it gives me this error back: (0 , _striptags.striptags) is not a function.


问:
Configure KafkaAvroSerializer for transform step of topology
I'm using Spring Cloud Stream Kafka Streams Binder version 3.2.4, Confluent Platform ver 7.1.1. I following the documentation provided here https://docs.spring.io/spring-cloud-stream-binder-kafka/docs/current/reference/html/spring-cloud-stream-binder-kafka.html.

The Serde implementations for both the Key and Value are SpecificAvroSerde. The SpecificAvroSerde is configured to set auto_register_schemas = false because the topic has an union schema with schema references.

The stream is throwing a serialization error after the transform step in the topology as it cannot find registered schemas for the records in the schema registry.

edit: We are using multiple event types in a single topic. Confluent guidelines says to disable auto-schema registration for this topic. https://www.confluent.io/blog/multiple-event-types-in-the-same-kafka-topic/. We have disabled auto-schema-registration and registered the schema for the our main topic. However, after the transform step there's an new internal repartition topic is being created that doesn't have the registered schemas connected to it.

Caused by: io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException: Subject 'utw-local-095515-t-tipsProcess-repartition-value' not found.; error code: 40401

```<code>  @Bean
    @Autowired
    public Consumer<KStream<UnreportedTipsKey, SpecificRecord>> tipsProcess(
            @Value("${kafka.store.tips}") String unreportedTipsStore,
            Serde<UnreportedTipsKey> tipsKeySerde, Serde<SpecificRecord> specificSerde,
            EventPersister eventPersister, @Value("${kafka.topic.tips}") String topic,
            TransformerSupplier<UnreportedTipsKey, SpecificRecord, KeyValue<UnreportedTipsKey, SpecificRecord>> tipsTransformerSupplier,
            @Value("${MDE_DEPLOYMENT_STAGE}") String env) {

        return input -> input.transform(tipsTransformerSupplier)
                .groupByKey(Grouped.with(tipsKeySerde, specificSerde))
                .aggregate(UnreportedTips::new,
                        new UnreportedTipsAggregator(
                                eventPersister, topic, env),
                        Materialized
                                .<UnreportedTipsKey, UnreportedTips, KeyValueStore<Bytes, byte[]>>as(
                                        unreportedTipsStore)
                                .withKeySerde(tipsKeySerde).withValueSerde(
                                        SerdeConfiguration.unreportedTipsSerde()));
    }
</code>```

```<code>@Configuration
public class SerdeConfiguration {

    private static final String SCHEMA_REGISTRY_URL_CONFIG = "schema.registry.url";
    private static final String AUTO_REGISTER_SCHEMAS = "auto.register.schemas";

    @Bean
    public Serde<UnreportedTipsKey> tipsKeySerde(
            @Value("${spring.kafka.properties.schema.registry.url}") String schemaRegistryUrl) {

        final Map<String, Object> serdeConfig = new HashMap<>();
        serdeConfig.put(SCHEMA_REGISTRY_URL_CONFIG, schemaRegistryUrl);
        serdeConfig.put(AUTO_REGISTER_SCHEMAS, false);

        final Serde<UnreportedTipsKey> keySpecificRecordSerde = new SpecificAvroSerde<>();
        keySpecificRecordSerde.configure(serdeConfig, true);

        return keySpecificRecordSerde;
    }

    @Bean
    public Serde<SpecificRecord> specificRecordValueSerde(
            @Value("${spring.kafka.properties.schema.registry.url}") String schemaRegistryUrl) {

        final Map<String, Object> serdeConfig = new HashMap<>();
        serdeConfig.put(SCHEMA_REGISTRY_URL_CONFIG, schemaRegistryUrl);
        serdeConfig.put(AUTO_REGISTER_SCHEMAS, false);

        final Serde<SpecificRecord> specificRecordValueSerde = new SpecificAvroSerde<>();
        specificRecordValueSerde.configure(serdeConfig, false);

        return specificRecordValueSerde;

    }

    public static Serde<UnreportedTips> unreportedTipsSerde() {
        Serdes.String();
        return new JsonSerde<>(new ObjectMapper().constructType(UnreportedTips.class));
    }
}

</code>```

I have tried several solutions

I wrote my own serializer that ignore the schema registry and set with the properties
spring.cloud.stream.kafka.streams.bindings.tipsProcess.producer.keySerde
spring.cloud.stream.kafka.streams.bindings.tipsProcess.producer.valueSerde
Both of these properties were ignored and a KafkaAvroSerde is being configured.

I updated the Serde in my configuration to use RecordNameStrategy:
This doesn't work either because there's a different Serde being configured for the transform step.

```<code>  @Bean
    public Serde<SpecificRecord> specificRecordValueSerde(
            @Value("${spring.kafka.properties.schema.registry.url}") String schemaRegistryUrl) {

        final Map<String, Object> serdeConfig = new HashMap<>();
        serdeConfig.put(SCHEMA_REGISTRY_URL_CONFIG, schemaRegistryUrl);
        serdeConfig.put(AUTO_REGISTER_SCHEMAS, false);
        serdeConfig.put("value.subject.name.strategy", RecordNameStrategy.class);

        final Serde<SpecificRecord> specificRecordValueSerde = new SpecificAvroSerde<>();
        specificRecordValueSerde.configure(serdeConfig, false);

        return specificRecordValueSerde;

    }
</code>```

The documentation says the following:

Value serdes are inferred using the same rules used for inbound deserialization. First it matches to see if the outbound type is from a provided bean in the application. If not, it checks to see if it matches with a Serde exposed by Kafka such as - Integer, Long, Short, Double, Float, byte[], UUID and String. If that doesnt’t work, then it falls back to JsonSerde provided by the Spring Kafka project, but first look at the default Serde configuration to see if there is a match. Keep in mind that all these happen transparently to the application. If none of these work, then the user has to provide the Serde to use by configuration.

I realize that this may not apply to my topology because the function does not have a declared out bound stream, but the documentation does not mention how to configure serde for any intermediate topics.

Body:
I'm using Spring Cloud Stream Kafka Streams Binder version 3.2.4, Confluent Platform ver 7.1.1. I following the documentation provided here https://docs.spring.io/spring-cloud-stream-binder-kafka/docs/current/reference/html/spring-cloud-stream-binder-kafka.html.

The Serde implementations for both the Key and Value are SpecificAvroSerde. The SpecificAvroSerde is configured to set auto_register_schemas = false because the topic has an union schema with schema references.

The stream is throwing a serialization error after the transform step in the topology as it cannot find registered schemas for the records in the schema registry.

edit: We are using multiple event types in a single topic. Confluent guidelines says to disable auto-schema registration for this topic. https://www.confluent.io/blog/multiple-event-types-in-the-same-kafka-topic/. We have disabled auto-schema-registration and registered the schema for the our main topic. However, after the transform step there's an new internal repartition topic is being created that doesn't have the registered schemas connected to it.

Caused by: io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException: Subject 'utw-local-095515-t-tipsProcess-repartition-value' not found.; error code: 40401

  @Bean
    @Autowired
    public Consumer<KStream<UnreportedTipsKey, SpecificRecord>> tipsProcess(
            @Value("${kafka.store.tips}") String unreportedTipsStore,
            Serde<UnreportedTipsKey> tipsKeySerde, Serde<SpecificRecord> specificSerde,
            EventPersister eventPersister, @Value("${kafka.topic.tips}") String topic,
            TransformerSupplier<UnreportedTipsKey, SpecificRecord, KeyValue<UnreportedTipsKey, SpecificRecord>> tipsTransformerSupplier,
            @Value("${MDE_DEPLOYMENT_STAGE}") String env) {

        return input -> input.transform(tipsTransformerSupplier)
                .groupByKey(Grouped.with(tipsKeySerde, specificSerde))
                .aggregate(UnreportedTips::new,
                        new UnreportedTipsAggregator(
                                eventPersister, topic, env),
                        Materialized
                                .<UnreportedTipsKey, UnreportedTips, KeyValueStore<Bytes, byte[]>>as(
                                        unreportedTipsStore)
                                .withKeySerde(tipsKeySerde).withValueSerde(
                                        SerdeConfiguration.unreportedTipsSerde()));
    }

@Configuration
public class SerdeConfiguration {

    private static final String SCHEMA_REGISTRY_URL_CONFIG = "schema.registry.url";
    private static final String AUTO_REGISTER_SCHEMAS = "auto.register.schemas";

    @Bean
    public Serde<UnreportedTipsKey> tipsKeySerde(
            @Value("${spring.kafka.properties.schema.registry.url}") String schemaRegistryUrl) {

        final Map<String, Object> serdeConfig = new HashMap<>();
        serdeConfig.put(SCHEMA_REGISTRY_URL_CONFIG, schemaRegistryUrl);
        serdeConfig.put(AUTO_REGISTER_SCHEMAS, false);

        final Serde<UnreportedTipsKey> keySpecificRecordSerde = new SpecificAvroSerde<>();
        keySpecificRecordSerde.configure(serdeConfig, true);

        return keySpecificRecordSerde;
    }

    @Bean
    public Serde<SpecificRecord> specificRecordValueSerde(
            @Value("${spring.kafka.properties.schema.registry.url}") String schemaRegistryUrl) {

        final Map<String, Object> serdeConfig = new HashMap<>();
        serdeConfig.put(SCHEMA_REGISTRY_URL_CONFIG, schemaRegistryUrl);
        serdeConfig.put(AUTO_REGISTER_SCHEMAS, false);

        final Serde<SpecificRecord> specificRecordValueSerde = new SpecificAvroSerde<>();
        specificRecordValueSerde.configure(serdeConfig, false);

        return specificRecordValueSerde;

    }

    public static Serde<UnreportedTips> unreportedTipsSerde() {
        Serdes.String();
        return new JsonSerde<>(new ObjectMapper().constructType(UnreportedTips.class));
    }
}

I have tried several solutions

I wrote my own serializer that ignore the schema registry and set with the properties
spring.cloud.stream.kafka.streams.bindings.tipsProcess.producer.keySerde
spring.cloud.stream.kafka.streams.bindings.tipsProcess.producer.valueSerde
Both of these properties were ignored and a KafkaAvroSerde is being configured.

I updated the Serde in my configuration to use RecordNameStrategy:
This doesn't work either because there's a different Serde being configured for the transform step.

  @Bean
    public Serde<SpecificRecord> specificRecordValueSerde(
            @Value("${spring.kafka.properties.schema.registry.url}") String schemaRegistryUrl) {

        final Map<String, Object> serdeConfig = new HashMap<>();
        serdeConfig.put(SCHEMA_REGISTRY_URL_CONFIG, schemaRegistryUrl);
        serdeConfig.put(AUTO_REGISTER_SCHEMAS, false);
        serdeConfig.put("value.subject.name.strategy", RecordNameStrategy.class);

        final Serde<SpecificRecord> specificRecordValueSerde = new SpecificAvroSerde<>();
        specificRecordValueSerde.configure(serdeConfig, false);

        return specificRecordValueSerde;

    }

The documentation says the following:

Value serdes are inferred using the same rules used for inbound deserialization. First it matches to see if the outbound type is from a provided bean in the application. If not, it checks to see if it matches with a Serde exposed by Kafka such as - Integer, Long, Short, Double, Float, byte[], UUID and String. If that doesnt’t work, then it falls back to JsonSerde provided by the Spring Kafka project, but first look at the default Serde configuration to see if there is a match. Keep in mind that all these happen transparently to the application. If none of these work, then the user has to provide the Serde to use by configuration.

I realize that this may not apply to my topology because the function does not have a declared out bound stream, but the documentation does not mention how to configure serde for any intermediate topics.


问:
Does Tosca supports react and angular applications
Does Tosca supports react and angular applications. Do the old test scripts built on angular applications will work on new react upgraded application .Is there any add on which helps us to run old UI scripts in New upgraded UI .If any solution please let me know.

Try to run old test cases in the New UI of same application


问:
Sveltekit + Docker + Prisma (prisma do not seem to work)
Anyone who can see anything off in my Dockerfile?
Prisma works well when running: pnpm run dev in ordinary Dev folder (also seems to work well via Vercel). But when running through Docker any prisma calls/requests to db do not seem to work at all.

Isn't I'm copying .env and prisma folder correctly in my Dockerfile or am I perhaps missing something else? (.env has DATABASE_URL = "postgres: .... which Prisma uses)

```<code>FROM node:18-alpine as builder
RUN npm install -g pnpm

WORKDIR /app

COPY package*.json ./

RUN pnpm install

COPY prisma ./prisma/

COPY .env ./

RUN npx prisma generate

COPY . .

RUN pnpm run build

FROM node:18-alpine

WORKDIR /app

COPY --from=builder /app/build .
COPY --from=builder /app/package.json .
COPY --from=builder /app/node_modules ./node_modules

EXPOSE 3000

CMD ["node", "index.js"]
</code>```

Body:
Anyone who can see anything off in my Dockerfile?
Prisma works well when running: pnpm run dev in ordinary Dev folder (also seems to work well via Vercel). But when running through Docker any prisma calls/requests to db do not seem to work at all.

Isn't I'm copying .env and prisma folder correctly in my Dockerfile or am I perhaps missing something else? (.env has DATABASE_URL = "postgres: .... which Prisma uses)

FROM node:18-alpine as builder
RUN npm install -g pnpm

WORKDIR /app

COPY package*.json ./

RUN pnpm install

COPY prisma ./prisma/

COPY .env ./

RUN npx prisma generate

COPY . .

RUN pnpm run build

FROM node:18-alpine

WORKDIR /app

COPY --from=builder /app/build .
COPY --from=builder /app/package.json .
COPY --from=builder /app/node_modules ./node_modules

EXPOSE 3000

CMD ["node", "index.js"]


问:
Region is not getting selected in react-google-charts geo-chart
I am trying to highlight the selected region in basic geochart using react-google-charts.

Here's how I want to do it jsfiddle.

As you can see in above example when the region is clicked it keeps highlighted till next one is clicked. I have used the same example in my code and it is not working. It does not keep the region highlighted after click.

Here is my code sample,( same as the jsfiddle example )

```<code>import Chart from "react-google-charts";

const test = [
        ["Country", "Popularity"],
        ["Germany", 200],
        ["United States", 300],
        ["Brazil", 400],
        ["Canada", 500],
        ["France", 600],
        ["RU", 700],
        ["India", 900]
    ];

render(){
    return(
        <div>
           <Chart
             chartEvents={[
            {
                eventName: "select",
                callback: ({ chartWrapper }) => {
                const chart = chartWrapper.getChart();
                const selection = chart.getSelection();
                if (selection.length === 0) return;
                const region = test[selection[0].row + 1];
                console.log("Selected : " + region);
                },
            },
            ]}
            chartType="GeoChart"
            width="100%"
            height="400px"
            data={test}
          />
       </div>
    )
}
</code>```

I don't know where I am going wrong. I am using react with javascript. Any help will be appreciated.

Body:
I am trying to highlight the selected region in basic geochart using react-google-charts.

Here's how I want to do it jsfiddle.

As you can see in above example when the region is clicked it keeps highlighted till next one is clicked. I have used the same example in my code and it is not working. It does not keep the region highlighted after click.

Here is my code sample,( same as the jsfiddle example )

import Chart from "react-google-charts";

const test = [
        ["Country", "Popularity"],
        ["Germany", 200],
        ["United States", 300],
        ["Brazil", 400],
        ["Canada", 500],
        ["France", 600],
        ["RU", 700],
        ["India", 900]
    ];

render(){
    return(

           <Chart
             chartEvents={[
            {
                eventName: "select",
                callback: ({ chartWrapper }) => {
                const chart = chartWrapper.getChart();
                const selection = chart.getSelection();
                if (selection.length === 0) return;
                const region = test[selection[0].row + 1];
                console.log("Selected : " + region);
                },
            },
            ]}
            chartType="GeoChart"
            width="100%"
            height="400px"
            data={test}
          />

    )
}

I don't know where I am going wrong. I am using react with javascript. Any help will be appreciated.


问:
Event triggering only when breakpoint is present
I have a weird problem that I would like to solve. I have a project where I want a tooltip window to be shown. For this tooltip, I'm using ToolTip.OwnerDraw = true because I want to draw a picture in the tooltip.

The tooltip is used on a TreeView Node, on the NodeMouseHover event. I then call ToolTip. Show from there.

From my understanding, the following should be happening in that order:

NodeMouseHover happens and ToolTip. The show is called Tooltip_Popup and should happen ToolTip_Draw happens.

For debugging purposes, I've put a Debug.Print in the ToolTip_Popup event and if I run the code normally (in debug mode, but with no breakpoint), the Debug.Print never happens (ToolTip_PopUp is never called). If I put a breakpoint on the ToolTip.Show call and then follow execution with F11, the PopUp event is called. Do you know why?

I tried changing the order around, but in any case, the PopUp event is only triggering when using the F11 debugging method, otherwise, it's not called...


问:
Saving Excel charts as images from certain worksheets in python shows up blank
When I run the code as part of a function, it returns blank images. However, when i run it line by line(and exclude the bloomberg refresh) it produces and saves the images I want to see.
This code is supposed to update all bloomberg api formulas and then save all charts that show up on a specific worksheets. However, it shows up blank. There are 4 worksheets in this workbook but I just want to save images from 2 worksheets.  Any suggestions on why?</p>
```<code>import win32com.client
from win32com.client import Dispatch

sheets_list = ['GRAPH_TAB','GRAPH_TAB2']
outputPNGImagePath = 'C:\\Users'

def export_image():
    xlapp = win32com.client.gencache.EnsureDispatch("Excel.Application")
    time.sleep(t)
    xlapp.RegisterXLL('C:/blp/API/Office Tools/bofaddin.dll')
    time.sleep(t)
    xlapp.Workbooks.Open('C:\\blp\\API\\Office Tools\\BloombergUI.xla')
    time.sleep(t)
    wb = xlapp.Workbooks.Open(outputPNGImagePath + '\\myFile.xlsx',None,False)
    xlapp.CalculateFull()
    xlapp.CalculateUntilAsyncQueriesDone()
    xlapp.Application.Calculation = -4135 # to set xlCalculationManual
    xlapp.DisplayAlerts = False
    xlapp.Visible = True
    time.sleep(t)
    wb_addin = ('C:/blp/API/Office Tools/bofaddin.dll')
    time.sleep(t*4)
    wb.RefreshAll()
    xlapp.CalculateUntilAsyncQueriesDone()
    time.sleep(t*2)

    i = 1
    for sheet in sheets_list:
        graph = wb.Worksheets(sheet)
        for chartObject in graph.ChartObjects():
            chartObject.Copy
            print(graph.Name + ':' + chartObject.Name)
            chartObject.Chart.Export(outputPNGImagePath + "\\chart" + str(i) + ".png")
            i += 1
    wb.Close(SaveChanges=True)
    xlapp.Application.Quit()

    wb = None
    xlapp = None
    del wb
    del xlapp
</code>```

Body:
When I run the code as part of a function, it returns blank images. However, when i run it line by line(and exclude the bloomberg refresh) it produces and saves the images I want to see.
This code is supposed to update all bloomberg api formulas and then save all charts that show up on a specific worksheets. However, it shows up blank. There are 4 worksheets in this workbook but I just want to save images from 2 worksheets.  Any suggestions on why?

import win32com.client
from win32com.client import Dispatch

sheets_list = ['GRAPH_TAB','GRAPH_TAB2']
outputPNGImagePath = 'C:\\Users'

def export_image():
    xlapp = win32com.client.gencache.EnsureDispatch("Excel.Application")
    time.sleep(t)
    xlapp.RegisterXLL('C:/blp/API/Office Tools/bofaddin.dll')
    time.sleep(t)
    xlapp.Workbooks.Open('C:\\blp\\API\\Office Tools\\BloombergUI.xla')
    time.sleep(t)
    wb = xlapp.Workbooks.Open(outputPNGImagePath + '\\myFile.xlsx',None,False)
    xlapp.CalculateFull()
    xlapp.CalculateUntilAsyncQueriesDone()
    xlapp.Application.Calculation = -4135 # to set xlCalculationManual
    xlapp.DisplayAlerts = False
    xlapp.Visible = True
    time.sleep(t)
    wb_addin = ('C:/blp/API/Office Tools/bofaddin.dll')
    time.sleep(t*4)
    wb.RefreshAll()
    xlapp.CalculateUntilAsyncQueriesDone()
    time.sleep(t*2)

    i = 1
    for sheet in sheets_list:
        graph = wb.Worksheets(sheet)
        for chartObject in graph.ChartObjects():
            chartObject.Copy
            print(graph.Name + ':' + chartObject.Name)
            chartObject.Chart.Export(outputPNGImagePath + "\\chart" + str(i) + ".png")
            i += 1
    wb.Close(SaveChanges=True)
    xlapp.Application.Quit()

    wb = None
    xlapp = None
    del wb
    del xlapp


问:
How to live stream to UPnP media renderer TV?
I would like to stream live audio-video from my PC with camera over LAN to TV supporting DLNA/UPnP.

Questions:

How to get my TV to play my HLS/UDP/RTSP stream

How can I detect what formats/playlist are supported on my TV?

I can play video from HTTP
I can play video from Media Server

I have successfully used SetAVTransportURI for these.

But when I use m3u8 playlist, or RTSP, TV says unknown format.

I can control TV from Home Assistant or curl upnp request.
I can create streaming server using VLC, ffmpeg, gstreamer, icecast ...
I think it should be possible because TV can play live youtube, netflix streams. It is Philips TV with its SAPHI OS.


问:
Excel VBA find a text string from folder files and get relative data
I have a folder with lots of excel files inside. I need to search the contents of these files according to predefined keywords and once any of these keywords is found I need to extract some data from the table (since I have managed to get the most of the data, here I need help only in getting the data from the last row of the second to the next cell). After that, I have to make a list of all found data in another table. My search table looks something like this: (Header cells and 2 empty cells next to them are merged in my excel table as well as "kg", "m3" and "TN" cells)

Sand

Big Stone

Metal

kg

m3

TN

Norm
Act.
Approved
Norm
Act.
Approved
Norm
Act.
Approved

0.2
2.69
2.69

1.19
4.74
4.74

0.02
0.07
0.07

X

47.2
X

14.9
X

0.07

I have to find a cell that contains a word "stone" and get the value from the last row of "Approved" column i.e. "14.9" and put it in my other table in which I am listing all found values. My other table looks like the below example:

Keyword
Workbook
Worksheet
Address
Found cell content
Measure
Amount

stone
D:\Inert\М-29.xlsm
M-29
$W$2
Big Stone
m3
14.9

I actually have got a code from the internet to do the task and adapted it to my case. Unfortunately, as I have very little knowledge of VBA, I was not able figure out how to get "Amount" column value (just this one). In my case, these values should have been listed in G column of newly created final table. Below is my code, the part of the code that is necessary to be corrected is highlighted with "??????" question marks. I use MS Office 365. Any help is really appreciated. Thank you!

```<code>    Public Sub searchText()
    Dim MyFSO As FileSystemObject
    Dim MyFolder As folder
    Dim MySubfolder As folder
    Dim wb As Object
    Dim ws As Worksheet

    searchList = Array("stone", "somthng")    'define the list of text you want to search, case insensitive

    Set MyFSO = New FileSystemObject
    folderPath = "D:\Inert\М-29.xlsm" 'define the path of the folder that contains the workbooks
    Set folder = MyFSO.GetFolder(folderPath)
    Dim thisWbWs, newWS As Worksheet

    'Create summary worksheet if not exist
    For Each thisWbWs In ActiveWorkbook.Worksheets
        If wsExists("summary") Then
            counter = 1
        End If
    Next thisWbWs

    If counter = 0 Then
        Set newWS = ThisWorkbook.Worksheets.Add(After:=Worksheets(Worksheets.Count))
        With newWS
            .Name = "summary"
            .Range("A1").Value = "Keyword"
            .Range("B1").Value = "Workbook"
            .Range("C1").Value = "Worksheet"
            .Range("D1").Value = "Address"
            .Range("E1").Value = "Found cell content"
            .Range("F1").Value = "Measure"
            .Range("G1").Value = "Amount"
        End With
    End If

    With Application
        .DisplayAlerts = False
        .ScreenUpdating = False
        .EnableEvents = False
        .AskToUpdateLinks = False
    End With

    'Check each workbook in main folder
    For Each wb In folder.Files
        If Right(wb.Name, 3) = "xls" Or Right(wb.Name, 4) = "xlsx" Or Right(wb.Name, 4) = "xlsm" Then
            Set masterWB = Workbooks.Open(wb)
            For Each ws In masterWB.Worksheets
              For Each Rng In ws.UsedRange
                For Each i In searchList
                    If InStr(1, Rng.Value, i, vbTextCompare) > 0 Then   'vbTextCompare means case insensitive.
                        nextRow = ThisWorkbook.Sheets("summary").Range("A" & Rows.Count).End(xlUp).Row + 1

                        With ThisWorkbook.Sheets("summary")
                            .Range("A" & nextRow).Value = i
                            .Range("B" & nextRow).Value = Application.ActiveWorkbook.FullName
                            .Range("C" & nextRow).Value = ws.Name
                            .Range("D" & nextRow).Value = Rng.Address
                            .Range("E" & nextRow).Value = Rng.Value
                            .Range("F" & nextRow).Value = Rng.Offset(1).Value
                            .Range("G" & nextRow).Value = ??????????????
                        End With
                    End If
                Next i
              Next Rng
            Next ws
            ActiveWorkbook.Close True
        End If
    Next

    'Check each workbook in sub folders
    For Each subfolder In folder.SubFolders
        For Each wb In subfolder.Files
            If Right(wb.Name, 3) = "xls" Or Right(wb.Name, 4) = "xlsx" Or Right(wb.Name, 4) = "xlsm" Then
                Set masterWB = Workbooks.Open(wb)
                For Each ws In masterWB.Worksheets
                  For Each Rng In ws.UsedRange
                    For Each i In searchList
                        If InStr(1, Rng.Value, i, vbTextCompare) > 0 Then
                            nextRow = ThisWorkbook.Sheets("summary").Range("A" & Rows.Count).End(xlUp).Row + 1
                            With ThisWorkbook.Sheets("summary")
                                .Range("A" & nextRow).Value = i
                                .Range("B" & nextRow).Value = Application.ActiveWorkbook.FullName
                                .Range("C" & nextRow).Value = ws.Name
                                .Range("D" & nextRow).Value = Rng.Address
                                .Range("E" & nextRow).Value = Rng.Value
                                .Range("F" & nextRow).Value = Rng.Offset(1).Value
                .Range("G" & nextRow).Value = ??????????????
                            End With
                        End If
                    Next i
                  Next Rng
                Next ws
                ActiveWorkbook.Close True
            End If
        Next
    Next
    With Application
        .DisplayAlerts = True
        .ScreenUpdating = True
        .EnableEvents = True
        .AskToUpdateLinks = True
    End With

    ThisWorkbook.Sheets("summary").Cells.Select
    ThisWorkbook.Sheets("summary").Cells.EntireColumn.AutoFit
    ThisWorkbook.Sheets("summary").Range("A1").Select

End Sub

Function wsExists(wksName As String) As Boolean
    On Error Resume Next
    wsExists = CBool(Len(Worksheets(wksName).Name) > 0)
    On Error GoTo 0
End Function
</code>```

Body:
I have a folder with lots of excel files inside. I need to search the contents of these files according to predefined keywords and once any of these keywords is found I need to extract some data from the table (since I have managed to get the most of the data, here I need help only in getting the data from the last row of the second to the next cell). After that, I have to make a list of all found data in another table. My search table looks something like this: (Header cells and 2 empty cells next to them are merged in my excel table as well as "kg", "m3" and "TN" cells)

Sand

Big Stone

Metal

kg

m3

TN

Norm
Act.
Approved
Norm
Act.
Approved
Norm
Act.
Approved

0.2
2.69
2.69

1.19
4.74
4.74

0.02
0.07
0.07

X

47.2
X

14.9
X

0.07

I have to find a cell that contains a word "stone" and get the value from the last row of "Approved" column i.e. "14.9" and put it in my other table in which I am listing all found values. My other table looks like the below example:

Keyword
Workbook
Worksheet
Address
Found cell content
Measure
Amount

stone
D:\Inert\М-29.xlsm
M-29
$W$2
Big Stone
m3
14.9

I actually have got a code from the internet to do the task and adapted it to my case. Unfortunately, as I have very little knowledge of VBA, I was not able figure out how to get "Amount" column value (just this one). In my case, these values should have been listed in G column of newly created final table. Below is my code, the part of the code that is necessary to be corrected is highlighted with "??????" question marks. I use MS Office 365. Any help is really appreciated. Thank you!

    Public Sub searchText()
    Dim MyFSO As FileSystemObject
    Dim MyFolder As folder
    Dim MySubfolder As folder
    Dim wb As Object
    Dim ws As Worksheet

    searchList = Array("stone", "somthng")    'define the list of text you want to search, case insensitive

    Set MyFSO = New FileSystemObject
    folderPath = "D:\Inert\М-29.xlsm" 'define the path of the folder that contains the workbooks
    Set folder = MyFSO.GetFolder(folderPath)
    Dim thisWbWs, newWS As Worksheet

    'Create summary worksheet if not exist
    For Each thisWbWs In ActiveWorkbook.Worksheets
        If wsExists("summary") Then
            counter = 1
        End If
    Next thisWbWs

    If counter = 0 Then
        Set newWS = ThisWorkbook.Worksheets.Add(After:=Worksheets(Worksheets.Count))
        With newWS
            .Name = "summary"
            .Range("A1").Value = "Keyword"
            .Range("B1").Value = "Workbook"
            .Range("C1").Value = "Worksheet"
            .Range("D1").Value = "Address"
            .Range("E1").Value = "Found cell content"
            .Range("F1").Value = "Measure"
            .Range("G1").Value = "Amount"
        End With
    End If

    With Application
        .DisplayAlerts = False
        .ScreenUpdating = False
        .EnableEvents = False
        .AskToUpdateLinks = False
    End With

    'Check each workbook in main folder
    For Each wb In folder.Files
        If Right(wb.Name, 3) = "xls" Or Right(wb.Name, 4) = "xlsx" Or Right(wb.Name, 4) = "xlsm" Then
            Set masterWB = Workbooks.Open(wb)
            For Each ws In masterWB.Worksheets
              For Each Rng In ws.UsedRange
                For Each i In searchList
                    If InStr(1, Rng.Value, i, vbTextCompare) > 0 Then   'vbTextCompare means case insensitive.
                        nextRow = ThisWorkbook.Sheets("summary").Range("A" & Rows.Count).End(xlUp).Row + 1

                        With ThisWorkbook.Sheets("summary")
                            .Range("A" & nextRow).Value = i
                            .Range("B" & nextRow).Value = Application.ActiveWorkbook.FullName
                            .Range("C" & nextRow).Value = ws.Name
                            .Range("D" & nextRow).Value = Rng.Address
                            .Range("E" & nextRow).Value = Rng.Value
                            .Range("F" & nextRow).Value = Rng.Offset(1).Value
                            .Range("G" & nextRow).Value = ??????????????
                        End With
                    End If
                Next i
              Next Rng
            Next ws
            ActiveWorkbook.Close True
        End If
    Next

    'Check each workbook in sub folders
    For Each subfolder In folder.SubFolders
        For Each wb In subfolder.Files
            If Right(wb.Name, 3) = "xls" Or Right(wb.Name, 4) = "xlsx" Or Right(wb.Name, 4) = "xlsm" Then
                Set masterWB = Workbooks.Open(wb)
                For Each ws In masterWB.Worksheets
                  For Each Rng In ws.UsedRange
                    For Each i In searchList
                        If InStr(1, Rng.Value, i, vbTextCompare) > 0 Then
                            nextRow = ThisWorkbook.Sheets("summary").Range("A" & Rows.Count).End(xlUp).Row + 1
                            With ThisWorkbook.Sheets("summary")
                                .Range("A" & nextRow).Value = i
                                .Range("B" & nextRow).Value = Application.ActiveWorkbook.FullName
                                .Range("C" & nextRow).Value = ws.Name
                                .Range("D" & nextRow).Value = Rng.Address
                                .Range("E" & nextRow).Value = Rng.Value
                                .Range("F" & nextRow).Value = Rng.Offset(1).Value
                .Range("G" & nextRow).Value = ??????????????
                            End With
                        End If
                    Next i
                  Next Rng
                Next ws
                ActiveWorkbook.Close True
            End If
        Next
    Next
    With Application
        .DisplayAlerts = True
        .ScreenUpdating = True
        .EnableEvents = True
        .AskToUpdateLinks = True
    End With

    ThisWorkbook.Sheets("summary").Cells.Select
    ThisWorkbook.Sheets("summary").Cells.EntireColumn.AutoFit
    ThisWorkbook.Sheets("summary").Range("A1").Select

End Sub

Function wsExists(wksName As String) As Boolean
    On Error Resume Next
    wsExists = CBool(Len(Worksheets(wksName).Name) > 0)
    On Error GoTo 0
End Function


问:
AWS QuickSight: ListDashboards API throwing 302 error back
I was trying to list the dashboards available / configured in the AWS QuickSight using the QuickSight APIs. Unfortunately there are very very few examples available on the internet and hence thought to seek some help.

Following is what my java code looks like:

`

```<code>    @RequestMapping(name = "listDashboards", value = "/quicksight/listdashboards", method = RequestMethod.GET)
    public ResponseEntity<ListDashboardsResult> listDashboards() {
        String endPointURI = "https://us-east-1.quicksight.aws.amazon.com";
        EndpointConfiguration endPointConfig = new EndpointConfiguration(endPointURI, "us-east-1");
        AmazonQuickSightClientBuilder awsQsBuilder = AmazonQuickSightClientBuilder.standard()//.withRegion(AWSProperties.getRegion())
        .withCredentials(new AWSStaticCredentialsProvider(
                new BasicAWSCredentials("XYZ_ACCESS_KEY", "ABC_SECRET_KEY")));
        awsQsBuilder.setEndpointConfiguration(endPointConfig);
        AmazonQuickSight quickSightClient = awsQsBuilder.build();
        ListDashboardsRequest listDashboards = new ListDashboardsRequest();
        listDashboards.setAwsAccountId("ACCOUNT_ID");
        ListDashboardsResult result = quickSightClient.listDashboards(listDashboards);
        return new ResponseEntity<ListDashboardsResult>(result, HttpStatus.OK);
    }
</code>```

`

I'm trying to test this from my local machine. I've added the localhost URL https URL to the "Accepted Domains" in the quicksight "Domains and Embedding" section.

However when I run the application and try to retrieve the list, I always end up seeing the following response being returned from the quicksight.

```<code>com.amazonaws.services.quicksight.model.AmazonQuickSightException: null (Service: AmazonQuickSight; Status Code: 302; Error Code: null; Request ID: b43aabfb-7852-449c-854d-6d88f1f11c13; Proxy: null)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1862) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleServiceErrorResponse(AmazonHttpClient.java:1415) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1384) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1154) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:811) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:779) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:753) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:713) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:695) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:559) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:539) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.services.quicksight.AmazonQuickSightClient.doInvoke(AmazonQuickSightClient.java:9215) ~[aws-java-sdk-quicksight-1.12.195.jar:na]
at com.amazonaws.services.quicksight.AmazonQuickSightClient.invoke(AmazonQuickSightClient.java:9182) ~[aws-java-sdk-quicksight-1.12.195.jar:na]
at com.amazonaws.services.quicksight.AmazonQuickSightClient.invoke(AmazonQuickSightClient.java:9171) ~[aws-java-sdk-quicksight-1.12.195.jar:na]
at com.amazonaws.services.quicksight.AmazonQuickSightClient.executeListDashboards(AmazonQuickSightClient.java:5370) ~[aws-java-sdk-quicksight-1.12.195.jar:na]
at com.amazonaws.services.quicksight.AmazonQuickSightClient.listDashboards(AmazonQuickSightClient.java:5339) ~[aws-java-sdk-quicksight-1.12.195.jar:na]
at com.example.demo.quicksight.QuickSightDashboardUtils.listDashboards(QuickSightDashboardUtils.java:62) ~[main/:na]
at com.example.demo.quicksight.QuickSightController.listDashboards(QuickSightController.java:20) ~[main/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.24.jar:5.3.24]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-5.3.24.jar:5.3.24]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-5.3.24.jar:5.3.24]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.24.jar:5.3.24]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.24.jar:5.3.24]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.24.jar:5.3.24]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1071) ~[spring-webmvc-5.3.24.jar:5.3.24]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:964) ~[spring-webmvc-5.3.24.jar:5.3.24]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.24.jar:5.3.24]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.24.jar:5.3.24]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:670) ~[tomcat-embed-core-9.0.69.jar:4.0.FR]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.24.jar:5.3.24]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:779) ~[tomcat-embed-core-9.0.69.jar:4.0.FR]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.69.jar:9.0.69]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.24.jar:5.3.24]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.24.jar:5.3.24]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.24.jar:5.3.24]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.24.jar:5.3.24]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.24.jar:5.3.24]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.24.jar:5.3.24]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1784) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]
</code>```

Is there anything else I am missing here?

Body:
I was trying to list the dashboards available / configured in the AWS QuickSight using the QuickSight APIs. Unfortunately there are very very few examples available on the internet and hence thought to seek some help.

Following is what my java code looks like:

`

    @RequestMapping(name = "listDashboards", value = "/quicksight/listdashboards", method = RequestMethod.GET)
    public ResponseEntity<ListDashboardsResult> listDashboards() {
        String endPointURI = "https://us-east-1.quicksight.aws.amazon.com";
        EndpointConfiguration endPointConfig = new EndpointConfiguration(endPointURI, "us-east-1");
        AmazonQuickSightClientBuilder awsQsBuilder = AmazonQuickSightClientBuilder.standard()//.withRegion(AWSProperties.getRegion())
        .withCredentials(new AWSStaticCredentialsProvider(
                new BasicAWSCredentials("XYZ_ACCESS_KEY", "ABC_SECRET_KEY")));
        awsQsBuilder.setEndpointConfiguration(endPointConfig);
        AmazonQuickSight quickSightClient = awsQsBuilder.build();
        ListDashboardsRequest listDashboards = new ListDashboardsRequest();
        listDashboards.setAwsAccountId("ACCOUNT_ID");
        ListDashboardsResult result = quickSightClient.listDashboards(listDashboards);
        return new ResponseEntity<ListDashboardsResult>(result, HttpStatus.OK);
    }

`

I'm trying to test this from my local machine. I've added the localhost URL https URL to the "Accepted Domains" in the quicksight "Domains and Embedding" section.

However when I run the application and try to retrieve the list, I always end up seeing the following response being returned from the quicksight.

com.amazonaws.services.quicksight.model.AmazonQuickSightException: null (Service: AmazonQuickSight; Status Code: 302; Error Code: null; Request ID: b43aabfb-7852-449c-854d-6d88f1f11c13; Proxy: null)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1862) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleServiceErrorResponse(AmazonHttpClient.java:1415) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1384) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1154) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:811) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:779) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:753) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:713) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:695) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:559) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:539) ~[aws-java-sdk-core-1.12.195.jar:na]
at com.amazonaws.services.quicksight.AmazonQuickSightClient.doInvoke(AmazonQuickSightClient.java:9215) ~[aws-java-sdk-quicksight-1.12.195.jar:na]
at com.amazonaws.services.quicksight.AmazonQuickSightClient.invoke(AmazonQuickSightClient.java:9182) ~[aws-java-sdk-quicksight-1.12.195.jar:na]
at com.amazonaws.services.quicksight.AmazonQuickSightClient.invoke(AmazonQuickSightClient.java:9171) ~[aws-java-sdk-quicksight-1.12.195.jar:na]
at com.amazonaws.services.quicksight.AmazonQuickSightClient.executeListDashboards(AmazonQuickSightClient.java:5370) ~[aws-java-sdk-quicksight-1.12.195.jar:na]
at com.amazonaws.services.quicksight.AmazonQuickSightClient.listDashboards(AmazonQuickSightClient.java:5339) ~[aws-java-sdk-quicksight-1.12.195.jar:na]
at com.example.demo.quicksight.QuickSightDashboardUtils.listDashboards(QuickSightDashboardUtils.java:62) ~[main/:na]
at com.example.demo.quicksight.QuickSightController.listDashboards(QuickSightController.java:20) ~[main/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.24.jar:5.3.24]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-5.3.24.jar:5.3.24]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-5.3.24.jar:5.3.24]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.24.jar:5.3.24]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.24.jar:5.3.24]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.24.jar:5.3.24]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1071) ~[spring-webmvc-5.3.24.jar:5.3.24]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:964) ~[spring-webmvc-5.3.24.jar:5.3.24]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.24.jar:5.3.24]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.24.jar:5.3.24]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:670) ~[tomcat-embed-core-9.0.69.jar:4.0.FR]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.24.jar:5.3.24]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:779) ~[tomcat-embed-core-9.0.69.jar:4.0.FR]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.69.jar:9.0.69]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.24.jar:5.3.24]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.24.jar:5.3.24]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.24.jar:5.3.24]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.24.jar:5.3.24]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.24.jar:5.3.24]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.24.jar:5.3.24]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1784) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.69.jar:9.0.69]
at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]

Is there anything else I am missing here?


问:
Make table with td collapse an borders
Can I make a table like the image attached below?

The functionality I want but have trouble implementing is styling. More specifically the rounded edges and border when the row is collapsed and not.

This is what I have tried:

$(document).ready(function() {
    $('tr:not(.header)').hide();

    $('tr.header').click(function() {
      $(this).find('span').text(function(_, value) {
        return value == '^' ? 'v' : '^'
      });

      $(this).nextUntil('tr.header').slideToggle(100, function() {});
    });
  });```
<pre class="snippet-code-css lang-css prettyprint-override"><code>table,
tr,
td,
th {
  border: 1px solid black;
  border-collapse: collapse;
}

tr.header {
  cursor: pointer;
}</code>```

              NUM
              ITEM

              INFO
              INCLUDE

            010
            Shoes
            v
            <input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">

            DRAG
            <input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
            NAME
            ITEM
            PREFERED
            EDIT

```

I am using bootstrap-5

Any helps is greatly appreciated

Title: Make table with td collapse an borders

Body:
Can I make a table like the image attached below?

The functionality I want but have trouble implementing is styling. More specifically the rounded edges and border when the row is collapsed and not.

This is what I have tried:

$(document).ready(function() {
    $('tr:not(.header)').hide();

    $('tr.header').click(function() {
      $(this).find('span').text(function(_, value) {
        return value == '^' ? 'v' : '^'
      });

      $(this).nextUntil('tr.header').slideToggle(100, function() {});
    });
  });

table,
tr,
td,
th {
  border: 1px solid black;
  border-collapse: collapse;
}

tr.header {
  cursor: pointer;
}

              NUM
              ITEM

              INFO
              INCLUDE

            010
            Shoes
            v
            <input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">

            DRAG
            <input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
            NAME
            ITEM
            PREFERED
            EDIT

I am using bootstrap-5

Any helps is greatly appreciated


问:
How to make an Microsoft Access data entry form with multiple linked tables
Complicated question based on a personal project, but if there was any thoughts or tips would be much appreciated. I am still relatively new to Microsoft Access and SQL.

I am having troubles with a Personal Project that I am working on.

I am trying to develop a QC Testing Database for my work.

There are a number of different products we produce, and they each have a set of tests that have to be performed on a production Lot. The tests vary depending on the product.

The database would have a form for the Test Report, that would allow a user to go in and select the product they are testing. Ideally that would have a sub form that shows all the tests they have to perform, and then a box next to each to enter the results of each test. The operator could then and make a QC Test report that can be saved as a pdf.

My biggest issue is creating a form to enter in new data. I want the specific tests to show up based on the product they choose, and then be able to enter results tied to those tests.

I am able to enter in data into the tables manually, and make a form to view the data properly for each report.

As for tables I have:

Product table - unique table of all the products

Specification Tests table- unique table of all individual tests that have to be performed, as well as specification range for the results

Spec table - table that joins the product ID to all the specification tests that have to be performed

Report Table - table that creates a record for each report. This has

Result table - houses each unique test result.  Relates to specification test ID as well as the Report ID.

As for queries, I have:

Query that shows the specification tests required based on the product ID chosen.

As I said, I can enter in data to the tables manually, and have a form that allows me to go through each Test Report record and see the data properly.

Data entry is harder because the number of tests and the specific tests vary based on product.

I have a query that looks at the product Id selected by user, and lists the specification tests required. I tried to make a query using that query, and adding in a results field.
When I go to my main reports form, this sub form is completely empty.[enter image description here](https://i.stack.imgur.com/SzB9K.jpg)


问:
CD to compute engine from cloud-build is not working
I'm trying to setup a CD from cloud build with below cloud build yaml file,

```<code>steps:
  - name: gcr.io/cloud-builders/gcloud
    args: [ 'compute', 'ssh', '<my-ce-name>', '--zone', 'us-west2-a', '--command', 'docker rm -f container-name && docker pull gcr.io/$PROJECT_ID/my-image-name:latest && docker run  -d -p 80:8080 --name container-name gcr.io/$PROJECT_ID/my-image-name:latest' ]
</code>```

The build runs but fails with the below error,

```<code>Permission denied (publickey).
</code>```

I assume there is some problem in the way the ssh is being handled. What's the way out?

Body:
I'm trying to setup a CD from cloud build with below cloud build yaml file,

steps:
  - name: gcr.io/cloud-builders/gcloud
    args: [ 'compute', 'ssh', '<my-ce-name>', '--zone', 'us-west2-a', '--command', 'docker rm -f container-name && docker pull gcr.io/$PROJECT_ID/my-image-name:latest && docker run  -d -p 80:8080 --name container-name gcr.io/$PROJECT_ID/my-image-name:latest' ]

The build runs but fails with the below error,

Permission denied (publickey).

I assume there is some problem in the way the ssh is being handled. What's the way out?


问:
Why are timed out queries not being flagged as incomplete?
While using the GitHub Search API, some queries are incomplete. For instance, this one -

```<code>import requests

url = "https://api.github.com/search/code?q=torch +in:file + language:python&page=1&per_page=100"

headers = {
'Authorization': 'Token XXXXXXXXXXXXXXXXX'
}

response = requests.request("GET", url, headers=headers).json()
try:
    print(len(response['items']))
    print("response = ", response)
except:
    print("response = ", response)
</code>```

*Note - The above code won't work as I have removed my token. Please replace the "xxx" with your GitHub token if you'd like to run the code.

This rarely returns 100 results. From previous SO posts, I understand this is due to the query timing out. However, in that case as per GitHub documentation, the returned result should indicate that the results are incomplete -

```<code>response =  {'total_count': 6872903, 'incomplete_results': False, 'items' ...
</code>```

Why is incomplete_results not set to True over here?

Body:
While using the GitHub Search API, some queries are incomplete. For instance, this one -

import requests

url = "https://api.github.com/search/code?q=torch +in:file + language:python&page=1&per_page=100"

headers = {
'Authorization': 'Token XXXXXXXXXXXXXXXXX'
}

response = requests.request("GET", url, headers=headers).json()
try:
    print(len(response['items']))
    print("response = ", response)
except:
    print("response = ", response)

*Note - The above code won't work as I have removed my token. Please replace the "xxx" with your GitHub token if you'd like to run the code.

This rarely returns 100 results. From previous SO posts, I understand this is due to the query timing out. However, in that case as per GitHub documentation, the returned result should indicate that the results are incomplete -

response =  {'total_count': 6872903, 'incomplete_results': False, 'items' ...

Why is incomplete_results not set to True over here?


问:
How to render the count of like button every time it changes?
enter image description hereI have created a like button and on clicking I am sending the event to backend to update the post and send the updated post back but I am not able to render the updated post.

After loading the post it is transferred as parameter to this page

```<code>import React, { Fragment, useEffect, useState } from 'react';
import "./PostCard.css";
import Person4Icon from '@mui/icons-material/Person4';
import FavoriteIconfrom '@mui/icons-material/Favorite';
import HeartBrokenIcon from '@mui/icons-material/HeartBroken';
import ForumOutlinedIcon from '@mui/icons-material/ForumOutlined';
import { Link } from 'react-router-dom';
import { likeDislike } from '../../actions/postAction';
import { useSelector, useDispatch } from "react-redux";

const PostCard = ({post}) => {
    // console.log(post);
    const dispatch = useDispatch();
    const { like } = useSelector((state) => state.likePost);

    const { isAuthenticated, user } = useSelector((state) => state.user);
    const [likeCount, setLikeCount] = useState(Object.keys(post.hearts).length);
    var isLiked=false;
    if(isAuthenticated){
        isLiked = Boolean(post.hearts[user._id]);
    }

    const likes = () => {
        dispatch(likeDislike(post._id));
        setLikeCount(Object.keys(post.hearts).length);
        console.log(like.hearts);
        console.log(Object.keys(like.hearts).length);
    }

    const dislikes = () => {
        dispatch(likeDislike(post._id))
    }

  return (
    <Fragment>

        <div className='card'>
            <div className='profile_icon'><Person4Icon
            style={{color: post.avatarColor}}
            /></div>
            <div className='post'>
            <Link className='card_head' to={`/comment/${post._id}`}>
                <h4
                style={{color:"orange"}}
                >{post.userName}</h4>
                <p>{post.post}</p>
            </Link>
                <div className='post_footer'>
                <Link className='card_head' to={`/comment/${post._id}`}>
                    <div className='post_footer_button'>
                        <ForumOutlinedIcon/>
                        <span className='number'>{post.comments.length}</span>
                    </div>
                </Link>
                    <div className='post_footer_button'>
                        <HeartBrokenIcon onClick={dislikes}/>
                        <span className='number'>{post.condolences.length}</span>
                    </div>
                    <div className='post_footer_button'>
                        <FavoriteIcon onClick={likes}/>
                        <span className='number'>{likeCount}</span>
                    </div>
                </div>
            </div>
        </div>
        <div className='break'>

        </div>

    </Fragment>
  )
}

export default PostCard
</code>```

Action part of the dispatch of like event

```<code>//Likes Dislikes
export const likeDislike = (id) => async (dispatch) => {
    try {
        dispatch({ type: LIKE_POST_REQUEST });

        const config = { headers: { "Content-Type": "application/json" } };

        const { data } = await axios.put(`/social/like`, {id}, config);

        console.log(data);

        dispatch({
          type: LIKE_POST_SUCCESS,
          payload: data.updatedPost,
        });
      } catch (error) {
        dispatch({
          type: LIKE_POST_FAIL,
          payload: error.response.data.message,
        });
      }
}
</code>```

Reducer for updated like post

```<code>export const likePostReducer = (state = {like: {}}, action) => {
  switch (action.type) {
    case LIKE_POST_REQUEST:
      return {
        ...state,
        loading: true,
      };
    case LIKE_POST_SUCCESS:
      return {
        loading: false,
        like: action.payload,
      };
    case LIKE_POST_FAIL:
      return {
        loading: false,
        error: action.payload,
      };
    case CLEAR_ERRORS:
      return {
        ...state,
        error: null,
      };
    default:
      return state;
  }
};
</code>```

Server side updating post

```<code>exports.likePost = catchAsyncErrors(async(req,res,next) => {

    // console.log(req.body);
    const {id} = req.body;
    const post = await Post.findById(id);
    const user = await User.findById(req.user._id);
    const isLiked = post.hearts.get(user._id);

    if (isLiked) {
        post.hearts.delete(user._id);
    } else {
        post.hearts.set(user._id, true);
    }
    const updatedPost = await Post.findByIdAndUpdate(
        id,
        { hearts: post.hearts },
        { new: true }
    );

    res.status(200).json({
        success:true,
        updatedPost,
    });

});
</code>```

Parent Component of Post Card

```<code>import React, { Fragment, useEffect } from 'react';
import "./Home.css";
import PostCard from '../Layout/PostCard';
import CreatePost from '../Layout/CreatePost';
import { getPosts, clearErrors } from '../../actions/postAction';
import { useSelector, useDispatch } from "react-redux";
import {toast} from "react-toastify";
import Loader from "../Loader/Loader";
import { CREATE_POST_RESET } from '../../constants/postConstants';
import AddIcon from '@mui/icons-material/Add';
import { useNavigate } from "react-router-dom";

const Home = () => {

 const dispatch = useDispatch();
 const navigate = useNavigate();
 const { loading, error, posts } = useSelector((state) => state.posts);
 const { success } = useSelector((state) => state.createPost);
 const { isAuthenticated } = useSelector((state) => state.user);
 // console.log(user);

 const open = () => {
   if(isAuthenticated===false){
     toast.error("Login first");
   }

   if(isAuthenticated){
     navigate("/createPost");
   }
 }

 useEffect(() => {
   if(error){
     toast.error(error);
     dispatch(clearErrors());
   }
   if (success) {
     toast.success("Posted");
     dispatch({ type: CREATE_POST_RESET });
   }
   dispatch(getPosts());
 },[dispatch, success, error]);

 return (
   <Fragment>
       {loading ? (
         <Loader/>
       ) : (
         <Fragment>
           <div className='home'>
             <div className='home_left'>
                 <div className='home_heading'>
                   <h4>Try something here</h4>
                 </div>
                 <div>
                   {posts &&
                     posts.map((post) => {
                       return(
                         <PostCard key={post._id} post={post} />
                       );
                     })}
                 </div>
             </div>
             <div className='home_right'>
                 <CreatePost/>
             </div>
           </div>

           {/* FLOATING BUTTON */}
           <div className='floating_button'>
               <button onClick={open}>
                   <AddIcon/>
               </button>
           </div>
         </Fragment>
       )}
   </Fragment>
 )
}

export default Home;
</code>```

Body:
enter image description hereI have created a like button and on clicking I am sending the event to backend to update the post and send the updated post back but I am not able to render the updated post.

After loading the post it is transferred as parameter to this page

import React, { Fragment, useEffect, useState } from 'react';
import "./PostCard.css";
import Person4Icon from '@mui/icons-material/Person4';
import FavoriteIconfrom '@mui/icons-material/Favorite';
import HeartBrokenIcon from '@mui/icons-material/HeartBroken';
import ForumOutlinedIcon from '@mui/icons-material/ForumOutlined';
import { Link } from 'react-router-dom';
import { likeDislike } from '../../actions/postAction';
import { useSelector, useDispatch } from "react-redux";

const PostCard = ({post}) => {
    // console.log(post);
    const dispatch = useDispatch();
    const { like } = useSelector((state) => state.likePost);

    const { isAuthenticated, user } = useSelector((state) => state.user);
    const [likeCount, setLikeCount] = useState(Object.keys(post.hearts).length);
    var isLiked=false;
    if(isAuthenticated){
        isLiked = Boolean(post.hearts[user._id]);
    }

    const likes = () => {
        dispatch(likeDislike(post._id));
        setLikeCount(Object.keys(post.hearts).length);
        console.log(like.hearts);
        console.log(Object.keys(like.hearts).length);
    }

    const dislikes = () => {
        dispatch(likeDislike(post._id))
    }

  return (
    <Fragment>

<Person4Icon
            style={{color: post.avatarColor}}
            />

            <Link className='card_head' to={`/comment/${post._id}`}>

{post.userName}

{post.post}

            </Link>

                <Link className='card_head' to={`/comment/${post._id}`}>

                        <ForumOutlinedIcon/>
                        {post.comments.length}

                </Link>

                        <HeartBrokenIcon onClick={dislikes}/>
                        {post.condolences.length}

                        <FavoriteIcon onClick={likes}/>
                        {likeCount}

    </Fragment>
  )
}

export default PostCard

Action part of the dispatch of like event

//Likes Dislikes
export const likeDislike = (id) => async (dispatch) => {
    try {
        dispatch({ type: LIKE_POST_REQUEST });

        const config = { headers: { "Content-Type": "application/json" } };

        const { data } = await axios.put(`/social/like`, {id}, config);

        console.log(data);

        dispatch({
          type: LIKE_POST_SUCCESS,
          payload: data.updatedPost,
        });
      } catch (error) {
        dispatch({
          type: LIKE_POST_FAIL,
          payload: error.response.data.message,
        });
      }
}

Reducer for updated like post

export const likePostReducer = (state = {like: {}}, action) => {
  switch (action.type) {
    case LIKE_POST_REQUEST:
      return {
        ...state,
        loading: true,
      };
    case LIKE_POST_SUCCESS:
      return {
        loading: false,
        like: action.payload,
      };
    case LIKE_POST_FAIL:
      return {
        loading: false,
        error: action.payload,
      };
    case CLEAR_ERRORS:
      return {
        ...state,
        error: null,
      };
    default:
      return state;
  }
};

Server side updating post

exports.likePost = catchAsyncErrors(async(req,res,next) => {

    // console.log(req.body);
    const {id} = req.body;
    const post = await Post.findById(id);
    const user = await User.findById(req.user._id);
    const isLiked = post.hearts.get(user._id);

    if (isLiked) {
        post.hearts.delete(user._id);
    } else {
        post.hearts.set(user._id, true);
    }
    const updatedPost = await Post.findByIdAndUpdate(
        id,
        { hearts: post.hearts },
        { new: true }
    );

    res.status(200).json({
        success:true,
        updatedPost,
    });

});

Parent Component of Post Card

import React, { Fragment, useEffect } from 'react';
import "./Home.css";
import PostCard from '../Layout/PostCard';
import CreatePost from '../Layout/CreatePost';
import { getPosts, clearErrors } from '../../actions/postAction';
import { useSelector, useDispatch } from "react-redux";
import {toast} from "react-toastify";
import Loader from "../Loader/Loader";
import { CREATE_POST_RESET } from '../../constants/postConstants';
import AddIcon from '@mui/icons-material/Add';
import { useNavigate } from "react-router-dom";

const Home = () => {

 const dispatch = useDispatch();
 const navigate = useNavigate();
 const { loading, error, posts } = useSelector((state) => state.posts);
 const { success } = useSelector((state) => state.createPost);
 const { isAuthenticated } = useSelector((state) => state.user);
 // console.log(user);

 const open = () => {
   if(isAuthenticated===false){
     toast.error("Login first");
   }

   if(isAuthenticated){
     navigate("/createPost");
   }
 }

 useEffect(() => {
   if(error){
     toast.error(error);
     dispatch(clearErrors());
   }
   if (success) {
     toast.success("Posted");
     dispatch({ type: CREATE_POST_RESET });
   }
   dispatch(getPosts());
 },[dispatch, success, error]);

 return (
   <Fragment>
       {loading ? (
         <Loader/>
       ) : (
         <Fragment>

Try something here

                   {posts &&
                     posts.map((post) => {
                       return(
                         <PostCard key={post._id} post={post} />
                       );
                     })}

                 <CreatePost/>

           {/* FLOATING BUTTON */}

               <button onClick={open}>
                   <AddIcon/>
               </button>

         </Fragment>
       )}
   </Fragment>
 )
}

export default Home;


问:
Export global styles and assets using angular module federation
I implemented Webpack 5 module federation in my angular app and was able to import it into another app by exporting the remote module
webpack.config.ts
However, I'd also like to export the global style sheet so the host app gets all the global CSS. would anyone have any experience with this?

I tried implementing it with an answer that I saw, https://stackoverflow.com/a/70552914/15125666 without success