23 September, 2022

Angular 14 function inside callback value not updating view

 Angular 14 function inside callback value not updating view

I've written a function, inside of which I'm calling a callback function. After the callback answer, I updated a string variable, but my view was not updated.

Old Code


import { Component, HostListener, OnInit, ViewChild } from '@angular/core';

@Component({
  selector: 'app-appointment',
  templateUrl: './appointment.component.html',
  styleUrls: ['./appointment.component.css']
})


export class ViewComponent {

        getAddress : string;
        public totlaBalance : string;

        ngOnInit():void{
             var self = this;
             fetchData(this.getEmployees,function(error,res){
                 console.log(res);
                 self.totlaBalance = res;

            });
        }
}


Solution 1 (new Code):

Just need to use ArrowFunction (()=>) and  call the method ChangeDetectionRef as shown below,



import { ChangeDetectorRef, Component, HostListener, OnInit, } from '@angular/core';

@Component({
  selector: 'app-appointment',
  templateUrl: './appointment.component.html',
  styleUrls: ['./appointment.component.css']
})


export class ViewComponent {

        getAddress : string;
        public totlaBalance : string;

        constructor(private ref: ChangeDetectorRef){}  

        ngOnInit():void{
             var self = this;
             fetchData(this.getEmployees,function(error,res){
                 console.log(res);
                 self.totlaBalance = res;
                 self.ref.detectChanges();

            });
        }
}


Solution 2: NgZone

An injectable service for executing work inside or outside of the Angular zone.


The most common use of this service is to optimize performance when starting a work consisting of one or more asynchronous tasks that don't require UI updates or error handling to be handled by Angular. Such tasks can be kicked off via runOutsideAngular and if needed, these tasks can reenter the Angular zone via run.

constructor(private _ngZone: NgZone) {}
// Loop outside of the Angular zone
  // so the UI DOES NOT refresh after each setTimeout cycle
  processOutsideOfAngularZone() {
    this.label = 'outside';
    this.progress = 0;
    this._ngZone.runOutsideAngular(() => {
      this._increaseProgress(() => {
        // reenter the Angular zone and display done
        this._ngZone.run(() => { console.log('Outside Done!'); });
      });
    });
  }

16 September, 2022

windows 10: robocopy example

 

Robocopy, for "Robust File Copy", is a command-line directory and/or file replication command for Microsoft Windows. Robocopy functionally replaces Xcopy, with more options


Robocopy

Example: 

Fastest and easy way to copy a large amount files and folder

Open the command prompt in ADMIN Mode and run the below command, make sure to use your own file paths.

Command:

robocopy c:\temp\source c:\temp\destination /MIR

14 September, 2022

Error: Module not found: Error: Can't resolve '@angular/localize/init' in Angular 14

Error:  

./src/polyfills.ts:59:0-32 - Error: Module not found: Error: Can't resolve '@angular/localize/init' in 'C:\source\repos\Project1\Project1\ClientApp\src'  

× Failed to compile.


How to Fix it?

This error occurred due to a missing package in the package.json file.

Installing the package and importing it into polyfills.ts are both required. Running is the fastest way to do this.

npm install @angular/localize --save


Finally, it works here is the result:





30 August, 2022

Angular Error: Schema validation failed with the following errors: Data path "" should NOT have additional properties(project)

 

Solutions:


When I was getting version error issues, the Following command worked for me:

First, run:

    npm update

Second run:

    ng update

Third run: (It will update all the mismatching packages)

    ng update --all --force


OR
Run this command which will  Perform a basic update to the current stable release of the core framework
 and CLI by running the following command.

ng update @angular/cli@^<major_version> @angular/core@^<major_version>

28 August, 2022

exceeded maximum budget. Budget 4.00 kB was not met by 4.54 kB with a total of 8.54 kB.

Angular Error

Error:  “exceeded maximum budget. Budget 4.00 kB was not met by 14 bytes with a total of 4.01 kB” Code 

Error: table.component.css exceeded maximum budget. Budget 4.00 kB was not met by 4.54 kB with a total of 8.54 kB.


How to Fix It? Here is Answer: 

go to your angular.json file and increase the default setting, here  original value, is in a red color  new value is in green color






04 August, 2022

Amazon 14 leadership principles interview questions

