问:
C++ server sending response to Javascript Client throws HPE_INVALID_CONSTANT. Expected HTTP/
I have a C++ server and JS client connected on the same localhost port. But I get an exception:

```<code>code: 'HPE_INVALID_CONSTANT',
reason: 'Expected HTTP/',
rawPacket: Buffer(...) [Uint8Array] [ ... ]
</code>```

on the client.
I decoded the rawPacket using String.fromCharCode.apply(null, rawPacket) and can see it is exactly what I send from my server. So the response reaches my client but throws on parsing.

The api used in C++ server to send response is sys/socket.h's send. The buffer argument is a char const * and the flag argument is set to 0 (vanilla setting).

The api used in the JS client to receive the response is NodeJs's http package's get function. It's passed a url, which is http://localhost:<port>/request and a callback to process the response.

The decoded rawPacket (i. e. response received in the client) is:

```<code>POST /response HTTP/1.1
Host: localhost:3000
Connection: keep-alive
</code>```

The request received by the server is:

```<code>GET /request HTTP/1.1
Host: localhost:3000
Connection: close
</code>```

Does anyone know why my JS client is having trouble parsing the response from my C++ server?

The response seems like a valid one to me.

Body:
I have a C++ server and JS client connected on the same localhost port. But I get an exception:

code: 'HPE_INVALID_CONSTANT',
reason: 'Expected HTTP/',
rawPacket: Buffer(...) [Uint8Array] [ ... ]

on the client.
I decoded the rawPacket using String.fromCharCode.apply(null, rawPacket) and can see it is exactly what I send from my server. So the response reaches my client but throws on parsing.

The api used in C++ server to send response is sys/socket.h's send. The buffer argument is a char const * and the flag argument is set to 0 (vanilla setting).

The api used in the JS client to receive the response is NodeJs's http package's get function. It's passed a url, which is http://localhost:<port>/request and a callback to process the response.

The decoded rawPacket (i. e. response received in the client) is:

POST /response HTTP/1.1
Host: localhost:3000
Connection: keep-alive

The request received by the server is:

GET /request HTTP/1.1
Host: localhost:3000
Connection: close

Does anyone know why my JS client is having trouble parsing the response from my C++ server?

The response seems like a valid one to me.


来源: stackexchange

问:
How to store Math operators in variable in C and check if user entered the correct operator to perform correct operation
I have a class exercise that ask us write a C-program to read 2 numbers from user and perform an operation based on the operator entered by the user. The Pseudocode is this.

Get 2 numbers from user.

Get operator from user (e.g +,-,/,*).

if operator entered = +, add the 2 numbers, else if ....

This is my code:

```<code>
</code>```
```<code>#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x,y;
    char op;  //op is the identifier meaning operator

    printf("Enter x: ");
    scanf("%d",&x);

    printf("Enter y: ");
    scanf("%d",&y);

    printf("Enter op: ");
    scanf("%ch",&op);

    if(op == '+'){
        printf("%d + %d = %d \n",x,y,x+y);
    }else if(op == '-'){
        printf("%d + %d = %d \n",x,y,x-y);
    }else if(op == '*'){
        printf("%d + %d = %d \n",x,y,x*y);
    }else if(op == '/'){
        printf("%d + %d = %d \n",x,y,x/y);
    }else{
        printf("Invalid operator entered!\n");
    }
}

</code>```

This is the output i get when i run the code

Output

I've done this before, sometimes last year and everything ran smoothly, but now it isnt. i dont know if its from my IDE or something i'm getting wrong (I use Codeblocks as my IDE for C-lang )

i've tried to change the operator from a single to character to a string but its still not working.

ContentLicense: CC BY-SA 4.0

Body:
I have a class exercise that ask us write a C-program to read 2 numbers from user and perform an operation based on the operator entered by the user. The Pseudocode is this.

Get 2 numbers from user.

Get operator from user (e.g +,-,/,*).

if operator entered = +, add the 2 numbers, else if ....

This is my code:

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x,y;
    char op;  //op is the identifier meaning operator

    printf("Enter x: ");
    scanf("%d",&x);

    printf("Enter y: ");
    scanf("%d",&y);

    printf("Enter op: ");
    scanf("%ch",&op);

    if(op == '+'){
        printf("%d + %d = %d \n",x,y,x+y);
    }else if(op == '-'){
        printf("%d + %d = %d \n",x,y,x-y);
    }else if(op == '*'){
        printf("%d + %d = %d \n",x,y,x*y);
    }else if(op == '/'){
        printf("%d + %d = %d \n",x,y,x/y);
    }else{
        printf("Invalid operator entered!\n");
    }
}

This is the output i get when i run the code

Output

I've done this before, sometimes last year and everything ran smoothly, but now it isnt. i dont know if its from my IDE or something i'm getting wrong (I use Codeblocks as my IDE for C-lang )

i've tried to change the operator from a single to character to a string but its still not working.


问:
Chrome `cookie.getAll()` Yields Different Cookie Values than Chrome Dev Tools
I am writing a chrome extension that makes calls to an API and for that I am trying to get some existing session cookies in the service worker. My worker makes a call like this,

```<code>const cookies = await chrome.cookies.getAll({} )
const sessionToken = cookies.filter(
    cookie =>
        cookie.name === "__Secure-next-auth.session-token")[0].value

</code>```

However the value I get back for the cookie is different than the value in chrome dev tools. Interestingly enough both values have the same prefix (the value is long, I only pasted enough to demonstrate my point):

```<code>Dev tools cookie: eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..dCOoryziuSU3zkJl...
chrome.cookies.getAll: eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..colJ2H6th0yLZ9Q8...
</code>```

In case it's useful the cookies have the HttpOnly parameter set. Can anyone guess why the cookie values might be different?
My worker is running after the page has loaded (so there's no chance that I'm getting an old value), I know the value the chrome API is giving is completely invalid because when i try to use it with the API I'm calling, I get "invalid token". On the other hand, the cookie in dev tools works with my API.

I thought maybe the cookie value had been decoded/encoded in some way but then why would the prefix match? I thought maybe the chrome API is storing multiple cookies with the same name, but when I log cookies, there is only one cookie with this name.
Would appreciate any thoughts.

Body:
I am writing a chrome extension that makes calls to an API and for that I am trying to get some existing session cookies in the service worker. My worker makes a call like this,

const cookies = await chrome.cookies.getAll({} )
const sessionToken = cookies.filter(
    cookie =>
        cookie.name === "__Secure-next-auth.session-token")[0].value

However the value I get back for the cookie is different than the value in chrome dev tools. Interestingly enough both values have the same prefix (the value is long, I only pasted enough to demonstrate my point):

Dev tools cookie: eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..dCOoryziuSU3zkJl...
chrome.cookies.getAll: eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..colJ2H6th0yLZ9Q8...

In case it's useful the cookies have the HttpOnly parameter set. Can anyone guess why the cookie values might be different?
My worker is running after the page has loaded (so there's no chance that I'm getting an old value), I know the value the chrome API is giving is completely invalid because when i try to use it with the API I'm calling, I get "invalid token". On the other hand, the cookie in dev tools works with my API.

I thought maybe the cookie value had been decoded/encoded in some way but then why would the prefix match? I thought maybe the chrome API is storing multiple cookies with the same name, but when I log cookies, there is only one cookie with this name.
Would appreciate any thoughts.


问:
how to update package with conda
I am trying to update a package called rdkit with conda, but after installation the version remains the same:

```<code>(solv_rdkit_2020) C:\Users\miche>conda update rdkit
Retrieving notices: ...working... done
Collecting package metadata (current_repodata.json): done
Solving environment: /
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

  - conda-forge/noarch::ase==3.22.1=pyhd8ed1ab_1
  - pyg/win-64::pytorch-sparse==0.6.12=py36_torch_1.10.0_cpu
done

## Package Plan ##

  environment location: C:\Users\miche\miniconda3\envs\solv_rdkit_2020

  added / updated specs:
    - rdkit

The following NEW packages will be INSTALLED:

  scipy              conda-forge/win-64::scipy-1.5.3-py36h27d303f_1

Proceed ([y]/n)? y

Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
</code>```

When checking the package version it remains the same:

```<code>(solv_rdkit_2020) C:\Users\miche>conda list -n solv_rdkit_2020 -f rdkit
# packages in environment at C:\Users\miche\miniconda3\envs\solv_rdkit_2020:
#
# Name                    Version                   Build  Channel
rdkit                     2019.03.2        py36h3020836_0    conda-forge
</code>```

I tried uninstalling the package, but apparently it is not even installed in my environment:

```<code>(solv_rdkit_2020) C:\Users\miche>pip uninstall rdkit
WARNING: Skipping rdkit as it is not installed.

(solv_rdkit_2020) C:\Users\miche>pip3 uninstall rdkit
WARNING: Skipping rdkit as it is not installed.
</code>```

Title: how to update package with conda

Body:
I am trying to update a package called rdkit with conda, but after installation the version remains the same:

(solv_rdkit_2020) C:\Users\miche>conda update rdkit
Retrieving notices: ...working... done
Collecting package metadata (current_repodata.json): done
Solving environment: /
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

  - conda-forge/noarch::ase==3.22.1=pyhd8ed1ab_1
  - pyg/win-64::pytorch-sparse==0.6.12=py36_torch_1.10.0_cpu
done

## Package Plan ##

  environment location: C:\Users\miche\miniconda3\envs\solv_rdkit_2020

  added / updated specs:
    - rdkit

The following NEW packages will be INSTALLED:

  scipy              conda-forge/win-64::scipy-1.5.3-py36h27d303f_1

Proceed ([y]/n)? y

Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

When checking the package version it remains the same:

(solv_rdkit_2020) C:\Users\miche>conda list -n solv_rdkit_2020 -f rdkit
# packages in environment at C:\Users\miche\miniconda3\envs\solv_rdkit_2020:
#
# Name                    Version                   Build  Channel
rdkit                     2019.03.2        py36h3020836_0    conda-forge

