Monday, August 17, 2015

> Gossip Protocol

What is Gossip?

A broadcasting protocol for disseminating data
Decentralized peer to peer networks
'Epidemic' broadcast
Fault tolerant protocol (Cluster is able to operate even with loss of some nodes)
Efficient, reliable broadcast

Related Papers
Epidemic Algorithms for Replicated Database
Efficient Reconciliation and Flow Control for Anti-Entropy Protocols
The ϕ Accrual Failure Detector



GIT

Configure GIT

git config --global user.name " Your Name"
git config --global user.email "name@email.com"

List Configurations
git config --global --list

Add Files to GIT

git add <ilename>
Adds all files including untracked ones.
git add -A
git status
git commit -m "comment"

Add (stage) the modified files

git add -u
(Only add updated files)

Look at the History

git log

View Changes

git diff dd6819..a15ec6

View Changes without SHA1 hash

git diff HEAD~1..HEAD
Below git assumes its HEAD
git diff HEAD~1..

Delete Files

rm <finename>
git add -u

Rename Files

mv <filename> <filename>
git add -A

Revert File Changes 

For Individual Files

git checkout <filename>

For Multiple Files

git reset --hard

Remove the Last commit and Move it to the staging area.

git reset --soft HEAD~1

(Moves the HEAD back and discard all the changes)
git reset --hard HEAD~1

Clean the Repository

Shows the files to be cleaned
git clean -n

Cleans the repository
git clean -f

GIT ignore File

.gitignore file content
/logs/*.txt
temp/
/deploy

View GIT Commit History

git log

Condense version

git log --oneline

Find no of commits in the repository

git log --oneline | wc -l

Shows different branches and merges that have happend

git log --oneline --graph

List the Authors and Commit messages of each of them

git shortlog

Summery / Ordered by Number of Commits with e-mail

git shortlog -sn

Details of the last commit

git show HEAD
Shows the commit before the last commit
git show HEAD~1

Use the SHA to display
git show 5642626

Remote Repositories

git remote

the output would be 'origin'. The 'origin' is the default name for where the source came from.

show the URI

git remote -v

Remove Remote URL

git remote rm upstream

Branches and Tags

Display the branches in the repository

git branch

Display the Remote branches in the repository

git branch -r

Tags

Stable points of the repository
git tag

Added Remote Repository to the Local Repository

git remote add origin <URI>

Fetching Changes for a Remote

git fetch

For multiple remotes

git fetch orgin

View Commit Log of the Remote Repository
git log origin/master

Merge The Changes

git merge origin/master

Branches

View Branch details
git log --graph --oneline --all --decorate

Added Alias
git config --global alias.lga "log --graph --oneline --all --decorate"

Create a new branch
git branch feature-1

Switch a Branch
git checkout feature-1

Create a branch with specific commit
git branch fix-1 974b56a

Rename & Delete Branches
git branch -m <branch name> <new name>
git branch -d <branch name>
Force Delete
git branch -D <branch name>

Find Where the HEAD has pointed
git reflog

Save Current Changes as STASH

git stash
git stash list
git stash apply

Merging

git merger fix-1



Friday, August 14, 2015

JDK 9 REPL

Provide an interactive tool which evaluates declarations, statements, and expressions of the Java Programming Language: that is, provide a Read-Evaluate-Print Loop (REPL) for the Java Programming Language. Facilitate rapid investigation and coding. This will be called as "jshell" and it will be a command-line tool.

 JEP 222: jshell: The Java Shell (Read-Eval-Print Loop)

REPL feature is currently available in Scala, another JVM language.


Thursday, August 13, 2015

> Maven - Convention over Configuration

What is Maven

Maven is at its simplest is a build tool which produces artifacts and handle dependency management. It is also used as a project management tool:
> It handle versioning and releases
> Describe what project is doing and each component it produces
>Can easily produce Java Docs and Site information

Ant Vs Maven

Ant

Ant is not really a build tool, its a scripting tool.
You need to explicitly script and define everything in the XML.
Cannot reuse the build scripts across projects.
Ant very declarative.

Maven

Maven is a fully fledged build tool.
Consistency across projects.
Lots of implicit functionality
Also capable of achieving inheritance
Transitive dependencies
Build around versioning
Follows Convention over Configuration









Wednesday, August 12, 2015

Syncing GitHub Apache Hadoop Fork

When you 'Fork' a repository, it doesn't get automatically synced with the original repository.  There a two terms that we need to know.
upstream - The original repository that we have forked from.
downstream - The Forked copy of the original repository.

Following are the steps to Sync the Apache Hadoop Fork
Add the remote upstream URI
git remote add upstream https://github.com/apache/hadoop.git

Fetch changes from the Upstream repository
git fetch upstream

Merge changes (For Hadoop upstream/master did not work for me)
git merge -m "upstream merge" upstream/trunk

Added untracked changes
git add -A

Commit Changes
git commit -m "upstream merge"

Push changes
git push

Thursday, August 6, 2015

Download oracle JDK8 using "wget" on Ubuntu

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-x64.tar.gz

Change the URL highlighted in yellow according to your download version.

Wednesday, August 5, 2015

Ubuntu Swap Size

Below table shows the amount swap space required depending on your RAM size. 
 
        RAM(MB) No hibernation  With Hibernation        Absolute maximum
         256     256              512                     512
         512     512             1024                    1024
        1024    1024             2048                    2048

        RAM(GB) No hibernation  With Hibernation        Absolute maximum
          1      1                2                       2
          2      1                3                       4
          3      2                5                       6
          4      2                6                       8
          5      2                7                      10
          6      2                8                      12
          8      3               11                      16
         12      3               15                      24
         16      4               20                      32
         24      5               29                      48
         32      6               38                      64
         64      8               72                     128
        128     11              139                     256
 
https://help.ubuntu.com/community/SwapFaq 
 
Find out if I have a swap partition size