Archive for February, 2012

smallest compilable program:
main;

smallest executable program:
main();

declaration of an integer global/function variable without using keyword int:
var1;
main(var2,var3){}

another way to declare the variables without using datatype keywords:
__typeof(1) var_name; //declares a variable of integer type
__typeof(1.0) var_name; //declares a variable of double type

reading garbage input without storing it to any variable
scanf(“%*s”);

You can separate the words using multiline comments characters instead of space:
int/**/var1,var2;

Well C is a powerful language and with years, so many features have been added to the language which we don’t use in daily life programming as a developer but its always fascinating to know the hidden concepts of a programming language as a programmer. Happy Programming.

I got a wedding invitation from one of my colleague a few days back. I was just back from another wedding at one of my relatives and this was invitation was dated for the first weekend after my return from 15 days(add subtract a two) holidays . I was pretty much excited about this event as I never attended any wedding outside my relatives circle. Since this one was of also from a person of different culture, my colleague is Bengali and the groom is a Tamil Guy. Me and another colleague of mine Arun (also one of my best friends in office) were planning to go to this wedding since we heard of the wedding. Since we stay nearby, we decided to leave together and will join another colleague of mine at Silk Board. Well the Day arrived and I called Arun around 3:15 PM. He told me that he will leave around 3:45 PM and so accordingly I should reach the bus stand on time. We caught the bus and reached the Silk Board around 5PM.Now this is the time and place when the series of events started.

Since we overestimated the time to reach the Silk Board (This third guy,one who should not be named,told us to be there around 6PM ), we decided to explore the area a little. Finally we found a small restaurant. As Arun didn’t have his lunch and ordered Noodles and juice. Then we came back to Silk Board and waiting for one who should not be named and had another round of snacks ( well It was just Badaam Milk but consider it as snacks) as he made us wait for another hour. Finally our guy came and we headed towards the Hosur in his car where the Reception was. Since neither of us did carry the invitation card and also none of us remembered the name of the marriage hall (yes we were going to a destination without address), we called another colleague of us who had already reached there to spell out the address. Now there was another problem. Hosur was in Tamilnadu and neither of us knew Tamil (Those who have been to TamilNadu can only understand this), we were asking people about the directions and they were looking at us like we were from all the way from Africa. Finally we saw one policeman who somehow explained the route and we reached the destination.

Ohh Boy, what is this? ***** B.E. MBA weds ***** B.Sc. MCA. This was what written on the front gate of the marriage Hall. Later I learned that this is pretty common in South India. Well for the interesting part, some people even prints on the marriage invitation card as this is a thing of prestige for the people over here in society. I was laughing way too much and even considered clicking a pic of it to show at home. Our guy parked his car and we entered the Hall. Now what, there is a queue to get a picture clicked(well also to wish couple a happy married life) with the couple like the one we have when we go to some famous temples. Oops, our guy, one who should not be named, the reason why he should not be named, forgot the gift purchased for the occasion at his home. Now what, lets go to market and find at least some flower bookey and we will give her the present later but yes you dont know Tamil. After wandering around for half an hour we managed to find a flower shop but yes, he does not sell bookey. Okay so what now, we purchased a nice wall clock as a present. Now we had to stand in that “temple like queue” for another half an hour to get our picture clicked with the couple. Standing in the queue I was feeling pity for the couple as they had been standing for as long as people were going to the stage for stills. Thank god in North India, couple remain seated while the people come and go(and offcourse wishes the couple). Well “Hamara Number AA Gaya” and photographer managed to get a click in two attempts though he was still waving his hands like he didn’t it to the frame but we decided to leave the stage after giving our best wishes to the couple. Now comes the part for which actually all the rush gathers in a wedding…FOOD. Arun was even a little more enthusiastic about it as he is a typical HardCore non-vegetarian bengali and he did not have any good bengali food since a long time. He had his high expectations set. But Once we saw those banana leafs lying on the tables, he was like the person gone into Coma. It was a pure south Indian meal. I somehow managed to eat few things while avoiding the most and we decided to drop by to a restaurant on our way back. Ohh yes, when we were coming out of the dining hall, we also got a coconut each of which Arun was thinking of using it as potential weapon against the bride ;-P. We headed back all tired towards our homes in the car of one who should not be named and thanks to him, he missed few turns and we missed our planned dinners to some restaurant in Indiranagar. Finally covering half of the city of bangalore, I reached home at around 11:20 PM. I was tired enough not to worry about the dinner I could had and felt asleep.
[sigh] Yes the day was over for me.
And after two days, that coconut is still waiting for its turn 🙂

Was browsing through the cricket news and read one comment by Mr. Captain Cool MS Dhoni that “Bonus Point- Very Difficult Task”

