Saturday, September 26, 2009

My First Hack into Netbeans

This post describes how to develop a simple macro for Netbeans to comment and uncomment the selected text. By default the purpose is done by a inbuilt template in Netbeans. To comment the selected text using this template follow :
  • Select the text to be commented.
  • Press Alt+Enter. A drop-down menu will come. Select Surround with /*$selection*/
This method becomes cumbersome when you keep adding your own Templates.(How to develop your own Template in another post :P ) NetBeans allows you to develop your own macros to perform such tasks.
  • Go to Tools -> Options.
  • In Options select the Editor -> Macros tab.
  • Now Click New. A pop-up will come. Enter the macro name Comment .
  • A new entry in the macro table is entered. Select the entry and paste the following code in the Macro Code window.
select-identifier cut-to-clipboard caret-begin-line insert-break "/*" insert-break delete-previous delete-previous paste-from-clipboard insert-break remove-line "*/" insert-break
  • Set Shortcut Alt+Q (or anything you like)
Comment macro is created. Similarly create uncomment macro. Paste following code in the Macro Code window:
select-identifier last-non-white remove-line cut-to-clipboard caret-begin-line paste-from-clipboard first-non-white remove-line remove-line
  • Set shortcut Shift+Alt+Q (or anything you like)
  • Click Ok.
Now both the macros are created. To use them Select the text from the editor and press Alt+Q to comment and press Shift+Alt+Q to uncomment the commented code. Here is the list of elementary macro functions. You can develop your own using these link.

Enjoy NetBeans :)

Wednesday, September 16, 2009

Multiuser Gtalk

You can customize Gtalk to allow multiple login from a computer.
All you have to do is to goto the installed gtalk.exe or goto Start Menu right click Gtalk -> Properties
add /nomutex to the Target.

Now restart Gtalk. You can run multiple instances now.

Saturday, August 22, 2009

The Cow Theories

Last nite I was watching the movie Someone Like You. It was based on the New Cow Theory as mentioned (here) and its analogy to the Humans.
So, I googled the so called Cow Theory and what I found is different but equally interesting ...
The Theory goes like this ......
Here is the hypothetical situation: Your neighbor has 3 cows, you have one cow. How do different economic systems deal with this situation?
Communism: The government takes two cows away from your neighbor and sends them into orbit to prove the communist system is better. Your neighbor is sent to Siberia for being a landowner. You are sent to Siberia for being a troublemaker. The capitalists, shocked about the orbiting cows, are spurred into action and land cows on the moon a few years later. Your economy cannot compete and dissolves into chaos.
American capitalism: The person with 3 cows becomes rich by renting one of his cows to you. Then he takes his cow back and uses the profit to buy your cow from you, leaving him with 4 cows and you with none.
European capitalism: The government discovers that cows cause global warming and you are forced sell your cow to pay for expensive emission control devices. There is no market for cows. It is considered gauche to eat beef, and killing a cow is considered a form of genocide. Your neighbor is tried in the International Criminal Court for running a cow slavery ring. The government sets limits on the number of cows it can have, then exceeds them.
Marxism: The cows revolt against exploitation and form a commune where they are all equal. Since everyone is equal, they are all managers and no one does any work. They stand in long lines to buy grass. One cow escapes to Mexico, but the other cows send an assassin after him.
Feminism: You are forced to have an equal number of cows and bulls. Instead of giving milk, your cow runs for the US Senate while your bull refuses to mate. Cows become extinct.
Democrat: You feel guilty for being successful.You vote people into office that put a tax on your cows, forcing you to sell one to raise money to pay the tax.The people you voted for then take the tax money, buy a cow and give it to your neighbor.
You feel righteous.

P.S. : The complete list can be found Ref 1 Ref 2

Firefox saved-form data

Have you ever mistyped your password in the username field and it got saved in the form data, or your form data list has become long and you had to clear all your form data just to remove these selected entries?

Then here is a simple trick to overcome this problem...
Just go to the form field and press the Down key. It will show the list of saved data. Now move to the data entry you want to remove. Select the entry and press Delete .. and its gone :)

Saturday, August 15, 2009

are your friends invisible or offline?

Here is a little trick to find out if one in your friendlist is Offline or Invisible :

If you are Gmail user:

1. Open the chat window by clicking your friend’s name
2. Click on Options and select Go off the Record
3. Send some message to the user.
4. If you get the feedback from gtalk that User is offline and can’t receive messages means that the user is really offline.
5. But if you get no response that means that the user is appearing offline and in invisible mode.

If you are Gtalk User:

All the steps are same except 2. Here Click on the Down Arrow below the name in the chat window and select Go off the Record

Thursday, June 4, 2009

my first day at cooking

Atlast after eating in restaurants for about a month I plunged myself into the waters of cooking.

I was indeed inspired by the way Akhil made it easy for me during my visit to Paris to atleast give it a shot.

So, I and Sharjeel decided to cook our dinner last nite, Narendra wasnt involved as he gets hi meal from the landlord. I took out the packages and baggages of masala and rice. Got some potatoes from the landord's basket. While I was washing the rice I told Sharjeel to peel the potatoes, it turned out that he didnt even know this art, which I think everyone should know. Nevertheless, I washed the rice put it on the stove, peeled the potatoes and let it to boil. While the cooking was being done by the stove, I opened the packets of masalas to figure out exactly what were they, thankfully my mom had put a slip in each of them. But still I didnt know what all to put in a sabji, so I decided to gamble(I think gamble will not be a good word, as I had tried this once in my home) to put little of all the stuffs in. But I do had the idea of how much salt to put(I do help my mom in the kitchen sometime) so I was pretty safe in ruining the sabji. Finally after 20 min the potatoes were boiled and rice was cooked, I drained the excess water from the rice and kept it aside.

Now main test of my memory was to begin, in what order do I have to cook the sabji(means wat to put in first and den on). I remembered mom used to fry the potatoes first, so i did dat untill the were brownish(another thing learnt while helpin mom in kitchen), den put in the water and pinch of all the masalas(kaali mirch, haldi, zeera and many other) and waited it to form a dense gravy, which is when U know sabji is cooked.

