问:
match sentence in multilines
I got a problem to slove how to matching a sentence in a paragraph. the sentences in the paragraph will be in multilines,usually a line will be a part of a sentence.
for example:

```<code>search_str = "I have a pen"
</code>```

paragraph can be like:

```<code>My name is XXX.
I have # 01
a pen which I like it. # 02
Because I have a pen. So I #03
can have a pen pen. # 04
I have a pen. I have a pen xxx. # 05
</code>```

the desired output is:

```<code>I have
a pen
I have a pen
\[nothing...\]
I have a pen I have a pen
</code>```
```<code>search_sentence = "for learning distinctive features among"

raw_sentences = ["methods it is possible to among recognize Instagram filters and at-", # 01
                 "tenuate the sensor pattern noise signal in images. Amerini", # 02
                 "et al. [10] introduced a CNN for learning distinctive features", # 03
                 "among social networks. for learning distinctive features among from the histogram of the discrete co-", # 04
                 "sine transform (DCT) coefficients and the noise residual of", # 05
                 "the images. Phan et al. [11] proposed a method to track mul-", # 06
                 "tiple image sharing on social networks by using a CNN for ar-", # 07
                 "chitecture able to learn", # 08
                 "et al. [10] introduced a CNN for learning distinctive features among it is possible to among recognize Instagram filters", # 09
                 "and at- tenuate xx"] # 10

def longest_intersection(string1, string2):
    list1 = string1.split()
    list2 = string2.split()
    intersection = []
    for word in list1:
        if word in list2 and word == list2[0]:
            intersection.append(word)
            list2.remove(word)
    if " ".join(intersection) in search_sentence:
        return intersection

for line in raw_sentences:

    one_line_match = ' '.join(longest_intersection(line.strip(), search_sentence))

    if one_line_match != "" and one_line_match[0] == search_sentence[0]:
        print(one_line_match)
        search_sentence = search_sentence.replace(one_line_match, "").strip()
        if search_sentence == "":
            search_sentence = "for learning distinctive features among"
    else:
        print("[no matched sentences!]")
        search_sentence = "for learning distinctive features among"

</code>```

for now, my outputs are:

```<code>[no matched sentences!] [no matched sentences!] for learning distinctive features among [no matched sentences!] [no matched sentences!] for [no matched sentences!] for learning distinctive features among [no matched sentences!]
</code>```

but I desired output will be like this:

```<code>[no matched sentences!]
[no matched sentences!]
for learning distinctive features
among for learning distinctive features among
[no matched sentences!]
[no matched sentences!]
[no matched sentences!]
[no matched sentences!]
for learning distinctive features among
[no matched sentences!]
</code>```

Title: match sentence in multilines

Body:
I got a problem to slove how to matching a sentence in a paragraph. the sentences in the paragraph will be in multilines,usually a line will be a part of a sentence.
for example:

search_str = "I have a pen"

paragraph can be like:

My name is XXX.
I have # 01
a pen which I like it. # 02
Because I have a pen. So I #03
can have a pen pen. # 04
I have a pen. I have a pen xxx. # 05

the desired output is:

I have
a pen
I have a pen
\[nothing...\]
I have a pen I have a pen

search_sentence = "for learning distinctive features among"

raw_sentences = ["methods it is possible to among recognize Instagram filters and at-", # 01
                 "tenuate the sensor pattern noise signal in images. Amerini", # 02
                 "et al. [10] introduced a CNN for learning distinctive features", # 03
                 "among social networks. for learning distinctive features among from the histogram of the discrete co-", # 04
                 "sine transform (DCT) coefficients and the noise residual of", # 05
                 "the images. Phan et al. [11] proposed a method to track mul-", # 06
                 "tiple image sharing on social networks by using a CNN for ar-", # 07
                 "chitecture able to learn", # 08
                 "et al. [10] introduced a CNN for learning distinctive features among it is possible to among recognize Instagram filters", # 09
                 "and at- tenuate xx"] # 10

def longest_intersection(string1, string2):
    list1 = string1.split()
    list2 = string2.split()
    intersection = []
    for word in list1:
        if word in list2 and word == list2[0]:
            intersection.append(word)
            list2.remove(word)
    if " ".join(intersection) in search_sentence:
        return intersection

for line in raw_sentences:

    one_line_match = ' '.join(longest_intersection(line.strip(), search_sentence))

    if one_line_match != "" and one_line_match[0] == search_sentence[0]:
        print(one_line_match)
        search_sentence = search_sentence.replace(one_line_match, "").strip()
        if search_sentence == "":
            search_sentence = "for learning distinctive features among"
    else:
        print("[no matched sentences!]")
        search_sentence = "for learning distinctive features among"

for now, my outputs are:

[no matched sentences!] [no matched sentences!] for learning distinctive features among [no matched sentences!] [no matched sentences!] for [no matched sentences!] for learning distinctive features among [no matched sentences!]

but I desired output will be like this:

[no matched sentences!]
[no matched sentences!]
for learning distinctive features
among for learning distinctive features among
[no matched sentences!]
[no matched sentences!]
[no matched sentences!]
[no matched sentences!]
for learning distinctive features among
[no matched sentences!]


来源: stackexchange

问:
Java ignore a specific symbol after another specific symbol
I have a .csv file. Data is divided by commas and I need to extract information out this file. Thing is if i just write this it works but partially:

```<code>    String file = "FinalProject/src/Data.csv";
    BufferedReader rd = null;
    String line = "";
    HashSet<String> platforms = new HashSet<String>();

    try
    {
        rd = new BufferedReader(new FileReader(file));
        rd.readLine();
        while ((line = rd.readLine())!=null)
        {
            String [] arr = line.split("\"");
            var words = new ArrayList<String>();

            for(int i =0; i < arr.length;i++)
            {
                if(i % 2 == 0)
                {
                    words.addAll(Arrays.asList(arr[i].split(",")));
                }
                else
                {
                    words.add(arr[i]);
                }
                platforms.add(words.get(2));

            }

        }
    }
    catch (Exception e)
    {
        System.out.println("");
    }
    finally
    {
        try
        {
            rd.close();
        }
        catch (IOException e)
        {

            throw new RuntimeException(e);
        }
    }
</code>```

When I check the contents of Set and extract the same data out of the database created from this .csv file it shows difference. For example - my set has 38 values, when the database has 40, all of them are unique( nothing is repeated). I think the problem is caused by separation of data in .csv file with comma signs. Because some of these signs are inside of quotes and this probably causes a loss of the potential values that i need. Is there any solution to that problem? Or perhaps there is a more efficient way to deal with the comma sings inside of the quotes so that they are ignored?

ContentLicense: CC BY-SA 4.0

Body:
I have a .csv file. Data is divided by commas and I need to extract information out this file. Thing is if i just write this it works but partially:

    String file = "FinalProject/src/Data.csv";
    BufferedReader rd = null;
    String line = "";
    HashSet<String> platforms = new HashSet<String>();

    try
    {
        rd = new BufferedReader(new FileReader(file));
        rd.readLine();
        while ((line = rd.readLine())!=null)
        {
            String [] arr = line.split("\"");
            var words = new ArrayList<String>();

            for(int i =0; i < arr.length;i++)
            {
                if(i % 2 == 0)
                {
                    words.addAll(Arrays.asList(arr[i].split(",")));
                }
                else
                {
                    words.add(arr[i]);
                }
                platforms.add(words.get(2));

            }

        }
    }
    catch (Exception e)
    {
        System.out.println("");
    }
    finally
    {
        try
        {
            rd.close();
        }
        catch (IOException e)
        {

            throw new RuntimeException(e);
        }
    }

When I check the contents of Set and extract the same data out of the database created from this .csv file it shows difference. For example - my set has 38 values, when the database has 40, all of them are unique( nothing is repeated). I think the problem is caused by separation of data in .csv file with comma signs. Because some of these signs are inside of quotes and this probably causes a loss of the potential values that i need. Is there any solution to that problem? Or perhaps there is a more efficient way to deal with the comma sings inside of the quotes so that they are ignored?


问:
java.awt.robot is not capturing screen in mac os x ventura
I am trying to capture screen in mac os ventura using java.awt.robort but it captures the desktop image every time but not the image of current application running. As shown in https://i.stack.imgur.com/KABpT.png. Also it does not captures the second screen attached to laptop.</p>
```<code>Rectangle screenRect = new Rectangle(0, 0, 0, 0);
            for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
                screenRect =    screenRect.union(gd.getDefaultConfiguration().getBounds());
            }
            BufferedImage screenFullImage = new   Robot().createScreenCapture(screenRect);

            /*
             * final BufferedImage screenFullImage = new Robot() .createScreenCapture(new
             * Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
             */
            ImageIO.write(screenFullImage, AppConstants.JPG_FORMAT, new     File(imageFilePath.toString()));
</code>```

Body:
I am trying to capture screen in mac os ventura using java.awt.robort but it captures the desktop image every time but not the image of current application running. As shown in https://i.stack.imgur.com/KABpT.png. Also it does not captures the second screen attached to laptop.