We have compiled a small list of interview questions that are used in Amazon interviews to evaluate applicants on each of these 14 leadership characteristics after speaking with Amazon recruiters and candidates. Please be aware that the interview questions listed here are not all-inclusive and just serve as an example of the territory that your Amazon interview questions would be probing. With the help of this list of interview questions, you may refine your long list of accomplishments and choose your star stories—those that most effectively illustrate the Amazon leadership principles you want to emphasize. Recognize that every step of the Amazon Interview procedure was designed to systematically describe leadership qualities.

 The candidates applying for AWS roles should also make note that these 14 principles are also the AWS leadership principles, and it would be critical for their candidature to pay heed to these.

Choose a few of these leadership principles that mean the most to you and focus on them in an obvious way. Speak in them. Speak to them. Mention them in your stories.

1. Customer Obsession

Leaders start with the customer and work backward. They work vigorously to earn and keep customer trust. Although leaders pay attention to competitors, they obsess over customers.

Amazon Interview Questions on Customer Obsession

Who was your most challenging customer?

Give me an example of a time when you did not meet a client’s expectations. What happened, and how did you attempt to rectify the situation?

When you’re working with a large number of customers, it’s tricky to deliver excellent service to them all. So how do you go about prioritizing your customers’ needs?

Tell the story of the last time you had to apologize to someone.

2. Ownership

Leaders are owners. They think long-term and don’t sacrifice long-term value for short-term results. They act on behalf of the entire company beyond just their own team. They never say That’s not my job

Amazon Interview Questions on Ownership

Tell me about a time when you had to leave a task unfinished.

Tell me about a time when you had to work on a project with unclear responsibilities.

3. Invent and Simplify

Leaders expect and require innovation and invention from their teams and always find ways to simplify. They are externally aware, look for new ideas from everywhere, and are not limited by “not invented here”. As we do new things, we accept that we may be misunderstood for long periods of time

Amazon Interview Questions on Invent and Simplify

Tell me about a time when you gave a simple solution to a complex problem.

Tell me about a time when you invented something.

An excellent example of this is the Amazon flywheel.

Amazon Flywheel is a beautiful demonstration of how a business model can be constructed to be a self-perpetuating machine. You feed any part of the Amazon flywheel and the entire business model gets benefits. It is a simple but brilliant example of Invent & Simplify.


4. Are Right, A Lot

Leaders are right, a lot. They have strong judgment and good instincts. They seek diverse perspectives and work to disconfirm their beliefs.

Amazon Interview Questions on Are Right, A Lot

Tell me about a time when you were wrong

Tell me about a time when you had to work with incomplete data or information.

5. Learn and Be Curious

Leaders are never done learning and consistently seek to improve themselves. They are curious about new possibilities and act to explore them.

Amazon Interview Questions on Learn and Be Curious

Tell me about a time when you influenced a change by only asking questions.

Tell me about a time when you solved a problem through just superior knowledge or observation.

6. Hire and Develop The Best

Leaders are responsible for raising the performance bar with every hire and promotion. They recognize exceptional talent and will move them throughout the organization. Leaders develop leaders and take their role in coaching others seriously. We work on behalf of our people to invent mechanisms for development like Career Choice.

Amazon Interview Questions on Hire and Develop The Best

Tell me about a time when you mentored someone

Tell me about a time when you made a wrong hire. When did you figure it out, and what did you do?

7. Insist on the Highest Standards

Leaders have relentlessly high standards – many people may think these standards are unreasonably high. However, leaders are continually raising the bar and driving their teams to deliver high-quality products, services, and processes. In addition, leaders ensure that defects do not get sent down the line and that problems are fixed, so they stay fixed.

Amazon Interview Questions on Insist on the Highest Standards

Tell me about a time when you couldn’t meet your own expectations on a project.

Tell me about a time when a team member didn’t meet your expectations on a project.

8. Think Big

Thinking small is a self-fulfilling prophecy. Instead, leaders create and communicate a bold direction that inspires results. They think differently and look around corners for ways to serve customers.

Amazon Interview Questions on Think Big

Tell me about your proudest professional achievement

Tell me about a time when you went way beyond the scope of the project and delivered.

9. Bias for Action

Speed matters in business. Many decisions and actions are reversible and do not need extensive study. We value calculated risk-taking.

Amazon Interview Questions on Bias for Action

Describe a time when you saw some problem and took the initiative to correct it rather than waiting for someone else to do it

