Monday, April 24, 2017

How to read tabular data using pandas


Tabular data are data that looks like a table. Data with rows and columns like excel spreadsheet.common format is tabular data


Overview of Redis


  • Written in C
  • In memory
  • Optimized to sub mili seconds latency with a single standard server

Sunday, April 23, 2017

Data analysis with Python and Panda

Python 

  • Programming language that lets us work quickly and integrate systems more efficiently
  • Written in C
  • Python is almost fast as C
  • Syntax is very easy

Generators in ES6

Generators are special type of functions in java script that can pause and resume state which would be helpful in asynchronous coding

Haskell

Definition

  • Is truly functional strongly typed, lazily executed expressive high level programming language.
  • There are no for loops, there are no while loops or go-to and no variables

Wednesday, April 19, 2017

ReactDOM



The react-dom package provides DOM-specific methods that can be used at the top level of your app and as an escape hatch to get outside of the React model if you need to.

Tuesday, April 18, 2017

Scaling horizontally and vertically

In the above example we have a requirement to take 50 passengers from LA to Vegas in a bus of max capacity 25.

RAID 0, RAID 1, RAID 5, RAID 10 Explained

RAID stands for Redundant Array of Inexpensive (Independent) Disks.

These are some of the RAIDs which are mostly used.
RAID 0
RAID 1
RAID 5
RAID 10


What is the difference between public and private IP ?

What is public IP address?

  • A public IP address is the address that is assigned to a computing device to allow direct access over the Internet. 
  • A web server, email server and any server device directly accessible from the Internet are candidate for a public IP address. 
  • A public IP address is globally unique, and can only be assigned to a unique device.

Monday, April 17, 2017

Flux vs Redux


Flux:It has 3 core concepts , Actions Dispatcher and Store

  • When actions are triggered stores are notified by the dispatcher. 

New concepts in Redux

Reducers are functions that take the current state in an action and returns the new state

Containers are react components that are user specific.Container component contains the necessary logic for marshaling data and actions which they pass to dumb components through props. These clear separation helps to keep it simple

Immutability Redux store are immutable

Similarity between Flux and Redux



  • They have the same unidirectional flow, data flows down actions flows up
  • They define finite set of actions that changes the state
  • They both have the concept of stores


Core principles of Redux


Redux has 3 principles

  • All application state is placed in a single application store (Helps is testing and debugging )
  • Only way to mutate state is to emit an action which describes the user intent
  • State is changed by pure functions. These are called as Reducers.

Path to choosing Redux


  • If the application is simple it is better to choose vanilla javascript
  • If the application needs to do ajax calls and DOM manipulation then we use JQuery

Sunday, April 16, 2017

How to find a factorial of a number ?


In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,
The value of 0! is 1, according to the convention for an empty product.[1]

Friday, April 14, 2017

Template literals in ES6



Template literals are new features that helps working with strings and string templates.We wrap our text in  `backticks  `

Finally we have classes in ES6


Classes creation and usage in ES5 was a pain. In ES6 we have class keyword and we can create methods and constructor on this class.

Note:This feature would not make JavaScript an object oriented language .These are syntax sugar over functions (Prototype over inheritance language)

Charlies angles for declaring variables in ES6



All these days we were able to use only var for declaring variables. Now we have the charlies angles options for declaring variables . What I mean is we have three ways of declaring variables.

Previously we had only 2 scopes. function scope and global scope. global scope is assigned if we do not declare var

How to use destructuring assignment in ES6 ?




Destructuring assignments helps to reduce the no of lines of code. Its basically sugarcoating

Thursday, April 13, 2017

Angular 2 validations for input field

Angular places these classes automatically on the form. Same css classes are also available as properties for ng module

Data binding in Angular 2


How to install React



Guide for react installation can be found at : https://facebook.github.io/react/docs/installation.html

Steps involved
1) Create a project
npm init

2 ) Install React and React DOM
npm install --save react react-dom

Important changes in angular 4



These are some of the important changes related to angular 4
  • Skipping angular 3.0 to angular 4.0 so we can align core with the router which is already 3.0
  • Compiler is faster compared to angular 2
  • Some of the bugs which are in angular 2 are rectified in angular 4
  • Else clause has been introduced 
 

Resources in REST


  • Client consumes servers capability by interacting with resources
  • Resources are identified by a resource identifier.In http terms this is an URL
  • Client interacts with resources the client does not work directly with the resources but with representations of those resources
         Example Person can be identified by name. We directly do not work with the Person by representation of person using JSON or XML. The message should also contain meta data about what to do with the services

