Parsing the Page

I wrote a small js script, I want to enter the site by login and password and parsing data birthday and name users on the page I need. But i do not know what i need to do further

var page = require('webpage').create();
phantom.cookiesEnabled = true;
page.open("http://www.facebook.com/login.php", function(status) {

  if (status === "success") {
    page.evaluate(function() {
        document.getElementById("email").value = "[email protected]";
        document.getElementById("pass").value = "12345";
        document.getElementById("u_0_1").click();
    });


window.setTimeout(function() {
       page.render("fb.png");
    }, 5000);

page.open('https://www.facebook.com/friends/requests/?fcref=ff', function() {
      window.setTimeout(function() {
       page.render("fb2.png");
       phantom.exit();
    }, 5000);
    });
  }
});

merge two sorted link-list JS

  1. Merge Two Sorted Lists
    You are given the heads of two sorted linked lists list1 and list2.

Merge the two lists in a one sorted list. The list should be made by
splicing together the nodes of the first two lists.

Return the head of the merged linked list.

https://leetcode.com/problems/merge-two-sorted-lists/description/

I am trying to solve this problem and i don’t understand why my logic or code is wrong !!

/**
 * Definition for singly-linked list.
 * function ListNode(val, next) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.next = (next===undefined ? null : next)
 * }
 */
/**
 * @param {ListNode} list1
 * @param {ListNode} list2
 * @return {ListNode}
 */
var mergeTwoLists = function(list1, list2) {
    let head = new ListNode()
    let temp = head
    while(list1 && list2){
        if(list1.val>list2.val){
            head.next = list2
            list2 = list2.next
        }
        if(list1.val <= list2.val){
            head.next = list1
            list1 = list1.next
        }
        head = head.next
    }
    if(list1){
        head.next = list1
    }
    if(list2){
        head.next = list2
    }
    return temp.next
};

My test case is this:

enter image description here
Thank you

Disable script on condition

Good day, from this page I run the below script, which extracts, in the field “Name”, the publisher from the bibliographic item (Feltrinelli, in the example). I would like the script to run only once, that is to be disabled when on the previous page there is the expression “Modern publisher” under the heading “Persons, institutions and families”.

function getNome(tmp) {
 
    idx = tmp.indexOf('. ((');
 
    if(idx > -1){
    tmp = tmp.substr(0, idx);
    }
 
    tmp = tmp.split('. - ');
     
    switch(tmp.length){
    case 3:
    tmp = tmp[1];
    break;
    case 4:
    tmp = tmp[2];
    break;
    default:
    tmp = "";
    break;
    }
     
    if(tmp !== ''){
        tmp = tmp.substr(tmp.indexOf(' : ') + 2);
        console.log(tmp);
        if(tmp.indexOf('.') != -1 && tmp.split('.').length == 2){
            tmp = tmp.substr(tmp.indexOf('. ') + 1, tmp.indexOf(', ') -3);
            tmp = tmp.trim();
        }
        else {
            tmp = tmp.split(",")[0];
            tmp = tmp.trim();
        }
    }
    return tmp;
}
function impostaNome(tmp) {
    Array.from(document.querySelectorAll('article section.grid_container form div.grid-row label span')).filter( e => e.innerText.trim() === 'Nome')[0].parentNode.querySelector('input').value = tmp;
}
impostaNome(getNome(document.querySelector('div.meta.tito div.evidence.isbd').innerText));

DC.js pie chart of already summarized data

I have aggregate data like so:

Event  Yellows  Reds  talls  shorts
A.           1     3     5       0
B.           0     7    17      19

So each row contains a set of colours and a set of heights. The real data has more group fields (event is really an event type and we also have region, but I think the above simplification works)

I want to use dc.js to present two pie charts: one for colours and one for heights.

Normally using crossfilter the data would be vertical: witg each row containing: event, colour, height, value. But I don’t have that data; I don’t have a breakdown of how many yellows were tall, for example.

I want that when you click yellow on the colours pie chart, the height chart should only show event data where yellows>0, I.e. event A. Likewise clicking on tall would filter only where there are tall (so no filter in this dataset); click short and event A should be filtered out.

Is this possible? How?

how to define dynamic routes while doing next export command

Basically I want to define dynamic routes like this:

routes->

 /books/categoryname
  /books/categoryname/bookId

categoryname is dynamic and also bookId

folder structure:

books -> 
  index.tsx
  [book_category] ->
    index.tsx
    [id]
      index.tsx

how to define dynamic routes in next.config.js ?

next.config.js

  exportPathMap: async function (
    defaultPathMap,
    { dev, dir, outDir, distDir, buildId }
  ) {
    return {
      '/': { page: '/' },
      '/about': { page: '/about' },
      '/contact': { page: '/contact' },
      '/register': { page: '/register' },
      '/login': { page: '/login' },
      '/books': { page: '/books' },
      '/books/category': { page: '/books/[book_category]' },
      '/books/category/id': { page: '/books/[book_category]/[id]' },
    }
  },
}

