How to get a value of an object referenced by another value [duplicate]

from the countries API I want to identify the 10 largests countries, already got the area values of these countries in the largest array but I want to reference the names of those cuntries in the object obtained from the API.

const countriesAPI = 'https://restcountries.com/v2/all'
let area = []
let names = []
let languages = []
let langNames = [] 
const fetchData = async () => {
    try {
      const response = await fetch(countriesAPI)
      const countries = await response.json()
      countries.forEach(country => {
          area.push(country.area)
          names.push(country.name)
          languages.push(country.languages)
      })
      let areaSorted = area.sort((function(a,b){return b - a}))
      let largests = areaSorted.slice(0,10)
      console.log(largests)
    } catch (err) {
      console.error(err)
    }
}
fetchData()

this is what I got so far

How can I use the info from the top ten areas to find what cuntries they belong to

How to resolve a race condition in javascript (react) async component

I am using getInitialProps hook from nextjs api in my project. On first load, it returns the data and it shows in the browser, but when i refresh the page it becomes null, and the data no longer shows in the browser.

Observation: When I refresh the Accounts page, the data disappears, then when I click “Account” link on the navbar to the same page, the data shows up. here is a pic.

Also, the prop userInfo is sent to a separate component which shows the data

enter image description here

[ Account on the navbar

import {auth} from ...firebase
...
Dashboard.getInitialProps = async (context) => {   
  const userRef = ref(database, "users/" + auth?.currentUser?.uid);   
  const getUser = async () => (await get(userRef)).val();

  const data = await getUser();   
  const userInfo = data;   console.log("user info below");   
  console.log(userInfo);   
  if (!userInfo) return { notFound: true };   
  return {
    props: { userInfo },   
   }; 
  };

Failed to change placeholder color of an input

so I have an input and I was trying to change the color of the placeholder, in some websites I believe I see people are changing the placeholder color

I tried changing with elem.value but it doesn’t make any sense value and placeholder are two different things
even .placeholder and then style is not working as you can see below.
can’t find the way to do it
am I missing something?
here is my code:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="new">
      <input type="text" id="myInput" placeholder="type here" />
    </div>
  </body>
  <script>
    const elem = document.getElementById("myInput");
    elem.placeholder.style.color = "green";
  </script>
</html>

get specfic objects from array inside array of object express js mongodb

i have array of friends inside users array , i need to get all friends of specfic user by email that approved field is true

in nodejs i have user mongo schema

const UserSchema = mongoose.Schema({
     username : {type: String , required :true},
     email : {type: String , required :true, unique: true, match: /.+@.+..+/},
     password : {type: String , required :true},
     friends : {type:[{username : String, approved: Boolean}]},
});

[
  {
    "username": "ali",
    "email": "ali200@gmail,com",
    "password": "pdcjjfefmkadjakefkeofjafjafsfjsalnnryifajs",
    "friends": [
      {
        "id": "1",
        "username": "gamal",
        "approved": true
      },
      {
        "id": "2",
        "username": "osama",
        "approved": false
      },
      {
        "id": "3",
        "username": "john",
        "approved": true
      }
    ]
  }
]

i need to get this

[
{
“id”: “1”,
“username”: “gamal”,
“approved”: true
},
{
“id”: “3”,
“username”: “john”,
“approved”: true
}

]

MODULE_NOT_FOUND issue in node.js

I stuck at MODULE_NOT_FOUND , I have checked other questions related to it and tried their soultions but could not get succeed. Any help will be appreciated. Thanks.

I am trying to create node.js with mysql db using TypeORM and trying to import User entity created in entity folder where I have file name User.ts

enter image description here

This is my folder structure.

Below is package.json

{
  "name": "mysql-typeorm",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "scripts": {
    "test": "echo "Error: no test specified" && exit 1",
    "start": "nodemon app.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@types/express": "^4.17.17",
    "@types/node": "^18.14.6",
    "express": "^4.18.2",
    "mysql2": "^3.2.0",
    "nodemon": "^2.0.21",
    "reflect-metadata": "^0.1.13",
    "ts-node": "^10.9.1",
    "typeorm": "^0.3.12",
    "typescript": "^4.9.5"
  }
}

Below is my app.js

const express = require('express')
const { User } = require('./entity/User')

const { DataSource , createConnection} =  require('typeorm')
const app = express()

const port = 3000 || process.env.port

app.listen(port , () => {
    console.log(`server is listening on ${port}`)
})

const appDataSource = new DataSource({
    type:"mysql",
    host:"localhost",
    port:3308,
    username:"root",
    password:"",
    database:"booksDB",
    synchronize:true,
    logging:true,
    entities:[User]
});

appDataSource.initialize().then((res)=> {
    console.log(`db is connected`)
}).catch((err) => {
    console.log(`${err}`)
})

app.get('/test',(req,res)=>{
    res.send({
        test:'Testing is done'
    })
})

Below is my User.ts for entity User located in entity folder.

import {Entity , PrimaryGeneratedColumn , Column , BaseEntity } from 'typeorm'

@Entity()
export class User extends BaseEntity {
 @PrimaryGeneratedColumn()
    id!: number;

 @Column()
    name!: string;

 @Column()
    email!: string;

 @Column()
    phone!: string;

}

I am getting error like this

Error: Cannot find module './entity/User'
Require stack:
- D:2023elluminoustechnical_growth_programnode.jsnode-mysql-typeormapp.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (D:2023elluminoustechnical_growth_programnode.jsnode-mysql-typeormapp.js:2:18)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'D:\2023\elluminous\technical_growth_program\node.js\node-mysql-typeorm\app.js'
  ]
}
[nodemon] app crashed - waiting for file changes before starting...

