How to reduce the risk of Coronary heart disease ?

To reduce the risk of developing coronary heart disease, the goal is to decrease your overall level of LDL (“bad”) cholesterol.

First lets understand what is cholesterol and the role it plays in our body:

Cholesterol is a soft, waxy substance found among the lipids (fats) in the bloodstream and in all your body’s cells. It’s an important part of a healthy body because it’s used to form cell membranes, some hormones and is needed for other functions. But a high level of cholesterol in the blood — hypercholesterolemia — is a major risk factor for coronary heart disease, which leads to heart attack.

Cholesterol and other fats can’t dissolve in the blood. They have to be transported to and from the cells by special carriers called lipoproteins. There are several kinds, but the ones to focus on are low-density lipoprotein (LDL) and high-density lipoprotein (HDL).

What is LDL cholesterol?

Low-density lipoprotein is the major cholesterol carrier in the blood. If too much LDL cholesterol circulates in the blood, it can slowly build up in the walls of the arteries feeding the heart and brain. Together with other substances it can form plaque, a thick, hard deposit that can clog those arteries. This condition is known as atherosclerosis. A clot (thrombus) that forms near this plaque can block the blood flow to part of the heart muscle and cause a heart attack. If a clot blocks the blood flow to part of the brain, a stroke results. A high level of LDL cholesterol (160 mg/dL and above) reflects an increased risk of heart disease. If you have heart disease, your LDL cholesterol should be less than 100 mg/dL and your doctor may even set your goal to be less than 70 mg/dL. That’s why LDL cholesterol is called “bad” cholesterol. Lower levels of LDL cholesterol reflect a lower risk of heart disease.

What is HDL cholesterol?

About one-third to one-fourth of blood cholesterol is carried by HDL. Medical experts think HDL tends to carry cholesterol away from the arteries and back to the liver, where it’s passed from the body. Some experts believe HDL removes excess cholesterol from plaques and thus slows their growth. HDL cholesterol is known as “good” cholesterol because a high HDL level seems to protect against heart attack. The opposite is also true: a low HDL level (less than 40 mg/dL in men; less than 50 mg/dL in women) indicates a greater risk. A low HDL cholesterol level also may raise stroke risk.

What is Lp(a) cholesterol?

Lp(a) is a genetic variation of plasma LDL. A high level of Lp(a) is an important risk factor for developing atherosclerosis prematurely. How an increased Lp(a) contributes to heart disease isn’t clear. The lesions in artery walls contain substances that may interact with Lp(a), leading to the buildup of fatty deposits.

What about cholesterol and diet?

People get cholesterol in two ways. The body — mainly the liver — produces varying amounts, usually about 1,000 milligrams a day. Foods also can contain cholesterol. Foods from animals (especially egg yolks, meat, poultry, shellfish and whole- and reduced-fat milk and dairy products) contain it. Foods from plants (fruits, vegetables, grains, nuts and seeds) don’t contain cholesterol.

Typically the body makes all the cholesterol it needs, so people don’t need to consume it. Saturated fatty acids are the main culprit in raising blood cholesterol, which increases your risk of heart disease. Trans fats also raise blood cholesterol. But dietary cholesterol also plays a part. The average American man consumes about 337 milligrams of cholesterol a day; the average woman, 217 milligrams.

Some of the excess dietary cholesterol is removed from the body through the liver. Still, the American Heart Association recommends that you limit your average daily cholesterol intake to less than 300 milligrams. If you have heart disease, limit your daily intake to less than 200 milligrams. Still, everyone should remember that by keeping their dietary intake of saturated and trans fats low, they can significantly lower their dietary cholesterol intake. Foods high in saturated fat generally contain substantial amounts of dietary cholesterol.

People with severe high blood cholesterol levels may need an even greater reduction. Since cholesterol is in all foods from animal sources, care must be taken to eat no more than six ounces of lean meat, fish and poultry per day and to use fat-free and low-fat dairy products. High-quality proteins from vegetable sources such as beans are good substitutes for animal sources of protein.

How does physical activity affect cholesterol?

Regular physical activity increases HDL cholesterol in some people. A higher HDL cholesterol is linked with a lower risk of heart disease. Physical activity can also help control weight, diabetes and high blood pressure. Aerobic physical activity raises your heart and breathing rates. Regular moderate-to-vigorous-intensity physical activity such as brisk walking, jogging and swimming also condition your heart and lungs.

Physical inactivity is a major risk factor for heart disease. Even moderate-intensity activities, if done daily, help reduce your risk. Examples are walking for pleasure, gardening, yard work, housework, dancing and prescribed home exercise.

