Monday, 4 September 2017

TypeScript : An Introduction


Typescript is the sexiest JavaScript!

Typescript gives the privilege to write the code like JAVA or C and compiles into JavaScript code on the fly both on the server side and client side.

It was becoming difficult to build large-scale applications using JS, there was a demand for a language which can ease the development of components in JS. Thus Typescript Originated! It was first made public in October 2012 after two years of internal development at Microsoft.


Typescript is a  strict superset of JavaScript (ECMAScript 5 ). A JavaScript program is a valid Typescript program.
With Typescript it is possible to use existing JavaScript code along with its libraries.
Typescript comes with many advantages over JavaScript :
  • It is purely Object Oriented Programming having support for adding classes and modules
  • Modules in Typescript are very useful in organizing code with which large scale application development becomes easy.
  • Can be used for client side and server side development
  • It includes Static Type Checking
  • Has a “compiler” for converting the code into JavaScript
  • It follows EcmaScript 6 proposals

Below is a code snippet showing the difference between a Typescript and a JavaScript code :

Angular 2 uses Typescript as the major tool for application development as it provides advanced autocompletion, navigation, and refactoring which is very much essential in developing large scale apps . Moreover it attracts many object oriented programmers to write large scale appliation codes !
Other than angular 2 many other technologies also take benefit of Typescript :

  • React
  • Node JS (Express + MongoDB + Typescript)
  • ASP .Net Core
  • React Native
  • Vue.js
  • Glimmer (component library with Typescript support)
  • WeChat
  • Dojo 2
  • Knokout

Monday, 28 August 2017



Application program interface(API) is a set of routines, protocols, and tools for building software applications. It specifies how software components should interact. A good API makes it easier to develop a program by providing all the building blocks. A programmer then puts the block together.


REST is any interface between systems using HTTP to obtain data and generate operations on those data in all possible formats, such as XML and JSON. Developers do not need to need to install libraries or additional software in order to take advantage of REST API design.


In 1999, most developers had to deal with SOAP—Simple Object Access Protocol— to integrate APIs. And the “simple” part of that acronym is not to be taken literally. To make a call, they had to hand-write an XML document with an RPC call in the body. From there, they had to specify the endpoint and POST their SOAP envelope to that specified endpoint.
SOAP was notorious for being complex to build, complex to use, and near-impossible to debug. And the alternative, CORBA, was even worse. The problem was that there was no standard for how APIs should be designed and used. Back then, APIs were not designed to be accessible, they were only designed to be flexible.
But a small group of expert developers recognized the true potential of web APIs. Thanks to this small group, led by Roy Fielding, REST was coined and the API landscape changed forever.
In 2000, Roy Fielding and his colleagues had one objective: create a standard so that any server could talk to any other server in the world. Roy Fielding gave the disorganized internet world the gift of a common language through which their software could communicate.


The Angular HTTP client communicates with the server using a familiar HTTP request/response protocol. The Http client is one of a family of services in the Angular HTTP library. When importing from the @angular/HTTP module, SystemJS knows how to load services from the Angular HTTP library because the systemjs.config.js file maps to that module name. The HttpModule is necessary for making HTTP calls.


Think of an Observable as a stream of events published by some source. To listen for events in this stream, subscribe to the Observable. These subscriptions specify the actions to take when the web request produces a success event or a fail event (with the error in the payload).
  • The observable’s map callback moves to the success parameter and its catch callback to the fail parameter in this pattern.
  • The errorHandler forwards an error message as a failed promise instead of a failed observable.

RxJS library

  • RxJS (“Reactive Extensions”) is a 3rd party library, endorsed by Angular, that implements the asynchronous observable pattern.
  • RxJS npm package loaded via system.js because observables are used widely in Angular applications.
  • The app needs it when working with the HTTP client. Additionally, you must take a critical extra step to make RxJS observables usable.
  • The RxJS library is large. Size matters when building a production application and deploying it to mobile devices. You should include only necessary features.
  • Accordingly, Angular exposes a stripped down version of Observable in the rxjs/Observable module that lacks most of the operators such as the map method.
  • You could add every RxJS operator with a single import statement. While that is the easiest thing to do, you’d pay a penalty in extended launch time and application size because the full library is so big.
  • Since this app only uses a few operators, it’s better to import each Observable operator and static class method, one-by-one, for a custom Observable implementation tuned precisely to the app’s requirements. Put the import statements in one app/rxjs-operators.ts file.
