Tuesday, February 21, 2012

Volatile Vs Synchronized

Friday, December 9, 2011

Excel Tips


conditional formating :

1) select the cell where we are going to apply the formating.

2) Click on conditional formating

3) go to New rule

4) select the second option

5) Give the rules conditions in the second columns.

6) apply the format using the format painter where ever required.


 Protecting the sheets/files. :

Protecting the files with password :

1) when we are saving the file, go to tools in the dialog box , select genaral options.

2) type the passwords then click ok.

Protect the worsheet :

1) RightClick on the sheet name

2) Select protect sheet,

3) check the approriate conditions to protect the sheet.

4) Click Ok.

5) right click on the worksheet name.

6) Click on unprotect.


Creating the list. :

1) click on Alt +D + L

2) select "List" from the drop down

3) go to the source & select the source cells, or we can enter manually also.

4) We can enter the text on the input messae & error ( optional).

Remove the Validation

Go to --> Data --> validation --> ( choose the option ).


Hyperlink

ctrl +K

Remove the gridlines
open the Excel --> go to View tab --> uncheck the "gridlines".

Simple steps to control Cold, Cough, Asthama.

We found many people are suffering from cold, cough, Asthama, breathing related problem every where. In order to control, we use hellopathy medicines & we also found due to many hellopathy medicins , we undergo many side effects.

Now, There is best solution for the people who are facing the above problem,

The best Medicine with out any side effects & with many more advantages is : YOGA(Control breath).

By listening the Word YOGA we will feel, this is not possible with us. But here is the simple Yoga asans which brings so many benifits with little amount of time & effort.


Pranayama - restraint of breath.

1) Sit in the comfortable position. (perferablly Vajrasan )

2) Hold your thumb on

Kapalabath -


I personally following steps to improve my immunnity & reduce cold, cough.

1) Do 10 min Pranayama (breathing excersise )

2) Do 10 min Kapalbah ( stomch excersie)


Just follow the above 2 steps every day, Enjoy your health.




Friday, April 15, 2011

Document.ready() vs Onload ()

Document.ready() onload()
JqueryNormal JS function
calls as soon as DOM id loadedcalls when everything gets loaded on the page that includes DOM, images and all associated resources of the page
We can have as many as
document.ready()
onload function is limited on one time
Fasterslow compared to .ready()


What is jQuery and what are its Features/Advantages?

 jQuery is a very good JavaScript Library that runs in browser. Its is client side ajax framework. It is used to develop web 2.0 . The jQuery library is designed to keep the things very simple and reusable. jQuery library simplifies the process of traversal of HTML DOM tree. You can use jQuery to handle events, perform animation, and add the ajax support into your web applications with ease.



The following are important features of jQuery.


  1. Light weight only few js area supposed to include to use the functionality.
  2. Easy to learn. With in days , any one can become the master of the JQuery.
  3. Extensibility The jQuery Framework is easily extensible.
  4. DOM elements manipulations It easily handles DOM element selections functions, manipulations, traversal and modification.
  5. Event Handling We can implement Event Handling at client side.
  6. CSS manipulation It provides the flexibility for CSS manipulation. We can apply or change CSS dynamically using jQuery.
  7. Animations Advanced effects and animations are possible using jQuery.
  8. Cross Browser Compatibility It is Consistent across all browsers.
  9. Easy Plugins Number of plug-in or widgets available to achieve certain functionality like paging, sorting, drag, accordion etc

Tuesday, April 27, 2010

Java Interviwe Questions.

1) What is interface and when to use the abstract class ?
When To Use Interfaces
An interface allows somebody to start from scratch to implement your interface or implement your interface in some other code whose original or primary purpose was quite different from your interface. To them, your interface is only incidental, something that have to add on to the their code to be able to use your package.
When To Use Abstract classes
An abstract class, in contrast, provides more structure. It usually defines some default implementations and provides some tools useful for a full implementation. The catch is, code using it must use your class as the base. That may be highly inconvenient if the other programmers wanting to use your package have already developed their own class hierarchy independently. In Java, a class can inherit from only one base class.

2) Explain System.out.println ?
System is a predefined final class,
out is a PrintStream object and
println is a built-in overloaded method in the out object.

3) What we will get if System.out.println(null) and why?
Compilation error

4) How to create the immutable class with the properties as name and date ? tell any 2 ways ???
5) How to find out ip address of the java address ?
6) How to read the last 100 lines in a 1GB file ?
7) How can we find the free memory in java ?
8) Will the immutable objects impact the Garbage collection ? Are the immutable objects are good or bad for GC?
9) Open a file à modify the file àclose the file à where can we close the file ?
10) For (1 to 100) { string str =”Hello” } how many string objects are created in the for loop ?
11) Basic structure of Hash table? Code to write our own hash table ? create a class , 2 properties like key and value.. use collection to do it ……. What makes the hash table as so fast ??
12) How to you write a singleton class… implements serializes …but can we make them deserialiable .. what method .. any type single ton method.. which method we need to override … clone()
13) How do you create a connection? load the driver manager ?
14) How to execute a sql statement using java
15) If the invoke a close() under a statements … will the resultSet object will be closed ?
16) How many resultsets can we have for a statement ?
17) Out of memory .. how can we resolve the error ??? which method we are supposed to use ????
18) What are cursors .. ??? what is purpose of cursors ….
19) How do insert data to DB using JDBC ? excuteUpdate() or excute() what are the other ways ????
20) Resultset .insertRow ()
21) Diff between Forward() and sendRedirect () ?
22) We have servlets .. how can measure execution time of a servlets ? suppose we have login logic ???
23) What is doPost() ? how do we get the doPost() execution time ???
24) How can find no. of requests comings to a web application ???
25) Every time any request comes to web application , we want to write some info into log file.. what methods we use ?
26) A jsp returns a message “Welcome “ … the jsp can’t be modified by us… how can change the “welcome” message to “Goodbye “ ?
27) How do we implements filter ?
28) What is design pattern used in Struts ? MVC
29) How many Action servlets object can be there in struts ?
30) In struts , how can I pass my objects to actionServlet … simultaneous 2 or more
31) Extend the actionServlet .. which method we are suppose to override ? excute () ?
32) Jsp page … form à button à send a button .. click multiple times.. multiple times the files has been sent ?? how can we slove this … that only one time the files has to sent instead of multiple times ….. in struts and normal ???
33) Anyone can access the page.. one can access the file.. other can’t access the page .. access controller API ???
34) What is outer join?
35) What is biff between outer join and inner join?
36) Syntax to create a SP…
37) Table , varchar filename, filesDesc .. data is case sensitive ???
38) File table … fileID ,filename , file table is very huge …. To run the query .. it is taking 10 min… how can we tune the query ?????
39) Is the data in Oracle is case sensitive ?
40) How to execute the SP in SQL+ ?
41) How do we parse XML in java ?
42) Diff between SAX and DOM ?
43) How to we modify the XML as a well-formed??
44) How can we know that some attribute has been set to the session?
45) How can we make sure that parent class method is going to modify by the child class ?
46) What is a thread dump?
47) How many sockets can w open in Java at a time ?
48) How do we create server socket ?
49) What are features of JDK 1.5 ?
50) What are Auto switch Jobs ?
51) Difference between CVS and SVN ?
52) What is object in JavaScript?
53) How do we solve the memory leaks in java ? when do the memory leaks occur ?
54) How do we debug a jsp in product env .?
55) How to select different targets in Ant?
56) What is the root element in Ant?
57) How do we know that some events are happening in Java ?
58) Difference between doPost() and doGet() ?
59) How do we make the singleton as 100% even in 2 JVMS ?
60) What is thread Local class?
61) How do we delete a file in Java?
62) Dif between string buffer and string builder and string?
63) We have 32 bit JVM, but we are going to read 3GB data,, due to this we are going to get out of memory.. how we are going to handle the situation suing JDBC ?
64) Other way to insert data using JDBC other than execute() ?
65) What is setrogated key in DB ?
66) How would we create a object which is similar to hash table ?
67) How can we create a single ton class which implements serializable ?
68) How many ways can we create instance in java ?
69) what is the difference b/w request.getAttribute & getPrameter

