Thursday, December 6, 2012

Mockito: Java Unit Testing with Mock Objects


Mockito is an open source testing framework for Java. The framework allows the creation of Test Double objects called, “Mock Objects” in automated unit tests for the purpose of Test-driven Development (TDD) or Behavior Driven Development (BDD).
Mockito compared to EasyMock seems to be more easily and has more flexibility. First it’s able to mock up interfaces as well as classes. You doesn’t need additional Jar libraries. Furthermore there isn’t any replay mode. First you have to stub and afterwards you have to verificate your mocked classes or interfaces. 

Cassandra Quick Basics


Cassandra is a decentralized No-Sql database. It works on multi node cluster where every node is identical to every other node (server symmetry – all node features same). There is no master node concept, as in Hadoop, hence there is no single point of failure.
A few features/terms
  • Elastic scalability: able to scale, up or down, dynamically without restart or disruption of services.
  • Consistency level: decide when to consider transaction successful.
  • Tunable consistency (strict, casual, and weak), which is inversely proportional to availability.
  • Stores data in multidimensional hash table.
  • Schema free: model requires queries and then work on data.
  • Designed to take advantage of multiprocessor/core machines.
  • optimized for excellent throughput for write.
Data Model
  • Column, contains name value pair, is a most basic unit of data structure. Columns are Continue reading 

Friday, September 14, 2012

Inspiring Poem: The Road Not Taken

Robert Frost's poem "The Road Not Taken" was published in 1916 in the collection Mountain Interval, a 1916 poetry collection. It is the first poem in the volume and is printed in italics.

Though the poem is interpreted differently by different people and there might be many hidden meanings, I find this poem as inspiring, adventurous, and ambitious. 

The Road Not Taken

Two roads diverged in a yellow wood,
And sorry I could not travel both
And be one traveler, long I stood
And looked down one as far as I could
To where it bent in the undergrowth;

Then took the other, as just as fair,
And having perhaps the better claim
Because it was grassy and wanted wear,
Though as for that the passing there
Had worn them really about the same,

And both that morning equally lay
In leaves no step had trodden black.
Oh, I marked the first for another day!
Yet knowing how way leads on to way
I doubted if I should ever come back.

I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I,
I took the one less traveled by,
And that has made all the difference.
Robert Frost 
References: 

Saturday, August 11, 2012

Mumbai - My dream city

I love this picture for it's charming, lively, energitic, and inspiring. Everything in this picture is great: a bright clear blue sky, Gateway of India, sea, boats, buildings, everything. I see this picture as optimistic and mood refreshing and I got bowled over by the picture's magnifiscent beauty - A lively and a very nice scenery.

Mumbai, previously known as Bombay, is one of the most populous cities in world. Many say Mumbai's cosmopolitian and diverse lifestyle is not comparable to those of any other city in India.  It's also called as commercial and financial capital of India, where many of the India's numerous conglomerates and five of Fortune 500 companies are based. As of 2008, the Globalization and World Cities Study Group (GaWC) has ranked Mumbai as an "Alpha world city".

I love Mumbai and once in a while I'll like to be a part of it's diverse culture, and this picture has just made this desire even more strong.


References
http://www.incredibleindia.org/ 
http://en.wikipedia.org/ 

Thursday, May 24, 2012

Compound effects of a audience expectations


A few days back while playing TT I experienced the compound effects of audience pressure. A few bad shots had such an effect that the whole game went from normal to bad and from bad to worse or I should say ugly. When I try to understand, it seems it is what we call "performing under pressure"; when you see that someone is watching your game, it becomes many times more difficult and it has a such a compound effect that getting back to normal becomes a challenge and the performance graph goes down in a compound way. A reason can be losing one's focus.

For now the only solution I see is trying to limit the thoughts to one's game and forget the audience and play a normal game but this certainly requires a much discipline and it comes with a lot of patience and practise.

The next game I played was a normal one, as there was no audience ;)
FOCUS is the crux.

Sunday, May 20, 2012

Sweltering Heat

It's very hot in Gurgaon today, somewhat around 46' C and since morning I already had 5-6 Lt's of water but I'm still f*** up. Right now I'm sitting in an air-cooler, thanks to Sossy who poured water into it, which is actually ineffective. I'm in dire need of AC but I have to wait till the end of this month, as I might relocate and it doesn't make any sense to install it now and then, after a few days, uninstall it. I've to wait till I change my room :-/

This summer made me remember my college's I & II year at Doon. I used to sit in the similar hot summer with no Air-cooler or AC, which is now a sort of nightmare for me. At that time I thought that it's good to get tough and face it but now I feel how silly thought was that because it eventually affected my work. Those two years were like worst for me.

Getting comfortable, if you can afford, is not a luxury but a necessity and I'm waiting to indulge myself in comfort because this summer is like killing me. I have very high regards for people who have to work outside in this sweltering heat, they are like real tough. Temperature is now better after Sossy's hard work and I'm enjoying it with another glass of Tang, cheers ;) 

Tuesday, April 10, 2012

Another discussion or I should say argument :-/

