July 12, 2014

Dynamically Add/Remove Rows In HTML Table Using JavaScript



In this example, I'll show you how to create dynamic HTML table which will display table rows having these properties:

1. User can add rows of table dynamically which contains the list and textbox when press button named "Add More...". 

2. User can remove the row of his choice too. 

3. Here I set the maximum number of rows can be generated. 



HOW I DONE THIS? Well I counted the total number of items in the list and fixed the maximum count number there. Like I have 3 item in the list present in row, then this code will allow user to generate the three (03) rows only. And will show error when user tries to add another row after the 3rd one.

4. Here I set the validation check on text field.




I'm using the donation amount field for this example which can accept only digit value either contains decimal or not. So If user tries to SAVE the record, application will prompt the user to enter the amount which should be greater than 0 and should be a digit value.

Here is source Code of this application:


 <!DOCTYPE html>  
 <html xmlns="http://www.w3.org/1999/xhtml">  
 <head>  
   <title>Dynamically Add/Remove Rows In HTML Table Using JavaScript</title>  
   <script type="text/javascript">  
     function addRow(tableId) {  
       var listValues =  
           [{ value: "1", text: "Charity 1" }, { value: "2", text: "Charity 2" }, { value: "3", text: "Charity 3" }];  
       document.getElementById('hdnListCount').value = listValues.length;  
       var table = document.getElementById(tableId);  
       var listCount = document.getElementById('hdnListCount').value;  
       var rowCount = table.rows.length;  
       if (rowCount <= listCount) {  
         var row = table.insertRow(rowCount);  
         // Column 1   
         var cell1 = row.insertCell(0);  
         var ddlId = "ddlCharity" + ((rowCount - 1) + 1);  
         var element1 = document.createElement('select');  
         element1.setAttribute('id', ddlId);  
         for (var i = 0; i < listValues.length; i += 1) {  
           var option = document.createElement('option');  
           option.setAttribute('value', listValues[i].value);  
           option.appendChild(document.createTextNode(listValues[i].text));  
           element1.appendChild(option);  
         }  
         cell1.appendChild(element1);  
         // Column 2  
         var cell2 = row.insertCell(1);  
         var txtId = "txtDonationAmount" + ((rowCount - 1) + 1);  
         var element2 = document.createElement("input");  
         element2.setAttribute('id', txtId);  
         element2.type = "text";  
         element2.setAttribute('value', '0');  
         cell2.appendChild(element2);  
         // Column 3  
         var cell3 = row.insertCell(2);  
         var btnId = "btnDelete" + ((rowCount - 1) + 1);  
         var element3 = document.createElement("input");  
         element3.setAttribute('id', btnId);  
         element3.type = "button";  
         element3.setAttribute('value', 'Delete');  
         element3.onclick = function() { removeRow(btnId); };  
         cell3.appendChild(element3);  
       } else {  
         alert('You can add ' + listCount + ' charity-donation details only!');  
       }  
     }  
     function removeRow(btnDelete) {  
       var table = document.getElementById('dataTable');  
       var rowCount = table.rows.length;  
       for (var i = 0; i < rowCount; i++) {  
         var row = table.rows[i];  
         var rowObj = row.cells[2].childNodes[0];  
         if (rowObj.id == btnDelete) {  
           table.deleteRow(i);  
           rowCount--;  
         }  
       }  
     }  
     function saveDetail() {  
       var table = document.getElementById('dataTable');  
       var rowCount = table.rows.length;  
       var rowState = "";  
       if (rowCount > 1) {  
         for (var i = 1; i <= rowCount; i++) {  
           var row = table.rows[i];  
           var charitySelect = row.cells[0].childNodes[0];  
           var donationAmount = row.cells[1].childNodes[0];  
           if (donationAmount.value == "0") {  
             alert("Donation amount should be greater than 0");  
             donationAmount.focus();  
             break;  
           }  
           var isValidRegex = /^\d+$/;  
           if (!isValidRegex.test(donationAmount.value)) {  
             alert("Donation amount should be a digit value");  
             donationAmount.focus();  
             break;  
           }  
           rowState = rowState + charitySelect.value + "," + donationAmount.value + ":";  
           document.getElementById('hdnTableState').value = rowState;  
         }  
       } else {  
         alert('No record present!');  
       }  
     }  
   </script>  
 </head>  
 <body>  
   <input type="button" name="btnSave" value="Save" onclick="saveDetail();" />  
   <input type="button" value="Add More..." onclick="addRow('dataTable')" />  
   <input type="hidden" id="hdnListCount" />  
   <input type="hidden" id="hdnTableState" />  
   <table id="dataTable" width="350px" border="1">  
     <tr>  
       <th>Charity  
       </th>  
       <th>Donation Amount  
       </th>  
       <th>Action  
       </th>  
     </tr>  
   </table>  
 </body>  
 </html>  

