Monthly Archives: April 2012

Accessing .rar files in Ubuntu

Until recently I was not able to extract, forget about accessing .rar files in Ubuntu. I came across a way to access .rar files in Ubuntu. All you’ve got to do, is to install unrar. That’s it.

Just run this command :

sudo apt-get install unrar

Those who use other Debian-based distributions of Linux also the above command will work. For people who use any of the RPM-based distributions of Linux and face the same problem, the following command should work :

sudo yum install unrar

This will install the application unrar. You can then manually extract the files. If you would like to do it using a terminal, you could use the command unrar. For more details about the command, you can go to the manual page for the command. Running the command :

man unrar

will display the manual for the command.

assert.h

A couple of days back, I attended Br. Jayaraj ji’s class(by the way, he is one of the best guys in Amrita University, quoting a senior’s words). He was teaching some basic concepts in C and C++, concepts that we should have known by now, having studied these programming languages for quite sometime. I came across a very easy method to detect errors in the program. One can use the assert function defined in the header file assert.h, to find out errors in the program. This is very useful in cases where you have to check whether a particular value in greater or lesser than a specified value. The following code would help you to understand things better.

#include<stdio.h>
#include<assert.h> 
main() {
    int i, element_number, array[10];
    printf("Enter the size of the array - ");
    scanf("%d", &element_number);
    assert(element_number > 0);
    assert(element_number <= 10);
    printf("Enter the elements to be inserted in the array - ");
    for (i = 0; i <= element_number; i++) 
        scanf("%d", &array[i];
    for (i = 0; i <= element_number; i++)
        printf("%d ", array[i]);
}

Here the assert function checks if the number of elements to be entered is greater than 0 but is lesser than the size of the maximum size of the array. This helps the user check if he has entered the correct value for the number of elements to be entered.

One disadvantage of the assert() function is that it does not work functions with equality checking. It can only be used for checking if the considered value is greater than or lesser than a particular value. Consider the following piece of code :

#include<stdio.h>
#include<assert.h>
main() {
 float i  =  0.3;
    printf("Value of i - %f\n", i);
    i+=0.3;
    printf("The incremented value of i is %f\n", i);
    assert(i == 0.6);
    i+=0.3;
    printf("The incremented  value of i is %f", i);
}

When run, the printf statements before assert function, get printed on the screen. However, the expression in the assert function, gets evaluated as false and hence the program gets aborted at that particular point, and this has nothing to do with the number of zeroes at the end of the number. The floating point numbers are represented in a different manner. They are represented in the form of fraction(or mantissa), exponent, and base. Hence the unexpected result.

Happy coding 🙂

Ram Navami

Today, I thought I would post about how I spent my Ram Navmi. I know that it’s been more a week since Ram Navmi. I could not post last week because I  was busy with some last minute that I had to submissions that I had to do. Better late than never.

For those people who don’t know why Ram Navmi is celebrated, it is the day on which Hindus celebrate the birthday of Lord Shri Ram, one of the deities, worshiped by Hindus. It falls on the 9th day of Chaitra Month of Hindu lunar year.

Lord Rama, being my favorite God, I eagerly look forward to celebrating Ram Navmi every year, ever since I remember. In a small place called Punkunnam in Thrissur, the residents of Pushpagiri Agraharam very ardently celebrate Ram Navmi. I make it a point to come home during this part of the year, no matter how many classes I have to bunk or many assignment-submissions I have to delay 😉 There is a temple of Lord Rama here. The Ram Navami celebrations here go on for eleven days, starting from the Prathama  of Chaitra Month, and continuing till Ekadeshi, which is the ninth day of the month.

Everyday during these eleven days, in the mornings the idols are worshiped with abhishekam in the temple, and during the evenings the bronze idols of Lord Rama, Sita, Lakshman and Hanuman are taken around the village in a chariot. Out of the eleven days, every day the idols are decorated in different styles, and are brought out for the entire village to see.  The significance is that Lord Rama comes to visit His devotees around this time every year.

Day 1 :

Lord Rama with Goddess Sita and Lord Lakshman, on Day 1

Day 2:

Day 2

Day 3 :

Day 3

 Day 4 :

Day 4

Day 5 : Lord Krishna

On the fifth day, the Lord is dressed as Krishna, with butter in his hands. On this day, every house keeps a little bit of butter in the prasad that they offer to Lord everyday.

Lord Krishna, with a pot full of butter in His hands
The back view 

Day 6 : Anandashayanam

On this day, He takes the Anandashayanam pose. This signifies eternal relaxation.

Anandashayanam on Day 6

Take a closer at the Lord

Day 7 :

Day 7

Day 8 :

On this day, three chariots are brought out. As you can see, one chariot is of Lord Hanuman, who carries Lord Rama. Another one is that of Goddess Sita riding a peacock. Yet another, is the chariot that is used everyday, in which all the other Gods – Hanuman, Lakshman, Ganesh, Shiva and His consort Parvathi, Karthikeyan and his two consorts Vall and Devyani, are placed.

Day 8 : On the left, Lord Rama is placed on Hanuman’s shoulders and on the right, Goddess Sita is sitting on a peacock.
Lords Hanuman, Lakshman, Ganesh, Shiva, Parvathi, Karthikeyan and His consorts Valli and Devyani.

Day 9 : Rama Navmi

On this day, the idols of Lord Ram, Sita, and Lakshman are placed on a chariot which is approximately 15 feet tall. The Lord is dressed up in Raja Alankaram. In the photo, it can be seen how majestically He sits, His legs crossed, just like a king.

Day 9 : Raja Alankaram on Ram Navmi
(Lord Ram in the center, flanked by Sita on the left and Lakshman on the right)
Day 10 : Seetakalyanam – The wedding of Lord Rama and Sita

Day 11: Anjaneyotsavam

It is believed that the best way to please God is to please his devotees. On the last day of the celebration, Lord Hanuman is given importance. He is dressed up beautifully, with garlands of rose apple and betel leaves. As the chariot stops at each house, crackers are bursted, since Hanuman likes crackers a lot.

Day 11 : Lord Hanuman on Anjaneyotsavam Day

First Bug Fix in Gnome

Yesterday, I got my first bug in GNOME, fixed. It was a very simple bug in gedit – a product of GNOME. I downloaded the source code from the Ubuntu repository and then created a patch.

This the bug that I fixed :

https://bugzilla.gnome.org/show_bug.cgi?id=671296

This is the patch for the bug that I fixed :

http://git.gnome.org/browse/gedit/commit/?id=3306a4b901411cc2f5be90fc84ac0fcc1cb8b36e

This is what I did :

  • The first step was to download the source code from launchpad.net.
  • The next step is to search for the bug in the vast source code. Once the bug has been located in the source code, 50% of the problem gets over.
  • You have to now try to fix the problem mentioned in the bug. This varies from bug to bug. My bug was pretty simple.
  • After you create a change in the source code, you have to test this by running it.
  • Now you create a patch, which is basically a file stating the difference between the source code and the change that you have created.
  • Upload this in the bug page in the corresponding Bug Tracker website and leave it to the reporter of the bug and developers of the organization to review the  patch and comment upon it.

I thank all people who helped me get the bug fixed, as well as, those who pushed it into the git repository 🙂