How do to upload and convert json file to excel file in using javasxript and html

I need to upload and convert JSON files like

[
    {
        "First Name": "Paul",
        "Last Name": "Craig",
        "Gender": "Male",
        "Age": 18,
        "Phone": "072-8074-38"
    },
    {
        "First Name": "Alan",
        "Last Name": "Richards",
        "Gender": "Male",
        "Age": 22,
        "Phone": "616-2480-27"
    }
]

to excel file. Before downloading the file user must be able to preview the file. This needs to be done using HTML and javascript

Calling Google Local Services API from Google Sheets

I am attempting to call the Local Services API, which is documented here: Local Services API documentation

I am calling the API inside of Apps Script, which is a way to write JavaScript inside of a Google Sheet. I have closely followed the tutorial that has been written to call other Google APIs in Apps Script, but I have not been able to call this one.
Here is the function to call the API:

function makeRequest() {
  var adsService = getAdsService();
  console.log(adsService.getAccessToken()) //I am getting a token back here
  var response = UrlFetchApp.fetch('https://localservices.googleapis.com/v1/accountReports:search?query=manager_customer_id:{manager_customer_id}', {
    headers: {
      Authorization: 'Bearer ' + adsService.getAccessToken()
    }
  });}

The makeRequest() function calls the getAdsService function below. Inside of getAdsService I am specifying ‘adwords’ and I have set the scope for .setScope('https://www.googleapis.com/auth/adwords')

function getAdsService() {
  // Create a new service with the given name. The name will be used when
  // persisting the authorized token, so ensure it is unique within the
  // scope of the property store.
  return OAuth2.createService('adwords')
      // Set the endpoint URLs, which are the same for all Google services.
      .setAuthorizationBaseUrl('https://accounts.google.com/o/oauth2/auth')
      .setTokenUrl('https://accounts.google.com/o/oauth2/token')

      // Set the client ID and secret, from the Google Developers Console.
      .setClientId(ClientID)
      .setClientSecret(ClientSecret)

      // Set the name of the callback function in the script referenced
      // above that should be invoked to complete the OAuth flow.
      .setCallbackFunction('authCallback')

      // Set the property store where authorized tokens should be persisted.
      .setPropertyStore(PropertiesService.getUserProperties())

      // Set the scopes to request (space-separated for Google services).
      .setScope('https://www.googleapis.com/auth/adwords')

      // Below are Google-specific OAuth2 parameters.

      // Sets the login hint, which will prevent the account chooser screen
      // from being shown to users logged in with multiple accounts.
      .setParam('login_hint', Session.getEffectiveUser().getEmail())

      // Requests offline access.
      .setParam('access_type', 'offline')

      // Consent prompt is required to ensure a refresh token is always
      // returned when requesting offline access.
      .setParam('prompt', 'consent');
}

There are also 2 other methods to redirect the user to authorize this application.

I believe the problem is the way I am structuring the request. I believe I need to supply more information to the API call in the makeRequest function. I have seen a 'payload' : JSON.stringify(request, null, 2) go in the headers section of the request function where request specifies a specific set of instructions to call from the API but I do not know how to structure that for this case. A solution would be super appreciated.

Highcharts – Compare multiple series

https://www.goldmine-sice.com.tw/ag-%e6%a8%a1%e7%b5%84%e7%b8%be%e6%95%88-%e8%a4%87%e8%a3%bd/enter image description here
This is a Highcharts stock charts, and I put it on my wordpress website. I want this charts exactly the same but the data resource. I want to change the data from AAPL, GOOG, MSFT price to my csv data.

My csv data have to columns: date and price(everyday’s price index).

What should I do?

How to change other components’ property with styled-components?

I am using styled-components and I am trying to change the height of Top to 300px when I focus on my Input.

I was tried something like this but not working:

&:focus ${Top} {
  height: 500px;
}

My code:

export const Top = styled.div`
  display: flex;
  align-items: flex-start;
  height: 150px;
`;

export const Input = styled.textarea`
  flex: 1;
  height: 100%;
  resize: none;
  border: none;
  outline: none;
  font-size: 16px;
  padding: 10px;

  &:focus ${Top} {
    height: 500px;
  }
`;

How do I change other components’ prop with styled-components?

Web dev project – API calls

I’m looking for high level advice for a web project I’m working on.

I’m working with the BscScan API for crypto tokens, and would like to display 10 different wallet balances on one page of my site using this API call – Get Token balance by address

My first thought to displaying these wallet balances on the page was to use a javascript script that runs the 10 separate API calls upon page load. However, according to BscScan Plans, you can only issue so many calls per second/day.

I’m wondering if there’s a way to run a script like this say every minute and store it somewhere backend. Then just use the page load javascript to retrieve this data from wherever I’m storing it. How would I go about something like this? I’m very new to web dev so this may be something simple, I just need help with the high level method of approach I could use and I can run with it from there.

