Wednesday, December 1, 2010

Life in Air Force Academy(AFA) - Hyderabad

Line Up of Kiran Jet Trainer Aircrafts on Tarmac

It was a fine July morning when I found myself standing at the Secunderabad Railway Station in front of a desk with three people sitting under the banner announcing Reporting for Air Force Academy. Got my name checked and they told me to remember the name of squadron as Brar. Outside found a few guys whom I met at SSB or medicals and was please to know that two other guys of my group from SSB were in same Sqn.
Quite a number of Cadet and some parents were standing there soon we guys boarded the bus, a photographer was clicking the pics of the guys and of course the gals present there, so that later we all could see them and make out how funny we were looking then as compared to now, and as a matter of fact one never fails to find how we people looked so funny and casual when we were still civilians( and it would be the other way round for all the normal civil guys when they notice the difference between us).

Soon enough we reached the gates of Air Force Academy(AFA) Dundigal and it was with a sense of huge pride that I looked at the runway and the gate and a feeling that finally I arrived at a worthy enough place which I deserved. The bus moved inside and the occupants of the bus kept their stares fixed at the various aircraft and missiles on display en-route from Annaram Gate to Flight Cadet's Mess(FCM) aka our home for the next one year.

I remember well that it was lightly drizzling and in my astrological beliefs that was a sign of good beginning. Our stuff got offloaded and we moved to Shamiyana for the attendance. After a long wait, we got our luggage checked. The check were to make sure that we were not in possession of a mobile phone or camera or any eatables !! and other superficial stuffs(even personal medication) like that. All these while the things were being done by the Appointments, who are the Senior Term cadets who takes care of the Cadets while they are in FCM, kind of like School Captain.

After a while we got several items issued and our cabin numbers. Life in college can be easily managed without even seeing a water glass, water bottle, hangers, brooms and all some trifle items but not so here, maintaining a living standard of an Officer requires a lot of polishing of the attitude and this was a small beginning.

As Juniors(the people in white with ugly haircuts)

Once all the luggage was dumped in the cabin and after acquaintance with the neighbors around the rest of the evening and night passed in having a gala time with old friends from SSB and medical. Since by this time any of the Senior Term cadets have not arrived except for the Appointments, there was nobody to check any junior cadets.
Then from day two to the first week were probably the most boring and disgusting days of my life. There were lot of formalities, kit issue, tailor issue, hair cut, medicals and so on and so forth an endless number of things in which we just have to go to one place and keep standing at-ease and just wait till eternity till everyone got finished and then we march of back to Sqn Office. It was like at the end of every day we used to count that in the whole day we have just done 3-4 things and not even got to sit down once or be in our cabin for more than 5 minutes. The first night muster of the Academy was quite an experience of continuously standing in attention till all the counting was done, report compiled, its checked and rechecked that all are present and Duty Instructor came, report is handed over, he again checks and cross checks and finally goes back.
At the end of first week we could feel that our previous lifestyles have been left far behind, every luxury and privileges that we were used to were taken away. No more were we getting time to be alone as an individual, the only time spend alone was either during study hour or while sleeping after lights-out. The clothes we wore became the simplest a white shirt(with collar and cuff button and no tie) and white trouser(no provision as well as need of a belt, as only the size being fit is worn) for the formal places and white PT kit for games and ragda sessions :).  No dhobi, no orderly and any facility of fruit shop, bar etc etc. It would seem like a POW camp but this is how an individual is broken down of his shells of individuality and made in an person who matters only along with his Sqn.


A normal daily routine of junior cadets at the beginning of term used to be like, waking up at between 2-3am depending on the amount of clothes that you have to wash(it is quite difficult to hide any dirt or dust in white clothes) or iron, and then attending a 4am fall-in in which the report never gets compiled and submitted to Sqn Appointment by the allotted time and hence by default all the undergoes a series of push-ups, sit-ups and other doses of early morning exercises. At 5 am there was another fall-in for juniors for daily Drill( that is march past) and we were left sweating from the sqn office just 10 min to 5, to change to drill uniform and report in time. From 5 am after all the junior cadets have came, all the sqns' report compiled and submitted,  then the dreaded round of dress inspection by the appointments and the defaulters caught with dirty clothes, improper ironing and anything major or minor were rounded off to be destined to do some more sweating out in the afternoon and evening in the form of reportings. Then we move on to the Drill Square or Parade ground where Drill Ustads instruct the cadets to perform the parade movements individually and in synch when in a group. Drill is one strenuous exercise, from the outside it appears only few movements are being done but the crispness, speed, timing and intensity of these calculated movements will make you sweat in no time. Anyways its always a treat to the eyes to watch  well executed josh-filled parade movements. We graduate from basic hand drill to parade with rifle in the later part of the training. Left from their we rush back in great hurry, to make good the fall-in time of 0730 with half-an hour to spare for bath, change over uniform and have breakfast. It really amazes now how efficient people become with their time once time becomes precious. In such testing times it helps to have a priority, I for one have highest priority for breakfast in all of this morning chaos. I was willing to take an hour or so of punishment later in the day rather than start the day with empty tummy. Bottom line make your value system and prioritise your task and stick to it. 
At 0800 another part of the day commences in which cadets of different branches go to their respective faculty for studies in their relevant subject. This probably is the most relaxed part of the day with ample opportunities to relax from the tiredness of the early part of the day, some people keep their eyes and/or ears open for the activities going on in the classes but some simply give up on the efforts. By 2 o'clock in the afternoon we leave for FCM again and after having a more or less unhurried lunch, we come back to our rooms, just to hear in time another round of session for accumulated deeds of the morning or anything pending. By the time we get done with this it it again time for PT and so we proceed for the fall-in routine for the same. PT is a toned down activity compared to the same happening all the time in FCM. We come back by around 6 in the evening and after having a round of eats/tea/cold coffee served in mess office, we again barely have 30 min or so to take bath to clean up from the sweaty, soiled condition of us and our clothes and also get our rooms in Cabin-Cupboard inspection standard for the study period starting from 7 o'clock. Study period is an open door time in which you are supposed to be studying in your neat and tidy room dressed up immaculately in whites/muftis simply meaning white full sleeves shirt & white/grey coloured trousers with or without neck tie. Inspection goes around by an Officer or Sqn Appointment to ensure compliance of the same. End of the study period starts with a call for Dinner, and all the cadets assemble in their sqn office and proceed to Dining Hall together. Then after having food or something else depending on your luck, again a mass gathering of the whole cadet lot of all branch and sqn, a night muster takes place in which everyone is counted, accounted and presented on the parade for inspection. After this the everyone is dispersed for a Lights out time of 2200. But the time in between is again a fun filled activity of some more bit of exercises and couple of minutes before the Lights out time we are left to rest our body for the night. 