To clarify just a bit. Parameters in a request are set there by the HTML client when the request is created, typically from elements (input and file elements to be exact) within an HTML form. Therefore if the form that called your servlet/JSP page had an element with a name "fred", you would retrieve the value of that form element by using getParameter("fred"). An HTML form does not set attributes, only parameters.Attributes are set programatically. If you set an attribute, then you can get it. This is typically done by a servlet or java POJO that either does some pre-processing and sets some additional attribute values, or one that processes the request, finds errors and therefore sets attributes and returns the request back to the originator. The originator may look for these attributes (for example error messages) and display them. You don't programatically set parameters, only attributes. -
70) how to change the port number in tomcat -- RUNNING.txt

71) where does the Ajax lies – both in the server side & client side…

72) what is the default port number of oracle – 80

73) What are the different transaction mgt in spring?

74) 6) where exactly we deploy the war file in tomcat --- webapps

75) what is the configuration we need to make to configure the debug mode in the eclipse – just run in the debug mode..
76) what are steps to configure the Tomcat with eclipse ..

77) what are inner joins & outer joins -

In outer Join some extra rows will come but in the inner join we get only the common rows. There is no option for the outer join to add the left or right joins..

78) how the resultSet maps to the data fetched from the query?



79) How can we make the code as synchronized w/o using the synchronized key word.
Use the Lock concept in JDK1.5
12) How Log4J works internally? What are the severity levels in it?
13) what is diff/bt warning & bug in log4J?
14) what are the advantages of the inheritance & polymorphism?
15) How do we send the java objects to the stored procedures?
16) how do we the session object in the servlet?
Http Session session = request.getSession(true);
*) why do we need a protocol specific sessions.
17) can we call abstract method in the non abstract () – yes.
18) Inheritance advantages
19) why we need so many layers in our project?
20) how can make sure that the implementing class will call the non shape.. color..
21) with using normal joins .. how many rows will get? no of rows of first table * no of rows in 2nd table
22) Implementation of the Abstraction & exact meaning of Abstraction?
23) Implementation of the Encapsulation
24) what is the significant of the user- defined exception?
25) is synchronized is the access modifier?
26) multicasting? – During the java sockets we need to use the multicasting.
27) main() of one class can be called in other class? - yes
28) throw & throws & throwable?
29) can a static class be there? No
30) Different methods in Redirecting the servlets? – RequestDispatcher.farward() & response.sendRedirect()
31) Advantages of the datasources over JDBC?
32) Abstract Factory pattern?
33) Inner Joins, outer joins & normal joins?
34) What algorithm does the Garbage collector uses?
35) How many static blocks can a class can have?
36) How to sort the arraylist.. – sort().
37)JDBC steps….
38) DriverManager is a interface or a class? - class
39) What does Class.forName return? - returns the class instances that representing the class….
Mainly it loads the class & returns the instatnce of the given class.
40) What are the ways to create an instance of the class?
a. Using new operater
b. Using the class.forname(“fdgdf ”).newInstance()
c. Using the deserialization
d. Using clone
41) Examples of the checked exceptions – FileNotFound.
42) How a Stored Procedure returns more than one RS.
a. Rs.getMoreResultset(), it also has rs.hasMoreResult.
43) How to pass an object to the Stored Procedure?
44) What is a RequestDispatcher?
a. RequestDispatcher dispatcher = getServletConfig ( ) .getServletContext ( ) .getRequestDispatcher ( "/"file_name ) ; dispatcher.forward ( request, response ) ;
b. ServletContext sc = getServletContext ( ) ; RequestDispatcher rd = sc.getRequestDispatcher ( url ) ; rd.forward ( req, res ) ;
45) Can a abstacr class contains the full nonabstact class?
46) Is it illegal to have a abstact modifier infornt of a interface method?
47) How can you pass the error page in the jsp…
a. In web.xml :
i.

java.lang.NullPointerException

/NPEerror.html






404
/errorServlet
48) Implict objects in Java?
49) How can we store the objects of the e.printstactTrace into a string & store into a DB?
a. StringWritter sw = new StringWritter(e.printStactTrace());
b. PrintWritter pw = new printwritter(sw);
c. String str = sw.tostring();
d. Store the str in the DB.
50) How do you handle Nullpointer exception?

Tuesday, March 9, 2010

Dynamic table creation using JSON objects.

Hi,
Here is an example for creating dyanmic table using JSON objects.

script type="text/javascript"

// Adding the rows to tbody. From the html we will call the below function.
function displayRows(jsonString){
var tableBody = document.getElementById("QuestionBody");
// Clears the table row contents initally.
while (tableBody.firstChild) {
tableBody.removeChild(tableBody.firstChild);
}
// Fetches the size of the JSON object and creates that many rows.
for(i=0; ivar row = document.createElement('tr');
createTableData(row, jsonString[i]);
tableBody.appendChild(row);
}
document.getElementById("QuestionBody").appendChild(tableBody);
jQuery('#QuestionTable').show();
jQuery('table').Scrollable(100, 800);
}

function createTableData(rowObject, data){
createTableRowContent(rowObject, data, 'td');
}
// Adding the actuall data content to the td.
function createTableRowContent(rowObject, data, cellType){
var rowContent = document.createElement(cellType);
var cell = document.createTextNode(data);
rowContent.appendChild(cell);
rowObject.appendChild(rowContent);
}
/script

Friday, March 5, 2010

Ways to fetch values using Hibernate

