Monday, 17 June 2019

What is Microservices Architecture?


Introduction


The micro-services architecture pattern is getting a lot of attention these days and it’s trending. If it is hard to believe, then just check what Google Trends says.
As its name its a micro applications or services those run independently. Mean we can manage (update) independently.

What is micro-services architecture




A micro-services architecture make more sense when we compare it with a monolithic architecture. In a monolithic architecture all modules of the application are tightly coupled inside a single execution or web server.
An example of monolithic application is a like shopping cart application, in which users module, products module, categories module etc are developed in a single project and deployed on a single server like apache or nginx.
This means when we have to update something in project then we need to test the whole project and deploy it again.

In other architecture mean in micro-services architecture all module are developed separately and deployed on different servers. For example users module on one server, products on another server and payment system on another server. So with this approach when we need to update product module then just update product build/server, no need to touch other modules.

Here some other definition of micro-services

  • Very very small application that focusing on a single thing
  • Independent application
  • Individual team can work on it
  • Easy to scalable

Risk in micro-services

We had gone through the possible benefits of micro-services, but there some risk as well



  • Bad design decision
  • Testing very hard with micro services
  • Data storing and sharing
  • Compatibility issue

Principal of Micro services

There are 3 principal of micro services architecture


  • Never ever try to make micro-service from day one: Mean understand application maturely, clearly, data models, communication protocols etc
  • Premature splitting is then the root of all evil: Don’t split application if you don’t know how application interact with root application.
  • Don’t design “CRUD” micro-services: Micro-services should have HTTP apis that not reflect database but provide behavior, actions, like hay sent this report to this user.

Standard protocols

Here are some protocols that used to communication between services



  • HTTP: Socket, message pack, binary protocol
  • RestFull: Resource base endpoint (Put, Patch, Post, Path)
  • Swagger, Json-schema: Specification json based serialization
  • Token Based Authentication: Authentication for request

Keep in mind while designing HTTP API


  • Don’t surface too many details
  • Version your api
  • Backward compatibility make your life easier
  • Json-schema can help for data checking


Monday, 3 June 2019

AI & Machine Learning


What is AI?


You can think of deep learning, machine learning and artificial intelligence as a set of Russian dolls nested within each other, beginning with the smallest and working out. Deep learning is a subset of machine learning, and machine learning is a subset of AI, which is an umbrella term for any computer program that does something smart. In other words, all machine learning is AI, but not all AI is machine learning, and so forth.

Here are a few other definitions of artificial intelligence
  • A branch of computer science dealing with the simulation of intelligent behavior in computers.
  • The ability of a digital computer or computer-controlled robot to perform tasks commonly associated with intelligent beings.
  • The capability of a machine to imitate the intelligent human behavior 
  • A computer system able to perform tasks that normally require human intelligence, such as visual perception, speech recognition, decision-making, and translation between languages.

What is Machine Learning?


Machine learning is an application of artificial intelligence (AI) that provides systems the ability to automatically learn and improve from experience without being explicitly programmed.
Machine learning focuses on the development of computer programs that can access data and use it learn for themselves. It is a category of algorithm that allows software applications to become more accurate in predicting outcomes without being explicitly programmed.

The basic premise of machine learning is to build algorithms that can receive input data and use statistical analysis to predict an output while updating outputs as new data becomes available.

How Machine Learning Works?


The process of learning begins with observations or data, such as examples, direct experience, or instruction, in order to look for patterns in data and make better decisions in the future based on the examples that we provide. It is also similar to data mining and predictive modeling.

Some machine learning methods: Machine learning algorithms are often categorized as supervised or unsupervised.

  • Supervised Algorithm: Supervised algorithms require a data scientist or data analyst with machine learning skills to provide both input and desired output. It can apply on what has been learned in the past to new data using labeled examples. The system is able to provide targets for any new input after sufficient training.
  • Unsupervised Algorithm: Unsupervised algorithms do not need to be trained with desired outcome data. Instead, they use an iterative approach called deep learning to review data and arrive at conclusions. Unsupervised learning algorithms -- also called neural networks -- are used for more complex processing tasks than supervised learning systems, including image recognition, speech-to-text and natural language generation.   
  • Semi-supervised: somewhere in between supervised and unsupervised learning, since they use both labeled and unlabeled data for training – typically a small amount of labeled data and a large amount of unlabeled data. The systems that use this method are able to considerably improve learning accuracy. Usually, semi-supervised learning is chosen when the acquired labeled data requires skilled and relevant resources in order to train it / learn from it. Otherwise, acquiringunlabeled data generally doesn’t require additional resources.
  • Reinforcement Algorithm: This area of deep learning involves models iterating over many attempts to complete a process. Steps that produce favorable outcomes are rewarded and steps that produce undesired outcomes are penalized until the algorithm learns the optimal process.

Free Online Artificial Intelligence  

  • Google’s Free Machine Learning Course
  • Andrew NG’s Free AI Course on Coursera
  • Free Udacity Online AI Course




Wednesday, 2 August 2017

Angular Performance: ng-show vs ng-if



You’ve probably come across ng-if and ng-show and wondered why they both exist and what’s the difference between them. After all they usually have the same behavior as far as the user is concerned.

The devil is in the details and the differences between these directives can allow your to boost your application’s performance easily.

The Differences


Both ng-show and ng-if receive a condition and hide from view the directive’s element in case the condition evaluates to false. The mechanics they use to hide the view, though, are different.

ng-show (and its sibling ng-hide) toggle the appearance of the element by adding the CSS display: none style.

ng-if, on the other hand, actually removes the element from the DOM when the condition is false and only adds the element back once the condition turns true.

Since ng-show leaves the elements alive in the DOM, it means that all of their watch expressions and performance cost are still there even though the user doesn’t see the view at all. In cases where you have a few big views that are toggled with ng-show you might be noticing that things are a bit laggy (like clicking on buttons or typing inside input fields).

If you just replace that ng-show with an ng-if you might witness considerable improvements in the responsiveness of your app because those extra watches are no longer happening.


That’s it: replace ng-show and ng-hide with ng-if!

ReadMore

Saturday, 29 July 2017

What is Angular JS

Angular JS is an open source JavaScript framework that is used to build web applications. It can be freely used, changed and shared by anyone.

Angular Js is developed by Google.

It is an excellent framework for building single phase applications and line of business applications.

Advantage of AngularJS


There are a lot of JavaScript frameworks for building web applications. So, it is a genuine question, why to use Angular JS.

Following are the advantages of AngularJS over other JavaScript frameworks: 

Dependency Injection: Dependency Injection specifies a design pattern in which components are given their dependencies instead of hard coding them within the component.

Two way data binding: AngularJS creates a two way data-binding between the select element and the orderProp model. orderProp is then used as the input for the orderBy filter.

Testing: Angular JS is designed in a way that we can test right from the start. So, it is very easy to test any of its components through unit testing and end-to-end testing.

Model View Controller: In Angular JS, it is very easy to develop application in a clean MVC way. You just have to split your application code into MVC components i.e. Model, View and the Controller.

Directives, filters, modules, routes etc.

Read More



Friday, 21 July 2017

What is WebRTC ?


WebRTC is a free, open project that provides browsers and mobile applications with Real-Time Communications (RTC) capabilities via simple APIs. The WebRTC components have been optimized to best serve this purpose.

Our mission: To enable rich, high-quality RTC applications to be developed for the browser, mobile platforms, and IoT devices, and allow them all to communicate via a common set of protocols.


The WebRTC initiative is a project supported by Google, Mozilla and Opera, amongst others. This page is maintained by the Google Chrome team.