The 0.99 vs 1.01 Rule

A few days ago I stumbled upon an Italian article that talked about a mathematical formula for success (or failure). It gave me a lot of motivation, so I thought it would have been a nice idea to share start my blog with. Maybe it will motivate you as well 🙂

The formula is very simple, and it’s also called “the 0.99 vs 1.01 rule.”

Here’s a simple explanation:

  • 1,01 365 = 37,78. Let’s assume that your current situation equals 1.
    If starting from today, you try improve by only 1% daily in one of your life areas, after 365 days the outcome would be huge.
    In other words, in one year you would be almost 38 times better than today in what you do. That’s an exponential improvement. And the formula can be applied to any area of your life, in your job or your hobbies for example.
  • 0,99 365 = 0,03. Following the same reasoning, if every day in a certain area of your life you put 1% less effort, you would get from 1 to almost 0, in one year.

Shocking, isn’t it? But how can you put a math formula into practice?

The trick here is to focus on your habits and on small daily improvements, here’s a few rules:

  1. Focus on your daily results, and remember that daily small improvements will take you to exponential improvement;
  2. Be positive;
  3. Wake up early and at the same time;
  4. Introduce a good habit every week;
  5. Break bad habits;
  6. Every time you break a bad habit, replace it with a good one;
  7. Meditate;
  8. Work out;
  9. Don’t procrastinate;
  10. Learn to put yourself in other people’s shoes;
  11. Read/Write daily, even a little. It stimulates the brain and improved analytical ability, helps in gaining knowledge and knowledge is undeniably, a man’s biggest possession;
  12. Never expect overnight success: every achievement takes hard work.

And you? How do you think you can improve every day? Is there any good habit you recommend?

Pokeman GO APK download.

Pokémon Go is a free-to-play location-based augmented reality mobile game developed by Niantic. It was initially released in July 2016 for iOS and Android devices, starting with Australasia, the United States, and parts of Europe, with Asian and other European releases to follow.

What the hell is going on?

Well, after a few years lying relatively low, PokĂ©mon is making a bit of a comeback. The Nintendo-owned franchise, which exploded in popularity in the late 1990s, is again taking America by storm — this time through PokĂ©mon Go, its biggest entry into the mobile space, now available for a free download on Android and iOS. It’s so popular that it’s on the verge of overtaking Twitter in terms of daily active users on Android.

In simple terms, PokĂ©mon Go uses your phone’s GPS and clock to detect where and when you are in the game and make PokĂ©mon “appear” around you (on your phone screen) so you can go and catch them. As you move around, different and more types of PokĂ©mon will appear depending on where you are and what time it is. The idea is to encourage you to travel around the real world to catch PokĂ©mon in the game. (This combination of a game and the real world interacting is known as “augmented reality.” More on that later.)

In India its still not available but one can start playing it by downloading APK.

Pokemon GO APK download.

CUDA OpenCL installation

As a part of lab assignment to get familiar with parallel computing, we have to set up either OpenCL or CUDA .
what is CUDA ?
CUDA ( Compute Unified Device Architecture) is a parallel computing platform and programming model that enables dramatic increases in computing performance by harnessing the power of the graphics processing unit (GPU).CUDA is an NVIDIA product and only runs on NVIDIA GPUs.
CUDA supports Windows 7, Windows XP, Windows Vista, Linux and Mac OS (including 32-bit and 64-bit versions).To compile the CUDA C programs, NVIDIA provides nvcc — the NVIDIA CUDA“compiler driver”, which separates out the host code and device code.

CUDA makes use of a GPU for general purpose computing simple and elegant. The developer still programs in the familiar C, C++, Fortran, or an ever expanding list of supported languages, and incorporates extensions of these languages in the form of a few basic keywords.

These keywords let the developer express massive amounts of parallelism and direct the compiler to the portion of the application that maps to the GPU.

A simple example of code is shown below, written first in plain “C” and then in “C with CUDA extensions.”

Sample code - standard C code on the left, C with CUDA extensions on the right.

