Saturday, December 17, 2011

How to remove or uninstall GRUB Loader in Windows 7.

Hi all
            I tried installing Linux and got hooked up with this innocent yet annoying GRUB loader. For those who doesn't have any idea of what the hell is GRUB Loader, here is a piece of info about it. GNU GRUB is a bootloader capable of loading a variety of free and proprietary operating systems. GRUB will work well with Linux, DOS, Windows, or BSD. GRUB stands for GRand Unified Bootloader. GRUB is dynamically configurable. This means that the user can make changes during the boot time, which include altering existing boot entries, adding new, custom entries, selecting different kernels, or modifying intrid.  This means that if your computer has a fairly modern BIOS that can access more than 8GB of hard disk space, GRUB will automatically be able to access all of it. GRUB can be run from or be installed to any device (floppy disk, hard disk, CD-ROM, USB drive, network drive) and can load operating systems from just as many locations, including network drives. It can also decompress operating system images before booting them.
            So, successfully I installed GRUB Loader, but don't know really how to use it. So, Whenever I start my system, instead of loading Windows, it will end up with GRUB Loader screen. It would be fun to use it, when you really know how to use it. But for me it looked like piece of shit which has to be cleaned. So, how to uninstall it. I was puzzled, searched in net for the solution. Nothing worked. Finally tried the combination and found out the solution.

      1. Go to BIOS Settings and set first boot device as CDROM. Insert the Windows 7 installation/Upgrade disc in the CD drive, and then restart the computer.     
      2. You will be shown a message saying "Press any key to boot from CD or DVD. Press the key which you like the most.
      3. Setup will start and windows will load the files and will prompt a dialogue box. Select a language, a time, a currency, a keyboard or an input method, and then click Next.
      4. You will find "Install Now" in the middle and "Repair your computer" at the left bottom. Click Repair your computer.
      5. Click the operating system that you want to repair Windows 7 in this case, and then click Next.     
      6. In the System Recovery Options dialog box, click Command Prompt which you will find it as a last option.
      7. Command prompt will open with system reserved drive with
Press Enter. You will see "Operation completed successfully." It won't even take a second.      
      8. And your next command will be this -
Press Enter. You will see "Operation completed successfully." It won't even take a second.     
      9. Reboot and set First boot device as HDD again in the BIOS Settings.

Hurrah !!! You have successfully uninstalled GRUB Loader and your windows will load automatically the next time you restart. Happy reading..

Sunday, December 11, 2011


Hi everyone,
          Which word in any language you have uttered the most ? Mom? Dad? Which word in any language you have heard the most? I am hearing this word very often, which should not be the word which you hear it often. I saw many videos and got inspired to write this post about "TERRORISM".

          I am unable to find the meaning of terrorism. Everyone has their own way of defining Terrorism.
Americans define it as the terror thing that people do in and around Afganistan, Iraq and other Islamic countries. Indians define it as what people do in Pakistan. Islamic countries define it as fight for freedom. A normal person defines it as a bomb blast in civilian home, gun shots in public place and lot many. As for as me, Terrorism is killing innocent. It may be an ant, an animal, a human and every living thing in the world.

         Dominance is the only word comes to my mind. You want to show others what you are capable of. You want to dominate others. Elder siblings dominate younger ones.Teachers dominate students. Seniors dominate juniors. These are little things which doesn't give greater impact. But think of a bigger image. A country wanted to dominate the other. Leads to Attacks, War and ultimately leading to TERRORISM.

TERRORIST - The one who performs terror acts. Lol. If you ask me, the one who stimulates a innocent to perform terror act is Terrorist. In that case, there are too many terrorist. 

         I would like to ask a general question. My question is "The word Terrorism reminds you of which country?". And your answer would be Afganistan, Iraq and all possible Islamic countries. Do you think only Islam countries are terrorism prone countries. Do you think Quran preaches terrorism whereas Bible and Bagavat Gita preaches peace. Never. What would you do if someone enter your house in the intention of acquiring it? Would you smile and say, "Take it, Everything I earned is for you." Would you dare to say that?
