问:
Dynamically added inputs does not send the data to the database
My task is to create form where question with its answers can be added. In other pages where question type is double choice, or true/false, it works just fine as there are no dynamically added inputs.

But in multiple choice question I want the user to be able to add as many questions as they want by having dynamical inputs.

The input are created, but when I am pressing submit only the question, feedback, mark and initially created answers, grades are sent to the database, the added answers and grades are failing to send. How can I solve it?

My code:

multiplechoice.php

```<code><?php
    include("create.php");
?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title>PHP CRUD</title>
    <link rel="stylesheet" href="style.css">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

    <script>

    </script>
</head>

<body>
    <div class="container">
        <div class="row">

            <div class="col-md-12">
                <h3>create Question</h3>
                <hr />
            </div>

            <form name="createq" id="createq" method="post">
                <label for="cars">Question Type:</label>
                <select id="cars" name="questionTypeID" onchange="this.form.submit()">
                    <option value="1">Multiple Choice</option>
                    <option value="2">True/False</option>
                    <option value="3">Double Choice</option>
                    <option value="4">Numerical</option>
                    <option value="5">Short Answer</option>
                </select>
                <div class="quest">
                    <label for="question">Question: </label>
                    <input type="text" name="question" class="form-control" required>
                </div>
                <div class="feedback">
                    <label for="feedback">Feedback: </label>
                    <input type="text" name="feedback" class="form-control" required>
                </div>
                <div class="marks">
                    <label for="mark">Mark: </label>
                    <input type="number" name="mark" class="form-control" required>
                </div>
        </div>
        </br>
        <div class="row" id="dynamic_field">
            <div class="first">
                <label>Answer 1:</label>
                <input type="text" name="answer1" class="form-control">
                <label>Grade 1:</label>
                <input type="number" name="isCorrect1" class="form-control">
            </div>
            <div class="second">
                <label>Answer 2:</label>
                <input type="text" name="answer2" class="form-control">
                <label>Grade 2:</label>
                <input type="number" name="isCorrect2" class="form-control">

            </div>
        </div>
        <td><button type="button" name="add" id="add" class="btn btn-success">Add More</button></td>

        <div class="row" style="margin-top:1%">
            <div class="col-md-8">
                <input type="submit" id="create" name="create" value="Submit">
            </div>
        </div>
        </form>

    </div>
</body>

<script>
$(document).ready(function() {
    var postURL = "/create.php";
    var i = 2;
    $('#add').click(function() {
        i++;

        $('#dynamic_field').append('<div id="row' + i + '"><td><input type="text" name="answer' + i +
            '" placeholder="Enter your Skill" class="form-control name_list" /><input type="number" name="isCorrect' +
            i + '" class="form-control"></td><td><button type="button" name="remove" id="' + i +
            '" class="btn btn-danger btn_remove">X</button></td></div>');
    });

    $(document).on('click', '.btn_remove', function() {
        var button_id = $(this).attr("id");
        $('#row' + button_id + '').remove();
    });
    $('#create').click(function() {
        $.ajax({
            url: postURL,
            method: "POST",
            data: $('#createq').serialize(),
            type: 'json',
            success: function(data) {
                i = 2;
                $('#row' + i + '').remove();
                $('#create')[0].reset();
                alert('Record Inserted Successfully.');
            }
        });
    });
});
</script>

</html>

</code>```

create.php

```<code>
<?php
    if(isset($_POST['questionTypeID'])) {
        switch($_POST['questionTypeID']) {
            case 1:
                header("Location: multipleChoice.php");
                break;
            case 2:
                header("Location: truefalse.php");
                break;
            case 3:
                header("Location: doublechoice.php");
                break;
            case 4:
                header("Location: numerical.php");
                break;
            case 5:
                header("Location: shortanswer.php");
                break;
        }
    }
    include("connect-database.inc.php");
    session_start();
    if(isset($_POST['create'])) {
        $question = $_POST['question'];
        $feedback = $_POST['feedback'];
        $mark = $_POST['mark'];
        $questionTypeID = $_POST['questionTypeID'];
        $num_of_answers = (count($_POST) - 3)/2 ;
        $count = count($_POST['answer']);

        $sql="INSERT INTO questions (question, feedback, mark, questionTypeID) VALUES(:question, :feedback, :mark, :questionTypeID)";

        $query = $pdo->prepare($sql);

        $query->bindParam(':question',$question,PDO::PARAM_STR);
        $query->bindParam(':feedback',$feedback,PDO::PARAM_STR);
        $query->bindParam(':mark',$mark,PDO::PARAM_INT);
        $query->bindParam(':questionTypeID',$questionTypeID,PDO::PARAM_INT);
        $q_execute = $query->execute();

        $question_id = $pdo->lastInsertId();
        $query_answer = $pdo->prepare("INSERT INTO answers (answer,isCorrect, questionID) VALUES (?, ?, ?)");

        for($i = 1; $i < $num_of_answers; $i++){
            $query_answer->execute([$_POST["answer".$i], $_POST["isCorrect".$i], $question_id]);
        }
        if($q_execute || $query_answer) {
            $_SESSION['message'] = "Updated Successfully";
            header('Location: homepage.php');
            exit(0);
        }
        else {
            $_SESSION['message'] = "Not Updated";
            header('Location: homepage.php');
            exit(0);
        }
    }

?>
</code>```

Body:
My task is to create form where question with its answers can be added. In other pages where question type is double choice, or true/false, it works just fine as there are no dynamically added inputs.

But in multiple choice question I want the user to be able to add as many questions as they want by having dynamical inputs.

The input are created, but when I am pressing submit only the question, feedback, mark and initially created answers, grades are sent to the database, the added answers and grades are failing to send. How can I solve it?

My code:

multiplechoice.php

<?php
    include("create.php");
?>

<!DOCTYPE html>

    <meta charset="utf-8">
    <title>PHP CRUD</title>
    <link rel="stylesheet" href="style.css">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">

create Question

            <form name="createq" id="createq" method="post">
                Question Type:
                <select id="cars" name="questionTypeID" onchange="this.form.submit()">
                    <option value="1">Multiple Choice</option>
                    <option value="2">True/False</option>
                    <option value="3">Double Choice</option>
                    <option value="4">Numerical</option>
                    <option value="5">Short Answer</option>
                </select>

                    Question:
                    <input type="text" name="question" class="form-control" required>

                    Feedback:
                    <input type="text" name="feedback" class="form-control" required>

                    Mark:
                    <input type="number" name="mark" class="form-control" required>

                Answer 1:
                <input type="text" name="answer1" class="form-control">
                Grade 1:
                <input type="number" name="isCorrect1" class="form-control">

                Answer 2:
                <input type="text" name="answer2" class="form-control">
                Grade 2:
                <input type="number" name="isCorrect2" class="form-control">

        <button type="button" name="add" id="add" class="btn btn-success">Add More</button>

                <input type="submit" id="create" name="create" value="Submit">

        </form>

create.php

<?php
    if(isset($_POST['questionTypeID'])) {
        switch($_POST['questionTypeID']) {
            case 1:
                header("Location: multipleChoice.php");
                break;
            case 2:
                header("Location: truefalse.php");
                break;
            case 3:
                header("Location: doublechoice.php");
                break;
            case 4:
                header("Location: numerical.php");
                break;
            case 5:
                header("Location: shortanswer.php");
                break;
        }
    }
    include("connect-database.inc.php");
    session_start();
    if(isset($_POST['create'])) {
        $question = $_POST['question'];
        $feedback = $_POST['feedback'];
        $mark = $_POST['mark'];
        $questionTypeID = $_POST['questionTypeID'];
        $num_of_answers = (count($_POST) - 3)/2 ;
        $count = count($_POST['answer']);

        $sql="INSERT INTO questions (question, feedback, mark, questionTypeID) VALUES(:question, :feedback, :mark, :questionTypeID)";

        $query = $pdo->prepare($sql);

        $query->bindParam(':question',$question,PDO::PARAM_STR);
        $query->bindParam(':feedback',$feedback,PDO::PARAM_STR);
        $query->bindParam(':mark',$mark,PDO::PARAM_INT);
        $query->bindParam(':questionTypeID',$questionTypeID,PDO::PARAM_INT);
        $q_execute = $query->execute();

        $question_id = $pdo->lastInsertId();
        $query_answer = $pdo->prepare("INSERT INTO answers (answer,isCorrect, questionID) VALUES (?, ?, ?)");

        for($i = 1; $i < $num_of_answers; $i++){
            $query_answer->execute([$_POST["answer".$i], $_POST["isCorrect".$i], $question_id]);
        }
        if($q_execute || $query_answer) {
            $_SESSION['message'] = "Updated Successfully";
            header('Location: homepage.php');
            exit(0);
        }
        else {
            $_SESSION['message'] = "Not Updated";
            header('Location: homepage.php');
            exit(0);
        }
    }

?>


来源: stackexchange

问:
React app, after refreshing the page cannot access one object parametre, but can accesses the rest
I have an app where I would like to share "longitude and latitude" data on Leaflet to show on a map.
I have achieved it but once I refresh the page the data returns undefined and I just could not understand why.

from CreateListing.jsx

```<code>  let geolocation = {}; //store lat and lng
    const response = await fetch(
     //removed for privacy purposes
    );
    const geoData = await response.json();
    geolocation.lat = geoData[0].lat;
    geolocation.lng = geoData[0].lon;
    console.log(geolocation.lat, geolocation.lng, location);
</code>```

I have access to geolocation data with this code. I check it and everything works good.
Then I push this data to firebase.

I have a dataForm variable in which I store data of location and I add "geolocation" variable to that data so that I can use it in another component in which I want to show the latitude and longitude and this is where I get the error.

```<code>geolocation: Object { lng: "32.8540482", lat: "39.9207886" }

latitude: 0 //this is a variable I put so that user can type in latitude by hand

location: "//a random address"

longitude: 0 //this is a variable I put so that user can type in longitude by hand

name: "asdasd"

offer: false

regularPrice: "1242"
</code>```

I use useEffect to run the function to fetch the data from database

from Listing.jsx

```<code>  const [listing, setListing] = useState({});

useEffect(() => {
    const fetchListing = async () => {
      const docRef = doc(db, "listings", params.listingId);
      const docSnap = await getDoc(docRef);
      if (docSnap.exists()) {
        console.log(docSnap.data());
        setListing(docSnap.data());
        setLoading(false);
      } else {
        // doc.data() will be undefined in this case
        console.log("No such document!");
      }
    };
    fetchListing();
  }, []);
</code>```

and this is how I use it on render

```<code>  <p className="listingName">
          {listing.name} - $
          {listing.offer ? listing.discountedPrice : listing.regularPrice}
        </p>
        <p className="listingLocation">{listing.location}</p>
        <p className="listingType">
          {listing.condition === "used" ? "used" : "new"}
        </p>

        {listing.offer && (
          <p className="discountPrice">
            ${listing.regularPrice - listing.discountedPrice} discount
          </p>
        )}

        <p className="listingLocationTitle">LOcation</p>
        <p>{listing.geolocation.lat}</p>
</code>```

When I use the data I persisted to Firebase, I can use "name" and any other parametres and whenever page is refreshed it stays the same and does not throw error. But when I want to use "listing.geolocation.lng" when I save my file I can see it works but when I refresh it, it just throws "listing.geolocation.lng" undefined but it is defined, I can see it in my object in console log. I just do not understand why other parameters work but geolocation parametres that I added goes back to zero.

I hope it was clear enough and was not too long.

Thanks.

I tried storing geoLocation data in a state and use useState to store it but still whenever I refresh it goes to zero.

ContentLicense: CC BY-SA 4.0

Body:
I have an app where I would like to share "longitude and latitude" data on Leaflet to show on a map.
I have achieved it but once I refresh the page the data returns undefined and I just could not understand why.

from CreateListing.jsx

  let geolocation = {}; //store lat and lng
    const response = await fetch(
     //removed for privacy purposes
    );
    const geoData = await response.json();
    geolocation.lat = geoData[0].lat;
    geolocation.lng = geoData[0].lon;
    console.log(geolocation.lat, geolocation.lng, location);

