Can’t able to resolve dependencies of the SqsService when i tried to use it in Custom Provider

I’m aiming to make the code less dependent on specific parts. My idea is to create a provider, which would allow me to easily switch between using a queueService or bypassing the queue during local development. Additionally, using this provider would make it simpler in the future if we decide to switch to cloud tasks. I’d only need to change the class, and the provider will handle the rest.

import { SqsService } from '@ssut/nestjs-sqs';
import { SqsOptions } from '@ssut/nestjs-sqs/dist/sqs.types';
import { DiscoveryService } from '@golevelup/nestjs-discovery';
import { SQS_OPTIONS } from '@ssut/nestjs-sqs/dist/sqs.constants';


export interface QueueResolver {
  send(queue: string, message: any): Promise;
}

export const QueueProvider = {
  provide: 'QueueResolver',
  useFactory: (options: SqsOptions, discover: DiscoveryService) => new SqsService(options,discover),
  inject: [SQS_OPTIONS, DiscoveryService]
}

[ExceptionHandler] Nest can't resolve dependencies of the SqsService (?, DiscoveryService). Please make sure that the argument Symbol(SQS_OPTIONS) at index [0] is available in the CoreModule context.

I’m seeking guidance on how to properly inject or provide dependencies, especially related to the SQS_OPTIONS argument.

how to get job in google company? [closed]

Understand the Requirements: Look at the job openings on Google’s career page and assess the requirements for positions that interest you. Google hires for various roles, including engineering, product management, design, marketing, sales, and more.

Build Relevant Skills and Experience: Acquire the skills and experience necessary for the role you’re targeting. Google values technical expertise, problem-solving abilities, creativity, leadership skills, and a passion for innovation.

Education and Certifications: While not always mandatory, having a relevant degree or certifications can be advantageous. Google often looks for candidates with strong academic backgrounds, especially in technical roles.

Prepare Your Resume: Tailor your resume to highlight relevant experiences and skills that align with the job description. Emphasize your achievements, projects, and any work that demonstrates your abilities.

Prepare for Interviews: If your application gets noticed, expect multiple rounds of interviews. Google is known for its rigorous interview process, which may include technical questions, problem-solving scenarios, behavioral assessments, and more. Practice and preparation are crucial.

Show Passion and Cultural Fit: Google looks for candidates who not only have the skills but also fit well within the company culture. Showcase your passion for innovation, collaboration, and problem-solving during interviews.

Continuously Improve: If you don’t get the job on your first attempt, seek feedback and continue improving your skills and experiences. Reapply when you feel you’ve grown stronger as a candidate.

Remember, getting a job at Google can be highly competitive

can Babel transfile JSP?

I want to use Babel to transfile my jsp files
what I worried is that
in JSP file there are many languages not only javascript

there are html, css, js code with EL Expression, Scriptlet(Java Code),
Spring:message tag(they are written in js code for alert msg, covered with “”)

does Babel change javascript code only?
Is there any possiblity that Babel change other code so may occur errors??

thanks a lot 😀

actually I’m considering standalone-babel too.
but I’m not sure that does It works fine?

is there any expected error by using it?

Why are all the events filtered out?

Am making an event filter using the following data. However it seems all the event got filtered out.
I am not sure what is wrong though

[
    {
    "index": 1,
    "eventname": "Swimming",
    "price":[250,100,350],
    "date":[20230812,20230831]
    }
    ,
    {
    "index":2,
    "eventname": "Fencing",
    "price":[220,140,50],
    "date":[20230712,20230913]
    }
    ,
    {
    "index":3,
    "eventname": "Jogging",
    "price":[90,70,50],
    "date":[20230308,20230609]
    }
    ,
    {
    "index":4,
    "eventname": "Basketball",
    "price":[160,140,120],
    "date":[20230911,20230221]
    }
]

The Event Filters are as follows:

