问:
missing id from vertext dataframe in pyspark creating Graphframe
I have writting this code using Python, when I run it, the following errors show up.

```<code>      spark = SparkSession\
      .builder\
      .appName("GraphX")\
      .getOrCreate()
  e = spark.read.parquet("hdfs://localhost:9000/gf/edge")
  v = spark.read.parquet("hdfs://localhost:9000/gf/vertex")
  s = GraphFrame(v, e)
  s.edges.show()
  s.vertices.show()
</code>```

Body:
I have writting this code using Python, when I run it, the following errors show up.

      spark = SparkSession\
      .builder\
      .appName("GraphX")\
      .getOrCreate()
  e = spark.read.parquet("hdfs://localhost:9000/gf/edge")
  v = spark.read.parquet("hdfs://localhost:9000/gf/vertex")
  s = GraphFrame(v, e)
  s.edges.show()
  s.vertices.show()


来源: stackexchange

问:
Reciving a permission denied (publickey) error using EC2 Serial Console
I'm dealing with an EC2 instance which suddenly stopped to work via SSM (and a reboot is not fixing it).

The keypair is missing, so no access via SSH.

The only way to access would be using EC2 Serial Console. Using the web client, the screen remains black, so instead, I'm using the alternative version of pushing my key.

The action to push the key is successful.

```<code>$ aws ec2-instance-connect send-serial-console-ssh-public-key --instance-id i-123456abcd --serial-port 0 --ssh-public-key file://test.pub --region us-east-1
{
    "RequestId": "dsadasdasdasd",
    "Success": true
}
</code>```

However, when I try to SSH, I'm getting a wrong publickey error.

```<code>$ ssh -i test i-123456abcd.port0@serial-console.ec2-instance-connect.us-east-1.aws
i-123456abcd.port0@serial-console.ec2-instance-connect.us-east-1.aws: Permission denied (publickey)
</code>```

For testing's sake, I create a new pair, same error.

Serial Console access is enabled account-wide and my role has AdministratorAccess.

Any ideas about how to proceed?

ContentLicense: CC BY-SA 4.0

Body:
I'm dealing with an EC2 instance which suddenly stopped to work via SSM (and a reboot is not fixing it).

The keypair is missing, so no access via SSH.

The only way to access would be using EC2 Serial Console. Using the web client, the screen remains black, so instead, I'm using the alternative version of pushing my key.

The action to push the key is successful.

$ aws ec2-instance-connect send-serial-console-ssh-public-key --instance-id i-123456abcd --serial-port 0 --ssh-public-key file://test.pub --region us-east-1
{
    "RequestId": "dsadasdasdasd",
    "Success": true
}

However, when I try to SSH, I'm getting a wrong publickey error.

$ ssh -i test i-123456abcd.port0@serial-console.ec2-instance-connect.us-east-1.aws
i-123456abcd.port0@serial-console.ec2-instance-connect.us-east-1.aws: Permission denied (publickey)

For testing's sake, I create a new pair, same error.

Serial Console access is enabled account-wide and my role has AdministratorAccess.

Any ideas about how to proceed?


问:
Wait for all component rerenders
I have a simple component with a custom hook. If I add that hook useTest(as I see this hook uses Context and gql queries) I got about 6 rerenders of this component and see flickering on h1. Is it possible to wait for all renders and only then render the h1? Thanks.
`

```<code>import React from 'react'

const AccountDetail = () => {
  console.log('RENDER!!!', new Date())
  const { test } = useTest()
  return <h1>{new Date().getMilliseconds()}</h1>
}

export default AccountDetail

</code>```

`

Title: Wait for all component rerenders

Body:
I have a simple component with a custom hook. If I add that hook useTest(as I see this hook uses Context and gql queries) I got about 6 rerenders of this component and see flickering on h1. Is it possible to wait for all renders and only then render the h1? Thanks.
`

import React from 'react'

const AccountDetail = () => {
  console.log('RENDER!!!', new Date())
  const { test } = useTest()
  return
{new Date().getMilliseconds()}

}

export default AccountDetail

`


问:
Self join using criteria Query
I would like to find the greatest n per group from a table.

```<code>SELECT a.* FROM YourTable a
 LEFT OUTER JOIN YourTable b
 ON a.id = b.id AND a.rev < b.rev
WHERE b.id IS NULL;
</code>```

As some inputs are dynamic I relied on using criteria queries.
As Criteria Joins require mapping of the entities this operation requires mapping the entity within itself.

Here is the entity I'm relying upon

```<code>@Entity
@Getter
@Setter
@Table(name = "user_order_package_subscription_v1")
public class UserOrderPackageSubscriptionV1 {

    @Id
    @Column(name = "user_order_package_subscription_id", nullable = false, updatable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long userOrderPackageSubscriptionId;

    @Column(name = "total_paid_amount", nullable = false)
    private Double totalPaidAmount;

    @Column(name = "purchase_date", nullable = false)
    private LocalDateTime purchaseDate;

    @ManyToOne
    @JoinColumn(name="uam_id", referencedColumnName = "uam_id", insertable=false, updatable=false)
    private UserOrderPackageSubscriptionV1 uopsv1;

    @ManyToOne
    @JoinColumn(name = "uam_id", referencedColumnName = "uam_id")
    private StudentDetailsV1 studentDetail;

}
</code>```

The column in which I want to perform the left join is uam_id but it is a foreign key that refers to another table studentDetails and hence I have written another mapping for it.

The join segment from the service is as follows

```<code>    Root<UserOrderPackageSubscriptionV1> userOrderSubscriptionTableLeft = query.from(UserOrderPackageSubscriptionV1.class);

Join<UserOrderPackageSubscriptionV1, UserOrderPackageSubscriptionV1> selfJoin = userOrderSubscriptionTableLeft.join(UserOrderPackageSubscriptionV1_.uopsv1, JoinType.LEFT);
        selfJoin.on(
                       cb.lessThan(userOrderSubscriptionTableLeft.get("purchaseDate"),
                        selfJoin.get("purchaseDate"))
        );
</code>```

But this makes the UAM_ID unique and tries to create a foreign key constraint on uam_id that self references the table.

Also if I remove referencedColumnName it joins using the uam_id and the user_order_package_subscription_id(PK of the table). How do I perform a self join.

Title: Self join using criteria Query

Body:
I would like to find the greatest n per group from a table.

SELECT a.* FROM YourTable a
 LEFT OUTER JOIN YourTable b
 ON a.id = b.id AND a.rev < b.rev
WHERE b.id IS NULL;

As some inputs are dynamic I relied on using criteria queries.
As Criteria Joins require mapping of the entities this operation requires mapping the entity within itself.

Here is the entity I'm relying upon

@Entity
@Getter
@Setter
@Table(name = "user_order_package_subscription_v1")
public class UserOrderPackageSubscriptionV1 {

    @Id
    @Column(name = "user_order_package_subscription_id", nullable = false, updatable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long userOrderPackageSubscriptionId;

    @Column(name = "total_paid_amount", nullable = false)
    private Double totalPaidAmount;

    @Column(name = "purchase_date", nullable = false)
    private LocalDateTime purchaseDate;

    @ManyToOne
    @JoinColumn(name="uam_id", referencedColumnName = "uam_id", insertable=false, updatable=false)
    private UserOrderPackageSubscriptionV1 uopsv1;

    @ManyToOne
    @JoinColumn(name = "uam_id", referencedColumnName = "uam_id")
    private StudentDetailsV1 studentDetail;

}

The column in which I want to perform the left join is uam_id but it is a foreign key that refers to another table studentDetails and hence I have written another mapping for it.

The join segment from the service is as follows

    Root<UserOrderPackageSubscriptionV1> userOrderSubscriptionTableLeft = query.from(UserOrderPackageSubscriptionV1.class);

Join<UserOrderPackageSubscriptionV1, UserOrderPackageSubscriptionV1> selfJoin = userOrderSubscriptionTableLeft.join(UserOrderPackageSubscriptionV1_.uopsv1, JoinType.LEFT);
        selfJoin.on(
                       cb.lessThan(userOrderSubscriptionTableLeft.get("purchaseDate"),
                        selfJoin.get("purchaseDate"))
        );

But this makes the UAM_ID unique and tries to create a foreign key constraint on uam_id that self references the table.

Also if I remove referencedColumnName it joins using the uam_id and the user_order_package_subscription_id(PK of the table). How do I perform a self join.


问:
Snipcart + Nuxt + Strapi + ngrok JSON Crawler setup for testing purchases
I have a Nuxt + Strapi setup - no back-end, strictly front-end, product data is fed via API in the component from strapi. I've been loosely following this (my implementation deviates a little for the HTML but is practically the same for the single product component) and this for the local testing guidance.

From my understanding and the docs here I have to implement a data-item-url that triggers the JSON crawler. I'm not sure how I can achieve this using just Nuxt as I don't have (or want) a back-end.

My single product component is like so:

```<code><template>
  <section v-if="product !== null" class="product-v3 padding-y-lg js-product-v3">
    <div class="container max-width-adaptive-lg margin-top-md">
      <div class="margin-bottom-sm">
      </div>

      <div class="grid gap-md">
        <div class="col-6@md col-7@lg">
          <div class="flex flex-column gap-sm">
            <figure v-for="image in product.attributes.image.data">
              <img class="block width-100%" :src='`${baseUrl}${image.attributes.url}`' :alt="`${product.attributes.description}`">
            </figure>
          </div>
        </div>

        <div class="col-6@md col-5@lg">
          <div class="product-v3__panel">
            <div class="margin-bottom-xs">
              <h1>{{product.attributes.title}}</h1>
            </div>

            <div class="text-component margin-bottom-lg">
              <p>{{product.attributes.description}}</p>
            </div>

            <div class="text-component margin-bottom-lg">
              <div class="margin-top-xs">
                <div v-if="product.attributes.status === 'On Sale'" class="margin-y-xxxs">
                  <ins class="prod-card-v2__price">{{product.attributes.discount_price}}</ins>
                  <del class="prod-card-v2__old-price">{{product.attributes.price}}</del>
                </div>
                <span v-else class="prod-card-v2__price">£{{ product.attributes.price }}</span>
              </div>
            </div>

            <div class="text-component margin-bottom-lg">
              <p class="text-component">Available in:</p>
              <p class="text-component">
                {{variants}}
              </p>
              <p class="text-component">Add to cart and choose your size & flavour!</p>
            </div>

            <button
                    :data-item-id="product.id"
                    :data-item-price="product.attributes.price"
                    :data-item-url="`${storeUrl}${$route.fullPath}`"
                    :data-item-description="product.attributes.description"
                    :data-item-image="`http://localhost:1337${product.attributes.image.data[0].attributes.url}`"
                    :data-item-name="product.attributes.title"
                    data-item-metadata='{"verifyMyAgeReponse": {}}'
                    v-bind="customFields"
                    class="btn btn--primary flex-grow snipcart-add-item"
            >Add to Cart</button>
          </div>
        </div>

