Camera is not working whenever i try to run my qr code project to my browser

i have a project idea where the employee scans the qr code of the applicant that was given by the company after he submitted his application online, whenever the employee scans the qr code the record of the applicant will automatically appear. the problem is whenever i try to run my code on the chrome browser there is no camera appearing my browser. I’m using xampp for local development with a language of php and javascript. can anyone help me i tried some ways to fix it and also ask chat gpt for solving this problem but the issue is still persist.

(sorry for my bad english this is not my native language)

i tried everything on what chat gpt said but the problem is still there, I’m expecting to show my camera on my browser to scan the qr code.

my proble is about button when clicked on it it didnot run that show new menu

i make code js for icon beager in header so i due to when user click on it show new bakground-color that in it is ul ect

this code js i think my problem is in js

let bgc_menu_header = document.querySelector(".bgc_menu_header")
let menuBtn = document.querySelector(".btn-beager-icon")
let menuBtnicon = document.querySelector(".btn-beager-icon img")

bgc_menu_header.addEventListener("click", function(){
   if (menuBtnicon.classList.contains("menu_header")){
    bgc_menu_header.style.left = "0";
    menuBtnicon.classList="menu_header"
   } else{
        bgc_menu_header.style.left = "-299px";
    menuBtnicon.classList="menu_header"
   }
})

Dynamically add rounded corners in stacked bar chart (amcharts 4)

I was following the guide from the documentation trying to implement the same feature, but can’t make the code work the same way. I am aiming to make series’s corners rounded on the right side if it’s the last series in the bar.

When the chart is rendered initially I see the desired rounded corners, but once I start to toggle series, corner radius properties are not updated dynamically (e.g. the third piece of the bar becomes the last one but it doesn’t start having rounded corners on the right side).

That's how it looks now

I tried to log the currentColumnValueX property and I see, that when I toggle for example Asia series, currentColumnValueX is always equals Asia‘s valueX. That results in the check on the last line of adapter function always being false.

const borderRadiusAdapter = (_, target) => {
  if (!chart) {
    return 0;
  }

  const dataItem = target.dataItem;
  let lastSeries;

  chart.series.each((series) => {
    const isHidden =
      !series.properties.visible || series.isHidden || series.isHiding;
    const shouldProcessSeries =
      Boolean(series.dataFields.valueX) &&
      Boolean(dataItem.dataContext[series.dataFields.valueX]) &&
      !isHidden;
    if (shouldProcessSeries) {
      lastSeries = series;
    }
  });

  const currentColumnValueX = dataItem?.component?.dataFields?.valueX;
  const lastSeriesValueX = lastSeries?.dataFields?.valueX;
  
  // When I toggle Latin America in the legend, currentColumnValueX is always Latin America,
  // whereas lastSeriesValueX is Asia, I just can't understand why Asia is not rerendered, 
  // so it have rounded right side
  console.log('currentColumnValueX', currentColumnValueX)
  console.log('lastSeriesValueX', lastSeriesValueX)
  return lastSeriesValueX && lastSeriesValueX === currentColumnValueX ? 10 : 0;
};

Here’s the codepen with the full implementation.

Could someone tell me, please, what might be the problem?

How to Fetch File Name from Default Upload Feature in Telerik File Explorer and Set Character Limit Validation

I am using the Telerik File Explorer in my web application, and I need assistance with the default file upload feature. I have two specific requirements:

Fetching the File Name: How can I programmatically retrieve the file name from the default upload feature in Telerik File Explorer when a user selects a file?

Setting Character Limit Validation: I want to implement a validation rule to limit the file name to a maximum of 100 characters. If the file name exceeds this limit, an error message should appear, instructing the user to shorten the file name.

I tried to fetch the select file from below code. But it wasn’t successful.

    function onClientFileSelected(radUpload, eventArgs) {
         var input = eventArgs.get_fileInputField();
         alert(input);
    }

Note:

<telerik:RadUpload id="RadUpload1" runat="server" allowedfileextensions=".zip,.txt" onclientfileselected="onClientFileSelected" />

This hasn’t used inside my .ascx file.

Default Upload

Above image is when the user selected a invalid file, How do i add a new validation message for the character length.

Session information can be accessed with Postman but not from the front end

