react-native app crashing on variant release after adding realm .work fine in debug mode

description
My applucation works fine on build mode live testing but once we try to release it it keeps crashing with a single error message. Project works fine if unlink realm package in both buold and release mode . hence issue is with realm linking .i wish to know how to solve this

06-22 21:22:41.273 25349 29886 E AndroidRuntime: Process: com.gocollect, PID: 25349
06-22 21:22:41.273 25349 29886 E AndroidRuntime: java.lang.UnsatisfiedLinkError: couldn’t find DSO to load: librealm.so caused by: io.realm.react.util.SSLHelper result: 0
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at com.facebook.soloader.SoLoader.g(Unknown Source:341)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at com.facebook.soloader.SoLoader.t(Unknown Source:124)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at com.facebook.soloader.SoLoader.s(Unknown Source:2)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at com.facebook.soloader.SoLoader.q(Unknown Source:42)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at com.facebook.soloader.SoLoader.p(Unknown Source:1)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at io.realm.react.RealmReactModule.(Unknown Source:2)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at io.realm.react.a.c(Unknown Source:0)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at com.facebook.react.u.a(Unknown Source:41)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at com.facebook.react.e.b(Unknown Source:30)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at com.facebook.react.p.V(Unknown Source:35)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at com.facebook.react.p.W(Unknown Source:54)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at com.facebook.react.p.t(Unknown Source:36)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at com.facebook.react.p.d(Unknown Source:0)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at com.facebook.react.p$f.run(Unknown Source:69)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at java.lang.Thread.run(Thread.java:920)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: io.realm.react.util.SSLHelper
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at java.lang.Runtime.nativeLoad(Native Method)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at java.lang.Runtime.nativeLoad(Runtime.java:1121)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at java.lang.Runtime.load0(Runtime.java:927)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at java.lang.System.load(System.java:1620)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at com.facebook.soloader.SoLoader$a.a(Unknown Source:201)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at com.facebook.soloader.d.h(Unknown Source:176)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at com.facebook.soloader.d.a(Unknown Source:2)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at com.facebook.soloader.b.a(Unknown Source:2)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: at com.facebook.soloader.SoLoader.g(Unknown Source:67)
06-22 21:22:41.273 25349 29886 E AndroidRuntime: … 14 more
06-22 21:22:41.292 5096 5096 E DMASA[D]: [DropBoxReceiverManager]enqueueFCwork: ProcessErrorStateInfo is null
06-22 21:22:41.324 7583 5485 E TaskStackListenerAbstract: onTaskSnapshotChanged called by Binder.getCallingPid() 0 android.app.ITaskStackListener$Stub.onTransact:585 android.os.Binder.execTransactInternal:1220 android.os.Binder.execTransact:1179
06-22 21:22:41.325 2362 2431 E TaskStackListenerAbstract: onTaskSnapshotChanged called by Binder.getCallingPid() 0 android.app.ITaskStackListener$Stub.onTransact:585 android.os.Binder.execTransactInternal:1220 android.os.Binder.execTransact:1179
06-22 21:22:41.325 2362 7092 E TaskStackListenerAbstract: onTaskSnapshotChanged called by Binder.getCallingPid() 0 android.app.ITaskStackListener$Stub.onTransact:585 android.os.Binder.execTransactInternal:1220 android.os.Binder.execTransact:1179
06-22 21:22:41.326 5176 5455 E TaskStackListenerAbstract: onTaskSnapshotChanged called by Binder.getCallingPid() 0 android.app.ITaskStackListener$Stub.onTransact:585 android.os.Binder.execTransactInternal:1220 android.os.Binder.execTransact:1179
06-22 21:22:41.416 621 621 E BpTransactionCompletedListener: Failed to transact (-32)
06-22 21:22:41.417 530 536 E statsd : Predicate -7037417284711607308 dropping data for dimension key (10)0x2010101->10658[I] (10)0x30000->launch[S]
06-22 21:22:41.418 530 536 E statsd : Predicate 5980654721335871649 dropping data for dimension key (10)0x2010101->10658[I] (10)0x30000->launch[S]
06-22 21:22:41.462 3156 3156 E pageboostd: Received HALT command code 2
06-22 21:22:43.568 2362 2446 E CscParser: update(): xml file exist
06-22 21:22:44.125 5816 15614 E TaskStackListenerAbstract: onTaskSnapshotChanged called by Binder.getCallingPid() 0 android.app.ITaskStackListener$Stub.onTransact:585 android.os.Binder.execTransactInternal:1220 android.os.Binder.execTransact:1179
06-22 21:22:44.243 29930 29930 E com.gocollect: Not starting debugger since process cannot load the jdwp agent.
06-22 21:22:44.250 29930 29930 E USNET : USNET: appName: com.gocollect
06-22 21:22:44.608 2362 2446 E CscParser: update(): xml file exist

