Powered By Blogger

Tuesday, May 23, 2017

Maven

Maven



What is Maven?

Maven is a software management and comprehension tool based on the concept of Project Object Model (POM) which can manage project build, reporting, and documentation from a central piece of information. 

Why Maven is used?

  • A standard way to build the projects
  • A clear definition of what the project consisted of
  • An easy way to publish project information and a way to share JARs across several projects
What is POM?

As a fundamental unit of work in Maven, POM is an XML file that contains information about project ad configuration details used by Maven to build the project.

Maven's Objectives

  • Making the build process easy
  • Providing a uniform build system
  • Providing quality project information
  • Providing guidelines for best practices development 
  • Allowing transparent migration to new features
How to install maven,

prerequisites

  • Make sure JDK is installed, and "JAVA_HOME" variable is added as windows environmental variable.
Download Maven

  • Download Maven by visiting the web site https://maven.apache.org/download.cgi 
  • Add both M2_HOME and MAVEN_HOME variables in the windows environment, and point it to your maven folder.  
  • Open command prompt and type mvn -version to check if maven installed correctly. 

Creating First Maven Project

  • Create a folder for the maven project and open the folder using command prompt
  • Type as mvn archetype:generate 

  • When you hit enter there will be list of project that you can create. You just have to enter the number of it and the respective project will be created. Else you can just hit enter and a sample project will be created. 

  • There will be a list displayed. These are the different version of maven. we will select the latest version which is 6
  • Enter the groupid, artifaceId, version, package


  • Now your Maven Project is created successfully 



Monday, May 15, 2017

REST services

REST Services


Today the Internet connectivity is increasing the day by day. Earlier the connectivity was limited only to the computers that were using same hardware and software technologies. But this limited functionality was insufficient to fulfill the ever-growing needs. So there was necessity of such kind of a system can allow inter platform communications, or I can say that the communications should be independent of the Operating Systems and Programming Languages. To address this issue the concept of web services was introduced.





A web service has list of methods and procedures that can be used by any of the applications irrespective of the programming languages, OS, hardware used to develop them. Any type of applications can access the functionality provided by the web service and such functionality is called web methods or web APIs.
A web service allows the communication via internet standards XML and HTTP.Thus I, can say that any computer that has an access to the internet can have access to the web service. Once the web service is deployed on the Internet it can be used by any of the clients using HTTP and XML. There can be a web service, which provide the details of any person based on its social security number. This service can be readily available to any clients who need to access it.
The fundamental requirements for a web service are listed as under.
  • A common format for data representation so that the communication or data exchange should be platform agnostic.
  • A standard specification for sending messages to web service and receiving responses from web services.
  • A standard format to describe a web service.
  • A standard for publishing and discovering web services enabling applications to access them.
The various requirements described above are based on the open standards such as XML, SOAP, WSDL and UDDI.
  • Since XML (eXtensionable Markup Language) is considered as cross platform standard for transferring data over Internet because it is understand by any hardware and software. The XML also describes the data.
  • In order to communicate there must be a common protocol to exchange the information. SOAP (Simple Object Access Protocol) is Microsoft implementation, responsible for transporting messages between network applications and includes protocols such as HTTP, HTTPS, SMTP and MIME. It uses the XML for information exchange. The messages received or returned by SOAP are called Request and Response envelopes. These are strictly based on XML and described in WSDL for that web service.
  • WSDL (Web Services Description Language) describes, publicly available methods provided by the web service. The information it provides such as the name of methods, parameters passed to the web services and the values it returns. It is a standard for describing the web service methods. WSDL is a XML format that is used to describe web services.The following are the elements of WSDL.


Sunday, May 7, 2017

Selinum IDE

Selenium IDE






Selenium IDE is an integrated development environment for Selenium scripts. It is implemented as a Firefox extension, and allows you to record, edit, and debug tests.

Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It also provides a test domain-specific language (Selenese) to write tests in a number of popular programming languages, including C#, Groovy, Java, Perl, PHP, Python, Ruby and Scala.

Selenium IDE is the most simplest and easiest of all the tools within the Selenium Package. The record and playback feature makes it exceptionally easy to learn with minimal knowledge of any programming language. The disadvantages of IDE are in reality not disadvantages, but just limitations to what the IDE could achieve. These limitations can be overcome by using Selenium RC or Web Driver.

Advantages
  • Selenium IDE is very easy to use.
  • It has the capability to convert the test to different programming languages such as html, java etc
  • Programming language experience is not required for Selenium IDE
  • Selenium IDE provides Logging capabilities using file login plug-in.
  • In Selenium IDE, user can debug and set breakpoints
  • Selenium IDE is flexible for the users.
Disadvantage
  • Selenium IDE is Firefox plugin, thus its support is limited to Firefox only
  • It will not support iteration and conditional statement
  • Selenium IDE doesn't support error handling
  • Doesn't support test script grouping
  • Selenium IDE do not support Database testing

How to add Selenium to your web browser?
  • Open Fire Fox web browser
  • Install Selenium IDE add on 
  • Open Selenium by navigating to  tools -> Developer -> Selenium IDE
Lets see how to navigate to a web page using Selenium

  • Open Selenium  


  • Click Record Button
  • Navigate to the page you need to go
Ex: I will first go to google.com and then type Colombo and then I will visit the first page that comes up
  • Now the steps will be recorded automatically
  • To check whether the script is correct press the Play entire test suit button & that will open the necessary pages and navigate to the page. 
Instead of recording you can also select the commands and fill the other fields too and do the scripting too. 


Sunday, April 30, 2017

Anjular JS

