how to make margin-left atuo increment with javascript bootstrap 3.0.0

i need add margin-left into .card class “style” element auto generate margin-left every time post page input.

my jquery version 1.12.4

my idea is

if .card css style margin-left 0 and with 479px set position 0
else set position margin-left 479px 
else set position mergin-left ...px

becuse im new learning javascript, so im trying help ask question with this code

enter link description here

Login Page using Bootstrap via Google and Apple ID

I am creating a website for admin usage. I have admin pages which I will have to add to payment methods via ATM, VISA cards.

enter image description here

Login 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">
     <!-- Custom CSS -->
     <link href="plugins/bower_components/chartist/dist/chartist.min.css" rel="stylesheet">
     <link rel="stylesheet" href="plugins/bower_components/chartist-plugin-tooltips/dist/chartist-plugin-tooltip.css">
     <!-- Custom CSS -->
     <link href="css/style.min.css" rel="stylesheet">
</head>
<body>
    <div class="container">
      <div class="row">
        <div class="col-sm-9 col-md-7 col-lg-5 mx-auto">
          <div class="card border-0 shadow rounded-3 my-5">
            <div class="card-body p-4 p-sm-5">
              <h5 class="card-title text-center mb-5 fw-light fs-5">Sign In</h5>
              <form>
                <div class="form-floating mb-3">
                  <input type="email" class="form-control" id="floatingInput" placeholder="[email protected]">
                  <label for="floatingInput">Email address</label>
                </div>
                <div class="form-floating mb-3">
                  <input type="password" class="form-control" id="floatingPassword" placeholder="Password">
                  <label for="floatingPassword">Password</label>
                </div>
  
                <div class="form-check mb-3">
                  <input class="form-check-input" type="checkbox" value="" id="rememberPasswordCheck">
                  <label class="form-check-label" for="rememberPasswordCheck">
                    Remember password
                  </label>
                </div>
                <div class="d-grid">
                  <button class="btn btn-primary btn-login text-uppercase fw-bold" type="submit">Sign
                    in</button>
                </div>
                <hr class="my-4">
                <div class="d-grid mb-2">
                  <button class="btn btn-google btn-login text-uppercase fw-bold" type="submit">
                    <i class="fab fa-google me-2"></i> Sign in with Google
                  </button>
                </div>
                <div class="d-grid">
                  <button class="btn btn-facebook btn-login text-uppercase fw-bold" type="submit">
                    <i class="fab fa-facebook-f me-2"></i> Sign in with Facebook
                  </button>
                </div>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>
  </body>
</html>

I have a page which allows an account to be login via Google or Apple ID, but I don’t known how to navigate the username and password to Google and Apple that what I implement in my website for the authentication part.

enter image description here

And What is the correct method to navigate to the HomePage() for those users who is signed in when app starts?

angular table horizontal scroll with sticky header

I have a sticky header and I have a scroll outside the table which is as you can see on the screenshot.

I wanted to add a horizontal scroll to the table I added overflow-x:scroll; but the sticky no longer works if I added the horizontal scroll. Any idea guys ? Thanks.

enter image description here

#css code

#table {
  width: 100%;
}
#table tr.mat-row{
  height: 40px;
}

#html code

   <div style="overflow-x:scroll;">
       <table  mat-table [dataSource]="dataSource" matSort id="table" cdkDropList cdkDropListOrientation="horizontal" (cdkDropListDropped)="drop($event)">
      
        <ng-container matColumnDef={{col.matColumnDef}} *ngFor="let col of gridColumns">
          <th class="table_header"  mat-header-cell *matHeaderCellDef cdkDrag mat-sort-header> {{col.columnHeader}} </th>
          <td mat-cell *matCellDef="let row" > {{(col.value(row) !== 'null')? col.value(row) : '-'}}</td>
        </ng-container>
  
        <tr mat-header-row *matHeaderRowDef="displayedColumns;sticky:true"></tr>
        <tr mat-row *matRowDef="let row; columns: displayedColumns;" (click)="getPlaceDetails(row.propertyAccountId)"></tr>
      </table>
   
      </div>

I’m making a searchbar component with suggestions, but why is the list I’m rendering for suggestions showing a semicolon as one of the list items?

