Error Code: SalariedApplicant.java:9: error: constructor Applicant in class Applicant cannot be applied to given types;

I am using my base code Applicant as shown below and I am trying to use inheritance to extend it but am getting the error: Constructor Applicant in class Applicant cannot be applied to given types; I have included the two code I am trying to get to extend the Applicant it is in both hourly wage and salary.

import java.io.BufferedReader;//import file for input output functionality.

import java.io.IOException;//import java library for handling the file input output exceptions.

import java.io.InputStreamReader;//the bridge from byte streams to character streams: It reads bytes and decodes them into characters using a specified charset.

//main function
class Applicant{

    public static void main(String[] args) throws IOException {

        Employee[] employees = new Employee[3];//object for employee class

            for(int i=0; i<3; i++) { //data for upto three employees.

                BufferedReader br = new BufferedReader(new InputStreamReader(System.in));//Recieves user input

                System.out.println("Enter employee number: ");//prompter for user input

                int empNum = Integer.parseInt(br.readLine()); //employee number

                    System.out.println("Enter employee first name and last name: ");//prompter for user to enter the employee first name and last name.

                    String fname = br.readLine(); //reads first name

                    String lname = br.readLine(); //reads last name

                    Name name = new Name(fname,lname);//first and last name passed

                    System.out.println("Enter Street, city, state and zip: ");//prints street, city, state and zip.

                    String street = br.readLine(); //reads street

                    String city = br.readLine(); //reads city

                    String state = br.readLine(); //reads state

                        int zip = Integer.parseInt(br.readLine());//reads zip code

                        Address address = new Address(street,city,state,zip);//All address data passed

                        System.out.println("Enter day, month and year of hire date: ");//prompts user to enter hire date.

                        int day = Integer.parseInt(br.readLine()); //reads day

                        int month = Integer.parseInt(br.readLine()); //reads month

                        int year = Integer.parseInt(br.readLine()); //reads year

                            Date date = new Date(day,month,year);//day, month, year passed

                            Employee employee = new Employee(empNum,name,address,date); //created the employee object

                                employees[i] = employee; //adds the employee to an array

                            }

                                for(Employee e : employees){ //Prints output for all employees

                                    System.out.println(e.toString());

                                }

                }
  
}

class Employee { //Creates employee class

    int empNum; //employee number

    Name name; //employee name.

    Address address; //employee address

    Date hireDate; //employee hire date

    public Employee(int empNum, Name name, Address address, Date hireDate) {

    //employee file creator

        this.empNum = empNum;

        this.name = name;

        this.address = address;

        this.hireDate = hireDate;

    }

    public int getEmpNum() {//returm employee number

        return empNum;

    }

    public void setEmpNum(int empNum) {//returns employee number

        this.empNum = empNum;

    }

    public Name getName() {//return employee name

        return name;

    }

    public void setName(Name name) { //takes employee name

        this.name = name;

    }

    public Address getAddress() {//gets employee address

        return address;

    }

    public void setAddress(Address address) {//employee address input 

        this.address = address;

    }

    public Date getHireDate() {//return hire date

        return hireDate;

    }

    public void setHireDate(Date hireDate) {// hire date inpt for employee

        this.hireDate = hireDate;

    }

    public String toString() {//returns employee data

        return "Employee{" +

        "empNum=" + empNum +

        ", name=" + name +

        ", address=" + address +

        ", hireDate=" + hireDate +

        '}';

    }

}

class Name {//Creats name Class: Initializes first and last name

    String firstName;

    String lastName;

    public Name(String firstName, String lastName) {//name cunstructor

        this.firstName = firstName;

        this.lastName = lastName;

    }

    public String getFirstName() { //return first name

        return firstName;

    }

    public void setFirstName(String firstName) {//sets first name

        this.firstName = firstName;

    }

    public String getLastName() { //returns last name.

        return lastName;

    }

