Everything I add to section-2 (text-content spans and header) of my index.html doesn’t show up on page

When I hover over .section-2 in inspector it appears like it’s off the screen but the page won’t let me scroll down. When I turn off position absolute on the header I can see the first two letters of it but again it goes off-screen and doesn’t allow me to scroll.

CSS: 
/* Common Styles */
        * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        text-decoration: none;
        list-style-type: none;
        outline: none;
        font-family: "Jura", sans-serif;
        }

        html {
        font-size: 62.5%;
        scroll-behavior: smooth;
        }

        .section-2{
           position: relative;
           padding: 10rem 10rem 15rem 10rem;
  

        
HTML:
        <section class="section-2" id="section-2">
        <h1 class="section-heading">About Me</h1>
        <p class="about-me-text"></p>
[![Picture of issue][1]][1]


  [1]: https://i.stack.imgur.com/8Fjuf.jpg

GSAP’s Scroll Trigger Function Not Working in React App

feel free to test the behavior here: https://better-web-metrics.herokuapp.com/

I am just starting to use the GSAP 3 API. I am simply trying to have 3 cards animate from 0 to 1, when the user begins to scroll and the cards begin to enter or are completely in the viewport. But what’s happening is though the cards are out of the viewport frame, the animation begins automatically. It’s like the scrollTrigger object has been completely ignored.

What adjustments do I need to make here?
I’d appreciate it.
Ironman

main.js

import { gsap } from "gsap";
import {ScrollTrigger} from "gsap/ScrollTrigger";
gsap.registerPlugin(ScrollTrigger);

function init(){

    gsap.from("article", {
        scrollTrigger:{
            trigger:".cards",
        },
        stagger: {amount: 0.5},
        scale:0, duration:3
    })   
}

window.addEventListener('load', function(){
    init();
});

the html

<section class="cards">

              <article>
                <h1 class="cardHeading">Card 1</h1>
                <p id="aboutTxt01" className="aboutText" >
                "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium
                </p>
              </article>

              <article>
                <h1 class="cardHeading">Card 2</h1>
                <p id="aboutTxt02" className="aboutText" >
                "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium
                </p>
              </article>

              <article>
                <h1 class="cardHeading">Card 3</h1>
                <p id="aboutTxt03" className="aboutText" >
                "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
                </p>
              </article>
            </section>    
        </div>

the relevant css

 header {
    height: 99vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: calc(10px + 2vmin);
    color: white;
    position: relative;
    border: 2px solid green;
  }

  section {
    border: 2px solid red;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
  }

  article {
    width: 300px;
    height: 300px;
    border: 2px solid #4f5165;
    color: #293132;
    padding: 1rem;
    margin-top: -10%;
    margin-right: 1%;
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    align-items: center;
  }

If statement in Cypress

How can i write correctly this code, in such a way that it is a valid if syntax, and if it is not respected, should I have someone else with it?

Basically I want to search for a text in a popup window. If it does not exist, enter the code in else statement.

cy.get(".ibxudA").find('.WildnessText-kRKTej').should('have.text',"Wildness")

Warning:findDOMNode was passed an instance of InputElement which is inside StrictMode.Instead,add a ref directly to the element you want to reference

Estou recebendo este warning, por utilizar o TextField como filho do InputMask conforme código abaixo. Como posso ajustá-lo para resolver este warning ?

<Box>
         <InputMask 
            mask='(99)999999999'
            maskChar=''
            value={user.phone} 
            onChange={event=> handleChange(event,true)}
            onBlur={event=> handleBlur(event)}>
            {inputProps =>
                <TextField
                {...inputProps}
                id='phone' 
                name='phone'
                label='(DDD) + Celular'
                autoComplete='off'
                inputProps={{style:{textAlign:'left'}}}
                InputProps={{
                    classes: {
                        input: styledUpdateUser.resize
                    },
                }}
                sx={styledUpdateUser.mediumTextField}
                helperText={inputvalidation.keys.phone !== '' ? inputvalidation.keys.phone  : ''}
                error={inputvalidation.keys.phone !== '' ? true : false}
                />}
        </InputMask>
    </Box>

Jest variable outside function is undefined while testing function

below is a function i want to test

import { logger } from 'logger';
const log = logger(__filename);

export const foo = () => {
 log('test log');
};

below is my test case

import { foo } from '../../src/utils/foo';
import * as utils from 'logger';
jest.mock('logger');
// eslint-disable-next-line no-undef
const mockedFoo = jest.mocked(utils, true);

describe('Common Utils', function () {
  describe('#foo', function () {
   it('foo', () => {
      // eslint-disable-next-line no-undef
      mockedFoo.logger.mockReturnValueOnce(() => { return { log: jest.fn() }; });
      await foo();
      expect(mockedFoo.logger).toHaveBeenCalledWith('test');
    });
  });
});

when i try to run it gives error log is not defined, it cannot get out of scope variable

How to make a new Array of Object using data from backend which is array of objects?

Hi I am new to Angular and I want to bind my dropdown options with value as

[ { label: "name", value: "id"} ]

as in label should have the below names and the values as the below IDs ( in the image )

I have my backend data as

enter image description here

I want the id and name as my options value for the dropdown.
Please if anyone could guide me

p.s I tried using map function but all I am getting in the options is [object object]

How do I link a csv file to flask?

I have a CSV file of readings from a sensor that I would like to graph with chart.js on a flask server, however I am getting 404 errors when trying to access the CSV file, since I am getting 404 errors I am assuming that I need to actually path the CSV file in flask, but I cant figure out how to do this, I’m coming across a lot of irrelevant information about using flask to make and fill a database but I need to pass the database to an html page to parse for graphing.

Could someone please help me learn how to do this?

Code that I’m testing and playing around with for reading CSV files in JavaScript. Has the route specified in flask code below!

<script>
    //path is from html file location to db location is this right?
    d3.csv("../db/test.csv", function(data) {
        for (var i = 0; i < data.length; i++) {
            console.log(data[i].Test1);
            console.log(data[i].Test2);
            console.log(data[i].Test3);
        }
    });
</script>

Test CSV file.

Test1, Test2, Test3
1, 2, 3

404 Error Details

Any help to better understand how to do this is much appreciated!

forgot my flask code!

@app.route('/test')
def test():
    #every thing that links the csv to flask would go here? Or would I need a more specific function for the csv file?
    return render_template('test.html'), 201

How to connect local storage to button?

I am a beginner and learning by working on tutorials.
I am using the NASA API and displaying the images using a modal. The modals have a button, however, I don’t know how to connect it to the local storage and save it to the favourites section.
Appreciate any help, thanks.

https://jsfiddle.net/neg4byd5

  <!-- The Modal -->
  <div id="myModal" class="modal">
    <span class="close">&times;</span>
    <img class="modal-content" id="img01">
    <span><button>Add To Favourites</button></span>
    <div id="caption"></div>
  </div>


    // Save Text
    const saveText = document.createElement("p");
    saveText.classList.add("clickable");
    if (page === "results") {
      saveText.textContent = "Add To Favorites";
      saveText.setAttribute("onclick", `saveFavorite('${result.url}')`);
    } else {
      saveText.textContent = "Remove Favorite";
      saveText.setAttribute("onclick", `removeFavorite('${result.url}')`);
    }


// Update the DOM
function updateDOM(page) {
  // Get favorites from local storage
  if (localStorage.getItem("nasaFavorites")) {
    favorites = JSON.parse(localStorage.getItem("nasaFavorites"));
  }
  imagesContainer.textContent = "";
  createDOMNodes(page);
  showContent(page);
}


// Add result to favorites
function saveFavorite(itemUrl) {
  // Loop through the results array to select favorite
  resultsArray.forEach((item) => {
    if (item.url.includes(itemUrl) && !favorites[itemUrl]) {
      favorites[itemUrl] = item;
      // Show save confirmation for 2 seconds
      saveConfirmed.hidden = false;
      setTimeout(() => {
        saveConfirmed.hidden = true;
      }, 2000);
      // Set Favorites in Local Storage
      localStorage.setItem("nasaFavorites", JSON.stringify(favorites));
    }
  });
}

// Remove item from favorites
function removeFavorite(itemUrl) {
  if (favorites[itemUrl]) {
    delete favorites[itemUrl];
    localStorage.setItem("nasaFavorites", JSON.stringify(favorites));
    updateDOM("favorites");
  }
}

// On Load
getNasaPictures();

Link target unrecognized in iframe; opens in new tab

I’m working on a simple web interface that requires another web interface (that I don’t control) to be embedded, which unless someone has a better solution I’ve been serving via Apache reverse proxy to a sandboxed iframe.

The problem is, that web interface consists of a few frames of its own, and when I click a link in the navbar (<a href="main.htm" id="main.htm" target="main">LINKNAME</a>) targeting the main content frame, it opens in a new tab. If I open the reverse proxy in its own tab everything runs fine, I’ve just been unable to figure out why it’s not working properly in the iframe. At this point my assumption is that the “main” target isn’t being recognized but I don’t know why (the “_self” targets in the top and main frames do work properly).

<frameset framespacing="0" border="0" frameborder="0" rows="54,*"> 
    <frame name="top" noresize="" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" border="no" src="top.htm" target="_self"> 
    <frameset cols="166,*"> 
        <frame name="contents" target="main" src="navbar.htm" scrolling="auto" noresize="" marginwidth="5" marginheight="0"> 
        <frame name="main" src="main.htm" scrolling="auto" noresize="" target="_self" marginwidth="0" marginheight="0"> 
    </frameset> 
</frameset>

I’ve noticed that I get "Unsafe attempt to initiate navigation for frame with URL 'http://.../main.htm' from frame with URL 'http://.../navbar.htm'. The frame attempting navigation is sandboxed, and is therefore disallowed from navigating its ancestors." in the console when clicking the links but not sure if it directly relates to the problem. I don’t understand why it considers main.htm to be an ancestor, as they’re both at the same level of the site’s hierarchy. Either way, I’m unable to allow it out of the sandbox, as it will set itself as the top level document by way of if(top!=self){top.location.href=location.href}.

Any thoughts?

why are we retuning a anonymous function in the below from JS [duplicate]

// Debouncing in Javascript
let counter = 0;
const getData = () => {
  // calls an API and gets Data
  console.log("Fetching Data ..", counter++);
}

const debounce = function(fn, d) {
  let timer;
  return function() {
    let context = this,
      args = arguments;
    clearTimeout(timer);
    timer = setTimeout(() => {
      getData.apply(context, arguments);
    }, d);
  }
}

const betterFunction = debounce(getData, 300);
<input type="text" onkeyup="betterFunction()" />

how to use showMore showLess for top 20 users in angular

I have 20 top users with ranking by point, I got them from an api rest, so i’m trying to create a button (showMore – showLess).

At first it shows 10 users automatically and when i click showMore it will add the other 10 users that’s mean 20 users. but when i click showLess it will reduce the 10 users to show just the 10 users.

html code :

        <div class="col-md-6  text-center">
            <h2><strong>TOP 20 FANS</strong></h2>

            <div *ngFor="let top of top2" class="rank" style="width: 74%;">
                <div class="data-row">
                    <div class="row-user">
                        <div class="col-lg-4 col-md-7 col-sm-7 col-7">
                            <div class="rank-row">
                                <span class="logo-wrapper ">
                                    <img src={{top.photoUrl}}>
                                </span>
                                <div class="td-wrap"><a class="uni-link">{{top.firstname}} {{top.familyname}}</a>
                                </div>
                                <div class="location "> <img width="10px" src="../assets/localisation.png">
                                    france</div>
                            </div>
                        </div>
                        <div
                            class="col-lg-4 offset-lg-0 col-md-12 offset-md-0 col-sm-11 offset-sm-1 text-center">
                            <span><img width="25px" src="../assets/golden.png"> {{top.point}} PT</span>
                        </div>
                    </div>
                </div>
            </div>

ts code :

import { Component, OnInit } from '@angular/core';
import { ApiService } from './api.service';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
  top2: any;



  constructor(private apiService: ApiService) { }


  ngOnInit() {
    this.getTop2();
  }

  getTop2() {
    this.apiService.gettop2().subscribe(res => {
      this.top2 = res;
      console.log(res)
    });

  }



}

