问:
Suggestions - Aggregation query for nested embedded documents
I have this story collection with embedded docs cashierBoxes and cashierBoxes has embedded docs inOutMovements.

I have been trying to make a query to get the inOutMovements sorted by date (descending) with pagination using ($sort, $skip and $limit) but I’m getting the error “Sort exceeded memory limit of 33554432 bytes”, I already added allowDiskUse(true) and an index to my store schema.

I expect to have all the inOutMovements ordered by date, to work in a pagination component but I'm not sure if I'm forced to unwind the inOutMovements array before sorting it since I'm getting the error because of the sort.

Am I doing something in the wrong order during aggregate?

```<code>await StoreModel.aggregate([
        {
          $match: {
            _id: Types.ObjectId(storeId)
          }
        },
        {
          $unwind: {
            path: '$cashierBoxes',
          }
        },
        {
          $match: {
            "cashierBoxes._id": Types.ObjectId(id)
          }
        },
        {
          $unwind: {
            path: '$cashierBoxes.inOutMovements'
          }
        },
        { $sort: { "cashierBoxes.inOutMovements.date": -1 } },
        { $skip: +pageNum * +limit },
        { $limit: +limit },
        {
          $lookup: {
            from: "user",
            localField: "cashierBoxes.inOutMovements.createdBy",
            foreignField: "_id",
            as: "cashierBoxes.inOutMovements.createdBy",
            pipeline: [
              {
                $project: {
                  _id: 1,
                  name: 1
                }
              }
            ]
          },
        },
        {
          $unwind: {
            path: "$cashierBoxes.inOutMovements.createdBy",
            preserveNullAndEmptyArrays: true,
          },
        },
        {
          $group:
          {
            _id: {
              _id: "$cashierBoxes._id",
              name: "$cashierBoxes.name",
            },
            inOutMovements: {
              $push: {
                $cond: [
                  { $gte: ["$cashierBoxes.inOutMovements.amount", 0] },
                  '$cashierBoxes.inOutMovements',
                  "$$REMOVE"
                ]
              }
            },
          }
        },
      ]).allowDiskUse(true);
</code>```
```<code>const StoreSchema = new Schema({
  cashierBoxes: {
    type: [CashierBoxSchema],
    required: true,
    default: []
  },
})
StoreSchema.index({
  "_id": 1,
  "cashierBoxes._id": 1,
  "cashierBoxes.inOutMovements.date": - 1
})
</code>```
```<code>const CashierBoxSchema = new Schema({
  createdBy: {
    ref: 'user',
    type: Schema.Types.ObjectId,
  },
  inOutMovements: {
    type: [CashierBoxActivity],
    required: false,
    default: []
  },
})
</code>```
```<code>const CashierBoxActivity = new Schema({
  date: {
    type: Date,
    required: true
  },
  createdBy: {
    ref: 'user',
    type: Schema.Types.ObjectId,
    required: false
  }
});
</code>```

Body:
I have this story collection with embedded docs cashierBoxes and cashierBoxes has embedded docs inOutMovements.

I have been trying to make a query to get the inOutMovements sorted by date (descending) with pagination using ($sort, $skip and $limit) but I’m getting the error “Sort exceeded memory limit of 33554432 bytes”, I already added allowDiskUse(true) and an index to my store schema.

I expect to have all the inOutMovements ordered by date, to work in a pagination component but I'm not sure if I'm forced to unwind the inOutMovements array before sorting it since I'm getting the error because of the sort.

Am I doing something in the wrong order during aggregate?

await StoreModel.aggregate([
        {
          $match: {
            _id: Types.ObjectId(storeId)
          }
        },
        {
          $unwind: {
            path: '$cashierBoxes',
          }
        },
        {
          $match: {
            "cashierBoxes._id": Types.ObjectId(id)
          }
        },
        {
          $unwind: {
            path: '$cashierBoxes.inOutMovements'
          }
        },
        { $sort: { "cashierBoxes.inOutMovements.date": -1 } },
        { $skip: +pageNum * +limit },
        { $limit: +limit },
        {
          $lookup: {
            from: "user",
            localField: "cashierBoxes.inOutMovements.createdBy",
            foreignField: "_id",
            as: "cashierBoxes.inOutMovements.createdBy",
            pipeline: [
              {
                $project: {
                  _id: 1,
                  name: 1
                }
              }
            ]
          },
        },
        {
          $unwind: {
            path: "$cashierBoxes.inOutMovements.createdBy",
            preserveNullAndEmptyArrays: true,
          },
        },
        {
          $group:
          {
            _id: {
              _id: "$cashierBoxes._id",
              name: "$cashierBoxes.name",
            },
            inOutMovements: {
              $push: {
                $cond: [
                  { $gte: ["$cashierBoxes.inOutMovements.amount", 0] },
                  '$cashierBoxes.inOutMovements',
                  "$$REMOVE"
                ]
              }
            },
          }
        },
      ]).allowDiskUse(true);

const StoreSchema = new Schema({
  cashierBoxes: {
    type: [CashierBoxSchema],
    required: true,
    default: []
  },
})
StoreSchema.index({
  "_id": 1,
  "cashierBoxes._id": 1,
  "cashierBoxes.inOutMovements.date": - 1
})

const CashierBoxSchema = new Schema({
  createdBy: {
    ref: 'user',
    type: Schema.Types.ObjectId,
  },
  inOutMovements: {
    type: [CashierBoxActivity],
    required: false,
    default: []
  },
})

const CashierBoxActivity = new Schema({
  date: {
    type: Date,
    required: true
  },
  createdBy: {
    ref: 'user',
    type: Schema.Types.ObjectId,
    required: false
  }
});


来源: stackexchange

问:
Ensemble LDA: How to find more than 1 stable topic?
I used LDA (Latent Dirichlet Allocation) algorithm to analyse corpus from StackExchange database. LDA is not ideal because it has problem with reproducibility because it gives different topics suggestion with every execution, which make it unreliable from my point of view. After reading an introduction for Ensemble LDA (eLDA) from Gensim, eLDA addresses this problem by executing LDA models multiple times and only outputs stable topics, which are topics that are occur multiple times from multiple LDAs (to explain it in a very simplified way).

How I executed eLDAs are:

Filter (so that only questions with topic "security" are left) and preprocess the data from StackExchange. I use last 10 years data of Q&A from StackOverflow.

Do trial and error of normal LDA to get ideal hyper parameter (passes and iteration) so that most if not all documents have converged. I refer this step to this documentation.

With the optimal LDA parameters, I ran eLDA:

```<code> corpus = self.doc_matrix
 dictionary = vectorizer.id2word.id2token
 topic_model_class = LdaModel
 ensemble_workers = 4
 num_models = 12
 distance_workers = 4
 num_topics = 50
 passes=20
 iterations=5000
 epsilon = 1
 eval_every=10

 self.estimator = EnsembleLda(
     corpus=corpus,
     id2word=dictionary,
     num_topics=num_topics,
     passes=passes,
     iterations=iterations,
     num_models=num_models,
     topic_model_class=topic_model_class,
     ensemble_workers=ensemble_workers,
     distance_workers=distance_workers,
     epsilon=epsilon,
     eval_every=eval_every
 )
</code>```

The result is always only one stable topic. This is just too few stable topic for my purpose. After couple days, I doesn't manage to increase stable topic findings/ improve my eLDA.

My goal: find trend or topics in StackOverflow questions that are related to topic "security".

My opinion: the finding should be more than just one stable topic, because in StackOverflow there are tags available for every questions. Tag by itself is a topic. Therefore it should find more than one stable topic.

Questions:

a. Can somebody point me a direction how to optimise my eLDA model so that it can find more than one stable topic?

b. Is my logic wrong to assume that there should be more than one stable topic? I could accept it if the data are very diverse. But since every StackOverflow question consists tags, I assume the finding should have > 1 stable topic.

Thank you for any advice.

#################################################################

Why did I choose epsilon=1?
I execute the following:

```<code>def optimize_ensembleLda(self):
    print('*** Optimize ensemble LDA model.')
    import numpy as np
    shape = self.estimator.asymmetric_distance_matrix.shape
    without_diagonal = self.estimator.asymmetric_distance_matrix[~np.eye(shape[0], dtype=bool)].reshape(shape[0], -1)
    print("Min, mean & max value of asymetric distance matrix:")
    print(without_diagonal.min(), without_diagonal.mean(), without_diagonal.max())
    new_epsilon = without_diagonal.max()
    self.estimator.recluster(eps=new_epsilon, min_samples=2, min_cores=2)
    return
</code>```

I chose to use the maximum distance, because I am trying to get more stable topics.

#################################################################

After executing Erwan's suggestion from commentary (increasing num_models to e.g. 40), I got the following error:

```<code>RecursionError: maximum recursion depth exceeded in comparison
</code>```

The error points to the eLDA model from under step 2 above.
I doubled the ensemble_worker but the problem is not fixed. I will keep increasing it and give update here.

#################################################################

I solved the RecursionError by increasing the Python recursion limit with:

```<code>sys.setrecursionlimit(int(len(self.ttda)*1.2))
</code>```

inside my Gensim eLDA code...
The reason for this problem is my large corpus size and hence the large topic numbers.
Still my original problem still exists, after increasing num_models to 40, I still get one stable topic.

I would appreciate very much, if someone can help me finding more than one stable topic with Ensemble LDA from Gensim.

ContentLicense: CC BY-SA 4.0

Body:
I used LDA (Latent Dirichlet Allocation) algorithm to analyse corpus from StackExchange database. LDA is not ideal because it has problem with reproducibility because it gives different topics suggestion with every execution, which make it unreliable from my point of view. After reading an introduction for Ensemble LDA (eLDA) from Gensim, eLDA addresses this problem by executing LDA models multiple times and only outputs stable topics, which are topics that are occur multiple times from multiple LDAs (to explain it in a very simplified way).

How I executed eLDAs are:

Filter (so that only questions with topic "security" are left) and preprocess the data from StackExchange. I use last 10 years data of Q&A from StackOverflow.

Do trial and error of normal LDA to get ideal hyper parameter (passes and iteration) so that most if not all documents have converged. I refer this step to this documentation.

