Saturday, August 31, 2013

LifeStyle: All About Hair Fall and Home Remedies to stop it

Hair loss is known as Khalitya Paalitya in Ayurveda. According to Ayurveda, People who have excess Pitta in their body are likely to lose their hair early in life, or have prematurely thin or gray hair.

Excess Pitta in the sebaceous gland, at the root of the hair, or folliculitis can lead to hair loss.


Human hair naturally grows in three phases:


1. Anagen – Anagen is the active or growing phase.


2. Catagen – Catagen is a short phase of the natural hair cycle during which hairs begin to break down.


3. Telogen – Telogen is the resting phase. The hairs that are shed daily are often in the resting or late phase in the hair cycle.


Normally, about 10% of the scalp hairs are in the resting or telogen phase at any time. These hairs are not growing and are getting prepared for cyclic shedding.


The human scalp has around 1, 00,000 – 1, 50,000 hair follicles.

Each follicle grows a hair continuously up to age 8.


The average scalp has up to 150,000 hairs.

Each follicle produces a single hair that grows at a rate of half an inch per month.

After growing for two to six years, hair rests awhile before falling out.

It is soon replaced with a new hair, and the cycle begins again.

At any given time, 85% of hair is growing, and the remainder is resting.


Most people lose anywhere from 50 to 100 strands of hair each day, according to the American Academy of Dermatology


Hair loss is common in Women too.


Like men, females also face hair loss problem.


The following is a list of drugs known to cause hair loss in certain cases:

Side effect of drugs that may cause hair loss for more information you can ask your doctor.


1. Cholesterol-lowering drug: clofibrate (Atromis-S) and gemfibrozil (Lopid)


2. Parkinson Medications:levodopa (Dopar, Larodopa)


3. Ulcer drugs:cimetidine (Tagamet), ranitidine (Zantac) and famotidine (Pepcid)


4. Anticoagulents: Coumarin and Heparin


5. Agents for gout:Allopurinol (Loporin, Zyloprim)


6. Antiarthritics:penicillamine, auranofin (Ridaura), indomethacin (i\Indocin), naproxen (Naprosyn), sulindac (Clinoril), and methotrexate (Folex)


7. Drugs derived from vitamin-A:isotretinoin (Accutane) and etretinate (Tegison)


8. Anticonvulsants for epilepsy:trimethadione (Tridione)


9. Antidepressants:tricyclics, amphetamines


10. Beta blocker drugs for high blood pressure:atenolol (Tenormin), metoprolol (Lopressor), nadolol (Corgard), propranolol (Inderal) and timolol (Blocadren)


11. Antithyroid agents: carbimazole, Iodine, thiocyanate, thiouracil,


12. Blood thinners, male hormones (anabolic steroids)


13. Cancer treatments


What is PH balance shampoo?


In advertisements popular shampoo brands use the term PH balanced shampoo so what is the meaning of pH balanced shampoo?


pH is a scale from 0 to 14, which measures the acidity or alkalinity of a solution.

Solutions with a pH less than 7 are acidic,

pH more than 7 are alkaline.

Solutions with a pH of 7 are considered neutral.

The natural pH of hair is around 5.5.

At this pH, the hair is the strongest

If a solution, which is either acidic or alkaline, is applied to hair, it will become weaker. Any chemical with a pH of more than 10, or less than 0 will severely damage hair.


Thus, balance of pH is very important in shampoo.


Everyone who is suffering from hair loss or facing baldness knows in his heart he got the problem and problem is visible to everyone.


For us important is home remedies, which will help to stop hair loss, stop growing baldness, or keep in control the hair loss and baldness.


What is dandruff?


In short, it is a condition where the skin cells on the scalp go into over drive and are produced in excess, which gives rise to irritation and itching.

Dandruff is a condition where the skin cells on the scalp are produced in excess.

One can get dandruff on parts of your body other than your scalp, like your forehead, eyebrows, eyelashes, or ears.

Dandruff does not directly cause hair loss,

but scratching scalp a lot could cause hair loss.

Following are the few reasons of hair loss and baldness


1) Hereditary or Hair loss that is genetic is known as androgenetic alopecia