I tried uninstalling the package, but apparently it is not even installed in my environment:

(solv_rdkit_2020) C:\Users\miche>pip uninstall rdkit
WARNING: Skipping rdkit as it is not installed.

(solv_rdkit_2020) C:\Users\miche>pip3 uninstall rdkit
WARNING: Skipping rdkit as it is not installed.


问:
Dropzone and Vue - FIle variable is not updated
We are using Dropzone and Vue. We have this code.

```<code>let obj = null;
let files = ref([]);

obj = new Dropzone("body", {
  ....
  init: function() {
    this.on("addedfile", function(file) {

      setTimeout(function() {
        if (file.accepted) {

          //PUSHING FILE TO fileList
          files.value.push(file);
        }
      }, 5);

    });

  },
});
</code>```

As you can see, we are pushing the file to the files variable.

We are printing it like:

```<code><p v-for="(val, index) in fileList" :key="index"> {{ val.upload.progress }} </p>
</code>```

It does NOT print the progress automatically. Shows 0 all the time. Does not change.

When we debug..

```<code>fileList.value.forEach(o => {
   console.log(o.upload.progress);
});
</code>```

This one shows the progress.

Question: How can we make it dynamic in the HTML part?

Any help would be appreciated.

Body:
We are using Dropzone and Vue. We have this code.

let obj = null;
let files = ref([]);

obj = new Dropzone("body", {
  ....
  init: function() {
    this.on("addedfile", function(file) {

      setTimeout(function() {
        if (file.accepted) {

          //PUSHING FILE TO fileList
          files.value.push(file);
        }
      }, 5);

    });

  },
});

As you can see, we are pushing the file to the files variable.

We are printing it like:

 {{ val.upload.progress }}

It does NOT print the progress automatically. Shows 0 all the time. Does not change.

When we debug..

fileList.value.forEach(o => {
   console.log(o.upload.progress);
});

This one shows the progress.

Question: How can we make it dynamic in the HTML part?

Any help would be appreciated.


问:
Converting string to assertion in OpenSAML 4
For reasons outside of the context of the question, I have the SAML XML assertion created by an IdP and I just want to check its validity. I have it only as a string.

How can I convert it in an OpenSAML 4 XML assertion object, so that it can be validated with OpenSAML?


问:
How can the HC128 streamcipher be used to decrypt a ciphered message in smaller parts?
I use the HC128 streamcipher in an application where the sender
applies the HC128 cipher on the message, slices the ciphered data
into (fixed size) smaller parts and sends them to the receiver.

The receiver gets these encrypted data chunks but it cannot wait until all parts
arrive to decrypt the whole message. Instead it should decrypt
the individual message parts and use them before all parts arrive.

I tried to realize this concept but it did not work: when I decrypted
the message parts I did not get the original message. Do I misuse
the HC128 streamcipher or is there a missing step? How can I
achieve the expected behavior?

The HC128 source.

```<code>#include <iostream>
#include <ecrypt-sync.h>

int main()
{
    ECRYPT_ctx sender_ctx;
    ECRYPT_ctx receiver_ctx;
    unsigned char key[32];
    unsigned char iv[32];

    unsigned char plaintext[100];
    unsigned char ciphertext[100];
    unsigned char plaintext_receiver[100];

    // SENDER
    // ------

    // Key and initial value for the example.
    for (int i = 0; i < 16; i++)
        key[i] = iv[i] = i;

    // Initialize sender's encryptor.
    ECRYPT_keysetup(&sender_ctx, key, 128, 128);
    ECRYPT_ivsetup(&sender_ctx, iv);

    // The message to send.
    for (int i = 0; i < 24; i++)
        plaintext[i] = i;

    // Encrypt the message. The ciphertext will be sent in two parts for this example.
    ECRYPT_encrypt_bytes(&sender_ctx, plaintext, ciphertext, 24);

    // RECEIVER
    // --------

    // Initialize receiver's decryptor.
    ECRYPT_keysetup(&receiver_ctx, key, 128, 128);
    ECRYPT_ivsetup(&receiver_ctx, iv);

    // First data chunk has received.
    ECRYPT_decrypt_bytes(&receiver_ctx, ciphertext, plaintext_receiver, 12);

    // Second data chunk has received.
    ECRYPT_decrypt_bytes(&receiver_ctx, ciphertext + 12, plaintext_receiver + 12, 12);

    for (int i = 0; i < 24; i += 1)
    {
        if (plaintext[i] != plaintext_receiver[i])
        {
            std::cout << "Error at index: " << i << "\n";
            return -1;
        }
    }

    std::cout << "Everything OK!" << "\n";
    return 0;
}

</code>```

Body:
I use the HC128 streamcipher in an application where the sender
applies the HC128 cipher on the message, slices the ciphered data
into (fixed size) smaller parts and sends them to the receiver.

The receiver gets these encrypted data chunks but it cannot wait until all parts
arrive to decrypt the whole message. Instead it should decrypt
the individual message parts and use them before all parts arrive.

I tried to realize this concept but it did not work: when I decrypted
the message parts I did not get the original message. Do I misuse
the HC128 streamcipher or is there a missing step? How can I
achieve the expected behavior?

The HC128 source.

#include <iostream>
#include <ecrypt-sync.h>

int main()
{
    ECRYPT_ctx sender_ctx;
    ECRYPT_ctx receiver_ctx;
    unsigned char key[32];
    unsigned char iv[32];

    unsigned char plaintext[100];
    unsigned char ciphertext[100];
    unsigned char plaintext_receiver[100];

    // SENDER
    // ------

    // Key and initial value for the example.
    for (int i = 0; i < 16; i++)
        key[i] = iv[i] = i;

    // Initialize sender's encryptor.
    ECRYPT_keysetup(&sender_ctx, key, 128, 128);
    ECRYPT_ivsetup(&sender_ctx, iv);

    // The message to send.
    for (int i = 0; i < 24; i++)
        plaintext[i] = i;

    // Encrypt the message. The ciphertext will be sent in two parts for this example.
    ECRYPT_encrypt_bytes(&sender_ctx, plaintext, ciphertext, 24);

    // RECEIVER
    // --------

    // Initialize receiver's decryptor.
    ECRYPT_keysetup(&receiver_ctx, key, 128, 128);
    ECRYPT_ivsetup(&receiver_ctx, iv);

    // First data chunk has received.
    ECRYPT_decrypt_bytes(&receiver_ctx, ciphertext, plaintext_receiver, 12);

    // Second data chunk has received.
    ECRYPT_decrypt_bytes(&receiver_ctx, ciphertext + 12, plaintext_receiver + 12, 12);

    for (int i = 0; i < 24; i += 1)
    {
        if (plaintext[i] != plaintext_receiver[i])
        {
            std::cout << "Error at index: " << i << "\n";
            return -1;
        }
    }

    std::cout << "Everything OK!" << "\n";
    return 0;
}


问:
Can you make the typescript language server show all members of a type?

Problem

When using typescript I can access hover-help from the language server for my variables. Given this snippet of code:

interface X {
    x1: string;
    x2: number;
}

type Y = {
    y1: boolean;
    y2: number;
};

export type Z = X | Y;
```

getting the types for Z, Y, and X produce different kinds of results. See the screenshots below:

✔ Help for Y

As you can see, the help for Y is great. It shows me all the members of Y.

❌ Help for X

The help for X however, is pretty awful because "what is X?" results in "X is X." Not great.

❌ Help for Z

And for Z, it isn't much better. It just regurgitates the exact definition from the line on which it was defined.

Desired Outcome

When I activate hover-help for a type/interface, I am usually interested in seeing all the members of that type. However, with nested interfaces I just get the top-level and it's often minimally helpful if not totally useless.

Is there a way to get more information here? Perhaps I can "expand" the types in the hover-help? Or maybe there's a setting to recursively expand?

Workaround

Currently I just type const foo = null as unknown as Z; to get myself a quick and dirty "instance of Z" and then I type foo. and use the auto-suggestion popup after the . to see all the members. As you can imagine, I really hate doing this.

Other Information

Note: I'm using Vim with CoC, but this should also apply to other editors.

Playground Link

Body:
Problem

When using typescript I can access hover-help from the language server for my variables. Given this snippet of code:

interface X {
    x1: string;
    x2: number;
}

type Y = {
    y1: boolean;
    y2: number;
};

export type Z = X | Y;

getting the types for Z, Y, and X produce different kinds of results. See the screenshots below:

✔ Help for Y

As you can see, the help for Y is great. It shows me all the members of Y.

❌ Help for X

The help for X however, is pretty awful because "what is X?" results in "X is X." Not great.

❌ Help for Z

And for Z, it isn't much better. It just regurgitates the exact definition from the line on which it was defined.

Desired Outcome

When I activate hover-help for a type/interface, I am usually interested in seeing all the members of that type. However, with nested interfaces I just get the top-level and it's often minimally helpful if not totally useless.

Is there a way to get more information here? Perhaps I can "expand" the types in the hover-help? Or maybe there's a setting to recursively expand?

Workaround

Currently I just type const foo = null as unknown as Z; to get myself a quick and dirty "instance of Z" and then I type foo. and use the auto-suggestion popup after the . to see all the members. As you can imagine, I really hate doing this.

Other Information

Note: I'm using Vim with CoC, but this should also apply to other editors.

Playground Link


问:
Grouping and transposing data in R
It is hard to explain this without just showing what I have, where I am, and what I need in terms of data structure:
What structure I had:

Where I have got to with my transformation efforts:

What I need to end up with:

Notes:
I've not given actual names for anything as the data is classed as sensitive, but:
Metrics are things that can be measured- for example, the number of permanent or full-time jobs. The number of metrics is larger than presented in the test data (and the example structure above).
Each metric has many years of data (whilst trying to do the code I have restricted myself to just 3 years. The illustration of the structure is based on this test). The number of years captured will change overtime- generally it will increase.
The number of policies will fluctuate, I've just labelled them policy 1, 2 etc for sensitivity reasons and limited the number whilst testing the code. Again, I have limited the number to make it easier to check the outputs.

The source data comes from a workbook of surveys with a tab for each policy. The initial import creates a list of tibbles consisting of a row for each metric, and 4 columns (the metric names, the values for 2024, the values for 2030, and the values for 2035). I converted this to a dataframe, created a vector to be a column header and used cbind() to put this on top to get the "What structure I had" data.
To get to the "Where I have got to with my transformation efforts" version of the table, I removed all the metric columns, created another vector of metrics and used rbind() to put this as the first column.
The idea in my head was to group the data by policy to get a vector for each metric, then transpose this so that the metric became the column, and the grouped data would become the row. Then expand the data to get the metrics repeated for each year. A friend of mine who does coding (but has never used R) has suggested using loops might be a better way forward. Again, I am not sure of the best approach so welcome advice. On Reddit someone suggested using pivot_wider/pivot_longer but this appears to be a summarise tool and I am not trying to summarise the data rather transform its structure.

Any suggestions on approaches or possible tools/functions to use would be gratefully received. I am learning R whilst trying to pull this data together to create a database that can be used for analysis, so, if my approach sounds weird, feel free to suggest alternatives. Thanks

Title: Grouping and transposing data in R


问:
How do I make a file boot with my apk using G++
I created a .so file with G++ and I wrote the file in C++. I put the file in my arm64-v8a files for my decompiled apk and it never booted on start.

I don’t know what the problem was but I think there might be something wrong with my .so. The file was called libhelloo.so. Can someone tell me how to properly compile into an .so file and then where to place the file so that it can run with the app?


问:
Object not serializable because of attribute, but attribute is serializable on its own
I am trying to create an endpoint (using Spring Boot) that will return a list of Row objects. However I am getting an error because the user attribute is not serializable. Why is this happening?

My confusion is around the fact that another endpoint is able to return a list of User objects with no issue.

I believe my Row is known as a "DTO". It is not mapped to a database table (unlike User), but is instead calculated using some fairly complicated logic and using data from multiple tables. If Row was an "entity" then I could set its fetch type to be eager and I believe that would solve the issue.

I understand that the User class is an entity and the Row class is not, so presumably it is something to do with this. But given User is serializable in one context, why is it not serializable in another context/all contexts?

Row.java

```<code>public class Row {

    private User user;
    private Float score1;
    private Float score2;

    // getters, setters etc
}
</code>```

User.java

```<code>@Entity
@Table(name="users")
public class User {