Angular JS

What is Angular JS?
  • Angular Js is a JavaScript framework that helps to build  web applications. It lets you use HTML as your template language and lets extends HTML's syntax to express your application's components clearly and succinctly. AngularJS's data binding and dependency injection eliminate much of the code you would otherwise have to write. And it all happens within the browser, making it an ideal partner with any server technology.
Benefits of Angular JS

  • Dependency injection
  • Two way data-binding
  • Testing
  • Model View Controller (MVC)
  • Directives
  • Filters
Getting started with Angular

  • First need to get the angular js file from https://angularjs.org/  web site. Instead of downloading the JavaScript file you can also use a CDN to add Angular js files. 
First we will create a simple application using Angular JS

<!DOCTYPE html>
<html>
<head>
    <script src="angular-1.6.4/angular.js"></script>
    <script src="angular-1.6.4/angular.min.js"></script>
</head>
<body ng-app>
    <div>
        10+20 = {{10+20}}
    </div>
</body>
</html>

Output : 10+20 = 30

Angular modules and controllers

What is a module?
  • A module is a container for different parts of your application 
How to create a module?
  • Use the angular object's module() method to create a module
What is a controller?
  • In angular a controller is a JavaScript function. The job of the controller is to build a model for the view to display
create a script.js file & include the following code

var myapp = anjular.module("myModule",[]);
myapp.controller("myController",function($scope)){
     $scope.message="Angular Tutorial";
}

Modify the html code to

<!DOCTYPE html>
<html ng-app="myModule">
<head>
    <script src="angular-1.6.4/angular.js"></script>
    <script src="angular-1.6.4/angular.min.js"></script>
    
    <script src="Script.js"></script>
</head>
<body>
    <div ng-controller="myController">
      {{message}}
    </div>
</body>
</html>

Output : Angular Tutorial

Wednesday, April 12, 2017

Node JS

NODE JS


Node.js is a very popular server-side platform built on Google Chrome's JavaScript Engine. This uses an event driven, non-blocking I/O model that make it lightweight and efficient. 


How to create a simple application using NodeJS?

1) As the first step we need to install NodeJs to the computer by visiting the website, https://nodejs.org 

2) After that we have to open a IDE and create a new Node Project. 

3) First create a JavaScript file name Server.js inside the Node Project and add this code

var http = require("http");

function onRequest(request,response)
{
console.log("A user made a request" + request.url);
response.writeHead(200,{"Context-Type":"text/plain"});
response.write("Here is some data");
response.end();
}

http.createServer(onRequest).listen(8888);
console.log("server is running"); 

4) when you run this application and visit http://localhost:8888/ from Google Chrome You can see the Hello world text appear on the screen. 

How to run a html code in the web server using nodeJS

1) In the Server.js file type the following code part

var http = require("http");
var fs = require('fs');

//404 Response
function send404Respose(response)
{
response.writeHead(404,{"Context-Type":"text/plain"});
response.write("Error 404: Page not found");
response.end();
}

//handle a User request
function onRequest(request,response)
{
if(request.method == 'GET' && request.url == '/')
{
response.writeHead(200,{"Context-Type":"text/html"});
fs.createReadStream("./index.html").pipe(response);
}
else
{
send404Respose(response);
}
}

http.createServer(onRequest).listen(8888);
console.log("server is running"); 

2) create index.html file and create a small html page for ex:

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

<h1>Sri Lanka Institute of Information Technology</h1>>

</body>
</html>

3) Now when you run the Server.Js file we can clearly see that the index.html file is hosted on the local server.

Tuesday, April 4, 2017

MongoDB

MONGODB

Mongodb lets you develop faster deploy easier and scale bigger. Modern applications are more networked social and interactive than ever this is driving new requirements to support big data fast feature development and flexible deployment strategies.

Advantages of MongoDB

1) Schema less Database
2) No Complex joins
3) Structure of a single object is clear
4) Deep Query ability
5) Ease of Scale

Where to use MongoDB

1) Big Data
2) Content management and delivery
3) Mobile and social infrastructure
4) User data management
5) Data hub

How to install MongoDB? 

1) Download MongoDB by visiting https://www.mongodb.com/  



2) Install the setup which you can get downloaded from the website 




3) After you have successfully installed MongoDB to your computer you will be able to see all the mongodb files in the C drive -> Program files -> MongoDb. Now you should open the command prompt and go into the bin directory of that file.


4) Now we need to create a folder to add the data which we are going to add using mongodb. To do this we are going to create a folder in the C directory named data.



5) Now we can run the mongod command. Type "mongod" in the command prompt and hit enter.



6) To start a connection enter "mongo" in the command prompt and hit enter.


7) Now we are successfully connected to our database. 

Tuesday, March 21, 2017

GIT



What is GIT?

GIT is a free and open source, distributed version control system designed to handle all the things from a mini project to a large scale project with speed and efficiency.




Git’s distributed architecture means each developer has a local copy of the entire history. These local copies are a complete history of changes and it doesn’t need any access to a central server or collaborative network in order to create commits or inspect previous versions. Because of that this makes Git heaps faster than some other version control systems.

Unlike centralized version control systems, Git provides a feature branch workflow which gives an environment for code changes. What this mean is when there is a new feature is added it’s created on a new branch so that the main branch can be kept clean and this regardless of the size for that matter. Even the development progress can be continued regardless of approval because each contributor can work in their isolated environment.

Since Git is using a cryptographically secure hashing algorithm called SHA1 it can be guaranteed that the code you are writing is 100% protected. Git protects you against security vulnerabilities such as accidental or malicious alterations.