With the optimal LDA parameters, I ran eLDA:

 corpus = self.doc_matrix
 dictionary = vectorizer.id2word.id2token
 topic_model_class = LdaModel
 ensemble_workers = 4
 num_models = 12
 distance_workers = 4
 num_topics = 50
 passes=20
 iterations=5000
 epsilon = 1
 eval_every=10

 self.estimator = EnsembleLda(
     corpus=corpus,
     id2word=dictionary,
     num_topics=num_topics,
     passes=passes,
     iterations=iterations,
     num_models=num_models,
     topic_model_class=topic_model_class,
     ensemble_workers=ensemble_workers,
     distance_workers=distance_workers,
     epsilon=epsilon,
     eval_every=eval_every
 )

The result is always only one stable topic. This is just too few stable topic for my purpose. After couple days, I doesn't manage to increase stable topic findings/ improve my eLDA.

My goal: find trend or topics in StackOverflow questions that are related to topic "security".

My opinion: the finding should be more than just one stable topic, because in StackOverflow there are tags available for every questions. Tag by itself is a topic. Therefore it should find more than one stable topic.

Questions:

a. Can somebody point me a direction how to optimise my eLDA model so that it can find more than one stable topic?

b. Is my logic wrong to assume that there should be more than one stable topic? I could accept it if the data are very diverse. But since every StackOverflow question consists tags, I assume the finding should have > 1 stable topic.

Thank you for any advice.

#################################################################

Why did I choose epsilon=1?
I execute the following:

def optimize_ensembleLda(self):
    print('*** Optimize ensemble LDA model.')
    import numpy as np
    shape = self.estimator.asymmetric_distance_matrix.shape
    without_diagonal = self.estimator.asymmetric_distance_matrix[~np.eye(shape[0], dtype=bool)].reshape(shape[0], -1)
    print("Min, mean & max value of asymetric distance matrix:")
    print(without_diagonal.min(), without_diagonal.mean(), without_diagonal.max())
    new_epsilon = without_diagonal.max()
    self.estimator.recluster(eps=new_epsilon, min_samples=2, min_cores=2)
    return

I chose to use the maximum distance, because I am trying to get more stable topics.

#################################################################

After executing Erwan's suggestion from commentary (increasing num_models to e.g. 40), I got the following error:

RecursionError: maximum recursion depth exceeded in comparison

The error points to the eLDA model from under step 2 above.
I doubled the ensemble_worker but the problem is not fixed. I will keep increasing it and give update here.

#################################################################

I solved the RecursionError by increasing the Python recursion limit with:

sys.setrecursionlimit(int(len(self.ttda)*1.2))

inside my Gensim eLDA code...
The reason for this problem is my large corpus size and hence the large topic numbers.
Still my original problem still exists, after increasing num_models to 40, I still get one stable topic.

I would appreciate very much, if someone can help me finding more than one stable topic with Ensemble LDA from Gensim.


问:
plt.hist with density = True does not work
From what I understand hist() is supposed to normalise the bars, unfortunately with the following code I do not get correct bar heights

```<code>data = np.loadtxt("../data/data_queue_R" + str(64) + "_" + str(1) + ".txt")
print(data)
hist = plt.hist(data, bins=40,density=True)
</code>```

I get the following

Body:
From what I understand hist() is supposed to normalise the bars, unfortunately with the following code I do not get correct bar heights

data = np.loadtxt("../data/data_queue_R" + str(64) + "_" + str(1) + ".txt")
print(data)
hist = plt.hist(data, bins=40,density=True)

I get the following


问:
openhtmltopdf dont add fonts
I trying to add fonts to my pdf but without success, I using this  code to generate

```<code> public static void main(String[] args) throws Exception {
        try (OutputStream os = new FileOutputStream("/Users/fabio/Downloads/pdf/out2.pdf")) {
            PdfRendererBuilder builder = new PdfRendererBuilder();
            builder.useFastMode();
            Path fontDirectory = Paths.get("/Users/fabio/Downloads/Roboto/");

            // PERF: Should only be called once, as each font must be parsed for font family name.
            List<AutoFont.CSSFont> fonts = AutoFont.findFontsInDirectory(fontDirectory);

            // Use this in your template for the font-family property.
            String fontFamily = AutoFont.toCSSEscapedFontFamily(fonts);
            for (AutoFont.CSSFont font : fonts) {
                System.out.println(font.family);
            }
            // Add fonts to builder.
            AutoFont.toBuilder(builder, fonts);

            builder.withUri("file:/Users/fabio/Downloads/pdf/teste2.html");
            builder.toStream(os);
            builder.run();
        }
        Desktop desktop = Desktop.getDesktop();//checks file exists or not
            desktop.open(new File("/Users/fabio/Downloads/pdf/out2.pdf"));              //opens the specified file
    }
</code>```

with this code to AutoFont AutoFont class

and this is my pdf without all fonts and the image thats show all fonts added

Title: openhtmltopdf dont add fonts

Body:
I trying to add fonts to my pdf but without success, I using this  code to generate

 public static void main(String[] args) throws Exception {
        try (OutputStream os = new FileOutputStream("/Users/fabio/Downloads/pdf/out2.pdf")) {
            PdfRendererBuilder builder = new PdfRendererBuilder();
            builder.useFastMode();
            Path fontDirectory = Paths.get("/Users/fabio/Downloads/Roboto/");

            // PERF: Should only be called once, as each font must be parsed for font family name.
            List<AutoFont.CSSFont> fonts = AutoFont.findFontsInDirectory(fontDirectory);

            // Use this in your template for the font-family property.
            String fontFamily = AutoFont.toCSSEscapedFontFamily(fonts);
            for (AutoFont.CSSFont font : fonts) {
                System.out.println(font.family);
            }
            // Add fonts to builder.
            AutoFont.toBuilder(builder, fonts);

            builder.withUri("file:/Users/fabio/Downloads/pdf/teste2.html");
            builder.toStream(os);
            builder.run();
        }
        Desktop desktop = Desktop.getDesktop();//checks file exists or not
            desktop.open(new File("/Users/fabio/Downloads/pdf/out2.pdf"));              //opens the specified file
    }

with this code to AutoFont AutoFont class

and this is my pdf without all fonts and the image thats show all fonts added


问:
get full path to PowerShell file parameter
I'm creating a PowerShell script. It takes a single path as a parameter. I want to manipulate that path and use it in another command, so I need the full path.

I do not want to change the current directory. I just want the full path of the given file.

I have worked with wonderful Java libraries such as Picocli, and I had assumed that merely setting the argument type to System.IO.FileInfo would make PowerShell figure out how where the path is (i.e. relative to the command or absolute). But apparently it isn't that smart, and System.IO.FileInfo casts the string to a file info and assumes that the parent directory for relative paths is the home directory. For example:

```<code>[CmdletBinding()]
Param([Parameter(Mandatory, HelpMessage="Archive Path")] [System.IO.FileInfo]$path)
…
Write-Output $path.FullName
</code>```

I put this script in C:\bin\extract-zip.ps1 and make sure C:\bin\ is on the PATH. Then I go to the C:\temp\ directory and run this command:

```<code>extract-foo foo.zip
</code>```

It prints:

C:\Users\user\foo.zip

This makes absolutely zero sense to me. I expected C:\temp\foo.zip.

So I guess I'll have to manually convert $path to an absolute path. If I know ahead of time that the user provided a relative path, I can do something like this (but I guess I would have to use type String instead of System.IO.FileInfo):

```<code>$path = Join-Path ([System.IO.Directory]::GetCurrentDirectory()) $path
</code>```

But what if the user provided an absolute path? Isn't there some resolve() method that Do The Right Thing if the second argument is absolute? Or is there a method for detecting whether a path is absolute?

Here is the question: I want to convert a given path argument to an absolute path, whether the given path is absolute or relative, without changing the current directory.

I can find no Stack Overflow question that provides a direct answer. For System.IO.FileInfo and Relative Paths someone said to try [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($pwd, '.\test.txt')), but nobody said if this works, and whether it works with both relative and absolute paths.

Body:
I'm creating a PowerShell script. It takes a single path as a parameter. I want to manipulate that path and use it in another command, so I need the full path.

I do not want to change the current directory. I just want the full path of the given file.

I have worked with wonderful Java libraries such as Picocli, and I had assumed that merely setting the argument type to System.IO.FileInfo would make PowerShell figure out how where the path is (i.e. relative to the command or absolute). But apparently it isn't that smart, and System.IO.FileInfo casts the string to a file info and assumes that the parent directory for relative paths is the home directory. For example:

[CmdletBinding()]
Param([Parameter(Mandatory, HelpMessage="Archive Path")] [System.IO.FileInfo]$path)
…
Write-Output $path.FullName

I put this script in C:\bin\extract-zip.ps1 and make sure C:\bin\ is on the PATH. Then I go to the C:\temp\ directory and run this command:

extract-foo foo.zip

It prints:

C:\Users\user\foo.zip

This makes absolutely zero sense to me. I expected C:\temp\foo.zip.

So I guess I'll have to manually convert $path to an absolute path. If I know ahead of time that the user provided a relative path, I can do something like this (but I guess I would have to use type String instead of System.IO.FileInfo):

$path = Join-Path ([System.IO.Directory]::GetCurrentDirectory()) $path

But what if the user provided an absolute path? Isn't there some resolve() method that Do The Right Thing if the second argument is absolute? Or is there a method for detecting whether a path is absolute?

Here is the question: I want to convert a given path argument to an absolute path, whether the given path is absolute or relative, without changing the current directory.

I can find no Stack Overflow question that provides a direct answer. For System.IO.FileInfo and Relative Paths someone said to try [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($pwd, '.\test.txt')), but nobody said if this works, and whether it works with both relative and absolute paths.


问:
Nuxt 3 trouble after build project
Can you help me to solve problem with my project?

The Problem.
After build project does not work html5 video on MacOS < 15 version and iOS < 15 version. Path is ok, there is no 404 error, but video don’t work.
In development mode video is work.
Are you know something about this problem?
Can you see this repo ?

Video is located in components/main-page/ Screen.vue - line 94

