"A little progress everyday adds up to big results"

Sunday 16 September 2012

Clear explanation of Java's Ugly Syntax

Introduction:
               Most of the Java programmers might have worked with the (Ugly) syntax of an anonymous class. This post will cleanly explain the Ugly syntax (especially with Anonymous classes) of Java. For example,  consider the button click event in Java Swing.

class EventHandler implements ActionListener
{
         public void actionPerformed(ActionEvent e)
         {
                     // Code that handles the event
         }
}

// Somewhere else
ActionListener e = new EventHandler();
button_object.addActionListener(e);


This is a very straight forward way, where each and every process is done step by step. Now, before moving on to the equivalent ugly syntax code, we must be knowing 5 Java concepts.

1. Interface object concept:
                                 An interface can have an object to which, an object of one of the classes implementing it, can be assigned. For example, in the above code, ActionListener is an interface and e is an object of it. We have instantiated e by invoking the new operator on the EventHandler class (which implements the ActionListener interface).

2. Anonymous object concept:
                                 The synonym for the term 'Anonymous' is 'nameless'. There might be some situations when we would require the object of a particular class, in just one statement. In such cases to avoid 2 lines of code, we may go for an Anonymous object. 

For example:

ActionListener e = new EventHandler();

button_object.addActionListener(e);


could be written as

button_object.addActionListener(new EventHandler());

                           This is done purely to reduce the lines of code; however doing so affects the readability of the code, whereas the efficiency of the code remains unaltered.

3. Method implementation specific to an object:
                                While writing multi-threading code in Java, one might have written code something like this.

Thread t = new Thread()
{
          public void run()
          {
                   // Thread code
          }
};


One can say that this code implements the method run(), which is specific to the object t.

4. Method implementation specific to an instance of an interface:
                          This is nothing but the combination of the concepts 1 and 3. This concept will be well understood with the following examples.

Runnable t = new Thread()
{
     public void run()
     {
          // Thread code

     }
};


Using this concept with the ActionListener interface,

ActionListener e = new EventHandler()
{
          public void actionPerformed(ActionEvent e)
         {
                     // Code that handles the event
         }
};


5. Anonymous class concept:
                              Bit tricky to understand, but would be simple with an example. The syntax of an anonymous class is
new <Implemented interface/Super class>()
{
           // Code inside the class
}

For example,
class A
{
       // block of A
}
interface B
{
       // block of B
}
class C extends A implements B
{
       // block of C
}
class Main
{
        B b = new B()
        {
               // methods of the interface B are implemented here
        };
}

                
Putting them all together:                        
                            Now, we are going to put them all together. So, the click event code (mentioned in the second paragraph) can be written as follows.

button_object.addActionListener ( new ActionListener()
{
        public void actionPerformed(ActionEvent e)
        {
            // Code that handles the event
        }
} );


                Well...! Hope you might have understood. If not, please don't worry, you will understand it when you use these concepts in your code.

Now tell me, isn't Java interesting and challenging ?

Sunday 9 September 2012

Running Java Applet in free website domain

                           As a Java programmer, everyone will know that Java can be embedded in Web pages as Applets. This post will show how an Applet can be embedded in a Web page, which is hosted in a free domain.

Step 1: Make the Java applet source file ready.
Step 2: Compile the Java applet to get the class file.
Step 3: Write an HTML code, embedding the Applet.
Step 4: Create a free domain using one of the free hosting services like 000webhost
Step 5: Upload the .class and the .html files into the same directory

Share the URL with your friends and enjoy!

Sunday 2 September 2012