Replace String with value `$&’ not working in javascript

I have string show {{value}} and I want replace {{value}} with $& but it not work. It return current value show {{value}}.
Here is my code

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  let data ="show {{value}}";
  let output = data.replace("{{value}}","$&");
  alert(output);
});
</script>
</head>
<body>


</body>
</html>

I don’t know why it not work. I try replace with other strings same $1, $a and it work.
How I can fix my problem

Unable to Detect link from Text with multiple links in text React js

I had tried to get the link from the text using below code

  urlify(description) {
   const regex = /(.+)[(.+)]((.+))/;
   return description.replace(regex, (match, a, b, c) => {
    const text = `${a[0].toUpperCase()}${a.substring(1)}${b}`;
    return a+' '+`<a href="${c}" target="_blank">${b}</a>`;
   });
  }
  render() {
    let description='Hello this is [XYZ](wwww.XYZ.com) and please redirect to [PQR] 
     (www.PQR.com)'
     return (
     <p dangerouslySetInnerHTML={{__html: this.urlify(description),}}></p>
   );
  }
}

The output I get here is like

Hello this is [XYZ](wwww.XYZ.com) and please redirect to PQR

Only the last link is getting as required, I am trying something like ‘Hello this is XYZ and please redirect to PQR’ where XYZ and PQR should only act as link.

apakah ekstensi Beautify bekerja di semua bahasa pemograman?

does the Beautify vscode extension work for all programming languages,
I’m currently working on a PHP, dart/flutter, html, css, javascript and sass project?
if the Beautify extension does not work in all programming languages, is there another extension that can work in all programming languages such as pretier etc.

Get rotation from camera matrix of format x y z w

I have a 4×4 matrix within JS called world to obj. This matrix I assume from context must be the camera transformations matrix and thus I am trying to extract the rotation from it in radians on x y and z axis.

I have no clue where to start and have tried many things

for context this below image it the camera transformations with no rotation

enter image description here

This second one is with rotation of 1 radian is applied to each axis. it is important to note that this camera is orbiting as well in this example

enter image description here

How to create multiples of of one object?

beginner coder with an assignment due soon and I cannot figure out how to incorporate for() loop in my code so that I will have more than one quad shape that can appear using if (mouseIsPressed) conditional. Here is my code:

//stars in the sky
      if (mouseIsPressed){
  starMorning = color(214,198,214);
  starEvening = color(255,255,225);
  //star colours transition from background colour to pale yellow
  starColours = lerpColor(starMorning,starEvening,mouseX/width);
  noStroke();
  fill(starColours);
  quad(55,40,50,45,55,50,60,45);
  }

This will create one quad shape in the left corner of the screen that slowly appears as you press on your left mouse button and move it horizontally across the screen. Now I want, say, 50 of these quad things all over the screen. How do I do that? Do I need to build classes and then use the for() loop? I’ve tried following so many tutorials but I just can’t seem to apply the logic to my code. Help please!!!

How can I make certain words highlighted in incoming text?

I am new to application development and working in React Native. I want the color of certain words in the text to be red and clickable like picture below. You can see the incoming data under the picture. The words in data.highlight should be red and clickable when first seen in the text. Although there are a few “dummy” as seen in the picture, only the first one is red. I tried to do this but couldn’t get it to a loop. Everything is constant when I do it. The incoming data may change and for example there may be more than 3 words in the data.highlight. How can I do this in a practical way?

const data = {
    text: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, dummy when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
    highlight: ["dummy", "standard", "since"]
}

enter image description here

import React from "react"
import { Text, View } from "react-native"


const data = {
    text: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, dummy when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
    highlight: ["dummy", "standard", "since"]
}


const WordBoxText = () => {

    // for first highlight word
    const convertData1 = data.text.split(data.highlight[0])
    let converted = []
    for (i = 1; i < convertData1.length; i++) {
        converted.push(convertData1[i])
    }
    const rest1 = converted.join(data.highlight[0]) // maybe it will useful
    const Highlighter = <Text style={{ color: "red" }}>{data.highlight[0]}</Text>


    // for first highlight word
    const convertData2 = data.text.split(data.highlight[1])
    let converted2 = []
    for (i = 1; i < convertData2.length; i++) {
        converted2.push(convertData2[i])
    }
    const rest2 = converted.join(data.highlight[1]) // maybe it will useful
    const Highlighter2 = <Text style={{ color: "red" }}>{data.highlight[1]}</Text>


    // for first highlight word
    const convertData3 = data.text.split(data.highlight[2])
    let converted3 = []
    for (i = 1; i < convertData3.length; i++) {
        converted3.push(convertData3[i])
    }
    const rest3 = converted.join(data.highlight[2]) //sentences from the last word
    const Highlighter3 = <Text style={{ color: "red" }}>{data.highlight[2]}</Text>


    const Final = () => {
        return (
            <Text>{
                convertData1[0]} {Highlighter}
                {convertData2[0]} {Highlighter2}
                {convertData3[0]} {Highlighter3} {rest3} </Text>
        )
    }

    return (
        <View style={{ marginTop: 100 }}>
            <Final></Final>
        </View>
    )
}

export default WordBoxText

IS THERE A WAY TO PASS A DATA FROM PARENT COMPONENT TO CHILD COMPONENT WITHOUT HAVING THE NEED TO CALL AND DISPLAY THE CHILD TO THE PARENT COMPONENT? [closed]

I’m new to react JS and i am trying to pass a data from a component when i click it to another component..

for example, i have an image(parent) and when i click on it, it would open a new component(child) with the data from the parent.. HOW CAN I DO THAT ON REACT JS?

this is the container

<div className="Videos">
            <h2> Available Lessons </h2>
            <div className="Videos__uploads">

                {
                    vids.map(({ id, data }) => (
                        <Link key={id} to={{ pathname: `/play/${id}`, data: data}}>
                            {console.log(id)}
                            <VideoCard
                                key={id}
                                videoTitle={data.videoTitle}
                                videoDate={data.videoDate}
                                videoCaption={data.videoCaption}
                                videoUrl={data.videoUrl}
                            />
                            {console.log(data.videoUrl)}
                        </Link>
                    ))

                }

            </div>

this is the Parent

function VideoCard({ videoTitle, videoCaption, videoDate, videoUrl}) {

    return (
        <div className="videoCard">
            <img className="videoCard__thumbnail"
                src={Dummy}
                alt="Thumbnail"
                height="200px"
            />
            <div className="video__info">
                {/* <Avatar className="video__avatar"
                    alt={channel}
                    src={chan_img} /> */}
                <div className="video__text">
                    <h4>{videoTitle}</h4>
                    <p>
                        {videoDate}
                    </p>
                    <p>{videoCaption}</p>

                </div>
            </div>

            <VideoPlayer videoUrl={videoUrl}/>
        </div>
    )
}

and this is the child

function VideoPlayer({ key, videoTitle, videoUrl}) {
    
    return (
        <div className="videoPlayer__container">
            <h1>Helloo</h1>
            {console.log(videoUrl)}
            <ReactPlayer
                key={key}
                id="videoPlayer"
                url={videoUrl}
                height="100%"
                width='100%'
                playing={true}
                controls={true}
                volume={1}
                progressInterval={5000}
                pip={true}
            />
    </div>
)

}

Google analytics track multiple custom variables

I’m tring to use google analytics to monitor activities on my laravel site, as you can see i managed to record the events by $user_name witch is great however how to i associate this user name with another variable for example $project_id so i can see data for each user and on each different project.

enter image description here

enter image description here

any idea how i can achieve this? here is my code:

<script>
$(document).ready(function(){
$(document).mousemove(function(){

  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-9YXX', {
  'custom_map': {'dimension<Index>': 'user_id'}
});

gtag('event', 'user_name', {'user_id': '{!!$user_name!!}'});

});

});

</script>

What is difference between let , const and var in case of variable shadowing /re declaration in different scope? [duplicate]

Please check below 2 code snippets the difference is redeclaring as const/let and var in foo function.

for var, it executes but for const and let it throughs error.

Please tell me why it behaves differently.

Below code does not through any error as a is declared as var
var a=12; //Global variable
foo(); //hoisting 
function foo() {
    console.log("a="+a);
    var a=13;
    console.log("a="+a);
    if(true) {
        const a=89;
        console.log("in block="+ a);
    }
    var a=90;    //no error
    console.log("a="+a);    
}

Below code throughs variable declaration error “a has already been declared”

var a=12; //Global variable
foo(); //hoisting 
function foo() {
    console.log("a="+a);
    var a=13;
    console.log("a="+a);
    if(true) {
        const a=89;
        console.log("in block="+ a);
    }
    let a=90;    //Or const a :: error
    console.log("a="+a);    
}

Position returned data results in App Lab (code.og)

We simply can’t find an answer this anywhere in the official documentation.

We are getting data on the screen like this…

var theStore = getText("searchlist");

readRecords("games", {store:theStore}, function(records) {
    if (records.length>0) {
        for (var i =0; i < records.length; i++) {
        write("-> " + records[i].title);
        }
    }
});

…which does get data, but the problem is that write() is not really the correct function to use, as it just returns all the data starting at the top of the screen and eventually rendering off screen, which absolutely no way to control it.

So how on earth can I just display the results in a way I can control the position? At the very least, I would be happy if the results were displayed in a textarea element.