问:
Django In-built Messages
I'm working on one of my Django Project(currently it's only able to Registered user and get them logged in). but the problem that I have facing is that when users provide incorrect data while registering(like password1 does not match with password2 etc.) the in-built error messages (provided by Django Framework) popping up on my landing page and even after refreshing the page its still reflect there.

is there any way to clear them? (using Js or any other in-built mechanism)?

`

```<code>{% if messages %}
    {% for message in messages %}
    <article class="container message is-small" id="msgcontainer">
        <div class="message-header">
            <p>Message</p>
            <button class="delete" id="msg-btn" aria-label="delete"></button>
        </div>
        <div class="message-body">
            <p>{{ message }}</p>
        </div>
    </article>
    {% endfor %}
    {% endif %}
</code>```

`

I have try using js to get rid of those messages after popping up, but its not working that way.

Title: Django In-built Messages

Body:
I'm working on one of my Django Project(currently it's only able to Registered user and get them logged in). but the problem that I have facing is that when users provide incorrect data while registering(like password1 does not match with password2 etc.) the in-built error messages (provided by Django Framework) popping up on my landing page and even after refreshing the page its still reflect there.

is there any way to clear them? (using Js or any other in-built mechanism)?

`

{% if messages %}
    {% for message in messages %}

Message

            <button class="delete" id="msg-btn" aria-label="delete"></button>

{{ message }}

    {% endfor %}
    {% endif %}

`

I have try using js to get rid of those messages after popping up, but its not working that way.


来源: stackexchange

问:
Using typescript decorators in multiple files
i'm developing a script in typescript that uses decorators, the decorator function add the decorated class to a list, when an event happens a method inside the class will be called like a callback. It all works if there are multiple decorated classes inside the same file but if i put a class with the decorator inside another file it doesn't work.

This is my code:

```<code>export class Person {
  sayRole(): void {
    console.log("generic");
  }
}

@PersonDecorator("Bob")
export class Student extends Person {
  sayRole(): void {
    console.log("student");
  }
}

var people = new Array<Person>();
function PersonDecorator(name:string) {
  return (target: any) => {
    (<Person>target).sayRole();
  };
}
</code>```

ContentLicense: CC BY-SA 4.0

Body:
i'm developing a script in typescript that uses decorators, the decorator function add the decorated class to a list, when an event happens a method inside the class will be called like a callback. It all works if there are multiple decorated classes inside the same file but if i put a class with the decorator inside another file it doesn't work.

This is my code:

export class Person {
  sayRole(): void {
    console.log("generic");
  }
}

@PersonDecorator("Bob")
export class Student extends Person {
  sayRole(): void {
    console.log("student");
  }
}

var people = new Array<Person>();
function PersonDecorator(name:string) {
  return (target: any) => {
    (<Person>target).sayRole();
  };
}


问:
Automatically expand hierarchical List view to show the selected (nested) item
I use the following code to display a hierarchical navigation sidebar in my app:

```<code>NavigationSplitView {
    List (selection: $curr){
        OutlineGroup (data, children: \.children) { c in
            NavigationLink (value: c) {
                Label (c.name)
            }
        }
    } detail: {
        //...
    }
}
</code>```

This all works well, and I'm able to use the hierarchical list to select an item and I can read the value from the curr variable. The list also correctly highlights an element if I assign some value to the curr variable (i.e. after my program selects an item programmatically).

What doesn't work, however, is that if the curr is set to some nested element, say (A/A.1/A1.1), the list is not expanded to show the selected A11.1 element.

So, the question is how to make the list automatically expand upon setting of the $curr variable?

Body:
I use the following code to display a hierarchical navigation sidebar in my app:

NavigationSplitView {
    List (selection: $curr){
        OutlineGroup (data, children: \.children) { c in
            NavigationLink (value: c) {
                Label (c.name)
            }
        }
    } detail: {
        //...
    }
}

This all works well, and I'm able to use the hierarchical list to select an item and I can read the value from the curr variable. The list also correctly highlights an element if I assign some value to the curr variable (i.e. after my program selects an item programmatically).

What doesn't work, however, is that if the curr is set to some nested element, say (A/A.1/A1.1), the list is not expanded to show the selected A11.1 element.

So, the question is how to make the list automatically expand upon setting of the $curr variable?


问:
How can i terminate getServerSideProps when it client goes to another route
My /wallet page api request in getServerSideProps falls on timeout. Even when the client goes to another route in nav bar for Link /wallet page getServerSideProps still continues and complete the request redirect to /wallet page again. How can i terminate getServerSideProps when it client goes to another route?

export async function getServerSideProps(context) {
    try {
        const smartcard = await axiosServer.get(`/user/wallet/${context.params.id}`);

        try {
            const transactions = await axiosServer.get(`/user/wallet/${context.params.id}/transactions`);
            return {
                props: {
                    wallet: wallet.data,
                    transactions : transactions.data,
                },
            };
        } catch (e) {
            return {
                props: {
                    wallet: wallet.data,
                    transactions: {},
                },
            };
        }
    } catch (e) {
        return {
            props: {},
        };
    }
}
```


问:
object detection library problem in importing Object_Detection
I have already pip install object_detection lib, but when importing : from object_detection import ObjectDetection . I got error:

```<code>ImportError: cannot import name 'ObjectDetection' from 'object_detection' (/usr/local/lib/python3.8/dist-packages/object_detection/__init__.py)
</code>```

I searched a lot but didn't find the solution.

Body:
I have already pip install object_detection lib, but when importing : from object_detection import ObjectDetection . I got error:

ImportError: cannot import name 'ObjectDetection' from 'object_detection' (/usr/local/lib/python3.8/dist-packages/object_detection/__init__.py)

I searched a lot but didn't find the solution.


问:
How force a reload of a page with Node.js?
For a school project, we try to code a Wordle type game.

We are implementing an incremental mode where the user starts with a 3 letters long words and then have a 4's one in case of success etc ...

The fact is, we have problems from the 3 letters long game to go to the 4 letters long one.

From the front, Ajax is used to ask the server to res.render another page but the render isn't done. The page isn't reloaded, and we stay also on a "you won" page.

How could I force the reloading of the current page or render the same page but with the parameter of the current word length incremented ?

The part form the front used :

```<code>$("input").on("keydown", function (event) {
      if (event.key == 'Enter' && this.checkValidity()) {
      let mot_entre = this.value;
      entrerUnMot(mot_entre);
      this.value = '';

      if (mot_entre == app.mot) {
          $("input").remove();
          $("#victory").text("Bravo, vous avez gagné!");
          if (<%= id_joueur %> != 0) {
          sauvegarderScore("<%= mode %>", <%= nb_lettres %>, <%= id_joueur %>);
          }
          app.partie_gagnee = true;
          if ("<%= mode %>" == "incremental" && parseInt(<%= nb_lettres %>) < INCREMENTAL_LETTRES_MAX) {
          incrementerPartie(<%= nb_lettres %>, <%= id_joueur %>);
          }
      }
      }
  });
</code>```

Ajax request :

```<code>function incrementerPartie(nb_lettres, id_joueur) {
      $.ajax({
      type: 'POST',
      url: '/jouer/incrementalNextGame',
      data: {nb_lettres: nb_lettres, id_joueur: id_joueur},
      success: function() {
      },
      error: function() {
          alert("impossible de lancer la partie suivante du mode incrémental");
      }
      });
  }
</code>```

Here is the back-end code used :

```<code>router.use('/incrementalNextGame', (req, res, next) => {
res.render('jouer.ejs', {mode: "incremental", nb_lettres: parseInt(req.body.nb_lettres) + 1, id_joueur: req.body.id_joueur});});
</code>```

Body:
For a school project, we try to code a Wordle type game.

We are implementing an incremental mode where the user starts with a 3 letters long words and then have a 4's one in case of success etc ...

The fact is, we have problems from the 3 letters long game to go to the 4 letters long one.

From the front, Ajax is used to ask the server to res.render another page but the render isn't done. The page isn't reloaded, and we stay also on a "you won" page.

How could I force the reloading of the current page or render the same page but with the parameter of the current word length incremented ?

The part form the front used :

$("input").on("keydown", function (event) {
      if (event.key == 'Enter' && this.checkValidity()) {
      let mot_entre = this.value;
      entrerUnMot(mot_entre);
      this.value = '';

      if (mot_entre == app.mot) {
          $("input").remove();
          $("#victory").text("Bravo, vous avez gagné!");
          if (<%= id_joueur %> != 0) {
          sauvegarderScore("<%= mode %>", <%= nb_lettres %>, <%= id_joueur %>);
          }
          app.partie_gagnee = true;
          if ("<%= mode %>" == "incremental" && parseInt(<%= nb_lettres %>) < INCREMENTAL_LETTRES_MAX) {
          incrementerPartie(<%= nb_lettres %>, <%= id_joueur %>);
          }
      }
      }
  });

Ajax request :

function incrementerPartie(nb_lettres, id_joueur) {
      $.ajax({
      type: 'POST',
      url: '/jouer/incrementalNextGame',
      data: {nb_lettres: nb_lettres, id_joueur: id_joueur},
      success: function() {
      },
      error: function() {
          alert("impossible de lancer la partie suivante du mode incrémental");
      }
      });
  }

Here is the back-end code used :

router.use('/incrementalNextGame', (req, res, next) => {
res.render('jouer.ejs', {mode: "incremental", nb_lettres: parseInt(req.body.nb_lettres) + 1, id_joueur: req.body.id_joueur});});


问:
how to revert GitHub repository to previous commit?
it is related to GitHUB.

I AM UNABLE TO MAKE CHANGES AND REVERT IN GITHUB
I want to undo a whole commit with all the changes. Instead of doing all this manually , I want to know more about  how to revert a commit


问:
Cannot fetch api data in javascript using fetch method
I am building a simple web app to get me the meaning of a word, I am using oxford dictionary api to get the word meanings but unable to do so.
In oxford dictionary documentation sample python code is given which I am able to run properly with flask here is the code

But when I try to implement the same code in vanila JS I am getting the following errors:

with (mode:"cors") : 403 error

with (mode:"no-cors") :

"Access to fetch at 'https://od-api.oxforddictionaries.com/api/v2/entries/en-gb/phobia' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled."

```<code>word = "phobia";
language = "en-gb";

const options = {
  method: "GET",
  mode:'cors',
  headers: {
    app_id: "<app id>",
    app_key: "<app key>",
  },
};
fetch(`https://od-api.oxforddictionaries.com/api/v2/entries/${language}/${word}`, options)
.then(response => response.json())
.then(response => {
    console.log(response);
  })
