Web Development begineer [closed]

From where a beginner should start to learn more to get a job as web developer or particular front-end developer having basic knowledge of html, css, js.In particularly what roadmap should be followed .

I have started learning from youtube , its making me understand how things work in web development but still i’m little bit of confused.

How can I implement the inputSearch component so that users can find a certain task by typing a couple of letters?

For now, I have almost finished implementing the functionality for users to find a certain task. I am using a variable called isTaskListEmpty to render different content depending on its state. But this functionality only works when the user types the second letter. When the user types the first letter, nothing happens because the isTaskListEmpty variable is false. However, when the user types the second letter and the re-rendering occurs, my inputSearch component works. I understand that the problem lies in the variable isTaskListEmpty. Perhaps someone can provide a clue on how I can overcome this issue. How can I make the isTaskListEmpty variable change immediately when the user enters the first letter in the input field?

import React, { useState } from "react";
import InputTask from "../InputTask/InputTask";
import HeaderOfTaskList from "../HeaderOfTaskList/HeaderOfTaskList";
import Task from "../Task/Task";
import { useDispatch, useSelector } from "react-redux";
import { removeTask, addTask } from "../../store/actions";
import InputSearch from "../InputSearch/InputSearch";
import useInput from "../../hooks/useInput";
import "./TaskList.css";

export const TaskList = () => {
  const dispatch = useDispatch();
  const tasks = useSelector((state) => state.tasklist);
  const input = useInput();
  const [isTaskListEmpty, setIsTaskListEmpty] = useState(false);
  const [searchTerm, setSearchTerm] = useState("");

  const filteredTasks = tasks.filter((task) =>
    task.title.toLowerCase().includes(searchTerm.toLowerCase())
  );

  const handleInputChange = (value) => {
    setIsTaskListEmpty(!isTaskListEmpty);
    setSearchTerm(value);

    console.log(isTaskListEmpty);
  };

  const handleDelete = (id) => {
    dispatch(removeTask(id));
  };

  const handleAddTask = (tasklist) => {
    dispatch(addTask(tasklist));

    console.log(isTaskListEmpty);
  };

  return (
    <div>
      <InputTask addTask={handleAddTask} />
      <InputSearch onInputChange={handleInputChange} />
      <HeaderOfTaskList />
      {!isTaskListEmpty ? (
        <ul>
          {filteredTasks
            .filter((task) =>
              task.title.toLowerCase().includes(input.value.toLowerCase())
            )
            .map((task) => (
              <Task
                task={task}
                key={task.id}
                onDelete={() => handleDelete(task.id)}
              />
            ))}
        </ul>
      ) : (
        <ul>
          {tasks.map((task) => (
            <Task
              task={task}
              key={task.id}
              onDelete={() => handleDelete(task.id)}
            />
          ))}
        </ul>
      )}
    </div>
  );
};
import { useState } from "react";

const useInput = (defaultValue = "") => {
  const [value, setValue] = useState(defaultValue);
  return {
    value,
    onChange: (e) => {
      setValue(e.target.value);
    },
  };
};

export default useInput;

I created the filteredTasks function to find matches, and I also implemented the useInput custom hook.

chatGpt message genrater without Open AI

I have implemented a chrome extension to generate a reply message from an email page based on the Subject by using chatGpt Open AI.

I want to do this thing without using chat gpt Open AI based on already login chatGpt platform on my chrome its possible if yes please suggest how can i do this?

JavaScript – different pre-increment output with what is expected [duplicate]

I have a program below:

let c = 7;
let d = {
  c: 10,
  d: ++c
};
console.log("c + d.c + ++d.d :", c + d.c + ++d.d);

Expectation

I was expecting :

c = 7

d.c = 10 = 10

++d.d = (++c -> 8 -> +d.d -> 9) = 9

Hence, 7 + 10 + 9 = 26

Output

However, the output was 27. I saw the explanation saying :

Prefix operator increments the number and then returns it. So it would e 8 + 10 + 9 = 27

How is c incremented when the operation does not include a pre-increment to c (I see no ++c in the operation)?

In Apex Charts React Line chart stack on area chart, when use multiple line and area in Series, Visible as curve line, parent chart is of area type

while creating stack area graph, the straight line graph which is added in series is should be visible as a straight line as the value is [2,2][4,4]but it is getting stacked over the area chart
and can be seen as a curved line with wrong data on line.

enter image description here

here is the code I am using