The same thing happens with country. Powerful countries enter into other nations in the intention of acquiring it. If they don't agree, you kill them, torture them to death. What will the innocent people do? Die. What will the daring people do? Fight for their country. Fight for their freedom. All Islamic countries do terror attacks thinking that they are fighting their freedom. But, they are not. All other countries fight against Islamic countries saying that they are suppressing terrorism by terrorism. Funny world. Funny people. 
         For those who say only Afganistan, Iraq, Iran, Pakistan a terror country then I would say USA, Russia and world's dominating countries are terror countries in the world. Who made Islamic people terrorists? What made their blood rise and what made their country a terror country? If 9-11 attack was the worst attack in the world history, at the cost of so many civilians life, then what about Hiroshima and Nagasaki? The so called dominant country in the world proudly said United States of America almost destroyed a country which grieved for destruction of two towers. I didnt mean to say that Twin Tower attack was right thing which Osama did. And Japanese people should be happy about it. I have seen videos and pictures of Japanese people grieving for Twin Tower attack. That's called humanity. Everyone must be knowing the term and association Taliban. Taliban is an arabic word meaning group of students. There are many misconception regarding this. Initially, Taliban is formed to defend themselves from Soviet and there is a misconception like Taliban was formed by USA and Taliban had even American soldiers. After soviet withdrew themselves, there was a big gap for power rising and the powerful succeeded. Now, it has become the world's most dangerous group for whom the world fears. Anywyas these I have just heard of and I am not sure of it. USA has done lots of peace creating treaties though. I don't want to talk much about history and don;t want to poke any of the country for their do. I am just a normal common man who wishes to see this world without war, without terror attacks, without fighting for land acround borders. When there are so many natural attacks happening why we want to kill ourselves and make this world a grave.

        I didn't write this post to say who is right or who is wrong. This post is not to depict who are terrorist and who are not. I am just a peace loving guy who wanted this whole world to be a peace loving place. When there are thousand reasons to love, why we are swinging by holding few reasons to hate. No one is going to gain anything by being superior. When you leave the world, you are just a piece of shit.
        I would like to end my post by sharing a video of an soldier talk who feels guilty of his job. And it was amazing to watch a soldier talk like that and really got goosebumps which made me to draft this post.

Saturday, November 19, 2011

Don't you go away...

Album: Don't you go away...
Author: Freekill's Scribbling
Music: Yet to compose.

Don’t  you don’t you don’t you go away…
Don’t you don’t you don’t you stab my heart..
If you want, I will give you my heart..
But don’t you don’t you stab it hard.. 

The sky has become dark..
The clouds are really fast..
Before they start crying baby, please come to me..
Lets make them happy by just holding our hands…
While they shed happy tears, we shall sink it by just holding our hands..
Just holding our hands…

Baby I love you just like  I love my mom..
Will you love me too just like u love your mom..
I don’t have a choice and I really don’t know why..
You just be my wife and I will make you queen of Gods,,
Why don’t you come here and hug me like a bear.. Baby…

Why don’t you just kiss me..?
Why don’t you just hug me...?
I m already feeling cold,  Why do you have to kill me just by making me so cold…?
You have a reason to hate me.. Baby, I have reasons to love you…
Have a single reason to love me baby.. I ll make them unnumbered..

I know I m not the one… 
Bt I m sure, I can be the one.. 
Jus to love you… Jus be with you.. To look after you.. baby…

Don’t  you don’t you don’t you go away…
Don’t you don’t you don’t you stab my heart..
If you want, I will give you my heart..
But don’t you don’t you stab it hard.. 

Saturday, October 22, 2011

English Translation of "Voda Voda " song from Mayakam Enna

