Image is not rendering from the backend assert folder

I’m working on a movie recommendations web app, but I’m having trouble getting images from the backend to display on the frontend. When I directly use the image path, like this:

<img src={http://localhost:8000/images/Jailer.jpg} alt={item.movieName} />
I can see the image of “Jailer” from the backend. But when I comment that line out and instead use item.movieImage, like this:

<img src={http://localhost:8000/images/${item.movieImage}} alt={item.movieName} />
the image doesn’t render. In the tag, I’m seeing “Jailer.jpeg”, so I know the image path is correct. I’ve tried to debug this, but I can’t figure out why it’s not working. Could you please help me out?

I don’t know to do can anyone help me guys?

history.replaceState() causes user media video to became black on iOS 17

I have a case, when I need to update a browser’s URL while a user is streaming video from an iPhone. I update the URL like this.
window.history.replaceState(null, "", browserUrl);

On iOS 17 it causes a user media video to became black. See an attached video.
I can’t reproduce it on iOS 16.

Demo code: https://github.com/ivan-banha/safari-video-container-resize/commit/7197fb57e9758c81ff482fab7fe210bcf59f87b0

Demo link: https://ivan-banha.github.io/safari-video-container-resize

Demo video: https://github.com/ivan-banha/safari-video-container-resize/blob/main/assets/safari-replace-url-bug.mp4

STR:

  1. Open the link in mobile safari.
  2. Press the “share screen” button.
  3. When a video from a camera appears, press the “replace url” button.
  4. The video should become black.

Is this a bug in safari or expected behaviour?

Next js 14.1.4 npm run build issue like The “next export” command has been removed in favor of “output: export” in next.config.js

Hello i am new to front end next js deplyoment
currently, i have created one next js application with version 14.1.4
and to build deployment i am using this command
npm run build
but it is giving below error
The "next export" command has been removed in favor of "output: export" in next.config.js. Learn more: https://nextjs.org/docs/advanced-features/static-html-export

below is my next.config.js file can someone please help me to resolve this issue

/** @type {import('next').NextConfig} */
const nextConfig = {
    async rewrites() {
        return [{
            source: "/(t|T)(e|E)(x|X)(t|T)",
            destination: "/text"
        }]
    },
    images: {
        domains: [
            'naturalproduct.s3.amazonaws.com',
            'naturalproductproduction.s3.amazonaws.com',
            'naturalproductstaging.s3.amazonaws.com',
            'naturalproducttest.s3.amazonaws.com',
            'cdn-icons-png.flaticon.com',
            'static.vecteezy.com']
    },
    experimental: {
        missingSuspenseWithCSRBailout: false,
    },
    env: getEnvConfig()
}

module.exports = nextConfig

function getEnvConfig() {
    const dotenv = require('dotenv');

    const environment = process.env.TARGET_ENV || process.env.NODE_ENV;
    const envFilePath = `.env.${environment}`;

    try {
        const result = dotenv.config({ path: envFilePath });
        if (result.error) {
            throw result.error;
        }
        return result.parsed;
    } catch (err) {
        console.error(`Error loading environment variables from ${envFilePath}: ${err.message}`);
        return {};
    }
}

How can I capture integrated fingerprint data from an android tablet to my browser webapp?

I have a tablet with an inbuilt fingerprint scanner and I want to access the fingerprint data from the device into my NextJS app, I’ve been looking for libraries to do that but no luck.

However the device came with an android app that can access this features, but it is of no use to me as I need to capture users’ fingerprints directly in my webappPicture of device i am using and save them to my database.

I haven’t tried any workaround this issue as I dont even have any idea where to start. Although I have the SDK or source code for the app that works with this features and it’s written in Java.

Why cant I import this file into my code in JavaScript?

I tried to import a file into a code but the foulder could not be found.
However when i try to type the name of the folder out it already suggests me the folder and recognizes it as such.
I also already have tried out to write the entire path out but the result is the same.

I hope someone can find my rookie mistake.

I have provided a screenshot where the folder name and the error can be found

Best Regards.enter image description here
enter image description here

    import { Routes, Route } from "react-router-dom";
    import "./globals.css";
    import SigninForm from "./_auth/forms/SigninForm";
    import { Home } from "./_root/pages";
    import SignupForm from "./_auth/forms/SignupForm";
    import AuthLayout from "./_auth/AuthLayout";
    import RootLayout from "./_root";


    
    const App = () => {
    return (
    <main className="flex h-screen">
    <Routes>
     {/* public routes */}
     <Route element={<AuthLayout />}>

     
     <Route path= "sign-in" element ={<SigninForm />} />
     <Route path= "sign-up" element ={<SignupForm />} />
     </Route>
      {/* private routes */}
      <Route element={<RootLayout />}>

      <Route index element ={<Home />} />
      </Route>
      </Routes>
      </main>
      )
      }

      export default App

Configure DHIS2 to add Javascript

How can I customize DHIS2 to add javascript file to autocalculate form’s fields? Help me!

I tried to add autocalculate using GUI but seems GUI does not support that or maybe i just don’t know. if there is a way to do this without using javascript then, help me, if not help me on how to add the javascript file into dhis2.

How can I get waterpolo betting tips for a specific country using JavaScript?

I am a programmer looking to retrieve waterpolo betting tips for a specific country using JavaScript. I have found a resource that provides referees by country, but I am unsure how to use this information to get betting tips.

I have tried using the provided resource link with the country_id parameter, but I am not sure how to extract the betting tips data. I expected to receive a list of betting tips for the specified country, but I did not get the desired result.

const country_id = '123';
const url = `https://waterpolo.sportdevs.com/referees-by-country?country_id=eq.${country_id}`;

fetch(url)
  .then(response => response.json())
  .then(data => {
    console.log(data);
  })
  .catch(error => console.error('Error:', error));

Update DOM in real time by JQuery (using AMCharts5) – need to find the best way to improve performance

I have a system that need to show logs of locations in real-time. My API returns 1000 rows per second and I need to show all rows in DOM. However, a row is added to table DOM every 50ms. Hence, I have a queue to store all objects that are waiting for displaying in DOM. Here is my queue array:

queue = [
  {"datetime": "20240429110000001", "id": "abc1", "country": "USA", "lat": "37.77777", "lng": "-122.5"},
  {"datetime": "20240429110000002", "id": "abc1", "country": "USA", "lat": "36.66666", "lng": "-120.5"},
  {"datetime": "20240429110000003", "id": "abc1", "country": "USA", "lat": "35.55555", "lng": "-118.5"},
  {"datetime": "20240429110000004", "id": "abc1", "country": "USA", "lat": "34.44444", "lng": "-116.5"}
]

And here is my table:

<thead>
  <tr>
    <th>Datetime</th>
    <th>ID</th>
    <th>Location</th>
    <th>Latitude</th>
    <th>Longitude</th>
  </tr>
</thead>
<tbody id="live-data">
  <tr id="item-0"></tr>
</tbody>

Each one is pushed between header row and the first row in tbody. When the table reaches 50 rows, the next row showing to DOM, it will remove the last row of table (meaning the oldest time). Here is my JQuery to insert row:

let preID = 0;
setInterval(() => {
  $(`
    <tr id="item-${queue[0].id}">
      <td>${queue[0].datetime}</td>
      <td>${queue[0].id}</td>
      <td>${queue[0].country}</td>
      <td>${queue[0].lat}</td>
      <td>${queue[0].lng}</td>
    </tr>
  `).insertBefore(`#item-${preID}`);
  preID = queue[0].id

  // Map update function (AMCharts5)
  mapUpdate(queue[0])

  queue.shift();
}, 50);

After updating, I use queue.shift() to remove the first element in queue. If there are 50 rows in table, I use the following code to remove the oldest row.

$(`#item-${oldestID}`).remove();

My problem is, this code is running smoothly after a minute or two (along with map update), but after that, DOM is updating slower and slower, and may get crashed at some points. So what should I need to improve the performance when updating DOM? Because this system must be run 24/24 hours.

Reponsive Grid MUI with order

I’m trying to achieve the following responsive Grid:

https://i.sstatic.net/ARfMpH8J.png

For desktop I’ve already set up the needed code:

         <Grid container spacing={2}>
          <Grid item sm={12} lg={6} order={{ sm: 2, lg: 1 }}>
            <Gallery
              images={product.images.map((image) => ({
                src: image.url,
                altText: image.altText
              }))}
            />
          </Grid>
          <Grid item sm={12} lg={6} container direction="column" order={{ sm: 1, lg: 2 }}>
            <Grid item>
              <ProductDescription product={product} />
            </Grid>
            <Grid item order={{ sm: 3, lg: 2 }}>
              <Typography variant="titolo-1">$99.99</Typography>
            </Grid>
          </Grid>
        </Grid>

My question has to do with the order of the items. On mobile the nested grid item container should not apply giving the possibility to order items like the attached image.
Is it possible to achieve without hiding and duplicating content?

how to put a custom close button in bootstrap modal

I’m working on a project where I need to create a Bootstrap modal with a close button positioned at the top right corner. While I’ve managed to position the button using CSS, it’s not quite sticking to one spot. Despite applying absolute positioning, the button seems to move around inconsistently. I’ve tried troubleshooting the issue by adjusting the CSS properties and inspecting the elements in the browser’s developer tools, but I haven’t been able to find a solution.

enter image description here

Html

 <div class="modal fade" id="POD__Modal" tabindex="-1" aria-labelledby="POD__ModalLabel" aria-hidden="true">
      <div id="modal__close" class="  sticky-top">
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-dialog">
        
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title" id="POD__ModalLabel">Proof of delivery</h5>
            
            </div>
          <div class="modal-body">
            <figure class="zoom" onmousemove="zoom(event)" style="background-image: url(https://i.guim.co.uk/img/media/70a2fd5f5acddd683b892245209974fa4c768498/324_0_1429_858/master/1429.jpg?width=1200&height=1200&quality=85&auto=format&fit=crop&s=e2b8991e17e7bd966a29f5c706fe2552)">
              <img src="https://i.guim.co.uk/img/media/70a2fd5f5acddd683b892245209974fa4c768498/324_0_1429_858/master/1429.jpg?width=1200&height=1200&quality=85&auto=format&fit=crop&s=e2b8991e17e7bd966a29f5c706fe2552" />
            </figure>
          </div>
          
        </div>
      </div>
    </div>

CSS

/* POD Image Modal  */
#POD__Modal .modal-body {
  padding: 0px;
}

#POD__Modal .modal-header {
  justify-content: space-around;
  color: var(--primary-color);
}