Hope you understand the whole logic. Let me know if any query remains.

5 Signs It's Time To Leave Your Day Job And Become An Entrepreneur

Entrepreneurship isn't really something you can measure, but there are ways to tell when the timing is right. Here are five signs that you might be ready for life as a founder. 

1. You have an idea: This may seem blatantly obvious but, often, the idea behind a startup is not thought through as deeply as it needs to be. Too many wannabe founders set out to start a company in a predefined space, with the goal of being their own boss. Your goal should not be to work for yourself, your goal should be to solve a problem.

"I didn't start Unikey because I wanted to start a company, I started Unikey because I had an idea. I thought we could build something pretty cool. So, I think you really need to have an idea, and some experience on executing that idea, and then you start a company. You don't start a company and then figure out what you're going to do," said Phil Dumas, president at Unikey Technologies.

This idea has to be a part of you. It cannot merely be something you have put a little bit of thought to, it has to be something that consumes you and something you have stewed over. You must have considered every facet of this idea and all of its potential outcomes. People don't get excited about a business because it's a business, they get excited about the idea behind a business.

"It's not enough to have just a thought of what a product should be. I think you really need to put it down on paper and have a great sense of what you want to build. After that yes, you can hire people and they can help you along the way," Adam Mashaal, creator of Mashfeed, said. Adding, "At the end of the day when you are building a company you are selling a product. What really creates a successful business is the proper execution of a good idea."

So, you need to have an idea that you have developed as fully as possible. Once you have that idea, you have to determine whether or not there is a market for it.

2. There is a market for your idea: Most good business ideas begin by addressing a problem or pain point within an industry. Your idea may undoubtedly solve a problem, but the question you must ask yourself is whether or not that problem is worth solving. Something that is a major problem to you, may be a minor inconvenience to the rest of the world.

Kraig Swensrud left his job as CMO of Salesforce to start his company GetFeedback.com. He saw the need for his product while working for Salesforce and was able to determine a pain point that he could address with his company.

"I think that's something that is really critical for folks before they leave their 9-to-5 and venture out on their own is to really validate the need within the market for the product or service they are going to be creating," Swensrud said. "Validate that what you're going to be doing is of interest, and that people will pay for the product or service that you're going to be creating, before you leave the comforts of a great company and venture out on your own."

If you do not currently work in the industry you are addressing, there are other ways to validate the market. urBin Storage co-founder Joshua Ernst recommends you start by asking the people around you. Talk to your friends, your family, and your colleagues (if you are comfortable) and ask them if they would purchase your product or service.

Remember, just because there is a pain point doesn't mean there is a need. Check out any potential competition to make sure that you aren't entering an overly crowded market. Once you have determined that there is a need, you should work on developing a plan. Meet with your startup friends and see how it's been done before.

"Make sure the strategy or the thought, the process, the plan has been vetted somewhat," Ernst said.

3. Your passion is in check: Inspiration and passion are what fuel successful founders. Excitement and the novelty of a new lifestyle are often misinterpreted as passion, and that doesn't bode well for new founders. You have to be ready to eat, sleep, and breathe this company because it will take all that you have to make it work.

"You as an individual have to be completely passionate about pursuing that venture. It can't just be something that's interesting, or something that you think you can make a little money at. You're going to be putting your blood, sweat, and tears into this new venture. And, as an entrepreneur, you have to be willing to really do just about everything that it takes to get a company off the ground," Swensrud said.

It is one thing to say that you are willing to give 100% for the success of your company, and it is something else entirely to live in such a way that proves that to be true. It will require a shift in the way you think and you must have courage to see it through. While these things will help you along the journey, it starts with having realistic expectations.

4. You have realistic expectations: There is no way you can prepare for everything that entrepreneurship will throw at you. But, you can work toward an understanding of what a startup lifestyle will be like. Although this may sound counterintuitive, you must prepare yourself for the chaos.

"You're at the top, so you ride the highs and you ride the lows; and you have to be ready to do that," Dumas said.

The rollercoaster ride of entrepreneurship can bring along a feeling of instability that most people are not prepared for. When it's good, it will be really god; but when it's bad, it will be terrible. If you are going to weather the storm, you have to begin to divorce your sense of self from your idea. While you, as the entrepreneur, are the most important piece of the puzzle, you should try to see your business as a separate entity that you are devoting your energy to bring to life.