There are 3 ways to fetch values using Hibernate.
1) Using the HQL : just write the query in hql and map the tables to Classes and also the columns to attributes in the Class.
Ex:
String queryString = "select columName from tableX where columName like '%"+name+"%'";
List str = getHibernateTemplate().find(queryString);
Note : here in hql we are supposed to use the table attributes as column name and class names as table name.

2) Fetch directly with out using the query statement at all.
Ex : this.getSession().createCriteria(XXX.class).list();

3) write the query in the hbm.xml file and call the query from java file.
Ex :
In the java file :
getHibernateTemplate().findByNamedQuery("selectAllLike", x.trim());
In the hbm file define the selectAllLike query statement like

sql-query name="selectAllLike"
return alias="component" class="com.bofa.osm.hibernate.Component"
SELECT * FROM COMPONENT c WHERE upper(c.NAME) LIKE upper(?)
sql-query

Note : sql-query ans return are the tags.
Cheers
DeepthiMahesh

Friday, February 5, 2010

Food for thought

If you want to make the right decisions in confusing times—Time to refinance? Explore a different career? Root for the singing spinster or the 12-year-old?—you need to pay special attention to what you eat. That’s right: Your grocery list can help with your to-do list. That’s because the right foods are a kind of clean-burning fuel for your body’s biggest energy hog: Your brain. A study in the Journal of Physiology makes the point that, though your brain represents only 2 percent of your body weight, it makes 20 percent of the energy demands on your resting metabolism. On our new Eat This, Not That! Web site, we rounded up the best foods to munch on when you need a mental boost—and found studies that show, in fact, that you can be up to 200 percent more productive if you make the right eating choices. Stock up on these items to halt mental decline, jog your memory, sharpen your senses, improve your performance, activate your feel-good hormones, and protect your quick-witted sharpness, whether you’re 15, 40—or not admitting to any age whatsoever! FOR SHORT-TERM MEMORYDrink This!: COFFEEFresh-brewed joe is the ultimate brain fuel. Caffeine has been shown to retard the aging process and enhance short-term memory performance. In one study, British researchers found that just one cup of coffee helps improve attention and problem-solving skills. Not That!: ENERGY DRINKS/TOO MUCH COFFEEEver heard of the concept “too much of a good thing”? If you OD on caffeine—too many cups, a jolt of caf from the late afternoon onward, a Red Bull cocktail—it can mess with your shuteye schedule. Sleep is reboot time for your mental computer, and you don’t want to mess with it.FOR LONG-TERM MEMORYEat This!: BLUEBERRIESAntioxidants in blueberries help protect the brain from free-radical damage and cut your risk of Alzheimer’s and Parkinson’s diseases. They can also improve cognitive processing (translation: thinking). Wild blueberries, if you can find them, have even more brain-boosting antioxidants than the cultivated variety, so book that vacation in Maine now. The berries will ripen in July. Not That!: THE UNRIPE AND UNREADYHere’s a cool tip: if your favorite berries are out of season, buy them frozen. The freezer locks in peak flavor and nutrients, so the berries’ antioxidant capacity is maxed out. Those pale, tough, and expensive off-season berries usually ripen on a truck, rather than on the bush, so they’re nutritional imposters compared to the real thing.For more smart shopping tips, point your grocery cart to THIS story and learn how to pick the most delicious and nutritious while controlling your waistline! TO THINK FASTEREat This!: SALMON OR MACKERELIf the Internal Revenue Service picks you for some up-close-and-personal auditing, you’ll want to be on your toes when they vet your deductions list. So put salmon or mackerel on the grocery list. The omega-3 fatty acids found in fatty fishes are a primary building block of brain tissue, so they’ll amp up your thinking power. Salmon is also rich in niacin, which can help ward off Alzheimer’s disease and slow the rate of cognitive decline. Not That!: FULL-FAT ICE CREAMNot all fats are created equal: Beware foods high in saturated fats, which can clog blood vessels and prevent the flow of nutrients and blood to the brain. Ice cream is not a brain-health food. TO ENERGIZE:Eat This!: HIGH-PROTEIN SALAD WITH VINAIGRETTEThe oil in the dressing will help slow down digestion of protein and carbs in the salad, stabilizing blood-sugar levels and keeping energy levels high. Build your salad on a bed of romaine and spinach for an added boost in riboflavin, and add chicken and a hard-boiled egg for more energizing protein. Not That!: PANCAKES OR BAGELSMIT researchers analyzed blood samples from a group of people who had eaten either a high-protein or a high-carbohydrate breakfast. Two hours after eating, the carb eaters had tryptophan levels four times higher than those of the people who had eaten protein. The tryptophan in turkey is one of the reasons you crawl off for an afternoon nap after Thanksgiving dinner. So watch what you gobble.TO CALM DOWNEat This!: LOW-FAT YOGURT OR MIXED NUTSScientists in Slovakia gave people 3 grams each of two amino acids—lysine and arginine—or a placebo, and asked them to deliver a speech. Blood measurements of stress hormones revealed that the amino acid-fortified guys were half as anxious during and after the speech as those who took the placebo. Yogurt is one of the best food sources of lysine; nuts pack loads of arginine. Not That!: SODAA study from the American Journal of Public Health found that people who drink 2½ cans of soda daily are three times more likely to be depressed and anxious, compared with those who drink fewer. So Mountain Dew is a Mental Don’t. TO CONCENTRATEEat This!: PEPPERMINT TEAThe scent of peppermint helps you focus and boosts performance, according to researchers. Need to reach Chicago before nightfall, and you’re stuck in traffic around Cleveland? One study found that peppermint makes drivers more alert and less anxious. Not That!: CANDYSugary foods incite sudden surges of glucose that, in the long term, cause sugar highs and lows, leading to a fuzzy state of mind. So you’ll need to avoid all the attention-busting sugar bombs on this list of the 20 most sugar-packed foods in America. FOR GOOD MOODS AND GRINSEat This! ARUGULA OR SPINACH SALADLeafy greens—arugula, chard, spinach—are rich sources of B vitamins, which are key components on the assembly line that manufactures feel-good hormones such as serotonin, dopamine, and norepinephrine. According to a study published in the Journal of Neuroscience Nursing, a lack of B6 can cause nervousness, irritability, and even depression. Not That!: WHITE CHOCOLATEWhite chocolate isn’t chocolate at all, since it contains no cocoa solids. So it won’t stimulate the euphoria-inducing mood boosters like serotonin, as real chocolate does. Grab the real thing, the darker the better. More cacao means more happy chemicals and less sugar, which will eventually pull you down. FOR SHARPER SENSESEat This!: 1 TBSP OF GROUND FLAXSEED DAILYFlax is the best source of alphalinoleic, or ALA—a healthy fat that improves the workings of the cerebral cortex, the area of the brain that processes sensory information, including that of pleasure. To meet your quota, sprinkle it on salads or mix it into a smoothie or shake. Not That!: ALCOHOLThis one’s obvious, but worth mentioning anyway. A drink or two can increase arousal signals, but more than that will actually depress your nervous system. This makes you sloppy, not sharp.