Coming back to the room, sleep is a something you don't have to wait for and paying no remembrances to all the good, bad and ugly things of the day, we sleep on like a baby with a clear head and tiring limbs, to soldier on for another day and then another day for the whole duration of the junior term. 

So for the uninitiated, as the saying goes though it would seem contradictory, this whole routine of training is mental rather than physical. People say that if you survive the academy for first 22 days you will make it through 22 weeks. 


Wednesday, June 30, 2010

Life in AFA(Air Force Academy ) - pre reporting

After almost 9 month long process of CDS Written Exam, Selection Board at 1 AFSB and Medical Checkup at AFCME , the path to AFA was now clear.

It was just a formality but after the long and patient wait for the merit list of CDSE was over, the result was declared by UPSC. It was a really nice surprise to find my name on the top of the merit list. WOW !!!
So I was off to a good start. But as it happens with all of us everytime, once you have finished something a worry of the future starts to occupy your mind and in my case I started wondering if I could maintain my steam and will I be good enough to be selected for Fighter Stream after Trifurcation in the Academy.

The answer to this lied almost 1 year in future. To ease any worries I started off with a routine of daily morning running and other exercises to get in shape. Now as my bad luck would have it I found out the really hard and painful way that in my circumstances its better to avoid joining a Gym and more doing Dead-Lift without proper care. This caused me to have symptoms of hernia(or so I thought) and my subsequent lingering worries were not settled down till a Medical Examination in the Academy.

I am being so close to realizing a dream of a life time. I am sure life will rise to a different gear once the training start. Training in AFA will bring across several anecdotes and definitely a lot of memories which I will want to remember.

But the disappointing fact is that there is hardly any first person account which one comes across about life of a Flight Cadet in AFA. The purpose of this series will be to fill this gap, so that a lot of dreamers like me can know more about flying training in IAF.

Before I finish this post, I should mention one more incident.
Once I got through medicals, I went to a retired Maj. Gen. who was a faculty in my college, to get his advice on how to do well in Service. He had some gems of experience to recount.
He told me that in Defence Services a person is quite often identified by the company of people he is into. Like if you hang around with geeks you will be labeled as a geek similarly if you hang around with people having questionable incidences to their name, so will people think you to be. And in Service like Indian Airforce the size is not so big and your reputation, both good and bad, travels far and wide.

Another of his suggestion was that the Defence Services are such that they require a certain set of qualities and requirement and the training and subsequent service makes sure that you inculcate those qualities and the things in you which are not desirable gets filtered out. So one should always take care because we as a cadet and later as Officers will be judged all the time for the OLQs.

Tuesday, June 29, 2010

Airforce Medical checkup at AFCME

People clearing AFSB (Airforce Selection Board) are next send to AFCME i.e. Airforce Central Medical Establishment, New Delhi for a detailed medical checkup to certify that they are medically fit to discharge their duties in Indian Air Force. All different categories of candidate for IAF ie Flying Branch, Technical Entry and Ground Duty have the complete checkup at this venue. Apart from this this establishment is also the place where DGCA (Directorate General of Civil Aviation) send civilian pilots to have their medical fitness certificate issued or renewed.

AFCME is situated in the beautiful and very neatly maintained Western Air Command(WAC), Subroto Park which is located near to Dhaula Kuan. Except for Dental checkup , all other test, diagnostics and measurments are done in AFCME itself. For this its has several departments like Pathology(with the lab facilities), ENT, Radiology, Eyes, Ultrasound, Anthropology, Cardiac etc.

For the Airforce candidates the process is usually 4 day long. On our first day of arrival the business of the day started at 8:00 am with us filling a couple of forms and other necessary formalities. As usual these form filling take a lot of time and it was almost 11am by the time we were done.
Now the funny thing was that we were specifically told to come empty stomach for the tests otherwise it will take a day more. So there we were all fasting on empty stomach. and it turns out that now a days at AFCME there are no blood test done on first day so no need of the fasting(which b.t.w. sort of triggered a sinus pain in my eye, that too during the medical. what an irony !!!).
After the formalities we were send for the dental checkup which is done at a separate premise. In the dental clinic there were quite a few patients waiting for the doctors, so it took us around 3 hour time for the dental checkup to be done. Dental is usually straight forward affair and unless you have a decaying stuff up your jaws , its a clear affair. Though it is advised that you get teeth scaling done and take care of the decays or caries. In our group two guys were send to see doctor to get their nicotine marks removed.Since it became quite late so this was the only thing that was done on the first day.
I found that in almost all department and all the doctors were hard pressed with the load of the candidates, the civilian pilots and the patients. Its really a tough job for them to keep on doing their job without any mistakes or omissions.

Our lodging was in the Officers Mess and it was so tiring and hot day after getting the meal at 3 pm that for next three hours we slept deeply in the cozy dorms.