Rectangle screenRect = new Rectangle(0, 0, 0, 0);
            for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
                screenRect =    screenRect.union(gd.getDefaultConfiguration().getBounds());
            }
            BufferedImage screenFullImage = new   Robot().createScreenCapture(screenRect);

            /*
             * final BufferedImage screenFullImage = new Robot() .createScreenCapture(new
             * Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
             */
            ImageIO.write(screenFullImage, AppConstants.JPG_FORMAT, new     File(imageFilePath.toString()));


问:
Cannot destructure response from google after oauth sign in ReactJS
Hi I have managed to successfully login using Google sso oauth but after I set an object with the response.profileObj I can't seem to reuse it.

```<code>const [profile, setProfile] = useState();
// console.log(res.profileObj) shows all the information I need name, email, profile pic
setProfile(res.profileObj);
</code>```

On the html side, when I use profile.name it shows the name but when I try to console log profile.name it returns undefined.

I have read the question from Cannot destructure property 'name' of 'response.profileObj' as it is undefined but in my case response.credential does not return anything for me

Body:
Hi I have managed to successfully login using Google sso oauth but after I set an object with the response.profileObj I can't seem to reuse it.

const [profile, setProfile] = useState();
// console.log(res.profileObj) shows all the information I need name, email, profile pic
setProfile(res.profileObj);

On the html side, when I use profile.name it shows the name but when I try to console log profile.name it returns undefined.

I have read the question from Cannot destructure property 'name' of 'response.profileObj' as it is undefined but in my case response.credential does not return anything for me


问:
How to display Slack slash command in channel
I'm trying to make a slack bot that responds to a slash command. However I want it to still post the original slash command in the channel, followed by the bot's response. From my understanding of the documentation, this should happen as long as the response_type='in_channel' parameter is specified. When I implement this it still doesn't show my slash command in the chat. Any suggestions why this would be?

```<code>@app.route("/praise", methods=["POST"])
def praise():
  # Get the request data
  data = request.form

  # Get the channel ID and command text from the request data
  channel_id = data.get('channel_id')
  command_text = data.get('text')

  try:
    # Use the WebClient to send a message to the channel
    response = client.chat_postMessage(
      channel=channel_id,
      text=f'{command_text} testing',  # Include the command text in the response
      response_type='in_channel'  # Make the response visible in the channel
    )
  except SlackApiError as e:
    # An error occurred
    print(f'Error: {e}')
    return e, 500

  # Create a response object with a 200 status code and a JSON body
  resp = Response(response=response, status=200, mimetype='application/json')

  # Return the response object
  return resp
</code>```

Documentation:

When the response_type is in_channel, both the response message and
the initial Slash Command typed by the user will be shared in the
channel:

Body:
I'm trying to make a slack bot that responds to a slash command. However I want it to still post the original slash command in the channel, followed by the bot's response. From my understanding of the documentation, this should happen as long as the response_type='in_channel' parameter is specified. When I implement this it still doesn't show my slash command in the chat. Any suggestions why this would be?

@app.route("/praise", methods=["POST"])
def praise():
  # Get the request data
  data = request.form

  # Get the channel ID and command text from the request data
  channel_id = data.get('channel_id')
  command_text = data.get('text')

  try:
    # Use the WebClient to send a message to the channel
    response = client.chat_postMessage(
      channel=channel_id,
      text=f'{command_text} testing',  # Include the command text in the response
      response_type='in_channel'  # Make the response visible in the channel
    )
  except SlackApiError as e:
    # An error occurred
    print(f'Error: {e}')
    return e, 500

  # Create a response object with a 200 status code and a JSON body
  resp = Response(response=response, status=200, mimetype='application/json')

  # Return the response object
  return resp

Documentation:

When the response_type is in_channel, both the response message and
the initial Slash Command typed by the user will be shared in the
channel:


问:
how to import individuals in its original name into protege not a hash string?
enter image description here
I am using cellfie to import individuals into protege, but when I use the axiom:

Individual: @A*(mm:hashEncode)
Types: NutritionalInformation

the individuals' name in the protege are not the same as that in the excel. Individual's name is in hash string based on the cell value in cell, but I want all the imported individuals is in its own name in excel, which could help me identify different individuals, could anyone know how to solve this problem?


问:
Laravel how to use column from subquery in another subquery?
```<code>User::query()
->addSelect(['col_a' => function($q){
   $q->select('table_a.some_col')
   ->from('table_a')
   ->whereColumn('users.some_col', 'table_a.some_col')
   ->limit(1);
}])
->addSelect(['col_b' => function($q){
   $q->select(DB::raw("table_b.some_col * col_a"))
   ->from('table_b')
   ->whereColumn('users.some_col', 'table_b.some_col')
   ->limit(1);
}])
->get();
</code>```

How can I use col_a in my second addSelect() function? Query above will cause error unknown column 'col_a'

Body:
User::query()
->addSelect(['col_a' => function($q){
   $q->select('table_a.some_col')
   ->from('table_a')
   ->whereColumn('users.some_col', 'table_a.some_col')
   ->limit(1);
}])
->addSelect(['col_b' => function($q){
   $q->select(DB::raw("table_b.some_col * col_a"))
   ->from('table_b')
   ->whereColumn('users.some_col', 'table_b.some_col')
   ->limit(1);
}])
->get();

How can I use col_a in my second addSelect() function? Query above will cause error unknown column 'col_a'


问:
Tailwind CSS — How do I reference another value defined in my theme in the config file?
I am trying to set up a custom Tailwind CSS theme in the tailwind.config.js file with a color palette that consists of two groups of color: core and derived colors.

```<code>module.exports = {
  theme: {
    colors: {
      core: {
        neutral: {
          // ...
          500: '#63727D'
        }
      },
      derived: {
        // ...
        text: {
          muted: // Here I want to reference a theme.colors.core.neutral.500 value, #63727D.
        }
      }
    }
  }
}
</code>```

I can't seem to figure referencing out, though. What I've tried so far was:

Reading a TailwindCSS documentation for theme configuration and referencing other values. The closest thing to what I wanted to achieve was the "You can't use functions for individual values" example. But I couldn't extract any solution for me out of that.

Using a getter. I coulnd't get this to work, as the color of the text is not on the same level in my object's hierarchy as the neutral.500 color, and setting it to get muted() { return this.theme.colors.core.neutral[500] } didn't work.

Defining my core color values in a separate object. While this worked technically, I found that to be a rather short-sighted solution, as I can soon find myself in a need of referencing/derived core color values between each other, too.

Unless I should adopt a whole different way of thinking about it, my ideal solution would be to keep all my color definitions within the module.exports with the ability to cross-reference values inside.

Body:
I am trying to set up a custom Tailwind CSS theme in the tailwind.config.js file with a color palette that consists of two groups of color: core and derived colors.

module.exports = {
  theme: {
    colors: {
      core: {
        neutral: {
          // ...
          500: '#63727D'
        }
      },
      derived: {
        // ...
        text: {
          muted: // Here I want to reference a theme.colors.core.neutral.500 value, #63727D.
        }
      }
    }
  }
}

I can't seem to figure referencing out, though. What I've tried so far was:

Reading a TailwindCSS documentation for theme configuration and referencing other values. The closest thing to what I wanted to achieve was the "You can't use functions for individual values" example. But I couldn't extract any solution for me out of that.

Using a getter. I coulnd't get this to work, as the color of the text is not on the same level in my object's hierarchy as the neutral.500 color, and setting it to get muted() { return this.theme.colors.core.neutral[500] } didn't work.

Defining my core color values in a separate object. While this worked technically, I found that to be a rather short-sighted solution, as I can soon find myself in a need of referencing/derived core color values between each other, too.

Unless I should adopt a whole different way of thinking about it, my ideal solution would be to keep all my color definitions within the module.exports with the ability to cross-reference values inside.


问:
How to connect to an MQTT server using a SAS token, in LwIP?
I'm know working on establishing a connection to an Azure test IOT hub but using a SAS token and not a device certificate as mentioned here in the Azure certificates change

I was using this function from LwIP stack to make a tls config using my device certifcate

```<code>altcp_tls_create_config_client_2wayauth
</code>```

and

```<code>mqtt_client_connect
</code>```

to connect to the server
What I need to know is:

Should I use another altcp_tls function to connect using a SAS token?

How can I check that the TLS handshake is done? because this is what I need to know

I appreciate any help

I tried to use the connection string from the article as a client password in MQTT client parameters, but I don't know if the TLS handshake is done or not

Body:
I'm know working on establishing a connection to an Azure test IOT hub but using a SAS token and not a device certificate as mentioned here in the Azure certificates change

I was using this function from LwIP stack to make a tls config using my device certifcate

altcp_tls_create_config_client_2wayauth

and

mqtt_client_connect

to connect to the server
What I need to know is:

Should I use another altcp_tls function to connect using a SAS token?

How can I check that the TLS handshake is done? because this is what I need to know

I appreciate any help

I tried to use the connection string from the article as a client password in MQTT client parameters, but I don't know if the TLS handshake is done or not