        <div class="product-v3__cta-clone hide@md js-product-v3__cta-clone" aria-hidden="true">
          <button class="btn btn--primary flex-grow">Add to Cart</button>
        </div>
      </div>
    </div>
  </section>
</template>
</code>```

and I have a call to the strapi API in the mounted:

```<code>async mounted () {
    const url = `${process.env.apiUrl}/products/${this.$route.params.id}?populate=*`;
    this.$axios.get(url)
      .then(response => {
        this.product = response.data.data
        console.log(this.product);
        this.assignVariants();
      })
      .catch(e => {x
        console.log(e)
      });
  },
</code>```

Everytime I attempt a test purchase I get an order validation error. I assume this is because the HTML crawler is kicking in and the product data is dynamically generated via Vue from the API calls.

How can I implement a solution for the JSON crawler using just Nuxt? I want to be able to create orders locally and view them in the dashboard because there are things I want to implement off the back of what is visible in the snipcart dashboard.

I plan on hosting the front-end on AWS Amplify, is it a case where once hosted orders will work? I still need to be able to locally test orders for various reasons so don't want to wait to deploy. But once in prod and once Nuxt builds into a dist folder will this have any effect or can whatever is implemented locally for the JSON crawl translate into prod?

Body:
I have a Nuxt + Strapi setup - no back-end, strictly front-end, product data is fed via API in the component from strapi. I've been loosely following this (my implementation deviates a little for the HTML but is practically the same for the single product component) and this for the local testing guidance.

From my understanding and the docs here I have to implement a data-item-url that triggers the JSON crawler. I'm not sure how I can achieve this using just Nuxt as I don't have (or want) a back-end.

My single product component is like so:

<template>

              <img class="block width-100%" :src='`${baseUrl}${image.attributes.url}`' :alt="`${product.attributes.description}`">

{{product.attributes.title}}

{{product.attributes.description}}

                  {{product.attributes.discount_price}}
                  {{product.attributes.price}}

                £{{ product.attributes.price }}

Available in:

                {{variants}}

Add to cart and choose your size & flavour!

            <button
                    :data-item-id="product.id"
                    :data-item-price="product.attributes.price"
                    :data-item-url="`${storeUrl}${$route.fullPath}`"
                    :data-item-description="product.attributes.description"
                    :data-item-image="`http://localhost:1337${product.attributes.image.data[0].attributes.url}`"
                    :data-item-name="product.attributes.title"
                    data-item-metadata='{"verifyMyAgeReponse": {}}'
                    v-bind="customFields"
                    class="btn btn--primary flex-grow snipcart-add-item"
            >Add to Cart</button>

          <button class="btn btn--primary flex-grow">Add to Cart</button>

</template>

and I have a call to the strapi API in the mounted:

async mounted () {
    const url = `${process.env.apiUrl}/products/${this.$route.params.id}?populate=*`;
    this.$axios.get(url)
      .then(response => {
        this.product = response.data.data
        console.log(this.product);
        this.assignVariants();
      })
      .catch(e => {x
        console.log(e)
      });
  },

Everytime I attempt a test purchase I get an order validation error. I assume this is because the HTML crawler is kicking in and the product data is dynamically generated via Vue from the API calls.

How can I implement a solution for the JSON crawler using just Nuxt? I want to be able to create orders locally and view them in the dashboard because there are things I want to implement off the back of what is visible in the snipcart dashboard.

I plan on hosting the front-end on AWS Amplify, is it a case where once hosted orders will work? I still need to be able to locally test orders for various reasons so don't want to wait to deploy. But once in prod and once Nuxt builds into a dist folder will this have any effect or can whatever is implemented locally for the JSON crawl translate into prod?


问:
SignalR Troubleshooting keeping the connection after 25 seconds, and then reconnecting again. NET 7 -> IIS Release
Right know I have WebAPI only for SignalR, running one hub.
Has JWT authentication by middleware.
The error only occurs when I'm in Release, with Debug mode work 100%.

Images:

SignalR Configuration

Program configurations

IIS Advanced settings

IIS Pool

Client configurations

Client terminal logs

Pool .NET CLR is the last options is selected.

Client is javascript with more recent packages.

My gool is to be possible to maintaining the connection stable like de debug mode.


问:
How Can I Connect Python to MS SQL Server with Different Windows User?
I enter a new Windows username and password with run as different user to connect to SSMS. I need to import the data there into Python.

However I get an error:
InterfaceError: ('28000', "[28000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'domain\username'. (18456) (SQLDriverConnect); [28000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'domain\username'. (18456)")

I am trying the following code:

```<code>import pyodbc

conn = pyodbc.connect('Driver={SQL Server Native Client 11.0};'
                      'Server=Server;'
                      'Database=Database;'
                      'UID=domain\username;'
                      'PWD=password;')
</code>```

Body:
I enter a new Windows username and password with run as different user to connect to SSMS. I need to import the data there into Python.

However I get an error:
InterfaceError: ('28000', "[28000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'domain\username'. (18456) (SQLDriverConnect); [28000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'domain\username'. (18456)")

I am trying the following code:

import pyodbc

conn = pyodbc.connect('Driver={SQL Server Native Client 11.0};'
                      'Server=Server;'
                      'Database=Database;'
                      'UID=domain\username;'
                      'PWD=password;')


问:
How to include target/generated-sources/jaxb folder in jacoco coverage report?
While running the application, I am getting the total coverage including the target/generated-sources/jaxb folder. In local i.e. eclipse IDE this folder is included but not in jacoco report. PSB the screenshot:

Screenshot

But while checking the jacoco report, in that this target/generated-sources/jaxb folder is not included. How to include this folder in jacoco report?

Another screenshot

because of this my sonar is also not showing the combined coverage of the FOSSIL_CLIENT folder.

How can I include this folder in the coverage part?


问:
Twilio Voice-SDK device.register doesn't register device, instead keeps spamming signal websocket
I have a Laravel+Vue application that I'm trying to connect to Twilio to receive incoming calls.

Below is my Vue Method, /token gets the device token no problem, I have included the code for this so you can see what is being generated in case it is this.

Whenever device.register() is called it does nothing except open a new websocket at Twilio for /signal every second and never actually registers the device.

I've gone over the docs multiple times and can't see what I'm doing wrong - any idea?

```<code> setupCall(){
  axios.get('/token').then( (response) => {
   this.device = new Device(response.data.data);

   this.device.addListener('registered', device => {
    console.log('The device is ready to receive incoming calls.')
   });

   this.device.register();

  });
 },
</code>```
```<code>$token = new AccessToken(config('services.twilio.sid'),config('services.twilio.sk'),config('services.twilio.sec'));

$outgoingApplicationSid = config('services.twilio.app_sid');

$voiceGrant = new VoiceGrant();
$voiceGrant->setOutgoingApplicationSid($outgoingApplicationSid);
$voiceGrant->setIncomingAllow(true);
$token->addGrant($voiceGrant);

</code>```

I've tried async/await, triggering register in a separate function, hardcoding the token.

Body:
I have a Laravel+Vue application that I'm trying to connect to Twilio to receive incoming calls.

Below is my Vue Method, /token gets the device token no problem, I have included the code for this so you can see what is being generated in case it is this.

Whenever device.register() is called it does nothing except open a new websocket at Twilio for /signal every second and never actually registers the device.

I've gone over the docs multiple times and can't see what I'm doing wrong - any idea?

 setupCall(){
  axios.get('/token').then( (response) => {
   this.device = new Device(response.data.data);

   this.device.addListener('registered', device => {
    console.log('The device is ready to receive incoming calls.')
   });

   this.device.register();

  });
 },

$token = new AccessToken(config('services.twilio.sid'),config('services.twilio.sk'),config('services.twilio.sec'));

$outgoingApplicationSid = config('services.twilio.app_sid');

$voiceGrant = new VoiceGrant();
$voiceGrant->setOutgoingApplicationSid($outgoingApplicationSid);
$voiceGrant->setIncomingAllow(true);
$token->addGrant($voiceGrant);

I've tried async/await, triggering register in a separate function, hardcoding the token.


问:
WebClient - response.bodyToMono behaviour on an unexpected response body
I am converting the response body from a webclient call to a specific type in case of errors.

```<code>        if (clientResponse.statusCode().is4xxClientError() ||
                clientResponse.statusCode().is5xxServerError()) {

            return clientResponse.bodyToMono(ErrorDetails.class)
                         .map(e -> log.error("Response status: {}, error: {}", clientResponse.statusCode(), e);
</code>```

In case of a response payload that cannot be deserialized to this type (ErrorDetails.class) because of a different json structure that expected, i am receiving an initialized object of the type specified in the map method. No error signal is generated.

```<code>Response status: 404 NOT_FOUND, error: class Error {\n    messages: null\n}
</code>```

Is there a way to change this behavior's and request an error signal in case the response body cannot be set to the type specified?

Body:
I am converting the response body from a webclient call to a specific type in case of errors.

