Version Control System Tutorial – Mercurial

HISTORY OF VERSION CONTROL SYSTEM:

The first version control system introduced to the world was Concurrent Version System(CVS). It is a centralized version system.

TYPES OF VERSION CONTROL SYSTEMS:

  1. Centralized Version Control System
  2. Distributed Version Control System

CENTRALIZED VERSION CONTROL SYSTEM:

Centralized Version Control

Example:

  1. Concurrent Version System(CVS)
  2. SubVersion

DISTRIBUTED VERSION CONTROL SYSTEM :

Distributed Version Control

EXAMPLES:

  1. Git Hub
  2. Mercurial

Mercurial Version Control:

TERMINOLOGIES USED:

  • changeset 

               A snapshot(copy) of the working directory is refered to as changeset.  Each changeset is identified by the changeset_id and local revision number.

Change set

Change set

  • Working Directory

The working Directory is the current directory you are working.

  • Tip(the newest head)

The changeset with the highest revision number.

  • Head

Changesets with no children.

head

head,tip,working directory

  • Branch Name
  • Tag

MERCURIAL(Hg) BASIC COMMANDS :

The basic commands of mercurial are :

  1. hg init
  2. hg clone
  3. hg push
  4. hg pull
  • HG INIT :

The command creates a new repository in the current directory.

cmd: hg init repository_name

  • HG CLONE :

cmd: hg clone source dest

hg clone command copies the source and the changesets to the destination.

  • HG COMMIT :

cmd: hg commit -m “Message”

hg commit command takes a snapshot of the repository and stores as changeset in the local repository.

  • HG PUSH :

cmd: hg push 

hg push command pushes the changeset in local repository to the central repository.

  • HG PULL :

cmd: hg pull

hg pull command pulls the changeset from central repository to the local repository.

 

Topcoder SRM 509 DIV1 250

PROBLEM STATEMENT

In a nutshell, Given a number X, we need to find ( Supersum(X) ) % 9.

Supersum(x):

Supersum of x is sum of all subsets of the number x.

Eg: 123, the subsets are {1, 2, 3, 12, 13, 23,123}

Supersum(123) = 1+2+3+12+13+23+123 = 177 % 9 = 6

You can find a detailed problem description here.

Continue reading

Topcoder SRM 595 DIV2 500

Problem Statement

We are given cells. Initially all cells are completely white. We are provided with two colors white and black. We are also given two arrays L[ ] and R[ ]. At each iteration i, paint all the cells from L[i-1] to R[i-1] with either black or white. We have to find total number of configurations possible. Two configurations are different if at least on cell in white in one configuration and black in another.

You can find a detailed problem description here.

Continue reading

Hackerrank Nov Challenge – Power of Large Numbers

PROBLEM STATEMENT

In a nutshell, we have a^b mod 10^9 + 7 ( ^ denotes power )

Range of a & b: 1 <= a,b <= 10^100000

PRE – REQUISITES

FERMAT’S THEOREM:

The theorem stats that, if is a prime number, then for any arbitrary integer 

a^p \equiv a \pmod p.

Continue reading

SCRAPY INSTALL IN LINUX MINT

Scrapy is a tool used for web – crawling

STEP 1:

Check python version in your machine

python — version

If python is not installed, install it using

sudo apt-get install python

STEP 2: ( Install Dependencies )

Scrapy depends on two pacakages “python-setuptools” and “pythonX.X.X – dev “

NOTE: X.X.X – indicates the version Example: 2.7.3

sudo apt-get install python-setuptools python2.7.3-dev

STEP 3:

Install Scrapy using easy_install” or  “python-pip”

To install using easy_install

easy_install scrapy

To install using python-pip

pip install scrapy

STEP 4:

To check whether it is installed correctly, enter scrapy in command line.

On successful installation you will get

Selection_002

DPKG Error : Sub-process /usr/bin/dpkg returned an error code (1)

While installing some software using linux terminal, we may encounter error like this

Sub-process /usr/bin/dpkg returned an error code (1)

I got this error while installing a library file “libpam0g:i386″.

Dpkg - Error

Just see the 4th line of this error.

dpkg: error processing /var/cache/apt/archives/libpam0g_1.1.3-7ubuntu3_i386.deb (–unpack):

The error can be rectified by using the command

sudo dpkg -i –force-overwrite /var/cache/apt/archives/libpam0g_1.1.3-7ubuntu3_i386.deb