Sunday, December 30, 2012

ඉන්දියාවෙන් ඉගෙන ගත හැකි පාඩම



එය අතිශයින්ම ශෝකජනක පුවතකි. 23 හැවිරිදි වෛද්‍ය ශිෂ්‍යාවක් බසයක් තුල දුෂණයට ලක් වීමෙන් අනතුරුව සිංගප්පූරුවේ රෝහලක ප්‍රතිකාර ලබමින් සිටින විට ඊයේ අවසන් ගමන් ගියාය. මෙය ලංකාවේ සිදු වුව නම් සාමාන්‍ය සිදුවීමකි .

එනමුත් ඉන්දියාවේ මහා දේශපාලනික හා සමාජීය කුණාටුවක් නිර්මාණය කිරීමට මෙම සිදුවීම සමත් වී ඇත .අවසානයේ මෙම සිසුවියගේ දේහය ඉන්දියාවට ගෙන එන ලද්දේ විශේෂ ගුවන් යානයකිනි . එය භාර ගැනීමට ඉන්දියාවේ අගමැති සහ පාලක පක්ෂ නායිකාව පැමිණ සිටියහ .

ඉන්දීය ජනතාව මෙම සිදුවීමට ඉතා ප්‍රබල විරෝධයක් මතු කල අතර අදාළ වැරදි කරුවන් 6 දෙනාට මරණ දඬුවම ලබාදෙන ලෙස බල කරමින් උද්ගෝෂණ සහ පෙළපාලි වලට ලක්ෂ ගණන් ජනතාව එක රැස්ව වුහ . මෙයින් අපට ඉගෙන ගත හැකි පාඩම වන්නේ ඉන්දීය ජනතාව තුල  තම සමාජය පිරිසිදු කිරීමට ඇති උනන්දුවයි . ඔවුන් මෙවැනි සිදුවීමක ඇති බරපතල කම ඉතා හොඳින් දැක ඇත . අප සමාජයට හැදෙන්නට මෙය ඉතා හොඳ පාඩමකි . අද මිය ගියේ වෛද්‍ය ශිෂ්‍යාවකි . හෙට එය ඔබගේ අසල වැසියාට සිදු විය හැක . ඉන් පසුව එය ඔබගේ පවුලේ අයෙකුට සිදු විය හැක . එම නිසා අදම එය නතර කල යුතුය. ඉන්දීය ජනතාව මෙය හොඳින් තේරුම් ගෙන ඇත . 

අපේ රටේ ජනතාව මෙය ඉක්මනින් අවබෝධ කර නොගත හොත් රට අරාජික තත්වයට පත් වීම සක්කරයාට  වත් නැවැත්වීමට  නොහැකි වනු ඇත .

Wednesday, September 26, 2012

10 Tips to improve your productivity by Robin sharma

1. Stop waiting for perfect conditions to launch a great project. Immediate action fuels a positive feedback loop that drives even more action.

2. Run routines. When I studied the creative lives of massively productive people like Stephen King, John Grisham and Thomas Edison, I discovered they follow strict daily routines. (i.e., when they would get up, when they would start work, when they would exercise and when they would relax). Peak productivity's not about luck. It's about devotion.

3. Get up at 5 am. Win the battle of the bed. Put mind over mattress. This habit alone will strengthen your willpower so it serves you more dutifully in the key areas of your life.

4. Don't say yes to every request. Most of us have a deep need to be liked. That translates into us saying yes to everything - which is the end of your elite productivity.