Work for a Cause, not applause. Live to express, not to impress...

Life is short make it sweet.
Satish

The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.

Sunday, December 20, 2009

A Motivational Story with Wisdom

A Professor stood before his philosophy class and had some items in front of him. When the class began, wordlessly, he picked up a very large and empty mayonnaise jar and proceeded to fill it with golf balls. He then asked the students if the jar was full. They agreed that it was.
So the Professor then picked up a box of pebbles and poured them into the jar. He shook the jar lightly. The pebbles rolled into the open areas between the golf balls. He then asked the students again if the jar was full. They agreed it was.
The Professor next picked up a box of sand and poured it into the jar. Of course, the sand filled up everything else. He asked once more if the jar was full. The students responded with an unanimous "yes."
The Professor then produced two cups of coffee from under the table and poured the entire contents into the jar, effectively filling the space between the grains of sand.
"Now," said the professor, as the laughter subsided, "I want you to recognize that this jar represents your life. The golf balls are the important things--your family, your children, your health, your friends, and your favorite passions - things that if everything else was lost and only they remained, your life would still be full.
The pebbles are the other things that matter like your job, your house, and your car. The sand is everything else -the small stuff.
"If you put the sand into the jar first," he continued, "there is no room for the pebbles or the golf balls. The same goes for life. If you spend all your time and energy on the small stuff, you will never have room for the things that are important to you. Pay attention to the things that are critical to your happiness. Play with your children. Take time to get medical checkups. Take your partner out to dinner. Play another 18.
There will always be time to clean the house and fix the disposal. "Take care of the golf balls first, the things that really matter. Set your priorities. The rest is just sand."
One of the students raised her hand and inquired what the coffee represented. The Professor smiled. "I'm glad you asked.
"It just goes to show you that no matter how full your life may seem, there's always room for a couple of cups of coffee with a friend."

Thursday, December 17, 2009

Customized Java scripts Alerts

Here is the code through which we can override the JavaScript window.Alert() and write our own custom alerts where we can define our own title, text in the button of alert box :
Just we need to follow the below files and enjoy the customzied Javascript Alerts.

CSS Code :
just copy the below code in the "style type="text/css" " tag and "/style"

#alertBox {
position:relative;
width:300px;
min-height:100px;
margin-top:50px;
border:2px solid #000;
background-color:#F2F5F6;
background-image:url(alert.png);
background-repeat:no-repeat;
background-position:20px 30px;
}
#alertBox h1 {
margin:0;
font:bold 0.9em verdana,arial;
background-color:#78919B;
color:#FFF;
border-bottom:1px solid #000;
padding:2px 0 2px 5px;
}
#alertBox p {
font:0.7em verdana,arial;
height:50px;
padding-left:5px;
margin-left:55px;
}
#alertBox #closeBtn {
display:block;
position:relative;
margin:5px auto;
padding:3px;
border:2px solid #000;
width:70px;
font:0.7em verdana,arial;
text-transform:uppercase;
text-align:center;
color:#FFF;
background-color:#78919B;
text-decoration:none;
}

JavaScript Code :

just copy the below code in the javaScript code "
script type="text/javascript"" " tag and "/script"

var ALERT_TITLE = "Oops!";
var ALERT_BUTTON_TEXT = "Ok";
if(document.getElementById) {
window.alert = function(txt) {
createCustomAlert(txt);
}
}
function createCustomAlert(txt) {
d = document;
if(d.getElementById("modalContainer")) return;
mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
mObj.id = "modalContainer";
mObj.style.height = d.documentElement.scrollHeight + "px";
alertObj = mObj.appendChild(d.createElement("div"));
alertObj.id = "alertBox";
if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px";
alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px";
alertObj.style.visiblity="visible";
h1 = alertObj.appendChild(d.createElement("h1"));
h1.appendChild(d.createTextNode(ALERT_TITLE));
msg = alertObj.appendChild(d.createElement("p"));
//msg.appendChild(d.createTextNode(txt));
msg.innerHTML = txt;
btn = alertObj.appendChild(d.createElement("a"));
btn.id = "closeBtn";
btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT));
btn.href = "#";
btn.focus();
btn.onclick = function() { removeCustomAlert();return false; }
alertObj.style.display = "block";
}
function removeCustomAlert() {
document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}

HTML Code :
<input type="button" value = "Test the alert" onclick="alert('This is a custom alert dialog that was created by over-riding the window.alert method.');" />

Monday, November 30, 2009

Interactive Sites on Medical INFO - Very useful

