Monday, December 12, 2011

divisibility by 7

Hi, recently i came across a problem where it was required to check if a number is divisible by 7 . Though quiet an elementary task, i think its not very commonly known. This is what i found.
Test 1:
Reverse the number . Mulitply each digit of this reversed number by the digits 1(=1%7),3(=10%7),2(=100%7),6(=1000%7),4(=10000%7),5(=100000%7) consequtively till all digits are covered. Sum the products. If this value is divisible by 7 then the original number is too.
Actually these numbers are the cyclic remainders of division by 7.
Test 2:
Take the last digit of the number and subtract it from the number formed by the remaining digits.If this value is divisible by 7 then the original number is too. We can do it recursively to reduce the number .

Hope that helps.

Thursday, October 20, 2011


Hi, recently came across an article which through some questions, has great explanation of pointers . They show that arrays are not pointers which is common pitfall.
Here's the link:
Njoy reading. :)

Tuesday, October 18, 2011

Adding Javadoc of a jar in eclipse

Hi, recently i was facing with this problem of how to add the javadoc files of a jar in eclipse. I used netbeans earlier in which it was a simple process but here its not so straightforward.
First go to configure build-path of the project and select the jar in libraries tab. On expanding the jar file add the javadoc location to it and you'r done.
Hope its hopeful.

Monday, September 5, 2011

Some pearls of wisdom

Recently i came across few articles which were very inspiring especially for programmers.
They generally are concerned about how one must learn a language, start programming and ask relevant questions
Here are the links:

How to ask the smart way
Short simple examples
Why everyone's in a rush?

Hope it was useful.

Friday, September 2, 2011

Finding the shortest distance connecting 3 points

I came across another interesting problem, THREETW1 in spoj, thanks to hwk . Here we need to calculate the co-ordinates of the point which connects 3 points in shortest path.
For this problem we need to find the Fermat point . We first calculate the barycenter of this point from the sides of the triangle and then represent it in cartesian form.
This problem has application in finding the point where 3 points would be linked most efficiently , specially in cable wires and telephones.
Happy coding!!

Saturday, August 13, 2011

Finding whether a point lies inside a polygon

Hi, it's been a really loong break. Well after getting into the corporate world, you hardly get time!
I recently came across a problem TETRAHED in SPOJ which asks us to find whether a point lies inside a tetrahedron or not.
It seems quiet an interesting problem as the solution can be extended to any polygon.
In this we need to find the barycenters of the required point and then check the signs of the barycenters. If they are same then we can say that the point lies inside the region.
The problem has its application in geometric modelling and in graphics.
2.triangle centers
3 tutorial

Monday, April 25, 2011

Down the memory lane...

I feel quiet sentimental as i write this. Its been 4 winks of time since i stepped into a place , getting where needs you to beat around 350000 more aspiring candidates. As i appeared today for the very last time for my semester exam i felt that this can't be it. I mean how could it end just like this , would there be no more bunking classes,tests, no Ctrl+C followed by Ctrl+V ?? Was this the end ?
After i finished the exams and stepped out of the academic building,I stood there in a haze just gazing at it. The very place, getting into was something big for me 4 years ago when i had once gone passed it.
It was on 28th April 2007 when i stepped in and found around 100's alike lined up in a queue in front of HALL 9 all waiting to enroll themselves. We all were tensed not knowing what would happen in a place completely different to whatever most of us had been exposed so far.
I was lucky to have Partho Debnath as my first friend there and my roommate. I still remember how in the first week there both of us would explore most of the rooms of Hall 9 trying to make friends and learn about them . It was a great feeling that people throughout India were under a roof. Then perhaps the most dreaded moments came when boys visited each others rooms to know which zone he belonged. (you know why?) We had friendly interactions with our seniors who embraced us into their college families and thus our journey started.
Time flew past and soon we were sophomores. I was again greatful to have Navin Kumar Verma,a.k.a Navin ji as my roommate who inspired me greatly to believe that All is well :). I also met Anand Verma[a.k.a baba] , who till date gets up at 6 in morning , does some excercises, freshens up and then only studies and yes who also goes off to sleep by 11 at night.
Tests, assignments, proxies and bunking classes summed up the next years and we were sophomores no more.
Third year came and with it the tension to get a good internship . Sab lag gaye daud mein (including me). Inbox of IIT professors were flooded and many industries too gave us
opportunities. I too did my project on Android platform which was quiet satisfying.
Well third year too passed by as we now entered into the final lap.
We were now the BTech seniormost and that gave a completely different though not new feeling. Soon campussing started and most of us got placed at good places. Soon it was my chance and i too got placed. :) At first it felt that now what? But then i realised that Mukit'11 was coming up and we had to make it large. It was a grand success with participants all over the world (we had some online events too.) Mukti ended , now what, two months passed by and entered April and it was project time. I would be highly greatful to Howlader Sir who helped a lot in my Cryptography project. What a guide!
Soon exams were knocking and though we had only a couple of papers and we knew it would end before we would realise it. So finally it ended within a span of 5 days and now i sit before my computer writing this and realising that yes this is it. Well one phase of my journey has ended but there are many a miles to walk before i stop. Its been a great golden period of my life, emboidered by moments like India winning the World cup. Oh! that tumbling in mud in Hall 9 to running on streets in the final year. These moments would be treasured for ever.
Lets see next is what?