    private long userID;
    private String username;

    // getters and settesr etc
}
</code>```

Error

```<code>org.springframework.http.converter.HttpMessageConversionException: Type definition error: [simple type, class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor and no properties discovered to create BeanSerializer
</code>```

Body:
I am trying to create an endpoint (using Spring Boot) that will return a list of Row objects. However I am getting an error because the user attribute is not serializable. Why is this happening?

My confusion is around the fact that another endpoint is able to return a list of User objects with no issue.

I believe my Row is known as a "DTO". It is not mapped to a database table (unlike User), but is instead calculated using some fairly complicated logic and using data from multiple tables. If Row was an "entity" then I could set its fetch type to be eager and I believe that would solve the issue.

I understand that the User class is an entity and the Row class is not, so presumably it is something to do with this. But given User is serializable in one context, why is it not serializable in another context/all contexts?

Row.java

public class Row {

    private User user;
    private Float score1;
    private Float score2;

    // getters, setters etc
}

User.java

@Entity
@Table(name="users")
public class User {

    private long userID;
    private String username;

    // getters and settesr etc
}

Error

org.springframework.http.converter.HttpMessageConversionException: Type definition error: [simple type, class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor and no properties discovered to create BeanSerializer


问:
Get PowerBI Report object from within a Custom Visual
I'm building a series of Custom Visuals for PowerBI and am looking for a way to navigate through different pages in my report from within these custom visuals. For example, I have built a header with buttons, and clicking those buttons needs to change the page in the report.

I've tried various different code samples/suggestions that are out there, but they always lead to a deadend.

In short, using the library powerbi-client within a custom visual, how can I change the active page in a report?


问:
Opera only shows notifications when switched to a different tab
I'm trying to setup Notification api in Opera Browser.  My code works in Firefox, Safari, and Chrome.  It does not entirely work in Opera GX.

When the notification is created, the banner is only shown after the tab has been changed.  It doesn't matter how long ago the notification was created, nor does switching to another application trigger the event.  Only selecting a new tab.

Is this expected behavior?

Can I fix it with js?

Can I fix it within Opera GX?

EDIT: peculiar details.  It does not trigger the notification when switching to another tab on localhost.  Also, the one I'm triggering from is https://localhost:1234 (not an iframe, is https)


问:
How to self update a component after an async api call has completed?
This is my current code:

```<code>import React, { Component } from 'react';

class Test extends Component {

    test: boolean | null = null;

    constructor(props: any) {
        super(props);
        this.fetchCurrentChargingStatus();
    }

    async fetchCurrentChargingStatus(){
        const result = await fetch("some url");
        this.test = (await result.text()) == "true"
    }

    render() {
        return (
            <div>
                <button>{this.test == null ? "null" : this.test ? "True" : "False"}</button>
            </div>
        );
    }
}

export default Test;
</code>```

I make a REST-API call when this component is loaded. Depending on the result, I want to update the text of the button. How can this be achieved?

Body:
This is my current code:

import React, { Component } from 'react';

class Test extends Component {

    test: boolean | null = null;

    constructor(props: any) {
        super(props);
        this.fetchCurrentChargingStatus();
    }

    async fetchCurrentChargingStatus(){
        const result = await fetch("some url");
        this.test = (await result.text()) == "true"
    }

    render() {
        return (

                <button>{this.test == null ? "null" : this.test ? "True" : "False"}</button>

        );
    }
}

export default Test;

I make a REST-API call when this component is loaded. Depending on the result, I want to update the text of the button. How can this be achieved?


问:
Is it possible to get Websocket Id when receiving the message from MessageEventArgs?
I am trying to find websocket connection Id or some unique data that I can use to store connections.</p>
```<code>WebSocketServer wss = new WebSocketServer("ws://localhost:8887");
wss.AddWebSocketService<Message>("/Message");
wss.Start();
Console.ReadKey();
wss.Stop();

    protected override void OnMessage(MessageEventArgs message)
    {
         **var connectionID= ??? ;**
        Sessions.Broadcast(e.Data);
        Send(e.Data);
    }
</code>```

Body:
I am trying to find websocket connection Id or some unique data that I can use to store connections.

WebSocketServer wss = new WebSocketServer("ws://localhost:8887");
wss.AddWebSocketService<Message>("/Message");
wss.Start();
Console.ReadKey();
wss.Stop();

    protected override void OnMessage(MessageEventArgs message)
    {
         **var connectionID= ??? ;**
        Sessions.Broadcast(e.Data);
        Send(e.Data);
    }


问:
Play QueryStringBindable with Gradle
I am trying to implement a custom QueryStringBindable and use it in a Play project built with Gradle, but cannot figure out what is the SBT equivalent of routesImport.

There is this discussion:

gradle :compilePlayBinaryPlayRoutes is not generating all imports

but it appears to no longer work with Play 2.8. I tried

```<code>play {
  platform {
    playVersion = 2.8.17
    scalaVersion = 2.12.17
  }
//  additionalImports += ...
//  and
..  routesImport += ...

}
</code>```

but end up with Could not get unknown property 'routesImport' for extension 'play' of type org.gradle.playframework.extensions.PlayExtension.

Did something change in Play 2.8 or am I missing something?

Title: Play QueryStringBindable with Gradle

Body:
I am trying to implement a custom QueryStringBindable and use it in a Play project built with Gradle, but cannot figure out what is the SBT equivalent of routesImport.

There is this discussion:

gradle :compilePlayBinaryPlayRoutes is not generating all imports

but it appears to no longer work with Play 2.8. I tried

play {
  platform {
    playVersion = 2.8.17
    scalaVersion = 2.12.17
  }
//  additionalImports += ...
//  and
..  routesImport += ...

}

but end up with Could not get unknown property 'routesImport' for extension 'play' of type org.gradle.playframework.extensions.PlayExtension.

Did something change in Play 2.8 or am I missing something?


问:
Failed to load function definition from source: Failed to generate manifest from function source: Error: Cannot find module 'firebase-admin/auth'
I'm getting the following error while trying to deploy any function to firebase functions:

Command:

```<code>firebase deploy --only functions
</code>```

And this is the output

```<code>i  deploying functions
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
i  artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
✔  artifactregistry: required API artifactregistry.googleapis.com is enabled
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
i  functions: preparing codebase default for deployment

Error: Failed to load function definition from source: Failed to generate manifest from function source: Error: Cannot find module 'firebase-admin/auth'
</code>```

I've already tried removing node_modules folder with rm -rf node_modules and npm install with no success.

Firebase tools version: 11.18.0
Node version: v18.12.1
NPM version: 8.19.2

It was properly working only few days ago and suddenly stopped. Does anyone know how to fix this?

Body:
I'm getting the following error while trying to deploy any function to firebase functions:

Command:

firebase deploy --only functions

And this is the output

i  deploying functions
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
i  artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
✔  artifactregistry: required API artifactregistry.googleapis.com is enabled
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
i  functions: preparing codebase default for deployment

Error: Failed to load function definition from source: Failed to generate manifest from function source: Error: Cannot find module 'firebase-admin/auth'

I've already tried removing node_modules folder with rm -rf node_modules and npm install with no success.

Firebase tools version: 11.18.0
Node version: v18.12.1
NPM version: 8.19.2

It was properly working only few days ago and suddenly stopped. Does anyone know how to fix this?


问:
Create a new subdirectory for each walker - Emcee/MCMC
I am using the Emcee python package to fit some models to data. My python code is a wrapper to a separate piece of software. My code generates the input file to this software at each step in the MCMC chain.

For each iteration, I need to:

Copy the folder containing the software to a new folder with a unique path

Generate the input file within that folder

Run the software

Compare the output to the data

I am having trouble with Step 1. I have set up a function called model() which creates the new folder and input file for each iteration:

```<code>def model(theta):
    id_number = random.randint(100000)
    os.system('cp -R original/model/path/ new/model/path/{}/'.format(id_number))

    # then actually generate input and run the model using theta...
</code>```

The idea is that each walker copies the folder over with a unique ID, then generates an input file and runs the software from that particular unique location. However, the code doesn't seem to create a new folder for each individual walker. At the moment, the folder is successfully copied with a unique ID once, then all the walkers attempt to generate input files and run the software from that folder at the same time. I am not sure why this is.

The emcee part of my code is as follows:

```<code>from multiprocessing import Pool
import multiprocessing as mp
mp.set_start_method('fork')

def main(p0,nwalkers,niter,ndim,lnprob,data):
    with Pool() as pool:
        sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=data, pool=pool)
        pos, prob, state = sampler.run_mcmc(p0, niter, progress=True)

        return sampler, pos, prob, state