How does tobacco smoke affect cholesterol?

Tobacco smoke is one of the six major risk factors of heart disease that you can change or treat. Smoking lowers HDL cholesterol levels and increases the tendency for blood to clot.

How does alcohol affect cholesterol?

In some studies, moderate use of alcohol is linked with higher HDL cholesterol levels. However, because of other risks, the benefit isn’t great enough to recommend drinking alcohol if you don’t do so already.

If you drink, do so in moderation. People who consume moderate amounts of alcohol (an average of one to two drinks per day for men and one drink per day for women) have a lower risk of heart disease than nondrinkers. However, increased consumption of alcohol brings other health dangers, such as alcoholism, high blood pressure, obesity, stroke, cancer, suicide, etc. Given these and other risks, the American Heart Association cautions people against increasing their alcohol intake or starting to drink if they don’t already do so.  Consult your doctor for advice on consuming alcohol in moderation.

Tips related to heart disease and cholesterol:

Eating a large amount of trans fatty acids raises blood cholesterol and risk of heart disease.

Published in: on January 16, 2010 at 10:53 pm  Leave a Comment  

Vitamins

Vitamin C – Ascorbic acid:

Vitamin C helps body maintain healthy tissues and a strong immune system and aids in the absorption of iron. Vitamin C is considered a powerful ally if you’re trying to avoid or kick a cold or other illness. Together with calcium and iron, it’s also an important part of a diet that counteracts lead poisoning.

The recommended daily allowance (RDA) for adult men is 90 mg.

Oranges:

One medium orange contains 70 mg of vitamin C and 62 calories.

If you prefer it in liquid form, 3/4 cup of orange juice contains 61-93 mg of vitamin C and 79-84 calories.

Guava:

Guava is rich in vitamin C — one half cup of the fruit contains 188 mg of vitamin C and 56 calories.

Red Sweet Pepper:

You probably instantly think citrus when you think of immune system-boosting vitamin C, but red sweet pepper offers a solid dose of the nutrient. One half cup of raw red sweet pepper contains 142 mg of vitamin C and 20 calories. If you cook the veggie, a half cup offers 116 mg of vitamin C.

Green Sweet Pepper:

Green sweet peppers offer 60 mg of vitamin C per half cup, with only 15 calories. When cooked, the vegetable provides 51 mg of vitamin C.

Grapefruit:

Grapefruit juice provides almost the same amount of vitamin C as green peppers: 3/4 cup has 50-70 mg vitamin C and 71-86 calories.

Strawberries:

Strawberries are full of fiber and antioxidants, including vitamin C. A half cup of strawberries contains 49 mg of the vitamin and 27 calories.

Brussels Sprouts:

This veggie is packed with 48 mg of Vitamin C, 300 micro-grams of Vitamin K and just 28 calories.

Cantaloupe: (its that orange fruit .. which is like papaya. You eat this a lot as part of parfait).

One quarter of a medium cantaloupe has 47 mg of vitamin C and 51 calories.

Read more: http://www.thedailygreen.com/healthy-eating/eat-safe/top-sources-vitamin-C-44102808#ixzz0cbMpYCqv

Benefits of Vitamin C:

Read more on the benefits of Vitamin C:

http://www.webmd.com/diet/guide/the-benefits-of-vitamin-c

Published in: on January 14, 2010 at 3:52 pm  Leave a Comment  

How to build muscle – a lame man’s guide

Protein is the building block for muscles and carbs are carriers for the proteins. Then there is fat.

Protein, carbs and fat. Find the correct ratio.

During body building: eat high protein, medium carb, low fat.

A protein is a long train of amino acids linked together. Proteins have different functions; they can provide structure (ligaments, fingernails, hair), help in digestion (stomach enzymes), aid in movement (muscles), and play a part in our ability to see (the lens of our eyes is pure crytalline protein).

Types of fat:

Saturated fats:

Saturated fat is fat that consists of triglycerides containing only saturated fatty acid radicals. Fat that occurs naturally in living matter contains varying proportions of saturated and unsaturated fat. Examples of foods containing a high proportion of saturated fat include dairy products (especially cream and cheese but also butter and ghee), animal fats such as suettallowlardand fatty meatcoconut oilcottonseed oilpalm kernel oilchocolate, and some prepared foods

What are triglycerides ?

To reduce triglycerides, one may reduce consumption of fats, alcohol and carbohydrates, particularly in rice, and engage in aerobic exercise. The American Heart Association notes that diets high in carbohydrates, with carbohydrates consumption amounting to 60 % of the total caloric intake, can increase triglyceride levels.