The tutorials listed below are interactive health education resources from the Patient Education Institute. Using animated graphics each tutorial explains a procedure or condition in easy-to-read language. You can also listen to the tutorial. JUST CLICK ON YOUR PREFFERED AILMENT NOTE: These tutorials require a special Flash plug-in, version 6 or above... If you do not have Flash, you will be prompted to obtain a free download of the software before you start the tutorial.
Diseases and Conditions
Abdominal Aortic Aneurysm
Acne
AIDS
Allergies to Dust Mites
Alopecia
Amyotrophic Lateral Sclerosis (ALS)
Angina
Anthrax
Arrhythmias
Arthritis
Asthma
Atrial Fibrillation
Avian Influenza
Back Pain - How to Prevent
Bell's Palsy
Brain Cancer
Breast Cancer
Burns
Cataracts
Cerebral Palsy
Cold Sores (Herpes)
Colon Cancer
Congestive Heart Failure
COPD (Chronic Obstructive Pulmonary Disease)
Crohn's Disease
Cystic Fibrosis
Depression
Diabetes - Eye Complications
Diabetes - Foot Care
Diabetes - Introduction
Diabetes - Meal Planning
Diverticulosis
Endometriosis
Epstein Barr (Mononucleosis)
Erectile Dysfunction
Fibromyalgia
Flashes and Floaters
Fractures and Sprains
Ganglion Cysts
Gastroesophageal Reflux Disease (GERD)
Glaucoma
Gout
Hearing Loss
Heart Attack
Hepatitis B
Hepatitis C
Hypertension (High Blood Pressure)
Hypoglycemia
Incisional Hernia
Influenza
Inguinal Hernia
Irritable Bowel Syndrome
Kidney Failure
Kidney Stones
Leishmaniasis
Leukemia
Low Testosterone
Lung Cancer
Lupus
Lyme Disease
Macular Degeneration
Malaria
Melanoma
Meningitis
Menopause
Migraine Headache
Mitral Valve Prolapse
Multiple Myeloma
Multiple Sclerosis
Myasthenia Gravis
Osteoarthritis
Osteoporosis
Otitis Media
Ovarian Cancer
Ovarian Cysts
Pancreatitis
Parkinson's Disease
Pneumonia
Prostate Cancer - What is it?
Psoriasis
Retinal Tear and Detachment
Rheumatoid Arthritis
Rotator Cuff Injuries
Sarcoidosis
Scabies
Seizures and Epilepsy
Sexually Transmitted Diseases
Shingles
Skin Cancer
Sleep Disorders
Smallpox
Spinal Cord Injury
Temporomandibular Joint Disorders (TMJ)
Tennis Elbow
Tinnitus
Trigeminal Neuralgia
Tuberculosis
Ulcerative Colitis
Umbilical Hernia
Uterine Fibroids
Varicose Veins
Vasculitis
Warts
Tests and Diagnostic Procedures
Amniocentesis
Barium Enema
Bone Densitometry
Breast Lumps - Biopsy
Bronchoscopy
Colonoscopy
Colposcopy
Coronary Angiogram and Angioplasty
CT Scan (CAT Scan)
Cystoscopy - Female
Cystoscopy - Male
Echocardiogram
Echocardiography Stress Test
IVP (Intra Venous Pyelogram)
Knee Arthroscopy
Laparoscopy
Mammogram
MRI
Myelogram
Newborn Screening
Pap Smear
Shoulder Arthroscopy
Sigmoidoscopy
Ultrasound
Upper GI Endoscopy
Surgery and Treatment Procedures
Aorto-Bifemoral Bypass
Cardiac Rehabilitation
Carotid Endarterectomy
Carpal Tunnel Syndrome
Chemotherapy
Cholecystectomy - Open Laparoscopic (Gallbladder Removal Surgery)
Clinical Trials
Colon Cancer Surgery
Colostomy
Coronary Artery Bypass Graft (CABG)
C-Section
Dilation and Curettage (D & C)
General Anesthesia
Heart Valve Replacement
Hemorrhoid Surgery
Hip Replacement
Hip Replacement - Physical Therapy
Hysterectomy
Knee Replacement
LASIK
Massage Therapy
Neurosurgery - What is it?
Open Heart Surgery - What to Expect?
Pacemakers
Preparing for Surgery
Prostate Cancer - Radiation Therapy
Shoulder Replacement
Sinus Surgery
Stroke Rehabilitation
Thyroid Surgery
Tonsillectomy and Adenoidectomy
TURP (Prostate Surgery)
Vaginal Birth
Vasectomy
Prevention and Wellness
Back Exercises
Coumadin - Introduction
Exercising for a Healthy Heart
Managing Cholesterol
Muscles
Preventing Strokes
Smoking - The Facts

Saturday, November 28, 2009

Annotations

Annotation: From English Dictionary, it's the explanation/comments/Remarks/Observations/Notes/Clarifications.

Annotations in Java: 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. As a result, you will have helpful ways to indicate whether your methods are dependent on other methods, whether they are incomplete, whether your classes have references to other classes, and so on.
Pros & cons of Annotations:

Pros :1) Annotations are relatively simple to use and understand.2) Compilation time requires less for annotations when compared to the xml-configurations.3) Annotations are used for flexibility.4) Annotations can be used by the compiler to detect errors or suppress warnings.5) Software tools can process annotation information to generate code, XML files, and so forth.6) Annotations can be applied to a program's declarations of classes, fields, methods, and other program elements.

Cons: Annotations unnecessarily couple the metadata to the code. Thus, changes to metadata require changing the source code. (i.e. when we want to change some configuration , we need to change the source code, where as in the xml -configuration, just need to change the xml file & redeploy it ).
Two things in Annotations:

1) Annotation : An annotation is the meta-tag that you will use in your code to give it some life.

2) Annotation Type: It is used for defining an annotation. used when we need to create our own custom annotation.
Define an Annotation type: In order to define our own custom tag, the following syntax need to be followed. "@" symbol followed by "interface" followed by "Name of the annotations".
Example:
public @interface MyAnnotation {String doSomething();}

Annotate Your Code (Annotation)
We are just supposed to use the name of our annotations & assign some values to the annotation variables.
Example:
MyAnnotation (doSomething="What to do")public void mymethod() {....}
Annotation Types:

There are three annotation types:

Marker: Marker type annotations have no elements, except the annotation name itself. Example: public @interface MyAnnotation {}Usage: @MyAnnotationpublic void mymethod() {....}

Single-Element: 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.Example: public @interface MyAnnotation {String doSomething();}Usage: @MyAnnotation ("What to do")public void mymethod() {....}

Full-value or multi-value: 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();}Usage: @MyAnnotation (doSomething="What to do", count=1,date="09-09-2005")public void mymethod() {....}

Rules to define an Annotation Type.
1) Annotation declaration should start with an 'at' sign like @, following with an interface keyword, following with the annotation name.2) Method declarations should not have any parameters.3) Method declarations should not have any throws clauses.4) Return types of the method should be one of the following:i) primitivesii) Stringiii) Classiv) enumv) array of the above types
Annotation :

Simple annotations : These are the basic types supplied with Tiger, which you can use to annotate your code only; you cannot use those to create a custom annotation type. There are only three types of simple annotations provided by JDK5.

They are:

Override : ( @Override ) throws an error when it some method is not overrided preoperly.
Deprecated: ( @Deprecated ) throws warnings when a method is used which is deprecated.
Suppress warnings: This annotation indicates that compiler warnings should be shielded in the annotated element and all of its sub-elements. @SuppressWarnings({"deprecation
Meta annotations : These are called the annotations-of-annotations
These are:i) Targetii) Retentioniii) Documentediv) Inherited.

The Target annotation : The target annotation indicates the targeted elements of a class in which the annotation type will be applicable. It contains the following enumerated types as its value:@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
The Retention annotation: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 by retained only at the source level and will be ignored by the compilerRetentionPolicy.CLASS—Annotations with this type will be by retained by the compiler at compile time, but will be ignored by the VMRetentionPolicy.RUNTIME—Annotations with this type will be retained by the VM so they can be read only at run-time
The Documented annotation : 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
The Inherited annotation: Automatically all the methods are inherited in the child class.
Ex :@Inheritedpublic @interface myParentObject {boolean isInherited() default true;String doSomething() default "Do what?";}
Next, annotate a class with your annotation:
@myParentObjectpublic Class myChildObject {}

If there were no annotations , we should have written the class in the following way. i.e. we need to implement all the methods
public class myChildObject implements myParentObjectpublic boolean isInherited() {return false;}public String doSomething() {return "";}public boolean equals(Object obj) {return false;}public int hashCode() {return 0;}public String toString() {return "";}public Class annotationType() {return null;}}

Monday, November 23, 2009

Serialization

Serialization is the process of saving an object's state to a sequence of bytes. This byte streams can be stored either in a file or DB or memory.

3 Modes of Serialization in Java:
              1) Implement either Serializable or Externalizable interface.
              2) XML serialization :
              3)  Implement our own serialzation process, i.e. suing objectObjectStream