Hi guys
       Too many Tamil post and my Non-Tamil readers would have really bugged up with my previous posts. Many non-tamil people who hear this song "Voda Voda Voda" from Mayakam Enna is wondering what is the exact meaning of this song. They don't know the meaning but still they enjoy it. Now read this post, know the meaning and sing it along.

       I have differentiated the original lyrics of the song in blue color and the meaning of it in the next line in red color. Here we go...

Voda voda voda thooram korayala...
Running running running distance didn't get reduced...
Paada paada  paada paatum mudiyala...
Singing singing singing song didn't get over...
Poga poga poga onum puriyala, aaga motham onum velangala...
Time passing by nothing able to grasp, totally nothing understood...
Free ah suthum podhu figure illaye...
While roaming freely figure was not there...
Pudicha figurum ipa free ah illaye...
The figure I liked is not free now..
Kayil bat iruku ball illaye, life poora indha thollaye...
Bat is there in hand ,but no ball.. full of life this problem only...

Ulagame speed ah odi pogudhu... En vandi punchar aagi nikkudhu...
World is running fast... Only my bike is standing still with flat tyre...
Mokka piece kuda enna kindal panudhu... Saami ena bangam panudhu..
Moderate looking girl is also mocking me... Even GOD is betraying me...
Crack ah maariten.. Joker aayiten.. Gundu chattiyile rendu kudhura vandi oturen....
I have changed into a crack... I have become a joker... Trying to ride two horse chariot in a small fat round vessel...

Oru beach la thaniya alanjen alanjen... 
In one beach I roamed, roamed alone...
Nadu roatula aludhen porenden kilinjen...
In middle of the road, I cried, rolled,torn...
Baaram thaangala thaangala, Kaludha na illaye....
Could not bear the weight, I m not a donkey...
Jaanu yerala yerala, mozhama sarukarane...
The half cubit measure didnt rise, sliding like cubit measure..
[Jaan: Unit of length measured from tip of the thumb to the tip of the little finger
Mozham: If I remember right it is equal to two jaans. A direct definition is the length of the forearm starting with the tip of the middle finger. Strung flowers are measured in mozhams  The word has an English equivalent - cubit.]

Crack ah maariten.. Joker aayiten.. fuse pona pin bulb kaana switch ah theduren....
I have changed into a crack... I have become a joker... I m searching for the bulb switch after it got fused...

[voda voda repeat]

Nadu raathiri, ezhunthen paduthen ezhunthen
In the middle of night, I got up, lied back, again got up...
Oru maadhiri, sirichen aluthen sirichen
Like mad guy, I laughed, cried and laughed...
Meenaa neendhuren neendhuren, kadalum seralaye
Swimming, swimming like fish.. couldn't reach the sea...
Padaga poguren poguren, karaiyum seralaye

Going, going like boat, couldn't reach the shore...

Crack ah maariten.. Joker aayiten.. Kelvi kettu kettu kelvi kuri pola nikkuren
I have changed into a crack... I have become a joker...I have become a question mark by asking many questions...

[voda voda repeat]

Saturday, October 01, 2011

திருக்குறள் - கல்யாண பால்

                  நீண்ட நாட்கள் ஆகியும் பதிவை புதிப்பிக்க முடியாததற்கு வருந்துகிறேன். முந்தைய பதிவின் தொடர்ச்சியாக கல்யாண பால். இதற்கு முன் சைட் பால் மற்றும் காதல் பால் படித்திருப்பீர்கள் என நம்புகிறேன். படிகாதோற்கு இதோ இணைப்பு - மற்றும் . நான் எழுதும் இக்குறள் சிரிப்பதற்காகவும் மற்றும் சிந்திபதற்காக மட்டுமே.. யார் மனதையும் புண்படுத்தும் நோக்கம் இல்லை.

 கல்யாண பால்