Effective utilization of resources


                Initially I would like to inform that this post is not to hurt anybody. The only intension of this post is to make people to utilize the available resources efficiently

             We, the homosapiens, keep telling that certain resources are not abundantly available. Now-a-days, electricity is very scarce in India. This is very evident as most of us might have been facing many problems because of frequent and unannounced power cuts.

                  Do you think that electricity is really insufficient ? That might be true to some extent, but, what I feel is that some people are overusing (and thereby wasting) it. The variations are very drastic in the country. When there is a group of people suffering because of power cut, there is a group which consumes electricity without any use. There are some people who are waiting for the power to type their documents in a computer. There are also people who keep their computer turned on the whole day whether or not they are using it.

                   Petrol hike keeps persisting because of the inefficient usage of it. People start preserving a thing, only when there occurs a scarcity. If a certain resource is abundantly available, we use it to a greater extent. Why not we preserve that particular resource inspite of its abundant availability ? We expect certain things as a rule. For example, some of us use helmets for the sake that it's compulsory and not for our own safety. Another example is the rain water harvesting scheme of Tamil Nadu government a few years ago.

                     I don't mean that we should limit the usage of resources. My point is that don't use any resource unless it is needed (or in other words, don't unnecessarily use any resource).

"It's our duty to leave behind all the resources to our future generations"

Tuesday 28 August 2012

Curriculum Vitae structure

                         The following is the curriculum vitae structure suggested by Infosys during my industrial visit with my friends.

1. Contact address
2. Educational designation in the order college, 12th, 10th
3. Career objective
4. Project experience
5. Project achievement
6. Work experience (in NGOs etc)
7. Rewards and recognitions
8. Extra-curricular activities
9. Extra-curricular activities (non-technical rewards and recognitions)
10. Personal details

Monday 27 August 2012

Common interview questions

              On 25th August, 2012, I had been to Infosys, Bangalore with my friends as industrial visit. There, common interview questions were discussed by the Infosys workers. Those questions are listed below.

1. Tell me about yourself
2. What are your career goals (short term and long term)?
3. Why do you prefer to work with us?
4. What is your biggest achievement in life?
5. How do you handle failure?
6. How do you deal with the change?
7. What salary do you expect?
8. Would you like to ask us any questions?
9. What is unique in you?
10. What are your likes and dislikes in teamwork?
11. How have you contributed for events in your college?
12. How do you update yourself?
13. What are the frequent websites you visit or frequent books you read?
14. What is your favorite pastime?

Sunday 26 August 2012

Infosys campus visit

                    On 25th of August, a group of more than 150 people from my college (Sona College of Technology), went to Infosys as an industrial visit. This post is about IT students' campus visit to Infosys, Bangalore.

My stay at hostel:
                          We had planned to depart at 3 am on 25th August. Since my home was far away from the college and there would not be sufficient transport facilities around the midnight, I went to the college hostel the previous day at 10 pm and stayed there in my friend, Vignesh's room. The stay in the hostel was a bit strange to me; everyone using laptops/desktops for browsing, playing games or listening to music; people walking in the corridor with mobiles in their hands; funny talks and many more scenes.

Departure:
                         On the day of our departure, almost everyone reached the college by 3:15 am. A group of 41 students (32 girls and 9 boys) and 2 staff from IT department departed the college campus sharp by 3:34 am in the bus (owned by Lakshmi Vilas), which we had booked. Unfortunately, no one had brought songs in pen drive and so, we couldn't listen to good songs. But, then, we watched the film titled 'Naan ee' (நான் ஈ). Some of us (including me) were sleeping in the bus (as we had waken up so early).

Infosys:
                                  After having refreshment at Krishnagiri and breakfast at Hosur, we shifted to another (Karnataka registered) bus in order to reduce the bus fare by minimizing the tollgate charge. The driver of that bus drove very fast and harsh. Holding breath, we were keenly looking for Infosys. By the time we reached Infosys, it was 9:12 am. But, they said that they couldn't let us in without the whole college assembling. The CSE department had departed the college only around 6 am and said that they would be reaching only after 10:30. Then, upon request, the Infosys organizers let the IT students and MCA students (who had already assembled by the time we reached Infosys) in.

The campus:
                                The campus was full of green plants and trees. There were many magnificent buildings. Seeing the surroundings of the campus, mind was very pleasing. We could see trees and buildings on all the directions. Then, after refreshment, we were made to sit in an auditorium, which also had a balcony. Some of us sat in the ground floor whereas the rest were sitting in the balcony. 

Presentation: 
                               There were 6 colleges including AVS Engineering College, Paavai College of Engineering, participating in this campus visit program. First of all, they asked our expectations in that program. One or two students from each college told their expectations, whereas 6 students represented Sona College. The entire session was co-ordinated by a person called 'Dattatreya'. Several other speakers also addressed on various topics. Time passed away so quickly and around 1:20, we were taken for lunch. After lunch and photographs, we went back to the auditorium.

Interactive sessions:
                                 In the afternoon, there were 2 small interactive programs. Initially there was a story matching contest (by re-arranging the given sheets of papers) and then there was a group discussion, in which four people from each college were allowed to participate. I was one among them. Later, the do's and don'ts of a group discussion were listed. After that, the Curriculum Vitae structure and the most common interview questions were discussed. Finally, after writing feedback, they gave us the email ids of the volunteers, who co-ordinated the event. After the completion of the sessions, we came out of the campus by taking photographs all the way through.

Return back:
                                While returning back, after changing to Tamil Nadu bus, one of my professors, Mr. Ilanchezian and I kept discussing regarding various things for more than an hour till we reach Krishnagiri for dinner. After dinner, I went to the front side of the bus and slept till we reach the college. By the time, we all land in the college campus, it was 11:50 pm. I stayed in Vignesh's room in college hostel and returned back to my home the next day morning around 6:30 am.


"Campus visits definitely teach everyone something new"

Saturday 4 August 2012

My first presentation on Android application development

A surprise:
                  When I had been to internship at IIIT, Hyderabad during my fourth semester holidays, I kept reporting my work to my HOD (Dr. J. Akilandeswari) via email. She replied that it was her wish that I take a presentation on "Android application development" after my return to college, as I did my internship project on Android platform. Being a lover of sharing knowledge, I was overwhelmed with joy and immediately replied my acceptation to my HOD through mail.

Longing days:
                       After returning to my college, HOD specified a Saturday (August 4th, 2012) for doing the presentation and asked me to contact my lecturer, Mr. Murali, to make the hall arrangements. Everything were ready on 31st July and I was waiting for the day to come. At last, the day came and I did the presentation on "An introduction to Android application development" at PG auditorium of my college approximately about one hour and fifteen minutes for the 3rd year IT students. 

Presentation:
                         This was the first time in my life doing a continuous presentation for more than an hour. Though I had stage fear during previous presentations and seminars, I couldn't find stage fear in myself during this presentation (might be because, I was doing announcements in different classes the previous week, regarding programming club, Aspirations - a programming contest conducted by Infosys every year and was taking classes in the programming club of my college). I think because of my confidence, I could explain clearly, whatever I intended to tell.

Feedback:
                        Some of my friends appreciated my confidence, professionalism and accent. Some added that they could understand the concepts very clearly, though they have attended Android workshops. Because of the lack of time, I could not complete explaining whatever I had prepared. But then, I was happy about the feedback given by my friends. I should really thank my HOD for giving me such a golden opportunity.

"Practice makes a man perfect"

Tuesday 31 July 2012

Earthing your PC to prevent shocks

                   Sometimes, if the power line of the house is not connected to earth properly, we might get shock on touching electronic devices. I used to get shock whenever I insert pen drive to my system. So, whenever I insert a pen drive to my system, I kept my feet in the air so that there is no physical contact between my body and the ground. Though this solved the problem temporarily, I needed a permanent solution. As we (my parents and I) were staying in a rent house (in the first floor of the building), I couldn't do the conventional earthing.

                             When I consulted the situation to an electrician, the solution given by him was so simple. "Fill a small pot/jug with sand, connect one of the USB ports with the sand by means of any wire and keep the sand wet all the time". This was the suggestion given by him. I tried the same and now, everything is fine and there are no more shocks.

"For every big problem, there is a simple solution"

Sunday 29 July 2012

Education system

               This post is just to share my sufferings and not to complaint about the education system. 

My HSC (12th std) exam:
                       I usually love Mathematics since my school days. But, during my 12th standard public exam, though I had a good preparation, I couldn't write the Mathematics exam properly, because of the tension as the question paper was bit lengthy and was not according to the blue print. So, I scored just 182 in Mathematics. Mathematics score plays a very important role in getting seats in Engineering colleges as 50% of the cut-off is Mathematics mark.

How I suffered?
                          I concentrated equally on all the subjects and had obtained a total score of 1137, whereas my cut-off was just 189.75 (because of Maths, as I scored 197 in Physics and 198 in Chemistry). Students who mainly focused on PCM (Physics, Chemistry and Maths) subjects had good cut-off, but less total score. They got seats in reputed colleges and government colleges, whereas I worried a lot. But, I don't mean that Sona College is not a reputed college. What I mean is "Why do people give more importance to only three subjects rather than the total score?". This is not only my question. It's the question of many people, who suffered and are suffering like me.

"The 3 hour examination is more important than the 1 year preparation!"

Saturday 28 July 2012

Mounting

What is mounting?

                       In modern computing, mounting plays an important role. In layman terms, mounting is making a drive/archive to act as a directory or making a directory to act as a drive, though that is not the exact/right definition.

Where is mounting used?

                             Mounting is used in several places like looking for the contents of an iso image without burning them to a CD, using Windows partitions from Linux OS, etc. Let's discuss a few applications of mounting and how to use the mounting facility.

Running Turbo C from Dosbox:

                               Many novice C programmers, especially those who use Windows 7 platform for programming, make use of a third party software called Dosbox. To run Turbo C from dosbox, the very first command is mounting, which goes as
mount c: <directory_path>
Here, the entire directory acts as the C: drive and for any action that is being performed within Turbo C, the <directory_path> has to be considered as C: drive. Here as you can see, the directory is treated as drive.

Mounting devices in Ubuntu:

                        Ubuntu, one of the famous operating systems of Linux, uses auto-mount concept. Once you click on a Windows drive icon, Ubuntu automatically mounts that drive in the /media/<directory_label>/ directory. If the directory already exists, then an '_' is added as a suffix to the <directory_label>. Even when you insert pen drive, it is auto-mounted in the /media/<pendrive_label>/ directory. Here, a drive is treated as a directory. Though Ubuntu supports auto-mounting, sometimes we might need manual mounting also.

Manual mounting in Ubuntu using Terminal:

                          To manually mount a device in Ubuntu, we first create an empty directory in the required directory, by using the command
mkdir <dir_name>
To know the list of available devices, run the command
sudo fdisk -l
Now, mount the required device, using the command
sudo mount <device_name> <dir_name>
Now, you can see the contents of the device, in the <dir_name> directory. To unmount, use the command
sudo umount <dir_name>
Note: The spelling is umount (no 'n') and not unmount.

Mounting with permissions:

                                 If we normally mount pen drives (either auto-mount or manual mount), then we won't be able to run any application from pen drive. To mount a device with permission to run applications, use the command.
sudo mount -o umask=0 <device_name> <dir_name>

"Mounting is a powerful feature, if you know how to use it"

Tuesday 10 July 2012

My visit to Golconda fort

Preparation:                  
                      I had booked train ticket to return on 11th July, to Salem from Hyderabad (where I went for my summer research fellowship). I had completed my project and report work on 9th July. So, I decided to visit Golconda fort on 10th July. As usual, I noted down the guidelines to reach the fort from IIIT, where I was doing my fellowship project, by seeing google maps.

Travel:
                   There was no direct but to Golconda. Since, the buses were much crowded, I reached a place called 'Shekpet Nala' through mini taxi, which is one of the famous modes of transport in Hyderabad. I was charged Rs. 10. Then, when I inquired auto to go to Golconda from Shekpet, they asked for Rs. 70. Neglecting them, I started walking towards the bus stop. Then, an auto-man asked me whether I was going to Golconda fort. When I replied in positive, he said that he would take me there for Rs. 20. I accepted. He dropped me in a place called Tolichowki, got Rs. 10 and asked me to get another auto from there, which will cost another 10 rupees. I did as he said and reached Golconda finally.

The fort:
                By paying the entry fee of Rs. 5, I entered the fort. The fort is like a big city, with many ups and downs, rocks and building structures. I could see a temple, olden day jail, etc. When I was walking alone, I saw a long, but thin, snake crawling in the walls. Though the snake was at a distance, I was a bit scared and vacated that place instantly. On one side of the fort, the people are doing poojas by killing goats and cocks.

Departure:
                    The fort consists of several steps to reach on to the top for enjoying the city's beauty. I couldn't go all along the top at a stretch, as it was panting. So, I sat on the rocks in between several times. After enjoying the olden structures, I boarded a bus to reach Mehdipatnam (one of the famous bus stands in Hyderabad) and from there, I reached IIIT at 2:30 pm, as I had to pack my things for returning to Salem, the next day.

"Whatever may be the modern structures, people still like olden structures also"

Sunday 1 July 2012

My Charminar visit

                 During my stay at Hyderabad for Summer Research Fellowship, I went to Charminar. This blog is about my visit to Charminar.

Departure:
                       On the previous day of my visit, with the help of Google Maps, I found that there is no direct bus for Charminar from IIIT(Gachibowli). I had to go to a place called Lakdikapul first and from there I should go to Charminar in another bus. After having my breakfast in the IIIT bus stop, I boarded a bus for going to Lakdikapul. In the first bus, after buying the ticket, I told the conductor in Hindi that I don't know the stopping. He said that he would intimate me on reaching Lakdikapul.

Me at Lakdikapul:
                           After reaching Lakdikapul, I asked so many people, where would the bus towards Charminar stop. But, everyone replied that they don't know. With some assumptions (from the Google Maps), I reached a bus stop. I was stopping there so long. But, the bus towards Charminar didn't come for a long time. After inquiring many people, I was said that I was standing in the right stopping only. Moreover, the language was also a problem for me. மொழி தெரியாமல், வழி தெரியாமல், விழி பிதுங்கி நின்றிருந்தேன். At last the bus came when it was about 45 minutes since I reached the stop.

Charminar:
                            Somehow, I reached Charminar around 10 am. The entry fee was Rs. 5 per head. Charminar is like a multi-storied building with steps having spiral structure. Each step differs in size. Thank God, we were not restricted to take photographs there. After going to the top, one could see all the 4 sides surrounded by streets. A security person was explaining about the architecture in Telugu to a family. Even I listened to him, but I couldn't understand much as I didn't know Telugu.

Mecca Masjid:
                           My mom had asked me to buy a pair of pearl bangles. So, after having my lunch, I inquired about the bangles in 3 to 4 shops and then bought a pair. Then, I went to Bhaghyalakshmi temple, which is immediately next to Charminar. Later, I went to Mecca Masjid, which is just opposite to Charminar. I had been into a Mosque for the first time in my life, on this day. I could see many doves coming to eat the grains that are being spilled in the Masjid by the pilgrims.

Golconda fort:
                           It was just 3 pm, by the time I see all these. Then, I decided to go to Golconda fort. After waiting for more than an hour, a bus towards Golconda came. After reaching Golconda, it was 5 pm and I was really very shocked to see the crowd and the traffic jam. Since, I need to travel a long to IIIT, I didn't enter Golconda fort. I reached Mehdipatnam (One of the famous bus stands at Hyderabad) in an auto and then reached IIIT through a bus from Mehdipatnam.

"It's always better to go out by knowing a language which is familiar to the people living there"

Saturday 30 June 2012

Comparing floating point numbers in programming languages

                    Some times, while programming, we might need to handle floating point numbers. In such cases, we cannot compare them simply by giving '==' operator, because, we cannot expect the numbers to be perfectly equal, if the number of values beyond the decimal point goes unlimited. In such cases, we can follow these steps.

(Assuming we need the floating point numbers to be equal for 4 digit precision)
For C/C++:
#define PRECISION_DIGITS 4
#define DELTA pow(10, - PRECISION_DIGITS)

For Java:
final int PRECISION_DIGITS = 4;
final float DELTA = Math.pow(10, - PRECISION_DIGITS);

and in the program, you can compare like this
if ( abs ( value1 - value 2 ) < DELTA ) // For Java change abs to Math.abs
{
       // Statements for value1 == value2
}
else
{
      // Statements for value1 != value2
}

More references regarding the floating point comparison is available in this site.

Tuesday 26 June 2012

The power of NDK in Android

                     While developing android applications, sometimes, one might want to perform CPU intensive operations like huge number of calculations. In such cases, the time taken for performing those operations might be so high, so that the user gets frustrated. Of-course, one can run such operations as a Service ( background task ) and intimate the user on completion via notification; but, there is a better alternative in Android, called Native Devleopment Kit ( NDK ), which allows development from C/C++ instead from Java.

                       It is simply the equivalent of Java Native Interface ( JNI ) in Java. This is nothing but, calling C/C++ functions from Java. If one has a very basic knowledge of JNI, then it's not at all a matter for him/her to develop application in NDK. I faced this situation once, when I developed Speaker Recognizer application for android as a part of my internship at IIIT, Hyderabad. I had written the entire code in Java and the code executed nearly for about 40 seconds on a device with operational frequency 600 MHz. When I reported this to my project guide, Dr. Kishore S. Prahallad, he suggested me NDK.

                      I thought that C/C++ would be some 2 or 3 times faster than Java. But, to my surprise, my code executed in just 4 seconds on the same device, which is almost 10 times faster. I was wondered and realized that C and C++ are nearly 10 times faster than Java on Android devices. So, if you want to perform CPU intensive operations on android, I suggest NDK. The entire tutorial is available at this site.

Functional testing of your mobile

                       Almost all possess at least one mobile phone now-a-days. Sometimes, some of the features in the mobile might not be working. In such cases, you yourself can test what has went wrong by following some simple steps as given below.

1. Bring your mobile to the home screen ( Unlock if necessary )
2. Press right arrow key once
3. Press * once
4. Press left arrow key twice
5. Press * once
6. Press left arrow once
7. Press * once
8. Now, you can see a menu. Select a one which has 'Testing' or 'Test' term
9. You can now, select the functionality that you want to test.

Note:
1. Perform these operations at your own risk. You can use 'back' button to return back.
2. The key order might change on some mobiles.

Sunday 10 June 2012

My visit to Birla Temple and Birla Planetarium

                          It was too boring for me at IIIT, Hyderabad when I went for an internship during my second year summer vacation. My mom was insisting me to go somewhere out, especially to the Birla Temple. So, I have decided to go on a Sunday.

Preparations:
                     On June 9th, with the help of google maps, I found out the guidelines for going to Birla Temple from IIIT and also found that Birla Planetarium is very close to the temple. I have decided to go there the next day ( Sunday, 10th June, 2012 ).

Starting of my journey:
                         After asking the location of the bus stop to one of the securities of IIIT, I went to the stop. A bus came in 10 minutes. With a little hesitation whether or not the bus will go to Birla Temple bus stop, I boarded and asked ( while standing in the steps ) a person ( a policeman ), who was sitting in the first row of the bus, whether the bus will go to Birla temple. He replied in positive and asked me to sit next to him in action. I did so.

Bus ticket:
                        That policeman asked me something in Telugu. I said that I don't know Telugu and Hindi. He asked me where actually I am going, in English. I said that I am going to Birla Temple. When the conductor came and asked for the ticket, that policeman himself told "1 Birla Temple" and I gave a 10 rupees note to the conductor. When the conductor asked for 2 more rupees ( as the ticket was 12 rupees ), the policeman translated it for me, though I understood the words of the conductor. The policeman asked the conductor ( in Telugu ) to intimate me on the bus reaching Birla Temple stop.

On the way:
                        On the way I could see a vehicle sweeping the road and the other one pouring water to the plants in the median, at 7:30 am. The policeman informed me that he is going to alight and added that my stopping is 5 stops next. He also informed the driver to intimate me on reaching Birla Temple and alighted the bus. On reaching the stop, the driver and the conductor intimated me and I alighted.

At Birla Temple:
                    Finally, after asking the route from 3 people, I reached Birla Temple. There, the temple is wonderful. The whole building is made up of crystals. After admiring at the architecture, I entered and worshiped Lord Venkateshwara. As soon as I came out after my prayer, I could see a view of Hyderabad as if it's seen from a 6 or 7 storied building. Unfortunately, we are not allowed to take mobiles or cameras inside. I also saw a lake with some fountains and the morning breeze ( around 8 am ), pleased me. Though, I know that the temple's beauty is much more reflected during the night time, I couldn't stay that long. Here are some pictures of Birla Mandir obtained from the internet.


At Birla Planetarium:
                       After returning back from the temple, I had my breakfast in a nearby hotel and went to the Birla Planetarium which is next to the temple. But, the ticket counter to enter the planetarium had not been opened at 9:45. Many people, including school students, were curiously waiting for the counter to open. Everyday there are shows ( in Telugu, Hindi and English ) at the planetarium, among which the shows in English are at 11:30 am, 4 pm and 6 pm. A science museum is also located inside the planetarium itself. After opening of the counter around 10:45 am, I got the tickets for both the planetarium show ( at 11:30 ) and for the science museum.

Science museum:
                      I remember, when I was a kid, I have been to a Science museum at Bangalore. With full of curiosities, I entered the museum at 11 am. There were many instruments each depicting a science experiment. I just had a overview of what are available in the museum and the time was 11:33. I rushed to the planetarium. I was asked to switch off my mobile and I did it. The show had started. But, then, some other people who came late and I were taken inside a dark room. Later they took into the theater where the show was held. Due to the darkness, I couldn't move and I was standing still. I could see 2 small dots ( as stars ) in the side wall. After some time, I was guided and asked to sit in a vacant place.

A visit to the Solar System:
                        After sitting and leaning back, I could see a number of stars and objects in the ceiling of the doom shaped theater. Starting from Mercury till Neptune, each and every planet were described in detail along with some videos and an illusion of what one would see, if he/she is landing in that particular planet. Being a lover of Space Science since my childhood, I enjoyed the journey to the Solar System. After a 45 minute travel in the solar system, I went back to the Science Museum.

Pictures of Birla Planetarium





Back to museum:
                         Some of the experiments which I liked were, the depiction of Pythagoras theorem, optical illusion experiments, density and refractive index variation of water with change in temperature, periscope to see the happenings at the 1st floor from the ground floor, etc. Some people were taking notes of whatever they see. Simply saying, Science Museum is place for enjoyment for kids, knowledge zone for students and entertainment zone for others. Later, I also happened to see a skeleton of a Dinosaur. Here are some pictures of Birla Science Museum.



Wednesday 6 June 2012

Vignesh Jagadeesan

                     Vignesh Jagadeesan is one of my best friends. Here I am going to tell you, how we became friends.

Meeting:
                     During the first year of my engineering, I used to go to college by bus. Vignesh also used to come to college by bus. We had seen each other. But, hadn't spoken to each other. Vignesh had achieved a lot by presenting papers, posters and also by winning in almost all of his presentations and competitions that he participated in, during his first year of engineering itself! He maintains a social relationship with everyone he meets. I used to see him noting down the unknown terms from the newspaper in the college library.

First speaking:
                      It was the last day of our first semester theory examinations. It was 'Engineering Graphics' exam where we were supposed to draw some shapes using a template. It was held batch-wise and after my batch completed the exam, Vignesh had his exam. He forgot to bring his template. So, he asked mine. I gave and even before I ask his name and department, he introduced himself to be 'J.Vignesh from CSE - C section'. He told that if I am not available, he would give the template the next semester after 10 days of semester holidays. I accepted.

Template:
                  As his face showed that he is so sincere and is a very responsible person, he returned back the template on the very first day of the college reopening, by coming to my class! After some days, when I went to his class, everybody in the class started shouting. I was shocked and didn't know the reason. Then I came to know that they are making fun of Vignesh and me, as we look the same.

A wonder:
                     Whoever sees us both for the first time, used to ask us whether we are brothers. I had written a modified version of 10 Thirukkurals, which I had shown to the first year dean, Mr. Karunakaran. He had asked Vignesh, are you the boy who wrote those Thirukkurals. I came to know this around the end of 2nd year ( on March 10th ). The wonder is that, both our characters as well as appearance matches almost exactly!

First presentations:
                 No sooner we became friends, we started doing presentations together from the third semester. The first paper presentation that we did was in Sri Venkateswara College of Engineering, Chennai and the first project presentation was in Thiyagaraja College of Engineering, Madhurai. But, before that, we both attended In-plant training at BSNL, Salem.

Teachers' comment:
                      Vignesh's class councellor, Ms. Theetchanya, said when she met me for the first time,  "அதே தலை, அதே முடி, அதே மண்டை" and dean of CSE, Dr. Usha mam used to make fun of us, by saying "Suresh... Ramesh..." ( because, it was a famous 'Diary milk' advertisement at that time ).

Feeling proud:
                     If I hadn't been a friend of Vignesh, I might not be able to undergo a fellowship, which is a turning point in everyones life! I wish him all success in his life. I am very proud to be his friend and trust that our friendship will never end!

Tuesday 29 May 2012

Our first fellowship story

Confused?
                     One might wonder seeing the title, why I have used 'our' instead of 'my'. Because, Vignesh Jagadeesan, one of my best friends, and me applied for the fellowship together. This article will explain the problems that we faced for our first fellowship.

Preparation:
                     It was the time, when we were just back from International Collegiate Programming Contest Regionals ( ICPC-2012 )  held at Amrita University, Coimbatore during December 2011. We just saw the data to be filled in the application form for the Indian Academy of Sciences ( IAS ) fellowship. Mr. K. Saravanan, my class councellor and Ms. Theetchanya, Vignesh's class councellor helped us for applying to this fellowship. Everything else in the application form, except the list of (5) guides preferred and statement of interest, were easily fillable by us. 

Statement of interest:
                    So, we approached my HOD, Dr. J. Akilandeswari for preparing the statement of interest. She helped us and initially we chose 'Opinion Mining' and had prepared the report. HOD had thought that the fellowship is a team one. But, later when she realized that it's individual, she asked one of us to choose different topic. So, I prepared a report on 'Social Network analysis' ( Finding Similar Users in Facebook ). We have applied for it On-line ( with very less hope ) after getting recommendation letter from corresponding HODs.

Problem with post:
                     Both of us, posted the On-line filled application form, together, on 2nd January, 2012 ( my birthday ). But, Vignesh's post had reached them whereas mine had not. This is still a miracle. On tracking the post, the status was delivered. But, then, I kept on getting remainder emails from the academy to post the application form. So, I got signature in all the required forms from my HOD and resent it.

Selection:
                   Days rolled over and we weren't watching for the selection curiously. We also applied for fellowship at IIT-Delhi. After 3 days of applying to IIT-Delhi fellowship, on March 1st, my department was in the symposium mood which was to be held on the next day. Vinoth Kumar, one of my best friends, was practicing for his dance and I was with him. Unexpectedly, I got a mail alert on my mobile with from address pointing to the academy mail. With much curiosity, I checked mail from Vinoth's laptop and on seeing it I called Vignesh and called him to check the mail. He checked and obviously, he was also selected.

Guides:
                  Vignesh's guide was Prof. Sushmita Mitra, ISI, Kolkata and
                  my guide was Dr. Kishore S. Prahallad, IIIT, Hyderabad.

Happiness:
                  Immediately we told both the HODs. They were really happy. We thought that we have to go to Bangalore for fellowship and our guides will also come there. I went home fearing whether or not my mother will allow me for it. But, she wasn't there when I went home. I went through the mail in depth and realized that we must go to the respective locations of our guides. When my mom came home after 8pm or so, I told her. To my surprise, she accepted and also Dr. Dhanalakshmi ( Homeopathic doctor ) who was residing opposite to my house also asked my mom to send me.

Mother's meeting with HOD:
                  Though my mother had accepted, she had a doubt whether it would be useful or not. I asked her to come and clarify it with HOD. But, then trusting me, she said that it was not necessary. One day, I applied for passport in college. I left out 10th mark list in home and went. But, since, they asked it, I asked my father to bring. My mother brought it. I asked my mom to meet HOD. She did. HOD said that it would be useful and was a wonderful opportunity that one wouldn't easily get. My mother became confident.

Booking the train tickets:
                  As we would be leaving in summer vacation, we would not be able to get the train tickets, if we booked late. So, even before the announcement of time-table, we had to book tickets. Fortunately, when we were in chaos for more than an hour without knowing whom to ask, we happened to meet first year dean, Dr. K. Karunakaran. He gave the mobile number of deputy COE, Prof. S. Radjarejesri. We called her and she told that all the exams would be over by 10th of May. So, we booked the train tickets for the respective destinations. 

The Great Mind Challenge:
               Vignesh and I were doing an IBM project for a web-design contest titled 'The Great Mind Challenge' at that time along with 2 more friends. But, since we wouldn't be able to complete the project, we completed only the design part and didn't do database connectivity. 

Mini-project evaluation:
              I had to do a mini-project with two of my friends ( Ramki and Sasidharan ) for which 2 credits are allotted during the fourth semester and the evaluation dates ( June 11 & 12 ) had been fixed as soon as the college reopens ( June 11 ). So, I asked my HOD, whether anything could be done. But, then, since her reply was in negative, I booked train tickets to come back to Salem on June 10th and return back to Hyderabad for fellowship on July 11th, after confirming to my guide whether the break is acceptable.

Special Interest evaluation:
            Later we came to know that the special interest ( which had no credits, yet cleared/not cleared was based on it ) evaluation, which is common for all departments, is also going to be conducted after the reopening of the college ( June 15th and 16 ). Upon requesting, my HOD asked principal and COE, to reschedule the entire evaluation dates on June 13th and 14th just for me ! ( since I will be here for mini-project evaluation on June 11th ). So, again I booked the train ticket to return to Hyderabad on July 14th. Though I felt, that it was okay, I felt really bad about Vignesh's situation as he had to come all the way from Kolkata ( via Chennai ) which would take around one week ( for his arrival, evaluation and departure ). Even he booked the train tickets for his return and departure to Kolkata.

An unexpected turning point:
           During the study holidays, Vignesh's class councellor, Ms. Theetchanya, who helped us a lot in applying for the fellowship, called me and asked to tell Vignesh that the Special Interest evaluation had been postponed to some other date. As the college reopening date had been postponed to June 18th, the mini-project evaluation was postponed to June 19th and 20th whereas special interest evaluation was postponed to June 21st and 22nd. We felt too bad. I called my microprocessor sir, Mr. Ilanchezian, who was also working as Assistant COE, and conveyed our situation. I just told him the situation ! He had requested Deputy COE, to advance both the mini-project and special interest evaluations for both of us before we leave Salem for our fellowship ! We felt really happy and canceled the unwanted tickets. Vignesh and I had successfully completed the evaluations and then, departed to Kolkata and Hyderabad respectively, for our fellowship.

People whom we should thank:
            During that period, a lot of people helped us both directly and indirectly. Here I am listing the people who helped us a lot for our fellowship and without whom, our fellowship could not have been peaceful.
Dr. J. Akilandeswari,
Dr. B. Sathyabama,
Dr. B. Saravanen,
Dr. K. Karunakaran,
Ms. Theetchanya,
Mr. K. Saravanan,
Mr. P. Ilanchezian

"Apart from these, we faced some more problems, which I am unable to post publicly".

My coding conventions

                                  When I started programming, I didn't follow any conventions in naming the variables and functions. But, as days passed by, I started using standard conventions for naming. The naming conventions I use for programming are

class - Every word in title case - standard Java convention

method - Every word except the first one in title case - standard Java convention

variable - Every word in lower case, each word separated by an underscore '_'

non-final, non-static, member variable - Every word in lower case, each word separated by an underscore '_' and prefixed with 'm_'

non-final, static, member variable - Every word in lower case, each word separated by an underscore '_' and prefixed with 's_'

final variables - Every word in upper case, each word separated by an underscore '_'

Other conventions used by me:
Task pending - // TODO: - Convention followed by Eclipse IDE

Optimization possible - //::

Test code which has to be removed later - surrounded by lines // TEST //

My programming journey

Before starting to learn programming:
                                  I started programming ( of course 'C' )  in late 2009, when I was studying in my 11th standard. Before I was taught programming, I just went through the text book ( two volumes for Computer Science and C was in the second volume ) given to us. In the exercises part of the 'C' lesson, I saw a numerous problems ( to convert Fahrenheit to Celsius, to find the number of days between two dates, to find the perfect number, etc ). As Computer is not a subject in school days ( though I had studied Computer during my 8th standard in Matriculation ), I was wondered to see those problems and was admired how one could solve them.

Initial programming classes:
                                   Later, the most awaited day came. We were taught C. But, then, initially we were taught the history of C and then theoretical parts like keywords, tokens, etc. Then, we were taught how to program. At this point, I must thank my Computer Teacher Mr. Yuvaraj. Initially I was very blank.

A program written on a paper:
                                   Then, my cousin ( Ms. Usha ) got married to Mr. Shivaraman. He asked me to write a simple program which calculates the total, average, result, etc of a 10th student. It was the time when there was no system in my house. I tried to write that program in a notebook. It went to 2 or 3 pages. After that, one day, I went to my cousin's ( Mr. Kannan ) house and typed that program by seeing the notebook ( and it was the time, I didn't know typing ). I searched for every letter and typed. I didn't compile the program, till I finish typing the entire code.
                          