I have access to geolocation data with this code. I check it and everything works good.
Then I push this data to firebase.

I have a dataForm variable in which I store data of location and I add "geolocation" variable to that data so that I can use it in another component in which I want to show the latitude and longitude and this is where I get the error.

geolocation: Object { lng: "32.8540482", lat: "39.9207886" }

latitude: 0 //this is a variable I put so that user can type in latitude by hand

location: "//a random address"

longitude: 0 //this is a variable I put so that user can type in longitude by hand

name: "asdasd"

offer: false

regularPrice: "1242"

I use useEffect to run the function to fetch the data from database

from Listing.jsx

  const [listing, setListing] = useState({});

useEffect(() => {
    const fetchListing = async () => {
      const docRef = doc(db, "listings", params.listingId);
      const docSnap = await getDoc(docRef);
      if (docSnap.exists()) {
        console.log(docSnap.data());
        setListing(docSnap.data());
        setLoading(false);
      } else {
        // doc.data() will be undefined in this case
        console.log("No such document!");
      }
    };
    fetchListing();
  }, []);

and this is how I use it on render

          {listing.name} - $
          {listing.offer ? listing.discountedPrice : listing.regularPrice}

{listing.location}

          {listing.condition === "used" ? "used" : "new"}

        {listing.offer && (

            ${listing.regularPrice - listing.discountedPrice} discount

        )}

LOcation

{listing.geolocation.lat}

When I use the data I persisted to Firebase, I can use "name" and any other parametres and whenever page is refreshed it stays the same and does not throw error. But when I want to use "listing.geolocation.lng" when I save my file I can see it works but when I refresh it, it just throws "listing.geolocation.lng" undefined but it is defined, I can see it in my object in console log. I just do not understand why other parameters work but geolocation parametres that I added goes back to zero.

I hope it was clear enough and was not too long.

Thanks.

I tried storing geoLocation data in a state and use useState to store it but still whenever I refresh it goes to zero.


问:
How can I make a table in Orchid Laravel Package with data from array of objects?
I'm making an WooCommerce administration center with the Laravel WooCommerce Package and Orchid - Laravel Admin Package.

I'm getting product data from Shops in an array format:
Example

And I need to display this product in a table like this:
Example

For this I need to make an WooCommerceProductListLayout that extends from the class Table. But this extended class can get data only from a database. I don't want all the data from variables saving to a database, because the data is very large and temporary.

I made the WooCommerceProductListLayout class, but I don't know how to avoid getting data from database. All the data should come from Product::all() or WooCommerce::all('products') and not the database.

They use static method from:

```<code>use Codexshaper\WooCommerce\Facades\Product;
use Codexshaper\WooCommerce\Facades\WooCommerce;

</code>```

Please help me, thx

Body:
I'm making an WooCommerce administration center with the Laravel WooCommerce Package and Orchid - Laravel Admin Package.

I'm getting product data from Shops in an array format:
Example

And I need to display this product in a table like this:
Example

For this I need to make an WooCommerceProductListLayout that extends from the class Table. But this extended class can get data only from a database. I don't want all the data from variables saving to a database, because the data is very large and temporary.

I made the WooCommerceProductListLayout class, but I don't know how to avoid getting data from database. All the data should come from Product::all() or WooCommerce::all('products') and not the database.

They use static method from:

use Codexshaper\WooCommerce\Facades\Product;
use Codexshaper\WooCommerce\Facades\WooCommerce;

Please help me, thx


问:
SQL Query to select only Customers whose orders are ascending.(every new order bigger then previous)
I couldn't figure it out how to select only customers with ascending orders.

I have tables:

customer (id, name)

order (orderID, customerID)

orderDetails (id, orderID, productID, quantity, orderDate)

Please help!

I was trying something like 2 selects, 1 ordered by date, and one ordered by quantity but couldn't manage to think about something useful.


问:
ParentNode returns undefined
I' trying to get access to the parent of a specific class, however the code seems to only return undefined. My reason for trying to find the child and then the parent is because the identifying attribute belongs to the child and not the parent. In my case I want to remove a video based on the thumbnail.

Here is the relevant code.

manifest.json

```<code>{
"content_scripts":
[{
    "matches": ["https://www.youtube.com/*"],
    "all_frames" : true,
    "js": ["remove_html.js"],
    "run_at": "document_start"
}],

  "manifest_version": 3,
  "name": "Nms",
  "version": "0.0.0.1",
  "description": "",
  "icons": {"128": "img.png"}
}
</code>```

I have tried both .parentNode and .parentElement

remove_html.js

```<code>const onMutation = (mutations) => {
  mo.disconnect();
  for (const { addedNodes } of mutations) {
    for (const node of addedNodes) {
      if (node.id != null) {
        if (node.className == "style-scope ytd-thumbnail"){
          console.log(node);
          console.log("parent",node.parentNode);
      }

        }
    }
  }

  observe();
}

const observe = () => {
  mo.observe(document, {
    subtree: true,
    childList: true,
  });
}

const mo = new MutationObserver(onMutation);

observe();

</code>```

the output looks like

```<code><ytd-thumbnail-overlay-time-status-renderer class="style-scope ytd-thumbnail" overlay-style="SHORTS" has-icon>…</ytd-thumbnail-overlay-time-status-renderer>flex
parent undefined
</code>```

Title: ParentNode returns undefined

Body:
I' trying to get access to the parent of a specific class, however the code seems to only return undefined. My reason for trying to find the child and then the parent is because the identifying attribute belongs to the child and not the parent. In my case I want to remove a video based on the thumbnail.

Here is the relevant code.

manifest.json

{
"content_scripts":
[{
    "matches": ["https://www.youtube.com/*"],
    "all_frames" : true,
    "js": ["remove_html.js"],
    "run_at": "document_start"
}],

  "manifest_version": 3,
  "name": "Nms",
  "version": "0.0.0.1",
  "description": "",
  "icons": {"128": "img.png"}
}

I have tried both .parentNode and .parentElement

remove_html.js

const onMutation = (mutations) => {
  mo.disconnect();
  for (const { addedNodes } of mutations) {
    for (const node of addedNodes) {
      if (node.id != null) {
        if (node.className == "style-scope ytd-thumbnail"){
          console.log(node);
          console.log("parent",node.parentNode);
      }

        }
    }
  }

  observe();
}

const observe = () => {
  mo.observe(document, {
    subtree: true,
    childList: true,
  });
}

const mo = new MutationObserver(onMutation);

observe();

the output looks like

<ytd-thumbnail-overlay-time-status-renderer class="style-scope ytd-thumbnail" overlay-style="SHORTS" has-icon>…</ytd-thumbnail-overlay-time-status-renderer>flex
parent undefined


问:
How to draw a 3d square in Qt?
I've been trying to draw a simple 3d square but I'm getting nothing.  From my understanding I'm setting it up correctly.  There's a context, vao and vbo with vertex data allocated to it, and the shader is properly linked.  My guess is that I'm messing up putting the data into the vbo somehow or, the view in 3d space is messed up.  From the examples I've seen, many don't use the mvp matrix which is a little confusing to me.

```<code>//vertex shader
#version 330 core
layout(location = 0) in vec4 position;
layout(location = 1) in vec4 color;

out vec4 f_color;

void main()
{
    gl_Position = position;
   f_color = color;
};

...................................

//fragment shader
in vec4 f_color;
out vec4 outputColor;

void main()
{
    outputColor = vec4(0.5, 0.5, 0, .5);
};
</code>```

These are the shaders I use, the color is just something random to see.

```<code>GLfloat cube[] = {
         //pos                          color
         -0.5f, -0.5f, -1.0f, 1.0f,     1.0f, 0.0f, 0.5f, 0.5f,
          0.5f, -0.5f, -1.0f, 1.0f,     1.0f, 1.0f, 0.5f, 0.5f,
          0.5f,  0.5f, -1.0f, 1.0f,     1.0f, 0.5f, 0.5f, 0.5f,
         -0.5f,  0.5f, -1.0f, 1.0f,     0.0f, 0.5f, 0.5f, 0.5f,
    };

void MyOpenGLWidget::paintGL(){
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    m_program->bind();
    m_program->enableAttributeArray(attributePos);
    m_program->enableAttributeArray(attributeColor);

    m_vao.bind();
    glDrawArrays(GL_LINES, 0, 4);
    m_vao.release();
    m_program->release();
}

void MyOpenGLWidget::initializeGL()
{
    initializeOpenGLFunctions();
    glClearColor(1, 1, 1, 0.5);
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_BLEND);

    m_vao.create();
    if (m_vao.isCreated())
        m_vao.bind();

    m_vbo.create();
    m_vbo.bind();
    m_vbo.setUsagePattern(QOpenGLBuffer::StreamDraw);
    m_vbo.allocate(sizeof(cube));

//...... setup m_program (QOpenGLShaderProgram) .....

    attributePos = m_program->attributeLocation("position");
    attributeColor = m_program->attributeLocation("color");

    int stride = 8 * sizeof(GLfloat);
    m_program->enableAttributeArray(attributePos);
    m_program->setAttributeBuffer(attributePos, GL_FLOAT, 0, 4, stride);

    m_program->enableAttributeArray(attributeColor);
    m_program->setAttributeBuffer(attributeColor, GL_FLOAT, 4 * sizeof(GLfloat), 4, stride);

    m_vbo.release();
    m_program->release();
    m_vao.release();
}

void MyOpenGLWidget::resizeGL(int w, int h){
    glViewport(0, 0, (GLsizei)w, (GLsizei)h);
}

</code>```

I'm having trouble finding what I'm doing wrong.  From my understanding I'm inputing the vbo's correctly and if the coordinate systems origin is in the center, the -1 z value of the cube should put the cube into perspective.

Title: How to draw a 3d square in Qt?

Body:
I've been trying to draw a simple 3d square but I'm getting nothing.  From my understanding I'm setting it up correctly.  There's a context, vao and vbo with vertex data allocated to it, and the shader is properly linked.  My guess is that I'm messing up putting the data into the vbo somehow or, the view in 3d space is messed up.  From the examples I've seen, many don't use the mvp matrix which is a little confusing to me.

//vertex shader
#version 330 core
layout(location = 0) in vec4 position;
layout(location = 1) in vec4 color;

out vec4 f_color;

void main()
{
    gl_Position = position;
   f_color = color;
};

...................................

//fragment shader
in vec4 f_color;
out vec4 outputColor;

void main()
{
    outputColor = vec4(0.5, 0.5, 0, .5);
};

These are the shaders I use, the color is just something random to see.

GLfloat cube[] = {
         //pos                          color
         -0.5f, -0.5f, -1.0f, 1.0f,     1.0f, 0.0f, 0.5f, 0.5f,
          0.5f, -0.5f, -1.0f, 1.0f,     1.0f, 1.0f, 0.5f, 0.5f,
          0.5f,  0.5f, -1.0f, 1.0f,     1.0f, 0.5f, 0.5f, 0.5f,
         -0.5f,  0.5f, -1.0f, 1.0f,     0.0f, 0.5f, 0.5f, 0.5f,
    };

void MyOpenGLWidget::paintGL(){
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    m_program->bind();
    m_program->enableAttributeArray(attributePos);
    m_program->enableAttributeArray(attributeColor);

    m_vao.bind();
    glDrawArrays(GL_LINES, 0, 4);
    m_vao.release();
    m_program->release();
}

void MyOpenGLWidget::initializeGL()
{
    initializeOpenGLFunctions();
    glClearColor(1, 1, 1, 0.5);
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_BLEND);

    m_vao.create();
    if (m_vao.isCreated())
        m_vao.bind();

    m_vbo.create();
    m_vbo.bind();
    m_vbo.setUsagePattern(QOpenGLBuffer::StreamDraw);
    m_vbo.allocate(sizeof(cube));