        if (clientResponse.statusCode().is4xxClientError() ||
                clientResponse.statusCode().is5xxServerError()) {

            return clientResponse.bodyToMono(ErrorDetails.class)
                         .map(e -> log.error("Response status: {}, error: {}", clientResponse.statusCode(), e);

In case of a response payload that cannot be deserialized to this type (ErrorDetails.class) because of a different json structure that expected, i am receiving an initialized object of the type specified in the map method. No error signal is generated.

Response status: 404 NOT_FOUND, error: class Error {\n    messages: null\n}

Is there a way to change this behavior's and request an error signal in case the response body cannot be set to the type specified?


问:
Uploading images on MERN app using Typescript
I am having issues uploading images in react using typescript. I am using Express (Typescript ) and mongoose for my backend. After testing my API on ThunderClient everything is working fine except when I try uploading an image in my form in react it doesn't work at all. I've tried so many thing yet no positive results
Here is my code:

```<code>import axios from "axios";
import { useState, useEffect } from "react";
import { useNavigate } from "react-router-dom";

const ProductCreate = () => {
const [title, setTitle] = useState<string>("");
const [price, setPrice] = useState<string>("");
const [ImageFile, setImageFile] = useState<File | null>(null);
const [category, setCategory] = useState<string>("");
const [description, setDescription] = useState<string>("");
const [isLoading, setLoading] = useState<boolean>(false);
const [isError, setError] = useState<boolean>(false);
const [data, setData] = useState<[]>([]);
const navigate = useNavigate();

interface handleCategory {
  _id: string;
  Name: string;
}

useEffect(() => {
  const fetchCategory = async () => {
    try {
      const res = await axios.get("http://localhost:5000/category");
      await setData(res.data);
    } catch (error) {
      console.log(error);
    }
  };
  fetchCategory();
}, []);

//  Submitting the form
const handleSubmit = async (e: any) => {
  e.preventDefault();
  const body = {
    title,
    price,
    description,
    category,
    ImageFile,
  };
  console.log(body);
  try {
    const res = await axios.post(
      "http://localhost:5000/product/create",
      body,
    );
    await res.data;
    navigate("/products");
    console.log(res.data);
  } catch (err: any) {
    setError(err);
    console.log(err);
  }
};

return (
  <div className='productCreate'>
    {isError && <p> Something is wrong</p>}
    <div>
      <form
        className='prForm'
        onSubmit={handleSubmit}
        encType='multipart/form-data'
      >
        <h3> Create Product</h3>
        <div className='Form_Control'>
          <label>Product Title</label>
          <input
            onChange={(e) => setTitle(e.target.value)}
            type='text'
            placeholder='Input title'
          />
        </div>
        <div className='Form_Control'>
          <label>Product Image</label>
          <input
            type='file'
            name='image'
            onChange={(e) =>
              setImageFile(e.target.files ? e.target.files[0] : null)
            }
          />
        </div>
        <div className='Form_Control'>
          <label>Price</label>
          <input
            onChange={(e) => setPrice(e.target.value)}
            type='text'
            placeholder='Input  price'
          />
        </div>
        <div className='Form_Control'>
          <label>Product Category</label>
          <select onChange={(e) => setCategory(e.target.value)} id=''>
            {data.map((data: handleCategory) => (
              <option key={data._id} value={data._id}>
                {data.Name}
              </option>
            ))}
          </select>
        </div>
        <div className='Form_Control'>
          <label>Description</label>
          <textarea onChange={(e) => setDescription(e.target.value)} />
        </div>
        <button type='submit'> Create</button>
      </form>
    </div>
  </div>
);
};

export default ProductCreate;

</code>```

My backend code (Routes)

```<code>import { Router } from "express";
import {
  getAllProduct,
  getProductByID,
  createProduct,
  countProduct,
  updateProduct,
  deleteProduct,
} from "../controller/productController";
import multer from "multer";
import path from "path";

const router = Router();

const storage = multer.diskStorage({
  destination: (req, file, cb) => cb(null, "./upload"),
  filename: (req, file, cb) => {
    console.log(file);
    cb(null, Date.now() + path.extname(file.originalname));
  },
});

const upload = multer({ storage });

router.get("/", getAllProduct);
router.get("/:id", getProductByID);
router.get("/count", countProduct);
router.post("/create", upload.single("ImageFile"), createProduct);
router.put("/:id", upload.single("ImageFlie"), updateProduct);
router.delete("/:id", deleteProduct);

export default router;

</code>```

My backend code (product Controller)

```<code>import { Request, Response } from "express";
import product from "../model/productModel";

// Get all product
const getAllProduct = async (req: Request, res: Response) => {
  try {
    const findproduct = await product.find().populate("category").exec();
    res.status(200).json(findproduct);
  } catch (err: any) {
    res.status(500).json(err.message);
  }
};

// Count all product
const countProduct = async (req: Request, res: Response) => {
  const count = await product.find().count().exec();
  console.log(count);

  res.status(200).json({ count });
};

const getProductByID = async (req: Request, res: Response) => {
  try {
    const id = req.params.id;
    const getSingleProduct = await product.findById(id);
    res.status(200).json(getSingleProduct);
  } catch (err: any) {
    res.status(500).json(err.message);
  }
};
const createProduct = async (req: Request, res: Response) => {
  try {
    const newProducs = new product({
      title: req.body.title,
      description: req.body.description,
      price: req.body.price,
      category: req.body.category,
      image: req.file?.filename,
    });
    const savedProduct = await newProducs.save();
    res.status(200).json(savedProduct);
  } catch (err: any) {
    res.status(500).json(err.message);
  }
};
const updateProduct = async (req: Request, res: Response) => {
  try {
    const id = req.params.id;
    const result = await product.findByIdAndUpdate(
      id,
      { $set: req.body },
      { new: true },
    );
    res.status(200).json(result);
  } catch (err: any) {
    res.status(500).json(err.message);
  }
};
const deleteProduct = async (req: Request, res: Response) => {
  try {
    const id = req.params.id;
    const deletedProduct = await product.findByIdAndDelete(id);
    res.status(200).json("Deleted Successfully");
  } catch (err: any) {
    res.status(500).json(err.message);
  }
};

export {
  getAllProduct,
  getProductByID,
  countProduct,
  createProduct,
  updateProduct,
  deleteProduct,
};

</code>```

Please I'm totally frustrated using typescript please help out

Body:
I am having issues uploading images in react using typescript. I am using Express (Typescript ) and mongoose for my backend. After testing my API on ThunderClient everything is working fine except when I try uploading an image in my form in react it doesn't work at all. I've tried so many thing yet no positive results
Here is my code:

import axios from "axios";
import { useState, useEffect } from "react";
import { useNavigate } from "react-router-dom";

const ProductCreate = () => {
const [title, setTitle] = useState<string>("");
const [price, setPrice] = useState<string>("");
const [ImageFile, setImageFile] = useState<File | null>(null);
const [category, setCategory] = useState<string>("");
const [description, setDescription] = useState<string>("");
const [isLoading, setLoading] = useState<boolean>(false);
const [isError, setError] = useState<boolean>(false);
const [data, setData] = useState<[]>([]);
const navigate = useNavigate();

interface handleCategory {
  _id: string;
  Name: string;
}

useEffect(() => {
  const fetchCategory = async () => {
    try {
      const res = await axios.get("http://localhost:5000/category");
      await setData(res.data);
    } catch (error) {
      console.log(error);
    }
  };
  fetchCategory();
}, []);

//  Submitting the form
const handleSubmit = async (e: any) => {
  e.preventDefault();
  const body = {
    title,
    price,
    description,
    category,
    ImageFile,
  };
  console.log(body);
  try {
    const res = await axios.post(
      "http://localhost:5000/product/create",
      body,
    );
    await res.data;
    navigate("/products");
    console.log(res.data);
  } catch (err: any) {
    setError(err);
    console.log(err);
  }
};

return (

    {isError &&
 Something is wrong
}

      <form
        className='prForm'
        onSubmit={handleSubmit}
        encType='multipart/form-data'
      >

 Create Product

          Product Title
          <input
            onChange={(e) => setTitle(e.target.value)}
            type='text'
            placeholder='Input title'
          />

          Product Image
          <input
            type='file'
            name='image'
            onChange={(e) =>
              setImageFile(e.target.files ? e.target.files[0] : null)
            }
          />

          Price
          <input
            onChange={(e) => setPrice(e.target.value)}
            type='text'
            placeholder='Input  price'
          />

          Product Category
          <select onChange={(e) => setCategory(e.target.value)} id=''>
            {data.map((data: handleCategory) => (
              <option key={data._id} value={data._id}>
                {data.Name}
              </option>
            ))}
          </select>

          Description
          <textarea onChange={(e) => setDescription(e.target.value)} />

        <button type='submit'> Create</button>
      </form>

);
};

export default ProductCreate;

My backend code (Routes)

import { Router } from "express";
import {
  getAllProduct,
  getProductByID,
  createProduct,
  countProduct,
  updateProduct,
  deleteProduct,
} from "../controller/productController";
import multer from "multer";
import path from "path";

const router = Router();

const storage = multer.diskStorage({
  destination: (req, file, cb) => cb(null, "./upload"),
  filename: (req, file, cb) => {
    console.log(file);
    cb(null, Date.now() + path.extname(file.originalname));
  },
});

const upload = multer({ storage });

router.get("/", getAllProduct);
router.get("/:id", getProductByID);
router.get("/count", countProduct);
router.post("/create", upload.single("ImageFile"), createProduct);
router.put("/:id", upload.single("ImageFlie"), updateProduct);
router.delete("/:id", deleteProduct);

export default router;

My backend code (product Controller)

import { Request, Response } from "express";
import product from "../model/productModel";

// Get all product
const getAllProduct = async (req: Request, res: Response) => {
  try {
    const findproduct = await product.find().populate("category").exec();
    res.status(200).json(findproduct);
  } catch (err: any) {
    res.status(500).json(err.message);
  }
};

// Count all product
const countProduct = async (req: Request, res: Response) => {
  const count = await product.find().count().exec();
  console.log(count);

  res.status(200).json({ count });
};

const getProductByID = async (req: Request, res: Response) => {
  try {
    const id = req.params.id;
    const getSingleProduct = await product.findById(id);
    res.status(200).json(getSingleProduct);
  } catch (err: any) {
    res.status(500).json(err.message);
  }
};
const createProduct = async (req: Request, res: Response) => {
  try {
    const newProducs = new product({
      title: req.body.title,
      description: req.body.description,
      price: req.body.price,
      category: req.body.category,
      image: req.file?.filename,
    });
    const savedProduct = await newProducs.save();
    res.status(200).json(savedProduct);
  } catch (err: any) {
    res.status(500).json(err.message);
  }
};
const updateProduct = async (req: Request, res: Response) => {
  try {
    const id = req.params.id;
    const result = await product.findByIdAndUpdate(
      id,
      { $set: req.body },
      { new: true },
    );
    res.status(200).json(result);
  } catch (err: any) {
    res.status(500).json(err.message);
  }
};
const deleteProduct = async (req: Request, res: Response) => {
  try {
    const id = req.params.id;
    const deletedProduct = await product.findByIdAndDelete(id);
    res.status(200).json("Deleted Successfully");
  } catch (err: any) {
    res.status(500).json(err.message);
  }
};

export {
  getAllProduct,
  getProductByID,
  countProduct,
  createProduct,
  updateProduct,
  deleteProduct,
};

Please I'm totally frustrated using typescript please help out


问:
Sound mediaPlayer not playing first time android studio
I am not able to play a sound when it is the first time I pass it through the else if. If I remove the condition, there is not change at all. The code here works fine

```<code>                punchPlayerSound.start();

        }
        else if (dodgeCPUSound != null) {
            dodgeCPUSound.start();
        }
</code>```

For the set, only the fourth sound won't play the first time even if it value is not null

```<code>    public void setSounds(MediaPlayer dodgePlayerSound, MediaPlayer punchPlayerSound, MediaPlayer dodgeCPUSound, MediaPlayer punchCPUSound) {
        this.dodgePlayerSound = dodgePlayerSound;
        this.punchPlayerSound = punchPlayerSound;
        this.dodgeCPUSound = dodgeCPUSound;
        this.punchCPUSound = punchCPUSound;
    }
</code>```

Body:
I am not able to play a sound when it is the first time I pass it through the else if. If I remove the condition, there is not change at all. The code here works fine

                punchPlayerSound.start();

        }
        else if (dodgeCPUSound != null) {
            dodgeCPUSound.start();
        }

For the set, only the fourth sound won't play the first time even if it value is not null

    public void setSounds(MediaPlayer dodgePlayerSound, MediaPlayer punchPlayerSound, MediaPlayer dodgeCPUSound, MediaPlayer punchCPUSound) {
        this.dodgePlayerSound = dodgePlayerSound;
        this.punchPlayerSound = punchPlayerSound;
        this.dodgeCPUSound = dodgeCPUSound;
        this.punchCPUSound = punchCPUSound;
    }


问:
How are operations performed in the data that is spilled in spark?
I understand the reason for spill mentioned here. I am confused on whether for the following transformations

The tasks are executed for the data that is already in memory and then the data in disk is read and transformations are applied.

or

2.The transformations are applied on the disk itself.

This might be an illogical question, but can someone explain as I am new to Computing.


问:
Parallelize a task on gpu
I have a task in which I have to read in some images, perform some trasformations such as resizing the images, etc, and then write the image back on the disk. I can parallelize this operation over my cpu. However, I was wondering if there is a possible way to parallelize this over gpu. Since, this would make my task terminate quicker.

I should specify that the images that I have are quiet large. Their size tends to be around 5000px X 4000px.

I perform this task in python 3.

So I would like to know if this is even possible. If yes, where can I begin from?

Title: Parallelize a task on gpu


问:
Ionic/Angular FIreStorage Error Cannot read properties of undefined (reading 'match')
I've created a service on a previous iteration of my application that was build in Angular and now I'm copying the same code base to use on a Ionic app.

Even thou the code works fine on my other application, it's not working on the Ionic version. I get this error:

core.mjs:7621 ERROR Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'match') at new DataURLParts (index.esm2017.js:1088:33) at dataURLBytes_ (index.esm2017.js:1103:19) at dataFromString (index.esm2017.js:987:35)

Here is my service:

```<code>import { Injectable } from '@angular/core';
import { AngularFireStorage } from '@angular/fire/compat/storage';
import { AlertServices } from './alert-service';

@Injectable({ providedIn: 'root' })
export class UploadService {
    constructor(private afStorage: AngularFireStorage, private alertService: AlertServices) {}
    async uploadAvatarCoverImage(data: any, userID: string, path?: string): Promise<string> {
        return this.afStorage.storage.ref(`${path || 'avatar'}/${userID}`).putString(data.data, 'data_url', {contentType: 'image/png'})
        .then(res => res.ref.getDownloadURL().then(d => d))
        .catch((e) => this.alertService.showAlert('Error', e));
    }
}

</code>```

What am I missing?

Thanks

Body:
I've created a service on a previous iteration of my application that was build in Angular and now I'm copying the same code base to use on a Ionic app.

Even thou the code works fine on my other application, it's not working on the Ionic version. I get this error:

core.mjs:7621 ERROR Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'match') at new DataURLParts (index.esm2017.js:1088:33) at dataURLBytes_ (index.esm2017.js:1103:19) at dataFromString (index.esm2017.js:987:35)

