React bootstrap modal animate only on show OR on hide

I’m trying to have it so that I can go directly from one modal to another without flicker/animations for bootstrap Modals in react (using react-bootstrap), but it doesn’t work because of the fade CSS class.

I’d like to set it so that the first modal a user opens animates, and the last one a user closes animates. So say I have 3 modals the user goes between:

1 => 2 => 3

Modal 1: fades in on open, no animation on close
Modal 2: no animation at all
Modal 3: no animation on open, fades out on close

How should I go about doing this? I’ve tried tinkering with the fade CSS class to no avail.

This feels like an anti-pattern, so maybe I don’t really want to do this. What I’m trying to do is cleanly go from a Registration modal to an Account Setup modal, with it being seamless for the user.

Display each element of array in grid box one row JS

I wish to display each char of my array into a box in only one row (see image below) using javascript.
Result wished

When I use grid it displays only in one column and also sometimes my box is empty.

Here is my following code working, but only display chars without css

var questionParse = JSON.parse(currentQuestion.question); //here is for example surreal
        //display letters in random order
        for (let i = questionParse.length; i >= 0; i--) {
            const randLetters = Math.floor(Math.random() * (i+1));//Var for random letter
            [questionParse[i], questionParse[randLetters]] = [questionParse[randLetters], questionParse[i]];
        }
        questionTxt.innerHTML = questionParse.join(" "); //displays for example : r a r s l e u

Here is the code I tried but displays in column and sometimes give empty box :

        //Parse string to create array of chars, here string can be as an example surreal
        var questionParse = JSON.parse(currentQuestion.question);
        //Display letters in random order
        for (let i = questionParse.length; i >= 0; i--) {
            var anagrammeLetter = document.createElement('span');
            anagrammeLetter.className = "box";
            const randLetters = Math.floor(Math.random() * (i+1));//Var for a random letter
            [questionParse[i], questionParse[randLetters]] = [questionParse[randLetters], questionParse[i]];
            anagrammeLetter.textContent = questionParse[i];
            questionTxt.appendChild(anagrammeLetter);
        }

Style :

.box {
width: 60px;
height: 60px;
border: 2px solid var(--empty);
margin: 4px;
color: black;
text-transform: uppercase;
display: grid;
place-items: center;
font-family: Arial, Helvetica, sans-serif;
font-size: 2.4rem;

}

Does anyone have any idea ?
Thanks in advance

Build created with Create React App shows empty page when deployed on production

I made a very basic corporate website with create-react-app and used react-router v6 for routing.
Everything works fine locally. Then I create a build folder by running following command:

npm run build

I uploaded the contents of build folder and uploaded to the server folder like: /var/www/mysite

On server I am running apache, I create apache site there and pointed root directory to be /var/www/mysite.
Now when I try to run the website on my domain like:

www.mysite.com it does not work and shows blank page.

But when I upload the same build into sub folder like /var/www/mysite/v2 and then try to run www.mysite.com/v2 the site works perfectly fine.

I don’t know what is wrong. I tried following in package.json file

"homepage": "."
OR
"homepage": "/"
OR
"homepage": "./"
OR
"homepage": "wwww.mysite.com/"

Here are the contents of my .htaccess file that is placed in public directory of project, it gets copied to build folder when build folder is generated:

  Options -MultiViews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.html [QSA,L]

Please tell me what I am doing wrong.
I have spent full day trying to figure out what is wrong. This issue is not mentioned in documentation or anywhere online.
I have tried all possible fixes available on similar questions but nothing works.

Note: I am not including https in above question wherever www is written because SO does not let me submit question with https.

Delay animated progress bar until page scrolled into view

I’ve managed to modify an animated progress bar to my specific requirements, but would like the additional feature of the animation effect being delayed until that section of the page is scrolled to.

Here is a fiddle of my current setup: Fiddle using the following Javascript:

$(".animated-progress span").each(function () {
  $(this).animate(
    {
      width: $(this).attr("data-progress") + "%",
    },
    2000
  );

});

