Wednesday, December 21, 2016

What is MEAN stack? Why is it popular?

What’s the MEAN Stack?


MEAN is an acronym made up of commonly used technologies for an all JavaScript web stack. You don’t have to use this combination and there are many alternative choices, especially on the client-side such as Backbone, Ember etc.

This particular combination of tools has generated a lot of traction in the enterprise area and is framework based, making it a good place to start.

The key components are:


  • MongoDB (Database)
  • ExpressJS (Web Framework)
  • AngularJS (Front-end Framework)
  • NodeJS (Application Server)



Why MEAN stack?

NodeJS has been built from bottom up a non-blocking I/O paradigm, which gives you more efficiency per CPU core than using threads in other languages like Java.

LAMP (Linux-Apache-MySQL-PHP) has dominated web application stack for many years now. Well-known platforms such as Wikipedia, Wordpress, and even Facebook uses it or started with it. Enterprise, usually, used go down the Java path: Hibernate, Spring, Struts, JBoss. More agile frameworks also have been used such as Ruby on Rails and for Python Django and Pylon.

























Request Flow

Diagram Dataflow











Friday, December 16, 2016

Learn PL/SQL in 20 minutes

Introduction

PL/SQL is procedural language.
Syntax of PL/SQl Block:
The Declaration section (optional).
The Execution section (mandatory).
The Exception Handling (or Error) section (optional).

Note-: Every statement in the above three sections must end with a semicolon ; . PL/SQL blocks can be nested within other PL/SQL blocks. Comments can be used to document code.


Sample PL/SQL Block

DECLARE
     Variable declaration
BEGIN
     Program Execution
EXCEPTION
      Exception handling
END;


PL/SQL Placeholders

Placeholders are temporary storage area. PL/SQL Placeholders can be any of Variables, Constants and Records.
Oracle defines placeholders to store data temporarily, which are used to manipulate data during the execution of a PL SQL block.
Depending on the kind of data you want to store, you can define placeholders with a name and a datatype. Few of the datatypes used to define placeholders are as given below: Number (n,m) , Char (n) , Varchar2 (n) , Date , Long , Long raw, Raw, Blob, Clob, Nclob, Bfile

General Syntax to declare a variable is:
variable_name datatype [NOT NULL := value ];
Example
DECLARE
salary number(4);
dept varchar2(10) NOT NULL := “HR Dept”;

Variable Declaration

1) We can directly assign values to variables.
    The General Syntax is:      
  variable_name:=  value;

2) We can assign values to variables directly from the database columns by using a SELECT.. INTO statement. The General Syntax is:
SELECT column_name
INTO variable_name
FROM table_name
[WHERE condition];

Example
DECLARE  var_salary number(6);
 var_emp_id number(6) := 1116;
BEGIN
 SELECT salary  INTO var_salary  FROM employee  WHERE emp_id = var_emp_id;
END;

Constant

General Syntax to declare a constant is:
constant_name CONSTANT datatype := VALUE;

Note:-You must assign a value to a constant at the time you declare it. If you do not assign a value to a constant while declaring it and try to assign a value in the execution section, you will get a error. If you execute the below Pl/SQL block you will get error.

Example
DECLARE  salary_increase CONSTANT number (3) := 10;

DECLARE  salary_increase CONSTANT number(3);
BEGIN
 salary_increase := 100;       --Error will be shown
 dbms_output.put_line (salary_increase);
END;

Records

 Records are composite datatypes, which means it is a combination of different scalar datatypes like char, varchar, number etc.  Each scalar data types in the record holds a value. A record can be visualized as a row of data. It can contain all the contents of a row.
The General Syntax to define a composite datatype is:
TYPE record_type_name IS RECORD (first_col_name column_datatype, second_col_name column_datatype, ...);

Example
DECLARE
 TYPE employee_type IS RECORD
(employee_id number(5),  employee_first_name varchar2(25),  employee_last_name employee.last_name%type,  employee_dept employee.dept%type);