sampler, pos, prob, state = main(p0, nwalkers, niter, ndim, lnprob, data)
</code>```

A similar question was asked here, but I wasn't able to get this to work.

Body:
I am using the Emcee python package to fit some models to data. My python code is a wrapper to a separate piece of software. My code generates the input file to this software at each step in the MCMC chain.

For each iteration, I need to:

Copy the folder containing the software to a new folder with a unique path

Generate the input file within that folder

Run the software

Compare the output to the data

I am having trouble with Step 1. I have set up a function called model() which creates the new folder and input file for each iteration:

def model(theta):
    id_number = random.randint(100000)
    os.system('cp -R original/model/path/ new/model/path/{}/'.format(id_number))

    # then actually generate input and run the model using theta...

The idea is that each walker copies the folder over with a unique ID, then generates an input file and runs the software from that particular unique location. However, the code doesn't seem to create a new folder for each individual walker. At the moment, the folder is successfully copied with a unique ID once, then all the walkers attempt to generate input files and run the software from that folder at the same time. I am not sure why this is.

The emcee part of my code is as follows:

from multiprocessing import Pool
import multiprocessing as mp
mp.set_start_method('fork')

def main(p0,nwalkers,niter,ndim,lnprob,data):
    with Pool() as pool:
        sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=data, pool=pool)
        pos, prob, state = sampler.run_mcmc(p0, niter, progress=True)

        return sampler, pos, prob, state

sampler, pos, prob, state = main(p0, nwalkers, niter, ndim, lnprob, data)

A similar question was asked here, but I wasn't able to get this to work.


问:
Powershell how to replace multiple commands with output of single variable
I am traversing an object and would like to replace several path parts with a string stored in another variable. For example:

```<code># a is a complex ps object, the path is valid
$a.b.c
myvalue

$replace = "b.c"
$a.$($replace)
# here I expect 'myvalue', however nothing is returned, as I would like to execute the equivalent of $a.b.c
</code>```

Is there some way to do this replacement?

Body:
I am traversing an object and would like to replace several path parts with a string stored in another variable. For example:

# a is a complex ps object, the path is valid
$a.b.c
myvalue

$replace = "b.c"
$a.$($replace)
# here I expect 'myvalue', however nothing is returned, as I would like to execute the equivalent of $a.b.c

Is there some way to do this replacement?


问:
Spring Boot 3.0 Native: Code generation does not support org.springframework.statemachine.config.builders.StateMachineConfigBuilder<?, ?>
Spring Boot 3.0 brings support for native image creation using GraalVM.

I've recently upgraded my project, which implements spring-statemachine-core 3.2.0, to Spring Boot 3.0 and was eager to try out the new native image creation. However, when I run mvn spring-boot:process-aot, I get the following error:

```<code>Exception in thread "main" java.lang.IllegalArgumentException: Failed to generate code for 'org.springframework.statemachine.config.builders.StateMachineConfigBuilder@6b3b4f37' with type org.springframework.statemachine.config.builders.StateMachineConfigBuilder<?, ?>
        at org.springframework.beans.factory.aot.BeanDefinitionPropertyValueCodeGenerator.generateCode(BeanDefinitionPropertyValueCodeGenerator.java:101)
        at org.springframework.beans.factory.aot.BeanDefinitionPropertiesCodeGenerator.generateValue(BeanDefinitionPropertiesCodeGenerator.java:186)
        at org.springframework.beans.factory.aot.BeanDefinitionPropertiesCodeGenerator.lambda$addConstructorArgumentValues$3(BeanDefinitionPropertiesCodeGenerator.java:151)
        at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
        at java.base/java.util.Collections$UnmodifiableMap.forEach(Collections.java:1553)
        at org.springframework.beans.factory.aot.BeanDefinitionPropertiesCodeGenerator.addConstructorArgumentValues(BeanDefinitionPropertiesCodeGenerator.java:150)
        at org.springframework.beans.factory.aot.BeanDefinitionPropertiesCodeGenerator.generateCode(BeanDefinitionPropertiesCodeGenerator.java:119)
        at org.springframework.beans.factory.aot.DefaultBeanRegistrationCodeFragments.generateSetBeanDefinitionPropertiesCode(DefaultBeanRegistrationCodeFragments.java:146)
        at org.springframework.beans.factory.aot.BeanRegistrationCodeGenerator.generateCode(BeanRegistrationCodeGenerator.java:86)
        at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.lambda$generateBeanDefinitionMethod$3(BeanDefinitionMethodGenerator.java:186)
        at org.springframework.aot.generate.GeneratedMethod.<init>(GeneratedMethod.java:54)
        at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:112)
        at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:89)
        at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.generateBeanDefinitionMethod(BeanDefinitionMethodGenerator.java:180)
        at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.generateBeanDefinitionMethod(BeanDefinitionMethodGenerator.java:102)
        at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.lambda$generateRegisterBeanDefinitionsMethod$2(BeanRegistrationsAotContribution.java:85)
        at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
        at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.generateRegisterBeanDefinitionsMethod(BeanRegistrationsAotContribution.java:83)
        at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.lambda$applyTo$1(BeanRegistrationsAotContribution.java:67)
        at org.springframework.aot.generate.GeneratedMethod.<init>(GeneratedMethod.java:54)
        at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:112)
        at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:89)
        at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.applyTo(BeanRegistrationsAotContribution.java:66)
        at org.springframework.context.aot.BeanFactoryInitializationAotContributions.applyTo(BeanFactoryInitializationAotContributions.java:78)
        at org.springframework.context.aot.ApplicationContextAotGenerator.lambda$processAheadOfTime$0(ApplicationContextAotGenerator.java:58)
        at org.springframework.context.aot.ApplicationContextAotGenerator.withCglibClassHandler(ApplicationContextAotGenerator.java:67)
        at org.springframework.context.aot.ApplicationContextAotGenerator.processAheadOfTime(ApplicationContextAotGenerator.java:53)
        at org.springframework.context.aot.ContextAotProcessor.performAotProcessing(ContextAotProcessor.java:106)
        at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:84)
        at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:49)
        at org.springframework.context.aot.AbstractAotProcessor.process(AbstractAotProcessor.java:82)
        at org.springframework.boot.SpringApplicationAotProcessor.main(SpringApplicationAotProcessor.java:76)
Caused by: java.lang.IllegalArgumentException: Code generation does not support org.springframework.statemachine.config.builders.StateMachineConfigBuilder<?, ?>
        at org.springframework.beans.factory.aot.BeanDefinitionPropertyValueCodeGenerator.generateCode(BeanDefinitionPropertyValueCodeGenerator.java:133)
        at org.springframework.beans.factory.aot.BeanDefinitionPropertyValueCodeGenerator.generateCode(BeanDefinitionPropertyValueCodeGenerator.java:98)
        ... 31 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.052 s
