how controle height Row Bootstrap

Good evening
For BOOTSTRAP regulars,
By clicking on the link (medico-surgical consumable), there is a collapse of information (as in the photo),
But all the cards on the same “row” take place at the same time
(knowing that by removing ROW, there is no longer this problem, but I need it for position management)
How to make so that only the card concerned which will unfold while keeping the row function?

code :

me
Thanks in advance

            <div class="row justify-content-center" style="border: none;">

                        <div class="card dropdown dropdown-processed col-xl-3 col-md-6 mb-4 border-left-primary shadow h-150 py-2">
                            <div class="card-body">
                                <div class="row no-gutters align-items-center">
                                    <div class="col mr-2">
                                        <div class="text-xs font-weight-bold text-primary text-uppercase mb-1"> Catégorie </div>
                                        <a class="collapsed h6 mb-0 font-weight-bold text-gray-600" data-bs-toggle="collapse" data-bs-target="#cons" aria-expanded="true" aria-controls="cons"> Consommable <br> médico-chirurgical </a>
                                    </div>    
                                </div>
                                <div  id="cons" class="collapse" aria-labelledby="headingTwo">
                                    <ul class="ss_catg" style="list-style: none;">
                                        @foreach ( $cons as $con)
                                            <a class="collapse-item text-wrap" href="#"> {{$con->nom_ss_catg}} </a>
                                        @endforeach
                                    </ul>
                                </div>
                            </div>
                        </div>

                        <div class="card dropdown dropdown-processed col-xl-3 col-md-6 mb-4 border-left-success shadow h-150 py-2">
                            <div class="card-body">
                                <div class="row no-gutters align-items-center">
                                    <div class="col mr-2">
                                        <div class="text-xs font-weight-bold text-primary text-uppercase mb-1"> Catégorie </div>
                                        <a class="h6 mb-0 font-weight-bold text-gray-600 "  data-bs-toggle="collapse" data-bs-target="#cons" aria-expanded="true" aria-controls="equip" href="Equipements"> Equipements </a>
                                    </div> 
                                </div>

                                <div id="equip" class="collapse" aria-labelledby="headingTwo">
                                    <ul class="ss_catg" style="list-style: none;">
                                        @foreach ( $equips as $equip)
                                            <li><a href={{route('produits', [$equip->id,'0'])}}> {{$equip->nom_ss_catg}} </a></li>
                                        @endforeach
                                    </ul>
                                </div>

                            </div>
                        </div>

                        <div class="card col-xl-3 col-md-6 mb-4 border-left-danger shadow h-150 py-2">
                            <div class="card-body">
                                <div class="row no-gutters align-items-center">
                                    <div class="col mr-2">
                                        <div class="text-xs font-weight-bold text-primary text-uppercase mb-1"  data-bs-toggle="collapse" data-bs-target="#cons" aria-expanded="true" aria-controls="equip" href="Equipements"> Catégorie </div>
                                        <a class=" link h6 mb-0 font-weight-bold text-gray-600" href="Mobilier médical" >Mobilier médical</a>
                                    </div>
                                </div>

                                <div id="equip" class="collapse" aria-labelledby="headingTwo">
                                    <ul class="ss_catg" style="list-style: none;">
                                    @foreach ( $equips as $equip)
                                        <li><a href={{route('produits', [$equip->id,'0'])}}> {{$equip->nom_ss_catg}} </a></li>
                                    @endforeach
                                    </ul>
                                </div>
                                
                            </div>
                        </div>

                    </div>

Validate object that’s received from api and set defaults

I want to receive something from an api and validate if all fields are strings but if they are not present I want to set default values, I was planning to use yup and validate the object based on that so the object that I return from the function is typed

import { v4 } from "uuid";
import { array, object, string } from "yup";

let mySchema = array(
  object({
    id: string().default(() => v4()),
    title: string().default(""),
    description: string().default(""),
    courseVersions: array(
      object({
        courseCodeId: string().default(""),
        courseName: string().default(""),
      })
    ).default([]),
  })
);