Syntax’s to declare Record
Following syntax is used to declare a record based on a user-defined type:
       record_name record_type_name;
2.     If all the fields of a record are based on the columns of a table, we can declare the record as follows:
       record_name table_name%ROWTYPE;

How to put Value
The General Syntax to assign a value to a column within a record directly is:
        record_name.col_name := value;
If you used %ROWTYPE to declare a record, you can assign values as shown:
        record_name.column_name := value;
To assign values to each field of a record from the database table
     SELECT col1, col2  INTO record_name.col_name1, record_name.col_name2  FROM table_name  [WHERE     clause];
To assign a value to all fields in the record from a database table.
SELECT * INTO record_name  FROM table_name  [WHERE clause];


Conditional Statements in PL/SQL

IF condition 1
THEN
 statement 1;
 statement 2;
ELSIF condtion2 THEN
 statement 3;
ELSE
 statement 4;
END IF

IF condition 1
THEN
 statement 1;
 statement 2;
ELSIF condtion2 THEN
 statement 3;
ELSE
 statement 4;
END IF;

IF condition1
THEN
ELSE
 IF condition2 THEN
 statement1;
 END IF;
ELSIF condition3 THEN
  statement2;
END IF;


Iterative Statements in PL/SQL

There are three types of loops in PL/SQL:
Simple Loop
     LOOP 
   statements; 
   EXIT; 
   {or EXIT WHEN condition;}
  END LOOP;
While Loop
                 WHILE <condition> 
                  LOOP statements; 
                 END LOOP;
For Loop
           FOR counter IN val1..val2 
             LOOP statements; 
             END LOOP; 
                          
                             val1 - Start integer value.
                             val2 - End integer value.
   
Cursors

A cursor is a temporary work area created in the system memory when a SQL statement is executed.
This temporary work area is used to store the data retrieved from the database, and manipulate this data. 
A cursor can hold more than one row, but can process only one row at a time. The set of rows the cursor holds is called the active set.
Types of Cursors
1.Implicit cursors:-These are created by default when DML statements like, INSERT, UPDATE, and DELETE statements are executed. They are also created when a SELECT statement that returns just one row is executed. 
2.Explicit cursors:-They must be created when you are executing a SELECT statement that returns more than one row. Even though the cursor stores multiple records, only one record can be processed at a time, which is called as current row. When you fetch a row the current row position moves to next row.

Implicit Cursors

When you execute DML statements like DELETE, INSERT, UPDATE and SELECT statements, implicit statements are created to process these statements.
Oracle provides few attributes called as implicit cursor attributes to check the status of DML operations. The cursor attributes available are %FOUND, %NOTFOUND, %ROWCOUNT, and %ISOPEN. 

Explicit Cursors

Explicit Cursors-:An explicit cursor is defined in the declaration section of the PL/SQL Block. It is created on a SELECT Statement which returns more than one row
 1) Declaring a Cursor in the Declaration Section:
  DECLARE   CURSOR emp_cur IS    SELECT *    FROM emp_tbl   WHERE salary > 5000; 
2) Accessing the records in the cursor:
   These are the three steps in accessing the cursor.
Open the cursor.
Fetch the records in the cursor one at a time.
Close the cursor.

Stepwise
General Syntax to open a cursor is:
OPEN cursor_name;

General Syntax to fetch records from a cursor is:
FETCH cursor_name INTO record_name;
OR 
FETCH cursor_name INTO variable_list;

General Syntax to close a cursor is:
CLOSE cursor_name;




Procedures

A stored procedure or in simple a proc is a named PL/SQL block which performs one or more specific task.
A procedure has a header and a body. The header consists of the name of the procedure and the parameters or variables passed to the procedure. The body consists of declaration section, execution section and exception section similar to a general PL/SQL Block.
A procedure is similar to an anonymous PL/SQL Block but it is named for repeated usage.
Note-:   IS - marks the beginning of the body of the procedure and is similar to DECLARE in anonymous PL/SQL Blocks. The code between IS and BEGIN forms the Declaration section.





