Monthly Archives: August 2016

ANGULAR MATERIAL DESIGN

Angular Material Design

Material Design is a language developed by Google. It aimed to make a persistent experience across all Google applications & platforms such as YouTube, Android, Google Play, Inbox, and Gmail. Google has announced Material Design at the 2014 Google I/O conference.

Angular Material Design

In this article we’re going to explore about Angular Material Design and its importance.

ANGULAR MATERIAL IS ABOUT:

Angular Material is a UI component library for Angular JS developers. Angular Material components help the user in constructing attractive, steady, and functional web pages and web applications while complying with modern web design principles such as browser portability, device independence, and graceful degradation. It helps the user in creating faster and responsive websites and it is inspired from Google Material Design.

SALIENT FEATURES OF ANGULAR MATERIAL DESIGN:

  • In-built responsive designing.
  • It also includes new versions of common user interface controls such as, buttons, check boxes, and text fields which are adapted to follow Material Design concepts.
  • Standard CSS with basic essential footprint.
  • It enhances the specialized features like cards, toolbar, speed dial, side navigation, and swipe.
  • Cross-browser can be used to create reusable web components.

RESPONSIVE DESIGN

Angular Material has an in-built responsive designing so that, the website which is created using Angular Material will be recreated depending on the device size. The Angular classes are created in such a way that the website has to fit in any screen size. The websites which are created using Angular Material is fully compatible with PC, tablets, and mobile devices.

PROTRACTILE

  • Angular Material is by design is very minimum and flat.
  • It is designed by considering the fact that it is much easier to add new CSS rules than to overwrite existing CSS rules.
  • It supports bold colors.
  • The colors and shades remain constant across various platforms and devices.

Usage of Angular Material
There are two ways to use Angular Material, they are as follows:

  • Local Installation
  • CDN Based Version

Local Installation: A user can download the Angular Material libraries using npm, jspm, or a bower on a local machine and can include it in HTML code.

CDN Based Version: A user can include the angular-material.min.css and angular-material js files into their HTML code directly from the Content Delivery Network.

Local Installation:

  • Firstly, the user has to install Node.js.
  • Use the following command to install Angular material libraries
  • npm install angular-material
  • The Output will be as shown below
  • angular-animate@1.5.2 node_modules\angular-animate
  • angular-aria@1.5.2 node_modules\angular-aria
  • angular-messages@1.5.2 node_modules\angular-messages
  • angular@1.5.2 node_modules\angular
  • angular-material@1.0.6 node_modules\angular-material
  • npm will download the files in node_modular > angular-material folder.

CDN Based Version:

A user can include the angular-material.css and angular-material.js files into HTML code directly from the CDN.

BIG DATA:APACHE SPARK

Big Data:Apache Spark

The open source technology has been around and popular for few years. But 2016 was the year where Spark went from a predominant technology to a bona-fide superstar.

Big Data Apache Spark

Apache Spark has become so popular as it provides data engineers and data scientists with a powerful, consolidated engine that is both fast (100x faster than Apache Hadoop for large-scale data processing) and easy to use.

In this article, we will discuss some of the key points one encounters when working with Apache Spark.

WHAT SPARK IS ALL ABOUT:

Apache spark is an open-source big data processing framework built around quickness, ease of use, and sophisticated analytics. Apache spark is built on top of Hadoop MapReduce and it extends the MapReduce model to effortlessly use more types of calculations which include Interactive queries and Stream processing.

Spark has several more advantages while compared to other big data and MapReduce technologies like Hadoop and Storm.

Firstly, Spark gives us a comprehensive, united framework to manage big data processing requirements with a wide variety of data sets that are distinct in nature.

Spark authorizes applications in Hadoop clusters to run up to 100 times faster in memory and 10 times faster while running on disk.

Spark lets the user to quickly write applications in Java, Scala, and Python. It comes with an inbuilt set of 80 high-level operators. A user can use it interactively to query the data within the shell. In addition to Map and Reduce operations, it also supports SQL queries, streaming data, machine learning, and graph data processing. A user can use this standalone or can combine them to run in a single data pipeline use case.

FEATURES OF SPARK

Spark takes MapReduce to the next level with less cost shuffles in the data processing. With the capabilities like in-memory data storage and real-time processing, the performance can be numerous times faster than other big data technologies.

Spark holds intermediate results in memory rather than writing them to disk which is very useful especially when you need to work on the same dataset a multiple number of times. It can store part of a data set in memory and the remaining data in the disk. A user has to look at his data and use cases to assess the memory requirements. With this in-memory data storage, Spark comes with some performance advantages.