these are the errors showing on this log

    "dependencies": {
    "@react-native-community/async-storage": "^1.12.1",
    "@react-native-masked-view/masked-view": "^0.2.6",
    "@react-navigation/bottom-tabs": "^6.3.1",
    "@react-navigation/native": "^6.0.10",
    "@react-navigation/stack": "^6.2.1",
    "react": "17.0.2",
    "react-native": "0.68.0",
    "react-native-element-dropdown": "^1.8.13",
    "react-native-elements": "^3.4.2",
    "react-native-gesture-handler": "^2.4.2",
    "react-native-hide-with-keyboard": "^1.2.1",
    "react-native-paper": "^4.12.1",
    "react-native-safe-area-context": "^4.3.1",
    "react-native-safe-area-view": "^1.1.1",
    "react-native-screens": "^3.13.1",
    "react-native-vector-icons": "^9.1.0",
    "realm": "^10.19.1"
},

these are my my packages

npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2 
react-native: 0.68.0 => 0.68.0 
react-native-macos: Not Found

npmGlobalPackages:
react-native: Not Found

multiple box javascript lightbox in one page typeError: slides3[(slideIndex3 – 1)] is undefined

ive try any single way to make multiple box of lightbox in one page,ive replace each possible class and variable,but the image on lighbox 1,and 2 doesnt appears,or vice versa.ive try another way to solve this by read any program on internet,but ive to try more to make this project cause this project has taken 3 days.

 //  for lighbox1
    function openModal() {
      document.getElementById("myModal1").style.display = "block";
    }
    
    function closeModal() {
      document.getElementById("myModal1").style.display = "none";
    }
// -------------------------
    var slideIndex1 = 1;
    showSlides(slideIndex1);
    
    function plusSlides(n) {
      showSlides(slideIndex1 += n);
    }
    
    function currentSlide(n) {
      showSlides(slideIndex1 = n);
    }
 // lighbox1
 function showSlides(n) {
      var i;
      var slides1 = document.getElementsByClassName("mySlides1");
      var dots1 = document.getElementsByClassName("demo1");
      var captionText1 = document.getElementById("caption1");
      
// lighbox 1
      if (n > slides1.length) {slideIndex1 = 1}
      if (n < 1) {slideIndex1 = slides1.length}
      for (i = 0; i < slides1.length; i++) {
          slides1[i].style.display = "none";
      }
      for (i = 0; i < dots1.length; i++) {
          dots1[i].className = dots1[i].className.replace(" active", "");
      }
      slides1[slideIndex1-1].style.display = "block";
      dots1[slideIndex1-1].className += " active";
      captionText1.innerHTML = dots1[slideIndex1-1].alt;
    }

    // ---------------------------------------
   //  =======================================
    // for lighbox2
    function openModal() {
      document.getElementById("myModal2").style.display = "block";
    }
    
    function closeModal() {
      document.getElementById("myModal2").style.display = "none";
    }
   //  ---------------------
    var slideIndex2 = 1;
    showSlides(slideIndex2);
    
    function plusSlides(o) {
      showSlides(slideIndex2 += o);
    }
    
    function currentSlide(o) {
      showSlides(slideIndex2 = o);
    }
    // lightbox2
    function showSlides(o){
      var j;
      var mySlides2 = document.getElementsByClassName("mySlides2");
      var dots2 = document.getElementsByClassName("demo2");
      var captionText2 = document.getElementById("caption2");

       // lighbox 2
       if (o > slides2.length) {slideIndex2 = 1}
      if (o < 1) {slideIndex2 = slides2.length}
      for (j = 0; j < slides2.length; j++) {
          slides2[j].style.display = "none";
      }
      for (j = 0; j < dots2.length; j++) {
          dots2[j].className = dots2[j].className.replace(" active", "");
      }
      slides2[slideIndex2-1].style.display = "block";
      dots2[slideIndex2-1].className += " active";
      captionText2.innerHTML = dots2[slideIndex2-1].alt;
    
    }
    // ---------------------------------------
   //  =======================================
    // for lighbox3
    function openModal() {
      document.getElementById("myModal3").style.display = "block";
    }
    
    function closeModal() {
      document.getElementById("myModal3").style.display = "none";
    }
   //  --------------------
    var slideIndex3 = 1;
    showSlides(slideIndex3);
    
    function plusSlides(p) {
      showSlides(slideIndex3 += p);
    }
    
    function currentSlide(p) {
      showSlides(slideIndex3 = p);
    }
     // lighbox3
     function showSlides(p){
      var k;
      var slides3 = document.getElementsByClassName("mySlides3");
      var dots3 = document.getElementsByClassName("demo3");
      var captionText3 = document.getElementById("caption3");

      // lighbox 3
      if (p > slides3.length) {slideIndex3 = 1}
      if (p < 1) {slideIndex3 = slides3.length}
      for (k = 0; k < slides3.length; k++) {
          slides3[k].style.display = "none";
      }
      for (k = 0; k < dots3.length; k++) {
          dots3[k].className = dots3[k].className.replace(" active", "");
      }
      slides3[slideIndex3-1].style.display = "block";
      dots3[slideIndex3-1].className += " active";
      captionText3.innerHTML = dots3[slideIndex3-1].alt;
    }
    // ---------------------------------------