PL/SQL Functions

A function is a named PL/SQL Block which is similar to a procedure. The major difference between a procedure and a function is, a function must always return a value, but a procedure may or may not return a value.

General Syntax to create a function is
CREATE [OR REPLACE] FUNCTION function_name [parameters] 
RETURN return_datatype;  
IS  
Declaration_section  
BEGIN  
Execution_section 
Return return_variable;  
EXCEPTION  
exception section  
Return return_variable;  
END; 

1) Return Type: The header section defines the return type of the function. The return datatype can be any of the oracle datatype like varchar, number etc.
2) The execution and exception section both should return a value which is of the datatype defined in the header section.




Parameters in Procedure and Functions

In PL/SQL, we can pass parameters to procedures and functions in three ways.
1) IN type parameter: These types of parameters are used to send values to stored procedures.
2) OUT type parameter: These types of parameters are used to get values from stored procedures. This is similar to a return type in functions.
3) IN OUT parameter: These types of parameters are used to send values and get values from stored procedures.

NOTE: If a parameter is not explicitly defined a parameter type, then by default it is an IN type parameter.

General syntax to pass a IN parameter is
CREATE [OR REPLACE] PROCEDURE procedure_name (
  param_name1 IN datatype, param_name12 IN datatype ... )
 General syntax to create an OUT parameter is
CREATE [OR REPLACE] PROCEDURE proc2 (param_name OUT datatype)
General syntax to create an IN OUT parameter is
CREATE [OR REPLACE] PROCEDURE proc3 (param_name IN OUT datatype)




Example of IN OUT parameter





Exception Handling

General Syntax:
 DELCARE
   Declaration section 
 BEGIN
    DECLARE
      Declaration section 
    BEGIN 
      Execution section 
    EXCEPTION 
      Exception section 
    END; 
 EXCEPTION
   Exception section 
 END; 


Types of Exception

There are 3 types of Exceptions. 
a) Named System Exceptions 
b) Unnamed System Exceptions 
c) User-defined Exceptions


Example of Unnamed Exception 




Example of User Defined Exception

DECLARE
  huge_quantity EXCEPTION;
  CURSOR product_quantity is
  SELECT p.product_name as name, sum(o.total_units) as units
  FROM order_tems o, product p
  WHERE o.product_id = p.product_id;
  quantity order_tems.total_units%type;
  up_limit CONSTANT order_tems.total_units%type := 20;
  message VARCHAR2(50);
BEGIN
  FOR product_rec in product_quantity LOOP
    quantity := product_rec.units;
     IF quantity > up_limit THEN
      message := 'The number of units of product ' || product_rec.name ||
                 ' is more than 20. Special discounts should be provided.
Rest of the records are skipped. '
     RAISE huge_quantity;
     ELSIF quantity < up_limit THEN
      v_message:= 'The number of unit is below the discount limit.';
     END IF;
     dbms_output.put_line (message);
  END LOOP;
 EXCEPTION
   WHEN huge_quantity THEN
     dbms_output.put_line (message);
 END;
/

TRIGGER

A trigger is a pl/sql block structure which is fired when a DML statements like Insert, Delete, Update is executed on a database table. A trigger is triggered automatically when an associated DML statement is executed.

Syntax for Creating a Trigger:

 CREATE [OR REPLACE ] TRIGGER trigger_name
 {BEFORE | AFTER | INSTEAD OF }
 {INSERT [OR] | UPDATE [OR] | DELETE}
 [OF col_name]
 ON table_name
 [REFERENCING OLD AS o NEW AS n]
 [FOR EACH ROW]
 WHEN (condition)
 BEGIN
   --- sql statements
 END;

Types of PL/SQL Triggers