问:
Is there a response size limit imposed by DigitalOcean App Platform?
I have successfully deployed a Python (FastAPI) API on the Digital Oceans App Platform. There is a POST API endpoint that returns an Excel file as a response. When the file size is 7 KB, it is returning fine. When the file size is 80 KB, a 0 bytes file gets downloaded.

The cURL I am using is similar to

```<code>curl -X 'POST' \
  'https://example.com/api' \
  -H 'accept: */*' \
  -H 'header: value' \
  -H 'Content-Type: multipart/form-data' \
  -F 'myfile=@myfile.pdf;type=application/pdf' \
  --output output.xlsx
</code>```

When the output.xlsx is less than 10 KB, it is getting saved just fine, however when it is more, the output is a 0 bytes file.

Is there a limit on the response size limit on the DO App Platform? Could not find any such thing mentioned on https://docs.digitalocean.com/products/app-platform/details/limits/

The API code is similar to https://fastapi.tiangolo.com/advanced/custom-response/#fileresponse

Not using any NGINX proxy as well. Just a simple Docker based deployment as given in https://fastapi.tiangolo.com/deployment/docker/#build-a-docker-image-for-fastapi

Body:
I have successfully deployed a Python (FastAPI) API on the Digital Oceans App Platform. There is a POST API endpoint that returns an Excel file as a response. When the file size is 7 KB, it is returning fine. When the file size is 80 KB, a 0 bytes file gets downloaded.

The cURL I am using is similar to

curl -X 'POST' \
  'https://example.com/api' \
  -H 'accept: */*' \
  -H 'header: value' \
  -H 'Content-Type: multipart/form-data' \
  -F 'myfile=@myfile.pdf;type=application/pdf' \
  --output output.xlsx

When the output.xlsx is less than 10 KB, it is getting saved just fine, however when it is more, the output is a 0 bytes file.

Is there a limit on the response size limit on the DO App Platform? Could not find any such thing mentioned on https://docs.digitalocean.com/products/app-platform/details/limits/

The API code is similar to https://fastapi.tiangolo.com/advanced/custom-response/#fileresponse

Not using any NGINX proxy as well. Just a simple Docker based deployment as given in https://fastapi.tiangolo.com/deployment/docker/#build-a-docker-image-for-fastapi


问:
How do i catch a tensorboard exception inside model.fit() that breaks training
We are running a custom training on vertexAI that runs over multiple days.
Now we added tensorboard support using callbacks:

```<code>myCallbacks.append(tf.keras.callbacks.TensorBoard(log_dir=os.environ['AIP_TENSORBOARD_LOG_DIR'], histogram_freq=1))
</code>```

After some epochs we get an exception inside model.fit() due to some temporary network problems:

```<code>2022-12-18 18:24:32.612516: W tensorflow/core/framework/op_kernel.cc:1745] OP_REQUIRES failed at summary_kernels.cc:150 : FAILED_PRECONDITION: Error executing an HTTP request: libcurl code 6 meaning 'Couldn't resolve host name', error details: Could not resolve host: www.googleapis.com
         when resuming upload gs://dx-ai-train/WorkingDir_3D_dinbv217/aprl18/config_tb/logs/train/events.out.tfevents.1671295725.66e23cc7db45.1.0.v2
        Failed to flush 11 events to gs://dx-ai-train/WorkingDir_3D_dinbv217/aprl18/config_tb/logs/train/events.out.tfevents.1671295725.66e23cc7db45.1.0.v2
        Could not flush events file.
</code>```

I can't catch the exception, since the catch would be outside of model.fit() already.

Maybe add my own callback, and then relay to the Keras TensorBoard callback inside a try/catch construction?

Body:
We are running a custom training on vertexAI that runs over multiple days.
Now we added tensorboard support using callbacks:

myCallbacks.append(tf.keras.callbacks.TensorBoard(log_dir=os.environ['AIP_TENSORBOARD_LOG_DIR'], histogram_freq=1))

After some epochs we get an exception inside model.fit() due to some temporary network problems:

2022-12-18 18:24:32.612516: W tensorflow/core/framework/op_kernel.cc:1745] OP_REQUIRES failed at summary_kernels.cc:150 : FAILED_PRECONDITION: Error executing an HTTP request: libcurl code 6 meaning 'Couldn't resolve host name', error details: Could not resolve host: www.googleapis.com
         when resuming upload gs://dx-ai-train/WorkingDir_3D_dinbv217/aprl18/config_tb/logs/train/events.out.tfevents.1671295725.66e23cc7db45.1.0.v2
        Failed to flush 11 events to gs://dx-ai-train/WorkingDir_3D_dinbv217/aprl18/config_tb/logs/train/events.out.tfevents.1671295725.66e23cc7db45.1.0.v2
        Could not flush events file.

I can't catch the exception, since the catch would be outside of model.fit() already.

Maybe add my own callback, and then relay to the Keras TensorBoard callback inside a try/catch construction?


问:
HTML to org.w3c.dom.Document using Thymeleaf
I am currently using Thymeleaf to parse a HTML document and output it as a String which is then used to perform further operations.