This is my searchbar with suggestions component that I’m working on:

import React from 'react';
import { FiSearch } from 'react-icons/fi';
import '../CSS/SearchBar.css'
import productsData from './../productsData.json'
import 'bootstrap/dist/css/bootstrap.min.css'
    
class SearchBar extends React.Component {
      constructor(props) {
        super(props);
        this.state = {
          typed:""
        }
    
        this.userTyped = this.userTyped.bind(this);
      }  
    
      userTyped(e) {
        this.setState({
          typed: e.target.value
        })
      }
      
      render() {
    
        return (
          <div className='searchbar'>
            <div className='wrapper'> 
              <input 
              type='text'
              value={this.state.typed}
              onChange={this.userTyped}
              />
    
              <button>
                <FiSearch size={18}/>
              </button>
            </div>
    
            <ul className='list-group suggestions'>
              {productsData.map((item) => {
                return (
                  <button id='list-item' className='list-group-item list-group-item-action'>
                    {item.title}
                    </button>
    
                )
              })};
              
            </ul> 
          </div>
        )
      }
      

}

The map function uses productsData that is a json file with five items in it.

And this is what the semicolon I’m confused about. Its at the bottom of the list:
my searchbar

I was wondering if the cause of this is returning my button element, but I wasn’t sure how else to go about it.

Would appreciate any help! Pretty new at this.

Object.assign() causes TypeError: this.map is not a function

I was trying to extend Array.prototype with some new methods/properties, the following is what I did in the first attempt, which ended up with a TypeError:

// Array.prototype + .max(), .maxRowLength (by Object.assign)
Object.assign(Array.prototype, {

    // max something in the array
    max(mapf = (x) => x) {
        // -----------------------------------------
        return Math.max(...this.map(x => mapf(x)));
        //                 ^^^^^^^^
        // ⛔ TypeError: this.map is not a function
        // -----------------------------------------
    },

    // max row length of 2D array
    // assuming an element of the 2D array is called a "row"
    get maxRowLength() {
        return this.max(row => row.length);
    },
});

// matrix (2D array)
let m = [[1, 2, 3, 4], [1, 2], [1, 2, 3]];

m.max(row => row.length)    // didn't work, can't even run.
m.maxRowLength

I don’t understand why this is happening, so I go on with my second attempt, this time with a different approach, and it runs successfully without any problem:

// Array.prototype + .max()
Array.prototype.max = function(f = x => x){
    return Math.max(...this.map(x => f(x)));
};

// Array.prototype + .maxRowLength (by Object.defineProperty)
Object.defineProperty(Array.prototype, 'maxRowLength', {
    get: function(){ return this.max(row => row.length) }
});

// matrix (2D array)
let m = [[1, 2, 3, 4], [1, 2], [1, 2, 3]];    // 3 "rows"

m.max(row => row.length)    // 4 ✅
m.maxRowLength              // 4 ✅

Does anyone know what are the differences between these two approaches, and most importantly why the first attampt failed? Thanks.

JavaScript array looping over getting an error if array has mulitple data types

”’

const temperatures = ['error',3, -2, -6, -1, 'error', 9, 13, 17, 15, 14, 9, 5];

const calcTempAmplitide = function (temp) {
  let maxTemp = temp[0];
  let minTemp = temp[0];

  for (let i = 0; i < temp.length; i++) {
    const current_temp = temp[i];
    if (typeof current_temp !== 'number') continue;

    if (current_temp > maxTemp) maxTemp = current_temp;
    if (current_temp < minTemp) minTemp = current_temp;
  }

  return maxTemp - minTemp;
};
const amplitude = calcTempAmplitide(temperatures);

console.log(amplitude);

”’

After running this in Visual code I am getting a NaN value
if I remove ‘error’ from the beginning then the code works
Any solution for this

Need file hosting website that supports anonymous crossOrigin

I’m trying to load frames of a video into a canvas, but I can’t find the right file hosting system to do so. One of two things happen with every website I try:
Security error due to tainted canvas (crossOrigin:”use-credentials”)
No security error, but canvas is black (crossOrigin:”anonymous”)
The only website that works is commons.wikimedia.org, but none of the footage I want can be found there. Is there a file hosting website I could use that allows an anonymous crossOrigin?