I tried launch Nuxt2 project. Video is work well.
I tried load video from strapi. Its doesn't work in production.((

Thanks everyone!

Title: Nuxt 3 trouble after build project


问:
Getting empty sets from REST api, how do i get the bank parameters
i want to get the list of banks in Nigeria as well as their codes. it just returns more of an empty set. How do i make it get the respective data from Json like the bank name as well as the code and use it in my code?

My code looks like this

```<code>  getLocalBanks = async () => {

    var url = 'https://api.flutterwave.com/v3/banks/NG';

    fetch(url + email, {
      method: 'GET',
      headers: {
        'Content-type': 'application/json',
        'Authorization': 'Bearer FLWSECK_TEST-72fe360edef17334f4817a17407011bb-X',
      },
    })
      .then(response => response.json())
      .then(responseJson => {
        setGetBanks(responseJson);
        setLoading(false);
      });
  };
</code>```

and calling it , I do it like this

```<code>  useEffect(()=>{
    getLocalBanks();
    console.log({getBanks})
  });
</code>```

but i am getting a very empty set when i interract with the REST api

Full source code is like this

```<code>import {
  ImageBackground,
  Modal,
  ScrollView,
  StyleSheet,
  Text,
  TextInput,
  TouchableOpacity,
  View,
} from 'react-native';
import {Picker} from '@react-native-picker/picker';
import React, {useEffect, useState} from 'react';
import {useNavigation} from '@react-navigation/native';
import BackgroundOpacity from './BackgroundOpacity';

const LocalPayments = () => {
  const navigation = useNavigation();
  const[getBanks, setGetBanks] = useState([])
  const [modalVisible, setModalVisible] = useState(false);

  getLocalBanks = async () => {

    var url = 'https://api.flutterwave.com/v3/banks/NG';

    fetch(url + email, {
      method: 'GET',
      headers: {
        'Content-type': 'application/json',
        'Authorization': 'Bearer FLWSECK_TEST-72fe360edef17334f4817a17407011bb-X',
      },
    })
      .then(response => response.json())
      .then(responseJson => {
        setGetBanks(responseJson);
        setLoading(false);
      });
  };

  useEffect(()=>{
    getLocalBanks();
    console.log({getBanks})
  });

  showBanks = () =>{
    alert({})
  }

  return (
    <View style={styles.container}>
      <BackgroundOpacity
        display={Platform.OS === 'ios' ? false : modalVisible}
      />
      <View style={styles.space} />
      <ScrollView
        contentContainerStyle={{
          justifyContent: 'space-between',
          alignItems: 'center',
        }}>
        <ImageBackground
          source={{
            uri: 'asset:/logo/bg.JPG',
          }}
          imageStyle={{borderRadius: 6}}
          style={{
            top: -30,
            paddingTop: 95,
            alignSelf: 'center',
            width: 328,
            height: 115,
            borderadius: 9,
            justifyContent: 'center',
            alignSelf: 'center',
            alignItems: 'center',
          }}>
          <View>
            <Text style={styles.accText}>Wallet Balance</Text>
            <Text style={styles.text}> 250,000 </Text>
          </View>
        </ImageBackground>

        <View
          style={{
            borderRadius: 5,
            borderWidth: 1,
            overflow: 'hidden',
            height: 35,
            padding: 0,
            borderColor: '#00BB23',
          }}>
          {
            <Picker
              style={{
                width: 300,
                height: 55,
                borderBottomWidth: 1,
              }}
              itemStyle={{
                fontSize: 25,
                fontFamily: 'Poppins-Medium',
              }}>
              <Picker.Item label="Select Bank" value="accNum" />
            </Picker>
          }
        </View>
          <View style={styles.space}/>
        <TextInput
          placeholder="Destination Account"
          onChangeText={creditAccount => this.setState({creditAccount})}
          style={styles.input}
        />

        <TextInput
          placeholder=" Amount"
          onChangeText={amount => this.setState({amount})}
          style={styles.input}
        />

        <TextInput
          placeholder=" Narration"
          onChangeText={description => this.setState({description})}
          style={styles.input}
        />

        <View
          style={{
            borderRadius: 5,
            borderWidth: 1,
            overflow: 'hidden',
            height: 35,
            padding: 0,
            top: 10,
            borderColor: '#00BB23',
          }}>
          {
            <Picker
              style={{
                width: 300,
                height: 55,
                borderBottomWidth: 1,
              }}
              itemStyle={{
                fontSize: 25,
                fontFamily: 'Poppins-Medium',
              }}>
              <Picker.Item label="Currency" value="accNum" />
              <Picker.Item label="NGN" value="NGN" />
            </Picker>
          }
        </View>

        <TouchableOpacity
          onPress={() => {
            setModalVisible(true);
          }}
          style={styles.button}>
          <Text style={styles.loginbtn}> Transfer </Text>
        </TouchableOpacity>
        <Modal
          hasBackdrop={true}
          backdropOpacity={0.2}
          backdropColor="black"
          transparent
          visible={modalVisible}
          onRequestClose={() => setModalVisible(false)}>
          <View style={styles.modal}>
            <Text>Hello From Modal</Text>
            <TouchableOpacity>
              <Text>Modal! Modal!</Text>
            </TouchableOpacity>
          </View>
        </Modal>
      </ScrollView>
    </View>
  );
};

export default LocalPayments;

const styles = StyleSheet.create({
  container: {
    paddingTop: 40,
    flex: 1,
    flexDirection: 'row',
    justifyContent: 'space-between',
  },

  modal: {
    top: '50%',
    height: '50%',
    backgroundColor: '#fff',
  },
  accText: {
    top: -50,
    paddingTop: 10,
    justifyContent: 'center',
    alignItems: 'center',
    fontFamily: 'Poppins-Medium',
    fontSize: 12,
    color: 'white',
    textAlign: 'center',
  },
  text: {
    top: -50,
    fontSize: 20,
    color: 'white',
    textAlign: 'center',
    fontFamily: 'Poppins-Bold',
  },
  input: {
    top: 10,
    width: 300,
    height: 55,
    margin: 10,
    fontSize: 12,
    borderColor: '#00BB23',
    fontFamily: 'Poppins-Bold',
    borderRadius: 5,
    borderWidth: 1,
    marginBottom: 30,
  },

  button: {
    marginTop: 40,
    width: 150,
    height: 50,
    padding: 10,
    borderRadius: 10,
    backgroundColor: '#00BB23',
    alignItems: 'center',
  },

  Regbutton: {
    width: 150,
    height: 52,
    padding: 10,
    borderRadius: 10,
    backgroundColor: '#ffffff',
    alignItems: 'center',
    borderWidth: 2,
    borderColor: '#030303',
  },

  loginbtn: {
    color: '#ffff',
    fontSize: 15,
    fontFamily: 'Poppins-Medium',
  },

  AccountBalance: {
    fontSize: 13,
    fontWeight: 'bold',
    textAlign: 'left',
  },

  loginbtn2: {
    color: '#030303',
    fontSize: 20,
    fontWeight: 'bold',
  },

  logo: {
    width: 150,
    height: 150,
  },

  space: {
    top: 10,
    width: 10,
    height: 20,
  },

  space2: {
    width: 10,
    height: 10,
  },

  imageStyle: {
    flexDirection: 'row',
    justifyContent: 'center',
    padding: 5,
    margin: 2,
    height: 15,
    width: 15,
    resizeMode: 'stretch',
    marginBottom: 8,
    marginTop: 8,
    alignItems: 'center',
  },
});
</code>```

it is supposed to return something like this

