问:
How to return a function with nextjs firebase authentication, via context
I have been trying to setup authentication on my project for a while using firebase authentication. I am doing a Next.js project.

I am having issues where If I login and refresh the page, I have to login again, I found a partial solution which involves using contexts, but whenever I use it to login, I am getting type error login is not a function. I have attached 3 files I am using

here is my context file

import { createContext, useContext } from "react";
import { useFirebaseAuth } from "../firebase";

const authUserContext = createContext({
  authUser: null,
  loading: true,
  login: async () => {},
});

export function AuthUserProvider({ children }) {
  const Auth = useFirebaseAuth;

  return (
    <authUserContext.Provider value={Auth}>{children}</authUserContext.Provider>
  );
}

export const useAuth = () => useContext(authUserContext);```
</div>
</div>
</p>
<p>Here is my login page. If i just make the login as a regular export in the firebase Auth file, I dont get the error, i am able to login but the context doesnt get updated.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>import React from "react";
import { useState } from "react";
// import { emailRegex } from "../components/Utilities/validations";
import { useAuth } from "../components/contexts/userContext";

const Login = () => {
  const [email, setEmail] = useState("");
  const [password, setPassword] = useState("");
  const { login, authUser } = useAuth();
  const [loading2, setLoading] = useState(false);

  const handleSubmit = async (e) => {
    // validate(e.values);
    e.preventDefault();
    setLoading(true);

    try {
      const user = await login(email, password);
      console.log(user.user);
      console.log(authUser);
    } catch (err) {
      console.log(err);
    }

    setLoading(false);
  };
};

export default Login;</code>```

and here is the firebase code I have. If I remove the login function from the scope of the useFirebaseAuth, I can just import the login normally and get a login token. However, it doesnt update the authUser. If I refresh the page, I have to login again.

function useFirebaseAuth() {
  const [authUser, setAuthUser] = useState(null);
  const [loading, setLoading] = useState(true);

  const formatAuthUser = (user) => ({
    uid: user.uid,
    email: user.email,
  });
  const authStateChanged = async (authState) => {
    if (!authState) {
      setAuthUser(null);
      setLoading(false);
      return;
    }
    setLoading(true);
    const formattedUser = formatAuthUser(authState);
    setAuthUser(formattedUser);
    console.log("useAuth " + authUser?.email);
  };
  const login = (email, password) => {
    const promise = auth.signInWithEmailAndPassword(auth, email, password);
    console.log(promise);

    return promise;
  };

  useEffect(() => {
    const unsub = auth.onAuthStateChanged(authStateChanged);
    return unsub;
  }, []);

  return {
    authUser,
    loading,
    login,
  };
}```

Body:
I have been trying to setup authentication on my project for a while using firebase authentication. I am doing a Next.js project.

I am having issues where If I login and refresh the page, I have to login again, I found a partial solution which involves using contexts, but whenever I use it to login, I am getting type error login is not a function. I have attached 3 files I am using

here is my context file

import { createContext, useContext } from "react";
import { useFirebaseAuth } from "../firebase";

const authUserContext = createContext({
  authUser: null,
  loading: true,
  login: async () => {},
});

export function AuthUserProvider({ children }) {
  const Auth = useFirebaseAuth;

  return (
    <authUserContext.Provider value={Auth}>{children}</authUserContext.Provider>
  );
}

export const useAuth = () => useContext(authUserContext);

Here is my login page. If i just make the login as a regular export in the firebase Auth file, I dont get the error, i am able to login but the context doesnt get updated.

import React from "react";
import { useState } from "react";
// import { emailRegex } from "../components/Utilities/validations";
import { useAuth } from "../components/contexts/userContext";

const Login = () => {
  const [email, setEmail] = useState("");
  const [password, setPassword] = useState("");
  const { login, authUser } = useAuth();
  const [loading2, setLoading] = useState(false);

  const handleSubmit = async (e) => {
    // validate(e.values);
    e.preventDefault();
    setLoading(true);

    try {
      const user = await login(email, password);
      console.log(user.user);
      console.log(authUser);
    } catch (err) {
      console.log(err);
    }

    setLoading(false);
  };
};

export default Login;

and here is the firebase code I have. If I remove the login function from the scope of the useFirebaseAuth, I can just import the login normally and get a login token. However, it doesnt update the authUser. If I refresh the page, I have to login again.

function useFirebaseAuth() {
  const [authUser, setAuthUser] = useState(null);
  const [loading, setLoading] = useState(true);

  const formatAuthUser = (user) => ({
    uid: user.uid,
    email: user.email,
  });
  const authStateChanged = async (authState) => {
    if (!authState) {
      setAuthUser(null);
      setLoading(false);
      return;
    }
    setLoading(true);
    const formattedUser = formatAuthUser(authState);
    setAuthUser(formattedUser);
    console.log("useAuth " + authUser?.email);
  };
  const login = (email, password) => {
    const promise = auth.signInWithEmailAndPassword(auth, email, password);
    console.log(promise);

    return promise;
  };

  useEffect(() => {
    const unsub = auth.onAuthStateChanged(authStateChanged);
    return unsub;
  }, []);

  return {
    authUser,
    loading,
    login,
  };
}


来源: stackexchange

问:
I want to slide the div content horizontally to right automatically. and on mouse focus it should stop and allow the user to click
```<code><asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<section class="Banner_Home UnitDetails">
        <div class="innBanner">
            <div class="container-fluid">
               <div class="Slide1">
                   <h5>Your TEXT... XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  XXXX.</h5>
                    <div>
                         <img src="../Images/image1.svg" style="width:200px;" />
                   </div>
                   <div><a id="btnOnclickImage1" runat="server" onserverclick="btnImage1_ServerClick">Login Now</a></div>
               </div>
               <div class="Slide2">
                   <h5>Your Another TEXT... XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  XXXX.</h5>
                    <div>
                         <img src="../Images/image2.svg" style="width:200px;" />
                   </div>
                   <div><a id="btnOnclickImage2" runat="server" onserverclick="btnImage2_ServerClick">Login Now</a></div>
               </div>
            </div>
        </div>
    </section>
    <section class="ContentBody">
        <div class="container-fluid">
            <div class="accordion-container">
                <div class="set">
</code>```

slide1 and slide2 div content should be horizontally scrolling automatically (assume sliding time 30 seconds once)

ASP.NET Webforms 4.8 on framework

ContentLicense: CC BY-SA 4.0

Body:
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

Your TEXT... XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  XXXX.

Login Now

Your Another TEXT... XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  XXXX.

Login Now

slide1 and slide2 div content should be horizontally scrolling automatically (assume sliding time 30 seconds once)

ASP.NET Webforms 4.8 on framework


问:
Retrieve Google Forms (Questions) Data as JSON using REST API
If a google form is publicm then why can't I retrieve the data as a JSON from

https://forms.googleapis.com/v1/forms/{formID}

using the REST API ?

https://developers.google.com/forms/api/reference/rest/v1/forms/get


问:
How to detect container outside click
I have a International country code selector code for my website but the problem I'm facing is that I want to hide the dropdown menu when anyone clicks outside the container, I have already written the code for this feature but the bug I'm facing right now is that It closes the dropdown menu when anyone clicks inside of the container, not the outside. it's doing the exact opposite.

I want to hide the menu when clicked outside.

Please check out my Highlighted code -

Please suggest me some modification.

I have done little modification in my code, please check out below.

/********** Hide the menu when clicked outside ***********/

document.addEventListener("click", (event) => {
  if (container.contains(event.target)) {
    container.classList.remove('show');
  }
});

/********** Hide the menu when clicked outside ***********/

// Cache the elements
  const xbutton = document.querySelector('.country-code-selector .telcode');
  const container = document.querySelector('.country-code-selector .container');
  const input = document.querySelector('.country-code-selector input');
  const list = document.querySelector('.country-code-selector .list');

  // Add event listeners to the button, input, and list
  // We use a process called "event delegation" on the list
  // to catch events from its children as they "bubble up" the DOM
  // https://dmitripavlutin.com/javascript-event-delegation/
  xbutton.addEventListener('click', handleButton);
  input.addEventListener('input', handleInput);
  list.addEventListener('click', handleListClick);
  document.addEventListener('click', handleDocumentClick);

  // Handles the document click - it checks to see if the clicked
  // part of the document has a parent element which is either
  // `null` or is the HTML element, and then closes the container
  // if it's open
  function handleDocumentClick(e) {
    const { parentElement } = e.target;
  }

  // All of the data held as objects within an array
  const data = [
    { name: 'Afganistan', code: '69', flag: 'afg' },
    { name: 'Barbados', code: '1-246', flag: 'brb' },
    { name: 'Bolivia', code: '591', flag: 'bol' },
    { name: 'Cuba', code: '53', flag: 'cub' },
    { name: 'Fiji', code: '679', flag: 'fji' },
  ];

  // Filters the data based on the characters
  // at the start of the provided name
  function filterData(data, value) {
    return data.filter(obj => {
      return (
        obj.name.toLowerCase().startsWith(value.toLowerCase())
        || obj.code.toLowerCase().startsWith(value.toLowerCase())
      );
    });
  }

  // Create a series of list items based on the
  // data passed to it
  function createListHtml(data) {
    return data.map(obj => {
      const { name, code, flag } = obj;
      return `

${name} (+${code})

      `;
    }).join('');
  }

  // Toggle the container on/off
  function handleButton() {
    container.classList.toggle('show');
  }

  // No data available list item
  function createNoDataHtml() {
    return '
No data available
';
  }

  // When the input is changed filter the data
  // according to the current value, and then
  // create some list items using that filtered data
  function handleInput(e) {
    const { value } = e.target;
    if (value) {
      const filtered = filterData(data, value);
      if (filtered.length) {
        list.innerHTML = createListHtml(filtered);
      } else {
        list.innerHTML = createNoDataHtml();
      }
    } else {
      list.innerHTML = createListHtml(data);
    }
  }

  // Create some button HTML
  function createButtonHtml(code, flag) {
    return `