How to decorate a table cell with a JS

How to use javascript to decorate a cell in html?

I have this table in html

<table border="1" width="300" height="200">
        <tr>
            <td id="11"><</td>
            <td id="12"></td>
            <td id="13"></td>
            <td id="14"></td>
            <td id="15"></td>
            <td id="16"></td>
            <td id="17"></td>
            <td id="18"></td>
            <td id="19"></td>
            <td id="20"></td>
        </tr>
</table>
<style>
        table {
            border-collapse: collapse;
        }
        td {
            border: 1px solid grey;>
        }
    </style>

I want to conditionally get cell id 11, and paint it black

I tried to do it on JS, but nothing worked

function bthClick(){
    let table = document.querySelectorAll('td id')
    table[11].style.color = 'dark'
}

need to encrypt data in node-js and decrypt it in client side using pure javascript

here is server side app.js file

const crypto = require('crypto');

const { publicKey, privateKey } = crypto.generateKeyPairSync('rsa', {
    modulusLength: 4096,
    publicKeyEncoding: {
        type: 'spki',
        format: 'pem'
    },
    privateKeyEncoding: {
        type: 'pkcs8',
        format: 'pem',
        cipher: 'aes-256-cbc',
        passphrase: 'my-secret-passphrase'
    }
});

const data = 'Hello, World!';
function encryptData(data) {
    const buffer = Buffer.from(data);
    const encrypted = crypto.publicEncrypt(publicKey, buffer);
    return encrypted.toString('base64');
}
let encryptedData = encryptData(data);
res.render('final',{privateKey : privateKey,encrypted : encryptedData});

here is client side javascript

<script src="/crypto-js/crypto-js.js"></script>
<script>
    let privateKey = `<%= privateKey %>`;
    let base64String = `<%= encrypted %>`;
    function decryptData(encryptedData) {
        const encrypted = CryptoJS.enc.Base64.parse(encryptedData);
        const decrypted = CryptoJS.AES.decrypt({
            ciphertext: encrypted
            }, privateKey, {
            format: CryptoJS.format.OpenSSL
        });
        return decrypted.toString(CryptoJS.enc.Utf8);
    }


    console.log(decryptData(base64String));
</script>

but it giving me this error every time

Uncaught Error: Malformed UTF-8 data
at Object.stringify (crypto-js.js:523:24)
at WordArray.init.toString (crypto-js.js:278:38)
at decryptData ((index):66:26)
at (index):70:17