```<code>{
  "status": "success",
  "message": "Banks fetched successfully",
  "data": [
    {
      "id": 132,
      "code": "560",
      "name": "Page MFBank"
    },
    {
      "id": 133,
      "code": "304",
      "name": "Stanbic Mobile Money"
    },
    {
      "id": 134,
      "code": "308",
      "name": "FortisMobile"
    },
    {
      "id": 135,
      "code": "328",
      "name": "TagPay"
    },
    {
      "id": 136,
      "code": "309",
      "name": "FBNMobile"
    },
    {
      "id": 137,
      "code": "011",
      "name": "First Bank of Nigeria"
    },
    {
      "id": 138,
      "code": "326",
      "name": "Sterling Mobile"
    },
    {
      "id": 139,
      "code": "990",
      "name": "Omoluabi Mortgage Bank"
    },
    {
      "id": 140,
      "code": "311",
      "name": "ReadyCash (Parkway)"
    },
    {
      "id": 141,
      "code": "057",
      "name": "Zenith Bank"
    },
    {
      "id": 142,
      "code": "068",
      "name": "Standard Chartered Bank"
    },
    {
      "id": 143,
      "code": "306",
      "name": "eTranzact"
    },
    {
      "id": 144,
      "code": "070",
      "name": "Fidelity Bank"
    },
    {
      "id": 145,
      "code": "023",
      "name": "CitiBank"
    },
    {
      "id": 146,
      "code": "215",
      "name": "Unity Bank"
    },
    {
      "id": 147,
      "code": "323",
      "name": "Access Money"
    },
    {
      "id": 148,
      "code": "302",
      "name": "Eartholeum"
    },
    {
      "id": 149,
      "code": "324",
      "name": "Hedonmark"
    },
    {
      "id": 150,
      "code": "325",
      "name": "MoneyBox"
    },
    {
      "id": 151,
      "code": "301",
      "name": "JAIZ Bank"
    },
    {
      "id": 152,
      "code": "050",
      "name": "Ecobank Plc"
    },
    {
      "id": 153,
      "code": "307",
      "name": "EcoMobile"
    },
    {
      "id": 154,
      "code": "318",
      "name": "Fidelity Mobile"
    },
    {
      "id": 155,
      "code": "319",
      "name": "TeasyMobile"
    },
    {
      "id": 156,
      "code": "999",
      "name": "NIP Virtual Bank"
    },
    {
      "id": 157,
      "code": "320",
      "name": "VTNetworks"
    },
    {
      "id": 158,
      "code": "221",
      "name": "Stanbic IBTC Bank"
    },
    {
      "id": 159,
      "code": "501",
      "name": "Fortis Microfinance Bank"
    },
    {
      "id": 160,
      "code": "329",
      "name": "PayAttitude Online"
    },
    {
      "id": 161,
      "code": "322",
      "name": "ZenithMobile"
    },
    {
      "id": 162,
      "code": "303",
      "name": "ChamsMobile"
    },
    {
      "id": 163,
      "code": "403",
      "name": "SafeTrust Mortgage Bank"
    },
    {
      "id": 164,
      "code": "551",
      "name": "Covenant Microfinance Bank"
    },
    {
      "id": 165,
      "code": "415",
      "name": "Imperial Homes Mortgage Bank"
    },
    {
      "id": 166,
      "code": "552",
      "name": "NPF MicroFinance Bank"
    },
    {
      "id": 167,
      "code": "526",
      "name": "Parralex"
    },
    {
      "id": 168,
      "code": "035",
      "name": "Wema Bank"
    },
    {
      "id": 169,
      "code": "084",
      "name": "Enterprise Bank"
    },
    {
      "id": 170,
      "code": "063",
      "name": "Diamond Bank"
    },
    {
      "id": 171,
      "code": "305",
      "name": "Paycom"
    },
    {
      "id": 172,
      "code": "100",
      "name": "SunTrust Bank"
    },
    {
      "id": 173,
      "code": "317",
      "name": "Cellulant"
    },
    {
      "id": 174,
      "code": "401",
      "name": "ASO Savings and & Loans"
    },
    {
      "id": 175,
      "code": "030",
      "name": "Heritage"
    },
    {
      "id": 176,
      "code": "402",
      "name": "Jubilee Life Mortgage Bank"
    },
    {
      "id": 177,
      "code": "058",
      "name": "GTBank Plc"
    },
    {
      "id": 178,
      "code": "032",
      "name": "Union Bank"
    },
    {
      "id": 179,
      "code": "232",
      "name": "Sterling Bank"
    },
    {
      "id": 180,
      "code": "076",
      "name": "Skye Bank"
    },
    {
      "id": 181,
      "code": "082",
      "name": "Keystone Bank"
    },
    {
      "id": 182,
      "code": "327",
      "name": "Pagatech"
    },
    {
      "id": 183,
      "code": "559",
      "name": "Coronation Merchant Bank"
    },
    {
      "id": 184,
      "code": "601",
      "name": "FSDH"
    },
    {
      "id": 185,
      "code": "313",
      "name": "Mkudi"
    },
    {
      "id": 186,
      "code": "214",
      "name": "First City Monument Bank"
    },
    {
      "id": 187,
      "code": "314",
      "name": "FET"
    },
    {
      "id": 188,
      "code": "523",
      "name": "Trustbond"
    },
    {
      "id": 189,
      "code": "315",
      "name": "GTMobile"
    },
    {
      "id": 190,
      "code": "033",
      "name": "United Bank for Africa"
    },
    {
      "id": 191,
      "code": "044",
      "name": "Access Bank"
    },
    {
      "id": 567,
      "code": "90115",
      "name": "TCF MFB"
    }
  ]
}
</code>```

Edits
Please see the Package.json

```<code>{
  "name": "XXXXXXXXXXX",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.17.11",
    "@react-native-picker/picker": "^2.4.8",
    "@react-navigation/bottom-tabs": "^6.4.0",
    "@react-navigation/material-top-tabs": "^6.3.0",
    "@react-navigation/native": "^6.0.13",
    "@react-navigation/native-stack": "^6.9.1",
    "@react-navigation/stack": "^6.3.3",
    "@rneui/base": "^4.0.0-rc.7",
    "@rneui/themed": "^4.0.0-rc.7",
    "react": "18.1.0",
    "react-native": "0.70.4",
    "react-native-gesture-handler": "^2.8.0",
    "react-native-modal": "^13.0.1",
    "react-native-pager-view": "^6.0.2",
    "react-native-paper": "^4.12.5",
    "react-native-safe-area-context": "^4.4.1",
    "react-native-safe-area-view": "^1.1.1",
    "react-native-screens": "^3.18.2",
    "react-native-tab-view": "^3.3.0",
    "react-native-table-component": "^1.2.2",
    "react-native-text-avatar": "^1.0.7",
    "react-native-vector-icons": "^9.2.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "jetifier": "^2.0.0",
    "metro-react-native-babel-preset": "0.72.3",
    "react-test-renderer": "18.1.0"
  },
  "jest": {
    "preset": "react-native"
  },
  "rnpm": {
    "assets": [
      "./assets/fonts"
    ]
  }
}
</code>```

Body:
i want to get the list of banks in Nigeria as well as their codes. it just returns more of an empty set. How do i make it get the respective data from Json like the bank name as well as the code and use it in my code?

My code looks like this

  getLocalBanks = async () => {

    var url = 'https://api.flutterwave.com/v3/banks/NG';

    fetch(url + email, {
      method: 'GET',
      headers: {
        'Content-type': 'application/json',
        'Authorization': 'Bearer FLWSECK_TEST-72fe360edef17334f4817a17407011bb-X',
      },
    })
      .then(response => response.json())
      .then(responseJson => {
        setGetBanks(responseJson);
        setLoading(false);
      });
  };

and calling it , I do it like this

  useEffect(()=>{
    getLocalBanks();
    console.log({getBanks})
  });

but i am getting a very empty set when i interract with the REST api

Full source code is like this

import {
  ImageBackground,
  Modal,
  ScrollView,
  StyleSheet,
  Text,
  TextInput,
  TouchableOpacity,
  View,
} from 'react-native';
import {Picker} from '@react-native-picker/picker';
import React, {useEffect, useState} from 'react';
import {useNavigation} from '@react-navigation/native';
import BackgroundOpacity from './BackgroundOpacity';

const LocalPayments = () => {
  const navigation = useNavigation();
  const[getBanks, setGetBanks] = useState([])
  const [modalVisible, setModalVisible] = useState(false);

  getLocalBanks = async () => {

    var url = 'https://api.flutterwave.com/v3/banks/NG';

    fetch(url + email, {
      method: 'GET',
      headers: {
        'Content-type': 'application/json',
        'Authorization': 'Bearer FLWSECK_TEST-72fe360edef17334f4817a17407011bb-X',
      },
    })
      .then(response => response.json())
      .then(responseJson => {
        setGetBanks(responseJson);
        setLoading(false);
      });
  };

  useEffect(()=>{
    getLocalBanks();
    console.log({getBanks})
  });

  showBanks = () =>{
    alert({})
  }

  return (
    <View style={styles.container}>
      <BackgroundOpacity
        display={Platform.OS === 'ios' ? false : modalVisible}
      />
      <View style={styles.space} />
      <ScrollView
        contentContainerStyle={{
          justifyContent: 'space-between',
          alignItems: 'center',
        }}>
        <ImageBackground
          source={{
            uri: 'asset:/logo/bg.JPG',
          }}
          imageStyle={{borderRadius: 6}}
          style={{
            top: -30,
            paddingTop: 95,
            alignSelf: 'center',
            width: 328,
            height: 115,
            borderadius: 9,
            justifyContent: 'center',
            alignSelf: 'center',
            alignItems: 'center',
          }}>
          <View>
            <Text style={styles.accText}>Wallet Balance</Text>
            <Text style={styles.text}> 250,000 </Text>
          </View>
        </ImageBackground>

        <View
          style={{
            borderRadius: 5,
            borderWidth: 1,
            overflow: 'hidden',
            height: 35,
            padding: 0,
            borderColor: '#00BB23',
          }}>
          {
            <Picker
              style={{
                width: 300,
                height: 55,
                borderBottomWidth: 1,
              }}
              itemStyle={{
                fontSize: 25,
                fontFamily: 'Poppins-Medium',
              }}>
              <Picker.Item label="Select Bank" value="accNum" />
            </Picker>
          }
        </View>
          <View style={styles.space}/>
        <TextInput
          placeholder="Destination Account"
          onChangeText={creditAccount => this.setState({creditAccount})}
          style={styles.input}
        />

        <TextInput
          placeholder=" Amount"
          onChangeText={amount => this.setState({amount})}
          style={styles.input}
        />

        <TextInput
          placeholder=" Narration"
          onChangeText={description => this.setState({description})}
          style={styles.input}
        />

        <View
          style={{
            borderRadius: 5,
            borderWidth: 1,
            overflow: 'hidden',
            height: 35,
            padding: 0,
            top: 10,
            borderColor: '#00BB23',
          }}>
          {
            <Picker
              style={{
                width: 300,
                height: 55,
                borderBottomWidth: 1,
              }}
              itemStyle={{
                fontSize: 25,
                fontFamily: 'Poppins-Medium',
              }}>
              <Picker.Item label="Currency" value="accNum" />
              <Picker.Item label="NGN" value="NGN" />
            </Picker>
          }
        </View>

        <TouchableOpacity
          onPress={() => {
            setModalVisible(true);
          }}
          style={styles.button}>
          <Text style={styles.loginbtn}> Transfer </Text>
        </TouchableOpacity>
        <Modal
          hasBackdrop={true}
          backdropOpacity={0.2}
          backdropColor="black"
          transparent
          visible={modalVisible}
          onRequestClose={() => setModalVisible(false)}>
          <View style={styles.modal}>
            <Text>Hello From Modal</Text>
            <TouchableOpacity>
              <Text>Modal! Modal!</Text>
            </TouchableOpacity>
          </View>
        </Modal>
      </ScrollView>
    </View>
  );
};

export default LocalPayments;