Other Spark features include:

  • Supports more than Reduce and Map functions.
  • Provides brief and consistent APIs in Scala, Java, and Python.
  • Offers interactive shell for Scala and Python.

Spark is done in Scala Programming Language and runs in JVM (Java Virtual Machine) environment. Currently, it supports the following languages for developing applications using Spark.

  • Scala
  • Java
  • Python
  • Clojure

SPARK ECOSYSTEM

Other than Spark core API, there are some additional libraries that are part of the Spark ecosystem and provides other added capabilities in Big Data analytics and Machine Learning areas. These libraries include the following.

  • Spark streaming: It can be used for processing the real-time streaming data. This process is based on the micro batch style of computing and processing.
  • Spark SQL: It provides the capability to expose the Spark datasets over JDBC API and allows running the SQL queries on Spark data by using traditional BI and visualization tools.
  • Spark MLlib: MLlib is Spark’s scalable machine learning library consists of common learning algorithms and utilities such as regression, clustering, collaborative filtering, and underlying optimization primitives.

AWS LAMBDA SERVICES

AWS Lambda Services

AWS Lambda (Amazon Web Services Lambda) is a compute service that runs developers’ code in response to events and automatically manages the compute resources for them, making it easy to build applications that respond quickly to new information. It runs the code within milliseconds of trigger. AWS Lambda service is a service where you can upload your code to AWS Lambda and the service can run the code on your behalf using AWS infrastructure. This upload and create is called as AWS Lambda function. It also takes care of provisioning and managing the servers that you use to run the code.

The user needs to supply one of the languages which are supported by AWS Lambda. Currently, AWS Lambda supports Node.js, Python, and Java.

AWS Lambda executes the developers code only when needed and scales automatically. A user can use Lambda for building data processing triggers for AWS services like Amazon S3 and Amazon DynamoDB, or a user can create his own backend which operates at AWS scale, performance, and security.

WHEN SHOULD A USER USE AWS LAMBDA?

AWS Lambda is an optimal compute platform for many applications scenarios, where a user can write the application code in languages supported by AWS Lambda and can run within the AWS Lambda standard runtime environment and resources provided by Lambda.

When using AWS Lambda, a user is only responsible for the code. It manages and balances the memory, CPU, network, and other resources. These constraints enable AWS Lambda to perform operational and administrative activities on users behalf, including provisioning capacity, applying security patches, deploying the code, monitoring and logging to Lambda functions.

HOW AWS LAMBDA WORKS

While building applications in AWS Lambda, the core components are Lambda functions and event sources. An event source is an AWS service or custom application that publishes an event, and a Lambda function is the custom code that processes the events. Below are the following scenarios to be considered.

File Processing: For an instance, you have a photo sharing application. People use your application to upload photos, and the application stores the user photos in Amazon S3 bucket.Then your application creates a thumbnail version of each user photos and displays them on the user’s profile page. In this scenario, you may choose to create a Lambda function that creates a thumbnail automatically. Your Lambda function code can read the photo object from the S3 bucket, create a thumbnail version and can save it in another S3 bucket.

Data and Analytics: If suppose you are building an analytics application and storing raw data in a DynamoDB table, when you write, update, or delete the items in a table, DynamoDB streams can publish item update events to a stream associated with the table. In that case, the event data provides the item key, event name, and other details as needed. A user can write a Lambda function to generate custom metrics by accumulating raw data.

Websites: If you are creating a website and you want to host the backend logic on Lambda. You can invoke your Lambda function over HTTP using Amazon API gateway as the HTTP endpoint. Then your web client can invoke the API gateway to route the request to Lambda.

Mobile Applications: If you have a custom mobile application that produces events. You can create Lambda function to process events published by your custom application.

COMPUTE REQUIREMENTS – LAMBDA FUNCTION CONFIGURATION

A Lambda function consists of code and associated dependencies. A Lambda function also has configuration information associated with it. At the beginning, you specify the configuration information when you create a Lambda function. Lambda provides an API for the user to provide some of the configuration data. Lambda function configuration includes the following elements:

Compute resource that a user needs: A user can specify the amount of memory that he wants to allocate for the Lambda function. AWS Lambda allocates CPU power proportional to the memory by using the same ratio as an Amazon EC2 instance type.

Maximum execution time: The user pays for the AWS resources that are used to run the users Lambda functions. To prevent the Lambda function running indefinitely, a user specifies a timeout. When it reaches the specified timeout the AWS Lambda function terminates the Lambda function.

Execution role: This is the role that AWS Lambda assumes while executing the Lambda function on behalf of a user.

Handler name: The handler refers to the method in the user’s code where AWS Lambda begins execution.