.catch(err => console.error(err));
</code>```

How to solve the issue ?

Body:
I am building a simple web app to get me the meaning of a word, I am using oxford dictionary api to get the word meanings but unable to do so.
In oxford dictionary documentation sample python code is given which I am able to run properly with flask here is the code

But when I try to implement the same code in vanila JS I am getting the following errors:

with (mode:"cors") : 403 error

with (mode:"no-cors") :

"Access to fetch at 'https://od-api.oxforddictionaries.com/api/v2/entries/en-gb/phobia' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled."

word = "phobia";
language = "en-gb";

const options = {
  method: "GET",
  mode:'cors',
  headers: {
    app_id: "<app id>",
    app_key: "<app key>",
  },
};
fetch(`https://od-api.oxforddictionaries.com/api/v2/entries/${language}/${word}`, options)
.then(response => response.json())
.then(response => {
    console.log(response);
  })
.catch(err => console.error(err));

How to solve the issue ?


问:
Re-use Xcode custom script build rules between targets
I have a large Xcode project with lots of targets (130+ and growing), and each of these targets needs several custom script build rules.  These build rules are however all identical between the targets.

I have already put the entire script in an single external .sh file, but the build rule definitions themselves multiply like rabbits, making changes to these rules tiresome (I still have to tweak the script's cmdline args every now and then; thank god there's also plain text editors with regex replaces), and they also clog up my project file (4000+ lines already - Git patches are awful here).

I already tried hacking the .pbxproj file to keep one of each set of build rules, and let all projects re-use those rule's unique IDs, but that turned out to be a brittle solution at best :P

Is there any way to define these build rules in another location and have them implicitly or explicitly be used in the individual targets?  I suspect a resounding 'no', but one can hope...


问:
How to concatenate strings to get the correct variable and function names
Considering this bit of code, I would like to be able to add values to the correct state using the same function to avoid code duplications. How can I concatenate strings to get the correct variable and function names?

```<code>const [questionsAdditionalProperties, setQuestionsAdditionalProperties] = useState([]);
const [usersAdditionalProperties, setUsersAdditionalProperties] = useState([]);

const handleAddAdditionalProperty = (type) => {
  //how to concatenate this valiable name to access the value in state?
  const key = ${type}AdditionalProperties.length;
  let newAdditionalProperty = [];
  newAdditionalProperty.push(
  // how to concatenate the function name to call the correct hook?
    getQuestionsAdditionalPropertiesRow(type, key)
  );
// how to concatenate the function name to call the correct hook and the variable name to use spread?
  setQuestionsAdditionalProperties([...questionsAdditionalProperties, ...newAdditionalProperty]);
};

<p className="right" onClick={e => handleAddAdditionalProperty("questions")}><Button variant="primary" >Add Question Additional Property</Button></p>

<p className="right" onClick={e => handleAddAdditionalProperty("users")}><Button variant="primary" >Add Users Additional Property</Button></p>
</code>```

I don't want to use objects as this will lead me to refactor too much code in this application.

Body:
Considering this bit of code, I would like to be able to add values to the correct state using the same function to avoid code duplications. How can I concatenate strings to get the correct variable and function names?

const [questionsAdditionalProperties, setQuestionsAdditionalProperties] = useState([]);
const [usersAdditionalProperties, setUsersAdditionalProperties] = useState([]);

const handleAddAdditionalProperty = (type) => {
  //how to concatenate this valiable name to access the value in state?
  const key = ${type}AdditionalProperties.length;
  let newAdditionalProperty = [];
  newAdditionalProperty.push(
  // how to concatenate the function name to call the correct hook?
    getQuestionsAdditionalPropertiesRow(type, key)
  );
// how to concatenate the function name to call the correct hook and the variable name to use spread?
  setQuestionsAdditionalProperties([...questionsAdditionalProperties, ...newAdditionalProperty]);
};

 handleAddAdditionalProperty("questions")}><Button variant="primary" >Add Question Additional Property</Button>

 handleAddAdditionalProperty("users")}><Button variant="primary" >Add Users Additional Property</Button>

I don't want to use objects as this will lead me to refactor too much code in this application.


问:
Encrypting the input and output of a docker container
I have a docker container and someone is going to run this container and it will provide some form of communication (e.g. a simple REST service).

I don't want the user who runs the docker to have access to the data that is sent to the docker or the data that is being received. Is this feasible?

The easiest solution that comes to my mind is that I can encrypt the data before sending it to the docker. But is there a way to prevent the user to have access to the key required for decrypting this data which is stored inside the docker container?


问:
Digikey OAuth2 API Connection
I am trying to implement digikey.com API in my windows app. I want to search for part detail based on either partnumber or keyword.
I have tried below code but its not working, giving error. Where am I making mistake, please help.
I am not able to verify, they have mentioned something called sandbox and production application. Two different things. See documents here: https://developer.digikey.com/documentation/oauth

'''

```<code>import requests

client_id = '<client-id>'
client_secret = '<client-secret>'
redirect_uri = 'https://localhost:8139/digikey_callback'

auth_response = requests.get('https://sandbox-api.digikey.com/v1/oauth2/authorize', params={
    'client_id': client_id,
    'redirect_uri': redirect_uri,
    'response_type': 'code'
})

auth_code = auth_response.url.split('code=')[1]

token_response = requests.post('https://api.digikey.com/v1/oauth2/token', data={
    'client_id': client_id,
    'client_secret': client_secret,
    'redirect_uri': redirect_uri,
    'code': auth_code,
    'grant_type': 'authorization_code'
})

access_token = token_response.json()['access_token']

search_response = requests.get('https://api.digikey.com/v1/products/search', params={
    'access_token': access_token,
    'keywords': 'screw'
})

print(search_response.json())
</code>```

'''

Title: Digikey OAuth2 API Connection

Body:
I am trying to implement digikey.com API in my windows app. I want to search for part detail based on either partnumber or keyword.
I have tried below code but its not working, giving error. Where am I making mistake, please help.
I am not able to verify, they have mentioned something called sandbox and production application. Two different things. See documents here: https://developer.digikey.com/documentation/oauth

'''

import requests

client_id = '<client-id>'
client_secret = '<client-secret>'
redirect_uri = 'https://localhost:8139/digikey_callback'

auth_response = requests.get('https://sandbox-api.digikey.com/v1/oauth2/authorize', params={
    'client_id': client_id,
    'redirect_uri': redirect_uri,
    'response_type': 'code'
})

auth_code = auth_response.url.split('code=')[1]

token_response = requests.post('https://api.digikey.com/v1/oauth2/token', data={
    'client_id': client_id,
    'client_secret': client_secret,
    'redirect_uri': redirect_uri,
    'code': auth_code,
    'grant_type': 'authorization_code'
})

access_token = token_response.json()['access_token']

search_response = requests.get('https://api.digikey.com/v1/products/search', params={
    'access_token': access_token,
    'keywords': 'screw'
})

print(search_response.json())

'''


问:
Descriptions across the scale in corrplot()
Is any way how to move labels put over scale in corrplot?


问:
Dataframe get max() from multiple columns in a rolling window - Shape Error
EDIT 2:

Considier the question closed.
After I gave the example in the first EDIT I have realised that I am senslessly looking through all of the columns looking for Highest value, since the High column will always have the highest value and the following code is sufficient:

```<code>_high[f'Highest {n1}'] = price_df['High'].rolling(n1).max()
</code>```

I am trying to get max from multiple columns with this code:

```<code>_high[f'Highest {n1}'] = price_df[['Open', 'Close', 'High', 'Low']].rolling(n1).max()
</code>```

, but I am getting this error:

```<code>  File "C:\Users\...\main.py", line 1282, in chop_zone
    _high[f'Highest {n1}'] = price_df[['Open', 'Close', 'High', 'Low']].rolling(n1).max()
  File "C:\Users\...\venv\lib\site-packages\pandas\core\frame.py", line 3968, in __setitem__
    self._set_item_frame_value(key, value)
  File "C:\Users\...\venv\lib\site-packages\pandas\core\frame.py", line 4098, in _set_item_frame_value
    raise ValueError("Columns must be same length as key")
ValueError: Columns must be same length as key

Process finished with exit code 1
</code>```

And I don't know why, how can I fix this?

EDIT:

What I expect the output to be:

Lets say I have the following dataframe (it is price_df[['Open', 'Close', 'High', 'Low']].tail(10))

```<code>         Open     Close      High       Low
5168  14010.0  14016.00  14024.05  14005.50
5169  14016.0  14018.00  14018.50  14007.50
5170  14018.0  14015.50  14021.50  14012.50
5171  14015.5  14007.00  14018.00  14004.50
5172  14007.0  14013.00  14013.50  13999.50
5173  14013.0  14007.00  14013.50  14002.00
5174  14007.0  14009.60  14017.60  14003.55
5175  14009.6  14013.60  14015.00  14004.60
5176  14013.6  14020.00  14021.60  14009.00
5177  14020.0  14015.55  14022.60  14013.60
</code>```

So I expect a single column with the maximum value from the rolling window of size n1 along all columns.
For example if the rolling window would be 3 the first maximal value would be  14024.5 from column High across all columns from index 5168 to 5170, the next maximal value would be 14021.5 from the high column across from indices 5169 to 5171.

Body:
EDIT 2:

Considier the question closed.
After I gave the example in the first EDIT I have realised that I am senslessly looking through all of the columns looking for Highest value, since the High column will always have the highest value and the following code is sufficient:

_high[f'Highest {n1}'] = price_df['High'].rolling(n1).max()

I am trying to get max from multiple columns with this code:

_high[f'Highest {n1}'] = price_df[['Open', 'Close', 'High', 'Low']].rolling(n1).max()

, but I am getting this error:

  File "C:\Users\...\main.py", line 1282, in chop_zone
    _high[f'Highest {n1}'] = price_df[['Open', 'Close', 'High', 'Low']].rolling(n1).max()
  File "C:\Users\...\venv\lib\site-packages\pandas\core\frame.py", line 3968, in __setitem__
    self._set_item_frame_value(key, value)
  File "C:\Users\...\venv\lib\site-packages\pandas\core\frame.py", line 4098, in _set_item_frame_value
    raise ValueError("Columns must be same length as key")
ValueError: Columns must be same length as key

Process finished with exit code 1

And I don't know why, how can I fix this?

EDIT:

What I expect the output to be:

Lets say I have the following dataframe (it is price_df[['Open', 'Close', 'High', 'Low']].tail(10))

         Open     Close      High       Low
5168  14010.0  14016.00  14024.05  14005.50
5169  14016.0  14018.00  14018.50  14007.50
5170  14018.0  14015.50  14021.50  14012.50
5171  14015.5  14007.00  14018.00  14004.50
5172  14007.0  14013.00  14013.50  13999.50
5173  14013.0  14007.00  14013.50  14002.00
5174  14007.0  14009.60  14017.60  14003.55
5175  14009.6  14013.60  14015.00  14004.60
5176  14013.6  14020.00  14021.60  14009.00
5177  14020.0  14015.55  14022.60  14013.60

So I expect a single column with the maximum value from the rolling window of size n1 along all columns.
For example if the rolling window would be 3 the first maximal value would be  14024.5 from column High across all columns from index 5168 to 5170, the next maximal value would be 14021.5 from the high column across from indices 5169 to 5171.


问:
How i can get list of ssh_url repo from gitlab.com
How i can get list of ssh url repo from gitlab.
I have group with some id 56627504, and try to get list of all ssh repository which was created under this group i use

```<code>curl --header "PRIVATE-TOKEN: glpat-pnwcu54ZQKz3gtyG-fty" "https://gitlab.com/api/v4/groups/56627504/" | jq -r '.projects[*].ssh_url_to_repo'
</code>```

THis part of my json-object

```<code>  "id": 56627504,
  "web_url": "https://gitlab.com/groups/awg-roi-new",
  "name": "awg-roi-new",
  "path": "awg-roi-new",
  "description": "",
  "visibility": "private",
  "share_with_group_lock": false,
  "require_two_factor_authentication": false,
  "two_factor_grace_period": 48,
  "project_creation_level": "developer",
  "auto_devops_enabled": null,
  "subgroup_creation_level": "maintainer",
  "emails_disabled": null,
  "mentions_disabled": null,
  "lfs_enabled": true,
  "default_branch_protection": 2,
  "avatar_url": null,
  "request_access_enabled": true,
  "full_name": "awg-roi-new",
  "full_path": "awg-roi-new",
  "created_at": "2022-08-12T12:49:50.607Z",
  "parent_id": null,
  "ldap_cn": null,
  "ldap_access": null,
  "shared_with_groups": [],
  "prevent_sharing_groups_outside_hierarchy": false,
  "projects": [
    {
      "id": 39020008,
      "description": null,
      "name": "Roi4cio B4r Db",
      "name_with_namespace": "awg-roi-new / Roi4cio B4r Db",
      "path": "roi4cio-b4r-db",
      "path_with_namespace": "awg-roi-new/roi4cio-b4r-db",
      "created_at": "2022-08-31T08:17:59.863Z",
      "default_branch": "master",
      "tag_list": [],
      "topics": [],
      "ssh_url_to_repo": "git@gitlab.com:awg-roi-new/roi4cio-b4r-db.git",
      "http_url_to_repo": "https://gitlab.com/awg-roi-new/roi4cio-b4r-db.git",
      "web_url": "https://gitlab.com/awg-roi-new/roi4cio-b4r-db",
      "readme_url": "https://gitlab.com/awg-roi-new/roi4cio-b4r-db/-/blob/master/readme.md",
      "avatar_url": null,
      "forks_count": 0,
      "star_count": 0,
      "last_activity_at": "2022-11-09T15:20:16.950Z",
      "namespace": {
</code>```

But if i use code like this its work only for one repo

```<code>curl --header "PRIVATE-TOKEN: Private-token" "https://gitlab.com/api/v4/groups/56627504/" | jq -r '.projects[0].ssh_url_to_repo'
</code>```

Body:
How i can get list of ssh url repo from gitlab.
I have group with some id 56627504, and try to get list of all ssh repository which was created under this group i use

curl --header "PRIVATE-TOKEN: glpat-pnwcu54ZQKz3gtyG-fty" "https://gitlab.com/api/v4/groups/56627504/" | jq -r '.projects[*].ssh_url_to_repo'

THis part of my json-object

  "id": 56627504,
  "web_url": "https://gitlab.com/groups/awg-roi-new",
  "name": "awg-roi-new",
  "path": "awg-roi-new",
  "description": "",
  "visibility": "private",
  "share_with_group_lock": false,
  "require_two_factor_authentication": false,
  "two_factor_grace_period": 48,
  "project_creation_level": "developer",
  "auto_devops_enabled": null,
  "subgroup_creation_level": "maintainer",
  "emails_disabled": null,
  "mentions_disabled": null,
  "lfs_enabled": true,
  "default_branch_protection": 2,
  "avatar_url": null,
  "request_access_enabled": true,
  "full_name": "awg-roi-new",
  "full_path": "awg-roi-new",
  "created_at": "2022-08-12T12:49:50.607Z",
  "parent_id": null,
  "ldap_cn": null,
  "ldap_access": null,
  "shared_with_groups": [],
  "prevent_sharing_groups_outside_hierarchy": false,
  "projects": [
    {
      "id": 39020008,
      "description": null,
      "name": "Roi4cio B4r Db",
      "name_with_namespace": "awg-roi-new / Roi4cio B4r Db",
      "path": "roi4cio-b4r-db",
      "path_with_namespace": "awg-roi-new/roi4cio-b4r-db",
      "created_at": "2022-08-31T08:17:59.863Z",
      "default_branch": "master",
      "tag_list": [],
      "topics": [],
      "ssh_url_to_repo": "git@gitlab.com:awg-roi-new/roi4cio-b4r-db.git",
      "http_url_to_repo": "https://gitlab.com/awg-roi-new/roi4cio-b4r-db.git",
      "web_url": "https://gitlab.com/awg-roi-new/roi4cio-b4r-db",
      "readme_url": "https://gitlab.com/awg-roi-new/roi4cio-b4r-db/-/blob/master/readme.md",
      "avatar_url": null,
      "forks_count": 0,
      "star_count": 0,
      "last_activity_at": "2022-11-09T15:20:16.950Z",
      "namespace": {

But if i use code like this its work only for one repo

curl --header "PRIVATE-TOKEN: Private-token" "https://gitlab.com/api/v4/groups/56627504/" | jq -r '.projects[0].ssh_url_to_repo'


问:
How to create a Counter object or a defaultdict in PoweShell
I am writing a PowerShell script that examines a collection of objects and counts how many times various properties are seen.  In Python, I would use a Counter object, but PowerShell doesn't seem to have a standard counter/bag/multiset object. My need is fairly simple, so I could use a defaultdict, but that also doesn't seem to exist.  Is there a standard way to do this?  Thanks!</p>


问:
Express, Mongoose with Custom API send more requests than expected
I have a code that fetch total users set in a document of stats collection.
As shown here :

{ stats:"stats", users:50, totalActiveUsers:45 }
```
<p>I made a route in express that will save new user in users collection then call email api and then update the value in stats collection by 1 and I want if the users are 100 then stop accepting.</p>
<pre class="lang-js prettyprint-override"><code>router.get('/newuser',async (req,res)=\>{
var { email } = req.query;
var stats = await Stats.findOne({status:"stats"}).lean();

if(stats.users == 100){
return res.json({msg:"Sorry 100 Users Already Registered"});
}

await fetch(`https://myemailapi.xyz/?email=${email}`);
await Stats.findOneAndUpdate({status:"stats"},{users:stats.users++});
var user = new User({ email : email });
await user.save();

res.json({msg:"Registered Successfully"});
})
</code>```

When many users register on my website, I see 100 users in stats collection but when I check my email api dashboard it shows it have sent 110+ emails.

How do I fix this problem ??

I wanted that 100 users register and 100 emails should be sent.

Body:
I have a code that fetch total users set in a document of stats collection.
As shown here :

{ stats:"stats", users:50, totalActiveUsers:45 }

I made a route in express that will save new user in users collection then call email api and then update the value in stats collection by 1 and I want if the users are 100 then stop accepting.

router.get('/newuser',async (req,res)=\>{
var { email } = req.query;
var stats = await Stats.findOne({status:"stats"}).lean();

if(stats.users == 100){
return res.json({msg:"Sorry 100 Users Already Registered"});
}

await fetch(`https://myemailapi.xyz/?email=${email}`);
await Stats.findOneAndUpdate({status:"stats"},{users:stats.users++});
var user = new User({ email : email });
await user.save();

res.json({msg:"Registered Successfully"});
})

When many users register on my website, I see 100 users in stats collection but when I check my email api dashboard it shows it have sent 110+ emails.

How do I fix this problem ??

I wanted that 100 users register and 100 emails should be sent.


问:
RuntimeError: failed to factorize matrix
I want to find the inversion of scipy.sparse.coo_matrix matrix.

adj = to_scipy_sparse_matrix(graph.edge_index)
<796022x796022 sparse matrix of type '<class 'numpy.float32'>'
with 1791298 stored elements in COOrdinate format>

```<code>from scipy.sparse.linalg import inv
Dinv = inv(adj)
Dinv`
</code>```

I write the above code but it show the error: RuntimeError: failed to factorize matrix

```<code>---------------------------------------------------------------------------
>
> RuntimeError                              Traceback (most recent call last)
> Input In \[77\], in \<cell line: 2\>()
> 1 from scipy.sparse.linalg import inv
> 2 Dinv = inv(adj2)
> 3 Dinv
>
> File \~\\Anaconda3\\lib\\site-packages\\scipy\\sparse\\linalg_matfuncs.py:75, in inv(A)
> 73 # Use sparse direct solver to solve "AX = I" accurately
> 74 I = \_ident_like(A)
> 75 Ainv = spsolve(A, I)
> 76 return Ainv
>
> File \~\\Anaconda3\\lib\\site-packages\\scipy\\sparse\\linalg_dsolve\\linsolve.py:236, in spsolve(A, b, permc_spec, use_umfpack)
> 233         x = x.ravel()
> 234 else:
> 235     # b is sparse
> 236     Afactsolve = factorized(A)
> 238     if not (isspmatrix_csc(b) or is_pydata_spmatrix(b)):
> 239         warn('spsolve is more efficient when sparse b '
> 240              'is in the CSC matrix format', SparseEfficiencyWarning)
>
> File \~\\Anaconda3\\lib\\site-packages\\scipy\\sparse\\linalg_dsolve\\linsolve.py:525, in factorized(A)
> 523     return solve
> 524 else:
> 525     return splu(A).solve
>
> File \~\\Anaconda3\\lib\\site-packages\\scipy\\sparse\\linalg_dsolve\\linsolve.py:366, in splu(A, permc_spec, diag_pivot_thresh, relax, panel_size, options)
> 363 if (\_options\["ColPerm"\] == "NATURAL"):
> 364     \_options\["SymmetricMode"\] = True
> 366 return \_superlu.gstrf(N, A.nnz, A.data, A.indices, A.indptr,
> 367                       csc_construct_func=csc_construct_func,
> 368                       ilu=False, options=\_options)
>
> RuntimeError: failed to factorize matrix at line 110 in file ../../scipy/sparse/linalg/\_dsolve/SuperLU/SRC/ssnode_bmod.c
</code>```

Body:
I want to find the inversion of scipy.sparse.coo_matrix matrix.

adj = to_scipy_sparse_matrix(graph.edge_index)
<796022x796022 sparse matrix of type '<class 'numpy.float32'>'
with 1791298 stored elements in COOrdinate format>

from scipy.sparse.linalg import inv
Dinv = inv(adj)
Dinv`