Encrypt data in NodeJS using public key and decrypt data pure JavaScript without any error

Filters Needs to be done based on the tags name

{
    "current_page": 1,
    "per_page": 100,
    "next_page": null,
    "previous_page": null,
    "total_pages": 1,
    "total_count": 23,
    "checks": [
        {
            "id": 230610,
            "name": "Kentico Kontent (docs.wiise.com) - Kentico - Digital",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2021-12-16T22:54:23.000Z",
            "updated_at": "2023-02-26T15:55:21.000Z",
           
            "status": {
                "last_code": 401,
                "last_message": "Unauthorized",
                "last_response_time": 169,
                "last_run_at": "2023-02-26T15:55:21.000Z",
                "last_failure_at": null,
                "last_alert_at": null,
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9360,
                    "name": "Kentico"
                }
            ]
        },
        {
            "id": 230612,
            "name": "Google Recaptcha - Google - Digital",
            "type": "api",
            "frequency": 15,
            "paused": true,
            "muted": false,
            "created_at": "2021-12-16T23:37:51.000Z",
            "updated_at": "2022-03-03T22:05:00.000Z",
            
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 350,
                "last_run_at": "2022-03-03T22:04:07.000Z",
                "last_failure_at": null,
                "last_alert_at": null,
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 3596,
                    "name": "Google"
                }
            ]
        },
        {
            "id": 230628,
            "name": "Shopify API - Shopify - Product",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2021-12-17T10:03:02.000Z",
            "updated_at": "2023-02-26T16:00:27.000Z",
            
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 667,
                "last_run_at": "2023-02-26T16:00:27.000Z",
                "last_failure_at": "2022-06-21T07:14:52.000Z",
                "last_alert_at": "2022-06-21T07:29:50.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9364,
                    "name": "Shopify"
                }
            ]
        },
        {
            "id": 230631,
            "name": "Wiise Registration API - Wiise - Product",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2021-12-17T10:08:58.000Z",
            "updated_at": "2023-02-26T16:02:19.000Z",
            
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 443,
                "last_run_at": "2023-02-26T16:02:19.000Z",
                "last_failure_at": "2022-09-12T07:53:06.000Z",
                "last_alert_at": "2022-09-12T08:02:29.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9361,
                    "name": "Wiise"
                }
            ]
        },
        {
            "id": 230632,
            "name": "Quickstart Wiise API - Wiise - Product",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2021-12-17T10:11:02.000Z",
            "updated_at": "2023-02-26T15:57:59.000Z",
            
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 2930,
                "last_run_at": "2023-02-26T15:57:59.000Z",
                "last_failure_at": "2023-02-21T12:16:06.000Z",
                "last_alert_at": "2023-02-21T12:28:10.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9361,
                    "name": "Wiise"
                }
            ]
        },
        {
            "id": 230634,
            "name": "KeyPay API - KeyPay - Product",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2021-12-17T10:13:24.000Z",
            "updated_at": "2023-02-26T16:01:47.000Z",
            
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 225,
                "last_run_at": "2023-02-26T16:01:46.000Z",
                "last_failure_at": "2023-02-18T22:01:41.000Z",
                "last_alert_at": "2023-02-18T22:16:43.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9373,
                    "name": "KeyPay"
                }
            ]
        },
        {
            "id": 230640,
            "name": "Chargebee API - Chargebee - RevOps",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2021-12-17T10:18:19.000Z",
            "updated_at": "2023-02-26T16:03:34.000Z",
           
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 211,
                "last_run_at": "2023-02-26T16:03:33.000Z",
                "last_failure_at": "2022-09-30T14:23:12.000Z",
                "last_alert_at": "2022-09-30T14:34:22.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9376,
                    "name": "Chargebee"
                }
            ]
        },
        {
            "id": 230641,
            "name": "HubSpot API - HubSpot - RevOps",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2021-12-17T10:19:02.000Z",
            "updated_at": "2023-02-26T16:01:18.000Z",
           
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 715,
                "last_run_at": "2023-02-26T16:01:18.000Z",
                "last_failure_at": "2023-02-09T14:46:22.000Z",
                "last_alert_at": "2023-02-09T14:49:26.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9377,
                    "name": "HubSpot"
                }
            ]
        },
        {
            "id": 230810,
            "name": "Business Central - Microsoft - Product",
            "type": "real_browser",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2021-12-21T05:46:20.000Z",
            "updated_at": "2023-02-26T16:03:41.000Z",
           
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 916,
                "last_run_at": "2023-02-26T16:03:41.000Z",
                "last_failure_at": "2023-02-22T12:34:15.000Z",
                "last_alert_at": "2023-02-22T12:33:10.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 4320,
                    "name": "Microsoft"
                },
                {
                    "id": 10186,
                    "name": "public"
                }
            ]
        },
        {
            "id": 234403,
            "name": "Wiise Square Integration API - Wiise - Product",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2022-01-25T01:07:25.000Z",
            "updated_at": "2023-02-26T15:56:07.000Z",
            
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 2581,
                "last_run_at": "2023-02-26T15:56:07.000Z",
                "last_failure_at": "2023-01-25T07:58:02.000Z",
                "last_alert_at": "2023-01-25T08:00:05.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9361,
                    "name": "Wiise"
                }
            ]
        },
        {
            "id": 234405,
            "name": "Wiise main website - Wiise - Digital",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2022-01-25T02:00:07.000Z",
            "updated_at": "2023-02-26T15:51:35.000Z",
            
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 697,
                "last_run_at": "2023-02-26T15:51:32.000Z",
                "last_failure_at": "2022-06-21T07:06:56.000Z",
                "last_alert_at": "2022-06-21T07:06:56.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9361,
                    "name": "Wiise"
                }
            ]
        },
        {
            "id": 234406,
            "name": "Wiise Google indexing - Wiise - Digital",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2022-01-25T02:01:43.000Z",
            "updated_at": "2023-02-26T16:02:49.000Z",
            
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 916,
                "last_run_at": "2023-02-26T16:02:48.000Z",
                "last_failure_at": "2022-09-15T03:13:31.000Z",
                "last_alert_at": "2022-09-15T03:13:31.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9361,
                    "name": "Wiise"
                }
            ]
        },
        {
            "id": 234407,
            "name": "Wiise download website - Wiise - Digital",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2022-01-25T02:11:53.000Z",
            "updated_at": "2023-02-26T16:02:30.000Z",
           
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 615,
                "last_run_at": "2023-02-26T16:02:30.000Z",
                "last_failure_at": "2023-01-25T07:48:52.000Z",
                "last_alert_at": "2023-01-25T07:50:57.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9361,
                    "name": "Wiise"
                }
            ]
        },
        {
            "id": 237198,
            "name": "Business Central API - Simplify Payments for Customers - Wiise + Simplify - Product",
            "type": "real_browser",
            "frequency": 30,
            "paused": false,
            "muted": false,
            "created_at": "2022-02-17T23:20:04.000Z",
            "updated_at": "2023-02-26T16:01:59.000Z",
           
            "status": {
                "last_code": 200,
                "last_message": null,
                "last_response_time": 10212,
                "last_run_at": "2023-02-26T16:01:59.000Z",
                "last_failure_at": "2023-02-09T09:07:48.000Z",
                "last_alert_at": "2023-02-09T09:30:32.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9372,
                    "name": "Wiise"
                }
            ]
        },
        {
            "id": 237201,
            "name": "Business Central API - Paid Simplify Payments for Customers - Wiise - Product",
            "type": "real_browser",
            "frequency": 30,
            "paused": false,
            "muted": false,
            "created_at": "2022-02-17T23:31:14.000Z",
            "updated_at": "2023-02-26T15:38:40.000Z",
            
            "status": {
                "last_code": 200,
                "last_message": null,
                "last_response_time": 3054,
                "last_run_at": "2023-02-26T15:38:40.000Z",
                "last_failure_at": "2023-02-23T11:09:03.000Z",
                "last_alert_at": "2023-02-23T11:08:28.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9361,
                    "name": "Wiise"
                }
            ]
        },
        {
            "id": 237207,
            "name": "Keypay - Keypay - Product",
            "type": "real_browser",
            "frequency": 30,
            "paused": false,
            "muted": false,
            "created_at": "2022-02-18T00:00:30.000Z",
            "updated_at": "2023-02-26T15:39:56.000Z",
            
            "status": {
                "last_code": 200,
                "last_message": null,
                "last_response_time": 3777,
                "last_run_at": "2023-02-26T15:39:56.000Z",
                "last_failure_at": "2023-02-23T01:10:03.000Z",
                "last_alert_at": "2023-02-23T01:09:21.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9373,
                    "name": "KeyPay"
                }
            ]
        },
        {
            "id": 237927,
            "name": "Square API - Square - Product",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2022-02-28T00:58:31.000Z",
            "updated_at": "2023-02-26T15:54:49.000Z",
           
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 2222,
                "last_run_at": "2023-02-26T15:54:48.000Z",
                "last_failure_at": "2022-12-16T11:27:57.000Z",
                "last_alert_at": "2022-12-16T11:39:48.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9363,
                    "name": "Square"
                }
            ]
        },
        {
            "id": 237928,
            "name": "CSP - Microsoft - RevOps",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2022-02-28T01:38:07.000Z",
            "updated_at": "2023-02-26T16:01:44.000Z",
           
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 5706,
                "last_run_at": "2023-02-26T16:01:44.000Z",
                "last_failure_at": "2023-01-11T10:15:48.000Z",
                "last_alert_at": "2023-01-11T10:15:48.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 4320,
                    "name": "Microsoft"
                }
            ]
        },
        {
            "id": 237940,
            "name": "Business Central API - Microsoft - Product",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2022-02-28T05:37:25.000Z",
            "updated_at": "2023-02-26T15:54:24.000Z",
           
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 1571,
                "last_run_at": "2023-02-26T15:54:24.000Z",
                "last_failure_at": "2023-02-21T16:09:29.000Z",
                "last_alert_at": "2023-02-21T16:24:27.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 4320,
                    "name": "Microsoft"
                }
            ]
        },
        {
            "id": 237945,
            "name": "Wiise KeyPay Integration API - Wiise - Product",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2022-02-28T06:24:38.000Z",
            "updated_at": "2023-02-26T15:56:20.000Z",
           
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 3576,
                "last_run_at": "2023-02-26T15:56:20.000Z",
                "last_failure_at": "2023-02-21T12:26:23.000Z",
                "last_alert_at": "2023-02-21T12:41:25.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9361,
                    "name": "Wiise"
                }
            ]
        },
        {
            "id": 238394,
            "name": "SSIS API - SSIS - Product",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2022-03-03T21:31:56.000Z",
            "updated_at": "2023-02-26T15:59:44.000Z",
           
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 2453,
                "last_run_at": "2023-02-26T15:59:44.000Z",
                "last_failure_at": "2023-02-18T22:19:16.000Z",
                "last_alert_at": "2023-02-18T22:29:10.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9482,
                    "name": "SISS"
                }
            ]
        },
        {
            "id": 238395,
            "name": "Wiise SISS Integration API - Wiise - Product",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2022-03-03T22:16:27.000Z",
            "updated_at": "2023-02-26T15:58:18.000Z",
           
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 1996,
                "last_run_at": "2023-02-26T15:58:18.000Z",
                "last_failure_at": "2023-02-18T22:18:35.000Z",
                "last_alert_at": "2023-02-18T22:28:26.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9361,
                    "name": "Wiise"
                }
            ]
        },
        {
            "id": 243857,
            "name": "Wiise Docs website - Wiise - Digital",
            "type": "api",
            "frequency": 15,
            "paused": false,
            "muted": false,
            "created_at": "2022-04-26T06:42:51.000Z",
            "updated_at": "2023-02-26T15:58:10.000Z",
           
            "status": {
                "last_code": 200,
                "last_message": "OK",
                "last_response_time": 202,
                "last_run_at": "2023-02-26T15:58:09.000Z",
                "last_failure_at": "2023-01-25T07:29:08.000Z",
                "last_alert_at": "2023-01-25T07:29:08.000Z",
                "has_failure": false,
                "has_location_failure": null
            },
            "tags": [
                {
                    "id": 9361,
                    "name": "Wiise"
                }
            ]
        }
    ]
}
Wiise
 A
 B
 C
