How to call template on tab button onclick action in XSLT

I am trying to want to call a template on click of tab button. I have written below xsl which is currently not working.. Please let me know how I can achieve the same:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:param name="model"/>
    <xsl:param name="warningsText"/>
    <xsl:template match="/">
        <html>
            <body>
                <h1>
                    <xsl:value-of select="$model"/> model schema validation report
                </h1>
                <div>
                    <button class="tablink">
                        <xsl:attribute name="value">Error</xsl:attribute>
                        <xsl:attribute name="onclick">
                            <xsl:call-template  name="Error"/>
                        </xsl:attribute>
                    </button>
                </div>
            </body>
        </html>

Delete the UploadVideo.jsx and remove react drop-zone. Because I didn’t want any of these. And error occur in my web localhost. What should i do?

Got this error in chorme
Compiled with problems:X

ERROR in ./src/App.js 13:0-53

Module not found: Error: Can’t resolve ‘./components/UploadVideo.1’ in ‘C:UsersPanda Desktopwebsrc’

Got this error in VSCODE terminal:

Failed to compile.

Module not found: Error: Can’t resolve ‘./components/UploadVideo.1’ in ‘C:UsersPandaDesktopwebsrc’
WARNING in srcfirebaseauth.js
Line 1:8: ‘firebase’ is defined but never used no-unused-vars

srcfirebaseconfig.js
Line 16:7: ‘analytics’ is assigned a value but never used no-unused-vars

srcpagesCoachPage.jsx
Line 29:18: ‘createRoom’ is defined but never used no-unused-vars
Line 32:11: ‘db’ is assigned a value but never used no-unused-vars
Line 72:12: ‘joinRoom’ is defined but never used no-unused-vars
Line 137:18: ‘hangUp’ is defined but never used no-unused-vars

srcpagesSignup.js
Line 40:10: ‘isLoading’ is assigned a value but never used
no-unused-vars
Line 40:21: ‘setLoading’ is assigned a value but never used
no-unused-vars

ERROR in ./src/App.js 13:0-53
Module not found: Error: Can’t resolve ‘./components/UploadVideo.1’ in ‘C:UsersPandaDesktopwebsrc’

webpack compiled with 1 error and 1 warning

vlaue of checkbox to database in vue laravel

i have this input:

<div class="d-flex justify-content-between align-items-center">
<label for="patymentTerms">Payment Terms</label>
<b-form-checkbox id="patymentTerms" :checked="true" switch v-model="rForm.payment_terms" />
</div>

and this is the data:

data() {
return {
  rForm: {
    payment_terms: "",
  },
};

},

i am able to store data and other inputs in database but i’m a bit confused of how can i return false or true to of this input

how to remove duplicate array elements in JavaScript and Vue

I am attempting to set up a Vue demo that prevents a user from inputting duplicate items in an array. The inputs values with the following text field and button:

 <div>
    <input v-model="numberValue" type="number" />
 </div>
 <div>
   <button @click="submit" type="submit">Submit</button>
</div>

After pushing numberValue.value into the numArray array, I then for to loop through the items in numArray. Then, I used the indexOf method in a conditional to check for occurances of array items in newArray. If array items don’t already exist in newArray, then they will be pushed into newArray.

const submit = () => {
  numArray.value.push(numberValue.value)
  
  newArray.value = [];
  
  for (let i = 0; i < numArray.value.length; i++) { 
    if(newArray.value.indexOf(numArray.value[i]) === -1) { 
        newArray.value.push(numArray.value[i]); 
        console.log(newArray.value)
    } else if (newArray.value.indexOf(numArray.value[i]) !== -1) {
      window.alert('No Duplicates Allowed!')
    }
  }
}

I then attempted to set up an else if statement that targets instances when the user tries to input a duplicate array item. On the else if, I added a window.alert to alert the user when entering a duplicate. After entering a duplicate, I see the alert. I then see the alert on all subsequent inputs, even ones that are not duplicates. How can I go about properly setting up the else if statement to target duplicates and trigger an alert?

