Thursday, April 7, 2016

JAVASCRIPT - the use of bind method of Function.prototype.bind()

https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Function/bind

Method bind() will bind the scope of the object's (passed as parameter) this to the function on which it was called.

this.x = 9;
var module = {
  x: 81,
  getX: function() { return this.x; }
};

module.getX(); // 81

var getX = module.getX;
getX(); // 9, поскольку в этом случае this ссылается на глобальный объект

// создаём новую функцию с this, привязанным к module
var boundGetX = getX.bind(module);
boundGetX(); // 81
function list() {
  return Array.prototype.slice.call(arguments);
}

var list1 = list(1, 2, 3); // [1, 2, 3]

// Создаём функцию с предустановленным ведущим аргументом
var leadingThirtysevenList = list.bind(undefined, 37);

var list2 = leadingThirtysevenList(); // [37]
var list3 = leadingThirtysevenList(1, 2, 3); // [37, 1, 2, 3]

REGEXP - good source for learning regexp

https://ponyfoo.com/articles/learn-regular-expressions

Wednesday, April 6, 2016

IMPOSTOR SYNDROME - when an experienced programmer feel like a perpetual beginner

I've been programming for 6 years and I feel like I'm a perpetual beginner. Do many other programmers feel this way?


Answers from different programmers:

Yes, it's called Impostor Syndrome. If you want to see an army of beginners, walk into a high tech company full of experienced programmers.

Well, that's pretty the same thing for 99% of devs.

When you start questioning yourself, that's very good - means that from now on, the real programming starts.

We grow in cycles and you need to invest most patience when you doubt yourself the most! and just go to that online course or book or repl and just to a tiny little program. 

MapReduce. What is it?

MapReduce is compound from two main steps:

Map step (input files)
Map step is the process of going through the unformatted data and generating a series of key-value pairs.

Shuffle intermediate step (processing of the data of input files)
All of the values for a given key are collated into separated piles (common keys go to one folder).

Reduce step (output files)
Producer Node will count tally for each key (from all data values of that key is a folder)


HADOOP

Hadoop = MapReduce + HDFS 

It is an Apache project combining:
MapReduce engine with Hadoop Distributed File System (HDFS)

HDFS allows many local disks of each Node operate in a Hadoop Cluster as a single pool of storage.
Files are replicated across nodes (by default 1 original has 2 copies, 3 in total)

Hadoop stack (from bottom to top)

  1. MapReduce + HDFS
  2. Database: HBase (NoSQL Database). HBase tables are HDFS files. Optionally HBase tables can be used as an input for MapReduce jobs or MapReduce job's output can create a new HBase table.
  3. Query: HiveQL (SQL abstraction layer over MapReduce) + Pig Latin (its commands corresponds to a different SQL commands: used for querying and stepwise data transformation as an ETL tool)
  4. RDBMS Import/Export: Sqoop (Additional component to Hive and Pig, moves data between Hadoop and any RDBMS)
  5. Machine Learning / Data Mining: Mahout
  6. Log file integration: Flume




EMR (Elastic MapReduce) is a Hadoop distro from AWS
It has in common: MapReduce and HDFS + Database +  Hive and Pig.
It adds MPP \ Column Store: Impala (Cloudera)

Hive and Pig is an abstraction layer over MapReduce. Hive is a batch system.
Impala is an abstraction layer over HDFS. Impala is an interactive query engine.






Tuesday, April 5, 2016

NoSQL categories and DynamoDB example

NoSQL has 4 categories:
Key-Value stores (AWS DynamoDB)
Document stores (MongoDB)
Graph stores (Nodes keep the data)
Wide Column / Column Family stores
In Key-Value store e.g. DynamoDB tables have rows, rows have key and value


Querying in Key-Value store








CAP theorem - Consistency, Availability, Partition Tolerance

CAP stands for:
Consistency, Availability, Partition Tolerance

SQL
priorities Consistency first and then Partition Tolerance

NoSQL
priorities Partition Tolerance first and then Availability



AWS - Big Data stack components components overview

AWS Big Data stack components overview

  • Elastic MapReduce (EMR)
  • Redshift
  • DynamoDB
  • Data Pipline (ETL tool)
  • Simple Storage Service (S3)
  • Jaspersoft AWS
  • Kinesis (streaming data)
Elastic MapReduce (MapReduce - processing algorythm)
Amazon implementation of Hadoop
Hadoop-on-Demand
Integrated with S3 (Simple Storage Service)
Amazon distro or MapR
MapR - Unlike other Hadoop distributions that require separate clusters for multiple applications, the MapR Platform is built to process both distributed files, database tables, and event streams in one unified layer – an engineering feat in its own right. This enables organizations to support both operational (e.g., HBase) and analytic apps (e.g., Apache Drill, Hive, or Impala) on one cluster, significantly reducing costs as you grow your big data deployment. https://www.mapr.com/why-hadoop/why-mapr
Redshift 
Cloud-based, Massively Parallel Processing (MPP), column store data warehouse.
Uses common relational, SQL technology.
Integrated with S3 and DynamoDB

DynamoDB
Based on Dynamo, Amazon's internal, seminal Key-Value store
Accommodates unstructured data - no schema needs to be declared
Replaced Amazon SimpleDB

    Data Pipline (ETL tool - Extract Transform Load)
    A workflow system for shaping data and moving data from table to table, DB to DB +=>
    Serves as an Integration tool for AWS Big Data stack components (moves components)
    Build pipelines graphically (WEB) or programmatically (scripts)
    Works on a scheduled, batch bases
    Integrates with RDS/MySQL (Relational Database Service from Amazon - SQL distributed solution)

    Important Acronyms
    AWS Amazon Web Services
    EC2 Elastic Compute Cloud
    AMI Amazon Machine Image
    S3 Simple Storage Service
    EMR Elastic MapReduce
    VPC Virtual Private Cloud
    IAM Identity and Access Management
    SSH Secure Socket Shell

    Getting Set Up with AWS
    Create an account
    Create a Key pair
    Create an S3 bucket
    Install SSH client
    Install S3 client
    Install SQL Workbench, drivers