#POD__Modal #modal__close {
  position: absolute;
  margin-right: auto;
  margin-left: auto;
  top: -0.1rem;
  right: 0rem;
  z-index: 999999;
  padding: 5px;
  border-radius: 50%;
  background-color: var(--secondary-color);
}
#POD__Modal .btn-close
{
  filter:  invert(1) grayscale(100%) brightness(300%) hue-rotate(180deg);
}

#POD__Modal .modal-content {
  border: 2px solid var(--secondary-color);
  border-radius: 1rem;
}

#POD__Modal .modal-body {
  border-bottom-left-radius: 1rem;
}

#POD__Modal figure.zoom {
  background-position: 50% 50%;
  position: relative;
  width: 100%;
  overflow: hidden;
  cursor: zoom-in;
}

#POD__Modal figure.zoom img:hover {
  opacity: 0;
}

#POD__Modal figure.zoom img {
  transition: opacity .5s;
  display: block;
  width: 100%;
 
}
#POD__Modal figure {
  border-bottom-left-radius: 1rem;
  border-bottom-right-radius: 1rem;
}

enter image description here

How do I update a d3 projection to match zoom tranform?

This is my zoom handler for my map:

const zoom = d3.zoom()
    .scaleExtent([1,25])
    .translateExtent([[width * -0.5, height * -0.5], [width * 1.5,height*1.5]])
    .on('zoom', (ev) => {
       svg.selectAll('path').attr('transform', ev.transform);  
    })