+${code}

    `;
  }

  // Updates the selected list by removing the `selected`
  // class from all items, and then adding one to the clicked
  // item
  function updateSelected(list, item) {
    const items = list.querySelectorAll('.item');
    items.forEach(item => item.classList.remove('selected'));
    item.classList.add('selected');
  }

  // When an item is clicked, grab the relevant data
  // attributes, create the new button HTML, and then
  // close the container
  function handleListClick(e) {
    const item = e.target.closest('li') || e.target;
    if (item.classList.contains('item')) {
      const { code, flag } = item.dataset;
      xbutton.innerHTML = createButtonHtml(code, flag);
      updateSelected(list, item);
      container.classList.remove('show');
    }
  }

  list.innerHTML = createListHtml(data);```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.country-code-selector .telcode {
       margin-bottom: 1em;
       display: flex;
  }
  .country-code-selector .telcode div.code, .item div.name {
       margin-left: 0.25em;
  }
  .country-code-selector .container {
       display: none;
       border: 1px solid grey;
  }
  .country-code-selector .show {
       display: block;
  }
  .country-code-selector .list {
       height: 100px;
       list-style: none;
       margin: 1em 0 0 0;
       padding: 0;
       overflow-y: scroll;
       border: 1px soldi darkgray;
  }
  .country-code-selector .item {
       display: flex;
       padding: 0.25em;
       border: 1px solid lightgray;
  }
  .country-code-selector .item:hover {
       cursor: pointer;
  }
  .country-code-selector .item:hover, .item.selected {
       background-color: lightyellow;
  }</code>```

<link href="https://amitdutta.co.in/flag/css/flag-icon.css" rel="stylesheet"/>

  <button type="button" class="telcode">Tel code</button>

    <input type="text" placeholder="Search for country" />

```

Title: How to detect container outside click

Body:
I have a International country code selector code for my website but the problem I'm facing is that I want to hide the dropdown menu when anyone clicks outside the container, I have already written the code for this feature but the bug I'm facing right now is that It closes the dropdown menu when anyone clicks inside of the container, not the outside. it's doing the exact opposite.

I want to hide the menu when clicked outside.

Please check out my Highlighted code -

Please suggest me some modification.

I have done little modification in my code, please check out below.

/********** Hide the menu when clicked outside ***********/

document.addEventListener("click", (event) => {
  if (container.contains(event.target)) {
    container.classList.remove('show');
  }
});

/********** Hide the menu when clicked outside ***********/

// Cache the elements
  const xbutton = document.querySelector('.country-code-selector .telcode');
  const container = document.querySelector('.country-code-selector .container');
  const input = document.querySelector('.country-code-selector input');
  const list = document.querySelector('.country-code-selector .list');

  // Add event listeners to the button, input, and list
  // We use a process called "event delegation" on the list
  // to catch events from its children as they "bubble up" the DOM
  // https://dmitripavlutin.com/javascript-event-delegation/
  xbutton.addEventListener('click', handleButton);
  input.addEventListener('input', handleInput);
  list.addEventListener('click', handleListClick);
  document.addEventListener('click', handleDocumentClick);

  // Handles the document click - it checks to see if the clicked
  // part of the document has a parent element which is either
  // `null` or is the HTML element, and then closes the container
  // if it's open
  function handleDocumentClick(e) {
    const { parentElement } = e.target;
  }

  // All of the data held as objects within an array
  const data = [
    { name: 'Afganistan', code: '69', flag: 'afg' },
    { name: 'Barbados', code: '1-246', flag: 'brb' },
    { name: 'Bolivia', code: '591', flag: 'bol' },
    { name: 'Cuba', code: '53', flag: 'cub' },
    { name: 'Fiji', code: '679', flag: 'fji' },
  ];

  // Filters the data based on the characters
  // at the start of the provided name
  function filterData(data, value) {
    return data.filter(obj => {
      return (
        obj.name.toLowerCase().startsWith(value.toLowerCase())
        || obj.code.toLowerCase().startsWith(value.toLowerCase())
      );
    });
  }

  // Create a series of list items based on the
  // data passed to it
  function createListHtml(data) {
    return data.map(obj => {
      const { name, code, flag } = obj;
      return `

${name} (+${code})

      `;
    }).join('');
  }

  // Toggle the container on/off
  function handleButton() {
    container.classList.toggle('show');
  }

  // No data available list item
  function createNoDataHtml() {
    return '
No data available
';
  }

  // When the input is changed filter the data
  // according to the current value, and then
  // create some list items using that filtered data
  function handleInput(e) {
    const { value } = e.target;
    if (value) {
      const filtered = filterData(data, value);
      if (filtered.length) {
        list.innerHTML = createListHtml(filtered);
      } else {
        list.innerHTML = createNoDataHtml();
      }
    } else {
      list.innerHTML = createListHtml(data);
    }
  }

  // Create some button HTML
  function createButtonHtml(code, flag) {
    return `

+${code}

    `;
  }

  // Updates the selected list by removing the `selected`
  // class from all items, and then adding one to the clicked
  // item
  function updateSelected(list, item) {
    const items = list.querySelectorAll('.item');
    items.forEach(item => item.classList.remove('selected'));
    item.classList.add('selected');
  }

  // When an item is clicked, grab the relevant data
  // attributes, create the new button HTML, and then
  // close the container
  function handleListClick(e) {
    const item = e.target.closest('li') || e.target;
    if (item.classList.contains('item')) {
      const { code, flag } = item.dataset;
      xbutton.innerHTML = createButtonHtml(code, flag);
      updateSelected(list, item);
      container.classList.remove('show');
    }
  }

  list.innerHTML = createListHtml(data);

.country-code-selector .telcode {
       margin-bottom: 1em;
       display: flex;
  }
  .country-code-selector .telcode div.code, .item div.name {
       margin-left: 0.25em;
  }
  .country-code-selector .container {
       display: none;
       border: 1px solid grey;
  }
  .country-code-selector .show {
       display: block;
  }
  .country-code-selector .list {
       height: 100px;
       list-style: none;
       margin: 1em 0 0 0;
       padding: 0;
       overflow-y: scroll;
       border: 1px soldi darkgray;
  }
  .country-code-selector .item {
       display: flex;
       padding: 0.25em;
       border: 1px solid lightgray;
  }
  .country-code-selector .item:hover {
       cursor: pointer;
  }
  .country-code-selector .item:hover, .item.selected {
       background-color: lightyellow;
  }

<link href="https://amitdutta.co.in/flag/css/flag-icon.css" rel="stylesheet"/>

  <button type="button" class="telcode">Tel code</button>

    <input type="text" placeholder="Search for country" />


问:
I updated angular application from 10 to 12 , it runs fine in development ,but when i build the application and host the files in cpanel , i get err
This error only occurs after I login successfully ,and this error does not let me enter to dashboard ,of my application.

I have tried changing aot : "true" in ts.config ,but it does not work.


问:
Add custom user param to DiscordProvider NextAuth.js
I am developing a web application in Next.js using next-auth. The main authorization process takes place through the built-in DiscordProvider library. How can I add a custom user parameter (balance), which will not be taken from discord, but will be set as standard when first logging into the account, and then taken from the database?

I tried to look in the documentation of the library, but it describes the process of adding to the user model parameters that Diskord gives, I need an additional parameter is set by default, and then taken from the database.


问:
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are v
```<code>def get_recommendations(title, cosine_sim=cosine_sim):
    # Get the index of the movie that matches the title

    # Get the pairwsie similarity scores of all movies with that movie
    sim_scores = list(enumerate(cosine_sim[movies['name']]))

    # Sort the movies based on the similarity scores
    sim_scores = sorted(sim_scores, key=lambda x: x[1], reverse=True)

    # Get the scores of the 10 most similar movies
    sim_scores = sim_scores[1:11]

    # Get the movie indices
    movie_indices = [i[0] for i in sim_scores]

    # Return the top 10 most similar movies
    return df2['title'].iloc[movie_indices]
</code>```

e

IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

Body:
def get_recommendations(title, cosine_sim=cosine_sim):
    # Get the index of the movie that matches the title

    # Get the pairwsie similarity scores of all movies with that movie
    sim_scores = list(enumerate(cosine_sim[movies['name']]))

    # Sort the movies based on the similarity scores
    sim_scores = sorted(sim_scores, key=lambda x: x[1], reverse=True)

    # Get the scores of the 10 most similar movies
    sim_scores = sim_scores[1:11]

    # Get the movie indices
    movie_indices = [i[0] for i in sim_scores]

    # Return the top 10 most similar movies
    return df2['title'].iloc[movie_indices]

e

IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices


问:
Why is my code running perfectly in PyCharm, but causes errors when run in Visual Studio Code?
The objective of my code is to receive a specific input CSV file and modify it into an output CSV file. The input file contains headers of name and house, while the output file includes headers of first, last, and house.

When I ran this code in PyCharm, being sure to have the necessary supplementary files "before.csv" and "after.csv" in the same folder, the terminal caught no errors, and the file before.csv was successfully modified into after.csv. However, when I ran the same program in VS Code, the terminal displays

ValueError: not enough values to unpack (expected 2, got 1).