AWS Lambda Services

 

ECLIPSE FOUNDATION RELEASES IOT PROJECTS

ECLIPSE & ECLIPSE FOUNDATION?

Eclipse was started in 2001 when IBM donated three million lines of code from its Java tools. It is an integrated development environment (IDE) used in computer programming. Eclipse is the most widely used IDE. Eclipse is mostly written in Java and its primary use is for developing Java applications, also it can be used for developing applications for other programming languages by using plugins. Whereas Eclipse Foundation is a not-for-profit, it is an open source community working to build a development platform which consists of frameworks, tools, and runtimes which are needed for building, utilizing, and managing software across the lifecycle.

ECLIPSE FOUNDATION RELEASES IOT PROJECTS

Eclipse Foundation announced the release of number of Internet of Things projects. These projects include:
* Eclipse Kura (Framework for building IOT gateways)
* Eclipse Paho (Used for implementing MQTT protocols)
* Eclipse OM2M (It is an open-source implementation of SmartM2M and OneM2M standard)
* Eclipse SmartHome (It is an open-source framework for building smart home solutions)

The main purpose of the Eclipse IOT projects at Eclipse is to bring the competitors together in IOT space to work on open-source solutions for compatibility.

ECLIPSE KURA

Eclipse Kura is a framework used for building IOT gateways. The latest release of Eclipse Kura is Kura 2.0, bringing you many new features and enhancements, such as,
* New responsive user interface: It is based on Bootstrap that simplifies Kura gateway management from mobile devices.
* Supports multiple cloud connections: It enables the scenarios where a single gateway can be simul taneously connected to numerous cloud platforms.
* Improved on-boarding process for developers: With new tools and code samples to ease the creation of Kura applications and drag-and-drop deployment of Kura applications available from the Eclipse marketplace.

ECLIPSE OM2M

Eclipse OM2M is an open source implementation of the OneM2M standard. It provides horizontal set of IOT services which enables the development of IOT solutions independently which is lying under the network.

The OM2M 1.0 provides the implementation of SmartM2M and OneM2M. The major features of OM2M is listed below.
* Lightweight REST API: It is disclosed through multiple communication bindings such as HTTP and CoAP protocols and other various supporting content formats such as XML and JSON.
* Flexible data storage: It is based on abstract persistence layer supporting embedded and server da tabases, in-memory mode, SQL & NoSQL models.

The OM2M implements the following key concepts:
* Common service entity: CSE is used by infrastructure node (IN), middle node (MN), and application service node (ASN).
*Common service function: Also includes registration, application and service management, discovery, data management and repository.

ECLIPSE PAHO

Eclipse Paho provides an open-source client implementation of the MQTT and MQTT-SN messaging protocols. Paho 1.2 is the update for the existing Java, Python, JavaScript, C, .Net, Android, and Embedded C/C++ clients libraries. The major developments include:
* Automatic reconnect & online buffering: This functionality is for C, Java, and Android clients.
* Web socket support: This functionality is for Java and Python clients.
* New Go client: This is a component which is for Windows, Mac OS X, and Linux.

PROS & CONS OF POLYMER.JS

Pros & Cons of Polymer.js

Building modern web applications requires a lot of tooling. This includes pre-processors, JavaScript frameworks, testing tools and much more. As the complexities of these applications increases, the breadth of tooling and services are needed to manage them.

Web components aim to solve some of these complexities by providing a consolidated way to create new elements that encompass rich functionalities without the need for extra libraries.
To bridge the gap and to give the developers an access to this rich functionality, Google has created the Polymer library which serves as a set of Polyfills to bring the promise of Web Components to you today. In this article, we will be covering what exactly the polymer is and its advantages and disadvantages.

WHAT IS POLYMER

The polymer library is designed for the developers to create some great and reusable components for the modern web. Polymer library is a set of Polyfills that helps a developer to create Web Components on all modern web browsers. It provides the framework for defining, creating, and rendering complex custom elements in a simple manner. It also helps to simplify the way you use complex components by:

• Encapsulating the complex code and structure.
• Allows the developers to use simple-to-use tag style naming convention.
• Providing a suite of predefined user interface elements to leverage and extend.

With Polymer.js, you can create your own HTML elements and can compose them into complete complex web applications that are scalable and maintainable.

Below is the sample code for Polymer.js:

Polymer({
is:’component-id’,
properties:{
propertyOne:{
type:Object,
value:{},
observer:’_valueChanged’
},
propertyTwo:{
type:Boolean,
value:true
}
},
ready:function(){
var self = this;
self.set(‘propertyTwo’,false);
},
_valueChanged:function(){
var self = this;
console.log(self.propertyOne);
if(self.propertyOne){
self.userDefinedFunction();
}
},
userDefinedFunction:function(){
console.log(‘its an user defined function’);
}
});