The next day again we reported at 7:30 am empty stomach and then our Chest measurement and Height and Weight measurements were taken. There is a height-weight-age chart for the candidates and its is strongly advised to get your tummy measure up to the numbers, Though the authorities give a lot of relaxation on these count. After this we were send to the pathology lab for Blood and Urine Tests. Next on card was the Ultrasound test in which abdomen, liver etc were checked if these parts were normal and to check there are no abnormal things like kidney stones and abnormal size of internal organs. Next we had Radiology in which around 5-6 X-Rays were taken of chest, Spine, Skull etc. Some of the people who had a large angle in the bones of the elbow had elbow X-ray done to determine that angle.After this we quickly had a couple of test one after another like ECG, Anthropological measurement(sitting height, leg length, thigh length and ENT.
For Ear they check for ear wax after that they apply a varying pressure to the ear and the machine generate a plot, it seemed like this test checks how the ear drum behaves in changing pressure. Then the Audio-metric test was done in which there is a headphone through which a few very faint beeps of different frequencies are emitted first in the left ear then in the right, on hearing each beep you have to press the button.The rest of the test of nose is basically one in which the doctor inserts a thong in your nose to check for DNS.
The last thing of the day was a basic test of the eyes in which we were to read a chart about 6mtrs away, a book of color blindness. After this we wore a setup with possibly a polarized lens and a light source was shined which caused a vertical line and a dot to appear.

The next day started with the detail checkup of eyes.Again this time the Medical Officer one by one made us read the Alphabet chart and the color blindness book.Next our eyes were dilated and something was checked by the doctor.
The results of ECG had come and in some cases there were doubts so two extra test 2D Color Doppler ECG and TMT or stress test was performed. In TMT I had to run for 15 minutes on a treadmill while the ECG machine was taking the reading continuously. The 2D Color Doppler ECG was similar to Ultrasound but only it was being done for Heart. Last but not the least we had surgical checkup in which different things like piles,hernia, flat foot , knocked knees etc are checked. Well this test requires you to divest of your clothes, it would seem funny , but actually this all feeling vanishes as soon as you are being checked.

So since we were a bit late our conference was scheduled for the next day. All the files of the candidates were compiled, completed and all the test results were included in the dossier.At last when all the files were completed , we were sent to the President of AFCME, who called us one by one and declared the results which was either you are medically fit to fly or whatever problem was found it was told.

In our group some of the problem which caused them to be declared TR(temporary unfit) were fracture in spine, anemia, too much angle in elbow, eyes sight problem. Since in every case of TR you are given an opportunity to appear before an Appeal Board. In this case you have to submit application for Appeal to Air HQ and then in a week or so you get the date to appear for the Appeal Board in Army R& R Hospital.

So once I was done with the Medical Board, now all is done for joining AFA.

Since lot of queries have been coming regarding individual medical conditions and suitability of these for IAF medical selection, but I am not a medical professional hence there will not much guidance I will be able to provide on the same.
However as a reference some of the links that you may go through to clarify some of your doubts are mentioned below.

General Physical Standards

Additional Medical Standards for Flying Branch 

A detailed list of probably all the applicable medical standards.

Friday, April 30, 2010

PWM generation in BeagleBoard

My primary interest to make a robot centred around BeagleBoard is incomplete without generating PWMs to control DC motors and Servos. Since Beagleboard has all what it takes to make a robot, I am not going to be bothered to have a microcontroller to aid Beagleboard.

My requirement is like this - say an image processing algorithm is running on Beagleboard, and at end of every iteration I want to update the speed of motors by changing the PWM values. In the meantime when the Vision algorithm is running, the board should keep on generating the PWM until it's value is changed.

It started with searching the community for info and this post is quite helpful. this one also is quite helpful. When I first tried all sort of permutations and combinations according to these information, it just didn't work. The file in which we are supposed to write the values like direction, value would give no write excess error. This problem was due to drivers not loaded i.e. this problem got solved when we compiled a new kernel with drivers of TPS320* which handles these IO functionalities.

Now the basic checks like making a pin high or low starts to work. To make a code to suits the above requirement, we went ahead with multi-threading. one thing to just remind here is that, in Linux these port operations are done through writing and reading appropriate files.

So here are the two files new_main.c and waveform.c


#include < stdio.h >
#include < string.h >
#include < stdlib.h >
#include < pthread.h >
#include < time.h >
#include < fcntl.h >
#include < sys types.h="" >
#include < sys stat.h="" >

time_info pwm_times;
time_info pwm_times2;

int main()
    int i=0,j,k,l;

    pthread_t threadid;
    pthread_t threadid2;   




          // Your main code runs here

           // Your code ends here

           // Update values of PWM


In the above code, in new_code.c the main algorithm will be running in place of the three nested for loops.
We have created two threads one for each pwm, and created a structure having parameters time_h and time_l denoting high time and low time. Whenever we want to change the value of PWM we change the value of these two parameters.

Once each iteration of the algorithm completes, we change the value of time_h and time_l for both the PWMs.


#include < stdio.h >
#include < pthread.h >
#include < time.h >
#include < fcntl.h >
#include < sys/types.h >
#include < sys/stat.h >

typedef struct
    long int time_h;
    long int time_l;

void *pwm(void* pwm_times)
    FILE *fs;
    int i=0;
    char ch;
    struct timespec pwm_delay;   
    time_info *pwm_ptr=(time_info*)pwm_times;


void *pwm2(void* pwm_times2)
    FILE *fs;
    int i=0;
    char ch;
    struct timespec pwm_delay;   
    time_info *pwm_ptr=(time_info*)pwm_times2;


in waveform.c we perform the toggling of pin ON-OFF manually in the code by writing to the file named value. [Beware that before even executing the program you have to do some initialisation manually which have not been done in code, these are mentioned at the end]

Since these are multithreaded files the compilation is doen by
gcc new_main.c -lpthread

Initialisation needed Before Executing
You need to do the following things:-
1. Create directory for your IO pin/s
2. Set its direction (as output in our case)

For 1st go to the directory /sys/class/gpio . In here issue the command
echo "168" > export

this will create the directory gpio168, giving you access to GPIO168 which is pin number 24, according to RevC3. Similarly do the same for GPIO183 which is pin number 23.

Now for step 2, go to the directory gpio168 and issue command
echo "out" > direction

this declares the GPIO168 as output pin.
Do the same with GPIO183.

Now your pin no 23 and 24 are ready to generate the PWM according to the code. The waveform that you should get is dutycycle changing from 50% to 100% in one pin and from 50% to 0% in other pin.

Now once the PWM are up, we need an interfacing circuit to connect there 1.8V waveform to motor drivers like L293D. So here we can use Optoisolator like MCT2 etc.

Obviously there might be other better methods to use the in-built PWM functionality, but I am still not conversant with them.

This Post possibly will be the last post on Beagleboard and related Tech. topics, since a different line of work awaits me.

Tuesday, March 23, 2010

1 AFSB Dehradun

Group Picture - Candidate Mess (1AFSB Dehradun)

A lot of children dream of flying a fighter jet, its just that only a handful set out to achieve this goal. And in this pursuit you have to encounter Indian Air Force Service Selection Boards(AFSB).

I got my chance to undo my failure in NDA five years back at 4AFSB Varanasi. I had to attend AFSB for CDSE at 1AFSB Dehradun. This post just relays my views with a lot of speculations, what works for one doesn't translate for another.

Just when you move from Haridwar towards Dehradun on train a wind of cold and rich air hits you in the face, the quietness of the forest trees of the hills just appears like a wonder to person accustomed to the noise of the city crowd. Soon the fertile fields carved in the lap of hills with all sort of crop growing comes up on the landscape. All this beauty and serenity of the place fills you up with an energy and hope.

We reported at the designated place outside Railway Station , and I could see around 100 people. The Air Force bus took us to the board. After the OIC-Call up  addressed the candidates , we were led into to fill some forms, after that the documents were verified and chest numbers distributed. Since some people had cleared PABT/INSB we were led off to Candidates Mess while the freshers were send off to testing. In the meantime we guys sat in the Sun and chatted. One among us was an Airman and he had a lot of tales to tell about the life of an airmen. When the other guys returned, then we had our Lunch and all the people were assigned rooms. We retired for the day since the Screening Test were due next day.
During our chat in the afternoon, I was filled with a bit apprehension about clearing the screening. To me screening appeared just normal, but a lot of talk by the guys like about half of the people to be screened out sort of made me a bit wary of my chances.

Next day lot of guys waked up real early and then wondered what to do till the breakfast is served at 6:00 am !! In the testing first we had OIR(Officers Intelligence Rating) tests, which are a bunch of same booklets since 1970. The test is pretty simple with Verbal and Non-Verbal Questions. It went well and then we were send back to candidates mess to wait for PP and DT(Picture Perception and Description Test) to start.
We were made a group of 10 people and the picture shown to us was a Big smoke in the background with a poor looking man standing and a women and man crouching in the fields. We wrote our stories and then were led to a small room for the GD on it. Soon 3 evaluators came and asked us to narrate our stories one by one and then let the group discuss and come to a conclusion. While the individual narration was going on, I tried to scribble down main points from all stories, hoping it would help in summation. The point I noticed in GD was that obviously everyone tries to say his stuff, but the guy who can direct the discussion of the group by saying like " Lets first decide the age and mood of characters", shows the skills of holding the group together. So try to put forward the points which acts as sub topics of discussion, so that the group can move along these lines, like "Lets first decide the age and mood of characters", "Now what caused the smoke or Fire", "What is the response of the Hero", " What qualities did the hero show by his action", these kind of guidance to the group will definitely be a good performance from you.

We returned back and waited for the results. Soon our DSO(Duty Selection Officer) came and started calling names of people screened in. I knew they will call in DOB order with freshers first and then repeaters, but the wait and anticipation was a bit tough. Finally around half were screened out and we were left with 47 people for the next 3 days. 

There was a feeling that we could have the Psych tests on the same day and it turned out to be true. Personally I did not like that because I sort of wanted to have a preparation of Self-Appraisal before I go through it, but now I had no choice.
Just after lunch we were led into the projection room to start with PPDT, WAT, SRT and Self-Appraisal tests. It seemed that the Board had just converted to a automated Software for these tests, but the people were not quite conversant with the usage of the whole system, so we got quite some time between different pictures to write a story.
In PPDT there were 12 pictures like two friends sitting on a Mango tree, a boy opening and Almirah, a boy in in a boat in middle of storm in open sea, a boy siting in a library, a boy following a dark figure in the street etc and the last one was blank. I had not planned this before but as soon as the first picture was shown I got an idea and almost all the stories that I wrote were really me. I just put myself into the situation and wrote the story. Like the friends on Mango tree - one friend asks the other one not to steal and not to injure himself by jumping , the second one - small boy find bad things in his brothers Almirah and stop his bad habits, third one - a boy set out to sail around the world and succeeds and so on. The basic idea being any picture whatever it may be should not reflect a negative idea.
WAT as such is a bit hectic and it is recommend to do a practice of it to make sure you can write fast enough and legibly at the same time. The rule of WAT is that each sentence should reflect your idea about the word not a descriptive sentence, so that the psychologist can understand your personality.
In SRT, I had read somewhere that for any situation who have three options - attack the problem, withdraw form the situation and last one compromise. Again answer behaving like you are a good helping citizen. Going good till it is required and then minding your own  business.
Self-Appraisal is the part in which you write about yourself from the view of your friend, parents, teachers and your own view, what would you like to improve in yourself and what are your aim in life.

Maybe doing too much preparation of the last component can lead to a divide between the conclusion about your personality derived by the psychologist from the first three sections and what you are telling about yourself from the last section. Just  have in mind what the above persons really think about you and don't overdo this by adding a lot of bogus things but a few negative traits could easily be skipped.

We were quite tired till the time this whole thing got over and it was also late, so everybody just roamed around here and there or played the indoor games , some watched TV etc. Some time later the schedule for the next day was put and I was a quite happy to find that I had nothing the next day, meaning the whole day off. Some people had Interview starting others had Group tasks lined up.
Before our Dinner started the DSO again turned up and we were handed two copies of PIQ(Personal Information Questionnaire)  to be filled. The form is basically about your Education, family , Hobbies, Achievements, Previous SSB attempts etc. It goes without saying that honest is the first thing that you should keep in mind while filling the PIQ, because one copy of it goes to Interviewing Officer(IO) and other copy goes to maybe Psychologist.
After dinner we watched some TV and slept a bit late and also waked up late.

During the Call-In the next morning I got confused seeing people in full Formal Dress for the interview, ranging from Full Sleeves Shirt, with a Matching trouser and Laced Shoes and thrown on top a good looking tie with a shining belt around the waist. Now to be frank I sort of half expected that but way in no way prepared for this. There I was with one formal Trouser and nothing else from the above list. My problems increased when we were told that people who had no task could have interview if the current one got over early. I tried to Book Out as soon as possible but that did not happen and finally the time just passed by and I was out of danger for the day.
As soon as the testing for the day was over we booked out for the first time and went out to explore the town. The first stop was the Tibetan Buddhist Temple , which is at a walking distance from AFSB. The temple was really good, the garden surrounding on all sides was nicely laid out, inside the temple all the possible wall spaces were covered with painting from the Buddhist Mythology, just as we had entered there were preperation being made for the evening prayers. The prayers are a spectacle in themself. The low humming voice of head priest , something like pronouncing a single syllabi creates a environment of meditation, then periodically the drums type instruments are hit softly producing a sound further reinforcing the sacredness of the rituals.  It was really a place to see and the realization that the ancient tradition of Tibetan Buddhist is continuing unhindered and peacefully in India , thousands of miles away from the native place of The Forbidden Palace - Lhasa, just says how great our Nation is after all.
Sometime soon I started off to Paltan Market in search to buy some Formal Dress and Shoes, for the intending Interview. It was then I noticed that in Dehradun the ratio of females seems much higher as compared to any other metro, city or town I had been to. In this city it being the state capital there are many Colleges and a lot of boys and girls from several places come here to study and this contribute a lot to the young crowd in all the places in Dehradun.

After coming back we looked up our schedule for the next day and I had the bulk of activities, starting with Interview at 8:00 am , then Group Tasks from 10:30am. From the other guys it was found that one of the Interview was basically about PIQ form that we had  was asking questions like you your friends, your friends view about you, etc. Though I should have prepared answers for these but I didn't. After dinner all of the people in our room got together for a kind of mock GD. It was more fun that discussion and we had regular uncontrollable bouts of laughter thrown in now and then.  Our Airmen guy had major roles in the whole thing and one of his incident was that in any discussion that he had nothing to say, he would say "Gentlemen, I think this is because of the lack of Education". To maintained sanity of discussion we asked him not to say that in the GD or else we would all be rolling in laughter in front of GTO. 

The next morning I got ready to face the Interview and with a borrowed Tie and Shoes dressed up smartly and raring to go. At 7:40am the peon called my Chest Number, and led me to the office of IO.  Now the schedule time was 8am but fortunately I was ready before the call came. On reaching the office , I was asked to sit down outside on a chair and my documents including resume were sent inside. A minute later I was called and we exchanged pleasantries and then once I was comfortable, the IO started asking questions. The very first one was a rapid fire. I was asked about my education, what all subject I studied, which one I liked most, which one I disliked most , my favorite professor, one professor which I did not like, what were my extracurricular activities etc. I tried remembering all these but while answering I forgot a few. Once I had stopped, the IO asked is that all and then repeated the questions that I had missed. Then he asked about my friends, what do they have opinion about me, what do they do , how do I spend my free time on a normal day , on a holiday etc.
Somehow though I am not convinced about the effectiveness of this method, It seems that when you are asked about opinion of other people, what you say reflect your own personality.
Later he asked my views on Telangana issue and the Women Reservation bill. With a little more chit-chat, he wrapped up the Interview and send we off warmly. The whole thing lasted around 40 minutes and I was quite satisfied overall.

After this we kitted up in PT overalls for the GT of the day.First task at hand was Group Discussion and Military Planning.
In first GD, the GTO(Group Task Officer) gave us two topics - India's Participation in International Summit - useful exercise of waste of exchequer money and The breaking Social fabric of Indian Families. We agreed on the first topic and the discussion started. My group was quite knowledgeable so points kept flowing, I was also active in the contribution and since all were give arguments how the participation was a good thing, to explore the other side, I presented some counter points. I feel that usually in GDs there are always some angel or some points which are not covered and this gives a good opportunity to make your mark.
The second GD was on Riots because of Anti-social elements, judiciary failure or (something ....), the GD went on as the previous one, just when the discussion was going on as usual, our Airmen guy popped up and said "Gentlemen , I think this is because of lack of education". There was a silence for a second, I looked around to see any signs of smiles breaking out, but fortunately people holded on and a tragedy was averted :).
Next came Military Planning , in which we were given a sand model of some villages and a situation to avert like, a hurt tractor driver, prevent a robbery, stop a train and get back to hostel by time.  Everybody wrote down their solution to the problem and then we were given the 10 minutes to discuss and come up with a common solution.
The discussion started I immediately knew that other people had nice ideas so rather then pitching up my own ideas I tried to moderate by first pointing all the situations to solve, how to solve each one of them and how many men to depute for each task. Apparently finally at the end, some people were of the view that the Military Planning was ok, others said that maybe everybody got exited because of me, well so this test also ended and we were led to the PGT (Progressive Group Task). Since it was quite late that day we were only able to finish this.
Before the PGT, GTO gave us a piece of advice that whatever ideas, you come up with go through them completely and don't waste time in new idea.  The general rule of engagements, I had got from the books is that just keep in the front, be active, volunteer for anything, if you are not getting the ideas, then support the ideas of others.
In the PGT, when we started it is usually the general perception that the guy who first gets hold of the Plank or balli will put them together and get up on the front in the obstacles, but I noticed that the guy in our group who was in the forefront was not really implementing his ideas, or proposing one, he was just doing what other guys were deciding, so that kind of thing does not really help. One guy was always in the end , just not happy that the whole group was just doing what everyone was wishing.  I was not really getting all the ideas,so I just kept going along the group, sometime in front , sometime at the back and continuously doing something or supporting others and so on.
Accidentally at the end of very first PGT one of our guy jumped and his foot landed at an angle and it swelled pretty badly so he was out for the rest of PGTs. The guy was immediately send away in Ambulance for Medical  Care.
We people somehow finished the PGT and were left off for the day.