I am developing a web application with NodeJs. I save the session information to the session object in the login function, but this value returns undefined in the requests I make from the front end. I configured CORS settings on the NodeJs side but the result is the same. But when I send the same request with Postman, it works smoothly. Can you offer any solution or can I do this in a different way?

The login function code I use in the router is as follows:

exports.loginWithLdap = catchAsync(async (req, res, next) => {
  const { username, password } = req.body;

  if (!username || !password) {
    return next(new AppError('Please provide username and password!', 404));
  }
  const user = await ldapService.authenticate(username, password);
  if (!user) {
    return next(new AppError('Ldap authentication failed!', 401));
  }
  const otp = await otpService.generateAndSaveOTP(user.mail);

  await otpService.sendOTP(user.mail, otp);
  req.session.user = user;
  
  res.cookie('user', user, { httpOnly: true });
  res.status(200).json({
    status: 'success',
    message: 'OTP sent successfully!',
  });
});

My cors and session settings are as follows:

app.use(
  cors({
    origin: 'http://localhost:5173', 
    credentials: true, 
    methods: 'GET,HEAD,PUT,PATCH,POST,DELETE', 
  })
);

app.use(
  session({
    secret: 'yourSecretKey',
    resave: true,
    saveUninitialized: true,
    cookie: {
      httpOnly: true,
      secure: false,
      sameSite: 'none',
      maxAge: 24 * 60 * 60 * 1000,
    },
  })
);

app.use('/api', userRouter);

And i am trying to read req.session.user in this function:

exports.verifyOtp = catchAsync(async (req, res, next) => {
  console.log(req.session.user);
  const { otp } = req.body;
  if (!otp) {
    return next(
      new AppError('Please provide an OTP code for authentication!', 404)
    );
  }
  await otpService.verifyOTP(req.session.user.mail, otp);

  res
    .status(200)
    .json({ message: 'OTP verified successfully!', user: req.session.user });
});

I tried to send request from Postman and it works fine. After that updated cors and session setings many times because i think that might be the problem. But it doesn’t work at all.

How to handle the delay between the drag leave and actual drop event in Angular

<div dragDrop class="container" (fileDropped)= "fileDropped >

<kendo-grid [data]="gridData"></kendo-grid>

</div>

“container” occupies entire page. When a file from explorer dragged and dropped in the container area fileDropped method will populate. I have some functionality in the fileDropped method.

dragDrop is directive.

import {
  Directive,
  Output,
  EventEmitter,
  HostBinding,
  HostListener,
  Input
} from '@angular/core';
@Directive({
  selector: '[DragDrop]'
})
export class DragDropDirective {
  @Output() fileDropped = new EventEmitter<any>();
  @HostListener('dragenter', ['$event']) onDragStart(evt: any) {
    evt.preventDefault();
    evt.stopPropagation();
  }
 
  // Dragover listener
  @HostListener('dragover', ['$event']) onDragOver(evt: any) {
    evt.preventDefault();
    evt.stopPropagation();
  }
 
  // Dragleave listener
  @HostListener('dragleave', ['$event']) public onDragLeave(evt: any) {
    evt.preventDefault();
    evt.stopPropagation();
  }
   
  // Drop listener
  @HostListener('drop', ['$event']) public ondrop(evt: any) {
    evt.preventDefault();
    evt.stopPropagation();
    let files = evt.dataTransfer.files;
    if (files.length > 0) {
      this.fileDropped.emit(files);
    }
  }
}

Issue - Once a file is dropped , there is delay in firing of fileDropper method. Along with that if the file is dragged for long time on the container and then dropped the delay is more. I want to implement some loader for this delay. But the problem is when to start the loader and when to end ?
 

Curved infinite scroll or marquee with custom logic

I have been struggling to build this(mention in picture). I want to make a curved marquee or infinite scroll carousel where each item, in this case flag will move from left to right. When a flag enter center of the viewport, in this case enter into window area – window background will be changed. How can I build this? For any kind of query please let me know.

note: any third party library like gsap can be used, I have no issue.

enter image description here

Why addEventListenr dosen’t work in javascript [duplicate]

I tried to get the e.target of 3 buttons through addEventLister but it doesn’t work with javascript but works fine with jquery.Can you explain this to me?

let cards = [{
    title : 'selin',
    price : 20000
},{
    title : 'young',
    price : 30000
},{
    title : 'hanoe',
    price : 10000
}]