export default function validateCourses(originalObject: any) {

  const cleanObject = mySchema.someFunction(originalObject); // Hope yup has a function

  console.log({ originalObject, cleanObject });

  return cleanObject;
}

Why is this iteration not getting the last values in col D (GAS)?

This is the data:

enter image description here

With the loop below, I’m trying to get the highlighted data, but the one next to Qtd/Peças doesn’t get pushed into the array.

function salvarCorte(status) {
  if (status != '') {
    const dadosCorte = sheetCorte.getRange(1, 1, sheetCorte.getLastRow(), sheetCorte.getLastColumn()).getValues();

    let dadosRiscos = [];
    const parametrosRisco = ["Risco", "Matéria Prima", "Molde", "Tamanho", "Grade", "Consumo Unit.", "Espelhado", "Tecido/Pé", "Obs", "Qtd/Peças"];
    for (let r = 0; r < dadosCorte.length; r++) {
      if (parametrosRisco.indexOf(dadosCorte[r][0]) > -1) {
        dadosRiscos.push(dadosCorte[r][1]);
        }
      if (parametrosRisco.indexOf(dadosCorte[r][2]) > -1) {
        dadosRiscos.push(dadosCorte[r][3]);
      }
    }
  }
}

Javascript – All Possible Combinations From Single Array Every Order

Javascript – Generating all combinations of elements in a single array (in pairs)

So I’ve seen this questions and I’ve seen some of the answers to it, but I was wondering if it was possible to get all combinations even if it’s a duplicate in every order possible.

ex.

var array = ["apple", "banana", "lemon", "mango"];

output

var result = [
   "apple"
   "apple banana"
   "apple banana lemon"
   "apple banana lemon mango"
   "apple lemon"
   "apple lemon banana mango"
   "apple lemon mango banana"
   "apple mango"
   "apple mango lemon banana"
   "apple mango banana lemon"
   ...
];

In the end I essentially want all possible combinations whether it be 1 item or pairs or multiple items in every possible order.

The closest answer I’ve seen is this set of code.

function getCombinations(valuesArray: String[])
{

var combi = [];
var temp = [];
var slent = Math.pow(2, valuesArray.length);

for (var i = 0; i < slent; i++)
{
    temp = [];
    for (var j = 0; j < valuesArray.length; j++)
    {
        if ((i & Math.pow(2, j)))
        {
            temp.push(valuesArray[j]);
        }
    }
    if (temp.length > 0)
    {
        combi.push(temp);
    }
}

combi.sort((a, b) => a.length - b.length);
console.log(combi.join("n"));
return combi;
}
let results = getCombinations(['apple', 'banana', 'lemon', ',mango']);

enter image description here

Wait for user response Role

    message.channel.send(``DBump Reminders` Have been enabled`)
    message.channel.send(``DBump Reminders` What role would you like to ping? If None response with N`)

    const returnedMessageContent = await new Promise((resolve) => {
  const messageCollector = message.channel.createMessageCollector({ time: 60000 });




  messageCollector.on('collect', (msg) => {
    if (msg.author.id !== message.author.id) return;
    if(msg.content === 'N') return message.channel.send('Enabled without Ping')
    console.log(message.mentions.roles.first())
    const role = message.mentions.roles.first()
    if(msg.content.replace(/D+/g, '') !== role.id){
   message.channel.send(`No Role was Found`)
  } else {
   message.channel.send(`${role} was set as the bump ping`)
  }


    messageCollector.stop();
    resolve(msg.content);
  });

  messageCollector.on('end', (collected, reason) => {
    if (reason === 'time') {
      message.channel.send('Time ran out, please call the command again');
      resolve(null);
    }
  });
 });

I’m trying to wait for user response however It can’t read mentioned roles

