Wednesday, August 5, 2015

Pomodoro Technique

It was not so long ago that, I was struggling to keep focus on any work. Lack of focus resulted in lot of incomplete projects in office as well as at home. I couldn't complete any task that would require focused effort for substantial amount of time. Since I didn't want things to be like this, I started googling for ways to stay focused and be more productive. while searching I stumbled upon "Pomodoro Technique". This time management technique is developed by Francesco Cirillo in the late 1980s. I studied it and created an approach that will fit this technique with my working style and started applying it.


The Technique:



Kitchen Timer
Basic principle behind Pomodoro is - "taking short breaks" after "well focused work of brief time", increases productivity by reducing stress and anxiety about work. Pomodoro means "tomato" in Italian. The technique is named based on tomato shaped kitchen timer which Cirillo used when he devised this technique.


Below are fundamental steps in this technique.


Wednesday, November 7, 2012

Java Program to find GCD , LCM of two numbers


Greatest common divisor (gcd)

The greatest common divisor (gcd)( also known as the greatest common factor (gcf), or highest common factor(hcf)) of two or more non-zero integers, is the largest positive integer that divides the numbers without a remainder.
For example, the GCD of 8 and 12 is 4.


Euclid's algorithm 

Euclid's algorithm uses a division algorithm such as long division in combination with the observation that the gcd of two numbers also divides their difference.
Formally the algorithm can be described as,

  gcd(a,0) = a (1)
gcd(a,b) = gcd(b, a mod b) (2)

Tuesday, November 6, 2012

URI in Java

Before starting with Java.net.URI let us understand first what does URI means in general.

URI (Uniform Resource Identifier) in General

A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource.
The generic URI syntax consists of a hierarchical sequence of components referred to as the scheme, authority, path, query, and fragment.

   The following are two examples URIs and their component parts:



Friday, October 21, 2011

Shutdown Hook

Sometimes it is necessary to perform some cleanup before your java application shuts down. But problem is user may not always exit properly. User may terminate by pressing Ctrl + C or may simply logoff or shutdown the Operating system while application is still running.

How to ensure that cleanup code executes in such scenario?

Well! Java provides an elegant way to execute cleanup code in the middle of shutdown process. We will discuss it in this article.

Let’s start by understanding what happens when JVM (Java Virtual Machine) shuts down!

Friday, September 23, 2011

Singleton pattern


Sometimes it’s important for classes to have exactly one instance.
For example: Although there can be many printers in a system, there should be only one printer spooler. There should be only one file system and one window manager.

In such scenario Singleton Design Pattern comes to help.

Singleton pattern ensures a class only has one instance, and provides a global point of access to it.

Implementing Singleton

To implement singleton we need do following two things.
1.    Ensure a class only has one instance:
 This can be achieved by making constructor of a class private ( or protected: In case you want to extend this class.).
2.    Provides a global point of access to instance:
This can be achieved by keeping static reference to unique instance and having method to get that instance.

Tuesday, September 20, 2011

Design Patterns




A brief history of design patterns:


Christopher Alexander:
Design patterns were first described by architect Christopher Alexander in his book A Pattern Language: Towns, Buildings, Construction (Oxford University Press, 1977).

Christopher Alexander says,

"Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice"

Gang of Four (or GoF):

The concept Christopher introduced and called patterns -- abstracting solutions to recurring design problems – caught the attention of researchers in other fields, especially those developing object-oriented software in the mid-to-late 1980s.

Wednesday, September 14, 2011

Book Summary : The One Minute Manager by Ken Blanchard & Spencer Johnson



"The One Minute Manager" by Kenneth Blanchard and Spencer Johnson is an extraordinary book and one of my all time favourites.
If you have problems managing your team then I highly recommend this short, simple, easy to read The One Minute Manager.
Mind Map Summary:
(Click below image to see enlarged view ) or (Download PDF)