காதலில் ஜெயமென்றால் கணவன் அஃதில்லையேல் 
அடுத்தப்பெண்ணை  தேடல் ஜெயம்.

மனைவி அமைவது இறைவன் கொடுத்தவரம்
அதைமாற்றி அமைப்பவன் புத்திசாலி.

பெண்ணுக்கு கழுத்தில் ஏறும் தாளிசங்கிலி
அஃது ஆணின் மரணசங்கிலி.

ஆண் பெண் திருமணம் செய்துவிடல்
சந்தோஷம் என்பது கணவாம்.

தாரம் தாய்போற் இருப்பின் அதிர்ஷ்டம்
நாய்போற் இருப்பின் துரதிருஷடம்.

 கல்யாணம் ஆனபின் குழந்தைப்பேறு அழகு
முன்னேரே பெற்றால் அசிங்கம். 

கல்யாணம் சுவர்கத்தில் நிச்சயிக்கப்படும் ஆனபின்
வாழ்வோர் நரகத்திலே வாழ்வார்.  

தாய் தாரம் அடிதடிக்கு நடுவில்
ஆட்டநடுவராக இருத்தல் ஆபத்து.      

தாய்க்குப்பின் தாரமென்றால் தாரத்திடம் அடி
தாரத்திற்குப்பின் தாயென்றால் தாயிடம் உதை.

கல்யாணம் என்பது மாயவலயாம் அஃது
மாட்டிகொண்டு மீண்டவர் யாருமில்லை.

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

Saturday, August 20, 2011

திருக்குறள் - காதல் பால்

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

காதல் பால்

அகர முதல எழுத்தெல்லாம் முதல்
காதலி முதற்றே உலகு.

காதலில் சிறந்தது கோவிலும் இல்லை
காதலி சொல்மிக்க மந்திரமில்லை.

கருப்புக்காகம் கலராகக் கண்ணில் காண
காதல் செய்து பார்.

சுண்டல் காதல் கடற்கரை வரை
உண்மைக்காதல் சுடுகாடு வரை.

காதலன் காதலி கைபேசியில் பேச
தந்தைச்சொத்து அழிவது உறுதி.

மனைவி அமைவது இறைவன் செயலன்றோ
காதலி அமைவது அவன்பாவச்செயல்.

காதலிக் கொஞ்சிப் பேசினால் காதலன்
காசுக்கரியாகும் வழி எனக்கொள்.

சிகரெட்டால் சுட்ட புண் உள்ளாறும்
ஆறாதே காதலிச்சுட்ட வடு.

காதலில் தோற்றானவன் அடுத்த பெண்ணை
காதலிப்பது சால சிறந்தது.

காதல் என்பது சொரிச்சிரங்காம் அஃது
சொரிஞ்ச பின்னரே எரியும். 


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

Tuesday, June 28, 2011

திருக்குறள் - சைட்பால்

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


சைட் அடித்து வாழ்வாரே வாழ்வார்
மற்றவர் சீக்காயே சாவர்.

சைட்டடித்து வாழ்ந்து பார்க்கின் மக்கள்
பிணி நீங்கி செழிப்பர்.

சைட்டடிப்பதே தொழிலாய் கொண்டோர் அவர்
வாழ்வில் செழிப்பது அரிது.

சைட்டடிக்க அழகான பெண்ணில்லையேல் அது
அழுகிய வாழைபழம் எனக்கொள். 

ஃபிகர்பார்க்க சீன்போட்டு வாழ்வரெனின் அவனை
ஊர்பார்க்க உண்டு அடி.

ஃபிகர் போயின் பார்கவிடில் ஃபிகர்
தானே நம்மை பார்த்துவிடும்.

காதல் சொல்ல போகும் பெண்ணிடம்
செருப்பு இல்லாமை நன்று.

ஃபிகர்க்கு செய்யும் செலவானது அவன்
தகப்பன் சொத்தழியும் அறிகுறி.