There are two types of triggers based on the which level it is triggered.
1) Row level trigger - An event is triggered for each row upated, inserted or deleted. 
2) Statement level trigger - An event is triggered for each sql statement executed. 

1) BEFORE UPDATE, Statement Level: This trigger will insert a record into the table 'product_check' before a sql update statement is executed, at the statement level.

CREATE or REPLACE TRIGGER Before_Update_Stat_product 
BEFORE 
UPDATE ON product 
Begin 
INSERT INTO product_check 
Values('Before update, statement level',sysdate); 
END; 
2) BEFORE UPDATE, Row Level: This trigger will insert a record into the table 'product_check' before each row is updated.

 CREATE or REPLACE TRIGGER Before_Upddate_Row_product 
 BEFORE 
 UPDATE ON product 
 FOR EACH ROW 
 BEGIN 
 INSERT INTO product_check 
 Values('Before update row level',sysdate); 
 END; 

View 

A view is a predefined query on one or more tables.
Retrieving information from a view is done in the same manner as retrieving from a table.
With some views you can also perform DML operations (delete, insert, update) on the base tables.
Views don't store data, they only access rows in the base tables.
user_tables, user_sequences, and user_indexes are all views.
View Only allows a user to retrieve data.
view can hide the underlying base tables.
By writing complex queries as a view, we can hide complexity from an end user.
View only allows a user to access certain rows in the base tables.
Example-:
CREATE VIEW my_view AS  SELECT *  FROM employee  WHERE id < 5;
Syntax-:
CREATE [OR REPLACE] VIEW [{FORCE | NOFORCE}] VIEW view_name
[(alias_name[, alias_name...])] AS subquery
[WITH {CHECK OPTION | READ ONLY} CONSTRAINT constraint_name];


Index

An index for a database table is similar in concept to a book index.
When a row is added to the table, additional time is required to update the index for the new row.
Oracle database automatically creates an index for the primary key of a table and for columns included in a unique constraint.

You create an index using CREATE INDEX, which has the following simplified syntax:
CREATE [UNIQUE] INDEX index_name ON table_name(column_name[, column_name...])  TABLESPACE table_space;







What is meant by Full Stack Developer

The term full-stack means developers who are comfortable working with both back-end and front-end technologies. 



Layers of the full stack
  • Server, Network, and Hosting Environment.
This involves understanding what can break and why, taking no resource for granted.
Appropriate use of the file system, cloud storage, network resources, and an understanding of data redundancy and availability is necessary.
How does the application scale given the hardware constraints?
What about multi-threading and race conditions? Guess what, you won’t see those on your development machine, but they can and do happen in the real world.
Full stack developers can work side by side with DevOps. The system should provide useful error messages and logging capabilities. DevOps will see the messages before you will, so make them count.

  • Data Modeling
If the data model is flawed, the business logic and higher layers start to need strange (ugly) code to compensate for corner cases the data model doesn’t cover.
Full stack developers know how to create a reasonably normalized relational model, complete with foreign keys, indexes, views, lookup tables, etc.
Full stack developers are familiar with the concept of non-relational data stores and understand where they shine over relational data stores.

  • Business Logic
The heart of the value the application provides.
Solid object oriented skills are needed here.
Frameworks might be needed here as well.

  • API layer / Action Layer / MVC
How the outside world operates against the business logic and data model.
Frameworks at this level should be used heavily.
Full stack developers have the ability to write clear, consistent, simple to use interfaces. The heights to which some APIs are convoluted repel me.

  • User Interface
Full stack developers: a) understand how to create a readable layout, or b) acknowledge they need help from artists and graphic designers. Either way, implementing a good visual design is key.
Can include mastery of HTML5 / CSS.
JavaScript is the up and coming language of the future and lots of exciting work is being done in the JavaScript world (node, backbone, knockout…)

  • User Experience