I write the above code but it show the error: RuntimeError: failed to factorize matrix

---------------------------------------------------------------------------
>
> RuntimeError                              Traceback (most recent call last)
> Input In \[77\], in \<cell line: 2\>()
> 1 from scipy.sparse.linalg import inv
> 2 Dinv = inv(adj2)
> 3 Dinv
>
> File \~\\Anaconda3\\lib\\site-packages\\scipy\\sparse\\linalg_matfuncs.py:75, in inv(A)
> 73 # Use sparse direct solver to solve "AX = I" accurately
> 74 I = \_ident_like(A)
> 75 Ainv = spsolve(A, I)
> 76 return Ainv
>
> File \~\\Anaconda3\\lib\\site-packages\\scipy\\sparse\\linalg_dsolve\\linsolve.py:236, in spsolve(A, b, permc_spec, use_umfpack)
> 233         x = x.ravel()
> 234 else:
> 235     # b is sparse
> 236     Afactsolve = factorized(A)
> 238     if not (isspmatrix_csc(b) or is_pydata_spmatrix(b)):
> 239         warn('spsolve is more efficient when sparse b '
> 240              'is in the CSC matrix format', SparseEfficiencyWarning)
>
> File \~\\Anaconda3\\lib\\site-packages\\scipy\\sparse\\linalg_dsolve\\linsolve.py:525, in factorized(A)
> 523     return solve
> 524 else:
> 525     return splu(A).solve
>
> File \~\\Anaconda3\\lib\\site-packages\\scipy\\sparse\\linalg_dsolve\\linsolve.py:366, in splu(A, permc_spec, diag_pivot_thresh, relax, panel_size, options)
> 363 if (\_options\["ColPerm"\] == "NATURAL"):
> 364     \_options\["SymmetricMode"\] = True
> 366 return \_superlu.gstrf(N, A.nnz, A.data, A.indices, A.indptr,
> 367                       csc_construct_func=csc_construct_func,
> 368                       ilu=False, options=\_options)
>
> RuntimeError: failed to factorize matrix at line 110 in file ../../scipy/sparse/linalg/\_dsolve/SuperLU/SRC/ssnode_bmod.c


问:
With spring state machine , can timerOnce be tested
Using spring state machine we have a transition to new state using timerOnce

```<code>.source(States.PRE_ACT).target(States.ACT)
                    .timerOnce(100000)
                    .action(doSomething)
</code>```

Is there a way to test that the state machine is progressing to desired state?

the only option I saw was using

```<code> .defaultAwaitTime(100000)

</code>```

on the StateMachineTestPlan

Is there a nicer way doing it?

Body:
Using spring state machine we have a transition to new state using timerOnce

.source(States.PRE_ACT).target(States.ACT)
                    .timerOnce(100000)
                    .action(doSomething)

Is there a way to test that the state machine is progressing to desired state?

the only option I saw was using

 .defaultAwaitTime(100000)

on the StateMachineTestPlan

Is there a nicer way doing it?


问:
How to get the names of embedded resx files
I need a little advice on how to get the names of the resx embedded files. I have a Languages folder and in it resx files and I would like to get the names of these files.

I tried to do this:

```<code>Assembly assembly = Assembly.GetExecutingAssembly();
string[] resourceNames = assembly.GetManifestResourceNames();
string folderName = "Languages";

foreach (string resourceName in resourceNames)
{
    if (resourceName.StartsWith(folderName) && resourceName.EndsWith(".resx"))
    {
        string fileName = resourceName.Substring(folderName.Length + 1);
        Console.WriteLine(fileName);
    }
}
</code>```

Body:
I need a little advice on how to get the names of the resx embedded files. I have a Languages folder and in it resx files and I would like to get the names of these files.

I tried to do this:

Assembly assembly = Assembly.GetExecutingAssembly();
string[] resourceNames = assembly.GetManifestResourceNames();
string folderName = "Languages";

foreach (string resourceName in resourceNames)
{
    if (resourceName.StartsWith(folderName) && resourceName.EndsWith(".resx"))
    {
        string fileName = resourceName.Substring(folderName.Length + 1);
        Console.WriteLine(fileName);
    }
}


问:
Permission denied on returning captions to YouTube
I have an integration with YouTube to return captions to videos of different YouTube accounts, and I use the YouTube API for this.

The thing is that some accounts are not being authorized to return captions. I made some investigation and I noticed some stuffs:

The oauth app seems to intermittently give an unverified warning to users trying to authorize the application to access their youtube account via api;

Even the users authorizing their accounts, when I try to return the captions I get an unauthorized message;

By digging more, I noticed that the access token had its expiration date to the moment of authorization.

The token is not being refreshed, which should be done by the refresh token, and seems to be not working.

Did someone had problems like that? How did you solved? I already tried to get in touch with YouTube support, but they could not give me a solution or a path to do a better investigation.

I was trying getting in touch with YouTube, but it seems that their technical support only replies on Stackoverflow.

Google saying that the app was not verified

Status of verified application


Title: K-nearest neighbor for spatial weights R

Body:
I was wondering if you could help me with this problem. I have a dataset of US counties that I am trying to do k-nearest neighbor analysis for spatial weighting, following the method proposed here (section 4.5), but the results aren't making sense, or potentially I'm not understanding them.

library(spdep)
library(tigris)
library(sf)

counties <- counties("Georgia", cb = TRUE)
coords <- st_centroid(st_geometry(counties), of_largest_polygon=TRUE)
col.knn <- knearneigh(coords)
gck4.nb <- knn2nb(knearneigh(coords, k=4, longlat=TRUE))
summary(gck4.nb, coords, longlat=TRUE, scale=0.5)

However, the output I'm getting, with regards to the distances, seems rather small, on the order of less than 1 km:

Neighbour list object:
Number of regions: 159
Number of nonzero links: 636
Percentage nonzero weights: 2.515723
Average number of links: 4
Non-symmetric neighbours list
Link number distribution:

  4
159
159 least connected regions:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 with 4 links
159 most connected regions:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 with 4 links
Summary of link distances:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
 0.1355  0.2650  0.3085  0.3112  0.3482  0.6224

  The decimal point is 1 digit(s) to the left of the |

  1 | 44
  1 | 7799999999999999
  2 | 00000000000011111111112222222222222233333333333333333333333333444444
  2 | 55555555555555555555555555556666666666666666666666666666666666667777+92
  3 | 00000000000000000000000000000001111111111111111111111111111111111111+121
  3 | 55555555555555555555555555555556666666666667777777777777777777777777+19
  4 | 00000000000111111111112222222222223333333444
  4 | 555667777999
  5 | 0000014
  5 | 7888
  6 | 2


问:
Difference between Expo CLI and React Native CLI
I want to ask the question that, What is the difference between React native Cli and Expo Cli?
2 - is there any Syntax difference or other difference that limits the Expo learner to work with React native?
3 - if a course which is using expo cli can be implemented on React native CLI without any issues?

I am new and didn't tried any thing yet


问:
How to properly handle customer subscription updated event
I've setup Stripe so that customers can manage their subscription through Stripe's customer portal.

In order to keep my app in sync with Stripe, I've created a web hook to handle customer.subscription.updated events. The idea is to simply get the price/plan the customer has changed to and then update a column in the Db to reflect that.

The problem however, is that when a customer makes the change via the portal. My webhook receives 2 subscription updated events. One containing a subscription object holding the old plan/price info, and the other containing a subscription with the new plan and price data.

How would I go about distinguishing which event is for the old price/plan and which is for the new so that I can ignore the old one and only update the db field using the new price/plan?

Event object for old subscription price/plan: https://pastebin.com/NA2KPh90

Event object for new subscription price/plan: https://pastebin.com/qF9g1wDs


问:
Import Swift-file in Qt-Application
I would like to integrate font recognition into my Qt application. Unfortunately I only know how to do this in Swift. Therefore I want to import the Swift file with the code for it into my already finished Qt application but I haven't found any information about how to do that.
I would be glad if someone can tell me how to do this or if font recognition through Apple Pencil is also possible in qt.
Thanks</p>

Title: Import Swift-file in Qt-Application


问:
FlatList ref - loop through data items
I have a FlatList where the datainput gets rendered into a customcomponent.
The component has a state that i would like to toggle in each individual component.

i have a ref for the Flatlist, but i don't see a reference to data, items or something similar...
any body have any idea on how to do this?

i have tried different ways of tagging into the ref, but so far, none of my attempts have proven fruitful.

and, no, the state is not delivered through the input for the flatlist, they are states on the custom component it self - i just don't see how i'm supposed to access the component inside the flatlist

Title: FlatList ref - loop through data items


问:
Android Webview Javascript window.location and checked problems
I am having 2 related problem with javascript in webview.

The first is that when I check a checkbox in the html page it will sometimes but not always display the checkbox as checked. So, to help the user I also use a label and also set the onclick event to document.getElementById('checkbox')=checked and still it only sometimes works:

```<code><label><input type="checkbox" class="big" id="checkbox' + (i-1) +'" name="activities" value="' + (i-1) + '"><a onclick="document.getElementById(checkbox' + (i-1) +')=checked">' + questionsTexts[i-1] + '</a></label>
</code>```

The second is that when I try to open a new page i use