Using CSV node module in chrome extension

I am trying to make an extension for chrome and one of the needed functionality is to make it possible to save user’s data locally (But I do plan to integrate Gdrive saving). I wanted to save user’s data into CSV assuming that it would be easier but it turned out a disaster.

I have tried many different methods in order to make it possible but it seems like it’s no use.

Here’s part of the code that doesn’t work:

    var { parse } = require('csv-parse');

    const fs = require("chrome-fs");
    const records = [];

    const csvFile = chrome.runtime.getURL("save_file.csv");

    var parser = parse({ columns: true }, function(err, records) {
        console.log(records);
    });

    fs.createReadStream(chrome.runtime.getURL("save_file.csv")).pipe(parser);

and here’s an error that browser throws at me when I try to initialize this code:

Uncaught Error
    at chrome.js:511:1
    if (err.name === 'NotFoundError') {
            var enoent = new Error()
511:        enoent.code = 'ENOENT'
            callback(enoent)

Material UI v4 Chip custom typescript onDelete always set

I want to custom my MUI chip while extending props from the original chip and its success, here is my code.

interface IChipProps extends ChipProps {
  backgroundColor: any;
}

function CustomChip(props: IChipProps) {
  return <Chip {...props} />;
}

export default CustomChip;

But the problem is, onDelete prop somehow is always set while I don’t set that, I guess because I use prop from the original chip. Here is how I solve it.

interface IChipProps extends ChipProps {
  backgroundColor: any;
}

function CustomChip(props: IChipProps) {
  const propsManipulation = { ...props };
  // If onDelete is not set
  if (propsManipulation?.onDelete?.name === 'actionHandler') {
    propsManipulation.onDelete = undefined;
  }
  propsManipulation.deleteIcon = deleteIcon();
  console.log(propsManipulation);
  return <Chip {...propsManipulation} />;
}

export default CustomChip;

But I think my way is not good enough, is there any other right way to make this work and look more legit?

why giving Axios error-404 in react and laravel api

I am trying to submit data from a form on my page to a react.js api using axios but i get the following error.

import axios from 'axios';
import React, { Component } from 'react'
import { Link } from 'react-router-dom';

class AddStudent extends Component {
    state = {
        name:'',
        course:'',
        email:'',
        phone:'',
    }
     
    handleInput = (e) => {
        this.setState
        ({
           [e.target.name]:e.target.value
        });
    }

    saveStudent = async (e) =>{ 
        e.preventDefault();
        const res = await axios.post('http://127.0.0.1:8000//api/add-student',this.state);
        if(res.data.status === 200)
        {
            console.log(res.data.message);
            this.setState({
                name:'',
                course:'',
                email:'',
                phone:'',

            });
        }
    }


    render()
    {
        return (
    <div className="container">
        <div className="row">
            <div className="col-md-6">
            <div className="card">
            <div className="card-holder">
<h4>
   Add Student
    <Link to={'/'} className="btn btn-primary btn-sm float-end"> Back </Link>
</h4>
            </div>
<div className='card-body'>

<form onSubmit={this.saveStudent} >

<div className="form-group mb-3">
<label>Student Name</label>
<input type="text" name="name" onChange={this.handleInput}  value={this.state.name} className="form-control" />
</div>
<div className="form-group mb-3">
<label>Student Course</label>
<input type="text" name="course" onChange={this.handleInput}  value={this.state.course} className="form-control" />
</div>
<div className="form-group mb-3">
<label>Student Email</label>
<input type="text" name="email" onChange={this.handleInput}   value={this.state.email} className="form-control" />
</div>
<div className="form-group mb-3">
<label>Student Phone</label>
<input type="text" name="phone" onChange={this.handleInput}  value={this.state.phone}  className="form-control" />
</div>

<div className="form-group mb-3">
<button type="submit" className="btn btn-primary">Save Student</button>
</div>

  </form>

</div>

</div>

            </div>
            </div>

        </div>
      
    
  );
    }
  
}

export default AddStudent

this is my student controller data which I want to send in my dtabase but it giving error –> “AxiosError {message: ‘Request failed with status code 404’, name: ‘AxiosError’, code: ‘ERR_BAD_REQUEST’, config: {…}, request: XMLHttpRequest, …}
code: “ERR_BAD_REQUEST” “

<?php

namespace AppHttpControllersApi;
use AppModelsStudent;
use AppHttpControllersController;
use IlluminateHttpRequest;

class StudentController extends Controller
{
    public function store(Request $request)
    {
        $student= new Student;
        $student->name= $request-> input('name');
        $student->course= $request-> input('course');
        $student->email= $request-> input('email');
        $student->phone= $request-> input('phone');
        $student ->save();

        return response()->json([
        'status'=> 200,
        'message'=>'Student added Successfully',                                                                                                                                   
        ]);
    }
}

here it is my .env file

APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:08iFPF3lcJqA98M9d9+lUeYi88nVtkHCWk2XIV6dKBU=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravelreactjs
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

Alignment of Google Maps object inside another CSS template

Simplified for the purposes of this question, I am building a website that will use a simple Google Maps object (via Googles API), and displaying it inside the template of a CSS menu system I’ve downloaded.

Here is the JSFiddle: https://jsfiddle.net/brad28b/tx6872ov/16/

The problem I’m having is this: I want the Google Map object to fill the entire area below the header, and to the right of the side menu, right up to the edges and the top and bottom. I have tried adjusting the CSS of both the “map” div, and the CSS of the template I am using (included in JSFiddle), but for the life of me I cannot get it to fill that entire area. Currently I have the height of the “map” div set to 600px, but if I change that to 100%, the map doesn’t display at all. I also have the width set to 100%, but as you can see there are margins around it in both the left and right. Where are those coming from, and how can I remove them and make the map fill that entire area?

// Initialize and add the map
function initMap() {
  // The location of Uluru
  const uluru = {
    lat: -25.344,
    lng: 131.031
  };
  // The map, centered at Uluru
  const map = new google.maps.Map(document.getElementById("map"), {
    zoom: 4,
    center: uluru,
  });
  // The marker, positioned at Uluru
  const marker = new google.maps.Marker({
    position: uluru,
    map: map,
  });
}

  
/*========== GOOGLE FONTS ==========*/
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap");

/*========== VARIABLES CSS ==========*/
:root {
  --header-height: 3.5rem;
  --nav-width: 219px;

  /*========== Colors ==========*/
  --first-color: #6923D0;
  --first-color-light: #F4F0FA;
  --title-color: #19181B;
  --text-color: #58555E;
  --text-color-light: #A5A1AA;
  --body-color: #F9F6FD;
  --container-color: #FFFFFF;

  /*========== Font and typography ==========*/
  --body-font: 'Poppins', sans-serif;
  --normal-font-size: .938rem;
  --small-font-size: .75rem;
  --smaller-font-size: .75rem;

  /*========== Font weight ==========*/
  --font-medium: 500;
  --font-semi-bold: 600;

  /*========== z index ==========*/
  --z-fixed: 100;
}

@media screen and (min-width: 1024px) {
  :root {
    --normal-font-size: 1rem;
    --small-font-size: .875rem;
    --smaller-font-size: .813rem;
  }
}

/*========== BASE ==========*/
*,
::before,
::after {
  box-sizing: border-box;
}

body {
  margin: var(--header-height) 0 0 0;
  padding: 1rem 1rem 0;
  font-family: var(--body-font);
  font-size: var(--normal-font-size);
  background-color: var(--body-color);
  color: var(--text-color);
}

#map {
  height: 600px;
  /* The height is 400 pixels */
  width: 100%;
  /* The width is the width of the web page */
}


