Tuesday, January 27, 2009

function to build string Ex : Input 1a2b3c Output abbccc


private void btnTest_Click(object sender, EventArgs e)
{
MessageBox.Show(Build(textBox1.Text));
}


private String Build(String strInput)
{
String strOutput = "";
String tChar = "";
int nTimes = 0;
int nLen = 0 ,nPointer=0;
// strInput = "4a";
Char[] strChar = strInput.ToCharArray();
nLen = strChar.Length;
while(nPointer<nLen)
{
nTimes = 0;
bool bInt = true;
while (bInt && nPointer < nLen)
{
int res = 0;
bInt = Int32.TryParse(strChar[nPointer].ToString(),out res);
if(bInt)
{
nTimes = (nTimes * 10) + res;
nPointer++;
}
}
bInt = false;
tChar = "";
while (!bInt && nPointer < nLen)
{
int res = 0;
bInt = Int32.TryParse(strChar[nPointer].ToString(), out res);
if (!bInt)
{
tChar = tChar + strChar[nPointer];
nPointer++;
}
}
for (int n = 0; n < nTimes;n++ )
{
strOutput = strOutput + tChar;
}

}
return strOutput;
}

Tuesday, January 20, 2009

Loading Excel File C# & VB

HI
this is the code for Loading excel file data to DataSet

String strConn = "";
String str =""; //should assign the name of the excel file
Dataset myDataSet = new DataSet();
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + str + ";" +
"Extended Properties=Excel 8.0;";
myDataSet = new DataSet();
OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn);
myCommand.Fill(myDataSet, "ExcelInfo");


VB Code
Dim strConn As String = ""
Dim str As String = ""

Dim myDataSet As Dataset = New DataSet()
strConn = ("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=") + str & ";" & "Extended Properties=Excel 8.0;"
dt = New DataTable()
myDataSet = New DataSet()
Dim myCommand As New OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn)
myCommand.Fill(myDataSet, "ExcelInfo")

Msn Lifestyle -Relationship

Keeping your marriage alive
By Meenakshi Shankar

Marriage is something that most of us end up taking for granted. Little of course, realizing the institution needs a lot of work. I still remember before I had kids, we actually went to bed at the same time every night. We spoke about our respective jobs - trivial details which made up our evenings so special. Those little touches, the warm fire beneath those feathery touches made up for a romantic evening.

But all that changed after the baby came along. We just moved into the Phase II of our relationship. There were many nights one of us would take the night shift while the other one slept. As the kids got older, I would sometimes use the after-bedtime hours as my office hours. Wise men/women said "Romance can be challenging when you have children". And I couldn't help but agree.

I recently read an article in which a woman of young children said that sex no longer existed for her and her husband. The truth of the matter is, if a husband and wife don't try to keep the fires burning in their marriage, the stress and demands of having children can sap every scrap of energy until there's nothing left for romance. While being a mother is one of the most important things you'll ever do, having a solid and thrilling marriage is just as important. Kids who see their parents madly in love are more likely to grow up and have strong marriages themselves.

Small things go a long into making your marriage click:

• Before going to bed, make sure that you chat with your partner about his/her work or how was his/her day.
• Reminisce the times you had and try to re-live it.
• Go out on a date once awhile without your kids.
• Try to remember or do the things you used to do for your partner.

• Be more open to your partners needs and feelings.

• Live each day as if it is your last, in that way you would make an effort of being sweeter to your partner.

• Spend less time watching the TV on your own, instead spend time with each other.

• Give something to your partner once in awhile like a certain gift that he/she would appreciate.

• Surprise your partner.

• Take care of yourself and make sure that you look pleasant to his/her eyes.

And if you are in a mood for seduction:

• Set the stage for seduction - Just before he goes to work, give him a long, passionate kiss which holds the promise to suprise and probably forget all about his sexy young thing back at the office.

• Send him a kinky email - Know the time that he's tuned into a meeting and send him something really short and sexy. Don't write a soap opera, but be a tease

• Drop off our baby to your mother's place and have a splurge day - Buy sexy lingerie, do your hair and order in food. Plan a perfect evening.

• Work your magic with your fingers - Who says that being a mom takes you off the genie pedestal. You still are a sexy little genie and work your magic with your fingers. Give him a good rub with essential oils. Treat him to something soothing and relaxing.

And sit back and enjoy your evening whilst it takes rainbow like hues.

Source: India Syndicate

Saturday, January 10, 2009

Healthy LifeStyle from MsN

What can be done to help people change?

Everyone talks about achieving it, but most people have plenty of excuses as to why they can’t, won’t, or don’t want to change their current status. The most common excuse people make for not trying to have a healthy lifestyle is “a lack of time.” Have you ever said to yourself, “Oh, I’m tired, I don’t have time to exercise?” or “I don’t feel like cooking dinner tonight; let’s just get some fast food.”

Yes Dorothy, excuses are real and they are contagious.

Time and health always seem to be at odds with each other. We have time to work, time to commute, time for our business associates, but very little time to spend on ourselves, people we love, or even random people who deserve our attention.

What can you do in 10 minutes or less?

More than you think. In a brief 10 minute window you can release tension, prevent future frustrations, get your blood flowing, etc. In fact, here are 50 things you can do. With time out as an excuse, what are you going to begin doing differently tomorrow? I don't care what it is, the point is, just do something!

Here are some ideas. If you have other thoughts, leave them in the comments!
1. Brush your teeth

2. Do 15 sit-ups

3. Read the health news headlines of the day

4. Straighten your posture

5. Eat an apple

6. Stand up and stretch