I now need to pass Thymeleaf's output to a library which expects a org.w3c.dom.Document instead of a plain String, but I can't figure out how to do it without using another tool (I'd prefer not to do so).

Is there a way to make Thymeleaf output a org.w3c.dom.Document?


问:
SpringApplicationAotProcessor does not return when processing Spring AOT
I'm trying to generate AOT data for a Spring Boot 3 application. When I run mvn -Pnative native:compile the Spring application is started using org.springframework.boot.SpringApplicationAotProcessor. The problem is that the process doesn't quit even after the main method is finished. I copied the class to my code, using the original package, i.e. overwriting it, and added System.exit(0); to the main method and it works. So that's a workaround but it doesn't feel right.


问:
Receiving Unterminated CSV Quoted Field Error while inserting into Postgres using Copy
I am trying to insert CSV file into Postgres using Copy command at the time I am receiving Unterminated CSV Quoted Field error (out of 100 CSV files I am getting this error for 2-5 files).

I will usually identify the error file then I will open the same using Microsoft Excel and I will simply save without doing anything changes. Then I will try to copy the same file again into Postgres, this time it was working the data get inserted. Can anyone please explain how its possible simply opening and saving the file using Excel will resolve this error?


问:
KeyPairGenerator RSA512 signing error on JWT
Autogenerated RSA (512bit) keypair gives key length error while signing or parsing Claims. when i try to use 1024bit RSA code is working, but still JWT configured as RS512.
When i try to check token on jwt debugger it gives invalid signature.

i generated 1024bit RSA, how RS512 is working with 1024bit RSA?

codes are as follows:

public JwtUtil() throws Exception {
       KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
       kpg.initialize(512);
       KeyPair kp = kpg.generateKeyPair();

       System.out.println(kp.getPrivate());
       System.out.println("-----BEGIN PRIVATE KEY-----");
       System.out.println(Base64.getEncoder().encodeToString(kp.getPrivate().getEncoded()));
       System.out.println("------END PRIVATE KEY------");
       System.out.println("-----BEGIN PUBLIC KEY-----");
       System.out.println(Base64.getEncoder().encodeToString(kp.getPublic().getEncoded()));
       System.out.println("------END PUBLIC KEY------");

       secret_key = kp.getPrivate();
}
```
<p><strong>keypair output:</strong></p>
```SunRsaSign RSA private CRT key, 512 bits
  params: null
  modulus: 7601809965540561359509816601988074293551191141989978875146926955998131556140998184761208135689250313813989553710817084679571823318927874570265090788702603
  private exponent: 1189620565582556377361378748950816942409036366514323562926390937344047442510036558397360889583782021886617860703448643224975214481114339798954443100484737
-----BEGIN PRIVATE KEY-----
MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAkSTfg/fwSSMMFfGOh76yOBGgX9LrcevnQpWNrt5/CDRsYSKTg/tSzCbqEAZLSMV1LousZd/7gPfHtCmtWww5iwIDAQABAkAWtr6D2Hkx+NobVQIJHD6np5qBZHCUE2bNdLoHc6pNjimLwZKR45KQv8BIrymijPNo6MPTGrydilujTVg6ZXSBAiEApDL4gzbMNS6jHe0OKVdnOGwCWylPqdzzx46wXCKDcVcCIQDiSqRQg77HpD8UNo1w+f1wiFKvMWrI2PVk2PgH8RqU7QIgXQogtMEFHxFpDhj30EcdTuQsxZj38ekoHShmGB7aWgsCIDtHcmPlH0UNMbkJ0WOXGV0xWPer6l1S+HXCoLbz4hLBAiEAjjJv/Mpo3J/RAvvkikXJX3WDgeGCILklnvM/MZ38V3A=
------END PRIVATE KEY------
-----BEGIN PUBLIC KEY-----
MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJEk34P38EkjDBXxjoe+sjgRoF/S63Hr50KVja7efwg0bGEik4P7Uswm6hAGS0jFdS6LrGXf+4D3x7QprVsMOYsCAwEAAQ==
------END PUBLIC KEY------
```
<p><strong>signing function:</strong></p>
<pre class="lang-java prettyprint-override"><code>private String createToken(Map<String, Object> claims, String subject) {
       return Jwts.builder().setClaims(claims).setSubject(subject)
              .setIssuedAt(new Date(System.currentTimeMillis()))
              .setExpiration(new Date(System.currentTimeMillis() + 1000 * expire_duration_sec))
              .signWith(SignatureAlgorithm.RS512, secret_key)
              .compact();
}
</code>```

Exception:

```<code>java.security.InvalidKeyException: Key is too short for this signature algorithm
    at java.base/sun.security.rsa.RSASignature.initCommon(RSASignature.java:138) ~[na:na]
    at java.base/sun.security.rsa.RSASignature.engineInitSign(RSASignature.java:115) ~[na:na]
    at java.base/sun.security.rsa.RSASignature.engineInitSign(RSASignature.java:104) ~[na:na]
    at java.base/java.security.Signature$Delegate.tryOperation(Signature.java:1318) ~[na:na]
    at java.base/java.security.Signature$Delegate.chooseProvider(Signature.java:1272) ~[na:na]
    at java.base/java.security.Signature$Delegate.engineInitSign(Signature.java:1356) ~[na:na]
    at java.base/java.security.Signature.initSign(Signature.java:635) ~[na:na]
    at io.jsonwebtoken.impl.crypto.RsaSigner.doSign(RsaSigner.java:54) ~[jjwt-0.9.1.jar:0.9.1]
    at io.jsonwebtoken.impl.crypto.RsaSigner.sign(RsaSigner.java:43) ~[jjwt-0.9.1.jar:0.9.1]
    at io.jsonwebtoken.impl.crypto.DefaultJwtSigner.sign(DefaultJwtSigner.java:45) ~[jjwt-0.9.1.jar:0.9.1]
    at io.jsonwebtoken.impl.DefaultJwtBuilder.compact(DefaultJwtBuilder.java:322) ~[jjwt-0.9.1.jar:0.9.1]
    at pw.cicek.jcms.core.auth.token.JwtUtil.createToken(JwtUtil.java:81) ~[classes/:na]
</code>```

Body:
Autogenerated RSA (512bit) keypair gives key length error while signing or parsing Claims. when i try to use 1024bit RSA code is working, but still JWT configured as RS512.
When i try to check token on jwt debugger it gives invalid signature.

i generated 1024bit RSA, how RS512 is working with 1024bit RSA?

codes are as follows:

public JwtUtil() throws Exception {
       KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
       kpg.initialize(512);
       KeyPair kp = kpg.generateKeyPair();

       System.out.println(kp.getPrivate());
       System.out.println("-----BEGIN PRIVATE KEY-----");
       System.out.println(Base64.getEncoder().encodeToString(kp.getPrivate().getEncoded()));
       System.out.println("------END PRIVATE KEY------");
       System.out.println("-----BEGIN PUBLIC KEY-----");
       System.out.println(Base64.getEncoder().encodeToString(kp.getPublic().getEncoded()));
       System.out.println("------END PUBLIC KEY------");

       secret_key = kp.getPrivate();
}

keypair output:

SunRsaSign RSA private CRT key, 512 bits
  params: null
  modulus: 7601809965540561359509816601988074293551191141989978875146926955998131556140998184761208135689250313813989553710817084679571823318927874570265090788702603
  private exponent: 1189620565582556377361378748950816942409036366514323562926390937344047442510036558397360889583782021886617860703448643224975214481114339798954443100484737
-----BEGIN PRIVATE KEY-----
MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAkSTfg/fwSSMMFfGOh76yOBGgX9LrcevnQpWNrt5/CDRsYSKTg/tSzCbqEAZLSMV1LousZd/7gPfHtCmtWww5iwIDAQABAkAWtr6D2Hkx+NobVQIJHD6np5qBZHCUE2bNdLoHc6pNjimLwZKR45KQv8BIrymijPNo6MPTGrydilujTVg6ZXSBAiEApDL4gzbMNS6jHe0OKVdnOGwCWylPqdzzx46wXCKDcVcCIQDiSqRQg77HpD8UNo1w+f1wiFKvMWrI2PVk2PgH8RqU7QIgXQogtMEFHxFpDhj30EcdTuQsxZj38ekoHShmGB7aWgsCIDtHcmPlH0UNMbkJ0WOXGV0xWPer6l1S+HXCoLbz4hLBAiEAjjJv/Mpo3J/RAvvkikXJX3WDgeGCILklnvM/MZ38V3A=
------END PRIVATE KEY------
-----BEGIN PUBLIC KEY-----
MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJEk34P38EkjDBXxjoe+sjgRoF/S63Hr50KVja7efwg0bGEik4P7Uswm6hAGS0jFdS6LrGXf+4D3x7QprVsMOYsCAwEAAQ==
------END PUBLIC KEY------

signing function:

private String createToken(Map<String, Object> claims, String subject) {
       return Jwts.builder().setClaims(claims).setSubject(subject)
              .setIssuedAt(new Date(System.currentTimeMillis()))
              .setExpiration(new Date(System.currentTimeMillis() + 1000 * expire_duration_sec))
              .signWith(SignatureAlgorithm.RS512, secret_key)
              .compact();
}

Exception:

java.security.InvalidKeyException: Key is too short for this signature algorithm
    at java.base/sun.security.rsa.RSASignature.initCommon(RSASignature.java:138) ~[na:na]
    at java.base/sun.security.rsa.RSASignature.engineInitSign(RSASignature.java:115) ~[na:na]
    at java.base/sun.security.rsa.RSASignature.engineInitSign(RSASignature.java:104) ~[na:na]
    at java.base/java.security.Signature$Delegate.tryOperation(Signature.java:1318) ~[na:na]
    at java.base/java.security.Signature$Delegate.chooseProvider(Signature.java:1272) ~[na:na]
    at java.base/java.security.Signature$Delegate.engineInitSign(Signature.java:1356) ~[na:na]
    at java.base/java.security.Signature.initSign(Signature.java:635) ~[na:na]
    at io.jsonwebtoken.impl.crypto.RsaSigner.doSign(RsaSigner.java:54) ~[jjwt-0.9.1.jar:0.9.1]
    at io.jsonwebtoken.impl.crypto.RsaSigner.sign(RsaSigner.java:43) ~[jjwt-0.9.1.jar:0.9.1]
    at io.jsonwebtoken.impl.crypto.DefaultJwtSigner.sign(DefaultJwtSigner.java:45) ~[jjwt-0.9.1.jar:0.9.1]
    at io.jsonwebtoken.impl.DefaultJwtBuilder.compact(DefaultJwtBuilder.java:322) ~[jjwt-0.9.1.jar:0.9.1]
    at pw.cicek.jcms.core.auth.token.JwtUtil.createToken(JwtUtil.java:81) ~[classes/:na]


问:
Selenium How to disable Chrome download alert pop-up "This type of file can harm your computer"
In selenium, How to disable Chrome download alert pop-up "This type of file can harm your computer"
I already use below scripts, but it looks like not work for my chrome version 107

```<code>        options.add_argument('--safebrowsing-disable-download-protection')
    options.add_argument('--safebrowsing-disable-extension-blacklist')
</code>```

Body:
In selenium, How to disable Chrome download alert pop-up "This type of file can harm your computer"
I already use below scripts, but it looks like not work for my chrome version 107

        options.add_argument('--safebrowsing-disable-download-protection')
    options.add_argument('--safebrowsing-disable-extension-blacklist')


问:
please how use hamburger menu to display all my content on my view alone with out the hamburger showing on desktop view
```<code>#mobile{
    display: none;
    align-items: center;
}
</code>```
```<code>#mobile{
        display: flex;
        align-items: center;
    }
</code>```

now the first display none is to hide hamburger menu from desktop view and second display flex is to show hamburger menu on mobile, now the display none worked but I'm to make it show on mobile with display flex but its not working

I tried display none to hide the hamburger menu from desktop view it worked but I want it show on the mobile view

Body:
#mobile{
    display: none;
    align-items: center;
}

#mobile{
        display: flex;
        align-items: center;
    }

now the first display none is to hide hamburger menu from desktop view and second display flex is to show hamburger menu on mobile, now the display none worked but I'm to make it show on mobile with display flex but its not working

I tried display none to hide the hamburger menu from desktop view it worked but I want it show on the mobile view


问:
Node excel to json time formatting
I was formatting a time column from excel using node xlxs library the column has time and when I converted to json the time format comes like this. The correct data from excel was

When this columns were converted to json I got like below

```<code>"from": 0.08333333333333333,
        "to": 0.125
</code>```

when formatting I have used cellDates: true, so what could be the cause? Thanks

Title: Node excel to json time formatting

Body:
I was formatting a time column from excel using node xlxs library the column has time and when I converted to json the time format comes like this. The correct data from excel was

When this columns were converted to json I got like below

"from": 0.08333333333333333,
        "to": 0.125

when formatting I have used cellDates: true, so what could be the cause? Thanks