h3 {
  margin: 0;
}

a {
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
}

/*========== HEADER ==========*/
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: var(--container-color);
  box-shadow: 0 1px 0 rgba(22, 8, 43, 0.1);
  padding: 0 1rem;
  z-index: var(--z-fixed);
}

.header__container {
  display: flex;
  align-items: center;
  height: var(--header-height);
  justify-content: space-between;
}

.header__img {
  width: 35px;
  height: 35px;
  border-radius: 50%;
}

.header__logo {
  color: var(--title-color);
  font-weight: var(--font-medium);
  display: none;
}

.header__search {
  display: flex;
  padding: .40rem .75rem;
  background-color: var(--first-color-light);
  border-radius: .25rem;
}

.header__input {
  width: 100%;
  border: none;
  outline: none;
  background-color: var(--first-color-light);
}

.header__input::placeholder {
  font-family: var(--body-font);
  color: var(--text-color);
}

.header__icon,
.header__toggle {
  font-size: 1.2rem;
}

.header__toggle {
  color: var(--title-color);
  cursor: pointer;
}

/*========== NAV ==========*/
.nav {
  position: fixed;
  top: 0;
  left: -100%;
  height: 100vh;
  padding: 1rem 1rem 0;
  background-color: var(--container-color);
  box-shadow: 1px 0 0 rgba(22, 8, 43, 0.1);
  z-index: var(--z-fixed);
  transition: .4s;
}