Monday, April 4, 2011

One of my favourite songs

Just love this song, "Sau gram zindagi" sung by Kunal in Guzaarish.
Here's just a try:

Sunday, April 3, 2011

The Cup that matters!

Really thrilled today as most of you are after we won the all important battle.. yes the cup that matters the most is finally with us, and we can now proudly say that yes we are the CHAMPIONS of the cricketing world.

It was a dream come true and perhaps the only achievement left to achieve for the greatest cricketer on Earth, the great Sachin Tendulkar. What hasn't he done for the INDIAN cricket!! and aptly Virat Kohli says, "..he has carried the INDIAN cricket on his shoulders for the past 21 years and we are just carrying him on our shoulders for sometime.." after the historic win.

I believe what Gary and Dhoni have done and made this INDIAN cricket team is remarkable specially after all the controversies under Greg Chappel era. Gary now seems just another INDIAN .. :)
The attitude of MSD is immense and you could sense it with the way he ended the match, the way he spoke and silenced the critics by his bat.. as they say.. "bite is more effective than the bark"!

For us(me and all those in 2007-2011 batch) it couldn't have been a better adieu to our golden period of life. They won it for us when we entered this phase and they gifted us with even a bigger Cup when we are about to embark on the Corporate journey of our lives.
Often we used to cherish the moments when we won the T-20 world cup only to relive it now even in a bigger style.
I once again feel honoured to be an INDIAN and can proudly say to have lived in an era where GOD lived amongst us.

Tuesday, March 29, 2011

Winner for a couple of hours

Hi all, felt really happy to be the first one to submit a solution to this spoj challenge. This is a challenge problem so the shorter the code, the more points. Well i did remain the winner till a couple of hours till my code length was beaten by numerix, who is one of the best python coders around.
Hoping to improve my code and learn more python.

Wednesday, March 9, 2011


Hi, recently working on making a better version of Desktop Speaking Alarm.
Here's the latest version.
1. The application now works in background once you set the timer.
2. The clock set is a 24 hour one.
Please leave you reviews.

Sunday, March 6, 2011

Fun with perl-- Terminal Animation

Here's some fun for you. Want to turn you terminal to a live aquarium with sharks and ships roaming around?? Here's what you need to do:
1. Install Term-Animation from here
2. Extract the package using tar -xvf filename
3. cd to the directory formed after extraction and run :
perl Makefile.PL && make && make test
4. sudo make install
5. Install AsciiAquarium from here.
6. cd to the directory and type sudo cp asciiquarium /usr/local/bin
7. sudo chmod 0755 /usr/local/bin/asciiquarium
8. Now to test the application , type:
perl /usr/local/bin/asciiquarium
Here's a screenshot of the animation:

That't it hope you enjoy!
P.S Source: nixcraft