//...... setup m_program (QOpenGLShaderProgram) .....

    attributePos = m_program->attributeLocation("position");
    attributeColor = m_program->attributeLocation("color");

    int stride = 8 * sizeof(GLfloat);
    m_program->enableAttributeArray(attributePos);
    m_program->setAttributeBuffer(attributePos, GL_FLOAT, 0, 4, stride);

    m_program->enableAttributeArray(attributeColor);
    m_program->setAttributeBuffer(attributeColor, GL_FLOAT, 4 * sizeof(GLfloat), 4, stride);

    m_vbo.release();
    m_program->release();
    m_vao.release();
}

void MyOpenGLWidget::resizeGL(int w, int h){
    glViewport(0, 0, (GLsizei)w, (GLsizei)h);
}

I'm having trouble finding what I'm doing wrong.  From my understanding I'm inputing the vbo's correctly and if the coordinate systems origin is in the center, the -1 z value of the cube should put the cube into perspective.


问:
Installing libsndfile1 on PyCharm/Windows 10
I'm trying to run a PyTorch Audio program tutorial, and one of the first steps is to install libsndfile1, which I seem incapable of doing. I can run the other pip install {blabla} commands with ease, but the "apt -y" doesn't work for me, and I can't seem to figure out a solution. I believe it is a problem because I am trying to run the program on Windows 10/PyCharm. I'd love to switch operating systems, but I am not allowed to.

The command at question:

```<code>apt install -y libsndfile1 ffmpeg
</code>```

Based on surfing the web, this command seems to work perfectly well on a Linux server, but does anyone know how to get this running on Windows?

Thanks for all the help!

Body:
I'm trying to run a PyTorch Audio program tutorial, and one of the first steps is to install libsndfile1, which I seem incapable of doing. I can run the other pip install {blabla} commands with ease, but the "apt -y" doesn't work for me, and I can't seem to figure out a solution. I believe it is a problem because I am trying to run the program on Windows 10/PyCharm. I'd love to switch operating systems, but I am not allowed to.

The command at question:

apt install -y libsndfile1 ffmpeg

Based on surfing the web, this command seems to work perfectly well on a Linux server, but does anyone know how to get this running on Windows?

Thanks for all the help!


问:
How to close the window in egui
Well, strange question, I'm using egui and macroquad, showing LogsWindow over CentralWindow. But I just can't close it using click on the cross (.open() method for Window object).

pub struct LogsWindow<'a> {
    pub is_opened: &'a mut bool,
    pub logs: Logs,
}

impl<'a> LogsWindow<'a> {
    pub fn new(logs: Logs, is_opened: &'a mut bool) -> Self {
        Self { is_opened, logs }
    }
    pub fn name(&self) -> &'static str {
        "Logs"
    }
    pub fn show(&mut self, ctx: &egui::Context) {
        egui::Window::new(self.name())
            .open(self.is_opened)
            .show(ctx, |_| {});
    }
    pub fn ui(&mut self, ui: &mut Ui) {
        egui::Grid::new("logs_grid").striped(true).show(ui, |ui| {
            ------smth-----
        });
    }
}
```
<p>And for  UI:</p>
<pre class="lang-rust prettyprint-override"><code>egui_macroquad::ui(|egui_ctx| {
        LogsWindow::new(logs.clone(), &mut true).show(egui_ctx);

        egui::CentralPanel::default()
            .frame(Frame::none().fill(Color32::TRANSPARENT))
            .show(egui_ctx, |central_panel_ui| {
                ------------smth more-----------------
            });
    });

    egui_macroquad::draw();
</code>```

I understand that egui is in immediate mode UI and therefore draws each frame creating new LogsWindow with .open(true), but I don't know how to actually make it work

Title: How to close the window in egui

Body:
Well, strange question, I'm using egui and macroquad, showing LogsWindow over CentralWindow. But I just can't close it using click on the cross (.open() method for Window object).

pub struct LogsWindow<'a> {
    pub is_opened: &'a mut bool,
    pub logs: Logs,
}

impl<'a> LogsWindow<'a> {
    pub fn new(logs: Logs, is_opened: &'a mut bool) -> Self {
        Self { is_opened, logs }
    }
    pub fn name(&self) -> &'static str {
        "Logs"
    }
    pub fn show(&mut self, ctx: &egui::Context) {
        egui::Window::new(self.name())
            .open(self.is_opened)
            .show(ctx, |_| {});
    }
    pub fn ui(&mut self, ui: &mut Ui) {
        egui::Grid::new("logs_grid").striped(true).show(ui, |ui| {
            ------smth-----
        });
    }
}

And for  UI:

egui_macroquad::ui(|egui_ctx| {
        LogsWindow::new(logs.clone(), &mut true).show(egui_ctx);

        egui::CentralPanel::default()
            .frame(Frame::none().fill(Color32::TRANSPARENT))
            .show(egui_ctx, |central_panel_ui| {
                ------------smth more-----------------
            });
    });

    egui_macroquad::draw();

I understand that egui is in immediate mode UI and therefore draws each frame creating new LogsWindow with .open(true), but I don't know how to actually make it work


问:
How do I call code-behind for Html.DropDownListFor selectedIndexChanged in ASP.NET MVC?
Using the Html.DropDownListFor for Serial Numbers, I would like to change Display when a serial number FK_DASRNO is selected to one of my static ModelStyles.

How would I do something like this?

ViewModel

public class WindowStickerModel
{
    static WindowStickerModel()
    {
        ModelStyles = new List<WindowStickerModelStyle>();
    }

    public static List<WindowStickerModelStyle> ModelStyles { get; set; }

    public WindowStickerModel()
    {
        Serials = new List<SelectListItem>();
        Styles.AddRange(StaticModelStyles);
    }

    public string Display { get; set; }

    public List<SelectListItem> Serials { get; set; }

    public List<WindowStickerModelStyle> Styles { get; set; }

    public string Serial { get; set; }

    public string Order { get;  set; }

}

public class WindowStickerModelStyle
{
    private string m_display;
    public WindowStickerModelStyle()
    {
        m_display = null;
    }
    public string CMSTYL { get; set; }    // Style
    public string FK_DASRNO { get; set; } // Serial Number
    public string LU_Model { get; set; }  // Lookup Model
    public string Display
    {
        get
        {
            if (string.IsNullOrEmpty(m_display))
            {
                return $"{LU_Model} {CMSTYL}";
            }
            return m_display;
        }
        set
        {
            m_display = value;
        }
    }

}
```
<p><strong>Controller</strong></p>
<pre class="lang-cs prettyprint-override"><code>public async Task<ActionResult> WindowSticker(string dealer)
{
    var sessionDealer = $"{Session["DealershipID"]}";
    var model = await WindowStickerService.GetModelData(dealer, ViewBag.Library);
    return View(model);
}

public static async Task<WindowStickerModel> GetModelData(string dealer, string library)
{
    string sql = $@"
SELECT DADNAM, DASRNO, DAORNO, DAPRGY, DASTAT, DAMDLN
FROM {library}.DLRINVAPF
WHERE DASTAT IN('DL', 'SN', 'RT')
ORDER BY DASTAT ASC, DASRNO ASC
for read only with UR";
    var table = new DataTable();
    using (var cmd = new OleDbCommand(sql, new OleDbConnection($"{ConfigurationManager.ConnectionStrings["AS400"]}")))
    {
        cmd.Connection.Open();
        table.Load(await cmd.ExecuteReaderAsync());
    }
    var model = new WindowStickerModel();
    foreach (DataRow row in table.Rows)
    {
        var dasrno = $"{row["DASRNO"]}".Trim();
        var dastat = $"{row["DASTAT"]}".Trim();
        var daorno = $"{row["DAORNO"]}".Trim();
        var dadnam = $"{row["DADNAM"]}".Trim();
        var damdln = $"{row["DAMDLN"]}".Trim();
        if (dadnam == dealer)
        {
            model.Serials.Add(new SelectListItem()
            {
                Text = $"{dasrno} {dastat}",
                Value = daorno
            });
        }
        WindowStickerModel.Add(new WindowStickerModelStyle() { FK_DASRNO = dasrno});
    }
    return model;
}
</code>```

View

        @Html.LabelFor(model => model.Serials, htmlAttributes: new { @class = "control-label pull-right float-right" })

        @Html.DropDownListFor(m => m.Order, Model.Serials, "- - Select - -", new { htmlAttributes = new { @class = "form-control" } });
        @Html.ValidationMessageFor(model => model.Serials, "required", new { @class = "text-danger" })

        @Html.LabelFor(model => model.Display, htmlAttributes: new { @class = "control-label pull-right float-right" })

        @Html.EditorFor(model => model.Display);

```
<p><strong>HTML Result</strong></p>
<pre class="lang-html prettyprint-override"><code></code>```

I started a fiddle, but I didn't get anywhere with it.

https://dotnetfiddle.net/MHLuvc#

Update

What I would like would be a way to edit the Razor code to include some code-behind like this:

View

    @Html.DropDownListFor(m => m.Order, Model.Serials, "- - Select - -", new { htmlAttributes = new { @class = "form-control" } });
    @Html.ValidationMessageFor(model => model.Serials, "required", new { @class = "text-danger", onChange="SerialsChanged" })

```
<p><strong>Controller</strong></p>
<pre class="lang-cs prettyprint-override"><code>public void SerialsChanged(object sender, EventArgs e)
{
    var ddl = sender as DropDownList;
    var serial = ddl.Text;
    var description = WindowStickerModel.ModelStyles.FirstOrDefault(x => x.FK_DASRNO == serial);
    this.Display = description;
}
</code>```

Body:
Using the Html.DropDownListFor for Serial Numbers, I would like to change Display when a serial number FK_DASRNO is selected to one of my static ModelStyles.

How would I do something like this?

ViewModel

public class WindowStickerModel
{
    static WindowStickerModel()
    {
        ModelStyles = new List<WindowStickerModelStyle>();
    }

    public static List<WindowStickerModelStyle> ModelStyles { get; set; }

    public WindowStickerModel()
    {
        Serials = new List<SelectListItem>();
        Styles.AddRange(StaticModelStyles);
    }

    public string Display { get; set; }

    public List<SelectListItem> Serials { get; set; }

    public List<WindowStickerModelStyle> Styles { get; set; }

    public string Serial { get; set; }

    public string Order { get;  set; }

}

public class WindowStickerModelStyle
{
    private string m_display;
    public WindowStickerModelStyle()
    {
        m_display = null;
    }
    public string CMSTYL { get; set; }    // Style
    public string FK_DASRNO { get; set; } // Serial Number
    public string LU_Model { get; set; }  // Lookup Model
    public string Display
    {
        get
        {
            if (string.IsNullOrEmpty(m_display))
            {
                return $"{LU_Model} {CMSTYL}";
            }
            return m_display;
        }
        set
        {
            m_display = value;
        }
    }

}

Controller

public async Task<ActionResult> WindowSticker(string dealer)
{
    var sessionDealer = $"{Session["DealershipID"]}";
    var model = await WindowStickerService.GetModelData(dealer, ViewBag.Library);
    return View(model);
}

public static async Task<WindowStickerModel> GetModelData(string dealer, string library)
{
    string sql = $@"
SELECT DADNAM, DASRNO, DAORNO, DAPRGY, DASTAT, DAMDLN
FROM {library}.DLRINVAPF
WHERE DASTAT IN('DL', 'SN', 'RT')
ORDER BY DASTAT ASC, DASRNO ASC
for read only with UR";
    var table = new DataTable();
    using (var cmd = new OleDbCommand(sql, new OleDbConnection($"{ConfigurationManager.ConnectionStrings["AS400"]}")))
    {
        cmd.Connection.Open();
        table.Load(await cmd.ExecuteReaderAsync());
    }
    var model = new WindowStickerModel();
    foreach (DataRow row in table.Rows)
    {
        var dasrno = $"{row["DASRNO"]}".Trim();
        var dastat = $"{row["DASTAT"]}".Trim();
        var daorno = $"{row["DAORNO"]}".Trim();
        var dadnam = $"{row["DADNAM"]}".Trim();
        var damdln = $"{row["DAMDLN"]}".Trim();
        if (dadnam == dealer)
        {
            model.Serials.Add(new SelectListItem()
            {
                Text = $"{dasrno} {dastat}",
                Value = daorno
            });
        }
        WindowStickerModel.Add(new WindowStickerModelStyle() { FK_DASRNO = dasrno});
    }
    return model;
}