Uploading file to Digital Ocean with React – Access to fetch has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is

For 3 days I’ve been trying to upload a file to any sort of backend without success. I used every guide I could find for uploading to S3, GCP, Cloudinary, and now Digital Ocean.

When uploading to Digital Ocean with a React front-end, I get this cors error (I removed the link).

“Access to fetch at ‘https://removed-the-link.s3-us-west-1.amazonaws.com/’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.”

Because as I’ve said, I’ve read EVERYTHING I can find about this, I know the cors error is likely because I’m using a front-end to submit the request, when I need to use a backend. But the syntax I’m following seems to follow this guide I’m using.

I really need to find some way to get a working example, or a guide that I can follow without getting these unexpected errors that the people writing them don’t seem to get.

I must be missing something really obvious, but I really need someone to spell it out for me.

Please, I don’t want to spend another full day on this. Help…

Here’s my code if anyone wants to look at it.

import React from 'react'
import AWS from 'aws-sdk'

const spacesEndpoint = new AWS.Endpoint('https://sfo3.digitaloceanspaces.com')
const S3 = new AWS.S3({
  endpoint: process.env.REACT_APP_DO_END_POINT,
  accessKeyId: process.env.REACT_APP_DO_KEY,
  secretAccessKey: process.env.REACT_APP_DO_SECRET_KEY,
})

const handleImageChange = (e) => {
  console.log(e)
  if (e.target.files && e.target.files[0]) {
    const blob = e.target.files[0]
    const params = {
      Body: blob,
      Bucket: process.env.REACT_APP_BUCKET_NAME,
      Key: blob.name,
    }
    // Sending the file to the Spaces
    S3.putObject(params)
      .on('build', (request) => {
        request.httpRequest.headers.Host = process.env.REACT_APP_DO_SPACE
        request.httpRequest.headers['Content-Length'] = blob.size
        request.httpRequest.headers['Content-Type'] = blob.type
        request.httpRequest.headers['x-amz-acl'] = 'public-read'
      })
      .send((err) => {
        if (err) alert(err)
        else {
          // If there is no error updating the editor with the imageUrl
          const imageUrl = process.env.REACT_APP_DO_SPACE + blob.name
          //callback(imageUrl, blob.name)
          console.log('success')
        }
      })
  }
}

export const AddPostForm = () => {
  return (
    <input
      type="file"
      id="inputfile"
      accept="image/*"
      onChange={handleImageChange}
    />
  )
}

how to make a timer for next loop for this code

<?php
        $mysqli = new mysqli($db, $dbuser, $passwd, $db) or die($mysqli->connect_error);

        $query = "SELECT * FROM images ORDER BY id DESC";
        $result = $mysqli->query($query);
        $array_ads = array();
        while ($data = $result->fetch_assoc()) {
            $array_ads[] = $data;
        }

this code :
for ($t = 0; $t < count($array_ads); $t++) {?>

;base64,” style=”margin: 0″ class=”img-thumnail” />
<?php
}
this code

The output of my password generator is less than desired

I’m trying to make a password generator for a coding bootcamp but I’m running into an issue that has 2 outcomes both of which aren’t desired. The HTML is very basic and I’m supposed to use prompts for the selection. I included my code but took out a few unnecessary things, the other 14 if-else statements, and a few variables. I’m turning in the project with the ugly formatting and spaces but still would like to know where I went wrong. The two outcomes are

  1. The selections won’t be unique and instead use the same character over and over
  2. It comes out looking sloppy and adds spaces into it
function randomLower() {
  return String.fromCharCode(Math.floor(Math.random() * 26) + 97);
}
//random uppercase from character code
function randomUpper() {
  return String.fromCharCode(Math.floor(Math.random() * 26) + 65);
}
//random number from character code
function randomNumber() {
  return String.fromCharCode(Math.floor(Math.random() * 10) + 48);
}
// random symbol from character code
function randomSymbol() {
  let symbol = "!@#$%^&*()_-><[]}{";
  return symbol[Math.floor(Math.random() * symbol.length)];
}

// Get references to the #generate element
var generateBtn = document.querySelector("#generate");

// Write password to the #password input
function writePassword() {
  var password = generatePassword();
  var passwordText = document.querySelector("#password");

  passwordText.value = password;
}