for(let i=0; i<cards.length; i++){
    
var cards_templte = `
<div class="card col-md-4" >
     
       <div class="card-body">
         <h5 class="card-title">${cards[i].title}</h5>
         <p class="card-text">${cards[i].price}</p>
         <button class="store-btn">구매</button>
       </div>
 </div>
`

document.querySelector('.row').insertAdjacentHTML('beforeend', cards_templte);
}




document.querySelector('.store-btn').addEventListener('click',function(e){
    console.log(e.target)

})


Can you explain this to me?

How to add custom popup to tinymce editor and add fields content to editor

I have added code to open bootstrap modal in tinymce custom button. I tried and added code below whi

ch I have tried. I don’t know why it came blank fields not adding the content.

How can this fixed?

<!DOCTYPE html>
<html lang="en">

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script
   src="https://cdn.tiny.cloud/1/qagffr3pkuv17a8on1afax661irst1hbr4e6tbv888sz91jc/tinymce/5/tinymce.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
   integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
   integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<script>
   tinymce.init({
      selector: '#editor',
      plugins: 'autolink image link lists code template',
      toolbar: 'undo redo | bold italic strikethrough forecolor backcolor | image link bullist numlist custom_button code',
      menubar: false,
      height: 'calc(100vh - 2rem)',
      setup: (editor) => {
         editor.ui.registry.addButton('custom_button', {
            icon: 'comment-add',
            tooltip: 'Insert Sharequote',
            onAction: function (api) {
               $('#exampleModal').modal('show');
            }
         });
      },
   });

   $(document).on('click', '.saveChanges', function () {
      var editor = tinymce.get('editor');
      editor.execCommand('mceInsertTemplate', false, `
                        <h1>${$('#heading').html()}</h1>
                        <p>${$('#content').html()}</p>
                  `);
   });

</script>
<textarea id="editor"></textarea>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
   aria-hidden="true">
   <div class="modal-dialog" role="document">
      <div class="modal-content">
         <div class="modal-header">
            <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
         </div>
         <div class="modal-body">
            <input type="text" class="form-control" id="heading" />
            <textarea id="content" class="form-control"></textarea>
         </div>
         <div class="modal-footer">
            <button type="button" class="btn btn-primary saveChanges">Save changes</button>
         </div>
      </div>
   </div>
</div>
</html>

html and php or js select using query with relative field

Hi i have a customer and customer locations. When i select a customer i want to load the related customer location in another select. how can i do that using html and php

<div class="form-group">
<label for="customerID" class="col-sm-3 control-label">Customer</label>
<div class="col-sm-9">
<select class="form-control" name="customerName[]" id="customerName" onchange="getCustomerData()" >
<option value="">~~SELECT~~</option>
<?php
$customerSql = "SELECT * FROM customers WHERE transactionstatus='1' and companyid='1'";
$customerData = $connect->query($customerSql);

while($row = $customerData->fetch_array()) {                                            
echo "<option value='".$row['customerid']."' id='changeCustomer".$row['customerid']."'>".$row['customername']."</option>";
} // /while 

?>

</select>
</div>
</div> <!--/form-group-->             
<div class="form-group">

Problem updating array with reffs React framer-motion

My task is to implement 2 lists. One of the lists is just a “toolbar” that contains items. Also, from this list, you can drag items to the second list, which is the “target”. It will not be possible to drag items from the target list to the other, but in the future I want to make it possible to delete items. The main task of the target list is the ability to sort items by dragging (taking into account the position the cursor is hovering over).

I implemented this functionality in some form, but ran into some problems. I solved the first one (it’s pretty ugly, but it works). And with the second one, unfortunately, I could not figure out on my own. The problem is that after adding an item to the middle of the list, strange behavior occurs – it is impossible to drag the next item to a certain position. I tried to figure it out and looked at the logs. I saw that targetItemRefs.current is not updated properly. After that, I tried to update it manually in the onReorderTarget() function. But this was also unsuccessful. Here is a reproducible example of my problem: sandbox

Pin the before content when doing horizontal scroll

I am using GSAP for horizontal scrolling. Here it is working but I need to stick the above inro also untill horizontal scroll end. Currently it scrolls up and horizontal scrolling start.

