How to get difference between two array and push values in form based on result Angular 8

I have two array namely arrayOne and arrayTwo. I want to compare values of both array based on below condition
and if it matches than it will pass data along with form otherwise it will create an empty form.

Below condition i wanted to check in arrayOne and arrayTwo.

if arrayOne processTypeId is equal to arrayTwo of makeProcessTypeId And
arrayOne makeLineName is equal to arrayTwo of makeLineName And
arrayOne processTechType is equal to arrayTwo of processTechType than
If all above conditions are met than only dataOne variable will pass along with form.

 this.itemTypes().push(this.createContinuousForm(item, dataOne));
else it will create an empty form only without pushing dataOne in form.

 this.itemTypes().push(this.createContinuousForm(item)); 

patchDataCollection(arrayOne) {
      if (arrayTwo) {
        for (const dataOne of arrayTwo) {
          if (item.makeLineName == dataOne.makeLineName) {
            if (dataOne.processTechType === 'Continuous') {
              this.itemTypes().push(this.createContinuousForm(item, dataOne));
            }
            if (dataOne.processTechType === 'Batch' || dataOne.processTechType === 'Batch-Crunch') {
              this.itemTypes().push(this.createBatchForm(item, dataOne));
            }           
          }
        }
      } 
  }


createContinuousForm(type, data) {
    return this.fb.group({ 
      minRunLength: [data.minRunLength ? data.minRunLength : '']     
    });
  }

  createBatchForm(type, data) {
    return this.fb.group({  
      avgBct: [data.avgBct ? data.avgBct : '', [Validators.required]]     
    });
  }

  

Sample Response for arrayOne and arrayTwo.

Const arrayOne = [
      {
        "makeLineName": "Red",
        types : [           
             {
                "processTypeId": "102",
                "processTechType": "Batch" 
            }
        ]   
      },
      {
        "makeLineName": "Blue",
        types : [
            {
                "processTypeId": "103",
                "processTechType": "Continuous" 
            }
        ]     
      } 
    ];

Const arrayTwo = 
[     
  {   
    "makeProcessTypeId": 102,
    "makeLineName": "Red",
    "processTechType": "Batch",
    "avgBct": 45,
    "bestBct": 45
  },
  {   
    "makeProcessTypeId": 103,
    "makeLineName": "Blue",
    "processTechType": "Continuous",
    "designProcessCapacity": 250,
    "minRunLength": 250
  }
]; 

add raw string to regex

I am writing a regex where I suppose to add a raw string before the match field, for example here is my regex which I used to assign the name with Sally from the provided text.

Regex: (?'name'Sally) 

text: Call me Sally.

name = Sally

What I want is to add something before Sally, such as

`ABSally` 

or

`12Sally`

within the regex pattern so the name group should hold complete value. How can I achieve this functionality?

How to iterate an object in node.js?

I have an object.

players = {
{
   name:'a',
   class:'V'
},
{
   name:'b',
   class:'VI'
}
}

I want to iterate each element of this object i.e. each player from the players object
this can be done easily in javascript but how to do it in node. usual methods in node gives something different.

Why i have this two errors when i use babylonjs

I am currently developing an application that displays 360° images and I use the BabylonJS library for that. And if today I come to you it’s because I have 2 errors that I don’t understand where they can come from
enter image description here
the first is: [.WebGL-00000A18072FEA00] GL_INVALID_OPERATION: Must have element array buffer bound.

and the second is :WebGL: INVALID_OPERATION: uniformMatrix4fv: location is not from current program

Load the target page on the same page after submitting a form

To begin with, there’s an include function in PHP:

The include (or require) statement takes all the text/code/markup that exists in the specified file and copies it into the file that uses the include statement.
https://www.w3schools.com/php/php_includes.asp

I have an HTML form with an action link and once I submit the form, it redirects me to that target page.

What I’d like to do is instead of redirecting me to that target page, the contents of the target page will load on the same page as the form like how include works. It won’t be a new page, it will still be the same but the contents of the target page will be added into it. How would I go about this?