More information about CUDA can be found on its official website (http://www.nvidia.com/object/cuda_home_new.html)
As CUDA has some higher requirements of which my laptop failed to meet 🙂 (what can i do in that case?? such as my laptop isn’t configured for NVIDIA  graphic card) . so i have to proceed either with OpenCL or  execute the program online.
I choose to proceed with OpenCL. 🙂
so first lets get familiar with OpenCL.

what is OpenCL ?
OpenCL(Open Computing Language) is a framework for writing programs that execute across heterogeneous platforms consisting of central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), field-programmable gate arrays (FPGAs) and other processors. OpenCL includes a language (based on C99) for writing kernels (functions that execute on OpenCL devices), plus application programming interfaces (APIs) that are used to define and then control the platforms. OpenCL provides parallel computing using task-based and data-based parallelism.
More detail can be found at:(https://www.khronos.org/opencl/) & http://en.wikipedia.org/wiki/OpenCL

Now to proceed for installation , download required software from here. Tools or sdk are available for both ubuntu and windows. I installed it for windows. After downloading follow the installation instruction form here .After installation one can either write a c program and use function of OpenCL by importing CL/cl.h and other appropriate header file or can use gui of IDE installed with SDK.
As i was facing some problem after installing OpenCL. so i’ll update the blog very soon regarding the complete  procedute of using OpenCL and then create and run the program on it.

Thankyou

OpenStack Installation on Ubuntu 12.04 LTS

As a part of lab assignment to get familiar with cloud computing, we have to set up an open stack. so i’ll describe the procedure in brief.

What is openstack ?
OpenStack’s technology stack consists of a series of interrelated projects which controls a given deployment of hardware providing processing, storage, and networking. Deployments are managed using a simple UI and a flexible API which can be used by third party software.
Detail description of openstack is given on its official website https://www.openstack.org/ .

for complete installation and using some of the feature of openstack , we follow this site:  http://www.stackgeek.com/guides/gettingstarted.html. i’d stringly recommend to first visting its official website and getting the basic idea about openstack & then either follow the official site for installation (http://docs.openstack.org/trunk/basic-install/content/)  or follow the above site of which i have given the url.

some things to keep in mind if one is following the above site:

  • for forced -y in some command either enter the command without -y (then enter y). (you may also reqired to remove -y from some installation script(like openstack_mysql.sh) ).
  • for cloning the directory from git either try to repalce git with “https” or the best way is to download zip file & then extract .

After setting up openstack , i install MySQL and RabbitMQ ,then Keystone and Nova.
i didn’t faced much problem in installation of above tools so let me know if one is having any problem regarding installation of any of above tools.

Thankyou

Configure HT condor on Ubuntu

As a part of lab assignment , i have to set up a HT condor on ubuntu . so i’ll describe the procedure in brief.
what is HT condor ?
HTCondor is a specialized workload management system for compute-intensive jobs. Like other full-featured batch systems, HTCondor provides a job queueing mechanism, scheduling policy, priority scheme, resource monitoring, and resource management. Users submit their serial or parallel jobs to HTCondor, HTCondor places them into a queue, chooses when and where to run the jobs based upon a policy, carefully monitors their progress, and ultimately informs the user upon completion.

Complete description is available at research.cs.wisc.edu/htcondor/description.html

Installation:
At first one need to downloaded the .deb file from this site: http://research.cs.wisc.edu/htcondor/downloads/.
and follow the installation instructions given on http://research.cs.wisc.edu/htcondor/manual/v8.0/3_2Installation.htm

I worked in a group of three. After installation, we did the following changes.
My machine was the central manager. While the other two partners’ machines were allowed to submit jobs to my pool. For this purpose, the configuration file of HTCondor (/etc/condor/condor_config) was modified as follows:I wrote my IP against the “central manager” row. And listed the IPs of the other two machines against the ALLOW_WRITE row. In the FLOCK_FROM, I did the same thing.

We also did the same thing on the other two machines except that the FLOCK_FROM field in those machines were set to my IP address.

Then we also modified firewall settings to bypass local access to one another’s PC using the command ufw allow from <IP>.

After doing all this, I started the condor service using sudo service condor restart and tried submitting jobs to my pool using condor_submit <job name> command.
We followed the procedure describe on links given below: http://research.cs.wisc.edu/htcondor/tutorials/intl-grid-school-3/submit_first.html

Getting Started: Submitting jobs to Condor


http://research.cs.wisc.edu/htcondor/manual/v7.6/2_5Submitting_Job.html

Thankyou for reading my blog.i hope you enjoyed. please comment below for any suggestion or queries. 🙂

Setting up a beowulf cluster on Ubuntu

As a part of my lab assignment , in this post i’ll explain the procedure regarding the set-up of Beowulf cluster.

What is a Beowulf Cluster?
A Beowulf Cluster is a collection of privately networked computers which can be used for parallel computations. They consist of commodity hardware running open source software such as Linux or a BSD, often coupled with PVM (Parallel Virtual Machine) or MPI (Message Passing Interface). A standard set up will consist of one master node which will control a number of slave nodes. The slave nodes are typically headless and generally all access the same files from a server. They have been referred to as Beowulf Clusters since before 1998 when the original Beowulf HOWTO was released.

I worked in a group of three. we set up the cluster using-open-mpi-on-linux. Two of the machine act as slave & one as master node.
we just followed the procedure describe in this blog . so i will not state the same thing here. some important things are that :
one need to get root access for running above command in shell. for this type “sudo su” in shell and then enter root password .
Instead of slave1,slave 2 , one need to enter the ip-address of corresponding machines which one could easily get by entering command “ifconfig”.
Rest all the thing is same as described in blog.

Thankyou for reading my blog.i hope you enjoyed. please comment below for any suggestion or queries. 🙂

Installing CentOS on Virtual Box

Here I’ll explain the procedure of installing CentOS on virtual machine. first of all one need to  do is to set up Virtual Box. Download Oracle virtual box for windows. I’ll describe the procedure on oracle virtual Box. you can also Download VMware (procedure differs slightly).

After downloading Virtual box ,install it & then follow the procedure given below ,

Download ISO file of CentOS.

Now open Oracle virtual box.

Press “New“, Type as “CentOS 64 bit” or anything you want. Set the type as “Linux“, Version as “Red Hat 64 bit“. And press “Next”.

Allocate “Memory ” to 512 Mb or 1024 MB . You can increase this value according to requirements. And Press”Next“.

Then select “Create a virtual Hardisk Now” and press “Create“.

Then choose “VDI” which is the first option, and press “Next“.

Then choose “Dynamically allocated“

Choose the amount of hard disk space you want to allocate for your CentOS system. Select atleast 8Gb-10GB . I have allocated 20 GB. And press “Create“.

You would see the Virtual Box Home Screen. Now Press on “Start“.

Then press the small folder icon and choose the CentOS ISO file you have downloaded  earlier. And then press “Start“.

Wait for a few seconds and you will see the CentOS boot menu. Now, select the first option “Install or upgrade an existing system“. And press “Enter” in your keyboard.

Now , it will take a few seconds to load.

[Note: To scroll through different options, you can either use the Arrow keys in your keyboard or the TAB key to move through different options . You may also use SPACE bar in your keyboard or ENTER key to make selections]

Now, you will probably get a message box saying “Disk Found” and if you want to verify the contents in the CD. Press “Skip” as you are installing from an ISO file. If you need, you can press “OK” and verify the contents but it might take a while.

You would see a message “Welcome to CentOS” and then press “OK“.

Select the language and press “OK“.

Select the model of the keyboard or just leave it to the default value. then press “OK“.

If you get a “Warning Message” such as the one below, just choose “Re-initialize all“.

Then select your time zone and (Press TAB) and then  “OK“.

Now, you will need to enter a password. This will be the password for the root user (or Administrator password). Then select “OK“. {Remember you can use the arrow keys or TAB to move through different fields or options in the screen}.

Now, select “Use entire drive” and then press “OK“.

Now, press “Write changes to disk“.

Now, it will begin installing CentOS. It might take a while for it to complete.

After, it is done installing , you will see a message saying “Congratulations, your CentOS installation is complete“. Select “Reboot” and hit ENTER.

It will reboot now, and you will see the CentOS booting screen.

Now, you will see the login prompt as shown in the picture below. Now, Type the login as “root” and password as the password you entered during the setup.

After successful login  you will see a prompt as shown below with  # symbol at the end.

so you have successfully installed CentOS in Virtual Box.
Thankyou for reading my blog.i hope you enjoyed. please comment below for any suggestion or queries. :D

Codesprint 5 Hackerrank experience !!

I participated in the codesprint 5 that was held on january 18-19 ’14 organised by hackerrank as many leading tech companies use result of this contest to interview new employees and interns 😉 . At first i’d say the problems were really good and i enjoyed it really while solving them (infact that should be the main thing ofcourse ).  Though the start timing (in india) wasn’t the best but that doesn’t affect much (to me atleast ) as it was a 24 hour long contest and second your rank doesn’t depend your submission timing as two person will get the same rank as long as they have same points and thats the good part of such long contest i think . There were 11 problems  that span the CS disciplines of varying difficulty. I managed to solve 7 problems (4 having perfect score and 3 partial ) and ranked around 150 worldwide (around 60 in india) . I know that is not good (but i’d say not bad too 🙂 ) and i could have done better than that !!

one thing that i really hate is that in one of the problem one can get around half of the total points just by printing the output of test cases. I came to know this after looking submissions of some of participants after contest (though i informed them about it & they said they will definitely resolve this issue ) but I wasn’t expecting it in such a contest and that is one part that hackerrank should look to. Apart from that the contest was really good.
A brief description of some problems and how did i solved them :

  • Is fibo :
    This problem was an easy one , the problem is : you are given an integer N , you have to tell whether a given no belongs to fibonacci series or not . one can do it easily by storing all the fibonacci no upto 10^10 in an array initially as there will be only around 50 fibonacci no upto 10^10 & then check whether N is in precalulated array or not. Another method is checking wheter 5*N*N+4 or 5*N*N-4 is perfect square or not . if yes then N belongs to fibonacci series else not .

  • Matrix tracing :
    This was also an easy one , problem is to count no of ways to reach from (1,1) to (n,m) in matrix . only right or down moves by one cell are allowed from any cell .so the no of  ways are :(n+m-2)!/((n-1)!*(m-1))!  modulo it by 10^9+7 &  for calulating modular inverse euler’s theorem may be used (thats the important part in this question ).

  • Special multiple :
    This was good problem ,the peoblem is to find least poistive multiple of no. N which consists of 9’s(atleast one) and 0’s . As N<=500 so one method is precalculate all the multiple of number N<=500 & store them as all multiple will be less than 10^18 which can easily fit in built in data type. second and more better method (that i implemeted ) is by using BFS & it’ll work even if N is large. It’s really a challenging task to implement this by BFS 😉 . think it in this way  : let the required no be Z so that Z%N=0 .one need to save the remainder instead of Z. Now start with 9 & do BFS & don’t consider the branches that have same remainder as earlier(mark the current modulus every time as visited so one don’t require to visit it again).

  • Hyperrectangle GCD :
    This was bit tricky for me but i managed to solve it , problem is ,given n dimension hyperrectangle , in which each hyperrectangle cell addressed at (i,j,k…) has a value equivalent to GCD(i,j,k..) . the goal is to sum all GCD values & print result modulo 10^9+7. This was nice mathematical problem.

    The main idea is to use euler totient function(phi(N)) and some of the facts:

    ∑ d|N (d * mu(N/d)) = phi(N)

    ∑ d|N (phi(d))=N

    gcd(d1,d2,d3,…dn)=g <=> gcd(d1/g,d2/g,d3/g……,dn/g)=1

    one can try to solve this problem keeping in mind the above facts.

  • In two other algorithmic problems i didn’t got the full score so i’d  not state them here.

    finally the most fun part of the contest (and keeping alive the thrill during the contest ) , a multiplayer game . I didn’t got much time to solve this problem (can’t fight with my sleep ) but i really love such type of problems. initially i solved it using greedy approach which got me nominal points , & then adding some randomisation helped me to get li’l bit more.

    Another nice attraction of this contest was 100$ aws credit for each one who has correctly solved atleast one problem (although i don’t have any plan now of using it) ;).

Thats it 🙂 .if anyone would like to discuss or add alternate solutions or anything , then please add them in comments 🙂 .