[Mursy] Unhandled Rejection: TypeError: Cannot read properties of undefined (reading ‘id’)
at MessageCollector. (C:UsersawesoDesktopMursy – CopyMursyFilesCommandsTesttest.js:36:49)
at MessageCollector.emit (node:events:390:28)
at MessageCollector.handleCollect (C:UsersawesoDesktopMursy – CopyMursynode_modulesdiscord.jssrcstructuresinterfacesCollector.js:109:12)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

this is the error I keep getting

show javascript alert box when a field is empty, if not show form elements in a table in another php file

its my first php exercice and i am asked to make a form in a php file and show result in another file i chose the post method
then i have been asked to show a javascript alert if a field is empty
the fist part was fine, but im struggling to mix php js in the submit button for the second part. i tried changing order of code i put the php and script below the form but it still didnt work
file 1

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>ex4</title>
</head>
<body>
    <?php 
    function check_input(){
        if ($_SERVER["REQUEST_METHOD"] == "POST") {
            if (empty($_POST['nom']) || empty($_POST['prenom']) || empty($_POST['adresse']) || empty($_POST['code_postal'])){
                echo "window.alert("un ou plusieurs champs ne sont pas remplis !");";
            }
        }
    }
    ?>
    <script>
        function myFunction() {
        <?php check_input(); ?>
        }
    </script>

    <form method="post" action="ex4sep.php">
        <fieldset style ="display: inline-block;">
        <legend>Informations Etudiants</legend>
        <table>
            <tr>
                <td style="width:50%;">nom</td>
                <td><input type="text" name="nom"></td>
            </tr>
            <tr>
                <td style="width:50%;">prenom</td>
                <td><input type="text" name="prenom"></td>
            </tr>
            <tr>
                <td style="width:50%;">adresse</td>
                <td><input type="text" name="adresse"></td>
            </tr>
            <tr>
                <td style="width:50%;">code postal</td>
                <td><input type="text" name="code_postal"></td>
            </tr>
            <tr>
            <td colspan="2"><input type="submit" onclick="myFunction"></td>
            <td></td>
            </tr>
        </table>
    </fieldset>
    </form>
</body>
</html>

file 2 of results

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>ex4sep</title>
</head>
<body>
    <table border>
            <tr>
                <td>nom</td>
                <td><?php echo $_POST['nom']; ?></td>
            </tr>
            <tr>
                <td>prenom</td>
                <td><?php echo $_POST['prenom']; ?></td>
            </tr>
            <tr>
                <td>adresse</td>
                <td><?php echo $_POST['adresse']; ?></td>
            </tr>
            <tr>
                <td>code postal</td>
                <td><?php echo $_POST['code_postal']; ?></td>
            </tr>
        </table>
</body>
</html>

Scripts not working in React, NextJS project unless I specifically refresh the page

I had to refactor a large codebase built on pure HTML, CSS, and javascript into a ReactJS and NextJS application. The codebase had a whole lot of links and scripts whereby some scripts applied for all pages while some applied for only specific pages.

In the set-up I did, I created a Meta.js file where I kept all links and scripts and also created a Layout.js file which held the Meta.js as well a common navbar and sidebar layout which was applied to all pages.

The issue I am facing presently now is that some scripts/functionality do not work unless the page is refreshed. For instance, I enter the application from the homepage which is the index.js file, and then navigate to the settings page, which is a settings.js file.

The settings.js page has some tab that uses some script in it but will not work unless I reload the page. What can be the issue with this and how can I fix this.

Here are some of the important files listed below:

Meta.js

import React from 'react'
import Head from 'next/head'
import Script from 'next/script'

const Meta = ({title, keywords, description}) => {
  return (
    <>
    <Head>
      <meta charSet="utf-8" />
      <meta content="Webflow" name="generator" />
    </Head>
    <Script src="https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js"></Script>
    <Script src='/CustomScript.js'></Script>
    <Script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js' strategy='beforeInteractive' crossOrigin="anonymous"></Script>
    <Script src='/webflow.js'></Script>
    <Script src='https://fengyuanchen.github.io/datepicker/js/datepicker.js'></Script>
    <Script src='https://cdn.jsdelivr.net/npm/flatpickr'></Script>
    <Script src='https://cdn.quilljs.com/1.3.6/quill.js' strategy='beforeInteractive'></Script>
    </>
  )
}