.nav__container {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-bottom: 3rem;
  overflow: auto;
  scrollbar-width: none;
  /* For mozilla */
}

/* For Google Chrome and others */
.nav__container::-webkit-scrollbar {
  display: none;
}

.nav__logo {
  font-weight: var(--font-semi-bold);
  margin-bottom: 2.5rem;
}

.nav__list,
.nav__items {
  display: grid;
}

.nav__list {
  row-gap: 2.5rem;
}

.nav__items {
  row-gap: 1.5rem;
}

.nav__subtitle {
  font-size: var(--normal-font-size);
  text-transform: uppercase;
  letter-spacing: .1rem;
  color: var(--text-color-light);
}

.nav__link {
  display: flex;
  align-items: center;
  color: var(--text-color);
}

.nav__link:hover {
  color: var(--first-color);
}

.nav__icon {
  font-size: 1.2rem;
  margin-right: .5rem;
}

.nav__name {
  font-size: var(--small-font-size);
  font-weight: var(--font-medium);
  white-space: nowrap;
}

.nav__logout {
  margin-top: 5rem;
}

/* Dropdown */
.nav__dropdown {
  overflow: hidden;
  max-height: 21px;
  transition: .4s ease-in-out;
}

.nav__dropdown-collapse {
  background-color: var(--first-color-light);
  border-radius: .25rem;
  margin-top: 1rem;
}

.nav__dropdown-content {
  display: grid;
  row-gap: .5rem;
  padding: .75rem 2.5rem .75rem 1.8rem;
}

.nav__dropdown-item {
  font-size: var(--smaller-font-size);
  font-weight: var(--font-medium);
  color: var(--text-color);
}

.nav__dropdown-item:hover {
  color: var(--first-color);
}

.nav__dropdown-icon {
  margin-left: auto;
  transition: .4s;
}

/* Show dropdown collapse */
.nav__dropdown:hover {
  max-height: 100rem;
}

/* Rotate icon arrow */
.nav__dropdown:hover .nav__dropdown-icon {
  transform: rotate(180deg);
}

/*===== Show menu =====*/
.show-menu {
  left: 0;
}

/*===== Active link =====*/
.active {
  color: var(--first-color);
}

/* ========== MEDIA QUERIES ==========*/
/* For small devices reduce search*/
@media screen and (max-width: 320px) {
  .header__search {
    width: 70%;
  }
}

