Every time that I import RtcEngine into my application (import RtcEngine from ‘react-native-agora’;) I get the following error:

** TypeError: null is not an object (evaluating ‘AgoraRtcChannelModule.prefix’)
at node_modulesreact-nativeLibrariesLogBoxLogBox.js:148:8 in registerError
at node_modulesreact-nativeLibrariesLogBoxLogBox.js:59:8 in errorImpl
at node_modulesreact-nativeLibrariesLogBoxLogBox.js:33:4 in console.error
at node_modulesexpobuildenvironmentreact-native-logs.fx.js:27:4 in error
at node_modulesreact-nativeLibrariesCoreExceptionsManager.js:104:6 in reportException
at node_modulesreact-nativeLibrariesCoreExceptionsManager.js:171:19 in handleException
at node_modulesreact-nativeLibrariesCoresetUpErrorHandling.js:24:6 in handleError
at node_modulesexpo-error-recoverybuildErrorRecovery.fx.js:12:21 in
ErrorUtils.setGlobalHandler$argument_0
at node_modules@babelruntimenode_modulesregenerator-runtimeruntime.js:62:36 in tryCatch
at node_modules@babelruntimenode_modulesregenerator-runtimeruntime.js:288:29 in invoke
at node_modules@babelruntimenode_modulesregenerator-runtimeruntime.js:62:36 in tryCatch
at node_modules@babelruntimenode_modulesregenerator-runtimeruntime.js:152:27 in invoke
at node_modules@babelruntimenode_modulesregenerator-runtimeruntime.js:162:18 in
Promise.resolve.then$argument_0
at node_modulesreact-nativenode_modulespromisesetimmediatecore.js:37:13 in tryCallOne
at node_modulesreact-nativenode_modulespromisesetimmediatecore.js:123:24 in
setImmediate$argument_0
at node_modulesreact-nativeLibrariesCoreTimersJSTimers.js:130:14 in _callTimer
at node_modulesreact-nativeLibrariesCoreTimersJSTimers.js:181:14 in _callImmediatesPass
at node_modulesreact-nativeLibrariesCoreTimersJSTimers.js:441:30 in callImmediates
at node_modulesreact-nativeLibrariesBatchedBridgeMessageQueue.js:387:6 in __callImmediates
at node_modulesreact-nativeLibrariesBatchedBridgeMessageQueue.js:135:6 in
__guard$argument_0
at node_modulesreact-nativeLibrariesBatchedBridgeMessageQueue.js:364:10 in __guard
at node_modulesreact-nativeLibrariesBatchedBridgeMessageQueue.js:134:4 in flushedQueue
at [native code]:null in flushedQueue
at [native code]:null in invokeCallbackAndReturnFlushedQueue**

how to get array of objects based on object value in javascript [closed]

I would like to know how to get array of object values based on object value match

using javascript

how to get only array of objects having the type AM and N by comparing with object
value

var result = list.filter(e=>e.type==="AM" && "N");
 how to compare with object instead of direct value
var list =[
  {id:1, name: "abc", type:"AM", valid:"yes"},
  {id:2, name: "xyz", type:"AM", valid:"yes"}
  {id:3, name: "zen", type:"N", valid:"no"}
  {id:41, name: "lisa", type:"PM", valid:"no"}
]

var obj={
  shiftmrn: "AM",
  shiftnoon: "N",
  shiftnight: "PM",
  noshift: "NIL"
}

Expected Output
[
  {id:1, name: "abc", type:"AM", valid:"yes"},
  {id:2, name: "xyz", type:"AM", valid:"yes"},
  {id:3, name: "zen", type:"N", valid:"no"}
]

Chrome extension how to enter text in any selected text field

I am making a Chrome extension that generates nicknames when you press Ctrl+Shift+U, and it should automatically enter the generated name in the selected text field, if one is selected. My problem is that there are many types of text fields, the most basic being input. This is currently my function that generates the nickname, which works for input fields and textarea fields, but for nothing else.

//Nickname gets generated here
//...

var inp = document.querySelectorAll("input");
var txt = document.querySelectorAll("textarea");
    
for (var i=0;i<inp.length;i++) {
    if (inp[i] == document.activeElement) {
        inp[i].value = nick;
    }
}
    