2) old age


3) Protein deficiency


4) Vitamin deficiency e.g. Deficiency of vitamin B12


5) Anemia


6) Hormonal imbalance


7) Iron deficiency occasionally produces hair loss


8) Tensions or Stress can cause hair loss


9) Unhealthy Scalp – Skin conditions that lead to hair loss include seborrheic dermatitis (dandruff), psoriasis, and fungal infections such as ringworm.


10) Thyroid abnormalities


11) High doses of Vitamin A, blood pressure medications, Gout medications can also cause hair loss


Following are the home remedies, which will help to stop hair loss, start hair re growth, stop growing baldness, and increasing hair fall and hair loss.


For every person the reason for hair loss is different so one should try all the home remedies and keep watch on allergies when you will try home remedies.


1) Hair loss reason DHT or Dihydrotestosterone. Most effective preventative treatments are anti-androgens, drugs that prevent the creation of DHT.


2) Hair loss reason – Hereditary – Reduce the hair loss by applying minoxidil (Rogaine) to the scalp twice a day. Women should not use minoxidil if they are pregnant or nursing. Men may be treated with finasteride (Propecia), an oral medication.


3) Avoid Pitta-aggravating foods like spicy, and oily foods,


4) Avoid or reduce consumption of tea and coffee.


5) Avoid refined foods


6) Avoid refined sugar


7) Avoid junk food


8) Avoid alcoholic drink


9) Avoid carbonated drinks


10) Start eating green leafy vegetables


11) Start drinking vegetable juices prepared from lettuce, carrot, capsicum, and alfalfa.


12) Mix Indian gooseberry (amla) and sesame seeds in equal amounts. Take 1 teaspoon twice a day with water.


13) Heat 500 milliliters of coconut oil in a pan, and add 8 amla cut into pieces. Heat until the amla turn dark brown or black. Use the oil for a hair massage 2-3 times a week.


14) Take 2 cup of curry leaves and grind them with 2 cup of buttermilk. Apply this to the hair for 1 hour, and then wash the hair


15) boil some henna leaves in mustard oil. After cooling and straining this preparation, mix it in a coconut oil and start using this oil.


16) wash the hair with a paste made from Neem leaves helps stop hair loss.


17) washing the hair with apple cider vinegar reduces hair fall.


18) Applying Curd to hair helps reduce dandruff.


19) Do not brush the hair when it is wet. Let them dry.


20) Start washing hairs with Aritha and Shikakai Powder. It does not have any chemicals or any other side effects. Aritha and Shikakai powder is available at any kirana store or general store.


21) Do not use too hot water for hairs and scalp. It can damage the roots and may increase dandruff.


22) Avoid using appliances that overheat your hair. Set your hair dryer on cool and low settings


23) To stop hair fall, massage your scalp with fingers gently


24) Always wear a cap with brim or a scarf to protect from sunlight


25) always use a swimming cap or at least shampoo your hair after swimming.


26) Apply coconut milk all over the scalp and massaging gently into the hair


27) Apply juice of green coriander leaves on the head


28) Apply Amla Oil, start using Amla Oil = to prepare amla oil, put some dry pieces of amla in coconut oil and bring to a boil and oil is ready for use.


29) Brahmi and Bhringraj oil massage reduces or stops hair loss.


30) Boil fresh neem leaves in water for an hour. Strain the water and let it cool. Wash hair with this neem leaves water.


31) Boil curry leaves with coconut oil until leaves turn black. Strain the oil, and store in a bottle and use this oil for massage daily.


32) Take 1-cup amla juice and 1-cup lemon juice mix it and apply it to hair, scalp and then wash the hairs.


33) Hair loss – reason iron deficiency – start eating spinach every day or start iron pills with the advice of doctor. Eat iron-rich foods such as beef, pork, fish, leafy greens, fortified cereals, and beans


34) Zinc also helps stop hair loss so start eating wholegrain flour


35) Eat food, which contains vitamin B, Vitamin C, Vitamin E.


36) Copper stops hair loss – Start eating nuts cashews and peanuts, seeds, whole milk and beans


37) Start eating almonds