export default Meta

Layout.js

import Nav from "./Nav";
import Meta from "./Meta";

const Layout = ({children}) => {
  return ( 
    <>
    <Meta />
    <Nav/>
    <div className="body">
      <main>
        {children}
      </main>
    </div>
    </>
   );
}
 
export default Layout;

Nav.js

import React from 'react'
import Image from 'next/image'
import Link from 'next/link'

const Nav = () => {
  return (
    <div className="app-nav-layout">
            <Link href="#"><Image src="/listwise-logo-black-nospace.svg" width={130} height={130} alt="" className="left-navbar-logo" /></Link>
          </div>
          <nav role="navigation" className="left-navbar-menu w-nav-menu">
                  <Link href="/dashboard/listings/addListing">Create new listing</Link>
                <Link href="/">Dashboard<br/></Link>
                <Link href="/dashboard/listings/allListings"><a className="left-navbar-link w-nav-link"><span className="material-icons-round md-18 mr-8">list_alt</span> Listings<br/></a></Link>
                <Link href="/dashboard/settings/settings">Account settings</Link>
                <Link href="/dashboard/listings/myListwise">My Listwise</Link>
          </nav>
        </div>
  )
}

export default Nav

settings.js

import React, {useState} from 'react'
import Head from "next/head"
import Script from "next/script"

const settings = () => {

  <Head>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css" />
    <link rel="stylesheet" href="https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.css" />
    <link rel="stylesheet" href="https://unpkg.com/filepond/dist/filepond.min.css" />
    <Script src="https://unpkg.com/filepond-plugin-file-encode/dist/filepond-plugin-file-encode.min.js"></Script>
    <Script src="https://unpkg.com/filepond/dist/filepond.min.js"></Script>
  </Head>

  return (
    <div className="app-main-layout-container">
                  <div className="tabs-menu w-tab-menu">
                    <a data-w-tab="Personal" className="tab-link w-inline-block w-tab-link w--current">
                      <div className="material-icons-round md-24 icon-acc-settings">person</div>
                      <div className="tab-text">Personal profile</div>
                    </a>
                    <a data-w-tab="Business" className="tab-link w-inline-block w-tab-link">
                      <div className="material-icons-round md-24 icon-acc-settings">store</div>
                      <div className="tab-text">Business profile</div>
                    </a>
                    <a data-w-tab="Social" className="tab-link w-inline-block w-tab-link">
                      <div className="material-icons-round md-24 icon-acc-settings">share</div>
                      <div className="tab-text">Social links</div>
                    </a>
                  </div>
                  <div className="tabs-content w-tab-content">
                    <div data-w-tab="Personal" className="w-tab-pane w--tab-active">
                      <div className="w-form">
                        <form id="wf-form-profile" name="wf-form-profile" data-name="profile" method="get">
                          <div className="form-group"><label htmlFor="name-4" className="label">Upload profile photo</label>
                        </form>
                    </div>
                    <div data-w-tab="Business" className="w-tab-pane">
                      <div className="w-form">
                        <form id="wf-form-profile" name="wf-form-profile" data-name="profile" method="get">
                          <div className="form-group"><label htmlFor="name-4" className="label">Business name</label>
                            <div className="hint marginb--20px">This is usually the name you work under</div><input type="text" className="input w-input" maxLength="256" name="Business-Name" data-name="Business Name" placeholder="Enter business name" id="business-name" required="" />
                        </form>
                    </div>
                    <div data-w-tab="Social" className="w-tab-pane">
                      <div className="w-form">
                        <form id="wf-form-profile" name="wf-form-profile" data-name="profile" method="get">
                          <div className="form-group"><label htmlFor="instagram-link" className="label">Instagram profile link</label><input type="text" className="input w-input" maxLength="256" name="Instagram-Link" data-name="Instagram Link" placeholder="www.instagram.com/myname" id="instagram-link" /></div>
                        </form>
                    </div>
                  </div>
                </div>
              </div>
            </div>
      </div>
    </div>
  )
}