Below is the HTTP signature as is in Angular 2 source:
* Performs any type of http request. First argument is required, and can either be a url or
* a {@link Request} instance. If the first argument is a url, an optional {@link RequestOptions}
* object can be provided as the 2nd argument. The options object will be merged with the values
* of {@link BaseRequestOptions} before performing the request.
request(url: string | Request, options?: RequestOptionsArgs): Observable;
* Performs a request with `get` http method.
get(url: string, options?: RequestOptionsArgs): Observable;
* Performs a request with `post` http method.
post(url: string, body: any, options?: RequestOptionsArgs): Observable;
* Performs a request with `put` http method.
put(url: string, body: any, options?: RequestOptionsArgs): Observable;
* Performs a request with `delete` http method.
delete(url: string, options?: RequestOptionsArgs): Observable;
* Performs a request with `patch` http method.
patch(url: string, body: any, options?: RequestOptionsArgs): Observable;
* Performs a request with `head` http method.
head(url: string, options?: RequestOptionsArgs): Observable;
Each method takes in a url and a payload as the case may be and returns a generic observable response type.
The service class has the following structure:
/* * * ./app/comments/services/comment.service.ts * * */
// Imports
import { Injectable } from ‘@angular/core’;
import { Http, Response, Headers, RequestOptions } from ‘@angular/http’;
import { Comment } from ‘../model/comment’;
import {Observable} from ‘rxjs/Rx’;
// Import RxJs required methods
import ‘rxjs/add/operator/map’;
import ‘rxjs/add/operator/catch’;
export class CommentService {
// Resolve HTTP using the constructor
constructor (private http: Http) {}
// private instance variable to hold base url
private commentsUrl = ‘http://localhost:3000/api/comments’;
We are importing the required libraries for our service to behave as expected. The observable about has also been imported and ready for use. The map and catch observable operators which will help us manipulate data and handle errors respectively has also been imported. Then we inject HTTP in the constructor and keep a reference to the base url of our API.
// Fetch all existing comments
getComments() : Observable<Comment[]> {
// …using get request
return this.http.get(this.commentsUrl)
// …and calling .json() on the response to return data
.map((res:Response) => res.json())
//…errors if any
.catch((error:any) => Observable.throw(error.json().error || ‘Server error’));
Using the http instance we already have on the class, we call it’s get method passing in the base url because that is the endpoint where we can find a list of comments.
We are maintaining strictness by ensuring that the service instance methods always return an observable of type Comment:
/* * * ./app/comments/model/comment.ts * * */
export class Comment {
public id: Date,
public author: string,
public text:string
With the map operator, we call the .json method on the response because the actual response is not a collection of data but a JSON string.
It is always advisable to handle errors so we can use the catch operator to return another subscribable observable but this time a failed one.
The rest of the code has the above structure but different HTTP methods and arguments:
// Add a new comment
addComment (body: Object): Observable<Comment[]> {
let bodyString = JSON.stringify(body); // Stringify payload
let headers = new Headers({ ‘Content-Type’: ‘application/json’ }); // … Set content type to JSON
let options = new RequestOptions({ headers: headers }); // Create a request option
return, body, options) // …using post request
.map((res:Response) => res.json()) // …and calling .json() on the response to return data
.catch((error:any) => Observable.throw(error.json().error || ‘Server error’)); //…errors if any
// Update a comment
updateComment (body: Object): Observable<Comment[]> {
let bodyString = JSON.stringify(body); // Stringify payload
let headers = new Headers({ ‘Content-Type’: ‘application/json’ }); // … Set content type to JSON
let options = new RequestOptions({ headers: headers }); // Create a request option
return this.http.put(`${this.commentsUrl}/${body[‘id’]}`, body, options) // …using put request
.map((res:Response) => res.json()) // …and calling .json() on the response to return data
.catch((error:any) => Observable.throw(error.json().error || ‘Server error’)); //…errors if any
// Delete a comment
removeComment (id:string): Observable<Comment[]> {
return this.http.delete(`${this.commentsUrl}/${id}`) // …using put request
.map((res:Response) => res.json()) // …and calling .json() on the response to return data
.catch((error:any) => Observable.throw(error.json().error || ‘Server error’)); //…errors if any
The above makes a postput and delete request, converts response to JSON and catches error if any.
Observables are not as mouthful as it seemed in the beginning. What’s is just left to do is subscribe to the observable and bind the data as they are emitted to the views.

Monday, 21 August 2017

Components in Angular2


Components are the core building block of Angular 2 applications. A good technical definition would be “components in Angular 2 are a framework construct that owns a single node of HTML and dictates what children are written to that node, and handle all interaction with those children”.

There is one root component called app.component. Then there are components and subcomponents. The following example will make it more clear:
Screenshot 2017-07-03 17.40.33
In this example app.component is the root component, header ,body and footer are its component and signup-login are subcomponents of body.

How to create a component:

Create a new file src/app folder with the name
Eg – my-header.component.ts
In the file write the following:
Screenshot 2017-07-03 17.40.39
This is the basic structure of a component.
If you working with Angular CLI then write the following command in command prompt and your component will be created with the structure shown above:
Screenshot 2017-07-03 17.40.43

Explaining the structure of the component:

Component represents a reusable piece of UI that is usually depicted by a custom html element.It consists of the following –
  • Selector- the aforementioned html element which will match the element tag that identifies this
  • Template − This is used to render the view for the application. This contains the HTML that needs to be rendered in the application. This part also includes the binding and directives.
  • Class − This is like a class defined in any language such as C. This contains properties and methods. This has the code which is used to support the view. It is defined in TypeScript.
  • Metadata − This has the extra data defined for the Angular class. It is defined with a decorator.
Components are very helpful as they make our code more understandable to other person by dividing the whole structure into various parts.And we can reuse these components in different applications as well.
A lot of changes are there in Angular 1 and Angular 2.And one stand-out feature change is the introduction of components. Angular 2 is entirely component based. Components and directives have replaced the controllers and $scope of Angular 1. Components are directives with a template.
In Angular 1 we’d attach controllers to various parts of the page with our custom logic. Scopes would be attached or flow through, based on how our custom directives encapsulated themselves.In this model it wasn’t like any hierarchical structure. We’d just “attach” behaviors to various parts of our page and then have to deal with the complicated meta-structure created by our directives, controllers, and scopes.
To add logic to the page, we’d have to decide between building a controller or a custom directive.
Angular 2 drops all of this for a much cleaner, more object-oriented Component model.

Example of Controller in Angular 1 and Components in Angular 2 :

Angular 1 Controller:
Screenshot 2017-07-03 17.40.53
Angular 2 Components:
Screenshot 2017-07-03 17.40.59
This was all about Components.Try making a new component and learn more about it.
Keep learning.

Monday, 14 August 2017

Faster than expected - HyperLoop



Whenever something comes into the market there is this one thing that let the occurrence and that is nothing but “Requirement or need”. Hyperloop is such one development in the industry of science and technology which dealt with the requirements.

Where it was started?

In year 2012, the renowned innovator Elon Musk released its first version which tells that some people will be travelling in capsules running on air bearings driven by motors and air compressors.
Like a spark, this ignites many minds and in year 2013, a paper on this concept was published which creates an idea of a hyperloop system that would propel passengers along the 350-mile (560 km) route at an average speed of around 600 mph (970 km/h), with a top speed of 760 mph (1,200 km/h), allowing for a travel time of 35 minutes, which is considerably faster than current rail or air travel times and after so many efforts from commercial companies and dozens of student teams,  on January 29, 2017, approximately one year after winning phase one of the Hyperloop pod competition, the MIT Hyperloop pod demonstrated the first ever low-pressure Hyperloop run in the world [credits : Wikipedia].
Oh, didn’t i tell you Why Hyperloop ?
Because it is fast, cheaper(after some initial phase, probably), safer, efficient, quiet. In short, it is WOW.
You will come to know why i am saying this, bear with me :D

So, what is this buzzword?

Because no one else can tell you better than Hyperloop One

Who is working on it?

Hyperloop one and Hyperloop transportation technologies are the two main leaders in this field for now, also some support is backed up by the addition of Arrivo chaired by ex-Hyperloop One CTO and ex-SpaceX engineer Brogan BamBrogan.
It doesn't ends here, Elon Musk runs a Hyperloop Challenge, where he welcomes students to his Hyperloop test lab in his SpaceX facility in Las Vegas.  .
This global challenge invites people from around the world to make a comprehensive commercial, or transport or can be economic related for their cities, regions or even countries which can be considered to host the first hyperloop networks. It’s not an engineering competition, they say : “we bring technology, you tell us how it should be used in your location”.
I hope you must be thinking when can i have one ride in this, but the answer is little disappointing, “we are really not sure” , But don’t be sad Musk track record of getting things done gives a ray of light to the Hyperloop project.
Hyperloop One lists a projected date of 2021 on its website for having “three production systems”, although what that means in terms of working transport is unclear. Hyperloop One chief executive Rob Lloyd has claimed that, following an agreement with Dubai, “from a technological point of view, we could have a Hyperloop One system built in the United Arab Emirates (UAE) in the next five years”.  So let's hope for the best and maybe some day a ride in hyper wouldn't be just a dream.
Source :

--- Swapnil kumar & Sunil kumar

Monday, 31 July 2017

What are Chatbots and How can one make them without knowledge of AI.

What are Chatbots?

Chat bots are computer programs that mimic conversation with people using artificial intelligence. They can transform the way you interact with the internet from a series of self-initiated tasks to a quasi-conversation.

The Kik Bot Store is launching with 16 bots, including the Weather Channel, H&M, Vine and Funny or Die. But the open platform will allow developers to add their own, as long as they comply with Kik’s teen-centric standards (no porn allowed), so expect more soon.

Without a chat bot, a user might direct his browser to, then type in their zip code to get the forecast. With the Kik’s Weather Channel bot, a user can send a chat asking for “Current Conditions” or a “3-Day Forecast” and the bot will reply with your answer.

How Chatbots Work

There are two types of chatbots, one functions based on a set of rules, and the other more advanced version uses machine learning.

Chatbot that functions based on rules:

This bot is very very limited. It can only respond to very specific commands. If you say the wrong thing, it doesn’t know what you mean.
This bot is only as smart as it is programmed to be.

Chatbot that functions using machine learning:

This bot has an artificial brain AKA artificial intelligence. You don’t have to be ridiculously specific when you are talking to it. It understands language, not just commands.
This bot continuously gets smarter as it learns from conversations it has with people.

Bots are created with a purpose. A store will likely want to create a bot that helps you purchase something, where someone like Comcast might create a bot that can answer customer support questions.

Artificial Intelligence

So, if these bots use artificial intelligence to make them work well… isn’t that really hard to do? Don’t I need to be an expert at artificial intelligence to be able to build something that has artificial intelligence?

Short answer? No, you don’t have to be an expert at artificial intelligence to create an awesome chat bot that has artificial intelligence. Just make sure to not over promise on your application’s abilities. If you can’t make the product good with artificial intelligence right now, it might be best to not put it in yet.

The model for the intelligent chatbot?

A chatbot based on the retrieval-based model works on the concept of predefined responses. The chatbot picks appropriate responses from the repository stacked which is based on the context and query raised by the user. Generative models built using machine translation techniques come with the ability to generate new responses right from the word go. Generative models enable longer conversations where the chatbot deals with several user queries. Though deep learning techniques are leveraged for building both these models, generative models seem to draw more power than its counterpart.

Chatbot conversation framework

Sunday, 28 May 2017

Importance of Coaching and Being Coachable

Its been almost 4 months of Internity, and we are ready to launch with Internship in June. We have been getting calls and messages from our dear fellows as how different is this internship,
will we be benefited out of it etc. Back of my mind, a thought always strikes, we are new in this field which already is on its maturity with various sources of learning available online and offline.
All these questions become very valid ones, and obviously all those who've joined us will be having a huge trust on us. So this blog brings an aspect of Internity offerings to provide a life altering experience to our interns.

Internity believes in coaching model, and hence internship is an offering to bring forth the importance of coaching and how being coachable can transform lives of our young fellows.

Two days ago, a movie got released on a man's life who united the entire nation with his game. 'Sachin - A Billion Dreams'. We all know the great man, and the miracles he did.
He too thanked his coach Ramakant Achrekar for all the practice in structure and environment he provided to him. We also saw 'Bhaag Milkha Bhaag', where Milkha Singh even after having so many
achievments worked with his coach till the end. Even in our holy books, there is a saying that a Coach(Guru) has a highest stature in a person's life.

Now, you all must be wondering why coaching model in internship, when so many learning sources are available with classroom offerings, online tutorials etc. Effective Learning requires a structure, 
Our internship provides a structured learning so that an intern generates an efficient output, and our coaching model provides that same structure to the interns, where every intern is
having a coach.

A coaching model is one of the best mechanism of effective and transformative learning, where a coach makes his student to inquire on why, what & how? analogy, by providing an environment to 
the student to play fullout, so that the best effort can be generated. A coach can alter lives of people he's coaching, like Gary Kirsten provided coaching to Indian Cricket Team
and took them to No. 1 spot in all formats of the game. A coach is not one who gives solutions, he lets you inquire deep into the problem and make you generate the solution for that problem
by providing scenarios. 

As we all know that for making things work a two way approach is required, so even though coaches are important, for interns, Being Coachable is most important to get the best out of 
coaching model. Being Coachable only means 'Doing what your coach says to do'. Sachin Tendulkar, Milkha Singh, Usain Bolt all were coachable and hence caused miracles, they did what their
coach asked them to do. At times, there will be regrets, complaints etc. due to the work, but its all for your betterment, coaches only have a commitment to transform your life.

Few days ago, I came across a video where a speaker was talking about Mental Strength and Self-Belief. A coach is a commited listener who enhances self-belief and mental strength. 
At the same time, being coachable brings this into our life and this makes us unstoppable.

I know it is getting a bit longer, but I want to ask a query, as why do all goverment leaders, organisations, NGO's have advisory boards?
Just to bring their work into the structure, these advisors are like coaches to coach on where things are lagging. 

You can now count on us, we are providing a 'Tried and Tested' approach.

Want to experience, Join us..!!

Till then Happy Reading..!!

Rishab Ilwadi

Sunday, 21 May 2017


Dear Readers,

 Have you ever contemplated, what will you doing when you come out of your education? Have you ever thought about what your passion for life is? Or have you sacrificed your innate desire for want of a more “settled” life ahead because you have responsibilities of your family on your shoulders? Whatever the case may be, a cursory look into the most successful people in the world tells us that no one can do wonders unless he is passionate about what he is doing. Now in this Blog we are going to talk about Why, What and How to Pursue your passion.

Why To Pursue Your Passion?

“Don’t worry about what the world needs.  Ask what makes you come alive and do that, because what the world needs is people who have come alive.” ~Howard Thurman

If the quote above isn’t enough we are going to tell you here why you should pursue your desired passion,

Working for money may seem to be a good enough reason for someone to keep their career but it doesn’t come anywhere near to working for Happiness.

By following your passion, you can always relate to what you are doing and come up with better ideas every day.

You can escape the endless cycle of misery because nothing would feel like as if it is forced upon you.

When you really enjoy what you do, no obstacle will stop you from achieving success.

Last but not the least, you are going to invest a large portion of your lives into your jobs and careers, maybe do something that gives you contentment as well.

What To Do Pursue Your Passion?

Now after deciding Why, the next step is What to do to pursue your passion.

Do your complete homework. Be informed about the current market condition of employment, organizations, and typical path to employment in the field of your respective field of passion.

Before kissing goodbye to your current “comfort zone”, make sure to network yourself well in the field of your interest. Assemble a robust professional network beforehand.

Gather thorough knowledge about your field of interest.

If you don’t want to go into the realm of insanity frankly, keep a contingency plan ready.

How To Pursue Your Passion.

In this section, we’ll focus on how to convert above points into reality.

With all the knowledge you have gathered and homework you have done, chalk out a rough blueprint.

Internships can be a great opportunity to attain real life experience in the field of your interest. And for those of you who belong to CS/IT, we are currently providing internships in various fields, for more information click on the following link-

Create a circle of people who share your passion for constant motivation and improvements.

Start meeting people, attending events, reading blogs and subscribe to industry publications early.

Be Patient, success doesn’t come straightaway you have to toil hard and consistently for results to be visible.

There will come the lowest points during the entire exercise. Ultimately how you handle these moments will ultimately determine your success.

Lastly, appreciate that you are getting a chance to live your dream that million others don’t. Make a steely resolve and overcome every obstacle that might come your way.

Hope you had a fruitful reading session. Will catch you soon.

-Avanish Pandey
Team Internity