Unsaturated fats

All about carrots:

The power and goodness of carrots – Carrots have many important vitamins and minerals. They are rich in antioxidants Beta Carotene, Alpha Carotene, Phytochemicals and Glutathione, Calcium and Potassium, and vitamins A, B1, B2, C, and E, which are also considered antioxidants, protecting as well as nourishing the skin. They contain a form of calcium easily absorbed by the body. Finally they also contain Copper, Iron, Magnesium, Manganese, Phosphorous.and Sulphur – better than a wonder drug!!

Carrot can enhance the quality of breast milk. It can improve the appearance of the skin, hair and nails. When taken daily it can lower cholesterol and blood pressure. Raw carrot contains beta-carotene, a strong antioxidant that can prevent cancer. Carrot juice when taken every day prevents bodily infections and is claimed to be valuable for the adrenal glands (the small endocrine glands situated above the kidneys). Carrot can help improve eye health. Carrot can help increase menstrual flow. Carrot can regulate blood sugar. Carrot can promote colon health, because it is rich in fibre.

Carrot is also helpful in the following cases: Obesity, poisoning of the blood, gum disease, insomnia, inflamed kidney, liver, gallbladder, Alzheimer’s disease, colitis, ulcer and painful urination. Carrots are one of the richest sources of Vitamin A. Carotene present in this vegetable gets converted into Vitamin A by our body. It is indeed amazing that a mere 100grams of carrot supplies around 11,000 milligrams of vitamin A.

Other major minerals present in carrot include chlorine, sulphur, phosphorous and magnesium. Chlorine present in carrot is vital for the proper functioning of liver. provides a cleansing and antiseptic effect on the digestive and circulatory systems. The three minerals calcium, phosphorus and magnesium are essential for ensuring the strength of bones. Phosphorus is essential for the health of skin, hair and nerves. The vital magnesium content present in fresh carrot enables mental development, digestion of fats and the metabolism of mineral salts such as calcium, phosphorus, sodium, and potassium. Sulphur also forms a major ingredient of insulin, the hormonal function of which is to convert carbohydrates into energy.

Another nutrient in carrot, which deserves mention is Vitamin E, the muscle vitamin. It promotes the efficiency of the entire muscular system by the effective utilisation of oxygen.

http://www.carrotmuseum.co.uk/nutrition.html

Published in: on December 2, 2009 at 8:16 pm  Leave a Comment  

Comparing Variables (primitives or references)

Sometimes you want to know if two primitives are the same. Just use the == operator.

Sometimes you want to know if two reference variables refer to the same object on the heap. Just use the == operator.

But sometimes you want to know if two objects are equal.  And for that you need the equals method.

The idea of equality for objects depends on the type of object. For example, if two different String objects have the same characters, they are meaningfully equivalent, regardless of whether they are two distinct object on the heap.  But what about a Dog ?

Do you want to treat two Dogs as being equal if they happen to have the same size and weight?  - Probably not.

So whether two different objects should be treated as equal depend on what makes sense for that particular object type.

We will explore the notion of object equality again in later chapters, but for now, we need to understand that the == operator is used only to compare the bits in two variables.

The == operator is used only to compare the bits in the two variables.

Use == to compare two primitives, or to see if two references refer to the same object.

Use equals() method to see if two different objects are equal.

Important point:

The == operator can be used to compare two variables of any kind, and it simply compares the bits.

For example: if (a == b ) looks at the bits in a and b and returns true if the bit pattern is the same ( it doesn’t matter the number of leading zeros it has). That is,

int a = 3;

byte b = 3;

if (a == b) -> evaluates to true.

To see if two references are the same (which means they refer to the same object on the heap) use the == operator.

Sticky Notes:

I always keep my variables private, if you have to see them then you have to talk to my methods.

Remember to finish the last two puzzles. You have to practice these problems. Look at examples which will make you comfortable before you start taking exams.

 

 

Published in: on November 28, 2009 at 11:23 pm  Leave a Comment  

Random Revising

A class is a blue print for an object.

When you write a class, you’re describing how the JVM should make an object of that type. (Telling the JVM how to make an object of that type)

Can every object of that type have different method behavior ?

Every instance of the class has the same methods, but the methods can behave differently based on the value of the instance variables.

Java is pass-by-value. That means pass-by-copy.

You can do cool things with parameters and return types. Now that we’ve seen how parameters and return types work, its time to put them to use: getters and setters.

At this point I am rearing to learn the different return types that can be returned. That is, all the legal ones using polymorphism.