import React from 'react';
import { HiOutlineMagnifyingGlass } from "react-icons/hi2";
import "./eventmain.css";
import "../App.css";

const EventNameFilter = ({ onInputChange }) => {
        const handleInputChange = (e) => {
            const value = e.target.value;
            onInputChange(value);
        };
        
        return(
            <div className="event-name-filter">
                <label htmlFor="eventname"  >Event name</label>
                <input type="text" id="event-name-search" 
                placeholder="Enter event name" className="event-name" onChange={handleInputChange}
                />
            </div>
    );

}

const PriceSlider = ({onPriceChange}) =>{
    const handlePriceChange = (e) => {
        const value = e.target.value;
        onPriceChange(value);
    };

    return(
        <div className='price-slider'>
            <label htmlFor="pricerange" className="flex flex-col">Price Range </label>
            <input type="range" min="0" max="500" id="pricerange"  onInput={handlePriceChange}/>
        </div>
    )
}

const GoToLocation = () =>{
    return(
        <div className = "go-to-location"> Find by location</div>
    );
}

const Search  = () =>{
    return(
        <div className = "search"> 
            <HiOutlineMagnifyingGlass />
        </div>
    );
}

export default function EventFilterBar(){
    return(
        <div className= "event-filter-bar">
            <EventNameFilter />
            <PriceSlider />
            <GoToLocation />
            <Search />
            <div>
                <p id="username">Username</p>
            </div>
            <div>
                <img id="usericon" src="./free-user-icon-3296-thumb.png" alt="user icon" />
            </div>
        </div>
    )
}

And the event page

export default function EventMain (){
    const [searchInput,setInput]=useState('');
    const [maxPrice,setMaxPrice] = useState(750);
    
    const handleSearchInput = (value) => {
        setInput(value);
    };

    const handlePriceChange = (value) => {
        setMaxPrice(value);
    }

    const getEarliestDate = (dates) => {
        return Math.min(...dates);
    };
    
    const getLatestDate = (dates) => {
        return Math.max(...dates);
    };

   const filteredEvents = mockEventData.filter((event) =>
        event.eventname.toLowerCase().includes(searchInput.toLowerCase())
           ).filter((event) =>Math.max(event.price)<maxPrice
        );

    return(
        <div className="event-main">
            <EventFilterBar onInputChange={handleSearchInput} onPriceChange={handlePriceChange}/>
            <HeaderBar/>
            {filteredEvents.map((event, index) => (
                <EventCard
                key={index}
                eventname={event.eventname}
                earliestdate={getEarliestDate(event.date)}
                latestdate={getLatestDate(event.date)}
                price={event.price.toSorted((a, b) => a - b).toString()}
                />
            ))}
        </div>
    );
}

The event cards

import './eventmain.css';
import { IoIosStar, IoIosStarOutline } from "react-icons/io";
import React, { useState } from 'react';

export default function EventCard({ eventname, earliestdate, latestdate, price }) {
    const [starred, setStarred] = useState(false);

    const StarIcon = starred ? <IoIosStar onClick={() => setStarred(!starred)} /> 
                             : <IoIosStarOutline onClick={() => setStarred(!starred)} />;

    return (
        <div className="event-card">
            <div className="event-element"><p>{eventname}</p></div>
            <div className="event-element"><p>{earliestdate}</p></div>
            <div className="event-element"><p>{latestdate}</p></div>
            <div className="event-element"><p>{price}</p></div>
            <div className="event-element">{StarIcon}</div>
        </div>
    );
}

(It looks like my post is mostly code; I am adding some more details. It looks like your post is mostly code; please add some more details.It looks like your post is mostly code; please add some more details.)

Miss logic looping for with condition Javascript

I wrote the script like below