Full stack developers appreciate that users just want things to work.
A good system doesn’t give its users carpal tunnel syndrome or sore eyes. A full stack developer can step back and look at a process that needs 8 clicks and 3 steps, and get it down to one click.
Full stack developers write useful error messages. If something breaks, be apologetic about it. Sometimes programmers inadvertently write error messages that can make people feel stupid.
Understanding what the customer and the business need.
Now we are blurring into the line of architect, but that is too much of a hands off role.
Full stack developers have a grasp of what is going on in the field when the customer uses the software. They also have a grasp of the business.

How skilled are you in each discipline?

The basics of the languages/frameworks we learn today can often be picked up in a matter of hours. We no longer add skills to our CVs by taking a course, we simply download some code and start hacking through tutorials and demo code. The problem is, I feel the difference between knowing something in web development and truly mastering it is now becoming an increasingly blurred line.

It's very easy to become disillusioned with your own skills when you've deployed some code which has been consumed by lots of users. Let's say you've written a web application which has scaled well under load, and you've received great feedback. Are you a master of everything you used in this stack? Or are you simply good at implementing the layers you needed to make things work together? Because that's an entirely different skill, and in fact a very valuable one.

The skill of acquiring new skills

In my eyes the most valuable skill to have is the ability to learn, closely followed by the ability to know when you don't know something. I'm sure we've all met people who decide to put brakes on their own learning because they believe they've become a master at something. I don't know about you, but the smartest people I know (and the ones I have most respect for) are the ones who are still eager to learn new things every day, from everyone they meet. These people just don't stop growing, in terms of both ability and character.


Employability of a true full-stack developer

The employability of a true full-stack developer: HIGH.
The chances of finding a good full-stack developer: LOW.
Smaller companies and startups NEED full-stack developers. Developers are often forced to acquire new skills when the resources simply aren't available. I feel the problem for companies desperate to hire these guys and girls, is that the real multi-skilled developers are often lost in a sea of douchebags, claiming they know it all.


Conclusion


Technology start-ups need full stack developers for their versatility!  However, as an organization matures, it needs more and more focused skills.
I’m not sure you can call yourself a full stack developer until you have worked in multiple languages, platforms, and even industries in your professional career. Note that , only items 3-5 involve writing code.


Thursday, December 15, 2016

Learn Java Spring in 20 minutes

       Client Server Architecture

       To start we must understand client server architecture, which can be seen in below diagram-:
           MVC Architecture
One of the earliest architecture which standardized procedures in client server architecture is MVC architecture.



       Struts
For the ease of developer, frameworks were introduced based on MVC architecture at its core. Struts with different version was introduced.




       Why Use Spring?
Spring having this much of demand because of the following 3 reasons….
  • Simplicity
  • Testability
  • Loose Coupling
The Spring framework is an extremely powerful Inversion of control(IoC) framework to help decouple your project components’ dependencies.

       Spring Introduction

Spring is a light weight (because of its POJO model)and open source framework.
Spring framework can be used for all layer implementations for a real time application or spring can be used for the development of particular layer of a real time application unlike struts [ only for front end related ] and hibernate [ only for database related ], but with spring we can develop all layers.

       Spring Modules


       Inversion of Control

The IOC container is responsible to instantiate, configure and assemble the objects. The IOC container gets information from the XML file and works accordingly. The main tasks performed by IOC container are:
  • to instantiate the application class
  • to configure the object
  • to assemble the dependencies between the objects.

There are two types of IOC containers. They are:
  • BeanFactory
  • ApplicationContext

Spring IOC container takes a form of configuration metadata(Which explain container how to initiate
object and configure) and combine it with application classes which in the end produces fully configured system.

Configuration metadata required for container can be provided in any of three ways.
  • XML
  • Java Code
  • Java Annotations

       Spring Core Example
     







    Dependency Injection

Dependency Injection (DI) is a design pattern that removes the dependency from the programming code so that it can be easy to manage and test the application. Dependency Injection makes our programming code loosely coupled.

