webkitSpeechRecognition keep listening always without ask for more than one permission

I am using webkitSpeechRecognition to my app, but after some time it stops, and I need that keep listening all the time, how can I do that?.

I have watched examples through internet, but they are old and the most of them have an implementation like this function that starts again

recognition.onend = function(event){
    recognition.start();
}

I use it, but always that I finish to speak I need to give permission in the browser.

enter image description here

I don’t know if by browser politics I need to give permission always that I use my microphone.

PHP Script is creating an empty row along with desired row

Currently using React for frontend, php for backend with XAMPP/Apache. When I send a POST using the fetch API, It creates two rows in my table, one empty and one with the correct details. I have verified that the js function only runs once (strict mode not the problem), and verified that the php code runs twice. I am fairly new to php and fetch and am at a loss as to why this is happening.

First row is made incorrectly on first run, not sure how. Second is correct.
enter image description here

register.php:

<?php
require_once('cors.php');
require_once('db_connection.php');

$data = json_decode(file_get_contents('php://input'), true);

$username = $data['username'];
$email = $data['email'];
$password = $data['password'];

$street = $data['street'];
$state = $data['state'];
$country = $data['country'];

$fname = $data['fname'];
$lname = $data['lname'];
$phone_number = $data['phone'];

$hashed_password = password_hash($password, PASSWORD_DEFAULT);

error_log(print_r($country, TRUE)); // prints twice
$sql = "INSERT INTO User (Email, `Password`, Street, `State`, Country, `First Name`, `Last Name`, `Phone Number`, Username)
 VALUES ('$email', '$hashed_password', '$street', '$state', '$country', '$fname', '$lname', '$phone_number', '$username')";
$result = $conn->query($sql);

if ($result === TRUE) {
    echo json_encode(array("success" => "Account Created Successfully"));
} else {
    echo json_encode(array("error" => "There was an error in your submission"));
}

$conn->close();
?>