38) Apply almond oil on scalp and massage


39) Massage warm castor oil mixed with almond oil into your scalp gently. Wrap a hot towel around your scalp so it gets absorbed into the hair. Do this 2 or 3 times a week


40) Grind fenugreek seeds in water and apply on your scalp. Wash off after 30 minutes or 1 hour. Do it for 1 month and helps you do it every day until full satisfaction.


41) Start eating Amla or drinking Amla Juice.


42) Using a 5% tea tree oil shampoo may reduce dandruff and that itchy feeling.


43) Dandruff – Massage the Scalp with pure coconut oil or apply lemon juice to scalp before washing hair.


44) Ketoconazole fights dandruff-causing fungus.


45) Dandruff – Salicylic acid gets rid of flaky skin but can be drying.


46) Dandruff – Selenium sulfide slows the buildup of dead skin cells and fights fungi.


47) Dandruff – Tar slows dead skin cell buildup, but may discolor blonde, gray, or color-treated hair.


48) Aloe. Using aloe on the scalp may help reduce itchiness and scaliness.


49) Zinc pyrithione attacks the fungi that may cause dandruff.


50) Lemongrass shampoo. Washing with a 2%, lemongrass shampoo may help fight fungus that causes dandruff.


51) Best foods for hairs =Salmon, walnuts, Oysters, egg, milk, sweet potato, spinach, lentils, yogurt , blueberries, Kiwis, tomatoes, strawberries, lemon, amla


52) Coconut oil, rosemary oil, brahmi and bhringraj oil, vitamin E oil all these oils are best for hair scalp massage always massage gently.


53) Start drinking Aloe Vera juice.


54) Applying Aloe Vera extract to your scalp can greatly reduce the hair fall and help regrowth of the hair.


55) Garlic and onion – help stop hair fall and regrowth Star using herbal oils which contain garlic or onion extract.


56) To slow down hair loss you can try These medications like Minoxidil, Propecia, and Avodart and prostaglandin analogs


57) Try multivitamin Tablets, which contain zinc, vitamin B, folate, iron, and calcium, Vitamin D, Vitamin C or try combination of vitamin pills.


58) White hair – Take a tablespoon of amla and almond oil. Mix few drops of limejuice to it and apply on your scalp.


59)

White hair – apply mixture of limejuice, amla juice, and almond oil. To make the mixture take 4 tablespoon of almond oil, 1 tablespoon of amla and lemon juice. Gently massage on scalp and leave for 1 hour.


60) Rubbing left and right hand’s fingernails with each other is a powerful technique for curing hair fall and increasing hair growth. 4 fingernails of right hand and left hand rub them each other. Thumb fingernails of left and right hand are not rubbed on each other. Fold both your palms inwards and place the fingernails of both hands against each other. Then with regular swift motions, rub them against each other. It is free of cost and you can do it any time anywhere while watching TV or listening music, do it daily 5 to 20 minutes everyday twice.

Don’t rub your thumbnails because it will accelerate the growth of beard, moustache or facial hairs.



LifeStyle: All About Hair Fall and Home Remedies to stop it

Thursday, August 29, 2013

Poem : Aaj fir school jaane ko dil karta hai

Cute Indian Girls

Aaj fir school jaane ko dil karta hai…


subah-subah jaldi uth kr nahane ko dil karta hai,

school dress pahan kr tie lagane ko dil karta hai,


Aaj firr… Line me lagkar prayer karne ko dil karta hai,

Ek dusre ko dhakka de aage badhne ko dil karta hai,


Aaj firr… Class ke khali period me kagaj ke aeroplane udane ko dil karta hai,

Lunch time me ek dusre ka tifin kahne ko dil karta hai,


Aaj firr… Class me mam ke questions puchne par chup chap khade hone ka dil karta hai,

Home work na karne aur dher sare bahane banana ka dil karta hai,


Aaj firr… Social science ke period me sone ka dil karta hai,

Chutti ke intezar me bell bajne ka dil karta hai,


Aaj firr… Un dosto ke sath baate karne aur ladne jhagdne ka dil karta hai,