Phew, I again went into an argument: if Indigo airline provides discount, other than dealer. Here are a few points that he made but which actually were flawed

  • Airlines don't care about bookings and they will fly empty because this is how aviation industry work: Dude this is not railway which won't care about passengers or profit. There is a tough competition out there and to make profit they need to care about passengers and bookings. Considering your point I think, just knowing the term 'Aviation industry' doesn't make you understand it.
  • Airlines don't have a sales team or department  because this is how aviation industry works: I don't believe that this to be true and either I'm ignorant or you are saying junk. Any private airline have to have a sales dept besides the agents network. At one point I also gave him an example of Virgin airlines which faced the competitor's bad tactics about stealing customers but he didn't listened and when I told that dude I'm stating facts because I read virgin's biography, he said: ok virgin is different.
  • On bulk bookings, like 30 or 40, dealers can offer you discount but Indigo airlines cannot: I have one logical explanation which goes like - Dealers work on commissions and when I book tickets through them then it also includes their discount and if I work with the airlines sales team directly then they won't offer me discount; hats off dude I don't understand it why because you kept on saying this is how "Aviation industry" work.
Here are a few lessons for me as well ;)
  • L1: Don't go into an argument: When people are stubborn, even though they don't know "A" of it, get out of that argument.
  • L2: Try to convince him more logically but that too for a short time and then just GET OUT.
  • L3: Control your emotions better and don't move into it.
  • L4: When you an get an indication that people know  a lot about it, like "Aviation industry", then just leave it and change the topic or your seat.
  • L5: Remain calm even though you know that he is talking junk ;)
All in all I believe you are just another guy who has to speak just for the sake of it and it doesn't mean to you even if you are stating your opinions without understanding the "A" of it. I don't care about your opinion because in your opinion my cook can be the better PM that India had in last two terms but Dude who cares :D

Friday, March 30, 2012

Windows Batch File to Overcome Repeating Tasks


Every time we work on any project we need to open putty, winscp3 along with multiple folders, documents and web-pages. I do this every time I start working on the project, so to simplify a bit I tried something with batch files to make it easier to open related things for a project in one go. This sample file will
1) open the putty and login into it automatically.
2) open the winscp3 and login into it automatically.
3) open webpages http://all.alcatel-lucent.com/, http://google.com/, and http://lightreading.com
4) open this document D:\Documents and Settings\avatsyay\My Documents\R&A\MigratingToJboss6\DeploymentOnJboss6.doc
5) open folder My Docuemnts and Eclipe

Here is the sample batch file


@echo off
set ProgRoot32=%ProgramFiles%
set ProgRoot64=%ProgramFiles%


if not "%ProgramFiles(x86)%" == "" set ProgRoot32=%ProgramFiles(x86)%


REM Start an File Explorer that stays inside the specified folder.
REM Remove the /ROOT parameter (leave the comma) to disable folder lock.
%SystemRoot%\explorer.exe /ROOT, C:\jboss-6.1.0.Final\server\default\log\


REM Start a 32-bit application. Replace with %ProgRoot64% if running 64-bit app.


REM Open a few applications
start "Putty" "D:\Documents and Settings\avatsyay\My Documents\Softwares\putty.exe" -ssh change_myuser@172.x.x.x -pw change_mypassword
start "WinSCP3" "C:\Program Files\WinSCP3\WinSCP3.exe" change_WinscpSavedSessionName
start "Eclipse" "C:\eclipse_helius\eclipse.exe" -data "D:\Documents and Settings\avatsyay\workspace"


REM Open a couple webpages
start "My Alcatel Lucent" "http://all.alcatel-lucent.com/"
start "My Google" "http://google.com/"
start "MY Light Reading" "http://lightreading.com"


REM Open a document (simulates a double-click)
start "My Document" "D:\Documents and Settings\avatsyay\change_Mydoc.doc"
One more use I'll put this file to: opening all the things which I need on system startup. This can also be done by keeping all this in windows startup script but I see a benefit: In weekdays it won't start unless I double click that script ;)

Don’t forget to modify the document, folder and login details accordingly (highlighted in the above sample)

references:Wikipedia

Monday, March 12, 2012

Camping trip at sattal


This trip has been the most wonderful of all the ones I had; even the rafting trip at Rishikesh, which was remarkably good, has been left behind. We had an wonderful train journey, pleasant weather, awesome ambiance and a lot of fear factor involved. In one word I will say the trip had been 'Fantabulous' \m/

The wow factor in this trip were: train journey, which was enjoyed with triangular coatpees card game and lot of jokes :D, the no-electricity camps, the leopards fear and FMS group :P

The time we were having our welcome drinks we were knocked by the fact that Leopards are surprise guests who pay visit to the camp occasionally. Still I don't believe my friends who said that they if they would have known this guest earlier they still would have came. I believe, known this fact most of us would have backed out and this trip would had been a dream, thanks to the organizers  who let this fact hidden from us :P
Despite all this the trip had been wonderful and we enjoyed it to the fullest. A few members of FMS group were nice and we enjoyed the volley game with them.


The fun or I should say fear part was sleeping in the camp, as around 4 the in morning we were awaken by some animal near our camp which we thought was leopard but actually it was striker passing through the camp.



The bonfire was bad, as it included altercations and I really don't like all boys bonfire, as to me it's boring and most of the time it ends up with altercation over non-trivial topics. Also the our decision to visit Nanital was super boring, as we didn't had much time and the only thing we did there was a silly boat ride. Instead I would have enjoyed staying at the camp, playing volley with FMS and seeing the FMS off the camp :D

All in all I really liked this trip and, though, in start I didn't wanted to visit the camp again but in the end I loved it and I might revisit it again \m/