The image does not expand inside the container, only a part of it is visible

I want to show more than one images in a container and put left and right swiper for make switch between images.

But only the upper left corner of the images is visible, it does not spread to the entire container.

I tried some things on object-fit parameter like contain, fill and some others and play with width and height values but cant find a solution.

How can i fix it?

Current Output :
image of problem
Expected Output :

I expect the image full fills the container the container it is in.

Here the html and javascript codes, I’m working on ASP.NET Core MVC :

//HTML CODES

    <div class="swiper-wrapper">
        @foreach (var homeModelProjects in Model.Projects)
        {
            <div class="swiper-slide">
                <div class="testimonial-item">
                    @{
                        // Split the ImagePaths string into an array of image URLs
                        var imageUrls = homeModelProjects.ImagePaths.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    }

                    <style>
                        .swiper-container {
                            width: 100%;
                            height: 300px; /* Set the desired height */
                            overflow: hidden;
                        }

                        .swiper-slide {
                            display: flex;
                            align-items: center;
                            justify-content: center;
                            width: 100%;
                            height: 100%;
                        }

                            .swiper-slide img {
                                width: 100%;
                                height: 100%;
                                object-fit: cover;
                                object-position: center;
                            }

                    </style>



                    <!-- Swiper container for images -->
                    <div class="swiper-container">
                        <div class="swiper-wrapper">
                            <!-- Loop through each URL and create a swiper-slide -->
                            @foreach (var imageUrl in imageUrls)
                            {

                                <div class="swiper-slide">
                                    <img src="@imageUrl" alt="">
                                </div>
                            }
                        </div>                                       
                        <!-- Add navigation buttons -->
                        <div class="swiper-button-next"></div>
                        <div class="swiper-button-prev"></div>
                    </div>

                    <h3>@homeModelProjects.Name</h3>
                    <a href="@homeModelProjects.GithubLink" target="_blank">
                        <h4>@homeModelProjects.GithubLink</h4>
                    </a>
                    <p>Kullanılan Teknolojiler : @homeModelProjects.UsedTechs</p>
                    <p>@homeModelProjects.Description</p>
                </div>
            </div>
            <!-- End testimonial item -->
        }
    </div>

    <div class="swiper-pagination"></div>
</div>

//Javascript Codes

<script>
    const mySwiper = new Swiper('.swiper-container', {
        // Optional parameters
        direction: 'horizontal',
        loop: true,
        speed: 300,
        mousewheel: true,
        coverflowEffect: {
            rotate: 30,
            slideShadows: true
        },
        // If we need pagination
        pagination: {
            el: '.swiper-pagination',
        },

        // Navigation arrows
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
        },

        // And if we need scrollbar
        scrollbar: {
            el: '.swiper-scrollbar',
        },
    })

</script>

Implementation of Array.prototype.toLocaleString

I’m interested in the following piece of code written in JS:

const array = [1,2,3];
const locales = 'en-US';
const options = null;
console.log(array.toLocaleString(locales,options));

Before Node.js 20, this would output 1,2,3. However, in Node.js 20, it now throws the following error:

Uncaught TypeError: Number.prototype.toLocaleString called on null or undefined
    at Number.toLocaleString (<anonymous>)
    at Array.toLocaleString (<anonymous>)

I’m trying to understand what changed in the implementation. Specifically, I’m looking for the exact line of code that was changed in the source code. I reviewed the ECMAScript language specification but couldn’t find any related changes. My focus is on identifying where the code changed in the implementation, rather than understanding the reasoning behind it. Please point me to the right direction.

The reason for this question is because I have a library that introduced a new data structure and provides similar methods as array. I want my DS and the array to have same results for any kind of input, including for null. Once I noticed that between versions, toLocaleString provides a different result, I understood that I need to update my own toLocaleString to support the latest changes. In order to do so, I’m trying to find out the exact change in order to see in my own eyes the change.

Migrating from Google Sign-In with my Create Calendar Event Javascript Method

I have a method which has been working for the last decade and it still works with my Client ID as is stated in the migration notice. The problem started when using a newly generated Client ID for a new client.

We got this response from Google

You have created a new client application that uses libraries for user authentication or authorization that are deprecated. New clients must use the new libraries instead. See the Migration Guide for more information.

Here is my existing methods that work with the old Client ID:

      var CLIENT_ID = 'XXX';

      var SCOPES = ["https://www.googleapis.com/auth/calendar"];

      /**
       * Check if current user has authorized this application.
       */
      function checkAuth() {


        gapi.auth.authorize(
          {
            'client_id': CLIENT_ID,
            'scope': SCOPES.join(' '),
            'immediate': false
          }, handleAuthResult);
      }

      /**
       * Handle response from authorization server.
       *
       * @param {Object} authResult Authorization result.
       */
      function handleAuthResult(authResult) {

        var authorizeDiv = document.getElementById('authorize-div');
        if (authResult && !authResult.error) {
          // Hide auth UI, then load client library.
          authorizeDiv.style.display = 'none';
          loadCalendarApi();

        } else {

          // Show auth UI, allowing the user to initiate authorization by
          // clicking authorize button.
          authorizeDiv.style.display = 'inline';
        }
      }

      /**
       * Initiate auth flow in response to user clicking authorize button.
       *
       * @param {Event} event Button click event.
       */
      function handleAuthClick(event) {
        gapi.auth.authorize(
          {client_id: CLIENT_ID, scope: SCOPES, immediate: false},
          handleAuthResult);
        return false;
      }

      /**
       * Load Google Calendar client library. List upcoming events
       * once client library is loaded.
       */
      function loadCalendarApi() {
        gapi.client.load('calendar', 'v3', addEvent);
      }

      /**
       * Print the summary and start datetime/date of the next ten events in
       * the authorized user's calendar. If no events are found an
       * appropriate message is printed.
       */
       
       function addEvent() {

      var startTime = $('input[id^=Field10]').val();
      var endTime = $('input[id^=Field11]').val();
      var calendar = $('#q8 input').val();
    var title = $('#q12 input').val();
    var desc = $('#q13 textarea').val();

var arrcal = calendar.split("/");
if (arrcal[0] < 2)
{arrcal[0] = "0"+arrcal[0];}
if (arrcal[1] < 2)
{arrcal[1] = "0"+arrcal[1];}

var formDate = arrcal[2]+"-"+arrcal[0]+"-"+arrcal[1];
var start = formDate+'T'+startTime+':00-07:00';
var end = formDate+'T'+endTime+':00-07:00';

console.log(start + end + title + desc );

var event = {
  'summary': title,
  'location': 'Phone',
  'description': desc,
  'start': {
    'dateTime': start,
    'timeZone': 'America/Los_Angeles'
  },
  'end': {
    'dateTime':  end,
    'timeZone': 'America/Los_Angeles'
  },
  'reminders': {
    'useDefault': false,
    'overrides': [
      {'method': 'email', 'minutes': 24 * 60},
      {'method': 'popup', 'minutes': 10}
    ]
  }
};

var request = gapi.client.calendar.events.insert({
  'calendarId': 'primary',
  'resource': event
});

request.execute(function(event) {
var strevent = event.htmlLink;
if (strevent.indexOf("google.com") >= 0)
{
  appendPre('Event Created');
} else 
{appendPre('Failed to create event');}
});

And my original HTML

  <button id="start" class="createEventButton" onclick="checkAuth()" type="button">
  Create Event
  </button>
    <div id="authorize-div" style="display: none">
      <span>Authorize access</span>
      <!--Button for the user to click to initiate auth sequence -->
      <button id="authorize-button" onclick="handleAuthClick(event)" type="button">
        Authorize
      </button>

I have added the new HTML recommended from the migration document with a call to my original method handleAuthResult since I don’t know what the handleCredentialReponse method is supposed to look like and how it links over to my create event method.

<html>
  <body>
    <script src="https://accounts.google.com/gsi/client" async defer></script>
    <div id="g_id_onload"
         data-client_id="YOUR_CLIENT_ID"
         data-callback="handleAuthResult">
    </div>
    <div class="g_id_signin" data-type="standard"></div>
  </body>
</html>

However my original code continues to use the old gpi.client libraries and so even after successfully logging in with the new auth button, my method return a 401 unauthorized.

I can clearly see that it says to stop using the old gpi.client when using this method but it provides no information on how to write the new handleCredentialResponse method shown in the new HTML callback or what to replace all my gpi. calls with.

There actually is not one piece of JS examples on this guide. I tried visiting the Javscript API page and I don’t see the word calendar anywhere. I am looking for information on how to create calendar events using the newly created Google client IDs or how to modify my existing methods to work.

Thanks in advance!

How to get my grid of bootstrap 5 treeseed item cards to render within my php file after making a call to MySQL database

I am trying to render a HTML grid layout in a php file called gardenshop.php. Within the grid container should be grid items in the form of Bootstrap 5 cards that are created dynamically. The grid container (a ) has a class of .items-wrapper. Each card should consist of the following:

a)A container which is a of class of container mt-3 slides-container (if the card has more than one image) or container mt-3 (if the card has only one image).