@media screen and (min-width: 768px) {
  body {
    padding: 1rem 3rem 0 6rem;
  }

  .header {
    padding: 0 3rem 0 6rem;
  }

  .header__container {
    height: calc(var(--header-height) + .5rem);
  }

  .header__search {
    width: 300px;
    padding: .55rem .75rem;
  }

  .header__toggle {
    display: none;
  }

  .header__logo {
    display: block;
  }

  .header__img {
    width: 40px;
    height: 40px;
    order: 1;
  }

  .nav {
    left: 0;
    padding: 1.2rem 1.5rem 0;
    width: 68px;
    /* Reduced navbar */
  }

  .nav__items {
    row-gap: 1.7rem;
  }

  .nav__icon {
    font-size: 1.3rem;
  }

  /* Element opacity */
  .nav__logo-name,
  .nav__name,
  .nav__subtitle,
  .nav__dropdown-icon {
    opacity: 0;
    transition: .3s;
  }


  /* Navbar expanded */
  .nav:hover {
    width: var(--nav-width);
  }

  /* Visible elements */
  .nav:hover .nav__logo-name {
    opacity: 1;
  }

  .nav:hover .nav__subtitle {
    opacity: 1;
  }

  .nav:hover .nav__name {
    opacity: 1;
  }

  .nav:hover .nav__dropdown-icon {
    opacity: 1;
  }
}
<html>

  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
    <title>Responsive sidebar submenus</title>
  </head>

  <body onload="initMap();">
    <!--========== HEADER ==========-->
    <header class="header">
      <div class="header__container">
        <img src="https://www.cssscript.com/demo/responsive-multi-level-sidebar-menu/assets/img/perfil.jpg" alt="" class="header__img">

        <a href="#" class="header__logo">Bedimcode</a>

        <div class="header__search">
          <input type="search" placeholder="Search" class="header__input">
          <i class='bx bx-search header__icon'></i>
        </div>

        <div class="header__toggle">
          <i class='bx bx-menu' id="header-toggle"></i>
        </div>
      </div>
    </header>

    <!--========== NAV ==========-->
    <div class="nav" id="navbar">
      <nav class="nav__container">
        <div>
          <a href="#" class="nav__link nav__logo">
            <i class='bx bxs-disc nav__icon'></i>
            <span class="nav__logo-name">Bedimcode</span>
          </a>

          <div class="nav__list">
            <div class="nav__items">
              <h3 class="nav__subtitle">Profile</h3>

              <a href="#" class="nav__link active">
                <i class='bx bx-home nav__icon'></i>
                <span class="nav__name">Home</span>
              </a>

              <div class="nav__dropdown">
                <a href="#" class="nav__link">
                  <i class='bx bx-user nav__icon'></i>
                  <span class="nav__name">Profile</span>
                  <i class='bx bx-chevron-down nav__icon nav__dropdown-icon'></i>
                </a>

                <div class="nav__dropdown-collapse">
                  <div class="nav__dropdown-content">
                    <a href="#" class="nav__dropdown-item">Passwords</a>
                    <a href="#" class="nav__dropdown-item">Mail</a>
                    <a href="#" class="nav__dropdown-item">Accounts</a>
                  </div>
                </div>
              </div>

              <a href="#" class="nav__link">
                <i class='bx bx-message-rounded nav__icon'></i>
                <span class="nav__name">Messages</span>
              </a>
            </div>

            <div class="nav__items">
              <h3 class="nav__subtitle">Menu</h3>

              <div class="nav__dropdown">
                <a href="#" class="nav__link">
                  <i class='bx bx-bell nav__icon'></i>
                  <span class="nav__name">Notifications</span>
                  <i class='bx bx-chevron-down nav__icon nav__dropdown-icon'></i>
                </a>

                <div class="nav__dropdown-collapse">
                  <div class="nav__dropdown-content">
                    <a href="#" class="nav__dropdown-item">Blocked</a>
                    <a href="#" class="nav__dropdown-item">Silenced</a>
                    <a href="#" class="nav__dropdown-item">Publish</a>
                    <a href="#" class="nav__dropdown-item">Program</a>
                  </div>
                </div>

              </div>

              <a href="#" class="nav__link">
                <i class='bx bx-compass nav__icon'></i>
                <span class="nav__name">Explore</span>
              </a>
              <a href="#" class="nav__link">
                <i class='bx bx-bookmark nav__icon'></i>
                <span class="nav__name">Saved</span>
              </a>
            </div>
          </div>
        </div>

        <a href="#" class="nav__link nav__logout">
          <i class='bx bx-log-out nav__icon'></i>
          <span class="nav__name">Log Out</span>
        </a>
      </nav>
    </div>

    <!--========== CONTENTS ==========-->
    <main>
      <section>
        <div id="map"></div>
      </section>
    </main>
    <!--
     The `defer` attribute causes the callback to execute after the full HTML
     document has been parsed. For non-blocking uses, avoiding race conditions,
     and consistent behavior across browsers, consider loading using Promises
     with https://www.npmjs.com/package/@googlemaps/js-api-loader.
    -->
    <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAYFIVkhCzcKMlp29Ln6tP6xw3DH6xgOtU&callBack=initMap&libraries=places,geometry&v=weekly"></script>
    <!--========== MAIN JS ==========-->
    <!--<script src="assets/js/main.js"></script>-->


  </body>