问:
Export HTML table having if else conditions in TD's, 2 buttons '1' for IF condition and '2nd Button' for else condition
I have a table and I'm using Jquery Library "Table2Excel" to export my HTML Table into an Excel file. Now I've If (yes) else (no) condition in my 's. I want to export specific data with if(yes) td values and with other (no) conditions. This means 2 buttons (1 button export all the data with If (yes) conditions from td's and 2nd button get all the data with "No" condition.
Can this library help me out to solve this problem "Table2Excel".</p>
```<code>
` $("#btnExportone").click(function() {
        let table = document.getElementsByTagName("table");
            // console.log(table);
            TableToExcel.convert(table[0], {
                 // html code may contain multiple tables so here we are refering to 1st table tag
               name: `campaign_order.xlsx`, // fileName you could use any name
               sheet: {
                  name: 'Campaign Sheet' // sheetName
               }
            });
    });`
</code>```

Body:
I have a table and I'm using Jquery Library "Table2Excel" to export my HTML Table into an Excel file. Now I've If (yes) else (no) condition in my 's. I want to export specific data with if(yes) td values and with other (no) conditions. This means 2 buttons (1 button export all the data with If (yes) conditions from td's and 2nd button get all the data with "No" condition.
Can this library help me out to solve this problem "Table2Excel".

` $("#btnExportone").click(function() {
        let table = document.getElementsByTagName("table");
            // console.log(table);
            TableToExcel.convert(table[0], {
                 // html code may contain multiple tables so here we are refering to 1st table tag
               name: `campaign_order.xlsx`, // fileName you could use any name
               sheet: {
                  name: 'Campaign Sheet' // sheetName
               }
            });
    });`


问:
display all the correspondingstate values in dropdown based on another text field dropdown in django
Here when country name is given in the text field display all the states in the dropdown list

Here is my html code

```<code>    <div class="control-group">
        <label class="control-label pull-left" for="coubtry">Sales order</label>
        <div class="controls">
             <input name="country_name" type="text">
        </div>
   </div>
   <div class="control-group">
       <label class="control-label pull-left" for="capacity">Items</label>
       <div class="controls">
           <select name="states">
               <option value="">-----</option>
                      ( How to display the states in dropdown based on country given above??)
           </select>
       </div>
   </div>
</code>```

Here country is given in text and i need the states in dropdown list

Body:
Here when country name is given in the text field display all the states in the dropdown list

Here is my html code

        Sales order

             <input name="country_name" type="text">

       Items

           <select name="states">
               <option value="">-----</option>
                      ( How to display the states in dropdown based on country given above??)
           </select>

Here country is given in text and i need the states in dropdown list


问:
Haproxy clear table is not clearing all records
I have a stick-table in my Haproxy:

```<code>backend myback
stick-table  type ip  size 5k  expire 1h  store http_req_cnt
http-request track-sc0 src
</code>```

When I clear the table using:

echo "clear table myback" |  sudo socat stdio
/var/run/haproxy/admin.sock

And show table immediately after the above command, using:

echo "show table myback" |  sudo socat stdio
/var/run/haproxy/admin.sock

I still have some records in my table with a huge number of http_req_cnt which aren't possible to be in a few seconds. For example in the below image I have a record with 149 http_req_cnt which cannot be possible in a few seconds.

My Clear Table Image

Plus, that the number of http records for each IP in stick-table is not equal with the number of http requests in the log file of Haproxy. Does anyone have any idea why they are different?

Note that I want a solution that helps me with resetting the stick-table http_req_cnt counter after 1h. In other words, I want each record of my table to be the number of http requests in each hour and reset the counter in the first minute of each hour (done in config file not by socat commands). I was wondering if anyone would have any suggestions.
Thanks in advance

Body:
I have a stick-table in my Haproxy:

backend myback
stick-table  type ip  size 5k  expire 1h  store http_req_cnt
http-request track-sc0 src

When I clear the table using:

echo "clear table myback" |  sudo socat stdio
/var/run/haproxy/admin.sock

And show table immediately after the above command, using:

echo "show table myback" |  sudo socat stdio
/var/run/haproxy/admin.sock

I still have some records in my table with a huge number of http_req_cnt which aren't possible to be in a few seconds. For example in the below image I have a record with 149 http_req_cnt which cannot be possible in a few seconds.

My Clear Table Image

Plus, that the number of http records for each IP in stick-table is not equal with the number of http requests in the log file of Haproxy. Does anyone have any idea why they are different?

Note that I want a solution that helps me with resetting the stick-table http_req_cnt counter after 1h. In other words, I want each record of my table to be the number of http requests in each hour and reset the counter in the first minute of each hour (done in config file not by socat commands). I was wondering if anyone would have any suggestions.
Thanks in advance


问:
tachyons-css does not reflected on the output
Need Help, 'tachyons' is not working.
I installed it with npm install tachyons then imported it in the 'index.js' file using import 'tachyons' but it's not working.
It does not show any changes in the output although I put ’f1 tc’ in the className.
I’m sure npm is started and it is added in the json package file, and I have tried this few times.enter image description here

enter image description here


问:
Is there any way to combine two models of Yolov5 of different classes using Ensemble technique
I have two models trained ie. one for cvv and other for cards and no_cards. In detect.py command, How can I combine the two models pt files so that I can get one output after combining two models.

I've tried it in the way as:

```<code>weights=['runs/exp5/weights/best.pt', 'runs/exp6/weights/best.pt'], # model.pt path(s)
</code>```

I am getting an error. How can I modify this? Kindly suggest.

Thanks in advance.

I have also tried writing

```<code>weights=['yolov5x.pt', 'yolov5l.pt']
</code>```

and in yolov5x.pt, I've mentioned number of classes ie. nc as 2 and in yolov5l.pt as 1.

But I want to mention the trained model exp as well but where to write I am having doubt.

Body:
I have two models trained ie. one for cvv and other for cards and no_cards. In detect.py command, How can I combine the two models pt files so that I can get one output after combining two models.

I've tried it in the way as:

weights=['runs/exp5/weights/best.pt', 'runs/exp6/weights/best.pt'], # model.pt path(s)

I am getting an error. How can I modify this? Kindly suggest.

Thanks in advance.

I have also tried writing

weights=['yolov5x.pt', 'yolov5l.pt']

and in yolov5x.pt, I've mentioned number of classes ie. nc as 2 and in yolov5l.pt as 1.

But I want to mention the trained model exp as well but where to write I am having doubt.


问:
getting error while I am trying to compile my following code for connecting nodeMCU(ESP8266) to firebase
This is an error message that i am getting while I am trying to compile my code for arduino while connecting it to firebase. So, if any one can help me in this regard i will be very thankful to you in advance.

// error I am getting

```<code>Arduino: 1.8.19 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp: In member function 'virtual void FirebaseHttpClientEsp8266::begin(const string&)':

C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:47:50: error: no matching function for call to 'begin(const char*, const char [60])'

   47 |     http_.begin(url.c_str(), kFirebaseFingerprint);

      |                                                  ^

In file included from C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:9:

C:\Users\Nitro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:166:10: note: candidate: 'bool HTTPClient::begin(String, uint16_t, String)' (near match)

  166 |     bool begin(String host, uint16_t port, String uri = "/")  __attribute__ ((error("obsolete API, use ::begin(WiFiClient, host, port, uri)")));

      |          ^~~~~

C:\Users\Nitro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:166:10: note:   conversion of argument 2 would be ill-formed:

C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:47:30: error: invalid conversion from 'const char*' to 'uint16_t' {aka 'short unsigned int'} [-fpermissive]

   47 |     http_.begin(url.c_str(), kFirebaseFingerprint);

      |                              ^~~~~~~~~~~~~~~~~~~~

      |                              |

      |                              const char*

In file included from C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:9:

C:\Users\Nitro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:167:10: note: candidate: 'bool HTTPClient::begin(String, const uint8_t*)' (near match)

  167 |     bool begin(String url, const uint8_t httpsFingerprint[20])  __attribute__ ((error("obsolete API, use ::begin(WiFiClientSecure, ...)")));

      |          ^~~~~

C:\Users\Nitro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:167:10: note:   conversion of argument 2 would be ill-formed:

C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:47:30: error: invalid conversion from 'const char*' to 'const uint8_t*' {aka 'const unsigned char*'} [-fpermissive]

   47 |     http_.begin(url.c_str(), kFirebaseFingerprint);

      |                              ^~~~~~~~~~~~~~~~~~~~

      |                              |

      |                              const char*

C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp: In member function 'virtual void FirebaseHttpClientEsp8266::begin(const string&, const string&)':

C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:51:60: error: invalid conversion from 'const char*' to 'const uint8_t*' {aka 'const unsigned char*'} [-fpermissive]

   51 |     http_.begin(host.c_str(), kFirebasePort, path.c_str(), kFirebaseFingerprint);

      |                                                            ^~~~~~~~~~~~~~~~~~~~

      |                                                            |

      |                                                            const char*

In file included from C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:9:

C:\Users\Nitro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:168:70: note:   initializing argument 4 of 'bool HTTPClient::begin(String, uint16_t, String, const uint8_t*)'

  168 |     bool begin(String host, uint16_t port, String uri, const uint8_t httpsFingerprint[20])  __attribute__ ((error("obsolete API, use ::begin(WiFiClientSecure, ...)")));

      |                                                        ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~

exit status 1

Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

</code>```