Spring framework provides two ways to inject dependency
  • By Constructor
  • By Setter method

     Constructor based dependency Injection


       Setter based Dependency Injection


 Difference between Setter and Constructor based Dependency

  • Setter Injection is more readable than constructor injection in Spring configuration file usually applicationContext.xml . 
  • Another difference between setter vs constructor injection in Spring and one of the drawback of  setter injection is that it does not ensures dependency Injection. You can not guarantee that certain dependency is injected or not, which means you may have an object with incomplete dependency. On other hand constructor Injection does not allow you to construct object, until your dependencies are ready.
  •  One more drawback of setter Injection is Security. By using setter injection, you can override certain dependency which is not possible which is not possible with constructor injection because every time you call the constructor, a new object is gets created.
  • Also drawback of setter Injection around ensuring mandatory dependency injected or not can be handled by configuring Spring to check dependency using "dependency-check" attribute of  tag or tag.
  • Setter Injection is preferred choice when number of dependency to be injected is lot more than normal, 




       Bean Definition


       Bean scope
  
Example of Singleton-:






   Example of Prototype-:


Autowiring in Spring

The Spring container can autowire relationships between collaborating beans without using <constructor-arg> and <property> elements which helps cut down on the amount of XML configuration you write for a big Spring based application.



Example of code with/without using autowiring


Example of byType-: If a bean definition is set to autowire byType in configuration file, and it contains a spellChecker property of SpellChecker type, Spring looks for a bean definition named SpellChecker, and uses it to set the property. Still you can wire remaining properties using <property> tags.

Bean Life Cycle

There are various interfaces that bean class can implement and can get method to control bean lifecycle at various stage.
  1. Instantiate - The Spring container instantiates the bean.
  2. Populate properties- Spring IoC container injects the bean’s properties.
  3. Set Bean Name- Spring container sets the bean name. If the bean implements BeanNameAware, spring container passes the bean’s id to setBeanName() method.
  4. Set Bean Factory-If the bean implements BeanFactoryAware, Spring container passes theBeanFactory to setBeanFactory().
  5. Pre Initialization-This stage is also called the bean postprocess . If there are anyBeanPostProcessors, theSpring container calls the postProcesserBeforeInitialization () method.
  6. Initialize beans- If the bean implements IntializingBean,its afterPropertySet()method is called. If the bean has init method declaration, the specified initialization method is called.
  7. Post Initialization- IfBeanPostProcessors is implemented by the bean, the Spring container calls their postProcessAfterinitalization() method.
  8. Ready to Use- Now the bean is ready to be used by the application.
  9. Destroy- The bean is destroyed during this stage. If the bean implements DisposableBean, the Spring IoC container will call the destroy() method . If a custom destroy () method is defined, the container calls the specified method.


Spring MVC

Spring MVC provides an elegant solution to use MVC in spring framework by the help of DispatcherServlet.

In Spring Web MVC, DispatcherServlet class works as the front controller. It is responsible to manage the flow of the spring MVC application.

There are basically 4 annotations , most commonly used, @Component,@Controller(used for controller part),@Service(used for business layer),@Repositories(used for DAO layer). Last three are layer specific whereas Component is generic.

The @Controller annotation is used to mark the class as the controller in Spring 3.The @RequestMapping annotation is used to map the request url. It is applied on the method and used in conjunction with @controller.

Upon initialization of DispatcherServlet, the framework will try to load the application context from a file named [servlet-name]-servlet.xml located in the application's WebContent/WEB-INF directory.


Architecture



MVC Example


controller








Spring Event handling 


S.N.Spring Built-in Events & Description
1
ContextRefreshedEvent
This event is published when the ApplicationContext is either initialized or refreshed. This can also be raised using the refresh() method on the ConfigurableApplicationContext interface.
2
ContextStartedEvent
This event is published when the ApplicationContext is started using the start() method on the ConfigurableApplicationContext interface. You can poll your database or you can re/start any stopped application after receiving this event.
3
ContextStoppedEvent
This event is published when the ApplicationContext is stopped using the stop() method on the ConfigurableApplicationContext interface. You can do required housekeep work after receiving this event.
4
ContextClosedEvent
This event is published when the ApplicationContext is closed using the close() method on the ConfigurableApplicationContext interface. A closed context reaches its end of life; it cannot be refreshed or restarted.
5
RequestHandledEvent
This is a web-specific event telling all beans that an HTTP request has been serviced.