In our Batch we had a lot of guys from Punjab, these guys were a real fun, though most of the time we didn't understand the jokes in Punjabi , but still it was a great fun in the company of these guys. When people talk a lot of speculations and experiences of the guys who have attended earlier  are shared. Like the Interview of one of the guy was taken by the President of the selection board itself, it turns out that maybe the guy who scored really good in the OIR, is interviewed by the President. We have had several anecdotes like someone told that there was one guy, who in his Group Task was given to dispose a mock bomb, since the task was not complete and the time was about to get over, this guy say to the group "Gentleman, everybody like down , the bomb is about to explode" , well that definitely shows presence of mind and taking good initiative. We got to know that the officers who do really well in there SSBs only get a chance to become GTOs or IO later in their service. Since one of our fella had got injured , we felt that the people who still hold out and do their tasks have a much higher chance of getting Recommended from the GTO. Our guy showed courage and managed to do his Command Task and some Individual Obstacles and that got him through.Though it is believed that the three evaluators GTO, Interviewer and Psychologists don't talk about the candidates before conference, but we found out that to the contrary when our GTO asked one of the guy, why did he ask a particular question to the Interviewing Officer !!

The next day we were to complete with our Group Task ie Command Tasks, Lecturate, Individual Obstacles and Final Group Task.
We started off with Command Tasks. Before my turn cam I was called as helper by two guys, this gave me some idea about the tricks of doing the tasks, and also how the GTO evaluates. One of the speculation by guys was that people who get hard Command Task are being evaluated closely by the GTO and have a good chance. In the command task, the GTO puts a constraint and keeps of changing the situation like the rope is not there or the support is given or the balli is broken etc. The trick is that just proceed with what you have got, just standing frozen does not give a good impression to the GTO. And it is definitely a good idea if you utilize your helper as most as you can, but I have seen people doing quite a lot of work in their own command task. A grave mistakes I committed was that I was helping a lot more that the guy was asking me to, and on this the GTO cautioned me. In my own Command task, I was called up and the GTO asked a few questions about me and then the task started. I started off well with giving clear instructions to my helpers, then the GTO cautioned me that I was breaking a lot of rules(maybe he wanted me to come under stress) and then he also scolded me on one of the approach I was taking, I went on the next approach without any pressure or getting worried, with a little hit and trial I achieved the goal and that was the end of it.