தகப்பனோ அண்ணனோ ஃபிகருடன் வருவாயின்
அவண்ணமே சைட்டடிப்பது  துணிவு. 

ஆண் பெண்ணையும் பெண் ஆணையும்
பேதமின்றி சைட்டடித்தல் நன்று.  

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

Sunday, June 12, 2011

Pop-up Using div tag

Hi Bloggies,
                    Here I come up with one more interesting technical  post. You have come across javascript many times and there you could find script for opening a new window by clicking some text or button. But, this has various constraints like if you use open.window() method it will open a new window replacing the existing one. This may sometimes cause problems in opening because browsers expects this to be a pop up window and wont allow you to open it. Here comes the simple solution. Use div tag and produce a onclick event. Try it out guys. This is such a simple code that the one tries it, doesn’t need to be a pro in technology. Here is the scenario which I came across. Visiting a website, I found a option called “Send to a Friend” . I clicked it and I found a small window popped up infront of me with existing website contents as it is. How does it work? Here, goes the code.

<div id=”share”><h2><span onclick=”popup()”>Click here to tell a friend</span><h2></div>
Write this HTML code in body tag of your HTML.
<div id=”layer”>
<div id=”email”>
<div id=”from”>From</div>
<div id=”sender” >
First Name<input type=”text” alt=”firstn”/><br><br>
Last Name<input type=”text” alt=”lastn”/><br><br>
Email Address<input type=”text” alt=”addr”/>
<div id=”to”>To</div>
<div id=”reciever”>Email Address <input type=”text” alt=”addr”/><br><br></div>
<div id=”send”><center>Send </center></div>
<div id=”close”><span onclick=”close1()”>Close</span></div>

This div layer is position absolute which means you can write anywhere in your HTML body tag and use it accordingly.
#layer {
 width: 500px;
 height: 450px;
 border: 1px solid #000;





You can add this CSS in link tag in head tag of the HTML or just write the CSS in your code. You can add your own CSS according to your favourite colors and styles.
<script type=”text/javascript”>
function popup()
function close1()

Add this Javascript in your head tag or just create a seperate .js file and add the link.
Try it out and have fun…. Happy reading..!!!

Monday, May 30, 2011

Change the Opacity of the image "onClick" - Javascript

Hi Folks,
               I come up with another technical blog which will be quite interesting. I did this in my training period. You might have heard of the Opacity which means transperancy. Now, I have added an image to my HTML code and on clicking the image its opacity will be reduced. Usually the rating will be between 1 to 100 for IE and 0.1 to 1 for Firefox. We have to write differently for different browsers. Lets see a example for it. Here is my HTML code with an image tag which has a image.
 Here goes the coding….