Tell me about a time when you took a calculated risk.

Tell me about a time you needed to get information from someone who wasn’t very responsive. What did you do?

10. Frugality

Accomplish more with less. Constraints breed resourcefulness, self-sufficiency, and invention. There are no extra points for growing headcount, budget size, or fixed expenses.

Amazon Interview Questions on Frugality

Tell me about a time when you had to work with limited time or resources.

11. Earn Trust

Leaders listen attentively, speak candidly, and treat others respectfully. They are vocally self-critical, even when doing so is awkward or embarrassing. Leaders do not believe their or their team’s body odor smells of perfume. Instead, they benchmark themselves and their teams against the best.

Amazon Interview Questions on Earn Trust

What would you do if you found out that your closest friend at work was stealing?

Tell me about a time when you had to tell someone a harsh truth.

12. Dive Deep

Leaders operate at all levels, stay connected to the details, audit frequently, and are skeptical when metrics and anecdotes differ. No task is beneath them.

Amazon Interview Questions on Dive Deep

Give me two examples of when you did more than what was required in any job experience.

Tell me about something that you learned recently in your role.

13. Have Backbone; Disagree and Commit

Leaders are obligated to respectfully challenge decisions when they disagree, even when doing so is uncomfortable or exhausting. Leaders have conviction and are tenacious. They do not compromise for the sake of social cohesion. Once a decision is determined, they commit wholly.

Amazon Interview Questions on Have Backbone; Disagree and Commit

Tell me about a time when you did not accept the status quo

Tell me about an unpopular decision of yours.

Tell me about a time when you had to step up and disagree with a team member's approach.

If your direct manager was instructing you to do something you disagreed with, how would you handle it?

14. Deliver Results

Leaders focus on the crucial inputs for their business and deliver them with the right quality and timely fashion. Despite setbacks, they rise to the occasion and never settle.

Amazon Interview Questions on Deliver Results

By providing an example, tell me when you have had to handle a variety of assignments. Describe the results.

What is the most challenging situation you have ever faced in your life? How did you handle it?

Give me an example of a time when you were 75% of the way through a project, and you had to pivot strategy–how were you able to make that into a success story?

Our final piece of advice is to refrain from attempting to manipulate the Amazon interview process by saying only what you believe they want to hear. Don't makeup tales to match the picture you wish to present. This mindset, more often than not, gives the impression that the candidate is inconsistent or "unreal." But more significantly, by doing so, you miss out on a crucial chance to present the authentic version of yourself. Your laundry list already includes every narrative you could possibly need. It is necessary to get a deeper understanding of oneself and to create these narratives in a way that highlights your leadership values and accomplishments.

We wish you all the best in your Amazon interview process!

19 July, 2022

The top 10 free most useful websites in the world - Powerful websites you should know

The top 10 free most useful websites in the world


1. TinyWOW:

a tool that solves your file problem. Get free versions of tools you usually pay for. Includes free versions of:

• Adobe Acrobat Pro (PDF editor)
• Photoshop (image editor)



2. Jenni AI:

Research, write, and everything in between. Jenni is the ultimate content assistant that you can take with you while writing your blogs, copy, or anything else. An AI auto-writing tool that automatically writes your essays and emails for you.

3. Temp-mail


Temp-mail gives you a temporary email and inbox to help you sign up for websites and avoid all the spam down the line.

4. Quillbot:

 is a free email service that allows receiving email at a temporary address that self-destructed after a certain time elapsesQuillbot is a paraphrasing website that rewrites everything as plagiarism-free text.

Super handy if you're in college.

5. Loom

A nifty little tool that lets you record your screen and yourself at the same time, so you can explain things just the way you want to. Record quick videos of your screen and cam. An essential tool for hybrid workplaces.


6. Otter AI

Have trouble taking notes in meetings? Otter records your meetings and automatically transcribes them to text. Automatically capture meeting notes. Find the information you need. Keep everyone informed and aligned.

7. Pexels

An awesome website that lets you download high-quality stock images for all your work and personal projects.

8. Removebg


An insane tool that lets you easily remove the background from your image and add in any background you like.

9. Convertio


This website lets you convert files to any format you want for free.

10. Microcopy

An awesome resource that helps you find persuasive headlines and slogans for your emails, websites, and much more.

11. Canva

Canva makes it easy to create professional designs and share or print them.