for (var i=0;i<txt.length;i++) {
    console.log(txt[i]);
    if (txt[i] == document.activeElement) {
        txt[i].innerHTML = nick;
    }
}

Basically, what I think I would need, is some kind of function that can act like the user is typing the name, without directly changing the value of a field.

vue computed properity not updating value

I’m trying to updated a Computed Property. The data is coming from vuex state.

I get my data from the store. I want to updated the value allowed in the store. However when I click my update button it dosn’t update the value.

html

  <div @click="update">update</div>
  <b-row>
    <b-col v-for="cat in categories" :key="cat.id" sm="12" md="6" lg="4">
        <div>{{cat.allowed}}</div>
    </b-col>
  </b-row>

  computed: {
...mapGetters("categories", ["customerCategories"]),

 categories() {
   return this.customerCategories;
 },
 methods: {
    update() {
      this.categories.filter((element) => (element.allowed = true));
      console.log(this.categories); // not updating the allowed
},
 }

},

// from the store
    categories = [
  {
    allowed: false
    description: "hsdkj fskdjf skfj"
    id: 15
  },
  {
    allowed: false
    description: "blah blah"
    id: 13
  },
   {
    allowed: false
    description: "more blah blah"
    id: 13
  },
  {
    allowed: false
    description: "lots more blah blah"
    id: 1
  }
]

setinterval and setitimeout not working on ios mobile devices and firefox with pure javascript

set interval and set timeout not working on ios mobile devices and firefox

I have one button on the page with pulsate animation, I have one class "zoom-in-out" on which I have added the animation
after 2 loops the button is getting pulsated, the below code is working fine on chrome but not on firefox and ios devices

I have used set interval and set timeout to add the delay of x seconds to remove and add the class for animation

code snippets

function animateDelayFunc(){
    var btnClass = document.querySelector(".btn");
    btnClass.classList.add("zoom-in-out");
    setInterval (function() {
      btnClass.classList.remove("zoom-in-out");
  }, 2000, true);
    setTimeout(function() { animateDelayFunc(); }, 4000, true);
}
animateDelayFunc();
.btn {
    width: 50%;
    box-shadow: 0 3px 5px 0 rgb(0 0 0 / 30%);
    background-color: #ea4f5a;
    height: 50px;
    font-size: 20px;
    line-height: 30px;
    border: 0;
    position: relative;
    max-width: 200px;
    border-radius: 35px;
    font-weight: 700;
    color: #fff;
    margin: 10px auto 10px auto;
    cursor: pointer;
    will-change: transform;
    -webkit-font-smoothing: antialiased;   
    -webkit-filter: blur(0);
    filter: blur(0);
}
.zoom-in-out {
    animation: zoom-in-out-animation 1s;
    animation-iteration-count: infinite;
}
@keyframes zoom-in-out-animation {
    0% {
        transform: translate(0px, 0px);
    }
    50% {
        transform: translate(0px, 0px) scale(1.05);
    }
    100% {
        transform: translate(0px, 0px);
    }
}
<button class="btn zoom-in-out">Continue</button>

I have tried various ways with StackOverflow suggestions but they are not working for me

How can I create a date bar every time a new month occurs when mapping data from firebase in React

I hava data structured like the following being fetched from firebase:

const shows = [
{
    name: 'one',
    date: '2022-04-24T20:00',
},
{
    name: 'two',
    date: '2022-04-26T20:00',
},
{
    name: 'three',
    date: '2022-04-29T20:00',
},
{
    name: 'four',
    date: '2022-05-10T20:00',
},
{
    name: 'five',
    date: '2022-05-12T20:00',
},
{
    name: 'six',
    date: '2022-06-10T20:00',
},
]

When mapping through the data I want to have a ‘month bar’ announcing the beginning of each new month and achieve something like this:

Month April

One - 2022-04-24T20:00
Two - 2022-04-26T20:00
Three – 2022-04-29T20:00

Month May

Four – 2022-05-10T20:00
Five – 2022-05-12T20:00

Month June

Six – 2022-06-10T20:00

The data of course contains much more dates and I have also set limit and a load-more button when fetching from firebase. My code right now looks like below and the only idea I’ve had, which doesn’t work, is to create a useState called showDate and change compare it to the date when mapping the array…

import React, { useEffect, useState } from 'react';
import db from './firebase-config';
import { collection,  where, query, limit, startAfter, getDocs } from "firebase/firestore";