<title>Change the Opacity of the image</title>
<script type=”text/javascript”>
function lightup(imageobject, opacity){
 if (this.img){
  Opacity(this.img, 100);
 Opacity(imageobject, opacity);
function Opacity(obj,opc){
 if (opc<0||opc>100) return;’alpha(opacity=’+opc+’)';;
<img src=”C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg” height=”200″ width=”200″ onclick=”lightup(this, 50)” />
<img src=”C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg” height=”200″ width=”200″ onclick=”lightup(this, 50)” />
KhtmlOpacity and MozOpacity for browsers Safari and Netscape. For your convenience I have added default windows my pictures pics, if you want you can change the images you want to try. Try it out and happy reading.

Friday, May 27, 2011

Java Annotations

Hi Folks,
               This is technical one. You may think for a while “What the *$#*# is this? Arvind writing technical post?!?!? ” No wonder, I am writing it. And this post I dedicate to my trainer Arun who provided us this wonderful notes regarding Annotations. Its about Java Annotations. Come on, Lets dig deep into it.
               Annotations are like meta-tags that you can add to your code and apply them to package declarations, type declarations, constructors, methods, fields, parameters, and variables. Annotations do not directly affect program semantics, but they do affect the way programs are treated by tools and libraries, which can in turn affect the semantics of the running program.
THE BASICS               There are two things you need to consider with annotations.
                       One is the “annotation” itself.
                       Another is the “annotation type“.

              An “annotation” is the meta-tag that you will use in your code to give it some life. An “annotation type” is used for defining an annotation. You will use it when you want to create your own custom annotation(User defined). First we shall see how to use the “annotation” and then we shall see how to use “annotation type” (writing user defined annotation).
                Lets have a look at the predefined Annotations in java.lang package.
An annotation always begins with @ symbol

In java.lang.annotation package, these annotations are called as “Meta – Annotations”.
 Meta – Annotations : Meta-annotations, which are actually known as the annotations of annotations, contain four types

            Annotations have a number of uses, among them:
                 Information for the compiler — Annotations can be used by the compiler to detect errors or suppress warnings.
                 Compiler-time and deployment-time processing — Software tools can process annotation information to generate code, XML files, and  so forth.
                 Runtime processing — Some annotations are available to be examined at runtime.
How the Java compiler tool uses it?
Example 1:               Let’s start with the predefined annotation @Deprecated defined in java.lang package.
                   Class DeprecatedDemo{
                    static void deprecatedMethod() { }
                    Class  TestDeprecatedAnnotation{
                    public static void main(String args[]) {
                    DeprecatedDemo. deprecatedMethod();

                Whenever you invoke the deprecatedMethod() from any program then the compiler “generates a warning “ when the program is compiled.
Example 2 :               @Override – the @Override annotation informs the compiler that the element is meant to override an element declared in a superclass, it helps to prevent errors.
                   int overriddenMethod() {
                    ……………………………….. // some code
                   return 100;

                If a method marked with @Override fails to correctly override a method in one of its superclasses, the compiler generates an error.
Example 3:             @SuppressWarnings—the @SuppressWarnings annotation tells the compiler to suppress specific warnings that it would otherwise generate. In the example below, a deprecated method is used and the compiler would normally generate a warning. In this case, however, the annotation causes the warning to be suppressed.
                   void useDeprecatedMethod() {
                   DeprecatedDemo. deprecatedMethod();    //deprecation  warning - suppressed

ANNOTATION TYPES -BASICS                                           
               An annotation defitype nition takes an “at” (@) sign, followed by the interface keyword plus the annotation name. Additionally, you can put data within parenthesis after the annotation name.
 Example to Define an Annotation (Annotation type)                   public @interface MyAnnotation {
                   String doSomething();

 Example to Annotate Your Code (Annotation)
                   @MyAnnotation (doSomething=”What to do”)
                   public void mymethod() { …. }

                 There are three annotation types:
                    Full-value or multi-value

Marker Annotation Type
            Marker: Marker type annotations have no elements, except the annotation name itself.
 Example :
                   public @interface MyAnnotation
                   { }

 Usage :
                    public void myMethod()
                    { …. }

Single-Element Annotation type
          Single-element, or single-value type, annotations provide a single piece of data only. This can be represented with a data=value pair or, simply with the value (a shortcut syntax) only, within parenthesis.
                   public @interface MyAnnotation {
                   String doSomething();

                  @MyAnnotation (”What to do”)
                   public void mymethod() { …. }

Multi-value Annotation type
          Full-value type annotations have multiple data members. Therefore, you must use a full data=value parameter syntax for each member.
 Example:                   public @interface MyAnnotation {
                   String doSomething();
                   int count;
                   String date();

                  @MyAnnotation (doSomething=”What to do”, count=1, date=”09-09-2005″)
                   public void mymethod() { …. }

Rules of Thumb for Defining Annotation Type
     Here are some rules-of-thumb when defining an annotation type:
                    Annotation declaration should start with an ‘at’ sign like @, following with an interface keyword, following with the annotation name.
                    Method declarations should not have any parameters.
                    Method declarations should not have any throws clauses.
                    Return types of the method should be one of the following:
                              array of the above types

@Target  - The target annotation indicates the targeted elements of a class in which the annotation type will be applicable.
                           @Target(ElementType.TYPE)—can be applied to any element of a class
                           @Target(ElementType.FIELD)—can be applied to a field or property
                           @Target(ElementType.METHOD)—can be applied to a method level annotation
                           @Target(ElementType.PARAMETER)—can be applied to the parameters of a method
                           @Target(ElementType.CONSTRUCTOR)—can be applied to constructors
                           @Target(ElementType.LOCAL_VARIABLE)—can be applied to local variables
                           @Target(ElementType.ANNOTATION_TYPE)—indicates that the declared type itself is an annotation type
             Where ElementType is an enum in java.lang.annotation package. The constants of this enumerated type provide a simple classification of the declared elements in a Java program.
Example :
                           public @interface Test_Target {
                           public String doTestTarget();

            Next, create a class that will use the @Test_Target annotation.
                           public class TestAnnotations {
                           public static void main(String arg[]) {
                           new TestAnnotations().doTestTarget();

                           @Test_Target(doTestTarget=”Hello World !”)
                           public void doTestTarget() {
                           System.out.printf(”Testing Target annotation”);

            The @Target(ElementType.METHOD) indicates that this annotation type can be used to annotate only at the method levels. If you compile the preceding code, no warning messages will be shown.
@Retention  - The retention annotation indicates where and how long annotations with this type are to be retained.
           There are three values:
                         RetentionPolicy.SOURCE—Annotations with this type will be retained only at the source level and will be ignored by the compiler.    
                         RetentionPolicy.CLASS—Annotations with this type will be by retained by the compiler at compile time, but will be ignored by the VM .     
                         RetentionPolicy.RUNTIME—Annotations with this type will be retained by the VM so they can be read only at run-time .

 Example :

                        public @interface Test_Retention {
                        String doTestRetention();

          In this example, the @Retention(RetentionPolicy.RUNTIME) annotation indicates that your @Test_Retention annotation will be retained by the VM so that it can be read reflectively at run-time.
 Note  -  The concept of using annotations at runtime using reflection is explained in the later part of this post.
 @Documented - The documented annotation indicates that an annotation with this type should be documented by the javadoc tool. By default, annotations are not included in javadoc. But if @Documented is used, it then will be processed by javadoc-like tools and the annotation type information will also be included in the generated document.
 Example :
               public @interface {
               String doTestDocument();

               public class TestAnnotations {
               public static void main(String arg[]) {
               new TestAnnotations().doSomeTestRetention();
               new TestAnnotations().doSomeTestDocumented();
               @Test_Retention (doTestRetention=”Hello retention test”)
                public void doSomeTestRetention() {
                System.out.printf(”Testing annotation ‘Retention’”);
                @Test_Documented(doTestDocument=”Hello document”)
                public void doSomeTestDocumented() {
                System.out.printf(”Testing annotation ‘Documented’”);

          Note: javadoc is a tool used for generating html docs for Java classes.
@Inherited –  Indicates that an annotation type is automatically inherited
            This meta-annotation type has no effect if the annotated type is used to annotate anything other than a class. Note also that this meta-annotation only causes annotations to be inherited from superclasses; annotations on implemented interfaces have no effect. By default annotations are not inherited.
    Example :
                          @MyAnnotation class Super {
                           public void foo() {}
                           class Sub extends Super {
                           public void foo() {}

             If an annotation type has the meta-annotation @Inherited then an annotation of that type on a class will cause the annotation to be inherited by sub-classes.
So, in the example above, if the MyAnnotation type had the @Inherited attribute, then Sub would have the MyAnnotation annotation.


            Thank you for reading this post and hope you all got a overview of what annotation is. Meet you all in my next post.

Share it if you like it