var options = {
  "chart": {
    "type": "area",
    "stacked": true,
    "stackOnlyBar": false
    //stackType:'normal'
  },
  "colors": [
    "#CECECE",
    "#E76F51",
    "#fcd757",
    "#2ec4b6",
    "#6563BB",
    "#000000"
  ],
  "dataLabels": {
    "enabled": false
  },
  "stroke": {
    "width": 2
  },
  "fill": {
    "type": "solid",
    "gradient": {
      "opacityFrom": 0.6,
      "opacityTo": 0.8
    }
  },
  "legend": {
    "position": "top",
    "horizontalAlign": "left"
  },
  "markers": {
    "size": 0.005
  },
  "tooltip": {
    "enabled": false,
    "shared": true,
    "inverseOrder": true,
    "fillSeriesColor": false,
    "y": {}
  },
  "xaxis": {
    "type": "datetime",
    "convertedCatToNumeric": false
  },
  "noData": {
    "text": "No data available",
    "style": {
      "fontSize": "18px"
    }
  },
  "yaxis":[{
    "min": 0,
    "max": 28.14,
    "labels": {}
  }],
  "series": [
    {
      "name": "Grey Zone",
      "type": "area", 
      "data": [
        [1709015776791, 8],
        [1709015673850, 0]
      ],
    },
    {
      "name": "Red Zone",
      "type": "area",
      "data": [
        [1709015776791, 4],
        [1709015673850, 4]
      ],
    },
    {
      "name": "Yellow Zone",
      "type": "area",
      "data": [
        [1709015776791, 6],
        [1709015673850, 6]
      ],
    },
    {
      "name": "Green Zone",
      "type": "area",
      "data": [
        [1709015776791, 10],
        [1709015673850, 10]
      ],
    },
    {
      "name": "Available Stock",
      "type": "line",
      "yAxisIndex": 1,
      "data": [
        [1709015776791, 2],
        [1709015673850, 2]
      ],
      "stacked":false,
      "stackSeries": false
    },
    {
      "name": "On Hand Stock",
      "type": "line",
      "yAxisIndex": 1,
      "data": [
        [1709015776791, 4],
        [1709015673850, 4]
      ],
      "stacked":false,
      "stackSeries": false
    },
  ]
};

var chart = new ApexCharts(document.querySelector("#chart"), options);

chart.render();

Please help me here

I was expecting two straight line and 4 area charts stacked on each other behind the straight lines. how should I obtain this output

Slider Puzzle Giving False Positives When on an Even Numbered Grid

I have been working on a slider puzzle project for the past few days, and when I thought I finally had it working I ran into a problem with the isSolvable() function that is supposed to ensure the puzzle can be solved. On odd numbered grids (3×3, 5×5, etc) it seems to work fine, but when it comes to even numbered grids (2×2, 4×4, etc) it is constantly giving false positives. I have been bashing my head against the wall for way too long and I need some help.

I have tried a multitude of different things to get it to work from Googling other people’s slider puzzles, reading a ton of different stack overflow solutions, reading the theory behind slider puzzle solvers, and even running some of the code through AI to see if it had any solutions with all of the solutions coming up as failures.

Here is a fiddle of what I currently have:
https://jsfiddle.net/Mid252/mh0qbg31/

it doesn’t always give false positives, so you may need to run the script a couple times, but you will definitely run into an unsolvable puzzle on size = 2 and size = 4 grids.

Any help figuring this out would be greatly appreciated!

Y-axis format type is not avilable in ApexChart

X-axis has a format type(Like numeric, datetime, category) attribute, but could not find Y-axis type attribute .

Is there a possible way to apply the Y-axis type – attribute ?

We have passed the following X & Y axis data to ApexChart :enter image description here

Apex Render :enter image description here

Expected Output:enter image description here

Could you please help us resolve this case?

Change the tail traingle color in the tooltip in leaflet

I am trying to change the tooltip tail triangle color on mouseover of the leaflet map marker pin but I can’t inspect the exact class name to override it. Is there a way to change the color and need to move the position of the triangle to left side of the marker image and also the css classname. This post shows the exact requirement for popup and I need for tooltip.

const tooltipOptions = {
        direction: 'top',
        offset: [0, -44],
        // className: 'leaflet-tooltip-tip', -- tried adding the class to change the color but didnt help.
      };
      onMouseOverEvent.bindTooltip('My tooltip', tooltipOptions).openTooltip();

How to optimally use Lexical as input in chat application?

