Monday, September 5, 2022

version

 war {

    dependsOn('generateBuildVersion')

    archiveName 'lms.war'

    from('../frontend/dist')

}


task generateBuildVersion {

    doLast {

        def jsonFile = file('../frontend/src/app/version.json')

        def parsedJson = new groovy.json.JsonSlurper().parseText(jsonFile.text)

        parsedJson.versionNumber = parsedJson.versionNumber + 0.01

        parsedJson.releaseDate = Date.newInstance().format('MM/dd/yyyy')

        def jsonStr = JsonOutput.toJson(parsedJson)

        def jsonData = JsonOutput.prettyPrint(jsonStr)

        jsonFile.write(jsonData)

    }

}




{

    "versionNumber": 1.03,

    "releaseDate": "09/01/2022"

}



src/app/version.json


LoginComponent.ts


  versionNumber: number;

  releaseDate: string;

  

  

  constructor(

    private notification: NotificationService

  ) {

    this.versionNumber = this.sessionService.versionNumber;

    this.releaseDate = this.sessionService.releaseDate;

  }

  

  

  

SessionService.ts



  versionNumber: number;

  releaseDate: string;

  

    constructor() {

      this.versionNumber = +version.versionNumber;

    this.releaseDate = version.releaseDate;

  }


  LoginComponent.html

  

                <div>

                <p class="alignleft">{{ releaseDate }}</p>

                <p class="alignright">{{ versionNumber }}</p>

              </div>

  

  

package json

{

  "name": "lms-web",

  "version": "1.0.0",

  "scripts": {

    "ng": "ng",

    "start": "ng serve --proxy-config proxy.conf.json --live-reload false --port 4200",

    "build": "ng build --prod --aot --build-optimizer --common-chunk --vendor-chunk --optimization --progress --base-href /projname/",

    "test": "ng test --code-coverage --watch false",

    "lint": "ng lint",

    "lintcs": "ng lint --format checkstyle > checkstyle/frontend.xml",

    "e2e": "ng e2e --base-href /projname/ --aot --webdriver-update false --proxy-config proxy.conf.json"

  },

  "private": true,

  "dependencies": {

    "@angular/animations": "~11.2.4",

  },

  "devDependencies": {

    "@angular-devkit/build-angular": "~0.1102.3",

  }

}


 

intelli j short cut keys

 

Ctrl + Shift + F

Search a word in All files in a project

Ctrl + Shift + N

Search for a file by name

Ctrl + N

Open any class quickly

Ctrl + E

Open recent files

Ctrl + Alt + à

Navigate further to the files

Ctrl + Alt + ß

Navigate to the previous files

Ctrl + F3

Navigate to occurrence in forward direction

Shift + F3

Navigate to occurrence in the backward direction

Ctrl + H

Type hierarchy / Class Hierarchy

Ctrl + Alt + L

Format Code inside a file

Alt + Enter

To import the classed from jars

Ctrl + Alt + O

Optimize imports (never import package/class, Only optimize)

Ctrl + F12

Open methods in pop up with All methods and variables

 

 

 

 

 

F8

Run/execute      // This will jump to another breakpoint

F10

Step Over            // This can be used to step by step line debugging

F11

Step Into              // This will go inside method call

F12

Close DevTools/end debugging

Ctrl + p

Open source code file in DevTools

 

Thursday, September 1, 2022

primeng appendto

 <div class="container-fluid" #parentDiv>

  <div class="row">


    <mat-toolbar color="primary">


      <span (click)="openHomePage($event)">Student management System</span>

      <span class="example-spacer"></span>


      <p-dropdown [options]="listItems" [(ngModel)]="selectedItem" [appendTo]="parentDiv" placeholder="Select Year Period"

                  (onChange)="valueOnChange($event)" dataKey="value">

        <ng-template let-item pTemplate="selectedItem">

          <div class="option-wrapper">

            <span class="option-value">{{selectedItem}}</span>&nbsp;

          </div>

        </ng-template>


        <ng-template let-object pTemplate="item">

          <div class="option-wrapper">

            <span class="option-value">{{object.value}}</span>&nbsp;

            <mat-icon class="option-icon">{{object.label}}</mat-icon>

          </div>

        </ng-template>

      </p-dropdown>

      </mat-toolbar>


  </div>

</div>

git command

 Git Commands

git reset --hard  ==> To remove all the modified files from stage

Create a local branch and commit to it

git checkout -b your-branch-name

git add .

git commit -m "Your Message"

Push your branch to your remote (server)

git push -u origin your-branch-name

$ git push

fatal: The current branch your-branch-name has no upstream branch.

To push the current branch and set the remote as upstream, use


git push --set-upstream origin your-branch-name


**You need to map your branch with the upstream

git push --set-upstream origin your-branch-name

Ruby Basics

Basics of Ruby   Start Ruby interpret On terminal just type rib ruby_docs $ irb 3 . 0 . 0 : 001 > name = "This is the first ...