A successful founder must be able to make decisions that are best for the business. You must be able to do what is best for the customer, not just what makes you happy. You can't see every failure or criticism of you business as a failure or criticism of you. You have a limited amount of energy and you can't waste it on worrying about what people think of you.

Something else you should expect is a change in workflow. The amount of hours you work will look different for each company, but you have to come to this with an understanding that your patterns and your habits are going to change. Your focus will begin to center on your startup and it will seem like the only thing that matters.

While work isn't everything, Ernst said, "It becomes everything when you're an entrepreneur." Adding, "The biggest advice would be for each individual to analyze whether or not they want work to become all-encompassing and they're excited about that challenge."

If you can, try to minimize the amount of instability in your life outside of your startup. It will be easier to deal with chaos brought on by entrepreneurship if there is less to worry about in your daily life. For example, Dumas didn't leave his job and start his company until he had enough money saved up to forgo a paycheck for two years.

"For me personally, especially being an engineer, everything is about calculated risk," Dumas said about his first opportunity he had to launch. "And, I didn't feel like I had the financial means to really go off on my own yet. The economics just didn't make sense. I think a lot of people figure out that they can't afford to be entrepreneurs when it's too late."

5. Your aren't fulfilled at your day job: Fulfillment is a subjective experience, so this will be the most difficult sign to read. Zhu recommends this simple test: "A simple gauge is when you wake up in the morning, are you excited to go to work," he said. For Zhu, the excitement waned when he stopped learning.

"It got to a point where I wasn't really learning at work. I felt that I was basically learning 5-10% of the time, and the other 90% just going through the motions, doing things I already knew. So, the pace of learning really slowed down," Zhu said.

Typically this lack of fulfillment is a chronic issue, and you may have even felt the same way at a previous company. Lack of fulfillment and lack of excitement are two different things, so you shouldn't view entrepreneurship as a way to simply "spice up" your professional life.

"I would caution people to, not necessarily, jump into it because it's exciting and it's buzzworthy if you are fulfilled in your current role and you are satisfied," Ernst said.

Most of the time, if you are even considering starting your own company, entrepreneurship is something you have been thinking of for a long time. These signs do not comprise the full list of everything you need to understand before you become an entrepreneur, because that list looks different for each person. But, if it captivates your thoughts it might be something to consider.

"If you are continually dreaming of new ideas and better products that are not already out there, and there's a certain part of you that can't give up the dream of creating something on your own, then there's no reason that you shouldn't take the steps necessary to make it a reality," Mashaal said.

5 Signs You Aren't Ready To Be An Entrepreneur

To make a successful go at the startup life, you need the right mindset and environment. Here are five signs that entrepreneurship isn't for you. 

Here are five signs that you might want to stick with your day job and put your startup dreams on hold.

1. You don't have a support system: When someone comes to Jason Hogg, a professor of management at Cornell University's Johnson Graduate School of Management, wanting to be an entrepreneur, he always asks them the same question, "Do you have a support network (family, friends, spouse, colleagues) that supports you in taking this leap?"

In order to achieve success as an entrepreneur, you need to have an established network of people that are willing to support you, and that support starts at home. If you don't have support, especially from spouse, you could end up making poor decisions for the business based on personal reasons. You won't feel empowered by the people around you.

"You need professional and personal mentorship and community around you in order to have these types of communities grow. Because, without that, you're going to burn out pretty quickly," said Moj Mahdara, CEO of Made With Elastic.

Startup founders have to be ready to face defeat. James Sun, Chairman and co-founder of Anomo and a finalist on season six of The Apprentice, calls this the door slam effect. This is the same thing faced by people in sales and, without a support system, it will be a lot harder to keep that rejection from getting under your skin. Also, it's important to know there are people who believe in you and are rooting for you.

Don't underestimate the power of having people in your corner.

2. You have a paycheck dependency: "One of the first questions I ask all my friends who want to be entrepreneurs is, 'Are you ready to go without a salary for sixth months?,'" Sun said.

Sun's view might be hard to swallow, but it is realistic. Some founders take it even further than six months. Phil Dumas, of Unikey Technologies, waited until he had enough money saved up to go two years without taking a paycheck, and he ended up going two and a half years before he cut a check to himself.

As a founder, especially if you have other employees, your money is obligated to other people before it is your own. Sun said this is especially true if you are raising an early round of financing such as a seed round. If a seed or Angel investor puts money into an early stage company, they're probably going to be averse to you paying yourself with it.

According to Mahdara, would-be founders should be able to stave off their worries about more than just their paycheck.