Javascript : Area of ​a 2d room [closed]

In this javascript project, I’m trying to make sure that when you click on “edit Floorplan” the area of ​​the room is displayed in the middle of it. The air must appear regardless of the number of walls or their lengths.
Unfortunately, I’m a beginner and I don’t see how I can do this. Thank you for your help.
Anyone have an idea how to do it ?

Here is the link of my project.
https://mega.nz/file/QDAj1K5D#E2gdlIiEBrkX2I5ymEpYRoHs7GtN2LvwePLPF2W9ID4

alternatives to componentDidMount….Axios?

I have recently done a few API tests for a new job. Just receiving data and passing it through. Although I have completed the tasks and it works functionally, the people I walk through it with are not huge fans of componentDidMount.

They do not suggest an alternative? Anyone know why this could be? Is it due to it being async?

How to generate typings for CSS modules with Parcel?

I’m very new to Parcel. So this might seem like a dumb question to ask.

I have a project that uses typescript, react, less, parcel. And I need a way to generate typings since typescript is giving me the ‘Cannot find module ‘xxx‘ or its corresponding type declarations.’ error. I know I can create a global typing file for all modules ending with the extension .less, but that way I get errors ‘Property ‘xxx‘ does not exist on type ‘typeof import(“*.less”)” and no IntelliSense when editing.

I’m not sure if this is even supposed to be handled by Parcel, I found an extension for VSCode CSS Modules Typed which seems to do the trick, but there are a few plugins for parcel which promise to do the same thing but I can’t get them to work.

can i display my text file data in html form input field? if yes, please tell me how?

setup field:
My code takes input from enduser and stores that form data in one text file.

info field: here you can see form data(text file) which we stored before.

My Requirement is: want to show form data which we stored, on html form.

for ex: my text file contains: Device ID: SLSK10209849, this data has to show in html form input field

Totally, how to show text file form data in HTML form input fields

Here is my code:

<!DOCTYPE html>
<html>
<head>
<style>
.button {
  width: 100px;
  height: 30px;
  display: inline-block;
  background-color: #A9A9A9;
  margin: 0 10px 10px 0;
  color: #fff;
  text-align: center;
  line-height: 30px;
  cursor: pointer;
  border-radius: 15px;
}




.hide {
  display: none;
}
</style>
<div class="button" onclick="switch_div(1);">
 Setup
</div>
<div class="button" onclick="switch_div(2);">
 Info
</div>


<title>setup/info</title>





<div class="content hide" id="show_1">
<script language="Javascript" >
function download() {
  var filename = window.document.myform.docname.value;
  var name =  window.document.myform.name.value;
  var meterno =  window.document.myform.meterno.value;
  var volth=  window.document.myform.volth.value;
  var curth=  window.document.myform.curth.value;
  var sht=  window.document.myform.sht.value;
  var seasonal=  window.document.myform.seasonal.value;
  var mno=  window.document.myform.mno.value;
  var imno=  window.document.myform.imno.value;
  
  
  
  var pom = document.createElement('a');
  pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + 
    "Device ID: " + encodeURIComponent(name) + "nn" +
    "Meter Number: " + encodeURIComponent(meterno) + "nn" +
    "Voltage Threshold: " + encodeURIComponent(volth) + "nn" +
    "Current Threshold: " + encodeURIComponent(curth) + "nn" +
    "Server Hit Time: " + encodeURIComponent(sht) + "nn" +
    "Seasonal: " + encodeURIComponent(seasonal) + "nn" +
    "Mobile No: " + encodeURIComponent(mno) + "nn" +
    "IMEI Number: " + encodeURIComponent(imno) + "nn" +

    encodeURIComponent("")); 

  pom.setAttribute('download', filename);

  pom.style.display = 'none';
  document.body.appendChild(pom);

  pom.click();

  document.body.removeChild(pom);
}
</script>
</head>
<body>
<form name="myform" method="post" >
  <label> File Name:</label>
  <input type="text" id="docname" value="name.txt" /><br/><br/>
  <label> Device ID:</label>
  <input type="text" id="name" /><br/><br/>
  <label> Meter Number:</label>
  <input type="text" id="meterno" /><br/><br/>
  <label> Voltage Threshold:</label>
  <input type="text" id="volth" /><br/><br/>
  <label> Current Threshold:</label>
  <input type="text" id="curth" /><br/><br/>
  <label> Server Hit Time:</label>
  <input type="text" id="sht" /><br/><br/>
  <label> Date:</label>
  <input type="date" id="seasonal"><br/><br/>
  <label> Mobile Number:</label>
  <input type="text" id="mno" /><br/><br/>
  <label> IMEI Number:</label>
  <input type="text" id="imno" /><br/><br/>
  
  
  
  
  
  <input id="download_btn" type="submit" class="btn" style="width: 125px" onClick="download();" />
  