register.jsx excerpt

  const onSubmit = e => {

      e.preventDefault() // only prints once
      console.log('hello')
      if (password === rePassword) {

        fetch('http://localhost/teashop/php/register.php', {
            method: 'POST',
            headers: {
              'Content-Type': 'application/json'
            },
            body: JSON.stringify(formData)
          })
          .then(response => response.json())
          .then(data => {
            
            if ('success' in data) {
              setDisplay('login');
            }
          })
          .catch(error => {
            console.error('Error fetching products:', error);
          }
        );

Implement Map using composite unordered keys

In javascript a Map allows uniquely retrieving a “value” based on a single associated “key” – like so:

let m = new Map();
m.set('a', 'my value');

let v = m.get('a'); // v === 'my value'

How can we implement a data structure which uses multiple unordered keys to retrieve an associated value? In such a case the “key” value would always be an array. Let’s call this a “CompoundMap”. Let’s allow a CompoundMap to be instantiated with a “width” value, giving a fixed-size for its compound keys. Like Map, the values used in CompoundMap keys should be able to be anything (e.g. String, Number, Object, Regex, ClientRequest… whatever) E.g.:

let cm = new CompoundMap({ width: 2 });
cm.set([ 'a', 1 ], 'my value');

let v1 = cm.get([ 'a', 1 ]); // v1 === 'my value'
let v2 = cm.get([ 1, 'a' ]); // v2 === 'my value'
let v3 = cm.get([ 'a', 2 ]); // v3 === undefined
let v4 = cm.get([ 'b', 1 ]); // v4 === undefined
let v5 = cm.get([ 2, 'a' ]); // v5 === undefined
let v6 = cm.get([ 1, 'b' ]); // v6 === undefined

One way I can think of is to use a nested trees of Maps:

class CompoundMap {
  
  constructor({ width, entries }) {
    
    if (!width && entries) width = entries[0]?.[0]?.length;
    if (!width) throw Error('Must provide "width"');
    
    Object.assign(this, { width, tree: new Map() });
    
    for (let [ cmpKey, val ] of entries ?? []) this.set(cmpKey, val);
    
  }
  
  * treeSearch(tree, cmpKey) {
    
    if (cmpKey.length === 0) throw Error('Compound key should have at least one item');
    
    // A `cmpKey` with length 1 is our "base case"; return the "tree" we reached, and the final key
    if (cmpKey.length === 1) return yield { tree, finalKey: cmpKey[0] };
    
    for (let [ n, key ] of cmpKey.entries()) {
      
      let subtree = tree.get(key);
      
      // If no `subtree`, `key` doesn't apply at this current depth
      if (!subtree) continue;
      
      // We found a `subtree` - we still need to process the remaining key, which is `cmpKey` with `key` removed
      let cmpKeyMinusKey = (() => {
        let copy = [ ...cmpKey ];
        copy.splice(n, 1); // `n` is the index of `key` in `copy`
        return copy;
      })();
      
      // Now recursively search for the rest of the key! Note `yield*` helps us implement backtracking - a
      // search down some specific chain of subtrees may not succeed, but the overall search could still
      // succeed when another chain of subtrees is able to fully consume the `cmpKey`
      // (This is also why the runtime for this approach will be horrible...)
      yield* this.treeSearch(subtree, cmpKeyMinusKey);
      
    }
    
  }
  
  set(cmpKey, val) {
    
    if (cmpKey.length !== this.width) throw Error(`Compound key must have exactly ${this.width} item(s)`);
    
    let preexisting = this.treeSearch(this.tree, cmpKey).next().value;
    
    if (preexisting) {
      
      // Overwrite existing item
      // `this.treeSearch` yields `{ tree, finalKey }`, so overwriting is very simple
      let { tree, finalKey } = preexisting;
      tree.set(finalKey, val);
      
    } else {
      
      // Write new item
      let tree = this.tree;
      for (let k of cmpKey.slice(0, -1)) {
        if (!tree.has(k)) tree.set(k, new Map());
        tree = tree.get(k);
      }
      
      tree.set(cmpKey.at(-1), val);
      
    }
    
    return this;
    
  }
  
  get(cmpKey) {
    
    if (cmpKey.length !== this.width) throw Error(`Compound key must have exactly ${this.width} item(s)`);
    
    let preexisting = this.treeSearch(this.tree, cmpKey).next().value;
    if (!preexisting) return undefined;
    
    let { tree, finalKey } = preexisting;
    return tree.get(finalKey);
    
  }
  
}

let obj1 = { desc: 'obj' };
let obj2 = { desc: 'obj' };
let tests = [
  
  {
    entries: [
      { cmpKey: [ 'a', 1 ], val: 'my value' },
    ],
    lookups: [
      { cmpKey: [ 'a', 1 ], expected: 'my value' },
      { cmpKey: [ 1, 'a' ], expected: 'my value' },
      { cmpKey: [ 'a', 2 ], expected: undefined },
      { cmpKey: [ 'b', 1 ], expected: undefined },
      { cmpKey: [ 2, 'a' ], expected: undefined },
      { cmpKey: [ 1, 'b' ], expected: undefined }
    ]
  },

  {
    entries: [
      { cmpKey: [ 'a', 'b', 'c' ], val: obj1 },
      { cmpKey: [ 'c', 'd', 'e' ], val: obj2 }
    ],
    lookups: [
      { cmpKey: [ 'a', 'd', 'e' ], expected: undefined },
      { cmpKey: [ 'c', 'b', 'a' ], expected: obj1 },
      { cmpKey: [ 'd', 'e', 'c' ], expected: obj2 }
    ]
  }
  
];

for (let { entries, lookups } of tests) {
  
  let cm = new CompoundMap({ entries: entries.map(({ cmpKey, val }) => [ cmpKey, val ]) });
  
  for (let { cmpKey, expected } of lookups) {
    
    let received = cm.get(cmpKey);
    
    if (received !== expected) {
      console.log(`Test Failed! Expected [ ${cmpKey.join(', ')} ] -> ${JSON.stringify(expected)} ... BUT GOT ${JSON.stringify(received)}`);
    } else {
      console.log(`Test Passed! [ ${cmpKey.join(', ')} ] -> ${JSON.stringify(expected)}`);
    }
    
  }
  
}

If you follow the above logic, however, you will see that the runtime is horrible – I think it’s at least exponential (O(2^n)). Can a CompoundMap be implemented more efficiently?

If we could somehow map arbitrary values to BigInts, through a function like getUniqueIntFor, we could map compound keys to single unique Strings:

let compoundKey = [ 1, 2, 'j', /my regex/u, { arr: [] }, new HttpServer() ];
let uniqueString = compoundKey
  .map(anyValue => getUniqueIntFor(anyValue).toString(36))
  .sort()
  .join('.');

Given this ability, it’s arbitrary to implement CompoundMap. But how to implement getUniqueIntFor?

Is this idea worthwhile?

Otherwise, how can I implement CompoundMap more efficiently?

Handling Square Terminal Transactions with Webhooks

I’m relatively new to working with webhooks and I’m currently integrating Square Terminal transactions into my web application. Specifically, I’m trying to implement a workflow where I can display a spinner while initiating the checkout using the Square Terminal API, and then hide the spinner upon receiving a webhook event indicating the completion of the payment.

Here’s the workflow I’m trying to achieve:

  1. When a user clicks the “Pay Now” button on my web application, I
    want to display a spinner to indicate that the payment is being
    processed. Upon clicking the button, I make a call to the Square
    Terminal API to initiate the checkout. Once the checkout initiation
    is successful, I receive a checkout ID from the API response.
  2. While waiting for the payment to be completed, I continue to display the
    spinner.
  3. When the payment is completed and I receive a webhook event
    indicating the success of the transaction, I want to hide the
    spinner and display a confirmation message to the user.

I’m struggling to implement this workflow efficiently, especially regarding how to handle the spinner display during the checkout initiation and webhook event processing. Can someone provide guidance on how to structure this workflow effectively? Any code examples or suggestions would be greatly appreciated.

Thank you in advance!

I’m not able to render data in the prime react editor

b static data also isn’t rendering in the PrimeReact Editor.There is data in the the backend the data is coming in fine but it doesn’t show up on the editor

I was trying to render the data to get to display it on the editor but even static data seems to fail nothing shows up on the editor, I’m able to type in it though

Angular cdk drag and drop horizontally and vertically

See the below Code to interchange the position of charts and tables inside a container using angular cdk

<ng-template #noFullScreenTemplate>
      <div class="row" #container (window:resize)="onResize($event)" cdkDropListGroup>
        <ng-container *ngFor="let graph of graphs; let i = index">
          <div
            class="column"
            cdkDropList
            cdkDropListOrientation="horizontal"
            [cdkDropListData]="{ graph: graph, index: i }"
            (cdkDropListDropped)="drop($event)"
          >
            <div *ngIf="graph.type === 'graph'" cdkDrag>
              <lib-window-graph
                [graph]="toGraph(graph)"
                (selectedGraphEvent)="getSelectedGraph($event)"
                (fullscreenLayoutEvent)="getFS($event)"
                (dragShapeEvent)="draggedShape($event)"
              ></lib-window-graph>
            </div>
            <div *ngIf="graph.type === 'table'" cdkDrag>
              <lib-window-table
                [graph]="toTable(graph)"
                (selectedGraphEvent)="fullscreen($event)"
                [selectedChannelHarmonicTable]="selectedChannelHarmonicTable"
              ></lib-window-table>
            </div>
          </div>
        </ng-container>
      </div>
    </ng-template>

When attempts to pan horizontally , instead of panning, the panel is lifted and is rearranged. Need to correct position interchange of dragged item to the dropped index. This need to be work in both horizontal and vertically

Why I keep getting this error , though I am passing the same metaData that i got from sharp “Width and height must match the pixels array”

I want to get image’s BlurHash so first I’m taking the raw Binary and passing it to sharp() function to get metaData and then pass it to blurHash function but it keep giving me this error
Width and height must match the pixels array

Here is my code

async function imgEncoder() {
    try {
        const res = await axios("https://s4.anilist.co/file/anilistcdn/media/anime/banner/132473-Lxge5Xq2A6HC.jpg", { responseType: 'arraybuffer' });
        const imageBuffer = res.data;

        // Log the image buffer to check if it's retrieved correctly
        console.log("Image Buffer:", imageBuffer);

        // Get metadata using sharp
        const metaData = await sharp(imageBuffer).raw().metadata();
        console.log("Metadata:", metaData);

        const { width, height } = metaData;
        const blurhash = encode(width, height, new Uint8ClampedArray(imageBuffer));
        console.log("Blurhash:", blurhash);
    } catch (err) {
        console.log("Error: " + err.message);
    }
}

imgEncoder();

Thanks in Advance 🙂
Please Help

Hostinger preview site is correct, but actual domain is incorrect

I’ve been trying to upload my website files to a hosting site. I’ve got my domain pointed at the Hostinger nameservers now, but my actual domain is displaying the incorrect site – even after updating my files in Hostingers file manager.

the website domain is: henrymiles.co.uk & the preview is: https://henrymiles-co-uk.preview-domain.com

I think that by me using webpack it has complicated things out of the reach of my ability really. But it was something I wanted to try out. If there’s any possibility that someone could help or give some advice, it would be really appreciated. Please also ask for any files or anything else that I may need to post to better illustrate the potential problem, thanks.

Domain version (not displaying site correctly)

Preview version from hostinger (correctly displaying)

I think there could be an issue with where the webpack.config.js is pointing certain files, it might not be grabbing or able to reach the stylesheet as well. I’m really not sure though. I’ve tried changing the..

output: {
    filename: 'main.js',
    path: path.resolve(__dirname, 'dist'),
  }

to...

output: {
    filename: 'main.js',
    path: path.resolve(__dirname, 'public_html'),
  }

because I thought it is an issue with where the main.js is getting placed. But this doesn’t work for me.

Thanks for any help.

Update canvas on mouse move

The basic idea comes from the map of a game. According to the my code review, the map is a full-page canvas. I have no problem with drawing images on canvas. My question is how to detect map houses and update the canvas or even add click ability to it.
I have attached a GIF and HTML code from the original game to better understand my request.

enter image description here

<div id="canvasBorder"><canvas id="canvasMap"></canvas></div>

Okay, This is my code. It’s simple. I have drawn the map houses according to the main image which is large on the canvas.

function onClick2() {
  const imagePath = '/lobby/map.png';

  //Image Positions and Width/Height
  const array = [
    { x: 1764, y: 1104, w: 126, h: 84 },
    { x: 0, y: 1188, w: 126, h: 84 },
    { x: 126, y: 1188, w: 126, h: 84 },
    { x: 2090, y: 340, w: 126, h: 68 },
    { x: 126, y: 1188, w: 126, h: 84 },
  ];

  if (canvasRef?.current) {
    let x = canvasRef?.current.getContext('2d');

    let img = new Image();
    img.src = path;

    //Draw Map Blocks
    //Here I deleted the extra codes, I just wanted to show that it was done this way.
    if (x) {
      x.drawImage(
        img,
        array[3].x,
        array[3].y,
        array[3].w,
        array[3].h,
        0,
        0,
        array[3].w,
        array[3].h
      );
    }
  }
}

This is my result:
enter image description here

Here I need your guidance to understand the implementation trick. Here we need to recognize the mouse movement on the image or we need a number of squares that are rotated and have the image and work with the isPointInPath function.
If we proceed with the second way that I mentioned, to draw the squares, we need rotate(-0.25 * Math.PI);

Update canvas on mouse move

The basic idea comes from the map of a game. According to the my code review, the map is a full-page canvas. I have no problem with drawing images on canvas. My question is how to detect map houses and update the canvas or even add click ability to it.
I have attached a GIF and HTML code from the original game to better understand my request.

enter image description here

<div id="canvasBorder"><canvas id="canvasMap"></canvas></div>

Okay, This is my code. It’s simple. I have drawn the map houses according to the main image which is large on the canvas.

function onClick2() {
  const imagePath = '/lobby/map.png';

  //Image Positions and Width/Height
  const array = [
    { x: 1764, y: 1104, w: 126, h: 84 },
    { x: 0, y: 1188, w: 126, h: 84 },
    { x: 126, y: 1188, w: 126, h: 84 },
    { x: 2090, y: 340, w: 126, h: 68 },
    { x: 126, y: 1188, w: 126, h: 84 },
  ];

  if (canvasRef?.current) {
    let x = canvasRef?.current.getContext('2d');

    let img = new Image();
    img.src = path;

    //Draw Map Blocks
    //Here I deleted the extra codes, I just wanted to show that it was done this way.
    if (x) {
      x.drawImage(
        img,
        array[3].x,
        array[3].y,
        array[3].w,
        array[3].h,
        0,
        0,
        array[3].w,
        array[3].h
      );
    }
  }
}

This is my result:
enter image description here

Here I need your guidance to understand the implementation trick. Here we need to recognize the mouse movement on the image or we need a number of squares that are rotated and have the image and work with the isPointInPath function.
If we proceed with the second way that I mentioned, to draw the squares, we need rotate(-0.25 * Math.PI);

LoadingOverlay iterate many overlays and hide programmatically

I’m working with this libraray
https://gasparesganga.com/labs/jquery-loading-overlay/

Example: To show an overlay for an element:

$("body").LoadingOverlay("show", {});

Example: To hide an overlay for an element:

$("body").LoadingOverlay("hide", true);

I can call hide and show explicitly and it will work as expected.

I want to iterate over all overlays and hide them programmatically. What I tried doesn’t work.

I appreciate any assistance you can provide. Thank you as always!

`

$("body").LoadingOverlay("show", {});
$("#scotty").LoadingOverlay("show", {});

////These work when explicitly called
//$("body").LoadingOverlay("hide", true);
//$("#scotty").LoadingOverlay("hide", true);

//I want to interate over all overlays and hide them programatically. 
//This code will not hide the overlays.
$(".loadingoverlay").each(()=>{
    $(this).LoadingOverlay("hide", true);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/loadingoverlay.min.js"></script>

<img id="scotty" src="https://i.imgflip.com/1pg0vt.jpg" alt="" width="300">

`Hi, I have a list of nodes that

Load and process csv file in javascript

I am trying to load a csv file in javascript and filter it based on the values within it. My csv file was created with the following r script:

d <- structure(list(U = c("a", "b", "c", "d", "e", "f"), 
                    T = c(1, 2, 3, 4, 5, 6), 
                    aE = c("X", "Y", "Y", "Y", "Y", "Y"), 
                    aA = c("R", "S", "S", "T", "U", "V"), 
                    aX = c("P", "Q", "Q", "W", "P", "P"), 
                    aP = c("Z", "A", "A", "A", "Z", "A"), 
                    aJ = c("K", "L", "L", "K", "K", "L"), 
                    aD = c("C", "B", "B", "B", "D", "D"), 
                    bE = c("X", "Y", "Y", "X", "X", "Y"), 
                    bA = c("G", "R", "R", "I", "I", "T"), 
                    bX = c("M", "N", "N", "O", "M", "O"), 
                    bP = c("Z", "A", "A", "Z", "A", "Z"), 
                    bJ = c("K", "L", "L", "L", "K", "L"), 
                    bD = c("B", "C", "C", "C", "B", "C")), 
               row.names = c(NA, -6L), 
               class = c("tbl_df", "tbl", "data.frame"))

write.csv(d, "data.csv")

I then load it in javascript and attempt to process it using the following code:

$(document).ready(function() {
    var task = '1';
    var userID = 'a';

    fetch('https://raw.githubusercontent.com/username/repo/main/data.csv')
        .then(response => response.text())
        .then(csvData => {
            // Parse CSV data into an array of rows
            var rows = csvData.trim().split('n');

            // Extract headers and trim whitespace
            var headers = rows[0].split(',').map(header => header.trim());

            // Extract and parse each row (excluding headers)
            var data = rows.slice(1).map(row => {
                var rowValues = row.split(',').map(value => value.trim());
                var rowData = {};

                headers.forEach((header, index) => {
                    rowData[header] = rowValues[index];
                });

                return rowData;
            });

            console.log('Parsed Data:', data);

            // Filter data to only include rows that match the specified task and userID
            var filteredData = data.filter(row => row['T'] === task && row['U'] === userID);

            console.log('Filtered Data:', filteredData);

            // Display the filtered row in the HTML document
            if (filteredData.length > 0) {
                var resultRow = filteredData[0]; // Get the first (and only) matching row
                displayResultRow(resultRow); // Call function to display the row in the document
            } else {
                console.log('No matching row found.');
                // Handle case where no matching row is found
            }

            return filteredData; // Return the filtered array of data objects
        })
        .then(filteredData => {
            console.log('Returned Filtered Data:', filteredData);
            // Use the returned filtered array of data objects here or perform additional actions
        })
        .catch(error => {
            console.error('Error fetching or processing CSV:', error);
            // Handle fetch or processing errors
        });

    function displayResultRow(row) {
        // Assuming there is a container in your HTML document with id="resultContainer"
        var resultContainer = document.getElementById('resultContainer');
        
        // Clear previous content
        resultContainer.innerHTML = '';

        // Create and append elements to display the row data
        Object.keys(row).forEach(key => {
            var rowElement = document.createElement('div');
            rowElement.textContent = `${key}: ${row[key]}`;
            resultContainer.appendChild(rowElement);
        });
    }
});

The initial data loading works, as I am able to successfully see the data object. However none of the processing works successfully. I believe this is because the columns and rows may not be created correctly. This is how the data object looks in my js code editor:

Parsed Data:
(6) [{...}, {...}, {...}, {...}, {...}, ...]
0
:
(15) {"": ""1"", "U": ""1...}
1
:
(15) {"": ""2"", "U": ""2...}
2
:
(15) {"": ""3"", "U": ""3...}
3
:
(15) {"": ""4"", "U": ""4...}
4
:
(15) {"": ""5"", "U": ""5...}
5
:
(15) {"": ""6"", "U": ""6...}

This seems to me like the row numbers are being read in, and the column headers are treated as other values of some sort. In any case, the data filtering is not working. I also am unsure how to store the data object to access it.

How can I take the csv file that I successfully load into javascript, process it to select the only row that has U = the specified userID above, and T = the specified task above? How can I store this row as an object (say, entitled info_object) so that I can then extract the specific values of particular columns within that row (ex: save the value of aE as the object “info_aE”)?

json_encode (php) and json_parse (js) [closed]

I read the database with php and pack the contents into a Json:

$lbtb_json = json_encode($lbtbs);

In Javascript I get the values. When I with

this.lbtbdata = lbtb_json;    
window.console.log(this.lbtbdata);

Outputting the data, I get the following:
before parse

If I do the following in Javascript:

this.lbtbdata = lbtb_json;    
this.events = JSON.parse(this.lbtbdata);
window.console.log(this.events);

I get the following:

after parse

I would like to be able to output the following:
this.events[‘id’] or
this.events[‘date’] and so on.

Why don’t I get any more values after parsing? How do I get the values to be output individually, as described above?

Picklist values are not showing in the LWC Datatable

import { LightningElement,track,wire,api} from 'lwc';
import { updateRecord, deleteRecord} from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { refreshApex } from '@salesforce/apex';
import { getObjectInfo, getPicklistValues } from 'lightning/uiObjectInfoApi';
import OPPORTUNITYPRODUCT_OBJECT from '@salesforce/schema/OpportunityLineItem'; 
import DISCOUNT_TYPE from '@salesforce/schema/OpportunityLineItem.Discount_Type__c'; 

import getOpportunityLineItems from '@salesforce/apex/OpportunityLineItemController.getOpportunityLineItems';

const columns = [
{ label: 'ProductLineItemName', fieldName: 'ProductLineItemName__c'},
{ label:'Quantity', fieldName:'Quantity',editable:true},
{ label: 'Sales Price', fieldName: 'UnitPrice', editable:true},
{ label: 'Discount Value', fieldName: 'Discount_Value__c', editable:true},
{
    label: 'Discount Type',
    fieldName: 'Discount_Type__c',
    type: 'customPicklist',
    editable: true,
    typeAttributes: {
       
        options:{fieldName:'pickListOptions'},
        value: { fieldName: 'Discount_Type__c'},
        context:{ fieldName: 'Id'}
        
    }
},
{ label: 'GST %', fieldName: 'GST__c', editable:true},


{
    type: "button",
    typeAttributes: {
        iconName: "utility:delete",
        name: "deleteOpportunity",
        variant: "destructive",
        iconSize: "x-small",
        class: "small-button"
    }
}

];

export default class OpportunityLineItemsEditor extends LightningElement {

@api recordId;

opportunityLineData=[];
columns = columns;
draftValues=[];
oppLineProp;
discountTypeOptions=[];

@wire(getObjectInfo, { objectApiName: OPPORTUNITYPRODUCT_OBJECT })
    opportunityProductInfo;

    @wire(getPicklistValues, {
        recordTypeId: '$opportunityProductInfo.data.defaultRecordTypeId',
        fieldApiName: DISCOUNT_TYPE
    })
    wiredPicklistValues({ data, error }) {
        if (data) {
            this.discountTypeOptions = data.value;
        } else if (error) {
            console.error('Error fetching picklist values', error);
        }
    }


@wire(getOpportunityLineItems,{
    opportunityId:'$recordId',pickList:'$discountTypeOptions'
}) getOpportunityLine(result){
    this.oppLineProp=result;

    if(result.data)
    {
        this.opportunityLineData=JSON.parse(JSON.stringify(result.data));
        this.opportunityLineData=result.data.map((currItem) =>{
            let pickListOptions = this.discountTypeOptions;
            return {
                ...currItem,
                pickListOptions:pickListOptions
                
                //pickListOptions:picklistOptions
            }
        });

    }
    else if(result.error)
    {
        console.log('error while loading records');
    }


}

async handleSave(event)
{

    let records=event.detail.draftValues;
    let updateRecordsArray= records.map((currItem) => {
        let fieldInput = {...currItem};
        return{
            fields:fieldInput
        };

    });

    this.draftValues=[]
    let updateRecordsArrayPromise=updateRecordsArray.map((currItem) => updateRecord(currItem));

    await Promise.all(updateRecordsArrayPromise);

    const toastEvent = new ShowToastEvent({
        title: 'Success',
        message:
            'Records Updated Successfully',
            variant:'success'
    });
    console.log('Dispatching toast event...');
    this.dispatchEvent(toastEvent);
    console.log('Toast event dispatched.');
    await refreshApex(this.oppLineProp);

}

async handleRowAction(event) {
    if (event.detail.action.name === "deleteOpportunity") {
        deleteRecord(event.detail.row.Id).then(() => {
            
            this.dispatchEvent(
                new ShowToastEvent({
                    title: 'Success',
                    message: "Record deleted successfully!",
                    variant: 'success'
                })
            );
        }).catch((error) => {
            console.log("error, " + error);
            this.dispatchEvent(
                new ShowToastEvent({
                    title: 'Error deleting record',
                    message: error.body.message,
                    variant: 'error'
                })
            );
        })
    }

    await refreshApex(this.oppLineProp);
}

}

I have create a custom type Datatable here which extends standard LWC Datatable. Also, create an extra HTML file customPicklist.html, customPickListEdit.html so we can put the Picklist Combobox and its static value here. Below image of the structure

enter image description here

My code is working fine apart from picklist values so could you please tell me where i’m making mistake?

in our thesis, we have system should post the photo result of the detect if the detect_face funtion in the index.html

this is my code

# Define a global variable to track whether the video feed has finished
def detect_faces(username):
    global video_feed_finished

    video_capture = cv2.VideoCapture(2)  # Access the webcam (change to the appropriate device index if necessary)

    start_time = time.time()  # Record the start time
    while True:
        _, frame = video_capture.read()  # Read a frame from the webcam

        # Check if 5 seconds have elapsed
        if time.time() - start_time > 5:
            # Set the flag to indicate that the video feed is finished
            video_feed_finished = True
            # Stop processing frames after 5 seconds
            break

        # Perform face recognition using FaceNet model of DeepFace
        result = DeepFace.analyze(frame, detector_backend='mtcnn')

        # Insert the result into the MySQL database
        insert_result_into_database(username, result)

        calculate_age_difference(username)

        # Save the image to the database
        save_image_to_database(username, cv2.imencode('.jpg', frame)[1].tobytes())

        # Process the result as needed
        # For example, you can print the result to the console
        print(result)

        # Encode the analyzed frame as JPEG
        ret, jpeg = cv2.imencode('.jpg', frame)
        frame_bytes = jpeg.tobytes()

        # Yield the frame bytes as a response
        yield (b'--framern'
               b'Content-Type: image/jpegrnrn' + frame_bytes + b'rn')

    video_capture.release()

# Route for video feed here where it redirect to the index.html
@app.route('/video_feed')
def video_feed():
    global video_feed_finished

    # Check if the video feed is finished
    if video_feed_finished:
        # If finished, redirect to the login page
        return redirect(url_for('login'))

    # Start the face detection process
    return render_template('index.html')

@app.route('/video_feed_data', methods=['POST'])
def video_feed_data():
    if request.method == 'POST':
        username = request.form['username']
        return generate_video_feed(username)
    else:
        return "Method not allowed"
    
@app.route('/generate_video_feed')
def generate_video_feed(username):
    return Response(detect_faces(username), mimetype='multipart/x-mixed-replace; boundary=frame')

in this code the video feed go to the the index.html where the result in video feed data must be shown in the index.html which is the result photo, instead of doing that it post the photo result in separate page because of the mimetype it leave the index.html.

this one is from my html code

<body>
    <div class="art-container">
        <div class="art-shape" style="background: skyblue; width: 100px; height: 100px; top: 20%; left: 10%;"></div>
        <div class="art-shape" style="background: skyblue; width: 80px; height: 80px; top: 70%; left: 80%;"></div>
        <div class="art-shape" style="background: skyblue; width: 120px; height: 120px; top: 40%; left: 50%;"></div>
    </div>

    <h1>Real-time Face Recognition</h1>

    <form id="username-form" method="post" action="{{ url_for('video_feed_data') }}">
        <!-- Other form fields -->
        <label for="username">Username:</label>
        <input type="text" id="username" name="username" required>
        <!-- Submit button -->
        <button type="submit">Submit</button>
    
    <div class="video-container">
        <img id="video-feed" src="{{ url_for('video_feed_data') }}" alt="Video Feed">
    </div>

    <!-- Add a button that appears after the video feed is done -->
    <div id="refresh-button-container">
        <button onclick="refreshPage()">Log In</button>
    </div>

    <div id="error-message" style="display: none;">
        <p>Face could not be detected. Please refresh the page.</p>
    </div>


    
    <!-- Include the JavaScript file -->
    <script src="{{ url_for('static', filename='js/script.js') }}"></script>
</body>

and my JavaScript

// script.js

// JavaScript function to refresh the page
function refreshPage() {
    location.reload();
}

// Function to display the error message
function showError() {
    // Show the error message div
    document.getElementById('error-message').style.display = 'block';
}

// Function to hide the error message
function hideError() {
    // Hide the error message div
    document.getElementById('error-message').style.display = 'none';
}

// Function to handle face detection success or failure
function detectFaceFailure() {
    // Check if there was an error loading the video feed
    const videoFeedError = document.getElementById('video-feed').naturalWidth === 0;

    if (videoFeedError) {
        // Show the error message if there was an error loading the video feed
        showError();
    } else {
        // Hide the error message if face detection was successful
        hideError();
    }
}

// Call the detectFaceFailure() function when the page loads (or at the appropriate time)
window.onload = detectFaceFailure;

// Check if the video feed has loaded successfully
document.getElementById('video-feed').onload = () => {
    console.log('Video feed loaded');
    // Show the refresh button
    document.getElementById('refresh-button-container').style.display = 'block';
};

// Handle error if face detection fails
document.getElementById('video-feed').onerror = () => {
    console.error('Error loading video feed');
    // Show the error message
    document.getElementById('error-message').style.display = 'block';
};

function toggleRefreshButton() {
    const username = document.getElementById('username').value;
    const refreshButtonContainer = document.getElementById('refresh-button-container');
    const errorMessage = document.getElementById('error-message');

    // Check if username is not empty
    if (username.trim() !== '') {
        refreshButtonContainer.style.display = 'block';
        errorMessage.style.display = 'none'; // Hide error message if shown
    } else {
        refreshButtonContainer.style.display = 'none';
    }
}

function refreshPage() {
    location.reload();
}