I am wondering how to implement Lexical as an input for a chat app. The issue lies in rendering the message list.

A naive approach would involve creating a common message editor component that wraps Lexical and all necessary plugins, with an editable prop. For the message input component, we would set editable="true", and for each message, editable="false". However, it’s clearly suboptimal to have a whole editor instance for each message, especially when there could be hundreds of messages at a time. I haven’t tested it yet, but I believe it would be a very resource-intensive approach.

The only alternative I could think of is to prerender HTML on save and store it in the database, but this has several caveats as well. It won’t keep up with future editor updates, and there are concerns related to rendering HTML from user input, among other issues.

I believe this problem has likely been solved by someone already, and I would be glad to learn about better solutions.

Brackets in JavaScript/React in Query Params

How do I achieve the brackets as shown on the picture below?

enter image description here

CODE

export const fetchInvoices = (
  {
    pageNumber,
    pageSize,
    search = '',
    orderBy = { created_at: 'asc', reference_number: 'asc' },
  },
  config
) => {
  const params = new URLSearchParams({
    page: pageNumber + 1,
    size: pageSize,
    search,
    ...orderBy,
  });
  return api.get(`${invoiceUrl}?${params.toString()}`, config);
};

Not able to access the audio while simultaneously accessing the image bit map

I am using the navigator.mediaDevices.getUserMedia to access my personal microphone and web camera. I am able to access my images through my webcamera and display it on my html page. however, i am not able to simulatenously play the audio.

I tried to first play the audio with the stream variable being set for the video srcObject. This worked great. However, when I changed the srcObject for my video to the imagebitmap, my code has not played the audio simultaneously.
I am getting an error in the console:Uncaught (in promise) DOMException: Failed to load because no supported source was found.

In this instance, you can ignore my jsonresponse as it is not doing anything other than returning a phrase. I’m first trying to access the audio chunks and imagebitmap properly.
Here’s the code:

{% extends "auctions/layout.html" %}
{% block body %}
    <style>
        #localVideo {
            border-radius: 25px;
        }
    </style>
    <center><video id="processedVideo" autoplay playsinline></video></center>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/simple-peer/9.11.1/simplepeer.min.js"></script>
    <script>
        const constraints = {
            video: true,
            audio: {
                echoCancellation: true,
                noiseSuppression: true,
                autoGainControl: true,
                // Set the desired bitrate (e.g., 128 kbps)
                deviceId: {
                  exact: "default"
                }
            },
        };
        navigator.mediaDevices.getUserMedia({ video: true, audio: true })
            .then(stream => {
                //document.getElementById('processedVideo').srcObject = stream;
                const videoTrack = stream.getVideoTracks()[0];
                //const audioTrack = stream.getAudioTracks()[0];
                const imageCapture = new ImageCapture(videoTrack);

                const mediaRecorder = new MediaRecorder(stream);


                // Function to handle rendering imageBitmap into srcObject
                function renderImage(imageBitmap) {
                    console.log('Received video frame:', imageBitmap);
                    const canvas = document.createElement('canvas');
                    canvas.width = imageBitmap.width;
                    canvas.height = imageBitmap.height;
                    const ctx = canvas.getContext('2d');
                    ctx.drawImage(imageBitmap, 0, 0, imageBitmap.width, imageBitmap.height);
                    const newStream = canvas.captureStream();
                    document.getElementById('processedVideo').srcObject = newStream;
                }

                // Create a single Audio element for playback
                console.log(mediaRecorder);

                // Example: Grabbing video frames at intervals
                setInterval(() => {
                    imageCapture.grabFrame()
                        .then(imageBitmap => {
                            renderImage(imageBitmap);
                            fetch('/image', {
                                method: 'PUT',
                                headers: { "Content-type": "application/json", "X-CSRFtoken": "{{ csrf_token }}" },
                                body: JSON.stringify({ image: imageBitmap })
                            })
                                .then(response => response.json())
                                .then(result => {
                                    console.log(result);
                                });
                        })
                        .catch(error => console.error('Error grabbing frame:', error));
                }, 200); // Adjust the interval as needed

                // Start recording audio
                mediaRecorder.ondataavailable = event => {
                    // Play audio chunk directly from MediaStream
                    var blobUrl = window.URL.createObjectURL(event.data);
                    console.log('Received audio chunk:', blobUrl);
                    const audioElement = new Audio(blobUrl); // Create Audio element
                    audioElement.play();
                };
                mediaRecorder.start(1000); // Adjust the interval as needed
            })
            .catch(error => console.error('Error accessing media devices:', error));
    </script>
{% endblock %}