`for (baris=1; baris<=newArray.length; baris++){

if(columns.indexOf(columns[j]) == 0 && newArray[baris-1] == '' )
{
  to_target.getRange(baris+2,columns.indexOf(columns[j])+1).setValue('New');
  Logger.log('baris ' + baris + ' new ' + 'column '+ columns.indexOf(columns[j]))
}
if(columns.indexOf(columns[j]) == 6)
{
  to_target.getRange(baris+2,30).setValue(newArray[baris-1]);
  Logger.log('baris ' + baris + ' column 30')
}

else 
{     
   to_target.getRange(baris+2,columns.indexOf(columns[j])+1).setValue(newArray[baris-1]);
   Logger.log('baris ' + baris + ' column '+ columns.indexOf(columns[j]))
}
}`

there are 7 columns in array and two rows. The output of the script is

baris 1 new column 0
baris 1 column 0
baris 2 column 0
baris 1 column 1
baris 2 column 1
baris 1 column 2
baris 2 column 2
baris 1 column 3
baris 2 column 3
baris 1 column 4
baris 2 column 4
baris 1 column 5
baris 2 column 5
baris 1 column 30
baris 2 column 30

however the expected result from logic on script that I wrote is

baris 1 new column 0
baris 2 column 0
baris 1 column 1
baris 2 column 1
baris 1 column 2
baris 2 column 2
baris 1 column 3
baris 2 column 3
baris 1 column 4
baris 2 column 4
baris 1 column 5
baris 2 column 5
baris 1 column 30
baris 2 column 30

I can’t find the reason why baris 1 column 1 are include the result? anyone can help me to solve this issue?

Angular standalone componentnot getting imported properly and after getting imported properly, not displaying anything on html

So I am pretty new to Angular and, currently I am making a clone by using Firebase and all. So, Angular is throwing two error’s to me named:

  1. Component AppComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead?

  2. The AppComponent class is a standalone component, which can not be used in the @NgModule.bootstrap array. Use the bootstrapApplication function for bootstrap instead.

This is the app.module.ts:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { LoginComponentComponent } from './login-component/login-component.component';
import { initializeApp, provideFirebaseApp } from '@angular/fire/app';
import { getAuth, provideAuth } from '@angular/fire/auth';
import { getFirestore, provideFirestore } from '@angular/fire/firestore';
import { MatFormFieldModule } from "@angular/material/form-field";
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

@NgModule({
  declarations: [
    AppComponent,
    LoginComponentComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    MatFormFieldModule,
    BrowserAnimationsModule,
    provideFirebaseApp(() => initializeApp({
      apiKey: "YOUR API KEY",
      authDomain: "YOUR AUTH DOMAIN",
      databaseURL: "YOUR DATABASE URL",
      projectId: "YOUR PROJECT ID",
      storageBucket: "YOUR STORAGE BUCKET",
      messagingSenderId: "YOUR SENDER ID",
      appId: "YOUR APP ID",
      measurementId: "YOUR MEASUREMENT ID"
    })),
    provideAuth(() => getAuth()),
    provideFirestore(() => getFirestore())
  ],
  providers: [],
  bootstrap: [AppComponent]
}
export class AppModule { }

This is the app.compnent.module.ts:

import { Component } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { CommonModule } from '@angular/common';
import { RouterLinkActive, RouterOutlet, RouterLink } from '@angular/router';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [CommonModule, RouterOutlet,
    RouterLink, RouterLinkActive],
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'zomato-clone';
}

I can’t figure out what to do. Can Someone please help? Thank you in advance.

I tried removing the AppComponent from declarations and bootstrap, it did compile but I was not able to see anything on the HTML. I was expecting to see the navbar that I had designed in the html doc, but just saw just a blank page.

How to access super function when overriding a function using a function passed as a parameter in Javascript?

I am overriding the functions of different classes by passing an object of functions as a parameter.

var parameter = {function1: function() {...}, function2: function() {...}}

Is it possible to call the original function, as would be done using super() when extending the class, from the overriding function being passed in?