View

        @Html.LabelFor(model => model.Serials, htmlAttributes: new { @class = "control-label pull-right float-right" })

        @Html.DropDownListFor(m => m.Order, Model.Serials, "- - Select - -", new { htmlAttributes = new { @class = "form-control" } });
        @Html.ValidationMessageFor(model => model.Serials, "required", new { @class = "text-danger" })

        @Html.LabelFor(model => model.Display, htmlAttributes: new { @class = "control-label pull-right float-right" })

        @Html.EditorFor(model => model.Display);

HTML Result

I started a fiddle, but I didn't get anywhere with it.

https://dotnetfiddle.net/MHLuvc#

Update

What I would like would be a way to edit the Razor code to include some code-behind like this:

View

    @Html.DropDownListFor(m => m.Order, Model.Serials, "- - Select - -", new { htmlAttributes = new { @class = "form-control" } });
    @Html.ValidationMessageFor(model => model.Serials, "required", new { @class = "text-danger", onChange="SerialsChanged" })

Controller

public void SerialsChanged(object sender, EventArgs e)
{
    var ddl = sender as DropDownList;
    var serial = ddl.Text;
    var description = WindowStickerModel.ModelStyles.FirstOrDefault(x => x.FK_DASRNO == serial);
    this.Display = description;
}


问:
Select a .geojson file with a scrolling menu
I'm trying to retrieve different .geojson files using a scrolling manu, but it doesn't work. Sorry, i'm not a developer, i'm trying to understand and fix it but i'm really struggling.

Actually, all my geojson are displayed using this code, in the xx.js file:
`

```<code>var bounds = race.gbounds = new google.maps.LatLngBounds();
            map.data.loadGeoJson('/geojson/afest.geojson')
            map.data.loadGeoJson('/geojson/afouest.geojson')
</code>```

`
But too heavy for a browser, as i have many files.

I tried , using this part of code into my xx.html file:

`

```<code><div name="geojson" style="position:absolute; z-index:10; background: #04162e; margin:8px 0px 0px 190px; border: 1px solid #C3C3C3">
            <legend style="font-size:12px; margin: 2px 12px 0px 12px">Select pixels : </legend>
            <select id="selblockmz" style="margin: 1px 10px 5px 10px">
                <option value="">---</option>
                <option value="Eastern Europa">Eastern Europa</option>
                <option value="Western Africa">Western Africa</option>
            </select>
            <button id="bt_map" style="margin: 0px 10px 4px 0px">🌍</button>
        </div>
</code>```

`

But i'm not able to display my geojson using this part of code... Do somebody have an idea?

Thanks

Body:
I'm trying to retrieve different .geojson files using a scrolling manu, but it doesn't work. Sorry, i'm not a developer, i'm trying to understand and fix it but i'm really struggling.

Actually, all my geojson are displayed using this code, in the xx.js file:
`

var bounds = race.gbounds = new google.maps.LatLngBounds();
            map.data.loadGeoJson('/geojson/afest.geojson')
            map.data.loadGeoJson('/geojson/afouest.geojson')

`
But too heavy for a browser, as i have many files.

I tried , using this part of code into my xx.html file:

`

            <legend style="font-size:12px; margin: 2px 12px 0px 12px">Select pixels : </legend>
            <select id="selblockmz" style="margin: 1px 10px 5px 10px">
                <option value="">---</option>
                <option value="Eastern Europa">Eastern Europa</option>
                <option value="Western Africa">Western Africa</option>
            </select>
            <button id="bt_map" style="margin: 0px 10px 4px 0px">🌍</button>

`

But i'm not able to display my geojson using this part of code... Do somebody have an idea?

Thanks


问:
How to put value from lookup in dialog field in SSRS d365fo
I made a SSRS Report in D365FO by X++ . I made RDP class and temp table and I want vehicle id and driver in temp table lookup to vehicle table in dialog but when I choose from lookup value didn't select or put in field in dialog so which property will make the value from lookup shown ?</p>


问:
Vimeo end screen link not working when remove hover controls
I am trying to create a clickable link from my embedded Vimeo video to a page on my website AND hide the hover play/pause/replay controls on the video.

When I insert background=1 or controls=0 it removes the hover controls but also removes the link. Does anyone know how to keep the end screen link while removing the controls?


问:
YouTube iframe player API body element has slightly different dimensions than iframe element
TLDR - The dimensions of the body element in the iframe element for the youtube iframe player api isn't the same exact dimensions as the iframe element which is causing a wrapping div's background to show - which doesn't look good.

I'm using the react-player library to add youtube videos onto a page. The markup ends up being like this... (paraphrased code)

    ...

            ...

```

The wrapper div ends up being 500.115 x 500.115 somehow (don't ask me how idk... would have expected 500.123 x 500.123), but nevertheless the iframe, having width: 100% and height: 100%, ends up being the same 500.115 x 500.115 which is expected. But then the body (which also has width: 100% and height: 100%... just not inline) ends up having different dimensions - 500 x 500. The html tag has dimensions 500 x 0, so idk if that's having an influence. I'm confused why the body element has different dimensions than the iframe element.

The reason this is an issue for me is because when I add a box shadow to the wrapper div, you can see a thin line which is the extra width/height of the wrapper div. So if, for whatever reason, the bg color of the div is red, you would see a red line on the edge of the video player - which doesn't look good.

Is there a way to get the body exactly the same size as the iframe it's contained in? I believe this would solve the overflow problem.

Body:
TLDR - The dimensions of the body element in the iframe element for the youtube iframe player api isn't the same exact dimensions as the iframe element which is causing a wrapping div's background to show - which doesn't look good.

I'm using the react-player library to add youtube videos onto a page. The markup ends up being like this... (paraphrased code)

    ...

            ...

The wrapper div ends up being 500.115 x 500.115 somehow (don't ask me how idk... would have expected 500.123 x 500.123), but nevertheless the iframe, having width: 100% and height: 100%, ends up being the same 500.115 x 500.115 which is expected. But then the body (which also has width: 100% and height: 100%... just not inline) ends up having different dimensions - 500 x 500. The html tag has dimensions 500 x 0, so idk if that's having an influence. I'm confused why the body element has different dimensions than the iframe element.

The reason this is an issue for me is because when I add a box shadow to the wrapper div, you can see a thin line which is the extra width/height of the wrapper div. So if, for whatever reason, the bg color of the div is red, you would see a red line on the edge of the video player - which doesn't look good.

Is there a way to get the body exactly the same size as the iframe it's contained in? I believe this would solve the overflow problem.


问:
Delete item from json file using requests and fastapi libs
I wrote the FastAPI function endpoint that deletes the item from the json using the item id.
Now i would like to trigger this endpoint from my ui. for some reason I keep getting connection errors. the "Add task" endpoint works just file using same URL.

Docker-compose:

```<code>version: "3.9"
services:
  app:
    build: .
    ports:
      - "8080:8080"
    networks:
      - deploy_network
    container_name: backend
    command: uvicorn main:app --reload --workers 1 --host 0.0.0.0 --port 8080
  streamlit:
    build: ./frontend/
    ports:
      - "8501:8501"
    networks:
      - deploy_network
    container_name: frontend
    command: streamlit run ui.py --server.port 8501
networks:
  deploy_network:
    driver: bridge
</code>```

FastAPI endpoint:

```<code>@app.delete("/tasks/{task_id}")
def delete_task(task_id: int):
    tasks = get_tasks()
    tasks.pop(task_id)
    save_tasks(tasks)
    return {"task_id": task_id}
</code>```

UI:

```<code>delete_input = st.number_input("Enter the task ID to delete:")
if st.button("Delete Task") and delete_input != "":
    delete_url = "http://localhost:8080/tasks/{task_id}"
    res = requests.delete(delete_url.format(task_id=int(delete_input)))
</code>```

Result:

```<code>ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /tasks/1 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f465180b3a0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Traceback:

File "/usr/local/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
File "/frontend/ui.py", line 53, in <module>
    res = requests.delete(url=delete_url.format(task_id=int(delete_input)))
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 157, in delete
    return request("delete", url, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 565, in send
    raise ConnectionError(e, request=request)
</code>```

Body:
I wrote the FastAPI function endpoint that deletes the item from the json using the item id.
Now i would like to trigger this endpoint from my ui. for some reason I keep getting connection errors. the "Add task" endpoint works just file using same URL.

Docker-compose:

version: "3.9"
services:
  app:
    build: .
    ports:
      - "8080:8080"
    networks:
      - deploy_network
    container_name: backend
    command: uvicorn main:app --reload --workers 1 --host 0.0.0.0 --port 8080
  streamlit:
    build: ./frontend/
    ports:
      - "8501:8501"
    networks:
      - deploy_network
    container_name: frontend
    command: streamlit run ui.py --server.port 8501
networks:
  deploy_network:
    driver: bridge

FastAPI endpoint:

@app.delete("/tasks/{task_id}")
def delete_task(task_id: int):
    tasks = get_tasks()
    tasks.pop(task_id)
    save_tasks(tasks)
    return {"task_id": task_id}

UI:

delete_input = st.number_input("Enter the task ID to delete:")
if st.button("Delete Task") and delete_input != "":
    delete_url = "http://localhost:8080/tasks/{task_id}"
    res = requests.delete(delete_url.format(task_id=int(delete_input)))

Result:

ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /tasks/1 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f465180b3a0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Traceback:

File "/usr/local/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
File "/frontend/ui.py", line 53, in <module>
    res = requests.delete(url=delete_url.format(task_id=int(delete_input)))
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 157, in delete
    return request("delete", url, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 565, in send
    raise ConnectionError(e, request=request)


问:
How to make asynchronous HTTP calls with asyncio python without knowing the the n
I am having a hard time coming up with an approach that would implement async REST API calls on a server without knowing the amount of times (n) that I need to repeat the process beforehand.

What I mean.

I can do this now:

```<code>def get_tasks(session):
    tasks = []
    for i in range(1, 50):  # let's say this is the number of pages due to pagination
        tasks.append(
          session.get(url=f"{url}?page={i}", headers=header, ssl=False)
        )
    return tasks

async def query_api():
   async with aiohttp.ClientSession as session:
       tasks = get_tasks(session)
       responses = await asyncio.gather(*tasks)
       for response in responses:
           results.append(await response.json())
</code>```

And this works fine.

But what if I did not know beforehand the number of pages that I need to query? What if there is a variable called "next_page" in every call, and I want to use that to act as my breakpoint on when my async call will stop meaning when I will not find that object in the response any more OR I have a limit, and a skip query parameter and you just play with those and you loop until you find an empty response. Any idea how that would be done?

Body:
I am having a hard time coming up with an approach that would implement async REST API calls on a server without knowing the amount of times (n) that I need to repeat the process beforehand.

What I mean.

I can do this now:

def get_tasks(session):
    tasks = []
    for i in range(1, 50):  # let's say this is the number of pages due to pagination
        tasks.append(
          session.get(url=f"{url}?page={i}", headers=header, ssl=False)
        )
    return tasks

async def query_api():
   async with aiohttp.ClientSession as session:
       tasks = get_tasks(session)
       responses = await asyncio.gather(*tasks)
       for response in responses:
           results.append(await response.json())

And this works fine.

But what if I did not know beforehand the number of pages that I need to query? What if there is a variable called "next_page" in every call, and I want to use that to act as my breakpoint on when my async call will stop meaning when I will not find that object in the response any more OR I have a limit, and a skip query parameter and you just play with those and you loop until you find an empty response. Any idea how that would be done?


问:
Get User Selection Response From PreRequisite Optional
Within PreRequisite Editor,  I have marked the option for user to optionally skip the installation in a prerequisite. Now, when the installation runs, there's a dialog box that says "[ProductName] optionally uses PreRequisite. Would you like to install it now?". I want to uninstall any other version of that prerequisite if user has selected Yes,else I do not want to uninstall the other version. How do I know if the user has selected Yes/No in the pre-requisite option dialog box?

I checked the logs but didn't find any properties that get modified during the InstallPrerequisites step during installation.

P.S. : I have to perform some other options if user selected the pre-requisite for installation


问:
sqlite3_open_v2 treats folder name as file name in Xcode 14 which threw error in Xcode 13
In Xcode 13, this would throw an error SQLError(code: 14, message: "unable to open database file"). Turns out in Xcode 14, the last folder name (UUID().uuidString) is treated as file name and a new file gets created when calling open.

What changed in Xcode 14? And is it possible to configure sqlite3_open_v2 so it will fail for a directory path instead of creating a file unexpectedly?

```<code>let temp = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
dbURL = temp.appendingPathComponent(UUID().uuidString, isDirectory: true)
var connectionPointer: OpaquePointer?
let flags = SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE | SQLITE_OPEN_FULLMUTEX
let code = sqlite3_open_v2(dbURL.absoluteString, &connectionPointer, flags, nil)
if code != SQLITE_OK {
   throw SQLError.lastError(in: connectionPointer!)
}
</code>```

Edit:
Tried using the SQLITE_OPEN_URI flag to see if it would enable a more rigorous check of the URL passed in. But it did not help.

Body:
In Xcode 13, this would throw an error SQLError(code: 14, message: "unable to open database file"). Turns out in Xcode 14, the last folder name (UUID().uuidString) is treated as file name and a new file gets created when calling open.

What changed in Xcode 14? And is it possible to configure sqlite3_open_v2 so it will fail for a directory path instead of creating a file unexpectedly?

let temp = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
dbURL = temp.appendingPathComponent(UUID().uuidString, isDirectory: true)
var connectionPointer: OpaquePointer?
let flags = SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE | SQLITE_OPEN_FULLMUTEX
let code = sqlite3_open_v2(dbURL.absoluteString, &connectionPointer, flags, nil)
if code != SQLITE_OK {
   throw SQLError.lastError(in: connectionPointer!)
}

Edit:
Tried using the SQLITE_OPEN_URI flag to see if it would enable a more rigorous check of the URL passed in. But it did not help.


问:
Google Chrome dev tools analyzing
I want to constantly look and analyze the chrome dev tools from the code level. Especially want to assess the network tab and the webhook data that I am recieveing every 1sec. Is it even possible to access the values and data from the source code level just like accesing JSON file or a variable?

Couldn't find any information online.

Title: Google Chrome dev tools analyzing


问:
cosmos file not found
Im making a operating system in c# cosmos called dino os and when I try to run it in virtual box it just says:
"error: file '/boot/dino' not found.
error: you need to load the kernel first."
I don't know why it happens my code is literally just the starter code that cosmos gives you.

I tried changing my csproj file to try to use other virtual machine programs but still didn't work.

Title: cosmos file not found


问:
Return an image if a tag is matched firestore
I have been having a problem attempting to return a formatted image based on whether or not it matched a firestore database data point. The way the database is set up is that each image has a name and five tags along with a reference image link. The code that cycles through each document, searching for the name is here:

```<code>async function ListImageData()
{
  const querySnapshot = await getDocs(collection(db, "users", userUID, "images"));
  querySnapshot.forEach((doc) => {
    console.log( doc.id, doc.data().name, " => ", doc.data().image)
    if(doc.data().name === "target image")
    {
      console.log("you got here", doc.data().name);
      src= doc.data().image;
      return(
        <>
          <img src={src} />
        </>
      );
    }
  });
}
</code>```

I thought that this would return an image with the link of the matching image but this code throws the error:

```<code>react-dom.development.js:14887 Uncaught Error: Objects are not valid as a React child (found: [object Promise]). If you meant to render a collection of children, use an array instead.
    at throwOnInvalidObjectType (react-dom.development.js:14887:1)
    at reconcileChildFibers (react-dom.development.js:15828:1)
    at reconcileChildren (react-dom.development.js:19167:1)
    at mountIndeterminateComponent (react-dom.development.js:20157:1)
    at beginWork (react-dom.development.js:21587:1)
    at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1)
    at invokeGuardedCallback (react-dom.development.js:4277:1)
    at beginWork$1 (react-dom.development.js:27451:1)
    at performUnitOfWork (react-dom.development.js:26557:1)
</code>```

It doesnt appear that what is being returned is an object, but as the error suggests react thinks it is.

I'd appreciate any hep with this,
Thanks

Body:
I have been having a problem attempting to return a formatted image based on whether or not it matched a firestore database data point. The way the database is set up is that each image has a name and five tags along with a reference image link. The code that cycles through each document, searching for the name is here:

async function ListImageData()
{
  const querySnapshot = await getDocs(collection(db, "users", userUID, "images"));
  querySnapshot.forEach((doc) => {
    console.log( doc.id, doc.data().name, " => ", doc.data().image)
    if(doc.data().name === "target image")
    {
      console.log("you got here", doc.data().name);
      src= doc.data().image;
      return(
        <>

        </>
      );
    }
  });
}

I thought that this would return an image with the link of the matching image but this code throws the error:

react-dom.development.js:14887 Uncaught Error: Objects are not valid as a React child (found: [object Promise]). If you meant to render a collection of children, use an array instead.
    at throwOnInvalidObjectType (react-dom.development.js:14887:1)
    at reconcileChildFibers (react-dom.development.js:15828:1)
    at reconcileChildren (react-dom.development.js:19167:1)
    at mountIndeterminateComponent (react-dom.development.js:20157:1)
    at beginWork (react-dom.development.js:21587:1)
    at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1)
    at invokeGuardedCallback (react-dom.development.js:4277:1)
    at beginWork$1 (react-dom.development.js:27451:1)
    at performUnitOfWork (react-dom.development.js:26557:1)

It doesnt appear that what is being returned is an object, but as the error suggests react thinks it is.

I'd appreciate any hep with this,
Thanks


问:
Flutter InteractiveViewer working for multible children in a stack
I have a Stack which contains an Image wrapped with an InteractiveViewer and on top multiple Containers in a GestureDetector. Status now: I can zoom(scale) and pan the Image around (InteractiveViewer) and I can move the Containers on their own because of the GestureDetector(onPanUpdate...).

My Problem: If I zoom the Image the Containers stay at the position. When I zoom/pan they should always stay at the same location on the Image were I have put them. They stick to the Display and not to the Image.

By the way I also don't know how to use onScaleUpdate to get the same effect as InteractiveViewer

When I put a Stack in the InteractiveViewer with the Image and the Containers, nothing happens. I need an InteractiveViewer or a GestureDetector (onscaleUpdate..or something like this) which moves/zooms the Image and the Containers. I have wrapped the Containers in a GestureDetector to move them individually. This already works.

I need:
InteractriveViewer / GestureDetector(onScaleUpdate: )

Image

Class with Containers

```<code>   |
  Stack(
     Positioned(
          GestureDetector(
             onPanUpdate:
                   child: Container1

  Stack(
     Positioned(
          GestureDetector(
             onPanUpdate:
                   child: Container2
</code>```

This is my code now. The Image doesn't zoom and I can't see the Containers.

```<code>class _MapState extends State<Map> {
  @override
  Widget build(BuildContext context) {
    return Expanded(
      child: Stack(
        children: [
          InteractiveViewer(
            maxScale: 2,
            minScale: 0.01,
            constrained: false,
            child: Stack(
              children: [
                Image.asset('images/myimage.jpg'),
                Organiser(),
              ],
            ),
          ),
        ],
      ),
    );
  }
}

class Organiser extends StatefulWidget {
  const Organiser({Key? key}) : super(key: key);
  @override
  State<Organiser> createState() => _OrganiserState();
}

class _OrganiserState extends State<Organiser> {
  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        Team2(),
        Team1(),
      ],
    );
  }
}

class Team1 extends StatefulWidget {
  const Team1({Key? key}) : super(key: key);
  @override
  State<Team1> createState() => _Team1State();
}

class _Team1State extends State<Team1> {
  double _left = 0;
  double _top = 0;
  @override
  Widget build(BuildContext context) {
    return Stack(
      children: <Widget>[
        Positioned(
          left: _left,
          top: _top,
          child: GestureDetector(
            onPanUpdate: (details) => setState(() {
              _top = max(0, _top + details.delta.dy);
              _left = max(0, _left + details.delta.dx);
            }),
            child: Container(
              height: 30,
              width: 30,
              color: Colors.blue,
              child: Center(
                child: Text('1'),
              ),
            ),
          ),
        ),
      ],
    );
  }
}

class Team2 extends StatefulWidget {
  const Team2({Key? key}) : super(key: key);

  @override
  State<Team2> createState() => _Team2State();
}

class _Team2State extends State<Team2> {
  double _left = 0;
  double _top = 0;
  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        Positioned(
          left: _left,
          top: _top,
          child: GestureDetector(
            onPanUpdate: (details) => setState(() {
              _top = max(0, _top + details.delta.dy);
              _left = max(0, _left + details.delta.dx);
            }),
            child: Container(
              height: 30,
              width: 30,
              color: Colors.red,
              child: Center(
                child: Text('2'),
              ),
            ),
          ),
        ),
      ],
    );
  }
}
</code>```

Body:
I have a Stack which contains an Image wrapped with an InteractiveViewer and on top multiple Containers in a GestureDetector. Status now: I can zoom(scale) and pan the Image around (InteractiveViewer) and I can move the Containers on their own because of the GestureDetector(onPanUpdate...).

My Problem: If I zoom the Image the Containers stay at the position. When I zoom/pan they should always stay at the same location on the Image were I have put them. They stick to the Display and not to the Image.

By the way I also don't know how to use onScaleUpdate to get the same effect as InteractiveViewer

When I put a Stack in the InteractiveViewer with the Image and the Containers, nothing happens. I need an InteractiveViewer or a GestureDetector (onscaleUpdate..or something like this) which moves/zooms the Image and the Containers. I have wrapped the Containers in a GestureDetector to move them individually. This already works.

I need:
InteractriveViewer / GestureDetector(onScaleUpdate: )

Image

Class with Containers

   |
  Stack(
     Positioned(
          GestureDetector(
             onPanUpdate:
                   child: Container1

  Stack(
     Positioned(
          GestureDetector(
             onPanUpdate:
                   child: Container2

This is my code now. The Image doesn't zoom and I can't see the Containers.

class _MapState extends State<Map> {
  @override
  Widget build(BuildContext context) {
    return Expanded(
      child: Stack(
        children: [
          InteractiveViewer(
            maxScale: 2,
            minScale: 0.01,
            constrained: false,
            child: Stack(
              children: [
                Image.asset('images/myimage.jpg'),
                Organiser(),
              ],
            ),
          ),
        ],
      ),
    );
  }
}

class Organiser extends StatefulWidget {
  const Organiser({Key? key}) : super(key: key);
  @override
  State<Organiser> createState() => _OrganiserState();
}

class _OrganiserState extends State<Organiser> {
  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        Team2(),
        Team1(),
      ],
    );
  }
}

class Team1 extends StatefulWidget {
  const Team1({Key? key}) : super(key: key);
  @override
  State<Team1> createState() => _Team1State();
}

class _Team1State extends State<Team1> {
  double _left = 0;
  double _top = 0;
  @override
  Widget build(BuildContext context) {
    return Stack(
      children: <Widget>[
        Positioned(
          left: _left,
          top: _top,
          child: GestureDetector(
            onPanUpdate: (details) => setState(() {
              _top = max(0, _top + details.delta.dy);
              _left = max(0, _left + details.delta.dx);
            }),
            child: Container(
              height: 30,
              width: 30,
              color: Colors.blue,
              child: Center(
                child: Text('1'),
              ),
            ),
          ),
        ),
      ],
    );
  }
}

class Team2 extends StatefulWidget {
  const Team2({Key? key}) : super(key: key);

  @override
  State<Team2> createState() => _Team2State();
}

class _Team2State extends State<Team2> {
  double _left = 0;
  double _top = 0;
  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        Positioned(
          left: _left,
          top: _top,
          child: GestureDetector(
            onPanUpdate: (details) => setState(() {
              _top = max(0, _top + details.delta.dy);
              _left = max(0, _left + details.delta.dx);
            }),
            child: Container(
              height: 30,
              width: 30,
              color: Colors.red,
              child: Center(
                child: Text('2'),
              ),
            ),
          ),
        ),
      ],
    );
  }
}


问:
Modifying onDisconnectRemoveValue() timeout value
After the user calls onDisconnectRemoveValue, if the user loses their connection for exactly 120 seconds (timeout = 120s), Firebase would go ahead and remove the referenced value from the specified directory.

e.g

```<code>database.child(directoryExample).onDisconnectRemoveValue(completionBlock: { _, _ in })
</code>```

Is there a way to increase the timeout value on Firebase's end?

Thanks!

Body:
After the user calls onDisconnectRemoveValue, if the user loses their connection for exactly 120 seconds (timeout = 120s), Firebase would go ahead and remove the referenced value from the specified directory.

e.g

database.child(directoryExample).onDisconnectRemoveValue(completionBlock: { _, _ in })

Is there a way to increase the timeout value on Firebase's end?

Thanks!


问:
ESP32 Crash LoadProhibited or wdt timeout
When executing the code, a wdt timeout failure appears. Sometimes the initial running is normal, but with any actions via wifi, LoadProhibited fails.

Help me find the problem or where to look. The log shows that all the problems are in the esp-idf functions.

Error Decoded #1 (wdt timeout):

`