After about 10 min wen I opened the lid, to my amazement there were no dense gravy but only water. Then smthing struck to my mind and I realised, dat I have to put the onions too. Hurriedly I drew one onion(again from landlord's basket) peeled it, cut into small pieces and put into the pan.

And den started coming the good smell of the sabji, 20 more min and sabji was ready and we(sheru came wen every things was done and ready) were on the table to have the dinner(my first self-made dinner). It was nice. As Sheru hadnt helped me in cooking so I left the washing of dishes to him.

Wednesday, June 3, 2009

BeNeLux Trip

finally ... got the time to write this blog ... after tiring and awesome trips to amsterdam,brussels, antwerp and paris.

We were having holiday on thursday so by getting Friday off we were there with 4 continuous holidays, anyone will agree that it is a great oppurtunity to travel and that too for us, who have to spend considerable amount of time traveling. Our intitial plan was to visit Amsterdam, Brussels and Paris, but due to unavalibility of train tickets to Paris we had to confine ourselves to Amsterdam, Brussels and Antwerp(talking in Eu-rail lingua BeNeLux). So we had our tickets booked. Our train was at 11 am from Kobenhaven station and we would be reaching Amsterdam central station at 11:30 pm(pretty long and tiring). Intitially Akhil and G2 were to meet us there at Amsterdam but because of some problems ;) G2 couldnt join. The journey to Amsterdam was fine, except at Duisberg where the German Fedral Police came to Sharjeel and asked for only his passport and none of others(now this is common as people are scared of Sharjeel's beard). Finally we were there at Amsterdam at 11:30 pm and after searching for Akhil for some time we five of us (me, Narendra, Sharjeel, Akhil and Akshay) were on the streets of Amsterdam starting our Eurotrip phase-I. Though it was midnight but the streets were full of people. You could see groups passing by with beer bottles in their one hand and joint in other(Sadly I dont smoke). We kept on moving around, had dinner at MacD, I had big french fries for 3.10 euros. Well wen u convert it into INR it would be approx 200 for 100gm of potatoes(first few things I learnt after reaching Copenhagen was to stop converting else I would be starving to death). Anywayz we continued our street patrolling. Then a strange thing happened, an old man came to us and asked for the lighter, as Sharjeel is only smoker in our group I asked him for the same. Out of sudden Sharjeel tossed the lighter to the old man and it hit him on his head. Being heavily drunk, man didnt feel the pain and went on to light his joint. Sharjeel was delighted(and so was Akshay, God knows why as neither he smokes nor was inclined to start) after seeing the joint and so he went on to ask the couple(sry if didnt mentioned that couple was heavily drunk or whatever u call wen people are on high). Couple was delighted to see the indians as for the people over there Indians means weed-supplier and dats the reason why we were asked for the weed by many during our stay. Anyway Sharjeel got some free weed, sadly he couldnt get the hash as women couldnt find in her bag. Sharjeel later complained about the weed of not being of good quality(have no idea wat a good quality means in weeds, wait for his comments if u want to know details). Now it was 2:00 am, every thing in Amsterdam closes at 2:00 only few bars and clubs :P open till 4:00 and they are in the Red Light District(RLD). So we went in, looking for the bars, dont know why as dere were only two drinkers in the group me and Akhil(sry occasional drinker, as this was fifth time for me and similar for Akhil), but we couldnt find any so at last we sat on the footpath and started playin cards. We later noticed that the place where we were playin cards was rite in front of the RLD, so were nagged by police on regular intervals. We played till 5:00, its wen the station opens, we went dere to have a short nap. So this how the first nite at Amsterdam went.

Wen we came outside the station it was like if a carnival is just over. Warm atmosphere, bottles, cigg butts and wrappers scattered all around. The muncipal workers were cleaning the roads. The hotels and restaurants were being delivered the drums of beer and wines in similar fashion as as milk is delivered in India. And soon after an hour and so street were crowded wid people as if its another day of a carnival.

We bought the I amsterdam cards to travel in Amsterdam(58 euros .. 5k INR, never mind) and the tour package for Belgium(53 euros), went on a canal ride which was included in the card fell asleep in the ride, went to various museums. Sharjeel and Akhil took the room for a nite(50 euros per nite per head), I had no enthu to spend so much. Den again came the nite. After having the dinner(french fries again), Sharjeel and Akhil went to their room and we(me, Narendra and Akshay) were on the streets again. First we went to the station(as it is open till 2), had a good sleep(generally you are not allowed to sleep but you can at the platforms as there are no cops dere). Then at 2 we were told to leave the platform, went outside and slept in a shade outside, but again were nagged by the cops for sleeping, this woke me and askhay and we couldnt sleep but narendra went on. slowly and slowly time went by and it was 5:00. We again entered the station, I went flat inside and was later woken by narendra wen police again nagged us for sleeping(Why the hell we not allowed to sleep at station ... take these people to India we will provide enought space to sleep at stations). We went ot Sharjeel's room, I had little sleep while other got fresh, den took a tram and randomly stopped at a station, it turned out to be "I amsterdam" park we got few pics and headed back as our Belgium tour was starting from 10:00. I was pretty sure Akhil and Sharjeel were still sleeping so went to their room they proved me right :P. I woke them and we hurried to get the bus. Luckily we caught the bus and so out trip to Belgium began. Our first stop was Antwerp, we went to Cathedral, castles, Akhil ordered white beer(dont know why they call it so, colour is the same and so is the taste). Den we were off for Brussels. It is an awesome city, with lot and lot of beautiful ancient architectures, huge palaces, city squares and buildings similar to Vienna(ohh i havent yet written about our Vienna trip, will write it soon). We had 3 hours of stay at Brussels, we went around tried the chocolates for free, they were awesome. Not much to write about the visits as you can find them in the pics. Boarded the bus and were back to Amsterdam by 10 in night. Akhil stayed there as he was having his train to Paris from Brussels next morning. As this was our last nite at Amsterdam, we went deep inside the RLD to explore it. There were many things .... oops cant write about them ... The whole of RLD was marked by the red lights as if it was circled with a red light ribbon and every shop, club and etc had the red lights in the front. We walked into the streets exploring it .. and spending our last nite at Amsterdam of the trip. We went to windmill and had the canal ride nest day ... and finally were on the train at 5 in the evening. It was as if we were returning to our home from a long journey(which ofcourse it was .. 3 continuous night on street sleeping here and dere).

Our train back to Copenhagen was one which you see in the movies with 6 people compartment. All of us were in different compartments, I went direclty to sleep and was sleeping until Utrech wen a fair Dutch girl came and woke me. I was in deep sleep so what I could manage to utter was which is your seat and she said seat 85 one rote in front of mine near the windows(nywayz it hardly mattered as only we two were in the compartment). She was a lively girl who always smiled. Then we talked about each other. I told her dat I was on a visit to Amsterdam and she told dat she was going to Copenhagen to visit her boyfriend who was a Phd student at Univ of Copenhagen. Den the talk moved to the arbit topics like the lifestyle in Amsterdam and India, she suggested me the places to visit in Rome as she had been dere and I strongly recommended her to go to Tivoli Gardens. She gave me one of the juice which she had brought, it was made from some flower, it tasted good. Den Sharjeel, Akshay and Rahul(we met him on this very train) came and we four (Akshay was excluded from the game) started playing cards. We played till late nite and den we went to sleep to wake up next morning in Copenhagen, back to the daily routine "office".

Monday, May 18, 2009

its me and my MAC keyboard

From the bunch of awkward situations, one most common and one dat can occur nywhr and nytym is Monkey-in-lab. For the one who is going out of the country for the first tym the occurrence of such situations are inevitable. Uptill now I too had many of them. My first was in my own office and my own computer, the very computer about which I proudly tell to my friends, a 8 core system with 6 GB RAM and Nvidia 8600 GTX. But the main problem with it is dat it is not only a MAC system and to add to ur hardships it has the Danish keyboard. One of the strange thing about the MAC keyboard is the Command button. Its functionality similar to the control button on the windows system but dere is one control button too(yet not sure abt its purpose). And dere is one ms ore extra button called Alt/Gr whose purpose is to act as the third character smthng similar to what shift does but now dere r thre characters on each letter rather than being two only(still amazed why MAC need so much of them characters).For initial few days, one could see the MAC keyboard shortcut or such stuffs opened in my browser, but soon realised their uselessness. Speaking of characters dere r some which still are nightmares for me. Of them are '{', '}', '[', ']' and '\'. I tried very hard and spent almost one of my whole weekend searching for these online but met no success. As one might know about the importance of these to a programmer, for the arrays, blocks and paths. Initially I used to copy them from one place and paste them whenever needed, it was clumsy and boring. But now I have found more elegant way to perform this. Now whenever I need them I just go to the top-right corner of my desktop and from there I toggle to US keyboard and I am with my Danish-MAC keyboard as a US keyboard. I perform my actions den back to Danish keyboard(I am not too good wid US keyboards either, so have to go back for typing ;) ). Hoping for some improvement in my present scenario wid my MAC in coming days.
Now it will be totally unfair and in some ways too rude of me if I donot mention some good(here I mean really good and cool) things about MAC. It has wonderful GUI interface along wid the UNIX kernel which gives me feeling of being at home. And above all is the magic of 8 core processor, Nvidia 8800 and 6 GB RAM(Now, my system will be happy when its RAM will read these stuffs as this page is loaded). There are many more cool things but I havnt explored so deep.

P.S.: This blog has its inspiration from g2's blog about monkey in lab and my prof's wish dat I should write about my experience wid MAC.

Thursday, May 14, 2009

getting started

Hmmmm .... atlast I have joined the group which I hated the most .. the group of bloggers .... I used to think that how can someone find so much time to write a blog when there are lots of other beautiful stuffs to do around you. But now I can fully understand the torchorous situation one would have gone through which compelled him become a blogger.
When you are in completely different time zone in which your friends live and you come back to home after tiring office work (mind you sitting in front of the computer and working can be pretty tiring) with the hope that you will chat with your friends tell them about your experiences, hear about theirs .. but ooops all are offline .. perhaps sleeping as its late nite over there part of the earth. And you after exausting all the TV serials episodes, are left with just nothing except staring at the online list as if someone pops up and then go back to sleep when you are bored enough. :P .
To add to the miseries of ur lyf is if you are missing someone very badly .. someone very dear to you, someone with whom you used to talk daily but now you just cant bcoz when they are free you arent and when you are free they are in their sound sleep and you dare not disturb their tender sleep.
All these things leave a blank space in your daily life. A SPACE which haunts you and you try all possible ways to fill this up .. and the most obivious and comfortable way is to sit in ur warm cozy bed with ur laptop on ur lap and write a blog as I am doing rite now.
So atlast compelled by the situations here I am writing my first BLOG. Hope this will fill in the SPACE in my daily life as I have so much to write about, the new city, country, culture people and above all how I adapt to them.
A whole new experience , the "EXCAVATION Of My LIFE"

Hoping to you soon over here reading my next blog, as I have no other thing to do. :P