Sab kuch bhool jaankar mast hone ka dil karta hai,


Aaj fir school jaane ka dil karta hai ……



Poem : Aaj fir school jaane ko dil karta hai

Wednesday, August 28, 2013

LifeStyle: 9 Fruits You Can Use to Replace Medications

 9 Fruits for medication


Apricot


Apricots contain beta-carotene which stops radicals from damaging the inner structures of the organism and it is also very useful for our eyes. In our body, the beta-carotene form the A vitamin which prevent from developing a series of cancer diseases, especially the skin cancer. One fruit contain 17 calories 1 gram of carbohydrates and does not contain any fats.


Apricots are an excellent source of beta-carotene and are useful in reducing infections or skin problems. They are a good source of iron and potassium. Fresh juice of apricot leaves is useful in skin diseases. It can be applied with beneficial results in scabies, eczema, sun burn and itching of the skin due to cold exposure. Apricots have an alkaline reaction in the system. They aid the digestion, if consumed before a meal. The fruit is highly valued as a gentle laxative and is beneficial in the treatment of constipation. The fresh juice of apricots, when mixed with glucose or honey forms a very cooling and soothing drink during fevers. Its many benefits include quenching the thirst, and eliminating waste products from the body. In addition, it tones up the eyes, stomach, liver, heart and nerves by supplying minerals and vitamins.


Advice: Try to buy apricots while there are still hard (green). When the apricots become soft, they begin to loose their nourishing properties.


Avocados


The oleic acid and the unsaturated fats containing in this fruit decrease the level of cholesterol and increase the quantity of high density lipoproteins. Beside that avocado contain a large quantity of cellulose, iron and vitamin C. One piece contains 81 calories, 8 grams of fats and 3 grams of carbohydrates. In order to fasten the ripping process put avocados in a closed plastic bag with an apple or a banana.


Advice: Try to replace the mayonnaise in your sandwiches with pieces of avocado.


Raspberries


Raspberries contain the ellagic acid which helps decrease the growth of cancer cells. These berries also contains the C vitamin, decrease the level of cholesterol and the probability of cardiovascular diseases. Rich in vitamin C, folate, iron and potassium, raspberries also provide high amounts of insoluble fiber (thanks to all those little seeds) as well as respectable amounts of the soluble fiber pectin, which helps control cholesterol levels.


Raspberries contain a large amount of cellulose. Since cooking does not destroy these compounds, raspberry jam may also be beneficial. Raspberry is one of the few fruits whose consumption would not have much effect on the body’s blood sugar levels. A glass of Raspberries contains 60 calories, 1 gram of fats and 8 grams of carbohydrates.


Advice: A natural face mask made raspberries helps protect against the suns rays. Vitamin C’s antioxidant powers help fade age spots and discoloration. It also rounds out the skin to fill in minor wrinkles.


Mango


A middle-sized mango fruit contains 57 milligrams of C vitamin which constitutes the daily norm for a human’ nourishment. This antioxidant helps to prevent the arthritis, is used in wounds recovery and enforces the immunity system. Pregnant women and people with anaemia are advised to eat this fruit regularly. It is also valuable to combat acidity and poor digestion. Mango also contains the A vitamin. One fruit of mango has 135 calories, 1 gram of fats and 4 grams of carbohydrates.


Advice: Some varieties do not turn red, orange or yellow. If buying these green varieties, look for other signs they are ripe such as a nice sweet fragrance. They should yield nicely to a light press with the fingertip. If they are brought unripe, they can be put in a paper bag in a warm place and they will ripen in a day or two.


Cantaloupe


Contain vitamin C (117 milligrams of C vitamin is contained in a half of cantaloupe – a double daily norm) and beta-carotene which stops the radicals from damaging the inner structures of the organism. It also contains 853 milligrams of potassium, which is twice more than in a banana. Potassium decreases the blood pressure. Cantaloupe has antioxidants that help us fight with heart diseases, high blood pressure, diabetes, cancer, aging, etc. Cantaloupe is also a very good source of potassium, vitamin B6, dietary fiber and niacin (vitamin B3). A half of cantaloupe contains 97 calories 1 gram of fats, 2 grams of carbohydrates. Cantaloupe is beneficial for arthritis, obesity, fever, rheumatism, skin diseases, high blood pressure, abdominal and stomach gas and many other diseases.


