CodeByAkram

Angular Installation

Lets talk about the installation process of Angular, which tools and IDE is required for angular,

How to install Angular?

Which IDE is used for angular?

Before getting started with Angular you have to download IDE like Visual Studio Code, Eclipse, Atom etc.

We will be using Visual Studio Code in our tutorial.

Visual Studio Code is open source and it is light weight, easy to use. It has vast range of built-in code formatting, editing and refactoring features.

You can download Visual Studio Code from: https://code.visualstudio.com

Install Node.js

You should install node.js to run the angular application, node.js provides npm dependencies and required libraries.

You can download and install node.js from: https://nodejs.org/en/

After node.js installation you will see the below command prompt.

You should install node.js to run the angular application, node.js provides npm dependencies and required libraries

Angular CLI

Angular app is mainly developed and run by the CLI, that helps in creating new project, adding files and other task.

To install Angular globally run below command or go to Angular official site https://cli.angular.io/ 

1. Run npm install -g @angular/cli on Node.js command prompt. This command will globally install angular on your system.
CodeByAkram - Run npm install -g @angular/cli on Node.js command prompt

2. Now you need to create a new angular app/project by using this command ng new my-dream-app
CodeByAkram - command ng new my-dream-app

3. Go to project directory using cd my-dream-app command and hit ng serve command to run the angular application.
CodeByAkram - hit cd my-dream-app command and hit ng serve command to run the angular application.

4. Now open http://localhost:4200/ in browser and will see angular app running in browser.
CodeByAkram - will see angular app running in browser.



What is Angular

Code by Akram - What is Angular

Angular is a latest front-end framework of JavaScript, a development platform for building mobile and desktop web applications that makes you able to create reactive SPA (Single Page Applications). Angular framework is developed and main by Google. Angular framework is totally based on components forming a tree based on parent child component.

Angular comes with many features such as Component, Pipes, Directives, Forms, Dependency Injections etc.

SPA (Single Page Application)

Single page application or SPA is a website or web application which provides very extensive and fast experience to users. When user click on any menu, button or link it dynamically re-write the url instead of loading the entire page.


Angular

Angular Tutorial: Getting Started With Angular 


Welcome to Angular tutorials, in this tutorial i will cover all the topics of angular and after this tutorial you will be able to write the code of angular.

Angular Tutorial: Code By Akram


So lets start the tutorial step by step.

  1. What is Angular
  2. Installation
  3. Getting Started with Angular 
  4. Angular Features
  5. Differences between AngularJS and Angular
  6. Angular Directives
  7. Angular Pipes
  8. Angular Databinding
  9. Angular CLI
  10. Forms

Write a program to print first non repeated char in a string in Java.


Write a program to print first non repeated char in a string in Java.

We are using the HashMap to store the character as key and count of times it is repeated as value.


package com.string.codebyakram;

import java.util.HashMap;

public class NonReapingCahr {
 public static void main(String[] args) {
  String string = "hello";
  System.out.println(findNonReapingCahr(string));
 }

 public static char findNonReapingCahr(String string) {

  HashMap< character > countChar = new HashMap<>();

  for (int i = 0; i < string.length(); i++) {
   int count = countChar.get(string.charAt(i)) == null ? 1 : countChar.get(string.charAt(i)) + 1;
   countChar.put(string.charAt(i), count);
  }

  for (int i = 0; i < string.length(); i++) {
   if (countChar.get(string.charAt(i)) == 1) {
    return string.charAt(i);
   }
  }
  return '\0';

 }
}

How to create multiple log file using same log4j property file?

You can create multiple logs file by using same log4j properties file or you can send logs to multiple files by using same log4j file.

How to create multiple log file using same log4j property file?
Add this below to your log4j properties file.

log4j.rootLogger=TRACE, stdout
log4j.appender.dataLogs=org.apache.log4j.FileAppender
log4j.appender.dataLogs.File=logs/logFile1.log
log4j.appender.dataLogs.layout=org.apache.log4j.PatternLayout
log4j.appender.dataLogs.layout.ConversionPattern=%d [%24F:%t:%L] - %m%n
log4j.appender.reportsLog=org.apache.log4j.FileAppender
log4j.appender.reportsLog.File=logs/logFile2.log
log4j.appender.reportsLog.layout=org.apache.log4j.PatternLayout
log4j.appender.reportsLog.layout.ConversionPattern=%d [%24F:%t:%L] - %m%n

log4j.category.dataLogger=TRACE, dataLogs
log4j.additivity.debugLogger=false
log4j.category.reportsLogger=DEBUG, reportsLog
log4j.additivity.reportsLogger=false
Then configure the loggers in the code accordingly as shown below:

static final Logger debugLog = Logger.getLogger("dataLogger");
static final Logger resultLog = Logger.getLogger("reportsLogger");