Angular Overview

  • Angular Overview
  • Angular Setup – build your first project !
  • TypeScript Overview (coming soon)
  • Data binding
    • Event binding
    • Two way data binding
    • Interpolation
    • Property binding
  • First TypeScript Program
  • Variable Declaration
  • Type Assetions
  • Arrow Functions
  • Interfaces
  • Classes
  • Objects
  • Properties
  • Modules
  • Constructors
  • Access Modifiers

Angular Overview

Angular development framework is introduced by Google and currently millions of developers are using it. Releases started with AngularJs and then Angular2 , Angular4 and going on.AngularJS to Angular2 is major change.
Native support of Typescript from Microsoft make coding faster and maintainable. Native support from testing tools like Karma and Protractor making this as number 1 choice for dynamic web app automation.

What is NgModules in Angular?

NgModules are Angular class from Angular/core and helps to build modules in Angular application development.

For e.g. you wanted to develop a complex application where many modules are needed for easy implementation. Each module acts like mini application like cart module, creditCard module, etc.

so NgModules combines browser modules, other modules that you develop, decoration, bootstrap etc.

NgModules has declration , import, providers, bootstrap arrays.

Angular Setup

  1. install latest nodejs from nodejs.org
  2. Go to git bash/powershell ISE/CMD
  3. type following commands,
  4. install Angular : npm install -g @angular/cli
  5. ng new my-newweb-app
  6. ng g c myFirstModule (optional)
  7. go to project folder ” my-newweb-app ” via commandline itself
  8. type ng serve -o

Data Binding

Data binding makes the angular applications development very easy.

Data binding helps to do the data synchronization between the template(view/html) and class(typescript code)

There are 4 types of data binding in Angular and are following,

  • Event binding
  • Two way data binding
  • Interpolation
  • Property binding

What is Interpolation?

For interpolation, double curly braces are used in the template as below,

// app.html is the example for interpolation

<p>{{ name }}</p>  

and it stores the variables, then angular checks for the variable and updates the value assigned to the text.

The Typescript app.ts as below to display the name value to app.html.

// app.ts

@Component({
  templateUrl: 'app.html',
  selector: 'app-test',
})
export class AppComponent {
  name = 'Sharath C';
}

What is Property binding?

Property binding helps to set the property of a view element and it uses [] syntax as below

// app.html is the simple for the property binding.

<button [disabled]="buttonIsDisabled"></button>

TypeScript has to be coded as below to pass the property binding to view template. refer the app.ts as example for Typescript passing the property value

// app.ts
@Component({
  templateUrl: 'app.html',
  selector: 'app-test',
})
export class Component {
  buttonIsDisabled = true;
}

Building Angular Data Visualization using ngx-charts

ngx-charts is an open-source, declarative charting framework for Angular projects to build very simplified yet powerful reporting.

Angular will do all rendering and ngx-charts module supports different chart types like bar charts, pie charts, line charts, heatmap, treemap etc, altogether this combo will be useful for any Angular Data visualization projects.

What is Protractor testing framework

Protractor is a test framework mainly intended for Angular and AngularJS applications.

During Protractor execution you no longer need to add waits specifically to wait for your next test. Protractor can automatically execute the next step in your test the moment the webpage finishes pending transaction.

Protractor expected condition setting code sample below:

var expectedCondition = protractor.ExpectedConditions; var elementOne = element(by.id(‘UserId’)); browser.wait(expectedCondition.presenceOf(elementOne), 10000); expect(elememtOne.isPresent()).toBeTruthy();

Protractor vs Selenium

What is Dockerfile, image, container !

What is Dockerfile, Docker Image and container ?

When I started reading about Docker, I was confused about the relationship between Docker file vs docker image vs docker container !

Short answer to my question is:

  • Docker file is where I need to script my steps on what actions to be done before I make a docker image.
  • A sample docker file as below:
  • here below in the code, I am pulling JDK environment in line 1.
  • copying a java class to app directory in line 2,
  • setting app as working directory in line 3 for my docker container after i convert image to container.
  • Then finally running my app in line 4.
    FROM java:8-jdk-alpine
    COPY HelloWorld.class /app/
    WORKDIR /app
    ENTRYPOINT [“java”,”HelloWorld”]
  • Docker image is created using the above docker file by building it. (command : docker build -t myhelloworldapp . )
  • then spin up the container by using command : docker run myhelloworldapp

Docker Basics

Docker build command is used to generate docker images out of dockerfile line by line instructions.
Docker build is managed by docker daemon and not by CLI.

Docker build context can be a set of files in a specified directory or a git repository.

PATH is for directory and URL is for git

dockerignore file is used to ignore not required files.

Docker daemon runs each instructions from Dockerfile and commits each instructions to new Image.

Docker has build cache to speed up build process.

What is a Docker file, image, container !

What is Dockerfile, Docker image and Docker container?