b)A div nested within a) with a class of tree-card

c)Nested within b) are the image or images. I have a database of treeseeds and some entries have only one image treeImage1 while other treeseed types have jave more than one images with treeImage2 and treeImage3 not being NULL.

d)Below the images and also nested within b) is a another div for the cardBody with a class of “.card-body”

e)Nested within d) should be a element with a class of “.card-title” that will have the commonName of the treeseed.

f)Nested within d) but below e) there should a

element with text saying “Information:” and has a class of “.info-text”.

g)Below f) and nested within d) should be an

    unordered list with the list items (fields/columns/properties) for the treeseeds in the form of

  • elements. I have a function called generateListItems() within a php file called shopconnect.php that I import into gardenshop.php.

    On the MySQL side I am using Sequelize with a table called treeseeds and it has the following fields:

  • id(primary key)
  • commonName DataTypes.STRING (60)
  • speciesName DataTypes.STRING (60)
  • family DataTypes.STRING (60)
  • seedcostInclVAT DataTypes.DOUBLE(4,2)
  • quantityInStock DataTypes.INTEGER
  • seedNumberPerPack DataTypes.INTEGER
  • colour DataTypes.STRING
  • hardiness DataTypes.STRING
  • soilType DataTypes.STRING
  • soilAcidity DataTypes.STRING
  • description DataTypes.TEXT
  • treeImage1 DataTypes.BLOB
  • treeImage2 DataTypes.BLOB
  • treeImage3 DataTypes.BLOB