Here is my service:

import { Injectable } from '@angular/core';
import { AngularFireStorage } from '@angular/fire/compat/storage';
import { AlertServices } from './alert-service';

@Injectable({ providedIn: 'root' })
export class UploadService {
    constructor(private afStorage: AngularFireStorage, private alertService: AlertServices) {}
    async uploadAvatarCoverImage(data: any, userID: string, path?: string): Promise<string> {
        return this.afStorage.storage.ref(`${path || 'avatar'}/${userID}`).putString(data.data, 'data_url', {contentType: 'image/png'})
        .then(res => res.ref.getDownloadURL().then(d => d))
        .catch((e) => this.alertService.showAlert('Error', e));
    }
}

What am I missing?

Thanks


问:
How can I get the authorization date of a connected app per user in Google Admin?
I was trying to list connected apps of mine google workspace with authorization date and if it is possible a last time used date as well.

On the frontend of Google Admin we have Connected applications in the Security dropdown inside of Directory -> Users, there we can find the authorization date but in the Admin SDK API I couldn't found where to get that information.

List of Connected Apps

I have already listed users and their tokens using this endpoint https://developers.google.com/admin-sdk/directory/reference/rest/v1/tokens/list

But the token resource doesn't have any kind of date.

The only endpoint I found that it should be possible to retrieve any date related to the token authorization would be https://developers.google.com/admin-sdk/reports/reference/rest/v1/activities/list

But this endpoint is kind of a log of the activities inside a google workspace account.

Do anyone knows if I have another way to get authorization date and last used date of an specific token related to the user in a google workspace account?


问:
Default row selection in Ag-grid react table
I have used a ag-grid table in my react application and when page renders table disply with list of rows. Is any option in ag-grid to make a default row selection when page rendered or any other option to achieve default row selection?</p>


问:
Laravel auth sanctum causes socket to hang up
I am trying to use Laravel auth sanctum middelware. Logging in and registering works fine, but when I try to make an authenticated request the socket hangs up, and all requests after that get refused.

```<code>Error: connect ECONNREFUSED 127.0.0.1:8000
Error: socket hang up
</code>```

My protected route:

```<code>Route::group(['middleware' => 'auth:sanctum'], function () {
    Route::get('/test', [ApiController::class, 'test']);
});
</code>```

My simple test method:

```<code>public function test(Request $request){
    return "hello world";
}
</code>```

My test function works fine when I don't authenticate it. It seems like when it is trying to authenticate the request, something goes wrong and the whole Laravel server refuses all requests.

What could be the cause of this?

Body:
I am trying to use Laravel auth sanctum middelware. Logging in and registering works fine, but when I try to make an authenticated request the socket hangs up, and all requests after that get refused.

Error: connect ECONNREFUSED 127.0.0.1:8000
Error: socket hang up

My protected route:

Route::group(['middleware' => 'auth:sanctum'], function () {
    Route::get('/test', [ApiController::class, 'test']);
});

My simple test method:

public function test(Request $request){
    return "hello world";
}

My test function works fine when I don't authenticate it. It seems like when it is trying to authenticate the request, something goes wrong and the whole Laravel server refuses all requests.

What could be the cause of this?


问:
Jenkins Remote Nodes - Dynamically Configure
In Atlassian Bamboo when we run a remote agent jar file on any remote machine then the related agent appears automatically in the Bamboo host environment. The agent’s name is defined using the related Host name of the remote machine.

However, in Jenkins we need to pass the agent’s name manually as we can see in the below command line:

curl -sO http://10.91.4.62:8080/jnlpJars/agent.jar java -jar agent.jar -jnlpUrl http://10.91.4.62:8080/manage/computer/GHH%20RC%20Automation%20Agent%202/jenkins-agent.jnlp -secret 2bfad28c088fca6b7674ea65902e6cdd18e8f2a5e08ead2 -workDir "C:\Jenkins\Agent"

Is there a way to run the agent jar on the remote machine such as it automatically names the remote agent using the information of the remote machine and reflects it at the Jenkins host automatically?

I looked into various online articles but was unable to achieve what we want in Jenkins.


问:
How to move one of the maven multi-module projects to its own directory?
I have a Springboot multi-module maven project.

Now I want to move one of the applications(module) to its own folder/project.

So far,

I created a new folder with its POM.xml

Copied my intended module to it, and made it a child module of the project's pom.

In my original project I ran mvn package to create jars of all the modules.

Copied these jars to a folder (./repo) inside the new project.

But now, I am unable to import dependencies from these JARs.

I have added this to the new project's POM

```<code><repositories>
  <repository>
    <id>data-local</id>
    <name>data</name>
    <url>file://${project.basedir}/repo</url>
  </repository>
</repositories>
</code>```

Body:
I have a Springboot multi-module maven project.

Now I want to move one of the applications(module) to its own folder/project.

So far,

I created a new folder with its POM.xml

Copied my intended module to it, and made it a child module of the project's pom.

In my original project I ran mvn package to create jars of all the modules.

Copied these jars to a folder (./repo) inside the new project.

But now, I am unable to import dependencies from these JARs.

I have added this to the new project's POM

<repositories>
  <repository>
    <id>data-local</id>
    <name>data</name>
    <url>file://${project.basedir}/repo</url>
  </repository>
</repositories>


问:
C# XML deserialize derived class
I'm trying to deserialize a XML using a derived class in C# .NET Framework 4.8:

```<code>        string xml =
        "<starttrigger>" +
            "<case>" +
                "<condition>" +
                    "<condition_type>ge</condition_type>" +
                    "<channelname>foobar/bar</channelname>" +
                    "<value>10</value>" +
                "</condition>" +
                "<condition>" +
                    "<condition_type>time</condition_type>" +
                    "<delay_ms>5</delay_ms>" +
                "</condition>" +
            "</case>" +
            "<case>" +
                "<condition>" +
                    "<condition_type>l</condition_type>" +
                    "<channelname>foo/bar</channelname>" +
                    "<value>5</value>" +
                "</condition>" +
            "</case>" +
        "</starttrigger>";

        MemoryStream str = new MemoryStream();
        StreamWriter writer = new StreamWriter(str);
        writer.Write(xml);
        writer.Flush();
        str.Position = 0;

        var serializer = new XmlSerializer(typeof(Trigger));
        var trigger = (Trigger)serializer.Deserialize(str);
</code>```

In the XML sample, you can see, that  can either have a channelname and value OR a delay_ms tag. I want to deserialize this using a derived class to keep by code tidy:

```<code>public enum ConditionType
{
    le, ge, l, g, eq, neq, time
}

[XmlInclude(typeof(ConditionTime))]
[XmlInclude(typeof(ConditionComparison))]
public abstract class Condition
{
    [XmlElement(ElementName = "condition_type")]
    public virtual ConditionType ConditionType { get; set; }
}

/// <summary>
/// if ConditionType = le, ge, l, g, eq, neq
/// </summary>
public class ConditionComparison : Condition
{
    [XmlElement(ElementName = "channelname")]
    public string Channelname { get; set; }

    [XmlElement(ElementName = "value")]
    public byte Value { get; set; }
}

/// <summary>
/// if ConditionType = time
/// </summary>
public class ConditionTime : Condition
{
    [XmlElement(ElementName = "delay_ms")]
    public uint DelayMs { get; set; }
}

public class Case
{
    [XmlElement(ElementName = "condition")]
    public List<Condition> Condition { get; set; }
}

[XmlRoot(ElementName = "starttrigger", Namespace = "")]
public class Trigger
{
    [XmlElement(ElementName = "case")]
    public List<Case> Case { get; set; }
}
</code>```

Using the XmlInclude Attribute it should recognize the derived classes and create the objects accordingly, but it doesn't.
In this code sample, I get a InvalidOperationException.

InvalidOperationException: The specified type is abstract: name='Condition', namespace='', at .

If I remove the abstract from the Condition class the code doesn't throw an exception, however the base class is created with only the ConditionType Property.
I have also tried giving the XmlSerializer constructor an array with the two extra types.

No matter what i do nothing seems to work. Can you help me?

Title: C# XML deserialize derived class

Body:
I'm trying to deserialize a XML using a derived class in C# .NET Framework 4.8:

        string xml =
        "<starttrigger>" +
            "<case>" +
                "<condition>" +
                    "<condition_type>ge</condition_type>" +
                    "<channelname>foobar/bar</channelname>" +
                    "<value>10</value>" +
                "</condition>" +
                "<condition>" +
                    "<condition_type>time</condition_type>" +
                    "<delay_ms>5</delay_ms>" +
                "</condition>" +
            "</case>" +
            "<case>" +
                "<condition>" +
                    "<condition_type>l</condition_type>" +
                    "<channelname>foo/bar</channelname>" +
                    "<value>5</value>" +
                "</condition>" +
            "</case>" +
        "</starttrigger>";

        MemoryStream str = new MemoryStream();
        StreamWriter writer = new StreamWriter(str);
        writer.Write(xml);
        writer.Flush();
        str.Position = 0;

        var serializer = new XmlSerializer(typeof(Trigger));
        var trigger = (Trigger)serializer.Deserialize(str);

In the XML sample, you can see, that  can either have a channelname and value OR a delay_ms tag. I want to deserialize this using a derived class to keep by code tidy:

public enum ConditionType
{
    le, ge, l, g, eq, neq, time
}

[XmlInclude(typeof(ConditionTime))]
[XmlInclude(typeof(ConditionComparison))]
public abstract class Condition
{
    [XmlElement(ElementName = "condition_type")]
    public virtual ConditionType ConditionType { get; set; }
}

///
/// if ConditionType = le, ge, l, g, eq, neq
///
public class ConditionComparison : Condition
{
    [XmlElement(ElementName = "channelname")]
    public string Channelname { get; set; }

    [XmlElement(ElementName = "value")]
    public byte Value { get; set; }
}

///
/// if ConditionType = time
///
public class ConditionTime : Condition
{
    [XmlElement(ElementName = "delay_ms")]
    public uint DelayMs { get; set; }
}

public class Case
{
    [XmlElement(ElementName = "condition")]
    public List<Condition> Condition { get; set; }
}

[XmlRoot(ElementName = "starttrigger", Namespace = "")]
public class Trigger
{
    [XmlElement(ElementName = "case")]
    public List<Case> Case { get; set; }
}

Using the XmlInclude Attribute it should recognize the derived classes and create the objects accordingly, but it doesn't.
In this code sample, I get a InvalidOperationException.

InvalidOperationException: The specified type is abstract: name='Condition', namespace='', at .

If I remove the abstract from the Condition class the code doesn't throw an exception, however the base class is created with only the ConditionType Property.
I have also tried giving the XmlSerializer constructor an array with the two extra types.

No matter what i do nothing seems to work. Can you help me?


问:
How do I include externally-built C/C++ libraries (e.g. OpenSSL) in Android Studio
I want to develop a C++ Android app using Android Studio.

If I need to include an external library, I may need to build it separately. For example, I may need OpenSSL which has Android NDK build instructions here. The instructions in that link are of this kind:

```<code>sudo -E make install CC=$ANDROID_TOOLCHAIN/arm-linux-androideabi-gcc RANLIB=$ANDROID_TOOLCHAIN/arm-linux-androideabi-ranlib

arm-linux-androideabi-gcc -I /usr/local/ssl/include my_prog.c -o my_prog.exe -L /usr/local/ssl/lib -lssl -lcrypto
</code>```

If I'm reading this right, the first line cross-compiles the library and the second line builds my_prog, linking to said library. But if I am using Android Studio to build the app, how do I integrate that with the library produced via the make install line?

Body:
I want to develop a C++ Android app using Android Studio.

If I need to include an external library, I may need to build it separately. For example, I may need OpenSSL which has Android NDK build instructions here. The instructions in that link are of this kind:

sudo -E make install CC=$ANDROID_TOOLCHAIN/arm-linux-androideabi-gcc RANLIB=$ANDROID_TOOLCHAIN/arm-linux-androideabi-ranlib

arm-linux-androideabi-gcc -I /usr/local/ssl/include my_prog.c -o my_prog.exe -L /usr/local/ssl/lib -lssl -lcrypto

If I'm reading this right, the first line cross-compiles the library and the second line builds my_prog, linking to said library. But if I am using Android Studio to build the app, how do I integrate that with the library produced via the make install line?


问:
How can I change the category to the page in the articles
How can I change the category to the page in the articles?

I have all categories no index.

I get clicks on it which is causing me a problem.

I want to change the category in the article to the interested page.


问:
App hangs when video export finishes on iOS 16 (AVFoundation)
The issue started happening randomly after iOS 16 update. For video exporting AVFoundation's AVAssetExportSession is used. The issue happens only when AVVideoComposition's animationTool property is applied. The ui freezes when the export process finishes. Main thread's call stack is attached below.