I’ve come across a similar post from 8 years ago: Previous Post, but when I try to incorporate this code into my setup, the animation stops working completely.

Can anyone point me in the right direction to achieve the effect I’m looking for?

Thanks

Hide tooltip when hovering over null-values in chart.js

I am currently using a line-chart with chart.js 3.5.0 and react-chart-js 3.0.4, given two datasets.

The first dataset has data in {x,y}-format with null-values for some y.
When hovering over those null-values, the tooltip jumps to the start of the second dataset. In this case, I would like to hide the tooltip, but approaching the problem with callbacks didn’t work.

Has anybody experienced the same issue?

Screenshot

codesandbox

const options = {
    interaction: {
        intersect: false
    },
    maintainAspectRatio: true,
    animation: false,
    plugins: {
        tooltip: {
            mode: 'nearest',
            axis: 'x',
            position: 'average',
            yAlign: "bottom"
        },
    },
    scales: {
        y: {
            type: 'linear',
            beginAtZero: true,
            min: 0,
            grace: '20%',
        }
    },
    chartArea: {
        backgroundColor: "rgb(240,240,240)"
    }
}

Delete specific columns in Google App Script FAST

below is code the delete entire columns except columns “G” and “M” using a for loop, yet the process is the way too slow, is there a way to perform it faster?

  var keep = [7,13]; 

  for (var col=lastCol; col > 0; col--) {
  if (keep.indexOf(col) == -1) {
  newSheet.deleteColumn(col);
                }
     }

How to host multiple nodejs applications with nginx

I have a VM where I upload two backend projects.
let’s say the first domain is “first.com” and the second domain is “second.com”.
the first runs on port 3000, and the second on 3001.
I have configured the file in this location “/etc/nginx/sites-available/default”.

this is the code:

server {
  server_name first.com;

  location / {
     proxy_pass http://localhost:3000;
     proxy_http_version 1.1;
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection 'upgrade';
     proxy_set_header Host $host;
     proxy_cache_bypass $http_upgrade;
  }

  listen 80;
}

server {

  server_name second.com;

  location / {
     proxy_pass http://localhost:3001;
     proxy_http_version 1.1;
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection 'upgrade';
     proxy_set_header Host $host;
     proxy_cache_bypass $http_upgrade;
   }

   listen 80;
}

the problem is that the two of the domains show the first project.

what am I doing wrong?

Html Change h1 content on javascript with list

Hello guys i have some mistake i want change h1 content on javacsipt with list but i cant where is my mistake can you help me?

<body>
    <h2 id="demo">Example H</h2>
    <div class="swiper-button-next"> </div>