I have tried all those solutions that were available online

giving preference

I have already installed all the required libraries.

Body:
This is an error message that i am getting while I am trying to compile my code for arduino while connecting it to firebase. So, if any one can help me in this regard i will be very thankful to you in advance.

// error I am getting

Arduino: 1.8.19 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp: In member function 'virtual void FirebaseHttpClientEsp8266::begin(const string&)':

C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:47:50: error: no matching function for call to 'begin(const char*, const char [60])'

   47 |     http_.begin(url.c_str(), kFirebaseFingerprint);

      |                                                  ^

In file included from C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:9:

C:\Users\Nitro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:166:10: note: candidate: 'bool HTTPClient::begin(String, uint16_t, String)' (near match)

  166 |     bool begin(String host, uint16_t port, String uri = "/")  __attribute__ ((error("obsolete API, use ::begin(WiFiClient, host, port, uri)")));

      |          ^~~~~

C:\Users\Nitro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:166:10: note:   conversion of argument 2 would be ill-formed:

C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:47:30: error: invalid conversion from 'const char*' to 'uint16_t' {aka 'short unsigned int'} [-fpermissive]

   47 |     http_.begin(url.c_str(), kFirebaseFingerprint);

      |                              ^~~~~~~~~~~~~~~~~~~~

      |                              |

      |                              const char*

In file included from C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:9:

C:\Users\Nitro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:167:10: note: candidate: 'bool HTTPClient::begin(String, const uint8_t*)' (near match)

  167 |     bool begin(String url, const uint8_t httpsFingerprint[20])  __attribute__ ((error("obsolete API, use ::begin(WiFiClientSecure, ...)")));

      |          ^~~~~

C:\Users\Nitro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:167:10: note:   conversion of argument 2 would be ill-formed:

C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:47:30: error: invalid conversion from 'const char*' to 'const uint8_t*' {aka 'const unsigned char*'} [-fpermissive]

   47 |     http_.begin(url.c_str(), kFirebaseFingerprint);

      |                              ^~~~~~~~~~~~~~~~~~~~

      |                              |

      |                              const char*

C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp: In member function 'virtual void FirebaseHttpClientEsp8266::begin(const string&, const string&)':

C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:51:60: error: invalid conversion from 'const char*' to 'const uint8_t*' {aka 'const unsigned char*'} [-fpermissive]

   51 |     http_.begin(host.c_str(), kFirebasePort, path.c_str(), kFirebaseFingerprint);

      |                                                            ^~~~~~~~~~~~~~~~~~~~

      |                                                            |

      |                                                            const char*

In file included from C:\Users\Nitro\Desktop\arduino-1.8.19-windows\arduino-1.8.19\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:9:

C:\Users\Nitro\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:168:70: note:   initializing argument 4 of 'bool HTTPClient::begin(String, uint16_t, String, const uint8_t*)'

  168 |     bool begin(String host, uint16_t port, String uri, const uint8_t httpsFingerprint[20])  __attribute__ ((error("obsolete API, use ::begin(WiFiClientSecure, ...)")));

      |                                                        ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~

exit status 1

Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I have tried all those solutions that were available online

giving preference

I have already installed all the required libraries.


问:
Is there an R Package allowing me to use Anderson Darling Upper tail test?
I am struggling with implementing the R function Anderson Darling Upper Tail Test.

The traditional Anderson Darling Test works fine with function ad_test(), but the Anderson Darling Upper Tail Test adup.test() is not working.

I have tried installing packages "truncgof" and "adklakedata", but both are not running and I have installed latest R Version

Is there any other package/function I may try?

Thanks!


问:
Android Volley library doesn't work for localhost request
I'm sending an http request from Android Java using the Volley library to a Spring backend. The backend application should responds with a JSON string. The Tomcat server is on 192.168.1.8:8080 (or localhost on the same machine) and from browser and with the http apache library requests works fine. On android I get some strange error:

```<code>public class MainActivity extends AppCompatActivity {

private TextView textResponse;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    textResponse = findViewById(R.id.responseText);
    // Instantiate the RequestQueue.
    RequestQueue queue = Volley.newRequestQueue(this);
    String url = "http://192.168.1.8:8080/admin/getAll";
    System.out.println(url);

    // Request a string response from the provided URL.
    StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
            response -> {
                // Display the first 500 characters of the response string.
                System.out.println("Response is: " + response.substring(0,500));
                textResponse.setText(response.substring(0,50));
            },
            error -> {
                System.out.println("That didn't work!" );
                textResponse.setText("error");
            });

    // Add the request to the RequestQueue.
    queue.add(stringRequest);
    //queue.start();
    System.out.println("sto qua");

}}
</code>```

It goes in the error case, and if I try to get the error status code with error.networkResponse.statusCode it gives me:

```<code>Attempt to read from field 'int com.android.volley.NetworkResponse.statusCode' on a null
object reference
</code>```

Where is the problem?

Body:
I'm sending an http request from Android Java using the Volley library to a Spring backend. The backend application should responds with a JSON string. The Tomcat server is on 192.168.1.8:8080 (or localhost on the same machine) and from browser and with the http apache library requests works fine. On android I get some strange error:

public class MainActivity extends AppCompatActivity {

private TextView textResponse;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    textResponse = findViewById(R.id.responseText);
    // Instantiate the RequestQueue.
    RequestQueue queue = Volley.newRequestQueue(this);
    String url = "http://192.168.1.8:8080/admin/getAll";
    System.out.println(url);

    // Request a string response from the provided URL.
    StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
            response -> {
                // Display the first 500 characters of the response string.
                System.out.println("Response is: " + response.substring(0,500));
                textResponse.setText(response.substring(0,50));
            },
            error -> {
                System.out.println("That didn't work!" );
                textResponse.setText("error");
            });

    // Add the request to the RequestQueue.
    queue.add(stringRequest);
    //queue.start();
    System.out.println("sto qua");

}}

It goes in the error case, and if I try to get the error status code with error.networkResponse.statusCode it gives me:

Attempt to read from field 'int com.android.volley.NetworkResponse.statusCode' on a null
object reference

Where is the problem?


问:
Best Codec and Pixel Formats to use in FFMPEG Pipeline
I have created an FFMPEG Pipeline to stream video frames to an RTSP server. The frames are RGB frames with 3 dimensions. My pipeline command is as follows:

```<code>openPipeLine = _popen("ffmpeg -f rawvideo -r 30 -video_size 720x1280 -pixel_format bgr24 -i pipe: -vcodec libx264 -crf 24 -pix_fmt yuv420p -f rtsp rtsp://localHost:8554/mystream", "w");
</code>```

I can barely make out the picture when I connect to the server via VLC Media. The colors seem scrambled. I've attached a sample image and the output on the server.

Are there any recommended Codec's that I can use to solve this? Perhaps the pixel format should be changed. I'm currently using a Codec and pixel format that I found online without knowing if these are the best options.
original frame
server output

Thank you very much.

Body:
I have created an FFMPEG Pipeline to stream video frames to an RTSP server. The frames are RGB frames with 3 dimensions. My pipeline command is as follows:

openPipeLine = _popen("ffmpeg -f rawvideo -r 30 -video_size 720x1280 -pixel_format bgr24 -i pipe: -vcodec libx264 -crf 24 -pix_fmt yuv420p -f rtsp rtsp://localHost:8554/mystream", "w");

I can barely make out the picture when I connect to the server via VLC Media. The colors seem scrambled. I've attached a sample image and the output on the server.

Are there any recommended Codec's that I can use to solve this? Perhaps the pixel format should be changed. I'm currently using a Codec and pixel format that I found online without knowing if these are the best options.
original frame
server output

Thank you very much.


问:
Skbuild setuptools : put library in correct place
I implemented python bindings for a C++ project. I want the extension module to be installable via pip. I managed to get a setupfile working, that compiles the module : https://gitlab.com/cytosim/cytosim/-/tree/pybind

So I can python3 setup.py sdist bdist_wheel and then pip3 install cytosim.xxxxx.whl without error. However, the module lands in /home/xxxx/anaconda3/module/lib instead of arriving in anaconda3/lib/python3.9/site-packages.

The relevant part of the setup.py file is :

```<code>setup(
    name="cytosim",
    version=version,
    packages=find_packages(where="module"),
    package_dir={"": "module"},
    cmake_install_dir="module",
    description=DOCLINES[0],
    long_description=open("README.md", encoding="utf8").read(),
    long_description_content_type="text/markdown",
    platforms=["Windows", "Linux", "Mac OS-X", "Unix"],
    keywords="simulation actin microtubule polymer",
    cmake_args=cmake_args,
    zip_safe=False,
)
</code>```

How do I put the compiled extension module in site-packages ?

