Saturday, 20 June 2020

Setting Environment for Angular

  source: different websites n following these work for me

Must have : user account with sudo privileges

you must familiar with these two commands refresh our local package

sudo apt-get update
sudo apt-get upgrade
  
sudo apt-get update
Then you probably want to make sure that your system is up to date:
sudo apt-get upgrade
It will list the packages wants to install, tell you how much space it needs for the download, and then get on with it when you tell it to. When you want to install some new software

Trying toinstall angular oops...

Mayank:~$ npm install -g @angular/cli
Command 'npm' not found, but can be installed with:

First need to install npm packages...

Angular, the Angular CLI, and Angular apps depend on features and functionality provided by libraries that are available as npm packages

Mayank:~$ npm - v
Command 'npm' not found, but can be installed with:
Mayank:~$ sudo apt install npm

Mayank:~$ node -v
Command 'node' not found, but can be installed with:
Mayank:~$ sudo apt install nodejs
Mayank:~$ node -v
Output
v8.10.0
Mayank:~$ npm - v
Output
5.6.0
 
The Angular CLI requires a minimum Node.js version of either v10.13 or v12.0.

Please update your Node.js version or visit https://nodejs.org/ for additional instructions. 

To update Node.js to 12 & NPM on Ubuntu 19.04

Mayank:~$ sudo curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
Mayank:~$ sudo apt-get install -y nodejs  
Mayank:~$ npm install -g @angular/cli
Mayank:~$ ng new my-angular-app 
 
Mayank:/opt/angularws$  ng new my-angular-app 
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? CSS
CREATE my-angular-app/README.md (1029 bytes)
CREATE my-angular-app/.editorconfig (274 bytes)
CREATE my-angular-app/.gitignore (631 bytes)
CREATE my-angular-app/angular.json (3630 bytes)
CREATE my-angular-app/package.json (1256 bytes)
CREATE my-angular-app/tsconfig.json (489 bytes)
CREATE my-angular-app/tslint.json (3125 bytes)
CREATE my-angular-app/browserslist (429 bytes)
CREATE my-angular-app/karma.conf.js (1026 bytes)
CREATE my-angular-app/tsconfig.app.json (210 bytes)
CREATE my-angular-app/tsconfig.spec.json (270 bytes)
CREATE my-angular-app/src/favicon.ico (948 bytes)
CREATE my-angular-app/src/index.html (298 bytes)
CREATE my-angular-app/src/main.ts (372 bytes)
CREATE my-angular-app/src/polyfills.ts (2835 bytes)
CREATE my-angular-app/src/styles.css (80 bytes)
CREATE my-angular-app/src/test.ts (753 bytes)
CREATE my-angular-app/src/assets/.gitkeep (0 bytes)
CREATE my-angular-app/src/environments/environment.prod.ts (51 bytes)
CREATE my-angular-app/src/environments/environment.ts (662 bytes)
CREATE my-angular-app/src/app/app-routing.module.ts (246 bytes)
CREATE my-angular-app/src/app/app.module.ts (393 bytes)
CREATE my-angular-app/src/app/app.component.css (0 bytes)
CREATE my-angular-app/src/app/app.component.html (25757 bytes)
CREATE my-angular-app/src/app/app.component.spec.ts (1083 bytes)
CREATE my-angular-app/src/app/app.component.ts (218 bytes)
CREATE my-angular-app/e2e/protractor.conf.js (808 bytes)
CREATE my-angular-app/e2e/tsconfig.json (214 bytes)
CREATE my-angular-app/e2e/src/app.e2e-spec.ts (647 bytes)
CREATE my-angular-app/e2e/src/app.po.ts (301 bytes)
✔ Packages installed successfully.

Mayank:/opt/angularws$ cd my-angular-app
Mayank:/opt/angularws/my-angular-app$ ng serve --open

Tuesday, 21 April 2020

Docker Part 0.1 (Source stackoverflow n docker.com)

Docker