It updates the paths in the svg using the transform params from the event. This works great, but if I use projection(point) or similar methods to return the x,y coordinates of a point, then they will be incorrect.

I realise I need to update my projection to update the zoom/pan behaviour.

If I record the original map translation before any zooming, const origTrans = projection.translate(); and then apply the x,y transforms then I am able to correctly sync the projection for the top zoom level (ie k=1).

.on("end", (ev)=> {
  projection.translate([origTrans[0] + ev.transform.x * ev.transform.k, origTrans[1] + ev.transform.y * ev.transform.k]);
  const c =  projection([-3.3632, 55]);
  svg.append("circle")
    .attr("cx", c[0])
    .attr("cy", c[1])
    .attr("r", 9)
    .attr("fill", "red");
  }); 

I’m unclear as how zoom level relates to the projection scale. I can’t achieve the same thing

I’ve tried a few things e.g. – projection.scale(ev.transform.k), or projection.scale(projection.scale() * ev.transform.k) – I’m assuming there’s a lot more to it? If it helps I am using geoMercator for the projection.

QR Code:- Adding canvas(qr code surroundings color with white) and some content on image qr code along with it and download it

After downloading qr code expected results not happening

=>the below following code for gr code

var qrcode = new QRCode(document.getElementById("qrcode"), { text: qrcode_text, width: 212, height: 212, colorDark: "#000000", colorLight: "#ffffff", correctLevel: QRCode.CorrectLevel.H });