</html>

Why is Chart.JS replacing my x-values with 0?

I’m new to JavaScript and chart.JS so I apologize if this is an ignorant question. I’m trying to generate a graph from a text file formatted like this:

### 2016-12-25 2016-12-30 awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe

### 2018-09-09 2018-09-30 awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe


### 2019-09-09 2019-09-30 awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposn bo09gewhfe bo09gewhfebo09gewhfe bo09gewhfe


### 2019-11-02 2019-12-30 awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe awewoihgknbsinevnsobie wehbsn0ew hb0ejnwoigjha0[ghnoibg gv[w90ejnbposnbo09gewhfe

Each paragraph is two points: the index of the start of the paragraph, linked to the first date, and the index of the end of the paragraph, linked to the second date. The graph should display 8 points where the y value is the date and the x value is the index (e.g. (0, 2016-12-25) and (1247, 2016-12-30). But when I graph it, this is what happens: the y-axis shows up properly, but all of the x-values have been replaced with 0.

Here’s a screenshot showing that the dataset is being passed correctly, but it’s parsing all the x’s to zero: _dataset array has correct values, but _parsed array doesn’t.

This is my code:

<!DOCTYPE html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.7.1/chart.min.js" integrity="sha512-QSkVNOCYLtj73J4hbmVoOV6KVZuMluZlioC+trLpewV8qMjsWqlIQvkn1KGX2StWvPMdWGBqim1xlC8krl1EKQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.3/moment.min.js"></script>
<title>Plotter</title>
</head>
<body>
 <h1>Plotter</h1>
 <input id="txtFile" type="file" accept="txt">
 <canvas id="graph" width="75%" height="50%"></canvas>
 
 <script>
        document.getElementById('txtFile')
        .addEventListener('change', function() {
            var sceneData = [];  
        var reader=new FileReader();
        reader.onload=function(){
            let fullText = reader.result;
            let i=0;
            
            while(i != -1){
                let start = fullText.indexOf('###',i);
                let end = fullText.indexOf('###', start + 3);
                i=end;
                if (start != -1){
                    if(end == -1) end = fullText.length;
                    sceneData.push({x: start, y: moment(fullText.substr(start + 4, 10))});
                    sceneData.push({x: end, y: moment(fullText.substr(start + 15, 10))});
                }
            }

            const ctx = document.getElementById('graph').getContext('2d');
            const myChart = new Chart(ctx, {
                type: 'line',
                data: {
                datasets: [{
                    data: sceneData
                }]
                },
                options: {
                    scales: {
                        y: 
                        {
                            ticks: {
                                callback: function(value, index, ticks) {
                                    let date = moment(value);
                                    return date.format('MMM D YYYY');
                                }
                            }
                        }
                    }
                } 
            });
        }
          
        reader.readAsText(this.files[0]);

    })
    
    </script>
</body>

I’m not familiar enough with chart.JS to figure out what’s going on, so I’d appreciate any help I can get. Thanks!

How to capture the old values from the FORM in ASP.NET

I want to store my old change values from the form with new values and store them in the database using DTO in ASP.NET.

Let’s assume I have five textboxes A1, A2, A3, A4, A5, and radio button R1 respectively.
which already has the values in it.
If I just changed textboxes A1 and A2 values, and changed the radio button
I want this particular data in the form of the old value and new value (not all the data).

Later I will store this in the database.

I have gone through some examples to achieve this.
jQuery $(this).data() is returning old values
https://syntaxfix.com/question/6087/input-jquery-get-old-value-before-onchange-and-get-value-after-on-change
but I am not getting how to proceed from the beginning from retrieving old values
help will be appreciated

Thanks in Advance

Google anayltics.js moved to external js file works, but gtag.js doesn’t

For years I have had the Google Universal Analytics snippet in an external js file. It of course had to be converted to use it there. I am now trying to do the same thing with the newer Google Analytics 4 (gtag) snippet. So far, the data collection in Google Analytics is not happening. I DID test the snippet in the header first, and it works that way.

Here is the snippet as provided by Google, which is supposed to go in your head section:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=myUA_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'myUA_ID');
</script>