问:
Why can't I see my messageField created from class file?
```<code>class Game
{
    constructor(root, lib)
    {
        this.root = root;
        this.stage = this.root.stage;
        this.canvas = this.root.canvas;
        this.messageField = this.root.messageField;
        this.lib = lib;
        this.init();
        this.keys ={};
    }

   init(e){
        this.player = this.root.player_mc;

        const game = this;

        document.addEventListener("keydown", (e) => {

    console.log(`Key "${e.key}" pressed [event: keydown]`);
            this.keys[e.key] = true;

});
        document.addEventListener("keyup", (e) => {

    console.log(`Key "${e.key}" pressed [event: keydown]`);
            this.keys[e.key] = false;

});

    //Message display field

    this.canvas = document.getElementById("gameCanvas");
    this.stage = new createjs.Stage(this.canvas);
    this.messageField = new createjs.Text("Loading", "bold 68px Arial", "#OOOOOO");
    this.messageField.maxWidth = 1000;
    this.messageField.textAlign = "center";
    this.messageField.textBaseline = "middle";
    this.messageField.x = canvas.width / 2;
    this.messageField.y = canvas.height / 2;
    this.stage.addChild(this.root.messageField);
    this.stage.update(e);   //update the stage to show text
    console.log(this.messageField.text);

    }

}
</code>```

I have this code on my class file game.js - the keys are being logged, the messageField can be logged in the console, but there is no text in the project when it is run.  No errors are being thrown by this code.  Any pointers greatly appreciated :)
thank you
sub

I have been working on how to create working Javascript to run from a game.js file to control an adobe animate cc HTML5 Canvas.

I have been asking various questions here and working out how to make it go
https://community.adobe.com/t5/animate-discussions/changing-code-to-get-it-to-work-from-a-class/td-p/13454073#M360897
and here for the current query
https://community.adobe.com/t5/animate-discussions/how-to-get-a-messagefield-working-from-a-class-file/td-p/13455867

I did notice that the text is set to white and thought if I changed it to black I would see the text (I was very happy with myself for a moment)- but you still can't see the text in the final project

Body:
class Game
{
    constructor(root, lib)
    {
        this.root = root;
        this.stage = this.root.stage;
        this.canvas = this.root.canvas;
        this.messageField = this.root.messageField;
        this.lib = lib;
        this.init();
        this.keys ={};
    }

   init(e){
        this.player = this.root.player_mc;

        const game = this;

        document.addEventListener("keydown", (e) => {

    console.log(`Key "${e.key}" pressed [event: keydown]`);
            this.keys[e.key] = true;

});
        document.addEventListener("keyup", (e) => {

    console.log(`Key "${e.key}" pressed [event: keydown]`);
            this.keys[e.key] = false;

});

    //Message display field

    this.canvas = document.getElementById("gameCanvas");
    this.stage = new createjs.Stage(this.canvas);
    this.messageField = new createjs.Text("Loading", "bold 68px Arial", "#OOOOOO");
    this.messageField.maxWidth = 1000;
    this.messageField.textAlign = "center";
    this.messageField.textBaseline = "middle";
    this.messageField.x = canvas.width / 2;
    this.messageField.y = canvas.height / 2;
    this.stage.addChild(this.root.messageField);
    this.stage.update(e);   //update the stage to show text
    console.log(this.messageField.text);

    }

}

I have this code on my class file game.js - the keys are being logged, the messageField can be logged in the console, but there is no text in the project when it is run.  No errors are being thrown by this code.  Any pointers greatly appreciated :)
thank you
sub

I have been working on how to create working Javascript to run from a game.js file to control an adobe animate cc HTML5 Canvas.

I have been asking various questions here and working out how to make it go
https://community.adobe.com/t5/animate-discussions/changing-code-to-get-it-to-work-from-a-class/td-p/13454073#M360897
and here for the current query
https://community.adobe.com/t5/animate-discussions/how-to-get-a-messagefield-working-from-a-class-file/td-p/13455867

I did notice that the text is set to white and thought if I changed it to black I would see the text (I was very happy with myself for a moment)- but you still can't see the text in the final project


问:
I am not able to view icon in options of select in HTML
I am not able to view font awosom icon in options. It will display when I select it but not displayed in options.

I have implement code as:
HTML

```<code><select id="dropdownview" class="rounded ps-3 pe-2">
    <option value="classic" id="classic">    Classic</option>
    <option value="compact" id="compact">    Compact</option>
    <option value="table" id="Table1">    Table</option>
</select>
</code>```

CSS

```<code>@font-face {
    font-family: "FontAwesome";
    font-weight: 600;
    font-style : normal;
    src : url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.eot");
    src : url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.eot") format("embedded-opentype"),
         url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.woff2") format("woff2"),
         url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.woff") format("woff"),
         url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.ttf") format("truetype"),
         url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.svg") format("svg");
}
#dropdownview {
    font-family: FontAwesome;
}

</code>```

Body:
I am not able to view font awosom icon in options. It will display when I select it but not displayed in options.

I have implement code as:
HTML

<select id="dropdownview" class="rounded ps-3 pe-2">
    <option value="classic" id="classic">    Classic</option>
    <option value="compact" id="compact">    Compact</option>
    <option value="table" id="Table1">    Table</option>
</select>

CSS

@font-face {
    font-family: "FontAwesome";
    font-weight: 600;
    font-style : normal;
    src : url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.eot");
    src : url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.eot") format("embedded-opentype"),
         url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.woff2") format("woff2"),
         url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.woff") format("woff"),
         url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.ttf") format("truetype"),
         url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.svg") format("svg");
}
#dropdownview {
    font-family: FontAwesome;
}


问:
Could not find name 'label'. Did you mean 'babel'?
I am using React and get this message when I hover over the label tag within this simple form element. I have never gotten it before with this project, and I have not installed babel to my package manager. Why am I getting this all of a sudden?</p>
```<code>    <div className={styles["form-element"]}>
      <label className={styles['form-label']} htmlFor="assignee">priority</label>
      <select className={styles.priorities}>
        <option value="none" >
          None
        </option>
        <option value="low" >
          Low
        </option>
        <option value="medium" >
          Medium
        </option>
        <option value="high" >
          High
        </option>
      </select>
    </div>
</code>```

Body:
I am using React and get this message when I hover over the label tag within this simple form element. I have never gotten it before with this project, and I have not installed babel to my package manager. Why am I getting this all of a sudden?

      priority
      <select className={styles.priorities}>
        <option value="none" >
          None
        </option>
        <option value="low" >
          Low
        </option>
        <option value="medium" >
          Medium
        </option>
        <option value="high" >
          High
        </option>
      </select>


问:
Contents inside Iframe in shiny
i am trying to put contents inside iframe and I am not sure why the below application is not working (Nothing is displayed inside iframe )

```<code>library(shiny)

members <- data.frame(name=c("Name 1", "Name 2"), nr=c('BCRA1','FITM2'))

ui <- fluidPage(titlePanel("Getting Iframe"),
                sidebarLayout(
                  sidebarPanel(
                    fluidRow(
                      column(6, selectInput("Member", label=h5("Choose a option"),choices=c('BCRA1','FITM2'))
                      ))),
                  mainPanel(fluidRow(
                    htmlOutput("frame")
                  )
                  )
                ))

server <- function(input, output) {
  observe({
    query <- members[which(members$nr==input$Member),2]
    test <<- paste0("http://news.scibite.com/scibites/news.html?q=GENE$",query)
  })
  output$frame <- renderUI({
    input$Member
    my_test <- tags$iframe(src=test, height=600, width=535)
    print(my_test)
    my_test
  })
}

shinyApp(ui, server)
</code>```

Can anyone help me here?

Title: Contents inside Iframe in shiny

Body:
i am trying to put contents inside iframe and I am not sure why the below application is not working (Nothing is displayed inside iframe )

library(shiny)

members <- data.frame(name=c("Name 1", "Name 2"), nr=c('BCRA1','FITM2'))

ui <- fluidPage(titlePanel("Getting Iframe"),
                sidebarLayout(
                  sidebarPanel(
                    fluidRow(
                      column(6, selectInput("Member", label=h5("Choose a option"),choices=c('BCRA1','FITM2'))
                      ))),
                  mainPanel(fluidRow(
                    htmlOutput("frame")
                  )
                  )
                ))

server <- function(input, output) {
  observe({
    query <- members[which(members$nr==input$Member),2]
    test <<- paste0("http://news.scibite.com/scibites/news.html?q=GENE$",query)
  })
  output$frame <- renderUI({
    input$Member
    my_test <- tags$iframe(src=test, height=600, width=535)
    print(my_test)
    my_test
  })
}

shinyApp(ui, server)

Can anyone help me here?


问:
TypeError: can't concat NoneType to bytes
I am using flask for creating api and then serving it on aws. I've created a lambda function for triggering the url, which is sent dynamically from IOT device. However my frame is stopped after sometime around 10 seconds, and throwing an error
TypeError: can't concat NoneType to bytes

```<code>@app.route('/<id>')
def yolo_v4(id):
    try:
        kinesis1 = vid_stream.get_hls_url(id)
        cap =  cv2.VideoCapture(kinesis1)

        # success,image = self.gen_frames("ucCPm3MMSbPmzxWcvd1zb5").read()

        previous = time()
        yolo_v4.delta = 0
        while True:
            success,image = cap.read()
            current = time()

            yolo_v4.delta += current - previous
            previous = current
            frame = image
            # frame = camera.do_something()
            # detection(frame, 0.5)

            try:
                create_alert(frame)

            except Exception as e:
                print("Exception after create alert function:",e)

            if not success:
                break

            else:

                ret, jpeg = cv2.imencode('.jpg', frame)
                frame = jpeg.tobytes()

                pass

    except Exception as e:
        pass

    # yield (b'--frame\r\n'
    #     b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n\r\n')

    yield b'--frame\r\nContent-Type: image/jpeg\r\n\r\n'
    yield frame
    yield b'\r\n\r\n'
</code>```