[INFO] Finished at: 2022-12-12T20:41:00-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.0.0:process-aot (default-cli) on project glamitoms: Process terminated with exit code: 1 -> [Help 1]
</code>```

I've tried downgrading and switching versions of Spring SM but I get the same error every time. Are projects that implement Spring SM exempt from using Spring Boot native?

Body:
Spring Boot 3.0 brings support for native image creation using GraalVM.

I've recently upgraded my project, which implements spring-statemachine-core 3.2.0, to Spring Boot 3.0 and was eager to try out the new native image creation. However, when I run mvn spring-boot:process-aot, I get the following error:

Exception in thread "main" java.lang.IllegalArgumentException: Failed to generate code for 'org.springframework.statemachine.config.builders.StateMachineConfigBuilder@6b3b4f37' with type org.springframework.statemachine.config.builders.StateMachineConfigBuilder<?, ?>
        at org.springframework.beans.factory.aot.BeanDefinitionPropertyValueCodeGenerator.generateCode(BeanDefinitionPropertyValueCodeGenerator.java:101)
        at org.springframework.beans.factory.aot.BeanDefinitionPropertiesCodeGenerator.generateValue(BeanDefinitionPropertiesCodeGenerator.java:186)
        at org.springframework.beans.factory.aot.BeanDefinitionPropertiesCodeGenerator.lambda$addConstructorArgumentValues$3(BeanDefinitionPropertiesCodeGenerator.java:151)
        at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
        at java.base/java.util.Collections$UnmodifiableMap.forEach(Collections.java:1553)
        at org.springframework.beans.factory.aot.BeanDefinitionPropertiesCodeGenerator.addConstructorArgumentValues(BeanDefinitionPropertiesCodeGenerator.java:150)
        at org.springframework.beans.factory.aot.BeanDefinitionPropertiesCodeGenerator.generateCode(BeanDefinitionPropertiesCodeGenerator.java:119)
        at org.springframework.beans.factory.aot.DefaultBeanRegistrationCodeFragments.generateSetBeanDefinitionPropertiesCode(DefaultBeanRegistrationCodeFragments.java:146)
        at org.springframework.beans.factory.aot.BeanRegistrationCodeGenerator.generateCode(BeanRegistrationCodeGenerator.java:86)
        at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.lambda$generateBeanDefinitionMethod$3(BeanDefinitionMethodGenerator.java:186)
        at org.springframework.aot.generate.GeneratedMethod.<init>(GeneratedMethod.java:54)
        at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:112)
        at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:89)
        at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.generateBeanDefinitionMethod(BeanDefinitionMethodGenerator.java:180)
        at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.generateBeanDefinitionMethod(BeanDefinitionMethodGenerator.java:102)
        at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.lambda$generateRegisterBeanDefinitionsMethod$2(BeanRegistrationsAotContribution.java:85)
        at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
        at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.generateRegisterBeanDefinitionsMethod(BeanRegistrationsAotContribution.java:83)
        at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.lambda$applyTo$1(BeanRegistrationsAotContribution.java:67)
        at org.springframework.aot.generate.GeneratedMethod.<init>(GeneratedMethod.java:54)
        at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:112)
        at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:89)
        at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.applyTo(BeanRegistrationsAotContribution.java:66)
        at org.springframework.context.aot.BeanFactoryInitializationAotContributions.applyTo(BeanFactoryInitializationAotContributions.java:78)
        at org.springframework.context.aot.ApplicationContextAotGenerator.lambda$processAheadOfTime$0(ApplicationContextAotGenerator.java:58)
        at org.springframework.context.aot.ApplicationContextAotGenerator.withCglibClassHandler(ApplicationContextAotGenerator.java:67)
        at org.springframework.context.aot.ApplicationContextAotGenerator.processAheadOfTime(ApplicationContextAotGenerator.java:53)
        at org.springframework.context.aot.ContextAotProcessor.performAotProcessing(ContextAotProcessor.java:106)
        at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:84)
        at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:49)
        at org.springframework.context.aot.AbstractAotProcessor.process(AbstractAotProcessor.java:82)
        at org.springframework.boot.SpringApplicationAotProcessor.main(SpringApplicationAotProcessor.java:76)
Caused by: java.lang.IllegalArgumentException: Code generation does not support org.springframework.statemachine.config.builders.StateMachineConfigBuilder<?, ?>
        at org.springframework.beans.factory.aot.BeanDefinitionPropertyValueCodeGenerator.generateCode(BeanDefinitionPropertyValueCodeGenerator.java:133)
        at org.springframework.beans.factory.aot.BeanDefinitionPropertyValueCodeGenerator.generateCode(BeanDefinitionPropertyValueCodeGenerator.java:98)
        ... 31 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.052 s
[INFO] Finished at: 2022-12-12T20:41:00-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.0.0:process-aot (default-cli) on project glamitoms: Process terminated with exit code: 1 -> [Help 1]

I've tried downgrading and switching versions of Spring SM but I get the same error every time. Are projects that implement Spring SM exempt from using Spring Boot native?


问:
Saved Search Formula to get Second Last Item Receipt Date
I try to get the Second Last Item Receipt Date using this following formula in my Saved Search, but it is returning an Invalid Expression

CASE WHEN {trandate} < MAX({trandate}) THEN {trandate} ELSE NULL END

Any advice how to get the Second Last Date in Netsuite using formula ?


问:
Changing cluster label in KMeans Intercluster Distance Map (via MDS)
I was to creating the centroid map (KMeans Intercluster Distance Map) using the Python (using Spyder) below:

```<code>from yellowbrick.cluster import InterclusterDistance
k = 5
kmeans = KMeans( n_clusters = k, random_state=42,init='k-means++')
visualizer = InterclusterDistance(kmeans)
visualizer.fit(df_sample)        # Fit the data to the visualizer
visualizer.show()        # Finalize and render the figure
</code>```

Here's the result:

Is there a way I can change the label from 0-4 to 1-5?

Body:
I was to creating the centroid map (KMeans Intercluster Distance Map) using the Python (using Spyder) below:

from yellowbrick.cluster import InterclusterDistance
k = 5
kmeans = KMeans( n_clusters = k, random_state=42,init='k-means++')
visualizer = InterclusterDistance(kmeans)
visualizer.fit(df_sample)        # Fit the data to the visualizer
visualizer.show()        # Finalize and render the figure

Here's the result:

Is there a way I can change the label from 0-4 to 1-5?


问:
Building Tkinter GUI that displays , edits, and exports JSON file
I am a beginner with python and am trying to make a GUI with tkinter. The result should be a GUI where you can upload a JSON file and on the left column, all the data in the JSON will be displayed. The next columns are textboxes with options to enter data manually. The Sector box should be a dropdown menu with few options. A JSON file should be exported with the new information added when submitted.

GUI Diagram

Original JSON File Data: {"Test1": "Test1", "Test2": "Test2", "Test 3": "Test 3", "Test 4": "Test 4", "Test 5": "Test 5"}

For example, if I type '$100' in the revenues box and submit, the output JSON file should be:

{"Test1": "Test1", "Test2": "Test2", "Test 3": "Test 3", "Test 4": "Test 4", "Test 5": "Test 5", "Revenue": "$100"}

With my current code, I am not sure how to get the information from the text boxes, and I do not have the JSON file upload set up yet, just hard-coded.

```<code>#import necessary modules
import pandas as pd
import json
import tkinter as tk

#read the newline delimited json file into a dataframe, newline delimited jsons require lines=True to succeed
brand = pd.read_json('Testing.json', lines=True)

# Container for info pulled from JSON
data = {}
input_data = dict.fromkeys(['Username', 'Medium', 'Date Posted', 'Country', 'Sector',
                            'Revenue', 'Employees', 'Start', 'Step/War', 'Price/Blitz',
                            'Analysis', 'Additional info', 'Date Sold', 'Buyer'])

# Creating keys and value for data container
for row in brand.itertuples(index=False):
    counter = 0
    for i in range(len(row)):
        data[brand.columns[counter]] = row[counter]
        counter += 1

# TKINTER --------------------------------------------------------------------------------------------

# Setting up window
window = tk.Tk()
window.geometry('1000x1000')
window.title("JSON Sorting")
window.configure(bg='#EEF1DB', padx=250, pady=30)

label = tk.Label(text='Info pulled from JSON')
label.grid(column=2, row=0)

label = tk.Label(text='Manual Filtering/Ordering info')
label.grid(column=4, row=0)

# Displaying JSON info
c = 1
for x in data:

    info = tk.Label(text=x)
    info.grid(column=1, row=c)

    txtbox = tk.Text(window)
    txtbox.configure(height=8, pady=10)
    txtbox.grid(column=2, row=c)
    txtbox.insert(tk.INSERT, data[x])
    c+=1

# Creating Manual Textbox inputs
c = 1
for x in input_data:
    if c <= 8:
        label = tk.Label(text=x)
        label.grid(column=3, row=c)

        txtbox = tk.Text(window)
        txtbox.configure(height=8, pady=10)
        txtbox.grid(column=4, row=c)
    c+=1
    if c >= 8:
        label = tk.Label(text=x)
        label.grid(column=5, row=c-7)

        txtbox = tk.Text(window)
        txtbox.configure(height=8, pady=10)
        txtbox.grid(column=6, row=c-7)

butt = tk.Button(window, text='Submit')
butt.grid(column=2, row=len(data)+1)

window.mainloop()
</code>```

How should I set up the textboxes for the manual input so that it can be submitted with the button, and how to do so while keeping the original JSON information?

Body:
I am a beginner with python and am trying to make a GUI with tkinter. The result should be a GUI where you can upload a JSON file and on the left column, all the data in the JSON will be displayed. The next columns are textboxes with options to enter data manually. The Sector box should be a dropdown menu with few options. A JSON file should be exported with the new information added when submitted.

GUI Diagram

Original JSON File Data: {"Test1": "Test1", "Test2": "Test2", "Test 3": "Test 3", "Test 4": "Test 4", "Test 5": "Test 5"}

For example, if I type '$100' in the revenues box and submit, the output JSON file should be:

{"Test1": "Test1", "Test2": "Test2", "Test 3": "Test 3", "Test 4": "Test 4", "Test 5": "Test 5", "Revenue": "$100"}

With my current code, I am not sure how to get the information from the text boxes, and I do not have the JSON file upload set up yet, just hard-coded.

#import necessary modules
import pandas as pd
import json
import tkinter as tk

#read the newline delimited json file into a dataframe, newline delimited jsons require lines=True to succeed
brand = pd.read_json('Testing.json', lines=True)

# Container for info pulled from JSON
data = {}
input_data = dict.fromkeys(['Username', 'Medium', 'Date Posted', 'Country', 'Sector',
                            'Revenue', 'Employees', 'Start', 'Step/War', 'Price/Blitz',
                            'Analysis', 'Additional info', 'Date Sold', 'Buyer'])

# Creating keys and value for data container
for row in brand.itertuples(index=False):
    counter = 0
    for i in range(len(row)):
        data[brand.columns[counter]] = row[counter]
        counter += 1

# TKINTER --------------------------------------------------------------------------------------------

# Setting up window
window = tk.Tk()
window.geometry('1000x1000')
window.title("JSON Sorting")
window.configure(bg='#EEF1DB', padx=250, pady=30)

label = tk.Label(text='Info pulled from JSON')
label.grid(column=2, row=0)

label = tk.Label(text='Manual Filtering/Ordering info')
label.grid(column=4, row=0)

# Displaying JSON info
c = 1
for x in data:

    info = tk.Label(text=x)
    info.grid(column=1, row=c)

    txtbox = tk.Text(window)
    txtbox.configure(height=8, pady=10)
    txtbox.grid(column=2, row=c)
    txtbox.insert(tk.INSERT, data[x])
    c+=1

# Creating Manual Textbox inputs
c = 1
for x in input_data:
    if c <= 8:
        label = tk.Label(text=x)
        label.grid(column=3, row=c)

        txtbox = tk.Text(window)
        txtbox.configure(height=8, pady=10)
        txtbox.grid(column=4, row=c)
    c+=1
    if c >= 8:
        label = tk.Label(text=x)
        label.grid(column=5, row=c-7)

        txtbox = tk.Text(window)
        txtbox.configure(height=8, pady=10)
        txtbox.grid(column=6, row=c-7)

butt = tk.Button(window, text='Submit')
butt.grid(column=2, row=len(data)+1)

window.mainloop()

How should I set up the textboxes for the manual input so that it can be submitted with the button, and how to do so while keeping the original JSON information?


问:
Unable to display information from multiple data models in AWS Amplify UI component (React)
I am using AWS Amplify and Amplify Studio to build a simple web app. I have created two Data Models, Booking and Provider. Using the UI Library visual editor, I am able to select multiple component properties and set these to the relevant data models but the issue arrises once I pull these components down locally and attempt to display this information in my react app.

I have created some test data in amplify and use the following code to render the data:

```<code>import * as React from 'react';
import PropTypes from 'prop-types';
import Tabs from '@mui/material/Tabs';
import Tab from '@mui/material/Tab';
import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';
import { Booking, Provider } from '../models';
import { useEffect, useState } from 'react';
import SwipeableViews from 'react-swipeable-views';
import { useTheme } from '@mui/material/styles';
import { DataStore } from 'aws-amplify';
import { Bookings } from '../ui-components';