body {
  font-family: Verdana, sans-serif;
  margin: 0;
}

* {
  box-sizing: border-box;
}

.row > .column {
  padding: 0 8px;
}

.row:after {
  content: "";
  display: table;
  clear: both;
}

.column {
  float: left;
  width: 25%;
}

/* The Modal (background) */
.modal {
  display: none;
  position: fixed;
  z-index: 1;
  padding-top: 100px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: black;
}

/* Modal Content */
.modal-content {
  position: relative;
  background-color: #fefefe;
  margin: auto;
  padding: 0;
  width: 90%;
  max-width: 1200px;
}

/* The Close Button */
.close {
  color: white;
  position: absolute;
  top: 10px;
  right: 25px;
  font-size: 35px;
  font-weight: bold;
}

.close:hover,
.close:focus {
  color: #999;
  text-decoration: none;
  cursor: pointer;
}

.mySlides1.mySlides2.mySlides3 {
  display: none;
}

.cursor {
  cursor: pointer;
}

/* Next & previous buttons */
.prev,
.next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  width: auto;
  padding: 16px;
  margin-top: -50px;
  color: white;
  font-weight: bold;
  font-size: 20px;
  transition: 0.6s ease;
  border-radius: 0 3px 3px 0;
  user-select: none;
  -webkit-user-select: none;
}

/* Position the "next button" to the right */
.next {
  right: 0;
  border-radius: 3px 0 0 3px;
}

/* On hover, add a black background color with a little bit see-through */
.prev:hover,
.next:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

/* Number text (1/3 etc) */
.numbertext {
  color: #f2f2f2;
  font-size: 12px;
  padding: 8px 12px;
  position: absolute;
  top: 0;
}

img {
  margin-bottom: -4px;
}

.caption-container {
  text-align: center;
  background-color: rgb(10, 10, 10);
  padding: 2px 16px;
  color: white;
}

.demo {
  opacity: 0.6;
}

.active,
.demo:hover {
  opacity: 1;
}

img.hover-shadow {
  transition: 0.3s;
}