Type-over mode and compile-time errors:
                                   Moreover, the cursor was in 'Type-over' mode. I didn't know how to correct it. If I had left any line, I typed everything once again starting from that line. After I completed typing the entire code, I compiled. I got 25 errors ( Turbo C compiler ). I couldn't trace out the problem and I left it on that day.

Run-time errors:
                                  Later, in school, when I was telling this story, my friend , Vikram, told that it was not 'studio.h' and it's 'stdio.h'. Then, I changed it, some one or two errors were there. After I correct, I ran it. But, the results produced were not as expected. I checked all the conditions. When I asked for help from my cousin ( Mr. Kannan ), he gave me a program and asked me to use it. But then, I was not completely satisfied. I came to know that I had missed '&' in scanf statements. Then, I started learning programming little by little.

                                And later, I learned C++ in 12th. Again C was taught in 1st and 2nd semesters. C++ in depth in 3rd semester. I must thank Mr. K. Saravanan and Mr. S. Lakshmanan for making me understand the coding concepts deeper. I learned Java during my 4th semester on my own and at the end of second year, during my fellowship, I started developing android applications.
                                  

Monday 28 May 2012

நடப்பதெல்லாம் நன்மைக்கே !

ஒரு நாள் ஒரு அரசர் தன் அமைச்சர்களுள் ஒருவரை அழைத்துக்கொண்டு காட்டிற்குச்  சென்றார். அந்த அமைச்சர் எப்பொழுதும் 'நடப்பதெல்லாம் நன்மைக்கே' என்னும் எண்ணம் கொண்டவர். காட்டில் சற்று நேரம் இளைப்பாற அவர்கள் ஒரு மரத்தடியில் அமர்ந்தனர். அரசர் ஒரு மாம்பழத்தை ருசிக்க அதனை அறுக்கும்போது தவறுதலாக கை விரலை அறுத்துக்கொண்டார். அமைச்சர் 'நடப்பதெல்லாம் நன்மைக்கே' என்றார்.

