Skip to content

ROCKY-SAM/LearningHub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

LearningHub

Next to watch

Blogs

CICD

Building and Deploying your Code with Azure Pipelines

Architecture

API

GIT

.NET

Single-responsibility principle (SRP)

The single-responsibility principle (SRP) is a computer-programming principle that states that every module, class or function in a computer program should have responsibility over a single part of that program's functionality, and it should encapsulate that part. All of that module, class or function's services should be narrowly aligned with that responsibility.

TypeScript complain “has no initializer and is not definitely assigned in the constructor” about constructors by returning constructed object

strictPropertyInitialization forces you to initialize all properties that are not optional in the constructor of the class. This check can be useful as it ensures that you don't get unexpected uninitialized properties. There are several ways to get around the error, the first two are the general way to do it, in your case only the last on applies (I include all for completeness):

Initialize the field

If you define the property as boolean if should be true or false initialize it when you declare the field or initialize it in the constructor:

class MyClass {
  someField: boolean = false;
  constructor() {
    return { someField: true };
  }
}

Make the field optional

If the field can be undefined, you should mark this in the field declaration either by using ? or typing the field as undefined|boolean

class MyClass {
    //someField?: boolean;
    someField: boolean | undefined;
    constructor() {
        return { someField: true };
    }
}

Use a not null assertion

In your case since in the constructor you are actually not initializing the current object (this) but returning a new one, you can tell the compiler it is wrong about the error and use a not null assertion. This assertion is specifically introduced because there are limitations in strictPropertyInitialization checks and sometimes the compiler gets it wrong. For those cases you can override what the compiler thinks, but you have to be explicit about it:

class MyClass {
    someField!: boolean;
    constructor() {
        return { someField: true };
    }
}

Creating local repository:

Initially user may have created the local git repository.
sh $ git init

  • This will make the local folder as Git repository,Link the remote branch:- Now challenge is associate the local git repository with remote master branch.
    sh $ git remote add RepoName RepoURL usage: git remote add []
  • Test the Remote
    sh $ git remote show --->Display the remote name
    sh $ git remote -v --->Display the remote branches\
  • Now Push to remote
    sh $git add . ----> Add all the files and folder as git staged
    sh $git commit -m "Your Commit Message" - - - >Commit the message
    sh $git push - - - - >Push the changes to the upstream\

primeNG

Question : PrimeNG Table filterGlobal TS2339: Property 'value' does not exist on type 'EventTarget'
Answer : Your HTML input should be like this
<input pInputText type="text" (input)="applyFilterGlobal($event, 'contains')" placeholder="Filter" /> and in your TS do this

applyFilterGlobal($event: any, stringVal: any) {
    this.dt!.filterGlobal(($event.target as HTMLInputElement).value, 'contains');
  }

if you get error for dt add below line

import { ViewChild } from '@angular/core';
import  {Table} from 'primeng/table';
@ViewChild('dt') dt: Table | undefined;

image

image

GitLens & GitGraph Below snapshot highlights how gitlens is showing commit over time image And the below picture is for the the amazing vivid GitGraph image

image

Update a user

var url = "http://localhost:8080/api/v1/users";

var data = {};
data.firstname = "John2";
data.lastname  = "Snow2";
var json = JSON.stringify(data);

var xhr = new XMLHttpRequest();
xhr.open("PUT", url+'/12', true);
xhr.setRequestHeader('Content-type','application/json; charset=utf-8');
xhr.onload = function () {
    var users = JSON.parse(xhr.responseText);
    if (xhr.readyState == 4 && xhr.status == "200") {
        console.table(users);
    } else {
        console.error(users);
    }
}
xhr.send(json);

Delete a user

var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest();

xhr.open("DELETE", url+'/12', true);
xhr.onload = function () {
    var users = JSON.parse(xhr.responseText);
    if (xhr.readyState == 4 && xhr.status == "200") {
        console.table(users);
    } else {
        console.error(users);
    }
}
xhr.send(null);

Azure DevOps: Resolving 'Conflict Prevents Automatic Merging'

https://www.shawnmcgough.com/conflict-prevents-automatic-merging/

What Is ADA Compliance? (And What Does ADA Compliance Mean for Your Website?)

https://www.webfx.com/blog/marketing/what-is-ada-compliance/

dynamic var in i18n message

image

Full calendar buttonText on 'today' view not updating

https://stackoverflow.com/questions/56941545/buttontext-on-today-view-not-updating

image

  //Inhertiance example
class person{
    constructor(name,job){
        this.name = name;
        this.job =job;
    }
    //method to return the string
    toString(){
        return (`Name of person: ${this.name}  --job ${this.job}`   );
    }
}
class student extends person{
    constructor(name,job,id){
        //super keyword to for calling above class constructor
        super(name,job);
        this.id = id;
    }
    toString(){
        return (`${super.toString()},Student ID: ${this.id}`);
    }
}
let student1 = new student('Sameera','developer',22);
console.log(student1.toString());
unamePattern = "^[a-z0-9_-]{8,15}$";
pwdPattern = "^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).{6,12}$";
mobnumPattern = "^((\\+91-?)|0)?[0-9]{10}$"; 
emailPattern = "^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$";

The “fatal: refusing to merge unrelated histories” Git error occurs when two unrelated projects are merged (i.e., projects that are not aware of each other’s existence and have mismatching commit histories).

image Consider the following two cases that throw this error:

You have cloned a project and, somehow, the .git directory got deleted or corrupted. This leads Git to be unaware of your local history and will, therefore, cause it to throw this error when you try to push to or pull from the remote repository.

You have created a new repository, added a few commits to it, and now you are trying to pull from a remote repository that already has some commits of its own. Git will also throw the error in this case, since it has no idea how the two projects are related.

Solution The error is resolved by toggling the allow-unrelated-histories switch. After a git pull or git merge command, add the following tag:

git pull origin master --allow-unrelated-histories

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published