const styles = StyleSheet.create({
  container: {
    paddingTop: 40,
    flex: 1,
    flexDirection: 'row',
    justifyContent: 'space-between',
  },

  modal: {
    top: '50%',
    height: '50%',
    backgroundColor: '#fff',
  },
  accText: {
    top: -50,
    paddingTop: 10,
    justifyContent: 'center',
    alignItems: 'center',
    fontFamily: 'Poppins-Medium',
    fontSize: 12,
    color: 'white',
    textAlign: 'center',
  },
  text: {
    top: -50,
    fontSize: 20,
    color: 'white',
    textAlign: 'center',
    fontFamily: 'Poppins-Bold',
  },
  input: {
    top: 10,
    width: 300,
    height: 55,
    margin: 10,
    fontSize: 12,
    borderColor: '#00BB23',
    fontFamily: 'Poppins-Bold',
    borderRadius: 5,
    borderWidth: 1,
    marginBottom: 30,
  },

  button: {
    marginTop: 40,
    width: 150,
    height: 50,
    padding: 10,
    borderRadius: 10,
    backgroundColor: '#00BB23',
    alignItems: 'center',
  },

  Regbutton: {
    width: 150,
    height: 52,
    padding: 10,
    borderRadius: 10,
    backgroundColor: '#ffffff',
    alignItems: 'center',
    borderWidth: 2,
    borderColor: '#030303',
  },

  loginbtn: {
    color: '#ffff',
    fontSize: 15,
    fontFamily: 'Poppins-Medium',
  },

  AccountBalance: {
    fontSize: 13,
    fontWeight: 'bold',
    textAlign: 'left',
  },

  loginbtn2: {
    color: '#030303',
    fontSize: 20,
    fontWeight: 'bold',
  },

  logo: {
    width: 150,
    height: 150,
  },

  space: {
    top: 10,
    width: 10,
    height: 20,
  },

  space2: {
    width: 10,
    height: 10,
  },

  imageStyle: {
    flexDirection: 'row',
    justifyContent: 'center',
    padding: 5,
    margin: 2,
    height: 15,
    width: 15,
    resizeMode: 'stretch',
    marginBottom: 8,
    marginTop: 8,
    alignItems: 'center',
  },
});

it is supposed to return something like this

{
  "status": "success",
  "message": "Banks fetched successfully",
  "data": [
    {
      "id": 132,
      "code": "560",
      "name": "Page MFBank"
    },
    {
      "id": 133,
      "code": "304",
      "name": "Stanbic Mobile Money"
    },
    {
      "id": 134,
      "code": "308",
      "name": "FortisMobile"
    },
    {
      "id": 135,
      "code": "328",
      "name": "TagPay"
    },
    {
      "id": 136,
      "code": "309",
      "name": "FBNMobile"
    },
    {
      "id": 137,
      "code": "011",
      "name": "First Bank of Nigeria"
    },
    {
      "id": 138,
      "code": "326",
      "name": "Sterling Mobile"
    },
    {
      "id": 139,
      "code": "990",
      "name": "Omoluabi Mortgage Bank"
    },
    {
      "id": 140,
      "code": "311",
      "name": "ReadyCash (Parkway)"
    },
    {
      "id": 141,
      "code": "057",
      "name": "Zenith Bank"
    },
    {
      "id": 142,
      "code": "068",
      "name": "Standard Chartered Bank"
    },
    {
      "id": 143,
      "code": "306",
      "name": "eTranzact"
    },
    {
      "id": 144,
      "code": "070",
      "name": "Fidelity Bank"
    },
    {
      "id": 145,
      "code": "023",
      "name": "CitiBank"
    },
    {
      "id": 146,
      "code": "215",
      "name": "Unity Bank"
    },
    {
      "id": 147,
      "code": "323",
      "name": "Access Money"
    },
    {
      "id": 148,
      "code": "302",
      "name": "Eartholeum"
    },
    {
      "id": 149,
      "code": "324",
      "name": "Hedonmark"
    },
    {
      "id": 150,
      "code": "325",
      "name": "MoneyBox"
    },
    {
      "id": 151,
      "code": "301",
      "name": "JAIZ Bank"
    },
    {
      "id": 152,
      "code": "050",
      "name": "Ecobank Plc"
    },
    {
      "id": 153,
      "code": "307",
      "name": "EcoMobile"
    },
    {
      "id": 154,
      "code": "318",
      "name": "Fidelity Mobile"
    },
    {
      "id": 155,
      "code": "319",
      "name": "TeasyMobile"
    },
    {
      "id": 156,
      "code": "999",
      "name": "NIP Virtual Bank"
    },
    {
      "id": 157,
      "code": "320",
      "name": "VTNetworks"
    },
    {
      "id": 158,
      "code": "221",
      "name": "Stanbic IBTC Bank"
    },
    {
      "id": 159,
      "code": "501",
      "name": "Fortis Microfinance Bank"
    },
    {
      "id": 160,
      "code": "329",
      "name": "PayAttitude Online"
    },
    {
      "id": 161,
      "code": "322",
      "name": "ZenithMobile"
    },
    {
      "id": 162,
      "code": "303",
      "name": "ChamsMobile"
    },
    {
      "id": 163,
      "code": "403",
      "name": "SafeTrust Mortgage Bank"
    },
    {
      "id": 164,
      "code": "551",
      "name": "Covenant Microfinance Bank"
    },
    {
      "id": 165,
      "code": "415",
      "name": "Imperial Homes Mortgage Bank"
    },
    {
      "id": 166,
      "code": "552",
      "name": "NPF MicroFinance Bank"
    },
    {
      "id": 167,
      "code": "526",
      "name": "Parralex"
    },
    {
      "id": 168,
      "code": "035",
      "name": "Wema Bank"
    },
    {
      "id": 169,
      "code": "084",
      "name": "Enterprise Bank"
    },
    {
      "id": 170,
      "code": "063",
      "name": "Diamond Bank"
    },
    {
      "id": 171,
      "code": "305",
      "name": "Paycom"
    },
    {
      "id": 172,
      "code": "100",
      "name": "SunTrust Bank"
    },
    {
      "id": 173,
      "code": "317",
      "name": "Cellulant"
    },
    {
      "id": 174,
      "code": "401",
      "name": "ASO Savings and & Loans"
    },
    {
      "id": 175,
      "code": "030",
      "name": "Heritage"
    },
    {
      "id": 176,
      "code": "402",
      "name": "Jubilee Life Mortgage Bank"
    },
    {
      "id": 177,
      "code": "058",
      "name": "GTBank Plc"
    },
    {
      "id": 178,
      "code": "032",
      "name": "Union Bank"
    },
    {
      "id": 179,
      "code": "232",
      "name": "Sterling Bank"
    },
    {
      "id": 180,
      "code": "076",
      "name": "Skye Bank"
    },
    {
      "id": 181,
      "code": "082",
      "name": "Keystone Bank"
    },
    {
      "id": 182,
      "code": "327",
      "name": "Pagatech"
    },
    {
      "id": 183,
      "code": "559",
      "name": "Coronation Merchant Bank"
    },
    {
      "id": 184,
      "code": "601",
      "name": "FSDH"
    },
    {
      "id": 185,
      "code": "313",
      "name": "Mkudi"
    },
    {
      "id": 186,
      "code": "214",
      "name": "First City Monument Bank"
    },
    {
      "id": 187,
      "code": "314",
      "name": "FET"
    },
    {
      "id": 188,
      "code": "523",
      "name": "Trustbond"
    },
    {
      "id": 189,
      "code": "315",
      "name": "GTMobile"
    },
    {
      "id": 190,
      "code": "033",
      "name": "United Bank for Africa"
    },
    {
      "id": 191,
      "code": "044",
      "name": "Access Bank"
    },
    {
      "id": 567,
      "code": "90115",
      "name": "TCF MFB"
    }
  ]
}

Edits
Please see the Package.json

{
  "name": "XXXXXXXXXXX",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.17.11",
    "@react-native-picker/picker": "^2.4.8",
    "@react-navigation/bottom-tabs": "^6.4.0",
    "@react-navigation/material-top-tabs": "^6.3.0",
    "@react-navigation/native": "^6.0.13",
    "@react-navigation/native-stack": "^6.9.1",
    "@react-navigation/stack": "^6.3.3",
    "@rneui/base": "^4.0.0-rc.7",
    "@rneui/themed": "^4.0.0-rc.7",
    "react": "18.1.0",
    "react-native": "0.70.4",
    "react-native-gesture-handler": "^2.8.0",
    "react-native-modal": "^13.0.1",
    "react-native-pager-view": "^6.0.2",
    "react-native-paper": "^4.12.5",
    "react-native-safe-area-context": "^4.4.1",
    "react-native-safe-area-view": "^1.1.1",
    "react-native-screens": "^3.18.2",
    "react-native-tab-view": "^3.3.0",
    "react-native-table-component": "^1.2.2",
    "react-native-text-avatar": "^1.0.7",
    "react-native-vector-icons": "^9.2.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "jetifier": "^2.0.0",
    "metro-react-native-babel-preset": "0.72.3",
    "react-test-renderer": "18.1.0"
  },
  "jest": {
    "preset": "react-native"
  },
  "rnpm": {
    "assets": [
      "./assets/fonts"
    ]
  }
}


问:
Why is a simple netgraph demo not displaying correctly in a colab notebook?
While this very small notebook runs fine on my local machine, with a table displaying all of the attributes of the node or edge you click on, when using is on colab it displays the graph as static and that's it. No dragging and moving and no data table appearing.

https://colab.research.google.com/drive/1X6KmadaUm92EEHkUbIKg3ysSYov_ohVy

Thank you very much and hope Santa will bring you all the best ;)


问:
source(file.path("server", "tab1.R"), local = TRUE)$value via Golem-Shiny
I have my shiny app already developed and is in the form where the ui and server functions are split into many separate files like this:

current Shiny R files

My question when I am trying to port my app into golem where do I source those server files: eg:

`source(file.path("server", "tab1.R"),  local = TRUE)$value`
`source(file.path("server", "tab2.R"),  local = TRUE)$value`

Can someone show me exactly where to put those files "tab1.R" and "tab2.R" and exactly which file I source them in and the syntax.

Been trying 10+ hours and can't figure it out.

Thank you very much in advance


问:
Property file is not loading in executable jar
I have property file in my maven project. Its in resources folder and below is snippet for that.

```<code>try
        {
            prop = new Properties();

           String path = System.getProperty("user.dir") +"/src/test/resources/config/my.properties";

           FileInputStream propFile = new FileInputStream(path);

            prop.load(propFile);

        }
        catch (FileNotFoundException e)
        {
            System.out.println("file not found");
        }
        catch (IOException e)
        {
            System.out.println("IO");
        }
</code>```

in my maven project I have this file at given location in code. When am running this code in eclipse its working fine but when am creating executable jar am getting below error