Deserialization is the process of rebuilding those bytes into a live object.
Why Serialization ???
In Java everything is an object, & these object are supposed to transfer to one server/component/network to other server/component/network if we want to communicate each other.
One way to achieve this is to define our own protocol and transfer an object. This means that the receiving end must know the protocol used by the sender to re-create the object, which would make it very difficult to talk to third-party components. Hence, there needs to be a generic and efficient protocol to transfer the object between components. Serialization is defined for this purpose, and Java components use this protocol to transfer objects.
Steps to Serialize an Object.
1) The object which is to be serialized has to implement a maker interface called Serializable.
2) The marker interface is nothing but a mechanism which tells that the class/object can be serialized.
3) calling the methods writeObject() , & readObject() as per our requirement.
4) No argument constructer should be there for the object.
Java's serialization algorithm


  • Transient variables and Static Variables can't be serailized.
  • Transient variables will have its default values when deserialize them.
  • serialVersionUID is generated using the metadata of the class.
  • you can use tool serialver to see serialVersionUID of a serialized object .
  • java.io.InvalidClassException  will be thrown if there is mismatch with the serialVersionUID
  • if the base is not serializable and derived class is serilzable, then NotSerializableException  is thrown.
Questions :
Q1) What is Serialization?


Ans) Serializable is a marker interface. When an object has to be transferred over a network ( typically through rmi or EJB) or persist the state of an object to a file, the object Class needs to implement Serializable interface. Implementing this interface will allow the object converted into bytestream and transfer over a network.

Q2) What is use of serialVersionUID?

Ans) During object serialization, the default Java serialization mechanism writes the metadata about the object, which includes the class name, field names and types, and superclass. This class definition is stored as a part of the serialized object. This stored metadata enables the deserialization process to reconstitute the objects and map the stream data into the class attributes with the appropriate type

Everytime an object is serialized the java serialization mechanism automatically computes a hash value. ObjectStreamClass's computeSerialVersionUID() method passes the class name, sorted member names, modifiers, and interfaces to the secure hash algorithm (SHA), which returns a hash value.The serialVersionUID is also called suid.

So when the serilaize object is retrieved, the JVM first evaluates the suid of the serialized class and compares the suid value with the one of the object. If the suid values match then the object is said to be compatible with the class and hence it is de-serialized. If not InvalidClassException exception is thrown.



Changes to a serializable class can be compatible or incompatible. Following is the list of changes which are compatible:

• Add fields

• Change a field from static to non-static

• Change a field from transient to non-transient

• Add classes to the object tree

List of incompatible changes:

• Delete fields

• Change class hierarchy

• Change non-static to static

• Change non-transient to transient

• Change type of a primitive field

So, if no suid is present , inspite of making compatible changes, jvm generates new suid thus resulting in an exception if prior release version object is used .

The only way to get rid of the exception is to recompile and deploy the application again.
If we explicitly metion the suid using the statement:

private final static long serialVersionUID =
then if any of the metioned compatible changes are made the class need not to be recompiled. But for incompatible changes there is no other way than to compile again.

Q3) What is the need of Serialization?

Ans) The serialization is used :-

• To send state of one or more object’s state over the network through a socket.

• To save the state of an object in a file.

• An object’s state needs to be manipulated as a stream of bytes.

Q4) Other than Serialization what are the different approach to make object Serializable?

Ans) Besides the Serializable interface, at least three alternate approaches can serialize Java objects:

1)For object serialization, instead of implementing the Serializable interface, a developer can implement the Externalizable interface, which extends Serializable. By implementing Externalizable, a developer is responsible for implementing the writeExternal() and readExternal() methods. As a result, a developer has sole control over reading and writing the serialized objects.

2)XML serialization is an often-used approach for data interchange. This approach lags runtime performance when compared with Java serialization, both in terms of the size of the object and the processing time. With a speedier XML parser, the performance gap with respect to the processing time narrows. Nonetheless, XML serialization provides a more malleable solution when faced with changes in the serializable object.

3)Finally, consider a "roll-your-own" serialization approach. You can write an object's content directly via either the ObjectOutputStream or the DataOutputStream. While this approach is more involved in its initial implementation, it offers the greatest flexibility and extensibility. In addition, this approach provides a performance advantage over Java serialization.

Q5) Do we need to implement any method of Serializable interface to make an object serializable?

Ans) No. Serializable is a Marker Interface. It does not have any methods.

Q6) What happens if the object to be serialized includes the references to other serializable objects?

Ans) If the object to be serialized includes the references to other objects whose class implements serializable then all those object’s state also will be saved as the part of the serialized state of the object in question. The whole object graph of the object to be serialized will be saved during serialization automatically provided all the objects included in the object’s graph are serializable.

Q7) What happens if an object is serializable but it includes a reference to a non-serializable object?

Ans- If you try to serialize an object of a class which implements serializable, but the object includes a reference to an non-serializable class then a ‘NotSerializableException’ will be thrown at runtime.



e.g.

public class NonSerial {

//This is a non-serializable class

}

public class MyClass implements Serializable{

private static final long serialVersionUID = 1L;

private NonSerial nonSerial;

MyClass(NonSerial nonSerial){

this.nonSerial = nonSerial;

}

public static void main(String [] args) {

NonSerial nonSer = new NonSerial();

MyClass c = new MyClass(nonSer);

try {

FileOutputStream fs = new FileOutputStream("test1.ser");

ObjectOutputStream os = new ObjectOutputStream(fs);

os.writeObject(c);

os.close();

} catch (Exception e) { e.printStackTrace(); }

try {

FileInputStream fis = new FileInputStream("test1.ser");

ObjectInputStream ois = new ObjectInputStream(fis);

c = (MyClass) ois.readObject();

ois.close();

} catch (Exception e) {

e.printStackTrace();

}

}

}

On execution of above code following exception will be thrown –

java.io.NotSerializableException: NonSerial

at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java)

Q8) Are the static variables saved as the part of serialization?

Ans) No. The static variables belong to the class and not to an object they are not the part of the state of the object so they are not saved as the part of serialized object.

Q9) What is a transient variable?

Ans) These variables are not included in the process of serialization and are not the part of the object’s serialized state.

Q10) What will be the value of transient variable after de-serialization?

Ans) It’s default value.

e.g. if the transient variable in question is an int, it’s value after deserialization will be zero.

public class TestTransientVal implements Serializable{



private static final long serialVersionUID = -22L;

private String name;

transient private int age;

TestTransientVal(int age, String name) {

this.age = age;

this.name = name;

}



public static void main(String [] args) {

TestTransientVal c = new TestTransientVal(1,"ONE");

System.out.println("Before serialization: - " + c.name + " "+ c.age);

try {

FileOutputStream fs = new FileOutputStream("testTransients.ser");

ObjectOutputStream os = new ObjectOutputStream(fs);

os.writeObject(c);

os.close();

} catch (Exception e) { e.printStackTrace(); }

try {

FileInputStream fis = new FileInputStream("testTransients.ser");

ObjectInputStream ois = new ObjectInputStream(fis);

c = (TestTransientVal) ois.readObject();

ois.close();

} catch (Exception e) { e.printStackTrace(); }

System.out.println("After de-serialization:- " + c.name + " "+ c.age);

}

}