Follow link for https://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html  

Understanding Database Technology in IT world: RDBMS Vs NoSQL

There are basically two types of databases.
1. RDBMS
2. NOSQL


      RDBMS vs NoSQL

NoSQL isn’t relational, and it is designed for distributed data stores for very large scale data needs (e.g. Facebook or Twitter accumulate Terabits of data every day for millions of its users), there is no fixed schema and no joins. Meanwhile, relational database management systems (RDBMS) “scale up” by getting faster and faster hardware and adding memory. NoSQL, on the other hand, can take advantage of “scaling out” – which means spreading the load over many commodity systems.

The acronym NoSQL was coined in 1998, and while many think NoSQL is a derogatory term created to poke fun at SQL, in reality it means “Not Only SQL” rather than “No SQL at all.” The idea is that both technologies (NoSQL and RDBMSs) can co-exist and each has its place. Companies like Facebook, Twitter, Digg, Amazon, LinkedIn and Google all use NoSQL in some way — so the term has been in the current news often over the past few years.

       What’s Wrong with RDBMS?

Well, nothing, really. They just have their limitations. Consider these three problems with RDBMSs:
RDBMSs use a table-based normalization approach to data, and that’s a limited model. Certain data structures cannot be represented without tampering with the data, programs, or both.
They allow versioning or activities like: Create, Read, Update and Delete. For databases, updates should never be allowed, because they destroy information. Rather, when data changes, the database should just add another record and note duly the previous value for that record.

Performance falls off as RDBMSs normalize data. The reason: Normalization requires more tables, table joins, keys and indexes and thus more internal database operations for implement queries. Pretty soon, the database starts to grow into the terabytes, and that’s when things slow down.
  
        Four Categories of NoSQL

1. Key-values Stores
  • Examples                     Tokyo Cabinet/Tyrant, Redis, Voldemort, Oracle BDB
  • Typical applications     Content caching (Focus on scaling to huge amounts of data, designed to handle massive load), logging, etc.
  • Data model                   Collection of Key-Value pairs
  • Strengths                        Fast lookups
  • Weaknesses                    Stored data has no schema

2.   Column Family Stores
  •  Examples                    Cassandra, HBase, Riak
  • Typical applications     Distributed file systems
  • Data model                   Columns → column families
  • Strengths                      Fast lookups, good distributed storage of data
  • Weaknesses                   Very low-level API

3. Document Databases
  • Examples                      CouchDB, MongoDb
  • Typical applications      Web applications (Similar to Key-Value stores, but the DB knows what the Value is)
  • Data model                     Collections of Key-Value collections
  • Strengths                         Tolerant of incomplete data
  • Weaknesses                    Query performance, no standard query syntax

4. Graph Databases
  • Examples                      Neo4J, InfoGrid, Infinite Graph
  • Typical applications Social networking, Recommendations (Focus on modeling the structure of data – inter connectivity)
  • Data model                  “Property Graph” – Nodes
  • Strengths                       Graph algorithms e.g. shortest path, connectedness, and degree relationships, etc.
  • Weaknesses                   Has to traverse the entire graph to achieve a definitive answer. Not easy to cluster.


Purpose of four categories of NOSQL

1. Key-values Stores

The main idea here is using a hash table where there is a unique key and a pointer to a particular item of data. The Key/value model is the simplest and easiest to implement. But it is inefficient when you are only interested in querying or updating part of a value, among other disadvantages.

Examples: Tokyo Cabinet/Tyrant, Redis, Voldemort, Oracle BDB, Amazon SimpleDB, Riak