```<code> java -jar CRDPOM.jar
 File name ***  /Users/myuser/Documents/Personal-Workspace
 path :  /Users/myuser/Documents/Personal-Workspace/src/test/resources/config/my.properties
file not found
[main] INFO org.testng.internal.Utils - [TestNG] Running:
  Command line suite

**** browser name if *****  null

</code>```

What am I missing here?

I checked it locally in eclipse and its working fine.

Body:
I have property file in my maven project. Its in resources folder and below is snippet for that.

try
        {
            prop = new Properties();

           String path = System.getProperty("user.dir") +"/src/test/resources/config/my.properties";

           FileInputStream propFile = new FileInputStream(path);

            prop.load(propFile);

        }
        catch (FileNotFoundException e)
        {
            System.out.println("file not found");
        }
        catch (IOException e)
        {
            System.out.println("IO");
        }

in my maven project I have this file at given location in code. When am running this code in eclipse its working fine but when am creating executable jar am getting below error

 java -jar CRDPOM.jar
 File name ***  /Users/myuser/Documents/Personal-Workspace
 path :  /Users/myuser/Documents/Personal-Workspace/src/test/resources/config/my.properties
file not found
[main] INFO org.testng.internal.Utils - [TestNG] Running:
  Command line suite

**** browser name if *****  null

What am I missing here?

I checked it locally in eclipse and its working fine.


问:
How are parent and child processes related when it comes to resources?
When you start a system, the first process started is INIT, which gets the PID of 1. Afterwards, all other processes are child of INIT (PID: 1) and each of them can have child processes and so on.

My question is, how are processes related when it comes to memory and cpu ? I am aware that each process can have multiple threads and that it each process has its own heap. In that case, how are parent and child processes related when it comes to resources ?

If, for example a process has a limit on the CPU amount it can use and that limit is set by the cgroup the process it's in, how would that affect child processes ? Does the CPU-amount of the parent process increase as the CPU-amount of its child processes increase ?


问:
How to activate a win32 menu bar when using glut for OpenGL?
I bind the glut window with the win32 window as its subwindow. But then I want to use the win32 menu bar instead of the menu bar provided by glut. However, if I use glutMainLoop(), dispatchMessage() can't get invoked. And if I write codes as win32: while(GetMessage(&nMsg, NULL, 0, 0)){}, everythin in glut can't be implemented.

```<code>static TCHAR szAppName[] = TEXT("HelloWin");
    HWND   hwnd;
    MSG    msg;
    WNDCLASS wndclass;
    wndclass.style = CS_HREDRAW | CS_VREDRAW;
    wndclass.lpfnWndProc = WndProc;
    wndclass.cbClsExtra = 0;
    wndclass.cbWndExtra = 0;
    wndclass.hInstance = 0;
    wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
    wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    wndclass.lpszMenuName = NULL;
    wndclass.lpszClassName = szAppName;

    if (!RegisterClass(&wndclass))
    {
        MessageBox(NULL, TEXT("This program requires Windows NT!"), szAppName, MB_ICONERROR);
        return 0;
    }
    hwnd = CreateWindowW(szAppName,      // window class name
        TEXT("The Hello Program"),   // window caption
        WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU,
        CW_USEDEFAULT,// initial x position
        CW_USEDEFAULT,// initial y position
        CW_USEDEFAULT,// initial x size
        CW_USEDEFAULT,// initial y size
        NULL,                 // parent window handle
        NULL,            // window menu handle
        0,   // program instance handle
        NULL);      // creation parameters

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
    glutInitWindowPosition(50, 50);
    glutInitWindowSize(800, 600);
    glutCreateWindow("easy geometry tool with typed input");

    WNDCLASS wc = { 0 };
    wc.lpfnWndProc = WndProc;
    RegisterClass(&wc);

    HWND hWnd = GetActiveWindow();
    HWND hwndGLFW = GetActiveWindow();
    SetWindowLong(hwndGLFW, GWL_STYLE, WS_VISIBLE);
    MoveWindow(hwndGLFW, 0, 0, 1150, 800, TRUE);
    SetParent(hwndGLFW, hwnd);
    HINSTANCE hInst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);
    HMENU hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1));
    SetMenu(hWnd, hMenu);

    ShowWindow(hwnd, SW_SHOW);
    UpdateWindow(hwnd);

    Init();
    glutDisplayFunc(myDisplay);
    glutMouseFunc(mouse);
    glutKeyboardFunc(keyboard);
    glutSpecialFunc(keyboardSpecial);
    createGlutMenu();

    MSG nMsg = { 0 };
    while (GetMessage(&nMsg, NULL, 0, 0)) {
        glutMainLoop();
        TranslateMessage(&nMsg);
        DispatchMessage(&nMsg);
    };
</code>```

If anyone who can tell me the solution to my problem, thanks a lot!!!!!!

Body:
I bind the glut window with the win32 window as its subwindow. But then I want to use the win32 menu bar instead of the menu bar provided by glut. However, if I use glutMainLoop(), dispatchMessage() can't get invoked. And if I write codes as win32: while(GetMessage(&nMsg, NULL, 0, 0)){}, everythin in glut can't be implemented.

static TCHAR szAppName[] = TEXT("HelloWin");
    HWND   hwnd;
    MSG    msg;
    WNDCLASS wndclass;
    wndclass.style = CS_HREDRAW | CS_VREDRAW;
    wndclass.lpfnWndProc = WndProc;
    wndclass.cbClsExtra = 0;
    wndclass.cbWndExtra = 0;
    wndclass.hInstance = 0;
    wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
    wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    wndclass.lpszMenuName = NULL;
    wndclass.lpszClassName = szAppName;

    if (!RegisterClass(&wndclass))
    {
        MessageBox(NULL, TEXT("This program requires Windows NT!"), szAppName, MB_ICONERROR);
        return 0;
    }
    hwnd = CreateWindowW(szAppName,      // window class name
        TEXT("The Hello Program"),   // window caption
        WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU,
        CW_USEDEFAULT,// initial x position
        CW_USEDEFAULT,// initial y position
        CW_USEDEFAULT,// initial x size
        CW_USEDEFAULT,// initial y size
        NULL,                 // parent window handle
        NULL,            // window menu handle
        0,   // program instance handle
        NULL);      // creation parameters

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
    glutInitWindowPosition(50, 50);
    glutInitWindowSize(800, 600);
    glutCreateWindow("easy geometry tool with typed input");

    WNDCLASS wc = { 0 };
    wc.lpfnWndProc = WndProc;
    RegisterClass(&wc);

    HWND hWnd = GetActiveWindow();
    HWND hwndGLFW = GetActiveWindow();
    SetWindowLong(hwndGLFW, GWL_STYLE, WS_VISIBLE);
    MoveWindow(hwndGLFW, 0, 0, 1150, 800, TRUE);
    SetParent(hwndGLFW, hwnd);
    HINSTANCE hInst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);
    HMENU hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1));
    SetMenu(hWnd, hMenu);

    ShowWindow(hwnd, SW_SHOW);
    UpdateWindow(hwnd);

    Init();
    glutDisplayFunc(myDisplay);
    glutMouseFunc(mouse);
    glutKeyboardFunc(keyboard);
    glutSpecialFunc(keyboardSpecial);
    createGlutMenu();

    MSG nMsg = { 0 };
    while (GetMessage(&nMsg, NULL, 0, 0)) {
        glutMainLoop();
        TranslateMessage(&nMsg);
        DispatchMessage(&nMsg);
    };

If anyone who can tell me the solution to my problem, thanks a lot!!!!!!


问:
an error occurs when starting a game with unity in WebGL format
Help please. I'm exporting the game to WebGL. Using a "Gzip" compressor. And when running in the local server, it gives such an error. How to fix it? (I have already tried to turn off the compressor did not help).

text error:
Unable to parse Build/grrrr.framework.js! The file is corrupt, or compression was misconfigured? (check Content-Encoding HTTP Response Header on web server)

(I have already tried to turn off the compressor did not help).


问:
Unzip a file using Scoped Storage in Android
I'm creating an Android app which I need to unzip a file in Android/data folder, I'm already done with asking permissions to write at this folder using Scoped Storage with getContentResolver().takePersistableUriPermission() method. My question is given an Uri object representing a subfolder located in Android/data, how can I extract the zip contents in it?

I tried using default android Zip lib and Zip4j but I'm getting permission errors (I think that is related to the path).

EDIT: I don't want to unzip on the app specific data folder but in another app folder in Android/data. This is why I used Scoped Storage.

EDIT 2:
I used used this code to get access to write at Android/data:

```<code>StorageManager sm = (StorageManager) getApplicationContext().getSystemService(Context.STORAGE_SERVICE);
Intent intent = sm.getPrimaryStorageVolume().createOpenDocumentTreeIntent();

String startSubDir = "Android%2Fdata";
Uri uri = intent.getParcelableExtra("android.provider.extra.INITIAL_URI");
String scheme = uri.toString();

scheme = scheme.replace("/root/", "/document/");
scheme += "%3A" + startSubDir;

uri = Uri.parse(scheme);
intent.putExtra("android.provider.extra.INITIAL_URI", uri);

someActivityResultLauncher.launch(intent);
</code>```

And onActivityResult() I requested for persistent permission:

```<code>ActivityResultLauncher<Intent> someActivityResultLauncher = registerForActivityResult(
    new ActivityResultContracts.StartActivityForResult(),
    new ActivityResultCallback<ActivityResult>() {
        @Override
        public void onActivityResult(ActivityResult result) {
            if (result.getResultCode() == Activity.RESULT_OK) {
                // There are no request codes
                Intent data = result.getData();
                if (data != null) {
                    getContentResolver().takePersistableUriPermission(data.getData(), Intent.FLAG_GRANT_WRITE_URI_PERMISSION);

                } else {
                    System.exit(0);
                }
            }
        }
    });
</code>```

Body:
I'm creating an Android app which I need to unzip a file in Android/data folder, I'm already done with asking permissions to write at this folder using Scoped Storage with getContentResolver().takePersistableUriPermission() method. My question is given an Uri object representing a subfolder located in Android/data, how can I extract the zip contents in it?