How do we reverse a string?



There are 2 ways of doing this

using array reverse function or by converting the string to character array


Wednesday, April 12, 2017

How to find the max in array of integers?


To find the max integer value we need to loop through the array and then assume last element is the greatest and the compare the current value. If cur is greater then last then max=cur

How do I reverse integer array?




To reverse an integer array we swap items until we reach the midpoint as shown below

 public int [] ReverseIntArray()
        {
            int[] arr = { 1, 5, 20 };
            
            for(int i= 0;i< (arr.Length)/2;i++)
            {
                int temp = arr[i];
                //Keep traversing from last
                arr[i] = arr[arr.Length - 1-i];
                arr[arr.Length - 1 - i] = temp;
            }

            return arr;
        }

Avoiding global scope in java script


Why global variables are bad?

  • The primary reason why we need to avoid global scope is because all code share a single global namespace.
  • JavaScript implied global namespace. i.e variables that are not explicitly not described in local scope are automatically added to global namespace
  • Relying on this might result in collision between various scripts on the same page
  • JavaScript does not have the concept of function overloading

OOPS quick reference


OOPS

  • Problem solving technique to develop software systems
  • Technique to think real world in terms of objects
  • Object maps the software to real world object
  • These objects have responsibility or provide services to application or other objects

String Manipulation ( Change first letter to Uppercase )



Angular function for converting the first letter to uppercase
firstNameToUpperCase(value:string){
       //Check if the value exists
      if(value.length > 0)
      {
        //Fetch the first character and turn it into upper and leave the rest
        this.userModel.firstName=value.charAt(0).toUpperCase() + value.slice(1);

      }
      else
      {
          this.userModel.firstName=value;
      }
   }

Overview of Restful api


Richardson's Maturity Model

The path towards REST is defined by Leonard Richardson
 Only level 3 in this model can be considered REST



 It starts at ( POX) Plain old XML )

HATEOAS on REST



HATEOAS, an abbreviation for Hypermedia As The Engine Of Application State, is a constraint of the REST application architecture that distinguishes it from most other network application architectures. The principle is that a client interacts with a network application entirely through hypermedia provided dynamically by application servers. A REST client needs no prior knowledge about how to interact with any particular application or server beyond a generic understanding of hypermedia. By contrast, in some service-oriented architectures (SOA), clients and servers interact through a fixed interface shared through documentation or an interface description language (IDL).
The HATEOAS constraint decouples client and server in a way that allows the server functionality to evolve independently.

Quick reference for Angular 2 changes


Changes in Angular 2 compared to angular 1

  • Ngref= href property binding. Browser module has definition to *ngref. Any directive that changes the directive is known as structural directive
    *ngFor
  • No watchers and No digest cycle
  • Binding syntax has been changed
    • Property binding is done using [ ]
                  Element property  < Img [src] = "vehicle.imageurl">

Tuesday, April 11, 2017

Reverse a string containing Japaneese and chinese characters


Problem statement: We need to reverse the sentence containing Japanese and Chinese character.

Ex "ABCabcDEFdef . Here we need to assume that the capital letters are Japanese and smaller letters are Chinese.

We need to get an o/p as "defDEFabcABC"

Steps involved

  • Write function to identify if the character is Chinese or Japanese character
  • Check if previous character is different than the current. If it is different then add a space
  • Use split and then reverse the string
  • Remove the empty space


Quick reference for clustered index vs non clustered index


ConfigureServices and Configure ASP.Net Core




   ConfigureServices and Configure can be specified in the startup.cs 

Comparison backbone vs ember, knockout vs ember, ember vs angular 1



Comparing backbone vs Ember is not fair

Backbone

  • Small set of library sit on top of jquery
  • We need to write own abstractions to sit on backbones core part
  • Uses collections and models
  • Does not try to abstract everything away rather it leaves to us
  • Developer who does not mind writing code his way this is a fine choice
Ember
  • If we do not want every single detail in your application focus  solving the problem on hand  instead how you solve Ember is a good choice

Big O notation


  • Big O notation is the language we use for articulating how long an algorithm takes to run. It's how we compare the efficiency of different approaches to a problem.
  • With big O notation we express the runtime in terms of—brace yourself—how quickly it grows relative to the input, as the input gets arbitrarily large.


Labels