I don't want to show the video anywhere that's why I even tried removing yield, when removing yield it throws another error
"The function either returned None or ended without a return statement"

Lambda code for triggering

```<code>import json
import logging
import urllib3

logger = logging.getLogger()
logger.setLevel(logging.DEBUG)

# --- Main handler ---

def lambda_handler(event, context):
    """
    Route the incoming request based on intent.
    The JSON body of the request is provided in the event slot.
    """

    print("PPE Event",event)
    streamName = event['deviceId']
    print("StreamName",streamName)

    http = urllib3.PoolManager()
    logger.debug("test")

    response = http.request("GET", "http://ec2-102.somenumber.ap-south-1.compute.amazonaws.com:8080/"+streamName)
    print(response.status)
    return response
</code>```

Body:
I am using flask for creating api and then serving it on aws. I've created a lambda function for triggering the url, which is sent dynamically from IOT device. However my frame is stopped after sometime around 10 seconds, and throwing an error
TypeError: can't concat NoneType to bytes

@app.route('/<id>')
def yolo_v4(id):
    try:
        kinesis1 = vid_stream.get_hls_url(id)
        cap =  cv2.VideoCapture(kinesis1)

        # success,image = self.gen_frames("ucCPm3MMSbPmzxWcvd1zb5").read()

        previous = time()
        yolo_v4.delta = 0
        while True:
            success,image = cap.read()
            current = time()

            yolo_v4.delta += current - previous
            previous = current
            frame = image
            # frame = camera.do_something()
            # detection(frame, 0.5)

            try:
                create_alert(frame)

            except Exception as e:
                print("Exception after create alert function:",e)

            if not success:
                break

            else:

                ret, jpeg = cv2.imencode('.jpg', frame)
                frame = jpeg.tobytes()

                pass

    except Exception as e:
        pass

    # yield (b'--frame\r\n'
    #     b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n\r\n')

    yield b'--frame\r\nContent-Type: image/jpeg\r\n\r\n'
    yield frame
    yield b'\r\n\r\n'

I don't want to show the video anywhere that's why I even tried removing yield, when removing yield it throws another error
"The function either returned None or ended without a return statement"

Lambda code for triggering

import json
import logging
import urllib3

logger = logging.getLogger()
logger.setLevel(logging.DEBUG)

# --- Main handler ---

def lambda_handler(event, context):
    """
    Route the incoming request based on intent.
    The JSON body of the request is provided in the event slot.
    """

    print("PPE Event",event)
    streamName = event['deviceId']
    print("StreamName",streamName)

    http = urllib3.PoolManager()
    logger.debug("test")

    response = http.request("GET", "http://ec2-102.somenumber.ap-south-1.compute.amazonaws.com:8080/"+streamName)
    print(response.status)
    return response