The next task was Lecturate, we each were given a time of 3 minutes to prepare our thoughts on a topic and the speak for 3 minutes. For me it did not really go off well. I deduced that to give a good Lecturate, just think a brief introduction of the topic, 5 pro points and 5 cons point. Then the most important thing, whatever you say , speak short sentences so that you put your point across well rather than trying to speak a lot and ending up speaking quickly which nobody end up understanding.
After this came the 10 Individual obstacles, my strategy was start with the toughest and with maximum marks , so I started off with Rope climbing , tiger jump, burma bridge, monkey crawl and so on complete 7 obstacles worth 44 points. Later heard some guys did all 10 obstacles in the 3 minutes , so that's also achievable.
But after the Individual Obstacles everybody was dead tired with air pumped out of their lungs still the GTO called us up for the Final Group Task(FGT), since none of us was in a condition to talk a lot , we progressed mechanically with what we were supposed to do and the task was completed with everybodys satisfaction.

With this our SSB testing got over, except for the Conference the next day. We booked out and decided to visit a "Tankeshawar Temple". In the evening when we returned back our DSO cautioned us to take good rest for tomorrow and be ready for the Conference. His advice was to maintain a sense of mind and give proper answer to the questions of the Board.

The next day we were once again dressed up in formal clothes and ready to face the music :).
All of were made to sit in the conference room and waited till our turn came to be presented before the Board consisting of The Board President, all the GTOs, IOs, 2 or 3 psychologists, in total about 8-9 people. Slowly one by one the candidates were called to face the board. All of us knew that if you are not asked anything in general and just pleasantries are exchanged then either you are in or out, but in case you are asked questions like SRTs or some other dimensions, then you are a border-case, with these questions, the Board want to get a clear idea about some of the doubtful areas of your personality. 