Microsoft
 D
 e
 f
GOOGLE
 a
 b

having trouble with the implementation of a cash register function

I am learning Javascript, and I completed the freeCodeCamp cash register JS project https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register . I am now trying to create a cash register website to implement and demonstrate this. The initial function was correct, but now I am adding a user price input and payment input, and the function should return when the button is clicked. I have not been able to get it to work. here is the link to my github repo: https://github.com/aaronnwg/Cash-Register . Any guidance as to what is missing, or what needs to be changed would be greatly appreciated.

After building the HTML page, I tried:

const price = document.getElementById('price');
const cash = document.getElementById('payment');
//cid is already declared
const cashRegisterFunction = () => {
  
  document.getElementById('return').innerHTML = checkCashRegister(price, cash, cid)
}
button.onClick = cashRegisterFunction();

My expectation is that the user will input ‘price’ and ‘payment’, and when the button is clicked, checkCashRegister function should return in the ‘return’.

Local Storage value

value is not set in a localstorage.

const todo = () => {
    let value = document.querySelector("#input_box").value;
    let ok_btn = document.querySelector(".ok_btn");
    function main(){
        return localStorage.setItem("0", value);
    }
    ok_btn.addEventListener("click", main);
    
}

todo();

I make a todo function. This function is work properly but the localstorage value is not set.