export default settings

Also, I will like to ask how best to render those scripts that only work for specific pages, should I add the to the Meta.js file which gets loaded on the initial rendering of the application, or creates a separate file and add it to the page that needs it when the page is navigated to.

How to cut audiofile from input in browser with js, lamejs?

I have input in my Vue component where i upload audiofile via @change, next i need to cut it, for example i have 30 seconds audio and i need to receive audio from 5 to 15 second.
I have installed lamejs package to do that.

But after all my operations with audio i receive cutted audio but without any sound, so i dont know where is the reason of that. Need help!

method which upload file

async onUploadFile(event) {
        const fileData = event.target.files[0];
        this.file = fileData;
        await this.decodeFile(fileData);
    },

method which decodes file to audioBuffer

async onUploadFile(event) {
        const fileData = event.target.files[0];
        this.file = fileData;
        await this.decodeFile(fileData);
    },

method which cut audio and encode it to mp3 and then receive blob url

async audioBufferSlice(buffer, begin, end) {
        const audioContext = new AudioContext();
        const channels = buffer.numberOfChannels;
        const rate = buffer.sampleRate;
        const duration = buffer.duration;

        const startOffset = rate * begin;
        const endOffset = rate * end;
        const frameCount = endOffset - startOffset;

        const audioLength = endOffset - startOffset;

        let trimmedAudio = audioContext.createBuffer(
            buffer.numberOfChannels,
            audioLength,
            rate
        );

        for(var i = 0; i < buffer.numberOfChannels; i++){
            trimmedAudio.copyToChannel(buffer.getChannelData(i).slice(begin, end), i);
        }

        var audioData = this.serializeAudioBuffer(trimmedAudio);

        let mp3Data = [];
        const sampleBlockSize = 1152;

        let mp3encoder = new lamejs.Mp3Encoder(2, audioData.sampleRate, 128);

        var left = new Int8Array(audioData.channels[0].length);
        var right = new Int8Array(audioData.channels[1].length);

        for (var i = 0; i < audioData.channels[0].length; i += sampleBlockSize) {
            var leftChunk = left.subarray(i, i + sampleBlockSize);
            var rightChunk = right.subarray(i, i + sampleBlockSize);
            var mp3buf = await mp3encoder.encodeBuffer(leftChunk, rightChunk);
            if (mp3buf.length > 0) {
                mp3Data.push(mp3buf);
            }
        }

        let buf = await mp3encoder.flush();

        if (buf.length > 0) {
            mp3Data.push(buf);
        }

        var blob = new Blob(mp3Data, {type: 'audio/mp3'});
        var url = window.URL.createObjectURL(blob);
        console.log('MP3 URl: ', url);
    },

What did I do wrong that I receive cut audio but without any sound?
I look at that repository as example https://github.com/Vinit-Dantkale/AudioFy

Beer bottle game

Beer Bottles Game Development in JAVA LANGUAGE.
Beer Bottles Game Development Preamble:

  1. In this game, there are 21 Beer bottles and 2 players You and Computer.
  2. You and Computer would pick up the Beer bottles one by one.
  3. At a time, any number of beer bottles can be picked up between 1 and 4 (inclusive)
  4. The one, who will have to pick up the last bottle, is the loser and will have to pay the bill, Design and implement a game, making use of Artificially Intelligent algorithm, so that if is playing first, then the Computer would pick up the bottles intelligently each time, Computer would always Win. The Computer would never Lose.

Run javascript code on multiple pages of a multi-page website

I am building a google chrome extension to automate a task that requires navigation to different pages on a multi-page website. Let say on the first page there’s a button which navigates to another page on the same website, I am using javascript to click on that button so that it navigates to the desired page but after successful navigation from the first page the javascript code which I wrote for navigated page doesn’t work.