Advice: When choosing cantaloupe, choose a fully ripened melon, because according to research as fruits fully ripen, almost to the point of spoilage their antioxidant levels actually increase.


Cranberries


Helps to combat the infections in the urinary bladder, stop the in growing number of bacteria. Cranberry juice can inhibit the aggregation of bacteria that cause dental plaque and based on evaluation of several vitro screening tests, it has been suggested that the proanthocyanidin compounds found in cranberry may exhibit some anti-carcinogenic activity. Some medical professionals and specialists believe that quinic acid abundant in cranberry may help to prevent the development of kidney stones. Recent scientific research shows that cranberries and cranberry products contain significant amounts of antioxidants and other phytonutrients that may help protect against heart disease, cancer and other diseases. In some people, regular cranberry juice consumption for months can kill the H. pylori bacteria, which can cause stomach cancer and ulcers. Drinking cranberry juice daily may increase levels of HDL, or good cholesterol and reduce levels of LDL, or bad cholesterol. A cup of cranberry juice contains 144 calories. There are no fats or carbohydrates.


Advice: Buy a 100% cranberry juice and add water without sugar.


Raisins


These little pearls- are the main resource of iron which helps to transmit the oxygen to tissues. The phytonutrients and olenolic acid present in raisins makes them beneficial for the health of teeth and gums. Having antioxidant properties, raisins help keep the blood clean and flowing, by getting rid of al the impurities. Raisins are believed to be good for bone density and have been associated with lower risk of osteoporosis in women. Studies claim that raisins contain additional nutritive compounds that can protect against heart disease and colon cancer. A half cup of Raisins contains 218 calories, 3 grams of carbohydrates. It does not contain fats.


Advice: Raisins are a good source of fiber and can help cure constipation. For the purpose, boil raisins in a saucepan of water, strain the liquid and drink it. Every morning try to add little raisins in your cereals.


Fig


The fig is a source of potassium and carbohydrates, it also contains the vitamin B6, which is responsible for the serotonyne – “hormone of pleasure”; it decreases the amount of cholesterol. One fig contains 37-48 calories, 2 grams of carbohydrates, 0 fats. Figs are high in natural and simple sugars, minerals and fiber. They contain good levels of potassium, calcium, magnesium, iron, copper and manganese. Dried figs contain an impressive 250mg of calcium per 100g, compared to whole milk with only 118mg. Dried figs consist from about 60% of sugar, contain a lot of vitamins and it is said that humans could live on figs only.


Advice: Eat dries figs as a healthy energy snack. For extra flavor and nutrients, stuff them with nuts and a little honey.


Lemon


Lemon contains limonene (click here to read more about LIMONENE) and C vitamin which help to prevent cancer. It has a limited number of calories and does not contain carbohydrates or fats. You must know that citrus fruits in general may have a great benefit over our body; citruses are useful for your skin, bones and heart; it’s a well-known fact that citruses are great eyesight defenders and mood enhancers.



LifeStyle: 9 Fruits You Can Use to Replace Medications

MARRIED OR NOT, YOU SHOULD READ THIS...

Relationship: You n Me


I have read this some where on net and wanted to share it…


“When I got home that night as my wife served dinner, I held her hand and said, I’ve got something to tell you. She sat down and ate quietly. Again I observed the hurt in her eyes.

Suddenly I didn’t know how to open my mouth. But I had to let her know what I was thinking. I want a divorce. I raised the topic calmly. She didn’t seem to be annoyed by my words, instead she asked me softly, why?

I avoided her question. This made her angry. She threw away the chopsticks and shouted at me, you are not a man! That night, we didn’t talk to each other. She was weeping. I knew she wanted to find out what had happened to our marriage. But I could hardly give her a satisfactory answer; she had lost my heart to Jane. I didn’t love her anymore. I just pitied her!