Result of executing above piece of code –

Before serialization: - Value of non-transient variable ONE Value of transient variable 1

After de-serialization:- Value of non-transient variable ONE Value of transient variable 0

Explanation –

The transient variable is not saved as the part of the state of the serailized variable, it’s value after de-serialization is it’s default value.

Q11) Does the order in which the value of the transient variables and the state of the object using the defaultWriteObject() method are saved during serialization matter?

Ans) Yes. As while restoring the object’s state the transient variables and the serializable variables that are stored must be restored in the same order in which they were saved.

Q12) How can one customize the Serialization process? or What is the purpose of implementing the writeObject() and readObject() method?

Ans) When you want to store the transient variables state as a part of the serialized object at the time of serialization the class must implement the following methods –

private void wrtiteObject(ObjectOutputStream outStream)

{

//code to save the transient variables state as a part of serialized object

}

private void readObject(ObjectInputStream inStream)

{

//code to read the transient variables state and assign it to the de-serialized object

}

e.g.

public class TestCustomizedSerialization implements Serializable{
private static final long serialVersionUID =-22L;

private String noOfSerVar;

transient private int noOfTranVar;

TestCustomizedSerialization(int noOfTranVar, String noOfSerVar) {

this.noOfTranVar = noOfTranVar;

this.noOfSerVar = noOfSerVar;

}

private void writeObject(ObjectOutputStream os) {
try {

os.defaultWriteObject();

os.writeInt(noOfTranVar);

} catch (Exception e) { e.printStackTrace(); }

}
private void readObject(ObjectInputStream is) {

try {

is.defaultReadObject();

int noOfTransients = (is.readInt());

} catch (Exception e) {

e.printStackTrace(); }

}
public int getNoOfTranVar() {

return noOfTranVar;

}
}

The value of transient variable ‘noOfTranVar’ is saved as part of the serialized object manually by implementing writeObject() and restored by implementing readObject().

The normal serializable variables are saved and restored by calling defaultWriteObject() and defaultReadObject()respectively. These methods perform the normal serialization and de-sirialization process for the object to be saved or restored respectively.

Q13) If a class is serializable but its superclass in not , what will be the state of the instance variables inherited from super class after deserialization?

Ans) The values of the instance variables inherited from superclass will be reset to the values they were given during the original construction of the object as the non-serializable super-class constructor will run.

E.g.

public class ParentNonSerializable {

int noOfWheels;
ParentNonSerializable(){
this.noOfWheels = 4;
}
}



public class ChildSerializable extends ParentNonSerializable implements Serializable {
 static final long serialVersionUID = 1L;

String color;
ChildSerializable() {
this.noOfWheels = 8;
this.color = "blue";

}

}



public class SubSerialSuperNotSerial {

public static void main(String [] args) {
ChildSerializable c = new ChildSerializable();
System.out.println("Before : - " + c.noOfWheels + " "+ c.color);
try {
FileOutputStream fs = new FileOutputStream("superNotSerail.ser");
ObjectOutputStream os = new ObjectOutputStream(fs);
os.writeObject(c);
os.close();
} catch (Exception e) { e.printStackTrace(); }
try {
FileInputStream fis = new FileInputStream("superNotSerail.ser");
ObjectInputStream ois = new ObjectInputStream(fis);
c = (ChildSerializable) ois.readObject();
ois.close();
} catch (Exception e) { e.printStackTrace(); }
System.out.println("After :- " + c.noOfWheels + " "+ c.color);
}
}

Result on executing above code –

Before : - 8 blue

After :- 4 blue

The instance variable ‘noOfWheels’ is inherited from superclass which is not serializable. Therefore while restoring it the non-serializable superclass constructor runs and its value is set to 8 and is not same as the value saved during serialization which is 4.

Q14) To serialize an array or a collection all the members of it must be serializable. True /False?

Ans) true.

15) What happens to the static fields of a class during serialization?

There are three exceptions in which serialization doesn’t necessarily read and write to the stream. These are

1. Serialization ignores static fields, because they are not part of any particular state.

2. Base class fields are only handled if the base class itself is serializable.

3. Transient fields.

16) What one should take care of while serializing the object?

One should make sure that all the included objects are also serializable. If any of the objects is not serializable then it throws a NotSerializableException.

17) What is serialVersionUID? What would happen if you don't define this?

SerialVersionUID is an ID which is stamped on object when it get serialized usually hashcode of object, you can use tool serialver to see serialVersionUID of a serialized object . serialVersionUID is used for version control of object. you can specify serialVersionUID in your class file also. Consequence of not specifying serialVersionUID is that when you add or modify any field in class then already serialized class will not be able to recover because serialVersionUID generated for new class and for old serialized object will be different. Java serialization process relies on correct serialVersionUID for recovering state of serialized object and throws java.io.InvalidClassException in case of serialVersionUID mismatch.

Thursday, November 19, 2009

Nov 14th 2009 - Celebrations with Children

It was Saturday 14th Nov 2009, Children's Day..
Some of the BoA associates are waiting near 5A parking slot for one more associate whose name is "Madhu". Actually Madhu went to Reliance Mart to buy some snacks to children before time itself. He bought 100 chocolates, 100 Gems packets, some more chocolates & biscuits to the children, As he is the first person in the mart he thought the billing happens with in no time & he can reach the office on time, but the great Reliance Mart guy said that he doesn't option to enter the "quantity " in the billing tool & he has scan each & every item, so in turn he scanned 100 Chocolate, 100 Gems.. etc.. Finally, Madhu reached office along with long long bill along with snacks.
With that long long bill all of us started to BJR school which is in Jubilee Hills. The place we went contains 2 different kinds of environments , one side slum area with no proper drainage , & one more side highly posed "Villas". By seeing that area we can easily get to know all kinds of people & their standing of living. After watching the posh & slum environments , we entered into the school premises.
As soon as we enter, we got sooo many wishes, so many greetings from school children & teachers. After the warm wishes children placed in their places to watch & enjoy the Magic show which is conducted by BoA. The magician is so clever that he carried full of smiles throughout the show. He made all the children to participate in the show. The magician made the show as Fun Learning movements to the children by conduction quiz after the show, where he presented some gifts also to the winners. He thought children about the greatness of non-violence, our culture, & why we are celebrating some festivals like HOLI etc.
After the magic show, Now the fun started with Dance & music which is hidden in children. We spent lot of time with non-stop sprit in the children in dance & songs. almost all children were willing to participate in the dance & songs... Mean while the associates made packing of the snacks to distribute to the children.
After the dance & music the children are asked to take their seats in their respective class rooms. Associates disturbed the snacks ( chocolates, Biscuits , Gems.. ) to the children & sweets to the parent & teachers.
After all these things we have a photos section..
With lots of fun learning happiness in our faces, we returned to our work place.
Here are some glimpse of the cheerful movements ....
http://www.flickr.com/photos/44766037@N03/