=> the below following code for canvas

`var downloadButton = document.getElementById('QRCode_download_btn');
downloadButton.addEventListener('click', function () {

    var canvas = document.getElementById('qrcode').querySelector('canvas');
    var anchor = document.createElement('a');
    anchor.href = canvas.toDataURL('image/jpeg');
    anchor.download = fileName +'.jpeg';
    anchor.click();
});`

=>example
qr code height :- 212
qr code width:- 212

canvas height :- 500
canvas width:- 500

=> after user click on download button create canvas(background color = white) and draw qr code with respective values and some content on image

Cordov JS file local resourse not loaded in Android

I want to render data from android cache memory JS file stored in my cordova project so I wrote html code as below

<script src="file:///data/data/com.stifirestop.systems2/files/system_menu_data.js"></script>

JS file code for download

var fileTransfer = new FileTransfer();
    var url = "https://systems.stifirestop.com/api/data/system_menu_data.js";
    var targetPath = cordova.file.dataDirectory + "system_menu_data.js";
    console.log("targetPath menu", targetPath);
    fileTransfer.download(
        url,
        targetPath,
        function (entry) {
            console.log("Download complete: menu " + entry.toURL());
        },
        function (error) {
            console.error("Download error:menu " + error.source + ", " + error.target + ", " + error.code);
        },
        true, // Optional, set to true if you want to overwrite existing files
         
    );

    // Second JS file
    var url2 = "https://files.stifirestop.com/automate/systems_mongo_dump/mongo_dump.js";
    var targetPath2 = cordova.file.dataDirectory + "mongo_dump.js";
    console.log("targetPath2 mongo", targetPath2);
    fileTransfer.download(
        url2,
        targetPath2,
        function (entry) {
            console.log("Download complete: mongo " + entry.toURL());
        },
        function (error) {
            console.error("Download error:menu " + error.source + ", " + error.target + ", " + error.code);
        },
        true, // Optional, set to true if you want to overwrite existing files
    );

File is successfully stored in my android files folder as below

enter image description here

When I run project in android device it give me error like

“Not allowed to load local resource: file:///data/data/com.stifirestop.systems2/files/system_menu_data.js”, source: https://localhost/index.html (0)

“Not allowed to load local resource: file:///data/data/com.stifirestop.systems2/files/mongo_dump.js”, source: https://localhost/index.html (0)

Any idea how I can solve this ?

How to correctly download pdf and docx file in React JS?

I am trying to download docx or pdf file in React JS(depending on server response) when I get the response from the server. Backend is implemented in Python/Flask.

When I try to download the file, it downloads but damaged and corrupted.

React JS

function downloadDocument(downloadLink, downloadType) {
 const documentBlob = new Blob([downloadLink], { type: downloadType });
 const url = window.URL.createObjectURL(documentBlob);
 const anchor = document.createElement('a');
 anchor.href = url;
 anchor.download = document_title;
 document.body.appendChild(anchor);
 anchor.click();
 document.body.removeChild(anchor);
 window.URL.revokeObjectURL(url) ;
}

Backend Python/Flask

@app.route('/download_document_docx/<request_document_id>', methods=['GET'])
@token_required
def download_document_docx(current_user, request_document_id):
    '''
    Docx document preparation code
    '''
    return send_file(docx_file_path, as_attachment=True, mimetype="application/vnd.openxmlformats-officedocument.wordprocessingml.document")