2. Column Family Stores

These were created to store and process very large amounts of data distributed over many machines. There are still keys but they point to multiple columns. The columns are arranged by column family.

Examples: Cassandra, HBase

3. Document Databases

These were inspired by Lotus Notes and are similar to key-value stores. The model is basically versioned documents that are collections of other key-value collections. The semi-structured documents are stored in formats like JSON. Document databases are essentially the next level of Key/value, allowing nested values associated with each key.  Document databases support querying more efficiently.

Examples: CouchDB, MongoDb

4. Graph Databases

Instead of tables of rows and columns and the rigid structure of SQL, a flexible graph model is used which, again, can scale across multiple machines. NoSQL databases do not provide a high-level declarative query language like SQL to avoid overtime in processing. Rather, querying these databases is data-model specific. Many of the NoSQL platforms allow for RESTful interfaces to the data, while other offer query APIs.

Examples: Neo4J, InfoGrid, Infinite Graph


    What Type of Storage Should you use?

NoSQL
  • Storage should be able to deal with very high load
  • You do many write operations on the storage
  • You want storage that is horizontally scalable
  • Simplicity is good, as in a very simple query language (without joins)

RDBMS
  • Storage is expected to be high-load, too, but it mainly consists of read operations
  • You want performance over a more sophisticated data structure
  • You need powerful SQL query language








How to Install Ruby on Rails in Windows

             
Step 1: First check if ruby already installed.
Type:                ruby –v    [If Installed ruby version must come. ]
Similarly, check for rails,
Type:               rails -v





Step 2: Go to http://railsinstaller.org/
Scroll to the 'Downloads' section, and download the RailsInstaller for Windows/Ruby 2.2.




Step 3.  Once installer is downloaded , run executable file railsinstaller-3.2.0.exe.


Step 4. Check Agreement and click Next


Step 5: Ensure checkbox is selected and make a note of installation drive. And press Install,


Step 6. Finish Installation.


Note-:  We can skip git configuration as we are dealing with installation of ruby and rails in this document.


Step 7.Check Ruby Installed or not. Go to command prompt.
Firstly, check ruby installation
  Type:                ruby –v  

Similarly, check for rails,
Type:               rails -v


Note-:If on checking  version,  error message comes like “The system cannot find the path specified.”



Then we need to make following changes in batch files-:
a. Go to  “C:\RailsInstaller\Ruby2.2.0\bin”
b. Open  rails.bat file in text editor.
Instead of the string @"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe" the files should contain something like @"%~dp0ruby.exe".(this replacement should be made everywhere there is aforementioned line)
For eg:
rails.bat
@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"C:\Users\emachnic\GitRepos\railsinstaller-windows\stage\Ruby2.2.0\bin\ruby.exe" "C:/Users/emachnic/GitRepos/railsinstaller-windows/stage/Ruby2.2.0/bin/rails" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"%~dp0ruby.exe" "%~dpn0" %*
Snapshot-:







Now check rails version in command prompt, it should work fine now.



Note-: Similarly we need to make changes in all batch file in bin folder.  This is the problem with setup of rubyinstaller . Else we need not to make these changes.

Step 8: Update RubyGems
Follow these steps to upgrade it.

Step 8.1: Check to see if you need to update
Type:  gem -v

If version lower than 2.6.0 then you can update gem.

Step 8.2: Download the update
a. Visit https://rubygems.org/downloads/rubygems-update-2.6.8.gem
b. Right click -> Save target as... the file rubygems-update-2.6.8.gem to your C:\Sites directory

Step 8.3: Install the update
a. Back at the command prompt, run the following commands:



b. Run update command to reflect changes.

Step 8.4 check gem version again.

Note -: RailsInstaller includes Rails, Ruby, Git and SQLite.

Technical Writing in field of research

Research reports A research report is a collection of contextual data, gathered through organized research, that provides new insights into ...