```<code>Thread 0 - com.apple.main-thread - (TH_STATE_WAITING)
0  libsystem_kernel.dylib +0x13004 _mach_msg2_internal
1  libsystem_kernel.dylib +0x13244 _mach_msg_overwrite
2  libsystem_kernel.dylib +0x1088  _mach_msg
3  QuartzCore +0x8a6ac             CA::Render::Message::send_message()
4  QuartzCore +0x2612a8            CA::Render::Encoder::send_message(unsigned int, unsigned int, unsigned int*, unsigned long)
5  QuartzCore +0x31168             CA::Context::commit_transaction(CA::Transaction*, double, double*)
6  QuartzCore +0x663c0             CA::Transaction::commit()
7  UIKitCore +0x504fcc             __UIApplicationFlushCATransaction
8  UIKitCore +0x651674             __UIUpdateSequenceRun
9  UIKitCore +0xc90900             _schedulerStepScheduledMainSection
10 UIKitCore +0xc8facc             _runloopSourceCallback
11 CoreFoundation +0xd6228         ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
12 CoreFoundation +0xe2610         ___CFRunLoopDoSource0
13 CoreFoundation +0x66578         ___CFRunLoopDoSources0
14 CoreFoundation +0x7beb4         ___CFRunLoopRun
15 CoreFoundation +0x811e0         _CFRunLoopRunSpecific
16 GraphicsServices +0x1364        _GSEventRunModal
17 UIKitCore +0x3a2d84             -[UIApplication _run]
18 UIKitCore +0x3a29e8             _UIApplicationMain
19 PicsArt +0x4998b0               main (main.m:29:16)
20 dyld +0x15944                   start
</code>```

I tried to call AVAssetExportSession's exportAsynchronously and cancelExport functions on background queue, as a result the number of crashes decreased, but big number of users still get this app hang. I expect to find some workaround solution for this.

Body:
The issue started happening randomly after iOS 16 update. For video exporting AVFoundation's AVAssetExportSession is used. The issue happens only when AVVideoComposition's animationTool property is applied. The ui freezes when the export process finishes. Main thread's call stack is attached below.

Thread 0 - com.apple.main-thread - (TH_STATE_WAITING)
0  libsystem_kernel.dylib +0x13004 _mach_msg2_internal
1  libsystem_kernel.dylib +0x13244 _mach_msg_overwrite
2  libsystem_kernel.dylib +0x1088  _mach_msg
3  QuartzCore +0x8a6ac             CA::Render::Message::send_message()
4  QuartzCore +0x2612a8            CA::Render::Encoder::send_message(unsigned int, unsigned int, unsigned int*, unsigned long)
5  QuartzCore +0x31168             CA::Context::commit_transaction(CA::Transaction*, double, double*)
6  QuartzCore +0x663c0             CA::Transaction::commit()
7  UIKitCore +0x504fcc             __UIApplicationFlushCATransaction
8  UIKitCore +0x651674             __UIUpdateSequenceRun
9  UIKitCore +0xc90900             _schedulerStepScheduledMainSection
10 UIKitCore +0xc8facc             _runloopSourceCallback
11 CoreFoundation +0xd6228         ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
12 CoreFoundation +0xe2610         ___CFRunLoopDoSource0
13 CoreFoundation +0x66578         ___CFRunLoopDoSources0
14 CoreFoundation +0x7beb4         ___CFRunLoopRun
15 CoreFoundation +0x811e0         _CFRunLoopRunSpecific
16 GraphicsServices +0x1364        _GSEventRunModal
17 UIKitCore +0x3a2d84             -[UIApplication _run]
18 UIKitCore +0x3a29e8             _UIApplicationMain
19 PicsArt +0x4998b0               main (main.m:29:16)
20 dyld +0x15944                   start

I tried to call AVAssetExportSession's exportAsynchronously and cancelExport functions on background queue, as a result the number of crashes decreased, but big number of users still get this app hang. I expect to find some workaround solution for this.


问:
Three JS export GLFT model doesn't look like in Blender Rendered Mode
I'm newbie to both 3JS and Blender , when I export my model to .glb , then import it to my 3JS project . But somehow they are not the same.

In Blender Rendered Mode it look so smooth but in 3JS , all the color , the mesh , ... so terrible, what did i miss to adjust in 3JS project , please help me :(
(all of my Blender setting are default)

import * as THREE from 'three';
import {OrbitControls} from 'three/examples/jsm/controls/OrbitControls.js';
import {GLTFLoader} from 'three/examples/jsm/loaders/GLTFLoader.js'
//import img
import galaxy from '../img/galaxy.jpg';
//setting value place
const monkeyURL = new URL('../asssets/racoon_2_1.glb',import.meta.url);
const renderer = new THREE.WebGLRenderer();
renderer.gammaOutput = true;
renderer.setSize(window.innerWidth,window.innerHeight); //note this place to change the size of scene to fit the html css
document.body.appendChild(renderer.domElement);
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(
    75,
    window.innerWidth/window.innerHeight,
    0.1,
    1000
);
//spot light
const spotLight= new THREE.SpotLight(0xFFFFFF);
scene.add(spotLight);
spotLight.position.set(00,10,10);
spotLight.castShadow=true;
const spotLight1= new THREE.SpotLight(0xFFFFFF);
scene.add(spotLight1);
spotLight1.position.set(00,10,-10);
spotLight.castShadow=true;
spotLight.angle=0.5;
const spotLightHelper = new THREE.SpotLightHelper(spotLight);
scene.add(spotLightHelper);

//change color background or image
//renderer.setClearColor(0xFFEA00);
//const textureLoader = new THREE.TextureLoader();
//scene.background = textureLoader.load(galaxy);

//model Blender
const assetLoader = new GLTFLoader();
assetLoader.load(monkeyURL.href,function(gltf){
    const model = gltf.scene;
    scene.add(model);
    model.position.set(0,0,0);
}, undefined, function(error){
    console.error(error);
});

//orbit controls
const orbit = new OrbitControls(camera, renderer.domElement);
//axes
const axesHelper = new THREE.AxesHelper(5);
scene.add(axesHelper);
//camera
camera.position.set(0,2,5);

//functions :D
orbit.update();
function animate()
{
    renderer.render(scene,camera);
}
renderer.setAnimationLoop(animate);
```

Get some help to fix my error

Body:
I'm newbie to both 3JS and Blender , when I export my model to .glb , then import it to my 3JS project . But somehow they are not the same.

In Blender Rendered Mode it look so smooth but in 3JS , all the color , the mesh , ... so terrible, what did i miss to adjust in 3JS project , please help me :(
(all of my Blender setting are default)

import * as THREE from 'three';
import {OrbitControls} from 'three/examples/jsm/controls/OrbitControls.js';
import {GLTFLoader} from 'three/examples/jsm/loaders/GLTFLoader.js'
//import img
import galaxy from '../img/galaxy.jpg';
//setting value place
const monkeyURL = new URL('../asssets/racoon_2_1.glb',import.meta.url);
const renderer = new THREE.WebGLRenderer();
renderer.gammaOutput = true;
renderer.setSize(window.innerWidth,window.innerHeight); //note this place to change the size of scene to fit the html css
document.body.appendChild(renderer.domElement);
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(
    75,
    window.innerWidth/window.innerHeight,
    0.1,
    1000
);
//spot light
const spotLight= new THREE.SpotLight(0xFFFFFF);
scene.add(spotLight);
spotLight.position.set(00,10,10);
spotLight.castShadow=true;
const spotLight1= new THREE.SpotLight(0xFFFFFF);
scene.add(spotLight1);
spotLight1.position.set(00,10,-10);
spotLight.castShadow=true;
spotLight.angle=0.5;
const spotLightHelper = new THREE.SpotLightHelper(spotLight);
scene.add(spotLightHelper);

//change color background or image
//renderer.setClearColor(0xFFEA00);
//const textureLoader = new THREE.TextureLoader();
//scene.background = textureLoader.load(galaxy);

//model Blender
const assetLoader = new GLTFLoader();
assetLoader.load(monkeyURL.href,function(gltf){
    const model = gltf.scene;
    scene.add(model);
    model.position.set(0,0,0);
}, undefined, function(error){
    console.error(error);
});

//orbit controls
const orbit = new OrbitControls(camera, renderer.domElement);
//axes
const axesHelper = new THREE.AxesHelper(5);
scene.add(axesHelper);
//camera
camera.position.set(0,2,5);

//functions :D
orbit.update();
function animate()
{
    renderer.render(scene,camera);
}
renderer.setAnimationLoop(animate);

Get some help to fix my error


问:
Zustand, persist, react native and react-native-mmkv-loader. How do I only update the changed values?
I have the following code:

```<code>const contractStorage = new MMKVLoader().initialize()

export const useStore = create<StoreType>()(
  persist(
    (set) => ({
      contracts: {},
      setContracts: (contract: Contract) => set((state) => ({ ...state, [contract.id]: contract })),
    }),
    {
      name: 'contract-storage',
      version: 0,
      getStorage: () => contractStorage,
    },
  ),
)
</code>```

This accesses the methods defined on the MMKVLoader, one of which being setItem, which updates the entire instance

Is there a way to use the persist middleware to only update the specific key/value pair in the storage that has actually changed?

My current workaround is the following:

```<code>export const useStore = create<StoreType>()(
  (set) => ({
    contracts: {},
    setContracts: (contract: Contract) => set((state) => {
      contractStorage.setMap(contract.id, contract)
      return ({ ...state, [contract.id]: contract })
    }),
  })
)
</code>```

Body:
I have the following code:

const contractStorage = new MMKVLoader().initialize()

export const useStore = create<StoreType>()(
  persist(
    (set) => ({
      contracts: {},
      setContracts: (contract: Contract) => set((state) => ({ ...state, [contract.id]: contract })),
    }),
    {
      name: 'contract-storage',
      version: 0,
      getStorage: () => contractStorage,
    },
  ),
)

This accesses the methods defined on the MMKVLoader, one of which being setItem, which updates the entire instance

Is there a way to use the persist middleware to only update the specific key/value pair in the storage that has actually changed?

My current workaround is the following:

export const useStore = create<StoreType>()(
  (set) => ({
    contracts: {},
    setContracts: (contract: Contract) => set((state) => {
      contractStorage.setMap(contract.id, contract)
      return ({ ...state, [contract.id]: contract })
    }),
  })
)


问:
fill stacked bar chart from dynamic js array using Chart.js
i created 3 dynamic array using js which user need to fill with his own data

```<code>function addcolumns2()
          {
              var année2=document.sample2.année2.value;
              var name2=document.sample2.name2.value;
              var Pénergie=document.sample2.Pénergie.value;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML=année2;
              td2.innerHTML=name2;
              td3.innerHTML=Pénergie;
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="Upcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl2").appendChild(tr);
          }

          function Upcolumns(columns){
              var année2=document.sample2.année2.value;
              var name2=document.sample2.name2.value;
              var Pénergie=document.sample2.Pénergie.value;
              var s = columns.parentNode.parentNode;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML='<input type="number" name="anné2">';
              td2.innerHTML='<input type="text" name="nam2">';
              td3.innerHTML='<input type="text" name="Pénergie">';
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="addUpcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl2").replaceChild(tr, s);
          }

          function addUpcolumns(columns){
              var année2=document.sample2.anné2.value;
              var name2=document.sample2.nam2.value;
              var Pénergie=document.sample2.Pénergie.value;
              var s = columns.parentNode.parentNode;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML=année2;
              td2.innerHTML=name2;
              td3.innerHTML=Pénergie;
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="Upcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl2").replaceChild(tr, s);
          }

          function delcolumns(columns){
              var s=columns.parentNode.parentNode;
              s.parentNode.removeChild(s);
          }
          function addcolumns3()
          {
              var année3=document.sample3.année3.value;
              var name3=document.sample3.name3.value;
              var Pénergie=document.sample2.Pénergie.value;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML=année3;
              td2.innerHTML=name3;
              td3.innerHTML=Pénergie;
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="Upcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl3").appendChild(tr);
          }

          function Upcolumns(columns){
              var année3=document.sample2.année3.value;
              var name3=document.sample2.name3.value;
              var Pénergie=document.sample2.Pénergie.value;
              var s = columns.parentNode.parentNode;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML='<input type="number" name="anné3">';
              td2.innerHTML='<input type="text" name="nam3">';
              td3.innerHTML='<input type="text" name="Pénergie">';
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="addUpcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl3").replaceChild(tr, s);
          }

          function addUpcolumns(columns){
              var année3=document.sample3.anné3.value;
              var name3=document.sample3.nam3.value;
              var Pénergie=document.sample3.Pénergie.value;
              var s = columns.parentNode.parentNode;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML=année3;
              td2.innerHTML=name3;
              td3.innerHTML=Pénergie;
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="Upcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl3").replaceChild(tr, s);
          }

          function delcolumns(columns){
              var s=columns.parentNode.parentNode;
              s.parentNode.removeChild(s);
          }
          function addcolumns4()
          {
              var année4=document.sample4.année4.value;
              var name4=document.sample4.name4.value;
              var Pénergie=document.sample4.Pénergie.value;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML=année4;
              td2.innerHTML=name4;
              td3.innerHTML=Pénergie;
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="Upcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl4").appendChild(tr);
          }

          function Upcolumns(columns){
              var année4=document.sample4.année4.value;
              var name4=document.sample4.name4.value;
              var Pénergie=document.sample4.Pénergie.value;
              var s = columns.parentNode.parentNode;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML='<input type="number" name="anné4">';
              td2.innerHTML='<input type="text" name="nam4">';
              td3.innerHTML='<input type="text" name="Pénergie">';
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="addUpcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl4").replaceChild(tr, s);
          }

          function addUpcolumns(columns){
              var année4=document.sample4.anné4.value;
              var name4=document.sample4.nam4.value;
              var Pénergie=document.sample4.Pénergie.value;
              var s = columns.parentNode.parentNode;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML=année4;
              td2.innerHTML=name4;
              td3.innerHTML=Pénergie;
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="Upcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl4").replaceChild(tr, s);
          }

          function delcolumns(columns){
              var s=columns.parentNode.parentNode;
              s.parentNode.removeChild(s);
          }