There are three different setups that providing a stack to run an application on (This will help us to recognize what a container is and what makes it so much powerful than other solutions):
1) Traditional Servers(bare metal)
2) Virtual machines (VMs)
3) Containers
 
1) Traditional server stack consist of a physical server that runs an operating system and your application.
Advantages:
  • Utilization of raw resources
  • Isolation
Disadvantages:
  • Very slow deployment time
  • Expensive
  • Wasted resources
  • Difficult to scale
  • Difficult to migrate
  • Complex configuration
2) The VM stack consist of a physical server which runs an operating system and a hypervisor that manages your virtual machine, shared resources, and networking interface. Each Vm runs a Guest Operating System, an application or set of applications.
Advantages:
  • Good use of resources
  • Easy to scale
  • Easy to backup and migrate
  • Cost efficiency
  • Flexibility
Disadvantages:
  • Resource allocation is problematic
  • Vendor lockin
  • Complex configuration
3) The Container Setup, the key difference with other stack is container-based virtualization uses the kernel of the host OS to rum multiple isolated guest instances. These guest instances are called as containers. The host can be either a physical server or VM.
Advantages:
  • Isolation
  • Lightweight
  • Resource effective
  • Easy to migrate
  • Security
  • Low overhead
  • Mirror production and development environment
Disadvantages:
  • Same Architecture
  • Resource heavy apps
  • Networking and security issues.
- A platform  for (a)developing,(b)shipping & (c)running application
- Container based over virtualization technology
- Container management service Since March 2013
- Especially for AGILE methodology both development and testing activities are concurrent

Docker encapsulates an application with all its dependencies.

Adv:
Ability to reduce size.
Seamlessly working across different platforms.
Deploy container any where physical machine virtual machine and even in cloud platform  
scalable light weight



1. Lightweight

This is probably the first impression for many docker learners.
First, docker images are usually smaller than VM images, makes it easy to build, copy, share.
Second, Docker containers can start in several milliseconds, while VM starts in seconds.

2. Layered File System

This is another key feature of Docker. Images have layers, and different images can share layers, make it even more space-saving and faster to build.
If all containers use Ubuntu as their base images, not every image has its own file system, but share the same underline ubuntu files, and only differs in their own application data.

3. Shared OS Kernel

Think of containers as processes!
All containers running on a host is indeed a bunch of processes with different file systems. They share the same OS kernel, only encapsulates system library and dependencies.
This is good for most cases(no extra OS kernel maintains) but can be a problem if strict isolations are necessary between containers.



Docker, basically containers, supports OS virtualization i.e. your application feels that it has a complete instance of an OS whereas VM supports hardware virtualization. You feel like it is a physical machine in which you can boot any OS.

Tuesday, 12 September 2017

JAVA Begins...


Features in JDK 1.1

  • JDBC (Java Database Connectivity)
  • Inner Classes
  • Java Beans
  • RMI (Remote Method Invocation)
  • Reflection (introspection only)

Features in J2SE 1.2


Code named Playground and released on December 8, 1998.

  • Collections framework.
  • Java String memory map for constants.
  • Just In Time (JIT) compiler.
  • Jar Signer for signing Java ARchive (JAR) files.
  • Policy Tool for granting access to system resources.
  • Java Foundation Classes (JFC) which consists of Swing 1.0, Drag and Drop, and Java 2D class libraries.
  • Java Plug-in
  • Scrollable result sets, BLOB, CLOB, batch update, user-defined types in JDBC.
  • Audio support in Applets.

Features in J2SE 1.3

