INEVITABLE<===> अपरिहार्य/अनिवार्य (pr. \\aparihary/anivary \\ )[Adjective]
Example:It is inevitable that interest rates will rise again..
INEVITABLE<===> दुर्निवार्य्य (pr. \\durnivaryy \\ )[Adjective]
उदाहरण:आजकल आतंकवाद एक दुर्निवार्य्य समस्या बन गयी है. Terrorism has become inevitable these days.
INEVITABLE<===> अनिवार्य (pr. \\anivary \\ )[Noun]
INEVITABLE<===> निश्चित (pr. \\nishchit \\ )[Noun]
INEVITABLE<===> जरूरी (pr. \\jaruri \\ )[Noun]
Thursday, December 15, 2011
QUOTES
"Imagination is more important than knowledge.
Knowledge is limited.
Imagination encircles the world."
- Albert Einstein
Knowledge is limited.
Imagination encircles the world."
- Albert Einstein
Wednesday, December 14, 2011
The secret productivity killer
(MoneyWatch) A new team member seems bright and capable. But soon after she starts the job, you notice that she's always tense, tired and has trouble concentrating. It's interfering with her ability to get her work done. The reason?
It could be that her partner snores.
"The amount of productivity that is affected by this nationally is hard to quantify," says Dr. David Volpi, founder of the Manhattan Snoring and Sleep Center, but estimates that it runs well into the billions of dollars. Sometimes snoring is a sign of sleep apnea -- a very serious medical condition that, among other things, disrupts the snorer's sleep -- but sometimes snoring is just snoring. It doesn't bother the snorer himself (and among younger snorers, "him" is more likely than "her") but whoever sleeps with him can potentially face lousy sleep until death do them part.
The question of whether snoring affects productivity is basically the question of "does a lack of sleep or interruption of sleep affect productivity," says Dr. Volpi. The answer? "Absolutely." People suffering from chronic sleep interruptions experience irritability, daytime fatigue, and a lack of ability to concentrate.
Fortunately, people no longer simply have to suffer through nights of poking the snorer to wake him up or decamping to the couch. Once sleep apnea is ruled out, treatments have improved to being as simple as "office procedures done under local anesthesia," says Dr. Volpi. "I see 30-35 people a week," and about 70% achieve their goal -- that "their partner can sleep through the night" or at least that "everybody's happy." Any night time wake-ups are just because someone has to go to the bathroom.
Does snoring cause a loss of productivity in your house? Tell us about it in the comments below.
It could be that her partner snores.
"The amount of productivity that is affected by this nationally is hard to quantify," says Dr. David Volpi, founder of the Manhattan Snoring and Sleep Center, but estimates that it runs well into the billions of dollars. Sometimes snoring is a sign of sleep apnea -- a very serious medical condition that, among other things, disrupts the snorer's sleep -- but sometimes snoring is just snoring. It doesn't bother the snorer himself (and among younger snorers, "him" is more likely than "her") but whoever sleeps with him can potentially face lousy sleep until death do them part.
The question of whether snoring affects productivity is basically the question of "does a lack of sleep or interruption of sleep affect productivity," says Dr. Volpi. The answer? "Absolutely." People suffering from chronic sleep interruptions experience irritability, daytime fatigue, and a lack of ability to concentrate.
Fortunately, people no longer simply have to suffer through nights of poking the snorer to wake him up or decamping to the couch. Once sleep apnea is ruled out, treatments have improved to being as simple as "office procedures done under local anesthesia," says Dr. Volpi. "I see 30-35 people a week," and about 70% achieve their goal -- that "their partner can sleep through the night" or at least that "everybody's happy." Any night time wake-ups are just because someone has to go to the bathroom.
Does snoring cause a loss of productivity in your house? Tell us about it in the comments below.
Tuesday, December 13, 2011
Oven-Baked "Fried" Chicken
Oven-Baked "Fried" Chicken
Ingredients
2/3 cup instant oats
1 teaspoon garlic powder
1 teaspoon onion powder
1 teaspoon mustard powder
1 teaspoon paprika
1 teaspoon dried oregano
1/2 teaspoon dried thyme
1/2 teaspoon salt
1/2 teaspoon ground black pepper
4 (4-ounce) boneless skinless chicken breast halves
2 tablespoons Dijon mustard
2 cups frozen green peas, steamed or microwaved until hot
Preheat oven to 400 degrees F.
Method
Coat a large baking sheet with cooking spray.
In a resealable plastic bag or shallow dish, combine oats, garlic powder, onion powder, mustard powder, paprika, oregano, thyme, salt, and pepper. Mix well and set aside.
Brush each chicken breast with Dijon mustard. Add chicken to oat mixture with tongs and turn to coat both sides. Transfer chicken to prepared baking sheet and spray with cooking spray.
Bake 30 minutes, until golden brown and cooked through. Serve with peas.
Ingredients
2/3 cup instant oats
1 teaspoon garlic powder
1 teaspoon onion powder
1 teaspoon mustard powder
1 teaspoon paprika
1 teaspoon dried oregano
1/2 teaspoon dried thyme
1/2 teaspoon salt
1/2 teaspoon ground black pepper
4 (4-ounce) boneless skinless chicken breast halves
2 tablespoons Dijon mustard
2 cups frozen green peas, steamed or microwaved until hot
Preheat oven to 400 degrees F.
Method
Coat a large baking sheet with cooking spray.
In a resealable plastic bag or shallow dish, combine oats, garlic powder, onion powder, mustard powder, paprika, oregano, thyme, salt, and pepper. Mix well and set aside.
Brush each chicken breast with Dijon mustard. Add chicken to oat mixture with tongs and turn to coat both sides. Transfer chicken to prepared baking sheet and spray with cooking spray.
Bake 30 minutes, until golden brown and cooked through. Serve with peas.
Diet that fights cancer
The National Cancer Institute estimates that roughly one-third of all cancer deaths may be diet related. What you eat can hurt you, but it can also help you. Many of the common foods found in grocery stores or organic markets contain cancer-fighting properties, from the antioxidants that neutralize the damage caused by free radicals to the powerful phytochemicals that scientists are just beginning to explore. There isn't a single element in a particular food that does all the work: The best thing to do is eat a variety of foods. The following foods have the ability to help stave off cancer and some can even help inhibit cancer cell growth or reduce tumor size.
Spice it up
The right spice can make the meal—and block the tumor. That's what University of Illinois researchers discovered when they pitted turmeric against19 different strains of H. pylori, the ulcer-inducing bacterium that's been linked to colon and gastric cancers. In every case, turmeric took the teeth out of H. pylori. "Turmeric didn't necessarily reduce the bacterial load," says Gail Mahady, Ph.D., the study's lead author. "What it did was reduce the chronic inflammation caused by H. pylori. And it's this inflammation that has been associated with the development of cancer."
The best way to increase your intake of turmeric? Eat Indian food. Specifically, try dining on curry, which is rich in turmeric and often contains additional cancer quashers, such as garlic and onions.
Another option: Slather extra mustard on all your sandwiches; the bright yellow variety is loaded with turmeric.
Fish for health
Shark cartilage won't ward off cancer, but a shark's diet might. A recently completed 12-year Harvard study of nearly 48,000 men determined that those who ate fish more than three times a week were 40 percent less likely to develop advanced prostate cancer than those who hit the surf only twice a month.
It's those amazing omega-3s again, though they don't deserve all the credit. "Fish also contains vitamin A and vitamin D, which may help prevent prostate cancer," says Michael F. Leitzmann, M.D., a coauthor of the study.
That's why it may be better to skip supplements and stick with actual fish. Salmon, mackerel, and herring have the best balance of omega-3s, vitamin A, and vitamin D.
Note: Don't wait until the weekend to go fishing, says Dr. Leitzmann. "Space your fish consumption out over the week so you consume a steady supply of these compounds."
Drink tangy juice
Fresh squeezed OJ contains all the health benefits of oranges except one: the cancer protection in the peel. People who regularly consume citrus zest reduce their risk of squamous-cell skin cancer by 30 percent, according to a recent University of Arizona study. Even lab rats live longer on the stuff; animal studies suggest that citrus zest can actually shrink existing tumors.
Turns out the oils in the peels of oranges, lemons, and grapefruit contain powerful compounds that stimulate the body's production of a detoxifying enzyme, explains study author Iman Hakim, M.D., Ph.D., who says the results had an impact on her research group. "Several people around here started chewing on citrus peels," she says.
Another option: Grate the colored portion of the peel and add the pile of zest (at least a tablespoonful) to soups, salads, and salsa, or sprinkle it on chicken and fish.
Sip it up white
Green tea grabs all the headlines as a tumor-taming brew, but the white kind surpasses it at preventing colon cancer. When researchers at Oregon State University's Linus Pauling Institute tested the two teas' abilities to block colon-polyp growth, the blanc beverage was about 10 percent more effective. In fact, it stopped polyps as effectively as sulindac, a powerful anti-inflammatory drug.
And while prescription anti-inflammatories can cause internal bleeding and ulcers, "tea is pretty much guaranteed not to cause side effects," says Gayle Orner, Ph.D., the study's lead author. The study used Exotica white tea; 3 cups a day may be enough to cut your cancer risk.
Eat your whey
Not since lycopene landed in our lives has there been a more promising prostate-cancer-fighting nutrient than whey protein. In a recent Ohio State University study, researchers treated human prostate cells with whey protein and then measured the cells' levels of a natural cancer-blocking compound called glutathione.
The finding: Glutathione levels rose by a remarkable 64 percent. "Whey is a great source of the amino acid cysteine, and cysteine can become glutathione in the body," explains Rosemary L. Walzem, R.D., Ph.D., director of the Center for Nutrition, Health, and Food Genomics at Texas A&M University.
One of the best sources of whey is yogurt; a lot of the protein is in the clear liquid on top, so don't pour it off. You can also pick up powdered whey-protein isolate—vanilla-flavored—and add it to instant oatmeal.
Indulge in berry
Make every day Thanksgiving and you could slash your risk of several different cancers. Researchers at the University of California at Los Angeles have confirmed that cranberries contain a trove of tumor-blocking compounds, including phenolic acids, glycosides, and anthocyanins.
These phytochemicals are effective at preventing cancer down below—in the colon and prostate—as well as up top—on the head and neck. "They force cancer cells to die or they inhibit their unregulated growth," says David Heber, M.D., Ph.D., a coauthor of the study.
To hit your daily cran quota, down a small glass of cranberry juice (the type that lists at least 27 percent juice on the label) at breakfast and snack on Craisins (sweetened dried cranberries) throughout the day.
Food with cool name
The nutrient with the coolest name—gamma tocopherol—may also be the one with the fastest draw in a showdown with cancer. When Purdue University researchers pitted this form of vitamin E against prostate- and lung-cancer cells, they discovered that it was able to stop the cells in their microscopic tracks.
What's more, gamma tocopherol helped kill existing tumor cells without hurting healthy cells, says Qing Jiang, Ph.D., the study's lead author.
But what about the research showing that vitamin E supplements are worthless, and perhaps even dangerous? Doesn't apply to gamma tocopherol, since it isn't included in most E supplements.
Instead, you'll find it in sesame oil, which you can sub for other cooking oils or sprinkle over salads. Or, if you want a source you can sink your teeth into, munch on walnuts.
Spice it up
The right spice can make the meal—and block the tumor. That's what University of Illinois researchers discovered when they pitted turmeric against19 different strains of H. pylori, the ulcer-inducing bacterium that's been linked to colon and gastric cancers. In every case, turmeric took the teeth out of H. pylori. "Turmeric didn't necessarily reduce the bacterial load," says Gail Mahady, Ph.D., the study's lead author. "What it did was reduce the chronic inflammation caused by H. pylori. And it's this inflammation that has been associated with the development of cancer."
The best way to increase your intake of turmeric? Eat Indian food. Specifically, try dining on curry, which is rich in turmeric and often contains additional cancer quashers, such as garlic and onions.
Another option: Slather extra mustard on all your sandwiches; the bright yellow variety is loaded with turmeric.
Fish for health
Shark cartilage won't ward off cancer, but a shark's diet might. A recently completed 12-year Harvard study of nearly 48,000 men determined that those who ate fish more than three times a week were 40 percent less likely to develop advanced prostate cancer than those who hit the surf only twice a month.
It's those amazing omega-3s again, though they don't deserve all the credit. "Fish also contains vitamin A and vitamin D, which may help prevent prostate cancer," says Michael F. Leitzmann, M.D., a coauthor of the study.
That's why it may be better to skip supplements and stick with actual fish. Salmon, mackerel, and herring have the best balance of omega-3s, vitamin A, and vitamin D.
Note: Don't wait until the weekend to go fishing, says Dr. Leitzmann. "Space your fish consumption out over the week so you consume a steady supply of these compounds."
Drink tangy juice
Fresh squeezed OJ contains all the health benefits of oranges except one: the cancer protection in the peel. People who regularly consume citrus zest reduce their risk of squamous-cell skin cancer by 30 percent, according to a recent University of Arizona study. Even lab rats live longer on the stuff; animal studies suggest that citrus zest can actually shrink existing tumors.
Turns out the oils in the peels of oranges, lemons, and grapefruit contain powerful compounds that stimulate the body's production of a detoxifying enzyme, explains study author Iman Hakim, M.D., Ph.D., who says the results had an impact on her research group. "Several people around here started chewing on citrus peels," she says.
Another option: Grate the colored portion of the peel and add the pile of zest (at least a tablespoonful) to soups, salads, and salsa, or sprinkle it on chicken and fish.
Sip it up white
Green tea grabs all the headlines as a tumor-taming brew, but the white kind surpasses it at preventing colon cancer. When researchers at Oregon State University's Linus Pauling Institute tested the two teas' abilities to block colon-polyp growth, the blanc beverage was about 10 percent more effective. In fact, it stopped polyps as effectively as sulindac, a powerful anti-inflammatory drug.
And while prescription anti-inflammatories can cause internal bleeding and ulcers, "tea is pretty much guaranteed not to cause side effects," says Gayle Orner, Ph.D., the study's lead author. The study used Exotica white tea; 3 cups a day may be enough to cut your cancer risk.
Eat your whey
Not since lycopene landed in our lives has there been a more promising prostate-cancer-fighting nutrient than whey protein. In a recent Ohio State University study, researchers treated human prostate cells with whey protein and then measured the cells' levels of a natural cancer-blocking compound called glutathione.
The finding: Glutathione levels rose by a remarkable 64 percent. "Whey is a great source of the amino acid cysteine, and cysteine can become glutathione in the body," explains Rosemary L. Walzem, R.D., Ph.D., director of the Center for Nutrition, Health, and Food Genomics at Texas A&M University.
One of the best sources of whey is yogurt; a lot of the protein is in the clear liquid on top, so don't pour it off. You can also pick up powdered whey-protein isolate—vanilla-flavored—and add it to instant oatmeal.
Indulge in berry
Make every day Thanksgiving and you could slash your risk of several different cancers. Researchers at the University of California at Los Angeles have confirmed that cranberries contain a trove of tumor-blocking compounds, including phenolic acids, glycosides, and anthocyanins.
These phytochemicals are effective at preventing cancer down below—in the colon and prostate—as well as up top—on the head and neck. "They force cancer cells to die or they inhibit their unregulated growth," says David Heber, M.D., Ph.D., a coauthor of the study.
To hit your daily cran quota, down a small glass of cranberry juice (the type that lists at least 27 percent juice on the label) at breakfast and snack on Craisins (sweetened dried cranberries) throughout the day.
Food with cool name
The nutrient with the coolest name—gamma tocopherol—may also be the one with the fastest draw in a showdown with cancer. When Purdue University researchers pitted this form of vitamin E against prostate- and lung-cancer cells, they discovered that it was able to stop the cells in their microscopic tracks.
What's more, gamma tocopherol helped kill existing tumor cells without hurting healthy cells, says Qing Jiang, Ph.D., the study's lead author.
But what about the research showing that vitamin E supplements are worthless, and perhaps even dangerous? Doesn't apply to gamma tocopherol, since it isn't included in most E supplements.
Instead, you'll find it in sesame oil, which you can sub for other cooking oils or sprinkle over salads. Or, if you want a source you can sink your teeth into, munch on walnuts.
Signs that your are sleep deprived
ur bodies give us plenty of signals when we’re tired. But some of us are so used to being sleep deprived that we remain oblivious to how impaired we really are. Sleep debt isn’t something you can pay off in a weekend, researchers say—it can take weeks of building up restorative sleep habits. Here are some signs you may need to make sleep a more urgent priority.
Block in thinking!
You’re up late one night booking your next vacation, and even though you know the dates and destination, you’re overwhelmed by minor details. Should you get a refundable ticket? Window or aisle seat? Rent a car now or later? When you’re tired, you’re less able to distinguish between important and irrelevant information, such as your seat assignment.
The result: Even the simplest decision takes on exaggerated importance. Tired people also take riskier gambles to maximize results (Maybe if I wait until the last minute, the ticket price will go down) and have trouble adjusting to changing circumstances (like firming up an itinerary if flying from an unfamiliar airport).
Hungry after a hearty meal!
Shortchanging your nightly sleep can make your waistline suffer. Studies show that chronic sleep loss can disrupt blood sugar levels and cause the body to produce less leptin, a hormone that curbs appetite, and more ghrelin, leptin’s hunger-stimulating counterpart. Because of these physiological changes, you may be more likely to overeat when you skimp on sleep—and the food you pick probably won’t be either nutritious or a lasting source of energy. Tired people tend to be particularly drawn to sugars and other simple carbohydrates, probably because the body is looking for a quick pick-me-up. Sleep deprivation also tends to erode self-control, making you more likely to choose a brownie over carrot sticks.
Coming down with cold!
Inadequate sleep can leave you more vulnerable to infection than those who are well rested.In one study, researchers injected healthy volunteers with a cold virus. Those who slept less than 7 hours a night for the previous week were 3 times more likely to develop symptoms than those who got 8 hours or more. In another study, people who got only 4 hours of sleep for several nights in a row had a weaker immune response to the flu vaccine than those who slept between 7.5 and 8.5 hours.
Easy your are put to tears!
Do those ballads on American Idol move you to tears? Try going to bed earlier. Don’t automatically chalk up your sudden weepiness to PMS: Without sleep, you are more emotionally volatile. In one brain-imaging study, for example, people who missed a night of sleep and viewed disturbing images had 60% more activity in the amygdala, which is involved in processing fear and anxiety, compared with better-rested volunteers. The study also found that the sleepy volunteers’ amygdalae communicated less with the part of the brain that determines appropriate emotional responses, suggesting that they weren’t doing a good job of tempering their emotions. When we’re sleep deprived, we may also feel glum because tired brains store negative memories more effectively than positive or neutral ones. If you are chronically sleep deprived, you could act like someone with depression.
Become senseless of surrounding!
One moment you’re brewing a cup of afternoon tea and the next thing you know, you’ve spilled it all over your new dress. Sound familiar? Researchers have accumulated ample evidence that the sleep deprived have slower and less precise motor skills, but exactly why isn’t yet known. Sleepy people may be clumsier for several reasons: Impaired reflexes and a lack of focus may make it hard for them to react quickly enough to things that spring up in their path. Another possibility: Sleepiness throws off balance or depth perception. In any case, it’s not uncommon for very sleepy people to black out momentarily when the body’s urge to sleep gets too strong. So it’s possible that your klutziness stems from “microsleeps” that last for a second or two.
Block in thinking!
You’re up late one night booking your next vacation, and even though you know the dates and destination, you’re overwhelmed by minor details. Should you get a refundable ticket? Window or aisle seat? Rent a car now or later? When you’re tired, you’re less able to distinguish between important and irrelevant information, such as your seat assignment.
The result: Even the simplest decision takes on exaggerated importance. Tired people also take riskier gambles to maximize results (Maybe if I wait until the last minute, the ticket price will go down) and have trouble adjusting to changing circumstances (like firming up an itinerary if flying from an unfamiliar airport).
Hungry after a hearty meal!
Shortchanging your nightly sleep can make your waistline suffer. Studies show that chronic sleep loss can disrupt blood sugar levels and cause the body to produce less leptin, a hormone that curbs appetite, and more ghrelin, leptin’s hunger-stimulating counterpart. Because of these physiological changes, you may be more likely to overeat when you skimp on sleep—and the food you pick probably won’t be either nutritious or a lasting source of energy. Tired people tend to be particularly drawn to sugars and other simple carbohydrates, probably because the body is looking for a quick pick-me-up. Sleep deprivation also tends to erode self-control, making you more likely to choose a brownie over carrot sticks.
Coming down with cold!
Inadequate sleep can leave you more vulnerable to infection than those who are well rested.In one study, researchers injected healthy volunteers with a cold virus. Those who slept less than 7 hours a night for the previous week were 3 times more likely to develop symptoms than those who got 8 hours or more. In another study, people who got only 4 hours of sleep for several nights in a row had a weaker immune response to the flu vaccine than those who slept between 7.5 and 8.5 hours.
Easy your are put to tears!
Do those ballads on American Idol move you to tears? Try going to bed earlier. Don’t automatically chalk up your sudden weepiness to PMS: Without sleep, you are more emotionally volatile. In one brain-imaging study, for example, people who missed a night of sleep and viewed disturbing images had 60% more activity in the amygdala, which is involved in processing fear and anxiety, compared with better-rested volunteers. The study also found that the sleepy volunteers’ amygdalae communicated less with the part of the brain that determines appropriate emotional responses, suggesting that they weren’t doing a good job of tempering their emotions. When we’re sleep deprived, we may also feel glum because tired brains store negative memories more effectively than positive or neutral ones. If you are chronically sleep deprived, you could act like someone with depression.
Become senseless of surrounding!
One moment you’re brewing a cup of afternoon tea and the next thing you know, you’ve spilled it all over your new dress. Sound familiar? Researchers have accumulated ample evidence that the sleep deprived have slower and less precise motor skills, but exactly why isn’t yet known. Sleepy people may be clumsier for several reasons: Impaired reflexes and a lack of focus may make it hard for them to react quickly enough to things that spring up in their path. Another possibility: Sleepiness throws off balance or depth perception. In any case, it’s not uncommon for very sleepy people to black out momentarily when the body’s urge to sleep gets too strong. So it’s possible that your klutziness stems from “microsleeps” that last for a second or two.
Why does an apple a day keep the doctor away?
Why does an apple a day keep the doctor away? Danish microbiologists fed rats a diet high in whole apples and apple products such as apple juice and puree to check if eating apples affected the level of “ friendly “ bacteria in the rats’ digestive system. It seemed that when apples were eaten regularly over a period of time, these bacteria helped produce short-chain fatty acids that provided ideal pH conditions for ensuring a beneficial balance of microorganisms. They also produced a chemical called butyrate, an important fuel for cells
of the intestinal wall. Apples are rich in pectin, a component of dietary fibre in apples, and boot the level of certain bacteria that may improve intestinal health and reduce risk of some diseases.
of the intestinal wall. Apples are rich in pectin, a component of dietary fibre in apples, and boot the level of certain bacteria that may improve intestinal health and reduce risk of some diseases.
Inner ear can ''store'' recent sounds: Study
A new study has revealed that vibrations in the inner ear continue even after a sound has ended, perhaps serving as a kind of mechanical memory of recent sounds. perception, the results may shed light on other fascinating aspects of the auditory system, such as why some gaps between sounds are too brief to be perceived by the human ear. The inner ear contains a structure called the cochlea that serves as the organ of hearing. The cochlea is a coiled, fluid filled structure that contains a "basilar" membrane and associated "hair cells".
Essentially, sound-evoked vibrations of the basilar membrane are sensed by the hair cells, which in turn convey auditory information to the nervous system. Some hair cells respond to basilar membrane vibrations by producing forces that increase hearing sensitivity and frequency selectivity through mechanisms that are not completely understood.
"Because hair cell force production is initiated by the acoustic stimulus, it was assumed to end when the stimulus was removed," says senior study author, Dr. Alfred L. Nuttall from the Oregon Hearing Research Center. "However, there is evidence that some tones produce vibrations that continue even after the end of the stimulus." Using anaesthetized guinea pigs, Dr. Nuttall and colleagues recorded basilar membrane motion and hair cell related potentials in response to various sounds.
They observed that after-vibrations were dependent on the magnitude and frequency of the sound stimuli and that even minor hearing loss elicited a profound reduction in after-vibrations. "The after-vibrations appear to be driven by sustained force production in the inner ear – a form of short-term memory of past stimulations," says Dr. Nuttall. "It is important to point out that although our findings clearly document the existence of after-vibrations, further work is needed to elucidate the underlying mechanism."
The authors also discuss the potential relevance of after-vibrations for sound perception. "The ability to detect brief gaps in an ongoing stimulus is critical for speech recognition; gaps need to be longer than a minimal interval to be perceived," explains Dr. Nutall. "To the extent that after-vibrations excite the auditory nerve fibers, they may explain part of the difficulty in detecting such gaps."
Essentially, sound-evoked vibrations of the basilar membrane are sensed by the hair cells, which in turn convey auditory information to the nervous system. Some hair cells respond to basilar membrane vibrations by producing forces that increase hearing sensitivity and frequency selectivity through mechanisms that are not completely understood.
"Because hair cell force production is initiated by the acoustic stimulus, it was assumed to end when the stimulus was removed," says senior study author, Dr. Alfred L. Nuttall from the Oregon Hearing Research Center. "However, there is evidence that some tones produce vibrations that continue even after the end of the stimulus." Using anaesthetized guinea pigs, Dr. Nuttall and colleagues recorded basilar membrane motion and hair cell related potentials in response to various sounds.
They observed that after-vibrations were dependent on the magnitude and frequency of the sound stimuli and that even minor hearing loss elicited a profound reduction in after-vibrations. "The after-vibrations appear to be driven by sustained force production in the inner ear – a form of short-term memory of past stimulations," says Dr. Nuttall. "It is important to point out that although our findings clearly document the existence of after-vibrations, further work is needed to elucidate the underlying mechanism."
The authors also discuss the potential relevance of after-vibrations for sound perception. "The ability to detect brief gaps in an ongoing stimulus is critical for speech recognition; gaps need to be longer than a minimal interval to be perceived," explains Dr. Nutall. "To the extent that after-vibrations excite the auditory nerve fibers, they may explain part of the difficulty in detecting such gaps."
Over an hour of meditation reduces pain
A little over an hour of meditation produces powerful pain-relieving effects in the brain, a new study shows. "This is the first study to show that only a little over an hour of meditation training can dramatically reduce both the experience of pain and pain-related brain activation," said Fadel Zeidan, who led the study. "We found a big effect - about a 40 percent reduction in pain intensity and a 57 percent reduction in pain unpleasantness," added Zeidan, post-doctoral research fellow at Wake Forest Baptist Medical Centre.
"Meditation produced a greater reduction in pain than even morphine or other pain-relieving drugs, which typically reduce pain ratings by about 25 percent," said Zeidan, reports the Journal of Neuroscience. For the study, a group of healthy volunteers who had never meditated attended four, 20-minute classes to learn a meditation technique known as focused attention, according to a Wake Forest statement.
Focused attention is a form of mindfulness meditation where people are taught to attend to the breath and let go of distracting thoughts and emotions. Both before and after meditation training, participants' brain activity was examined using a special type of imaging -- arterial spin labelling magnetic resonance imaging (ASL MRI) -- that captures longer duration brain processes, such as meditation, better than a standard MRI scan of brain function.
During these scans, a pain-inducing heat device was placed on the participants' right legs. This device heated a small area of their skin to 120 degrees Fahrenheit, a temperature that most people find painful, over a five-minute period. The scans taken after meditation training showed that every participant's pain ratings were reduced, with decreases ranging from 11 to 93 percent, Zeidan said.
"Meditation produced a greater reduction in pain than even morphine or other pain-relieving drugs, which typically reduce pain ratings by about 25 percent," said Zeidan, reports the Journal of Neuroscience. For the study, a group of healthy volunteers who had never meditated attended four, 20-minute classes to learn a meditation technique known as focused attention, according to a Wake Forest statement.
Focused attention is a form of mindfulness meditation where people are taught to attend to the breath and let go of distracting thoughts and emotions. Both before and after meditation training, participants' brain activity was examined using a special type of imaging -- arterial spin labelling magnetic resonance imaging (ASL MRI) -- that captures longer duration brain processes, such as meditation, better than a standard MRI scan of brain function.
During these scans, a pain-inducing heat device was placed on the participants' right legs. This device heated a small area of their skin to 120 degrees Fahrenheit, a temperature that most people find painful, over a five-minute period. The scans taken after meditation training showed that every participant's pain ratings were reduced, with decreases ranging from 11 to 93 percent, Zeidan said.
Eating 3 bananas a day could slash stroke risk by 21%
British and Italian researchers have found that eating three bananas cuts the risk of a stroke. The findings suggest that thousands of strokes could be prevented by the consumption of other potassium-rich foods such as spinach, nuts, milk, fish and lentils. Although some previous studies have suggested bananas could be important for controlling blood pressure and preventing strokes, results have not always been consistent.
In the latest research, scientists analysed data from eleven different studies - dating back to the mid-Sixties - and pooled the results to get an overall outcome. They found a daily potassium intake of around 1,600 milligrammes, less than half the UK recommended daily amount for an adult of 3,500mg, was enough to lower stroke risk by more than a fifth.
The average banana contains around 500 milligrammes of potassium, which helps to lower blood pressure and controls the balance of fluids in the body. Too little potassium can lead to an irregular heartbeat, irritability, nausea and diarrhoea. Researchers from the University of Warwick and the University of Naples said potassium intake in most countries is well below the recommended daily amount. But if consumers ate more potassium-rich foods and also reduced their salt intake, the annual global death toll from strokes could be cut by more than a million a year.
In the latest research, scientists analysed data from eleven different studies - dating back to the mid-Sixties - and pooled the results to get an overall outcome. They found a daily potassium intake of around 1,600 milligrammes, less than half the UK recommended daily amount for an adult of 3,500mg, was enough to lower stroke risk by more than a fifth.
The average banana contains around 500 milligrammes of potassium, which helps to lower blood pressure and controls the balance of fluids in the body. Too little potassium can lead to an irregular heartbeat, irritability, nausea and diarrhoea. Researchers from the University of Warwick and the University of Naples said potassium intake in most countries is well below the recommended daily amount. But if consumers ate more potassium-rich foods and also reduced their salt intake, the annual global death toll from strokes could be cut by more than a million a year.
Extra stress 'can lead to memory loss
Scientists at the University of Edinburgh have shed new light on how stress can contribute to memory loss in old age. The study could aid research into treatments for age-related memory disorders. Many believe that stress is bad for our brains especially as we get older. Now, researchers have shown how two receptors in older brains react to a stress hormone called cortisol. This has been linked to increasing forgetfulness as we age. While we know that stress hormones affect memory, this research explains how the receptors they engage with can switch good memory to poorly-functioning memory in old age. The study found that one receptor was activated by low levels of cortisol, which helped memory. However, once levels of this stress hormone were too high they spilled over onto a second receptor.
This activated brain processes that contribute to memory impairment. The study found that high levels of the stress hormone in aged mice made them less able to remember how to navigate a maze. The memory recall problem was reversed when the receptor linked to poor memory was blocked.
The research helps explain why too much stress over a prolonged period interferes with the normal processes in storing everyday memories. This is despite the fact that a little bit of stress can help us better remember emotional memories.
We now know that lowering the levels of these stress hormones will prevent them from activating a receptor in the brain that is bad for memory. Understanding the mechanisms in the brain, which affect memory as we age, will help us to find ways to combat conditions linked to memory loss.
This activated brain processes that contribute to memory impairment. The study found that high levels of the stress hormone in aged mice made them less able to remember how to navigate a maze. The memory recall problem was reversed when the receptor linked to poor memory was blocked.
The research helps explain why too much stress over a prolonged period interferes with the normal processes in storing everyday memories. This is despite the fact that a little bit of stress can help us better remember emotional memories.
We now know that lowering the levels of these stress hormones will prevent them from activating a receptor in the brain that is bad for memory. Understanding the mechanisms in the brain, which affect memory as we age, will help us to find ways to combat conditions linked to memory loss.
Monday, December 12, 2011
People management skills
Posted by Chris on 20/04/2009
How can you get the best from yourself and others?
Answer: develop your: “People management skills”
People management skills are the “soft skills”.
Some people develop them all naturally; and sadly, others don’t.
Do you know anyone with good technical skills, but poor people management skills?
Their effect can be devastating, cant it?
People management skills include the following:
1. Listening with intent to understand.
2. Asking insightful questions.
3. Being motivating and inspiring.
4. Handling conflict situations.
5. Showing a degree of trust.
6. Inspires productive atmosphere.
Listening with intent to understand
We would like you to make this distinction between two kinds of listening:
1. Listening with intent to understand
2. Listening with an intent to reply
Most people don’t really listen: when they are “listening “they are, really just waiting their turn to speak. They are not absorbing the others message: they are mentally preparing their response.
Good people skills mean that you listen with intent to understand.
That means listening and NOT interrupting, not drifting off, but paying full attention to the others message.
Good listening has three major benefits
1. You learn more about the other persons wants, desires and fears
2. You show respect to the other
3. You can’t say the wrong thing, if you are listening
Conclusion 1: Listen more often, with intent to understand.
Asking insightful questions
Listening will not be enough on its own.
Good listening will inspire questions about what the other person has said.
In order to understand you must become a good questioner.
Questions can be used in two main ways:
1. As a means of gathering more information.
2. As a means of gentle persuasion.
As a means of gathering more information, use this phrase
“When you say, BLANK, what specifically do you mean?
As a means of persuasion you might ask questions in of the form of:
“I understand what you mean, but what would you see as the possible long range problems associated with doing that?”
Conclusion 2: To persuade and to gather more information, develop your questioning skills.
Being Motivating and inspiring
Nobody likes a grump.
Nobody wants to work with a person who is pessimistic, cynical and down.
Good people skills involves resisting the temptation to submit to the bad news.
Good people skills includes keeping the mood strong in spite of the gloom.
In essence, being a positive motivator boils down to just one thing:
That means being able to
“Talk convincingly about WHY the future WILL BE better than the present.”
If you learn to come up with a convincing reason to support the idea that the future will be better than the present, then, to that degree you will inspire confidence in others.
To the degree to which you cannot do that, is the degree to which you will fail to inspire confidence.
Conclusion 3: train yourself to talk convincingly about WHY the future will be better than the present.
Handling conflict situations
Handling conflict situations is a delicate and important people management skill to master.
This skill resolves down to three basic abilities:
1. The ability to criticise the others behaviour (claiming bad behaviour) without criticising and attacking the character of the person ( NOT claiming he is of bad character)
2. The ability to suggest ways out of the conflict that is both possible and acceptable to the other
3. The ability to control your language, when you are in a bad mood (not to say too much!)
Conclusion 4: by applying the three laws stated above, train yourself to give constructive criticism.
Showing a degree of trust
Trust is the basis of our economy
If you don’t trust the other, then you cannot do business with him- her.
Demonstration of trust is therefore a major compliment.
Demonstration of a lack of trust is a major de-motivator and an insult.
Good people skills involves trusting others to the maximum that is justifiable given two things:
1. Their track record
2. The value of the task being entrusted
The people management skill is to give as much trust as you can to others.
(Allowing you to delegate lower value work and get on with higher value work).
Conclusion 5: as much as is justifiable, trust others
Inspiring a productive atmosphere
This is the sum total of all the other five skills.
If you can do all the other five, then you can and will inspire a productive effort from those around you.
Conclusion 6: Work harder on changing yourself, than you do trying to change others
People management skills include the following abilities.
1: Listen more often, with intent to understand.
2: To persuade and to gather more information, develop your questioning skills.
3: Train yourself to talk convincingly about WHY the future will be better than the present.
4: By applying the three laws stated above, train yourself to give constructive criticism.
5: As much as is justifiable, trust others.
6: Work harder on changing yourself, than you do trying to change others.
Visit the Corporate Coach Group for more information on Management Training.
How can you get the best from yourself and others?
Answer: develop your: “People management skills”
People management skills are the “soft skills”.
Some people develop them all naturally; and sadly, others don’t.
Do you know anyone with good technical skills, but poor people management skills?
Their effect can be devastating, cant it?
People management skills include the following:
1. Listening with intent to understand.
2. Asking insightful questions.
3. Being motivating and inspiring.
4. Handling conflict situations.
5. Showing a degree of trust.
6. Inspires productive atmosphere.
Listening with intent to understand
We would like you to make this distinction between two kinds of listening:
1. Listening with intent to understand
2. Listening with an intent to reply
Most people don’t really listen: when they are “listening “they are, really just waiting their turn to speak. They are not absorbing the others message: they are mentally preparing their response.
Good people skills mean that you listen with intent to understand.
That means listening and NOT interrupting, not drifting off, but paying full attention to the others message.
Good listening has three major benefits
1. You learn more about the other persons wants, desires and fears
2. You show respect to the other
3. You can’t say the wrong thing, if you are listening
Conclusion 1: Listen more often, with intent to understand.
Asking insightful questions
Listening will not be enough on its own.
Good listening will inspire questions about what the other person has said.
In order to understand you must become a good questioner.
Questions can be used in two main ways:
1. As a means of gathering more information.
2. As a means of gentle persuasion.
As a means of gathering more information, use this phrase
“When you say, BLANK, what specifically do you mean?
As a means of persuasion you might ask questions in of the form of:
“I understand what you mean, but what would you see as the possible long range problems associated with doing that?”
Conclusion 2: To persuade and to gather more information, develop your questioning skills.
Being Motivating and inspiring
Nobody likes a grump.
Nobody wants to work with a person who is pessimistic, cynical and down.
Good people skills involves resisting the temptation to submit to the bad news.
Good people skills includes keeping the mood strong in spite of the gloom.
In essence, being a positive motivator boils down to just one thing:
That means being able to
“Talk convincingly about WHY the future WILL BE better than the present.”
If you learn to come up with a convincing reason to support the idea that the future will be better than the present, then, to that degree you will inspire confidence in others.
To the degree to which you cannot do that, is the degree to which you will fail to inspire confidence.
Conclusion 3: train yourself to talk convincingly about WHY the future will be better than the present.
Handling conflict situations
Handling conflict situations is a delicate and important people management skill to master.
This skill resolves down to three basic abilities:
1. The ability to criticise the others behaviour (claiming bad behaviour) without criticising and attacking the character of the person ( NOT claiming he is of bad character)
2. The ability to suggest ways out of the conflict that is both possible and acceptable to the other
3. The ability to control your language, when you are in a bad mood (not to say too much!)
Conclusion 4: by applying the three laws stated above, train yourself to give constructive criticism.
Showing a degree of trust
Trust is the basis of our economy
If you don’t trust the other, then you cannot do business with him- her.
Demonstration of trust is therefore a major compliment.
Demonstration of a lack of trust is a major de-motivator and an insult.
Good people skills involves trusting others to the maximum that is justifiable given two things:
1. Their track record
2. The value of the task being entrusted
The people management skill is to give as much trust as you can to others.
(Allowing you to delegate lower value work and get on with higher value work).
Conclusion 5: as much as is justifiable, trust others
Inspiring a productive atmosphere
This is the sum total of all the other five skills.
If you can do all the other five, then you can and will inspire a productive effort from those around you.
Conclusion 6: Work harder on changing yourself, than you do trying to change others
People management skills include the following abilities.
1: Listen more often, with intent to understand.
2: To persuade and to gather more information, develop your questioning skills.
3: Train yourself to talk convincingly about WHY the future will be better than the present.
4: By applying the three laws stated above, train yourself to give constructive criticism.
5: As much as is justifiable, trust others.
6: Work harder on changing yourself, than you do trying to change others.
Visit the Corporate Coach Group for more information on Management Training.
Friday, December 9, 2011
Using XPath to Select Nodes
XPath is a special query language the is specifically used for selecting nodes in an XML document. With these language, you don’t have to search for the entire tree of the XML nodes. You will learn the basics of these language and apply it to a program. The two methods used for selecting nodes using the XPath language are the XmlNode.SelectNodes() and the XmlNode.SelectSingleNode(). The SelectNodes() method returns a XmlNodeList which contains all the nodes that matches the XPath string. Consider the following XML document.
30
Male
25
Male
22
Female
27
Male
35
Male
Figure 1
Suppose you want to get the age of every person, the code for doing that is:
XmlDocument document = new XmlDocument();
document.Load("Persons.xml");
XmlNodeList nodes = document.DocumentElement.SelectNodes("/Persons/Person/Age");
foreach(XmlNode node in nodes)
{
textBoxResult.Text += node.InnerText + "\r\n";
}
After loading the document, we used the DocumentElement property which is of type XmlNode. We used the SelectNodes() method which accepts a string argument that contains the XPath query. The XPath query /Persons/Person/Age tells that get Age element that is a child of a Person element which is a child of the Persons element. All the matching nodes will then be returned as an XmlNodeList. We used a foreach loop to print each age in a text box. Figure 2 shows you some XPath operations that you can use to query specific nodes.
XPath Query Description
. Selects the current node.
.. Selects the parent of the current node.
* Selects all the child of the current node.
nodename Selects all child nodes specified by the name.
/ Selects the root node.
// Selects nodes from the current node that match the selection
expression no matter where they are.
//* Selects all elements in the document.
/element Selects the root element named element. Staring a path
with a / means you are using an absolute path to an element.
/element/* Selects all the child of the root element.
element/* Selects all the child nodes of a child element.
element/child Selects the child elements which are a child of a specified child
element of the current node.
//element Selects all elements with the specified name regardless of
where they are in the document.
element//child Selects all child elements of the parent regardless of
where they are inside the parent element.
@attribute Selects an attribute of the current node where attribute
is the name of the attribute.
//@attribute Selects all the attributes specified by its name regardless of
where they are in the document.
@* Selects all attribute of the current node.
element[i] Selects an element with the specified element name and the specified index.
text() Selects the text of all the child nodes of the current element.
//text() Selects text of every element in the document.
//element/text() Selects the text of all the matching elements.
//element[name='value'] Selects all elements with a child containing a specified value.
//element[@att='value'] Selects all elements with the specified attribute having the specified value.
Figure 2 – XPath Operations
For example, if you want to select the current node, then you will use the . operator.
XmlNode current = document.DocumentElement.SelectSingleNode(".");
Notice that we used the XmlNode.SelectSingleNode() method to only select 1 node. In case of multiple results, it will return the first matching node. The method accepted the XPath string as its argument. Passing “.” will result on returning the actual node that calls it. Also notice that the returned value is an XmlNode and not an XmlNodeList.
Suppose you want to select all the Person elements which are children of the Persons node. You can use the following XPath query.
XmlNodeList personNodes =
document.DocumentElement.SelectNodes("/Persons/Person");
Notice that we started the query with a slash (/). This indicates that we are using an absolute path. We start fromt he Persons root node, then we look at all the Person nodes which is a direct child of the root node. If we are to get every age of each person, then we can use the following code.
XmlNodeList personNodes =
document.DocumentElement.SelectNodes("/Persons/Person/Age");
You can also use a relative path where the searching starts from the current node. For example, you can query all the Person node from the DocumentElement root node using the following code:
XmlNodeList personNodes =
document.DocumentElement.SelectNodes("Person");
or the age of every person usign the following code:
XmlNodeList personNodes =
document.DocumentElement.SelectNodes("Person/Age");
Notice that we didn’t precede the XPath query with a / to indicate that we are using a relative path.
We can also query nodes regardless of where they are in the document. This is usefull when you wan’t to search the whole document and return all matching nodes. For example, if you want to query all the Gender nodes, even if you are starting from the root node, then you can use the following query:
XmlNodeList personNodes =
document.DocumentElement.SelectNodes("//Gender");
We precede the element name with // to indicate that the whole document should be searched. The query will now return all the matching nodes wherever they are in the document. If you want to limit the area where the searching will be done, then you can specify the parent node or root node where the searching will start.
XmlNodeList personNodes =
document.DocumentElement.SelectNodes("/Persons//Gender");
The above code will search for all Gender elements under the Persons node.
If you want to query specific elements, then you can use their index. The following queries the third child of the Persons element.
XmlNode personNodes =
document.DocumentElement.SelectSingleNode("/Persons/Person[3]");
Since we are querying a single node, we used the SelectSingleNode() method. The third Person element is represented by Person[3] where we used 3 as the index. Note that indices are base-1, so the counting starts with 1 and not 0 as opposed to arrays in C#.
If you want to search for all the person who has a gender of male, then you can use the following code.
XmlNodeList personNodes =
document.DocumentElement.SelectNodes("//Person[Gender='Male']");
Since we used a double slash (//), then the whole document will be searched. Inside the bracket, we specify the name of the child element and after that, we specified what the value should be. The value must be enclosed in single quotes if it represents a string.
When dealign with attributes of elements, you can use the @ operator followed by the name of the attribute. For example, the following prints all the name of every person.
XmlNodeList list = document.DocumentElement.SelectNodes(@"//Person/@name");
foreach (XmlNode node in list)
{
textBox1.Text += node.Value + "\r\n";
}
XPath is a big topic and only some basic components was discussed here. If you want to study everything about XPath, then you can go to the following link:
http://www.w3schools.com/xpath/default.asp
Figure 1
Suppose you want to get the age of every person, the code for doing that is:
XmlDocument document = new XmlDocument();
document.Load("Persons.xml");
XmlNodeList nodes = document.DocumentElement.SelectNodes("/Persons/Person/Age");
foreach(XmlNode node in nodes)
{
textBoxResult.Text += node.InnerText + "\r\n";
}
After loading the document, we used the DocumentElement property which is of type XmlNode. We used the SelectNodes() method which accepts a string argument that contains the XPath query. The XPath query /Persons/Person/Age tells that get Age element that is a child of a Person element which is a child of the Persons element. All the matching nodes will then be returned as an XmlNodeList. We used a foreach loop to print each age in a text box. Figure 2 shows you some XPath operations that you can use to query specific nodes.
XPath Query Description
. Selects the current node.
.. Selects the parent of the current node.
* Selects all the child of the current node.
nodename Selects all child nodes specified by the name.
/ Selects the root node.
// Selects nodes from the current node that match the selection
expression no matter where they are.
//* Selects all elements in the document.
/element Selects the root element named element. Staring a path
with a / means you are using an absolute path to an element.
/element/* Selects all the child of the root element.
element/* Selects all the child nodes of a child element.
element/child Selects the child elements which are a child of a specified child
element of the current node.
//element Selects all elements with the specified name regardless of
where they are in the document.
element//child Selects all child elements of the parent regardless of
where they are inside the parent element.
@attribute Selects an attribute of the current node where attribute
is the name of the attribute.
//@attribute Selects all the attributes specified by its name regardless of
where they are in the document.
@* Selects all attribute of the current node.
element[i] Selects an element with the specified element name and the specified index.
text() Selects the text of all the child nodes of the current element.
//text() Selects text of every element in the document.
//element/text() Selects the text of all the matching elements.
//element[name='value'] Selects all elements with a child containing a specified value.
//element[@att='value'] Selects all elements with the specified attribute having the specified value.
Figure 2 – XPath Operations
For example, if you want to select the current node, then you will use the . operator.
XmlNode current = document.DocumentElement.SelectSingleNode(".");
Notice that we used the XmlNode.SelectSingleNode() method to only select 1 node. In case of multiple results, it will return the first matching node. The method accepted the XPath string as its argument. Passing “.” will result on returning the actual node that calls it. Also notice that the returned value is an XmlNode and not an XmlNodeList.
Suppose you want to select all the Person elements which are children of the Persons node. You can use the following XPath query.
XmlNodeList personNodes =
document.DocumentElement.SelectNodes("/Persons/Person");
Notice that we started the query with a slash (/). This indicates that we are using an absolute path. We start fromt he Persons root node, then we look at all the Person nodes which is a direct child of the root node. If we are to get every age of each person, then we can use the following code.
XmlNodeList personNodes =
document.DocumentElement.SelectNodes("/Persons/Person/Age");
You can also use a relative path where the searching starts from the current node. For example, you can query all the Person node from the DocumentElement root node using the following code:
XmlNodeList personNodes =
document.DocumentElement.SelectNodes("Person");
or the age of every person usign the following code:
XmlNodeList personNodes =
document.DocumentElement.SelectNodes("Person/Age");
Notice that we didn’t precede the XPath query with a / to indicate that we are using a relative path.
We can also query nodes regardless of where they are in the document. This is usefull when you wan’t to search the whole document and return all matching nodes. For example, if you want to query all the Gender nodes, even if you are starting from the root node, then you can use the following query:
XmlNodeList personNodes =
document.DocumentElement.SelectNodes("//Gender");
We precede the element name with // to indicate that the whole document should be searched. The query will now return all the matching nodes wherever they are in the document. If you want to limit the area where the searching will be done, then you can specify the parent node or root node where the searching will start.
XmlNodeList personNodes =
document.DocumentElement.SelectNodes("/Persons//Gender");
The above code will search for all Gender elements under the Persons node.
If you want to query specific elements, then you can use their index. The following queries the third child of the Persons element.
XmlNode personNodes =
document.DocumentElement.SelectSingleNode("/Persons/Person[3]");
Since we are querying a single node, we used the SelectSingleNode() method. The third Person element is represented by Person[3] where we used 3 as the index. Note that indices are base-1, so the counting starts with 1 and not 0 as opposed to arrays in C#.
If you want to search for all the person who has a gender of male, then you can use the following code.
XmlNodeList personNodes =
document.DocumentElement.SelectNodes("//Person[Gender='Male']");
Since we used a double slash (//), then the whole document will be searched. Inside the bracket, we specify the name of the child element and after that, we specified what the value should be. The value must be enclosed in single quotes if it represents a string.
When dealign with attributes of elements, you can use the @ operator followed by the name of the attribute. For example, the following prints all the name of every person.
XmlNodeList list = document.DocumentElement.SelectNodes(@"//Person/@name");
foreach (XmlNode node in list)
{
textBox1.Text += node.Value + "\r\n";
}
XPath is a big topic and only some basic components was discussed here. If you want to study everything about XPath, then you can go to the following link:
http://www.w3schools.com/xpath/default.asp
SelectSingleNode / SelectNodes
The selectSingleNode method returns a Node object for the first descendant node to match the specified pattern. The one parameter of this method is an XSL pattern query. If no match is made, it returns null. This method is similar to theselectNodes method, but returns only the first node to match the pattern rather than all of them.
// Load the document and set the root element. XmlDocument doc = new XmlDocument(); doc.Load("bookstore.xml"); XmlNode root = doc.DocumentElement; // Add the namespace. XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace("bk", "urn:newbooks-schema"); // Select and display the first node in which the author's // last name is Kingsolver. XmlNode node = root.SelectSingleNode( "descendant::bk:book[bk:author/bk:last-name='Kingsolver']", nsmgr); Console.WriteLine(node.InnerXml);
----------------
The primary means of reading and writing in C# 2.0 is done through the XmlDocument class. You can load most of your settings directly into the XmlDocument through the XmlReader it accepts.Loading XML Directly
XmlDocument document = new XmlDocument(); document.LoadXml(""); Loading XML From a File
XmlDocument document = new XmlDocument(); document.Load(@"C:\Path\To\xmldoc.xml"); // Or using an XmlReader/XmlTextReader XmlReader reader = XmlReader.Create(@"C:\Path\To\xmldoc.xml"); document.Load(reader);I find the easiest/fastest way to read an XML document is by using XPath.Reading an XML Document using XPath (Using XmlDocument which allows us to edit)
XmlDocument document = new XmlDocument(); document.LoadXml(""); // Select a single node XmlNode node = document.SelectSingleNode("/People/Person[@Name = 'Nick']"); // Select a list of nodes XmlNodeList nodes = document.SelectNodes("/People/Person"); If you need to work with XSD documents to validate an XML document you can use this.Validating XML Documents against XSD Schemas
XmlReaderSettings settings = new XmlReaderSettings(); settings.ValidateType = ValidationType.Schema; settings.Schemas.Add("", pathToXsd); // targetNamespace, pathToXsd XmlReader reader = XmlReader.Create(pathToXml, settings); XmlDocument document = new XmlDocument(); try { document.Load(reader); } catch (XmlSchemaValidationException ex) { Trace.WriteLine(ex.Message); }Validating XML against XSD at each Node (UPDATE 1)
XmlReaderSettings settings = new XmlReaderSettings(); settings.ValidateType = ValidationType.Schema; settings.Schemas.Add("", pathToXsd); // targetNamespace, pathToXsd settings.ValidationEventHandler += new ValidationEventHandler(settings_ValidationEventHandler); XmlReader reader = XmlReader.Create(pathToXml, settings); while (reader.Read()) { } private void settings_ValidationEventHandler(object sender, ValidationEventArgs args) { // e.Message, e.Severity (warning, error), e.Error // or you can access the reader if you have access to it // reader.LineNumber, reader.LinePosition.. etc }Writing an XML Document (manually)
XmlWriter writer = XmlWriter.Create(pathToOutput); writer.WriteStartDocument(); writer.WriteStartElement("People"); writer.WriteStartElement("Person"); writer.WriteAttributeString("Name", "Nick"); writer.WriteEndElement(); writer.WriteStartElement("Person"); writer.WriteStartAttribute("Name"); writer.WriteValue("Nick"); writer.WriteEndAttribute(); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Flush();(UPDATE 1)In .NET 3.5, you use XDocument to perform similar tasks. The difference however is you have the advantage of performing Linq Queries to select the exact data you need. With the addition of object initializers you can create a query that even returns objects of your own definition right in the query itself.XDocument doc = XDocument.Load(pathToXml); List<Person> people = (from xnode in xdoc.Element("People").Elements("Person") select new Person { Name = xnode.Attribute("Name").Value }).ToList();(UPDATE 2)A nice way in .NET 3.5 is to use XDocument to create XML is below. This makes the code appear in a similar pattern to the desired output.XDocument doc = new XDocument( new XDeclaration("1.0", Encoding.UTF8.HeaderName, String.Empty), new XComment("Xml Document"), new XElement("catalog", new XElement("book", new XAttribute("id", "bk001"), new XElement("title", "Book Title") ) ) );creates< span=""> id="bk001" </span><span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; ">Book Title</span><span class="tag" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(128, 0, 0); "> All else fails, you can check out this MSDN article that has many examples that I've discussed here and more. http://msdn.microsoft.com/en-us/library/aa468556.aspx-----------------------------------------
Subscribe to:
Comments (Atom)