i have code after login its not cliking on button can you give me solution

    // Click on the "Resumatic" link
    let interviewProLink = await driver.findElement(
      By.xpath(
        '/html/body/div/div[3]/div[3]/div/div/div[3]/div/div/div[1]/div/div/div[2]/a',
      ),
    );

    // Wait for the element to be clickable
    await driver.wait(until.elementIsClickable(interviewProLink), 10000);

    // Add a slight delay before clicking
    await driver.sleep(2000);

    // Click the "Resumatic" link
    await interviewProLink.click();
    console.log('Clicked on Resumatic');

    // Wait for the Resumatic page to load
    await driver.wait(
      until.elementLocated(By.css('.interview-pro-header')),
      10000,
    );

    // Locate and click the template button
    let templateButton = await driver.findElement(
      By.xpath('//*[@id="root"]/div/div[1]/div[2]/div[1]/a[2]'),
    );

    // Scroll the element into view
    await driver.executeScript(
      'arguments[0].scrollIntoView();',
      templateButton,
    );

    // Wait for the element to be clickable
    await driver.wait(until.elementIsClickable(templateButton), 10000);

    // Click the template button
    await templateButton.click();

    // Wait for the action to complete (if needed)
    await driver.sleep(5000);
  } else {
    console.log('Failed to navigate to Resumatic after login.');
  }
} catch (error) {
  console.error('Error:', error.message);
} finally {
  await driver.quit();
}

example();

this is code can you tell me what is wrong in this why its not cliking

can you give me code that is clikible

HookWebpackError: ENOENT: no such file or directory , ……. caused by plugins in Compilation.hooks.processAssets

I recently upgraded my application from angular 8 to Angular 17, also I upgraded many of the other libraries, I have attached the screenshot. Now, I am not able to serve the application.

Problems I faced during the upgrade:
ngx-soap does not work with Angular 17, I have used ‘soap’ (a different library) to mitigate the issues and now I am not getting any error related to ngx-soap.

error
[webpack-dev-middleware] HookWebpackError: ENOENT: no such file or directory, scandir at makeWebpackError
…… — inner error —
Error: ENOENT: no such file or directory ….. caused by plugins in Compilation.hooks.processAssets