function clickNextPage(url) {

```<code>        //write to cookies here

        //end write to cookies
        var HtmlStr = "ict4d_198_19815d.html?num_questions="+num_questions+"&";

        for(i=1; i<=num_questions; i++) {

            if (document.getElementById("checkbox" + (i-1)).checked)HtmlStr+="arrId"+(i-1)+"="+(i-1)+"&";
        }
        window.location=""+HtmlStr;
        return false;
    }
</code>```

Originally I passed it to the activity and used loadUrl(url) but this did not work as i could not get the webview to loadUrl. I tried this.loadUrl webview.loadUrl super.loadUrl but nothing would work so I went back to doing it in the javascript code with window.location. Again, it only works sometimes. Tried window.location.href also to no avail.

All these issues don't exist in the HTC Desire but do in the Samsung Galaxy S.

Does anyone have a workaround that is foolproof?

Thanks.

ContentLicense: CC BY-SA 3.0

Body:
I am having 2 related problem with javascript in webview.

The first is that when I check a checkbox in the html page it will sometimes but not always display the checkbox as checked. So, to help the user I also use a label and also set the onclick event to document.getElementById('checkbox')=checked and still it only sometimes works:

<input type="checkbox" class="big" id="checkbox' + (i-1) +'" name="activities" value="' + (i-1) + '">' + questionsTexts[i-1] + '

The second is that when I try to open a new page i use

function clickNextPage(url) {

        //write to cookies here

        //end write to cookies
        var HtmlStr = "ict4d_198_19815d.html?num_questions="+num_questions+"&";

        for(i=1; i<=num_questions; i++) {

            if (document.getElementById("checkbox" + (i-1)).checked)HtmlStr+="arrId"+(i-1)+"="+(i-1)+"&";
        }
        window.location=""+HtmlStr;
        return false;
    }

Originally I passed it to the activity and used loadUrl(url) but this did not work as i could not get the webview to loadUrl. I tried this.loadUrl webview.loadUrl super.loadUrl but nothing would work so I went back to doing it in the javascript code with window.location. Again, it only works sometimes. Tried window.location.href also to no avail.

All these issues don't exist in the HTC Desire but do in the Samsung Galaxy S.

Does anyone have a workaround that is foolproof?

Thanks.


问:
can i paginate data retrieved from api with yajra laravel
I am consuming api to get products using Laravel/yajra package but it get 6k entries every time can i get pagenumber from yarjra request to paginate manualy

Api Consumption

I want to add pagenumber to my api request when i click on yajra pagination links like in commented line below

```<code>public function index(Request $request)
    {

        if ($request->ajax()) {
            $response = Http::accept('application/json')->withHeaders(
                [
                    'Authorization' => 'Bearer ' . $this->token
                ]
            )->get($this->apiurl . '/products');
        //->get($this->apiurl . '/products'.'?page='$pagnenumber);
            $response = json_decode($response);
            if ($response->status == 200) {
                $data = $response->products;
            } else {
                $data = [];
            }
            return Datatables::of($data)
                ->addIndexColumn()
                ->addColumn('action', function ($row) {
                    $btn =  '<div class="btn-group mb-5">' .
                        '<button type="button" class="waves-effect waves-light btn btn-primary btn-sm dropdown-toggle" data-bs-toggle="dropdown">Action</button>' .
                        '<div class="dropdown-menu">'
                        . '<a href="' . route("products.edit", $row->id) . '" data-type="products" id="edtbtn-' . $row->id . '" class="dropdown-item" data-bs-original-title="Edit"><i class="ti-marker-alt"></i> Edit</a>'
                        . '<a href="' . route("productview", $row->id) . '" data-type="products"  class="dropdown-item" data-bs-original-title="Edit"><i class="ti-eye"></i> View</a>'
                        . '<a href="' . route("drawbc", $row->bc) . '" target="_blank"   class="dropdown-item" data-bs-original-title="Edit"><i class="ti-layout-column3-alt"></i>barcode label</a>'
                        . '<a href="javascript:void(0)" id="dltbtn-' . $row->id . '" data-type="products" class="text-danger dropdown-item deltbtn" data-bs-original-title="Delete" data-bs-toggle="tooltip"><i class="ti-trash"></i> Delete</a>'
                        //. '<a class="dropdown-item" href="#">Something else here</a>'

                        . '</div>'
                        . '</div>';
                    //$btn = '<a href="javascript:void(0)" id="dltbtn-' . $row->id . '" data-type="products" class="text-danger deltbtn" data-bs-original-title="Delete" data-bs-toggle="tooltip"><i class="ti-trash"></i></a>';

                    return $btn;
                })
                ->addColumn('active', function ($row) {
                    $actclass = $row->isact == 1 ? 'active' : '';
                    $boolclass = $row->isact == 1 ? 'true' : 'false';
                    //$html = '<button type="button"  class="btn btn-sm btn-toggle' .$row->isact == 1 ? 'active' : '' .'" data-bs-toggle="button" aria-pressed="'.  $row->isact == 1 ? 'true' : 'false' . '" autocomplete="off"></button><div class="handle"></div></button>';
                    $html = '<button type="button" aria-id="productid-' . $row->id . '" aria-id="productid-' . $row->id . '" class="btn btn-sm btn-toggle ' . $actclass . ' activate" data-bs-toggle="button" aria-pressed="' . $boolclass . '"  data-on-text="active" data-off-text="Inactive" autocomplete="off"><div class="handle"></div></button>';

                    return $html;
                })->addColumn('color', function ($row) {
                    if(isset($row->color)){
                    return $row->color->nm;
                    }else{
                        return '-';
                    }
                })->addColumn('size', function ($row) {

                    if(isset($row->size)){
                    return $row->size->nm;
                    }else{
                        return '-';
                    }
                })
                ->rawColumns(['action', 'active'])
                ->make(true);
        }
        $response = Http::accept('application/json')->withHeaders(
            [
                'Authorization' => 'Bearer ' . $this->token
            ]
        )->get($this->apiurl . '/attributes');
        $response = json_decode($response);
        //return $response;
        $attributes = [];
        if ($response->status == 200) {
            $attributes = $response->attributes;
        }
        $data = Http::accept('application/json')->withHeaders(
            [
                'Authorization' => 'Bearer ' . $this->token
            ]
        )->get($this->apiurl . '/productprequisites');
        $data = json_decode($data);
        if ($response->status == 200) {
            $groups = $data->groups;
            $categories = $data->categories;
            $departments = $data->departments;
            $units = $data->units;
            $brands = $data->brands;
            $qualities = $data->qualities;
            $acquiretypes = $data->acquiretypes;
            $agegroups = $data->agegroups;
            $seasons = $data->seasons;
        }
        return view('product.list', compact('attributes', 'brands', 'units', 'departments', 'categories', 'groups', 'seasons', 'acquiretypes', 'qualities', 'agegroups'));
    }
</code>```

Api

```<code>   public function index()
    {
        $products = Product::where('coid', $this->user->coid)->with('group', 'unit', 'category', 'brand', 'department', 'variants','color','size' ,'createdBy')->orderBy('created_at', 'DESC')->get();
        return response()->json([
            'status' => 200,
            'products' => $products
        ]);
    }
</code>```

is there anyway that i can send yajra pagenumber with my request for pagination

Body:
I am consuming api to get products using Laravel/yajra package but it get 6k entries every time can i get pagenumber from yarjra request to paginate manualy

Api Consumption

I want to add pagenumber to my api request when i click on yajra pagination links like in commented line below

public function index(Request $request)
    {

        if ($request->ajax()) {
            $response = Http::accept('application/json')->withHeaders(
                [
                    'Authorization' => 'Bearer ' . $this->token
                ]
            )->get($this->apiurl . '/products');
        //->get($this->apiurl . '/products'.'?page='$pagnenumber);
            $response = json_decode($response);
            if ($response->status == 200) {
                $data = $response->products;
            } else {
                $data = [];
            }
            return Datatables::of($data)
                ->addIndexColumn()
                ->addColumn('action', function ($row) {
                    $btn =  '
' .
                        '<button type="button" class="waves-effect waves-light btn btn-primary btn-sm dropdown-toggle" data-bs-toggle="dropdown">Action</button>' .
                        '
'
                        . 'id) . '" data-type="products" id="edtbtn-' . $row->id . '" class="dropdown-item" data-bs-original-title="Edit"> Edit'
                        . 'id) . '" data-type="products"  class="dropdown-item" data-bs-original-title="Edit"> View'
                        . 'bc) . '" target="_blank"   class="dropdown-item" data-bs-original-title="Edit">barcode label'
                        . 'id . '" data-type="products" class="text-danger dropdown-item deltbtn" data-bs-original-title="Delete" data-bs-toggle="tooltip"> Delete'
                        //. 'Something else here'

                        . '
'
                        . '
';
                    //$btn = 'id . '" data-type="products" class="text-danger deltbtn" data-bs-original-title="Delete" data-bs-toggle="tooltip">';

                    return $btn;
                })
                ->addColumn('active', function ($row) {
                    $actclass = $row->isact == 1 ? 'active' : '';
                    $boolclass = $row->isact == 1 ? 'true' : 'false';
                    //$html = '<button type="button"  class="btn btn-sm btn-toggle' .$row->isact == 1 ? 'active' : '' .'" data-bs-toggle="button" aria-pressed="'.  $row->isact == 1 ? 'true' : 'false' . '" autocomplete="off"></button>

</button>';
                    $html = '<button type="button" aria-id="productid-' . $row->id . '" aria-id="productid-' . $row->id . '" class="btn btn-sm btn-toggle ' . $actclass . ' activate" data-bs-toggle="button" aria-pressed="' . $boolclass . '"  data-on-text="active" data-off-text="Inactive" autocomplete="off">

</button>';

                    return $html;
                })->addColumn('color', function ($row) {
                    if(isset($row->color)){
                    return $row->color->nm;
                    }else{
                        return '-';
                    }
                })->addColumn('size', function ($row) {

                    if(isset($row->size)){
                    return $row->size->nm;
                    }else{
                        return '-';
                    }
                })
                ->rawColumns(['action', 'active'])
                ->make(true);
        }
        $response = Http::accept('application/json')->withHeaders(
            [
                'Authorization' => 'Bearer ' . $this->token
            ]
        )->get($this->apiurl . '/attributes');
        $response = json_decode($response);
        //return $response;
        $attributes = [];
        if ($response->status == 200) {
            $attributes = $response->attributes;
        }
        $data = Http::accept('application/json')->withHeaders(
            [
                'Authorization' => 'Bearer ' . $this->token
            ]
        )->get($this->apiurl . '/productprequisites');
        $data = json_decode($data);
        if ($response->status == 200) {
            $groups = $data->groups;
            $categories = $data->categories;
            $departments = $data->departments;
            $units = $data->units;
            $brands = $data->brands;
            $qualities = $data->qualities;
            $acquiretypes = $data->acquiretypes;
            $agegroups = $data->agegroups;
            $seasons = $data->seasons;
        }
        return view('product.list', compact('attributes', 'brands', 'units', 'departments', 'categories', 'groups', 'seasons', 'acquiretypes', 'qualities', 'agegroups'));
    }

Api

   public function index()
    {
        $products = Product::where('coid', $this->user->coid)->with('group', 'unit', 'category', 'brand', 'department', 'variants','color','size' ,'createdBy')->orderBy('created_at', 'DESC')->get();
        return response()->json([
            'status' => 200,
            'products' => $products
        ]);
    }

is there anyway that i can send yajra pagenumber with my request for pagination


问:
DATA Is Not Updating In The Database
I was following a tutorial, i can insert data and display it. But when i try to update the data, it does give me the success message, but the data doesn't change.'s still the same.

Here is the code :

view.php

```<code>
<?php
    session_start();
    include("./includes/connect.inc.php")
?>

<!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
    <title>Document</title>
</head>
<body>

    <?php if(isset($_SESSION['message'])) : ?>
        <h5 class="alert alert-success"><?= $_SESSION['message']; ?></h5>
    <?php
        unset($_SESSION['message']);
        endif;
    ?>
            <table class="table table-hover container mt-5">
            <thead>
                <tr>
                <th scope="col">Service/Brand</th>
                <th scope="col">Discount</th>
                <th scope="col">Expiry</th>
                <th scope="col">Code</th>
                <th scope="col">Actions</th>
                </tr>
            </thead>
            <tbody>

                <?php
                $query = "SELECT * FROM codes";
                $stmt = $conn->prepare($query);
                $stmt->execute();

                $stmt->setFetchMode(PDO::FETCH_OBJ); // PDO::FETCH_ASSOC === <td>$row["service"];</td>
                $result = $stmt->fetchAll();
                if($result) {

                    foreach($result as $row) {
                        ?>

                            <tr>
                                <td><?= $row->service;?></td>
                                <td><?= $row->discount;?></td>
                                <td><?= $row->expiry;?></td>
                                <td><?= $row->code;?></td>

                                <td><a href="edit-code.php?id=<?= $row->id; ?>" class="btn btn-success">Edit</a></td>
                            </tr>

                        <?php
                    }

                } else {
                    ?>

                        <tr>
                            <td>No Record Found</td>
                        </tr>

                    <?php
                }
                ?>
            </tbody>
            </table>
            <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
</body>
</html>
</code>```

update.inc.php

```<code><?php
session_start();
include("connect.inc.php");

if(isset($_POST["update-code-btn"])) {

    $code_id = $_POST["code_id"];
    $service = $_POST["service"];
    $discount = $_POST["discount"];
    $expiry = $_POST["expiry"];
    $code = $_POST["code"];

    try {

        $query = "UPDATE codes SET service=:service, discount=:discount, expiry=:expiry, code=:code WHERE id=:id LIMIT 1";
        $stmt = $conn->prepare($query);

        $data = [
            ":service" => $service,
            ":discount" => $discount,
            ":expiry" => $expiry,
            ":code" => $code,
            ":id" => $id,
        ];

        $query_execute = $stmt->execute($data);

        if($query_execute){
            $_SESSION["message"] = "Updated Successfully";
            header("Location: ../view.php");
            exit(0);
        } else {
            $_SESSION["message"] = "Data Update Failed";
            header("Location: ../view.php");
            exit(0);
        }

    } catch(PDOException $e) {
        echo $e->getMessage();
    }

}
</code>```

edit-code.php

```<code><?php
    include("./includes/connect.inc.php")
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
    <title>Edit Code</title>
</head>
<body>

    <h1 class="m-5">Edit code</h1>
    <a href="view.php" class="btn btn-primary mx-5 mb-5">Back</a>

    <?php
        if(isset($_GET["id"])) {
            $code_id = $_GET["id"];

            $query = "SELECT * FROM codes WHERE id=:code_id LIMIT 1";
            $stmt = $conn->prepare($query);
            $data = [":code_id" => $code_id];
            $stmt->execute($data);

            $result = $stmt->fetch(PDO::FETCH_OBJ); // PDO::FETCH_ASSOC
        }
    ?>

    <form class="container" action="./includes/update.inc.php" method="POST">
        <input type="hidden" name="id" value="<?= $result->id; ?>" class="form-control" id="id">
    <div class="mb-3">
        <label for="service" class="form-label">Service/Brand</label>
        <input type="text" name="service" value="<?= $result->service; ?>" class="form-control" id="service">
        <!-- aria-describedby="service" -->
    </div>
    <div class="mb-3">
        <label for="discount" class="form-label">Discount</label>
        <input type="text" name="discount" value="<?= $result->discount; ?>" class="form-control" id="discount">
        <!-- aria-describedby="discount" -->
    </div>
    <div class="mb-3">
        <label for="expiry" class="form-label">Expiry</label>
        <input type="text" name="expiry" value="<?= $result->expiry; ?>" class="form-control" id="expiry">
        <!-- aria-describedby="expiry" -->
    </div>
    <div class="mb-3">
        <label for="code" class="form-label">Code</label>
        <input type="text" name="code" value="<?= $result->code; ?>" class="form-control" id="code">
        <!-- aria-describedby="code" -->
    </div>

    <button type="submit" name="update-code-btn" class="btn btn-success mb-5">Save</button>
    </form>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
</body>
</html>
</code>```

Title: DATA Is Not Updating In The Database

Body:
I was following a tutorial, i can insert data and display it. But when i try to update the data, it does give me the success message, but the data doesn't change.'s still the same.

Here is the code :

view.php

<?php
    session_start();
    include("./includes/connect.inc.php")
?>

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
    <title>Document</title>

    <?php if(isset($_SESSION['message'])) : ?>

<?= $_SESSION['message']; ?>

    <?php
        unset($_SESSION['message']);
        endif;
    ?>

                Service/Brand
                Discount
                Expiry
                Code
                Actions

                <?php
                $query = "SELECT * FROM codes";
                $stmt = $conn->prepare($query);
                $stmt->execute();

                $stmt->setFetchMode(PDO::FETCH_OBJ); // PDO::FETCH_ASSOC === $row["service"];
                $result = $stmt->fetchAll();
                if($result) {

                    foreach($result as $row) {
                        ?>

                                <?= $row->service;?>
                                <?= $row->discount;?>
                                <?= $row->expiry;?>
                                <?= $row->code;?>

                                <a href="edit-code.php?id=<?= $row->id; ?>" class="btn btn-success">Edit

                        <?php
                    }

                } else {
                    ?>

                            No Record Found

                    <?php
                }
                ?>

update.inc.php

<?php
session_start();
include("connect.inc.php");

if(isset($_POST["update-code-btn"])) {

    $code_id = $_POST["code_id"];
    $service = $_POST["service"];
    $discount = $_POST["discount"];
    $expiry = $_POST["expiry"];
    $code = $_POST["code"];

    try {

        $query = "UPDATE codes SET service=:service, discount=:discount, expiry=:expiry, code=:code WHERE id=:id LIMIT 1";
        $stmt = $conn->prepare($query);

        $data = [
            ":service" => $service,
            ":discount" => $discount,
            ":expiry" => $expiry,
            ":code" => $code,
            ":id" => $id,
        ];

        $query_execute = $stmt->execute($data);

        if($query_execute){
            $_SESSION["message"] = "Updated Successfully";
            header("Location: ../view.php");
            exit(0);
        } else {
            $_SESSION["message"] = "Data Update Failed";
            header("Location: ../view.php");
            exit(0);
        }

    } catch(PDOException $e) {
        echo $e->getMessage();
    }

}

edit-code.php

<?php
    include("./includes/connect.inc.php")
?>

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
    <title>Edit Code</title>

Edit code

    Back

    <?php
        if(isset($_GET["id"])) {
            $code_id = $_GET["id"];

            $query = "SELECT * FROM codes WHERE id=:code_id LIMIT 1";
            $stmt = $conn->prepare($query);
            $data = [":code_id" => $code_id];
            $stmt->execute($data);

            $result = $stmt->fetch(PDO::FETCH_OBJ); // PDO::FETCH_ASSOC
        }
    ?>

    <form class="container" action="./includes/update.inc.php" method="POST">
        <input type="hidden" name="id" value="<?= $result->id; ?>" class="form-control" id="id">

        Service/Brand
        <input type="text" name="service" value="<?= $result->service; ?>" class="form-control" id="service">

        Discount
        <input type="text" name="discount" value="<?= $result->discount; ?>" class="form-control" id="discount">

        Expiry
        <input type="text" name="expiry" value="<?= $result->expiry; ?>" class="form-control" id="expiry">

        Code
        <input type="text" name="code" value="<?= $result->code; ?>" class="form-control" id="code">

    <button type="submit" name="update-code-btn" class="btn btn-success mb-5">Save</button>
    </form>


问:
MS Word Table Cell with Different Formats
I'm trying to automate a table cell format with VSTO.  The output I'm looking for is:

Particularly note the difference in font size between the LineItem and LineItemDescirption tokens.

How can write these two different formats to the same cell within C#?

I currently have the following:

```<code>var r = table.Cell(row, 1).Range;
r.Text = item.Name + Environment.NewLine + item.Description;
r.Font.Size = 11;
</code>```

But I can't find out how to do this as two separate entities.  I thought Range.Sentences would help (to return different ranges I could then apply the style individually to) but the compiler complains it doesn't exist.

I can't seem to write two ranges to the same cell.  I can only seem to capture the full text of any given range...

I'm (obviously) not fluent in the Word object model.  If someone can give me a push in the right direction that'd be great.  Thanks

Body:
I'm trying to automate a table cell format with VSTO.  The output I'm looking for is:

Particularly note the difference in font size between the LineItem and LineItemDescirption tokens.

How can write these two different formats to the same cell within C#?

I currently have the following:

var r = table.Cell(row, 1).Range;
r.Text = item.Name + Environment.NewLine + item.Description;
r.Font.Size = 11;

But I can't find out how to do this as two separate entities.  I thought Range.Sentences would help (to return different ranges I could then apply the style individually to) but the compiler complains it doesn't exist.

I can't seem to write two ranges to the same cell.  I can only seem to capture the full text of any given range...

I'm (obviously) not fluent in the Word object model.  If someone can give me a push in the right direction that'd be great.  Thanks


问:
Is it possible to print to postscript file without installing a print driver?
Microsoft Documentation is somewhat unclear about installing print drivers:

For example, apps that have a dependency on installing printer drivers into the host cannot be containerized because driver installation from within a container is unsupported.

I could not install a printer driver in a container, so I assume this quote also means that drivers cannot be installed in windows containers. Some of my confusion comes from the documentation saying that drivers cannot be installed into the host system--rather than container.

Without installing a driver, is it possible to print to postscript file with one of these preinstalled windows drivers?

```<code>Name                                                    PrinterEnvironment MajorVersion
----                                                    ------------------ ------------
Microsoft XPS Document Writer v4                        Windows x64        4
Microsoft Print To PDF                                  Windows x64        4
Microsoft Shared Fax Driver                             Windows x64        3
Microsoft enhanced Point and Print compatibility driver Windows x64        3
Microsoft enhanced Point and Print compatibility driver Windows NT x86     3
</code>```

Is it possible to add a network postscript printer and print to file from that printer?

I have tried installing HP Universal Print Driver, and I have tried using Rundll32 printui.dll,PrintUIEntry to install a driver. Neither worked nor had helpful error messages.

Body:
Microsoft Documentation is somewhat unclear about installing print drivers:

For example, apps that have a dependency on installing printer drivers into the host cannot be containerized because driver installation from within a container is unsupported.

I could not install a printer driver in a container, so I assume this quote also means that drivers cannot be installed in windows containers. Some of my confusion comes from the documentation saying that drivers cannot be installed into the host system--rather than container.

Without installing a driver, is it possible to print to postscript file with one of these preinstalled windows drivers?

Name                                                    PrinterEnvironment MajorVersion
----                                                    ------------------ ------------
Microsoft XPS Document Writer v4                        Windows x64        4
Microsoft Print To PDF                                  Windows x64        4
Microsoft Shared Fax Driver                             Windows x64        3
Microsoft enhanced Point and Print compatibility driver Windows x64        3
Microsoft enhanced Point and Print compatibility driver Windows NT x86     3

Is it possible to add a network postscript printer and print to file from that printer?

I have tried installing HP Universal Print Driver, and I have tried using Rundll32 printui.dll,PrintUIEntry to install a driver. Neither worked nor had helpful error messages.


问:
ConversionError: Failed to convert value(s) to axis units: '43pts' when displaying text in Matplotlib
I have a plot between numpy arrays (Points and Clubs) and have drawn a scatter plot between them.

The code is as under:

Points = np.array([30, 33, 38, 43])
Clubs = np.array(['Manchester United', 'Newcastle United', 'Manchester City', 'Arsenal'])

plt.xticks([30, 33, 38, 43], ['30pts', '33pts', '38pts', '43pts'])
plt.scatter(Points, Clubs)
plt.show()

```
<p>The scatter plot is shown in the attached figure.</p>
<p><img src="https://i.stack.imgur.com/sgUy5.png" alt="Picture showing scatter plot between Points and Club" /></p>
<p>What I want is to add the label 'Toppers' with the club having max points (Arsenal in this example).</p>
<p>The following snippet I'm using for this purpose:</p>
<pre class="lang-py prettyprint-override"><code>plt.text('43pts', 'Arsenal', 'Toppers')
plt.grid(True)
</code>```

However, this gives the error:

ConversionError: Failed to convert value(s) to axis units: '43pts'

Body:
I have a plot between numpy arrays (Points and Clubs) and have drawn a scatter plot between them.

The code is as under:

Points = np.array([30, 33, 38, 43])
Clubs = np.array(['Manchester United', 'Newcastle United', 'Manchester City', 'Arsenal'])

plt.xticks([30, 33, 38, 43], ['30pts', '33pts', '38pts', '43pts'])
plt.scatter(Points, Clubs)
plt.show()

The scatter plot is shown in the attached figure.

What I want is to add the label 'Toppers' with the club having max points (Arsenal in this example).

The following snippet I'm using for this purpose:

plt.text('43pts', 'Arsenal', 'Toppers')
plt.grid(True)

However, this gives the error:

ConversionError: Failed to convert value(s) to axis units: '43pts'


问:
i want to make a loop that's simulate F keys to DX9 GAME
i want to make a loop that's simulate F keys to DX9 GAME

and that is my code

```<code>  static void Example1(Keys k, Process Proces)
        {
            const uint WM_KEYDOWN = 0x100;
            const uint WM_KEYUP = 0x101;
            IntPtr child = FindWindowEx(Proces.MainWindowHandle,
            new IntPtr(0), "Edit", null);
            PostMessage(child, WM_KEYDOWN, ((IntPtr)k), ((IntPtr)0));
            Thread.Sleep(100);
            PostMessage(child, WM_KEYUP, ((IntPtr)0), ((IntPtr)0));
            Thread.Sleep(100);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            tt = new Thread(Example2);
            tt.IsBackground = true;
            if (isRunning)
            {
                isRunning = false;
            }
            else
            {
                isRunning = true;
                tt.Start();
            }
        }
        void Example2()
        {
            Process[] notepads = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(@"D:\Games\tahes\Env_DX9\Conquer.exe"));
            foreach (Process process in notepads)
            {
                for (; ; )
                {
                    do
                    {
                        while (!isRunning)
                        {
                            Thread.Sleep(1000);
                        }
                        if (checkBox1.Checked) Example1(Keys.A, process);
                    } while (!checkBox2.Checked);
                    Example1(Keys.B, process); Application.DoEvents();
                }

            }

        }
</code>```

i don't want to use sendkeys(); and SetForegroundWindow(); bec it brings the game in the front and i want to make it for more than 1 tap

Body:
i want to make a loop that's simulate F keys to DX9 GAME

and that is my code

  static void Example1(Keys k, Process Proces)
        {
            const uint WM_KEYDOWN = 0x100;
            const uint WM_KEYUP = 0x101;
            IntPtr child = FindWindowEx(Proces.MainWindowHandle,
            new IntPtr(0), "Edit", null);
            PostMessage(child, WM_KEYDOWN, ((IntPtr)k), ((IntPtr)0));
            Thread.Sleep(100);
            PostMessage(child, WM_KEYUP, ((IntPtr)0), ((IntPtr)0));
            Thread.Sleep(100);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            tt = new Thread(Example2);
            tt.IsBackground = true;
            if (isRunning)
            {
                isRunning = false;
            }
            else
            {
                isRunning = true;
                tt.Start();
            }
        }
        void Example2()
        {
            Process[] notepads = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(@"D:\Games\tahes\Env_DX9\Conquer.exe"));
            foreach (Process process in notepads)
            {
                for (; ; )
                {
                    do
                    {
                        while (!isRunning)
                        {
                            Thread.Sleep(1000);
                        }
                        if (checkBox1.Checked) Example1(Keys.A, process);
                    } while (!checkBox2.Checked);
                    Example1(Keys.B, process); Application.DoEvents();
                }

            }

        }