// Add event listener to generate button
generateBtn.addEventListener("click", writePassword);

// function for generatePassword
function generatePassword() {
  //Confirms # of characters needed
  click = parseInt(prompt("How many characters?", "8-128"));
  if (!click) {
    alert("Input is needed");
    //Ensures the character count isn't too high or low
  } else if (click < 8 || click > 128) {
    click = parseInt(prompt("Answer must be between 8 and 128"));
  } else {
    //The procedding few lines will confirm other variables
    useNumbers = confirm("Include numbers?");
    useLower = confirm("Include lowercase letters?");
    useUpper = confirm("Include uppercase letters?");
    useSymbol = confirm("Include special characters?");
  }
  //If all prompts are denied
  if (!useLower && !useUpper && !useNumbers && !useSymbol) {
    choices = alert("At least one option is needed");
    //If all prompts are accepted
  } else if (useLower && useUpper && useNumbers && useSymbol) {
    choices = randomLower().concat(randomUpper, randomNumber, randomSymbol);
//code only makes repeating characters
//choices = randomLower().concat(randomUpper(), randomNumber(), randomSymbol())
  
//placeholder for an array for user choices
  var pWord = [];
  //for loop to randomize selection
  for (let i = 0; i < click; i++) {
    var selected = choices[Math.floor(Math.random() * choices.length)];
    pWord.push(selected);
  }

  //.join will take all choices in the array pWord and turns it into a string
  var pass = pWord.join("");
  UserInput(pass);
  return pass;
}
// This puts the new password into the textbox
function UserInput(pass) {
  document.getElementById("password").value = pass;
}

React Router: Every time I click on a navlink I get a white screen, but it works if I refresh on each page

I’ve spent the last 12 hours going through forums and watching videos and I’m completely stumped. I’m building a BitUniverse clone app just to reinforce some of the stuff I’ve learned about React so far as well as up my API skills. The issue is when I click a nav link to go to a new page I get the cursed WSOD. The browser shows the correct path and generally if I refresh the page it will display, although it does take multiple refreshes sometimes in order for the page to render.

import { BrowserRouter as Router, Routes, Route, Link, NavLink } from 'react-router-dom';
import Container from 'react-bootstrap/Container';
import Navbar from 'react-bootstrap/Navbar';
import Nav from 'react-bootstrap/Nav';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faMagnifyingGlass, } from '@fortawesome/free-solid-svg-icons';
import { faBell } from '@fortawesome/free-regular-svg-icons';
import Logo from './assets/pics/cryptoicon.png';
import './App.css';

import CoinCapPage from './components/CoinCap/CoinCapPage';
import GainersPage from './components/Gainers/GainersPage';
import LosersPage from './components/Losers/LosersPage';
import MyPicksPage from './components/MyPicks/MyPicksPage';
import VolumePage from './components/Volume/VolumePage';
import Search from './components/Search/Search';


const magnifyingGlass = <FontAwesomeIcon icon={ faMagnifyingGlass } />
const bell = <FontAwesomeIcon icon={ faBell } /> 


class App extends React.Component {
  constructor(props) {
    super(props);
  }

  render() {
    return (
      <div className="App">
        <Router>
          <Container className="p-0" fluid="true">

            <Navbar className ="navbar">
              <Navbar.Brand className="navbar-brand"> 
                <img className="logo" src={ Logo } alt='logo' />
                <h1 className='header-name'>Cryptfolio</h1> 
                <Link className="nav-link" id='bell' to='/Alerts'>
                  { bell }
                </Link>
                <Link className="nav-link" id='magGlass' to='/Search'>
                  { magnifyingGlass }
                </Link>
              </Navbar.Brand>

              <Nav className="nav-list">
                <NavLink  
                  className={({ isActive }) => 
                  (isActive ? "active-page"
                  : "nav-link")}
                  to='/'>Picks
                </NavLink>

                <NavLink 
                  className={({ isActive }) => 
                    (isActive ? "active-page"
                    : "nav-link")}
                  to='/CoinCap'>CoinCap
                </NavLink>

                <NavLink 
                  className={({ isActive }) => 
                    (isActive ? "active-page"
                    : "nav-link")} 
                  to='/Gainers'>Gainers
                </NavLink>

                <NavLink 
                  className={({ isActive }) => 
                    (isActive ? "active-page"
                    : "nav-link")}
                  to='/Losers'>Losers
                </NavLink>

                <NavLink 
                  className={({ isActive }) => 
                    (isActive ? "active-page"
                    : "nav-link")}
                  to='/Volume'>Volume
                </NavLink>
              </Nav>
            </Navbar>

            <Routes>
              <Route path='/' element={ <MyPicksPage /> } />,
              <Route path='/CoinCap' key='picks' element={ <CoinCapPage /> } />,
              <Route path='/Gainers' key='gainers' element={ <GainersPage /> } />,
              <Route path='/Losers' key='losers' element={ <LosersPage /> } />,
              <Route path='/Volume' key='volume' element={ <VolumePage /> } />,
              <Route path='/Search' key='search' element={ <Search /> } />
            </Routes>
          </Container>
        </Router>
      </div>
    );
  }
}