http://picasaweb.google.co.in/neetha.jlg/NewFolder03?authkey=Gv1sRgCI_dieWw9JShbA&feat=email#

Tuesday, November 17, 2009

Breathing Therapy

Breathing Therapy
The nose has a left and a right side; we use both to inhale and exhale. Actually they are different; you would be able to feel the difference. The right side represents the sun, left side represents the moon. During a headache, try to close your right nose and use your left nose to breathe. In about 5 mins, your headache will go . If you feel tired, just reverse, close your left nose and breathe through your right nose. After a while, you will feel your mind is refreshed. Right side belongs to 'hot', so it gets heated up easily, left side belongs to 'cold'. Most females breathe with their left noses, so they get "cooled off" faster. Most of the guys breathe with their right noses, they get worked up. Do you notice the moment we wake up, which side breathes faster? Left or right? ? If left is faster, you will feel tired. So, close your left nose and use your right nose for breathing, you will get refreshed quickly. This can be taught to kids, but it is more effective when practiced by adults. My friend used to have bad headaches and was always visiting the doctor. There was this period when he suffered headache literally every night, unable to study. He took painkillers, did not work. He decided to try out the breathing therapy here: closed his right nose and breathed through his left nose. In less than a week, his headaches were gone! He continued the exercise for one month. This alternative natural therapy without medication is something that he has experienced. So, why not give it a try?

P.S: The people who are suffering from cold Asthama can try out this to complete cure. In fact I tried this & now I am free bird of cold...

Some Health Tips Reg : SLEEP

Please read this till the end…Very important take away…

What killed Ranjan Das and Lessons for Corporate India

A month ago, many of us heard about the sad demise of Ranjan Das from Bandra, Mumbai. Ranjan, just 42 years of age, was the CEO of SAP-Indian Subcontinent, the youngest CEO of an MNC in India. He was very active in sports, was a fitness freak and a marathon runner. It was common to see him run on Bandra's Carter Road. Just after Diwali, on 21st Oct, he returned home from his gym after a workout, collapsed with a massive heart attack and died. He is survived by his wife and two very young kids.

It was certainly a wake-up call for corporate India. However, it was even more disastrous for runners amongst us. Since Ranjan was anavid marathoner (in Feb 09, he ran Chennai Marathon at the same time some of us were running Pondicherry Marathon 180 km away), the question came as to why an exceptionally active, athletic person succumb to heart attack at 42 years of age.

Was it the stress?
A couple of you called me asking about the reasons. While Ranjan had mentioned that he faced a lot of stress, that is a common element in most of our lives. We used to think that by being fit, one can conquer the bad effects of stress. So I doubted if the cause was stress.

The Real Reason
However, everyone missed out a small line in the reports that Ranjan used to make do with 4-5 hours of sleep. This is an earlier interview of Ranjan on NDTV in the program 'Boss' Day Out':
http://connect.in.com/ranjan-das/play-video-boss-day-out-ranjan-das-of-sap-india-229111-807ecfcf1ad966036c289b3ba6c376f2530d7484.html
Here he himself admits that he would love to get more sleep (and that he was not proud of his ability to manage without sleep, contrary to what others extolled).

The Evidence
Last week, I was working with a well-known cardiologist on the subject of ‘Heart Disease caused by Lack of Sleep’. While I cannot share the video nor the slides because of confidentiality reasons, I have distilled the key points below in the hope it will save some of our lives.

Some Excerpts:

· Short sleep duration (<5 or 5-6 hours) increased risk for high BP by 350% to 500% compared to those who slept longer than 6 hours per night. Paper published in 2009.
As you know, high BP kills.
· Young people (25-49 years of age) are twice as likely to get high BP if they sleep less. Paper published in 2006.
· Individuals who slept less than 5 hours a night had a 3-fold increased risk of heart attacks. Paper published in 1999.
· Complete and partial lack of sleep increased the blood concentrations of High sensitivity C-Reactive Protein (hs-cRP), the strongest predictor of heart attacks. Even after getting adequate sleep later, the levels stayed high!!
· Just one night of sleep loss increases very toxic substances in body such as Interleukin-6 (IL-6), Tumour Necrosis Factor-Alpha (TNF-alpha) and C-reactive protein (cRP). They increase risks of many medical conditions, including cancer, arthritis andheart disease. Paper published in 2004.
· Sleeping for <=5 hours per night leads to 39% increase in heart disease. Sleeping for <=6 hours per night leads to 18% increase in heart disease. Paper published in 2006.

Ideal Sleep
For lack of space, I cannot explain here the ideal sleep architecture. But in brief, sleep is composed of two stages: REM (Rapid Eye Movement) and non-REM. The former helps in mental consolidation while the latter helps in physical repair and rebuilding. During the night, you alternate between REM and non-REM stages 4-5 times.

The earlier part of sleep is mostly non-REM. During that period, your pituitary gland releases growth hormones that repair your body. The latter part of sleep is more and more REM type.

For you to be mentally alert during the day, the latter part of sleep is more important. No wonder when you wake up with an alarm clock after 5-6 hours of sleep, you are mentally irritable throughout the day (lack of REM sleep). And if you have slept for less than 5 hours, your body is in a complete physical mess (lack of non-REM sleep), you are tired throughout the day, moving like a zombie and your immunity is way down (I’ve been there, done that L)

Finally, as long-distance runners, you need an hour of extra sleep to repair the running related damage.
If you want to know if you are getting adequate sleep, take Epworth Sleepiness Test below.

Interpretation: Score of 0-9 is considered normal while 10 and above abnormal. Many a times, I have clocked 21 out the maximum possible 24, the only saving grace being the last situation, since I don’t like to drive (maybe, I should ask my driver to answer that lineJ)
In conclusion:
Barring stress control, Ranjan Das did everything right: eating proper food, exercising (marathoning!), maintaining proper weight. But he missed getting proper and adequate sleep, minimum 7 hours. In my opinion, that killed him.
If you are not getting enough sleep (7 hours), you are playing with fire, even if you have low stress.
I always took pride in my ability to work 50 hours at a stretch whenever the situation warranted. But I was so spooked after seeing the scientific evidence last week that since Saturday night, I ensure I do not even set the alarm clock under 7 hours. Now, that is a nice excuse to get some more sleep. J

Unfortunately, Ranjan Das is not alone when it comes to missing sleep. Many of us are doing exactly the same, perhaps out of ignorance. Please forward this mail to as many of your colleagues as possible, especially those who might be short-changing their sleep. If we can save even one young life because of this email, I would be the happiest person on earth.