I have also got the glimpse of: different methods with the same name,but with different number and types of parameters. Polymorphism is the name given to it. The compiler or runtime decides this and calls the appropriate method depending on the number and type of the ARGUMENTS being passed. Question: Suppose there are compatible types as parameters to a method, then what are the rules that the compiler or runtime uses to decide which method to invoke ?  This i think is a very good candidate for questions in Java.

Also drive home the point of using getters and setters in a class. How cool those objects will be when they have getters and setters. Getters and setters are the way you get to your instance variables.

Encapsulation:

Exposing our data. Never show your data. Until this important moment, we’ve been committing one of the worst OO faux pas. Exposing our data.

Never leave your data for anyone to just see and even touch them.

Be encapsulated in life!

But you can’t do anything if your instance variables are public.

Instance variables always get a default value. The following are the default values:

integers 0

floating points 0.0

booleans false

references null

Number primitives including char get a value of 0.

 

 

Published in: on November 28, 2009 at 10:59 pm  Leave a Comment  

Objects live in one and only one place – Garbage Collectable Heap

There are two types of variables:

Primitive Variables and

Object references.

Primitive Variables:

char -> 16 bits -> unsigned (0 to 2^16)

byte -> 8 bits -> (-128 to 127)

short -> 16 bits -> (-2^15 to 2^15 – 1)

int -> 32 bits

long -> 64 bits

————-

float -> 32 bits

double -> 64 bits

Think of variables like cups which hold values.

If you are putting a large value into a small cup then you must tell the compiler that you are ok with it. Otherwise it will throw an error.

************************************************************************************************************

There is no such thing as Object variable, there is only an Object reference.

An object reference variable represents a way to access an object.

“A primitive variable is full of bits representing the actual value of the variable”.

“A object variable is full of bits representing a way to get to the variable”.

You use the dot operator on a reference variable to say “use the thing before the dot to get the thing after the dot”. For eg: mydog.bark() -> “means use the object referenced by variable myDog to invoke() the bark() method”.

* A JVM implements the object references.

Published in: on October 13, 2009 at 10:36 pm  Leave a Comment  

Reading Java EE 5: Developing Enterprise Applications.

What is the need for Java EE 5 ?

Helps developers develop:

Distributed

Transactional

Portable

applications that leverage the speed, security, and reliability of server-side technology.

With the Java Platform, Enterprise Edition (Java EE), development of Java enterprise applications has never been easier and faster.

The aim of Java EE 5 platform is to provide developers a powerful set of APIs while reducing development time, reducing application complexity, and improving application performance.

The Java EE 5 platform introduces a simplified programming model.

With Java EE 5 technology, XML deployment descriptors are now optional. Instead, a developer can simply enter information as an annotation directly into a Java source file, and the Java EE server will configure the component at deployment and runtime.

*Note to myself: Learn how to use annotations in Java from Vance’s material.

In the Java EE platform, dependency injection can be applied to all resources that a component needs, effectively hiding the creation and lookup of resources from the application code.

Dependency injection can be used in EJB containers, web containers, and application clients.

Dependency injection allows the Java EE container to automatically insert references to other required components or resources using annotations.

The Java Persistence API is new to the Java EE 5 platform. The Java Persistence API provides an object/relational mapping for managing relational data in enterprise beans,  web components, and application clients. It can also be used in Java SE applications, outside of the Java EE environment.

The Java EE 5 tutorial uses examples to describe the features and functionalities available in the Java EE 5 platform for developing enterprise applications.

## Java EE Application Model

The Java EE application model begins with the Java programming language and the Java virtual machine.

The proven portability, security, and developer productivity they provide forms the basis of the application model.

Published in: on October 12, 2009 at 5:37 am  Leave a Comment  

Books to Get

HeadFirst SQL

HeadFirst HTML, CSS & XHTML

HeadFirst AJAX

MySql

Understanding Object Oriented programming with Java. – Timothy Budd.

Published in: on October 9, 2009 at 10:34 pm  Leave a Comment  

What You can Do with DD ?

Besides mapping URL’s to actual servlets, you can use the DD to customize other aspects of your web application:

Security roles

Error pages

Tag libraries

initial configuration information

And, if its a full J2EE server, you can even declare that you’ll be accessing specific enterprise javabeans.

DD gives you a way to declaratively modify your application without changing source code.

DD benefits:

Lets you adapt your application to different resources(like databases), without having to recompile and test any code.

Makes it easier for you to maintain dynamic security info like access control lists and security roles.

** Container has a specific place to look for all servlets for which you’ve specified a mapping in the DD.