Ohh yes, Mr. Dhoni, Bonus point is a very difficult task if you will keep playing like this and take the games to last overs just so that you can steal the limelight of the show. I liked that Dhoni who could hit the balls anywhere in the ground. Since when you have changed your batting styles, as per adapting to the team’s requirement reasoned by you, I think its pretty much like you have forgot how to bat. You come to bat at no. 6 and your present batting style requires at least 50 balls to settle you down which in any circumstances cannot be permitted. I always thinks that you can be the best batsman at no. 3 or 4 but in plain english, at no. 6 you sucks. Your best innings have come in the top order. I have seen you coming to top order only when your openers have done pretty well for you but you have never come forward when the early wickets are down( Okay I know there are few exceptions here but one can count these on fingers). I like your batting when you have crossed the first 30 runs but as per your order, you have already consumes 50 odd balls for these runs and added an extra pressure on the batsmen on the other end forcing them to play shots and get out. India have got so many specialists who comments here and there but I wonder if anyone have told you this.

I think your lucky days are gone Mr. Captain Cool when your team supported you well on the performance front. I liked it when you tried different people on the squad. I liked it when you were taking risks like giving ball to someone like Joginder Sharma in final overs of crucial matches. I liked your unexpected but calculated decisions. I wonder what happened to that Dhoni.

Remember Mr. Dhoni, when you are giving output, nobody questions you even if there are some blunders happening but when you fails to give the result, your smallest mistake will catch enough no. of tongues.

Do you know why Indians watch cricket, Is it a very interesting game? No. The only reason we watch the this game is that this is the only game where Indian National Team is able to perform considerably well (do read as in comparison to other games) on an international stage but If you keep showing this Nation what Your Team Can Do, that day cant be far away when this game will see the empty stadiums and small cornered highlights of newspapers as like Hockey.
– A Cricket Fan

I was trying to install  VMWare workstation on my ubuntu 10.04 , downloaded the bundle file from VMWare site and installed using

#sh vmware.bundle

Till now everything was fine until I tried to run the workstation using vmware command from terminal.  I was getting the errors like

  CC [M]  /tmp/vmware-root/modules/vmmon-only/linux/driver.o
/tmp/vmware-root/modules/vmmon-only/linux/driver.c:788: error: ‘SPIN_LOCK_UNLOCKED’ undeclared here (not in a function)
make[2]: *** [/tmp/vmware-root/modules/vmmon-only/linux/driver.o] Error 1
make[1]: *** [_module_/tmp/vmware-root/modules/vmmon-only] Error 2
make[1]: Leaving directory `/home/kapil/Desktop/linux_src/linux-3.1.1′
make: *** [vmmon.ko] Error 2
make: Leaving directory `/tmp/vmware-root/modules/vmmon-only’

And I was just wondering what is going wrong. It looked like MACRO which has been used in the concerned file is removed from the latest kernel sources. I googled a bit and found a patch to successfully compile the vmmon module. You can get the patch from http://weltall.heliohost.org/wordpress/wp-content/uploads/2011/08/fullvmwarelinux310patch.tar.gz. Extract it using command

#tar -xvf  fullvmwarelinux310patch.tar.gz

now run the patch file as

#./patch-modules_2.6.39.sh

If you get an error like “Sorry, this script is only for VMWare WorkStation 7.1.4 or VMWare Player 3.1.4”, get your vmware and vmplayer version using

#vmwaree –version
and
#vmplayer –version

and update in patch file the values of vmreqver and plreqver accordingly. Now run the patch file as

#./patch-modules_2.6.39.sh

Now run the VMPlayer using

#vmplayer

If you get it done successfully and your vmplayer is coming up, you have got lucky otherwise if you get an error like

Starting VMware services:
VMware USB Arbitrator                                               done
Virtual machine monitor                                             done
Virtual machine communication interface                             done
VM communication interface socket family                            done
Blocking file system                                                done
Virtual ethernet                                                   failed

your vmnet module has just failed. To get your vmnet module running, do as follows:

#cd /usr/lib/vmware/modules/source/
#tar -xvf vmnet.tar
#cd vmnet-only
#vi compat_netdevice.h

Add following lines to this file

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 41, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)) || LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
#define HAVE_ALLOC_NETDEV /* feature macro: alloc_xxxdev
functions are available. */
#define HAVE_FREE_NETDEV /* free_netdev() */
#define HAVE_NETDEV_PRIV /* netdev_priv() */
#define HAVE_NETIF_QUEUE
#define HAVE_NET_DEVICE_OPS
#endif

save the file.

#cd ..
#tar cvf vmnet.tar vmnet-only
#vmplayer

Accept the agreement from VMWare and you are good to go.