I tried using default android Zip lib and Zip4j but I'm getting permission errors (I think that is related to the path).

EDIT: I don't want to unzip on the app specific data folder but in another app folder in Android/data. This is why I used Scoped Storage.

EDIT 2:
I used used this code to get access to write at Android/data:

StorageManager sm = (StorageManager) getApplicationContext().getSystemService(Context.STORAGE_SERVICE);
Intent intent = sm.getPrimaryStorageVolume().createOpenDocumentTreeIntent();

String startSubDir = "Android%2Fdata";
Uri uri = intent.getParcelableExtra("android.provider.extra.INITIAL_URI");
String scheme = uri.toString();

scheme = scheme.replace("/root/", "/document/");
scheme += "%3A" + startSubDir;

uri = Uri.parse(scheme);
intent.putExtra("android.provider.extra.INITIAL_URI", uri);

someActivityResultLauncher.launch(intent);

And onActivityResult() I requested for persistent permission:

ActivityResultLauncher<Intent> someActivityResultLauncher = registerForActivityResult(
    new ActivityResultContracts.StartActivityForResult(),
    new ActivityResultCallback<ActivityResult>() {
        @Override
        public void onActivityResult(ActivityResult result) {
            if (result.getResultCode() == Activity.RESULT_OK) {
                // There are no request codes
                Intent data = result.getData();
                if (data != null) {
                    getContentResolver().takePersistableUriPermission(data.getData(), Intent.FLAG_GRANT_WRITE_URI_PERMISSION);

                } else {
                    System.exit(0);
                }
            }
        }
    });


问:
Sending http2 get requests with cookies in nodejs
I'm trying to send an HTTP/2 GET request using nodejs http2 module but I'm having trouble with sending cookies.
I have to read the cookies from a JSON file and send them with the request.

I tried this:

```<code>const http2 = require("http2");
const client = http2.connect("http://192.168.1.50");
const fs = require('fs');

var COOKIE = fs.readFileSync('cookies.json', 'utf8');

const req = client.request( {
    ':path': '/cookies.php',
    ':method': 'GET',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0',
    'Cookie' : COOKIE,
  } )

let data = "";

req.on("response", (headers, flags) => {
 for (const name in headers) {
  console.log(`${name}: ${headers[name]}`);
 }

});

req.on("data", chunk => {
 data += chunk;
});
req.on("end", () => {
 console.log(data);
 client.close();
});
req.end();

</code>```

cookies.json:

```<code>[{"name":"test","value":"12345","domain":"192.168.1.50","path":"/"}]

</code>```

But it doesn't work, because I made a quick php page that prints $_COOKIE but it prints an empty array

I'm not an expert with HTTP headers, how can I do this?

Body:
I'm trying to send an HTTP/2 GET request using nodejs http2 module but I'm having trouble with sending cookies.
I have to read the cookies from a JSON file and send them with the request.

I tried this:

const http2 = require("http2");
const client = http2.connect("http://192.168.1.50");
const fs = require('fs');

var COOKIE = fs.readFileSync('cookies.json', 'utf8');

const req = client.request( {
    ':path': '/cookies.php',
    ':method': 'GET',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0',
    'Cookie' : COOKIE,
  } )

let data = "";

req.on("response", (headers, flags) => {
 for (const name in headers) {
  console.log(`${name}: ${headers[name]}`);
 }

});

req.on("data", chunk => {
 data += chunk;
});
req.on("end", () => {
 console.log(data);
 client.close();
});
req.end();

cookies.json:

[{"name":"test","value":"12345","domain":"192.168.1.50","path":"/"}]

But it doesn't work, because I made a quick php page that prints $_COOKIE but it prints an empty array

I'm not an expert with HTTP headers, how can I do this?


问:
display a List of GPS on LWC Map
I need to diplay a list of Goelocation field on a map in LWC. I am able to do it with a single record but i want to do it for mutiple records.

In the code below, data is a list of record.  this.items = data[0] display a single record, it works fine but  i want to know to work with the whole list.

```<code>import { LightningElement, wire } from 'lwc';
import beneficiaryList from '@salesforce/apex/IMS_Beneficiaries_List.findListOfBeneficiares';

export default class ImsMapOfBeneficiaries extends LightningElement {

    items;
    error;
    mapMarkers

    @wire(beneficiaryList)
    wiredItemsAccount({ error, data }) {
        if (data) {
            this.items = data[0];

            this.mapMarkers = [
                {
                    location: {
                        Latitude: this.items.GPS__Latitude__s,
                        Longitude: this.items.GPS__Longitude__s,
                    },
                    title: this.items.Id,
                    description: this.items.Name
                },
            ];
        } else if (error) {
            this.error = error;
        }
    }

    zoomLevel = 15;
}

</code>```

the HTML file is:

```<code><template>
    <lightning-map map-markers={mapMarkers} zoom-level={zoomLevel} list-view={listView}>
    </lightning-map>
</template>
</code>```
```<code> wiredItemsAccount({ error, data }) {
        if (data) {
            this.items = data[0];

            this.mapMarkers = [
                {
                    location: {
                        Latitude: this.items.GPS__Latitude__s,
                        Longitude: this.items.GPS__Longitude__s,
                    },
                    title: this.items.Id,
                    description: this.items.Name
                },
            ];
        } else if (error) {
            this.error = error;
        }
    }
</code>```

Title: display a List of GPS on LWC Map

Body:
I need to diplay a list of Goelocation field on a map in LWC. I am able to do it with a single record but i want to do it for mutiple records.

In the code below, data is a list of record.  this.items = data[0] display a single record, it works fine but  i want to know to work with the whole list.

import { LightningElement, wire } from 'lwc';
import beneficiaryList from '@salesforce/apex/IMS_Beneficiaries_List.findListOfBeneficiares';

export default class ImsMapOfBeneficiaries extends LightningElement {

    items;
    error;
    mapMarkers

    @wire(beneficiaryList)
    wiredItemsAccount({ error, data }) {
        if (data) {
            this.items = data[0];

            this.mapMarkers = [
                {
                    location: {
                        Latitude: this.items.GPS__Latitude__s,
                        Longitude: this.items.GPS__Longitude__s,
                    },
                    title: this.items.Id,
                    description: this.items.Name
                },
            ];
        } else if (error) {
            this.error = error;
        }
    }

    zoomLevel = 15;
}

the HTML file is:

<template>
    <lightning-map map-markers={mapMarkers} zoom-level={zoomLevel} list-view={listView}>
    </lightning-map>
</template>

 wiredItemsAccount({ error, data }) {
        if (data) {
            this.items = data[0];

            this.mapMarkers = [
                {
                    location: {
                        Latitude: this.items.GPS__Latitude__s,
                        Longitude: this.items.GPS__Longitude__s,
                    },
                    title: this.items.Id,
                    description: this.items.Name
                },
            ];
        } else if (error) {
            this.error = error;
        }
    }


问:
How to partially download video/image from Axios?
I have a NodeJS app and want to let user upload image/video from a given URL using Axios. But before downloading the media and store it on S3, I need to verify the width & height through ffprobe, and size of the media (can use Content-Length).

My current implementation is to get first 5 chunks and pipe it to write stream, but the video seems to be broken...

```<code>router.post('/upload', async (req, res) => {
  const { file } = req.body;
  try {
    const rawPath = path.resolve(`./.temp/raw/${Math.random()}`);
    const response = await axios.get(file, { responseType: 'stream' });

    // Progress
    const stream = response.data;
    const chunks: Buffer[] = [];
    const writeStream = fs.createWriteStream(rawPath);
    let progress = 0;

    await new Promise((resolve, reject) => {
      stream.on('error', reject).once('close', () => resolve(rawPath));
      stream.on('data', (data: Buffer) => {
        progress += Buffer.byteLength(data);
        console.log(progress);
        chunks.push(data);

        if (chunks.length >= 5) {
          stream.destroy();
          resolve(rawPath);
        }
      });
    });

    chunks.forEach((chunk) => {
      writeStream.write(chunk);
    });
    writeStream.end();

    res.json('ok');
  } catch (e) {
    console.log(e);
    res.sendStatus(400);
  }
});
</code>```

Describe what you tried:
Axios piping to write stream, but can't seem to get partial media

What you expected to happen:
Get some chunks of video to be checked

What actually resulted:
Broken media after downloaded

Body:
I have a NodeJS app and want to let user upload image/video from a given URL using Axios. But before downloading the media and store it on S3, I need to verify the width & height through ffprobe, and size of the media (can use Content-Length).

My current implementation is to get first 5 chunks and pipe it to write stream, but the video seems to be broken...

router.post('/upload', async (req, res) => {
  const { file } = req.body;
  try {
    const rawPath = path.resolve(`./.temp/raw/${Math.random()}`);
    const response = await axios.get(file, { responseType: 'stream' });

    // Progress
    const stream = response.data;
    const chunks: Buffer[] = [];
    const writeStream = fs.createWriteStream(rawPath);
    let progress = 0;

    await new Promise((resolve, reject) => {
      stream.on('error', reject).once('close', () => resolve(rawPath));
      stream.on('data', (data: Buffer) => {
        progress += Buffer.byteLength(data);
        console.log(progress);
        chunks.push(data);

        if (chunks.length >= 5) {
          stream.destroy();
          resolve(rawPath);
        }
      });
    });

    chunks.forEach((chunk) => {
      writeStream.write(chunk);
    });
    writeStream.end();

    res.json('ok');
  } catch (e) {
    console.log(e);
    res.sendStatus(400);
  }
});

Describe what you tried:
Axios piping to write stream, but can't seem to get partial media

What you expected to happen:
Get some chunks of video to be checked

What actually resulted:
Broken media after downloaded


问:
ffmpeg doesn't see yt_dlp stream
I making discord bot and i am trying to move from youtube_dl to yt_dlp to get +18 videos from youtube, I am getting error Output file #0 does not contain any stream.

