If your mouse is working sluggishly or not at all, don't go out and buy another cheap mouse. The cause is probably just a dirty mouse. A quick cleaning could fix the problem.
First, you need to identify which kind of mouse you have. If you turn your mouse over and part of a ball is showing, you have a ball mouse. If you see a lens, you have an optical or laser mouse. Each type of mouse requires a different type of cleaning.
The optical or laser mouse does not need to be cleaned near as often as the ball mouse, but it and the surface it runs on can still get dirty. If you do not clean the surface that the mouse moves on, it will soon turn black. So about once a month or so, wipe the surface off with a wet rag. The lens probably never will get dirty, but if it does, take a soft cloth, cotton swab, or q-tip wetted with window cleaner or alcohol and clean the lens.
The ball mouse may need cleaning quite often, so you should get well acquainted with the following cleaning procedure. The dirtier the ball mouse gets, the harder it is to get it to move the cursor on the screen smoothly. If you have to move the mouse across the mouse pad several times to get the cursor to move halfway across the screen, it needs to be cleaned.
The mouse does not need to be disconnected to clean it, but you should close all of the programs that are running, so that you don't accidentally click on something and mess it up. If you do decide to disconnect the mouse, be sure to turn off the computer first. The mouse cord should never be unplugged from the computer while it is running. Doing so could ruin your motherboard.
Turn the ball mouse over and find the cover that holds the ball in. Look for arrows on the cover to show which way it needs to be turned. Place two fingers on the cover and push in the direction of the arrows. Once the cover has been turned about an inch, cover it with your hand and turn the mouse back over to the upright position. The ball and cover should fall into your hand. If it doesn't, shake the mouse gently.
Wipe the ball off with a wet rag.
Now look in the ball well and find the three rollers. Start by cutting across the buildup on the rollers with your fingernail (a knife or steel dental pick may also be used gently), then turn the roller and remove the buildup as you go along. If you do this correctly, you will end up with one curled strip of buildup for each roller. Make sure to remove the buildup from the well. If it falls inside somewhere, blow and gently shake it until it comes out.
Take a wet rag and clean each of the rollers by wiping across it, then turning it and wiping again. Continue until the entire roller is cleaned. Put the ball back in the ball well and lock the cover back in place.
If the mouse still has problems once it is assembled, try cleaning it again. If that doesn't work, you may need to buy a new mouse.
It is a good idea to regularly clean the surface that the mouse is on because the cleaner the surface, the less dirt will get inside the mouse and the less often you will have to clean it.
If your mouse is shared by many people (especially if one of them is sick), you may want to disinfect the top of the mouse between users.
Follow these instructions and your mouse will be up and darting again in no time.
Friday, October 17, 2008
How to Clean your Keyboard-Part 2
When it comes to cleaning your keyboard there are many methods that can be used, some harder and more effective than others.
The easiest method is the Shake Method. It is so easy that you can do it right now. Pick up your keyboard, turn it over being careful not to press any keys, and shake it. See all of that stuff fall out? It is dirtier than you thought, isn't it? You can use one of the following methods to clean it further.
The Blow Method - You can buy cans of pressurized air at the computer department or computer store which are made especially for cleaning your computer. They usually have either a hose and nozzle or a tube extending from the nozzle. Hold the keyboard up vertically (that means that end of the keyboard is up and the other end is down), aim towards the keys and press the button. Keep blowing until all of the debris is blown out. Be sure to get around and in between all of the keys. This can be done with the computer on, but it is better if it is off so that you do not have to worry about pressing the keys and coming up with a page of aaaaaaaaaaaaaaaaaaaaa's.
The Vacuum Method - This is just like the Blow Method except that a vacuum is used instead of a can of pressurized air. It is quite simple. Just turn the vacuum on, pull out the hose, and run the nozzle over the keys. Before doing this make sure your keyboard does not have any loose pop off keys that could be sucked into the vacuum.
The Cotton Ball Method - This can be done in addition to the above methods and in lieu of the following methods. Take a cotton ball or cloth and wet it with rubbing alcohol. It should not be so wet that the alcohol runs down into the cracks of the keyboard. Wipe the tops and sides of the keys.
The Dishwasher Method - I hesitate to tell about this method because there is the possibility that it could fry your keyboard. When I had less experience with computers, I dunked my keyboard in a sink full of water to clean it. It did work afterwards, so I don't doubt those who say this method will not mess up your keyboard, but if it does, don't complain to me. I warned you. If your keyboard is not the standard membrane type of keyboard or if it is on a laptop, do not even think of trying this.
This is how you do it. Unplug the keyboard and place it face down in an empty dishwasher. Do not disassemble the keyboard and do not put it in a dishwasher that has dirty dishes in it. Some say to add soap, some say not to. Run the dishwasher through a regular cycle. Take the keyboard out, shake the water out, and stand it on end until it is completely dry (this may take several days). If it does not work after doing this, it may not be dry. Let it stand another week and try it again. If it still does not work, I warned you.
The Disassembly Method - This is the most thorough method, but it should not be done on laptop keyboards or non-standard non-membrane keyboards.
Turn off the computer and unplug the keyboard. Turn the keyboard upside down. You may want to get two books or short boards to place the keyboard on. Position them so that they hold up the keyboard on the edges when it is turned over. This should leave the keys dangling and not touching the books or the floor. This is especially needed when the keyboard's back is off; otherwise the keys will be lifted out of their position by the floor (or whatever surface it is laying on).
Get a screwdriver and remove all of the screws from the back of the keyboard. Lay the keyboard down on the books and carefully remove the back.
Take everything apart and clean thoroughly. It is better to take the keys out one at a time and clean them so that you do not put them back in the wrong place. Wipe each one down with a wet cloth and then with a dry cloth. Any keys that may be hard to put back in, can be cleaned in place without removing them. Wipe around the keys as they sit in place and blow any debris out with your lungs (using compressed air or a vacuum may upset the keys). If you are really brave, you can remove all of the keys at once and give the frame a good wipe down too.
Do a once over and make sure that you have cleaned everything. Then reassemble it all.
Don't forget the keyboard's cable. Wrap a wet cloth around it and wipe it down. It may have an accumulation of grime that needs to be scrubbed off. Also if any of the letters on the keys have rubbed off, you can use a fine point permanent marker to draw the letter back on the key.
Use these cleaning methods and your keyboard will last a long time and be something you can be proud of.
The easiest method is the Shake Method. It is so easy that you can do it right now. Pick up your keyboard, turn it over being careful not to press any keys, and shake it. See all of that stuff fall out? It is dirtier than you thought, isn't it? You can use one of the following methods to clean it further.
The Blow Method - You can buy cans of pressurized air at the computer department or computer store which are made especially for cleaning your computer. They usually have either a hose and nozzle or a tube extending from the nozzle. Hold the keyboard up vertically (that means that end of the keyboard is up and the other end is down), aim towards the keys and press the button. Keep blowing until all of the debris is blown out. Be sure to get around and in between all of the keys. This can be done with the computer on, but it is better if it is off so that you do not have to worry about pressing the keys and coming up with a page of aaaaaaaaaaaaaaaaaaaaa's.
The Vacuum Method - This is just like the Blow Method except that a vacuum is used instead of a can of pressurized air. It is quite simple. Just turn the vacuum on, pull out the hose, and run the nozzle over the keys. Before doing this make sure your keyboard does not have any loose pop off keys that could be sucked into the vacuum.
The Cotton Ball Method - This can be done in addition to the above methods and in lieu of the following methods. Take a cotton ball or cloth and wet it with rubbing alcohol. It should not be so wet that the alcohol runs down into the cracks of the keyboard. Wipe the tops and sides of the keys.
The Dishwasher Method - I hesitate to tell about this method because there is the possibility that it could fry your keyboard. When I had less experience with computers, I dunked my keyboard in a sink full of water to clean it. It did work afterwards, so I don't doubt those who say this method will not mess up your keyboard, but if it does, don't complain to me. I warned you. If your keyboard is not the standard membrane type of keyboard or if it is on a laptop, do not even think of trying this.
This is how you do it. Unplug the keyboard and place it face down in an empty dishwasher. Do not disassemble the keyboard and do not put it in a dishwasher that has dirty dishes in it. Some say to add soap, some say not to. Run the dishwasher through a regular cycle. Take the keyboard out, shake the water out, and stand it on end until it is completely dry (this may take several days). If it does not work after doing this, it may not be dry. Let it stand another week and try it again. If it still does not work, I warned you.
The Disassembly Method - This is the most thorough method, but it should not be done on laptop keyboards or non-standard non-membrane keyboards.
Turn off the computer and unplug the keyboard. Turn the keyboard upside down. You may want to get two books or short boards to place the keyboard on. Position them so that they hold up the keyboard on the edges when it is turned over. This should leave the keys dangling and not touching the books or the floor. This is especially needed when the keyboard's back is off; otherwise the keys will be lifted out of their position by the floor (or whatever surface it is laying on).
Get a screwdriver and remove all of the screws from the back of the keyboard. Lay the keyboard down on the books and carefully remove the back.
Take everything apart and clean thoroughly. It is better to take the keys out one at a time and clean them so that you do not put them back in the wrong place. Wipe each one down with a wet cloth and then with a dry cloth. Any keys that may be hard to put back in, can be cleaned in place without removing them. Wipe around the keys as they sit in place and blow any debris out with your lungs (using compressed air or a vacuum may upset the keys). If you are really brave, you can remove all of the keys at once and give the frame a good wipe down too.
Do a once over and make sure that you have cleaned everything. Then reassemble it all.
Don't forget the keyboard's cable. Wrap a wet cloth around it and wipe it down. It may have an accumulation of grime that needs to be scrubbed off. Also if any of the letters on the keys have rubbed off, you can use a fine point permanent marker to draw the letter back on the key.
Use these cleaning methods and your keyboard will last a long time and be something you can be proud of.
How to Clean your Keyboard- Part 1
I know most of you will not heed this advice, but KEYBOARDS CAN MAKE YOU SICK (how's that for tactfulness?). Germs live on your hands and fingers. When you type, many of them jump on to the keyboard. When someone else types on your keyboard, those germs transfer to their fingers. Or when you later type on the same keyboard, those germs reconquer your fingers. Regularly disinfecting the keyboard can prevent this.
To disinfect the keyboard, turn off the computer. Then spray disinfectant on a cloth. Be sure to use disinfectant and not just any type of cleaner because not all cleaners disinfect. Also do not spray the disinfectent directly on the keys. Spray it on the cloth. Wipe down the top and sides of the keys. Give the keys a few minutes to dry off before turning the computer back on.
Now that you know how to do it, you should make it a regular practice to disinfect the keyboard. It's one step towards a healthier you.
So you have your keyboard disinfected and life is great. Then your child spills koolaide all over it. What do you do? There are certain steps that you should take when something, like pop, beer, wine, coffee, milk, or kool-aide, is spilled on the keyboard.
The first thing to do is immediately unplug the keyboard from the back of the computer and turn the keyboard over so that its keys are down. This will allow the liquid to drain out. You will probably want to put a cloth under the keyboard or at least make sure that the surface you have put it on is washable.
Then use the mouse to shut down Windows and turn off the computer (this is important because later you will have to plug the keyboard back into the computer and you should never plug any device into a computer while it is on).
While the keyboard is upside down use a cloth to dry as much of the liquid off as you can. If you have a can of compressed air or a vacuum, while the keyboard is upside down blow or vacuum it out. Then let the keyboard set upside down for at least a night so that it can adequately dry out.
If the liquid that spilled on it was sticky, you may want to follow the extensive cleaning procedure explained in the next article, How to Clean your Keyboard - Part 2.
Liquid spilled on a laptop keyboard can easily reach the hard drive, so turn it over immediately and leave it in that position until it dries.
Keyboards are quite resilient and so it should work when you turn it on again. But if not, another attribute of keyboards is that they are cheap and so it won't cost too much to buy another one.
With these pointers in mind and a quick reaction, you just may save your keyboard from total destruction the next time it gets coated with coffee.
To disinfect the keyboard, turn off the computer. Then spray disinfectant on a cloth. Be sure to use disinfectant and not just any type of cleaner because not all cleaners disinfect. Also do not spray the disinfectent directly on the keys. Spray it on the cloth. Wipe down the top and sides of the keys. Give the keys a few minutes to dry off before turning the computer back on.
Now that you know how to do it, you should make it a regular practice to disinfect the keyboard. It's one step towards a healthier you.
So you have your keyboard disinfected and life is great. Then your child spills koolaide all over it. What do you do? There are certain steps that you should take when something, like pop, beer, wine, coffee, milk, or kool-aide, is spilled on the keyboard.
The first thing to do is immediately unplug the keyboard from the back of the computer and turn the keyboard over so that its keys are down. This will allow the liquid to drain out. You will probably want to put a cloth under the keyboard or at least make sure that the surface you have put it on is washable.
Then use the mouse to shut down Windows and turn off the computer (this is important because later you will have to plug the keyboard back into the computer and you should never plug any device into a computer while it is on).
While the keyboard is upside down use a cloth to dry as much of the liquid off as you can. If you have a can of compressed air or a vacuum, while the keyboard is upside down blow or vacuum it out. Then let the keyboard set upside down for at least a night so that it can adequately dry out.
If the liquid that spilled on it was sticky, you may want to follow the extensive cleaning procedure explained in the next article, How to Clean your Keyboard - Part 2.
Liquid spilled on a laptop keyboard can easily reach the hard drive, so turn it over immediately and leave it in that position until it dries.
Keyboards are quite resilient and so it should work when you turn it on again. But if not, another attribute of keyboards is that they are cheap and so it won't cost too much to buy another one.
With these pointers in mind and a quick reaction, you just may save your keyboard from total destruction the next time it gets coated with coffee.
How to clean your Mother Board
If you have not done the inspection mentioned in the previous article - How to Clean your Case, now is the time to do so. Look at the blades of the fan in the back of the computer. Also look at any vents. Is there clusters of dust there? Is there grime caked on to it? If so, the inside needs to be cleaned. If the fan blades are clean but it has been several years since you have cleaned the motherboard or if the computer is around cigarette smoke, it probably should be cleaned anyway. Dust and particles in the air (like cigarette smoke) can build up on the circuitry of the motherboard and cause it to heat up and/or corrode.
The first thing that you need to do is unplug your computer. Then open up the case to get access to the motherboard. Cases open differently. If you don't know how to open your case, look on the back of your computer along the edge for some screws. These screws may hold on side panels or an upside down U shaped panel that covers the sides and top. Removing the screws will allow you to take off the cover. Other cases have the screws on the front of the computer. To get access to these screws, you must first remove the front panel by pressing a hidden latch. The cover is there to give easy access to the inside of your computer, so if you look hard enough, you should be able to figure out how to remove it.
Remember that if you touch anything on the motherboard, you should be grounded by either touching the metal frame of the computer with your other hand or by wearing a special grounding device.
The goal of cleaning the motherboard is to remove all dust and debris from the motherboard and all components inside of the case. This can be done using one of three methods.
The preferred method is to use a can of compressed air to blow it out. Always hold the can in an up-right position to prevent the propellent chemicals which can damage or corrode components from coming out. Dust and dirt should be blown away from the motherboard and out of the case.
Another way to remove dust is to use a vacuum. The common advice is to only use a battery operated vacuum because an AC powered vacuum causes static and static can ruin the motherboard. I have used an AC powered vacuum (before I knew that it was not recommended) to clean my motherboard many times and it has never caused any problems, but I may have just been lucky. When using the vacuum, keep the nozzle a couple of inches away from the motherboard or any other components so that it does not come in contact with them and so that any small parts are not sucked into the vacuum.
If you do not have a can of compressed air or a vacuum, you can use a dry cloth and brush to clean the motherboard. Be careful not to dislodge or break anything using this method.
While cleaning the motherboard, be careful not to unplug any cables or connections or to dislodge any loose components, such as, jumpers.
Methodically clean the whole inside of the case going over all of the motherboard from one end to the other and all other components. Don't forget to clean the fans and heat sinks. Do not open up the power supply box or stick anything in it beyond the fan. If you do, you could get a shocking surprise and ruin your computer.
If your computer does not work when you put it back together, something was obviously dislodged during the cleaning. Open the case back up and push all connections and cards into their slots. Look for anything that may have become disconnected.
Cleaning the motherboard is probably the most dangerous form of cleaning but it is necessary to prevent an early death of your computer.
The first thing that you need to do is unplug your computer. Then open up the case to get access to the motherboard. Cases open differently. If you don't know how to open your case, look on the back of your computer along the edge for some screws. These screws may hold on side panels or an upside down U shaped panel that covers the sides and top. Removing the screws will allow you to take off the cover. Other cases have the screws on the front of the computer. To get access to these screws, you must first remove the front panel by pressing a hidden latch. The cover is there to give easy access to the inside of your computer, so if you look hard enough, you should be able to figure out how to remove it.
Remember that if you touch anything on the motherboard, you should be grounded by either touching the metal frame of the computer with your other hand or by wearing a special grounding device.
The goal of cleaning the motherboard is to remove all dust and debris from the motherboard and all components inside of the case. This can be done using one of three methods.
The preferred method is to use a can of compressed air to blow it out. Always hold the can in an up-right position to prevent the propellent chemicals which can damage or corrode components from coming out. Dust and dirt should be blown away from the motherboard and out of the case.
Another way to remove dust is to use a vacuum. The common advice is to only use a battery operated vacuum because an AC powered vacuum causes static and static can ruin the motherboard. I have used an AC powered vacuum (before I knew that it was not recommended) to clean my motherboard many times and it has never caused any problems, but I may have just been lucky. When using the vacuum, keep the nozzle a couple of inches away from the motherboard or any other components so that it does not come in contact with them and so that any small parts are not sucked into the vacuum.
If you do not have a can of compressed air or a vacuum, you can use a dry cloth and brush to clean the motherboard. Be careful not to dislodge or break anything using this method.
While cleaning the motherboard, be careful not to unplug any cables or connections or to dislodge any loose components, such as, jumpers.
Methodically clean the whole inside of the case going over all of the motherboard from one end to the other and all other components. Don't forget to clean the fans and heat sinks. Do not open up the power supply box or stick anything in it beyond the fan. If you do, you could get a shocking surprise and ruin your computer.
If your computer does not work when you put it back together, something was obviously dislodged during the cleaning. Open the case back up and push all connections and cards into their slots. Look for anything that may have become disconnected.
Cleaning the motherboard is probably the most dangerous form of cleaning but it is necessary to prevent an early death of your computer.
A Guide on RSS Tool
RSS is an abbreviation that has evolved into the following, depending on their versions:
• RDF Site Summary (also known as RSS 0.9; the first version of RSS)
• Rich Site Summary (also known as RSS 0.91; a prototype)
• Really Simple Syndication (also known as RSS 2.0)
Today, RSS stands for 'Really Simple Syndication', and it has the following 7 existing formats or versions:
• 0.90
• 0.91
• 0.92
• 0.93
• 0.94
• 1.0
• 2.0
RSS tools refer to a group of file formats that are designed to share headlines and other web content (this may be a summary or simply 1 to 2 lines of the article), links to the full versions of the content (the full article or post), and even file attachments such as multimedia files. All of these data is delivered in the form of an XML file (XML stands for eXtensible Markup Language), which has the following common names:
• RSS feed
• Webfeed
• RSS stream
• RSS channel
They are typically shown on web pages as an orange rectangle that usually has the letters XML or RSS in it.
RSS feeds can be used to deliver any kind of information. Some of these 'feeds' include:
• Blogs feed - each blog entry is summarized as a feed item. This makes blog posts easier to scan, enabling 'visitors' to zoom in on their items of interest.
• Article feed - this alerts readers whenever there are new articles and web contents available.
• Forum feed - this allows users to receive forum posts and latest discussion topics.
• Schedule feed - this allows users (such as schools, clubs, and other organizations) to broadcast events and announce schedule changes or meeting agendas.
• Discounts or Special feed - this is used to enable users (such as retail and online stores) to 'deliver' latest specials and discounted offers.
• Ego or News Monitoring - this enables users to receive 'filtered' headlines or news that are based on a specific phrase or keyword.
• Industry-specific feed - used by technical professionals in order to market, promote, or communicate with current (and prospective) customers and clients within their specific industries.
RSS feeds enable people to track numerous blogs and news sources at the same time. To produce an RSS feed, all you need is the content or the article that you want to publicize and a validated RSS text file. Once your text file is registered at various aggregators (or 'news readers'), any external site can then capture and display your RSS feed, automatically updating them whenever you update your RSS file.
RSS tools are useful for sites that add or modify their contents on a regular basis. They are especially used for 'web syndication' or activities that involve regular updates and/or publications, such as the following:
• News websites - as used by major news organizations such as Reuters, CNN, and the BBC.
• Marketing
• Bug reports
• Personal weblogs
There are many benefits to using RSS feeds. Aside from being a great supplemental communication method that streamlines the communication needs of various sectors, RSS tools and feeds can also have tremendous benefits in your business, particularly in the field of internet marketing.
RSS tools and feeds provide Internet users with a free (or cheap) and easy advertising or online marketing opportunity for their businesses. Below are some of the RSS features that can help make your internet marketing strategies more effective.
1. Ease in content distribution services. With RSS, your business can be captured and displayed by virtually any external site, giving you an easy way to 'spread out' and advertise them.
2. Ease in regular content updates. With RSS, web contents concerning your business can now be automatically updated on a daily (and even hourly) basis. Internet users will be able to experience 'real time' updates as information in your own file (such as new products and other business-related releases) is changed and modified simultaneously with that of the RSS feeds that people are subscribed to.
3. Custom-made content services. With RSS, visitors can have personalized content services, allowing them total control of the flow and type of information that they receive. Depending on their interests and needs, visitors can subscribe to only those contents that they are looking for (such as real estate or job listings).
4. Increase in (and targeted) traffic. With RSS, traffic will be directed to your site as readers of your content summary (or 1 to 2 lines of your article) who find them interesting are 'forced' to click on a link back to your site.
These are just several of the many things that you can do with RSS. The possibilities are endless, and they are all aimed at providing you with an effective internet marketing strategy for your business.
In the mean time, Good Luck on your journey to success…
• RDF Site Summary (also known as RSS 0.9; the first version of RSS)
• Rich Site Summary (also known as RSS 0.91; a prototype)
• Really Simple Syndication (also known as RSS 2.0)
Today, RSS stands for 'Really Simple Syndication', and it has the following 7 existing formats or versions:
• 0.90
• 0.91
• 0.92
• 0.93
• 0.94
• 1.0
• 2.0
RSS tools refer to a group of file formats that are designed to share headlines and other web content (this may be a summary or simply 1 to 2 lines of the article), links to the full versions of the content (the full article or post), and even file attachments such as multimedia files. All of these data is delivered in the form of an XML file (XML stands for eXtensible Markup Language), which has the following common names:
• RSS feed
• Webfeed
• RSS stream
• RSS channel
They are typically shown on web pages as an orange rectangle that usually has the letters XML or RSS in it.
RSS feeds can be used to deliver any kind of information. Some of these 'feeds' include:
• Blogs feed - each blog entry is summarized as a feed item. This makes blog posts easier to scan, enabling 'visitors' to zoom in on their items of interest.
• Article feed - this alerts readers whenever there are new articles and web contents available.
• Forum feed - this allows users to receive forum posts and latest discussion topics.
• Schedule feed - this allows users (such as schools, clubs, and other organizations) to broadcast events and announce schedule changes or meeting agendas.
• Discounts or Special feed - this is used to enable users (such as retail and online stores) to 'deliver' latest specials and discounted offers.
• Ego or News Monitoring - this enables users to receive 'filtered' headlines or news that are based on a specific phrase or keyword.
• Industry-specific feed - used by technical professionals in order to market, promote, or communicate with current (and prospective) customers and clients within their specific industries.
RSS feeds enable people to track numerous blogs and news sources at the same time. To produce an RSS feed, all you need is the content or the article that you want to publicize and a validated RSS text file. Once your text file is registered at various aggregators (or 'news readers'), any external site can then capture and display your RSS feed, automatically updating them whenever you update your RSS file.
RSS tools are useful for sites that add or modify their contents on a regular basis. They are especially used for 'web syndication' or activities that involve regular updates and/or publications, such as the following:
• News websites - as used by major news organizations such as Reuters, CNN, and the BBC.
• Marketing
• Bug reports
• Personal weblogs
There are many benefits to using RSS feeds. Aside from being a great supplemental communication method that streamlines the communication needs of various sectors, RSS tools and feeds can also have tremendous benefits in your business, particularly in the field of internet marketing.
RSS tools and feeds provide Internet users with a free (or cheap) and easy advertising or online marketing opportunity for their businesses. Below are some of the RSS features that can help make your internet marketing strategies more effective.
1. Ease in content distribution services. With RSS, your business can be captured and displayed by virtually any external site, giving you an easy way to 'spread out' and advertise them.
2. Ease in regular content updates. With RSS, web contents concerning your business can now be automatically updated on a daily (and even hourly) basis. Internet users will be able to experience 'real time' updates as information in your own file (such as new products and other business-related releases) is changed and modified simultaneously with that of the RSS feeds that people are subscribed to.
3. Custom-made content services. With RSS, visitors can have personalized content services, allowing them total control of the flow and type of information that they receive. Depending on their interests and needs, visitors can subscribe to only those contents that they are looking for (such as real estate or job listings).
4. Increase in (and targeted) traffic. With RSS, traffic will be directed to your site as readers of your content summary (or 1 to 2 lines of your article) who find them interesting are 'forced' to click on a link back to your site.
These are just several of the many things that you can do with RSS. The possibilities are endless, and they are all aimed at providing you with an effective internet marketing strategy for your business.
In the mean time, Good Luck on your journey to success…
The Battle of the Browsers – The History and the Future of Internet Browsers
With Internet Explorer 8 now available, can Microsoft hope to retain market dominance over fierce open source rivals such as Mozilla's Firefox or the feature packed Opera web browser. Can history give us a clue to what the future of web browsers/browsing might hold? How did Netscape Navigator go from having a dominant 89.36% market share of all web browsers in 1996 and yet only 3.76% by mid 1999?
Let us take a journey that will begin long before even the intellectual conception of Internet Explorer, that will glance at its long defeated rivals, examine the current browsers available and will end with a prediction of what the future of browsing will offer us – and which browser(s) will still be around to offer it.
People often think that Internet Explorer has been the dominant web browser since the golden age of the internet began. Well for a very long time now it has indeed been the most popular browser and at times been almost totally unrivalled. This was mainly a result of it being packaged free with Microsoft Windows, in what some would later call a brutal monopolisation attempt by Microsoft. The last few years however have heralded the arrival of new, possibly superior browsers. Mozilla's Firefox has been particularly successful at chipping away at Explorers market dominance. So where did it all begin, and why were Microsoft ever allowed to have a hundred percent market dominance?
Origins
The truth is they never did have total dominance, but at times they have come very close. Microsoft actually entered the Browser Battle quite late on. Infact a man named Neil Larson is credited to be one of the originators of internet browsers, when in 1977 he created a program – The TRS-80 - that allowed browsing between “sites” via hypertext jumps. This was a DOS program and the basis of much to come. Slowly other browsers powered by DOS and inspired by the TRS 80 were developed. Unfortunately they were often constricted by the limitations of the still fairly young internet itself.
In 1988, Peter Scott and Earle Fogel created a simple, fast browser called Hytelnet, which by 1990 offered users instant logon and access to the online catalogues of over five thousand libraries around the world – an exhilarating taste of what the internet, and web browsers, would soon be able to offer.
In 1989 the original World Wide Web was born. Using a NeXTcube computer, Tim Berners-Lee created a web browser that would change how people used the internet forever. He called his browser the WorldWideWeb(http://www., which is still likely to sound familiar to internet users today. It was a windowed browser capable of displaying simple style sheet, capable of editing sites and able to download and open any file type supported by the NeXTcube.
In 1993 the first popular graphical browser was released. Its name was Mosaic and it was created by Marc Andreessen and Eric Bina. Mosaic could be run on both Unix, and very importantly, on the highly popular Microsoft Windows operating system (incidentally it could also be used on Amiga and Apple computers). It was the first browser on Windows that could display graphics/pictures on a page where there was also textual content. It is often cited as being responsible for triggering the internet boom due to it making the internet bearable for the masses. (It should be noted that the web browser Cello was the first browser to be used on Windows – but it was non graphical and made very little impact compared to Mosaic).
The Browser Wars - Netscape Navigator versus Internet Explorer
Mosaic's decline began almost as soon as Netscape Navigator was released (1994). Netscape Navigator was a browser created by Marc Andreessen, one of the men behind Mosaic and co-founder of Netscape Communications Corporation. Netscape was unrivalled in terms of features and usability at the time. For example, one major change from previous browsers was that it allowed surfers to see parts of a website before the whole site was downloaded. This meant that people did not have to wait for minutes simply to see if the site they were loading was the actual one the were after, whilst also allowing them to read information on the site as the rest of it downloaded. By 1996 Netscape had almost 90% market dominance, as shown below.
Market Share Comparisons of Netscape Navigator and Internet Explorer from 1996 to 1998
....................Netscape.......IE
October 1998..........64%.........32.2%
April 1998............70%.........22.7%
October 1997..........59.67%......15.13%
April 1997............81.13%......12.13%
October 1996..........80.45%......12.18%
April 1996............89.36%.......3.76%
In these two years Netscape clearly dominated the internet browser market, but a new browser named Internet Explorer was quickly gaining ground on it.
Microsoft released their own browser (ironically based on the earlier Mosaic browser which was created by one of the men now running Netscape), clearly worried about Netscape's dominance. It was not so much the worry that it would have a 100% market share of internet browsers on their Windows operating system, but more the worry that browsers would soon be capable of running all types programs on them. That would mean foregoing the need for an actual operating system, or at the most only a very basic one would be needed. This in turn would mean Netscape would soon be able to dictate terms to Microsoft, and Microsoft were not going to let that happen easily. Thus in August 1995, Internet Explorer was released.
By 1999 Internet explorer had captured an 89.03% market share, whilst Netscape was down to 10.47%. How could Internet Explorer make this much ground in just two years? Well this was down to two things really. The first, and by far the most important was that Microsoft bundled Internet Explorer in with every new copy of Windows, and as Windows was used by about 90% of the computer using population it clearly gave them a huge advantage. Internet Explorer had one other ace it held over Netscape – it was much better. Netscape Navigator was stagnant and had been for some time. The only new features it ever seemed to introduce were often perceived by the public as beneficial for Netscape's parent company rather than Netscape's user base. (i.e., features that would help it monopolise the market). Explorer, on the other hand, was given much attention by Microsoft. Regular updates and excellent usability plus a hundred million dollar investment would prove too much for Netscape Explorer.
2000 – 2005
These years were fairly quiet in the Battle of the Browsers. It seemed as if Internet Explorer had won the war and that nobody could even hope to compete with it. In 2002/2003 it had attained about 95% of the market share – about the time of IE 5/6. With over 1000 people working on it and millions of dollars being poured in, few people had the resources to compete. Then again, who wanted to compete? It was clearly a volatile market, and besides that everybody was content with Internet Explorer. Or were they? Some people saw faults with IE – security issues, incompatibility issues or simply bad programming. Not only that, it was being shoved down peoples throats. There was almost no competition to keep it in line or to turn to as an alternative. Something had to change. The only people with the ability and the power to compete with Microsoft took matters into their own hands.
Netscape was now supported by AOL. A few years prior, just after they had lost the Browser Wars to Microsoft, they had released the coding for Netscape into the public domain. This meant anybody could develop their own browser using the Netscape skeleton. And people did. Epiphany, Galeon and Camino, amongst others, were born out of Netscape's ashes. However the two most popular newcomers were called Mozilla and Firefox.
Mozilla was originally an open sourced project aimed to improve the Netscape browser. Eventually it was released as Netscape Navigator 7 and then 8. Later it was released as Mozilla 1.0.
Mozilla was almost an early version on another open source browser, Firefox. With it being an open source the public were able to contribute to it - adding in what features it needed, the programming it required and the support it deserved. The problems people saw in Internet Explorer were being fixed by members of the open sourced browser community via Firefox. For instance, the many security issues IE 6 had were almost entirely fixed in the very first release of Firefox. Microsoft had another fight on their hands.
2005 – Present
Firefox was the browser that grew and grew in these years. Every year capturing an even larger market share percentage than before. More user friendly than most of its rivals along with high security levels and arguably more intelligent programming helped its popularity. With such a large programming community behind it, updates have always been regular and add on programs/features are often released. It prides itself on being the peoples browser. It currently has a 28.38% market share.
Apple computers have had their own browser since the mid 1990's – Safari - complete with its own problems, such as (until recently) the inability to run Java scripts. However most Apple users seemed happy with it and a version capable of running on Windows has been released. It has had no major competitor on Apple Macs, and as such has largely been out of the Browser Wars. It currently holds a 2.54% market share and is slowly increasing.
Internet Explorer's market share has dropped from over 90% to around 75%, and is falling. It will be interesting to see what Microsoft will attempt to regain such a high market share.
Opera currently holds 1.07%.
Mozilla itself only has a 0.6% market share these days.
The Future of Web Browsing
Web browsers come and go. It is the nature of technology (if such a term can be used), to supplant inferior software in very short periods of time. It is almost impossible for a single company to stay ahead of the competition for long. Microsoft have the advantage of being able to release IE with any Windows using PC. That covers over 90% of the market. They also have the advantage of unprecedented resources. They can compete how they wish for as long as they wish. So there is no counting IE out of the future of web browsing.
Safari is in a similar position, being easily the most popular Mac web browser. Its long term survival is dependant upon Apple and the sale of their computers.
These are the only two browsers that are almost guaranteed another five years of life, at least. Firefox may seem like another candidate, but the public is fickle, and one bad release, or if it seriously lags behind the new Internet Explorer 8 for long, could easily see its popularity quickly descend into virtual oblivion.
However, it seems likely community driven browsers, such as Mozilla and Firefox, will be the only types of browser capable of competing with the wealthy internet arm of Microsoft in the near future.
As for web browsing itself, will it change any time soon? Well it already has for some online communities. For example, if you want to buy clothes you could try entering an online 'world' creating an online virtual You to go from 'shop to shop' with, looking at products and trying/buying what you see. Some 'worlds' allow you to recreate yourself accurately including weight and height and then try on things apparel such as jeans to give you an idea of how you would look in that particular item.
Will 'worlds' like this destroy normal web browsers such as IE ? - It seems unlikely. Traditional web browsers provide such freedom and ease of access that it is hard to see any other alternative taking over. However they are part of the new, 'thinking out of the box' wave of alternatives that some people will find attractive, and really who knows what the future will bring.
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
Let us take a journey that will begin long before even the intellectual conception of Internet Explorer, that will glance at its long defeated rivals, examine the current browsers available and will end with a prediction of what the future of browsing will offer us – and which browser(s) will still be around to offer it.
People often think that Internet Explorer has been the dominant web browser since the golden age of the internet began. Well for a very long time now it has indeed been the most popular browser and at times been almost totally unrivalled. This was mainly a result of it being packaged free with Microsoft Windows, in what some would later call a brutal monopolisation attempt by Microsoft. The last few years however have heralded the arrival of new, possibly superior browsers. Mozilla's Firefox has been particularly successful at chipping away at Explorers market dominance. So where did it all begin, and why were Microsoft ever allowed to have a hundred percent market dominance?
Origins
The truth is they never did have total dominance, but at times they have come very close. Microsoft actually entered the Browser Battle quite late on. Infact a man named Neil Larson is credited to be one of the originators of internet browsers, when in 1977 he created a program – The TRS-80 - that allowed browsing between “sites” via hypertext jumps. This was a DOS program and the basis of much to come. Slowly other browsers powered by DOS and inspired by the TRS 80 were developed. Unfortunately they were often constricted by the limitations of the still fairly young internet itself.
In 1988, Peter Scott and Earle Fogel created a simple, fast browser called Hytelnet, which by 1990 offered users instant logon and access to the online catalogues of over five thousand libraries around the world – an exhilarating taste of what the internet, and web browsers, would soon be able to offer.
In 1989 the original World Wide Web was born. Using a NeXTcube computer, Tim Berners-Lee created a web browser that would change how people used the internet forever. He called his browser the WorldWideWeb(http://www., which is still likely to sound familiar to internet users today. It was a windowed browser capable of displaying simple style sheet, capable of editing sites and able to download and open any file type supported by the NeXTcube.
In 1993 the first popular graphical browser was released. Its name was Mosaic and it was created by Marc Andreessen and Eric Bina. Mosaic could be run on both Unix, and very importantly, on the highly popular Microsoft Windows operating system (incidentally it could also be used on Amiga and Apple computers). It was the first browser on Windows that could display graphics/pictures on a page where there was also textual content. It is often cited as being responsible for triggering the internet boom due to it making the internet bearable for the masses. (It should be noted that the web browser Cello was the first browser to be used on Windows – but it was non graphical and made very little impact compared to Mosaic).
The Browser Wars - Netscape Navigator versus Internet Explorer
Mosaic's decline began almost as soon as Netscape Navigator was released (1994). Netscape Navigator was a browser created by Marc Andreessen, one of the men behind Mosaic and co-founder of Netscape Communications Corporation. Netscape was unrivalled in terms of features and usability at the time. For example, one major change from previous browsers was that it allowed surfers to see parts of a website before the whole site was downloaded. This meant that people did not have to wait for minutes simply to see if the site they were loading was the actual one the were after, whilst also allowing them to read information on the site as the rest of it downloaded. By 1996 Netscape had almost 90% market dominance, as shown below.
Market Share Comparisons of Netscape Navigator and Internet Explorer from 1996 to 1998
....................Netscape.......IE
October 1998..........64%.........32.2%
April 1998............70%.........22.7%
October 1997..........59.67%......15.13%
April 1997............81.13%......12.13%
October 1996..........80.45%......12.18%
April 1996............89.36%.......3.76%
In these two years Netscape clearly dominated the internet browser market, but a new browser named Internet Explorer was quickly gaining ground on it.
Microsoft released their own browser (ironically based on the earlier Mosaic browser which was created by one of the men now running Netscape), clearly worried about Netscape's dominance. It was not so much the worry that it would have a 100% market share of internet browsers on their Windows operating system, but more the worry that browsers would soon be capable of running all types programs on them. That would mean foregoing the need for an actual operating system, or at the most only a very basic one would be needed. This in turn would mean Netscape would soon be able to dictate terms to Microsoft, and Microsoft were not going to let that happen easily. Thus in August 1995, Internet Explorer was released.
By 1999 Internet explorer had captured an 89.03% market share, whilst Netscape was down to 10.47%. How could Internet Explorer make this much ground in just two years? Well this was down to two things really. The first, and by far the most important was that Microsoft bundled Internet Explorer in with every new copy of Windows, and as Windows was used by about 90% of the computer using population it clearly gave them a huge advantage. Internet Explorer had one other ace it held over Netscape – it was much better. Netscape Navigator was stagnant and had been for some time. The only new features it ever seemed to introduce were often perceived by the public as beneficial for Netscape's parent company rather than Netscape's user base. (i.e., features that would help it monopolise the market). Explorer, on the other hand, was given much attention by Microsoft. Regular updates and excellent usability plus a hundred million dollar investment would prove too much for Netscape Explorer.
2000 – 2005
These years were fairly quiet in the Battle of the Browsers. It seemed as if Internet Explorer had won the war and that nobody could even hope to compete with it. In 2002/2003 it had attained about 95% of the market share – about the time of IE 5/6. With over 1000 people working on it and millions of dollars being poured in, few people had the resources to compete. Then again, who wanted to compete? It was clearly a volatile market, and besides that everybody was content with Internet Explorer. Or were they? Some people saw faults with IE – security issues, incompatibility issues or simply bad programming. Not only that, it was being shoved down peoples throats. There was almost no competition to keep it in line or to turn to as an alternative. Something had to change. The only people with the ability and the power to compete with Microsoft took matters into their own hands.
Netscape was now supported by AOL. A few years prior, just after they had lost the Browser Wars to Microsoft, they had released the coding for Netscape into the public domain. This meant anybody could develop their own browser using the Netscape skeleton. And people did. Epiphany, Galeon and Camino, amongst others, were born out of Netscape's ashes. However the two most popular newcomers were called Mozilla and Firefox.
Mozilla was originally an open sourced project aimed to improve the Netscape browser. Eventually it was released as Netscape Navigator 7 and then 8. Later it was released as Mozilla 1.0.
Mozilla was almost an early version on another open source browser, Firefox. With it being an open source the public were able to contribute to it - adding in what features it needed, the programming it required and the support it deserved. The problems people saw in Internet Explorer were being fixed by members of the open sourced browser community via Firefox. For instance, the many security issues IE 6 had were almost entirely fixed in the very first release of Firefox. Microsoft had another fight on their hands.
2005 – Present
Firefox was the browser that grew and grew in these years. Every year capturing an even larger market share percentage than before. More user friendly than most of its rivals along with high security levels and arguably more intelligent programming helped its popularity. With such a large programming community behind it, updates have always been regular and add on programs/features are often released. It prides itself on being the peoples browser. It currently has a 28.38% market share.
Apple computers have had their own browser since the mid 1990's – Safari - complete with its own problems, such as (until recently) the inability to run Java scripts. However most Apple users seemed happy with it and a version capable of running on Windows has been released. It has had no major competitor on Apple Macs, and as such has largely been out of the Browser Wars. It currently holds a 2.54% market share and is slowly increasing.
Internet Explorer's market share has dropped from over 90% to around 75%, and is falling. It will be interesting to see what Microsoft will attempt to regain such a high market share.
Opera currently holds 1.07%.
Mozilla itself only has a 0.6% market share these days.
The Future of Web Browsing
Web browsers come and go. It is the nature of technology (if such a term can be used), to supplant inferior software in very short periods of time. It is almost impossible for a single company to stay ahead of the competition for long. Microsoft have the advantage of being able to release IE with any Windows using PC. That covers over 90% of the market. They also have the advantage of unprecedented resources. They can compete how they wish for as long as they wish. So there is no counting IE out of the future of web browsing.
Safari is in a similar position, being easily the most popular Mac web browser. Its long term survival is dependant upon Apple and the sale of their computers.
These are the only two browsers that are almost guaranteed another five years of life, at least. Firefox may seem like another candidate, but the public is fickle, and one bad release, or if it seriously lags behind the new Internet Explorer 8 for long, could easily see its popularity quickly descend into virtual oblivion.
However, it seems likely community driven browsers, such as Mozilla and Firefox, will be the only types of browser capable of competing with the wealthy internet arm of Microsoft in the near future.
As for web browsing itself, will it change any time soon? Well it already has for some online communities. For example, if you want to buy clothes you could try entering an online 'world' creating an online virtual You to go from 'shop to shop' with, looking at products and trying/buying what you see. Some 'worlds' allow you to recreate yourself accurately including weight and height and then try on things apparel such as jeans to give you an idea of how you would look in that particular item.
Will 'worlds' like this destroy normal web browsers such as IE ? - It seems unlikely. Traditional web browsers provide such freedom and ease of access that it is hard to see any other alternative taking over. However they are part of the new, 'thinking out of the box' wave of alternatives that some people will find attractive, and really who knows what the future will bring.
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software computer software , computer software , computer software , computer software
Changing Cell Color w/VBA in Excel
ntroduction
This article covers ways to change cells and cell properties in Excel, using Visual Basic for Applications, or VBA. VBA is the built-in macro programming langauge used by all Microsoft Office applications, and allows the programmer to change the properties according to the document model provided by the underlying application.
Sometimes it is useful to change the appearance of a cell based on it's contents. For example:
Teacher's spreadsheets - low grades in red;
Web site statistics - climbers in green, losers in red;
Names in different colors, etc. etc.
In order to do this we need to isolate those cells that we wish to hilight, the criteria upon which we wish to make the decision, and the actual hilighting feature we wish to employ. In Excel, VBA provides a way to change many properties, including:
Font (Text) Color;
Font (Text) Size;
Cell background color (shading);
Cell borders, etc. etc.
For the purpose of this discussion, we shall assume that we have a spreadsheet, with a column titled 'Average', and that we want anything less than 50.0 to be hilighted by a red background. The sheet shall be called 'Totals'.
(There is addition information in the article Getting Started with VBA for MS Excel that covers how to enter code, and prepare macros and Visual Basic programs, for the uniniated...)
Referencing the Cells
Excel works with cells in ranges. A range can be one or more cells. These cells are contained in rows and columns in a sheet. Each sheet has a property, 'Cells', which allows us to reference such a range.
At it's smallest granularity, we might use this propery to reference a single cell:
Worksheets("Totals").Cells(1,1)
The above refers to a single cell, at Row 1, Column 1 - it is the equivalent to A1 on a spreadsheet. Row 1, Column 2, (1,2) would be cell B1. Row 2, Column 3 would be cell C2, and so on.
We can also refer to an entire column:
Worksheets("Totals").Columns(1)
The above refers to all of Column A. So, we have enough information to prepare the code that determines which column we are interested in; this was the first step we isolated in the Introduction.
We need to look at all the column headers, and note down which column has the word 'Average' in it. This can be done as follows:
Function FindColumn(szName) As Integer
nFoundColumn = 0
For nColumn = 1 To Worksheets("Totals").Columns.Count
If StrComp(Worksheets("Totals").Cells(1, nColumn), szName) = 0 Then
nFoundColumn = nColumn
End If
Next nColumn
FindColumn = nFoundColumn
End Function
In this snippet, the For loop (code between the For... and Next... statements) allows us to move through the columns, nColumn by nColumn. We use StrComp to evaluate the contents against the szName parameter fed into the Function.
The function returns (using the line FindColumn = nFoundColumn) the index of the column containing the value szName.
Scrolling Through the Dataset
Once we have found the column, we can proceed to loop through the rows (starting at row 2, row 1 containing the heading), evaluating the contents of each cell. To look up the column, we use the following call to our FindColumn function:
nCol = FindColumn("Average")
If this call returns 0, we know that the column does not exist, and we need go no further. From our previous For code snippet above, we can construct a similar loop for the rows:
For nRow = 0 To Worksheets("Totals").Columns(nCol).Rows.Count
Rem Do Work Here
Next nRow
At each iteration of the loop, we need to evaluate the cell, and decide whether it is lower than the threshold (in this case, 50). However, given that the Count might include cells that are empty (rather than set to 0), we might not want to include them. This is especially true since Excel will run through all 65,000 rows, and evaluate each one. If we do not either:
Tell Excel to stop at the last Row;
Ignore empty cells.
There are therefore two possibilities - test for a known 'stop' value in a cell, or ignore empty cells. The advantage of having a stop value is that empty cells will be chosen, and hilighted, otherwise they need to be set to 0 in order to be chosen.
For the sake of simplicity, we will just ignore empty cells:
For nRow = 0 To Worksheets("Totals").Columns(nCol).Rows.Count
If Not IsEmpty(Worksheets("Totals").Cells(nRow, nCol)) Then
If Worksheets("Totals").Cells(nRow, nCol) 50.0 Then
Rem Hilight cell
End If
End If
Next nRow
The above uses the IsEmpty function to ascertain whether the cell contains any data. The double If (nested If) statement is used for clarity, a Boolean operator could have been used to combine the two statements.
Hilighting the Cell
Finally, we need to hilight the chosen cell:
Worksheets("Totals").Cells(nRow, nCol).Interior.ColorIndex = 3
The Interior property references the color and style of the shading. It uses an index, rather than a real color, and a collection of constants to set the shading style. These are out of scope for this article, but can be found in the Visual Basic for Excel online help files.
Summary
The above is just one way to achieve the goal, and is presented here for education, and not as the most elegant solution. In particular, the bounds checking for the data set, and hilighting code could be changed to allow for more flexibility / user friendliness. Fee free to post your contribution at the end of this page.
Budding Excel and Visual Basic or VBA programmers might find my article Starting with VBA for MS Excel of interest, as it covers extensions to the conditional summing functionality of Excel.
Non-programmers can refer to Conditional Sum Examples in Excel which covers conditional summing without the VBA.
This article covers ways to change cells and cell properties in Excel, using Visual Basic for Applications, or VBA. VBA is the built-in macro programming langauge used by all Microsoft Office applications, and allows the programmer to change the properties according to the document model provided by the underlying application.
Sometimes it is useful to change the appearance of a cell based on it's contents. For example:
Teacher's spreadsheets - low grades in red;
Web site statistics - climbers in green, losers in red;
Names in different colors, etc. etc.
In order to do this we need to isolate those cells that we wish to hilight, the criteria upon which we wish to make the decision, and the actual hilighting feature we wish to employ. In Excel, VBA provides a way to change many properties, including:
Font (Text) Color;
Font (Text) Size;
Cell background color (shading);
Cell borders, etc. etc.
For the purpose of this discussion, we shall assume that we have a spreadsheet, with a column titled 'Average', and that we want anything less than 50.0 to be hilighted by a red background. The sheet shall be called 'Totals'.
(There is addition information in the article Getting Started with VBA for MS Excel that covers how to enter code, and prepare macros and Visual Basic programs, for the uniniated...)
Referencing the Cells
Excel works with cells in ranges. A range can be one or more cells. These cells are contained in rows and columns in a sheet. Each sheet has a property, 'Cells', which allows us to reference such a range.
At it's smallest granularity, we might use this propery to reference a single cell:
Worksheets("Totals").Cells(1,1)
The above refers to a single cell, at Row 1, Column 1 - it is the equivalent to A1 on a spreadsheet. Row 1, Column 2, (1,2) would be cell B1. Row 2, Column 3 would be cell C2, and so on.
We can also refer to an entire column:
Worksheets("Totals").Columns(1)
The above refers to all of Column A. So, we have enough information to prepare the code that determines which column we are interested in; this was the first step we isolated in the Introduction.
We need to look at all the column headers, and note down which column has the word 'Average' in it. This can be done as follows:
Function FindColumn(szName) As Integer
nFoundColumn = 0
For nColumn = 1 To Worksheets("Totals").Columns.Count
If StrComp(Worksheets("Totals").Cells(1, nColumn), szName) = 0 Then
nFoundColumn = nColumn
End If
Next nColumn
FindColumn = nFoundColumn
End Function
In this snippet, the For loop (code between the For... and Next... statements) allows us to move through the columns, nColumn by nColumn. We use StrComp to evaluate the contents against the szName parameter fed into the Function.
The function returns (using the line FindColumn = nFoundColumn) the index of the column containing the value szName.
Scrolling Through the Dataset
Once we have found the column, we can proceed to loop through the rows (starting at row 2, row 1 containing the heading), evaluating the contents of each cell. To look up the column, we use the following call to our FindColumn function:
nCol = FindColumn("Average")
If this call returns 0, we know that the column does not exist, and we need go no further. From our previous For code snippet above, we can construct a similar loop for the rows:
For nRow = 0 To Worksheets("Totals").Columns(nCol).Rows.Count
Rem Do Work Here
Next nRow
At each iteration of the loop, we need to evaluate the cell, and decide whether it is lower than the threshold (in this case, 50). However, given that the Count might include cells that are empty (rather than set to 0), we might not want to include them. This is especially true since Excel will run through all 65,000 rows, and evaluate each one. If we do not either:
Tell Excel to stop at the last Row;
Ignore empty cells.
There are therefore two possibilities - test for a known 'stop' value in a cell, or ignore empty cells. The advantage of having a stop value is that empty cells will be chosen, and hilighted, otherwise they need to be set to 0 in order to be chosen.
For the sake of simplicity, we will just ignore empty cells:
For nRow = 0 To Worksheets("Totals").Columns(nCol).Rows.Count
If Not IsEmpty(Worksheets("Totals").Cells(nRow, nCol)) Then
If Worksheets("Totals").Cells(nRow, nCol) 50.0 Then
Rem Hilight cell
End If
End If
Next nRow
The above uses the IsEmpty function to ascertain whether the cell contains any data. The double If (nested If) statement is used for clarity, a Boolean operator could have been used to combine the two statements.
Hilighting the Cell
Finally, we need to hilight the chosen cell:
Worksheets("Totals").Cells(nRow, nCol).Interior.ColorIndex = 3
The Interior property references the color and style of the shading. It uses an index, rather than a real color, and a collection of constants to set the shading style. These are out of scope for this article, but can be found in the Visual Basic for Excel online help files.
Summary
The above is just one way to achieve the goal, and is presented here for education, and not as the most elegant solution. In particular, the bounds checking for the data set, and hilighting code could be changed to allow for more flexibility / user friendliness. Fee free to post your contribution at the end of this page.
Budding Excel and Visual Basic or VBA programmers might find my article Starting with VBA for MS Excel of interest, as it covers extensions to the conditional summing functionality of Excel.
Non-programmers can refer to Conditional Sum Examples in Excel which covers conditional summing without the VBA.
Mono XSP: Open Source ASP.NET Development
ASP.NET is traditionally a Microsoft domain; but not now - now any PC can run ASP.NET by installing Mono XSP.
ASP is now considered very much 'last century' and has generally been superceded by ASP.NET - both of which have been produced by Microsoft; and that, of course, is the one fact that may deter some web site developers from using it (especially if they come from a Linux background). However, that is no longer an issue - thanks to the Mono's XSP.
What is Mono?
Mono is an open source implementation of ASP.NET which fully supports ASP.NET version 1.1 and most of ASP.NET version 2.0.
What is XSP?
XSP is a standalone lightweight web server designed specifically to support Mono.
Installing Mono and XSP
Installation of both Mono and XSP is very easy:
the binaries (for both Windows and Linux) are available from the download section of the Mono web site (http://www.mono-project.com)
many of the Linux distributions have their own versions of both Mono and XSP, for example with Debian Linux it's just a matter of using the apt-get command to install the software:
sudo apt-get install mono
sudo apt-get install mono-xsp
Once the software has been installed then the developer will need to create a new directory - this will become the home directory for the XSP web server:
cd
mkdir mono
Next the server will need to be started from the new directory:
cd mono
xsp
At this point the user will receive confirmation that the XSP web server is running:
Listening on port: 8080 (non-secure)
Listening on address: 0.0.0.0
Root directory: /home/bainm/mono
Hit Return to stop the server.
The XSP web server will now be up and running
A Simple Example of an ASP.NET Web Page
The XSP web server is almost ready for use, however it still needs an index page, something simple like:
<%@ Page Language="C#" %>
<%
Response.Output.Write("Greetings from the XSP Web Server");
%>
This first web page must be named index.aspx and must also be placed in the XSP home directory (the one in which the xsp command was run).
Accessing the XSP Web Server
Once the index.aspx is in place the server can be accessed via the default port 8080 - so the next stage is to open up a web browser and type in the correct url:
http://:8080/
Changing the Home Directory and Default Port
It is, of course, not always convient to start XSP from the current directory or to use the default port - if that's the case then they can both be defined when starting the server:
Conclusion
By installing the Mono XSP server anyone with a computer, be it Linux or Windows, can start developing their own ASP.NET applications, or even just learning how to use this powerful and adaptable software.
ASP is now considered very much 'last century' and has generally been superceded by ASP.NET - both of which have been produced by Microsoft; and that, of course, is the one fact that may deter some web site developers from using it (especially if they come from a Linux background). However, that is no longer an issue - thanks to the Mono's XSP.
What is Mono?
Mono is an open source implementation of ASP.NET which fully supports ASP.NET version 1.1 and most of ASP.NET version 2.0.
What is XSP?
XSP is a standalone lightweight web server designed specifically to support Mono.
Installing Mono and XSP
Installation of both Mono and XSP is very easy:
the binaries (for both Windows and Linux) are available from the download section of the Mono web site (http://www.mono-project.com)
many of the Linux distributions have their own versions of both Mono and XSP, for example with Debian Linux it's just a matter of using the apt-get command to install the software:
sudo apt-get install mono
sudo apt-get install mono-xsp
Once the software has been installed then the developer will need to create a new directory - this will become the home directory for the XSP web server:
cd
mkdir mono
Next the server will need to be started from the new directory:
cd mono
xsp
At this point the user will receive confirmation that the XSP web server is running:
Listening on port: 8080 (non-secure)
Listening on address: 0.0.0.0
Root directory: /home/bainm/mono
Hit Return to stop the server.
The XSP web server will now be up and running
A Simple Example of an ASP.NET Web Page
The XSP web server is almost ready for use, however it still needs an index page, something simple like:
<%@ Page Language="C#" %>
<%
Response.Output.Write("Greetings from the XSP Web Server");
%>
This first web page must be named index.aspx and must also be placed in the XSP home directory (the one in which the xsp command was run).
Accessing the XSP Web Server
Once the index.aspx is in place the server can be accessed via the default port 8080 - so the next stage is to open up a web browser and type in the correct url:
http://
Changing the Home Directory and Default Port
It is, of course, not always convient to start XSP from the current directory or to use the default port - if that's the case then they can both be defined when starting the server:
Conclusion
By installing the Mono XSP server anyone with a computer, be it Linux or Windows, can start developing their own ASP.NET applications, or even just learning how to use this powerful and adaptable software.
Symantec Norton Antibot The Latest In Norton Computer Protection Software
It seems like every other month a new “program” comes along to make our lives that much easier. For example, first we could bookmark favorites, and then RSS feed them, and then came widgets and now “bots” which are robots that do a lot of our computer work for us in the background. Examples of friendly bots are weather bots, game playing bots, instant messaging and my favorites are those on AOL Instant Messenger which do all kinds of functions for me like shop, find movie times and even give updates on the Wall Street Journal.
Unfortunately not all bots were created “equal.” Some are friendly and some are not. The ones that are not friendly can be a form of malware that allows control of your computer to be released, providing hackers with the opportunity to access your information and spread harmful bots to others. This type of computer virus can then be used to spread spam and commit various types of identity theft and other online fraud.
So with new threats to our computers and information, new methods of protection are required. One of the oldest and most well known software protection designers has recently released a new protection program, Symantec Norton AntiBot. This is a software product designed to prevent the hijacking of one’s personal computer by bots and uses the bots on design programs against them, to located and destroy them.
Many people already employ some form of protection on their personal computer, such as increasing the protection level from internet information to “high.” But these cannot detect some of the most recent bot programs and may not be the most efficient means of information protection, especially with the Internet being used more and more frequently for online shopping, ticket purchases, travel and other “high risk” activities.
A more effective method of detecting and eliminating threats caused by bots is to install software designed specifically to detect, destroy and prevent bots from having access to your computer. With Symantec Norton AntiBot software, protection against bots is enhanced several times and the threat of bot attack is greatly diminished. It’s program protects against bots by blocking bots from entering your computer through downloads and e-mail attachments (two of the common ways bots enter a personal computer), checking for any unusual behavior on your personal computer and eliminating it, and detecting malicious bot software at all levels; keeping your personal, financial and credit card information safe and stopping identify theft before it can occur.
Because bots operate in the background and are not detectable by antivirus or antispyware programs, many computer users are completely unaware that their personal computer has become infected. Many problems caused by bots go undetected until it is too late. Warning signs that your computer may have been accessed include: slowness of computer speed and unusual or irrelevant error messages. However, many times com these symptoms are sporadic and computer users will take little notice. Many people will continue to use their personal computer, unaware that bots have hijacked their personal computer and are slowly at work; looking for credit card numbers, passwords, and logon information which can be used for identity theft and in committing other types of online crime. This program scans your personal computer on a continuous basis, closing the gaps that could allow bots to infect your personal computer and better ensuring that bots do not invade and gain control.
The use of Symantec Norton AntiBot to determine what a harmful or useful bot and allows you to continue using those bots you love and have come to depend on for information and services. It can be used in addition to several other antivirus and antispyware programs. Its compatibility is not limited to only Norton products.
The cost of this software is $29.95 for one year of service. It was awarded PC Magazine’s Editor’s Choice Award (2007) and underwent rigorous testing which included using AntiBot on computers with existing threats as well as allowing threats to try to access the computer after installation.
With the growing threat of identity theft and credit card fraud Symantec Norton AntiBot offers an additional level of protection needed to combat the threat of bots and prevent them from turning one’s personal computer into a robotic that turns into an instrument of destruction to both your personal and financial well-being.
Unfortunately not all bots were created “equal.” Some are friendly and some are not. The ones that are not friendly can be a form of malware that allows control of your computer to be released, providing hackers with the opportunity to access your information and spread harmful bots to others. This type of computer virus can then be used to spread spam and commit various types of identity theft and other online fraud.
So with new threats to our computers and information, new methods of protection are required. One of the oldest and most well known software protection designers has recently released a new protection program, Symantec Norton AntiBot. This is a software product designed to prevent the hijacking of one’s personal computer by bots and uses the bots on design programs against them, to located and destroy them.
Many people already employ some form of protection on their personal computer, such as increasing the protection level from internet information to “high.” But these cannot detect some of the most recent bot programs and may not be the most efficient means of information protection, especially with the Internet being used more and more frequently for online shopping, ticket purchases, travel and other “high risk” activities.
A more effective method of detecting and eliminating threats caused by bots is to install software designed specifically to detect, destroy and prevent bots from having access to your computer. With Symantec Norton AntiBot software, protection against bots is enhanced several times and the threat of bot attack is greatly diminished. It’s program protects against bots by blocking bots from entering your computer through downloads and e-mail attachments (two of the common ways bots enter a personal computer), checking for any unusual behavior on your personal computer and eliminating it, and detecting malicious bot software at all levels; keeping your personal, financial and credit card information safe and stopping identify theft before it can occur.
Because bots operate in the background and are not detectable by antivirus or antispyware programs, many computer users are completely unaware that their personal computer has become infected. Many problems caused by bots go undetected until it is too late. Warning signs that your computer may have been accessed include: slowness of computer speed and unusual or irrelevant error messages. However, many times com these symptoms are sporadic and computer users will take little notice. Many people will continue to use their personal computer, unaware that bots have hijacked their personal computer and are slowly at work; looking for credit card numbers, passwords, and logon information which can be used for identity theft and in committing other types of online crime. This program scans your personal computer on a continuous basis, closing the gaps that could allow bots to infect your personal computer and better ensuring that bots do not invade and gain control.
The use of Symantec Norton AntiBot to determine what a harmful or useful bot and allows you to continue using those bots you love and have come to depend on for information and services. It can be used in addition to several other antivirus and antispyware programs. Its compatibility is not limited to only Norton products.
The cost of this software is $29.95 for one year of service. It was awarded PC Magazine’s Editor’s Choice Award (2007) and underwent rigorous testing which included using AntiBot on computers with existing threats as well as allowing threats to try to access the computer after installation.
With the growing threat of identity theft and credit card fraud Symantec Norton AntiBot offers an additional level of protection needed to combat the threat of bots and prevent them from turning one’s personal computer into a robotic that turns into an instrument of destruction to both your personal and financial well-being.
The Battle of the Browsers – The History and the Future of Internet Browsers
With Internet Explorer 8 now available, can Microsoft hope to retain market dominance over fierce open source rivals such as Mozilla's Firefox or the feature packed Opera web browser. Can history give us a clue to what the future of web browsers/browsing might hold? How did Netscape Navigator go from having a dominant 89.36% market share of all web browsers in 1996 and yet only 3.76% by mid 1999?
Let us take a journey that will begin long before even the intellectual conception of Internet Explorer, that will glance at its long defeated rivals, examine the current browsers available and will end with a prediction of what the future of browsing will offer us – and which browser(s) will still be around to offer it.
People often think that Internet Explorer has been the dominant web browser since the golden age of the internet began. Well for a very long time now it has indeed been the most popular browser and at times been almost totally unrivalled. This was mainly a result of it being packaged free with Microsoft Windows, in what some would later call a brutal monopolisation attempt by Microsoft. The last few years however have heralded the arrival of new, possibly superior browsers. Mozilla's Firefox has been particularly successful at chipping away at Explorers market dominance. So where did it all begin, and why were Microsoft ever allowed to have a hundred percent market dominance?
Origins
The truth is they never did have total dominance, but at times they have come very close. Microsoft actually entered the Browser Battle quite late on. Infact a man named Neil Larson is credited to be one of the originators of internet browsers, when in 1977 he created a program – The TRS-80 - that allowed browsing between “sites” via hypertext jumps. This was a DOS program and the basis of much to come. Slowly other browsers powered by DOS and inspired by the TRS 80 were developed. Unfortunately they were often constricted by the limitations of the still fairly young internet itself.
In 1988, Peter Scott and Earle Fogel created a simple, fast browser called Hytelnet, which by 1990 offered users instant logon and access to the online catalogues of over five thousand libraries around the world – an exhilarating taste of what the internet, and web browsers, would soon be able to offer.
In 1989 the original World Wide Web was born. Using a NeXTcube computer, Tim Berners-Lee created a web browser that would change how people used the internet forever. He called his browser the WorldWideWeb(http://www., which is still likely to sound familiar to internet users today. It was a windowed browser capable of displaying simple style sheet, capable of editing sites and able to download and open any file type supported by the NeXTcube.
In 1993 the first popular graphical browser was released. Its name was Mosaic and it was created by Marc Andreessen and Eric Bina. Mosaic could be run on both Unix, and very importantly, on the highly popular Microsoft Windows operating system (incidentally it could also be used on Amiga and Apple computers). It was the first browser on Windows that could display graphics/pictures on a page where there was also textual content. It is often cited as being responsible for triggering the internet boom due to it making the internet bearable for the masses. (It should be noted that the web browser Cello was the first browser to be used on Windows – but it was non graphical and made very little impact compared to Mosaic).
The Browser Wars - Netscape Navigator versus Internet Explorer
Mosaic's decline began almost as soon as Netscape Navigator was released (1994). Netscape Navigator was a browser created by Marc Andreessen, one of the men behind Mosaic and co-founder of Netscape Communications Corporation. Netscape was unrivalled in terms of features and usability at the time. For example, one major change from previous browsers was that it allowed surfers to see parts of a website before the whole site was downloaded. This meant that people did not have to wait for minutes simply to see if the site they were loading was the actual one the were after, whilst also allowing them to read information on the site as the rest of it downloaded. By 1996 Netscape had almost 90% market dominance, as shown below.
Market Share Comparisons of Netscape Navigator and Internet Explorer from 1996 to 1998
....................Netscape.......IE
October 1998..........64%.........32.2%
April 1998............70%.........22.7%
October 1997..........59.67%......15.13%
April 1997............81.13%......12.13%
October 1996..........80.45%......12.18%
April 1996............89.36%.......3.76%
In these two years Netscape clearly dominated the internet browser market, but a new browser named Internet Explorer was quickly gaining ground on it.
Microsoft released their own browser (ironically based on the earlier Mosaic browser which was created by one of the men now running Netscape), clearly worried about Netscape's dominance. It was not so much the worry that it would have a 100% market share of internet browsers on their Windows operating system, but more the worry that browsers would soon be capable of running all types programs on them. That would mean foregoing the need for an actual operating system, or at the most only a very basic one would be needed. This in turn would mean Netscape would soon be able to dictate terms to Microsoft, and Microsoft were not going to let that happen easily. Thus in August 1995, Internet Explorer was released.
By 1999 Internet explorer had captured an 89.03% market share, whilst Netscape was down to 10.47%. How could Internet Explorer make this much ground in just two years? Well this was down to two things really. The first, and by far the most important was that Microsoft bundled Internet Explorer in with every new copy of Windows, and as Windows was used by about 90% of the computer using population it clearly gave them a huge advantage. Internet Explorer had one other ace it held over Netscape – it was much better. Netscape Navigator was stagnant and had been for some time. The only new features it ever seemed to introduce were often perceived by the public as beneficial for Netscape's parent company rather than Netscape's user base. (i.e., features that would help it monopolise the market). Explorer, on the other hand, was given much attention by Microsoft. Regular updates and excellent usability plus a hundred million dollar investment would prove too much for Netscape Explorer.
2000 – 2005
These years were fairly quiet in the Battle of the Browsers. It seemed as if Internet Explorer had won the war and that nobody could even hope to compete with it. In 2002/2003 it had attained about 95% of the market share – about the time of IE 5/6. With over 1000 people working on it and millions of dollars being poured in, few people had the resources to compete. Then again, who wanted to compete? It was clearly a volatile market, and besides that everybody was content with Internet Explorer. Or were they? Some people saw faults with IE – security issues, incompatibility issues or simply bad programming. Not only that, it was being shoved down peoples throats. There was almost no competition to keep it in line or to turn to as an alternative. Something had to change. The only people with the ability and the power to compete with Microsoft took matters into their own hands.
Netscape was now supported by AOL. A few years prior, just after they had lost the Browser Wars to Microsoft, they had released the coding for Netscape into the public domain. This meant anybody could develop their own browser using the Netscape skeleton. And people did. Epiphany, Galeon and Camino, amongst others, were born out of Netscape's ashes. However the two most popular newcomers were called Mozilla and Firefox.
Mozilla was originally an open sourced project aimed to improve the Netscape browser. Eventually it was released as Netscape Navigator 7 and then 8. Later it was released as Mozilla 1.0.
Mozilla was almost an early version on another open source browser, Firefox. With it being an open source the public were able to contribute to it - adding in what features it needed, the programming it required and the support it deserved. The problems people saw in Internet Explorer were being fixed by members of the open sourced browser community via Firefox. For instance, the many security issues IE 6 had were almost entirely fixed in the very first release of Firefox. Microsoft had another fight on their hands.
2005 – Present
Firefox was the browser that grew and grew in these years. Every year capturing an even larger market share percentage than before. More user friendly than most of its rivals along with high security levels and arguably more intelligent programming helped its popularity. With such a large programming community behind it, updates have always been regular and add on programs/features are often released. It prides itself on being the peoples browser. It currently has a 28.38% market share.
Apple computers have had their own browser since the mid 1990's – Safari - complete with its own problems, such as (until recently) the inability to run Java scripts. However most Apple users seemed happy with it and a version capable of running on Windows has been released. It has had no major competitor on Apple Macs, and as such has largely been out of the Browser Wars. It currently holds a 2.54% market share and is slowly increasing.
Internet Explorer's market share has dropped from over 90% to around 75%, and is falling. It will be interesting to see what Microsoft will attempt to regain such a high market share.
Opera currently holds 1.07%.
Mozilla itself only has a 0.6% market share these days.
The Future of Web Browsing
Web browsers come and go. It is the nature of technology (if such a term can be used), to supplant inferior software in very short periods of time. It is almost impossible for a single company to stay ahead of the competition for long. Microsoft have the advantage of being able to release IE with any Windows using PC. That covers over 90% of the market. They also have the advantage of unprecedented resources. They can compete how they wish for as long as they wish. So there is no counting IE out of the future of web browsing.
Safari is in a similar position, being easily the most popular Mac web browser. Its long term survival is dependant upon Apple and the sale of their computers.
These are the only two browsers that are almost guaranteed another five years of life, at least. Firefox may seem like another candidate, but the public is fickle, and one bad release, or if it seriously lags behind the new Internet Explorer 8 for long, could easily see its popularity quickly descend into virtual oblivion.
However, it seems likely community driven browsers, such as Mozilla and Firefox, will be the only types of browser capable of competing with the wealthy internet arm of Microsoft in the near future.
As for web browsing itself, will it change any time soon? Well it already has for some online communities. For example, if you want to buy clothes you could try entering an online 'world' creating an online virtual You to go from 'shop to shop' with, looking at products and trying/buying what you see. Some 'worlds' allow you to recreate yourself accurately including weight and height and then try on things apparel such as jeans to give you an idea of how you would look in that particular item.
Will 'worlds' like this destroy normal web browsers such as IE ? - It seems unlikely. Traditional web browsers provide such freedom and ease of access that it is hard to see any other alternative taking over. However they are part of the new, 'thinking out of the box' wave of alternatives that some people will find attractive, and really who knows what the future will bring.
Let us take a journey that will begin long before even the intellectual conception of Internet Explorer, that will glance at its long defeated rivals, examine the current browsers available and will end with a prediction of what the future of browsing will offer us – and which browser(s) will still be around to offer it.
People often think that Internet Explorer has been the dominant web browser since the golden age of the internet began. Well for a very long time now it has indeed been the most popular browser and at times been almost totally unrivalled. This was mainly a result of it being packaged free with Microsoft Windows, in what some would later call a brutal monopolisation attempt by Microsoft. The last few years however have heralded the arrival of new, possibly superior browsers. Mozilla's Firefox has been particularly successful at chipping away at Explorers market dominance. So where did it all begin, and why were Microsoft ever allowed to have a hundred percent market dominance?
Origins
The truth is they never did have total dominance, but at times they have come very close. Microsoft actually entered the Browser Battle quite late on. Infact a man named Neil Larson is credited to be one of the originators of internet browsers, when in 1977 he created a program – The TRS-80 - that allowed browsing between “sites” via hypertext jumps. This was a DOS program and the basis of much to come. Slowly other browsers powered by DOS and inspired by the TRS 80 were developed. Unfortunately they were often constricted by the limitations of the still fairly young internet itself.
In 1988, Peter Scott and Earle Fogel created a simple, fast browser called Hytelnet, which by 1990 offered users instant logon and access to the online catalogues of over five thousand libraries around the world – an exhilarating taste of what the internet, and web browsers, would soon be able to offer.
In 1989 the original World Wide Web was born. Using a NeXTcube computer, Tim Berners-Lee created a web browser that would change how people used the internet forever. He called his browser the WorldWideWeb(http://www., which is still likely to sound familiar to internet users today. It was a windowed browser capable of displaying simple style sheet, capable of editing sites and able to download and open any file type supported by the NeXTcube.
In 1993 the first popular graphical browser was released. Its name was Mosaic and it was created by Marc Andreessen and Eric Bina. Mosaic could be run on both Unix, and very importantly, on the highly popular Microsoft Windows operating system (incidentally it could also be used on Amiga and Apple computers). It was the first browser on Windows that could display graphics/pictures on a page where there was also textual content. It is often cited as being responsible for triggering the internet boom due to it making the internet bearable for the masses. (It should be noted that the web browser Cello was the first browser to be used on Windows – but it was non graphical and made very little impact compared to Mosaic).
The Browser Wars - Netscape Navigator versus Internet Explorer
Mosaic's decline began almost as soon as Netscape Navigator was released (1994). Netscape Navigator was a browser created by Marc Andreessen, one of the men behind Mosaic and co-founder of Netscape Communications Corporation. Netscape was unrivalled in terms of features and usability at the time. For example, one major change from previous browsers was that it allowed surfers to see parts of a website before the whole site was downloaded. This meant that people did not have to wait for minutes simply to see if the site they were loading was the actual one the were after, whilst also allowing them to read information on the site as the rest of it downloaded. By 1996 Netscape had almost 90% market dominance, as shown below.
Market Share Comparisons of Netscape Navigator and Internet Explorer from 1996 to 1998
....................Netscape.......IE
October 1998..........64%.........32.2%
April 1998............70%.........22.7%
October 1997..........59.67%......15.13%
April 1997............81.13%......12.13%
October 1996..........80.45%......12.18%
April 1996............89.36%.......3.76%
In these two years Netscape clearly dominated the internet browser market, but a new browser named Internet Explorer was quickly gaining ground on it.
Microsoft released their own browser (ironically based on the earlier Mosaic browser which was created by one of the men now running Netscape), clearly worried about Netscape's dominance. It was not so much the worry that it would have a 100% market share of internet browsers on their Windows operating system, but more the worry that browsers would soon be capable of running all types programs on them. That would mean foregoing the need for an actual operating system, or at the most only a very basic one would be needed. This in turn would mean Netscape would soon be able to dictate terms to Microsoft, and Microsoft were not going to let that happen easily. Thus in August 1995, Internet Explorer was released.
By 1999 Internet explorer had captured an 89.03% market share, whilst Netscape was down to 10.47%. How could Internet Explorer make this much ground in just two years? Well this was down to two things really. The first, and by far the most important was that Microsoft bundled Internet Explorer in with every new copy of Windows, and as Windows was used by about 90% of the computer using population it clearly gave them a huge advantage. Internet Explorer had one other ace it held over Netscape – it was much better. Netscape Navigator was stagnant and had been for some time. The only new features it ever seemed to introduce were often perceived by the public as beneficial for Netscape's parent company rather than Netscape's user base. (i.e., features that would help it monopolise the market). Explorer, on the other hand, was given much attention by Microsoft. Regular updates and excellent usability plus a hundred million dollar investment would prove too much for Netscape Explorer.
2000 – 2005
These years were fairly quiet in the Battle of the Browsers. It seemed as if Internet Explorer had won the war and that nobody could even hope to compete with it. In 2002/2003 it had attained about 95% of the market share – about the time of IE 5/6. With over 1000 people working on it and millions of dollars being poured in, few people had the resources to compete. Then again, who wanted to compete? It was clearly a volatile market, and besides that everybody was content with Internet Explorer. Or were they? Some people saw faults with IE – security issues, incompatibility issues or simply bad programming. Not only that, it was being shoved down peoples throats. There was almost no competition to keep it in line or to turn to as an alternative. Something had to change. The only people with the ability and the power to compete with Microsoft took matters into their own hands.
Netscape was now supported by AOL. A few years prior, just after they had lost the Browser Wars to Microsoft, they had released the coding for Netscape into the public domain. This meant anybody could develop their own browser using the Netscape skeleton. And people did. Epiphany, Galeon and Camino, amongst others, were born out of Netscape's ashes. However the two most popular newcomers were called Mozilla and Firefox.
Mozilla was originally an open sourced project aimed to improve the Netscape browser. Eventually it was released as Netscape Navigator 7 and then 8. Later it was released as Mozilla 1.0.
Mozilla was almost an early version on another open source browser, Firefox. With it being an open source the public were able to contribute to it - adding in what features it needed, the programming it required and the support it deserved. The problems people saw in Internet Explorer were being fixed by members of the open sourced browser community via Firefox. For instance, the many security issues IE 6 had were almost entirely fixed in the very first release of Firefox. Microsoft had another fight on their hands.
2005 – Present
Firefox was the browser that grew and grew in these years. Every year capturing an even larger market share percentage than before. More user friendly than most of its rivals along with high security levels and arguably more intelligent programming helped its popularity. With such a large programming community behind it, updates have always been regular and add on programs/features are often released. It prides itself on being the peoples browser. It currently has a 28.38% market share.
Apple computers have had their own browser since the mid 1990's – Safari - complete with its own problems, such as (until recently) the inability to run Java scripts. However most Apple users seemed happy with it and a version capable of running on Windows has been released. It has had no major competitor on Apple Macs, and as such has largely been out of the Browser Wars. It currently holds a 2.54% market share and is slowly increasing.
Internet Explorer's market share has dropped from over 90% to around 75%, and is falling. It will be interesting to see what Microsoft will attempt to regain such a high market share.
Opera currently holds 1.07%.
Mozilla itself only has a 0.6% market share these days.
The Future of Web Browsing
Web browsers come and go. It is the nature of technology (if such a term can be used), to supplant inferior software in very short periods of time. It is almost impossible for a single company to stay ahead of the competition for long. Microsoft have the advantage of being able to release IE with any Windows using PC. That covers over 90% of the market. They also have the advantage of unprecedented resources. They can compete how they wish for as long as they wish. So there is no counting IE out of the future of web browsing.
Safari is in a similar position, being easily the most popular Mac web browser. Its long term survival is dependant upon Apple and the sale of their computers.
These are the only two browsers that are almost guaranteed another five years of life, at least. Firefox may seem like another candidate, but the public is fickle, and one bad release, or if it seriously lags behind the new Internet Explorer 8 for long, could easily see its popularity quickly descend into virtual oblivion.
However, it seems likely community driven browsers, such as Mozilla and Firefox, will be the only types of browser capable of competing with the wealthy internet arm of Microsoft in the near future.
As for web browsing itself, will it change any time soon? Well it already has for some online communities. For example, if you want to buy clothes you could try entering an online 'world' creating an online virtual You to go from 'shop to shop' with, looking at products and trying/buying what you see. Some 'worlds' allow you to recreate yourself accurately including weight and height and then try on things apparel such as jeans to give you an idea of how you would look in that particular item.
Will 'worlds' like this destroy normal web browsers such as IE ? - It seems unlikely. Traditional web browsers provide such freedom and ease of access that it is hard to see any other alternative taking over. However they are part of the new, 'thinking out of the box' wave of alternatives that some people will find attractive, and really who knows what the future will bring.
Web 2.0 And Why You Shouldn't Fake Reviews
The latest offering from Ramsay's Kitchen Nightmares aired on Channel 4 last night, followed the somewhat disastrous adventures of ex-boxer Mike and his wife Caron Ciminera as they struggled to run the Fish & Anchor, a restaurant in Lampeter, West Wales. Whilst the couple's arguing appeared to better the food they were originally sending out (a mix of jarred sauces and home cook book trophy dishes) they did let slip on a fantastically poor bit of black hat optimisation, which I hope made all white hat SEOs laugh out loud.
If there was one lesson to take away from the show, it would be - Don't fake reviews!
In order to gauged the feeling of the local community for the failing restaurant come sports bar, Ramsay conducted a search on Google for the Fish & Anchor, to which he was presented with a range of reviews, two of which were rather suspiciously from a character calling himself Michael or Mike Burns.
On the Wales portal of the BBC website Burns had posted "Well i don't get excited about food too often, and having dined in Rick Stein's, and Gordon Ramsay's,I think i have found a better restaurant in West Wales". On the SugarVine website he also posted "what a fantastic restaurant for couples, and families. it seems to have everything, the food has to be the best i have eaten (home or abroad) this place will go far". Other online reviews echoed what has already been said, but with the dire state of the restaurant, its food, its reputation and its perception from both the local community and Ramsay itself, would it not be right to question who was telling the truth?
The restaurateur confessed to posting the reviews, his rational pointing to stimulating custom, however with any reactive strategy it requires a degree of foresight - and I am not sure he really thought through the wider ramification of posting these "inaccurate" reviews.
Firstly, a warning must be expressed. For example, if someone finds your restaurant or hotel via a positive (fake) review and they have a bad experience, there is a chance that they will post a true review to assist fellow users and generally have a rant. The initial seeding of this true review has the potential to lead to an onslaught of further reviews from other visitors who might not have otherwise posted. Don't forget the saying "people don't lead... they follow".
But how can you manage your reviews and ultimately what your customers are saying about you? Well first and foremost, address the problem(s)!
You wouldn't put a sticking plaster on a gun shot wound, so why think that a positive review about the quality of your food or the softest of your sheets is going to counteract the adversities of your customer service?
The customer is king, a point stressed by Ramsay, and one that should ring true for any business, after all, without them, where would we be?
By rectifying or at least making plans to manage any failings within your business, regardless of its size, will be the first step in managing your online reputation, but this is an area I will not going into comprehensive detail for this post. Instead, I will offer some simply pointers as to how to harness online reviews for good.
Sites like Trip Advisor, which boasts over 10,000,000 user generated reviews of various hotels, holidays and restaurants is gaining increasing weighting as an resource for honest and unbiased review and via its system of community recommendation it really has the power to drive custom, and in many instances, divert customer - the key factor being positive, and consistent reviews.
But if you do run a successful hotel or restaurant and wish to harness these social spaces, but wish to do so in a more ethical way than that demonstrated in Kitchen Nightmares than why not encourage your diners of hotel guests to post a review after their stay.
When the customer is paying their bill or even booking their hotel room why not take their email address, or even ask them to submit their business card in return for entry into a monthly prize draw for a free meal in the restaurant?
In addition to building up a client database by collecting this data - for use in promotional mailings including notifying customers of events, promotional and the launch of a new menu - you can also harness it to stimulate online reviews by dropping your customers a short email after their stay / meal, which might look something like the following example...
"Good afternoon Simon, and thank you very much for your booking at the Leapfrogg Restaurant, we hope you had an enjoyable meal.
If there was one lesson to take away from the show, it would be - Don't fake reviews!
In order to gauged the feeling of the local community for the failing restaurant come sports bar, Ramsay conducted a search on Google for the Fish & Anchor, to which he was presented with a range of reviews, two of which were rather suspiciously from a character calling himself Michael or Mike Burns.
On the Wales portal of the BBC website Burns had posted "Well i don't get excited about food too often, and having dined in Rick Stein's, and Gordon Ramsay's,I think i have found a better restaurant in West Wales". On the SugarVine website he also posted "what a fantastic restaurant for couples, and families. it seems to have everything, the food has to be the best i have eaten (home or abroad) this place will go far". Other online reviews echoed what has already been said, but with the dire state of the restaurant, its food, its reputation and its perception from both the local community and Ramsay itself, would it not be right to question who was telling the truth?
The restaurateur confessed to posting the reviews, his rational pointing to stimulating custom, however with any reactive strategy it requires a degree of foresight - and I am not sure he really thought through the wider ramification of posting these "inaccurate" reviews.
Firstly, a warning must be expressed. For example, if someone finds your restaurant or hotel via a positive (fake) review and they have a bad experience, there is a chance that they will post a true review to assist fellow users and generally have a rant. The initial seeding of this true review has the potential to lead to an onslaught of further reviews from other visitors who might not have otherwise posted. Don't forget the saying "people don't lead... they follow".
But how can you manage your reviews and ultimately what your customers are saying about you? Well first and foremost, address the problem(s)!
You wouldn't put a sticking plaster on a gun shot wound, so why think that a positive review about the quality of your food or the softest of your sheets is going to counteract the adversities of your customer service?
The customer is king, a point stressed by Ramsay, and one that should ring true for any business, after all, without them, where would we be?
By rectifying or at least making plans to manage any failings within your business, regardless of its size, will be the first step in managing your online reputation, but this is an area I will not going into comprehensive detail for this post. Instead, I will offer some simply pointers as to how to harness online reviews for good.
Sites like Trip Advisor, which boasts over 10,000,000 user generated reviews of various hotels, holidays and restaurants is gaining increasing weighting as an resource for honest and unbiased review and via its system of community recommendation it really has the power to drive custom, and in many instances, divert customer - the key factor being positive, and consistent reviews.
But if you do run a successful hotel or restaurant and wish to harness these social spaces, but wish to do so in a more ethical way than that demonstrated in Kitchen Nightmares than why not encourage your diners of hotel guests to post a review after their stay.
When the customer is paying their bill or even booking their hotel room why not take their email address, or even ask them to submit their business card in return for entry into a monthly prize draw for a free meal in the restaurant?
In addition to building up a client database by collecting this data - for use in promotional mailings including notifying customers of events, promotional and the launch of a new menu - you can also harness it to stimulate online reviews by dropping your customers a short email after their stay / meal, which might look something like the following example...
"Good afternoon Simon, and thank you very much for your booking at the Leapfrogg Restaurant, we hope you had an enjoyable meal.
Thursday, September 11, 2008
Control Structures for c++
A program is usually not limited to a linear sequence of instructions. During its process it may bifurcate, repeat code or take decisions. For that purpose, C++ provides control structures that serve to specify what has to be done by our program, when and under which circumstances.
With the introduction of control structures we are going to have to introduce a new concept: the compound-statement or block. A block is a group of statements which are separated by semicolons (;) like all C++ statements, but grouped together in a block enclosed in braces: { }:
{ statement1; statement2; statement3; }
Most of the control structures that we will see in this section require a generic statement as part of its syntax. A statement can be either a simple statement (a simple instruction ending with a semicolon) or a compound statement (several instructions grouped in a block), like the one just described. In the case that we want the statement to be a simple statement, we do not need to enclose it in braces ({}). But in the case that we want the statement to be a compound statement it must be enclosed between braces ({}), forming a block.
Conditional structure: if and else
The if keyword is used to execute a statement or block only if a condition is fulfilled. Its form is:
if (condition) statement
Where condition is the expression that is being evaluated. If this condition is true, statement is executed. If it is false, statement is ignored (not executed) and the program continues right after this conditional structure.
For example, the following code fragment prints x is 100 only if the value stored in the x variable is indeed 100:
if (x == 100)
cout << "x is 100";
If we want more than a single statement to be executed in case that the condition is true we can specify a block using braces { }:
if (x == 100)
{
cout << "x is ";
cout << x;
}
We can additionally specify what we want to happen if the condition is not fulfilled by using the keyword else. Its form used in conjunction with if is:
if (condition) statement1 else statement2
For example:
if (x == 100)
cout << "x is 100";
else
cout << "x is not 100";
prints on the screen x is 100 if indeed x has a value of 100, but if it has not -and only if not- it prints out x is not 100.
The if + else structures can be concatenated with the intention of verifying a range of values. The following example shows its use telling if the value currently stored in x is positive, negative or none of them (i.e. zero):
if (x > 0)
cout << "x is positive";
else if (x < 0)
cout << "x is negative";
else
cout << "x is 0";
Remember that in case that we want more than a single statement to be executed, we must group them in a block by enclosing them in braces { }.
Iteration structures (loops)
Loops have as purpose to repeat a statement a certain number of times or while a condition is fulfilled.
The while loop
Its format is:
while (expression) statement
and its functionality is simply to repeat statement while the condition set in expression is true.
For example, we are going to make a program to countdown using a while-loop:
// custom countdown using while
#include
using namespace std;
int main ()
{
int n;
cout << "Enter the starting number > ";
cin >> n;
while (n>0) {
cout << n << ", ";
--n;
}
cout << "FIRE!\n";
return 0;
}
Enter the starting number > 8
8, 7, 6, 5, 4, 3, 2, 1, FIRE!
When the program starts the user is prompted to insert a starting number for the countdown. Then the while loop begins, if the value entered by the user fulfills the condition n>0 (that n is greater than zero) the block that follows the condition will be executed and repeated while the condition (n>0) remains being true.
The whole process of the previous program can be interpreted according to the following script (beginning in main):
User assigns a value to n
The while condition is checked (n>0). At this point there are two posibilities:
* condition is true: statement is executed (to step 3)
* condition is false: ignore statement and continue after it (to step 5)
Execute statement:
cout << n << ", ";
--n;
(prints the value of n on the screen and decreases n by 1)
End of block. Return automatically to step 2
Continue the program right after the block: print FIRE! and end program.
When creating a while-loop, we must always consider that it has to end at some point, therefore we must provide within the block some method to force the condition to become false at some point, otherwise the loop will continue looping forever. In this case we have included --n; that decreases the value of the variable that is being evaluated in the condition (n) by one - this will eventually make the condition (n>0) to become false after a certain number of loop iterations: to be more specific, when n becomes 0, that is where our while-loop and our countdown end.
Of course this is such a simple action for our computer that the whole countdown is performed instantly without any practical delay between numbers.
The do-while loop
Its format is:
do statement while (condition);
Its functionality is exactly the same as the while loop, except that condition in the do-while loop is evaluated after the execution of statement instead of before, granting at least one execution of statement even if condition is never fulfilled. For example, the following example program echoes any number you enter until you enter 0.
// number echoer
#include
using namespace std;
int main ()
{
unsigned long n;
do {
cout << "Enter number (0 to end): ";
cin >> n;
cout << "You entered: " << n << "\n";
} while (n != 0);
return 0;
}
Enter number (0 to end): 12345
You entered: 12345
Enter number (0 to end): 160277
You entered: 160277
Enter number (0 to end): 0
You entered: 0
The do-while loop is usually used when the condition that has to determine the end of the loop is determined within the loop statement itself, like in the previous case, where the user input within the block is what is used to determine if the loop has to end. In fact if you never enter the value 0 in the previous example you can be prompted for more numbers forever.
The for loop
Its format is:
for (initialization; condition; increase) statement;
and its main function is to repeat statement while condition remains true, like the while loop. But in addition, the for loop provides specific locations to contain an initialization statement and an increase statement. So this loop is specially designed to perform a repetitive action with a counter which is initialized and increased on each iteration.
It works in the following way:
initialization is executed. Generally it is an initial value setting for a counter variable. This is executed only once.
condition is checked. If it is true the loop continues, otherwise the loop ends and statement is skipped (not executed).
statement is executed. As usual, it can be either a single statement or a block enclosed in braces { }.
finally, whatever is specified in the increase field is executed and the loop gets back to step 2.
Here is an example of countdown using a for loop:
// countdown using a for loop
#include
using namespace std;
int main ()
{
for (int n=10; n>0; n--) {
cout << n << ", ";
}
cout << "FIRE!\n";
return 0;
}
10, 9, 8, 7, 6, 5, 4, 3, 2, 1, FIRE!
The initialization and increase fields are optional. They can remain empty, but in all cases the semicolon signs between them must be written. For example we could write: for (;n<10;) if we wanted to specify no initialization and no increase; or for (;n<10;n++) if we wanted to include an increase field but no initialization (maybe because the variable was already initialized before).
Optionally, using the comma operator (,) we can specify more than one expression in any of the fields included in a for loop, like in initialization, for example. The comma operator (,) is an expression separator, it serves to separate more than one expression where only one is generally expected. For example, suppose that we wanted to initialize more than one variable in our loop:
for ( n=0, i=100 ; n!=i ; n++, i-- )
{
// whatever here...
}
This loop will execute for 50 times if neither n or i are modified within the loop:
n starts with a value of 0, and i with 100, the condition is n!=i (that n is not equal to i). Because n is increased by one and i decreased by one, the loop's condition will become false after the 50th loop, when both n and i will be equal to 50.
Jump statements.
The break statement
Using break we can leave a loop even if the condition for its end is not fulfilled. It can be used to end an infinite loop, or to force it to end before its natural end. For example, we are going to stop the count down before its natural end (maybe because of an engine check failure?):
// break loop example
#include
using namespace std;
int main ()
{
int n;
for (n=10; n>0; n--)
{
cout << n << ", ";
if (n==3)
{
cout << "countdown aborted!";
break;
}
}
return 0;
}
10, 9, 8, 7, 6, 5, 4, 3, countdown aborted!
The continue statement
The continue statement causes the program to skip the rest of the loop in the current iteration as if the end of the statement block had been reached, causing it to jump to the start of the following iteration. For example, we are going to skip the number 5 in our countdown:
// continue loop example
#include
using namespace std;
int main ()
{
for (int n=10; n>0; n--) {
if (n==5) continue;
cout << n << ", ";
}
cout << "FIRE!\n";
return 0;
}
10, 9, 8, 7, 6, 4, 3, 2, 1, FIRE!
The goto statement
goto allows to make an absolute jump to another point in the program. You should use this feature with caution since its execution causes an unconditional jump ignoring any type of nesting limitations.
The destination point is identified by a label, which is then used as an argument for the goto statement. A label is made of a valid identifier followed by a colon (:).
Generally speaking, this instruction has no concrete use in structured or object oriented programming aside from those that low-level programming fans may find for it. For example, here is our countdown loop using goto:
// goto loop example
#include
using namespace std;
int main ()
{
int n=10;
loop:
cout << n << ", ";
n--;
if (n>0) goto loop;
cout << "FIRE!\n";
return 0;
}
10, 9, 8, 7, 6, 5, 4, 3, 2, 1, FIRE!
The exit function
exit is a function defined in the cstdlib library.
The purpose of exit is to terminate the current program with a specific exit code. Its prototype is:
void exit (int exitcode);
The exitcode is used by some operating systems and may be used by calling programs. By convention, an exit code of 0 means that the program finished normally and any other value means that some error or unexpected results happened.
The selective structure: switch.
The syntax of the switch statement is a bit peculiar. Its objective is to check several possible constant values for an expression. Something similar to what we did at the beginning of this section with the concatenation of several if and else if instructions. Its form is the following:
switch (expression)
{
case constant1:
group of statements 1;
break;
case constant2:
group of statements 2;
break;
.
.
.
default:
default group of statements
}
It works in the following way: switch evaluates expression and checks if it is equivalent to constant1, if it is, it executes group of statements 1 until it finds the break statement. When it finds this break statement the program jumps to the end of the switch selective structure.
If expression was not equal to constant1 it will be checked against constant2. If it is equal to this, it will execute group of statements 2 until a break keyword is found, and then will jump to the end of the switch selective structure.
Finally, if the value of expression did not match any of the previously specified constants (you can include as many case labels as values you want to check), the program will execute the statements included after the default: label, if it exists (since it is optional).
Both of the following code fragments have the same behavior:
switch example if-else equivalent
switch (x) {
case 1:
cout << "x is 1";
break;
case 2:
cout << "x is 2";
break;
default:
cout << "value of x unknown";
}
if (x == 1) {
cout << "x is 1";
}
else if (x == 2) {
cout << "x is 2";
}
else {
cout << "value of x unknown";
}
The switch statement is a bit peculiar within the C++ language because it uses labels instead of blocks. This forces us to put break statements after the group of statements that we want to be executed for a specific condition. Otherwise the remainder statements -including those corresponding to other labels- will also be executed until the end of the switch selective block or a break statement is reached.
For example, if we did not include a break statement after the first group for case one, the program will not automatically jump to the end of the switch selective block and it would continue executing the rest of statements until it reaches either a break instruction or the end of the switch selective block. This makes unnecessary to include braces { } surrounding the statements for each of the cases, and it can also be useful to execute the same block of instructions for different possible values for the expression being evaluated. For example:
switch (x) {
case 1:
case 2:
case 3:
cout << "x is 1, 2 or 3";
break;
default:
cout << "x is not 1, 2 nor 3";
}
Notice that switch can only be used to compare an expression against constants. Therefore we cannot put variables as labels (for example case n: where n is a variable) or ranges (case (1..3):) because they are not valid C++ constants.
If you need to check ranges or values that are not constants, use a concatenation of if and else if statements.
With the introduction of control structures we are going to have to introduce a new concept: the compound-statement or block. A block is a group of statements which are separated by semicolons (;) like all C++ statements, but grouped together in a block enclosed in braces: { }:
{ statement1; statement2; statement3; }
Most of the control structures that we will see in this section require a generic statement as part of its syntax. A statement can be either a simple statement (a simple instruction ending with a semicolon) or a compound statement (several instructions grouped in a block), like the one just described. In the case that we want the statement to be a simple statement, we do not need to enclose it in braces ({}). But in the case that we want the statement to be a compound statement it must be enclosed between braces ({}), forming a block.
Conditional structure: if and else
The if keyword is used to execute a statement or block only if a condition is fulfilled. Its form is:
if (condition) statement
Where condition is the expression that is being evaluated. If this condition is true, statement is executed. If it is false, statement is ignored (not executed) and the program continues right after this conditional structure.
For example, the following code fragment prints x is 100 only if the value stored in the x variable is indeed 100:
if (x == 100)
cout << "x is 100";
If we want more than a single statement to be executed in case that the condition is true we can specify a block using braces { }:
if (x == 100)
{
cout << "x is ";
cout << x;
}
We can additionally specify what we want to happen if the condition is not fulfilled by using the keyword else. Its form used in conjunction with if is:
if (condition) statement1 else statement2
For example:
if (x == 100)
cout << "x is 100";
else
cout << "x is not 100";
prints on the screen x is 100 if indeed x has a value of 100, but if it has not -and only if not- it prints out x is not 100.
The if + else structures can be concatenated with the intention of verifying a range of values. The following example shows its use telling if the value currently stored in x is positive, negative or none of them (i.e. zero):
if (x > 0)
cout << "x is positive";
else if (x < 0)
cout << "x is negative";
else
cout << "x is 0";
Remember that in case that we want more than a single statement to be executed, we must group them in a block by enclosing them in braces { }.
Iteration structures (loops)
Loops have as purpose to repeat a statement a certain number of times or while a condition is fulfilled.
The while loop
Its format is:
while (expression) statement
and its functionality is simply to repeat statement while the condition set in expression is true.
For example, we are going to make a program to countdown using a while-loop:
// custom countdown using while
#include
using namespace std;
int main ()
{
int n;
cout << "Enter the starting number > ";
cin >> n;
while (n>0) {
cout << n << ", ";
--n;
}
cout << "FIRE!\n";
return 0;
}
Enter the starting number > 8
8, 7, 6, 5, 4, 3, 2, 1, FIRE!
When the program starts the user is prompted to insert a starting number for the countdown. Then the while loop begins, if the value entered by the user fulfills the condition n>0 (that n is greater than zero) the block that follows the condition will be executed and repeated while the condition (n>0) remains being true.
The whole process of the previous program can be interpreted according to the following script (beginning in main):
User assigns a value to n
The while condition is checked (n>0). At this point there are two posibilities:
* condition is true: statement is executed (to step 3)
* condition is false: ignore statement and continue after it (to step 5)
Execute statement:
cout << n << ", ";
--n;
(prints the value of n on the screen and decreases n by 1)
End of block. Return automatically to step 2
Continue the program right after the block: print FIRE! and end program.
When creating a while-loop, we must always consider that it has to end at some point, therefore we must provide within the block some method to force the condition to become false at some point, otherwise the loop will continue looping forever. In this case we have included --n; that decreases the value of the variable that is being evaluated in the condition (n) by one - this will eventually make the condition (n>0) to become false after a certain number of loop iterations: to be more specific, when n becomes 0, that is where our while-loop and our countdown end.
Of course this is such a simple action for our computer that the whole countdown is performed instantly without any practical delay between numbers.
The do-while loop
Its format is:
do statement while (condition);
Its functionality is exactly the same as the while loop, except that condition in the do-while loop is evaluated after the execution of statement instead of before, granting at least one execution of statement even if condition is never fulfilled. For example, the following example program echoes any number you enter until you enter 0.
// number echoer
#include
using namespace std;
int main ()
{
unsigned long n;
do {
cout << "Enter number (0 to end): ";
cin >> n;
cout << "You entered: " << n << "\n";
} while (n != 0);
return 0;
}
Enter number (0 to end): 12345
You entered: 12345
Enter number (0 to end): 160277
You entered: 160277
Enter number (0 to end): 0
You entered: 0
The do-while loop is usually used when the condition that has to determine the end of the loop is determined within the loop statement itself, like in the previous case, where the user input within the block is what is used to determine if the loop has to end. In fact if you never enter the value 0 in the previous example you can be prompted for more numbers forever.
The for loop
Its format is:
for (initialization; condition; increase) statement;
and its main function is to repeat statement while condition remains true, like the while loop. But in addition, the for loop provides specific locations to contain an initialization statement and an increase statement. So this loop is specially designed to perform a repetitive action with a counter which is initialized and increased on each iteration.
It works in the following way:
initialization is executed. Generally it is an initial value setting for a counter variable. This is executed only once.
condition is checked. If it is true the loop continues, otherwise the loop ends and statement is skipped (not executed).
statement is executed. As usual, it can be either a single statement or a block enclosed in braces { }.
finally, whatever is specified in the increase field is executed and the loop gets back to step 2.
Here is an example of countdown using a for loop:
// countdown using a for loop
#include
using namespace std;
int main ()
{
for (int n=10; n>0; n--) {
cout << n << ", ";
}
cout << "FIRE!\n";
return 0;
}
10, 9, 8, 7, 6, 5, 4, 3, 2, 1, FIRE!
The initialization and increase fields are optional. They can remain empty, but in all cases the semicolon signs between them must be written. For example we could write: for (;n<10;) if we wanted to specify no initialization and no increase; or for (;n<10;n++) if we wanted to include an increase field but no initialization (maybe because the variable was already initialized before).
Optionally, using the comma operator (,) we can specify more than one expression in any of the fields included in a for loop, like in initialization, for example. The comma operator (,) is an expression separator, it serves to separate more than one expression where only one is generally expected. For example, suppose that we wanted to initialize more than one variable in our loop:
for ( n=0, i=100 ; n!=i ; n++, i-- )
{
// whatever here...
}
This loop will execute for 50 times if neither n or i are modified within the loop:
n starts with a value of 0, and i with 100, the condition is n!=i (that n is not equal to i). Because n is increased by one and i decreased by one, the loop's condition will become false after the 50th loop, when both n and i will be equal to 50.
Jump statements.
The break statement
Using break we can leave a loop even if the condition for its end is not fulfilled. It can be used to end an infinite loop, or to force it to end before its natural end. For example, we are going to stop the count down before its natural end (maybe because of an engine check failure?):
// break loop example
#include
using namespace std;
int main ()
{
int n;
for (n=10; n>0; n--)
{
cout << n << ", ";
if (n==3)
{
cout << "countdown aborted!";
break;
}
}
return 0;
}
10, 9, 8, 7, 6, 5, 4, 3, countdown aborted!
The continue statement
The continue statement causes the program to skip the rest of the loop in the current iteration as if the end of the statement block had been reached, causing it to jump to the start of the following iteration. For example, we are going to skip the number 5 in our countdown:
// continue loop example
#include
using namespace std;
int main ()
{
for (int n=10; n>0; n--) {
if (n==5) continue;
cout << n << ", ";
}
cout << "FIRE!\n";
return 0;
}
10, 9, 8, 7, 6, 4, 3, 2, 1, FIRE!
The goto statement
goto allows to make an absolute jump to another point in the program. You should use this feature with caution since its execution causes an unconditional jump ignoring any type of nesting limitations.
The destination point is identified by a label, which is then used as an argument for the goto statement. A label is made of a valid identifier followed by a colon (:).
Generally speaking, this instruction has no concrete use in structured or object oriented programming aside from those that low-level programming fans may find for it. For example, here is our countdown loop using goto:
// goto loop example
#include
using namespace std;
int main ()
{
int n=10;
loop:
cout << n << ", ";
n--;
if (n>0) goto loop;
cout << "FIRE!\n";
return 0;
}
10, 9, 8, 7, 6, 5, 4, 3, 2, 1, FIRE!
The exit function
exit is a function defined in the cstdlib library.
The purpose of exit is to terminate the current program with a specific exit code. Its prototype is:
void exit (int exitcode);
The exitcode is used by some operating systems and may be used by calling programs. By convention, an exit code of 0 means that the program finished normally and any other value means that some error or unexpected results happened.
The selective structure: switch.
The syntax of the switch statement is a bit peculiar. Its objective is to check several possible constant values for an expression. Something similar to what we did at the beginning of this section with the concatenation of several if and else if instructions. Its form is the following:
switch (expression)
{
case constant1:
group of statements 1;
break;
case constant2:
group of statements 2;
break;
.
.
.
default:
default group of statements
}
It works in the following way: switch evaluates expression and checks if it is equivalent to constant1, if it is, it executes group of statements 1 until it finds the break statement. When it finds this break statement the program jumps to the end of the switch selective structure.
If expression was not equal to constant1 it will be checked against constant2. If it is equal to this, it will execute group of statements 2 until a break keyword is found, and then will jump to the end of the switch selective structure.
Finally, if the value of expression did not match any of the previously specified constants (you can include as many case labels as values you want to check), the program will execute the statements included after the default: label, if it exists (since it is optional).
Both of the following code fragments have the same behavior:
switch example if-else equivalent
switch (x) {
case 1:
cout << "x is 1";
break;
case 2:
cout << "x is 2";
break;
default:
cout << "value of x unknown";
}
if (x == 1) {
cout << "x is 1";
}
else if (x == 2) {
cout << "x is 2";
}
else {
cout << "value of x unknown";
}
The switch statement is a bit peculiar within the C++ language because it uses labels instead of blocks. This forces us to put break statements after the group of statements that we want to be executed for a specific condition. Otherwise the remainder statements -including those corresponding to other labels- will also be executed until the end of the switch selective block or a break statement is reached.
For example, if we did not include a break statement after the first group for case one, the program will not automatically jump to the end of the switch selective block and it would continue executing the rest of statements until it reaches either a break instruction or the end of the switch selective block. This makes unnecessary to include braces { } surrounding the statements for each of the cases, and it can also be useful to execute the same block of instructions for different possible values for the expression being evaluated. For example:
switch (x) {
case 1:
case 2:
case 3:
cout << "x is 1, 2 or 3";
break;
default:
cout << "x is not 1, 2 nor 3";
}
Notice that switch can only be used to compare an expression against constants. Therefore we cannot put variables as labels (for example case n: where n is a variable) or ranges (case (1..3):) because they are not valid C++ constants.
If you need to check ranges or values that are not constants, use a concatenation of if and else if statements.
Basic Input/Output for c++
Until now, the example programs of previous sections provided very little interaction with the user, if any at all. Using the standard input and output library, we will be able to interact with the user by printing messages on the screen and getting the user's input from the keyboard.
C++ uses a convenient abstraction called streams to perform input and output operations in sequential media such as the screen or the keyboard. A stream is an object where a program can either insert or extract characters to/from it. We do not really need to care about many specifications about the physical media associated with the stream - we only need to know it will accept or provide characters sequentialy.
The standard C++ library includes the header file iostream, where the standard input and output stream objects are declared.
Standard Output (cout)
By default, the standard output of a program is the screen, and the C++ stream object defined to access it is cout.
cout is used in conjunction with the insertion operator, which is written as << (two "less than" signs).
cout << "Output sentence"; // prints Output sentence on screen
cout << 120; // prints number 120 on screen
cout << x; // prints the content of x on screen
The << operator inserts the data that follows it into the stream preceding it. In the examples above it inserted the constant string Output sentence, the numerical constant 120 and variable x into the standard output stream cout. Notice that the sentence in the first instruction is enclosed between double quotes (") because it is a constant string of characters. Whenever we want to use constant strings of characters we must enclose them between double quotes (") so that they can be clearly distinguished from variable names. For example, these two sentences have very different results:
cout << "Hello"; // prints Hello
cout << Hello; // prints the content of Hello variable
The insertion operator (<<) may be used more than once in a single statement:
cout << "Hello, " << "I am " << "a C++ statement";
This last statement would print the message Hello, I am a C++ statement on the screen. The utility of repeating the insertion operator (<<) is demonstrated when we want to print out a combination of variables and constants or more than one variable:
cout << "Hello, I am " << age << " years old and my zipcode is " << zipcode;
If we assume the age variable to contain the value 24 and the zipcode variable to contain 90064 the output of the previous statement would be:
Hello, I am 24 years old and my zipcode is 90064
It is important to notice that cout does not add a line break after its output unless we explicitly indicate it, therefore, the following statements:
cout << "This is a sentence.";
cout << "This is another sentence.";
will be shown on the screen one following the other without any line break between them:
This is a sentence.This is another sentence.
even though we had written them in two different insertions into cout. In order to perform a line break on the output we must explicitly insert a new-line character into cout. In C++ a new-line character can be specified as \n (backslash, n):
cout << "First sentence.\n ";
cout << "Second sentence.\nThird sentence.";
This produces the following output:
First sentence.
Second sentence.
Third sentence.
Additionally, to add a new-line, you may also use the endl manipulator. For example:
cout << "First sentence." << endl;
cout << "Second sentence." << endl;
would print out:
First sentence.
Second sentence.
The endl manipulator produces a newline character, exactly as the insertion of '\n' does, but it also has an additional behavior when it is used with buffered streams: the buffer is flushed. Anyway, cout will be an unbuffered stream in most cases, so you can generally use both the \n escape character and the endl manipulator in order to specify a new line without any difference in its behavior.
Standard Input (cin).
The standard input device is usually the keyboard. Handling the standard input in C++ is done by applying the overloaded operator of extraction (>>) on the cin stream. The operator must be followed by the variable that will store the data that is going to be extracted from the stream. For example:
int age;
cin >> age;
The first statement declares a variable of type int called age, and the second one waits for an input from cin (the keyboard) in order to store it in this integer variable.
cin can only process the input from the keyboard once the RETURN key has been pressed. Therefore, even if you request a single character, the extraction from cin will not process the input until the user presses RETURN after the character has been introduced.
You must always consider the type of the variable that you are using as a container with cin extractions. If you request an integer you will get an integer, if you request a character you will get a character and if you request a string of characters you will get a string of characters.
// i/o example
#include
using namespace std;
int main ()
{
int i;
cout << "Please enter an integer value: ";
cin >> i;
cout << "The value you entered is " << i;
cout << " and its double is " << i*2 << ".\n";
return 0;
}
Please enter an integer value: 702
The value you entered is 702 and its double is 1404.
The user of a program may be one of the factors that generate errors even in the simplest programs that use cin (like the one we have just seen). Since if you request an integer value and the user introduces a name (which generally is a string of characters), the result may cause your program to misoperate since it is not what we were expecting from the user. So when you use the data input provided by cin extractions you will have to trust that the user of your program will be cooperative and that he/she will not introduce his/her name or something similar when an integer value is requested. A little ahead, when we see the stringstream class we will see a possible solution for the errors that can be caused by this type of user input.
You can also use cin to request more than one datum input from the user:
cin >> a >> b;
is equivalent to:
cin >> a;
cin >> b;
In both cases the user must give two data, one for variable a and another one for variable b that may be separated by any valid blank separator: a space, a tab character or a newline.
cin and strings
We can use cin to get strings with the extraction operator (>>) as we do with fundamental data type variables:
cin >> mystring;
However, as it has been said, cin extraction stops reading as soon as if finds any blank space character, so in this case we will be able to get just one word for each extraction. This behavior may or may not be what we want; for example if we want to get a sentence from the user, this extraction operation would not be useful.
In order to get entire lines, we can use the function getline, which is the more recommendable way to get user input with cin:
// cin with strings
#include
#include
using namespace std;
int main ()
{
string mystr;
cout << "What's your name? ";
getline (cin, mystr);
cout << "Hello " << mystr << ".\n";
cout << "What is your favorite team? ";
getline (cin, mystr);
cout << "I like " << mystr << " too!\n";
return 0;
}
What's your name? Juan Souli�
Hello Juan Souli�.
What is your favorite team? The Isotopes
I like The Isotopes too!
Notice how in both calls to getline we used the same string identifier (mystr). What the program does in the second call is simply to replace the previous content by the new one that is introduced.
stringstream
The standard header file defines a class called stringstream that allows a string-based object to be treated as a stream. This way we can perform extraction or insertion operations from/to strings, which is especially useful to convert strings to numerical values and vice versa. For example, if we want to extract an integer from a string we can write:
string mystr ("1204");
int myint;
stringstream(mystr) >> myint;
This declares a string object with a value of "1204", and an int object. Then we use stringstream's constructor to construct an object of this type from the string object. Because we can use stringstream objects as if they were streams, we can extract an integer from it as we would have done on cin by applying the extractor operator (>>) on it followed by a variable of type int.
After this piece of code, the variable myint will contain the numerical value 1204.
// stringstreams
#include
#include
#include
using namespace std;
int main ()
{
string mystr;
float price=0;
int quantity=0;
cout << "Enter price: ";
getline (cin,mystr);
stringstream(mystr) >> price;
cout << "Enter quantity: ";
getline (cin,mystr);
stringstream(mystr) >> quantity;
cout << "Total price: " << price*quantity << endl;
return 0;
}
Enter price: 22.25
Enter quantity: 7
Total price: 155.75
In this example, we acquire numeric values from the standard input indirectly. Instead of extracting numeric values directly from the standard input, we get lines from the standard input (cin) into a string object (mystr), and then we extract the integer values from this string into a variable of type int (quantity).
Using this method, instead of direct extractions of integer values, we have more control over what happens with the input of numeric values from the user, since we are separating the process of obtaining input from the user (we now simply ask for lines) with the interpretation of that input. Therefore, this method is usually preferred to get numerical values from the user in all programs that are intensive in user input.
C++ uses a convenient abstraction called streams to perform input and output operations in sequential media such as the screen or the keyboard. A stream is an object where a program can either insert or extract characters to/from it. We do not really need to care about many specifications about the physical media associated with the stream - we only need to know it will accept or provide characters sequentialy.
The standard C++ library includes the header file iostream, where the standard input and output stream objects are declared.
Standard Output (cout)
By default, the standard output of a program is the screen, and the C++ stream object defined to access it is cout.
cout is used in conjunction with the insertion operator, which is written as << (two "less than" signs).
cout << "Output sentence"; // prints Output sentence on screen
cout << 120; // prints number 120 on screen
cout << x; // prints the content of x on screen
The << operator inserts the data that follows it into the stream preceding it. In the examples above it inserted the constant string Output sentence, the numerical constant 120 and variable x into the standard output stream cout. Notice that the sentence in the first instruction is enclosed between double quotes (") because it is a constant string of characters. Whenever we want to use constant strings of characters we must enclose them between double quotes (") so that they can be clearly distinguished from variable names. For example, these two sentences have very different results:
cout << "Hello"; // prints Hello
cout << Hello; // prints the content of Hello variable
The insertion operator (<<) may be used more than once in a single statement:
cout << "Hello, " << "I am " << "a C++ statement";
This last statement would print the message Hello, I am a C++ statement on the screen. The utility of repeating the insertion operator (<<) is demonstrated when we want to print out a combination of variables and constants or more than one variable:
cout << "Hello, I am " << age << " years old and my zipcode is " << zipcode;
If we assume the age variable to contain the value 24 and the zipcode variable to contain 90064 the output of the previous statement would be:
Hello, I am 24 years old and my zipcode is 90064
It is important to notice that cout does not add a line break after its output unless we explicitly indicate it, therefore, the following statements:
cout << "This is a sentence.";
cout << "This is another sentence.";
will be shown on the screen one following the other without any line break between them:
This is a sentence.This is another sentence.
even though we had written them in two different insertions into cout. In order to perform a line break on the output we must explicitly insert a new-line character into cout. In C++ a new-line character can be specified as \n (backslash, n):
cout << "First sentence.\n ";
cout << "Second sentence.\nThird sentence.";
This produces the following output:
First sentence.
Second sentence.
Third sentence.
Additionally, to add a new-line, you may also use the endl manipulator. For example:
cout << "First sentence." << endl;
cout << "Second sentence." << endl;
would print out:
First sentence.
Second sentence.
The endl manipulator produces a newline character, exactly as the insertion of '\n' does, but it also has an additional behavior when it is used with buffered streams: the buffer is flushed. Anyway, cout will be an unbuffered stream in most cases, so you can generally use both the \n escape character and the endl manipulator in order to specify a new line without any difference in its behavior.
Standard Input (cin).
The standard input device is usually the keyboard. Handling the standard input in C++ is done by applying the overloaded operator of extraction (>>) on the cin stream. The operator must be followed by the variable that will store the data that is going to be extracted from the stream. For example:
int age;
cin >> age;
The first statement declares a variable of type int called age, and the second one waits for an input from cin (the keyboard) in order to store it in this integer variable.
cin can only process the input from the keyboard once the RETURN key has been pressed. Therefore, even if you request a single character, the extraction from cin will not process the input until the user presses RETURN after the character has been introduced.
You must always consider the type of the variable that you are using as a container with cin extractions. If you request an integer you will get an integer, if you request a character you will get a character and if you request a string of characters you will get a string of characters.
// i/o example
#include
using namespace std;
int main ()
{
int i;
cout << "Please enter an integer value: ";
cin >> i;
cout << "The value you entered is " << i;
cout << " and its double is " << i*2 << ".\n";
return 0;
}
Please enter an integer value: 702
The value you entered is 702 and its double is 1404.
The user of a program may be one of the factors that generate errors even in the simplest programs that use cin (like the one we have just seen). Since if you request an integer value and the user introduces a name (which generally is a string of characters), the result may cause your program to misoperate since it is not what we were expecting from the user. So when you use the data input provided by cin extractions you will have to trust that the user of your program will be cooperative and that he/she will not introduce his/her name or something similar when an integer value is requested. A little ahead, when we see the stringstream class we will see a possible solution for the errors that can be caused by this type of user input.
You can also use cin to request more than one datum input from the user:
cin >> a >> b;
is equivalent to:
cin >> a;
cin >> b;
In both cases the user must give two data, one for variable a and another one for variable b that may be separated by any valid blank separator: a space, a tab character or a newline.
cin and strings
We can use cin to get strings with the extraction operator (>>) as we do with fundamental data type variables:
cin >> mystring;
However, as it has been said, cin extraction stops reading as soon as if finds any blank space character, so in this case we will be able to get just one word for each extraction. This behavior may or may not be what we want; for example if we want to get a sentence from the user, this extraction operation would not be useful.
In order to get entire lines, we can use the function getline, which is the more recommendable way to get user input with cin:
// cin with strings
#include
#include
using namespace std;
int main ()
{
string mystr;
cout << "What's your name? ";
getline (cin, mystr);
cout << "Hello " << mystr << ".\n";
cout << "What is your favorite team? ";
getline (cin, mystr);
cout << "I like " << mystr << " too!\n";
return 0;
}
What's your name? Juan Souli�
Hello Juan Souli�.
What is your favorite team? The Isotopes
I like The Isotopes too!
Notice how in both calls to getline we used the same string identifier (mystr). What the program does in the second call is simply to replace the previous content by the new one that is introduced.
stringstream
The standard header file
string mystr ("1204");
int myint;
stringstream(mystr) >> myint;
This declares a string object with a value of "1204", and an int object. Then we use stringstream's constructor to construct an object of this type from the string object. Because we can use stringstream objects as if they were streams, we can extract an integer from it as we would have done on cin by applying the extractor operator (>>) on it followed by a variable of type int.
After this piece of code, the variable myint will contain the numerical value 1204.
// stringstreams
#include
#include
#include
using namespace std;
int main ()
{
string mystr;
float price=0;
int quantity=0;
cout << "Enter price: ";
getline (cin,mystr);
stringstream(mystr) >> price;
cout << "Enter quantity: ";
getline (cin,mystr);
stringstream(mystr) >> quantity;
cout << "Total price: " << price*quantity << endl;
return 0;
}
Enter price: 22.25
Enter quantity: 7
Total price: 155.75
In this example, we acquire numeric values from the standard input indirectly. Instead of extracting numeric values directly from the standard input, we get lines from the standard input (cin) into a string object (mystr), and then we extract the integer values from this string into a variable of type int (quantity).
Using this method, instead of direct extractions of integer values, we have more control over what happens with the input of numeric values from the user, since we are separating the process of obtaining input from the user (we now simply ask for lines) with the interpretation of that input. Therefore, this method is usually preferred to get numerical values from the user in all programs that are intensive in user input.
Subscribe to:
Posts (Atom)