With a deep sense of guilt, I drafted a divorce agreement which stated that she could own our house, our car, and 30% stake of my company. She glanced at it and then tore it into pieces. The woman who had spent ten years of her life with me had become a stranger. I felt sorry for her wasted time, resources and energy but I could not take back what I had said for I loved Jane so dearly. Finally she cried loudly in front of me, which was what I had expected to see. To me her cry was actually a kind of release. The idea of divorce which had obsessed me for several weeks seemed to be firmer and clearer now.

The next day, I came back home very late and found her writing something at the table. I didn’t have supper but went straight to sleep and fell asleep very fast because I was tired after an eventful day with Jane. When I woke up, she was still there at the table writing. I just did not care so I turned over and was asleep again.

In the morning she presented her divorce conditions: she didn’t want anything from me, but needed a month’s notice before the divorce. She requested that in that one month we both struggle to live as normal a life as possible. Her reasons were simple: our son had his exams in a month’s time and she didn’t want to disrupt him with our broken marriage.

This was agreeable to me. But she had something more, she asked me to recall how I had carried her into out bridal room on our wedding day. She requested that every day for the month’s duration I carry her out of our bedroom to the front door ever morning. I thought she was going crazy. Just to make our last days together bearable I accepted her odd request.

I told Jane about my wife’s divorce conditions. . She laughed loudly and thought it was absurd. No matter what tricks she applies, she has to face the divorce, she said scornfully.

My wife and I hadn’t had any body contact since my divorce intention was explicitly expressed. So when I carried her out on the first day, we both appeared clumsy. Our son clapped behind us, daddy is holding mommy in his arms. His words brought me a sense of pain. From the bedroom to the sitting room, then to the door, I walked over ten meters with her in my arms. She closed her eyes and said softly; don’t tell our son about the divorce. I nodded, feeling somewhat upset. I put her down outside the door. She went to wait for the bus to work. I drove alone to the office.

On the second day, both of us acted much more easily. She leaned on my chest. I could smell the fragrance of her blouse. I realized that I hadn’t looked at this woman carefully for a long time. I realized she was not young any more. There were fine wrinkles on her face, her hair was graying! Our marriage had taken its toll on her. For a minute I wondered what I had done to her.

On the fourth day, when I lifted her up, I felt a sense of intimacy returning. This was the woman who had given ten years of her life to me. On the fifth and sixth day, I realized that our sense of intimacy was growing again. I didn’t tell Jane about this. It became easier to carry her as the month slipped by. Perhaps the everyday workout made me stronger.

She was choosing what to wear one morning. She tried on quite a few dresses but could not find a suitable one. Then she sighed, all my dresses have grown bigger. I suddenly realized that she had grown so thin, that was the reason why I could carry her more easily.

Suddenly it hit me… she had buried so much pain and bitterness in her heart. Subconsciously I reached out and touched her head.

Our son came in at the moment and said, Dad, it’s time to carry mom out. To him, seeing his father carrying his mother out had become an essential part of his life. My wife gestured to our son to come closer and hugged him tightly. I turned my face away because I was afraid I might change my mind at this last minute. I then held her in my arms, walking from the bedroom, through the sitting room, to the hallway. Her hand surrounded my neck softly and naturally. I held her body tightly; it was just like our wedding day.

But her much lighter weight made me sad. On the last day, when I held her in my arms I could hardly move a step. Our son had gone to school. I held her tightly and said, I hadn’t noticed that our life lacked intimacy. I drove to office…. jumped out of the car swiftly without locking the door. I was afraid any delay would make me change my mind…I walked upstairs. Jane opened the door and I said to her, Sorry, Jane, I do not want the divorce anymore.

She looked at me, astonished, and then touched my forehead. Do you have a fever? She said. I moved her hand off my head. Sorry, Jane, I said, I won’t divorce. My marriage life was boring probably because she and I didn’t value the details of our lives, not because we didn’t love each other anymore. Now I realize that since I carried her into my home on our wedding day I am supposed to hold her until death do us apart. Jane seemed to suddenly wake up. She gave me a loud slap and then slammed the door and burst into tears. I walked downstairs and drove away. At the floral shop on the way, I ordered a bouquet of flowers for my wife. The salesgirl asked me what to write on the card. I smiled and wrote, I’ll carry you out every morning until death do us apart.