```<code>Guru Meditation Error: Core  0 panic'ed (Interrupt wdt timeout on CPU0).

Core  0 register dump:
PC      : 0x4008dfe8  PS      : 0x00060034  A0      : 0x8008c482  A1      : 0x3ffafb80
0x4008dfe8: vListInsert at C:/Esp/esp-idf/components/freertos/list.c:166 (discriminator 1)

A2      : 0x3ffaf674  A3      : 0x3ffafcd0  A4      : 0x0000000e  A5      : 0x00060023
A6      : 0x00000003  A7      : 0x00060623  A8      : 0x3ffafcd0  A9      : 0x3ffafcd0
A10     : 0x00000001  A11     : 0x00000001  A12     : 0x00000001  A13     : 0x00060023
A14     : 0x00000003  A15     : 0x00060023  SAR     : 0x00000004  EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000

Backtrace: 0x4008dfe5:0x3ffafb80 0x4008c47f:0x3ffafba0 0x4008b4de:0x3ffafbc0 0x4008345f:0x3ffafc00 0x4008e061:0x3ffafc20
0x4008dfe5: vListInsert at C:/Esp/esp-idf/components/freertos/list.c:166 (discriminator 1)

0x4008c47f: vTaskPlaceOnEventList at C:/Esp/esp-idf/components/freertos/tasks.c:3566

0x4008b4de: xQueueSemaphoreTake at C:/Esp/esp-idf/components/freertos/queue.c:1688

0x4008345f: ipc_task at C:/Esp/esp-idf/components/esp_ipc/src/esp_ipc.c:54

0x4008e061: vPortTaskWrapper at C:/Esp/esp-idf/components/freertos/port/xtensa/port.c:131

Core  1 register dump:
PC      : 0x4008e1c6  PS      : 0x00060134  A0      : 0x8008d2ee  A1      : 0x3ffb9980
0x4008e1c6: compare_and_set_native at C:/Esp/esp-idf/components/esp_hw_support/include/soc/compare_set.h:25
 (inlined by) spinlock_acquire at C:/Esp/esp-idf/components/esp_hw_support/include/soc/spinlock.h:103
 (inlined by) xPortEnterCriticalTimeout at C:/Esp/esp-idf/components/freertos/port/xtensa/port.c:288

A2      : 0x3ffb11c8  A3      : 0xffffffff  A4      : 0x0022cd82  A5      : 0x00000029
A6      : 0x00000000  A7      : 0x3ffb5eb4  A8      : 0x0000abab  A9      : 0x0000abab
A10     : 0x00060120  A11     : 0x0000cdcd  A12     : 0xb33fffff  A13     : 0x00060123
A14     : 0x3ffb4198  A15     : 0x00000000  SAR     : 0x00000000  EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000

Backtrace: 0x4008e1c3:0x3ffb9980 0x4008d2eb:0x3ffb99a0 0x400e72a6:0x3ffb99c0 0x400d807b:0x3ffb99e0 0x4008e061:0x3ffb9a00
0x4008e1c3: cpu_ll_get_cycle_count at C:/Esp/esp-idf/components/hal/esp32/include/hal/cpu_ll.h:45
 (inlined by) spinlock_acquire at C:/Esp/esp-idf/components/esp_hw_support/include/soc/spinlock.h:113
 (inlined by) xPortEnterCriticalTimeout at C:/Esp/esp-idf/components/freertos/port/xtensa/port.c:288
0x4008d2eb: vPortEnterCritical at C:/Esp/esp-idf/components/freertos/port/xtensa/include/freertos/portmacro.h:578
 (inlined by) ulTaskGenericNotifyTake at C:/Esp/esp-idf/components/freertos/tasks.c:5372
0x400e72a6: frt::Task<DRVLed, 2048u>::wait() at C:/Users/Cosmoiler/Documents/Prog/Firmware/ESP32/workspace/cosmoiler-idf/main/Lib/Frt/src/frt.hpp:186
 (inlined by) DRVLed::run() at C:/Users/Cosmoiler/Documents/Prog/Firmware/ESP32/workspace/cosmoiler-idf/main/Drivers/Led/src/tskFlasher.cpp:192
0x400d807b: frt::Task<DRVLed, 2048u>::entryPoint(void*) at C:/Users/Cosmoiler/Documents/Prog/Firmware/ESP32/workspace/cosmoiler-idf/main/Lib/Frt/src/frt.hpp:255 (discriminator 1)
0x4008e061: vPortTaskWrapper at C:/Esp/esp-idf/components/freertos/port/xtensa/port.c:131
</code>```

`

Error Decoded #2 (LoadProhibited):

`

```<code>Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x4008e017  PS      : 0x00060f33  A0      : 0x8008c581  A1      : 0x3ffb0ab0
0x4008e017: uxListRemove at C:/Esp/esp-idf/components/freertos/list.c:199
A2      : 0x3ffcf034  A3      : 0x3ffb3cc0  A4      : 0x00000008  A5      : 0x3ffcd3e8
A6      : 0x00000019  A7      : 0x01e382cf  A8      : 0x00000000  A9      : 0x3ffb3d5c
A10     : 0x3ffb3d5c  A11     : 0x00000000  A12     : 0x00000001  A13     : 0x00060f23
A14     : 0x00000000  A15     : 0x3ffb0190  SAR     : 0x00000004  EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000004  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff

Backtrace: 0x4008e014:0x3ffb0ab0 0x4008c57e:0x3ffb0ad0 0x4008b0e8:0x3ffb0af0 0x40085622:0x3ffb0b20 0x40085b87:0x3ffb0b40 0x40085b0a:0x3ffb0b70 0x40085eff:0x3ffb0b90 0x40082f75:0x3ffb0bb0 0x4008404b:0x3ffafbe0 0x400834b5:0x3ffafc00 0x4008e061:0x3ffafc20
0x4008e014: uxListRemove at C:/Esp/esp-idf/components/freertos/list.c:193
0x4008c57e: xTaskRemoveFromEventList at C:/Esp/esp-idf/components/freertos/tasks.c:3657
0x4008b0e8: xQueueGenericSendFromISR at C:/Esp/esp-idf/components/freertos/queue.c:1128
0x40085622: queue_send_from_isr_wrapper at C:/Esp/esp-idf/components/esp_wifi/esp32/esp_adapter.c:423
0x40085b87: pp_post at ??:?
0x40085b0a: lmacProcessRxSucData at ??:?
0x40085eff: wDev_ProcessFiq at ??:?
0x40082f75: _xt_lowint1 at C:/Esp/esp-idf/components/freertos/port/xtensa/xtensa_vectors.S:1111
0x4008404b: spi_flash_op_block_func at C:/Esp/esp-idf/components/spi_flash/cache_utils.c:124 (discriminator 1)
0x400834b5: ipc_task at C:/Esp/esp-idf/components/esp_ipc/src/esp_ipc.c:77
0x4008e061: vPortTaskWrapper at C:/Esp/esp-idf/components/freertos/port/xtensa/port.c:131
</code>```

`

Body:
When executing the code, a wdt timeout failure appears. Sometimes the initial running is normal, but with any actions via wifi, LoadProhibited fails.

Help me find the problem or where to look. The log shows that all the problems are in the esp-idf functions.

Error Decoded #1 (wdt timeout):

`

Guru Meditation Error: Core  0 panic'ed (Interrupt wdt timeout on CPU0).

Core  0 register dump:
PC      : 0x4008dfe8  PS      : 0x00060034  A0      : 0x8008c482  A1      : 0x3ffafb80
0x4008dfe8: vListInsert at C:/Esp/esp-idf/components/freertos/list.c:166 (discriminator 1)

A2      : 0x3ffaf674  A3      : 0x3ffafcd0  A4      : 0x0000000e  A5      : 0x00060023
A6      : 0x00000003  A7      : 0x00060623  A8      : 0x3ffafcd0  A9      : 0x3ffafcd0
A10     : 0x00000001  A11     : 0x00000001  A12     : 0x00000001  A13     : 0x00060023
A14     : 0x00000003  A15     : 0x00060023  SAR     : 0x00000004  EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000

Backtrace: 0x4008dfe5:0x3ffafb80 0x4008c47f:0x3ffafba0 0x4008b4de:0x3ffafbc0 0x4008345f:0x3ffafc00 0x4008e061:0x3ffafc20
0x4008dfe5: vListInsert at C:/Esp/esp-idf/components/freertos/list.c:166 (discriminator 1)

0x4008c47f: vTaskPlaceOnEventList at C:/Esp/esp-idf/components/freertos/tasks.c:3566

0x4008b4de: xQueueSemaphoreTake at C:/Esp/esp-idf/components/freertos/queue.c:1688

0x4008345f: ipc_task at C:/Esp/esp-idf/components/esp_ipc/src/esp_ipc.c:54

0x4008e061: vPortTaskWrapper at C:/Esp/esp-idf/components/freertos/port/xtensa/port.c:131

Core  1 register dump:
PC      : 0x4008e1c6  PS      : 0x00060134  A0      : 0x8008d2ee  A1      : 0x3ffb9980
0x4008e1c6: compare_and_set_native at C:/Esp/esp-idf/components/esp_hw_support/include/soc/compare_set.h:25
 (inlined by) spinlock_acquire at C:/Esp/esp-idf/components/esp_hw_support/include/soc/spinlock.h:103
 (inlined by) xPortEnterCriticalTimeout at C:/Esp/esp-idf/components/freertos/port/xtensa/port.c:288

A2      : 0x3ffb11c8  A3      : 0xffffffff  A4      : 0x0022cd82  A5      : 0x00000029
A6      : 0x00000000  A7      : 0x3ffb5eb4  A8      : 0x0000abab  A9      : 0x0000abab
A10     : 0x00060120  A11     : 0x0000cdcd  A12     : 0xb33fffff  A13     : 0x00060123
A14     : 0x3ffb4198  A15     : 0x00000000  SAR     : 0x00000000  EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000

Backtrace: 0x4008e1c3:0x3ffb9980 0x4008d2eb:0x3ffb99a0 0x400e72a6:0x3ffb99c0 0x400d807b:0x3ffb99e0 0x4008e061:0x3ffb9a00
0x4008e1c3: cpu_ll_get_cycle_count at C:/Esp/esp-idf/components/hal/esp32/include/hal/cpu_ll.h:45
 (inlined by) spinlock_acquire at C:/Esp/esp-idf/components/esp_hw_support/include/soc/spinlock.h:113
 (inlined by) xPortEnterCriticalTimeout at C:/Esp/esp-idf/components/freertos/port/xtensa/port.c:288