Here is the call that is already in each web page in their head section:

<script type="text/javascript">
    <!--
    window.onload=function(){
        analytics();
    }
    //-->
</script>

Here is the code inside my external js file.:

function analytics(){

  /* Universal Analytics property (analytics.js) - OLD CODE WHICH WORKS */
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'myUA_ID']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
    
  /* Google Analytics 4 property (gtag.js) - NEW CODE NOT WORKING */
  gtag.push(['js', new Date()]);
  gtag.push(['config', 'myGtagID']);

 (function() {
    var ga4 = document.createElement('script'); ga4.type = 'text/javascript'; ga4.async = true;
    ga4.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.googletagmanager.com/gtag/js?id=myGtagID';
    var t = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga4, t);
    })();
}

Select a specific Target from a Stimulus Controller

I am looking for a simple and elegant way (a Stimulus-way) to select a specific element from the targets elements form my Stimulus controller.

For example: I have a list of 4 links and 4 paragraphs (both inside the scope of the controller). When clicking the link, I want something to happen (e.g. adding a class) with the paragraph, which has the same data-id as the link. The paragraphs have been defined as Stimulus-Targets.

Please see this JS-Fiddle for a code-example: https://jsfiddle.net/nbLvafxy/

I want to avoid document.querySelector(...) as the element with the data-id could be present on the page multiple times (see second list in the JS-Fiddle). Therefore, a solution within the “scope” of the Stimulus controller would be the best solution.

How to send data along with a request in ajax

So, i am pretty new to ajax and i was working with a small project in which i need to make a query from a HTML form, but for some reason i can’t send any data. I’ve tried to send a FormData through the xmlhttprequest.send() method, as well as an array containing values, but the php to which i’m sending the request gets absolutely nothing.
Here’s the html document

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>ajax</title>
    <script type="text/javascript">
        function pasarXMLATabla(xml){
            var empleados = xml.getElementsByTagName('empleado');
            var tabla = "<table> <tr> <th>ID</th> <th>Nombres</th> <th>Apellidos</th> <th>Salario</th> </tr>";
            for (var i = 0; i < empleados.length; i++) {
                tabla += "<tr> <td>"+empleados[i].getElementsByTagName("id")[0].innerHTML+"</td>";
                tabla += "<td>"+empleados[i].getElementsByTagName("nombre")[0].innerHTML+"</td>";
                tabla += "<td>"+empleados[i].getElementsByTagName("apellidos")[0].innerHTML+"</td>";
                tabla += "<td>"+empleados[i].getElementsByTagName("salario")[0].innerHTML+"</td></tr>"; 
            }
            tabla += "</table>"
            document.getElementById('lista-empleados').innerHTML=tabla;
        }
        function manejadorDeFormulario(){
            var datosDelFormulario = new FormData(document.getElementById('formulario'));
            const xhttp = new XMLHttpRequest();
            xhttp.onload = function () {
                var respuesta = xhttp.responseXML;
                pasarXMLATabla(respuesta);
                console.log(respuesta.getElementsByTagName('mensaje'));
            }
            xhttp.open("GET","empleados.php");
            xhttp.send(datosDelFormulario);
        }
    </script>