function App3() {
  
  const [shows, setShows] = useState([{namn: 'loading...', id: 'loading'}]);
  const [lastVisible, setLastVisible] = useState();  
  const [isEmpty, setIsEmpty] = useState(false);
  const [showDate, setShowDate] = useState();
  
  useEffect(() => {
    const getData = async () => {
      const q = query(collection(db, "shows"),  limit(3));
      
      const noData = q.size === 0;
      
      if(!noData){
      const showData = await getDocs(q);
      const newShows = showData.docs.map((doc) => ({...doc.data(), id: doc.id }));
      setShows(newShows);
      setLastVisible(showData.docs[showData.docs.length-1]);
      
      
      
      }else{
        setIsEmpty(true)
        console.log('no more');
      }
      
    };
    getData();
  }, []);

  
const getNextData = async () => {
  const q = query(collection(db, "shows"), startAfter(lastVisible), limit(3));
  const showData = await getDocs(q);
  const noData = showData.size === 0;
  if(!noData){
    
  const newShows = showData.docs.map((doc) => ({...doc.data(), id: doc.id }));
  setShows((shows) => [...shows, ...newShows]);
  setLastVisible(showData.docs[showData.docs.length-1]);
  }else{
    setIsEmpty(true)
    console.log('no more');
  }
  
}

  

  return (
  
    
      <div>
        {
        shows.map((show) => ( (new Date (show.date).getMonth() !== showDate) ? 
          (<div>Month {new Date(show.date).getMonth()}</div>):
          (new Date (show.date).getMonth() !== showDate) ?
          (setShowDate(new Date(show.date).getMonth())) :            
          (<div key={show.id}>{show.name}–{show.date}</div>)
        ))
        }
        
        {!isEmpty && <button onClick={getNextData} >More</button>}
        {isEmpty && <div>Nothing more to show</div>}
      </div>
    
      
 

  );
}

export default App3;

Any thoughts on what the best way of achieving this could be? Thanks!

How to call function JS for selected row only in table?

Im trying to increment Quantity for second row only but the first row that increment and not the second ?!

this is my code Html of my table :

  <table class="table">
              <thead>
                <tr>
                  <th class="">Item Name</th>
                  <th class="">Item Price</th>
                  <th class="">Quantité</th>
                  <th class="">Actions</th>
                </tr>
              </thead>
            @foreach(var item in @Model.panierWebs)
                            {
                               
                            
                            <tbody>
                <tr class="">
                  <td class="">
                    <div class="product-info">
                      <img width="80" src="@Url.Content(item.Image)" alt="" />
                      <a href="#!"> @Html.DisplayFor(modelItem => item.Model) </a>
                    </div>
                  </td>
                  <td class=""> @Html.DisplayFor(modelItem => item.Prix) DA</td>
                  <td class="">
                  <div class="quantity buttons_added">
<input onclick="decrement(@item.Prix,@item.Qte)" type="button" value="-" class="minus"><input type="number"  name="quantity" id="qte" value="@item.Qte" title="Qty" class="input-text qty text"  pattern="" inputmode=""><input onclick="increment(@item.Prix,@item.Qte)" type="button" value="+" class="plus">
                  <td class="">
                    <a onclick="remove(@item.Id)" class="product-remove" href="#!">Remove</a>
                  </td>
                </tr>
              
              </tbody>
              }
            </table>

and my Script JS of increment and decrement Qte :

<script>

function decrement(prix,qte)
{
console.log(“qte avant dec”+document.getElementById(“qte”).value);

     if(parseInt(document.getElementById("qte").value) != 1)
    {
        qte=parseInt(document.getElementById("qte").value)-1; // increment qte
       console.log("qte apres dec"+qte);
     $("#qte").val(qte); // affecter la nouvelle valeur de qte
     var currenttotal=document.getElementById("total").value; // calculer le nouveau total
     var newtotal = parseFloat(currenttotal)-parseFloat(prix);
     $("#total").val(newtotal);
    }
 }