WHAT IS POLYFILLS

For backing Web Components, we always need Polyfills. The webcomponent.js Polyfills enables the Web Components in browsers that lack native support. Webcomponent.js is set of Polyfills built on the top of Web Components specifications.

THE MAJOR ADVANTAGES & DISADVANTAGES OF USING POLYMER:
PROS:
• Polymer believes in leveraging the browsers “Native” technologies rather than relying on some increasingly complex custom JavaScript libraries.
• Polymer web development is always about creating only elements.
• The polymer provides the ability to compose enclosed JS, CSS, and HTML as Custom elements.
• Polymer elements provide templating and bi-directional data binding. It also provides new functionality such as Shadow DOM which enables the encapsulation of CSS.
• Reduces the gap between developer and designer:
Polymer assures an easy working relationship between designers who uses Web page UX and developers who are concerned with Web page functionality. Developers use Polymer elements which include design and themes, which means there is no need to modify complex Web page source code to match designer specifications.
• Quick: The Polymer is a new library which is three times faster on Chrome, four times faster on Safari. Also, it is ready to be used in production applications and believed to be easier for developers to produce feature-rich applications and websites.
CONS:
• It is not entirely clear that how to organize larger applications.
• Dependency errors and pointing to a different version of dependencies.
• Downloading of entire library and Polyfills.
• Lack of server side rendering.

HOW DOES POLYMER JS DIFFER FROM ANGULAR JS.?

How does Polymer JS differ from Angular JS.?

Angular JS is a complete framework for building web applications, whereas Polymer JS is a library for creating Web Components. Those components, however, can then be used to build a webapp.

Angular directives are conceptually similar to Custom Elements but they are implemented without the use of the Web Components APIs. Angular directives are a way to build custom elements, but Polymer and the Web Components specification are the standard way to do.

Similar to Angular, Polymer elements provide templating and bi-directional data binding. However, they also provide new functionality such as the Shadow DOM, which enables encapsulation of CSS. Angular directives don’t have any notion of style encapsulation, but Angular is expected incorporate that functionality eventually.

A comparison of an element that renders a Gravatar written as a Polymer Custom Element and as an Angular directive.

Polymer Element:

<polymer-element name=”user-gravatar” attributes=”email”>
<template>
<img src=”https://secure.gravatar.com/avatar/{{gid}}” />
</template>
<script>
Polymer(‘user-gravatar’, {
ready: function() {
this.gid = md5(this.email);
}
});
</script>
</polymer>
Angular Directive:
app.directive(‘user-gravatar’, [‘md5′, function() {
return {
restrict: ‘E’,
link: function(scope, element, attrs) {
scope.gid = md5(attrs.email);
},
template: ‘<img src=”https://gravatar.com/avatar/{{gid}}” />’
};
}]);

WHAT ARE THE MAIN ADVANTAGES OF USING THE AWS LAMBDA SERVICE?

What are the main advantages of using the AWS Lambda Service?

No Servers to Manage: AWS Lambda automatically runs your code without requiring you to provision or manage servers. Just write the code and upload it to Lambda.

Continuous Scaling: AWS Lambda automatically scales your application by running code in response to each trigger. Your code runs in parallel and processes each trigger individually, scaling precisely with the size of the workload.

Subsecond Metering: With AWS Lambda, you are charged for every 100ms your code executes and the number of times your code is triggered. You don’t pay anything when your code isn’t running.

WHAT IS CALLBACK IN NODE.JS?

What is Callback in Node.JS?

Callback is an asynchronous equivalent for a function. A callback function is called at the completion of a given task. Node makes heavy use of callbacks. All APIs of Node are written is such a way that they support callbacks.

For example, a function to read a file may start reading file and return the control to execution environment immediately so that next instruction can be executed. Once file I/O is complete, it will call the callback function while passing the callback function, the content of the file as parameter. So there is no blocking or wait for File I/O. This makes Node.js highly scalable, as it can process high number of request without waiting for any function to return result.

HOW DOES A COOKBOOK DIFFER FROM A RECIPE IN CHEF?

How does a cookbook differ from a recipe in Chef?

A recipe is a collection of resources, and typically configures a software package or some piece of infrastructure. A cookbook groups together recipes and other information in a way that is more manageable than having just recipes alone.

For example, use a template resource to manage your HTML home page from an external file. The recipe states the configuration policy for your web site, and the template file contains the data. You use a cookbook to package both parts up into a single unit that you can later deploy.