When I started reading about Docker, I was confused about the relationship between Docker file vs docker image vs docker container !

  • Docker file is where I need to script my steps on what actions to be done before I make a docker image.
    a sample docker file as below: here below in the code,
  • I am pulling JDK environment in line 1.
  • Then copying a java class to app directory in line 2,
  • Then setting app as working directory in line 3 for my docker container after i convert image to container.
  • Then finally running my app in line 4.
    FROM java:8-jdk-alpine
    COPY HelloWorl.class /app/
    WORKDIR /app
    ENTRYPOINT [“java”,”HelloWorld”]
  • Docker image is created using the above docker file by building it. (command : docker build -t myhelloworldapp . )
    • Note: dockerfile generates read only layers during the image conversion. These read only layers are created based the dockerfile commandline instructions. Images are considered as executable packages and is predefined. Once it is made, it can not be changed unless new dockerfile is created.
  • then spin up the container by using command : docker run myhelloworldapp

What is Amazon S3

Amazon S3 enables companies to store massive amount of data in a secure way. S3 enables companies to store, retrieve data. 

Benefits:

  • High durability, availability, and scalability. S3 provides the most comprehensive compliance capabilities.
  • S3 allows  data storage up to 5 terabytes 
  • S3 provides a REST web services interface supporting any internet development tool kit.
  • S3 is available in any AWS region worldwide

 

 

 

 

Components of 3 tier architecture – Web server vs Application server vs Database server

  • Web server serves a web content (HTML and static content) over the HTTP protocol.
  • Application server is a container on which one can build and expose business logic and processes to client applications through various protocols like HTTP. Some cases it will have internal web server. Application server is heavy in terms of resource usage.
  • Database server refers to the back-end system of a database application using client/server architecture. The database server performs tasks such as data analysis, storage, data manipulation, archiving, and other non-user specific tasks

 

What is amazon aws

amazon-aws

Amazon Web Services (AWS) is a subsidiary of amazon.com. AWS currently provides more than 100 services and helps to setup high computing power, data storage, queuing, notification, machine learning, security, monitoring services available under AWS management console.

AWS Free Tier includes 750 hours of Linux and Windows t2.micro instances each month for one year as per Amazon website. Please check  //aws.amazon.com or //aws.amazon.com/ec2/ website for more accurate details and to confirm this.
 
The quickest way to learn AWS is by creating free tier aws account by clicking below link.
 

Different AWS cloud services?

VPC, EC2, S3, SNS, SQS,  ML, Developer tools, Analytics, IAM, Media services etc.
 

VPC

What is VPC?

VPC lets us to place our AWS resources in a virtual network the way we wanted. As you can see below VPC 3 tier architecture holds the resources and makes a secure communication between the internet and your VPC.
 
VPC 3 tier architecture using AWS cloud services as below:
 

Amazon VPC – 3 tier architecture

here in the above diagram, Availability zone 1 has Web server 1, App server 1 and DB server 1 orchestrated 

Similarly, Availability zone 1 has Web server 2, App server 2 and DB server 2 orchestrated. 

The load balancer is placed to handle the load between the servers

EC2

 

What is EC2?

EC2 stands for Amazon Elastic Compute Cloud is a cloud service provides secure, resizable compute capacity. In simple terms it allows us to setup a windows, Linux servers in 2-3 minutes.

How to setup a Windows server and Linux server?

Steps:
AWS Free account gives access to AWS console.
Create a free account and select Linux and Windows t2.micro instances under EC2 option under AWS Dashboard.
Follow the instructions and make sure select “Free Tier Eligible servers” and after learning the process, terminate servers as to avoid the usage of computing services and storage.
 
 
Benefits?
Quick – easy to create/terminate servers.
Inexpensive – Gives an option to select the matching server configurations to reduce cost.   
Secure – EC2 works along with VPC to provide high security with robust networking features.
Elastic Web scale computing – enable to increase/decrease server capacity in minutes by adding/removing 100 of servers simultaneously. 
Integration – easy integration to VPC, S3, RDS etc.
 
Please click on S3Amazon Simple Storage Service (Amazon S3) 
 
Please click on RDS Amazon Relational Database Service (Amazon RDS)
 
Please click on VPC– Amazon Virtual Private Cloud (Amazon VPC)
 
Please click on RPA Amazon Relational Database Service (Amazon RDS)

How to run selenium on linux server using Firefox binary

How to run selenium on linux server using Firefox binary

String Xport = System.getProperty(“lmportal.xvfb.id”, “:1”); // setup firefox binary to start Xvfb
final File ffPath = new File(System.getProperty(“lmportal.deploy.firefox.path”, “/usr/bin/firefox”));
FirefoxBinary ffBinary = new FirefoxBinary(ffPath);
ffBinary.setEnvironmentProperty(“DISPLAY”, Xport);

WebDriver driver = new FirefoxDriver(ffBinary, null);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get(“URL”);

How to handle the error popup on site security certificate is not trusted with chrome selenium python automation

How to handle the error popup on site security certificate is not trusted with chrome selenium python automation

For Chrome, add –ignore-certificate-errors in following code
options = webdriver.ChromeOptions()
options.add_argument(‘–ignore-certificate-errors’)
driver = webdriver.Chrome(chrome_options=options)
driver.get(‘URL’)

For the Internet Explorer, set acceptSslCerts desired capability as true:
capabilities = webdriver.DesiredCapabilities().INTERNETEXPLORER
capabilities[‘acceptSslCerts’] = True
driver = webdriver.Ie(capabilities=capabilities)
driver.get(‘URL’)

For Firefox, set accept_untrusted_certs as true

profile = webdriver.FirefoxProfile()
profile.accept_untrusted_certs = True
driver = webdriver.Firefox(firefox_profile=profile)
driver.get(‘URL’)