function App() {

  const [bookings, setBookings] = useState([])

  const getBookings = async () => {
    const data = await DataStore.query(Booking)
    setBookings(data)
  }

  useEffect(() => {
    getBookings()
  }, [])

  return (
    <div>
      {bookings.map(booking => <Bookings booking={booking} provider={booking.Provider} key=booking.id}/>)}
    </div>
  );
}
</code>```

The problem arrises where I am trying to display providerName from the Provider Data Model. According to the guide here by an AWS Amplify developer here: https://youtu.be/ea6qrUMwqEo?t=751, I should be able to pass my Booking model to my Bookings Component and then I should be able to pass the Provider model the booking.Provider due to the relationship between the two models.

I have used console.log to print out each individual booking component and this below is the result.

I suspect the issue is because the booking.Provider data model is contained within a Promise and therefore it is unable to access it properly?

Any help would be much appreciated!

Body:
I am using AWS Amplify and Amplify Studio to build a simple web app. I have created two Data Models, Booking and Provider. Using the UI Library visual editor, I am able to select multiple component properties and set these to the relevant data models but the issue arrises once I pull these components down locally and attempt to display this information in my react app.

I have created some test data in amplify and use the following code to render the data:

import * as React from 'react';
import PropTypes from 'prop-types';
import Tabs from '@mui/material/Tabs';
import Tab from '@mui/material/Tab';
import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';
import { Booking, Provider } from '../models';
import { useEffect, useState } from 'react';
import SwipeableViews from 'react-swipeable-views';
import { useTheme } from '@mui/material/styles';
import { DataStore } from 'aws-amplify';
import { Bookings } from '../ui-components';

function App() {

  const [bookings, setBookings] = useState([])

  const getBookings = async () => {
    const data = await DataStore.query(Booking)
    setBookings(data)
  }

  useEffect(() => {
    getBookings()
  }, [])

  return (

      {bookings.map(booking => <Bookings booking={booking} provider={booking.Provider} key=booking.id}/>)}

  );
}

The problem arrises where I am trying to display providerName from the Provider Data Model. According to the guide here by an AWS Amplify developer here: https://youtu.be/ea6qrUMwqEo?t=751, I should be able to pass my Booking model to my Bookings Component and then I should be able to pass the Provider model the booking.Provider due to the relationship between the two models.

I have used console.log to print out each individual booking component and this below is the result.

I suspect the issue is because the booking.Provider data model is contained within a Promise and therefore it is unable to access it properly?

Any help would be much appreciated!


问:
Why is the "." period not working anymore in dplyr pipes as it used to?
I used the "." a lot to work with pipes chains in R and dplyr. However, now old code seems to now work anymore with that syntax. I could not find any answers on google. What am I missing?

Here is a silly example just to explain what I am referring to:

```<code>test <- iris |>
  select(Sepal.Length, Sepal.Width)

random <- data.frame(
  Sepal.Length = sample(iris$Sepal.Length),
  Sepal.Width = sample(iris$Sepal.Width)) |>
  bind_rows(., test) |>
  ggplot(aes(x=Sepal.Length, y=Sepal.Width)) +
  geom_point()
</code>```

The code above used to work, but now it fails with an error that "." was not found.

Body:
I used the "." a lot to work with pipes chains in R and dplyr. However, now old code seems to now work anymore with that syntax. I could not find any answers on google. What am I missing?

Here is a silly example just to explain what I am referring to:

test <- iris |>
  select(Sepal.Length, Sepal.Width)

random <- data.frame(
  Sepal.Length = sample(iris$Sepal.Length),
  Sepal.Width = sample(iris$Sepal.Width)) |>
  bind_rows(., test) |>
  ggplot(aes(x=Sepal.Length, y=Sepal.Width)) +
  geom_point()

The code above used to work, but now it fails with an error that "." was not found.


问:
I can't correctly set float type variables when entering them in custom component text boxes
I can't correctly set the variables when I set the value in custom component boxes.

The expected result: e.g.

I receive 300.00 in a custom textbox, and I replace 300.00 by 100.00, the expected result when I click on the button must be 100.00, but the real result is 0.00.

I declare these variables in SetVar.cs that is my class.

```<code>float t1, t2, t3, t4;
</code>```

This is the constructor where I receive the initial values from the previous form:

```<code>  public SetVar(float x1, float x2, float x3, float x4)
        {
            InitializeComponent();
            row_var1.Value1 = x1;
            row_var1.Value2 = x2;
            row_var2.Value1 = x3;
            row_var2.Value2 = x4;
        }
</code>```

And in this portion of code you have to pay close attention. What I want is to set the text box assigning it the floating value that I want and that is not zero, I am doing the validation and setting wrong. I know. But in this code is the real problem. The values when clicking on the button should be modified to the value with which I edit the text boxes and not with zero.

```<code>public float T1
    {
        get
        {
            return t1;
        }
        set
        {

            t1 = value;

        }
    }
    public float T2
    {

        get
        {
            return t2;
        }
        set
        {

            t2 = value;

        }
    }
    public float T3
    {

        get
        {
            return t3;
        }
        set
        {

            t3 = value;

        }
    }
    public float T4
    {
        get
        {
            return t4;
        }
        set
        {

            t4 = value;

        }
    }
</code>```

This is the setter I'm setting the values:

```<code>   public void setValues()
        {
        this.row_var1.Value1 = T1;
        this.row_var1.Value2 = T2;
        this.row_var2.Value1 = T3;
        this.row_var2.Value2 = T4;
        }
</code>```

And by last, this is the button that calls "Setting values". Here I'm setting the values in another form.

```<code>  private void button1_Click(object sender, EventArgs e)
    {
        this.setValues();

        var frm = Application.OpenForms.OfType<Main>().FirstOrDefault();

        if (frm != null)
        {
            frm = new Main(this.row_var1.Value1, this.row_var1.Value2,
                this.row_var2.Value1, this.row_var2.Value2,
           );

            frm.Activate();

        }
        Close();
    }
</code>```

but you must pay attention to this code:

```<code> public float T1
    {
        get
        {
            return t1;
        }
        set
        {

            t1 = value;

        }
    }
    public float T2
    {

        get
        {
            return t2;
        }
        set
        {

            t2 = value;

        }
    }
    public float T3
    {

        get
        {
            return t3;
        }
        set
        {

            t3 = value;

        }
    }
    public float T4
    {
        get
        {
            return t4;
        }
        set
        {

            t4 = value;

        }
    }