</form>
</body>

</div><br/><br/><br/><br/>



<div class="content hide" id="show_2">

<body>
    <input type="file" name="inputfile"
            id="inputfile">
    <br>

    <pre id="output"></pre>
    
    <script type="text/javascript">
        document.getElementById('inputfile')
            .addEventListener('change', function() {
            
            var fr=new FileReader();
            fr.onload=function(){
                document.getElementById('output')
                        .textContent=fr.result;
            }
            
            fr.readAsText(this.files[0]);
        })
    </script>
</body>
</div>

<script>
function switch_div(show) {  
  document.getElementById("show_"+show).style.display = "block";
  document.getElementById("show_"+((show==1)?2:1)).style.display = "none";
} 
</script>




</html>

Barcode generation and scanning with Cypress

I’m trying to automate a flow that requires scanning barcode. This was tested manually by using a 3rd party website to generate the barcode, and the actual scan barcode part was done on the site (using mobile browser and camera) I’m trying to automate. Since Cypress does not support multiple tabs or multiple browsers, I’m looking for alternate approaches to do so. The data that I can get is the UPC of the product, and the next step is to generate its barcode and scan it. How do we go about this using Cypress?
I know that there is a way to scan QR codes, but I haven’t been able to find much regarding generation and scanning of barcodes.

nuxtjs/composition-api – Module is undefined on composable file

I’m using @nuxtjs/composition-api in my Nuxt application with Vuetify. I have a composable file like this:

// composables/dialog.js
// https://www.npmjs.com/package/vuetify-dialog
import { useContext } from '@nuxtjs/composition-api'

export function useDialog () {
  const { $dialog } = useContext() // for some reason $dialog is undefined here
  const { message, error, info, warning, notify } = $dialog

  function showInfo (title, text) {
    return info({ title, text })
  }

  function messageSuccess (text) {
    return message.success(text)
  }

  // ... some other functions with message, error, info, warning

  return {
    $dialog,
    showInfo,
    messageSuccess,
    // ...
  }
}

The module $dialog is correctly registered in nuxt.config.js: $dialog docs

{
  modules: [
    // Simple usage
    'vuetify-dialog/nuxt',
    // ... other modules
  ]
}

When I access first a page that doesn’t use this composable and then navigate to another page that uses the composable, it works fine. However, if I directly open the page that uses the composable, it shows the error cannot destructure property 'message' of '$dialog' as it is undefined. It happens in production and local env.

Is there any limitation with composable files and @nuxtjs/composition-api ?

Github Issue

An API that returns details of retail stores in the United States and Canada

I’m trying to collate details of retail stores like Wallmart and Amazon. I need these details so i can visualize the data Tableau. The aim is for business owners to see these visualized data and make informed business decisions. So details like store name, location, MSA (Mertrpolitan Statistical Area), date store was opened and closed(if available).

While it is possible to get these data manually, it’s quite hectic and very difficult to come by.

Does anyone know any API I can use to solve this problem?