package.json
{
“name”: “unified-message-viewer”,
“version”: “0.0.0”,
“scripts”: {
“ng”: “ng”,
“start”: “ng serve –host 0.0.0.0 –port 4200 –disable-host-check –proxy-config proxy.config.json –base-href /UnifiedMessageViewer/”,
“build”: “ng build –base-href /UnifiedMessageViewer/”,
“build:prod”: “ng build –prod –base-href /UnifiedMessageViewer/ && npm run create-zip”,
“test”: “ng test”,
“test:coverage”: “ng test –code-coverage”,
“test-single-run:coverage”: “ng test –watch=false –code-coverage”,
“lint”: “ng lint”,
“e2e”: “ng e2e”,
“storybook”: “start-storybook -p 6006”,
“build-storybook”: “build-storybook”,
“create-zip”: “copy zip-utiliis-configweb.config distUnifiedMessageViewerweb.config && copy upload-utilreceiver.ashx distUnifiedMessageViewerreceiver.ashx && del distUnifiedMessageViewer.zip && node zip-util/create-zip.js”
},
“private”: true,
“dependencies”: {
“@angular/animations”: “~17.2.2”,
“@angular/common”: “~17.2.2”,
“@angular/compiler”: “~17.2.2”,
“@angular/core”: “~17.2.2”,
“@angular/forms”: “~17.2.2”,
“@angular/platform-browser”: “~17.2.2”,
“@angular/platform-browser-dynamic”: “~17.2.2”,
“@angular/router”: “~17.2.2”,
“@biesbjerg/ngx-translate-extract”: “^7.0.4”,
“@biesbjerg/ngx-translate-extract-marker”: “^1.0.0”,
“@fortawesome/fontawesome-free”: “^6.5.1”,
“@ngx-translate/core”: “^15.0.0”,
“@ngx-translate/http-loader”: “^8.0.0”,
“@progress/kendo-angular-buttons”: “^15.1.0”,
“@progress/kendo-angular-common”: “^15.1.0”,
“@progress/kendo-angular-dateinputs”: “^15.1.0”,
“@progress/kendo-angular-dialog”: “^15.1.0”,
“@progress/kendo-angular-dropdowns”: “^15.1.0”,
“@progress/kendo-angular-excel-export”: “^15.1.0”,
“@progress/kendo-angular-grid”: “^15.1.0”,
“@progress/kendo-angular-icons”: “^15.1.0”,
“@progress/kendo-angular-inputs”: “^15.1.0”,
“@progress/kendo-angular-intl”: “^15.1.0”,
“@progress/kendo-angular-l10n”: “^15.1.0”,
“@progress/kendo-angular-label”: “^15.1.0”,
“@progress/kendo-angular-layout”: “^15.1.0”,
“@progress/kendo-angular-navigation”: “^15.1.0”,
“@progress/kendo-angular-pdf-export”: “^15.1.0”,
“@progress/kendo-angular-popup”: “^15.1.0”,
“@progress/kendo-angular-progressbar”: “^15.1.0”,
“@progress/kendo-angular-tooltip”: “^15.1.0”,
“@progress/kendo-angular-treeview”: “^15.1.0”,
“@progress/kendo-angular-upload”: “^15.1.0”,
“@progress/kendo-angular-utils”: “^15.1.0”,
“@progress/kendo-data-query”: “^1.7.0”,
“@progress/kendo-drawing”: “^1.19.0”,
“@progress/kendo-licensing”: “^1.3.5”,
“@progress/kendo-theme-default”: “^7.2.0”,
“crypto-js”: “^4.2.0”,
“fast-xml-parser”: “^4.3.5”,
“lodash”: “^4.17.21”,
“moment”: “^2.30.1”,
“rxjs”: “~7.8.1”,
“soap”: “^1.0.0”,
“tslib”: “^2.6.2”,
“zone.js”: “~0.14.4”
},
“devDependencies”: {
“@angular-devkit/build-angular”: “~17.2.1”,
“@angular/cli”: “~17.2.1”,
“@angular/compiler-cli”: “~17.2.2”,
“@angular/language-service”: “~17.2.2”,
“@babel/core”: “^7.23.9”,
“@storybook/addon-actions”: “7.6.17”,
“@storybook/addon-links”: “7.6.17”,
“@storybook/addon-notes”: “5.3.21”,
“@storybook/addons”: “7.6.17”,
“@storybook/angular”: “7.6.17”,
“@types/jasmine”: “~5.1.4”,
“@types/jasminewd2”: “~2.0.13”,
“@types/node”: “^20.11.20”,
“archiver”: “^6.0.1”,
“babel-loader”: “^9.1.3”,
“codelyzer”: “^6.0.2”,
“husky”: “^9.0.11”,
“jasmine-core”: “~5.1.2”,
“jasmine-spec-reporter”: “~7.0.0”,
“karma”: “~6.4.2”,
“karma-chrome-launcher”: “~3.2.0”,
“karma-coverage-istanbul-reporter”: “~3.0.3”,
“karma-jasmine”: “~5.1.0”,
“karma-jasmine-html-reporter”: “^2.1.0”,
“node-sass”: “^9.0.0”,
“protractor”: “~7.0.0”,
“ts-node”: “~10.9.2”,
“tslint”: “~5.20.1”,
“typedoc”: “^0.25.8”,
“typescript”: “~5.3.3”
}
}

I have followed through all the suggestions that I can get, but nothing is working out. Also, should I upgrade sequentially like from 8 to 9 then from 9 to 10 , 10 to 11 and so on as I upgraded directly from 8 to 17. Or is there a way to clear the serve error.

React component not re-rendering

I have a react code where I am facing an issue which is related to nested components in the react.

code

The issue is that I have a parent component named testing which contains two children component named Component1 and Component2, Inside the Component2 there sub children present named Component 3.

Now in Component1 I am performing an api call which is fetching the a list of products and that data is saved inside a useState present inside the testing parent component and the value of that useState is passed as prop in Component2 and from that to component3.

Here in Component3 I have useState that is stored a flag now when again I hit the api and the data is changed from that api call response, then the flag present inside the Component3 is not resetting as the components are not re-rendering, and just the data is getting change.

You can also use this codesandbox link to know more about the issue.

My question here is that when the useState present inside the parent component (testing) is updated then the nested component should also be re-rendered.
But the component3 is not re-rendering.

Please explain the full logic behind this in terms of VDom and RDom as well as how props are passed and executed when states are changed.