i don't want to use sendkeys(); and SetForegroundWindow(); bec it brings the game in the front and i want to make it for more than 1 tap


问:
Problem with import bootstrap part globally
I would like to use @include media-breakpoint-down(sm) {...} in many components in my project and I don't want add

```<code>   @import 'bootstrap/scss/_functions';
   @import 'bootstrap/scss/_variables';
   @import 'bootstrap/scss/mixins/_breakpoints';
</code>```

to every components where I need to use it @include. But when I tried add it to file "styles.scss", and this file is correctly added to angular.json -

```<code>  "architect": {
    "build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
        ...
        "styles": [
          "node_modules/bootstrap/dist/css/bootstrap.min.css",
          "src/styles.scss"
        ],
        "scripts": []
      }
   }
}
</code>```

It doesn't work and I have error SassError: Undefined mixin. @include media-breakpoint-down(sm) {...

It only works when I add all import in my component.scss but I don't like it and I don't want to import it in every components. How can I fix it?

I'm using bootstrap 5 and angular 15.

Body:
I would like to use @include media-breakpoint-down(sm) {...} in many components in my project and I don't want add

   @import 'bootstrap/scss/_functions';
   @import 'bootstrap/scss/_variables';
   @import 'bootstrap/scss/mixins/_breakpoints';