</code>```

Variables should be set to a user entered value and not zero. These are t1, t2, t3 and t4 and must be stored in textboxes' values row_var1.Value1, row_var1.Value2, row_var2.Value1 and row_var2.Value2, respectively.

Can someone provide a precise solution so that the values initialized in the constructor can be set by values entered by the user and not by zero as it happens with the code in T1, T2, T3, T4 {get, set} ?

Body:
I can't correctly set the variables when I set the value in custom component boxes.

The expected result: e.g.

I receive 300.00 in a custom textbox, and I replace 300.00 by 100.00, the expected result when I click on the button must be 100.00, but the real result is 0.00.

I declare these variables in SetVar.cs that is my class.

float t1, t2, t3, t4;

This is the constructor where I receive the initial values from the previous form:

  public SetVar(float x1, float x2, float x3, float x4)
        {
            InitializeComponent();
            row_var1.Value1 = x1;
            row_var1.Value2 = x2;
            row_var2.Value1 = x3;
            row_var2.Value2 = x4;
        }

And in this portion of code you have to pay close attention. What I want is to set the text box assigning it the floating value that I want and that is not zero, I am doing the validation and setting wrong. I know. But in this code is the real problem. The values when clicking on the button should be modified to the value with which I edit the text boxes and not with zero.

public float T1
    {
        get
        {
            return t1;
        }
        set
        {

            t1 = value;

        }
    }
    public float T2
    {

        get
        {
            return t2;
        }
        set
        {

            t2 = value;

        }
    }
    public float T3
    {

        get
        {
            return t3;
        }
        set
        {

            t3 = value;

        }
    }
    public float T4
    {
        get
        {
            return t4;
        }
        set
        {

            t4 = value;

        }
    }

This is the setter I'm setting the values:

   public void setValues()
        {
        this.row_var1.Value1 = T1;
        this.row_var1.Value2 = T2;
        this.row_var2.Value1 = T3;
        this.row_var2.Value2 = T4;
        }

And by last, this is the button that calls "Setting values". Here I'm setting the values in another form.

  private void button1_Click(object sender, EventArgs e)
    {
        this.setValues();

        var frm = Application.OpenForms.OfType().FirstOrDefault();

        if (frm != null)
        {
            frm = new Main(this.row_var1.Value1, this.row_var1.Value2,
                this.row_var2.Value1, this.row_var2.Value2,
           );

            frm.Activate();

        }
        Close();
    }

but you must pay attention to this code:

 public float T1
    {
        get
        {
            return t1;
        }
        set
        {

            t1 = value;

        }
    }
    public float T2
    {

        get
        {
            return t2;
        }
        set
        {

            t2 = value;

        }
    }
    public float T3
    {

        get
        {
            return t3;
        }
        set
        {

            t3 = value;

        }
    }
    public float T4
    {
        get
        {
            return t4;
        }
        set
        {

            t4 = value;

        }
    }

Variables should be set to a user entered value and not zero. These are t1, t2, t3 and t4 and must be stored in textboxes' values row_var1.Value1, row_var1.Value2, row_var2.Value1 and row_var2.Value2, respectively.

Can someone provide a precise solution so that the values initialized in the constructor can be set by values entered by the user and not by zero as it happens with the code in T1, T2, T3, T4 {get, set} ?


问:
Operations Dashboard shows 'The branch for this project has no active pipeline configuration.'
One of my projects shows 'The branch for this project has no active pipeline configuration' on the operations dashboard and does not report the status. All my other projects are fine.  The project does indeed have a pipeline on branch 'main', and in all respects seems normal to me. What could be the cause?</p>


问:
How to scan a multiple lines input into an ArrayList?
When I try creating a new ArrayList object and scanning the input into it, it doesn't print anything. For example this doesn't work:

```<code>    Scanner scanner = new Scanner(System.in);
        ArrayList<String> input = new ArrayList<>();

        while (scanner.hasNextLine())
        {
            String[] tokens = scanner.nextLine().split("\\s");
            for (int i = 0; i < tokens.length; i++)
            {
                input.add(tokens[i]);
            }
        }
        System.out.print(input.toString());

        scanner.close();
</code>```

However, for some reason when I print it inside the while loop it prints the output I want.

```<code>    Scanner scanner = new Scanner(System.in);
        ArrayList<String> input = new ArrayList<>();

        while (scanner.hasNextLine())
        {
            String[] tokens = scanner.nextLine().split("\\s");
            for (int i = 0; i < tokens.length; i++)
            {
                input.add(tokens[i]);
            }
            System.out.print(input.toString());

        }

        scanner.close();
</code>```

It might seem like I got the answer I want (by putting the print statement in the loop) but that is not what I am trying to do. Ultimately, I am trying to manipulate the ArrayList in the future.

Body:
When I try creating a new ArrayList object and scanning the input into it, it doesn't print anything. For example this doesn't work:

    Scanner scanner = new Scanner(System.in);
        ArrayList<String> input = new ArrayList<>();

        while (scanner.hasNextLine())
        {
            String[] tokens = scanner.nextLine().split("\\s");
            for (int i = 0; i < tokens.length; i++)
            {
                input.add(tokens[i]);
            }
        }
        System.out.print(input.toString());

        scanner.close();

However, for some reason when I print it inside the while loop it prints the output I want.

    Scanner scanner = new Scanner(System.in);
        ArrayList<String> input = new ArrayList<>();

        while (scanner.hasNextLine())
        {
            String[] tokens = scanner.nextLine().split("\\s");
            for (int i = 0; i < tokens.length; i++)
            {
                input.add(tokens[i]);
            }
            System.out.print(input.toString());

        }

        scanner.close();

It might seem like I got the answer I want (by putting the print statement in the loop) but that is not what I am trying to do. Ultimately, I am trying to manipulate the ArrayList in the future.


问:
What are possible reasons for the " warning: could not find UI helper 'GitHub.UI' " with Git under windows
My Git version is 2.39.0 (the recent one) under windows 10. I got the

```<code>warning: could not find UI helper 'GitHub.UI' when trying to
clone a rep on github.
</code>```

What are possible causes of this error?

And how to fix it?

Reinstalling Git, rebooting. Still the same error.

Body:
My Git version is 2.39.0 (the recent one) under windows 10. I got the

warning: could not find UI helper 'GitHub.UI' when trying to
clone a rep on github.

What are possible causes of this error?

And how to fix it?

Reinstalling Git, rebooting. Still the same error.


问:
had a question about my code and why it possibly wasnt working any help would be appreciated
```<code><!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" type="text/css" href="css/quiz.css" />
</head>
<body>
// Create the login form
const form = document.createElement('form');
form.method = 'post';
form.action = '/login';

// Create the username input field
const usernameInput = document.createElement('input');
usernameInput.type = 'text';
usernameInput.name = 'username';
usernameInput.placeholder = 'Username';
form.appendChild(usernameInput);

// Create the password input field
const passwordInput = document.createElement('input');
passwordInput.type = 'password';
passwordInput.name = 'password';
passwordInput.placeholder = 'Password';
form.appendChild(passwordInput);

// Create the submit button
const submitButton = document.createElement('button');
submitButton.type = 'submit';
submitButton.innerText = 'Login';
form.appendChild(submitButton);

// Add the form to the page
document.body.appendChild(form);

// Handle the form submission
form.addEventListener('submit', event => {
    event.preventDefault();</body>

    // Get the username and password
    const username = usernameInput.value;
    const password = passwordInput.value;

    // Store the login information in local storage
    localStorage.setItem('username', username);
    localStorage.setItem('password', password);

    // Redirect the user to the homepage
    window.location.href = '/home';
});

<div id="divid">Next</div>
    <script type="text/javascript" src="js/quiz.js"></script>

</body>
</html>
</code>```

I wanted to create a login screen for a website to get it started I was wondering how i might edit this to make it efficient. This is written in JavaScript. I have 9 errors and when I try correcting them its not working.
Expression expected.ln1 col 1
';' expected. ln1 col 11
JSX element 'meta' has no corresponding closing tag. ln4 col 6
Unexpected token. Did you mean {'>'} or >? ln38 col 40
'}' expected. ln39 col 27
Unexpected token. Did you mean {'}'} or }? ln52 col 1
Expected corresponding JSX closing tag for 'html'. ln57 col 3
Declaration or statement expected. ln 58 col 1
Expression expected. ln 58 col 1

Body:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" type="text/css" href="css/quiz.css" />

// Create the login form
const form = document.createElement('form');
form.method = 'post';
form.action = '/login';

// Create the username input field
const usernameInput = document.createElement('input');
usernameInput.type = 'text';
usernameInput.name = 'username';
usernameInput.placeholder = 'Username';
form.appendChild(usernameInput);

// Create the password input field
const passwordInput = document.createElement('input');
passwordInput.type = 'password';
passwordInput.name = 'password';
passwordInput.placeholder = 'Password';
form.appendChild(passwordInput);

// Create the submit button
const submitButton = document.createElement('button');
submitButton.type = 'submit';
submitButton.innerText = 'Login';
form.appendChild(submitButton);

// Add the form to the page
document.body.appendChild(form);

// Handle the form submission
form.addEventListener('submit', event => {
    event.preventDefault();

    // Get the username and password
    const username = usernameInput.value;
    const password = passwordInput.value;

    // Store the login information in local storage
    localStorage.setItem('username', username);
    localStorage.setItem('password', password);

    // Redirect the user to the homepage
    window.location.href = '/home';
});

Next

I wanted to create a login screen for a website to get it started I was wondering how i might edit this to make it efficient. This is written in JavaScript. I have 9 errors and when I try correcting them its not working.
Expression expected.ln1 col 1
';' expected. ln1 col 11
JSX element 'meta' has no corresponding closing tag. ln4 col 6
Unexpected token. Did you mean {'>'} or >? ln38 col 40
'}' expected. ln39 col 27
Unexpected token. Did you mean {'}'} or }? ln52 col 1
Expected corresponding JSX closing tag for 'html'. ln57 col 3
Declaration or statement expected. ln 58 col 1
Expression expected. ln 58 col 1


问:
how to make two mat-form-field inputs stay inside the parent div without extrapolating?
I'm trying to make two "mat-form-field" side by side and not break the parent div.

And, here is the code:

```<code><div class="flex gap">
  <mat-form-field appearance="outline" class="w-100">
    <mat-label>Latitude</mat-label>
    <input type="text" matInput formControlName="latitude" />
  </mat-form-field>
  <mat-form-field appearance="outline" class="w-100">
    <mat-label>Longitude</mat-label>
    <input type="text" matInput formControlName="longitude" />
  </mat-form-field>
</div>
</code>```

CSS:

```<code>.gap {
  gap: 24px;
}