0x4008d2eb: vPortEnterCritical at C:/Esp/esp-idf/components/freertos/port/xtensa/include/freertos/portmacro.h:578
 (inlined by) ulTaskGenericNotifyTake at C:/Esp/esp-idf/components/freertos/tasks.c:5372
0x400e72a6: frt::Task<DRVLed, 2048u>::wait() at C:/Users/Cosmoiler/Documents/Prog/Firmware/ESP32/workspace/cosmoiler-idf/main/Lib/Frt/src/frt.hpp:186
 (inlined by) DRVLed::run() at C:/Users/Cosmoiler/Documents/Prog/Firmware/ESP32/workspace/cosmoiler-idf/main/Drivers/Led/src/tskFlasher.cpp:192
0x400d807b: frt::Task<DRVLed, 2048u>::entryPoint(void*) at C:/Users/Cosmoiler/Documents/Prog/Firmware/ESP32/workspace/cosmoiler-idf/main/Lib/Frt/src/frt.hpp:255 (discriminator 1)
0x4008e061: vPortTaskWrapper at C:/Esp/esp-idf/components/freertos/port/xtensa/port.c:131

`

Error Decoded #2 (LoadProhibited):

`

Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x4008e017  PS      : 0x00060f33  A0      : 0x8008c581  A1      : 0x3ffb0ab0
0x4008e017: uxListRemove at C:/Esp/esp-idf/components/freertos/list.c:199
A2      : 0x3ffcf034  A3      : 0x3ffb3cc0  A4      : 0x00000008  A5      : 0x3ffcd3e8
A6      : 0x00000019  A7      : 0x01e382cf  A8      : 0x00000000  A9      : 0x3ffb3d5c
A10     : 0x3ffb3d5c  A11     : 0x00000000  A12     : 0x00000001  A13     : 0x00060f23
A14     : 0x00000000  A15     : 0x3ffb0190  SAR     : 0x00000004  EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000004  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff

Backtrace: 0x4008e014:0x3ffb0ab0 0x4008c57e:0x3ffb0ad0 0x4008b0e8:0x3ffb0af0 0x40085622:0x3ffb0b20 0x40085b87:0x3ffb0b40 0x40085b0a:0x3ffb0b70 0x40085eff:0x3ffb0b90 0x40082f75:0x3ffb0bb0 0x4008404b:0x3ffafbe0 0x400834b5:0x3ffafc00 0x4008e061:0x3ffafc20
0x4008e014: uxListRemove at C:/Esp/esp-idf/components/freertos/list.c:193
0x4008c57e: xTaskRemoveFromEventList at C:/Esp/esp-idf/components/freertos/tasks.c:3657
0x4008b0e8: xQueueGenericSendFromISR at C:/Esp/esp-idf/components/freertos/queue.c:1128
0x40085622: queue_send_from_isr_wrapper at C:/Esp/esp-idf/components/esp_wifi/esp32/esp_adapter.c:423
0x40085b87: pp_post at ??:?
0x40085b0a: lmacProcessRxSucData at ??:?
0x40085eff: wDev_ProcessFiq at ??:?
0x40082f75: _xt_lowint1 at C:/Esp/esp-idf/components/freertos/port/xtensa/xtensa_vectors.S:1111
0x4008404b: spi_flash_op_block_func at C:/Esp/esp-idf/components/spi_flash/cache_utils.c:124 (discriminator 1)
0x400834b5: ipc_task at C:/Esp/esp-idf/components/esp_ipc/src/esp_ipc.c:77
0x4008e061: vPortTaskWrapper at C:/Esp/esp-idf/components/freertos/port/xtensa/port.c:131