</head>
<body style="background-color:#9EADAD;">
    <form onsubmit="manejadorDeFormulario();return false;" id='formulario' method='get'>
        <select id='tipo-de-busqueda' name='tipo-de-busqueda'>
            <option value=''>--Seleccione el tipo de búsqueda a realizar--</option>
            <option value='1'>Salarios menores</option>
            <option value='2'>Salarios iguales</option>
            <option value='3'>Salarios mayores</option>
        </select>
        <input type="text" id='cantidad-de-salario'><br>
        <button type="submit">Realizar búsqueda</button>
    </form>
    <div id="lista-empleados"></div>
</body>
</html>

Here’s the php

<?php
require_once("db/query_fns.php");
$empleadosEncontrados = buscarEmpleadosPorSalario();
require_once("views/empleadosxml.php");
function buscarEmpleadosPorSalario(){  
  $tipoDeBusqueda = $_GET['tipo-de-busqueda'];
  $cantidadDeSalario = $_GET['cantidad-de-salario'];
  $result = "";
  switch ($tipoDeBusqueda) {
    case 1:
      $sql = "SELECT * FROM empleados WHERE salario < " . $cantidadDeSalario;
      $result = getElements($sql);
      return $result;
      break;
    
    case 2:
      $sql = "SELECT * FROM empleados WHERE salario = " . $cantidadDeSalario;
      $result = getElements($sql);
      return $result;
      break;

    case 3:
      $sql = "SELECT * FROM empleados WHERE salario > " . $cantidadDeSalario;
      $result = getElements($sql);
      return $result;
      break;
  }
}
?>

The /views/empleadosxml.php document is where i build an XML from the results of the query, i’ve tested it giving specific values to $tipoDeBusqueda and $cantidadDeSalario and there’s no errors there UNLESS i try to use $_GET. And the /db/query_fns document it’s where i make the queries, and since i can generate the xml answer without a problem, then i can safely assume it’s working. I have tried to store the $_GET values and then echo print_r them inside a new XML tag to see what am i getting in the $_GET, and it’s always an empty array, regardless of if i’m using wether POST or GET. All my testing leads me to the $_GET being empty, since neither the query, XML generation or parsing, connection to server and database has problems, there’s only problems when i don’t give fixed values to $cantidadDeSalario and $tipoDeBusqueda, and the error i get is “extra content at the end of document”.
I have been trying all of this in OperaGX and Microsoft Edge with the same results.
I can’t use jquery for this.

Is there a simple way to perform the equivalent of a PHP include() in Javascript? [duplicate]

I have several forms pages which share some of the same fields. These field-sets have been turned into reusable code modules and are imported into each page’s DOM using PHP require() statements.

These field-sets have corresponding jQuery event handlers which perform field validation as well as miscellaneous UI-related tasks. I would like to make these handlers reusable, as well.

Previously, I’ve always declared such handlers within the $(document).ready() event.

If I’m going to import these handlers from an external file, it is my understanding they still need to be included directly into the $(document).ready() event, rather than imported using a standard HTML <script> tag pair.

In PHP, I’d simply include() or require() the code block like I do with the field-sets. How do I perform the equivalent in JS as simply as possible? Preferably without adding yet another framework, I might add.

Can I render a Nunjucks Template inside an 11ty shortcode?

I have a Nunjucks shortcode in an Eleventy project. It’s added to configuration in eleventy.js with the Eleventy addNunjucksAsyncShortcode method. My shortcode has gotten extremely messy with complex HTML string literals, and I’d like to refactor it into using a Nunjucks template along with the logic in my shortcode Javascript file.

Is there any way I can include and render a Nunjucks template in my async shortcode, or to call a Nunjucks template with the async shortcode config (which I could then use to include methods from my Javascript logic file)? It seems like the Nunjucks object is a singleton, and I get errors trying to use it.