That evening I arrived home, flowers in my hands, a smile on my face, I run up stairs, only to find my wife in the bed -dead. My wife had been fighting CANCER for months and I was so busy with Jane to even notice. She knew that she would die soon and she wanted to save me from the whatever negative reaction from our son, in case we push through with the divorce.— At least, in the eyes of our son—- I’m a loving husband….


The small details of your lives are what really matter in a relationship. It is not the mansion, the car, property, the money in the bank. These create an environment conducive for happiness but cannot give happiness in themselves.


So find time to be your spouse’s friend and do those little things for each other that build intimacy. If you are not in a relationship now, remember this for the second (or third) time around. It’s never too late.


If you don’t share this, nothing will happen to you.


If you do, you just might save a marriage. Many of life’s failures are people who did not realize how close they were to success when they gave up.


Thank you for reading: LIKE & SHARE



MARRIED OR NOT, YOU SHOULD READ THIS...

Saturday, August 17, 2013

ASP.NET - Life Cycle

ASP.Net application and its pages are instantiated and processed to produce dynamic output.

ASP.Net compiles the pages dynamically


The ASP.Net life cycle could be divided into two groups:


  • Application Life Cycle

  • Page Life Cycle

ASP.Net Application Life Cycle:


The application life cycle has the following stages:


User makes a request for accessing application resource, a page. Browser sends this request to the web server.


A unified pipeline receives the first request and the following events take place:


An object of the ApplicationManager class is created.


An object of the HostingEnvironment class is created to provide information regarding the resources.


Top level items in the application are compiled.


Response objects are created . the application objects: HttpContext, HttpRequest and HttpResponse are created and initialized.


An instance of the HttpApplication object is created and assigned to the request. The request is processed by the HttpApplication class. Different events are raised by this class for processing the request.


ASP.Net Page Life Cycle:


When a page is requested, it is loaded into the server memory, processed and sent to the browser. Then it is unloaded from the memory. At each of this steps, methods and events are available, which could be overridden according to the need of the application. In other words, you can write your own code to override the default code.


The Page class creates a hierarchical tree of all the controls on the page. All the components on the page, except the directives are part of this control tree. You can see the control tree by adding trace= “true” to the Page directive. We will cover page directives and tracing under ‘directives’ and ‘error handling’.


The page life cycle phases are:


  • Initialization

  • Instantiation of the controls on the page

  • Restoration and maintenance of the state

  • Execution of the event handler codes

  • Page rendering

Understanding the page life cycle helps in writing codes for making some specific thing happen at any stage of the page life cycle. It also helps in writing custom controls and initializing them at run time, populate their properties with view-state data and run control behavior code.


Following are the different stages of an ASP.Net page:


Page Request – when ASP.Net gets a page request, it decides whether to parse and compile the page or there would be a cached version of the page; accordingly the response is sent


Starting of page life cycle – at this stage, the Request and Response objects are set. If the request is an old request or post back, the IsPostBack property of the page is set to true. The UICulture property of the page is also set.


Page initialization – at this stage, the controls on the page are assigned unique ID by setting the UniqueID property and themes are applied. For a new request postback data is loaded and the control properties are restored to the view-state values.


Page load – at this stage, control properties are set using the view state and control state values.


Validation – Validate method of the validation control is called and if it runs successfully, the IsValid property of the page is set to true.


Postback event handling – if the request is a postback (old request), the related event handler is called.


Page rendering – at this stage, view state for the page and all controls are saved. The page calls the Render method for each control and the output of rendering is written to the OutputStream class of the Page’s Response property.


Unload – the rendered page is sent to the client and page properties, such as Response and Request are unloaded and all cleanup done.


ASP.Net Page Life Cycle Events:


At each stage of the page life cycle, the page raises some events, which could be coded. An event handler is basically a function or subroutine, bound to the event, using declarative attributes like Onclick or handle.


Following are the page life cycle events:


PreInit – PreInit is the first event in page life cycle. It checks the IsPostBack property and determines whether the page is a postback. It sets the themes and master pages, creates dynamic controls and gets and sets profile property values. This event can be handled by overloading the OnPreInit method or creating a Page_PreInit handler.


Init – Init event initializes the control property and the control tree is built. This event can be handled by overloading the OnInit method or creating a Page_Init handler.


InitComplete – InitComplete event allows tracking of view state. All the controls turn on view-state tracking.


LoadViewState – LoadViewState event allows loading view state information into the controls.


LoadPostData – during this phase, the contents of all the input fields defined with the


tag are processed.

PreLoad – PreLoad occurs before the post back data is loaded in the controls. This event can be handled by overloading the OnPreLoad method or creating a Page_PreLoad handler.


Load – the Load event is raised for the page first and then recursively for all child controls. The controls in the control tree are created. This event can be handled by overloading the OnLoad method or creating a Page_Load handler.


LoadComplete – the loading process is completed, control event handlers are run and page validation takes place. This event can be handled by overloading the OnLoadComplete method or creating a Page_LoadComplete handler.


PreRender – the PreRender event occurs just before the output is rendered. By handling this event, pages and controls can perform any updates before the output is rendered.


PreRenderComplete – as the PreRender event is recursively fired for all child controls, this event ensures the completion of the pre-rendering phase.


SaveStateComplete – state of control on the page is saved. Personalization, control state and view state information is saved. The HTML markup is generated. This stage can be handled by overriding the Render method or creating a Page_Render handler.


UnLoad – the UnLoad phase is the last phase of the page life cycle. It raises the UnLoad event for all controls recursively and lastly for the page itself. Final cleanup is done and all resources and references, such as database connections, are freed. This event can be handled by modifying the OnUnLoad method or creating a Page_UnLoad handler.




ASP.NET - Life Cycle

LINQ -Language Integrated Query

LINQ is set of extensions to the .Net Framework 3.5 and its managed languages that sets the query as an object. It defines a common syntax and a programming model to query different types of data using a common language.


The relational operators like Select, Project, Join, Group, Partition, Set operations etc., are implemented in LINQ and the C# and VB compilers in the .Net framework 3.5, which support the LINQ syntax makes it possible to work with a configured data store without resorting to ADO.Net.


For example querying the Customers table in the Northwind database, using LINQ query in C#, the code would be:


var data = from c in dataContext.Customers
where c.Name == "Rahul"
select c;

Where:


The ‘from’ keyword logically loops through the contents of the collection.


The expression with the ‘where‘ keyword is evaluated for each object in the collection.


The ‘select‘ statement selects the evaluated object to add to the list being returned.


The ‘var’ keyword is for variable declaration. Since the exact type of the returned object is not known, it indicates that the information will be inferred dynamically.


LINQ query can be applied to any data-bearing class that inherits from IEnumerable, here T is any data type.


LINQ Operators:


 



Apart from the operators used so far, there are several other operators, which implement all query clauses. Let us look at some of the operators and clauses.


 


The Join clause:


The ‘join clause’ in SQL is used for joining two data tables and displays a data set containing columns from both the tables. LINQ is also capable of that.


The Where clause:


The ‘where clause’ allows adding some conditional filters to the query.


The Orderby and Orderbydescending clauses:


These clauses allow sorting the query results.


The Let clause:


The let clause allows defining a variable and assigning it a value calculated from the data values.



LINQ -Language Integrated Query

Wednesday, August 14, 2013

SQL SERVER – Difference Between Union and Union All

SQL


UNION:


 



The UNION command is used to select related information from two tables, much like the JOIN command. However, when using the UNION command all selected columns need to be of the same data type. With UNION, only distinct values are selected.


 


UNION ALL:


 



The UNION ALL command is equal to the UNION command, except that UNION ALL selects all values.


 


The difference between Union and Union all is that Union all will not eliminate duplicate rows, instead it just pulls all rows from all tables fitting your query specifics and combines them into a table.


A UNION statement effectively does a SELECT DISTINCT on the results set. If you know that all the records returned are unique from your union, use UNION ALL instead, it gives faster results.



SQL SERVER – Difference Between Union and Union All

Tuesday, August 13, 2013