"Whenever someone says to me that they're concerned about how they're going to get healthcare, pretty much lets me know that they are not an entrepreneur. I know that sounds really silly, but those are the kinds of things that, when you're starting a company, you just don't think about," Mahdara said.

Not only do you have to be willing to waive your paycheck, but you also must be ready to learn.

3. You're unwilling to learn new roles: Too many entrepreneurs set out to start a company with the view that they will be able to utilize their specific skill set. You're in for a rude awakening if you think you can start a company as just a developer, or just a marketing person.

"Another sign that you are not ready to be an entrepreneur is if you are wanting to stay in your functional expertise, and you want to hire everyone else around you to do things you don't know how to do," Sun said. "Because, obviously, as an entrepreneur you have to wear so many hats, and not even at a generic level. You actually have to be pretty good at wearing all the hats."

As a founder, you have to know what you are doing and how to do it. Startups can carry with them a volatile environment, without a guarantee that you'll be able to hire or retain someone to carry out a specific task. You have to be prepared to step in and get that task done if need be.

When Hogg asks prospective entrepreneurs his set of questions to determine their readiness, he said that being able to answer them, "requires broad thinking on a variety of subjects and an ability to succeed as a generalist."

4. You believe the myth of entrepreneurship: The great myth of entrepreneurship, according to Sun, is that you are working for yourself. Let's get this clear right now, even as a startup founder you are not your own boss and you probably aren't working for just yourself.

"As an entrepreneur you are working for investors, you are working for your stakeholders, you are working for your employees -- not for yourself. In fact, it comes with more attachment and more accountability," Sun said.

According to Mahdara, that accountability can be a rude awakening to people who have a misguided notion of what life is like as an entrepreneur.

"You are accountable for everything, you pay yourself last, you take time off last. It's a huge privilege, but it's also a huge responsibility," Mahdara said. "And, I think most people have a fantasy about making your own hours and deciding who you get work with and when you want to work. There's definitely a lot of freedom in it, but that freedom comes at a price."

Unless you are planning on bootstrapping with your own money, you will be answering to other people on every move you make. What you need to remember is that the second you take capital, or trade equity for anything else, you are accountable to other people. Special consideration should be paid to your investment team as there is a timeline on your ROI and you can't fire your VC. This isn't necessarily a bad thing, as VC firms often bring valuable business expertise that can help you be more successful.

5. You lack business sense: Startups are often unpredictable. As such, many founders believe that they do not need a formal understanding of traditional business theory and practices. Unfortunately, this couldn't be further from the truth. While your goal might be to build a revolutionary product or service, you will need to be able to build a business around that product or service if you want it to gain traction.

"Do you have a clear plan to get started and what are you going to do when things go wrong, because they inevitably will? How are you going to get customers and how will you generate revenue (e.g., what's your business model)? And, how much money do you need to get to a proof point? If the person doesn't have the answer to many of these questions, they have some more work to do before taking the leap into entrepreneurship," Hogg said.

Do all you can to learn the business aspect of things. Do some reading, and try to map out how your contemporaries took their product to market. Meet with a financial expert to get an idea of what kind of money you'll need and develop a plan for how you'll spend it.

Both Sun and Hogg agree that the best way to get prepared, and give yourself a realistic view of life as a founder, is to work with an entrepreneur -- volunteer, shadow them, etc. Especially in the first days of their company, before they have raised money, and go to investor meetings with them. This will help to set your expectations for your own journey.

"It's very telling how difficult the journey is, and realism will definitely kick you right in the ass," Sun said.

Hogg describes the entrepreneurial journey like so: "It's like trying to prepare for Space Mountain [at Disney World]: You know you're getting on a rollercoaster but the whole thing is in the dark and you don't know when the turns are coming," Hogg said. "If you're averse to risk and really don't like to be in a dynamic environment, don't get on the entrepreneur rollercoaster. The best way to prepare is ask someone who's been on the ride."

July 10, 2014

10 secrets of success for English speakers

Do you get tongue-tied when you try to talk in English? Want to know how to get more speaking confidence? Even the best English speakers had to start somewhere, so read on to learn the secrets of their success.

1. Putting the pieces together: To speak English well, a number of different elements need to work together: knowing (and choosing) suitable vocabulary, using the right grammar and sentence patterns, and producing the correct sounds, stress patterns, rhythm and intonation. You have to work on these individual elements if you want to see improvements.

2. Two-way process: Speaking is about interacting with another person, and involves listening as well as talking. Check that the other person is following, by using conversation strategies like emphasizing key words, rephrasing, or using expressions like You know what I mean? or Don't you agree? 