<div class="container">
    <div class="process__intro__wrap" >
        <div class="process__intro">
            <div class="process__intro__title">
                <% if $ShowTitle %>
                    <h2>{$Title}</h2>
                <% end_if %>
            </div>
            <div class="process__intro__desc">
                $ElementProcessDescription
            </div>
        </div>
        <% if $ElementProcessLink %>
        <div class="process__intro__cta">
            <a href="$ElementProcessLink.LinkURL" class="btn">
                {$ElementProcessLink.Title}
                <% include SVG/arrow %>
            </a>
        </div>
        <% end_if %>
    </div>
    <div class="process__grid__wrap">
        <div class="mobile-hide" >
            <div class="process__grid horiz-gallery-wrapper"  > 
                <div class="process__items horiz-gallery-strip">
                        <% loop $getPathwayElements %>
                            <div class="process__item sticky-process-item ">
                                <div class="process__item__title">
                                    <div class="process__item__num">
                                        <h4>$Counter</h4>
                                    </div>
                                    <div class="process__item__topic">
                                        <h4>$Title</h4>
                                    </div>
                                </div>
                                <div class="process__item__desc">
                                    $Description.Raw
                                </div>
                            </div>
                        <% end_loop %>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="process__grid desktop-hide" data-fadein> 
        <div class="process__items js-clients-carousel">
                <% loop $getPathwayElements %>
                    <div class="process__item">
                        <div class="process__item__title">
                            <div class="process__item__num">
                                <h4>$Counter</h4>
                            </div>
                            <div class="process__item__topic">
                                <h4>$Title</h4>
                            </div>
                        </div>
                        <div class="process__item__desc">
                            $Description.Raw
                        </div>
                    </div>
                <% end_loop %>
            </div>
        </div>
    </div>
</div>

This is the js code which is using GSAP scrolling should be happen if there are more than 2 elements. currently block intro scrolls up then starts horizontal scrolling. It looks odd in big screens.

import gsap from "gsap";
import { ScrollTrigger } from 'gsap/ScrollTrigger';

export default () => {
  const buildProcess = document.querySelectorAll(".process");
  gsap.registerPlugin(ScrollTrigger);
  const processBlocks = gsap.utils.toArray('.process');

  processBlocks.forEach((processBlock) => {
    const horizontalSections = gsap.utils.toArray(processBlock.querySelectorAll('.horiz-gallery wrapper'));
    const processElements = processBlock.querySelectorAll('.sticky-process-item');

    if (processElements.length > 2) {
      horizontalSections.forEach((sec) => {
        const pinWrap = sec.querySelector(".horiz-gallery-strip");

        if (!pinWrap) {
          console.warn('No pinWrap found for', sec);
          return;
        }

        let pinWrapWidth;
        let horizontalScrollLength;

        function refresh() {
          pinWrapWidth = pinWrap.scrollWidth + 320; // Adjust width as needed
          horizontalScrollLength = pinWrapWidth - window.innerWidth;
          
        }

        refresh();

        gsap.to(pinWrap, {
          scrollTrigger: {
            scrub: 1,
            trigger: processBlock.querySelector('.process__grid__wrap'), // Use the grid wrap as the trigger
            pin: true,
            start: "center center", // Adjust to control when the horizontal scroll should start
            end: () => `+=${pinWrapWidth}`,
            invalidateOnRefresh: true,
            onEnter: () => console.log(`Entering ${sec}`),
            onLeave: () => console.log(`Leaving ${sec}`)
          },
          x: () => -horizontalScrollLength,
          ease: "none"
        });

        ScrollTrigger.addEventListener("refreshInit", refresh);
      });
    }
  });
};`

`

I tried to change start atribute but it was not success.

How can I make an API call to a website, obtain a Bearer token, store it in the browser, and use it for subsequent requests? [closed]

I’m working on a web application where I need to make an API call to a website, obtain a Bearer token from the response, store it in the browser (e.g., in local storage), and then use this token for subsequent API requests.

Could someone guide me through the best practices for implementing this securely and efficiently? Any code examples or detailed explanations would be greatly appreciated!

I have implemented an API call using fetch in JavaScript and successfully retrieved the Bearer token from the response. I stored the token in local storage using localStorage.setItem(‘token’, token). However, I’m unsure if this is the most secure approach, and I’m also having trouble figuring out how to use the stored token in subsequent API requests.

I was expecting to securely store the token and seamlessly use it for future API calls without manually passing it every time. I’m looking for best practices on how to achieve this, especially considering security concerns like token expiration and potential vulnerabilities.