export default App; 

Any point in the right direction would be amazing. I can provide the other page code as well if need be. Also any comments on how I could make the code more easily readable and/or scalable would also be appreciated.

How to read user content DiscordBot in Javascript

Hello im programming a discord chat bot, that when the command ‘!help’ is directed to a certain text channel, the bot writes a direct message to the person who wrote the command in order to answer a series of questions, this is the code that I did for now:

const {Client, RichEmbed, Intents, MessageEmbed} = require('discord.js');
const bot = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.DIRECT_MESSAGES] });
 
const token = 'TOKEN';
 
const PREFIX = '!';
 
 
bot.on('ready', () => {
    console.log(`Logged in as ${bot.user.tag}!`);
})

bot.on('messageCreate', message => {
    let args = message.content.substring(PREFIX.length).split(" ");
    
    switch (args[0]) { 
        case 'help':
            const Embed = new MessageEmbed()
            .setTitle("Helper Embed")
            .setColor(0xFF0000)
            .setDescription("Make sure to use the !help to get access to the commands");
 
            message.author.send(Embed);
        break;
    }
 
});
                            
bot.login(token);

The bot writes to the DM of the user that requested the command, but I have not been able to solve, that according to what the user answers, the robot response with other information, and also that the user can answer with reactions.

How do I resolve peer dependency conflicts with Nx, Angular and Nest?

I have a pretty fresh Nx workspace. Created an Angular app and a Nest app a few months ago, no problems. I come back after a hiatus to start a new Angular app and now I have a bunch of peer dependency conflicts I don’t know how to resolve. I’ve tried adding the --legacy-peer-deps option to npm install and this works (4 high vulnerabilities) but when I try to run npx nx g @angular/material:ng-add I can’t get around the errors.

Errors below:

npm ERR! While resolving: @nestjs/[email protected]
npm ERR! Found: @nestjs/[email protected]
npm ERR! node_modules/@nestjs/common
npm ERR!   @nestjs/common@"^8.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @nestjs/common@"^7.0.0" from @nestjs/[email protected]
npm ERR! node_modules/@nestjs/core
npm ERR!   @nestjs/core@"^7.5.5" from the root project
npm ERR!   peer @nestjs/core@"^7.0.0" from @nestjs/[email protected]
npm ERR!   node_modules/@nestjs/platform-express
npm ERR!     @nestjs/platform-express@"^7.5.5" from the root project
npm ERR!     2 more (@nestjs/core, @nestjs/testing)
npm ERR!   1 more (@nestjs/testing)
npm ERR!
npm ERR! Conflicting peer dependency: @nestjs/[email protected]
npm ERR! node_modules/@nestjs/common
npm ERR!   peer @nestjs/common@"^7.0.0" from @nestjs/[email protected]
npm ERR!   node_modules/@nestjs/core
npm ERR!     @nestjs/core@"^7.5.5" from the root project
npm ERR!     peer @nestjs/core@"^7.0.0" from @nestjs/[email protected]
npm ERR!     node_modules/@nestjs/platform-express
npm ERR!       @nestjs/platform-express@"^7.5.5" from the root project
npm ERR!       2 more (@nestjs/core, @nestjs/testing)
npm ERR!     1 more (@nestjs/testing)
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.