how to import all the icons using one import statement as I have to use 50 icons in this project

import BookmarkCheck from "../Icons/bookmark-check.svg";
import BookmarkOff from "../Icons/bookmark-off.svg";
import Bookmark from "../Icons/bookmark.svg";

export const Data = [
  {
    icon: BookmarkCheck,
    title: "Bookmark Checked",
  },
  {
    icon: BookmarkOff,
    title: "Bookmark Off",
  },
  {
    icon: Bookmark,
    title: "Bookmark",
  },
];

I want to shorten the number of import statements as i have to import 50 icons from a Icons folder.

JS event bubbling – How can I avoid the changing targets?

I have bound click eventListeners to an up and down vote button.

Problem: When I click on different parts of the button I get the corresponding element I clicked on and not the parent element which contains relevant information for further processing.

What I already tried: I already tried ev.stopPropagation(); but the behaviour remained the same.

Question: How can I solve this problem?

My example code

const commentVotes = document.querySelectorAll('.comment-votes');

commentVotes.forEach((row) => {
  const up = row.querySelector('.comment-vote-up');
  const down = row.querySelector('.comment-vote-down');            

  up.addEventListener('click', async (ev) => {    
    // ev.stopPropagation();
    const id = ev.target.getAttribute('data-item-id');
    console.log({"target": ev.target, "ID": id})
  });
  
  down.addEventListener('click', async (ev) => {
    // same as up
  })
});
.comment .comment-vote-box {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.spacer {
  margin-right:10px;
}
<div class="comment">
  <div class="comment-vote-box comment-votes mt-10">
    
    <div class="vote-up">
      <button class="comment-vote-up"
              data-item-id="11">
        <span class="spacer">Like</span>
        <span>0</span>
      </button>
    </div>
    
    <div class="vote-down">
      <button class="comment-vote-down"
              data-item-id="12">
        <span class="spacer">Dislike</span>
        <span>1</span>
      </button>
    </div>
    
  </div>
</div><!-- comment -->

React-Native with TypeORM, babel transform error “Couldn’t find program”

I’m the maintainer of a React-Native library. When trying to upgrade my package to the latest version of React-Native I started getting a babel transform error:

enter image description here

Here is a transcription of the stack:

LOG  Running "QuickSQLiteExample" with {"rootTag":1,"initialProps":{}}
error: node_modules/typeorm/browser/schema-builder/RdbmsSchemaBuilder.js: /Users/osp/Developer/react-native-quick-sqlite/example/node_modules/typeorm/browser/schema-builder/RdbmsSchemaBuilder.js: Couldn't find a Program
 ERROR  [Error: TransformError node_modules/typeorm/browser/schema-builder/RdbmsSchemaBuilder.js: /Users/osp/Developer/react-native-quick-sqlite/example/node_modules/typeorm/browser/schema-builder/RdbmsSchemaBuilder.js: Couldn't find a Program]
Error: /Users/osp/Developer/react-native-quick-sqlite/example/node_modules/typeorm/browser/schema-builder/RdbmsSchemaBuilder.js: Couldn't find a Program
    at Scope.getProgramParent (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/scope/index.js:768:11)
    at Scope.crawl (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/scope/index.js:686:32)
    at Scope.init (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/scope/index.js:676:12)
    at NodePath.setScope (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:122:30)
    at NodePath.setContext (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:134:8)
    at NodePath.popContext (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:192:10)
    at TraversalContext.visitQueue (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:109:12)
    at TraversalContext.visitMultiple (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:67:17)
    at TraversalContext.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:119:19)
    at traverseNode (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at traverse (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/index.js:50:34)
    at Function.traverse.hasType (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/index.js:86:3)
    at BlockScoping.wrapClosure (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/plugin-transform-block-scoping/lib/index.js:469:37)
    at BlockScoping.run (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/plugin-transform-block-scoping/lib/index.js:335:12)
    at PluginPass.Loop (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/plugin-transform-block-scoping/lib/index.js:59:38)
    at newFn (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/visitors.js:159:21)
    at NodePath._call (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:46:20)
    at NodePath.call (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:36:17)
    at NodePath.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:84:31)
    at TraversalContext.visitQueue (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitMultiple (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:67:17)
    at TraversalContext.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:119:19)
    at traverseNode (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:90:52)
    at TraversalContext.visitQueue (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitSingle (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:72:19)
    at TraversalContext.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:121:19)
    at traverseNode (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:90:52)
    at TraversalContext.visitQueue (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitMultiple (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:67:17)
    at TraversalContext.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:119:19)
    at traverseNode (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:90:52)
    at TraversalContext.visitQueue (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitSingle (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:72:19)
    at TraversalContext.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:121:19)
    at traverseNode (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:90:52)
    at TraversalContext.visitQueue (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitMultiple (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:67:17)
    at TraversalContext.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:119:19)
    at traverseNode (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:90:52)
    at TraversalContext.visitQueue (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitMultiple (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:67:17)
    at TraversalContext.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:119:19)
    at traverseNode (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:90:52)

Doing some research I found this issue which seems to point to duplicated babel versions, however I already tried to de-duplicate and nothing happens.

Here is the related issue I created on the TypeORM repo but cross-posting here because I now TypeORM maintainers are flooded with work.

Any idea for a workaround?

How to add the value of a previous array item to the next item given that the key does not have a fixed name?

I have an array like so in order of date.

PLEASE NOTE that the category and total are FIXED. However the key VALUE series variable can be anything!!

let originalArray = [
    {
        "category": 1384473600000,
        "total": 1,
        "VALUE series variable": 100
    },
    {
        "category": 1384992000000,
        "total": 1,
        "VALUE series variable": 1000
    },
    {
        "category": 1499990400000,
        "total": 1,
        "VALUE series variable": 10
    },
    {
        "category": 1565654400000,
        "total": 1,
        "VALUE series variable": 542
    },
    {
        "category": 1568505600000,
        "total": 1,
        "VALUE series variable": 124
    }
]

How can I add the items of the key that is not ‘category’ or ‘total’ (so in this case its the key with name VALUE series variable) of the previous item to the next item?

I want to achieve the following:

let newArray = [
    {
        "category": 3456345634634,
        "total": 1,
        "VALUE series variable": 100,      // ORIGINAL 100 IS THE SAME
    },
    {
        "category": 1384992000000,
        "total": 1,
        "VALUE series variable": 1100,     // 100 + 1000 
    },
    {
        "category": "1499990400000",
        "total": 1,
        "VALUE series variable": 1110,     // 1100 + 10
    },
    {
        "category": "1565654400000",
        "total": 1,
        "VALUE series variable": 1652,      // 1110 + 542
    },
    {
        "category": "1568505600000",
        "total": 1,
        "VALUE series variable": 1776,       // 1652 + 124
    }
]

I know I can iterate through the original array like so and I can use .reduce to get the previous item:

originalArray.forEach(element => {
    element.
});

However,’VALUE series variable’ isn’t fixed and can be anything (e.g. the name of this key is random but consistent. All of the array items have the same key but the key is generated by the user. So I’m unsure how to go forwards and how to add the previous item to the next item.

Regex pattern, optional plus character at start of line not matching

I am trying to control a text input field in a react application by only allowing an empty string, digits or an optional plus character at the start.

The regex pattern I am using is the following:

export const phoneNumberTestPattern = new RegExp('^\+?\d+?$');

This pattern is used to test the inputs value whenever the input is changed

onChange={ (e) => {
    if (e.target.value === '' || phoneNumberTestPattern.test(e.target.value)) {
       field.onChange(e.target.value);
   }
}}

The pattern is working correctly for allowing only digits. But the optional plus character at the start is not being matched when the onChange event parameter returns a + value as e.target.value.

The event.target.value does return the + as a value when typed in, but the test pattern does not recognize it as something that matches so the field.onChange method is never fired.

I dont understand what the reason for this is, and why the pattern is not matching a plus character at the start of the string being sent to it. Could it be possible the value I am sending to the test pattern is a string and I am trying to match it against a plus operator ?

Any help would be greatly appreciated.

Apps Script function for Google Sheets: Long formula(?) causing error: `SyntaxError: missing ) after argument list line: 14 file: new line.gs`

The Apps Script function in question:

function insertNewRow() {
  var ss = SpreadsheetApp.openById("redactedforprivacy");
  var sheet = ss.getSheetByName("Main");
  sheet.insertRowBefore(2);
  
  var date = new Date();
  var month = date.getMonth() + 1;
  var day = date.getDate();
  var year = date.getFullYear().toString().substr(-2);
  var formattedDate = month + "/" + day + "/" + year;
  
  sheet.getRange("A2").setValue(formattedDate);
  sheet.getRange("C2").setFormula("=ADD(C3,B2)");
  sheet.getRange("G2").setFormula("=IF(E2+F2>59,INT((E2+F2)/60)&IF(INT((E2+F2)/60)=1," hour"," hours")&" and "&MOD(E2+F2,60)&IF(MOD(E2+F2,60)=1," minute"," minutes"),MOD(E2+F2,60)&IF(MOD(E2+F2,60)=1," minute"," minutes");

}

The function makes a new row and adds some useful values and formulas in that row at various cells.

Like I said in the title, the error is as follows:

SyntaxError: missing ) after argument list line: 14 file: new line.gs

We’re focusing on line 14, where it sets the formula for the cell G2. The formula is probably pretty big and messy by someone else’s standards, but it works as expected on the spreadsheet. The error only occurs when line 14 is present, but I’m too stubborn to give up on the formula.

What I’ve tried:

(Disclaimer: I am not a programmer in any way, shape, or form.)

  1. I tried changing the formula around a few times, shortening it, changing it, trying to make it more efficient, but I couldn’t make any modifications that still worked on the spreadsheet; probably my own skill issue though.

  2. I looked through line 14 a numerous amount of times to try to find where it might be missing a faithful ), but I still can’t find it.

“Exploring the Role of Corporate Social Responsibility in Modern Business: What are the Benefits and Impact of CSR for Companies and Society?”

Corporate Social Responsibility (CSR) is a vital aspect of modern business, addressing issues such as women’s empowerment, environmental sustainability, education, skill training, and support for vulnerable groups. CSR is a way for companies to give back to society and address social and environmental issues by implementing various initiatives.
enter image description here
Importance of CSR
CSR is crucial for businesses as it helps to build trust and credibility with customers, employees, and other stakeholders. By committing to social and environmental causes, companies can improve their reputation and attract new customers. Additionally, CSR can help to attract and retain employees who are motivated by working for a company that is making a positive impact on the world.
Implementing CSR Implementing CSR can take many forms, depending on the company and its goals. Some common ways that companies engage in CSR include:
• Supporting charitable causes through donations or volunteer efforts
• Implementing environmentally-friendly practices in the workplace
• Offering fair wages and benefits to employees
• Providing opportunities for employee volunteerism and community service
CSR for women: This could include initiatives that support women empowerment, such as providing job training, promoting equal pay and workplace opportunities, and supporting women-owned businesses.
enter image description here
CSR for environment: This could include initiatives that promote sustainable practices, such as reducing waste, conserving energy and water, and protecting natural habitats.
CSR for education: This could include initiatives that support education and literacy, such as providing scholarships, building schools, and promoting education for girls and underprivileged children.
CSR for skill training: This could include initiatives that provide job training, vocational education, and skills development for underprivileged individuals, to help them secure better jobs and improve their livelihoods.
CSR for Old Age: This could include initiatives that support elderly people, such as providing financial assistance, medical care, and social support.
• [CSR for plantation]: This could include initiatives that promote reforestation, agroforestry, and sustainable agriculture, that can help to conserve biodiversity and fight against climate change.
• [CSR for street children]: This could include initiatives that provide shelter, education, and support services to children living on the streets, to help them break the cycle of poverty and vulnerability.
Measuring the Impact of CSR
Measuring the impact of CSR can be challenging, as it often involves intangible benefits such as improved reputation and employee engagement. One way to measure the impact of CSR is through metrics such as customer loyalty, employee retention, and community engagement. Additionally, companies can conduct surveys and focus groups to gather feedback from customers, employees, and other stakeholders on the impact of their CSR initiatives.
In conclusion,
CSR is an important aspect of any business. It helps to build trust and credibility with customers and employees, and it can create a positive impact on the community and the environment. By implementing CSR initiatives and measuring their impact, companies can ensure that they are making a meaningful difference in the world.

I want to define what is CSR.

How to get the Country-State-City selector in just one SelectMenu conditionally in reactJs? (not duplicate)

The solution for a question related to this is already existing over the stack overflow, but there is huge difference .
The former questions on this topic is related to have 3 select menus viz,
one dropdown for selecting country
2nd dropdown for selecting state
3rd dropdown for selecting city.

But, I dont want 3 cascading dropdowns, rather I want them to get clubbed together to a single dropdown. ( mainly location), which would take care of the city, country, state, based on what is being typed into the textField for selectMenu.

Just like Linkdin’s select employee menu..

could anyone tell me what could be the possible data schema of menu items, for linkedsIn select menu?.
do it have seperate values with ids like
cities (all cities in the globe), countries (all countries in the globe), (all states in the globe), and they got clubbed together based on their primary keys acting as the foreign key for other data, say primary key for country act as the foreign key for state and so on , so forth?

I just want to know, how could I achieve the cascade country, state, city select but with only a single select menu?

I am using ReactJs and Material UI as my front-end UI library

All suggestions would highly be valued.

Which case to use for JavaScript for naming variables? [closed]

I am using PHP Laravel and MySQL (which uses snake_case for field names) for API.
Is it ok to use snake_case instead of camelCase for client side javascript so that it’s easier to copy paste field names from PHP code to javascirpt code and when mapping javascript variables to PHP models?
Should I have used camelCase for MySQL data fields as well?

Thanks