Finally after due wait, my turn came. Somehow wearing Formal Dress bring out the smart person in me and I was quite confident with a bit of pride that I will be ok. I went into the room and wished the Board a Good Morning and stood still. It was just a mere second after which the President asked me to take my chair, but that small time difference does show your etiquette. Surprisingly I was not able to just have a glance at all the members of the board. All I could see in my Tunnel vision was the President and the OIC. Once seated the OIC immediately came straight to the point and started asking a few personal questions like give an instance when in Leadership role, you made decisions contrary to other people ideas ...., name some of your good friends, why did you not play lot of sports and so on. Then I was asked about my group, was the Group Task difficult or the Group was difficult etc. I once remember that when I had answered one such question, the OIC looked at my GTO, maybe I had given a proper reply to a question about which my GTO had doubts about me. My conference ended and I came out without too much hope or any letdown.

We all sat together with the guys waiting for the Conference to end and the results to come. Some time later the DSO came with a piece of paper. We Falled In and then after a bit of usual talk, the DSO announced the names of people who passed in PABT/INB. Most of the guys had cleared but still a few didn't. Then finally the Big Moment arrived and he started announcing the Chest No of people recommended. It is funny to remember that I was blank minded till the time my Chest No was called. I walked to join the people who had been Recommended. Though I had quite expected it, that feeling to pump in the air, feeling overjoyed did not happen to me. I was very normal and surprised about being this way also. Maybe somewhere at the back of my mind the fear of getting struck in Medical was present. I didn't wanted any premature celebration. Then when the DSO went back, we congratulated each other and our mates who didn't make it. In total 16 Guys were recommended that day :), the people ranging from freshers to one guys in his 12th attempt.

We picked up our belongings and moved to fills documentations. I knew it would take a long time, but this long ? We started the process at around 2:30 pm and were finally done at 8:30 pm !!! In between this we had to fill a few dozen forms and declarations.

Finally before we were led off, the OIC addressed all the candidates. I was feeling a bit uncomfortable why I was not very excited, but it was soon to go away, when the OIC said "Take care of yourself, your life is more valuable to the Nation now, now you are almost a National Property !!! " that statement made my day :) :) :).

Before being led off to the Bus Stand, we were handed over a gift of a T-Shirt with Su-30MKI poster on it :D :D and dinner packets to eat.

This is how this memorable event ended. Just wishing to clear Medical Examination and be on my way to Airforce Academy(AFA), which is incidentally in Hyderabad itself.

Monday, March 22, 2010

Internet over USB-OTG on BeagleBoard using NAT

 Firefox working in BeagleBoard

NAT stands for Network Address Translation. This concept allows to route a packet with changed address header so that the packet can be transported from one network to another.

Here is how it works for BeagleBoard.

Power up the BeagleBoard and connect it to your host computer using USART using minicom.
once you have logged in, enable g_ether.ko driver by

# cd /lib/modules/2.6.29-omap1/kernel/drivers/usb/gadget/
# insmod g_ether.ko

Now the driver is enabled. Now connect the USB-OTG cable between beagleboard and host computer. Configure the connection as follows:-

# ifconfig usb0 netmask
# route add default gw
# vi /etc/resolv.conf
    Add hostIP as nameserver, your hostIP will be as explained later
    -> nameserver

# export http_proxy=""

the last step set the variable to our local proxy and port number , change this according to the connection on your host machine.

On the Host computer:-

# ifconfig usb0 netmask
# sudo vi /etc/sysctl.conf
   uncomment the line   net.ipv4.ip_forward=1 , to enable forwarding of packets.