to every components where I need to use it @include. But when I tried add it to file "styles.scss", and this file is correctly added to angular.json -

  "architect": {
    "build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
        ...
        "styles": [
          "node_modules/bootstrap/dist/css/bootstrap.min.css",
          "src/styles.scss"
        ],
        "scripts": []
      }
   }
}

It doesn't work and I have error SassError: Undefined mixin. @include media-breakpoint-down(sm) {...

It only works when I add all import in my component.scss but I don't like it and I don't want to import it in every components. How can I fix it?

I'm using bootstrap 5 and angular 15.


问:
I have this error when I click to download a program, Ext.JSON.decode(): You're trying to decode an invalid JSON String: undefined
I have an application, and to download an agent, I have the following function

`

```<code>    const me = this;
    const viewModel = me.getViewModel();
    viewModel.set('step', 'windows');

    Ext.Ajax.request({
        url: `${Ext.manifest.apiUrl}/monitoring/downloadExecutable?platform=windows`,
        method: 'GET',
        binary: true,
        success: function (response) {
            console.log('response',response)
            try {
                const windowUrl = window.URL || window.webkitURL;
                const url = windowUrl.createObjectURL(new Blob([response.responseBytes], {
                    type: 'application/vnd.microsoft.portable-executable'
                }));
                let a = document.createElement('a');
                a.style.display = 'none';
                a.href = url;
                a.download = 'setup.exe';
                document.body.appendChild(a);
                a.click();
                window.URL.revokeObjectURL(url);
            } finally {
                viewModel.set('step', 'choose');
            }
        },
        failure: function (response) {
            console.log('error',response)
            Ext.toast({
                message: UITEXT.AGENT_MAIN_CONTROLLER_WINDOWS,
                align: 'tc'
            });
        }
    });
</code>```

`

but when I click to download it shows me this error: Ext.JSON.decode(): You're trying to decode an invalid JSON String: undefined, I couldn't find the error, and my api is downloading normally.

I'll be grateful if someone helps me, thanks in advance

Body:
I have an application, and to download an agent, I have the following function