How can I make it work and again do some tasks using javascript on the navigated page?

Javascript Google Auth Error redirect_uri: storagerelay://blob/?id=

I am trying to get Google Auth working. The Auth is being called from an IFrame embedded on a website. The code looks as such:

const client = google.accounts.oauth2.initCodeClient({
    client_id: 'xxxxxx',
    scope: 'https://www.googleapis.com/auth/calendar.readonly',
    ux_mode: 'popup',
    callback: (response) => {
    
  },
});

function signIn() {
    client.requestCode();
}

With the html being very simple:

<a class="btn btn-primary" onclick="signIn()"><i class="fab fa-google"></i> Sign-In With Google</a>

When the button is clicked, the following is returned.

enter image description here

What could be causing this the storage issue?

How do you modify an object multiple times and return it in a spread operator?

I’m working in React. I’m using useState to hold an object in state. To make one change to the object and return it I can use the spread operator like so …

 const [formWizard, setFormWizard] = useState(FORM_CONTROLS.steps[index]);

...

 const addSection = section => {
...

   setFormWizard(wizard => ({
     ...wizard,
     wizard: formWizard.controls[14].group.push(...subjectAddressCopy.slice(0, 5))
   }));
}

But what if I need to make multiple changes? I’ve tried putting a comma between them, use &&, and wrapping it in an object (though I think that would change the data structure). In either event known of those things worked.

   setFormWizard(wizard => ({
      ...wizard,
      wizard: formWizard.controls[14].group.push(...subjectAddressCopy.slice(0, 5),
      formWizard.controls[14].trash) // how can I also make this change?
   }));

How can I make two changes to formWizard and return it?

Vue 3 Automatic Update Array Outside Vue App

I have a simple scoring app that uses Vue 3 to maintain the scores and totals. I have a global teams object that contains all the scores. My Vue 3 app updates my scores quite happily within itself, but I also need to access the teams object outside of the Vue app to do other non-user interface activities, like saving etc. and i’d like to keep them sync’d.

My global teams object looks like this:

let teams = [];
teams[0] = {
    players: [
      { name: "Player 1" },
      { name: "Player 2" }
    ],
    scores: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  };
teams[1] = {
    players: [
      { name: "Player 1" },
      { name: "Player 2" }
    ],
    scores: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  };

I link it to my Vue 3 app like this:

data() {
      return {
        home: teams[0],
        away: teams[1]
      };
    },

If I update a score on the home or away object within Vue, the global teams object is not updated. For example I have a Save function (outside of Vue) that relies on the teams object be kept in sync with updates to home and away.

Is there a way to do this? Am I going about it all wrong? I could move my Save function into Vue but I was trying to separate out my user interface logic. I do have other functions that need access to a sync’d teams object and i’d rather not add everything into the Vue app.

Thanks in advance. J.

dynamic Employee table and how to css style

I wanted to dynamically create an employee table from a dataset. And I wanted to figure out how to bold all the department names, or supervisors. Here is a sample of my code:

var data = [{"name": "John Smith", "primary": 1, "title": "CEO", "phone":123}, {"name":"Frank Beans", "title": "COO", "phone": 333}, {"name": "test", "title": " newemployee", "phone": 555}, {"name": "Damar", "primary": 1, "title": "supervisor of quality", "phone": 999}]

function buildTable(data){
var table = document.getElementById(‘mytable’)

for(var i =0; i < data.length; i++){
    var row = `
    <tr>
        <td data-id="primary">${data[i].name}</td>
        <td>${data[i].title}</td>
        <td>${data[i].phone}</td>
    </tr>`
    table.innerHTML += row
}

}

I am able to display the table, which is great! But, when I try to bold the td cell that has name it bolds both cells of John Smith and Frank Beans. I would like to bold John Smith and Damar since John is the CEO and Damar is a supervisor. I was thinking of looping through the data and if it has primary === 1 then i could apply the bold to the cell but couldn’t figure out how to do that. I have been stuck on this for a few hours and need some help.