In fact, the Container uses a sophisticated set of rules for finding a match between the URL that comes in from the client request

Published in: on October 9, 2009 at 10:32 pm  Leave a Comment  

Everything about the Container

What does the container give you ?

We know that it’s the Container that manages and runs the servlet, but why? Is it worth the extra overhead ?

The container provides an easy way for your servlets to talk to the web server.

You don’t have to build a ServerSocket, listen on a port, create streams, etc.

The Container knows the protocol between the web server and itself, so that your servlet doesn’t have to worry about the API between the Apache Web Server and your web application code.  All you have to worry about is your business logic that goes in your Servlet (like accepting an order from your online store).

Lifecycle management: The container controls the life and death of your servlets. It takes care of loading the classes, instantiating and initializing the servlets, invoking the servlet methods, and making servlet instances eligible for garbage collection. With the Container in control, we don’t have to worry as much about resource management.

Multithreading Support: The Container automatically creates a new Java thread for every servlet request it receives. When the servlet’s done running the HTTP service method for that client’s request, the thread completes.

Declarative Security: With a Container, you get to use an XML deployment descriptor to configure(or modify) security without having to hard-code it into your servlet class code. You can manage and change your security without touching and recompiling your Java source files.

JSP support: We already know how cool JSP’s are. Well, who do you think takes care of translating that JSP code into real JAVA? -> The Container.

How the Container handles a request ?

User clicks a link that has a URL to a servlet instead of a static page.

The Container “sees” that the request is for a servlet, so the container creates two objects:

HttpServletRequest

HttpServletResponse

3.) The Container finds the correct servlet based on the URL in the request, creates or allocates a thread for that request and passes the request and response objects to the servlet thread.

4.) The Container then calls the Servlet’s service method.

5.) The doGet() method generates the dynamic page and stuffs the page into the response object. Remember, the container still has a reference to the response object!

6.) The thread completes, the container converts the response object into an HTTP response, sends it back to the client, then deletes the request and response objects.

The Container creates a new Java thread for every servlet request it receives.

Note: This prompts me to understand JVM process and class loading in bit more detail. What does it mean when we say loading the classes ?? I want to understand this completely.

*After creating the HttpServletRequest and HttpServletResponse objects, the container creates a servlet thread.

* The container finds the correct servlet based on the URL in the request, creates or allocates a thread for that request, and passes the request and response objects to the servlet thread.

* So its the container which creates a thread to handle the request, response object(which are also created by the container when a request arrives).

*So the container does the following:

- When the container sees that the request is for a servlet (instead of a static page), it creates two objects: HttpServletRequest, HttpServletResponse

- Next the container finds the correct servlet based on the URL in the request, creates or allocates a thread for that request, and passes the request and response objects to the servlet thread.

- The container calls the servlet’s service() method. Depending on the type of request, the service() method calls either the doGet() or doPost() method.

- The doGet() method generates the dynamic page and stuffs the page into the response object.

- The thread completes, the container converts the response object into a HTTP response, sends it back to the client, then deletes the request and response objects.

Thus, Container helps in creating a request, response objects to send back to the client.  The life and death of the servlet thread is maintained by the container.

# You are wondering how the Container found the Servlet ?

Somehow, the URL that comes in as part of the request from the client is mapped to a specific servlet on the server.

This mapping of URLs to servlets might be handled in a number of different ways, and it’s one of the most fundamental issues you’ll face as a web app developer.

*The user request must map to a particular servlet, and it’s up to you to understand and (usually) configure that mapping.

How ?

A SERVLET CAN HAVE THREE NAMES:

A servlet has a file path name, obviously, like classes/registration/SignUpServlet.class (a path to an actual class file).

The original developer of the servlet class chose the class name, and the location on the server defines the “file path name”.

But anyone who deploys the servlet can also give it a special “deployment name” – A deployment name is simply a secret internal name that doesn’t have to be same as the class or file name.

Finally, the servlet has a public URL name – the name the client knows about.

Using the Deployment Descriptor to map URl’s to servlets:

When you deploy your servlet into your web container, you’ll create a fairly simple XML document called the Deployment Descriptor to tell the Container how to run your servlets and JSPs.

Although you’ll use the DD for more than just mapping names, you’ll use two XML elements to map URL’s to servlets – one to map the client-known public URL name to your internal name, and the other to map your own internal name to a fully-qualified class name.

The <servlet> element tells the container which class files belong to a particular web application.

Published in: on October 6, 2009 at 11:49 pm  Leave a Comment  
Follow

Get every new post delivered to your Inbox.