OpenCV 2.4.2 in Ubuntu

I recently built OpenCV 2.4.2 for Ubuntu since I needed that for my project and the version available in Ubuntu was quite dated. I got quite a few pointer on how to build packages and upload them to launchpad PPA here.

To install OpenCV 2.4.2 in Ubuntu, give the following commands:

$ sudo apt-add-repository ppa:bobby-prani/opencv-2.4.2
$ sudo apt-get update
$ sudo apt-get install opencv

C/C++ auto complete in emacs using clang in Debian/Ubuntu

I got so accustomed to using Visual Studio 2010 over the course of my internship, that I seriously was missing it while coding in Linux. I knew there were tools available like libclang+vim etc., but they never seemed complete. So finally I sat down and got auto-complete working with emacs in Ubuntu Linux(Note: This should also work in other distributions, but I’ve only tested it on Debian testing and Ubuntu 12.04).

I also got the browsing mode setup which enables me to jump to definitions, see the references of functions etc., A complete setup for browsing source is here.

Here are the steps:

1. Install emacs, emacs-goodies, global, clang, auto-complete

sudo apt-get install emacs emacs-goodies-el global clang auto-complete-el cscope-el

2. Download this emacs conf file and copy it to ~/.emacs

3. Copy the contents of this file into ~/.emacs.d/

4. generate global tags in the rootsource directory by issuing the command

gtags -v

5. Done!

emacs_ftw

Auto complete in emacs using clang
* To search for tags, use M-.
* To search for symbols, use M-]
* To search for function references, use M-[
* To go back to where you were, use M-*

If there are any errors/suggestions, please let me know in the comments. Thanks!

update 11/08/2012: added cscope-el

update 1/30/2014: source code browsing in emacs is much simpler now thanks to global. Check it out: https://github.com/leoliu/ggtags

Diving

There are some feelings that one cannot put into words. These feelings can only be experienced. Being in love for the first time, getting high etc., are some of the experiences in this category. Having a gun pointed at you from a point-blank range is, I am sure, such an experience. Think of the scene from Fight Club, where Tyler Durden points a gun at the clerk in the store and asks him if that was what he wanted to do in his life.

Jumping from a plane alone is such an experience. I was scared shit-less the moment I saw the outside of the opened door from the plane. The instructor assured me that it is normal to be afraid on the first individual jump(rush of adrenaline etc.,). This is not tandem sky diving, where the instructor more or else carries you like a baby and you get to enjoy the views.  This is an AFF (Accelerated Free Fall) Level One jump. You will have two experienced instructors shoving you outside during your exit from the plane and positioning you during the subsequent free fall. They will usually help you pull open the parachute too. You will also have the assistance of an instructor on the ground who screams at you via radio.

I said a prayer and jumped squealing like a baby. The free fall was terrifying. Except for the wind hitting my face at 120 miles an hour (like Nadal hitting a tennis ball), the experience was exhilarating. We are told to open our chute at about 5000 ft. so as to have enough time for opening the backup if your first chute fails. I did as told. I checked my altimeter and around the standard altitude I pulled my chute. We are then supposed to count from 1001 to 1003, by which time the chute starts pulling you up. If you do not feel that pull, something has gone wrong. I did not feel the pull. I tried looking at my chute. It was wound in a lumpy ball. I tried tugging at it. I lost orientation for a while trying to look at what was wrong with the chute.

You are supposed to pull the backup chute before hitting 1000 ft altitude. After that there is too little time to save yourself. I was well above this altitude. So I let my first chute go and then tried pulling out the second chute. Luckily my two diving instructors were beside me and they came floating to me (it seems like floating when you are relatively motionless) and pulled my second chute. They then left me to my luck. I think I was at about 1500 ft at this time.

Alas, the second chute too failed. I hit the ground at about 400 mph after about 10 sec of free fall from the time of trying to open my second chute. That feeling is something you have to experience.

not A True Story

Back

The girl contemplated the consequences of the act she was about to perform. The rush of thoughts was confusing her. She was not able to perceive her surroundings clearly. That is mostly because of the rush of hormones caused by standing at the edge of a bridge with a 1000 ft drop. She knew what would happen to her once she hit the rocks in the stream.

People say your life flashes before your eyes when you die. The girl was experiencing something similar. Just that she was seeing her life as a  rolling  slow-mo picture. She was not sure of the reasons for her being in that situation. All she was sure of was that she had to do it. She came too far for this. There is no turning back. She could see the outline of the stream flowing beneath the bridge. She could make out patches of snow on the bank of the stream.

The spring air was a bit chilly. She remembered her childhood, the days spent in the woods with her father and sister, hiking and camping. She longed to have those days back.  She wanted to see her father once more. And she thought she will. Very soon.

She said a prayer and jumped. The feeling of falling liberates you somehow. You know you cannot do anything anymore. It is all left to the forces of nature. She kept dropping. She could clearly see the stream now. It was getting closer by the second. The wind brought tears to her eyes. She thought about the cold rocks in the stream. One more second of free fall and she would be hitting them.

Suddenly, she felt an upward force. The bunjee cord tugged at her legs and her hair slightly grazed the water. She is going to go back up now. The stretched cord taking her up. She would come back down again. Her father is waiting for her on the bank, to untie her.

road trip

“Are you afraid of death?, my friend” asked my co-passenger. Not quite amused by the question and not understanding what he was getting at, I replied with a stern ‘No’. I knew that picking up hitchhikers was a bad idea. But the thought of a long boring journey, alone, made me do what I would not usually have done. I hoped I would not repent it. This new friend was shuffling around in his seat, as if trying to get something out of his pocket. I caught the glitter off a metal object in his coat. I thought about the worst possible situation. This seemed to be it and that object seemed to be a gun.

“What are you doing?”, I shouted at him, startling him and making him fumble a bit more. “Jesus, why the fuck are you shouting?”, he shouted back. He found what he was looking for. His hand slowly took the gun out of his pocket. I found his use of Jesus and fuck in the same sentence a bit funny.

It was a metal box which had some weed rolled up.

All calm now, the hitchhiker said “If you are not afraid, I don’t think you would mind driving high” and handed me a lit joint. It was an interesting trip that one, sure did not repent it.

not A True Story.