# sudo sysctl -p
# sudo cat /proc/sys/net/ipv4/ip_forward
   to check that the change has been made and routing is enabled
# sudo iptables --table nat --append POSTROUTING --out-interface eth0 -j  MASQUERADE
# sudo iptables --append FORWARD --in-interface usb0 -j ACCEPT

This will establish the connection of beagleboard to the internet. Test the connection using ping command.

Now you can realise the power of opkg and install the packages, driver directly from the repositories

Monday, January 25, 2010

VNC, Self-Powered USB Hub & Squid(?) for BeagleBoard

Once the Ethernet over USB between your System and BeagleBoard is established , it is time to see the BeagleBoard Desktop first hand.

Download and install some VNC utility(Virtual Network Client) TigerVNC in my case.

Launch VNC , and in the window in which it asks for address for VNC Server , enter the IP of BeagleBoard i.e. in our case  .

Since I still don't have a Powered USB Hub in place for hooking up keyboard or mouse, after connecting the BeagleBoard through VNC, I connect the DVI-D connector to the LCD Monitor.

This arrangement is as good as it gets :)

The only bottom side is that the connection hangs up once we try to transfer a large file.

ScreenShot of VNC on Fedora Desktop

My USB Hub Attempts

Wanting to connect keyboard and mouse to BeagleBoard, the first attempts to directly plug USB Optical Mouse didn't even power up the LED on the bottom of mouse, signifying the insufficient power being supplied to the Mouse.
To supply enough juice to the Mouse, I made a small PCB , in which the USB connection coming from the BeagleBoard is connected to USB wires of the device as follows:-

USB from BeagleBoard          USB of Device               Status of the connection

GND                                     GND                               Connected
D+                                        D+                                 Connected
D-                                          D-                                  Connected
Vcc                                       Vcc                                 Not Connected

[ The Vcc of the device is powered through external 5V, and the Vcc from BeagleBoard is left unconnected] 

But unfortunately this also does not seems to produce any results apart from displaying the message

Device Not enumerated

I can only speculate here that maybe, the high Speed USB Host is not enumerating the Low Speed USB Device ?

Using Squid to provide internet Connectivity to BeagleBoard(?)

Once the connection to Laptop through USB is established, I reasoned that if I could configure my Laptop as a proxy server for the BeagleBoard , then it would be possible to provide Internet connection to BeagleBoard through my Laptop. Thinking on these lines , I found Squid Proxy Server to be a tools to do just that. After investing a lot of time making change in the config file of Squid , Now it seems that Squid can't possibly do this sort of networking , since the Laptop and BeagleBoard are on a seperate network.
Sigh !!Sigh !!  , I do have to purchase a USB dongle .


Ethernet over USB-OTG for BeagleBoard

Once Beagleboard is up and running with Angstrom OS and a serial port connectivity , we next turn to get ethernet connectivity over the USB OTG cable.

You will need a USB Type-A to USB Type-A mini connector for this purpose.

Configuring in the BeagleBoard
After you have logged in as root, go to directory /lib/modules/2.6.29-omap1/kernel/drivers/usb/gadget .
In this you will find a driver named g_ether.ko. At this point of time issue command

root@beagleboard:/lib/modules/2.6.29-omap1/kernel/drivers/usb/gadget# lsmod
Module Size Used by
g_ether 29376 0
ircomm_tty 36148 0
ircomm 21292 1 ircomm_tty
irda 186816 2 ircomm_tty,ircomm
ipv6 275228 12

This will tell you the driver currently loaded. If you don't find the module g_ether in the above output, then you need to load this driver to enable Ethernet over USB OTG.

root@beagleboard:/lib/modules/2.6.29-omap1/kernel/drivers/usb/gadget# insmod g_ether.ko
[ 218.496032] g_ether gadget: using random self ethernet address
[ 218.503570] g_ether gadget: using random host ethernet address
[ 218.534881] usb0: MAC 26:25:a1:4e:cf:55
[ 218.565948] ADDRCONF(NETDEV_UP): usb0: link is not ready
[ 218.572082] usb0: HOST MAC ae:c2:3b:52:78:5a
[ 218.587066] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[ 218.627716] g_ether gadget: g_ether ready
[ 218.632476] musb_hdrc musb_hdrc: MUSB HDRC host driver
[ 218.654815] musb_hdrc musb_hdrc: new USB bus registered, assigned bus number 2
[ 218.694671] usb usb2: configuration #1 chosen from 1 choice
[ 218.722137] hub 2-0:1.0: USB hub found
[ 218.739471] hub 2-0:1.0: 1 port detected

This will load the driver.

Now go back to root and configure the Ethernet connection of your BeagleBoard.
In the BeagleBoard Validation site it is adviced that the IP address be set to and netmask be set to , we do this here

root@beagleboard:/# ifconfig netmask

Configuring Your System

[root@shubham shubham]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:19:B9:5F:09:A2
inet addr: Bcast: Mask:
inet6 addr: fe80::219:b9ff:fe5f:9a2/64 Scope:Link
RX packets:113982 errors:0 dropped:0 overruns:0 frame:0
TX packets:28358 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:35000144 (33.3 MiB) TX bytes:5238712 (4.9 MiB)

lo Link encap:Local Loopback
inet addr: Mask:
inet6 addr: ::1/128 Scope:Host
RX packets:24 errors:0 dropped:0 overruns:0 frame:0
TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1520 (1.4 KiB) TX bytes:1520 (1.4 KiB)

wlan0 Link encap:Ethernet HWaddr 00:19:D2:BC:26:38
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

wmaster0 Link encap:UNSPEC HWaddr 00-19-D2-BC-26-38-A1-D1-00-00-00-00-00-00-00-00
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

This will show you the network devices active, here we don't see a USB0(which will represent the connection to BeagleBoard )
Once you have configured the connection in BeagleBoard , then issue 'ifconfig' command , you will find one more device

usb0 Link encap:Ethernet HWaddr 4A:00:09:5E:78:15
inet6 addr: fe80::4800:9ff:fe5e:7815/64 Scope:Link
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2056 (2.0 KiB) TX bytes:670 (670.0 b)

Now configure this device by the command

[root@shubham shubham]# ifconfig usb0 netmask

This will lead to an Ethernet over USB OTG being established, to test your connection ping any of the devices.