I want to get days of a week from an array

I am creating a weather forecast and I want to get 7 days forecast with the correct weather.

Please, check the below code

`import React, { useState } from "react";

import "./forecast.css";

const WEEK_DAYS = ["Mon", "Tue", "Wed", "Thur", "Fri", "Sat", "Sun"];

const Forecast = ({ data }) => {
const dayInAWeek = new Date().getDay();
const forecastDays = WEEK_DAYS.slice(dayInAWeek, WEEK_DAYS.length())
);`

I return a component and iterate all the data from the weather API to the WEEK_DAYS to show given days but it’s not displaying anything. Any help please.

Electron React 404 not found in production

I am building an electron app with react.js. It works fine in development mode but does not work in production mode. I have added the main folder inside the public and you can see my production error in the URL in the main.js code.

My folder structure

enter image description here

My main.js code –

const { app, BrowserWindow, globalShortcut, shell } = require("electron");
const isDev = require("electron-is-dev");
const path = require("path");

const getIconPath = () => {
  let ext = "png";
  if (process.platform === "darwin") {
    ext = "icns";
  }
  if (process.platform === "linux") {
    ext = "png";
  }
  if (process.platform === "win32") {
    ext = "ico";
  }
  let iconPath;
  iconPath = isDev
    ? iconPath.join(__dirname, "..", "assets", "app_icon", `icon.${ext}`)
    : iconPath.join(
        __dirname,
        "..",
        "..",
        "build",
        "assets",
        "app_icon",
        `icon.${ext}`
      );
  return iconPath;
};