var parameter = {function1: function() {// I want to call the original function1 of whatever class im going to be overriding, then do something else}, function2: function() {...}}

Further context: I am making a custom widget on surveyjs.

Enable pause on hover for 1 slide in a Bootstrap 5 Carousel with x slides

My carousel auto slides but I want a specific slide to pause on hover.

I tried with data-bs-pause="hover" but that’s not working. Is this even possible?

<div id="carouselExampleDark" class="carousel carousel-dark slide" data-bs-ride="carousel">
  <div class="carousel-inner">
    <div class="carousel-item active" data-bs-interval="2000" data-bs-pause="false">
      <img src="..." class="d-block w-100" alt="...">
      <div class="carousel-caption d-none d-md-block">
        <h5>First slide label</h5>
        <p>Some representative placeholder content for the first slide.</p>
      </div>
    </div>
    <div class="carousel-item" data-bs-interval="2000" data-bs-pause="hover">
      <img src="..." class="d-block w-100" alt="...">
      <div class="carousel-caption d-none d-md-block">
        <h5>Second slide label</h5>
        <p>Some representative placeholder content for the second slide.</p>
      </div>
    </div>
    <div class="carousel-item" data-bs-interval="2000" data-bs-pause="false">
      <img src="..." class="d-block w-100" alt="...">
      <div class="carousel-caption d-none d-md-block">
        <h5>Third slide label</h5>
        <p>Some representative placeholder content for the third slide.</p>
      </div>
    </div>
  </div>
  <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleDark" data-bs-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Previous</span>
  </button>
  <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleDark" data-bs-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Next</span>
  </button>
</div>

having trouble limking .JS with .html

i am unable to link JS file with HTML file i tried script tag but unfortunately i cant perform linking. please tell me correct syntax for the same process that will help me greatly and will allow me in making fabulous projects that are still in my mind

Typescript error in react native using react navigation

I have a typescript error in React Native that I can’t figure out

const handleLearningPathRedirect = (item: any) => {
    const routeParams: any = {
        props: item,
    };

    navigation.navigate(navigationString.LearningPath, routeParams);
};

Argument of type ‘[string, any]’ is not assignable to parameter of type ‘never’

I would rather not quick fix and disable eslint error and anything I have tried results in the same error

interface RouteParams {
  props: any; 
}

const handleLearningPathRedirect = (item: any) => {
  const routeParams: RouteParams = {
    props: item,
  };

  navigation.navigate('LearningPath', routeParams);
};

Calling two functions onClick in React, functions work independently but not when called simultaneously

I have a nav with buttons, each representing a category. When a button is clicked, the setActive function which is passed to the nav component as a prop from a parent file triggers a different category component to be rendered. This part of the code works as expected.

In the nav component, I also want the buttons to display an <svg> when clicked, instead of the default image for that button. I’m using the useState hook to setActiveButton when a button is clicked. I then check if activeButton === name of that button, and if so, conditionally render the <svg>.

If I pass either one or the other function to the onClick, the code works, but together, the local setActiveButton function keeps re-setting state to “null” on the initial click of a button, and only displays the <svg> after two clicks. Here’s the code in the nav component:

import { useState } from "react";

const DisciplineNav = ({ setActive }) => {

  const [activeButton, setActiveButton] = useState(null);

  const handleButtonClick = (button) => {
    setActiveButton(button);
    console.log(button);
    console.log(activeButton);
  };

  const svgElement = (
    <svg
      ...
    </svg>
  );

  return (
    <nav>
      <button
        onClick={() => {
          handleButtonClick("Button1");
          setActive("Button1");
        }}
      >
        {activeButton === "Button1" ? (
          svgElement
        ) : (
          <img
            src="https://cdn..."
          />
        )}
        <br />
        <span>Button1</span>
      </button>
      <button
        onClick={() => {
          handleButtonClick("Button2");
          setActive("Button2");
        }}
      >
        {activeButton === "Button2" ? (
          svgElement
        ) : (
          <img
            src="https://cdn..."
          />
        )}
        <br />
        <span>Button2</span>
      </button>
    </nav>
  );
};

export default DisciplineNav;

When I console log the button, it’s always the name of the button I just clicked, as expected. But when I console log activeButton, it logs the previously clicked button on first click, null on second click, and finally logs the button being clicked on the third click. Though for some reason on second click when activeButton is “null” the svg is rendered, which I don’t understand since the conditional render should only show the svg when activeButton === the button that was just clicked. I believe the issue may have to do with how react asynchronously renders state, but I can’t pin down how to solve this.

Any help would be massively appreciated!

File path not found

Hi anyone can help me here. so the problem is that the webapp can’t find the file for example.

if HelloWorld.txt is inside First_Folder, the file can be viewed.

if HelloWorld.txt is inside First_Folder/Sub_First_Folder, the file is not found.

Details.

Folder is shared thru smb/samba

Folder is owned by the credentials used.

Folder is Permission is set to 0777

Folder path is “/var/www/html/First_Folder. Subfolder is inside First_Folder, /Sub_First_Folder

SUBFOLDERS are NOT DYNAMIC they are GENERATED so it CANNOT BE HARDCODED on the path. And Files are generated also inside those subfolders

Here is the sample Code.

public class FileModel { 
String filedes = System.getProperty("catalina.home") + File.separator + "First_Folder";
String filepath = "smb://192.168.1.1/html/First_Folder/;
String pathuser = "user";
String pathuser = "user1";  }

Hope anyone can help Thanks!

JavaScript Program Not Running

This code aims to generate a word problem based on a user specified variable to solve for of the acceleration formula. My code seems to run correctly on here, but when I open the file in Chrome, the HTML appears, but there is no working Javascript function. How would I get this code to work in Chrome?

// Function to generate a random question
function GenerateProblem() {
    // Get which variable the user wants to solve for
    var variable = document.getElementById("variable").value;
    var question = "";

    switch (variable) {
        // Create question if solving for acceleration
        case "A":
            question = "What is the acceleration when the initial velocity is 10 m/s, the final velocity is 30 m/s, and the time is 5 seconds?";
            break;
            // Create question if solving for final velocity
        case "V":
            question = "What is the final velocity when the acceleration is 5 m/s^2, the initial velocity is 0 m/s, and the time is 10 seconds?";
            break;
            // Create question if solving for initial velocity
        case "U":
            question = "What is the initial velocity when the acceleration is 2 m/s^2, the final velocity is 20 m/s, and the time is 8 seconds?";
            break;
            // Create question if solving for time
        case "T":
            question = "What is the time when the acceleration is 3 m/s^2, the initial velocity is 10 m/s, and the final velocity is 40 m/s?";
            break;
    }

    document.getElementById("question").innerHTML = question;
}
// Function to check the answer
function CheckAnswer() {
    // Get which variable the user wants to solve for 
    var variable = document.getElementById("variable").value;
    // Get the user's answer from the input field
    var answer = document.getElementById("answer").value;
    var result = "";

    // Check the answer using a switch statement
    switch (variable) {
        // If the answer is 'A', check if answer is right    
        case 'A':
            // Check if the answer is correct or incorrect
            if (answer === "4") {
                result = "Correct! The acceleration is 4 m/s^2.";
            }
            // Check if the input is not a number
            else if (isNaN(answer)) {
                result = "You entered an invalid input. Please enter a number or a decimal.";
            }
            // Output the incorrect statement
            else {
                result = "Incorrect. The acceleration is 4 m/s^2.";
            }
            break;
            // If the answer is 'V', check if answer is right    
        case 'V':
            // Check if the answer is correct or incorrect
            if (answer === "40") {
                result = "Correct! The final velocity is 40 m/s.";
            }
            // Check if the input is not a number
            else if (isNaN(answer)) {
                result = "You entered an invalid input. Please enter a number or a decimal.";
            }
            // Output the incorrect statement
            else {
                result = "Incorrect. The final velocity is 40 m/s.";
            }
            break;
            // If the answer is 'U', check if answer is right    
        case 'U':
            // Check if the answer is correct or incorrect
            if (answer === "0") {
                result = "Correct! The initial velocity is 0 m/s.";
            }
            // Check if the input is not a number
            else if (isNaN(answer)) {
                result = "You entered an invalid input. Please enter a number or a decimal.";
            }
            // Output the incorrect statement
            else {
                result = "Incorrect. The initial velocity is 0 m/s.";
            }
            break;
            // If the answer is 'T', check if answer is right    
        case 'T':
            // Check if the answer is correct or incorrect
            if (answer === "10") {
                result = "Correct! The time is 10 seconds.";
            }
            // Check if the input is not a number
            else if (isNaN(answer)) {
                result = "You entered an invalid input. Please enter a number or a decimal.";
            }
            // Output the incorrect statement
            else {
                result = "Incorrect. The time is 10 seconds.";
            }
            break;
    }

    document.getElementById("result").innerHTML = result;
}
<html>
</body>
<h2>Practice the Equation:</h2>
    <!-- Choose a variable section -->
    <p>What variable do you want to solve for?</p> <!-- Displays the instruction to choose a variable -->
    <select id ="variable">
    <option value ="A">Acceleration</option> <!-- Option for selecting the 'A' variable -->
    <option value ="V">Final Velocity</option> <!-- Option for selecting the 'V' variable -->
    <option value ="U">Initial Velocity</option> <!-- Option for selecting the 'U' variable -->
    <option value ="T">Time</option> <!-- Option for selecting the 'T' variable -->
    </select>
    <button onclick="GenerateProblem()">Generate Question</button> <!-- Button generates question -->
    <p id="question"></p> <!-- Placeholder for displaying the question -->
    
    <!-- Answer input section -->
    <input type="text" name="Text" placeholder="Enter answer..." id="answer" /> <!-- Text input field for the answer -->
    <button onclick = "CheckAnswer()">Answer</button> <!-- Button for checking the answer -->
    <p id ="result"></p> <!-- Placeholder for displaying the result -->
    </body>
    </html>

I have to use my script with document.getElementById(“”) multiple times

I’m making a layout where each box has to use a… id=”top1″, id=”top2″, id=”top3″, etc… so that when you click it goes to the top of the document, but I can’t find a way to make that happen, whow can I use only one function to do this without repeat it multiple times? I would be very grateful to hear a solution, thanks in advance

I Try to do something like this so that clicking on each box makes the document scroll to the top:

const top1 = document.getElementById("top1, top 2, top3")
   top1.addEventListener('click', () => {
         window.scrollTo(0, 0)
       })

How can I convert a base62 (**NOT BASE64**) string into a hexadecimal (base16) string that is around 25 characters long? [Web Development JS]

I’ve been trying to find something to do this for a while, and people have given me really good answers and they do work it’s just that Web Development JS doesn’t support the amount of characters that I need (~25).

The original script that I was given is below

function base62ToHex(base62) {
  base62Charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
  const valueOfBase62Char = new Map([...base62Charset].map((char, i) => [char, i]))

  let decimal = 0;
  for (const [i, char] of [...base62].reverse().entries()) {
    decimal += 62**i * valueOfBase62Char.get(char)
  }

  return decimal.toString(16);
};
console.log(base62ToHex("3VOjfwjyAWOKEYNEQOZ8Tsm5RM"))

You can see that running this will output

>> 6578616d706c68000000000000000000000000

Which is where the problem is. Obviously the zeros shouldn’t be there and it should be regular hex, but I’m guessing I gave it too much input. Is there a way that I could fix this?

Thanks 🙂