`


问:
Confluence docker image fails starting with "Cannot find /opt/atlassian/confluence/bin/setclasspath.sh"
I tried to download the docker image for confluence 8.0.2, several tries. When I try to start it, I get an obnoxious message that files are missing. When I commit the container into another and start it interactively with a bash I still get the message. Here is what I did:

```<code>[root@seven]# docker pull atlassian/confluence-server:latest
latest: Pulling from atlassian/confluence-server
Digest: sha256:d0264f04a3c1eba7b944a8a81ddb4421cda088db71c94cc2e7d9435034ca4de1
Status: Downloaded newer image for atlassian/confluence-server:latest
docker.io/atlassian/confluence-server:latest
[root@seven]# docker run atlassian/confluence-server:latest
INFO:root:Generating /opt/atlassian/confluence/conf/server.xml from template server.xml.j2
INFO:root:Generating /opt/atlassian/confluence/confluence/WEB-INF/classes/seraph-config.xml from template seraph-config.xml.j2
INFO:root:Generating /opt/atlassian/confluence/confluence/WEB-INF/classes/confluence-init.properties from template confluence-init.properties.j2
INFO:root:Generating /var/atlassian/application-data/confluence/confluence.cfg.xml from template confluence.cfg.xml.j2
INFO:root:User is currently root. Will downgrade run user to confluence
INFO:root:Running Confluence with command '/opt/atlassian/confluence/bin/start-confluence.sh', arguments ['/opt/atlassian/confluence/bin/start-confluence.sh', '-fg']
executing as current user
Cannot find /opt/atlassian/confluence/bin/setclasspath.sh
This file is needed to run this program
</code>```

The image was updated on 24th. Maybe this is some kind of christmas humor from Atlassian. When I try to run the startup script manually in the committed container the error remains the same; all files present and executable for all. Data directory is mounted and owned by confluence owner.

When I do a

docker commit efb3494a609b test_container2

and a

docker run -ti --entrypoint=bash test_container2

I get this

```<code>confluence@abfe000e75b7:~$ ls /opt/atlassian/confluence/bin/ -la
total 10796
drwxr-xr-x 1 root root    4096 Dec 24 17:17  .
drwxr-xr-x 1 root root    4096 Dec 24 17:17  ..
-rwxr-xr-x 1 root root 1403435 Dec 22 08:56  atlassian-password-cli.jar
-rwxr-xr-x 1 root root 5867298 Dec 22 08:56  bcprov-jdk15on.jar
-rwxr-xr-x 1 root root   34700 Jul 14 18:28  bootstrap.jar
-rwxr-xr-x 1 root root   16840 Jul 14 18:28  catalina.bat
-rwxr-xr-x 1 root root   25294 Jul 14 18:28  catalina.sh
-rwxr-xr-x 1 root root    1703 Jul 14 18:28  catalina-tasks.xml
-rwxr-xr-x 1 root root    2123 Jul 14 18:28  ciphers.bat
-rwxr-xr-x 1 root root    1997 Jul 14 18:28  ciphers.sh
-rwxr-xr-x 1 root root   25410 Jul 14 18:28  commons-daemon.jar
-rwxr-xr-x 1 root root    2040 Jul 14 18:28  configtest.bat
-rwxr-xr-x 1 root root    1922 Jul 14 18:28  configtest.sh
-rwxr-xr-x 1 root root   19078 Dec 22 08:56  confluence-context-path-extractor.jar
-rwxr-xr-x 1 root root    9100 Jul 14 18:28  daemon.sh
-rwxr-xr-x 1 root root    2091 Jul 14 18:28  digest.bat
-rwxr-xr-x 1 root root    1965 Jul 14 18:28  digest.sh
-rwxr-xr-x 1 root root     346 Dec 22 08:55  display-help.bat
-rwxr-xr-x 1 root root     373 Dec 22 08:55  display-help.sh
-rwxr-xr-x 1 root root    3606 Jul 14 18:28  makebase.bat
-rwxr-xr-x 1 root root    3382 Jul 14 18:28  makebase.sh
-rwxr-xr-x 1 root root     165 Dec 22 08:55 'OS X - Run Confluence In Background.command'
-rwxr-xr-x 1 root root     191 Dec 22 08:55 'OS X - Run Confluence In Terminal Window.command'
-rwxr-xr-x 1 root root     167 Dec 22 08:55 'OS X - Stop Confluence.command'
-rwxr-xr-x 1 root root    9941 Dec 22 08:56  service.bat
-rwxr-xr-x 1 root root    3460 Jul 14 18:28  setclasspath.bat
-rwxr-xr-x 1 root root    3708 Jul 14 18:28  setclasspath.sh
-rwxr-xr-x 1 root root    4887 Dec 22 08:55  setenv.bat
-rwxr-xr-x 1 root root    5759 Dec 24 17:17  setenv.sh
-rwxr-xr-x 1 root root    2172 Dec 22 08:55  setjre.bat
-rwxr-xr-x 1 root root     869 Dec 22 08:55  setjre.sh
-rwxr-xr-x 1 root root    2020 Jul 14 18:28  shutdown.bat
-rwxr-xr-x 1 root root    1902 Jul 14 18:28  shutdown.sh
-rwxr-xr-x 1 root root    1185 Dec 22 08:55  start-confluence.bat
-rwxr-xr-x 1 root root    1637 Dec 22 08:55  start-confluence.sh
-rwxr-xr-x 1 root root    2022 Jul 14 18:28  startup.bat
-rwxr-xr-x 1 root root    1904 Jul 14 18:28  startup.sh
-rwxr-xr-x 1 root root      83 Dec 22 08:55  stop-confluence.bat
-rwxr-xr-x 1 root root     860 Dec 22 08:55  stop-confluence.sh
drwxr-xr-x 1 root root    4096 Dec 24 17:16  synchrony
-rwxr-xr-x 1 root root  522859 Dec 22 08:56  synchrony-proxy-watchdog.jar
-rwxr-xr-x 1 root root 2613248 Jul 14 18:28  tcnative-1.dll
-rwxr-xr-x 1 root root  142984 Jul 14 18:28  tomcat9.exe
-rwxr-xr-x 1 root root  126600 Jul 14 18:28  tomcat9w.exe
-rwxr-xr-x 1 root root   47050 Jul 14 18:28  tomcat-juli.jar
-rwxr-xr-x 1 root root    4574 Jul 14 18:28  tool-wrapper.bat
-rwxr-xr-x 1 root root    5540 Jul 14 18:28  tool-wrapper.sh
-rwxr-xr-x 1 root root     112 Dec 22 08:55  user.sh
-rwxr-xr-x 1 root root    2026 Jul 14 18:28  version.bat
-rwxr-xr-x 1 root root    1908 Jul 14 18:28  version.sh
</code>```

This looks pretty much ok. Confluence user should be able to execute the scripts.

Anybody got an idea?

Body:
I tried to download the docker image for confluence 8.0.2, several tries. When I try to start it, I get an obnoxious message that files are missing. When I commit the container into another and start it interactively with a bash I still get the message. Here is what I did:

[root@seven]# docker pull atlassian/confluence-server:latest
latest: Pulling from atlassian/confluence-server
Digest: sha256:d0264f04a3c1eba7b944a8a81ddb4421cda088db71c94cc2e7d9435034ca4de1
Status: Downloaded newer image for atlassian/confluence-server:latest
docker.io/atlassian/confluence-server:latest
[root@seven]# docker run atlassian/confluence-server:latest
INFO:root:Generating /opt/atlassian/confluence/conf/server.xml from template server.xml.j2
INFO:root:Generating /opt/atlassian/confluence/confluence/WEB-INF/classes/seraph-config.xml from template seraph-config.xml.j2
INFO:root:Generating /opt/atlassian/confluence/confluence/WEB-INF/classes/confluence-init.properties from template confluence-init.properties.j2
INFO:root:Generating /var/atlassian/application-data/confluence/confluence.cfg.xml from template confluence.cfg.xml.j2
INFO:root:User is currently root. Will downgrade run user to confluence
INFO:root:Running Confluence with command '/opt/atlassian/confluence/bin/start-confluence.sh', arguments ['/opt/atlassian/confluence/bin/start-confluence.sh', '-fg']
executing as current user
Cannot find /opt/atlassian/confluence/bin/setclasspath.sh
This file is needed to run this program

The image was updated on 24th. Maybe this is some kind of christmas humor from Atlassian. When I try to run the startup script manually in the committed container the error remains the same; all files present and executable for all. Data directory is mounted and owned by confluence owner.

When I do a

docker commit efb3494a609b test_container2

and a

docker run -ti --entrypoint=bash test_container2

I get this

confluence@abfe000e75b7:~$ ls /opt/atlassian/confluence/bin/ -la
total 10796
drwxr-xr-x 1 root root    4096 Dec 24 17:17  .
drwxr-xr-x 1 root root    4096 Dec 24 17:17  ..
-rwxr-xr-x 1 root root 1403435 Dec 22 08:56  atlassian-password-cli.jar
-rwxr-xr-x 1 root root 5867298 Dec 22 08:56  bcprov-jdk15on.jar
-rwxr-xr-x 1 root root   34700 Jul 14 18:28  bootstrap.jar
-rwxr-xr-x 1 root root   16840 Jul 14 18:28  catalina.bat
-rwxr-xr-x 1 root root   25294 Jul 14 18:28  catalina.sh
-rwxr-xr-x 1 root root    1703 Jul 14 18:28  catalina-tasks.xml
-rwxr-xr-x 1 root root    2123 Jul 14 18:28  ciphers.bat
-rwxr-xr-x 1 root root    1997 Jul 14 18:28  ciphers.sh
-rwxr-xr-x 1 root root   25410 Jul 14 18:28  commons-daemon.jar
-rwxr-xr-x 1 root root    2040 Jul 14 18:28  configtest.bat
-rwxr-xr-x 1 root root    1922 Jul 14 18:28  configtest.sh
-rwxr-xr-x 1 root root   19078 Dec 22 08:56  confluence-context-path-extractor.jar
-rwxr-xr-x 1 root root    9100 Jul 14 18:28  daemon.sh
-rwxr-xr-x 1 root root    2091 Jul 14 18:28  digest.bat
-rwxr-xr-x 1 root root    1965 Jul 14 18:28  digest.sh
-rwxr-xr-x 1 root root     346 Dec 22 08:55  display-help.bat
-rwxr-xr-x 1 root root     373 Dec 22 08:55  display-help.sh
-rwxr-xr-x 1 root root    3606 Jul 14 18:28  makebase.bat
-rwxr-xr-x 1 root root    3382 Jul 14 18:28  makebase.sh
-rwxr-xr-x 1 root root     165 Dec 22 08:55 'OS X - Run Confluence In Background.command'
-rwxr-xr-x 1 root root     191 Dec 22 08:55 'OS X - Run Confluence In Terminal Window.command'
-rwxr-xr-x 1 root root     167 Dec 22 08:55 'OS X - Stop Confluence.command'
-rwxr-xr-x 1 root root    9941 Dec 22 08:56  service.bat
-rwxr-xr-x 1 root root    3460 Jul 14 18:28  setclasspath.bat
-rwxr-xr-x 1 root root    3708 Jul 14 18:28  setclasspath.sh
-rwxr-xr-x 1 root root    4887 Dec 22 08:55  setenv.bat
-rwxr-xr-x 1 root root    5759 Dec 24 17:17  setenv.sh
-rwxr-xr-x 1 root root    2172 Dec 22 08:55  setjre.bat
-rwxr-xr-x 1 root root     869 Dec 22 08:55  setjre.sh
-rwxr-xr-x 1 root root    2020 Jul 14 18:28  shutdown.bat
-rwxr-xr-x 1 root root    1902 Jul 14 18:28  shutdown.sh
-rwxr-xr-x 1 root root    1185 Dec 22 08:55  start-confluence.bat
-rwxr-xr-x 1 root root    1637 Dec 22 08:55  start-confluence.sh
-rwxr-xr-x 1 root root    2022 Jul 14 18:28  startup.bat
-rwxr-xr-x 1 root root    1904 Jul 14 18:28  startup.sh
-rwxr-xr-x 1 root root      83 Dec 22 08:55  stop-confluence.bat
-rwxr-xr-x 1 root root     860 Dec 22 08:55  stop-confluence.sh
drwxr-xr-x 1 root root    4096 Dec 24 17:16  synchrony
-rwxr-xr-x 1 root root  522859 Dec 22 08:56  synchrony-proxy-watchdog.jar
-rwxr-xr-x 1 root root 2613248 Jul 14 18:28  tcnative-1.dll
-rwxr-xr-x 1 root root  142984 Jul 14 18:28  tomcat9.exe
-rwxr-xr-x 1 root root  126600 Jul 14 18:28  tomcat9w.exe
-rwxr-xr-x 1 root root   47050 Jul 14 18:28  tomcat-juli.jar
-rwxr-xr-x 1 root root    4574 Jul 14 18:28  tool-wrapper.bat
-rwxr-xr-x 1 root root    5540 Jul 14 18:28  tool-wrapper.sh
-rwxr-xr-x 1 root root     112 Dec 22 08:55  user.sh
-rwxr-xr-x 1 root root    2026 Jul 14 18:28  version.bat
-rwxr-xr-x 1 root root    1908 Jul 14 18:28  version.sh

This looks pretty much ok. Confluence user should be able to execute the scripts.

Anybody got an idea?


问:
Find if one of array elements exists within a multidimensional array
There are two arrays, $banwords with multiple words and a multidimensional one $data with two fields. I'm trying to check every array[$i][0] if there is a word from the $banwords array and if there isn't to print out the second field of array[$i][1]

$banwords array:

```<code>Array
(
    [0] => nonoword
    [1] => evil
    [2] => beep
    [3] => baddy
)
</code>```

$data array:

```<code>
Array
(
[0] => Array
(
[0] => Example with one evil word
[1] => user1
)

[1] => Array
(
[0] => No bad word is present
[1] => user2
)

[2] => Array
(
[0] => There is a baddy word here
[1] => user3
)
)
</code>```

My code so far and closest I have gotten:

```<code><?php
for ($i=0; $i < count($data); $i++) {
    // counter to replace $i and increment it so I can go through all the array elements

    foreach ( $banwords as $banword) {
        // go through each banword and compare it to $data[$i][0]
        if ( stripos( $data[$i][0], $banword) !== FALSE ) {
            // go through each first element within $data array if a word is found then do nothing
        }
        else {
            echo $banword.'<br>';
            echo $data[$i][0] .'<br>';
            echo $data[$i][1] .'<br><br><br>';
        }
    }
}
?>
</code>```

Body:
There are two arrays, $banwords with multiple words and a multidimensional one $data with two fields. I'm trying to check every array[$i][0] if there is a word from the $banwords array and if there isn't to print out the second field of array[$i][1]

$banwords array:

Array
(
    [0] => nonoword
    [1] => evil
    [2] => beep
    [3] => baddy
)

$data array:

Array
(
[0] => Array
(
[0] => Example with one evil word
[1] => user1
)

[1] => Array
(
[0] => No bad word is present
[1] => user2
)

[2] => Array
(
[0] => There is a baddy word here
[1] => user3
)
)

My code so far and closest I have gotten:

<?php
for ($i=0; $i < count($data); $i++) {
    // counter to replace $i and increment it so I can go through all the array elements

    foreach ( $banwords as $banword) {
        // go through each banword and compare it to $data[$i][0]
        if ( stripos( $data[$i][0], $banword) !== FALSE ) {
            // go through each first element within $data array if a word is found then do nothing
        }
        else {
            echo $banword.'
';
            echo $data[$i][0] .'
';
            echo $data[$i][1] .'

';
        }
    }
}
?>


问:
How can I seamlessly loop a video (webm since it has transparencies) in javascript canvas?
I'm trying to play a video from beginning to 10 seconds, then loop the video from second 3 to 10 until a key "c" is pressed. if it is pressed once, play the video from where it is currently in the loop until the end (about 14 seconds). When video plays from seconds 10 on start a new instance of the video (or a different one while the first one is still finishing).

The loop kind of works, it loops the video from second 3 till 10 indefinately. But it also includes seconds 0 till 3 as empty frames which causes flickering. How do I "cut" the empty seconds and play only the frames I want to loop? (javascript canvas)

```<code>draw(context) {
    // Get a reference to the video element
    var video = document.getElementById("playerVideo" + this.playernumber);

    // Check the readyState of the video
    if (video.readyState >= video.HAVE_ENOUGH_DATA) {
      // If the video has fully loaded, start playing it
      video.play();
    }

    // Set the playback rate of the video to a value close to 1
    if (this.playernumber <= 6) {
      video.playbackRate = 0.48;
    }
     else {
      if (
        video.currentTime <= video.duration - video.duration + 2.5 ||
        video.currentTime >= video.duration - 2.5
      ) {
        this.game.speed = 20;
        console.log(video.duration);
        video.playbackRate = 0.83;
      } else {
        this.game.speed = 7;
        video.playbackRate = 0.48;
      }
      video.loop = true;

      video.play();
    }
    if (video.currentTime >= 10) {
        video.currentTime = 3;
      }
      document.addEventListener("keydown", (event) => {
        if (event.key === "c" && video.currentTime >= 3 && video.currentTime <= 10) {
          video.loop = !video.loop;
        }
      });
    // Draw the video frame on the canvas
    context.drawImage(this.image, this.x, this.y);

    video.addEventListener("loadedmetadata", function() {
      // Set the dimensions of the canvas to match the video
      canvas.width = this.videoWidth;
      canvas.height = this.videoHeight;

      // Start the video
      this.play();
    });

    // Handle the "c" key press

    // Check if the video has reached its full duration
    if (video.currentTime >= video.duration) {
      // If it has, reset the currentTime to 0 to start the video over again
      video.currentTime = 0;

      // Play a randomly selected video from a preloaded set of 6 videos
      this.playernumber = 8;
      video = document.getElementById("playerVideo8");

    }
  }

</code>```

Body:
I'm trying to play a video from beginning to 10 seconds, then loop the video from second 3 to 10 until a key "c" is pressed. if it is pressed once, play the video from where it is currently in the loop until the end (about 14 seconds). When video plays from seconds 10 on start a new instance of the video (or a different one while the first one is still finishing).

The loop kind of works, it loops the video from second 3 till 10 indefinately. But it also includes seconds 0 till 3 as empty frames which causes flickering. How do I "cut" the empty seconds and play only the frames I want to loop? (javascript canvas)

draw(context) {
    // Get a reference to the video element
    var video = document.getElementById("playerVideo" + this.playernumber);

    // Check the readyState of the video
    if (video.readyState >= video.HAVE_ENOUGH_DATA) {
      // If the video has fully loaded, start playing it
      video.play();
    }

    // Set the playback rate of the video to a value close to 1
    if (this.playernumber <= 6) {
      video.playbackRate = 0.48;
    }
     else {
      if (
        video.currentTime <= video.duration - video.duration + 2.5 ||
        video.currentTime >= video.duration - 2.5
      ) {
        this.game.speed = 20;
        console.log(video.duration);
        video.playbackRate = 0.83;
      } else {
        this.game.speed = 7;
        video.playbackRate = 0.48;
      }
      video.loop = true;

      video.play();
    }
    if (video.currentTime >= 10) {
        video.currentTime = 3;
      }
      document.addEventListener("keydown", (event) => {
        if (event.key === "c" && video.currentTime >= 3 && video.currentTime <= 10) {
          video.loop = !video.loop;
        }
      });
    // Draw the video frame on the canvas
    context.drawImage(this.image, this.x, this.y);

    video.addEventListener("loadedmetadata", function() {
      // Set the dimensions of the canvas to match the video
      canvas.width = this.videoWidth;
      canvas.height = this.videoHeight;

      // Start the video
      this.play();
    });

    // Handle the "c" key press

    // Check if the video has reached its full duration
    if (video.currentTime >= video.duration) {
      // If it has, reset the currentTime to 0 to start the video over again
      video.currentTime = 0;

      // Play a randomly selected video from a preloaded set of 6 videos
      this.playernumber = 8;
      video = document.getElementById("playerVideo8");

    }
  }