let mainWindow;
let splash;
function createWindow() {
  splash = new BrowserWindow({
    width: 600,
    height: 400,
    autoHideMenuBar: true,
    center: true,
    transparent: true,
    frame: false,
    show: false,
    maximizable: false,
    resizable: false,
    minimizable: false,
    alwaysOnTop: true,
  });

  mainWindow = new BrowserWindow({
    minWidth: 500,
    minHeight: 300,
    show: false,
    autoHideMenuBar: true,
    icon: isDev ? getIconPath() : null,
    webPreferences: {
      contextIsolation: false,
      nodeIntegration: true,
    },
  });

  const mainWindowURL = isDev
    ? "http://localhost:3000"
    : `file://${path.join(__dirname, "../", "../build/index.html")}`;

  const splashURL = isDev
    ? "http://localhost:3000/splash"
    : `file://${path.join(__dirname, "../", "../build/index.html#/splash")}`;
  shell.openExternal(mainWindowURL);
  shell.openExternal(splashURL);
  splash.loadURL(splashURL);
  mainWindow.loadURL(mainWindowURL);

  splash.once("ready-to-show", () => {
    splash.show();
  });

  mainWindow.once("ready-to-show", () => {
    setTimeout(() => {
      splash.destroy();
      // maximize the window
      mainWindow.maximize();
      mainWindow.show();
    }, 3000);
  });

  // production a bad jabe
  const handleDevTools = () => {
    if (mainWindow.webContents.isDevToolsOpened()) {
      mainWindow.webContents.closeDevTools();
    } else {
      mainWindow.webContents.openDevTools();
    }
  };
  globalShortcut.register("CommandOrControl+Shift+I", handleDevTools);

  // mainWindow.webContents.openDevTools();

  mainWindow.on("closed", () => {
    mainWindow = null;
  });
}