Now referring back to g) the data for these columns for each treeseed will be listed a

  • list items that I was speaking about for g), except for ID as the viewer of the gardenshop.php website does not need to see the record id.

    I am using PDO (PHP Data Object) logic within a file called shopconnect.php to make a connection to my database and request the data back with MySQL select queries as usual.

    //shopconnect.php

    $host = "127.0.0.1";
    $db = "database"
    $user = "user";
    $pass = "password";
    $charset = "utf8mb4";
    
    $datasourcestr =  "mysql:host=$host;dbname=$db;charset=$charset";
    $options = [
      PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
      PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
      PDO::ATTR_EMULATE_PREPARES   => false,
    ];
    $pdo = new PDO($datasourcestr, $user, $pass, $options);
    
     $sql1 = "SELECT * FROM suppliers";
     $sql2 = "SELECT * FROM treeseeds";
    
    $supplierNameData = $pdo->query($sql1)->fetchAll();
    $treeSeedData = $pdo->query($sql2)->fetchAll();
    
    $treeSuppliers = [];
    
    function filterOutSuppliers($parentArr,$childDataArr,$candidateArr){
      foreach($parentArr as $parentRow)
         {
           foreach($childDataArr as $childRow){
              if(($parentRow["id"] <=> $childRow["supplierId"]) === 0 ){
                  array_push($candidateArr, $parentRow["supplierName"]);
              }else{
                  continue;
              }   
          
           }
         } 
         return $candidateArr;   
    }
    
    $treeSuppliers = filterOutSuppliers($supplierNameData,$treeSeedData,$treeSuppliers);
    
    $supplierIds = [];
     foreach($supplierNameData as $row1) {
         array_push($supplierIds,$row1["id"]);    
     }
    
    $supplierIdStrs = implode(',', $supplierIds);
    
    $treeSeedQuery = "SELECT * FROM `treeseeds` WHERE supplierId in ($supplierIdStrs)";
    $treeSeedDataOut = $pdo->query($treeSeedQuery);
    
    $treeSeedArr = [];
    
    do {
      $treeSeedArr = $treeSeedDataOut->fetchAll();
    } while ($treeSeedDataOut->nextRowset() && $treeSeedDataOut->columnCount());
    
    $domDoc = new DOMDocument();
    
    function generateTreeCard(){
      $topicDiv = $GLOBALS['domDoc']->createElement('div'); 
      $topicDiv->setAttribute('class','tree-card'); //tree-card div is to be appended to the container mt-3
      return $topicDiv; //USED IN LOOP BELOW 
    }
    
    function generateCardBody(){
      $cardBody = $GLOBALS['domDoc']->createElement('div');
      $cardBody->setAttribute('class','card-body');
      return $cardBody;  //DONE ALREADY APPENDED TO TREECARD BELOW IN THE LOOP
    }
    
    
    function addheaderH4Text($value){
      $cardTitle = $GLOBALS['domDoc']->createElement('h4',$value);body
      $cardTitle->setAttribute('class','card-title');//needs to be appended on to card body
      return $cardTitle; //ALREADY DONE IN THE LOOP BELOW
    }
    
    
    function generateListElements($key,$value){
      $resultItem = "";
      switch($key){
        case "commonName":
          $resultItem = $GLOBALS['domDoc']->createElement('li',"$key : $value"); 
          break;
        case "speciesName":
          $resultItem = $GLOBALS['domDoc']->createElement('li',"$key : $value"); 
          break;
        case "family":
          $resultItem = $GLOBALS['domDoc']->createElement('li',"$key : $value"); 
          break;
        case "seedcostInclVAT":
          $resultItem = $GLOBALS['domDoc']->createElement('li',"$key : $value"); 
          break;
        case "quantityInStock":
          $resultItem = $GLOBALS['domDoc']->createElement('li',"$key : $value"); 
          break;
        case "seedNumberPerPack":
          $resultItem = $GLOBALS['domDoc']->createElement('li',"$key : $value"); 
          break;
        case "colour":
          $resultItem = $GLOBALS['domDoc']->createElement('li',"$key : $value"); 
          break;
        case "hardiness":
          $resultItem = $GLOBALS['domDoc']->createElement('li',"$key : $value"); 
          break;
        case "soilType":
          $resultItem = $GLOBALS['domDoc']->createElement('li',"$key : $value"); 
          break;
        case "soilAcidity":
          $resultItem = $GLOBALS['domDoc']->createElement('li',"$key : $value"); 
          break;
        case "description":
          $resultItem = $GLOBALS['domDoc']->createElement('li',"$key : $value"); 
        break;
      }
      return $resultItem; //needs to be appended to the productInfoList variable <ul>
    }
    
    $outerContainer = $domDoc->createElement('div');
    $outerContainer->setAttribute('class','items-wrapper');
    
    $productInfoList = $domDoc->createElement('ul');
    $listElementResult = "";
    
    
    
    $imgCollectorArr = [];
    $h4Text = "";
    $cardBody = "";
    $treeCard = "";
    $treeImage1 = "";
    $infoParagraph = "";
    $cardContainer = "";
    
    ***ISSUE IS IN THE NESTED FOREACH LOOP HERE ****
    foreach($treeSeedArr as $key => $value){
       $infoParagraph = generateInfoText(); //Just to display "Information:"
      foreach($value as $key1 => $value1){
         echo $key1 . " has a value of " . $value1 . "<br/>";  //***TEST
         if($key1 === 'commonName'){
          $h4Text = addheaderH4Text($value1); //GENERATE h4 text line'
          $cardBody = generateCardBody()->appendChild($h4Text)->appendChild($infoParagraph);
         }
         if($key1 !== 'id' && $key1 !== 'treeImage1' && $key1 !== 'treeImage2' && $key1 !== 'treeImage3'){
           $listElementResult = generateListElements($key1,$value1); // the bullet pointed list of properties
           $productInfoList->appendChild($listElementResult);//this is the <ul> tag
         }
         if($key1 === 'treeImage1' && !(is_null($value["treeImage1"]))){
    
            if(array_key_exists("treeImage2",$value) && !(is_null($value["treeImage2"]))){
              $imgCollectorArr["treeImage1"] = $value[$key1];
              continue; //if a treeseed has more at least 2 images 
            }
            $treeImage1 = generatetreeImage1($value1); //this is if a treeseed only has one image
            $treeCard = generateTreeCard()->appendChild($treeImage1)->appendChild($cardBody);
         }
    
         if($key1 === 'treeImage2' && !(is_null($value["treeImage2"]))){
            if(array_key_exists("treeImage3",$value) && !(is_null($value["treeImage3"]))){
              $imgCollectorArr["treeImage2"] = $value[$key1];
              continue; //if a treeseed has 3 images instead of 2
            }
             //design what happens when there are 2 images
             $slideBox1 = $domDoc->createElement('div');
             $slideBox1->setAttribute('class','mySlides fade');
             $countText1 = $domDoc->createElement('div','1 / 2');
             $countText1->setAttribute('class','numbertext');
             $slideBox1->appendChild($countText1);
             $firstImg = $domDoc->createElement('img');
             $firstImg->setAttribute('style','width:100%');
             $firstImg->setAttribute('src',$imgCollectorArr["treeImage1"]);
             $slideBox1->appendChild($firstImg);
    
             $slideBox2 = $domDoc->createElement('div');
             $slideBox2->setAttribute('class','mySlides fade');
             $countText2 = $domDoc->createElement('div','2 / 2');
             $countText2->setAttribute('class','numbertext');
             $slideBox2->appendChild($countText2);
             $secondImg = $domDoc->createElement('img');
             $secondImg->setAttribute('style','width:100%');
             $secondImg->setAttribute('src',"$value1");
             $slideBox2->appendChild($secondImg);
             $treeCard->appendChild($slideBox1);
             $treeCard->appendChild($slideBox2);
    
            //attach on to treecard
            $previousLink = $domDoc->createElement('a','&#10094;');
            $previousLink->setAttribute('class','prev');
            $previousLInk->setAttribute('onclick','plusSlides(-1)');
    
            $forwardLink = $domDoc->createElement('a','&#10095;');
            $forwardLink->setAttribute('class','next');
            $forwardLInk->setAttribute('onclick','plusSlides(1)');
            $treeCard->appendChild($previousLink);
            $treeCard->appendChild($forwardLink);
    
    
              //dots/circles
          $dotCircleBox1 = $domDoc->createElement('div');
          $dotCircleBox1->setAttribute('style','text-align:center');
          $dotSpanA = $domDoc->createElement('span');
          $dotSpanA->setAttribute('class','dot');
          $dotSpanA->setAttribute('onclick','currentSlide(1)');
    
    
          $dotSpanB = $domDoc->createElement('span');
          $dotSpanB->setAttribute('class','dot');
          $dotSpanB->setAttribute('onclick','currentSlide(2)');
    
          $dotCircleBox1->appendChild($dotSpanA);
          $dotCircleBox1->appendChild($dotSpanB);
          $treeCard->appendChild($dotCircleBox1);
         }
    
         if($key1 === 'treeImage3' && !(is_null($value[$key1]))){
          $slideBoxA = $domDoc->createElement('div');
          $slideBoxA->setAttribute('class','mySlides fade');
          $countTextA = $domDoc->createElement('div','1 / 3');
          $countTextA->setAttribute('class','numbertext');
          $slideBox1->appendChild($countTextA);
          $firstImg = $domDoc->createElement('img');
          $firstImg->setAttribute('style','width:100%');
          $firstImg->setAttribute('src',$imgCollectorArr["treeImage1"]);
          $slideBoxA->appendChild($firstImg);
    
          $slideBoxB = $domDoc->createElement('div');
          $slideBoxB->setAttribute('class','mySlides fade');
          $countTextB = $domDoc->createElement('div','2 / 3');
          $countTextB->setAttribute('class','numbertext');
          $slideBoxB->appendChild($countTextB);
          $secondImg = $domDoc->createElement('img');
          $secondImg->setAttribute('style','width:100%');
          $secondImg->setAttribute('src',$imgCollectorArr["treeImage2"]);
          $slideBoxB->appendChild($secondImg);
    
          $slideBoxC = $domDoc->createElement('div');
          $slideBoxC->setAttribute('class','mySlides fade');
          $countTextC = $domDoc->createElement('div','3 / 3');
          $countTextC->setAttribute('class','numbertext');
          $slideBoxC->appendChild($countTextB);
          $thirdImg = $domDoc->createElement('img');
          $thirdImg->setAttribute('style','width:100%');
          $thirdImg->setAttribute('src',$value1);
          $slideBoxC->appendChild($thirdImg);
    
          $treeCard->appendChild($slideBoxA);
          $treeCard->appendChild($slideBoxB);
          $treeCard->appendChild($slideBoxC);
    
    
          $previousLink = $domDoc->createElement('a','&#10094;');
          $previousLink->setAttribute('class','prev');
          $previousLInk->setAttribute('onclick','plusSlides(-1)');
    
          $forwardLink = $domDoc->createElement('a','&#10095;');
          $forwardLink->setAttribute('class','next');
          $forwardLInk->setAttribute('onclick','plusSlides(1)');
    
          $treeCard->appendChild($previousLink);
          $treeCard->appendChild($forwardLink);
    
          //dots/circles
          $dotCircleBox2 = $domDoc->createElement('div');
          $dotCircleBox2->setAttribute('style','text-align:center');
          $dotSpan1 = $domDoc->createElement('span');
          $dotSpan1->setAttribute('class','dot');
          $dotSpan1->setAttribute('onclick','currentSlide(1)');
    
    
          $dotSpan2 = $domDoc->createElement('span');
          $dotSpan2->setAttribute('class','dot');
          $dotSpan2->setAttribute('onclick','currentSlide(2)');
    
    
          $dotSpan3 = $domDoc->createElement('span');
          $dotSpan3->setAttribute('class','dot');
          $dotSpan3->setAttribute('onclick','currentSlide(3)');
    
          $dotCircleBox2->appendChild($dotSpan1);
          $dotCircleBox2->appendChild($dotSpan2);
          $dotCircleBox2->appendChild($dotSpan3); //FORGOT TO APPEND THESE??
          $treeCard->appendChild($dotCircleBox2);
    
          
         }
      }
        $cardBody->appendChild($productInfoList);
        $treeCard->appendChild($cardBody);
      //for the forward and backwards arrow heads
        $cardContainer = $domDoc->createElement('div');//needs to be appended to items-wrapper
        if(!(is_null($value["treeImage2"])) || !(is_null($value["treeImage3"]))){
          $cardContainer->setAttribute('class','container mt-3 slides-container'); 
        }else{
          $cardContainer->setAttribute('class','container mt-3'); 
        }
        
        $cardContainer->appendChild($treeCard);
        $outerContainer->appendChild($cardContainer);
    }
    $domDoc->appendChild($outerContainer);
    $htmlString = $domDoc->saveHTML();
    echo $htmlString;
    
    

    So from the code above I am am getting the data back from database but like I said earlier I want the information presented in a html grid layout with bootstrap cards. The problems occur in the last part of the code with the nested foreach loop (see asterisks in code) and when I start used DOM elements. Essentially, I want to check on each iteration whether treeseed record has only one image or more. If a treeseed has more than one image then I want to render a bootstrap 5 card that has a slideshow where they user can click the dots/circles of navigation arrowheads to see the separate images. //***TEST is just a echo statement to test if I am getting any data back.

    plusSlides() and currentSlide() are javascript functions in slidelogic.js and the classes “mySlides fade” are classes that are used in slidelogic.js. See the JavaScript file below.

    //slidelogic.js

    let slideIndex  = 1;
    
    showSlides(slideIndex);
    
    //Next/previous controls
    function plusSlides(slideNum){
      showSlides(slideIndex += slideNum);
    }
    
    // Thumbnail image controls
    function currentSlide(n) {
      showSlides(slideIndex = n);
    }
    
    function showSlides(number){
      let i;
      let slides = document.getElementsByClassName("mySlides");
      let dots = document.getElementsByClassName("dot");
    
      if(number > slides.length){
        slideIndex = 1;
      }
    
      if(number < 1){
        slideIndex = slides.length;
      }
      for (i = 0; i < slides.length; i++) {
        slides[i].style.display = "none";
      }
      for (i = 0; i < dots.length; i++) {
        dots[i].className = dots[i].className.replace(" active", "");
      }
      slides[slideIndex-1].style.display = "block";
      dots[slideIndex-1].className += " active";
    
    } 
    
    function currentSlide(number){
      displaySlides(slideIndex = number)
    }
    
    

    Then I import the JavaScript file above (slidelogic.js) and shopconnect.php into gardenshop.php

    //gardenshop.php

    <!DOCTYPE html>
    <html lang="en">
        <head>
          <meta charset="utf-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <meta name="author" content="creator">
          <link rel="stylesheet" href="./gardenshop.css">
          <link rel="icon" href="../tree_icon.png">
          <script src="../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
          <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" 
          integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLJAJ9/2PkPKZ5QiAj6Ta86w+fsb2TkcmfRyVX3pBnMFcV7oQPJkl9QevSCWr3W6A==" 
          crossorigin="anonymous" referrerpolicy="no-referrer" />
        </head>
        <body>
           <header>
             <div class="img-container"></div>
             <section class="shop-header"><h1>SPROUTY'S GARDENING SHOP</h1></section>
             <ul class="header-grp">
               <li class="header-item"><a id="back-link" href="./homepage.html"><i id="header-arrow" class="fa-solid fa-arrow-left-long"></i>Back To Homepage</a></li>
               <li class="header-item"><i class="fa-solid fa-cart-shopping"></i></li>
             </ul>
           </header>
           <main>
              <div class="f-container">
                <div class="box-1">
                  <dl>
                    <dt class="inline-dt">Contains Stainless Steel</dt>:&nbsp<input type="checkbox" class="filter-checkbox" id="tool_stainlessstl" name="tool_stainlessstl"/>
                    <dt class="inline-dt">FSC &#40;Forest Stewardship Council&#41; certified</dt>:&nbsp<input type="checkbox" class="filter-checkbox" id="tool_fsc_cert" name="tool_fsc_cert"/>
                    <dt class="inline-dt">In Stock</dt>:&nbsp<input type="checkbox" class="filter-checkbox" id="tool_stock" name="tool_stock"/>
                  </dl>
                 </div>
                 <div class="box-2">
                   <dl>
                    <dt class="inline-dt">In Stock</dt>:&nbsp<input type="checkbox" class="filter-checkbox" id="giftcard_stock" name="giftcard_stock"/>
                    <dt class="inline-dt">Weight &#40;grams&#41;</dt>:&nbsp<input type="range" min="0" max="50" id="giftcard_weight" name="giftcard_weight"/>
                    <dt class="inline-dt">Price</dt>:&nbsp<input type="range" min="0" max="30" step="0.01" id="giftcard_price" name="giftcard_price"/>  
                    <dt class="inline-dt">FSC &#40;Forest Stewardship Council&#41; certified</dt>:&nbsp<input type="checkbox" class="filter-checkbox" id="giftcard_fsc_cert" name="giftcard_fsc_cert"/>
                   </dl>
                 </div>
                 <div class="box-3">
                  <dl>
                    <dt class="inline-dt">In Stock</dt>:&nbsp<input type="checkbox" class="filter-checkbox" id="fertiliser_stock" name="fertiliser_stock"/>
                    <dt class="inline-dt">Litres &#40;Capacity&#41;</dt>:&nbsp<input type="range" min="10" max="60" id="fertiliser_capacity" name="fertiliser_capacity"/>
                    <dt class="inline-dt">Price</dt>:&nbsp<input type="range" min="0" max="20" step="0.01" id="fertiliser_price" name="fertiliser_price"/>
                  </dl>
                 </div>
                 <div class="box-4">
                  <dl>
                    <dt class="inline-dt">In Stock</dt>:&nbsp<input type="checkbox" id="treeseed_stock" name="treeseed_stock"/>
                    <dt class="inline-dt">Soil Type</dt>:&nbsp<select name="soiltypes" id="soiltypes">
                      <option value="chalk">chalk</option>
                      <option value="sand">sand</option>
                      <option value="loam">loam</option>
                      <option value="clay">clay</option>
                    </select>
                    <dt class="inline-dt">Soil Acidity</dt>:&nbsp<select name="soilacidity" id="soilacidity">
                      <option value="acid">acid</option>
                      <option value="alkaline">alkaline</option>
                      <option value="neutral">neutral</option>
                    </select>
                    <dt class="inline-dt">Hardiness</dt>:&nbsp<select name="hardiness" id="hardiness">
                      <option value="hardy">hardy</option>
                      <option value="tender">tender</option>
                      <option value="hardy/half-hardy">hardy/half-hardy</option>
                    </select>
                    <dt class="inline-dt">Price</dt>:&nbsp<input type="range" min="0" max="4" step="0.01" id="treeseed_price" name="treeseed_price"/>
    
                  </dl>
                 </div>
                 <div class="box-5">
                  <dl>
                     <dt class="inline-dt">In Stock</dt>:&nbsp<input type="checkbox" id="compost_stock" name="compost_stock"/>
                     <dt class="inline-dt">Is Biodegradable</dt>:&nbsp<input type="checkbox" class="filter-checkbox" id="compost_degradable" name="compost_degradable"/>
                     <dt class="inline-dt">Litres &#40;Capacity&#41;</dt>:&nbsp<span><input type="range" min="0" max="280" id="compost_capacity" name="compost_capacity"/>
                     <dt class="inline-dt">Price</dt>:&nbsp<input type="range" min="0" max="20" step="0.01" id="compost_price" name="compost_price"/>
                  </dl>
                </div>
              </div>
                <?php require_once './shopconnect.php'; ?>
                <script type="text/javascript" src="./slidelogic.js"></script>
    
           </main>
    
        </body>
    </html>
    

    Finally hear is some CSS from gardenshop.css

    //gardenshop.css

    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    
    }
    
    .mySlides {
      display: none;
    }
    
    [class~="container mt-3"]{
      position: relative;
    }
    
    .prev,.next{
      transition-duration: 0.6s;
      transition-timing-function: ease;
      cursor: pointer;
      position: absolute;
      top: 50%;
      width: auto;
      margin-top: -22px;
      padding: 16px;
      color: white;
      font-weight: bold;
      font-size: 18px;
      border-radius: 0 3px 3px 0;
      user-select: none;
      -webkit-user-select: none; /* Safari */
      -ms-user-select: none; /* IE 10 and IE 11 */
    }
    
    .next{
      right: 0;
      border-radius: 3px 0 0 3px;
    }
    
    .prev:hover, .next:hover {
      background-color: rgba(0,0,0,0.8);
    }
    
    .numbertext {
      color: #f2f2f2;
      font-size: 12px;
      padding: 8px 12px;
      position: absolute;
      top: 0;
    }
    
    .dot {
      cursor: pointer;
      height: 15px;
      width: 15px;
      margin: 0 2px;
      background-color: #bbb;
      border-radius: 50%;
      display: inline-block;
      transition-property: background-color; 
      transition-duration: 0.6s;
      transition-timing-function: ease;
    }
    
    .active, .dot:hover {
      background-color: #717171;
    }
    
    @keyframes fade{
      from{opacity: 0.4};
      to{opacity: 1};
    }
    
    .fade {
      animation-name: fade;
      animation-duration: 1.5s;
      animation-direction: normal;
    }
    
    /*CSS for the product items dynamically made in PHP (shopconnect.php)*/
    
    .items-wrapper{
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
      grid-gap: 1rem;
    }
    
    
    

    I tried my code out above via XAMMP (render the php file gardenshop.php using the Apache on it)

    I get the following output in the image below. I would like to know how to get the bootstrap 5 cards to render in a grid dynamically. Dynamically in the sense I don’t need to hard code the grid items; if I want to add more treeseed data to my database I can do that and then when the gardenshop.php webpage is loaded (going via localhost in my browser) it will render the correct number of grid items (cards) automatically.

    Image of gardenshop.php when I go to localhost and the specific page using XAMPP](https://i.sstatic.net/0bk8E7lC.png)

  • i want to make years slider with html css and js

    slider example

    I want to create a horizontal timeline slider, similar to the one in the image below, where each year is clickable and linked to specific content. The part I’m struggling with is how to link the slider with specific dates (e.g., 2011, 2012, 2013) and display corresponding content when each date is clicked.

    I already know how to create the styled box for the content section, but I’m unsure how to implement the timeline and link each date to specific content using jQuery or a plugin.

    Here is an example of what I want to achieve:

    Could someone recommend a jQuery plugin or suggest an approach to create a timeline like this?

    Mapping in component with Redux and getting error noticesType.map is not a function

    I have all the needed working pieces of the React Redux-toolkit working but I can’t seem to get my data to display in the component. I’m getting the error:

    TypeError: noticesType.map is not a function

    > 31 |             {noticesType.map((post, index) => { 
     |                          ^
      32 |               <li key={index}>
    

    When I Google the error. When I see is that I’m most likely passing an object when it’s looking for an array. I am pretty sure I have it set up correctly. I have The Redux DevTools open, and it shows me the correct data coming back from the API call. After 3 days of searching the web, this is where I’m at. If there is more code or anything I’ve missed please let me know.

    page.tsx

      export default function page() {
        const dispatch = useAppDispatch();
        const {noticesType, loading, error} = useAppSelector(state => state.noticesReducer)
    
      useEffect(() => { 
        dispatch(fetchNotices())
      }, [dispatch])
    
     return (
    <>
      <div> 
        <h1>Notices</h1>
        <ul>  
          <>    
            {noticesType.map((post, index) => { 
              <li key={index}>
                {post.Title}
              </li>
            })}                
          
          </>                
        </ul>
      </div>
    </>
     )
     }
    

    noticesTypes.ts

    export type NoticesType = { 
      noticesType: NoticeType[], 
      createdDateTime: Date | string, 
      title: string, 
      version: string,     
    } 
    
    export type NoticeType = { 
      id: string, 
      Title: string, 
      Description: string,  
      startDateTime: Date | string, 
      endDateTime: Date | string,
      planned: boolean,       
    }
    

    notice.ts / noticeSlice

    type NoticeState = NoticesType & {     
      loading: boolean, 
      error: boolean
     }
    
    const initialState: NoticeState = {
       noticesType: [], 
       createdDateTime: '', 
       title: '', 
       version: '', 
       loading: false, 
       error: false
    }
    
    
    
    export const fetchNotices = createAsyncThunk('fetchNotices', async (thunkApi,{rejectWithValue}) => {
    
      try {
        const response = await fetch("https://API_CALL/notice")                          
        return await response.json(); 
        
      } catch (error) {
        return rejectWithValue("Something isn't working"); 
      }
    }); 
    
    export const noticeSlice = createSlice({ 
      name: 'notices', 
      initialState, 
      reducers: {
        setNotice: (state, action) => { 
            state.noticesType = action.payload
        }, 
        getNotice: (state, action) => { 
            return action.payload.notices
        },         
    }, 
    extraReducers: (builder) => { 
        builder
        .addCase(fetchNotices.pending, (state, action) => {            
            state.loading = true;
        })
        .addCase(fetchNotices.fulfilled, (state, action) => {             
            state.loading = false, 
            state.noticesType = action.payload
        })
        .addCase(fetchNotices.rejected, (state, {payload}) => { 
            state.loading = true                       
        })
     }
    })
    
    export const { 
      getNotice,
      setNotice,     
    } = noticeSlice.actions
    
    export default noticeSlice.reducer
    

    index.ts / store

    export const store = configureStore({ 
    reducer: { 
        noticesReducer, 
    }, 
    middleware: getDefaultMiddleware => getDefaultMiddleware({serializableCheck: false})
     })
      console.log(store.getState()); 
    
     export type RootState = ReturnType<typeof store.getState>
     export type AppDispatch = typeof store.dispatch
    

    SignaturePad in React: Signature appears magnified and cropped when switching to mobile simulation mode

    Question:

    I’m using the signature_pad library in a React JS application to capture user signatures. The signature pad works fine in desktop mode and on actual mobile devices or initial component mount in mobile inspect mode.

    However, when I switch to mobile simulation mode using the browser’s developer tools (e.g., in Chrome), I encounter an issue:

    • The signature pad allows me to draw the signature correctly.

    • But when I proceed to display the signature elsewhere in the app (e.g., in a PDF or another component), the signature appears magnified and cropped, showing only the top-left quarter of the signature.


    At first in desktop mode:

    enter image description here

    When switched to the Responsive Design Mode (aka inspect mobile mode):

    enter image description here


    This issue only occurs when simulating mobile devices in the browser. It does not happen in regular desktop mode or on actual startup of mobile devices or initial component mount in mobile inspect mode.

    I suspect it has something to do with the device pixel ratio (DPR) or canvas scaling when switching to mobile simulation mode, but I’m not sure how to fix it.

    Here is my code:

    SignatureCanvas.jsx:

    const SignatureCanvas = ({ canvasRef, onSignClear, turnOffSignPad }) => {
      const hideResetSignButton = turnOffSignPad;
      const disableCanvasUserSelect = turnOffSignPad ? 'none !important' : 'auto';
    
      return (
        <Paper
          PaperProps={{
            className: 'signature-container',
            sx: { p: 0, boxShadow: 0.25, borderRadius: 2, userSelect: disableCanvasUserSelect },
          }}
        >
          <canvas
            ref={canvasRef}
            style={{
              width: '100%',
              height: '300px',
            }}
          />
        </Paper>
      );
    };
    

    SignPaper.jsx:

    function SignPaper({ foundQuote, signature, setSignature, isQuoteAccepted, closeDialog }) {
      const canvasRef = useRef(null);
      const signPadRef = useRef(null);
    
      const turnOffSignPad = isQuoteAccepted;
    
      useEffect(() => {
        const resizeCanvas = () => {
          const canvas = canvasRef.current;
          const context = canvas.getContext('2d');
          const ratio = Math.max(window.devicePixelRatio || 1, 1);
    
          canvas.width = canvas.offsetWidth * ratio;
          canvas.height = canvas.offsetHeight * ratio;
          context.scale(ratio, ratio);
    
          if (signature) {
            signPadRef.current.fromDataURL(signature);
          } else {
            clearSign();
            closeDialog();
          }
        };
    
        if (!signPadRef.current) {
          signPadRef.current = new SignaturePad(canvasRef.current);
        }
    
        resizeCanvas();
    
        if (turnOffSignPad) {
          signPadRef.current.off();
        }
    
        window.addEventListener('resize', resizeCanvas);
        signPadRef.current.addEventListener('endStroke', saveSignature);
    
        return () => {
          window.removeEventListener('resize', resizeCanvas);
          signPadRef.current.removeEventListener('endStroke', saveSignature);
        };
      }, []);
    
      const clearSign = () => {
        if (signPadRef.current && signature !== null) {
          signPadRef.current.clear();
          setSignature(null);
        }
      };
    
      const saveSignature = () => {
        if (signPadRef.current && !signPadRef.current.isEmpty()) {
          const signData = signPadRef.current.toDataURL('image/svg+xml');
          setSignature(signData);
        }
      };
    
      return (
        <Paper>
          <SignatureCanvas
            canvasRef={canvasRef}
            onSignClear={clearSign}
            turnOffSignPad={turnOffSignPad}
          />
        </Paper>
      );
    }
    
    

    Questions:

    1. Why does the signature appear magnified and cropped when switching to mobile simulation mode in the browser’s developer tools?

    2. How can I fix this issue so that the signature displays correctly in all modes, including mobile simulation mode?

    display other name as user agent on website

    I have PHP control panel for TV and radio stations. Most of the radio stations which is shared by clients. So on some portals when someone clink on the radio station to listen because into my panel i have statistic for listeners, favorite user-agent, country i can see from which browser they listen too etc..

    But in some portals where radio stations is added when someone play the radio station into favorite user-agent not showing the real user-agent ex. “Mozilla/5.0 (Windows NT 10.0; Wi….. etc, its showin only name of the site for ex. “Example radio portal” what should i have to and which code i have to put into my HTML site when visitor play the radio station from my site to show ex. “my radio name site” instead of user agent. I know there is an option to use google analytics but i would like to know directly how much clients listen the radio stations from my radio portal.

    i was looking all the java script options but none of them not working.

    The geolocation pin is not displayed on the map

    I’m a novice developer. The third day I can’t understand what the problem is, I created an Aure Map, then I need to link it to the dynamics 365 fields, but the whole problem is that the map does not display a pin with geolocation, tell me what the problem is. My Code:

    <html>
      <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Azure Map Integration</title>
        <style>
          #myMap {
            height: 400px;
            width: 100%;
          }
        </style>
        <!-- Azure Maps SDK -->
        <script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.js"></script>
        <script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas-service.min.js"></script>
        <link
          rel="stylesheet"
          href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.css"
          type="text/css"
        />
      </head>
      <body>
        <div id="myMap"></div>
    
        <script>
          let map, datasource, searchService, pushpin;
    
          // Initialize Azure Map
          function initMap() {
            map = new atlas.Map("myMap", {
              center: [-73.935242, 40.73061], // Default center (New York)
              zoom: 12,
              authOptions: {
                authType: "subscriptionKey",
                subscriptionKey:
                  "api_key", // Replace with your Azure Maps key
              },
            });
    
            // Wait until the map resources are ready
            map.events.add("ready", function () {
              // Create a data source and add it to the map
              datasource = new atlas.source.DataSource();
              map.sources.add(datasource);
    
              // Create a search service for geocoding and reverse geocoding
              searchService = new atlas.service.SearchURL(map);
    
              // Try to get the user's current geolocation
              if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(
                  function (position) {
                    const userLocation = [
                      position.coords.longitude,
                      position.coords.latitude,
                    ];
    
                    // Center the map at the user's location
                    map.setCamera({
                      center: userLocation,
                      zoom: 15,
                    });
    
                    // Add a draggable pushpin at the user's location
                    pushpin = new atlas.data.Feature(
                      new atlas.data.Point(userLocation),
                      {
                        draggable: true,
                      }
                    );
                    datasource.add(pushpin);
    
                    // Create a symbol layer to render the pushpin
                    const symbolLayer = new atlas.layer.SymbolLayer(
                      datasource,
                      null,
                      {
                        iconOptions: {
                          image: "pin-blue", // Azure Maps default pin
                          anchor: "center",
                          allowOverlap: true,
                        },
                      }
                    );
                    map.layers.add(symbolLayer);
    
                    // Add dragend event listener to update form fields when pushpin is moved
                    map.events.add("dragend", pushpin, function () {
                      const location = pushpin.geometry.coordinates;
                      reverseGeocode(location);
                    });
                  },
                  function (error) {
                    console.error("Geolocation error: " + error.message);
                  }
                );
              } else {
                console.error("Geolocation is not supported by this browser.");
              }
            });
          }
    
          // Function to reverse geocode the pushpin position to update the Dynamics 365 fields
          function reverseGeocode(location) {
            searchService
              .reverseSearch(atlas.service.Aborter.timeout(10000), {
                query: location,
              })
              .then((response) => {
                const result = response.geojson.getFeatures();
                if (result.features.length > 0) {
                  const address = result.features[0].properties.address;
                  fillFormFields(address);
                }
              })
              .catch((error) => {
                console.log("Reverse geocode was not successful: " + error.message);
              });
          }
    
          // Function to fill Dynamics 365 fields based on reverse geocoding results
          function fillFormFields(address) {
            setFieldValue(
              "address1_line1",
              (address.streetName || "") + " " + (address.streetNumber || "")
            );
            setFieldValue("address1_city", address.municipality || "");
            setFieldValue("address1_stateorprovince", address.adminDistrict || "");
            setFieldValue("address1_postalcode", address.postalCode || "");
            setFieldValue("address1_country", address.countryRegion || "");
          }
    
          // Initialize the map on page load
          initMap();
        </script>
      </body>
    </html>
    

    I tried different things from azure map documentation to gpt the problem was not solved, the key if something is there and is also inscribed

    Problem with CSV export fom Google Earth Engine: final table is not what I want

    I am trying to download a CSV file with a time series of Landsat 8 EVI2, and with the respective date and plot id from multiple points using GEE according to the following code:

    var roi = ee.FeatureCollection([
     ee.Feature(ee.Geometry.Point([-43.8115,-16.6648]), {plot_id: 1}),
     ee.Feature(ee.Geometry.Point([-43.7923,-16.663]), {plot_id: 2}),
     ee.Feature(ee.Geometry.Point([-43.7794,-16.6596]), {plot_id: 3}),
     ee.Feature(ee.Geometry.Point([-43.8879,-16.7316]), {plot_id: 4}),
     ee.Feature(ee.Geometry.Point([-43.8487,-16.6756]), {plot_id: 5}),
     ee.Feature(ee.Geometry.Point([-43.8274,-16.6888]), {plot_id: 6}),
     ee.Feature(ee.Geometry.Point([-43.8946,-16.7579]), {plot_id: 7}),
     ee.Feature(ee.Geometry.Point([-48.3,-18.9833]), {plot_id: 8}),
     ee.Feature(ee.Geometry.Point([-44.1224,-16.3708]), {plot_id: 9}),
     ee.Feature(ee.Geometry.Point([-44.1134,-16.3687]), {plot_id: 10})
    ]);
    
    // Intervalo de tempo da minha série temporal
    var startdate = '2013-04-01'; 
    var enddate = '2024-04-30'; 
    
    var years = ee.List.sequence(ee.Date(startdate).get('year'), ee.Date(enddate).get('year'));
    
    
    // This function masks clouds in Landsat 8 imagery.
     function maskL8(im) {
       var qa = im.select('QA_PIXEL');
       var mask = qa.eq(2720);
       return im.updateMask(mask).copyProperties(im);
     }
    
    var ls8toa = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')
    .filterBounds(roi)
      .filterDate(startdate, enddate)
      .filter(ee.Filter.lt('CLOUD_COVER',0.3))
        .map(function(im) {return maskL8(im)});
    
    // Calcula EVI2 a partir do Landsat8
    
    var ls8_evi2 = ls8toa.map(function(image) {
      var evi2 = image.expression(
        '2.5*(NIR-RED)/(NIR+2.4*RED+1)', {
          'NIR': image.select('SR_B5'),
          'RED': image.select('SR_B4')
    }).rename('EVI2');
    return image.addBands(evi2);
    });
    
    var landsat = ee.ImageCollection(ls8_evi2);
    var EVI2 = ls8_evi2.select(['EVI2']);
    print(EVI2, 'EVI2');
    print('Quantas Imagens', EVI2.size());
    
    //Função pra calcular valores médios para cada ponto
    var pointsmean = function(image) {
      var means = image.reduceRegions({
        collection: roi.select(['plot_id']),
        reducer: ee.Reducer.mean(),
        scale: 30
      });
      
      // Atribuindo datas
      means = means.map(function(f) { return f.set({date: image.date().format("YYYY-MM-dd")}) });
      
      return means.copyProperties(image);
    };
    
    var finalEVI2 = EVI2.map(pointsmean).flatten()
    .sort('date', false);
    
    print(finalEVI2, 'final EVI2');
    
    // Exportar tabela em csv direto pro Drive
    Export.table.toDrive({
    collection: finalEVI2,
      description: 'EVI2_walter_'+startdate+'_TO_'+enddate,
      folder: 'LS8_walter',
    fileFormat: 'CSV'
    });
    
    

    Actually, I used 34 pairs of coordinates instead of 10 as shown in the code above. I simplified the sample in this Question.

    The output shown in the console is:

    Console output from the code above.

    The CSV file is not what I expected (see figure below). I need columns named ‘date’, ‘plot_id’, and ‘EVI2’ with the values.

    .csv file downloaded to Google Drive.

    What is wrong and how to fix it?

    How to validate and format large JSON files efficiently? [closed]

    I’m working with very large JSON files (up to a few MBs in size) and need a tool or method to validate and format them efficiently. Most online JSON tools I’ve tried tend to crash or are too slow when processing such large files.

    I’ve recently come across jsonmaster.com, which offers a JSON formatter, validator, and several other features, but I’m curious if anyone has any experience or recommendations on how to handle large JSON files in a more optimized way. Specifically:

    Are there specific libraries or tools that are designed to handle large JSON files better than others?
    How can I integrate such validation and formatting tools into a web-based app for large-scale use?
    Is there any strategy for breaking down the JSON file into smaller chunks for validation, then recombining them?
    Any advice on best practices or tools for this kind of scenario would be appreciated.

    tried jsonlint.com but failed

    Zod Validation for array of instance File

    I am making post form for a social media project and I am using zod for validation

    and this the solution in TypeScript but I am using JavaScript

    z.object({
        file: z.custom<File[]>()
    })
    

    How can I write this in Js

    I am not sure it my first time using zod

    I’m starting to get my hands into web development, Should I learn React or Do projects on vanilla JavaScript in the beginning

    I’m an aspiring full-stack developer currently enhancing my skills. I have a basic understanding of HTML and CSS, and I’m now looking to dive deeper into JavaScript and its frameworks. However, I’m at a crossroads and need some advice.

    Should I start by mastering Vanilla JavaScript before moving on to React, or can I jump straight into learning React?

    Here are a few points about my current situation:

    I have some experience with basic programming concepts.
    My ultimate goal is to build dynamic and responsive web applications.
    I enjoy learning through practical projects and hands-on experience.
    I’ve read that understanding the fundamentals of JavaScript is crucial, but I’ve also seen recommendations to start with React to quickly build real-world applications. What would be the best approach for someone in my position?

    Any insights or personal experiences would be greatly appreciated!

    Thanks in advance!

    Unable to import any module for nextjs

    I’m having some trouble with my Next.js project and I’m hoping someone here might be able to help. Here’s the situation:

    Issue: I’m trying to import modules in my Next.js project, but I keep running into errors indicating that modules cannot be resolved. For instance, when trying to import react-chartjs-2, I get the error Module not found: Can’t resolve ‘react-chartjs-2’.

    Setup:

    Next.js Version: 14.2.12 (as indicated in package.json)

    Error Message: Next.js (14.2.5) out of date when running the project, even though package.json lists version 14.2.12.

    Folder Structure: I have two directories in my project: nextjs and fastapi. Inside nextjs, there’s a node_modules folder and a package.json file.

    Questions:

    Why is there a version mismatch between package.json and the build error message?

    Are there any issues or steps I might have missed that could cause modules to not be resolved correctly?

    How can I make sure that my Next.js environment is correctly set up and using the right version?

    Steps Taken:

    I ran npm install in the nextjs folder to install dependencies and have tried reinstalling the dependency as well.

    I’ve tried deleting and reinstalling node_modules but still get the same errors.

    I checked that the correct Next.js version is listed in package.json, but the build process seems to be using an outdated version.

    I’ve also tried npm i next@latest as well

    Laravel javascript variable get in blade file

    I need get js var in view blade file.
    I got this one in Controller and got success in console
    in route file

    Route::post('/some-route', [Controller::class, 'someMethod']);
    Route::post('/some-route', 'Controller@someMethod');//this also work
    

    in js file in $(“#applyBonus”).on(“click”, function () method

    $.ajax({ 
        url: base_url + '/some-route', // The route to your Laravel controller 
        type: 'POST', 
        data: { 
            someVarName: someInput, // someInput is from blade file input value. got successfully 
             
        }, 
        success: function(response) { 
            console.log(response); //success
            alert("ssuccessss___" + someInput); //success
            
        }, 
        error: function(xhr) { 
            console.error(xhr.responseText); 
            alert("error___");
        } 
    }); 
    

    in Controller

    public function yourMethod(Request $request) { 
        //$variable = 'someVarName'; //this also work
        $variable = $request->input('someVarName'); 
        
        //return view('frontend.checkout', compact('variable')); // this also work
        //return view('frontend.checkout')->with('variable'); //this also work
        return view('frontend.checkout')->with('variableName', $variable);//success in console and alert message
    } 
    
    

    and now I tried to get this $variable in view.blade.php

    @foreach($variable as $varr) //undefined $variable
           <div class="row">{{ $variable }}</div>
           <div class="row">{{ $varr }}</div>
    @endforeach
    

    or

    echo $variable;
    //or next. also span tag
    <div class="row">{{ $variable }}</div>
    

    and all time I get error – $variable is undefined

    with I want do is to get input value as php $variable.
    maybe there other to get $variable from input value without page refresh?
    or
    How get this variable from controller in view blade file?
    Thanks

    try get input value via input value->js var -> controller -> blade file. on last step get error $variable undefined