</code>```

I already tried to put "box-sizing: border-box", but I was not successful

Body:
I'm trying to make two "mat-form-field" side by side and not break the parent div.

And, here is the code:

  <mat-form-field appearance="outline" class="w-100">
    <mat-label>Latitude</mat-label>
    <input type="text" matInput formControlName="latitude" />
  </mat-form-field>
  <mat-form-field appearance="outline" class="w-100">
    <mat-label>Longitude</mat-label>
    <input type="text" matInput formControlName="longitude" />
  </mat-form-field>

CSS:

.gap {
  gap: 24px;
}

I already tried to put "box-sizing: border-box", but I was not successful


问:
PictureBox.BringToFront(); Not working with transparency
I need to put a picturebox above another picture box, the picturebox on top is a png file with a transparent background but when trying to use Picturebox.BringToFront(); the picturebox below is replaced with what is in the background of the form.

I tried to get around this using picturebox.Parent = picturebox2, but I don't want the picturebox to be cut off at the edges of the other picturebox it's on top of.


问:
Create Program reads Float Big Endian from game (Cemu) to get position of player
I learned a bit of the basics of C# language a couple years ago and now I'm slowly trying to increase knowledge of it through the creation of a trainer for a CEMU game i really enjoyed (hope i dont get criticized for my honesty).
Since i'm a noob at this i learned much from looking at another trainer that a programer released on gitHub, mostly copying classes and then trying to understand the how and why of things... Surely not the best way to learn but one has to start somewhre. But now i'm way out of my league.
I've managed to get offsets (2byte Big Endian) of many things (HP,Stamina,Speed, Stamina) and am able to chage values. Now i wanted to get player position and though i have right offsets i have no idea how work with Float Big Endian.
My repositary (not all files yet) is here:
https://github.com/Snowfall007/ZELDA-BOTW-Trainer
The class - ProcessWrapper is probably the key, but dont know how to work it.
Any good samaritan with patience and skill to help this kid at heart?

```<code>internal class ProcessWrapper
    {
        private readonly string _processName;
        private string _processLocation;
        private Kernel32.SafeHPROCESS _process;
        private long _baseAddress = 0x0;

        public ProcessWrapper(string processName)
        {
            _processName = processName;
        }

        public bool OpenProcess()
        {
            Process[] processes = Process.GetProcessesByName(_processName);

            if (processes.Length != 1)
            {
                return false;
            }

            // Required rights : 0x0010 | 0x0400 | 0x0020 | 0x0008
            _process = Kernel32.OpenProcess(ACCESS_MASK.GENERIC_ALL, true, (uint)processes[0].Id);

            if (processes[0].MainModule == null) throw new Exception("Process main module is null.");

            _processLocation = processes[0].MainModule.FileName;

            return true;
        }

        public void SetBaseAddress(long baseAddress)
        {
            _baseAddress = baseAddress;
        }

        public bool OverwriteMemoryProtection(long address, int size)
        {
            return Kernel32.VirtualProtectEx(_process, (IntPtr)(_baseAddress + address), size, Kernel32.MEM_PROTECTION.PAGE_READWRITE, out Kernel32.MEM_PROTECTION oldProtection);
        }

        public byte[] ReadMemory(long address, int size, MemoryType memoryType)
        {
            IntPtr memoryReadPtr = Marshal.AllocHGlobal(size);

            Kernel32.ReadProcessMemory(_process, (IntPtr)(_baseAddress + address), memoryReadPtr, size, out SizeT readSize);

            byte[] memoryBuffer = new byte[readSize];
            Marshal.Copy(memoryReadPtr, memoryBuffer, 0, readSize);
            Marshal.FreeHGlobal(memoryReadPtr);

            return ProcessMemoryType(memoryBuffer, memoryType);
        }

        public byte[] ReadMemory(Offset offset)
        {
            return ReadMemory(offset.Address, offset.Size, offset.MemoryType);
        }

        public bool WriteMemory(long address, byte[] data, MemoryType memoryType)
        {
            data = ProcessMemoryType(data, memoryType);

            IntPtr dataPtr = Marshal.AllocHGlobal(data.Length);

            Marshal.Copy(data, 0, dataPtr, data.Length);

            bool writeResult = Kernel32.WriteProcessMemory(_process, (IntPtr)(_baseAddress + address), dataPtr, data.Length, out SizeT wroteCount);

            Marshal.FreeHGlobal(dataPtr);

            return writeResult;
        }

        public bool WriteMemory(Offset offset, byte[] data)
        {
            return WriteMemory(offset.Address, data, offset.MemoryType);
        }

        public string GetProcessLocation()
        {
            return _processLocation;
        }

        private static byte[] ProcessMemoryType(byte[] data, MemoryType memoryType)
        {
            if (memoryType == MemoryType.BigEndian && data.Length > 1)
            {
                data = data.Reverse().ToArray();
            }
            return data;
        }
    }

//In Form1 class i've have also these instructions:

//Coordinates
        //Position
        public int GetXPosition()
        {
            return ReadOffset(GameOffsets.Xposition);
        }
        public bool UpdateXPosition(int value)
        {
            return WriteOffset(GameOffsets.Xposition, value);
        }
        public int GetYPosition()
        {
            return ReadOffset(GameOffsets.Yposition);
        }
        public bool UpdateYPosition(int value)
        {
            return WriteOffset(GameOffsets.Yposition, value);
        }
        public int GetZPosition()
        {
            return ReadOffset(GameOffsets.Zposition);
        }
        public bool UpdateZPosition(int value)
        {
            return WriteOffset(GameOffsets.Zposition, value);
        }

//AND ALSO THIS:

private int ReadOffset(Offset offset)
        {
            byte[] data = _processWrapper.ReadMemory(offset);

            if (data.Length != offset.Size) return -1;
            else if (data.Length == 1) return data[0];
            else if (data.Length == 2) return BitConverter.ToInt16(data, 0);

            throw new Exception("32 Bits and 64 Bits types are currently not handled");
        }
</code>```

How can i make changes to work specifically with Float Big Endian?

Body:
I learned a bit of the basics of C# language a couple years ago and now I'm slowly trying to increase knowledge of it through the creation of a trainer for a CEMU game i really enjoyed (hope i dont get criticized for my honesty).
Since i'm a noob at this i learned much from looking at another trainer that a programer released on gitHub, mostly copying classes and then trying to understand the how and why of things... Surely not the best way to learn but one has to start somewhre. But now i'm way out of my league.
I've managed to get offsets (2byte Big Endian) of many things (HP,Stamina,Speed, Stamina) and am able to chage values. Now i wanted to get player position and though i have right offsets i have no idea how work with Float Big Endian.
My repositary (not all files yet) is here:
https://github.com/Snowfall007/ZELDA-BOTW-Trainer
The class - ProcessWrapper is probably the key, but dont know how to work it.
Any good samaritan with patience and skill to help this kid at heart?

internal class ProcessWrapper
    {
        private readonly string _processName;
        private string _processLocation;
        private Kernel32.SafeHPROCESS _process;
        private long _baseAddress = 0x0;

        public ProcessWrapper(string processName)
        {
            _processName = processName;
        }

        public bool OpenProcess()
        {
            Process[] processes = Process.GetProcessesByName(_processName);

            if (processes.Length != 1)
            {
                return false;
            }

            // Required rights : 0x0010 | 0x0400 | 0x0020 | 0x0008
            _process = Kernel32.OpenProcess(ACCESS_MASK.GENERIC_ALL, true, (uint)processes[0].Id);

            if (processes[0].MainModule == null) throw new Exception("Process main module is null.");

            _processLocation = processes[0].MainModule.FileName;

            return true;
        }

        public void SetBaseAddress(long baseAddress)
        {
            _baseAddress = baseAddress;
        }

        public bool OverwriteMemoryProtection(long address, int size)
        {
            return Kernel32.VirtualProtectEx(_process, (IntPtr)(_baseAddress + address), size, Kernel32.MEM_PROTECTION.PAGE_READWRITE, out Kernel32.MEM_PROTECTION oldProtection);
        }

        public byte[] ReadMemory(long address, int size, MemoryType memoryType)
        {
            IntPtr memoryReadPtr = Marshal.AllocHGlobal(size);

            Kernel32.ReadProcessMemory(_process, (IntPtr)(_baseAddress + address), memoryReadPtr, size, out SizeT readSize);

            byte[] memoryBuffer = new byte[readSize];
            Marshal.Copy(memoryReadPtr, memoryBuffer, 0, readSize);
            Marshal.FreeHGlobal(memoryReadPtr);

            return ProcessMemoryType(memoryBuffer, memoryType);
        }

        public byte[] ReadMemory(Offset offset)
        {
            return ReadMemory(offset.Address, offset.Size, offset.MemoryType);
        }

        public bool WriteMemory(long address, byte[] data, MemoryType memoryType)
        {
            data = ProcessMemoryType(data, memoryType);

            IntPtr dataPtr = Marshal.AllocHGlobal(data.Length);

            Marshal.Copy(data, 0, dataPtr, data.Length);

            bool writeResult = Kernel32.WriteProcessMemory(_process, (IntPtr)(_baseAddress + address), dataPtr, data.Length, out SizeT wroteCount);

            Marshal.FreeHGlobal(dataPtr);

            return writeResult;
        }

        public bool WriteMemory(Offset offset, byte[] data)
        {
            return WriteMemory(offset.Address, data, offset.MemoryType);
        }

        public string GetProcessLocation()
        {
            return _processLocation;
        }

        private static byte[] ProcessMemoryType(byte[] data, MemoryType memoryType)
        {
            if (memoryType == MemoryType.BigEndian && data.Length > 1)
            {
                data = data.Reverse().ToArray();
            }
            return data;
        }
    }

//In Form1 class i've have also these instructions:

//Coordinates
        //Position
        public int GetXPosition()
        {
            return ReadOffset(GameOffsets.Xposition);
        }
        public bool UpdateXPosition(int value)
        {
            return WriteOffset(GameOffsets.Xposition, value);
        }
        public int GetYPosition()
        {
            return ReadOffset(GameOffsets.Yposition);
        }
        public bool UpdateYPosition(int value)
        {
            return WriteOffset(GameOffsets.Yposition, value);
        }
        public int GetZPosition()
        {
            return ReadOffset(GameOffsets.Zposition);
        }
        public bool UpdateZPosition(int value)
        {
            return WriteOffset(GameOffsets.Zposition, value);
        }

//AND ALSO THIS:

private int ReadOffset(Offset offset)
        {
            byte[] data = _processWrapper.ReadMemory(offset);

            if (data.Length != offset.Size) return -1;
            else if (data.Length == 1) return data[0];
            else if (data.Length == 2) return BitConverter.ToInt16(data, 0);

            throw new Exception("32 Bits and 64 Bits types are currently not handled");
        }

How can i make changes to work specifically with Float Big Endian?