</body>
<script> 
next = document.querySelector("swiper-button-next");
name-index = 0;
name-list[
{
 name: 'John'
},
{
name: 'Christina'
}
];
next.addEventListener('click', myFunction)
function myFunction() {
  document.getElementById("demo").innerHTML /* (i was try like textContent) */ = "name-list[name-index].name";
}
<script>
<html> ```

Using NestJS custom configuration file in any typescript file in the project

I have created a custom configuration file according to the docs – Custom Configuration Files Section. I can see that we can use this by injecting the ConfigService in the constructor() function of any other services and use it. However, my question about its usage in any random file that needs to access the process.env variables. For example, I have a util file that has a function which just checks if process.env.NODE_ENV is in the given array of strings.

// nodeEnv.util.ts

export function isNodeEnvIn(envs: string[]): boolean {
    return envs.includes(process.env.NODE_ENV);
}
// config.ts

export default () => ({
    node: {
        env: process.env.NODE_ENV || 'local',
    },
})

SEND BLOB VIDEO (FROM WEBRTC) TO A MYSQL SERVER IN PHP

I have tried using some code to get blob uploaded to server, but this code has not functioned as intended. need help in finding where the error is and perhaps how to upload blob video to MySQL server.

The js code I used is

var blob = URL.createObjectURL(recorder.getBlob());
                var fd = new FormData();
                fd.append('fname', 'test.mp4');
                fd.append('data', blob);
                $.ajax({
                    type: 'POST',
                    url: '../../application/controllers/upload.php',
                    data: fd,
                    processData: false,
                    contentType: false
                }).done(function(data) {
                    alert(data);
                });
Then this is the PHP code I tried
foreach(array('video', 'audio') as $type) {
if (isset($_FILES["${type}-blob"])) {

    echo 'uploads/';

    $fileName = $_POST["${type}-filename"];
    $uploadDirectory = 'uploads/'.$fileName;

    if (!move_uploaded_file($_FILES["${type}-blob"]["tmp_name"], $uploadDirectory)) {
        echo(" problem moving uploaded file");
    }

    echo($fileName);
}
}

Once I am able to get this working I can be able to insert the data into MySQL database
Thank you for helping

react button conditional rendering not working properly

working on a cart app in a udemy course – the problem is when the quantity gets bought it supposed to make the button disabled but its not working, only showing the add to cart button without disabling it when quantity are zero
data.countInStock seems not to be updating

import { Button } from 'react-bootstrap';
import { Card } from 'react-bootstrap';
import { Link } from 'react-router-dom';
import React, { useContext } from 'react';
import Rating from './Rating';
import axios from 'axios';
import { Store } from '../Store';

function Product(props){
 const {product} = props;

const {state , dispatch:ctxDispatch} = useContext(Store);
const {cart: {cartItems}} = state

const addToCartHandler = async (item )=>{
  const existItem = cartItems.find((x)=> x._id === product._id);
   const quantity = existItem ? existItem.quantity+1:1 ; 

  const {data} = await axios.get(`/api/products/${item._id}`);
  if(data.countInStock < quantity){
      window.alert('sorry product is out of stock')
      return;
  }
   ctxDispatch({
       type:'CART_ADD_ITEM' 
       , payload:{...item , quantity},
   });
  };
  

return(

    <Card>


    <Link to={`/product/${product.slug}`}> 
      <img src={product.image} className="card-img-top" alt={product.name} />
    </Link>
    <Card.Body>
    <Link to={`/product/${product.slug}`}>
        <Card.Title>{product.name}</Card.Title>
    </Link>
    <Rating rating={product.rating} numReviews={product.numReviews} />
    <Card.Text>${product.price}</Card.Text>

    {  product.countInStock === 0 ? (

      
      <Button  color="light" disabled={true} >  Out of stock</Button>
      
    ):(
      
      <Button onClick={() => addToCartHandler(product)}>Add to cart</Button>
    )}
  </Card.Body>
</Card>
)}

it’s not showing the button out of stock when quantity gets used, What’s wrong with the code?
full code: https://github.com/basir/mern-amazona/commit/12e565bf6e1859b963729eaba46a5352962fe9e1

full code with backend : https://github.com/basir/mern-amazona/tree/12e565bf6e1859b963729eaba46a5352962fe9e1

:style doesn’t updates | vue

<div class="progress-bar" v-bind:class="[progressNegative != true ? 'progress-bar-success' : 'progress-bar-danger']" role="progressbar" v-bind:aria-valuenow="progress"
                                         aria-valuemin="-100" aria-valuemax="100" :style="{width : progress + '%'}">
                                        {{progress}}%
                                    </div>

progress is a variable where I store a value between 0 and 100, it updates everywhere in this element except of :style=””

JavaScript code wont execute but get printed as part of html

I have this html code with js inside and every time i submit the js wont execute but get printed as html, saw many similar problems on stack overflow they said something about not closing <div> correctly but i cant find the error on my code

This is my html code:

<div class="container-fluid">

<div class="row" id="riparues_frm">
<form method="post" action="ruajRiparues.php" id="FormaRuaj_rp" enctype="multipart/form-data">
    <input type="hidden" name="idRiparues" id="idRiparues" />
    <div class="form-group row d-flex" style="margin-bottom: 20px;" >
        <div class="col-sm-4">
            <input type="button" class="btn btn-outline-info" value="Kerko skript sipas pershkrimit" onclick="lookUpBox({
                title: 'Kerko skript sipas pershkrimit',
                url: 'kerkoSkript_sipas_emrit.php?chars=',
                onItemSelected: function(data){
                   $('input[id=' +
                    'idRiparues]').val(data.idRiparues);
                $('#delref').attr('href','fshi_riparues.php?id=' + data.idRiparues);
                $('input[name=kodi]').val(data.kodi);
                $('input[name=seq]').val(data.sequenca);
                $('input[name=pershkrimi]').val(data.pershkrimi);
                $('#scripti').val(data.script);
                $('#scripti').load(data.script, resizeArea);
                $('#modelScripti').val(data.modelScript);
                $('#modelScripti').load(data.modelScript, resizeArea);

               $('#dataregj').val(data.datazgjedh);
               $('#tipi').val(data.Tipi);

               //kosta070622 start
                var checkTipi = data.Tipi;
                filter()
            //kosta070622 end
                },
                tableHeader: ['idRiparues','kodi', 'pershkrimi','sequenca','script','modelScript','data']
              })
            " />&nbsp

        </div>

and this is my js code:

 <script>
            function filter() {
                if(isadmin === 1){
                    if(checkTipi != 'S' && checkTipi != 'B'){
                        document.getElementById('modelScripti').hidden = true;
                        document.getElementById('pathi').hidden = false;
                        document.getElementById('myfile').hidden = false;
                        document.getElementById('seq').disabled = true;
                        document.getElementById('lblpershkrimi').innerHTML = 'Emri Skedarit';
                        document.getElementById('lblscript').innerHTML = 'Pathi Relativ';
                        document.getElementById('lblmodelscript').innerHTML = 'Model Pathi Relativ';
                        $('#pathi').val(data.modelScript);
                    }else{
                        document.getElementById('modelScripti').hidden = false;
                        document.getElementById('pathi').hidden = true;
                        document.getElementById('myfile').hidden = true;
                        document.getElementById('seq').disabled = false;
                        document.getElementById('lblpershkrimi').innerHTML = 'Pershkrimi';
                        document.getElementById('lblscript').innerHTML = 'Script';
                        document.getElementById('lblmodelscript').innerHTML = 'Model Script';
                    }

                }else{
                    if(checkTipi != 'S' && checkTipi != 'B'){
                        document.getElementById('modelScripti').hidden = true;
                        document.getElementById('pathi').hidden = false;
                        document.getElementById('myfile').hidden = true;
                        document.getElementById('seq').disabled = true;
                        document.getElementById('pathi').disabled = true;
                        document.getElementById('scripti').disabled = true;
                        document.getElementById('Edito').disabled = true;
                        document.getElementById('lblpershkrimi').innerHTML = 'Emri Skedarit';
                        document.getElementById('lblscript').innerHTML = 'Pathi Relativ';
                        document.getElementById('lblmodelscript').innerHTML = 'Model Pathi Relativ';

                        $('#pathi').val(data.modelScript);
                    }else{
                        document.getElementById('modelScripti').hidden = false;
                        document.getElementById('pathi').hidden = true;
                        document.getElementById('myfile').hidden = true;
                        document.getElementById('seq').disabled = false;
                        document.getElementById('scripti').disabled = false;
                        document.getElementById('Edito').disabled = false;
                        document.getElementById('lblpershkrimi').innerHTML = 'Pershkrimi';
                        document.getElementById('lblscript').innerHTML = 'Script';
                        document.getElementById('lblmodelscript').innerHTML = 'Model Script';
                    }
                }
                console.log(Boolean(isadmin));
                console.log("HYRI KETU");

            }
        </script>

The html code it was written by someone else i just added the function filter and thats the the code that is being printed as html on the website.

enter image description here