மன்னருக்கு கோவம் வரவே மறுநாள் அந்த அமைச்சரை சிறையிலிட்டு தனியே காட்டிற்குச் சென்றார். அப்போது சில காட்டு மிராண்டிகள் அவரை சிறை பிடித்து கொல்ல முயற்சித்தனர். ஆனால் அவர்கள் உடலில் காயம் உள்ளவர்களை கொல்ல மாட்டார்கள். அரசனின் கையில் விரல் அடியைப் பார்த்தவுடன் அவரை விடுவித்தனர்.

உடனே அரசர் அரண்மனைக்குச் சென்று அமைச்சரை விடுவித்து நடந்ததைக் கூறியதுடன் நன்றியும் கூறினார். மன்னர் மன்னிப்பு கேட்டபொழுது அமைச்சர் 'தாங்கள் என்னை சிறையிலடைத்தடும் நன்மைக்கே' என்றார். எவ்வாறு என்று வினவிய அரசரிடம், தான் வந்திருந்தால் அந்த காட்டு மிராண்டிகள் தன்னை கொன்றிருப்பரகள் என்று விளக்கினார். 

மன்னரும் மட்டற்ற மகிழ்ச்சியுடன் 'நடப்பதெல்லாம் நன்மைக்கே' என உணர்ந்தார்.

