Cypress : Passthrough is not supported, GL is swiftshader, ANGLE is on aws code build for ci

I am trying to run cypress on codebuild pipeline for aws.

I am getting this error in aws codebuild pipeline :

[3039:0508/214055.907995:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is swiftshader, ANGLE is 

    tput: No value for $TERM and no -T specified

I tried to downgrade the cypress version from 9.6.0 to 9.2.0 but it didn’t help me.

How can I solve this error?

Any help will be appreciated.

Thanks

How to get a class from an html page

Highlighted the part i want to get

This html is from a steam profile page.

Im using npm request and cheerio to get some values form the html page.
How could get info from <form id="...."> which has the class="commentthread_entry"

await new Promise(async (resolve, reject) => {
     request(TARGET, (error, response, html) => {
          if (!error && response.statusCode == 200) {
               const $ = cheerio.load(html);
               const htmlRBar = $('.commentthread_entry').html()
               console.log(htmlRBar);
               resolve();
          }
     })
})

Result is null

d3: Tooltip placed on bottom of page instead of next to data

I am new to d3 and I have been following tutorials from www.d3-graph-gallery.com . These tutorials have worked very well for me, however, when it comes to displaying tooltips when hovering over data, things are weird. This tutorial shows how to do this on a heatmap. As you can see, it creates the tooltip as a div and then adds a mouselistener to the data that will make the tooltip div appear at the correct position. This works fine on the d3-graph-gallery website.

Unfortunatelly, it works neither on my local browser nor on Jsfiddle:
https://jsfiddle.net/vcfhnu4q/

<!DOCTYPE html>
<meta charset="utf-8">

<!-- Load d3.js -->
<script src="https://d3js.org/d3.v6.js"></script>

<!-- Create a div where the graph will take place -->
<div id="my_dataviz"></div>

<script>

// set the dimensions and margins of the graph
const margin = {top: 30, right: 30, bottom: 30, left: 30},
  width = 450 - margin.left - margin.right,
  height = 450 - margin.top - margin.bottom;

// append the svg object to the body of the page
const svg = d3.select("#my_dataviz")
.append("svg")
  .attr("width", width + margin.left + margin.right)
  .attr("height", height + margin.top + margin.bottom)
.append("g")
  .attr("transform", `translate(${margin.left},${margin.top})`);

// Labels of row and columns
const myGroups = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"]
const myVars = ["v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10"]

// Build X scales and axis:
const x = d3.scaleBand()
  .range([ 0, width ])
  .domain(myGroups)
  .padding(0.01);
svg.append("g")
  .attr("transform", `translate(0, ${height})`)
  .call(d3.axisBottom(x))

// Build X scales and axis:
const y = d3.scaleBand()
  .range([ height, 0 ])
  .domain(myVars)
  .padding(0.01);
svg.append("g")
  .call(d3.axisLeft(y));

// Build color scale
const myColor = d3.scaleLinear()
  .range(["white", "#69b3a2"])
  .domain([1,100])

//Read the data
d3.csv("https://raw.githubusercontent.com/holtzy/D3-graph-gallery/master/DATA/heatmap_data.csv").then( function(data) {

  // create a tooltip
  const tooltip = d3.select("#my_dataviz")
    .append("div")
    .style("opacity", 0)
    .attr("class", "tooltip")
    .style("background-color", "white")
    .style("border", "solid")
    .style("border-width", "2px")
    .style("border-radius", "5px")
    .style("padding", "5px")

  // Three function that change the tooltip when user hover / move / leave a cell
  const mouseover = function(event,d) {
    tooltip.style("opacity", 1)
  }
  const mousemove = function(event,d) {
    tooltip
      .html("The exact value of<br>this cell is: " + d.value)
      .style("left", (event.x)/2 + "px")
      .style("top", (event.y)/2 + "px")
  }
  const mouseleave = function(d) {
    tooltip.style("opacity", 0)
  }

  // add the squares
  svg.selectAll()
    .data(data, function(d) {return d.group+':'+d.variable;})
    .enter()
    .append("rect")
      .attr("x", function(d) { return x(d.group) })
      .attr("y", function(d) { return y(d.variable) })
      .attr("width", x.bandwidth() )
      .attr("height", y.bandwidth() )
      .style("fill", function(d) { return myColor(d.value)} )
    .on("mouseover", mouseover)
    .on("mousemove", mousemove)
    .on("mouseleave", mouseleave)
})
</script>

If you look at the jsfiddle, you will see that the tooltip is placed at the bottom of the page, not next to the mouse when hovering over a cell, which makes sense to me, how would it be possible to draw the div on top of the svg ? Aren’t they be separate containers?

How to get this to work?

not able to get the Dismissing alert in express application

I am not getting the Dismissing Alert as shown in bootstrap when I Include it in Express application I am new to node.js and express so please help me

below an image is attached which is my file structure :

file structure image click here

below is an image of my boilerplate code :

boilerplate of my application click here

below is my file in which I have included my bootstrap Dismissing alert :
click here

below is my output of Dismissing Alert :

click here

ignore the Dismissing alert message as I have kept that message temporarily

as you can see I am not getting the button to close the alert please someone help me

Access proxied properties internally

I’m using model classes that extend a base Model class. The Model class returns a Proxy from the constructor that allows me to access properties passed into the constructor without having to explicitly define them on the class.

Using this, I can access a property of the data object externally, but attempting to access it internally returns undefined. How can I access the proxied properties from within the class itself?

class Model {
  constructor(data) {
    this.data = data;

    return new Proxy(this, {
      get(model, prop) {
        if (model.hasOwnProperty(prop) || prop in model) {
          return model[prop];
        }

        if (model.data.hasOwnProperty(prop)) {
          return model.data[prop];
        }
      }
    });
  }
}

class User extends Model {
  get name() {
    return `${this.first_name} ${this.last_name}`;
  }
}


const user = new User({
  first_name: 'Bob',
  last_name: 'Smith'
});

console.log(user.first_name); // 'Bob'
console.log(user.name); // undefined undefined

filling excel sheet node js

I want to know the easiest way to fill an empty excel sheet using nodejs without creating a new one
for example
enter image description here

as I will do some functions later

and my data are stored in a list of objects like this:

data=[{name: “john”, count: 2, address: “x”},
{name: “mo”, count: 5, address: “y”}]

so after that my excel can be
enter image description here

is there any reference or example?

how to make better y-axis and x labels, in chart.js?

Lets say i have this graph created by Chart.js. https://i.stack.imgur.com/7FpMU.png
And the labels on x-axis is useful in creating, but not in reading by user. So i think it will be best to have only orientation marks from 0 to 6 in this case.(of course for example mark 4 is where it should be in graph maked by old labels).

I want it to be like this. But i cant figure out how
https://i.stack.imgur.com/XxSPO.png

And not that important question is if someone know how to get rid of that red line in the middle of graph. It should be tan(sqrt(x)) graph and it shouldn’t be here.

Thanks a lot

This text contains HTML tags within it, so how do I make the text not have HTML tags

When I click on the link for an individual job I should
be shown all of the relevant details of that job in a readable presentation, including the description. However, when I do this the description field contains HTML code in the browser. How would I fix this so that the text does not contain html tags within it.

For example, this is the output of the text:

Example of Output

export const jobDescriptionView = (id, jobs) => {

  const template = Handlebars.compile(`
  <div class="job-description">
  <div class="company-name">   <b><label>Company name:</label></b> <a href="/#!/companies/{{attributes.company.data.id}}"> {{attributes.company.data.attributes.name}}</a></div>
  {{attributes.description}}
  </div>`)

  const target = document.getElementById(id)
  target.innerHTML = template(jobs)
}

How to check if object is exist then update otherwise push a new object in to that using mongoose and node js express

const user = await Data.findOne({ email: req.body.email }).select("email").lean();
// here i want to update
`if( user ){

    console.log("data updated");

}`
else{

const dataa = new Data(req.body)
   let savedData = await dataa.save().then((resp)=> console.log(resp))

   console.log(savedData,"after save");}`

`
Data added else is running perfectly I want my if statement solution

Resize an image to 16:9?

I’m trying to resize the uploaded image to 16:9. I’ve been trying all day and this is the best I’ve done so far. Unfortunately this resizes/crops the 1800x1200 image to 1350x900, not 1600x900. Any help is appreciated!

const resizeResult = await manipulateAsync(
  uploadResult.uri,
  [
    {
      resize:
        uploadResult.width > uploadResult.height
          ? { height: 900 }
          : { width: 1600 },
    },
    {
      crop: {
        width: 1600,
        height: 900,
        originX:
          uploadResult.width > uploadResult.height
            ? (uploadResult.height - uploadResult.width) / 2
            : (uploadResult.width - uploadResult.height) / 2,
        originY: 0,
      },
    },
  ],
  { compress: 0.7, format: SaveFormat.JPEG }
);

How to correctly throttle API calls on NodeJS?

I am playing around with PokeAPI. Using a get request to the endpoint

https://pokeapi.co/api/v2/pokemon?limit=2

I receive a response

{
    "count": 1126,
    "next": "https://pokeapi.co/api/v2/pokemon?offset=2&limit=2",
    "previous": null,
    "results": [
        {
            "name": "bulbasaur",
            "url": "https://pokeapi.co/api/v2/pokemon/1/"
        },
        {
            "name": "ivysaur",
            "url": "https://pokeapi.co/api/v2/pokemon/2/"
        }
    ]
}

I wanted to get all 1126 pokemon. But to get more information about the pokemon I will need to follow the URL link.

The issue is that if I were to fetch all I get to read ECONNRESET and socket hang up errors in my code. How can I correctly throttle my API request?

export const fetchPokemons = async () => {
  let res = await axios.get('https://pokeapi.co/api/v2/pokemon?limit=1126');
  const { results } = res.data;
  let pokemonInfo = results.map(async ({ name, url }) => {
    let details = await axios.get(url)
  });
  
  return pokemonInfo;
}; 

 

Access control allow origin is always * when credentials is true

i am building a graphql api using apollo-server-express. I am using jwt and cookies for authentication so in my cors options credentials is set to true, the thing is, when credentials is set to true, Access-Control-Allow-Origin is always *, even if i set the origin in my cors options, it still is *.

here is my middleware:

app.use(
  cors({
    origin: "https://studio.apollographql.com",
    credentials: true,
  })
);
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json({ limit: "2mb" }));
app.use(cookieParser());

Having difficulties with adding items to unordered list with javascript

So I’m trying to retrieve data about countries from an Api (https://restcountries.com/v3.1/all)
Languages are displayed like this: languages: { afr: "Afrikaans", eng: "English", nbl: "Southern Ndebele", nso: "Northern Sotho", sot: "Southern Sotho", ssw: "Swazi", tsn: "Tswana", tso: "Tsonga", ven: "Venda", xho: "Xhosa", zul: "Zulu" }

my code so far is:

const langs = Object.values(country["languages"]) //create array of languages

 console.log(langs) 
 return ( 
   <ul>
     {langs.map(each => {
//if i add console.log(each) here, it returns all of the languages in console
     <li>
       {each} doesn't display at all
     </li>
   })}
   </ul>
)

If you could tell me what am I doing wrong, I’d greatly appreciate it.
Thanks in advance <3