    public void setLastName(String lastName) { //sets tht last name

        this.lastName = lastName;

    }

    public String toString() { //returns the full name of the employee.

        return firstName+" "+lastName;

    }

}

class Address { //Creates address class: Sets up the street address

    String street; 

    String city;

    String state;

    int zip;

    public Address(String street, String city, String state, int zip) {//Constructs the address

        this.street = street;

        this.city = city;

        this.state = state;

        this.zip = zip;

    }

    public String getStreet() { //Gets the street address

         return street;

    }

    public void setStreet(String street) {//Returns the street address

        this.street = street;

    }

    public String getCity() {

        return city;//gets the city

    }

    public void setCity(String city) {//Returns the city

        this.city = city;

    }

    public String getState() { //gets the state in two letters

        return state;

    }

    public void setState(String state) { //Returns the state in two letters

        this.state = state;

    }

    public int getZip() { //return zip code

        return zip;

    }

    public void setZip(int zip) { //return zip code

        this.zip = zip;

    }

    //returns the whole address.

    public String toString() {

        return "street='" + street + ''' +

        ", city='" + city + ''' +

        ", state='" + state + ''' +

        ", zip=" + zip;

    }

}

class Date { //Creates Date Class

    int day;//declares day as variable

    int month;

    int year;

    public Date(int day, int month, int year) { //passes date

        setDay(day);

        setMonth(month);

        setYear(year);//prints the day, month and year

    }

    public int getDay() {

        return day;

    }

    public void setDay(int day) { //Checks if day is between 1 and 31 and returns invalid if not.

        if(day<1 || day>31)

            System.out.println("Invalid day");

        else

            this.day = day;

    }

    public int getMonth() { //checks to ensure month is correct.

        if(month<1||month>12)

            System.out.println("");

            return month;

    }

    public void setMonth(int month) { //Error if month is invalid

        if(month<1 || month>31)

            System.out.println("Invalid month");

        else

            this.month = month;

    }

    public int getYear() {

        return year;

    }

    public void setYear(int year) {//checks to make sure the year is correct or returns an error if not

        if(year<1900 || year>2023)

            System.out.println("Invalid year");

        else

            this.year = year;

    }

    public String toString() {

        return day +"-" + month +"-" + year;

    }

}

======================================================================================================public class SalariedApplicant extends Applicant {
    private double annualSalary;

    public SalariedApplicant(double annualSalary) {
        this.annualSalary = annualSalary;
    }

    public SalariedApplicant(int empNum, Name name, Address address, Date hireDate, double annualSalary) {
        super(empNum, name, address, hireDate);
        this.annualSalary = annualSalary;
    }

    public double getAnnualSalary() {
        return annualSalary;
    }

    class setAnnualSalary {
        public setAnnualSalary(double annualSalary) {
            this.annualSalary = annualSalary;
        }
    }
}
=====================================================================================================
public class HourlyApplicant extends Applicant {
    private double hourlyPayRate;
    private double hours;
    private double earnings;

    public HourlyApplicant(double hourlyPayRate, double hours) {
        this.hourlyPayRate = hourlyPayRate;
        this.hours = hours;
        setEarnings();
    }

    public HourlyApplicant(int empNum, Name name, Address address, Date hireDate, double hourlyPayRate, double hours) {
        super(empNum, name, address, hireDate);
        this.hourlyPayRate = hourlyPayRate;
        this.hours = hours;
        setEarnings();
    }

    public double getHourlyPayRate() {
        return hourlyPayRate;
    }

I have tried removing the void in the public void setAnnualSalary(double annual Salary){

which is shown. It was previously written as

public void setAnnualSalary(double annualSalary){

this.annualSalary = annualSalary;

}

Resize textareas in the same row dynamically [duplicate]

There is an HTML table with textareas in the cells

<tr>
  <td class="include">
    <textarea></textarea>
  </td>
  <td class="include">
    <textarea></textarea>
  </td>
  <td class="include">
    <textarea></textarea>
  </td>
</tr>

I want the textareas in a single row to be dynamically resized so that they all have the same height when I resized one of them. I want this to happen only on that specific row, not on all textareas in the table (when there are multiple rows). How to do it using jQuery or Javascript?

How to implement select-all records for header checkbox in vue-table-with-tree-grid?

I am trying to trigger check/uncheck event for checkbox in header for vue-table-with-tree-grid component. The checkbox for the rest of the body of the table is working fine with checkbox-click. But I have not found any checkbox event as above mentioned in header section of the table so that I can count the number of records selected.

Here below is the code

Vue file

<zk-table
          ref="table"
          sum-text="sum"
          index-text="#"
          :data="reportInvoiceByProject"
          :columns="projectColumns"
          :stripe="props.stripe"
          :border="props.border"
          :show-header="props.showHeader"
          :show-summary="props.showSummary"
          :show-row-hover="props.showRowHover"
          :show-index="props.showIndex"
          :tree-type="props.treeType"
          :is-fold="props.isFold"
          :expand-type="props.expandType"
          :selection-type="props.selectionType"
          @checkbox-click="rowClick()"
          @on-header-checkbox-change="rowClick()"
          >

JS file

    rowClick(){
      this.selectedReportsLength = this.$refs.table.getCheckedProp("id").length;
      this.selectedReports = this.$refs.table.getCheckedProp("id");
    },

Design

Is there any event already mentioned in vue-table-with-tree-grid component or Is there any other way to implement the above mentioned feature here. Please guide me through this. Thank you in advance

I have tried this event so far

@on-header-checkbox-change="rowClick()"

I NEED HELP! to solve: Uncaught DOMException: Failed to execute ‘toDataURL’ on ‘HTMLCanvasElement’: Tainted canvases may not be exported [duplicate]

I want users to be able to download the map as an Image But whenever I include the NDVI Layer on the OSM layer and click on the download button. I get an Uncaught DOMException: Failed to execute ‘toDataURL’ on ‘HTMLCanvasElement.

1st, I have 2 base maps here:

var base_maps = new ol.layer.Group({
    title: 'Base maps',
    layers: [
        new ol.layer.Tile({
            title: 'Satellite',
            type: 'base',
            visible: true,
            source: new ol.source.XYZ({
                attributions: [
                    'Powered by Esri',
                    'Source: Esri, DigitalGlobe, GeoEye, Earthstar Geographics, CNES/Airbus DS, USDA, USGS, AeroGRID, IGN, and the GIS User Community',
                ],
                attributionsCollapsible: false,
                url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
                maxZoom: 23,
            }),
        }),
        new ol.layer.Tile({
            title: 'OSM',
            type: 'base',
            visible: true,
            source: new ol.source.OSM(),
        }),
    ],
});
var OSM = new ol.layer.Tile({
    source: new ol.source.OSM(),
    type: 'base',
    title: 'OSM',
});

overlays = new ol.layer.Group({
    title: 'Overlays',
    layers: [],
});

And I also have an NDVI Image Layer here coming from the GeoServer

var ndviLayer = new ol.layer.Image({ title: 'ndvi_layer',
source: new ol.source.ImageWMS({
    url: 'http://24.199.122.17:8080/geoserver/wms',
    params: {
        LAYERS: 'NDVI:ndvi22',
        VERSION: '1.1.0',
        TRANSPARENT: true,
    },
    ratio: 1,
    serverType: 'geoserver',
}),

});

2nd, This is my code line to export Map

// Begining of Export Map
document.getElementById('export-png').addEventListener('click', function () {
    map.once('rendercomplete', function () {
      const mapCanvas = document.createElement('canvas');
      const size = map.getSize();
      mapCanvas.width = size[0];
      mapCanvas.height = size[1];
      const mapContext = mapCanvas.getContext('2d');
      Array.prototype.forEach.call(
        map.getViewport().querySelectorAll('.ol-layer canvas, canvas.ol-layer'),
        function (canvas) {
          if (canvas.width > 0) {
            const opacity =
              canvas.parentNode.style.opacity || canvas.style.opacity;
            mapContext.globalAlpha = opacity === '' ? 1 : Number(opacity);
            let matrix;
            const transform = canvas.style.transform;
            if (transform) {
              // Get the transform parameters from the style's transform matrix
              matrix = transform
                .match(/^matrix(([^(]*))$/)[1]
                .split(',')
                .map(Number);
            } else {
              matrix = [
                parseFloat(canvas.style.width) / canvas.width,
                0,
                0,
                parseFloat(canvas.style.height) / canvas.height,
                0,
                0,
              ];
            }
            // Apply the transform to the export map context
            CanvasRenderingContext2D.prototype.setTransform.apply(
              mapContext,
              matrix
            );
            const backgroundColor = canvas.parentNode.style.backgroundColor;
            if (backgroundColor) {
              mapContext.fillStyle = backgroundColor;
              mapContext.fillRect(0, 0, canvas.width, canvas.height);
            }
            
            // Add crossOrigin attribute to image elements
            const images = canvas.parentNode.getElementsByTagName('img');
            Array.prototype.forEach.call(images, function (image) {
              image.setAttribute('crossOrigin', 'anonymous');
            });
            
            mapContext.drawImage(canvas, 0, 0);
          }
        }
      );
      mapContext.globalAlpha = 1;
      mapContext.setTransform(1, 0, 0, 1, 0, 0);
      const link = document.getElementById('image-download');
      link.href = mapCanvas.toDataURL();
      link.click();
    });
    map.renderSync();
}); // End of Export Map

The above export Map code works for only the OSM BaseMap Download

BUT

doesn’t work when the NDVI Image Layer is added; It gives the error below

enter image description here

Hide or show inputs according to a pickerinput choice in Shiny

I have a shiny application where I create a certain number of inputs based on a numeric input.
These inputs are :

  • Some text to display which input number you are at
  • A pickerinput with the selected choice “” and the possible choice c(“”, “-“, some agricultural fodder)
  • A numericInput to be the yield of the agricultural fodder
  • These inputs (apart from the first one giving the input number) are repeated three times on the same horizontal line (column(3, …), column(3, …), column(3, …), column(3, …)).

The user won’t necessarily use all 3 inputs horizontally, and I want to display only the pickerinputs as long as it hasn’t taken a value other than “” or “-” in the pickerinput.

I’ve also added a div to add space between my elements in case the output’s numericInput is hidden.

Here is what it looks like

So I use the map function, looping over the number of inputs I have, and use the hide/show function.

below is my function for creating inputs

inputsPrairie <- function(nbInputs, idPickerInput, choices, idEspace, idNumericInput, tagList){
  base::lapply(1 : nbInputs, function(i){
    
    picker_i <- pickerInput(inputId = paste0(idPickerInput, i), label = "", choices = choices,
                            multiple = FALSE, options = pickerOptions(title = "Choix du devenir"))
    
    espace <- div(HTML(""), id = paste0(idEspace, i))
    
    rendement_i <- numericInput(inputId = paste0(idNumericInput, i),
                                label = "Rendement", value = NULL, min = 0, step = 0.1)
    
    res <- tagAppendChild(tagList, picker_i)
    
    res <- tagAppendChild(res, espace)
    
    res <- tagAppendChild(res, rendement_i)
    
    return(res)
  })
}

and here the code to hide/show the numericInput

    1 : input$MOD2_nb_prairies %>%
      map(function(i){
        req(!is.null(input[[paste0("MOD2_rendement_devenir_prairie1_", i)]]))
        req(!is.null(input[[paste0("MOD2_type_devenir_prairie1_", i)]]))
        if(input[[paste0("MOD2_type_devenir_prairie1_", i)]] == "" |
           input[[paste0("MOD2_type_devenir_prairie1_", i)]] == "-"){
          shinyjs::hide(id = paste0("MOD2_rendement_devenir_prairie1_", i))
          shinyjs::addCssClass(id = paste0("espace_prairie1_", i), class = "picker_input_prairie")
        }else{
          shinyjs::show(id = paste0("MOD2_rendement_devenir_prairie1_", i))
          shinyjs::removeCssClass(id = paste0("espace_prairie1_", i), class = "picker_input_prairie")
        }
      })

My problem is that it works fine except when I reduce the value of my numericInput which allows me to create my number of different inputs…

Do you have any idea where my problem might be coming from?

PS: Sorry if my question isn’t clear, this is the first time I’ve asked a question on stackoerflow.

Redisplaying an already loaded animated WEBP image from the beginning

There is a problem: when initially loading an animated webp image on the page, everything works correctly. The image is loaded and when the loading is completed, it is displayed from the beginning of the animation. The animation of the image is looped, which means that it continues to play even when I hide it from the page (the CSS class is removed). It is inserted as a background image to the DIV element. If it is necessary to display the animation again, I add a class back to the div, but the animation does not play from the beginning, but from the moment in which the animation is since the initial load. I use jQuery on ерш page.

A working option is to add a random value to the end of the URL to the image, but this means reloading it from server again, and there are a lot of animated webp images on the page and they weigh quite a lot (about a 1 megabyte), which excludes the use of this method for people with slow Internet.

Dear experts, tell me, are there any cases to emulate the loading of an already loaded image in the browser and play the animation from the beginning? It is highly desirable to solve the problem without resorting to cumbersome third-party plugins. First of all, I want to understand the essence of the solution, and not load a huge plugin and get a quick but incomprehensible result.

now i research some constructions like this, but no good result yet

let promise     = this.load_image('/images/' + image_url, img);

promise.then((res) => {
    this.loaded(); // отображаем изображение
});

load_image: async function(url, elem)
{
    return new Promise((resolve, reject) => {
        elem.onload = () => resolve(elem);
        elem.onerror = reject;
        elem.src = url;
    });
}```

CryptoJs decryptor with 17 characters

I’m trying to crawl a website that is using CryptoJs.
I have the key and encrypted data and I can decrypt it using javaScript but when I’m trying to do it with python I get this error: ValueError: Incorrect AES key length (17 bytes)
although the javaScript code seems really weird to me, here is the code:

const key = [!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[+!+[]]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[+[]]+[+[]]+[+[]]+[+!+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]];
const encryptedData = "U2FsdGVkX1/Clj8BCUdX7VXpvi2lB5M4KePoC0pYBV94bxdUFBXPE5UkdBNozVS9cp8nHAyx8CcgZrHQRF+hqqBOxMrPAEQsyR5XD+1YLZIMVMVtQaatota4nc5URSjahGStaSvECE7muL9JYrzZuU4ek14d3FYeD7y6HZGOjgTqDbScWr/tVUXdD/UYHz3b2HIx71noUnKg1dg9z74Pp0HPJiolYL5t3cItGL4V5iIgRisUgDPbRzp8dl0DpV+M+aeqHG4rhjmxUjaPuCS3FqHuQV4+nk2fKnOzJXrILgcJqB0ezZ1Po69UjzQ2zUIz2dHN7BP0Hb/VjfB21josTFdGR35asKazp0lYXiEmmJp+ZMNeZJhcGBDfYQnh7XsFGClDvkQbqA/PVQIv9aIsdIc17iTsTwUjhskiumCCoVv2g1FI5XSAZ8/IFNau4l51ZRzSA6t0XYGavZlJjG5KKJtAzBFOr/XGs3eut8MF9UvbRsW508ZIjVVZRdBldUrrderzUKTgg7iRGJ7X7j3IcU6j4EBOrzNydgr0qAF03LegKoFNmhmh35SfK/KeLebMaIir8cjhCTeIkIavFRITbB5QwvAl7FTazXitkZwEhvhgv8pAlG3AnHW0a2C0iv2e3qoV+74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ag/8nYavhShh7/EKYu+SLmAgyENmEGSZR6Ng0iV7FKUxYWpW5fwwB6Wam/pAbjSLNLplkTome8Lc1q30F7UBiIvv06vC3W8xQYa4ArH00U5mDSHounAIHP0jr+XalGXuoMHgbu6uQNK9e+WaykgMg8kPKdbwKa+kv0aOzUReJtYmHQZkUYDCJwzqDQiQIr9cQOUc4QlrHvh18A5RKe0wym1yGIch7Tt0NBKEA6xguudsqqYsQTKsxSd+xvob5kWWbka/P87QSYe9Wqd1ZunBcMU3h8ae68Q6UPfkmoc8c5nUDcrWu3FIIwMckXRLJUhggUkWrWqSckdmNHQHYsrKLSac9ToAIKtOaeCbkTJM/k=";
var decrypted = CryptoJS.AES.decrypt(encryptedData, key).toString(CryptoJS.enc.Utf8); 

like I said the key looks really weird, and when I try to log it I get this: ‘33573251.60001165’
which is a 17 byte string and CryptoJs should throw an error but it doesn’t.
and the same key doesn’t work for python because the key is invalid.
here is the python code:

import base64
from Crypto.Cipher import AES
from Crypto.Util.Padding import unpad

data = 'U2FsdGVkX1/Clj8BCUdX7VXpvi2lB5M4KePoC0pYBV94bxdUFBXPE5UkdBNozVS9cp8nHAyx8CcgZrHQRF+hqqBOxMrPAEQsyR5XD+1YLZIMVMVtQaatota4nc5URSjahGStaSvECE7muL9JYrzZuU4ek14d3FYeD7y6HZGOjgTqDbScWr/tVUXdD/UYHz3b2HIx71noUnKg1dg9z74Pp0HPJiolYL5t3cItGL4V5iIgRisUgDPbRzp8dl0DpV+M+aeqHG4rhjmxUjaPuCS3FqHuQV4+nk2fKnOzJXrILgcJqB0ezZ1Po69UjzQ2zUIz2dHN7BP0Hb/VjfB21josTFdGR35asKazp0lYXiEmmJp+ZMNeZJhcGBDfYQnh7XsFGClDvkQbqA/PVQIv9aIsdIc17iTsTwUjhskiumCCoVv2g1FI5XSAZ8/IFNau4l51ZRzSA6t0XYGavZlJjG5KKJtAzBFOr/XGs3eut8MF9UvbRsW508ZIjVVZRdBldUrrderzUKTgg7iRGJ7X7j3Ic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aMOfDucDbfaj4UxH49yJ0tEqBW47e98Q5h6s9Kk5lZky97Ew7VBOEGcRIp+AHHKoTwCM0MoGZrrYjRh/MAQnI0WxQAWbea/uDOWHKIphuBAag/8nYavhShh7/EKYu+SLmAgyENmEGSZR6Ng0iV7FKUxYWpW5fwwB6Wam/pAbjSLNLplkTome8Lc1q30F7UBiIvv06vC3W8xQYa4ArH00U5mDSHounAIHP0jr+XalGXuoMHgbu6uQNK9e+WaykgMg8kPKdbwKa+kv0aOzUReJtYmHQZkUYDCJwzqDQiQIr9cQOUc4QlrHvh18A5RKe0wym1yGIch7Tt0NBKEA6xguudsqqYsQTKsxSd+xvob5kWWbka/P87QSYe9Wqd1ZunBcMU3h8ae68Q6UPfkmoc8c5nUDcrWu3FIIwMckXRLJUhggUkWrWqSckdmNHQHYsrKLSac9ToAIKtOaeCbkTJM/k='
key = '33573251.60001165'

def decrypt(encrypted_text, key):
    encrypted_bytes = base64.b64decode(encrypted_text)
    cipher = AES.new(key.encode(), AES.MODE_ECB)
    decrypted_bytes = cipher.decrypt(encrypted_bytes)
    return unpad(decrypted_bytes, AES.block_size).decode()

decrypted = decrypt(data, key)
print(decrypted)

I tried to decrypt an encrypted data using python but the key was invalid, however the same key works when I’m decrypting it in javaScript

using mongDB and node while saving user information, but i dont see 1 part

im saving user schema, using, name, email, password, date_created and role. but wheni m posting on POSTMAN, or trying to find out the role in mongoDBCompass i see everything except the role. can someone help me debug that?
this is the output of the console.log =
name: ‘wdasdsa’,
email: ‘[email protected]’,
password: ‘$2b$10$GSM.rNd9c12P3gQvw0wLMeIzRHhm9D5TJ/tQKsSHZoPNfhw7EhLvu’,
date_created: 2023-07-12T10:53:27.371Z,
_id: new ObjectId(“64ae863229b08cb443dba0c5”),
__v: 0
}

const mongoose = require('mongoose');
const Joi = require('joi');
const jwt = require('jsonwebtoken');

const userSchema = new mongoose.Schema({
    name: String,
    email: String,
    password: String,
    date_created: {
        type: Date, default: Date.now()
    }, 
    role: {
        type: String, default: "user"
    }
});


exports.UserModel = mongoose.model('users', userSchema);


exports.genToken = (_userId, role) => {
    let token = jwt.sign({_id:_userId, role}, "ELDERSECRET", {expiresIn:"180min"});
    return token;
};


exports.validateUser = (_bodyData) => {
    let joiSchema = Joi.object({
        name:Joi.string().min(5).max(50).required(),
        email:Joi.string().min(5).max(50).required().email(),
        password:Joi.string().min(5).max(50).required(),
    });
    return joiSchema.validate(_bodyData);
};

exports.validateUserLogin = (_bodyData) => {
    let joiSchema = Joi.object({
        email:Joi.string().min(5).max(50).required().email(),
        password:Joi.string().min(5).max(50).required()
    });
    return joiSchema.validate(_bodyData);
};

the user routes :

router.route('/')
    .get(authToken, async(req, res, next) => {
        try {
            let data = await UserModel.find({});
            res.json(data);
        } catch (err) {
            next(err);
        }
    })
    .post(async(req, res, next) => {
        let validBody = validateUser(req.body);
        if (validBody.error) {
            next({status: 400, message: validBody.error.details[0].message}); 
        } else {
            try {
                let user = new UserModel(req.body);
                user.password = await bcrypt.hash(user.password, 10);
                await user.save();
                console.log(user)
                user.password = undefined;
                res.status(201).json(user);
            } catch (err) {
                next(err);
            }
        }
    });
    ```

I’m looking for solution in c# OnPost

I have created an asp form for the input field date of birth in the project. Below is an example.

<div class="form-group">
   <label asp-for="Employee.Geburtsdatum" class="control-label col-form-label-sm mb-0">Geburtsdatum*</label>
   <input asp-for="Employee.Geburtsdatum" class="form-control form-control-sm" type="date" required />
   <span asp-validation-for="Employee.Geburtsdatum" class="text-danger"></span>
</div>

I need C# solution for OnPost method of birthdate validation with min/MinAge and max/MaxAge

I already have an HTML and JavaScript solution. Anyone know how to do something like this in C#? I am very thankful for the help.

JavaScript variant:

$( function ()
        {
            $( document ).ready( function ()
            {
                var todaysDate = new Date();

                var maxyear = todaysDate.getFullYear() - 70;
                var minyear = todaysDate.getFullYear() - 18;

                var month = ( "0" + ( todaysDate.getMonth() + 1 ) ).slice( -2 );
                var day = ( "0" + todaysDate.getDate() ).slice( -2 );

                var minDate = ( minyear + "." + month + "." + day );
                var maxDate = ( maxyear + "." + month + "." + day );

                $( '.birthdate' ).attr( 'max', minDate );
                $( '.birthdate' ).attr( 'min', maxDate );

            } );
        } );

C# I’m looking for a solution:

public async Task<IActionResult> OnPost()
        {
         ...............................
}

Create a class that extends javascript Date does not work

I am trying to create a class Birthdate extending Date in typescript :

class Birthday extends Date {
  public isYoungerThen(other: Date): boolean {
    return this.getTime() > other.getTime();
  }

  get isAdult(): boolean {
    const past = new Date();
    past.setFullYear(past.getFullYear() - 18)
    return this.getTime() <= past.getTime();
  }
}

But when trying to call : new Birthday('2022-08-08T16:04:25+02:00').isAdult this fails with an error : TypeError: this is not a Date object.

Can you help me figuring out what I could have done wrong ?

Thx

undefined is not iterable

i’m making a quickSort algorithm visualization project and when start visualizing i get the error undefined is not iterable (cannot read property Symbol(Symbol.iterator)) TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))

and it says the error accures at line const [barOneidx, newHeight] = newAnimations[i]; in my visualization file. the algorithm does work and it does sort the array as it should but i still get the error

here is my code for the visualization file:

`  quickSort() {
     const animations = QuickSort.quickSort([...this.state.array]); 
     const newAnimations = [];

    for(const animation of animations){
        newAnimations.push(animation.swap);
    }


    for(let i = 0; i < newAnimations.length; i++){
        const arrayBars = document.getElementsByClassName('array-bar');
        console.log(newAnimations[i]);

        
        
        setTimeout(() => {
            const [barOneidx, newHeight] = newAnimations[i];
            const barOneStyle = arrayBars[barOneidx].style;
            barOneStyle.height = `${newHeight}px`;
        }, i * 2);

    }
    }

`

and here is my code for the algorithm itself:

`export const quickSort = array => {
const animations = [];
if (array.length <= 0) return;
sortHelper(array, 0, array.length - 1, animations);
return animations;
};

function sortHelper(mainArray, startIdx, endIdx, animations) {
  if (endIdx <= startIdx) return;
  let index = partition(mainArray, startIdx, endIdx, animations);
  sortHelper(mainArray, startIdx, index - 1, animations);
  sortHelper(mainArray, index + 1, endIdx, animations);
}

function partition(array, startIdx, endIdx, animations){
const animation = {};
let pivotIndex = startIdx;
let pivotValue = array[endIdx];
for(let i = startIdx; i < endIdx; i++){
  if(array[i] < pivotValue){
    animation.swap = swap(array, i, pivotIndex, animations);
    pivotIndex++;
  }
}

animation.swap = swap(array, pivotIndex, endIdx, animations);

animations.push(animation);
return pivotIndex;


 }

function swap(arr, a, b, animations){
  let temp = arr[a];
  arr[a] = arr[b];
  arr[b] = temp;

  animations.push({ swap: [a, arr[a]] });
  animations.push({ swap: [b, arr[b]] });
}`

i already checked if the array is full and i already looked at other questions at stackoverflow but none of them helped me

Software Design and Development: Can Project Gutenberg in WordPress be used as View in with PHP MVC?

Is it possible to use Gutenberg (https://wordpress.org/gutenberg/) as a View Designer in a PHP version of MVC.

enter image description here

In the image above is two server side functions:

  • Add Action Event

    • What happens on a specific event, such as mouse-over and mouse-click
  • Edit Code Behind

    • Edit the server side code and see the PHP events that was created to handle the front-end code

Almost a MVC approach, to model using HTML, to view using Gutenberg (and design) and then PHP backend code to manage the updates to the model.

(If the question is vague, please let me know.)