Body:
I implemented python bindings for a C++ project. I want the extension module to be installable via pip. I managed to get a setupfile working, that compiles the module : https://gitlab.com/cytosim/cytosim/-/tree/pybind

So I can python3 setup.py sdist bdist_wheel and then pip3 install cytosim.xxxxx.whl without error. However, the module lands in /home/xxxx/anaconda3/module/lib instead of arriving in anaconda3/lib/python3.9/site-packages.

The relevant part of the setup.py file is :

setup(
    name="cytosim",
    version=version,
    packages=find_packages(where="module"),
    package_dir={"": "module"},
    cmake_install_dir="module",
    description=DOCLINES[0],
    long_description=open("README.md", encoding="utf8").read(),
    long_description_content_type="text/markdown",
    platforms=["Windows", "Linux", "Mac OS-X", "Unix"],
    keywords="simulation actin microtubule polymer",
    cmake_args=cmake_args,
    zip_safe=False,
)

How do I put the compiled extension module in site-packages ?


问:
Exracting latest edit date of a google slides in drive, in google sheets
I am trying to use the formule =IMPORTXML to extract the latest edit date of a slide deck that is on an open google drive folder. I inspect the XPATH, which looks like this:

In full:

```<code>/html/body/div[1]/c-wiz/div/div/c-wiz/div/div/div[3]/div[2]/div/div[1]/div[6]/div[1]/div
</code>```

In short:

```<code>//*[@id="yDmH0d"]/c-wiz/div/div/c-wiz/div/div/div[3]/div[2]/div/div[1]/div[6]/div[1]/div
</code>```

I tried both of the versions but neither of them work, as they both give me an error. Any ideas on what might go wrong?

Body:
I am trying to use the formule =IMPORTXML to extract the latest edit date of a slide deck that is on an open google drive folder. I inspect the XPATH, which looks like this:

In full:

/html/body/div[1]/c-wiz/div/div/c-wiz/div/div/div[3]/div[2]/div/div[1]/div[6]/div[1]/div

In short:

//*[@id="yDmH0d"]/c-wiz/div/div/c-wiz/div/div/div[3]/div[2]/div/div[1]/div[6]/div[1]/div

I tried both of the versions but neither of them work, as they both give me an error. Any ideas on what might go wrong?


问:
How to deploy pods in Azure Kubernetes in particular namespace using terraform
I am trying to deploy pods in Azure Kubernetes using terraform and I am able to deploy that. By default it is getting deployed in default namespace. I wanted to deploy my pods in "testing-ns" namespace. But I am getting error when I am trying to deploy the pods in "testing-ns: namespace. I have written code as below:

```<code>terraform {
  required_version = ">= 0.13"
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = "3.34.0"
    }
    kubectl = {
      source  = "gavinbunney/kubectl"
      version = ">= 1.7.0"
    }
  }
}

provider "azurerm" {
  # Configuration options
   client_id = "jdhsd-iuwey63gjds-w7ws"
   client_secret = "lksiuewdw-iowehh5gjs"
   tenant_id = "poefnkfkdjn=-weoidejf"
   subscription_id = "kqhdkwdwdncbjhd"
   features {}
}

data "azurerm_kubernetes_cluster" "my_cluster" {
  name     = "podkubTest"
  resource_group_name = "podTest"
}

data "kubernetes_namespace" "example" {
  metadata {
    name = "testing-ns"
  }
}

data "kubectl_filename_list" "manifests" {
    pattern = "C:/Users/Documents/API/*.yaml"
}

resource "kubectl_manifest" "test" {
    count     = length(data.kubectl_filename_list.manifests.matches)
    yaml_body = file(element(data.kubectl_filename_list.manifests.matches, count.index))
}
</code>```

But while running this above script, I am getting below error:

Can someone please help me with this. I wanted to deploy pods in particular namespace in AKS.

Thanks in advance.

Body:
I am trying to deploy pods in Azure Kubernetes using terraform and I am able to deploy that. By default it is getting deployed in default namespace. I wanted to deploy my pods in "testing-ns" namespace. But I am getting error when I am trying to deploy the pods in "testing-ns: namespace. I have written code as below:

terraform {
  required_version = ">= 0.13"
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = "3.34.0"
    }
    kubectl = {
      source  = "gavinbunney/kubectl"
      version = ">= 1.7.0"
    }
  }
}

provider "azurerm" {
  # Configuration options
   client_id = "jdhsd-iuwey63gjds-w7ws"
   client_secret = "lksiuewdw-iowehh5gjs"
   tenant_id = "poefnkfkdjn=-weoidejf"
   subscription_id = "kqhdkwdwdncbjhd"
   features {}
}

data "azurerm_kubernetes_cluster" "my_cluster" {
  name     = "podkubTest"
  resource_group_name = "podTest"
}

data "kubernetes_namespace" "example" {
  metadata {
    name = "testing-ns"
  }
}

data "kubectl_filename_list" "manifests" {
    pattern = "C:/Users/Documents/API/*.yaml"
}

resource "kubectl_manifest" "test" {
    count     = length(data.kubectl_filename_list.manifests.matches)
    yaml_body = file(element(data.kubectl_filename_list.manifests.matches, count.index))
}

But while running this above script, I am getting below error:

Can someone please help me with this. I wanted to deploy pods in particular namespace in AKS.

Thanks in advance.


问:
TypeError: The x variable is categorical, but one of ['numeric', 'datetime'] is required
```<code>import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
f = open('/Users/justkiddings/Desktop/Python/TKO/TKO.csv', ) # open the file

data = pd.read_csv(f) # read the .csv file
co=data['CO']
no2=data['NO2']  # set the data

sns.kdeplot(co,shade=True) # to make a figure of CO
sns.kdeplot(no2,shade=True) # to make a figure of NO2
plt.show()
</code>```

why does it error and how to solve it?

```<code>runfile('/Users/justkiddings/Desktop/Python/Code/untitled18.py', wdir='/Users/justkiddings/Desktop/Python/Code')
Traceback (most recent call last):

  File "/Users/justkiddings/opt/anaconda3/lib/python3.9/site-packages/spyder_kernels/py3compat.py", line 356, in compat_exec
    exec(code, globals, locals)

  File "/Users/justkiddings/Desktop/Python/Code/untitled18.py", line 11, in <module>
    sns.kdeplot(co,shade=True) # to make a figure of CO

  File "/Users/justkiddings/opt/anaconda3/lib/python3.9/site-packages/seaborn/_decorators.py", line 46, in inner_f
    return f(**kwargs)

  File "/Users/justkiddings/opt/anaconda3/lib/python3.9/site-packages/seaborn/distributions.py", line 1762, in kdeplot
    p._attach(ax, allowed_types=["numeric", "datetime"], log_scale=log_scale)

  File "/Users/justkiddings/opt/anaconda3/lib/python3.9/site-packages/seaborn/_core.py", line 1125, in _attach
    raise TypeError(err)

TypeError: The x variable is categorical, but one of ['numeric', 'datetime'] is required
</code>```

Data:

DATE,HOUR,STATION,CO,FSP,NO2,NOX,O3,RSP,SO2

1/1/2022,1,TSEUNG KWAN O,67,29,17,18,125,47,4

1/1/2022,2,TSEUNG KWAN O,68,31,18,18,119,50,5

1/1/2022,3,TSEUNG KWAN O,67,35,16,16,116,47,5

1/1/2022,4,TSEUNG KWAN O,66,30,14,15,112,46,4

1/1/2022,5,TSEUNG KWAN O,67,25,14,14,102,47,4

Body:
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
f = open('/Users/justkiddings/Desktop/Python/TKO/TKO.csv', ) # open the file

data = pd.read_csv(f) # read the .csv file
co=data['CO']
no2=data['NO2']  # set the data

sns.kdeplot(co,shade=True) # to make a figure of CO
sns.kdeplot(no2,shade=True) # to make a figure of NO2
plt.show()

why does it error and how to solve it?

runfile('/Users/justkiddings/Desktop/Python/Code/untitled18.py', wdir='/Users/justkiddings/Desktop/Python/Code')
Traceback (most recent call last):

  File "/Users/justkiddings/opt/anaconda3/lib/python3.9/site-packages/spyder_kernels/py3compat.py", line 356, in compat_exec
    exec(code, globals, locals)

  File "/Users/justkiddings/Desktop/Python/Code/untitled18.py", line 11, in <module>
    sns.kdeplot(co,shade=True) # to make a figure of CO

  File "/Users/justkiddings/opt/anaconda3/lib/python3.9/site-packages/seaborn/_decorators.py", line 46, in inner_f
    return f(**kwargs)

  File "/Users/justkiddings/opt/anaconda3/lib/python3.9/site-packages/seaborn/distributions.py", line 1762, in kdeplot
    p._attach(ax, allowed_types=["numeric", "datetime"], log_scale=log_scale)

  File "/Users/justkiddings/opt/anaconda3/lib/python3.9/site-packages/seaborn/_core.py", line 1125, in _attach
    raise TypeError(err)

TypeError: The x variable is categorical, but one of ['numeric', 'datetime'] is required

Data:

DATE,HOUR,STATION,CO,FSP,NO2,NOX,O3,RSP,SO2

1/1/2022,1,TSEUNG KWAN O,67,29,17,18,125,47,4

1/1/2022,2,TSEUNG KWAN O,68,31,18,18,119,50,5

1/1/2022,3,TSEUNG KWAN O,67,35,16,16,116,47,5

1/1/2022,4,TSEUNG KWAN O,66,30,14,15,112,46,4

1/1/2022,5,TSEUNG KWAN O,67,25,14,14,102,47,4


问:
Does Asterisk (v13.30.0) ignore allowed_origins
We are attempting to use AMI in Asterisk 13.30.0 (yes I know its old). It seems that regardless of the allowed_origins setting any calls from a browser result in a CORS error - though intrestingly enough it does get a 200 back (see below).

I would greatly appreciate any insights or guidance.

manager.conf

```<code>[general]
enabled=yes
webenabled=yes
bindaddr = 0.0.0.0
port = 5038
allowed_origins=*
</code>```

Multiple combinations have been tried for the allowed_origins with the same results

Initial auth

```<code>194.xxx.xxx.xxx:8088/rawman?action=login&username=XXXX&secret=XXXXXX
</code>```

results in

```<code>Access to XMLHttpRequest at 'http://194.xxx.xxx.xxx:8088/rawman?action=login&username=XXXX&secret=XXXX' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
</code>```

but....the return headers are

```<code>HTTP/1.1 200 OK
Server: Asterisk/13.30.0
Date: Mon, 19 Dec 2022 08:13:42 GMT
Cache-Control: no-cache, no-store
Content-type: text/plain
Set-Cookie: mansession_id="a790b432"; Version=1; Max-Age=60
Pragma: SuppressEvents
Content-Length: 55
</code>```

Body:
We are attempting to use AMI in Asterisk 13.30.0 (yes I know its old). It seems that regardless of the allowed_origins setting any calls from a browser result in a CORS error - though intrestingly enough it does get a 200 back (see below).

I would greatly appreciate any insights or guidance.

manager.conf

[general]
enabled=yes
webenabled=yes
bindaddr = 0.0.0.0
port = 5038
allowed_origins=*

Multiple combinations have been tried for the allowed_origins with the same results

Initial auth

194.xxx.xxx.xxx:8088/rawman?action=login&username=XXXX&secret=XXXXXX

results in

Access to XMLHttpRequest at 'http://194.xxx.xxx.xxx:8088/rawman?action=login&username=XXXX&secret=XXXX' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

but....the return headers are

HTTP/1.1 200 OK
Server: Asterisk/13.30.0
Date: Mon, 19 Dec 2022 08:13:42 GMT
Cache-Control: no-cache, no-store
Content-type: text/plain
Set-Cookie: mansession_id="a790b432"; Version=1; Max-Age=60
Pragma: SuppressEvents
Content-Length: 55


问:
Simple Tabs - Scroll position CSS/JS
Im using the following tabs, which behave like this:
(√ = working as intended, X = not working as intended)

-> When loading page, Tab 1 is active √

*Manually scrolling to bottom of Tab 1

-> Clicking Tab 2, Page scrolls automatically to top of Tab 2 √

*Manually scrolling to middle of Tab 2

-> Clicking Tab 1 again, Page scrolls to top of Tab 1 X

At this point (2nd visit of a tab) it should save the last scroll position, instead scrolling to top again.

It should go like this:

-> Scroll Tab 1 manually to ex. Height:20px

-> Click Tab 2, scroll to top automatically.

-> Scroll Tab 2 manually to Height:50px

-> Click Tab 1, scroll was saved on height:20px

-> Click Tab 2, scroll was saved on height:50px

-> Click Tab 1, scroll still saved on height:20px

-> Click Tab 2, scroll still saved on height:50px

-> Click Tab 3, automatically scroll to top because its the first visit to tab 3.

How can i achieve such function?

document.getElementById('tab').style.height = document.querySelector(`#tab div`).getBoundingClientRect().height + 'px'

const btn = [].slice.call(document.getElementsByTagName('button'))
btn.forEach((item, index) => {
  item.addEventListener('click', function() {
    btn.forEach((item) => {
      item.classList.remove('active')
    })
    item.classList.add('active')
    document.getElementById('tab').setAttribute('data-tab', index)

    const currentTab = document.querySelector(`#tab div:nth-of-type(${index + 1})`);
    document.getElementById('tab').style.height = currentTab.getBoundingClientRect().height + 'px'
  })
})```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.wrapper {
  overflow: hidden;
}

.tabs {
  position: relative;
  -webkit-transition: all .9s ease-in-out;
  -moz-transition: all .9s ease-in-out;
  -ms-transition: all .9s ease-in-out;
  -o-transition: all .9s ease-in-out;
  transition: all .9s ease-in-out;
}

.tabs>* {
  width: 100%;
}

.tabs[data-tab='1'] {
  transform: translateX(-100%);
}

.tabs[data-tab='2'] {
  transform: translateX(-200%);
}

.tabs[data-tab='3'] {
  transform: translateX(-300%);
}

.tabs[data-tab='4'] {
  transform: translateX(-400%);
}

.inliner {
  white-space: nowrap;
}

.inliner>* {
  display: inline-block;
  *display: inline;
  *zoom: 1;
  font-size: 1rem;
  letter-spacing: normal;
  vertical-align: top;
  word-spacing: normal;
  white-space: normal;
}</code>```

  <button> Tab 1</button>
  <button> Tab 2</button>
  <button> Tab3</button>

Content 1

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
        takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam

TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT

How can i save the scroll position after 1st visit of a tab?
```

In case i did not explain too well: I want to achieve this:

1st visit of Tab: scroll to top. (Already in code)

Save last scroll position of specific tab

When revisiting a Tab, dont scroll to top, instead display the last scroll position from 1st visit of that tab.

(JsFiddle)

Also, I dont need it to keep saved on pageload. I just need it for the current visit of my webpage.

Thanks

Title: Simple Tabs - Scroll position CSS/JS

Body:
Im using the following tabs, which behave like this:
(√ = working as intended, X = not working as intended)

-> When loading page, Tab 1 is active √

*Manually scrolling to bottom of Tab 1

-> Clicking Tab 2, Page scrolls automatically to top of Tab 2 √

*Manually scrolling to middle of Tab 2

-> Clicking Tab 1 again, Page scrolls to top of Tab 1 X

At this point (2nd visit of a tab) it should save the last scroll position, instead scrolling to top again.

It should go like this:

-> Scroll Tab 1 manually to ex. Height:20px

-> Click Tab 2, scroll to top automatically.

-> Scroll Tab 2 manually to Height:50px

-> Click Tab 1, scroll was saved on height:20px

-> Click Tab 2, scroll was saved on height:50px

-> Click Tab 1, scroll still saved on height:20px

-> Click Tab 2, scroll still saved on height:50px

-> Click Tab 3, automatically scroll to top because its the first visit to tab 3.

How can i achieve such function?

document.getElementById('tab').style.height = document.querySelector(`#tab div`).getBoundingClientRect().height + 'px'

const btn = [].slice.call(document.getElementsByTagName('button'))
btn.forEach((item, index) => {
  item.addEventListener('click', function() {
    btn.forEach((item) => {
      item.classList.remove('active')
    })
    item.classList.add('active')
    document.getElementById('tab').setAttribute('data-tab', index)

    const currentTab = document.querySelector(`#tab div:nth-of-type(${index + 1})`);
    document.getElementById('tab').style.height = currentTab.getBoundingClientRect().height + 'px'
  })
})

.wrapper {
  overflow: hidden;
}

.tabs {
  position: relative;
  -webkit-transition: all .9s ease-in-out;
  -moz-transition: all .9s ease-in-out;
  -ms-transition: all .9s ease-in-out;
  -o-transition: all .9s ease-in-out;
  transition: all .9s ease-in-out;
}

.tabs>* {
  width: 100%;
}

.tabs[data-tab='1'] {
  transform: translateX(-100%);
}

.tabs[data-tab='2'] {
  transform: translateX(-200%);
}

.tabs[data-tab='3'] {
  transform: translateX(-300%);
}

.tabs[data-tab='4'] {
  transform: translateX(-400%);
}

.inliner {
  white-space: nowrap;
}

.inliner>* {
  display: inline-block;
  *display: inline;
  *zoom: 1;
  font-size: 1rem;
  letter-spacing: normal;
  vertical-align: top;
  word-spacing: normal;
  white-space: normal;
}

  <button> Tab 1</button>
  <button> Tab 2</button>
  <button> Tab3</button>

Content 1

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
        takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam

TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT

How can i save the scroll position after 1st visit of a tab?

In case i did not explain too well: I want to achieve this:

1st visit of Tab: scroll to top. (Already in code)

Save last scroll position of specific tab

When revisiting a Tab, dont scroll to top, instead display the last scroll position from 1st visit of that tab.

(JsFiddle)

Also, I dont need it to keep saved on pageload. I just need it for the current visit of my webpage.

Thanks