Sunday 27 May 2012

Me as a part of power cut

I was developing 'Speaker Recognizer' application for android as my fellowship project at IIIT, Hyderabad. It was the time when power cut was a major problem in Tamil Nadu as well as in Andhra Pradesh. Students working in my guide's ( Dr. Kishore S. Prahallad ) laboratory used to just turn off the monitor and leave every day ( without shutting down the system ). But, I used to shutdown everyday.

Due to some reason, my monitor contents were shaking on every boot ( even after replacing the monitor ). Though it was corrected after restarting several times, it suck nearly one and half hours every day. I was very interested in developing the app and so, I had no other go. I had to turn off the monitor and leave the lab every day.

I felt very bad for being a part of power scarcity.

Android: NullPointerException with findViewById

I was developing an android application for 'Speaker Recognition' at IIIT, Hyderabad under the guidance of Dr. Kishore S. Prahallad as my fellowship project. I was very new to the android development ( approximately one and half weeks ).

I had a scenario where, I had to show a custom toast with differing text when the Name field is empty or the name entered is existing. I wrote a function as follows and called it with the resource ids from R class. The application crashed unexpectedly on running.

    private void notifyError(int id)
    {
    LayoutInflater in = getLayoutInflater() ;
    View layout = in.inflate(R.layout.toast_layout, (ViewGroup) findViewById ( R.id.toast_layout_root ) ) ;
   
    ImageView im = ( ImageView ) findViewById ( R.id.image ) ;
    im.setImageResource(R.drawable.warning) ;
   
    TextView warn = ( TextView ) findViewById ( R.id.message ) ;
    warn.setText ( id ) ;
   
    Toast toast = new Toast ( getApplicationContext() ) ;
    toast.setView(layout) ;
    toast.setGravity(Gravity.CENTER, 0, 0) ;
    toast.setDuration(Toast.LENGTH_SHORT) ;
    toast.show() ;
    }

When I debugged, I found that null is being assigned to the im and warn objects. But, couldn't know what was the problem. I google it for about 3 hours, but of no use. Later on having a closer look, I found out, View.findViewById() is different from Activity.findViewById(). So, I changed the code to:

    ImageView im = ( ImageView ) layout.findViewById ( R.id.image ) ;
    im.setImageResource(R.drawable.warning) ;
   
    TextView warn = ( TextView ) layout.findViewById ( R.id.message ) ;
    warn.setText ( id ) ;

And then, it worked.