3. It's not just what you say...: Non-verbal communication is very important for effective speaking, even for native English speakers. Use gestures, body language and facial expressions for explanation or emphasis, and try to read what the other person's body language is saying.

4. Sing a song!: Music is a great way to improve your speaking skills, practice the rhythm of the language and learn some useful expressions. Look up the lyrics (song words) to your favourite songs on the Internet, and then practising singing aloud.

5. Take a chance!: You need the right attitude to improve your English. Look for every opportunity to practice speaking, like talking to people at parties, approaching a foreigner who looks lost, or just putting up your hand when your teacher asks a question.

6. Think in English every day: This is a great way to improve your spoken English, and you can do it anywhere, any time. At home, you can talk to yourself while doing everyday tasks like preparing a meal. If you are on the train or bus, then describe the people around you (in your head, not aloud!), and when you go to sleep, go over the day's events in English.

7. Listen to the sound of your own voice: Even though you might not like hearing your own voice, this is a very useful way to find out what's wrong with your spoken English. Record yourself speaking and then listen to the tape, or ask a native speaker for some advice.

8. Keep a talking journal: Record your thoughts in English before you go to sleep at night. You can play the tape at the end of the year to look back on important events, as well as monitor your English progress.

9. Take extra classes: If you feel you need extra practice and want to interact with other English learners, why not join a language class? There are plenty of language schools around, or even on-line courses. Don't think you can learn to speak on the Internet? In English town's teacher-led classes, all you need is a headset and microphone to talk to the world! 

10. Find English-speaking friends: If you are really serious about becoming a good English speaker, you need to meet people you can speak to in English. This does NOT only mean native-speakers, though. English is spoken by many more people as a second language than as a native language, and being able to understand different accents is very important.

July 9, 2014

Drink Water On Empty Stomach



It is popular in Japan today to drink water immediately after waking up every morning. Furthermore, scientific tests have proven its value. We publish below a description of use of water for our readers. For old and serious diseases as well as modern illnesses the water treatment had been found successful by a Japanese medical society as a 100% cure for the following diseases:

Headache, body ache, heart system, arthritis, fast heart beat, epilepsy, excess fatness, bronchitis asthma, TB, meningitis, kidney and urine diseases, vomiting, gastritis, diarrhea, piles, diabetes, constipation, all eye diseases, womb, cancer and menstrual disorders, ear nose and throat diseases.

METHOD OF TREATMENT

1. As you wake up in the morning before brushing teeth, drink 4 x 160ml glasses of water

2. Brush and clean the mouth but do not eat or drink anything for 45 minute

3. After 45 minutes you may eat and drink as normal.

4. After 15 minutes of breakfast, lunch and dinner do not eat or drink anything for 2 hours

5. Those who are old or sick and are unable to drink 4 glasses of water at the beginning may commence by taking little water and gradually increase it to 4 glasses per day.

6. The above method of treatment will cure diseases of the sick and others can enjoy a healthy life.

The following list gives the number of days of treatment required to cure/control/reduce main diseases:

1. High Blood Pressure (30 days)
2. Gastric (10 days)
3. Diabetes (30 days)
4. Constipation (10 days)
5. Cancer (180 days)
6. TB (90 days)
7. Arthritis patients should follow the above treatment only for 3 days in the 1st week, and from 2nd week onwards – daily.

This treatment method has no side effects, however at the commencement of treatment you may have to urinate a few times.

It is better if we continue this and make this procedure as a routine work in our life. Drink Water and Stay healthy and Active.

This makes sense ... The Chinese and Japanese drink hot tea with their meals not cold water. Maybe it is time we adopt their drinking habit while eating!!! Nothing to lose, everything to gain...

For those who like to drink cold water, this article is applicable to you.
It is nice to have a cup of cold drink after a meal. However, the cold water will solidify the oily stuff that you have just consumed. It will slow down the digestion.

Once this 'sludge' reacts with the acid, it will break down and be absorbed by the intestine faster than the solid food. It will line the intestine.

Very soon, this will turn into fats and lead to cancer. It is best to drink hot soup or warm water after a meal.

A serious note about heart attacks:

1. Women should know that not every heart attack symptom is going to be the left arm hurting,
2. Be aware of intense pain in the jaw line.
3. You may never have the first chest pain during the course of a heart attack.
4. Nausea and intense sweating are also common symptoms.
5. 60% of people who have a heart attack while they are asleep do not wake up.
6. Pain in the jaw can wake you from a sound sleep. Let's be careful and be aware. The more we know, the better chance we could survive...

Kindly share this information to everyone you care about.