Artikel Terbaru

Monday, 21 November 2016

Gulp javascript build automation tool overview

What is gulpjs build tool


Gulpjs is java script open source framework for automating the build tool for java script applications written in Node.js, angular and other java script frameworks.Gulp uses pipe streams concepts to improves the performances of the tasks

Gulp features


Gulp is plugin based architectures which provides different plugins for doing the tasks
GuplJS is command line JavaScript task runner which do the below collection of tasks.
Each tasks we can configured gulp plugin
  • · Minification of javascript files to remove spaces
  • · Concatanation
  • · Copying files 
  • · written in javascript
  • · Javascript compilation
GulpJS supports all browser and all operation systems

How to install gulp JavaScript tool


To install gulp JS too, Node js need to be installed

npm install -g gulp

npm is node package manager, -g option indicates install the package available globally
npm command retrieve the gulp package from node registry repository and installs local to your system, so that gulp can be accessed using command line.
Use below command to check whether gulp is installed or not

Gulp –v

How to add gulp to your javascript application


And also we can also use –save-dev option to npm command to install the dependencies

npm install --save-dev gulp


the above command add the dependency to package.json

Sunday, 7 August 2016

XML and JSON basics

JSON Basics:-

JSON is java script Object notation. JSON is independentent format for exchaning data JSON is simple format which contain key pair values. JSON and xml are data formats used to transfer data between different systems of enterprise applications . JSON is lightweight and simple to read

JSON Sample data file

{ "id" : 1.0, "name" : "Kiran", "sal" : 5000, }
     {
        "id" : 1.0,
        "name" : "Kiran",
        "sal" : 5000,
    }

XML Basic meaning:-

XML is extensive markeuplanguage which start and end tag and follows certain data validations. XML file can be validates with XML Schema. XML files has data attributes. Reading xml is very easy as most of browsers and editors support simple clicable readable format.

xml sample data file:

Sub tag
Most of companies which offers REST APIS expose the data in either XML or JSON. Clients consume those REST API's and use programming technicque to process xml/json data XML and JSON data can be read easily by programmers. Both xml and json are not similar. There are many ways to convert xml to json
We have many ways to convert json to xml in java

How to convert json to xml in java

com.gson.gson library provides for reading JSON object and XML class will convert into XML object
import org.json.JSONObject;
import org.json.XML;

public class JsonToXmlConvert {
 public static void main(String[] args) throws Exception {
  String jsonObject = "{'json key':'json value'}";  
  JSONObject json = new JSONObject(jsonObject);
  String xml = XML.toString(json);

 }
}