```<code>self.YTDL_OPTIONS = {'format': 'bestaudio', 'nonplaylist': 'True', 'youtube_include_dash_manifest': False}

self.FFMPEG_OPTIONS = {
    'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
    'options': '-vn'
}
</code>```
```<code>with YoutubeDL(self.YTDL_OPTIONS) as ydl:
    try:
        info = ydl.extract_info(url, download=False)
    except:
        return False
return {
    'link': 'https://www.youtube.com/watch?v=' + url,
    'thumbnail': 'https://i.ytimg.com/vi/' + url + '/hqdefault.jpg?sqp=-oaymwEcCOADEI4CSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLD5uL4xKN-IUfez6KIW_j5y70mlig',
    'source': info['formats'][0]['url'],
    'title': info['title']
}
</code>```
```<code>self.vc[id].play(discord.FFmpegPCMAudio(
    song['source'], **self.FFMPEG_OPTIONS), after=lambda e: self.play_next(interaction))
</code>```

This config works with youtube_dl, but not with yt_dlp. Any ideas what i should change?

Title: ffmpeg doesn't see yt_dlp stream

Body:
I making discord bot and i am trying to move from youtube_dl to yt_dlp to get +18 videos from youtube, I am getting error Output file #0 does not contain any stream.

self.YTDL_OPTIONS = {'format': 'bestaudio', 'nonplaylist': 'True', 'youtube_include_dash_manifest': False}

self.FFMPEG_OPTIONS = {
    'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
    'options': '-vn'
}

with YoutubeDL(self.YTDL_OPTIONS) as ydl:
    try:
        info = ydl.extract_info(url, download=False)
    except:
        return False
return {
    'link': 'https://www.youtube.com/watch?v=' + url,
    'thumbnail': 'https://i.ytimg.com/vi/' + url + '/hqdefault.jpg?sqp=-oaymwEcCOADEI4CSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLD5uL4xKN-IUfez6KIW_j5y70mlig',
    'source': info['formats'][0]['url'],
    'title': info['title']
}

self.vc[id].play(discord.FFmpegPCMAudio(
    song['source'], **self.FFMPEG_OPTIONS), after=lambda e: self.play_next(interaction))

This config works with youtube_dl, but not with yt_dlp. Any ideas what i should change?


问:
Java Mqtt SSL implementation
I have to implement SSL connection in java

```<code>Properties properties = new Properties();

properties.setProperty(SSLSocketFactoryFactory.KEYSTORE, "C:\\Users\\SathishKumar\\cert.p12");
properties.setProperty(SSLSocketFactoryFactory.KEYSTOREPWD, "machchar001");
MqttConnectOptions options = new MqttConnectOptions();
options.setAutomaticReconnect(true);
options.setCleanSession(false);
options.setConnectionTimeout(10);
options.setSSLProperties(properties);
client.connect(options);`
</code>```

I'm facing

```<code>MqttException (0) - javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
</code>```

Title: Java Mqtt SSL implementation

Body:
I have to implement SSL connection in java

Properties properties = new Properties();

properties.setProperty(SSLSocketFactoryFactory.KEYSTORE, "C:\\Users\\SathishKumar\\cert.p12");
properties.setProperty(SSLSocketFactoryFactory.KEYSTOREPWD, "machchar001");
MqttConnectOptions options = new MqttConnectOptions();
options.setAutomaticReconnect(true);
options.setCleanSession(false);
options.setConnectionTimeout(10);
options.setSSLProperties(properties);
client.connect(options);`

I'm facing

MqttException (0) - javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target


问:
Validation multiple insert data laravel ajax
i need some help.
I want to store multiple data and validation using laravel ajax, and i want to display error validation like that :

In inspect elemen, error validation is displayed, but when i want displayed in bottom form input, error validation not displayed.

This my validation in controller

```<code>$val    =    Validator::make($request->all(), [
                 'nim.*'     =>  'required',
                 'abs.*'     =>  'required|numeric|between:1,100.00',
                 'tgs.*'     =>  'required|numeric|between:1,100.00',
                 'utsm.*'    =>  'required|numeric|between:1,100.00',
                 'uasm.*'    =>  'required|numeric|between:1,100.00',
             ],
             [
                 'nim.*.required'    =>  'NIM harus diisi',
                 'abs.*.required'    =>  'Kehadiran harus diisi',
                 'abs.*.numeric'     =>  'Kehadiran harus angka',
                 'abs.*.between'     =>  'Kehadiran antara angka 1.00 - 100.00',
                 'tgs.*.required'    =>  'Tugas harus diisi',
                 'tgs.*.numeric'     =>  'Tugas harus angka',
                 'tgs.*.between'     =>  'Tugas antara angka 1.00 - 100.00',
                 'utsm.*.required'   =>  'UTS harus diisi',
                 'utsm.*.numeric'    =>  'UTS harus angka',
                 'utsm.*.between'    =>  'UTS antara angka 1.00 - 100.00',
                 'uasm.*.required'   =>  'UAS harus diisi',
                 'uasm.*.numeric'    =>  'UAS harus angka',
                 'uasm.*.between'    =>  'UAS antara angka 1.00 - 100.00',
             ]);

            if($val->fails()) {
                return response()->json(['error' => $val->errors()]);
            }
</code>```

This my view for form input data and ajax

```<code><form id="storeNilai" method="post">
@csrf

<tbody>
  @php $no = 1; @endphp
  @foreache ($mahasiswa as $mhs)
    <tr>
      <td class="text-center">{{ $no++ }}</td>
      <td>
        <input type="hidden" name="nim[]" id="nim[]" value="{{ $mhs->nim }}" readonly>
        {{ $mhs->nim }}
      </td>
      <td>{{ $mhs->name }}</td>
      <td>
        <input type="text" class="form-control" size="1" name="abs[]" id="abs[]">
        <div class="fv-plugins-message-container">
          <div class="fv-help-block" id="abs_error"></div>
        </div>
      </td>

      <td>
        <input type="text" class="form-control" size="1" name="tgs[]" id="tgs[]">
          <div class="fv-plugins-message-container">
            <div class="fv-help-block" id="tgs_error"></div>
          </div>
      </td>

      <td>
        <input type="text" class="form-control" size="1" name="utsm[]" id="utsm[]">
        <div class="fv-plugins-message-container">
          <div class="fv-help-block" id="utsm_error"></div>
        </div>
      </td>

      <td>
        <input type="text" class="form-control" size="1" name="uasm[]" id="uasm[]">
        <div class="fv-plugins-message-container">
          <div class="fv-help-block" id="uasm_error"></div>
        </div>
      </td>
    </tr>
  @endforeach
</tbody>
<button type="submit" class="btn btn-primary ml-1">Simpan</button>
</form>

<script>
$(document).ready(function () {
  $('#storeNilai').on('submit', function (e) {
    e.preventDefault();

    $('#abs_error').html();
    $('#tgs_error').html();
    $('#utsm_error').html();
    $('#uasm_error').html();

    $.ajax({
      url: "{{ route('input-nilai.post') }}",
      method: 'POST',
      data: new FormData(this),
      contentType: false,
      cache: false,
      processData: false,
      dataType:"json",

      success: function(data) {
        if(data.errors) {
          if(data.error.abs) {
            $("#abs_error").html(data.error.abs[0]);
            $("#abs").addClass("is-invalid");
          }

          if(data.error.tgs) {
            $("#tgs_error").html(data.error.tgs[0]);
            $("#tgs").addClass("is-invalid");
          }

          if(data.error.utsm) {
            $("#utsm_error").html(data.error.utsm[0]);
            $("#utsm").addClass("is-invalid");
          }

          if(data.error.uasm) {
            $("#uasm_error").html(data.error.uasm[0]);
            $("#uasm").addClass("is-invalid");
          }
        }
      },
    });
  });
});
</script>
</code>```

Thank's for your help.

Body:
i need some help.
I want to store multiple data and validation using laravel ajax, and i want to display error validation like that :

In inspect elemen, error validation is displayed, but when i want displayed in bottom form input, error validation not displayed.

This my validation in controller

$val    =    Validator::make($request->all(), [
                 'nim.*'     =>  'required',
                 'abs.*'     =>  'required|numeric|between:1,100.00',
                 'tgs.*'     =>  'required|numeric|between:1,100.00',
                 'utsm.*'    =>  'required|numeric|between:1,100.00',
                 'uasm.*'    =>  'required|numeric|between:1,100.00',
             ],
             [
                 'nim.*.required'    =>  'NIM harus diisi',
                 'abs.*.required'    =>  'Kehadiran harus diisi',
                 'abs.*.numeric'     =>  'Kehadiran harus angka',
                 'abs.*.between'     =>  'Kehadiran antara angka 1.00 - 100.00',
                 'tgs.*.required'    =>  'Tugas harus diisi',
                 'tgs.*.numeric'     =>  'Tugas harus angka',
                 'tgs.*.between'     =>  'Tugas antara angka 1.00 - 100.00',
                 'utsm.*.required'   =>  'UTS harus diisi',
                 'utsm.*.numeric'    =>  'UTS harus angka',
                 'utsm.*.between'    =>  'UTS antara angka 1.00 - 100.00',
                 'uasm.*.required'   =>  'UAS harus diisi',
                 'uasm.*.numeric'    =>  'UAS harus angka',
                 'uasm.*.between'    =>  'UAS antara angka 1.00 - 100.00',
             ]);

            if($val->fails()) {
                return response()->json(['error' => $val->errors()]);
            }

This my view for form input data and ajax

<form id="storeNilai" method="post">
@csrf

  @php $no = 1; @endphp
  @foreache ($mahasiswa as $mhs)

      {{ $no++ }}

        <input type="hidden" name="nim[]" id="nim[]" value="{{ $mhs->nim }}" readonly>
        {{ $mhs->nim }}

      {{ $mhs->name }}

        <input type="text" class="form-control" size="1" name="abs[]" id="abs[]">

        <input type="text" class="form-control" size="1" name="tgs[]" id="tgs[]">

        <input type="text" class="form-control" size="1" name="utsm[]" id="utsm[]">

        <input type="text" class="form-control" size="1" name="uasm[]" id="uasm[]">

  @endforeach

<button type="submit" class="btn btn-primary ml-1">Simpan</button>
</form>

Thank's for your help.


问:
component and directive have same life cycle hook
Directive has same lifecycle hook when to use these lifecyclehook in live environment.

if directive don't have View .then where we use lifecyclehook