Tuesday, February 8, 2011

Installing NS2 in Ubuntu gets easy

Hi friends, the following is one of the easy procedures to get ns2 (Network Simulator) running on Ubuntu:
1.Download the .rar file form here.
2. Now extract it (u need unrar programme for that).
3. You would find some .deb packages. Just right click on each and choose "Open with Package Installer".
4. Open the terminal and type: ns . If you see a % sign then you have successfully installed ns2
5. Now to test the simulator, type in terminal : ns example.tcl and a simulator should pop up.(You need to write a sample tcl for this or you may donwload the example tcl file from here).
That's it , congratulations,you have installed ns2 without much hasstles i suppose. :)

1. While installing the packages with the package manager, some error messages may come , so leave those packages, and proceed with next and then come back to it.

2. A tutorial on ns and tcl can be accessed here.
3. Through the above method one won't be able to edit the source code of ns , so for that one can downlaod the ns-allinone RC7 from here . Extract it and do ./install . Then one needs to add some path variables in ~/.bashrc file (you will be told after the install process) and then run ./validate inside the ns folder

Monday, February 7, 2011

The Beginnning of Another End

It gives me immense pleasure to say that Mukti 11.2 ended in great spirits- The spirit of Openness and collaboration, contribution and encouragement.
Sadly it was my last Mukti as a co-ordinator but indeed the journey's been memorable.
Day 1:
Mukti 11.2 started with speeches from our Director and teachers who promoted foss. We had some wonderful speakers like Rahul Sundaram who started the day with workshop on RPM packaging .There was a great turn out and the workshop was very informative.
This was followed by some events. Later in the evening we had the workshop on Python programming(basics) by Kushal Das
Day 2:
The second day there were talks on Python Programming(advanced)by Kushal and then later Shilip Gupta gave some tips on Fundamentals of Programming.
Late in the evening i had the prelims of my event ,InCanity. Thanks to all for the great response. Only 1 of the qualifying team -"Madmen"( which ultimately were the winners) could correctly answer the question : "Importance of keyword volatile in C " . It left me wondering was it that uncommon??
Day 3:
At 10:00 am we started off with the finals of InCanity which was quiet interesting especially with teams competing to get the shortest code in a question.
Meanwhile we had workshop on System Programming in Python by Kushal.
In the afternoon we had talk on QML by Shantanu Tushar Jha following by Shreyank's workshop on Ruby on Rails.
After this we started off with closing ceremony by giving away the prizes for various events, with the best moments coming with Shreyank, DJing. Oh! take away his phone and he's helpless :)
Overall it was a great success, thank you all for being part of it.
Looking forward for Mukti 12.2

Wednesday, February 2, 2011

Mukti 11.02

Hi friends,
Each year Open Source enthusiasts from all over the country rise to it in unison. When Mukti comes calling.... MUKTI is the Annual National Level Technical Symposium on GNU/Linux and Free Software conducted by the GNU/Linux Users' Group of NIT Durgapur. Our sole goal is to promote the awareness of Free and Open Source Software (FOSS) in and beyond the student community of India. We have had the opportunity to play host to a number of eminent FOSS contributors at the international level during MUKTI. We preach the holy teachings of Open Source and practice it at the hallowed portals of the numerous workshops dedicated to it.We have also always had the good fortune of being associated with an enthusiastic and knowledge audience. So if you want to breath the fresh air of freedom – freedom from copyrights, licenses and registration codes - it is time to wake up. To the call of MUKTI...
So come on and register youself.

Tuesday, February 1, 2011

Solution to .jnlp file not launching in ubuntu

Hi, i was having this problem of not being able to launch a .jnlp file , i thought that it might be some problem with the java installed in my system and was almost ready to reinstall it when luckly i realised that Sun java was requiered for it and the default i was using was OpenJDK.
So i corrected it and now it's working perfectly :)
Here's how you can do it to prevent any hasstles.
Type in the terminal:
sudo update-alternatives --config java
This command will present you the java options in your system and the default one . Just follow the instruction and choose Sun Java as the default.
That's it . Enjoy :)