问:
Reverse for 'login' not found. 'login' is not a valid view function or pattern name
[Reverse for 'login' not found. 'login' is not a valid view function or pattern name.[Main.urls[Views.pyUrls.py](https://i.stack.imgur.com/Q88iG.png)](https://i.stack.imgur.com/MPxwl.png)](https://i.stack.imgur.com/9KYhw.png)

NoReverseMatch at /user/signup/

```<code>Reverse for 'login' not found. 'login' is not a valid view function or pattern name.
</code>```

Request Method:POSTRequest URL:http://127.0.0.1:8000/user/signup/Django Version:4.1.4Exception Type:NoReverseMatchException Value:Reverse for 'login' not found. 'login' is not a valid view function or pattern name.Exception Location:C:\Users\JOSHI\OneDrive\Desktop\Watch Store\Venv\lib\site-packages\django\urls\resolvers.py, line 828, in _reverse_with_prefixRaised during:User.views.signupPython Executable:C:\Users\JOSHI\OneDrive\Desktop\Watch Store\Venv\scripts\python.exePython Version:3.9.0Python Path:['C:\\Users\\JOSHI\\OneDrive\\Desktop\\Watch Store\\Online_Shop', 'C:\\Users\\JOSHI\\AppData\\Local\\Programs\\Python\\Python39\\python39.zip', 'C:\\Users\\JOSHI\\AppData\\Local\\Programs\\Python\\Python39\\DLLs', 'C:\\Users\\JOSHI\\AppData\\Local\\Programs\\Python\\Python39\\lib', 'C:\\Users\\JOSHI\\AppData\\Local\\Programs\\Python\\Python39', 'C:\\Users\\JOSHI\\OneDrive\\Desktop\\Watch Store\\Venv', 'C:\\Users\\JOSHI\\OneDrive\\Desktop\\Watch Store\\Venv\\lib\\site-packages']Server time:Sat, 31 Dec 2022 06:39:18 +0000

Body:
[Reverse for 'login' not found. 'login' is not a valid view function or pattern name.[Main.urls[Views.pyUrls.py](https://i.stack.imgur.com/Q88iG.png)](https://i.stack.imgur.com/MPxwl.png)](https://i.stack.imgur.com/9KYhw.png)

NoReverseMatch at /user/signup/

Reverse for 'login' not found. 'login' is not a valid view function or pattern name.

Request Method:POSTRequest URL:http://127.0.0.1:8000/user/signup/Django Version:4.1.4Exception Type:NoReverseMatchException Value:Reverse for 'login' not found. 'login' is not a valid view function or pattern name.Exception Location:C:\Users\JOSHI\OneDrive\Desktop\Watch Store\Venv\lib\site-packages\django\urls\resolvers.py, line 828, in _reverse_with_prefixRaised during:User.views.signupPython Executable:C:\Users\JOSHI\OneDrive\Desktop\Watch Store\Venv\scripts\python.exePython Version:3.9.0Python Path:['C:\\Users\\JOSHI\\OneDrive\\Desktop\\Watch Store\\Online_Shop', 'C:\\Users\\JOSHI\\AppData\\Local\\Programs\\Python\\Python39\\python39.zip', 'C:\\Users\\JOSHI\\AppData\\Local\\Programs\\Python\\Python39\\DLLs', 'C:\\Users\\JOSHI\\AppData\\Local\\Programs\\Python\\Python39\\lib', 'C:\\Users\\JOSHI\\AppData\\Local\\Programs\\Python\\Python39', 'C:\\Users\\JOSHI\\OneDrive\\Desktop\\Watch Store\\Venv', 'C:\\Users\\JOSHI\\OneDrive\\Desktop\\Watch Store\\Venv\\lib\\site-packages']Server time:Sat, 31 Dec 2022 06:39:18 +0000


问:
Process.Start in python is triggering all methods in a class
```<code>from ProjectName.PackageName1.class1 import CLass1
from ProjectName.PackageName1.class2 import CLass2
Class Main_input:

obj1 = Class1()
obj2 = Class2()

list_of_args = obj1.function1(args)

if __name__ == "__main__":
p1= multiprocessing.Process(target=obj2.function2, args=list_of_args)
p1.start()
p1.join

</code>```

When I am running the above code I am expecting

the function1 of Class1 to run first - This will return a list_of_args

Create a process p1 which will run Function2 of class2, iterating over the list_of_args
wherein the items in the list will be divided into the processes and the function will run concurrently of different values

What is happening

The function1 is running fine and returning list_of_args
BUT
when I create a process and I start the process, it is again running the below code again and again

```<code>list_of_args = obj1.function1(args)
</code>```

How should I fix this?

Body:
from ProjectName.PackageName1.class1 import CLass1
from ProjectName.PackageName1.class2 import CLass2
Class Main_input:

obj1 = Class1()
obj2 = Class2()

list_of_args = obj1.function1(args)

if __name__ == "__main__":
p1= multiprocessing.Process(target=obj2.function2, args=list_of_args)
p1.start()
p1.join

When I am running the above code I am expecting

the function1 of Class1 to run first - This will return a list_of_args

Create a process p1 which will run Function2 of class2, iterating over the list_of_args
wherein the items in the list will be divided into the processes and the function will run concurrently of different values

What is happening

The function1 is running fine and returning list_of_args
BUT
when I create a process and I start the process, it is again running the below code again and again

list_of_args = obj1.function1(args)

How should I fix this?


问:
How to integrate the auto modules in smm panels... jazzcash and easypaisa etc?
We see on most of the smm panels a payment method which is called the auto modules... in which the view contains some information about the account i.e account holder name and account number.. on which the user pay the desired amount manually and then add he got two form fields on the same page ... first to enter amount and second to enter trx id... than the wallet balance of an smm panel added automatically.... How this works i just wanted to know.....
Important note: they use a message forwarder which forward the message comes from the easypaisa or jazzcash to the an email address....

Here is the image of the view

i did not try anything


问:
Find CPU core count for apple m1/m2?
I see questions asking for apple gpu core count. I'd simply like to know how in C I can find how many cores are on the system? I know the apple m2 has 8 but the M1 appears to have 8 or more. Also I hear the big cores might be disabled in a battery efficient mode. I don't need to know how to detect that but that might be useful</p>

Title: Find CPU core count for apple m1/m2?


问:
How do I put files in folders while using Eliom?
I am beginning to develop a website in ocaml using Eliom. As the project grows, I want to be able to split off different segments of the code into different files and then group these files into folders. I figured out how to split off into different files: In Makefile.options, I change the line:

```<code>SERVER_FILES := $(wildcard *.eliomi *.eliom)
</code>```

to

```<code>SERVER_FILES := $(wildcard *.eliomi *.eliom) file.ml
</code>```

However, I can't figure out how to be able to use .ml files that are in folders. If I naively use:

```<code>SERVER_FILES := $(wildcard *.eliomi *.eliom) folder/file.ml
</code>```

I get the error:

```<code>/bin/sh: 1: cannot create _deps/folder/.server: Directory nonexistent
</code>```

And even if I manually create this file and build again, I get the error:

```<code>/bin/sh: 1: Unbound module File
</code>```

Is there some way I can access files that I put into folders?

Body:
I am beginning to develop a website in ocaml using Eliom. As the project grows, I want to be able to split off different segments of the code into different files and then group these files into folders. I figured out how to split off into different files: In Makefile.options, I change the line:

SERVER_FILES := $(wildcard *.eliomi *.eliom)

to

SERVER_FILES := $(wildcard *.eliomi *.eliom) file.ml

However, I can't figure out how to be able to use .ml files that are in folders. If I naively use:

SERVER_FILES := $(wildcard *.eliomi *.eliom) folder/file.ml

I get the error:

/bin/sh: 1: cannot create _deps/folder/.server: Directory nonexistent

And even if I manually create this file and build again, I get the error:

/bin/sh: 1: Unbound module File

Is there some way I can access files that I put into folders?


问:
Populating a MultiChoiceItem Dialog interface with ArrayList / CharSequence[] (dynamic data)
I've been trying to implement an ArrayAdapter or ArrayList into a custom dialog through its builder, as I need the ability to multiselect, and at same time the list items are going to be dynamic(fetching from database).

```<code>alertDialogBuilder.setMultiChoiceItems(items, checkedItems, listener);
</code>```

In my case I need the items to be populated by an ArrayList<String> or ArrayList<CharSequence> but i can't seem to get them working.

The type of MultiChoice dialog i mentioned is similar to this android-spinner-like-ui-for-selecting-multiple-options

I've tried searching but the only solutions i get are for single choice items. The builder.setAdapter(ListAdapter, OnClickListener) method only allows an OnClickListener while i need a DialogInterface.OnMultiChoiceClickListener instead. Can anyone kindly enlighten me a little? Thanks!

ContentLicense: CC BY-SA 3.0

Body:
I've been trying to implement an ArrayAdapter or ArrayList into a custom dialog through its builder, as I need the ability to multiselect, and at same time the list items are going to be dynamic(fetching from database).

alertDialogBuilder.setMultiChoiceItems(items, checkedItems, listener);

In my case I need the items to be populated by an ArrayList<String> or ArrayList<CharSequence> but i can't seem to get them working.

The type of MultiChoice dialog i mentioned is similar to this android-spinner-like-ui-for-selecting-multiple-options

I've tried searching but the only solutions i get are for single choice items. The builder.setAdapter(ListAdapter, OnClickListener) method only allows an OnClickListener while i need a DialogInterface.OnMultiChoiceClickListener instead. Can anyone kindly enlighten me a little? Thanks!


问:
Netlify Functions: file path and endpoint
I managed to get a Netlify "serverless" function working, but I noticed something, and hope someone can confirm what I'm seeing:

I believe the default location for Netlify functions in your project is netlify/functions, but if you save your function file, say hello-world.js, in the /functions folder, it won't work. Digging a little deeper, it seems the Netlify function endpoint refers to a FOLDER and not a FILE. Thus, to make this work, hello-world.js must be saved at /functions/hello-world/, in its own folder within /functions. Why this is, I don't know, and the Netlify docs aren't terribly clear and explicit about this. It's a bit confusing because in your code, you must obviously refer to the file path as netlify/functions/hello-world/hello-world.js [edit: actually the fetch is (or can be?) '/.netlify/functions/hello-world' which is the same as the endpoint, just make sure that is a folder, not the file itself] , yet the function endpoint in Netlify is netlify/functions/hello-world/.

Am I on the right track here?


问:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. > Failed to find Platform SDK with path: platforms;android-31

What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.

Failed to find Platform SDK with path: platforms;android-31

Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 11s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

Tried installing tools in sdk manager, which failed


问:
Trying to install metpy in my machine but getting error
Metpy 1.4 got installed but when imported it is showing error even after update

ModuleNotFoundError: No module named 'xarray.core.accessors'.

I was trying to work with Metpy, although the installation was successful but when I imported it in my code I got

I even tries conda update --all & than conda forge but the things are not working.


问:
Flutter Google Maps Access denied finding property "ro.vendor.perf.scroll_opt"
In flutter 3, I'm using google_maps_flutter package to show a map with markers. After map created I call animateCamera method, but this method print the following error.

```<code>Access denied finding property "ro.vendor.perf.scroll_opt"
</code>```

this is my map

```<code>          GoogleMap(
            mapType: MapType.normal,
            initialCameraPosition: CameraPosition(
              target: LatLng(49.28365819800792, -123.10308363551924),
              zoom: 10.4746,
            ),
            myLocationEnabled: true,
            myLocationButtonEnabled: false,
            tiltGesturesEnabled: true,
            compassEnabled: false,
            scrollGesturesEnabled: true,
            mapToolbarEnabled: false,
            zoomGesturesEnabled: true,
            zoomControlsEnabled: false,
            markers: Set<Marker>.of(markers.values),
            polylines: Set<Polyline>.of(polylines.values),
            onMapCreated: (GoogleMapController controller) {
              _mapController = controller;
              _animateCamera();
            },
            onTap: (argument) => _setBound(),
          ),
</code>```

and this is animate camera method.

```<code>  _animateCamera() {
    if (moverLat != null && moverLng != null)
      _mapController!.animateCamera(
        CameraUpdate.newCameraPosition(
          new CameraPosition(
            bearing: 192.8334901395799,
            target: LatLng(moverLat!, moverLng!),
            tilt: 0,
            zoom: 14.00,
          ),
        ),
      );
  }
</code>```

How can this be solved?

Body:
In flutter 3, I'm using google_maps_flutter package to show a map with markers. After map created I call animateCamera method, but this method print the following error.

Access denied finding property "ro.vendor.perf.scroll_opt"

this is my map

          GoogleMap(
            mapType: MapType.normal,
            initialCameraPosition: CameraPosition(
              target: LatLng(49.28365819800792, -123.10308363551924),
              zoom: 10.4746,
            ),
            myLocationEnabled: true,
            myLocationButtonEnabled: false,
            tiltGesturesEnabled: true,
            compassEnabled: false,
            scrollGesturesEnabled: true,
            mapToolbarEnabled: false,
            zoomGesturesEnabled: true,
            zoomControlsEnabled: false,
            markers: Set<Marker>.of(markers.values),
            polylines: Set<Polyline>.of(polylines.values),
            onMapCreated: (GoogleMapController controller) {
              _mapController = controller;
              _animateCamera();
            },
            onTap: (argument) => _setBound(),
          ),

and this is animate camera method.

  _animateCamera() {
    if (moverLat != null && moverLng != null)
      _mapController!.animateCamera(
        CameraUpdate.newCameraPosition(
          new CameraPosition(
            bearing: 192.8334901395799,
            target: LatLng(moverLat!, moverLng!),
            tilt: 0,
            zoom: 14.00,
          ),
        ),
      );
  }

How can this be solved?


问:
maven plugin error ? Plugin 'org.apache.maven.plugins:maven-release-plugin:' not found while converting the hazelcast from 3.x to 5.x
This maven plugin giving me the error i.e Plugin 'org.apache.maven.plugins:maven-release-plugin:' not found

```<code><plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <configuration>
        <tagBase>https://github.com/****************/tags</tagBase>
    </configuration>
</plugin>
</code>```

Body:
This maven plugin giving me the error i.e Plugin 'org.apache.maven.plugins:maven-release-plugin:' not found

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <configuration>
        <tagBase>https://github.com/****************/tags</tagBase>
    </configuration>
</plugin>


问:
Upsell product Displaying two times
In my Website the upsell product is displaying two times  when I add this code to move the position after related products

```<code>add_action( 'init', 'move_upsells_after_related' );
function move_upsells_after_related( ) {
    remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
    add_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 25 );
}
</code>```

In my Website the upsell product is displaying two times  when I add this code to move the position after related products

```<code>add_action( 'init', 'move_upsells_after_related' );
function move_upsells_after_related( ) {
    remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
    add_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 25 );
}
</code>```

Title: Upsell product Displaying two times

Body:
In my Website the upsell product is displaying two times  when I add this code to move the position after related products

add_action( 'init', 'move_upsells_after_related' );
function move_upsells_after_related( ) {
    remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
    add_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 25 );
}

In my Website the upsell product is displaying two times  when I add this code to move the position after related products

add_action( 'init', 'move_upsells_after_related' );
function move_upsells_after_related( ) {
    remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
    add_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 25 );
}


问:
GraphQL API is working locally but not when deployed to AWS
My project uses AWS and GraphQL (Amplify add api with DynamoDB). My schema.graphql is below:

```<code>type Post @model @auth(rules: [
    { allow: owner, operations: [delete, update, read]}
    # { allow: private, operations: [read, create], provider: userPools}
    { allow: public, provider: iam, operations: [read]}
    ])
  {
  id:ID!
  tag: String!
  title: String!
  content: String!
  photo: String
  owner: String
  category: String!
}

typescript
    const readBoards = async () => {
        const Boards = await API.graphql({query: listPosts, authMode: 'AMAZON_COGNITO_USER_POOLS'});
        const allBoards = Boards.data.listPosts.items;
        setBoardsItems(allBoards);
    };
</code>```

On localhost I can see listPosts items but not at deploying site.
I allow public to read but why at deploying site I can't see the table?

localhost:

deployment site:

I checked several @auth mode changes.

I think that API Gateway, Proxy or CORS are the cause of my problem.

Body:
My project uses AWS and GraphQL (Amplify add api with DynamoDB). My schema.graphql is below:

type Post @model @auth(rules: [
    { allow: owner, operations: [delete, update, read]}
    # { allow: private, operations: [read, create], provider: userPools}
    { allow: public, provider: iam, operations: [read]}
    ])
  {
  id:ID!
  tag: String!
  title: String!
  content: String!
  photo: String
  owner: String
  category: String!
}

typescript
    const readBoards = async () => {
        const Boards = await API.graphql({query: listPosts, authMode: 'AMAZON_COGNITO_USER_POOLS'});
        const allBoards = Boards.data.listPosts.items;
        setBoardsItems(allBoards);
    };

On localhost I can see listPosts items but not at deploying site.
I allow public to read but why at deploying site I can't see the table?

localhost:

deployment site:

I checked several @auth mode changes.

I think that API Gateway, Proxy or CORS are the cause of my problem.


问:
How can I remove header when setting UICollectionLayoutListConfiguration in iOS16
When I have a view with section and list components, it has a top padding for each section.

```<code>struct NewListView: View {

@State private var list = ["1", "2", "3", "4"]

var body: some View {
  NavigationView {
    List {
      ForEach(list, id: \.self) { item in
        let isHeaderHidden = item != "1"
        if isHeaderHidden {
          Section(header: Text("\(item)")) {
            Text("Content with Header")
          }.onAppear {
            print("item\(item)")
          }
        } else {
          Text("Content without header")
        }
      }
    }
    .listRowInsets(EdgeInsets())
    .listStyle(.plain)
    .navigationTitle("NavTitle")
    .navigationBarTitleDisplayMode(.inline)
  }
 }
}
</code>```

In order to remove the padding, I set the UICollectionLayoutListConfiguration(.headerTopPadding = 0) like below but the header view appears for the section I don't need(The first section).

How can I remove the header but also remove the top padding at the same time?
 Thanks in advance.

```<code>init() {
if #available(iOS 16, *) {
  var configuration = UICollectionLayoutListConfiguration(appearance: .plain)
  configuration.headerMode = .supplementary
  configuration.headerTopPadding = 0

  let layout = UICollectionViewCompositionalLayout.list(using: configuration)
  UICollectionView.appearance(whenContainedInInstancesOf: [UIViewController.self]).collectionViewLayout = layout
 }
}
</code>```

Body:
When I have a view with section and list components, it has a top padding for each section.

struct NewListView: View {

@State private var list = ["1", "2", "3", "4"]

var body: some View {
  NavigationView {
    List {
      ForEach(list, id: \.self) { item in
        let isHeaderHidden = item != "1"
        if isHeaderHidden {
          Section(header: Text("\(item)")) {
            Text("Content with Header")
          }.onAppear {
            print("item\(item)")
          }
        } else {
          Text("Content without header")
        }
      }
    }
    .listRowInsets(EdgeInsets())
    .listStyle(.plain)
    .navigationTitle("NavTitle")
    .navigationBarTitleDisplayMode(.inline)
  }
 }
}

In order to remove the padding, I set the UICollectionLayoutListConfiguration(.headerTopPadding = 0) like below but the header view appears for the section I don't need(The first section).

How can I remove the header but also remove the top padding at the same time?
 Thanks in advance.

init() {
if #available(iOS 16, *) {
  var configuration = UICollectionLayoutListConfiguration(appearance: .plain)
  configuration.headerMode = .supplementary
  configuration.headerTopPadding = 0

  let layout = UICollectionViewCompositionalLayout.list(using: configuration)
  UICollectionView.appearance(whenContainedInInstancesOf: [UIViewController.self]).collectionViewLayout = layout
 }
}


问:
How to set a jButton to trigger a key event in the keyboard?
For example, I have created a jTextField and ten jButtons representing 0-9 keyboard buttons in a number pad.

Here what I want is when I press the jButton which represents 0, it should trigger the keyboard's 0 button instead of triggering an assigned variable value (int jButton_Zero = 0) to the jButton and then it should appear on the jTextField.


问:
What is the logic behind the output of statistics.quantiles method
I have just started learning stats , and came across on this quantiles concept, want to know the reason behind the output, if- a =[1,2,3,3] statistics.quantiles(a) it returns [1.25,2.5, 3.0] , what is the reason behind 1.25 value? When method is 'inclusive' it gives 1.75.


问:
Custom theme not applied
I've created a new Flex library project called Foo, which contains a css file default.css.
I want to apply the .swc as a theme to project Bar.
So I went to Properties -> Flex Theme -> Import Theme... and imported Foo.swc.
A new theme called Foo showed up. I selected it and clicked OK to recompile Bar.

The css file was not applied ;(
What am I missing?

Title: Custom theme not applied


问:
Write a new line arrow into a model_has_role_table Spatie Laravel
i am using Spatie in Laravel 8, I tried using eloquent but unfortunately there is no model for the tables created under the spatie migrations.
I am trying to excecute a line like this

```<code>DB::table('model_has_roles')->insert(['role_id' => 1, 'model_type' => 'App\Models\User' ,'model_id' => 4]);
</code>```

i inserted this line into RegisterController.php in function create

```<code> protected function create(array $data)
{

  DB::table('model_has_roles')->insert(['role_id' => 1, 'model_type' => 'App\Models\User' ,'model_id' => 4]);

    return User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => Hash::make($data['password']),
    ]);
}
</code>```

When a register a new user i got the following error

Illuminate\Database\QueryException
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (tcsnpedro.model_has_roles, CONSTRAINT model_has_roles_role_id_foreign FOREIGN KEY (role_id) REFERENCES roles (id) ON DELETE CASCADE) (SQL: insert into model_has_roles (role_id, model_type, model_id) values (1, App\Models\User, 4))

what does this error mean?

I found this interesting article Update database table column - Laravel
where a person do an update of the "model_has_roles" table, and i guess he succeeded doing this.
where should i put the following DB code?

```<code> DB::table('model_has_roles')->insert(['role_id' => 1, 'model_type' => 'App\Models\User' ,'model_id' => 4]);
</code>```

Should i create a new laravel model in order to create and update information into the model_has_role spatie table?

Body:
i am using Spatie in Laravel 8, I tried using eloquent but unfortunately there is no model for the tables created under the spatie migrations.
I am trying to excecute a line like this

DB::table('model_has_roles')->insert(['role_id' => 1, 'model_type' => 'App\Models\User' ,'model_id' => 4]);

i inserted this line into RegisterController.php in function create

 protected function create(array $data)
{

  DB::table('model_has_roles')->insert(['role_id' => 1, 'model_type' => 'App\Models\User' ,'model_id' => 4]);

    return User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => Hash::make($data['password']),
    ]);
}

When a register a new user i got the following error

Illuminate\Database\QueryException
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (tcsnpedro.model_has_roles, CONSTRAINT model_has_roles_role_id_foreign FOREIGN KEY (role_id) REFERENCES roles (id) ON DELETE CASCADE) (SQL: insert into model_has_roles (role_id, model_type, model_id) values (1, App\Models\User, 4))

what does this error mean?

I found this interesting article Update database table column - Laravel
where a person do an update of the "model_has_roles" table, and i guess he succeeded doing this.
where should i put the following DB code?

 DB::table('model_has_roles')->insert(['role_id' => 1, 'model_type' => 'App\Models\User' ,'model_id' => 4]);

Should i create a new laravel model in order to create and update information into the model_has_role spatie table?


问:
how to refresh a page in IndexedStack - flutter
I used an indexedStack for my bottom navbar pages to prevent a page from reloading each time I open it and save it's state, but the thing is I need to make another page do the exact opposite, and being refreshed each time I open it. how can I do it?</p>


问:
Is there a way to create a php-like unique id using javascript?
Unique id created by php - uniqid() - for example - 63afe4f2903a2 - perfectly suits my needs, although it is not perfectly assured to be unique.

So I need a 13 characters length ID which is made using the same logic as uniqid in php

Is there a way to create it using plain javascript or jquery ?

Thanks.

update

There is no answer on my question here


问:
When npm installs the same dependencies of different versions for different root dependencies, where are they located and how are they tracked?
I had no good idea on how to word this, but let me try to show an example and explain.

taking a look at the json5 dep used in our app via npm ls json5 you will see 2 different verions of 2.2.1 and 1.0.1

```<code>├─┬ @babel/core@7.20.5
│ └── json5@2.2.1
├─┬ babel-loader@8.3.0
│ └─┬ loader-utils@2.0.4
│   └── json5@2.2.1 deduped
└─┬ eslint-plugin-import@2.26.0
  └─┬ tsconfig-paths@3.14.1
    └── json5@1.0.1

</code>```

Now my question relates to how npm installs and knows which version to use for which dependency (no matter how deep) and where are the located.

For example on my where are the located. part of my question.

When i search my root node_modules folder, and look for eslint-plugin-import dep, i find a node-modules within it but it only 3 things, I thought i would find another folder that is labeled tsconfig-path and inside that, find another node_modules folder that contains json5@1.0.1. But i dont, the only thing i do find is my root node_modules folder contains all three, eslint-plugin-import, tsconfig-paths, and json5.

I also noticed, that even thought this dep tree shows version 1.0.1 and 2.2.1 for json5, my root node_modules folder is the 2.2.1 version.

So that makes me wonder, where is the 1.0.1 version located, and how does it keep track of these different verions for these dep trees to know which one to us since i couldnt even find the 1.0.1 version physically anywhere. I guess i need a better understanding on how npm works and how the npm ecosystem for dependencies.

Sorry for long explanation, its just hard for me to rely my thoughts in a shorter summary.

Body:
I had no good idea on how to word this, but let me try to show an example and explain.

taking a look at the json5 dep used in our app via npm ls json5 you will see 2 different verions of 2.2.1 and 1.0.1

├─┬ @babel/core@7.20.5
│ └── json5@2.2.1
├─┬ babel-loader@8.3.0
│ └─┬ loader-utils@2.0.4
│   └── json5@2.2.1 deduped
└─┬ eslint-plugin-import@2.26.0
  └─┬ tsconfig-paths@3.14.1
    └── json5@1.0.1

Now my question relates to how npm installs and knows which version to use for which dependency (no matter how deep) and where are the located.

For example on my where are the located. part of my question.

When i search my root node_modules folder, and look for eslint-plugin-import dep, i find a node-modules within it but it only 3 things, I thought i would find another folder that is labeled tsconfig-path and inside that, find another node_modules folder that contains json5@1.0.1. But i dont, the only thing i do find is my root node_modules folder contains all three, eslint-plugin-import, tsconfig-paths, and json5.

I also noticed, that even thought this dep tree shows version 1.0.1 and 2.2.1 for json5, my root node_modules folder is the 2.2.1 version.

So that makes me wonder, where is the 1.0.1 version located, and how does it keep track of these different verions for these dep trees to know which one to us since i couldnt even find the 1.0.1 version physically anywhere. I guess i need a better understanding on how npm works and how the npm ecosystem for dependencies.

Sorry for long explanation, its just hard for me to rely my thoughts in a shorter summary.


问:
Why are the outputs of the following two functions different?
I'm trying to understand why JavaScript behaves this way. To generate numbers from 1 to n inclusive in an array,

The following works:

```<code>console.log(new Array(5).fill().map((a,i)=>i+1))  //Result [1,2,3,4,5] as expected.

</code>```

But if I remove fill() it doesn't work:

```<code>console.log(new Array(5).map((a,i)=>i+1))  //Result [undefined,undefined,undefined,undefined,undefined]

</code>```

Since the array is already initialized and we are mapping from the indices, why does the latter not work?

I tried both in jsFiddle. This is more about clarifying a concept than solving a problem.

Body:
I'm trying to understand why JavaScript behaves this way. To generate numbers from 1 to n inclusive in an array,

The following works:

console.log(new Array(5).fill().map((a,i)=>i+1))  //Result [1,2,3,4,5] as expected.

But if I remove fill() it doesn't work:

console.log(new Array(5).map((a,i)=>i+1))  //Result [undefined,undefined,undefined,undefined,undefined]

Since the array is already initialized and we are mapping from the indices, why does the latter not work?

I tried both in jsFiddle. This is more about clarifying a concept than solving a problem.


问:
Postgresql : Global replace all foreign key references to a row with another
I am using postgres with Django.

I have a table of users. The rows are referenced in other tables as foreign keys.

Some times, we want to merge two user rows into one. We want to replace all references to a particular row with another. Is this possible?


问:
Using AmplitudeTap with AudioKit on MacOS?
If I run the following test code, I hear sound, but AmplitudeTap doesn't seem to be called. What am I missing?

```<code>import Cocoa
import AudioKit
import SoundpipeAudioKit
import AudioKitEX

@main
class AppDelegate: NSObject, NSApplicationDelegate {

    let engine = AudioEngine()
    var last:Float = 0.0

    func applicationDidFinishLaunching(_ aNotification: Notification) {
        let osc = PinkNoise(amplitude: 0.1)
        osc.start()
        let mixer = Mixer()
        mixer.addInput(osc)
        mixer.start()
        engine.output = mixer
        let tap = AmplitudeTap(mixer) { amp in
            if amp>self.last {
                debugPrint("Monitor: \(amp)")
                self.last=amp
            }
        }
        tap.start()
        debugPrint("Tab started.")
        try! engine.start()
    }

    func applicationWillTerminate(_ aNotification: Notification) {
        // Insert code here to tear down your application
    }

    func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
        return true
    }

}
</code>```

I get this output:

```<code>2022-12-31 02:29:33.427567-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428191-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428263-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428331-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428413-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428475-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428539-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428597-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428657-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428923-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.429276-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.429345-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.429409-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.429480-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.429566-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.464884-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.464936-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.464982-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.468860-0500 LevelWatcher[25083:20195134] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x6000037bf4c0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
2022-12-31 02:29:33.552980-0500 LevelWatcher[25083:20195134]   no saved enable hardware sample rate converter preference found
"Tab started."
</code>```

Body:
If I run the following test code, I hear sound, but AmplitudeTap doesn't seem to be called. What am I missing?

import Cocoa
import AudioKit
import SoundpipeAudioKit
import AudioKitEX

@main
class AppDelegate: NSObject, NSApplicationDelegate {

    let engine = AudioEngine()
    var last:Float = 0.0

    func applicationDidFinishLaunching(_ aNotification: Notification) {
        let osc = PinkNoise(amplitude: 0.1)
        osc.start()
        let mixer = Mixer()
        mixer.addInput(osc)
        mixer.start()
        engine.output = mixer
        let tap = AmplitudeTap(mixer) { amp in
            if amp>self.last {
                debugPrint("Monitor: \(amp)")
                self.last=amp
            }
        }
        tap.start()
        debugPrint("Tab started.")
        try! engine.start()
    }

    func applicationWillTerminate(_ aNotification: Notification) {
        // Insert code here to tear down your application
    }

    func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
        return true
    }

}

I get this output:

2022-12-31 02:29:33.427567-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428191-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428263-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428331-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428413-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428475-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428539-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428597-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428657-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.428923-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.429276-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.429345-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.429409-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.429480-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.429566-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.464884-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.464936-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.464982-0500 LevelWatcher[25083:20195134] throwing -10878
2022-12-31 02:29:33.468860-0500 LevelWatcher[25083:20195134] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x6000037bf4c0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
2022-12-31 02:29:33.552980-0500 LevelWatcher[25083:20195134]   no saved enable hardware sample rate converter preference found
"Tab started."


问:
use a single navbar file on multiple html files using a single tag in python flask
I have navbar html template nav.html I want to use it on other html files.
I am creating a web application on pyhton flask.

enter image description here
I dont to write the same code on every page. I want to create once and user any where.


问:
WP Job Manager - Search Job Titles Only
WP Job Manager doesn’t provide an option for users to search jobs by job title only. This, the results of a job search can be widely off the mark as the search queries the post content by default.

I’ve found some code which works with WordPress posts, it limits the general site search to query post titles only.

My question is, I need it to work with the custom post type for WP Job Manager, which I believe is job_listing. Any thoughts appreciated.

```<code>function __search_by_title_only( $search, &$wp_query )
{
    global $wpdb;

    if ( empty( $search ) )
        return $search; // skip processing - no search term in query

    $q = $wp_query->query_vars;
    $n = ! empty( $q['exact'] ) ? '' : '%';

    $search =
    $searchand = '';

    foreach ( (array) $q['search_terms'] as $term ) {
        $term = esc_sql( like_escape( $term ) );
        $search .= "{$searchand}($wpdb->posts.post_title LIKE '{$n}{$term}{$n}')";
        $searchand = ' AND ';
    }

    if ( ! empty( $search ) ) {
        $search = " AND ({$search}) ";
        if ( ! is_user_logged_in() )
            $search .= " AND ($wpdb->posts.post_password = '') ";
    }

    return $search;
}
add_filter( 'posts_search', '__search_by_title_only', 500, 2 );
</code>```

Title: WP Job Manager - Search Job Titles Only

Body:
WP Job Manager doesn’t provide an option for users to search jobs by job title only. This, the results of a job search can be widely off the mark as the search queries the post content by default.

I’ve found some code which works with WordPress posts, it limits the general site search to query post titles only.

My question is, I need it to work with the custom post type for WP Job Manager, which I believe is job_listing. Any thoughts appreciated.

function __search_by_title_only( $search, &$wp_query )
{
    global $wpdb;

    if ( empty( $search ) )
        return $search; // skip processing - no search term in query

    $q = $wp_query->query_vars;
    $n = ! empty( $q['exact'] ) ? '' : '%';

    $search =
    $searchand = '';

    foreach ( (array) $q['search_terms'] as $term ) {
        $term = esc_sql( like_escape( $term ) );
        $search .= "{$searchand}($wpdb->posts.post_title LIKE '{$n}{$term}{$n}')";
        $searchand = ' AND ';
    }

    if ( ! empty( $search ) ) {
        $search = " AND ({$search}) ";
        if ( ! is_user_logged_in() )
            $search .= " AND ($wpdb->posts.post_password = '') ";
    }

    return $search;
}
add_filter( 'posts_search', '__search_by_title_only', 500, 2 );


问:
geom_mark_hull include empty spaces with no points
I am plotting biplots of NMDS and using ggforce::geom_marK_hull to create hulls around points representing fish communities from two sites, faceted by year and season (wet and dry):
Biplot

I found that some of the hulls are including empty spaces without any points (e.g. Upstream group in wet season 2018 and Upstream group in dry season 2020). I have tried to adjust the expand argument but it seems the problem persists.

Any idea what the reason might be? I would appreciate any comments or help! Thanks in advance!

Raw data files used are fish.spp and fish.env. Codes are:

```<code>library(vegan)
library(ggplot2)
library(ggforce)
library(concaveman)

fish.nmds.k3 <- metaMDS(fish.spp, distance = "bray", k = 3)
fish.nmds.k3.sites <- as.data.frame(fish.nmds.k3$points)
fish.nmds.k3.sp <- as.data.frame(fish.nmds.k3$species)

(ggplot(fish.nmds.k3.sites, aes(MDS1, MDS2))+
        ylim(-3, 3) + xlim (-3, 3) +
        geom_mark_hull(aes(fill = fish.env$Site), expand = unit(3, "mm")) +
        geom_point() +
        labs(title = "NMDS Plot of Freshwater Fish Community") +
        theme_bw() +
        theme(plot.title = element_text(hjust = 0.5, face = "bold", size = 10),
             panel.grid = element_blank()) +
        facet_grid(rows = vars(fish.env$Year), cols = vars(fish.env$Season))
)
</code>```

Body:
I am plotting biplots of NMDS and using ggforce::geom_marK_hull to create hulls around points representing fish communities from two sites, faceted by year and season (wet and dry):
Biplot

I found that some of the hulls are including empty spaces without any points (e.g. Upstream group in wet season 2018 and Upstream group in dry season 2020). I have tried to adjust the expand argument but it seems the problem persists.

Any idea what the reason might be? I would appreciate any comments or help! Thanks in advance!

Raw data files used are fish.spp and fish.env. Codes are:

library(vegan)
library(ggplot2)
library(ggforce)
library(concaveman)

fish.nmds.k3 <- metaMDS(fish.spp, distance = "bray", k = 3)
fish.nmds.k3.sites <- as.data.frame(fish.nmds.k3$points)
fish.nmds.k3.sp <- as.data.frame(fish.nmds.k3$species)

(ggplot(fish.nmds.k3.sites, aes(MDS1, MDS2))+
        ylim(-3, 3) + xlim (-3, 3) +
        geom_mark_hull(aes(fill = fish.env$Site), expand = unit(3, "mm")) +
        geom_point() +
        labs(title = "NMDS Plot of Freshwater Fish Community") +
        theme_bw() +
        theme(plot.title = element_text(hjust = 0.5, face = "bold", size = 10),
             panel.grid = element_blank()) +
        facet_grid(rows = vars(fish.env$Year), cols = vars(fish.env$Season))
)


问:
How can I call an asynchronous function inside my synchronous Consumer?
In my django quiz project I work with Channels. My consumer QuizConsumer is synchronous but now I need it to start a timer that runs in parallel to its other functions and sends a message after the timer is over.

```<code>class QuizConsumer(WebsocketConsumer):

    def configure_round(self, lobby_id):
        # Call function to send message to begin the round to all players
        async_to_sync(self.channel_layer.group_send)(
            self.lobby_group_name,
            {
                'type':'start_round',
                'lobby_id':lobby_id,
            }
        )

        self.show_results(lobby_id, numberVideos, playlength)

    def start_round(self, event):
        self.send(text_data=json.dumps({
            'type':'start_round',
            'lobby_id': event['lobby_id']
        }))

    def show_results(self, lobby_id, numberVideos, playlength):
        async_to_sync(self.channel_layer.group_send)(
            self.lobby_group_name,
            {
                'type':'show_results_delay',
                'lobby_id':lobby_id,
                'numberVideos':numberVideos,
                'playlength':playlength,
            }
        )

    def show_results_delay(self, event):
        time.sleep(event['numberVideos']*event['playlength']+5)
        self.send(text_data=json.dumps({
            'type':'show_solution',
            'lobby_id': event['lobby_id']
        }))
</code>```

I tried to work with async functions and await, but I did not get it to work as I expected yet. I tried to work with async functions but so far it disconnected from the websocket or it did not send the "start_round" until the timer was finished.

Body:
In my django quiz project I work with Channels. My consumer QuizConsumer is synchronous but now I need it to start a timer that runs in parallel to its other functions and sends a message after the timer is over.

class QuizConsumer(WebsocketConsumer):

    def configure_round(self, lobby_id):
        # Call function to send message to begin the round to all players
        async_to_sync(self.channel_layer.group_send)(
            self.lobby_group_name,
            {
                'type':'start_round',
                'lobby_id':lobby_id,
            }
        )

        self.show_results(lobby_id, numberVideos, playlength)

    def start_round(self, event):
        self.send(text_data=json.dumps({
            'type':'start_round',
            'lobby_id': event['lobby_id']
        }))

    def show_results(self, lobby_id, numberVideos, playlength):
        async_to_sync(self.channel_layer.group_send)(
            self.lobby_group_name,
            {
                'type':'show_results_delay',
                'lobby_id':lobby_id,
                'numberVideos':numberVideos,
                'playlength':playlength,
            }
        )

    def show_results_delay(self, event):
        time.sleep(event['numberVideos']*event['playlength']+5)
        self.send(text_data=json.dumps({
            'type':'show_solution',
            'lobby_id': event['lobby_id']
        }))

I tried to work with async functions and await, but I did not get it to work as I expected yet. I tried to work with async functions but so far it disconnected from the websocket or it did not send the "start_round" until the timer was finished.


问:
Google sheet API V4 append values formatting issue?
There is a problem in google sheet api v4. My application first add formatted heading row (Image1) to the user sheet via of sheet batchUpdate EHD point .

When my application start appending values (start from A1 or A2) into the sheet the new appended rows are also formatted like the first row (Image2) Image2

When i start appending from A3 (leave row2 empty) then it work fine (Image3)

This is API Endpoint:

https://sheets.googleapis.com/v4/spreadsheets/${sheet.id}/values/${sheet.gridName}!A1:append?valueInputOption=USER_ENTERED&insertDataOption=INSERT_ROWS

My Question is why google sheet append values function with insert_rows parameter copy the design(formatting) of the above row (last row after insert the new one) and how to solve this?


问:
Dynamically linking against standard library MinGW
one thing I haven't been able to work out running with bazel is using libstd dynamically
that is, using

libstdc++-6.dll

I have to manually copy this into the bazel-bin in order to use it. I was hoping this would be something I can have bazel manage such that it will do this each time automatically (on a full project clean for example)

I am able to have it work by specifying linkopts=["-static"] to statically link against the standard library, however this is not ideal, since sometimes I might be using a 3rd party library whose built files might require the DLL.

Any help here would be massively appreciated, thanks


问:
Require assistance with filtergraph contruction using ffmpeg
problem: I manually make videos, and have decided to make a program to automatically make the video for me. Here is an example of the videos that i am trying to achieve. E.g: (https://youtu.be/eVQ9ysp0Pj0) (videos are displayed at 19 seconds into the video). This is the desired result i am trying to achieve. I have the following filter graph that has most of the elements:

```<code>exe = "-i " + file + " -i " + frame + " -i " + framestart + " -i " + frameEnd + " -i " + audioOverlay + " -filter_complex \"[0:v]pad="+mVideoWidth+":"+mVideoHeight+":576:0[vpad]; [vpad][1]overlay[vframed]; [vframed]split=3[vfr1][vfr2][vfr3]; [vfr1]reverse[vrev]; [vfr2][vrev][vfr3]concat=n=3,setpts=1*(PTS-STARTPTS)[vboom]; [vboom][2]overlay=enable='lte(t,2)'[vpreout]; [vpreout][3]overlay=enable='gte(t,"+msec+"*3*0.5-2)'\" -map 4:a -b:v 8000k -shortest -preset ultrafast -crf 23 " + file2.getAbsolutePath();
</code>```

The only elements which i am struggling with is the sections that speed up momentarily and then return back to normal speed. it speeds up and returns to normal speed twice when the video plays forward, then reverses, then has the speed up effect twice while the video plays backwards. it speeds up for 1 second then continues playing the video at normal speed. Your help is greatly appreciated!

I have tried setpts=1*(PTS-STARTPTS)[vrev] and other sections of the filter graph, but im relatively new to ffmpeg and do not completely understand how it all works. I have tried the following links too. https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video & https://video.stackexchange.com/questions/21800/ffmpeg-slow-fast-motion-part-a-video-anywhere

Body:
problem: I manually make videos, and have decided to make a program to automatically make the video for me. Here is an example of the videos that i am trying to achieve. E.g: (https://youtu.be/eVQ9ysp0Pj0) (videos are displayed at 19 seconds into the video). This is the desired result i am trying to achieve. I have the following filter graph that has most of the elements:

exe = "-i " + file + " -i " + frame + " -i " + framestart + " -i " + frameEnd + " -i " + audioOverlay + " -filter_complex \"[0:v]pad="+mVideoWidth+":"+mVideoHeight+":576:0[vpad]; [vpad][1]overlay[vframed]; [vframed]split=3[vfr1][vfr2][vfr3]; [vfr1]reverse[vrev]; [vfr2][vrev][vfr3]concat=n=3,setpts=1*(PTS-STARTPTS)[vboom]; [vboom][2]overlay=enable='lte(t,2)'[vpreout]; [vpreout][3]overlay=enable='gte(t,"+msec+"*3*0.5-2)'\" -map 4:a -b:v 8000k -shortest -preset ultrafast -crf 23 " + file2.getAbsolutePath();

The only elements which i am struggling with is the sections that speed up momentarily and then return back to normal speed. it speeds up and returns to normal speed twice when the video plays forward, then reverses, then has the speed up effect twice while the video plays backwards. it speeds up for 1 second then continues playing the video at normal speed. Your help is greatly appreciated!

I have tried setpts=1*(PTS-STARTPTS)[vrev] and other sections of the filter graph, but im relatively new to ffmpeg and do not completely understand how it all works. I have tried the following links too. https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video & https://video.stackexchange.com/questions/21800/ffmpeg-slow-fast-motion-part-a-video-anywhere


问:
How to launch Chrome when using Visual Studio Code on a Chromebook?
Using VSCode on a Chromebook, the launch.json configuration of "type": "chrome" is unable to find the Chrome installation and says:

Unable to launch browser: "Unable to find an installation of the browser on
your system. Try installing it, or providing an absolute path to the browser
in the "runtimeExecutable” in your launch.json."

How can I launch and debug my web-based apps on a Chromebook?