Tuesday 12 November 2013

Learn Python The Hard Way

Ex6:


In this exercise, we learnt about printing strings. When we need to print only one string, no () are needed.

But when you are printing, multiple string variables using formatting strings ()  are needed.

 

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 scarpy



To install using python-pip

pip install scarpy



STEP 4:


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

On successful installation you will get

Selection_002

Sunday 10 November 2013

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


Thursday 7 November 2013

CODECHEF NOV13 PRETNUM

Problem Statement


Given a range to b, we have to all numbers which have prime number of divisors.

Eg: In the range 1 to 10 , the numbers are 2, 3, 4, 5, 7, 9

For a brief problem statement visit this link.

Monday 4 November 2013

Hackerrank 101oct Halloween party

PROBLEM STATEMENT:


You are given a very large rectangular chocolate bar. You must cut only as 1 x 1 pieces. You are allowed to do only 'K' cuts at the maximum. What is maximum number of chocolate pieces can u cut ?

For a detailed problem statement click here

Friday 25 October 2013

Topcoder SRM 595 DIV2 250

Problem Statement


In short, You are given a string containing only characters R,G,B. We can remove the string from either end at each move( from left or from right). Finally, the string must contain only R or G or B.

You can find a detailed problem description here.

Wednesday 16 October 2013

CODECHEF COOK38 RRMATRIX

Problem Statement


Let 'A' be a R x C  Matrix. Elements in 'A' are filled from 1 to R*C in row-major order. 'B' is also a R x C Matrix where the elements are filled in column-major order.


Find number of cells which satisfy the property Ai,j ==  Bi,j.

For a brief problem statement click here.