5. Stop multi-tasking. New research confirms that all the distractions invading our lives are rewiring the way our brains work (and drop our IQ by 5 points!). Be one of the rare-air few who develops the mental and physical discipline to have a mono-maniacal focus on one thing for many hours. (It's all about practice).

6. Work in 90 minute blocks with 10 minute intervals to recover and refuel (another game-changing move I personally use to do my best work).

7. Write a Stop Doing List. Every productive person obsessively sets To Do Lists. But those who play at world-class also record what they commit to stop doing. Steve Jobs said that what made Apple Apple was not so much what they chose to build but all the projects they chose to ignore.

8. Get things right the first time. Most people are wildly distracted these days. And so they make mistakes. To unleash your productivity, become one of the special performers who have the mindset of doing what it takes to get it flawless first. This saves you days of having to fix problems.

9. Get lost. Don't be so available to everyone. I often spend hours at a time in the cafeteria of a university close to our headquarters. I turn off my devices and think, create, plan and write. Zero interruptions. Pure focus. Massive results.

10. Remember that big, brave goals release energy. So set them clearly and then revisit them every morning for 5 minutes.

Wednesday, August 1, 2012

18 Rules of Living by Dalai Lama


1. Take into account that great love and great achievements involve great risk.

2. When you lose, don’t lose the lesson.

3. Follow the three Rs: 1. Respect for self 2. Respect for others 3. Responsibility for all your actions.

4. Remember that not getting what you want is sometimes a wonderful stroke of luck.

5. Learn the rules so you know how to break them properly.

6. Don’t let a little dispute injure a great friendship.

7. When you realize you’ve made a mistake, take immediate steps to correct it.

8. Spend some time alone every day.

9. Open your arms to change, but don’t let go of your values.

10. Remember that silence is sometimes the best answer.

11. Live a good, honorable life. Then when you get older and think back, you’ll be able to enjoy it a second time.

12. A loving atmosphere in your home is the foundation for your life.

13. In disagreements with loved ones, deal only with the current situation. Don’t bring up the past.

14. Share your knowledge. It’s a way to achieve immortality.

15. Be gentle with the earth.

16. Once a year, go someplace you’ve never been before.

17. Remember that the best relationship is one in which your love for each other exceeds your need for each other.

18. Judge your success by what you had to give up in order to get it.

Friday, July 20, 2012

ලාංකීය සමාජය තුල මධ්‍යම පන්තිකයාගේ අභියෝගය


මිනිසා යනු දේශපාලනික සත්වයෙකි. ඕනෑම අයෙකුට තමන්ට කැමති දේශපාලන  මතවාදයක් දැරිය හැක. ඒ පිලිබඳ අපට ගැටළුවක් නැත. අප කුමන මත වාදය දැරුවද පොදුවේ වර්තමාන ලාංකීය සමාජය තුල මධ්‍යම පන්තිකයා මුහුණ දෙන ගැටළු සම්බන්ධව විවරණයක් ඉදිරිපත් කිරීම මගේ බලාපොරොත්තුවයි.

අපට දේශපාලන නායකයන්ට ඕනෑ තරම් අවලාද නැගිය හැකිය. නමුත් ඒවායින් කිසිදු ප්‍රතිපලයක්  නොලැබෙන බව අමුතුවෙන් කිව යුතු නැත. අප කුමක් කීවද ඔවුන් ඔවුන්ට අවේනික දහදුරා වැඩ ටික කලට වෙලාවට නියම ආකාරයට සිදු කර ගනී. දේශපාලනික වශයෙන් රට ගොඩ දැමිය හැකි නායකයෙකු පෙනෙන තෙක් මානයක නැත. රටේ නිතිය සදාචාරය සම්බන්ධ පැහැදිලි ගැටළු පැන නැගී ඇත. එසේ නම් අපට කල හැක්කේ කුමක්ද? යම් තරමක වත් කමක් ඇති ඇතැම් දෙනෙක් වෙනත් රටවල් කරා සංක්‍රමණය වෙති. එය ඔවුන්ගේ තෝරාගැනීමය. නමුත් බහුතරයකට එසේ රට හැර දමා යා නොහැක. එසේ නම් අප කල යුත්තේ වල කටින්ම ගොඩ ඒමට උත්සහ දැරීමය. ඒ සඳහා මාගේ යෝජනා මාලාව පහතින් සඳහන් කරන්නෙමි.

  1. අපගේ මානුෂික ගති පවතුම් දියුණු කර ගත යුතුය. ඒ සඳහා ඔබගේ ආගම ඔබට උපකාර වනු ඇත.
  2. නිශ්චිත ඉලක්කයක් ඔස්සේ ජීවිතය ඉදිරියට ගෙන යා යුතුය.
  3. ඔබගේ සැබෑ හැකියාවන් හඳුනා ගෙන ඒ ඔස්සේ ඉදිරියට යාමට උත්සහ කල යුතුය.
  4. තමන්ගේ මුල හඳුනාගෙන කිසිම දිනෙක මුල අමතක නොකළ යුතුය. තමන්ගේ දෙමාපියන්, සහෝදරයන් කිසිම දිනෙක අමතක නොකළ යුතුය
මෙම කරුණු වෙත ඔබගේ අවධානය යොමු කරන අතර ඉතා වැදගත්ම කරුණ වන්නේ ඔබ වටා සිටින පුද්ගලයන් කුමන ආකාරයේ කෙනෙහෙලි කම් කලද තමන්ගේ උදාර ගති ගුණ නොසෙල්වෙන ලෙස ජිවත් විය යුතුය. එවිට ඔබ සැබෑ මනුෂ්‍යයෙක් වනු ඇති බව මාගේ විශ්වාශයයි.

ඔබගේ සාර්ථක ජීවිතය ගොඩ නැගීමට කිසිම විටක ඔබ ප්‍රමාද නැත. අවශ්‍ය වනුයේ ඔබගේ උනන්දුව පමණි. අනෙකුත් සැම දෙයක්ම ඔබ කර පැමිණීම අනිවාර්ය වේ.

කිසි ලෙසකින්වත් ඔබගේ උත්සාහය අත් නොහරින්න. ඉදිරියටම යන්න. ජයග්‍රහණය ඔබ කර ලඟා වනු නියතය.

ඔබ ජීවිතය සාර්ථක කර ගත පසු ඔබට දේශපාලකයන් කුමන දේ කලද ඔබට ශක්තිමත් මිනිසෙකු ලෙස ජිවත් විය හැක. එවිට ඔවුන් ඔබ කරා පැමිණෙනු ඇත.

Thursday, May 31, 2012

Beating Dengue


I am publishing this on behalf of Mr. Alailima since i felt that this is very useful for SriLankans at this moment.

By       Talavou Alailima
Founder and Chairman of Power World Gyms

In the early hours of the 19th April 2012, the doctors of the Lady Ridgeway Hospital (LRH) Medical Intensive care (MICU) were fighting to save the life of my 5 month baby son Jason, after having been diagnosed with a severe attack of dengue. It was the first time LRH-MICU had dealt with such a badly managed dengue case of a baby in its history, and the job of not only dealing with this severe dengue attack, but also undoing the damage done due to the bad management of Jason’s dengue, fell into the hands of a brilliant young pediatrician Dr. Daham de silva who was a senior registrar at the hospital. If not for his out of the box, bold and aggressive treatment of Jason, with the support of Dr. Srilal de silva and Dr. Nalin Kithulwaththa the head consultants of the MICU, and God’s direct intervention of making the impossible, possible, Jason my son would have been lost.
Such a disaster deserves reflection on where I failed as a father and what I could have done better as a parent to have protected my 5 month baby from this dreadful disease. This write up is about sharing with you the lessons I learnt and what all of us should know and understand about what can and must be done, to beat dengue!

1. If your child is under the age of one year and gets fever, show the child to a board certified pediatrician immediately. Ideally, one who is also linked to a government hospital. Board certified means that their credentials are in order. The fact that they are also linked with a government hospital further confirms their qualification and also, if the situation goes terribly wrong, the government’s emergency setup is the best way to deal with life and death situations.
2. If your child has fever and you are concerned that it could be dengue, get a blood test called “Dengue Antigen”, as it tells you whether you have dengue or not even after one day of fever, unlike the standard “Dengue Antibody” blood test that needs several days of having fever before you can get a positive test for dengue. This delay in time of knowing whether your child has dengue or not, gives the virus more time to succeed in weakening your child’s ability to fight it.

3. Beating dengue is about knowing as early as possible whether you or your child has it, because at such an early stage you or your child’s platelet count may even be within the normal range and you can win the fight with ease from that position of strength.
This was the case with my 3 year old second son Jonathan who got fever just a day after my 5 month baby Jason, and was warded in the hospital for dengue as well. The Dengue Antigen blood test showed he was positive for dengue but the platelet count was at 160,000 just above the lower end of the normal range. Because we were able to react early with this information, the lowest the platelet count was able to go was 80,000 before it turned around.

4. Even though it is said that there is no treatment for dengue, the indirect treatment for dengue does save lives. Balancing the intake and outflow of fluids is critical and at the heart of the solution. Roughly 50% of deaths are due to the mismanagement of dengue and 50% is due to a delay in providing treatment for dengue. Many hospitals and doctors are getting this balancing act wrong, more times than we are willing to believe. So, please don’t take your eyes off the ball, believing that the doctor or hospital will not get it wrong and everything will be fine.

5. The dengue virus' goal is to create a deficiency of vital nutrients to other life sustaining cells while it attacks important organs. The virus however, has only a maximum of a 6 day window to do this, from the day that the fever first appears. If it fails to overcome us within that window of time, we win! The proper management of dengue is to keep supplying the vital nutrients etc., to the body to support its ability to fight. The Full Blood Count test and a few others taken every 6 to 12 hours help us to know the direction of the attack, so that we can counter attack it by knowing how to support the body. This kind of support and management of dengue is the only way to beat it. Therefore, who the doctor is and where this support is provided is absolutely critical and central to the battle.

6. When you have fever, only take Panadol as a principle! Do not take any other fever reducing medicine such as Dolor, Brufen etc. If you do, and you or your child has dengue, and the fight goes down to the wire, this will tip the balance against you. The simple reason being that most other fever reducing medication has the ability to increase the leaking of blood from vessels and organs which begins to take place in dengue patients when the platelet counts go below 100,000.

7. What drove me to cycle in a fever medication, in between the 6 hourly Panadol dose when my second son Jonathan of three got fever, was the fear of him getting a fit if the fever rose too high which, I feared could lead to brain damage or so I thought. I believe I am not alone in this line of thinking and that is why I am addressing this issue as well.

I am told that such fear is misplaced and that brain damage does not take place if your child gets a fit as a result of high fever. If a fit does take place, turn the child on to his/her left and within 5 minutes the fit will end. However, if the fit extends beyond 10 minutes, show the child to a doctor to confirm that all is fine.

If the fever rises between Panadol doses, tepid sponge the child to bring comfort. Tepid sponging also does not guarantee that a fit will not take place in a child that may have a history of having fits because of fever or has a family history of such fits taking place.

If we follow the above instructions diligently, beating the dengue virus will be a walk in the park!

Wednesday, May 30, 2012

Ten Inspirational quotes to brighten your day


“There are only two ways to live your life. One is as though nothing is a miracle. The other is as though everything is a miracle.” – Albert Einstein



“The best years of your life are the ones in which you decide your problems are your own. You do not blame them on your mother, the ecology, or the president. You realize that you control your own destiny.” – Albert Ellis



“The trouble with not having a goal is that you can spend your life running up and down the field and never score.” – Bill Copeland



“If what you’re doing is not your passion, you have nothing to lose.” - Unknown author



“The person who says something is impossible should not interrupt the person who is doing it.” - Unknown author



“It is never too late to be what you might have been.” – George Eliot



“All our dreams can come true – if we have the courage to pursue them.” – Walt Disney



“What the mind can conceive, it can achieve.” – Napoleon Hill



“It is not because things are difficult that we do not dare; it is because we do not dare that things are difficult.” – Seneca



Great minds discuss ideas. Average minds discuss events. Small minds discuss people.” ~ Eleanor Roosevelt

Porn & addiction...sex out of context



On a cold, dark night, there's nothing better than a blazing fire in the fireplace. You can pile on the wood and let it burn nice and warm. It's safe, warm, relaxing and romantic. Now take that same fire out of the fireplace (which was built for it) and drop it in the middle of the living room. Suddenly it becomes destructive. It can burn down the whole house and kill everyone inside. Sex is like that fire. As long as it's expressed in the protective commitment of a marriage relationship, it's wonderful, warm and romantic. But porn takes sex outside that context.

It's a big business that makes a lot of money and doesn't care how. They'll show you whatever they think will make you come back and buy more. "There were 11,000 porn video titles last year versus 400 movie releases from Hollywood last year...[and] 70,000 pornographic web sites."1

What Fuels Porn Addiction
One of the most vital parts of mental environment is a healthy idea of who we are sexually. If these ideas are polluted, a critical part of who we are becomes twisted. The porn culture tells you that sex, love and intimacy are all the same thing. In porn, people have sex with total strangers -- people they just met. All that matters is my satisfaction. It doesn't matter whose body I'm using, as long as I get it. Porn gets you to think that sex is something you can have anytime, anywhere, with anyone, with no consequences.

The problem with porn's shallow perspective is that relationships are not built on sex, but on commitment, caring and mutual trust. In that context, like fire in the fireplace, sex is wonderful. Being with someone who loves and accepts you, someone who is committed to you for your whole lives together, someone you can give yourself completely to, that is what makes sex really great.

To Find Freedom from Porn Addiction: Recognize the Lies
You can't learn the truth about sex from pornography. It doesn't deal in truth. Pornography is not made to educate, but to sell. So, pornography will tell whatever lies attract and hold the audience. Porn thrives on lies -- lies about sex, women, marriage and a lot of other things. Let's look at some of those lies and see just how badly they can mess up your life and attitudes.

Lie #1 - Women are less than human
The women in Playboy magazine are called "bunnies," making them cute little animals or "playmates," making them a toy. Penthouse magazine calls them "pets." Porn often refers to women as animals, playthings, or body parts. Some pornography shows only the body or the genitals and doesn't show the face at all. The idea that women are real human beings with thoughts and emotions is played down.

Lie #2 - Women are a "sport"
Some sports magazines have a "swimsuit" issue. This suggests that women are just some kind of sport. Porn views sex as a game and in a game, you have to "win," "conquer," or "score." Men who buy into this view like to talk about "scoring" with women. They start judging their manhood by how many "conquests" they can make. Each woman I "score" with is another trophy on my shelf, another "notch" in my belt to validate my masculinity.

Lie #3 - Women are property
We've all seen the pictures of the slick car with the sexy girl draped over it. The unspoken message, "Buy one, and you get them both." Hard-core porn carries this even further. It displays women like merchandise in a catalog, exposing them as openly as possible for the customer to look at. It's not surprising that many young men think that if they have spent some money taking a girl out, they have a right to have sex with her. Porn tells us that women can be bought.

Lie #4 - A woman's value depends on the attractiveness of her body
Less attractive women are ridiculed in porn. They are called dogs, whales, pigs or worse, simply because they don't fit into porn's criteria of the "perfect" woman. Porn doesn't care about a woman's mind or personality, only her body.

Lie #5 - Women like rape
"When she says no, she means yes" is a typical porn scenario. Women are shown being raped, fighting and kicking at first, and then starting to like it. Porn teaches men to enjoying hurting and abusing women for entertainment.

Lie #6 - Women should be degraded
Porn is often full of hate speech against women. Women are shown being tortured and humiliated in hundreds of sick ways and begging for more. Does this kind of treatment show any respect for women? Any love? Or is it hatred and contempt that porn is promoting toward women?

Lie #7 - Little kids should have sex
One of the biggest sellers in pornography is imitation "child" porn. The women are "made-up" to look like little girls by wearing pony tails, little girl shoes, holding a teddy bear. The message of the pictures and cartoons is that adults having sex with kids is normal. This sets the porn user up to see children in a sexual way.

Lie #8 - Illegal sex is fun
Porn often has illegal or dangerous elements thrown in to make sex more "interesting." It suggests that you can't enjoy sex if it isn't weird, illegal or dangerous.

Lie #9 - Prostitution is glamorous
Porn paints an exciting picture of prostitution. In reality, many of the women portrayed in pornographic material are runaway girls trapped in a life of slavery. Many having been sexually abused. Some of them are infected with incurable sexually transmitted diseases that are highly contagious and often die very young. Many take drugs just to cope.
Bottom Line of Porn Addiction
Pornography makes a profit from the ruined lives of young women and entraps men who will spend lots of time AND money succumbing to their product.

We might think that the things we see and hear don't affect us. Yet we all admit that good music, good movies and good books add a lot to our lives. They can relax us, educate us, move us or inspire us. Just as uplifting media can benefit us, pornographic images can negatively affect us.

Images are not always neutral. They can persuade us. Businesses know that if they can get a persuasive image of their product in front of you during a highly emotional moment, it will sink into your subconscious mind. The advertising scientists are so good at what they do, they can predict just how much more of their product you will buy if you see their ad. Sometimes, viewers don't even see the name of the product. Reese's Pieces paid a huge price just to have their candy shown for a few seconds in the movie "ET," and sales of Reese's Pieces skyrocketed. Why? Because the emotions connected with watching that small boy reaching out to the alien were transferred to the visual image of the candy. If a split second view of a product -- even when it's not the center of attention -- can affect people's behavior, imagine the effect of a movie that keeps your attention glued to the screen for an hour and a half with sexually explicit images.

What are the effects of pornography on a man?
What kinds of ideas is porn putting into our heads? If the wrong things keep getting dumped in, your mental environment can get so polluted that your life is going to have problems. One of the most vital parts of mental environment is a healthy idea of who we are sexually. If these ideas are polluted, a critical part of who we are becomes twisted.

Porn Addiction: The Pull of Pornography
Not everyone who sees porn will become addicted. Some will just come away with toxic ideas about women, sex, marriage, and children. However, some will have some kind of emotional opening that allows the addiction to really grab hold. The porn companies don't mind at all if you become completely addicted to their product. It's great for business. Dr. Victor Cline has divided the progress of addiction into several stages; addiction, escalation, desensitization, and acting out. For porn addicts, I've found that there is another stage that comes first -- early exposure. Let's look at these stages:

EARLY EXPOSURE
Most guys who get addicted to porn start early. They see porn when they are very young and it gets its foot in the door.

PORN ADDICTION
You keep coming back to porn. It becomes a regular part of your life. You're hooked and can't quit.

ESCALATION
You start to look for more graphic pornography. You start using porn that disgusted you earlier. Now, it excites you.

DESENSITIZATION
You start to become numb to the images you see. Even the most graphic porn doesn't excite you any more. You become desperate to feel the same thrill again, but you can't find it.

ACTING OUT SEXUALLY
This is the point where men make a crucial jump and start acting out the images they have seen. Some move from the paper and plastic images of porn into the real world, with real people, in destructive ways.

Porn Addiction: Am I Addicted?
If you see any of these patterns in your life, you need to put the brakes on right now. Is porn becoming more and more in control of your life? Do you have trouble putting it down? Do you keep going back for more?

Porn Addiction: What Can I Do?
The first thing you've got to do is admit that you struggle with pornography. Believe me, you are not strange or unusual if you do. Millions of men are at various stages in the struggle with porn. It's really not surprising. The porn industry has spent billions of dollars trying to snare you. Is it really shocking that they have succeeded? For some of you there may also be issues in your past, such as abuse or sexual exposure, that makes porn addiction even harder to shake. There is only so much you can do in fighting addiction without help.

You need someone to help you break this addiction. Overcoming the secrecy is absolutely vital. You probably can't escape addiction without it. That doesn't mean everyone has to know you're struggling. Pick someone you can trust who counsels men who are having problems with addiction -- a pastor, youth group leader or counselor. Someone you can completely trust, feel safe with and has experience in the area of addiction isn't going to be surprised.

Is There Any Freedom from Porn Addiction?
Pornography entraps you with lies. In contrast, God can lead us into truth. Jesus said, "If you hold to my teaching, you are really my disciples. Then you will know the truth, and the truth will set you free."2 Those who heard Jesus say this were offended and countered, "We have never been slaves of anyone, how can you say that we shall be set free?"3 And Jesus explained that people are enslaved to sin, but that He can set you free.4

Sin not only enslaves us, but it distances us from God. And no one is perfect. No one is righteous in God's eyes. Instead we're told that "We all, like sheep, have gone astray, each of us has turned to his own way."5 We all deserve God's judgment and punishment. Yet God, who is holy and loving, provided a solution for our sin, so that we would not have to be justly condemned. He personally took the punishment for our sin on Himself. Jesus Christ, the Son of God, was tortured and died on the cross for our sin so that we could be forgiven. Three days later Jesus rose from the dead, just as He said He would. And He now offers you a relationship with Him. One of the most amazing statements in the Bible is this one, "If we confess our sin, he is faithful and just to forgive us our sin and to cleanse us from all unrighteousness."6

The Most Important Relationship
In your search for intimacy and love, pornography is an empty substitute for real love. We have been created by God to have our intimacy needs met most deeply by God Himself. "For God so loved the world that he gave his only Son, that whoever believes in him should not perish, but have everlasting life."7 In contrast to the darkness and destruction that pornography can bring to people's lives, Jesus said, "I came that they might have life, and have it more abundantly."8 God offers you his forgiveness through a relationship with Him. Do you want to ask Him to forgive you and come into your life? You can tell Him right now. If you need help putting this into words, here is prayer that might help:

"Lord Jesus, I am aware of my sin, and I know that you are also. I ask you to forgive me and cleanse me. Thank you for dying on the cross for my sins. I ask you to come into my life right now and begin to work in my life. Direct my life as you see fit. Thank you for your forgiveness and for coming into my life right now."

This article is taken from this website.
http://www.everystudent.com/wires/toxic.html

Sunday, May 27, 2012

ජනතා අපේක්ෂා සහ සරත් ෆොන්සේකා ගේ නිදහස


දිනෙන් දිනම ජිවන බරින් තෙරපෙමින් සිටි ජනතාවට තමන් මුහුණ දෙමින් සිටින ප්‍රශ්න අමතක කරවීමට මේ ආණ්ඩුව විටින් විට නොයෙකුත් ප්‍රයෝග ක්‍රියාත්මක කරනු දැක ගත හැකි විය. මෙම ක්‍රියාදාමයේ නවතම විකාශය වන්නේ සරත් ෆොන්සේකා මහතා නිදහස් කිරීමය.

එතුමා ගේ නිදහස් වීම මගින් ආණ්ඩුව එක ගලෙන් කුරුල්ලන් දෙදෙනෙකු මරා ගැනීමට සමත් වී ඇති බවක් පෙනෙන්නට ඇත. ඉන් පළමු කරුණ ඉහත විස්තර කල කරුණය. දෙවැන්න නම් දිනෙන් දින ඉහල යමින් තිබු ෆොන්සේකා මහතා ගේ ජනප්‍රියත්වය එතුමා හරහා ම බින්දුවට බැස්සිමය. සිර ගෙදරින් නිදහස් වූ ෆොන්සේකා මහතා ගෙන් ජනතාව අපේක්ෂා කලේ යුධ අපරාධ හෝ හමුදා බැරැක්ක ඉවත් කිරීම ගැන ප්‍රකාශ නිකුත් කිරීම නොවන බව එතුමා තේරුම් ගෙන නැත.ඇත්ත නම් එතුමාට ඒවා තේරුම් ගැනීමට අවශ්‍ය තාවයක් නැති බවය.

මන්ද යත් එතුමා තමන් තනිවම යුද්ධය දිනවූ බව ප්‍රකාශ කිරීමට නිතර උත්සුක වීමෙන් පෙනී යන්නේ එතුමා තම පෞද්ගලික දේශපාලන උවමනාවන් වෙනුවෙන් පෙනී සිටිනව මිස එතුමාට ජනතාව ගැන කැක්කුමක් නැති බවය. සරත් ෆොන්සේකා මහතා ගේ නිදහස් වීම පිලිබඳ වැඩිම බලාපොරොත්තු තබාගෙන සිටියේ එතුමාට චන්දය දුන් මෙරට යමක් කමක් තේරුම් ගත හැකි බුද්ධිමත් ජනතාව බව අප ට පෙනෙන්නට තිබුණි. නමුත් එතුමා නිදහස් වී සති දෙකක් ගතවෙන්නටත් පළමුව එතුමා ගේ ප්‍රකාශ මගින් අපට පෙනී යන්නේ එතුමා සහ මෙරට පාලක පන්තිය අතර වෙනසක් නැති බවය. එසේ නම් ජනතාව නැවතත් අපේක්ෂා භංගත්වයට  පත්වී ඇත.

Tuesday, May 22, 2012

Difference between TCP and UDP internet protocols

TCP
UDP
Reliability: TCP is connection-oriented protocol. When a file or message send it will get delivered unless connections fails. If connection lost, the server will request the lost part. There is no corruption while transferring a message.
Reliability: UDP is connectionless protocol. When you a send a data or message, you don't know if it'll get there, it could get lost on the way. There may be corruption while transferring a message.
Ordered: If you send two messages along a connection, one after the other, you know the first message will get there first. You don't have to worry about data arriving in the wrong order.
Ordered: If you send two messages out, you don't know what order they'll arrive in i.e. no ordered
Heavyweight: - when the low level parts of the TCP "stream" arrive in the wrong order, resend requests have to be sent, and all the out of sequence parts have to be put back together, so requires a bit of work to piece together.
Lightweight: No ordering of messages, no tracking connections, etc. It's just fire and forget! This means it's a lot quicker, and the network card / OS have to do very little work to translate the data back from the packets.
Streaming: Data is read as a "stream," with nothing distinguishing where one packet ends and another begins. There may be multiple packets per read call.
Datagrams: Packets are sent individually and are guaranteed to be whole if they arrive. One packet per one read call.
Examples: World Wide Web (Apache TCP port 80), e-mail (SMTP TCP port 25 Postfix MTA), File Transfer Protocol (FTP port 21) and Secure Shell (OpenSSH port 22) etc.
Examples: Domain Name System (DNS UDP port 53), streaming media applications such as IPTV or movies, Voice over IP (VoIP), Trivial File Transfer Protocol (TFTP) and online multiplayer games etc

4 steps for dropping into peaceful meditation – at your desk


Whether you have a strong practice or are just starting out, here are some building blocks for creating mindfulness at work. A note of caution: If you receive lots of interruptions, consider closing your door, putting up a sign, or going someplace where you can be alone for five to 10 minutes.

1. Perk up your posture.

Sitting at desks, we spend most of the day slouching forward. Do your spine a favor and sit up tall in the middle of the chair, without the chair back's support. Place both feet flat on the ground. Rest your palms on your thighs and gently drop your shoulders away from your ears and your shoulder blades together on your back. Tuck your chin down just slightly and pull your belly in and up. Take a nice, deep breath and close your eyes.

2. Tune in to your breath.

Spend a minute or so simply breathing. Follow the breath as it moves up and down the spine, and be aware that the breath is not just in the front body ­– it's a 360-degree effort. Notice how the side bodies expand and how the back body responds. A great technique that Burdulis shared is noticing the temperature of the breath above the upper lip and how it changes on the inhale and exhale.

3.  Relax the whole body.

As you continue to breathe slow, deep breaths, begin to relax your body. I like to start either with the feet and work to the crown of the head, or vice versa. Bring your awareness to each portion of your body and mentally give it permission to relax. Don't skip your jaw, your eyes and your forehead, common tension-holders in addition to our shoulders and hips.

4. Truly listen – first, without and then within.

Now that you're relaxed, bring your awareness to what's outside of you. Listen as if through earmuffs, allowing the sounds to exist but not becoming attached to them. Now, shift your focus completely internal, listening to the sounds within your body such as your breath and heart beat. If you can't hear yourself, simply strive to hear. Sit in this way for five to 10 minutes. As thoughts arise, simply bring your focus back to the breath.

You might find it hard at first to concentrate or detach yourself from the day's stress, but don't judge or second-guess yourself. There is no right way to meditate, and there is no failure. Any quiet moment of reflection will do, if only a nanosecond. As Burdulis said: "I don't know anybody who won't benefit from this."

The key is to keep at it. Schedule yourself mindfulness appointments and stick to them. The more you practice, the "easier" it will be to drop inward and find your center amidst a busy workday.

Friday, May 11, 2012

Abraham Lincoln’s letter to his son’s Head Master

Abraham Lincoln’s letter to his son’s Head Master

Respected Teacher,



  • My son will have to learn I know that all men are not just, all men are not true. But teach him also that for ever scoundrel there is a hero; that for every selfish politician, there is a dedicated leader. Teach him that for every enemy there is a friend.

  • It will take time, I know; but teach him, if you can, that a dollar earned is far more valuable than five found.

  • Teach him to learn to lose and also to enjoy winning.

  • Steer him away from envy, if you can.

  • Teach him the secret of quite laughter. Let him learn early that the bullies are the easiest to tick.

  • Teach him, if you can, the wonder of books.. but also give him quiet time to ponder over the eternal mystery of birds in the sky, bees in the sun, and flowers on a green hill –side.

  • In school teach him it is far more honourable to fail than to cheat.

  • Teach him to have faith in his own ideas, even if every one tells him they are wrong.

  • Teach him to be gentle with gentle people and tough with the tough.

  • Try to give my son the strength not to follow the crowd when every one is getting on the bandwagon.

  • Teach him to listen to all men but teach him also to filter all he hears on a screen of truth and take only the good that comes through.

  • Teach him, if you can, how to laugh when he is sad. Teach him there is no shame in tears. Teach him to scoff at cynics and to beware of too much sweetness.

  • Teach him to sell his brawn and brain to the highest bidders; but never to put a price tag on his heart and soul.

  • Teach him to close his ears to a howling mob… and to stand and fight if he thinks he’s right.

  • Treat him gently; but do not cuddle him because only the test of fire makes fine steel.

  • Let him have the courage to be impatient, let him have the patience to be brave. Teach him always to have sublime faith in himself because then he will always have sublime faith in mankind.


This is a big order; but see what you can do. He is such a fine little fellow, my son.


Abraham Lincoln.

Saturday, April 28, 2012

Installing joomla on ubuntu in 15 minutes


This is a simple and easy to use guide to install joomla without any permission issues on ubuntu. You can successfully install joomla within 15 minutes.

Let's start the clock and start working.

First you need to have a web server on your local machine. Xampp is the most popular open source web server which installs all the required components for your web server.
Download XAMPP for Linux to your your Home folder.

Install XAMPP


Open Terminal and enter:

sudo tar xvfz xampp-linux-1.7.7.tar.gz -C /opt


(replace xampp-linux-1.7.7.tar.gz with the version of XAMPP you downloaded).

This installs ... Apache2, mysql and php5 as well as an ftp server.

Start the xampp server with this command.

sudo /opt/lampp/lampp start

Test your XAMPP localhost server


Open your Browser and point it to
http://localhost
The index.php will redirect to
http://localhost/xampp
There you will find instructions on how to change default usernames/passwords. On a PC that does not server files to the Internet or LAN then changing the defaults is personal choice.

Get Joomla


Download the latest Joomla instalation zip [1]

Unzip to your hard drive

Connect to localhost with an FTP client. You can use FileZilla client as an open source ftp client. you can download it from here

http://filezilla-project.org/download.php

once you installed filezilla, start filezilla and connect to your localhost server with following information.

host: localhost

username: nobody

password: lampp

Create a folder for your Joomla on the localhost server

FTP the unpacked Joomla installation files to the newly created Joomla folder. You can drag and drop files using filezilla client.

Important:
  • The XAMPP installation sets the correct Ownership of the files and permissions.


  • Using the CHOWN command will cause Ownership problems with xampp.


  • Using nautilus to manipulate folders/files on localhost will cause Ownership problems with xampp.


Configure Joomla


In your Browser type
http://localhost/yournewjoomlafolder
In the first Joomla installation screen if error reporting is shown as on then:

In your Terminal type

sudo gedit /opt/lampp/etc/php.ini


In the php.ini file, locate

error_reporting =

And change the value to

error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED

Also locate

display_errors = On

And change the value to

display_errors = Off


Stop then restart xampp for the new settings to take effect

FTP layer is NOT needed

Then  go to your phpmyadmin database page and create a database for the joomla installation. You can do this by going to your localhost folder and then click on the phpmyadmin link and then it will take you to the phpmyadmin home page.

create a database named db_joomla (or whatever name you like)

once the database is created, go to the phpmyadmin home page and click on previleges tab and create a new user and asign all the previleges from the option.

username: user_joomla

password: joomla123 (Best practise is to use the generate password option).

OK. Now you have a separate database for your joomla installation.

Database info

Host: localhost

Database name: db_joomla
Database user: user_joomla
Password for Database user: joomla123
Administrator password is your choice.

Installing Sample Data is recommended for the novice user.

After installation delete the installation directory and point your Browser to:
http://localhost/yournewjoomlafolder
or
http://localhost/yournewjoomlafolder/administrator
That's it. Now you have installed joomla on your ubuntu machine within 15 minutes.
Cheers !!!!!!!!!!!


Thursday, April 26, 2012

Find File existence in windows in C++


Windows doesn't have a built-in function that checks if a file with a given name exists. It can be trivially written using GetFileAttributes or FindFirstFile APIs. Version below uses GetFileAttributes.

/* Return TRUE if file 'fileName' exists */
bool FileExists(const TCHAR *fileName)
{
    DWORD       fileAttr;

    fileAttr = GetFileAttributes(fileName);
    if (0xFFFFFFFF == fileAttr)
        return false;
    return true;
}

Wednesday, April 25, 2012

change mysql port on xampp

 Nice to be back with another solution for a common (not so) problem which google takes some time to find a proper solution. As mentioned in the title of the post, this thing happens when i was installing xampp server on my office computer. After successfully installing the xampp server, i was trying to start the mysql service using the control panel. But when i start the mysql service, it was trying to start but finally it was failing to start on port 3306. It gave some error about port 3306.

After few hours of google search i realized that the root cause for this issue was that port 3306 is using by another mysql service which was installed from another application. Then i had to change the port number to another one to start the mysql service on xampp server.

To change the port successfully, i had to change the port number in following files in the mentioned manner.

You can change the port number to 3308 from 3306 in \xampp\mysql\bin\my.ini file in a couple of places.

There is also a couple of default MySQL port settings in the \xampp\php\php.ini file that would also need changing.

Save the files and restart Apache and MySQL to test.

Cheers !!!!!!!!!

Sunday, April 22, 2012

How to change the root password in Ubuntu


As default Ubuntu has no password set for the root user, To gain root access you have to type in your own user password. This is the password you set for the first user while installing Ubuntu.

To manually set a password for the root user, type in the following in the shell:
sudo passwd

After that you are asked to type in the new root password twice. Finally, your root user has its own password.

Thursday, April 12, 2012

How to pin Eclipse to the ubuntu 11.04 Unity launcher

 If you are developing in ubuntu with eclipse, you may want  to add your eclipse shortcut to the ubuntu unity launcher. But if you open the eclipse, you may see that the eclipse is in the launcher, but the icon is not displaying and only a question mark icon appears. This is a simple solution to add ubuntu icon to the launcher menu. You can use the same procedure to add any other program to your launcher menu.
  1. Go to the ubuntu desktop and right click on it.
  2. Select, "Create Launcher.." option.

        3. Fill the required fields as shown in the below image.



In the command field above, select the eclipse file inside the eclipse folder in your file system.

        4. Select the icon by clicking the icon box in the top left hand corner and go to the eclipse folder in your file system and choose the eclipse icon "eclipse.xpm" and it will be display as below after the correct selection.



        5. Now you can see eclipse icon on the desktop. Double click the icon and start eclipse.
        6. Now the eclipse icon can be seen in your launcher since it is started. Right click the eclipse icon on the launcher and select the option "Keep in Launcher ..".
        7. Exit the eclipse and now you can see that eclipse is displayed in the launcher and the icon is properly displayed


cheers !!!!!!!!!!

Android testing with Monkey tool - a comprehensive guide


If you are in the android scene for some time, you may have heard about this tool. Monkey tool is a simple but very important tool to test android applications for their stability. It is a command-line tool that you can run on any emulator instance or on a device. Basically it sends out random key events and clicks to the device or emulator. If you have done testing on WM devices, you may have used a similar testing tool called hopper. In this tutorial i am hoping to guide you through the basic operations you can do with monkey tool and also some more advance and specific tasks.

The Monkey includes a number of options, but they break down into four primary categories:
  • Basic configuration options - such as setting the number of events to attempt.
  • Operational constraints - such as restricting the test to a single package.
  • Event types and frequencies - such as key events, click events and time interval between events.
  • Debugging options.

When the Monkey runs, it generates events and sends them to the system. It also watches the system under test and looks for three conditions, which it treats specially:

  • If you have constrained the Monkey to run in one or more specific packages, it watches for attempts to navigate to any other packages, and blocks them.
  • If your application crashes or receives any sort of unhandled exception, the Monkey will stop and report the error.
  • If your application generates an application not responding(ANR) error, the Monkey will stop and report the error.

Depending on the verbosity level you have selected, you will also see reports on the progress of the Monkey and the events being generated.

That's enough .... where is the actual test? ....

How to run monkey?

As mentioned above, monkey is a command line tool. In a command line or in a linux terminal window, you can run your first monkey test with the following command.

$>adb shell monkey -v 100

adb - connect to the device
shell - start the terminal (command line) on the device/emulator
monkey - start the monkey tool
-v - verbose mode
100 - number of random events to be sent

You will see some messages displaying on your command line window and if you are fortunate you may experience that monkey tool exits before it completes 100 events due to some exception or ANR scenario. But that will depend on the random events it sends and the applications you have. 

How to run monkey on my own application?

OK.. Now you know how to run monkey and what are things it can do up to some level. Let's run this test entirely on your own application. Let's you have installed the package "com.marakana.android.yamba" and you want to test this application against random clicks.

$>adb shell monkey -p com.marakana.android.yamba -v 500

-p - This will specify the application package you need to test. 

How to run the same event sequence again?

Sometimes you may want to check whether a particular failure always happens or randomly happens in an application. In a such scenario, you may need to run the exact same event sequence with monkey tool. You can achieve that goal like this.

Run your first test with

$>adb shell monkey -p com.marakana.android.yamba -s 999 -v 500

Go back to the same status in the device and run the above command again

$>adb shell monkey -p com.marakana.android.yamba -s 999 -v 500

-s - This will give the random seed value to generate the random events.

Note: It is essential to start both the tests with the same status in the device. Otherwise It will not give you the same result even though it sends the same events.

This tool has many more features and you can learn about these features from the android developer guide here http://developer.android.com/guide/developing/tools/monkey.html

Cheers !!!!!!!

Wednesday, April 11, 2012

ජීවිතය සහ දහම

 




හරයෙන් තොර දැවයෙන් කවර ප්‍රයෝජනද? ගුණයෙන් තොර ඖෂධයෙන් කවර ප්‍රයෝජනද? රසයෙන් හා පෝෂණයෙන් තොර ආහාරය කුමකටද? එමෙන්ම ධර්මයෙන් තොර ජිවිතයෙන් ඇති ඵලය කවරේද?
ධර්මය සැබවින්ම ජීවිතය අලංකාර කරයි. ශක්තිමත් කරයි. වටිනා බවට පමුණුවයි. ධර්මයෙන් වෙන්ව කවර සැපතක්ද? කවර ප්‍රීතියක්ද? ධර්මය නම් ජිවිතයේ හරයයි. ජිවිතයේ ඵලයයි. ධර්මය අමතක කොට, ධර්මය නොසලකා යමෙක් ජිවත් වෙයි නම් ඔහු සැමවිටම වටිනා මනුෂ්‍ය දිවිය නිකරුනේ විනාශ කර ගනියි.
ඔබ කියන වචන, කරන වැඩ, සිතන සිතුවිලි සියල්ලම ධර්මානුකුල විය යුතුය. දිනපතා ඔබගේ ජීවිතය ධර්මයට අනුව ගමන් කරන්නේදැයි සිතා බැලිය යුතුය. එසේ නොවෙයි නම් අද සිටම ධර්මානුකුලව ජීවිතය ගෙන යාමට උත්සාහ කල යුතුය. එසේ නොකළහොත් ඔබගේ ජිවිතයෙන් නියම ප්‍රයෝජනය ඔබට ලබා ගත නොහැකි වනු ඇත.

Tuesday, April 10, 2012

monkeyrunner tutorial - running tests on multiple devices with monkeyrunner

OK.. Great ... Now you know what is monkeyrunner and how to run tests with monkeyrunner. Let's discuss about one important feature of the monkeyrunner tool. Running tests on multiple devices with a single python script.

It looks like a big ask. But that is as simple as drinking a Sri Lankan Tea ...
By following my previous posts

http://chanakaudaya.wordpress.com/2012/03/31/android-testing-with-monkeyrunner-a-monkeyrunner-tutorial/
http://chanakaudaya.wordpress.com/2012/03/31/android-testing-with-monkeyrunner-a-monkeyrunner-tutorial-part-ii/

now you are running some scripts with monkeyrunner. Let's add some little bit of information to that script.

#First you need to import the modules which you are using in this script
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice

#Then you have to connect to the device which you are running your test
device = MonkeyRunner.waitForConnection()

Wait here !!!!!!


In this script you are waiting for a connection to a running android device or emulator implicitly. Rather than doing like that, you can explicitly tell what emulator or device you may need to connect. You can do that like this.

# Timeout value for waiting for connection 10 seconds
timeout = 10000 


# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection(timeout, "emulator-5554")


here you specify which device you need to connect by the id of the emulator or device.
 If you want to connect to another device within the same script, you can do like this

device2 = MonkeyRunner.waitForConnection(timeout, "emulator-5556")

Then you can do all the operations you have done with device parameter to device2 parameter.
With this kind of scripting, you can run commands on as many devices you have with you. I believe in sample scripts in tutorials. Here is a sample script in action.


# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
# Timeout value for waiting for connection
timeout = 10000

# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection(timeout, "emulator-5554")

# Installs the Android package. Notice that this method returns a boolean, so
# you can test to see if the installation worked.
device.installPackage('/home/chanaka/workspace/SimpleIntentPreference/bin/SimpleIntentPreference.apk')

# sets a variable with the package's internal name
package = 'com.chanaka.android.sip'

# sets a variable with the name of an Activity in the package
activity = '.SimpleIntentPreferenceActivity'

# sets the name of the component to start
runComponent = package + '/' + activity

# Runs the component
device.startActivity(component=runComponent)

# Wait for few seconds
MonkeyRunner.sleep(2)

# Presses the Menu button
device.press('KEYCODE_MENU', MonkeyDevice.DOWN_AND_UP)

# Wait for few seconds
MonkeyRunner.sleep(2)

#Touch the new status button
device.touch(160, 460, 'DOWN_AND_UP')

# Wait for few seconds
MonkeyRunner.sleep(2)

# Connects to the current device, returning a MonkeyDevice object
device2 = MonkeyRunner.waitForConnection(timeout, "emulator-5556")

# Installs the Android package. Notice that this method returns a boolean, so
# you can test to see if the installation worked.
device2.installPackage('/home/chanaka/workspace/SimpleIntentPreference/bin/SimpleIntentPreference.apk')

# sets a variable with the package's internal name
package = 'com.chanaka.android.sip'

# sets a variable with the name of an Activity in the package
activity = '.SimpleIntentPreferenceActivity'

# sets the name of the component to start
runComponent = package + '/' + activity

# Runs the component
device2.startActivity(component=runComponent)

# Wait for few seconds
MonkeyRunner.sleep(2)

# Presses the Menu button
device2.press('KEYCODE_MENU', MonkeyDevice.DOWN_AND_UP)

# Wait for few seconds
MonkeyRunner.sleep(2)

#Touch the new status button
device2.touch(160, 460, 'DOWN_AND_UP')

# Takes a screenshot
result = device.takeSnapshot()

# Wait for few seconds
MonkeyRunner.sleep(2)

# Writes the screenshot to a file
result.writeToFile('/home/chanaka/status_update.png','png')

#Touch the first preference
device2.touch(160, 30, 'DOWN_AND_UP')

#Touch the entre button
device2.press('KEYCODE_DPAD_CENTER', MonkeyDevice.DOWN_AND_UP)

# Takes a screenshot
result2 = device2.takeSnapshot()

# Writes the screenshot to a file
result2.writeToFile('/home/chanaka/shot1.png','png')

Saturday, April 7, 2012

solution for ubuntu not loading stuck in grub terminal


This has cost me lot of my time and effort to recover from this weird situation. There were some other methods to get rid of this situation. But i had a more unique requirement. That i needed my ubuntu installation restored. Because there were lot of things inside my ubuntu installation which were really important. I hope you are someone like me. You don't need loss your ubuntu installation.

Let's move on. 

I had ubuntu installed inside windows 7 using the wubi installer. One day i have shut down the machine after using with ubuntu and i disconnected my power supply before the system shuts down. Unfortunately , my laptop battery has been removed at that time (for a replacement) and when i disconnect the power supply it was totally without power. Next time when i started the machine and i select the ubuntu from operating system selection menu, it goes to grub terminal..

something like this 

grub>

There was a note mentioning that you can see the commands by pressing TAB key. I have tried various methods mentioned in internet and i had lost one of my partitions by doing those things. But finally i found a solution.

When you boot Windows and look in the C:\ubuntu\disks directory you'll notice the root.disk is missing. In some cases, the \ubuntu\disks directory is missing completely or is corrupted.

Running chkdsk
Depending on the problem, Windows may have run an automatic chkdsk or you may need to run it manually. It's not always necessary, but it will never hurt, so the first thing is to run it.
  • Go to My Computer on XP or Computer on Vista/7,
  • right click the drive you installed Ubuntu on e.g. right click on C:,
  • select Properties, select the Tools tab, then under Error-checking click Check now.
  • Select to Automatically fix file system errors or Scan for and attempt recovery of bad sectors 
  • When the drive you installed on is C: the computer will tell you it has to schedule the scan for the next time you start your computer. Reboot to complete. 


Locate recovered files/directories
The first thing to do is to look for the \found.000 folder on the drive in question i.e. C:\found.0000. This is hidden by default and (on my Windows 7 install) I also had to tell Windows not to "Hide protected OS files" just to see it. You may also have to recover from an administrator command prompt on Win7 (see below).

Hit the START key, enter CMD, then look above and right click on CMD.exe and select "Run as
Administrator".


C:\>cd \found.000
C:\found.000>dir
 Volume in drive C is OS
 Volume Serial Number is B4B7-99A8

 Directory of C:\found.000

19/07/2011  02:02 PM    15,000,000,000 file0000.chk
               1 File(s)              8 bytes
               0 Dir(s)  222,258,069,504 bytes free


So now you look for your root.disk (or other .disk files) and copy them back to the \ubuntu\disks folder. If the entire \ubuntu\disks folder is missing, you'll likely find a dir0000.chk directory and within that the root.disk, swap.disk and empty \boot\grub folders. Copy this back to \ubuntu renaming the directory todisks.

C:\found.000>move file0000.chk \ubuntu\disks\root.disk
        1 file(s) moved.

or if the whole disks folder is recovered
C:\found.000>move dir0000.chk \ubuntu\disks
        1 dir(s) moved.


If you're missing the root.disk but there is no file of that name, it may have been renamed chk0000.chk. Rename this to root.disk and copy back to \ubuntu\disks.

If the corruption was minor, then likely everything will work fine. If the corruption is major Windows may not even recover the root.disk at all.

I hope this helps you to recover your files. Remember to backup important data on your Wubi install. There's no reason to install important personal files on a root.disk - you can access them easily on the /host partition.

Cheers !!!!!!!!!!!

This site has helped me in solving this issue 


Thursday, April 5, 2012

Method to find a file in a directory with C++

Sometimes you may want to check whether a particular file is in the system programatically. Following is a C++ method you can use in Windows enviornment to search for a particular file.


BOOL FindFile(TCHAR* fileName)
{
WIN32_FIND_DATA data;
        //Folder to be searched
HANDLE h = FindFirstFile(L"\\Windows\\*.*",&data);
BOOL returnValue = FALSE;
if( h!=INVALID_HANDLE_VALUE ) 
{
do
{
TCHAR*   nPtr = new TCHAR [lstrlen( data.cFileName ) + 1];
for( int i = 0; i < lstrlen( data.cFileName ); i++ )
nPtr[i] = TCHAR( data.cFileName[i] );


nPtr[lstrlen( data.cFileName )] = '\0';
if(_tcscmp(fileName, nPtr)==0)
{
returnValue == TRUE;
break;
}
//cout << nPtr << endl;


} while(FindNextFile(h,&data));



FindClose(h);


return returnValue;
}

You can call this method inside your main application as mentioned below.

FindFile((LPTSTR)(_T("myfile.xxx")));

Import native DLL into a C++ program

When you are writing C++ programs, sometimes you may need to use third party dll files in your application. This tutorial is a comprehensive guide to using a native dll within a C++ application. Before we start the coding, let's have a small introduction about dynamic loading.


What is Dynamic Loading?

Normally, when you link to a DLL via a LIB file (for example, the MFC DLLs), the DLL is loaded when your application starts up. This kind of loading is referred to as implicit linking, because the system takes care of the DLL loading for you - all you have to do is link with the LIB file.

Dynamic loading (a.k.a. dynamic linking) means that your application loads a DLL just before you call a function in the DLL. For dynamic loading, you do not use a LIB file. Instead, what you do is call a pair of Win32 API functions (LoadLibrary/GetProcAddress) that load the DLL and then retrieve the address of a function in the DLL. Because you explicitly invoke these APIs, this kind of loading is also referred to as explicit linking. To summarize:


  • implicit linking - DLL is loaded automatically when your app starts
  • explicit linking - you write code to load DLL

following acronyms are used in the programming world for these two types of linking.

static linking - static loading, static linking, implicit linking, implicit loading, automatic loading

dynamic linking - dynamic loading, explicit linking, explicit loading, manual loading

Why Use Dynamic Loading?

Before I get into the details of dynamically loading DLLs, let me first answer the question: When is it desirable to dynamically load a DLL? Here are the typical scenarios:


  • You don't have a lib file to link with - this is a pretty lame reason, since if you worked at it you could generate a LIB file. On the whole, though, generating a LIB file is probably more work than just using LoadLibrary/GetProcAddress to dynamically load a DLL.

  • A DLL may not always be present - if you want to provide for some graceful program degradation, you must dynamically load any DLL that may or may not be present on the target machine (example: UXTHEME.DLL, which exists only on XP). If you used implicit linking, your application would never have the chance to degrade gracefully - the system simply would not allow your app to start, and would instead display some alarming message to your user.

  • You need to support multiple feature sets - this is one of the historically valid reasons for using dynamic loading. If you have a product that supports many different features, and you want to load only those features that the customer has paid for, then what you do is package each feature set in its own DLL, and ship the DLL to the customer when he orders it. This is also a very convenient way to add new features (read: plug-ins) to your product, essentially making it open-ended.

  • You need to support multiple platforms - this is also one of the historically valid reasons for using dynamic loading. You need to support multiple platforms (Win98, Win2000, WinXP) and each platform requires slightly different code for some reason. A simple solution is to segregate the code for each platform in its own DLL.

  • You need to speed up the time it takes to load your application - this is another historical reason for using dynamic loading. You will start thinking about this when customers start complaining about how slow your app is to load. The idea is to identify what DLLs are necessary to display the core UI, and then dynamically load all the other DLLs that your app needs.

How to implement with in the code?

Let's start the actual coding. Let's say you have a dll file which is named as mylibrary.dll. You have so many methods inside that library. You need to use the method Start(BOOL id) within your application.

Define a constant name for your dll file. (This is optional)
#define MY_LIBRARY_NAME TEXT("mylibrary.dll")

Declare a Handle for the library file instance.
HINSTANCE g_hinstLibrary;

Define a function pointer to the method you are willing to call from the dll. Signature of the definition should be equal as the actual method.

typedef BOOL (__stdcall *LPFN_START)(BOOL);

Declare a variable of the defined function pointer type
LPFN_START g_sStart;

Load the library file into the instance variable
g_hinstLibrary = ::LoadLibrary(MY_LIBRARY_NAME);

Get the Process address of the specific method you are going to use in your application

if (NULL != g_hinstLibrary)
{
//Get API addresses
g_sStart = (LPFN_START )GetProcAddress((HMODULE)g_hinstLibrary, TEXT("Start"));
          }

Now you can call the Start(BOOL id) function within your applications main method (or any other method) as below.

if(NULL != g_sStart)
{
      g_sStart(10);
}


Once you are finished using the function, Release the loaded library

if (NULL != g_hinstLibrary)
{
FreeLibrary(g_hinstLibrary);
}

This blog has helped me to write this post and some of the sections are copied from there.


Cheers !!!!!!!!!!!!!




Monday, April 2, 2012

Flower, Thunder and You

  • Be soft as a flower when it comes to kindness but 

tough as thunder when it comes to principle.

  • Be courteous and polite at all times but 

never be pushed around

  • Ensure that you are always treated with respect

Sunday, April 1, 2012

ඉනි මගේ ඉහලට

කුල භේදය යන වදන අපගේ දෙසවනට වැටෙන විට අපට සිහි වන්නේ පැරණි ඉන්දීය සමාජය හෝ අතීත සිංහල රජ කාලයයි. එසේ නමුදු මේ කුල භේදය සමාජය තුල සැමදා පවතින බවට ඕනෑ තරම සාක්ෂි තිබේ. වත්මනෙහි එය දුප්පත්, පහල මධ්‍යම, ඉහල මධ්‍යම සහ සුපිරි පැලැන්තිය ලෙස අපට දල වශයෙන් හඳුනා ගත හැක. දුප්පතා උත්සාහ කරන්නේ තමන්ට ඉහලින් ඇති ස්ථරයකට නැගීමටය. අනෙකුත් ස්තර තුල සිටින මිනිසුන්ද එසේමය. (මේ කියන්නේ බහුතරය ගැනය. ). එසේ නමුදු මේ සමාජ ස්තර හරහා ඉහලට නගින මිනිසුන් කිසිම විටෙක තමා ලබන ජයග්‍රහණයන් ගෙන් සැහීමකට පත් වන්නේ නැත. ඔවුන් බොහෝ දෙනෙකුට සතුටු වීමට වෙලාවක් නැත. මන්ද ඔවුන් සැම විටම ඉනි මගේ ඉහලට නගිමින් සිටින නිසාය. එසේ නමුදු තමන්ට ලැබෙන දෙයින් සතුටින් ජිවත්වන ඉතා සුළු පිරිසක්ද මේ සමාජයේ සිටිති. ඔවුන් ඉනි මගේ ඉහලට යාම වෙනුවට තමන්ගේ සතුට සොයා යති. ඔවුන්ට පිනක් දහමක් කිරීමට, සතුටු වීමට, විනෝද චාරිකා යාමට කාලය ඕනේ තරම් තිබේ. එසේ නම් අප උත්සාහ කල යුත්තේ ඉනි මගේ ඉහලට නැගීමට පමණක්ද? අප යම් මොහොතක ඉනි මගේ නැවතී අප ලද ජයග්‍රහණයන්ගෙන් සතුටු විය යුතුය. මුදල් පසු පසම හඹා යාම මගින් අපට කිසි දිනෙක සතුට ලඟා කර ගත නොහැක. ඉනි මගේ ඉහලට නගින අතර මදක් නැවතී ඔබගේ සතුට ගැන දෙවරක් සිතන්න. 

Saturday, March 31, 2012

robotium button click not working solution

I also had this issue and i couldn't find a solution with robotium. Then i move to the android instrumentation provided with the SDK. What i have done is mentioned below. This worked without any issues for me. Here it is ..




First define a private variable for the button as a member variable
private Button msButton; 

 Then get the button instance with in the setup method.


mButton = (Button) solo.getCurrentActivity().findViewById(
                com.marakana.android.simple_intent.R.id.sendButton);



Then call the button click with in the UI thread in the test method as mentioned below.

//Test button method

public void testButtonClick() {
 

//Get the current activity and request to run onUI thread       
        solo.getCurrentActivity().runOnUiThread(new Runnable() {


            public void run() {


//Request focus for the button
                mButton.requestFocus();
            }
        });


//Send the button click event
        this.sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
      
    }


That's it .. Now you can test your button with other Robotium features.
Cheers !!!!!!!!

Install Sinhala fonts in ubuntu

This is so simple. just type the following command in terminal window.'

sudo apt-get install ttf-sinhala-lklug

That's it. Now you can see Sinhala fonts

Friday, March 30, 2012

Android testing with monkeyrunner - a monkeyrunner tutorial part II

I hope that now you have an idea about what is monkeyrunner and what you can do with it. Let's start doing them.



How to install?
Oh .. oo .. you don't need to install it separately. It comes with Android SDK package. Inside your android-sdk-windows or linux package, inside tools directory, you can find this tool monkeyrunner.



How to run monkeyrunner?
If you want to run monkeyrunner from anywhere within the command line, you need to add the path of the monkeyrunner directory(\tools ) to your system PATH variable. changing path variable can be seen in this simple post .
http://chanakaudaya.blogspot.com/2012/03/how-to-change-path-variable-in-ubuntu.html



once you have the PATH variable set, you are ready to go.... But wait .. you should have something to run with monkeyrunner. It is none other than a python script.
Let's write a simple python script to test your application.

How to write your first script?
monkeyrunner API provides 3 modules which are located in com.android.monkeyrunner namespace. You will be using these modules to run your tests with monkeyrunner tool.



  • MonkeyRunner: A class of utility methods for monkeyrunner programs. This class provides a method for connecting monkeyrunner to a device or emulator. It also provides methods for creating UIs for a monkeyrunner program and for displaying the built-in help.
  • MonkeyDevice: Represents a device or emulator. This class provides methods for installing and uninstalling packages, starting an Activity, and sending keyboard or touch events to an application. You also use this class to run test packages.
  • MonkeyImage: Represents a screen capture image. This class provides methods for capturing screens, converting bitmap images to various formats, comparing two MonkeyImage objects, and writing an image to a file.
If you can't understand what these modules are for and what you are going to do with them, It's OK. you will know about them as you read the next section.

  1. First you need to import the modules which you are using in this script
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice

  1. Then you have to connect to the device which you are running your test

device = MonkeyRunner.waitForConnection()

  1. Then you need to install the application package to the device
device.installPackage('Yamba/bin/Yamba.apk')

(Here the folder name is given as a relative path. Yamba folder should be located in the same directory in which you are currently in. You can give the absolute path as well.
For Windows users,
you can give the path as ('C:\\Program Files\\Yamba\\bin\\Yamba.apk') as your absolute path. 


  1. set the package and the activity to be started

package = 'com.marakana.android.yamba'
activity = '.MainActivity'
runComponent = package + '/' + activity

  1. Run the activity on the device

device.startActivity(component=runComponent)

  1. Wait for 2 seconds before sending the next command

MonkeyRunner.sleep(2)

  1. Send a menu button press event

device.press('KEYCODE_MENU', MonkeyDevice.DOWN_AND_UP)

  1. Wait for 2 seconds before sending the next command

MonkeyRunner.sleep(2)

  1. Send a touch event to a button located at bottom center of an HVGA device

device.touch(200, 390, 'DOWN_AND_UP')

  1. Wait for 2 seconds before sending the next command

MonkeyRunner.sleep(2)

  1. Take a screenshot of the resulting window

result = device.takeSnapshot()

  1. Write the screenshot to a file

result.writeToFile('Yamba/status_update.png','png')



Name this script as test.py and save it on your current directory. (You can save it anywhere...)
Now it looks like this

# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()
# Installs the Android package. Notice that this method returns a boolean, so
# you can test to see if the installation worked.
device.installPackage('Yamba/bin/Yamba.apk')
# sets a variable with the package's internal name
package = 'com.marakana.android.yamba'
# sets a variable with the name of an Activity in the package
activity = '.MainActivity'
# sets the name of the component to start
runComponent = package + '/' + activity
# Runs the component
device.startActivity(component=runComponent)
# Wait for few seconds
MonkeyRunner.sleep(2)
# Presses the Menu button
device.press('KEYCODE_MENU', MonkeyDevice.DOWN_AND_UP)
# Wait for few seconds
MonkeyRunner.sleep(2)
#Touch the new status button
device.touch(200, 390, 'DOWN_AND_UP')
# Wait for few seconds
MonkeyRunner.sleep(2)
# Takes a screenshot
result = device.takeSnapshot()
# Wait for few seconds
MonkeyRunner.sleep(2)
# Writes the screenshot to a file
result.writeToFile('Yamba/status_update.png','png')

Then on the command line or in a terminal window type this command

monkeyrunner -v ALL test.py

(wait … what is this -v ALL thing …

-v is for verbose mode
ALL is for printing all the messages from monkeyrunner tool )

now you can see that the test is running on your device(s) or emulator(s).

cheers !!!!!!!!!