[root@shubham shubham]# ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=0.536 ms
64 bytes from icmp_seq=2 ttl=64 time=0.482 ms
64 bytes from icmp_seq=3 ttl=64 time=0.479 ms
64 bytes from icmp_seq=4 ttl=64 time=0.354 ms
64 bytes from icmp_seq=5 ttl=64 time=0.355 ms
--- ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4882ms
rtt min/avg/max/mdev = 0.354/0.441/0.536/0.074 ms

This checks that you connection is good.
You can send file to-and-fro BeagleBoard – your System using ssh command like :

[root@shubham shubham]# ssh test.txt root@


Serial Port Setup in BeagleBoard

[Italics shows the actual commands]

After the Memory Card has been formatted and Angstrom OS files loaded , it is time to configure the Serial Port connection to your Laptop.

We need Serial-to-USB Adapter like the one using PL-2303 from Prolific Inc. In latest Linux distribution the driver of PL-2303 is provided and is loaded automatically on detecting the device.
Also we need a 10 pin Flat Cable to connect to 10 pin box Serial connector on the BeagleBoard.
To connect the 10 pin Flat Cable to Serial-USB Adapter we made a small PCB.

The connection are as follows -
BeagleBoard                     Serial Port Connector
Pin No – 2(RxD)                Pin No - 3(TxD)
Pin No – 3 (TxD)               Pin No - 2(RxD)
Pin No – 5(Gnd)                Pin No - 5(Gnd)

The PCB for connecting 10-pin connector to DB9 and the powered USB device arrangement which didn't work :(

After connecting the USB connector of Serial-USB Adapter in your Laptop , it is time to configure the virtual serial port.

[root@shubham shubham]# dmesg
pl2303 ttyUSB1: pl2303 converter now disconnected from ttyUSB1

This will give a long output and among them try to find the line which has the mention of PL2303. This tells us that the name of serial device is ttyUSB1 .

Use a serial port utility like Minicom (you can install that on Fedora system using Yum )
Open the Serial Port Setup

[root@shubham shubham]# minicom -s

| Filenames and paths    |
| File transfer protocols |
| Serial port setup          |
| Modem and dialing      |
| Screen and keyboard   |
| Save setup as dfl          |
| Save setup as..             |
| Exit                               |
| Exit from Minicom       |

Select option Serial Port Setup by using cursor.

Change the name of Serial port device to represent /dev/ttyUSB1,which was found using dmesg command. Make the other setting of Baud Rate, number of bits, one error bit by setting it to 115200 8N1

| A - Serial Device : /dev/ttyUSB1                      |
| B - Lockfile Location : /var/lock                      |
| C - Callin Program :                                         |
| D - Callout Program :                                       |
| E - Bps/Par/Bits : 115200 8N1                         |
| F - Hardware Flow Control : No                     |
| G - Software Flow Control : No                       |
|                                                                           |
| Change which setting?                                     |

Save these settings and exit.
Now Launch the Minicom using

[root@shubham shubham]# minicom

Serial Connection to BeagleBoard

Now power up the BeagleBoard and you will see the Booting up:-

Notes :-

  1. We observed that USB OTG does not always supply sufficient power so if the booting fails again and again . Try using DC power using Barrel Connector. But make sure it is exactly 5V.

  2. An indication of BeagleBoard being booted properly is that LEDs USR0 and USR1 keeps glowing intermittently.


Thursday, January 14, 2010

Installation - Fedora 11, ffmpeg, OpenCV

Before starting with Computer Vision , I had to install OpenCV on my Laptop.
I decided to reformat my whole dual-boot OS , installing Vista after backing up my data was a straight deal. Then I installed Fedora - 11 on a different partition.
The slightly tricky thing in the otherwise simple Fedora installation is getting yum working. In my case I was able to connect to internet directly but on running
# yum list all
I continuously got error like
# [Errno 4] IOError : < urlopen error (111, 'Connection refused') >

after looking around a bit on forums and making changes in these files /etc/yum.repos.d/fedora.repo and /etc/yum.repos.d/fedora-updates.repo  as given here 
as well as changing the /etc/hosts file to include the extra mirror sites.
In my case I added the mirror site of IIT-K as it being the nearby server.
But the same error persisted, some more searching and a quick-fix to the problem was found. The problem being of yum being not able to access the servers through default proxy server, hence to just correct the proxy problem, we do
# export

So this finally worked and Yum started to install. later I added the proxy setting in .bashrc file.

Now for OpenCV,  FFmpeg is to be installed before that. Since I had a new installation of Fedora , so first I installed gcc and gcc-c++ compiler through Yum , to be able to install FFmpeg & OpenCV. The process of installation of later is as follows(Courtsey: Gaganpreet)

[ the ftp is on IIIT's Intranet , so is not accessible outside]
A small modification is mentioned at the end of these instructions

tar xvjf ffmpeg.tar.bz2
cd ffmpeg
mkdir /home/{ffmpeg,opencv}
./configure --prefix=/home/ffmpeg/ --enable-shared
make install
export LD_LIBRARY_PATH=/home/ffmpeg/lib

tar xvzf opencv-1.0.0.tar.gz
cd opencv-1.0.0/ 
./configure --prefix=/home/opencv CXXFLAGS=-fno-strict-aliasing 
CFLAGS=-I/home/ffmpeg/include/ CPPFLAGS=-I/home/ffmpeg/include/ LDFLAGS=-L/home/ffmpeg/lib/ 
I got an error at this point 
# ../../cxcore/include/cxmisc.h:133:6: error: #elif with no expression
to fix that goto the file /cxcore/include/cxmisc.h, line no 133  and
change the routine to [note the extra +/- sign and else statement added] 
#elif defined HAVE_ALLOCA
You will get errors like: cvcap_ffmpeg.cpp: cvcap_ffmpeg.cpp: error:
integer constant is too large for 'long' type etc.
For that do:

vim otherlibs/highgui/cvcap_ffmpeg.cpp

Add these two lines to the beginning:

#define INT64_C

and change this line:

make install

To compile a code now:
export LD_LIBRARY_PATH=/home/ffmpeg/lib:/home/opencv/lib    #You can
put this in ~/.bashrc
gcc code.c -lcv -lhighgui -I/home/opencv/include/
-I/home/ffmpeg/include/ -L/home/ffmpeg/lib/ -L/home/opencv/lib/

This will install FFmpeg and OpenCV in your Linux , enjoy :-)