`

    const me = this;
    const viewModel = me.getViewModel();
    viewModel.set('step', 'windows');

    Ext.Ajax.request({
        url: `${Ext.manifest.apiUrl}/monitoring/downloadExecutable?platform=windows`,
        method: 'GET',
        binary: true,
        success: function (response) {
            console.log('response',response)
            try {
                const windowUrl = window.URL || window.webkitURL;
                const url = windowUrl.createObjectURL(new Blob([response.responseBytes], {
                    type: 'application/vnd.microsoft.portable-executable'
                }));
                let a = document.createElement('a');
                a.style.display = 'none';
                a.href = url;
                a.download = 'setup.exe';
                document.body.appendChild(a);
                a.click();
                window.URL.revokeObjectURL(url);
            } finally {
                viewModel.set('step', 'choose');
            }
        },
        failure: function (response) {
            console.log('error',response)
            Ext.toast({
                message: UITEXT.AGENT_MAIN_CONTROLLER_WINDOWS,
                align: 'tc'
            });
        }
    });

`

but when I click to download it shows me this error: Ext.JSON.decode(): You're trying to decode an invalid JSON String: undefined, I couldn't find the error, and my api is downloading normally.

I'll be grateful if someone helps me, thanks in advance


问:
KeyError at 'body' when i send a request with fecth. Django and ReactJs project
i´m doing a project with django (django rest framework) as backend and React js as Front for some reason the 'body' isn´t send  to the backend.

here the django view:

```<code>@api_view(['POST'])
def crearTarea(request):
    data = request.data
    print(data['body'])
    tarea = Tarea.objects.create(
        body=data['body']
    )
    serializer = TareaSerializer(tarea, many=False)
    return Response(serializer.data)
</code>```

the request in react with fetch:

```<code>let crear = () =>{
        let tarea_json = {
            "titulo": document.getElementById("titulo").value ,
            "descripcion": tarea.descripcion,
            "tiempo_tarea": 1,
            "fk_idUsuario": 1
        }

        fetch('/api/tareas/create', {
            method: "POST",
            body: JSON.stringify(tarea_json),
            headers: {
                'Content-Type': 'application/json'
            }
        })
    }
</code>```

the model:

```<code>class Tarea(models.Model):

    titulo = models.CharField(max_length=50)
    descripcion = models.CharField(max_length=150)
    tiempo_tarea = models.ForeignKey(Tiempo_tarea, on_delete = models.CASCADE)

    fk_idUsuario = models.ForeignKey(User, on_delete = models.CASCADE)
    created = models.DateTimeField(auto_now_add=True)

    class Meta:
        ordering = ["created"]
        db_table = "Tarea"
        verbose_name_plural = "Tareas"
        verbose_name = "Tarea"

    def __str__(self) -> str:
        return self.titulo
</code>```

and the error:

enter image description here

i´m traying to create a new instance with the method POST and fecth but it doesn´t run.

I would be grateful if you could help me

Body:
i´m doing a project with django (django rest framework) as backend and React js as Front for some reason the 'body' isn´t send  to the backend.

here the django view:

@api_view(['POST'])
def crearTarea(request):
    data = request.data
    print(data['body'])
    tarea = Tarea.objects.create(
        body=data['body']
    )
    serializer = TareaSerializer(tarea, many=False)
    return Response(serializer.data)

the request in react with fetch:

let crear = () =>{
        let tarea_json = {
            "titulo": document.getElementById("titulo").value ,
            "descripcion": tarea.descripcion,
            "tiempo_tarea": 1,
            "fk_idUsuario": 1
        }

        fetch('/api/tareas/create', {
            method: "POST",
            body: JSON.stringify(tarea_json),
            headers: {
                'Content-Type': 'application/json'
            }
        })
    }

the model:

class Tarea(models.Model):

    titulo = models.CharField(max_length=50)
    descripcion = models.CharField(max_length=150)
    tiempo_tarea = models.ForeignKey(Tiempo_tarea, on_delete = models.CASCADE)

    fk_idUsuario = models.ForeignKey(User, on_delete = models.CASCADE)
    created = models.DateTimeField(auto_now_add=True)

    class Meta:
        ordering = ["created"]
        db_table = "Tarea"
        verbose_name_plural = "Tareas"
        verbose_name = "Tarea"

    def __str__(self) -> str:
        return self.titulo

and the error:

enter image description here

i´m traying to create a new instance with the method POST and fecth but it doesn´t run.

I would be grateful if you could help me


问:
How can I match a function parameter of a given type, regardless of whether it's passed by value, reference or pointer?
Here's a clang AST matcher which will match a function any of whose parameters are a std::vector (of any type) passed by value or reference:

DeclarationMatcher funcMatcher = functionDecl(
    anyOf(hasAnyParameter(
              hasType(references(recordDecl(matchesName("std::vector"))))),
          hasAnyParameter(hasType(recordDecl(matchesName("std::vector"))))));
```

I'd like to know if there is some matcher which will match e.g. std::vector&, std::vector* and std::vector?

Obviously I could expand the matcher above for the pointer case, but I was wondering if clang AST has some concept of the 'underlying' type. I've spent quite a bit of time looking here.

Body:
Here's a clang AST matcher which will match a function any of whose parameters are a std::vector (of any type) passed by value or reference:

DeclarationMatcher funcMatcher = functionDecl(
    anyOf(hasAnyParameter(
              hasType(references(recordDecl(matchesName("std::vector"))))),
          hasAnyParameter(hasType(recordDecl(matchesName("std::vector"))))));

I'd like to know if there is some matcher which will match e.g. std::vector&, std::vector* and std::vector?

Obviously I could expand the matcher above for the pointer case, but I was wondering if clang AST has some concept of the 'underlying' type. I've spent quite a bit of time looking here.


问:
whenever i start the development server in reactjs by using the command npm run start the development server dosent start instead it gives me an error
```<code>Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\util\\createHash.js:135:53)
    at NormalModule.\_initBuildHash (C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\NormalModule.js:417:16)
    at handleParseError (C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\NormalModule.js:471:10)
    at C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\NormalModule.js:503:5
    at C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\NormalModule.js:358:12
    at C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\loader-runner\\lib\\LoaderRunner.js:373:3
    at iterateNormalLoaders (C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\loader-runner\\lib\\LoaderRunner.js:214:10)
    at iterateNormalLoaders (C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\loader-runner\\lib\\LoaderRunner.js:221:10)
C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\react-scripts\\scripts\\start.js:19
  throw err;
  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\util\\createHash.js:135:53)
    at NormalModule.\_initBuildHash (C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\NormalModule.js:417:16)
    at C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\NormalModule.js:452:10
    at C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\NormalModule.js:323:13
    at C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\loader-runner\\lib\\LoaderRunner.js:367:11
    at C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\loader-runner\\lib\\LoaderRunner.js:233:18
    at context.callback (C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\loader-runner\\lib\\LoaderRunner.js:111:13)
    at C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\babel-loader\\lib\\index.js:59:103 {
  opensslErrorStack: \[ 'error:03000086:digital envelope routines::initialization error' \],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
</code>```

I tried editing changing the code, even tried ChatGPT but still didn't get any solution. I even deleted the node_modules folder and installed it again. I was expecting the development server to start but still it didnt

Body:
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\util\\createHash.js:135:53)
    at NormalModule.\_initBuildHash (C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\NormalModule.js:417:16)
    at handleParseError (C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\NormalModule.js:471:10)
    at C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\NormalModule.js:503:5
    at C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\NormalModule.js:358:12
    at C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\loader-runner\\lib\\LoaderRunner.js:373:3
    at iterateNormalLoaders (C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\loader-runner\\lib\\LoaderRunner.js:214:10)
    at iterateNormalLoaders (C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\loader-runner\\lib\\LoaderRunner.js:221:10)
C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\react-scripts\\scripts\\start.js:19
  throw err;
  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\util\\createHash.js:135:53)
    at NormalModule.\_initBuildHash (C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\NormalModule.js:417:16)
    at C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\NormalModule.js:452:10
    at C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\webpack\\lib\\NormalModule.js:323:13
    at C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\loader-runner\\lib\\LoaderRunner.js:367:11
    at C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\loader-runner\\lib\\LoaderRunner.js:233:18
    at context.callback (C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\loader-runner\\lib\\LoaderRunner.js:111:13)
    at C:\\Complete web development bootcamp\\React Course\\textutils\\node_modules\\babel-loader\\lib\\index.js:59:103 {
  opensslErrorStack: \[ 'error:03000086:digital envelope routines::initialization error' \],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

I tried editing changing the code, even tried ChatGPT but still didn't get any solution. I even deleted the node_modules folder and installed it again. I was expecting the development server to start but still it didnt


问:
Problem to get correct bounding box around the mesh and raycasting for gltf model with skinnedmesh
The idea is to import a gltf model into my scene and enclose all the children object of it inside a single bounding box. In most of the cases, these works without any issue. But in some cases when some of the children are skinnedmesh, bounding box is not covering all the children.

Please try with Test.glb - Google Drive so you can understand the issue. Even the issue can be seen in Three.js Editor too.

Also I can not raycast it correctly.

Can you please help me to sort out? I have already read about having manual bounding box or/and frustumCulled=false of skinned mesh and I need to load models dynamically sothat can not manually define the Bounding Box.

```<code> loader.load(filename,
    function (gltf) {
     let mgroup = new THREE.Group();
      while (gltf.scene.children.length > 0) {
        var child = gltf.scene.children[0];
        if (child.isObject3D) {
          mgroup.add(child);
        }
      }
      scene.add(mgroup);
      const aabb = new THREE.BoxHelper(mgroup);
      scene.add(aabb);
    });
</code>```

Body:
The idea is to import a gltf model into my scene and enclose all the children object of it inside a single bounding box. In most of the cases, these works without any issue. But in some cases when some of the children are skinnedmesh, bounding box is not covering all the children.

Please try with Test.glb - Google Drive so you can understand the issue. Even the issue can be seen in Three.js Editor too.

Also I can not raycast it correctly.

Can you please help me to sort out? I have already read about having manual bounding box or/and frustumCulled=false of skinned mesh and I need to load models dynamically sothat can not manually define the Bounding Box.

 loader.load(filename,
    function (gltf) {
     let mgroup = new THREE.Group();
      while (gltf.scene.children.length > 0) {
        var child = gltf.scene.children[0];
        if (child.isObject3D) {
          mgroup.add(child);
        }
      }
      scene.add(mgroup);
      const aabb = new THREE.BoxHelper(mgroup);
      scene.add(aabb);
    });