app.on("ready", createWindow);

app.on("window-all-closed", () => {
  if (process.platform !== "darwin") {
    app.quit();
  }
});

app.on("activate", function () {
  if (BrowserWindow.getAllWindows().length === 0) createWindow();
});

And when I run the project in production mode built by electron-builder. This shows up the

error – Unexpected Application Error! 404 Not Found

enter image description here

Can we integrate Framework7 app with ASP.Net MVC?

I am extremely new to framework7, though i have a strong background in HTML,CSS and C#. I recently found a framework7 template based a mobile app, which i wanted to take forward based on my requirement.

Can we integrate the Framework7 with ASP.Net MVC (with WebAPI) or we need to work with JS only to get things working on Framework7.

I saw the layout of Framework7, it does not seems it follows View/PartialView concept of MVC, because in the default Template, Index.html of Framework7 i could not see a placeholder where the Partial View would fill in, though other pages follow the class “pages” instead of whole layout of index page, but could not find where we need to stuff the Partial view inside View.

Please help me with setting up a Framework7 project with ASP.Net MVC, or any Github project which is already have the ASP.Net MVC integrated and using WebAPI.

fit footer image for all screen size

I have the below code of the footer :

<div class="footer footer-content">
    <div class="content-logo login">
        <span><img src="${url.resourcesPath}/img/logoSample1.png" alt="Logo" /></span>
    </div>      
</div>

here is the CSS:

div.footer {
    width: 100vw;
    height: 65vh;
    margin: 0px;
    padding: 0px;
    background-size: 100% 100%;
}


.footer {
    margin: 0px;
    padding: 0px;
    height: auto;
    background-image: url('../img/myImage.jpg');
    clip-path: polygon(50% 0%, 100% 9%, 100% 100%, 0% 100%, 0% 9%);
    background-repeat: no-repeat;
    text-align: center;
    background-size: cover;
}

.content-logo.login {
    margin: 0px;
    padding: 0px;
    /*  margin-top: 2rem;*/
}

.content-logo {
    font-family: 'Source Sans Pro', sans-serif;
    position: absolute;
    right: 15px;
    bottom: 40px;
    z-index: 999;
}

Image 1:

enter image description here

Image 2:

enter image description here

My question:

As I test in different devices, as can be seen in image-2 the footer doesnt fit/stays at the bottom on different screen sizes, It cuts the logo and the footer moves up, showing the background colour at bottom. I am able to fit the image by changing the height in above CSS (for example, chnaging in above CSS from “height: 65vh;” to “height: 35vh;” for a mobile screen) to the view port height of different screen sizes, but thats not good as screen sizes can be anything. how can I fit the footer at bottom with logo floating at the bottom right corner irrespective of any screen size ? Its okay if the image gets stretched, the logo should show up in every screen. I am stuck, appreciate all the help here.

Link to footer image just incase : https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSpblwwG6gPo00z3cP_4c-lgit81chm13PZjHOxHBlQrGcp3EAuYSEeGj7YCgP510fn3g&usqp=CAU