</code>```

first array

second

third

i want to display i stacked bar chart with the data that user will use in the tables

i tried to give each row an id then call it in the charts but it doesnt make sense because i dont know how many rows will the users use
example:
example of Stacked Bar Chart
any ideas please?

Body:
i created 3 dynamic array using js which user need to fill with his own data

function addcolumns2()
          {
              var année2=document.sample2.année2.value;
              var name2=document.sample2.name2.value;
              var Pénergie=document.sample2.Pénergie.value;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML=année2;
              td2.innerHTML=name2;
              td3.innerHTML=Pénergie;
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="Upcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl2").appendChild(tr);
          }

          function Upcolumns(columns){
              var année2=document.sample2.année2.value;
              var name2=document.sample2.name2.value;
              var Pénergie=document.sample2.Pénergie.value;
              var s = columns.parentNode.parentNode;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML='<input type="number" name="anné2">';
              td2.innerHTML='<input type="text" name="nam2">';
              td3.innerHTML='<input type="text" name="Pénergie">';
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="addUpcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl2").replaceChild(tr, s);
          }

          function addUpcolumns(columns){
              var année2=document.sample2.anné2.value;
              var name2=document.sample2.nam2.value;
              var Pénergie=document.sample2.Pénergie.value;
              var s = columns.parentNode.parentNode;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML=année2;
              td2.innerHTML=name2;
              td3.innerHTML=Pénergie;
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="Upcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl2").replaceChild(tr, s);
          }

          function delcolumns(columns){
              var s=columns.parentNode.parentNode;
              s.parentNode.removeChild(s);
          }
          function addcolumns3()
          {
              var année3=document.sample3.année3.value;
              var name3=document.sample3.name3.value;
              var Pénergie=document.sample2.Pénergie.value;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML=année3;
              td2.innerHTML=name3;
              td3.innerHTML=Pénergie;
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="Upcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl3").appendChild(tr);
          }

          function Upcolumns(columns){
              var année3=document.sample2.année3.value;
              var name3=document.sample2.name3.value;
              var Pénergie=document.sample2.Pénergie.value;
              var s = columns.parentNode.parentNode;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML='<input type="number" name="anné3">';
              td2.innerHTML='<input type="text" name="nam3">';
              td3.innerHTML='<input type="text" name="Pénergie">';
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="addUpcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl3").replaceChild(tr, s);
          }

          function addUpcolumns(columns){
              var année3=document.sample3.anné3.value;
              var name3=document.sample3.nam3.value;
              var Pénergie=document.sample3.Pénergie.value;
              var s = columns.parentNode.parentNode;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML=année3;
              td2.innerHTML=name3;
              td3.innerHTML=Pénergie;
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="Upcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl3").replaceChild(tr, s);
          }

          function delcolumns(columns){
              var s=columns.parentNode.parentNode;
              s.parentNode.removeChild(s);
          }
          function addcolumns4()
          {
              var année4=document.sample4.année4.value;
              var name4=document.sample4.name4.value;
              var Pénergie=document.sample4.Pénergie.value;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML=année4;
              td2.innerHTML=name4;
              td3.innerHTML=Pénergie;
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="Upcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl4").appendChild(tr);
          }

          function Upcolumns(columns){
              var année4=document.sample4.année4.value;
              var name4=document.sample4.name4.value;
              var Pénergie=document.sample4.Pénergie.value;
              var s = columns.parentNode.parentNode;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML='<input type="number" name="anné4">';
              td2.innerHTML='<input type="text" name="nam4">';
              td3.innerHTML='<input type="text" name="Pénergie">';
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="addUpcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl4").replaceChild(tr, s);
          }

          function addUpcolumns(columns){
              var année4=document.sample4.anné4.value;
              var name4=document.sample4.nam4.value;
              var Pénergie=document.sample4.Pénergie.value;
              var s = columns.parentNode.parentNode;
              var tr = document.createElement('tr');

              var td1 = tr.appendChild(document.createElement('td'));
              var td2 = tr.appendChild(document.createElement('td'));
              var td3 = tr.appendChild(document.createElement('td'));
              var td4 = tr.appendChild(document.createElement('td'));
              var td5 = tr.appendChild(document.createElement('td'));

              td1.innerHTML=année4;
              td2.innerHTML=name4;
              td3.innerHTML=Pénergie;
              td4.innerHTML='<input type="button" name="del" value="Delete" onclick="delcolumns(this);" class="btn btn-danger">'
              td5.innerHTML='<input type="button" name="up" value="Update" onclick="Upcolumns(this);" class="btn btn-primary">'

              document.getElementById("tbl4").replaceChild(tr, s);
          }

          function delcolumns(columns){
              var s=columns.parentNode.parentNode;
              s.parentNode.removeChild(s);
          }

first array

second

third

i want to display i stacked bar chart with the data that user will use in the tables

i tried to give each row an id then call it in the charts but it doesnt make sense because i dont know how many rows will the users use
example:
example of Stacked Bar Chart
any ideas please?


问:
Error in query: column does not exist though there's the column in database table
I'm getting an error as column doesn't exist by name 'createdat' though i'm querying as 'createdAt' which exist in my table.

I'm using postgres database

```<code>SELECT date_trunc('week', spaces.createdAt ) as start_of_week, sum(spaces.rent_amount)
FROM spaces
GROUP BY date_trunc('week', spaces.createdAt )
ORDER BY date_trunc('week', spaces.createdAt )
</code>```

Error in query (7): ERROR: column spaces.createdat does not exist
LINE 1: SELECT date_trunc('week', spaces.createdAt ) as start_of_wee...
HINT: Perhaps you meant to reference the column "spaces.createdAt".

Body:
I'm getting an error as column doesn't exist by name 'createdat' though i'm querying as 'createdAt' which exist in my table.

I'm using postgres database

SELECT date_trunc('week', spaces.createdAt ) as start_of_week, sum(spaces.rent_amount)
FROM spaces
GROUP BY date_trunc('week', spaces.createdAt )
ORDER BY date_trunc('week', spaces.createdAt )

Error in query (7): ERROR: column spaces.createdat does not exist
LINE 1: SELECT date_trunc('week', spaces.createdAt ) as start_of_wee...
HINT: Perhaps you meant to reference the column "spaces.createdAt".


问:
0 bytes of shared 0 bytes (100%) used in Google Workspace
I started using Google Colab through the GCE VM, but I have not been able to initialize or upload any notebooks.

The error I am getting is The user has exceeded their Drive storage quota, but upon looking into my Storage, I have 15 GB of available storage, 0 bytes of 15 GB used.

Trying to fix it, I log in as the admin account and go to Storage, and then what shows is that 0 bytes of shared 0 bytes (100%) and it is in red. So I believe the is something wrong happening with the storage allocation or the store quota?

The virtual machine was ran with 200 GB space, so I cannot see the issue.

Full error when trying to upload a notebook:

```<code>The user has exceeded their Drive storage quota
GapiError: The user has exceeded their Drive storage quota
    at YI.YA [as constructor] (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:1433:2101)
    at YI.iH [as constructor] (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:2270:222)
    at new YI (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:2334:151)
    at JGa (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:2396:348)
    at xa.program_ (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:2410:131)
    at za (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:21:57)
    at xa.throw_ (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:20:201)
    at Aa.throw (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:22:89)
    at c (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:22:343)