function increment(prix,qte)
{
console.log(“qte avant incr”+document.getElementById(“qte”).value);

if(parseInt(document.getElementById(“qte”).value)

Why is regex working only if function scoped variable is declared after the local doCount function

I have some sample code at the following link: working sample.

When I click on the the button that says Remove new line character(s) 1 the new line character is not trimmed from the string a. However, when I click on that says Remove new line character(s) 2 then the new line character in string a gets removed. Both these buttons are calling different functions when they are clicked, but the difference between these methods is simply that the regex expression variable _trimNewLineCharsRegExp is declared before doCount local scoped function.

Question
Why is the new line character not being removed by the first button onclick function?

fuzzer that mutating javascript file instead of binary file

I’m looking for a fuzzer that I can give it a number of initial seed inputs (these seed inputs are javascript files) and it mutates them. you know I’m looking for a fuzzer like afl but afl works on binary files (the inputs are binary and it mutates binary files) while I want a fuzzer that works on javascript files (the inputs are javascript files and it mutates javascript files). do you know any?

Shopify theme showing errors in a store. All other themes work well. How can I edit the core file?

I have been working on a Shopify Store built in the Ella theme (from https://halosoft.ticksy.com/). I was working on translator apps and downloaded two of them but since none of them fulfilled my requirement, I deleted them all. Unfortunately after that, I see the following:

  1. The navigation (sub menus) does not appear.
  2. The product image does not change with the variant selection.
  3. The quantity selector on the product page does not work.

All three were initially working. Also, when I use another theme in the same product, all the above points are working. It is not working for any Ella theme. I had taken a backup of the theme as well, but none of the above work for even the backup Ella theme.

Seems like there have been changes in the core file. How can I proceed? Any help will be appreciated.

Uploaded File Type Verification

function uploadFile() {
  var file = _("file1").files[0];
  //alert(file.name+" | "+file.size+" | "+file.type);
  var formdata = new FormData();
  formdata.append("file1", file);
  var ajax = new XMLHttpRequest();
  ajax.upload.addEventListener("progress", progressHandler, false);
  ajax.addEventListener("load", completeHandler, false);
  ajax.addEventListener("error", errorHandler, false);
  ajax.addEventListener("abort", abortHandler, false);
  ajax.open("POST", "upload_file_for_booking.php");
  ajax.send(formdata);
  
}

function progressHandler(event) {
  _("loaded_n_total").innerHTML = " Yüklendi " + event.loaded + " bytes'tan " + event.total;
  var percent = (event.loaded / event.total) * 100;
  _("progressBar").value = Math.round(percent);
  _("status").innerHTML = Math.round(percent) + "% Yüklendi ... Lütfen Bekleyin";
}

function completeHandler(event) {
  _("status").innerHTML = event.target.responseText;
  _("progressBar").value = 0;
  $("#rez-but").removeAttr("style")
}

function errorHandler(event) {
  _("status").innerHTML = "Yükleme Başarısız";
}

function abortHandler(event) {
  _("status").innerHTML = "Yükleme Durduruldu";
}

<?php 
$localhost = "localhost"; #localhost
$dbusername = "mydb"; #username of phpmyadmin
$dbpassword = "mydbpass";  #password of phpmyadmin
$dbname = "mydbname";  #database name

$conn = mysqli_connect($localhost,$dbusername,$dbpassword,$dbname);

$fileName = $_FILES["file1"]["name"]; // The file name
$fileTmpLoc = $_FILES["file1"]["tmp_name"]; // File in the PHP tmp folder
$fileType = $_FILES["file1"]["type"]; // The type of file it is
$fileSize = $_FILES["file1"]["size"]; // File size in bytes
$fileErrorMsg = $_FILES["file1"]["error"]; // 0 for false... and 1 for true

if (!$fileTmpLoc) { // if file not chosen
    echo "Hata : Lütfen bir dosya seçiniz";
    exit();
}

if(move_uploaded_file($fileTmpLoc, "upload/$fileName")){
    $sql = "INSERT INTO `uploads` (`id`,`file_name`,`upload_time`) VALUES (NULL,'$fileName',NOW())";
    mysqli_query($conn,$sql) ;
    echo "$fileName Yükleme Tamamlandı.";
    $class = 'show';
} else {
    echo "Hata Oluştu";
    $class = 'hidden';
}
?>

I am trying to make only pdf files downloadable in the code block that I have forwarded above, but I have not succeeded. Is there anyone who can help?

I am using ajax button for upload.

What should I do so that only pdf files are downloadable?

Should I solve this on the ajax side or the php side?