.hover-shadow:hover {
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
<h2 style="text-align:center">Lightbox1</h2>
<!-- this for lightbox 1 -->
<div class="row">
  <div class="column">
    <img src="https://source.unsplash.com/j7xx4uDVoCo/1600x900" style="width:100%" onclick="openModal();currentSlide(1)" class="hover-shadow cursor">
  </div>
  <div class="column">
    <img src="https://source.unsplash.com/ZS67i1HLllo/1600x900" style="width:100%" onclick="openModal();currentSlide(2)" class="hover-shadow cursor">
  </div>
  <div class="column">
    <img src="https://source.unsplash.com/YiX1jsdbWhY/1600x900" style="width:100%" onclick="openModal();currentSlide(3)" class="hover-shadow cursor">
  </div>
  <div class="column">
    <img src="https://source.unsplash.com/jafl5owXXVc/1600x900" style="width:100%" onclick="openModal();currentSlide(4)" class="hover-shadow cursor">
  </div>
</div>

<div id="myModal1" class="modal">
  <span class="close cursor" onclick="closeModal()">&times;</span>
  <div class="modal-content">

    <div class="mySlides1">
      <div class="numbertext">1 / 4</div>
      <img src="https://source.unsplash.com/j7xx4uDVoCo/1600x900" style="width:100%">
    </div>

    <div class="mySlides1">
      <div class="numbertext">2 / 4</div>
      <img src="https://source.unsplash.com/ZS67i1HLllo/1600x900" style="width:100%">
    </div>

    <div class="mySlides1">
      <div class="numbertext">3 / 4</div>
      <img src="https://source.unsplash.com/YiX1jsdbWhY/1600x900" style="width:100%">
    </div>
    
    <div class="mySlides1">
      <div class="numbertext">4 / 4</div>
      <img src="https://source.unsplash.com/jafl5owXXVc/1600x900" style="width:100%">
    </div>
    
    <a class="prev" onclick="plusSlides(-1)">&#10094;</a>
    <a class="next" onclick="plusSlides(1)">&#10095;</a>

    <div class="caption-container">
      <p id="caption"></p>
    </div>


    <div class="column">
      <img class="demo cursor" src="https://source.unsplash.com/j7xx4uDVoCo/1600x900" style="width:100%" onclick="currentSlide(1)" alt="Nature and sunrise">
    </div>
    <div class="column">
      <img class="demo cursor" src="https://source.unsplash.com/ZS67i1HLllo/1600x900" style="width:100%" onclick="currentSlide(2)" alt="Snow">
    </div>
    <div class="column">
      <img class="demo cursor" src="https://source.unsplash.com/YiX1jsdbWhY/1600x900" style="width:100%" onclick="currentSlide(3)" alt="Mountains and fjords">
    </div>
    <div class="column">
      <img class="demo cursor" src="https://source.unsplash.com/jafl5owXXVc/1600x900" style="width:100%" onclick="currentSlide(4)" alt="Northern Lights">
    </div>
  </div>
</div>
<!-- end lightbox1 -->
<br>
<br>
<br>

<!-- this for lighbox2 -->
<h2 style="text-align:center">Lightbox2</h2>
<div class="row">
   <div class="column">
     <img src="https://source.unsplash.com/0qvBNep1Y04/1600x900" style="width:100%" onclick="openModal();currentSlide(1)" class="hover-shadow cursor">
   </div>
   <div class="column">
     <img src="https://source.unsplash.com/BfrQnKBulYQ/1600x900" style="width:100%" onclick="openModal();currentSlide(2)" class="hover-shadow cursor">
   </div>
   <div class="column">
     <img src="https://source.unsplash.com/9wTPJmiXk2U/1600x900" style="width:100%" onclick="openModal();currentSlide(3)" class="hover-shadow cursor">
   </div>
   <div class="column">
     <img src="https://source.unsplash.com/O2MdroNurVw/1600x900" style="width:100%" onclick="openModal();currentSlide(4)" class="hover-shadow cursor">
   </div>
 </div>

 <div id="myModal2" class="modal">
   <span class="close cursor" onclick="closeModal()">&times;</span>
   <div class="modal-content">
 
     <div class="mySlides2">
       <div class="numbertext">1 / 4</div>
       <img src="https://source.unsplash.com/0qvBNep1Y04/1600x900" style="width:100%">
     </div>
 
     <div class="mySlides2">
       <div class="numbertext">2 / 4</div>
       <img src="https://source.unsplash.com/BfrQnKBulYQ/1600x900" style="width:100%">
     </div>
 
     <div class="mySlides2">
       <div class="numbertext">3 / 4</div>
       <img src="https://source.unsplash.com/9wTPJmiXk2U/1600x900" style="width:100%">
     </div>
     
     <div class="mySlides2">
       <div class="numbertext">4 / 4</div>
       <img src="https://source.unsplash.com/O2MdroNurVw/1600x900" style="width:100%">
     </div>
     
     <a class="prev" onclick="plusSlides(-1)">&#10094;</a>
     <a class="next" onclick="plusSlides(1)">&#10095;</a>
 
     <div class="caption-container">
       <p id="caption1"></p>
     </div>
 
 
     <div class="column">
       <img class="demo1 cursor" src="https://source.unsplash.com/0qvBNep1Y04/1600x900" style="width:100%" onclick="currentSlide(1)" alt="Nature and sunrise">
     </div>
     <div class="column">
       <img class="demo1 cursor" src="https://source.unsplash.com/BfrQnKBulYQ/1600x900" style="width:100%" onclick="currentSlide(2)" alt="Snow">
     </div>
     <div class="column">
       <img class="demo1 cursor" src="https://source.unsplash.com/9wTPJmiXk2U/1600x900" style="width:100%" onclick="currentSlide(3)" alt="Mountains and fjords">
     </div>
     <div class="column">
       <img class="demo1 cursor" src="https://source.unsplash.com/O2MdroNurVw/1600x900" style="width:100%" onclick="currentSlide(4)" alt="Northern Lights">
     </div>
   </div>
 </div>
 <!-- end ligtbox2 -->
 <br>
 <br>
 <br>
 <!-- this ligtbox3 -->
 <h2 style="text-align:center">Lightbox3</h2>
 <div class="row">
   <div class="column">
     <img src="https://source.unsplash.com/gnyA8vd3Otc/1600x900" style="width:100%" onclick="openModal();currentSlide(1)" class="hover-shadow cursor">
   </div>
   <div class="column">
     <img src="https://source.unsplash.com/g5jpH62pwes/1600x900" style="width:100%" onclick="openModal();currentSlide(2)" class="hover-shadow cursor">
   </div>
   <div class="column">
     <img src="https://source.unsplash.com/JpF58ANavoc/1600x900" style="width:100%" onclick="openModal();currentSlide(3)" class="hover-shadow cursor">
   </div>
   <div class="column">
     <img src="https://source.unsplash.com/mZRCMPbJSPc/1600x900" style="width:100%" onclick="openModal();currentSlide(4)" class="hover-shadow cursor">
   </div>
 </div>
 
 <div id="myModal3" class="modal">
   <span class="close cursor" onclick="closeModal()">&times;</span>
   <div class="modal-content">
 
     <div class="mySlides3">
       <div class="numbertext">1 / 4</div>
       <img src="https://source.unsplash.com/gnyA8vd3Otc/1600x900" style="width:100%">
     </div>
 
     <div class="mySlides3">
       <div class="numbertext">2 / 4</div>
       <img src="https://source.unsplash.com/g5jpH62pwes/1600x900" style="width:100%">
     </div>
 
     <div class="mySlides3">
       <div class="numbertext">3 / 4</div>
       <img src="https://source.unsplash.com/JpF58ANavoc/1600x900" style="width:100%">
     </div>
     
     <div class="mySlides3">
       <div class="numbertext">4 / 4</div>
       <img src="https://source.unsplash.com/mZRCMPbJSPc/1600x900" style="width:100%">
     </div>
     
     <a class="prev" onclick="plusSlides(-1)">&#10094;</a>
     <a class="next" onclick="plusSlides(1)">&#10095;</a>
 
     <div class="caption-container">
       <p id="caption2"></p>
     </div>
 
 
     <div class="column">
       <img class="demo2 cursor" src="https://source.unsplash.com/gnyA8vd3Otc/1600x900" style="width:100%" onclick="currentSlide(1)" alt="Nature and sunrise">
     </div>
     <div class="column">
       <img class="demo2 cursor" src="https://source.unsplash.com/g5jpH62pwes/1600x900" style="width:100%" onclick="currentSlide(2)" alt="Snow">
     </div>
     <div class="column">
       <img class="demo2 cursor" src="https://source.unsplash.com/JpF58ANavoc/1600x900" style="width:100%" onclick="currentSlide(3)" alt="Mountains and fjords">
     </div>
     <div class="column">
       <img class="demo2 cursor" src="https://source.unsplash.com/mZRCMPbJSPc/1600x900" style="width:100%" onclick="currentSlide(4)" alt="Northern Lights">
     </div>
   </div>
 </div>
<!-- end lightbox3 -->

this result in browser web page

How to create a hierarchical table dynamically from list of objects from model in Three Js?

In the three js editor, I am able to upload a model and it displays all the individual groups and meshes in the model in a hierarchical format:

enter image description here

I have been trying to figure out a way to replicate this hierarchical format based on the uploaded model’s children as shown below where each item has a parent id and child id.

enter image description here

My main issue currently is trying to figure out how to know which item belongs in which layer in the hierarchy so I can replicate the table from the three js editor. There is no property that defines where the item is in the hierarchy, so I was thinking that I would create a new property and use traverseAncestors for each item to assign it a layer number to indicates its position in the hierarchy. Then I was planning to dynamically create a collapsible list shown in this example. But my strategy seems very convoluted to me and I was wondering what is a better way to create a hierarchy and then dynamically creating the html list when the model is very complicated using only the list above?

convert regex from named capture groups feature into simple regex pattern

I have a string produit, and I wanna extract from it a bunch of properties like code_barre,qte…
I’ve tried that with ES2018’s solution which is named capture groups:

let produit = "8234507124671 36,000 5,00 7,00 167,40 DH";
let extractRe = /^(?<code_barre>d*)s+(?<qte>d*,d*)s+(?<prix_unitaire>d*,d*)s+(?<remise>d*,d*)s+(?<montant>d*,d*sw*)$/;
console.log(extractRe.exec(produit).groups)

And it works and I get those properties from that string, BUT if that string produit changed(doesn’t respect the regex pattern), my regex .exec(produit).groups will fail :/

So to avoid this error, I would use first an if statement to check if the string respect that pattern.

I know I need to use .test, But the question is

Is there a way to take an adventage of already pattern extractRe to convert it into a pattern we could use in .test regex method?

something like that:

'^(?<code_barre>d*)s+(?<qte>d*,d*)s+(?<prix_unitaire>d*,d*)s+(?<remise>d*,d*)s+(?<montant>d*,d*sw*)$'.replace(/(.*?)/g,'');
//output: 
'^s+s+s+s+$'
//expected output:
'd*s+d*,d*s+d*,d*s+d*,d*s+d*,d*sw*'

to Finally, I can run exec without errors :/

let produit = "8234507124671 36,000 5,00 7,00 167,40 DH";
let extractRe = /^(?<code_barre>d*)s+(?<qte>d*,d*)s+(?<prix_unitaire>d*,d*)s+(?<remise>d*,d*)s+(?<montant>d*,d*sw*)$/;
if(/^d*s+d*,d*s+d*,d*s+d*,d*s+d*,d*sw*$/.test(produit))
    console.log(extractRe.exec(produit).groups)

Is there a fix to my array sometimes having the right length but sometimes not with a binary array

I have a binary array and would like to count the longest number of 1s in a row with this function. In particular, when I use this value for nums like [1,1,0,1] it counts correctly.

let nums = [1, 1, 0, 1, 1, 1];

var findMaxConsecutiveOnes = function(nums) {
  let val = 0;
  if (nums.length >= 1) {
    console.log(nums.sort().reverse());
    for (i = 0; i <= nums.length - 1; i++) {
      if (nums[i] === nums[i + 1]) {
        val++;
      } else {
        console.log(val);
        return val;
      }
    }
    console.log(val);
    return 0;
  }
};

findMaxConsecutiveOnes(nums)

TypeError: client.on is not a function -node.js error

How do i fix this it keeps giving me the error TypeError: client.on is not a function

const DiscordPage = d;
await fill_discord(DiscordPage, username, password, email);

const client = d._client;
var token;

client.on('Network.webSocketFrameSent', ({requestId, timestamp, response}) => {
  try {
    const json = JSON.parse(response.payloadData);
    if(!token && json["d"]["token"]){
      token = json["d"]["token"];
      write_log(true, `Token: ${token}`);
    };
  } catch(e){};
})
await break_captcha(DiscordPage);

threejs gltf loader doesnt work multiple errors

hi i’m trying to import simple gltf model from sketchfab and display it with orbitview.

i get 2 errors:

was blocked because of a disallowed MIME type (“text/html”).

or

 Error resolving module specifier “three”. Relative module specifiers must start with “./”, “../” or “/”.

can anyone help me solve this problem?

to better understand what i am looking for take a look at this example form threejs website. it is exactly what i want to accomplish, but i couldn’t find it’s source code to read and learn from it, neither found proper guide about importing gltf models.

link to example

Cannot pass array object from map function as argument javascript

I am trying to figure out why I cannot pass array object from map function as argument to function createModal(student) that is called onclick:
The error is caused by the parameter because when I tried function createModal() it worked fine.

const allWorkshops = await fetch("/api/workshops/detail");
const data = await allWorkshops.json();
result.innerHTML = "";
counter = 0;

data.forEach((workshop) => {
  ...
  ${workshop.students.map(student =>
     `<li class="list-group-item">
        <a data-bs-toggle="modal" data-bs-target="#studentModal" type="button" onclick="createModal(${student})">${student.first_name} ${student.last_name}</a>
      </li>`
  ).join("")}
  ...
});

I have seen this (and this) question and tried changing the code as following but it did not work either:

...
${workshop.students.map(function(student) {
   var studentCopy = JSON.parse(JSON.stringify(student));
   return `<li class="list-group-item">
             <a data-bs-toggle="modal" data-bs-target="#studentModal" type="button" onclick="createModal(${studentCopy})">${student.first_name} ${student.last_name}</a>
           </li>`
}).join("")}
...

Unfortunately I don’t know the exact error because the only thing I see in inspect in Chrome is this. Which is at the beggining of index file and does not help me.

Uncaught SyntaxError: Unexpected identifier (at (index):1:21)

How to import a node_module package in client

I was using CDN but needed some changes in the code so I install the npm package but dont know how to imported in my client view.

I tried:

import Calendar from './@event-calendar/core';

import TimeGrid from './@event-calendar/time-grid';

And also

import * as Calendar from './@event-calendar/core';

import * as TimeGrid from './@event-calendar/time-grid';

But I get error:

“Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/html”. Strict MIME type checking is enforced for module scripts per HTML spec.”

Here is a Screen shot of my folder

And here of the node modules

Javascript shorthand if-else syntax when there are multiple things to do? [duplicate]

I am trying to write this in shorthand:

If(rainingOutside) { 
    goRideBike()
    goToBeach()
    console.log('it works')
} else {
    stayHome()
    writeCode()
}

I know it looks cleaner in the ‘classic’ if-else block, but I was wondering how do you write multiple stuff to do in shorthand? The below doesn’t work:

{ rainingOutside ? goRideBike() goToBeach() console.log('it doesn't work!') : stayHome() writeCode() }

Why do my offsetHeight variables not match the total size of their sources measured in the Dev tools when assigned to variables in my JS file?

Howdy,

Context:
I am attempting to recreate a section which has required some complex use of grid layouts. In an effort to conjoin the grids and get a mobile responsive layout using grid areas, I have attempted to set some of the grid layout sizing across these grids using dynamically adjusting “grid-template-rows” style assignments in my JavaScript file.

The basic construction is that the elements should appear in a row together and should have a uniform height set by their tallest pseudo sibling, despite being in separate grids by necessity for layout purposes.

I set the various grid item elements into a “row” array which is looped through to create a new array of their heights, which is again looped through to find the tallest height among them. I then do this for each row and take the heights given and set all grid-template-rows style for the multiple grid parents using those variables as fixed heights.

I am console logging the heights at several points to cross check them. The grid style changes have a media query screen size conditional statement wrapping them to account for variations in layout at mobile view.

I then created a ResizeObserver for the body element which should in theory dynamically adjust the heights as the window resizes.

Broken Features:
The heights logged by offset-height of my div element variables don’t seem to match up with the value of the sum of my element content height plus it’s padding.

On desktop it seems to be overvaluing, creating white space below as though the tallest element is actually slightly taller, while at mobile it is cutting short and bleeding over it’s assigned grid height which itself is too small relative to the heights of their contents.

In the Dev tools adjusting the grid height of the mobile row doesn’t seem to create more space for some reason, though I’m not sure where the constraint causing overflow is coming from if not the grid row height. I need to understand this part for this to be a viable solution.

My ResizeObserver is also not working as intended. Likely because I have not configured it correctly or because I have not appropriately repopulated the variable values with updated figures. I’m not familiar enough with it specifically to know what all is broken.

I’m in dire need of a consult.
Suggestions welcome

GitHub:
https://github.com/Aces-Gambit/grid-chart-project

How do I replace the user input in text box as it is being typed

I have a textbox where I need to replace the user input with an int from 0 to 1 for each letter typed, so typing “hello world” for example would result in a number like “01011010100”. My code so far is:

textbox.addEventListener("beforeinput", function() {
    textbox.value = textbox.value.replace(/D+/g, findRandom());
}, false);

where findRandom() is a function that gives the random integer, and it works ok for the most part, however it does not consider the last letter typed, and using a keydown listener has too much of a lag between the letter being inputted and it being replaced. How do I make it so that no matter what the user types it comes out as 1 or 0 fast enough that they don’t see what they actually typed?

Enabling horizontal scrollbar on Electron Window

So I created a BrowserView that will load a website url that I enter on Electron. The thing is: The website is not fitting in small screens, as there is no horizontal scrollbar. I tried changing the CSS in my view and while the changes are made, the website overlaps the CSS changes when all of it when it finishes loading.

I noticed that if I change the autoResize to horizontal: true for example, it does have an effect on the website page’s size.

I’d like to know if BrowserView has any way to enable Scrollbars.

Here’s the code snippet where I’m creating the BrowserView:

const mainView = new BrowserView({
      webPreferences: {
        preload: path.join(__dirname, "preload"),
        backgroundThrottling: false,
        pageVisibility: true,
        nodeIntegration: true,
      },
    });
    win.addBrowserView(mainView);
    mainView.setBounds({ x: 400, y: baseOffset, width: 1400, height: height });
    mainView.setAutoResize({ width: true, height: true });
    mainView.webContents.loadFile(path.join(__dirname, "showing.html"));

Add text after pressing button in Javascript

So I want to imitate a Survey where a Survey has:


  1. Question Name
  2. Options

The question name is basically just some text which can be changed on clicked.

Initially there is one option and it’s checkbox to tick it. This option should also change when clicked.
Also there’s is this button where should add a new option to a specific question and there will be one question with let’s say 4 options and you can check any amount of them.

Now after the first question has been edited (put whatever text you want for the question name and as many different options you need) you should be able to add more questions and do the same thing.

I tried to do this and I managed to find some code which edits text on click but I don’t know how I can add another option or another question. My code is as follows:

function help() {
  // code to add another option
}
body {
  background-color: #00ffaa;
  font-family: Verdana;
  text-align: center;
}

.questionName {
  margin-top: 15px;
  font-size: 20px;
}

.optionName {
  margin-top: 8px;
  font-size: 15px;
  font-style: italic;
  margin-left: 605px;
}

.box {
  margin-top: 12px;
}

.option {
  display: flex;
}
<html>
  <head>
    <title>Your Survey Form</title>
    <link rel="stylesheet" href="DemoSurveyStyle.css">
  </head>
  <body>
    <form>
      <h1 id="myText" contenteditable="true">Survey Name</h1>
      <div id="question">
        <div class="questionName" contenteditable="true">Question</div>
        <div class="option">
          <div class="optionName" contenteditable="true">Option</div>
          <input type="checkbox" class="box">
        </div>
        <button id="addOpButton" onclick="help()">Add Option</button>
      </div>
    </form>
    <script src="DemoCode.js"></script>
  </body>
</html>

If you could help me to how I should do this I would really appreciate. I think it’s not very complicated just I have never done it and don’t know how to do it.

Generating static pages for only certain pages of a React app

I would like to generate static html files for only certain pages of my React app.

Context: I have a react site for which most of the pages are interactive and are customised based on the logged-in user. However, I also have public facing pages which remain almost 100% static. So, to allow these pages to display without JS, and also to speed up load times, I’d like to serve these pages as static html files.

I’d like to allow these pages to be interactible on the browser before the React JS files are excuted, but allow for the minor interactive elements of the page to spring to life once React begins running.

What are my options here? I’m hoping to be able to do this with a serverless solution. I’ve looked into Gatsby JS, but this seems to be a whole entire framework. Is there anyway to add this functionality to a normal react app?

Are there any plugins that allow this functionality?