so i’m trying to create array inside an array, and in every array i have 10 users for example :

array : [{ },{ },{ },{ },{ },{ },{ }….] —> [ [ { },{ },{ },{ }] , [ { },{ },{ },{ } ] ]

let data =[ ]

data = t[0]

showMore i++ –> data.push() t[1]

showLess i–

Using mySQL in order to create a daily command?

still getting into the shift of things with this. So i’m currently using a system to create a discord.js command which can be ran by a player and then will go onto a 24 hour cooldown, however the issue with the system below is I have no real way to store when there cooldown expires. Currently it is using an array of IDs however a user could simply time there command with the refresh of the cache and then claim it twice in quick succession.

So my question is

Is there a way to handle a per user cooldown via mySQL, or should another method be looked into. Any answer is appreciated!

const { SlashCommandBuilder } = require("@discordjs/builders");
const connection = require("../db");

let claimedCache = []

const clearCache = () => {
    claimedCache = []
    setTimeout(clearCache, 1000 * 60 * 60 * 24)
}
clearCache()

module.exports = {
    data: new SlashCommandBuilder()
    .setName('daily')
    .setDescription('Claim your daily points'),

    
    async execute(interaction) {
        if (claimedCache.includes(interaction.user.id)) {
            interaction.reply({
                content: "You have already claimed your daily reward!",
                ephemeral: true
            })
            return
        }
        connection.query(`SELECT * FROM characters WHERE char_owner = '${interaction.user.id}'`, function(err, rows) {
            if (err || !rows.length) {
                interaction.reply({
                    content: "You do not have a character!",
                    epehemeral: true
                })
                return
            }
            const currentPoints = rows[0].char_points
            
            if (interaction.member.roles.cache.has('912680123113832448')) {
                connection.query(`UPDATE characters SET char_points = '${currentPoints + 4}' WHERE char_owner = '${interaction.user.id}'`)
                interaction.reply({
                    content: "You have claimed your daily reward!",
                    ephemeral: true
                })
                claimedCache.push(interaction.user.id)
                return
            } else if (interaction.member.roles.cache.has('912680385685635092')) {
                connection.query(`UPDATE characters SET char_points = '${currentPoints + 8}' WHERE char_owner = '${interaction.user.id}'`)
                interaction.reply({
                    content: "You have claimed your daily reward!",
                    ephemeral: true
                })
                claimedCache.push(interaction.user.id)
                return
            } else if (interaction.member.roles.cache.has('912680439095889971')) {
                connection.query(`UPDATE characters SET char_points = '${currentPoints + 12}' WHERE char_owner = '${interaction.user.id}'`)
                interaction.reply({
                    content: "You have claimed your daily reward!",
                    ephemeral: true
                })
                claimedCache.push(interaction.user.id)
                return
            } else if (interaction.member.roles.cache.has('912680476790120448')) {
                connection.query(`UPDATE characters SET char_points = '${currentPoints + 16}' WHERE char_owner = '${interaction.user.id}'`)
                interaction.reply({
                    content: "You have claimed your daily reward!",
                    ephemeral: true
                })
                claimedCache.push(interaction.user.id)
                return
            } else if (interaction.member.roles.cache.has('912680542091243570')) {
                connection.query(`UPDATE characters SET char_points = '${currentPoints + 16}' WHERE char_owner = '${interaction.user.id}'`)
                interaction.reply({
                    content: "You have claimed your daily reward!",
                    ephemeral: true
                })
                claimedCache.push(interaction.user.id)
                return
            }

            //connection.query(`UPDATE characters SET char_points = '${currentPoints + 4}' WHERE char_owner = '${interaction.user.id}'`)
        })
    }
}```

How to call a modal when I return data a partial view from the controller in ASP.NET MVC

I have a controller where I return data in a partial view and I would like to call a modal, how can it be done?

I leave you the details of my controller and view below .

Controller

 [HttpPost]
 public async Task<ActionResult> Items(List<string> items)

  {
             
   var dto = new ItemsDetails();
   dto = items;

  return PartialView($"~/Views/Items/ItemDetails.cshtml", dto);
  (Here I want to call a modal)

}
           
 

View
That is the modal that I want to call.

<!-- Modal -->

@model Application.ItemsDetails

<div class="modal fade" id="items" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <tbody>
    @foreach (var item in Model.Items)
    {
    <tr>
        <td class="small">@item.Barcode</td>
        <td class="small">@item.ErrorMsg</td>
        <br>

    </tr>
    }
</tbody>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

Webrtc screencapture or capturestream

Is there a way to capture on a specific part of the screen.. getting only the element or tag of HTML… I just want to share the video that is playing. I tried to find a solution. I tried the capturestream but the problem is there is no Output on my client-side. Any suggestion or who tried to stream only the video payer on capturestream?

Anyone who successfully broadcast live of the capturestream with broadcaster and client?