</code>```

I have not found a way to troubleshoot it or resolve it. There is nothing broken shown in the log, it says that its working as intended?

Body:
I started using Google Colab through the GCE VM, but I have not been able to initialize or upload any notebooks.

The error I am getting is The user has exceeded their Drive storage quota, but upon looking into my Storage, I have 15 GB of available storage, 0 bytes of 15 GB used.

Trying to fix it, I log in as the admin account and go to Storage, and then what shows is that 0 bytes of shared 0 bytes (100%) and it is in red. So I believe the is something wrong happening with the storage allocation or the store quota?

The virtual machine was ran with 200 GB space, so I cannot see the issue.

Full error when trying to upload a notebook:

The user has exceeded their Drive storage quota
GapiError: The user has exceeded their Drive storage quota
    at YI.YA [as constructor] (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:1433:2101)
    at YI.iH [as constructor] (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:2270:222)
    at new YI (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:2334:151)
    at JGa (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:2396:348)
    at xa.program_ (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:2410:131)
    at za (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:21:57)
    at xa.throw_ (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:20:201)
    at Aa.throw (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:22:89)
    at c (https://ssl.gstatic.com/colaboratory-static/common/456ec723e499489081e770703ac07ab8/external_polymer_binary.js:22:343)

I have not found a way to troubleshoot it or resolve it. There is nothing broken shown in the log, it says that its working as intended?


问:
Stopping and starting a service present in server.xml using tomcat manager application/api (Single tomcat instance)
I have multiple services defined in server.xml and below is the one which i need to restart(stop and start again) using tomcat manager application/api.

```<code>    <Service name="myService">
    <Executor name="myExecutorPool" namePrefix="my-http-pool"
        maxThreads="10" minSpareThreads="1"/>
    <Connector
         port="8701" protocol="org.apache.coyote.http11.Http11Nio2Protocol" SSLEnabled="true"
         executor="myExecutorPool"
         maxSavePostSize="-1"
         scheme="https" secure="true"
         enableLookups="false" disableUploadTimeout="true"
         acceptCount="100"
         sslEnabledProtocols="${sslEnabledProtocolsMediumSecurity}" server=" "
         allowUnsafeLegacyRenegotiation="false"
         clientAuth="want"
         bindOnInit="false"
         URIEncoding="UTF-8"
         useBodyEncodingForURI="true"
         keystoreType="PKCS11"
         keyAlias="server"
         trustManagerClassName="com.example.com.myproj.cert.RestTrustManager"
         sendReasonPhrase="true"
         sslImplementationName="com.example.com.myproj.cert.MyProjImplementation"
         ciphers="${tls.ciphers}"
     />
    <Engine name="myEngine" defaultHost="localhost">
      <Valve className="org.apache.catalina.valves.MethodsValve" methodsSupported="GET,POST,PUT,DELETE,HEAD" />
      <Host name="localhost"  appBase="mywebapp"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
            <Context path="" docBase="../webapps/ROOT" >
              <Valve className="org.apache.catalina.valves.RedirectValve" sendToApp="/myapp/" />
            </Context>
      </Host>
    </Engine>
  </Service>
</code>```

When i do curl -username:password http://localhost:8080/manager/text/list , i don't see this above service listed. It means i assume that, this service is not running as a separate service but contained inside appserver.

So i won't be able to do something like http://localhost:8080/manager/text/reload?path=/myService.

Can you please help here, how do i stop/start (restart) this particular service using tomcat manager app?

If JMX can be used here, can you please provide any links/resources for the same mentioning how to do that?

Body:
I have multiple services defined in server.xml and below is the one which i need to restart(stop and start again) using tomcat manager application/api.

    <Service name="myService">
    <Executor name="myExecutorPool" namePrefix="my-http-pool"
        maxThreads="10" minSpareThreads="1"/>
    <Connector
         port="8701" protocol="org.apache.coyote.http11.Http11Nio2Protocol" SSLEnabled="true"
         executor="myExecutorPool"
         maxSavePostSize="-1"
         scheme="https" secure="true"
         enableLookups="false" disableUploadTimeout="true"
         acceptCount="100"
         sslEnabledProtocols="${sslEnabledProtocolsMediumSecurity}" server=" "
         allowUnsafeLegacyRenegotiation="false"
         clientAuth="want"
         bindOnInit="false"
         URIEncoding="UTF-8"
         useBodyEncodingForURI="true"
         keystoreType="PKCS11"
         keyAlias="server"
         trustManagerClassName="com.example.com.myproj.cert.RestTrustManager"
         sendReasonPhrase="true"
         sslImplementationName="com.example.com.myproj.cert.MyProjImplementation"
         ciphers="${tls.ciphers}"
     />
    <Engine name="myEngine" defaultHost="localhost">
      <Valve className="org.apache.catalina.valves.MethodsValve" methodsSupported="GET,POST,PUT,DELETE,HEAD" />
      <Host name="localhost"  appBase="mywebapp"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
            <Context path="" docBase="../webapps/ROOT" >
              <Valve className="org.apache.catalina.valves.RedirectValve" sendToApp="/myapp/" />
            </Context>
      </Host>
    </Engine>
  </Service>

When i do curl -username:password http://localhost:8080/manager/text/list , i don't see this above service listed. It means i assume that, this service is not running as a separate service but contained inside appserver.

So i won't be able to do something like http://localhost:8080/manager/text/reload?path=/myService.

Can you please help here, how do i stop/start (restart) this particular service using tomcat manager app?

If JMX can be used here, can you please provide any links/resources for the same mentioning how to do that?


问:
AttributeError: module 'tensorflow' has no attribute 'reshape'
I am using tensorflow for a long time, and when I try to run my code on jupyter notebook (having latest version of keras and tensorflow installed with pip), I get the following error when I try to reshape a tensor:

```<code>def loss_nrmse():
    def nrmse(y_true, y_pred):
        """
        Normalized Root Mean Squared Error (NRMSE)

        Parameters
        ----------
        y_true: np.array
            Ground truth samples
        y_pred: np.array
            predicted samples

        Returns
        -------
        nrmse: float
            Normalized root mean squared error
        """
        y_true = tf.reshape(y_true[:,:,:,0], y_pred.shape) # PROBLEM IS HERE

        one_data_shape = (1, y_pred.shape[1], y_pred.shape[2] , y_pred.shape[3])
        values = []
        for i in range(len(y_true)):
            y_t = tf.reshape(y_true[i], one_data_shape)
            y_p = tf.reshape(y_pred[i], one_data_shape)
            diff = tf.keras.backend.max(y_t) - tf.keras.backend.min(y_t)
            val = RootMeanSquaredError()(y_t, y_p) / diff
            values.append(val)
        return np.mean(values)
    return nrmse
</code>```

and I get the only error:

AttributeError: module 'tensorflow' has no attribute 'reshape'

Could you help me please ?

Body:
I am using tensorflow for a long time, and when I try to run my code on jupyter notebook (having latest version of keras and tensorflow installed with pip), I get the following error when I try to reshape a tensor:

def loss_nrmse():
    def nrmse(y_true, y_pred):
        """
        Normalized Root Mean Squared Error (NRMSE)

        Parameters
        ----------
        y_true: np.array
            Ground truth samples
        y_pred: np.array
            predicted samples

        Returns
        -------
        nrmse: float
            Normalized root mean squared error
        """
        y_true = tf.reshape(y_true[:,:,:,0], y_pred.shape) # PROBLEM IS HERE

        one_data_shape = (1, y_pred.shape[1], y_pred.shape[2] , y_pred.shape[3])
        values = []
        for i in range(len(y_true)):
            y_t = tf.reshape(y_true[i], one_data_shape)
            y_p = tf.reshape(y_pred[i], one_data_shape)
            diff = tf.keras.backend.max(y_t) - tf.keras.backend.min(y_t)
            val = RootMeanSquaredError()(y_t, y_p) / diff
            values.append(val)
        return np.mean(values)
    return nrmse

and I get the only error:

AttributeError: module 'tensorflow' has no attribute 'reshape'

Could you help me please ?