7. Send a friendly email to a friend

8. Resist the impulse purchase of a candy bar

9. Post an inspirational quote on Twitter

10. Do 10 lunges

11. Drink a glass of water

12. Smile

13. Put a package of oatmeal in your pocket or purse for a healthy breakfast or snack

14. Throw a bottle of water in there as well

15. Plug your cell phone into the charger

16. Pay a bill online

17. Ask to have your salad dressing on the side

18. Start a dollar jar to be added to once per day

19. Open a window

20. Say thank you to someone who deserves it

21. Take a deep breath

22. Put on your seat belt

23. Wake up 10 minutes earlier

24. Post a comment on a blog

25. Turn off the lights when you’re the last one out

26. Put on your make-up (this usually pertains to the ladies, but hey, whatever makes you happy)

27. Share a healthy recipe

28. Give your mother a call

29. Wash your hands

30. Put on hand lotion

31. Check your blood pressure

32. Jog in place for 9 minutes

33. Throw away that pen that doesn’t work

34. Take a canvas tote bag to the grocery store

35. Ask a friend to join you for a healthy dinner

36. Put down the remote control and get up to change the TV channel

37. Hug your kids

38. Replace your next cup of coffee with a cup of tea

39. Lay out your clothes for the next day

40. Put your car keys in the same place everyday

41. Take a 10 minute break

42. Suck on a breath mint

43. Add a little pepper to your salad

44. Load the dishwasher

45. Play FreeRice for 5 minutes

46. Take a quick walk

47. Prepare your coffee maker the night before

48. Skip your late evening grocery store run

49. While watching TV, do 5 push-ups during the commercial

50. Read this list over again and count how many things pertain to you
These things take no time at all but they all could ensure a positive day and a healthier lifestyle. How many of these do you or can you do in a day? What other things can you add to the list?

Whatever you choose to do, make your day healthier and happier. If you can, do the same for someone else too, because, after all, it’s about a healthy lifestyle!

Written on 4/09/2008 by Shelly DeVous.

Friday, January 2, 2009

Tips to get smarter, better at work








Custom Search


Tips to get smarter, better at work
Here are some simple and effective tips that could enhance your career to a greater extent.
1. Effective communication forms the foundation for a positive work alliance. You need to be able to tell your potential ally what you need and listen deeply to what they need.

2. Treat your allies as equals. No matter their position within your organization, all people are equal; they just have different jobs. Believe this.

3. Exhibit total professionalism. Never participate in gossip or in discussing the business of coworkers behind their backs.

4. Make sure you are not forming an exclusive club that the rest of your organization will fear and resent. But, you must take the time to develop strong relationships with your allies.

5. When working on a project together, always put forth your best efforts. Be the person who is willing to do extra to strengthen the collaboration and the outcome or product.

6. Keep your promises. If you say you will do something, do it. People need to depend upon you and the deadlines to which you commit.

7. Resolve any conflicts or disputes at your earliest opportunity. Unresolved conflict festers just under the surface in organizations.

8. Be an ally. Support your colleague’s ability to accomplish his or her mission, too. Give credit for ideas and solutions.

9. Effective managers delegate and don’t micromanage. Prioritize your tasks to focus on the important ones.

10. Your workspace should keep you motivated, not provide hot spots for daydreaming. Dress up your desk with items that keep you focused.

11. Too much to do at work? Add another task to your list: take a vacation and relax. People can’t operate at full throttle on the job day after day.

12. It’s a fact that taking breaks will increase productivity. It’s been proven in studies. If you need to, find someone to help ensure you take a morning and afternoon break.

13. Establish a routine of planning your week and your day. This will allow you to have your most productive week all the time.

14. Delegate or delete the non-essential items from your to-do list. The best way to do this is to always do your most important things first.

15. Make sure you plan in enough time between activities and appointments, and find ways to fail proof being on time.

16. Choose to enjoy your time at work. Find others who are like this and spread good cheer. It’s contagious and it grows.

17. Deadlines, tough bosses, rude clients, slow computers. Don’t make them into large dramas. Don’t lament the challenges of the world.

18. Try doing something different. If you always go on a trip, try taking a more local vacation, and really get some good rest time.

19. When you complain or fight on everything, then your power to ask for things is diminished. Save it up for when you really need it.

20. Don’t wait for your company to tell you what to do. Think creatively about how you can work with others to generate a greater result than if you had each worked on this alone.

21. If you are asked a question that stumps you or surprises you, never feel like you have to answer it right away. Seek more time to think about or research your answer.

22. Don’t immediately reject critiques from others, even if you don’t like or respect them. Sometimes people you don’t like may be giving you more honest feedback.

23. Be open to change. Give it a chance. Adapt to new things while using your experience to guide you, and you will have great success.

24. Always be on the lookout for opportunities to learn and improve your skills. Look for good seminars and training.

25. Set up a routine for “busy days” - perhaps you work 2-4 extra hours, and stick to that schedule, working nothing beyond it.

26. Schedule things like “break”, “coffee”, or even “video games” into your calendar just like you would a conference call.

27. There is a time and a place for perfectionism - when things are busy, consciously choose the areas in which you are willing to slack.

28. Whether it be business or personal support, busy times call for a morale boost on a regular basis. Hire a temp virtual assistant or call a good friend.

29. Everyone has a few things that are guaranteed to bring your stress level down to normal. Know your ‘relax buttons’ and get them on your schedule now.

30. For many people, a computer is the central tool at work. Optimizing the energy settings for computers and other devices can be more than a modest energy saver.

Source: India Syndicate