Code named Kestrel and released on May 8, 2000.
  • Java Sound
  • Jar Indexing
  • A huge list of enhancements in almost all the java area.

      Features in J2SE 1.4

      Code named Merlin and released on February 6, 2002 (first release under JCP).

      • XML Processing
      • Java Print Service
      • Logging API
      • Java Web Start
      • JDBC 3.0 API
      • Assertions()
      • Preferences API
      • Chained Exception
      • Internet protocol version 6 ( IPv6) Support
      • Regular Expressions
      • Image I/O API

      Features in J2SE 5.0

      Code named Tiger and released on September 30, 2004.

      • Generics
      • Enhanced for Loop
      • Autoboxing/Unboxing
      • Typesafe Enums
      • Varargs
      • Static Import
      • Metadata (Annotations)
      • Instrumentation

      Features in Java SE 6

      Code named Mustang and released on December 11, 2006.
      • Scripting Language Support
      • JDBC 4.0 API
      • Java Compiler API
      • Pluggable Annotations
      • Native PKI, Java GSS, Kerberos and LDAP support.
      • Integrated Web Services.
      • Lot more enhancements.

       Features in Java SE 7

      Code named Dolphin and released on July 28, 2011.
      • Strings in switch Statement
      • Type Inference for Generic Instance Creation
      • Multiple Exception Handling
      • Support for Dynamic Languages
      • Try with Resources
      • Java nio Package
      • Binary Literals, underscore in literals
      • Diamond Syntax
      • Automatic null Handling

      Features in Java SE 8

      Java 8 was released on 18 March 2014. The code name culture is dropped with Java 8 and so no official code name going forward from Java 8.
      • Lambda Expressions
      • Pipelines and Streams
      • Date and Time API
      • Default Methods
      • Type Annotations
      • Nashhorn JavaScript Engine
      • Concurrent Accumulators
      • Parallel operations
      • PermGen Error Removed
      • TLS SNI


      Friday, 12 May 2017

      Installing Wildfly 10.0.0 on ubuntu 16.04

      #1 Directory to download wildfly

      #root@mayank-VirtualBox:~# cd /opt
      #root@mayank-VirtualBox:/opt# ls
      #root@mayank-VirtualBox:/opt# wget http://download.jboss.org/wildfly/10.0.0.Final/wildfly-10.0.0.Final.tar.gz

      Downloading the wildfly latest version from official site using wget command



      #2 Once download is completed check #ls ,then extract the tar file by using the command.
      tar -xvzf wildfly-10.0.0.Final.tar.gz

      #root@mayank-VirtualBox:/opt# ls
      wildfly-10.0.0.Final.tar.gz
      #root@mayank-VirtualBox:/opt# tar -xvzf wildfly-10.0.0.Final.tar.gz






      #3 Rename that extracted directory and then change permission.

      #root@mayank-VirtualBox:/opt# ls
      wildfly-10.0.0.Final wildfly-10.0.0.Final.tar.gz
      #root@mayank-VirtualBox:/opt# mv wildfly-10.0.0.Final wildfly
      #root@mayank-VirtualBox:/opt# ls
      wildfly wildfly-10.0.0.Final.tar.gz



      #root@mayank-VirtualBox:/opt#
      #root@mayank-VirtualBox:/opt# chmod -R 755 wildfly
      #root@mayank-VirtualBox:/opt# ls
      wildfly wildfly-10.0.0.Final.tar.gz



      #4 Next go to “wildfly/bin/” directory and list the files.

      #root@mayank-VirtualBox:/opt# ls
      wildfly wildfly-10.0.0.Final.tar.gz
      #root@mayank-VirtualBox:/opt# cd wildfly/
      #root@mayank-VirtualBox:/opt/wildfly# ls
      appclient copyright.txt domain LICENSE.txt README.txt welcome-content
      bin docs jboss-modules.jar modules standalone
      #root@mayank-VirtualBox:/opt/wildfly# cd bin
      #root@mayank-VirtualBox:/opt/wildfly/bin# ls



      #root@mayank-VirtualBox:/opt/wildfly/bin# 

      #5 Next execute the “standalone.sh” script

      #root@mayank-VirtualBox:/opt/wildfly/bin# ./standalone.sh




      Use jdk 1.8 instead of jdk 1.7. MetaspaceSize is a new flag added for Metaspace in jdk 1.8.
      MetaspaceSize option is introduced in JDK 8.As mentioned in release notes, JDK8 is required for wildfly10, it wont run on JDK7.



      /usr/lib/jvm/java-8-oracle/
      #root@mayank-VirtualBox:/opt/wildfly/bin# cd
      #root@mayank-VirtualBox:~# java -version
      java version "1.8.0_121"
      Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
      Java HotSpot(TM) Client VM (build 25.121-b13, mixed mode)
      #root@mayank-VirtualBox:~# source /etc/environment
      #root@mayank-VirtualBox:~# echo $JAVA_HOME
      /usr/lib/jvm/java-8-oracle
      #root@mayank-VirtualBox:~# update-alternatives --config java
      There are 3 choices for the alternative java (providing /usr/bin/java).

      Selection Path Priority Status
      ------------------------------------------------------------
      0 /usr/lib/jvm/java-7-oracle/jre/bin/java 1082 auto mode
      1 /usr/lib/jvm/java-7-oracle/jre/bin/java 1082 manual mode
      2 /usr/lib/jvm/java-8-openjdk-i386/jre/bin/java 1081 manual mode
      * 3 /usr/lib/jvm/java-8-oracle/jre/bin/java 1081 manual mode

      Press <enter> to keep the current choice[*], or type selection number: 3
      #root@mayank-VirtualBox:~# JAVA_HOME="/usr/lib/jvm/java-8-oracle/" export JAVA_HOME
      #root@mayank-VirtualBox:~# echo $JAVA_HOME
      /usr/lib/jvm/java-8-oracle/
      #root@mayank-VirtualBox:/opt/wildfly/bin# cd
      #root@mayank-VirtualBox:~# java -version
      java version "1.8.0_121"
      Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
      Java HotSpot(TM) Client VM (build 25.121-b13, mixed mode)
      #root@mayank-VirtualBox:~# source /etc/environment
      #root@mayank-VirtualBox:~# echo $JAVA_HOME
      /usr/lib/jvm/java-8-oracle
      #root@mayank-VirtualBox:~# update-alternatives --config java
      There are 3 choices for the alternative java (providing /usr/bin/java).

      Selection Path Priority Status
      ------------------------------------------------------------
      0 /usr/lib/jvm/java-7-oracle/jre/bin/java 1082 auto mode
      1 /usr/lib/jvm/java-7-oracle/jre/bin/java 1082 manual mode
      2 /usr/lib/jvm/java-8-openjdk-i386/jre/bin/java 1081 manual mode
      * 3 /usr/lib/jvm/java-8-oracle/jre/bin/java 1081 manual mode

      Press <enter> to keep the current choice[*], or type selection number: 3
      #root@mayank-VirtualBox:~# JAVA_HOME="/usr/lib/jvm/java-8-oracle/" export JAVA_HOME
      #root@mayank-VirtualBox:~# echo $JAVA_HOME
      /usr/lib/jvm/java-8-oracle/
      #root@mayank-VirtualBox:~# cd /opt
      #root@mayank-VirtualBox:/opt# cd wildfly/
      #root@mayank-VirtualBox:/opt/wildfly# cd bin/
      #root@mayank-VirtualBox:/opt/wildfly/bin# ./standalone.sh
      =========================================================================

      JBoss Bootstrap Environment

      JBOSS_HOME: /opt/wildfly

      JAVA: /usr/lib/jvm/java-8-oracle//bin/java

      JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true

      =========================================================================

      00:23:20,509 INFO [org.jboss.modules] (main) JBoss Modules version 1.5.1.Final
      00:23:23,929 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
      00:23:24,585 INFO [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) starting
      00:23:35,905 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
      00:23:36,398 INFO [org.xnio] (MSC service thread 1-2) XNIO version 3.3.4.Final
      00:23:36,466 INFO [org.xnio.nio] (MSC service thread 1-2) XNIO NIO Implementation Version 3.3.4.Final
      00:23:37,252 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 38) WFLYCLINF0001: Activating Infinispan subsystem.
      00:23:37,491 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 46) WFLYNAM0001: Activating Naming Subsystem
      00:23:37,949 INFO [org.jboss.as.security] (ServerService Thread Pool -- 53) WFLYSEC0002: Activating Security Subsystem
      00:23:37,427 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 54) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.
      00:23:38,155 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 56) WFLYWS0002: Activating WebServices Extension
      00:23:38,172 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 44) WFLYJSF0007: Activated the following JSF Implementations: [main]
      00:23:38,313 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 37) WFLYIO001: Worker 'default' has auto-configured to 2 core threads with 16 task threads based on your 1 available processors
      00:23:38,955 INFO [org.jboss.as.connector] (MSC service thread 1-2) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.3.2.Final)
      00:23:39,193 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0003: Undertow 1.3.15.Final starting
      00:23:39,845 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 33) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
      00:23:40,192 INFO [org.jboss.as.security] (MSC service thread 1-2) WFLYSEC0001: Current PicketBox version=4.9.4.Final
      00:23:40,462 INFO [org.jboss.remoting] (MSC service thread 1-1) JBoss Remoting version 4.0.18.Final
      00:23:40,583 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0003: Undertow 1.3.15.Final starting
      00:23:40,888 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) WFLYJCA0018: Started Driver service with driver-name = h2
      00:23:41,791 INFO [org.jboss.as.naming] (MSC service thread 1-2) WFLYNAM0003: Starting Naming Service
      00:23:41,986 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0014: Creating file handler for path '/opt/wildfly/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
      00:23:42,251 INFO [org.jboss.as.mail.extension] (MSC service thread 1-2) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
      00:23:42,803 INFO [org.jboss.as.ejb3] (MSC service thread 1-1) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 16 (per class), which is derived from thread worker pool sizing.
      00:23:42,805 INFO [org.jboss.as.ejb3] (MSC service thread 1-1) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 4 (per class), which is derived from the number of CPUs on this host.
      00:23:42,844 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0012: Started server default-server.
      00:23:42,866 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0018: Host default-host starting
      00:23:43,996 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080
      00:23:44,705 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-1) WFLYDS0013: Started FileSystemDeploymentService for directory /opt/wildfly/standalone/deployments
      00:23:46,547 INFO [org.jboss.ws.common.management] (MSC service thread 1-2) JBWS022052: Starting JBossWS 5.1.3.Final (Apache CXF 3.1.4)
      00:23:47,861 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-1) ISPN000128: Infinispan version: Infinispan 'Mahou' 8.1.0.Final
      00:23:47,869 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-2) ISPN000128: Infinispan version: Infinispan 'Mahou' 8.1.0.Final
      00:23:48,216 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
      00:23:49,436 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
      00:23:49,449 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
      00:23:49,451 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) started in 32568ms - Started 267 of 553 services (371 services are lazy, passive or on-demand)


      # Now the wildfly is running on port number 9990. We can access wildfly from browser by using following url.

      http://127.0.0.1:9990




      Add user for Wildfly
      #Just open the terminal then kill the current process. Run “add-user.sh” script file
      #root@mayank-VirtualBox:/opt/wildfly/bin# ./add-user.sh


      # Now again run the “standalone.sh” script file.

      #root@mayank-VirtualBox:/opt/wildfly/bin# ./standalone.sh
      =========================================================================

      JBoss Bootstrap Environment

      JBOSS_HOME: /opt/wildfly

      JAVA: /usr/lib/jvm/java-8-oracle/bin/java

      JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true

      =========================================================================

      # Open the browser and type the following http://127.0.0.1:9990/console.


      Authentication Pop-up will open.


      # Enter the added user :Username\Password 


      # Now you will be directed to Home page




      # For deploying click on deployments ,redirect to deployment page.



      # Click on Add Button a pop-up will open ,asking for new deployment/creating an unmanaged deployment.



      # Select New Deployment  then NEXT>> 



      # Select the correct directory and chose the file to be deployed.


      # LogOut