<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:series="http://unfoldingneurons.com/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Indometric</title>
	
	<link>http://www.indometric.com</link>
	<description>News, Articles and E-Book</description>
	<pubDate>Mon, 29 Sep 2008 16:06:54 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/Indometric" type="application/rss+xml" /><feedburner:emailServiceId>1608422</feedburner:emailServiceId><feedburner:feedburnerHostname>http://www.feedburner.com</feedburner:feedburnerHostname><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2FIndometric" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FIndometric" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2FIndometric" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.rojo.com/add-subscription?resource=http%3A%2F%2Ffeeds.feedburner.com%2FIndometric" src="http://blog.rojo.com/RojoWideRed.gif">Subscribe with Rojo</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/Indometric" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FIndometric" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FIndometric" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FIndometric" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2FIndometric" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare href="http://mix.excite.eu/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FIndometric" src="http://image.excite.co.uk/mix/addtomix.gif">Subscribe with Excite MIX</feedburner:feedFlare><item>
		<title>C++ Design Patterns</title>
		<link>http://feeds.feedburner.com/~r/Indometric/~3/406379007/</link>
		<comments>http://www.indometric.com/c-design-patterns/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 16:03:30 +0000</pubDate>
		<dc:creator>Linda</dc:creator>
		
		<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://www.indometric.com/?p=91</guid>
		<description><![CDATA[Anyone who is not already familiar with design patterns may, after a brief survey of the field, come away with the impression that design patterns are a lot of marketing hype, are just some simple coding techniques, or are the playthings of computer scientists who really should get out more. While each of these impressions [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><p>Anyone who is not already familiar with design patterns may, after a brief survey of the field, come away with the impression that design patterns are a lot of marketing hype, are just some simple coding techniques, or are the playthings of computer scientists who really should get out more. While each of these impressions carries a grain of truth, design patterns are an essential component of the professional C++ programmer&#8217;s toolkit.</p>
<p>A &#8220;design pattern&#8221; is a recurring architectural theme that provides a solution to a common design problem within a particular context and describes the consequences of this solution. A design pattern is more than a simple description of a technique; it&#8217;s a named capsule of design wisdom gleaned from successful existing practice, written in such a way that it can be easily communicated and reused. Patterns are about programmer to programmer communication.</p>
<p>From a practical perspective, design patterns have two important properties. First, they describe proven, successful design techniques that can be customized in a context-dependent way to new design situations. Second, and perhaps more important, mentioning the application of a particular pattern serves to document not only the technique that is applied but also the reasons for its application and the effect of having applied it.</p>
<p><span id="more-91"></span>This sort of thing is nothing new. Consider an analogy from the field of algorithms. (Algorithms are not design patterns, and they&#8217;re not &#8220;code patterns.&#8221; They&#8217;re algorithms, and this is an analogy.) Consider the following statement that I might make to a colleague: &#8220;I have an unsorted sequence that I have to search a number of times. Therefore, I&#8217;m going to quick sort it and use binary search to perform each lookup.&#8221; The ability to use the terms &#8220;quick sort&#8221; and &#8220;binary search&#8221; is of inestimable value not only in design but also in communicating that design to an educated colleague. When I say &#8220;quick sort,&#8221; my colleague knows that the sequence I&#8217;m sorting is in a random access structure, that it will probably be sorted within O(nlg2n) time, and that the elements in the sequence may be compared with a less-than-like operator. When I say &#8220;binary search,&#8221; my colleague knows (even if I hadn&#8217;t earlier mentioned &#8220;quick sort&#8221;) that the sequence is sorted, that I will locate the item of interest within O(lg2n) comparisons, and that an appropriate operation is available to compare sequence elements. Shared knowledge of, and a standard vocabulary for, standard algorithms permits not only efficient documentation but also efficient criticism. For example, if I planned to perform this search and sort procedure on a singly linked list structure, my colleague would immediately smirk and point out that I couldn&#8217;t use quick sort and probably wouldn&#8217;t want to use binary search.</p>
<p>Until the advent of design patterns, we missed these advantages in documentation, communication, and efficient smirking with our object-oriented designs. We were forced into low-level descriptions of our designs, with all the inefficiency and imprecision that entails. It&#8217;s not that techniques for sophisticated object-oriented design didn&#8217;t exist; it&#8217;s that the techniques were not readily available to the entire programming community under a shared, common terminology. Design patterns address that problem, and we can now describe object-oriented designs as efficiently and unambiguously as algorithmic designs.</p>
<p>For example, when we see that the Bridge pattern has been applied to a design, we know that at a simple mechanical level an abstract data type implementation has been separated into an interface class and an implementation class. Additionally, we know that the reason this was done was to separate strongly the interface from the implementation so that changes to the implementation would not affect users of the interface. We also know a runtime cost exists for this separation, how the source code for the abstract data type should be arranged, and many other details. A pattern name is an efficient, unambiguous handle to a wealth of information and experience about a technique, and careful, accurate use of patterns and pattern terminology in design and documentation clarifies code and designs.</p>
<p>Patterns wonks sometimes describe design patterns as a form of literature (they really do) that follows a certain formal structure. Several common variants are in use, but all forms contain four essential parts.</p>
<ol>
<li>First, a design pattern must have an unambiguous name. For example, the term &#8220;wrapper&#8221; is useless for a design pattern, because it is already in common use and has dozens of meanings. Using a term like &#8220;Wrapper&#8221; as a pattern name would lead only to confusion and misunderstanding. Instead, the different design techniques that formerly went under the name &#8220;wrapper&#8221; are now designated by the pattern names &#8220;Bridge,&#8221; &#8220;Strategy,&#8221; &#8220;Façade,&#8221; &#8220;Object Adapter,&#8221; and probably several others. Use of a precise pattern name has a clear advantage over using a less precise term, in the same way that &#8220;binary search&#8221; is a more precise and useful term than &#8220;lookup.&#8221;</li>
<li>Second, the pattern description must define the problem addressed by the pattern. This description may be relatively broad or narrow.</li>
<li>Third, the pattern description describes the problem&#8217;s solution. Depending on the statement of the problem, the solution may be rather high level or relatively low level, but it should still be general enough to customize according to the various contexts in which the problem may occur.</li>
<li>Fourth, the pattern description describes the consequences of applying the pattern to the context. How has the context changed for better or worse after application of the pattern?</li>
</ol>
<p>Will knowledge of patterns make a bad designer a good designer? Time for another analogy: Consider one of those painful mathematics courses you may have been forced to undergo, in which the final examination is to prove a number of theorems in a certain area of mathematics. How do you get out of such a course alive? One obvious way is to be a genius. Starting from first principles, you develop the underpinnings of an entire branch of mathematics and eventually prove the theorems. A more practical approach would be to memorize and internalize a large number of theorems in that area of mathematics and use whatever native mathematical ability, inspiration, or good luck you have at your disposal to select the appropriate subsidiary theorems and combine them with some logical glue to prove the new theorems. This approach is advantageous even for our fictitious genius, because a proof built upon established theorems is more efficient to construct and easier to communicate to mere mortals. Familiarity with subsidiary theorems does not, of course, guarantee that a poor mathematician will be able to pass the test, but such knowledge will at least enable that person to understand the proof once it has been produced.</p>
<p>In a similar vein, developing a complex object-oriented design from first principles is probably going to be tedious, and communication of the eventual design difficult. Composition of design patterns to produce an object-oriented design is similar to use of subsidiary theorems in mathematics to prove a new theorem. Design patterns are often described as &#8220;micro-architectures&#8221; that can be composed with other patterns to produce a new architecture. Of course, selecting appropriate patterns and composing them effectively requires design expertise and native ability. However, even your manager will be able to understand the completed design if he or she has the requisite knowledge of patterns.</p>
</div><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Indometric?a=7q6mL"><img src="http://feeds.feedburner.com/~f/Indometric?i=7q6mL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=QVWDl"><img src="http://feeds.feedburner.com/~f/Indometric?i=QVWDl" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=agQRL"><img src="http://feeds.feedburner.com/~f/Indometric?i=agQRL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=oCOGL"><img src="http://feeds.feedburner.com/~f/Indometric?i=oCOGL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=tUn2l"><img src="http://feeds.feedburner.com/~f/Indometric?i=tUn2l" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=7nUFL"><img src="http://feeds.feedburner.com/~f/Indometric?i=7nUFL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=0hial"><img src="http://feeds.feedburner.com/~f/Indometric?i=0hial" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Indometric/~4/406379007" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.indometric.com/c-design-patterns/feed/</wfw:commentRss>
	
		<series:name><![CDATA[C++ Common Knowledge]]></series:name>
	<feedburner:origLink>http://www.indometric.com/c-design-patterns/</feedburner:origLink></item>
		<item>
		<title>C++ Data Abstraction &amp; Polymorphism</title>
		<link>http://feeds.feedburner.com/~r/Indometric/~3/406374418/</link>
		<comments>http://www.indometric.com/c-data-abstraction-polymorphism/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 16:00:04 +0000</pubDate>
		<dc:creator>Linda</dc:creator>
		
		<category><![CDATA[C++]]></category>

		<category><![CDATA[CERN]]></category>

		<guid isPermaLink="false">http://www.indometric.com/?p=88</guid>
		<description><![CDATA[Data Abstraction
A &#8220;type&#8221; is a set of operations, and an &#8220;abstract data type&#8221; is a set of operations with an implementation. When we identify objects in a problem domain, the first question we should ask about them is, &#8220;What can I do with this object?&#8221; not &#8220;How is this object implemented?&#8221; Therefore, if a natural [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><h3>Data Abstraction</h3>
<p>A &#8220;type&#8221; is a set of operations, and an &#8220;abstract data type&#8221; is a set of operations with an implementation. When we identify objects in a problem domain, the first question we should ask about them is, &#8220;What can I do with this object?&#8221; not &#8220;How is this object implemented?&#8221; Therefore, if a natural description of a problem involves employees, contracts, and payroll records, then the programming language used to solve the problem should contain Employee, Contract, and PayrollRecord types. This allows an efficient, two-way translation between the problem domain and the solution domain, and software written this way has less &#8220;translation noise&#8221; and is simpler and more correct.</p>
<p>In a general-purpose programming language like C++, we don&#8217;t have application-specific types like Employee. Instead, we have something better: the language facilities to create sophisticated abstract data types. The purpose of an abstract data type is, essentially, to extend the programming language into a particular problem domain.</p>
<p><span id="more-88"></span>No universally accepted procedure exists for designing abstract data types in C++. This aspect of programming still has its share of inspiration and artistry, but most successful approaches follow a set of similar steps.</p>
<ol>
<li>Choose a descriptive name for the type. If you have trouble choosing a name for the type, you don&#8217;t know enough about what you want to implement. Go think some more. An abstract data type should represent a single, well-defined concept, and the name for that concept should be obvious.</li>
<li>List the operations that the type can perform. An abstract data type is defined by what you can do with it. Remember initialization (constructors), cleanup (destructor), copying (copy operations), and conversions (nonexplicit single-argument constructors and conversion operators). Never, ever, simply provide a bunch of get/set operations on the data members of the implementation. That&#8217;s not data abstraction; that&#8217;s laziness and lack of imagination.</li>
<li> Design an interface for the type. The type should be, as Scott Meyers tells us, &#8220;easy to use correctly and hard to use incorrectly.&#8221; An abstract data type extends the language; do proper language design. Put yourself in the place of the user of your type, and write some code with your interface. Proper interface design is as much a question of psychology and empathy as technical prowess.</li>
<li> Implement the type. Don&#8217;t let the implementation affect the interface of the type. Implement the contract promised by the type&#8217;s interface. Remember that the implementations of most abstract data types will change much more frequently than their interfaces.</li>
</ol>
<h3>Polymorphism</h3>
<p>The topic of polymorphism is given mystical status in some programming texts and is ignored in others, but it&#8217;s a simple, useful concept that the C++ language supports. According to the standard, a &#8220;polymorphic type&#8221; is a class type that has a virtual function. From the design perspective, a &#8220;polymorphic object&#8221; is an object with more than one type, and a &#8220;polymorphic base class&#8221; is a base class that is designed for use by polymorphic objects.</p>
<p>Consider a type of financial option, <code>AmOption</code>, as shown in Figure 1.</p>
<p><strong>Figure 1. Polymorphic leveraging in a financial option hierarchy</strong>. An American option has four types.</p>
<p><img class="alignnone size-full wp-image-89" title="figure1" src="http://www.indometric.com/im-contents/upload/2008/09/figure1.gif" alt="" width="395" height="280" /></p>
<p>An AmOption object has four types: It is simultaneously an <code>AmOption</code>, an <code>Option</code>, a <code>Deal</code>, and a <code>Priceable</code>. Because a type is a set of operations, an <code>AmOption</code> object can be manipulated through any one of its four interfaces. This means that an <code>AmOption</code> object can be manipulated by code that is written to the <code>Deal</code>, <code>Priceable</code>, and <code>Option</code> interfaces, thereby allowing the implementation of <code>AmOption</code> to leverage and reuse all that code. For a polymorphic type such as <code>AmOption</code>, the most important things inherited from its base classes are their interfaces, not their implementations. In fact, it&#8217;s not uncommon, and is often desirable, for a base class to consist of nothing but interface.</p>
<p>Of course, there&#8217;s a catch. For this leveraging to work, a properly designed polymorphic class must be substitutable for each of its base classes. In other words, if generic code written to the <code>Option</code> interface gets an <code>AmOption</code> object, that object had better behave like an <code>Option</code>!</p>
<p>This is not to say that an AmOption should behave identically to an Option. (For one thing, it may be the case that many of the <code>Option</code> base class&#8217;s operations are pure virtual functions with no implementation.) Rather, it&#8217;s profitable to think of a polymorphic base class like <code>Option</code> as a contract. The base class makes certain promises to users of its interface; these include firm syntactic promises that certain member functions can be called with certain types of arguments and less easily verifiable semantic promises concerning what will actually occur when a particular member function is called. Concrete derived classes like <code>AmOption</code> and <code>EurOption</code> are subcontractors that implement the contract <code>Option</code> has established with its clients, as shown in Figure 2.</p>
<p><strong>Figure 2. A polymorphic contractor and its subcontractors</strong>. The <code>Option</code> base class specifies a contract.</p>
<p><img class="alignnone size-full wp-image-90" title="figure2" src="http://www.indometric.com/im-contents/upload/2008/09/figure2.gif" alt="" width="400" height="182" /></p>
<p>For example, if <code>Option</code> has a pure virtual price member function that gives the present value of the <code>Option</code>, both <code>AmOption</code> and <code>EurOption</code> must implement this function. It obviously won&#8217;t implement identical behavior for these two types of <code>Option</code>, but it should calculate and return a price, not make a telephone call or print a file.</p>
<p>On the other hand, if I were to call the price function of two different interfaces to the same object, I&#8217;d better get the same result. Essentially, either call should bind to the same function:</p>
<pre>AmOption *d = new AmOption;</pre>
<pre>Option *b = d;</pre>
<pre>d-&gt;price(); // if this calls AmOption::price...</pre>
<pre>b-&gt;price(); // ...so should this!</pre>
<p>This makes sense. (It&#8217;s surprising how much of advanced object-oriented programming is basic common sense surrounded by impenetrable syntax.) If I were to ask you, &#8220;What&#8217;s the present value of that American option?&#8221; I&#8217;d expect to receive the same answer if I&#8217;d phrased my question as, &#8220;What&#8217;s the present value of that option?&#8221;</p>
<p>The same reasoning applies, of course, to an object&#8217;s nonvirtual functions:</p>
<pre>b-&gt;update(); // if this calls Option::update...</pre>
<pre>d-&gt;update(); // ...so should this!</pre>
<p>The contract provided by the base class is what allows the &#8220;polymorphic&#8221; code written to the base class interface to work with specific options while promoting healthful ignorance of their existence. In other words, the polymorphic code may be manipulating <code>AmOption</code> and <code>EurOption</code> objects, but as far as it&#8217;s concerned they&#8217;re all just Options. Various concrete Option types can be added and removed without affecting the generic code that is aware only of the Option base class. If an <code>AsianOption</code> shows up at some point, the polymorphic code that knows only about Options will be able to manipulate it in blissful ignorance of its specific type, and if it should later disappear, it won&#8217;t be missed.</p>
<p>By the same token, concrete option types such as <code>AmOption</code> and <code>EurOption</code> need to be aware only of the base classes whose contracts they implement and are independent of changes to the generic code. In principle, the base class can be ignorant of everything but itself. From a practical perspective, the design of its interface will take into account the requirements of its anticipated users, and it should be designed in such a way that derived classes can easily deduce and implement its contract. However, a base class should have no specific knowledge of any of the classes derived from it, because such knowledge inevitably makes it difficult to add or remove derived classes in the hierarchy.</p>
<p>In object-oriented design, as in life, ignorance is bliss.</p>
</div><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Indometric?a=OOjWL"><img src="http://feeds.feedburner.com/~f/Indometric?i=OOjWL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=z4aOl"><img src="http://feeds.feedburner.com/~f/Indometric?i=z4aOl" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=AOBZL"><img src="http://feeds.feedburner.com/~f/Indometric?i=AOBZL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=QkrcL"><img src="http://feeds.feedburner.com/~f/Indometric?i=QkrcL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=bfnjl"><img src="http://feeds.feedburner.com/~f/Indometric?i=bfnjl" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=IFoJL"><img src="http://feeds.feedburner.com/~f/Indometric?i=IFoJL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=Lzfal"><img src="http://feeds.feedburner.com/~f/Indometric?i=Lzfal" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Indometric/~4/406374418" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.indometric.com/c-data-abstraction-polymorphism/feed/</wfw:commentRss>
	
		<series:name><![CDATA[C++ Common Knowledge]]></series:name>
	<feedburner:origLink>http://www.indometric.com/c-data-abstraction-polymorphism/</feedburner:origLink></item>
		<item>
		<title>Getting a Grip on Reality: Wide Open 802.11 Networks Around Us</title>
		<link>http://feeds.feedburner.com/~r/Indometric/~3/403112279/</link>
		<comments>http://www.indometric.com/getting-a-grip-on-reality-wide-open-80211-networks-around-us/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 20:11:29 +0000</pubDate>
		<dc:creator>John</dc:creator>
		
		<category><![CDATA[WiFi]]></category>

		<category><![CDATA[access points]]></category>

		<category><![CDATA[aironet]]></category>

		<category><![CDATA[antenna]]></category>

		<category><![CDATA[cisco]]></category>

		<category><![CDATA[double decker bus]]></category>

		<category><![CDATA[internet side]]></category>

		<category><![CDATA[laptop]]></category>

		<category><![CDATA[london sightseeing tour]]></category>

		<category><![CDATA[public ip addresses]]></category>

		<category><![CDATA[wardriving]]></category>

		<category><![CDATA[wireless network administrator]]></category>

		<category><![CDATA[wireless networks]]></category>

		<guid isPermaLink="false">http://www.indometric.com/?p=87</guid>
		<description><![CDATA[As mentioned, in the majority of cases an attacker does not have to do anything to get what he or she wants. The safe door is open and the goods are there to be taken. The Defcon 2002 wardriving contest showed that only 29.8 percent of 580 access points located by the contesters had WEP [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><p>As mentioned, in the majority of cases an attacker does not have to do anything to get what he or she wants. The safe door is open and the goods are there to be taken. The Defcon 2002 wardriving contest showed that only 29.8 percent of 580 access points located by the contesters had WEP enabled. As much as 19.3 percent had default <strong>ESSID values</strong>, and (not surprisingly) 18.6 percent of discovered access points did not use WEP and had default ESSIDs. If you think that something has changed since then, you are mistaken. If there were any changes, these were the changes for the worse, because the <strong>Defcon 2003</strong> wardrive demonstrated that only approximately 27 percent of networks in Las Vegas are protected by WEP. Because one of the teams employed a lateral approach and went to wardrive in Los Angeles instead, this number also includes some statistics for that city.</p>
<p>The Defcon wardrive observations were independently confirmed by one of the authors wardriving and walking around Las Vegas on his own.</p>
<p>Are things any better on the other side of the Atlantic? Not really. We speculated that only around 30 percent of access points in the United Kingdom would have WEP enabled. To validate this for research purpose, one of the authors embarked for a London Sightseeing Tour in the famous open-top red double-decker bus armed with a &#8220;debianized&#8221; laptop running Kismet, <strong>Cisco Aironet LMC350 card</strong>, and 12 dBi omnidirectional antenna. During the two-hour tour (exactly the time that laptop&#8217;s batteries lasted), 364 wireless networks were discovered, of which 118 had WEP enabled; 76 had default or company name and address ESSIDs. Even worse, some of the networks discovered had visible public IP addresses of wireless hosts that were pingable from the Internet side. If you are a wireless network administrator in central London and are reading this now, please take note. Of course, in the process of collecting this information, no traffic was logged to avoid any legal complications. The experiment was &#8220;pure&#8221; wardriving (or rather &#8220;warbusing&#8221;) at its best. Not surprisingly, warwalking in central London with a <strong>Sharp Zaurus SL-5500 PDA</strong>, <strong>D-Link DCF-650W CF 802.11b card</strong> (wonderful large antenna, never mind the blocked stylus slot), and Kismet demonstrated the same statistics. A similar level of <strong>802.11 WLAN</strong> insecurity was revealed in Bristol, Birmingham, Plymouth, Canterbury, Swansea, and Cardiff.</p>
<p><span id="more-87"></span>Crossing the English Channel does not help either. One of the authors has driven from Warsaw to London with another Zaurus/D-Link CF card/Kismet kit and found a similar ratio of <strong>WEP/noWEP 802.11 networks</strong>, including very powerful unencrypted point-to-point links crossing the countryside motorways in the middle of nowhere. Another author has evaluated 802.11 security in Riga, Latvia. Curiously, the wireless networks in Riga were so abundant that it was practically impossible to use the middle ISM band (2.4–2.45 GHz) and many networks moved to the UNII (5.15–5.35 and 5.725–5.825 GHz) or even licensed ~24 GHz bands. Many legacy Breeznet and 802.11 FHSS networks were present. The wireless boom in Riga can be explained by old, noisy, Soviet-period phone lines incapable of carrying xDSL traffic without a significant packet loss/retransmission rate. Yet, despite the popularity of <strong>802.11 networks</strong>, hardly anyone used WEP.</p>
<p>If you think that the majority of these unprotected wireless networks were home user access points, wireless community networks, or public access hot spots, you are wrong. Many of the wide open networks we have observed &#8220;in the wild&#8221; belong to government organizations (foreign governments included) and large corporations (multinationals included). In fact, some of these corporations are major information technology (IT) enterprises or IT-related consultancies, which is particularly shameful! We don&#8217;t even dare to think how many of the 802.11 networks located had implemented proper security measures beyond the standard (&#8221;crackable&#8221;) <strong>WEP</strong> and <strong>MAC address filtering</strong>. Single-digit percentage values surely come to mind. Considering that both WEP and MAC filtering are not difficult to circumvent with a bit of patience, it is not surprising that security remains the major concern restricting the spread and use of wireless technology around the world. At the same time, there are efficient wireless security solutions available, including powerful and affordable free and Open Source-based wireless safeguards that we describe in the second part of this book. Unfortunately, very few wireless network engineers and administrators are aware of the existence of these solutions. As always, human factor proves to be the weakest link.</p>
</div><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Indometric?a=jPz7L"><img src="http://feeds.feedburner.com/~f/Indometric?i=jPz7L" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=siGfl"><img src="http://feeds.feedburner.com/~f/Indometric?i=siGfl" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=2rmjL"><img src="http://feeds.feedburner.com/~f/Indometric?i=2rmjL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=eolUL"><img src="http://feeds.feedburner.com/~f/Indometric?i=eolUL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=ULmxl"><img src="http://feeds.feedburner.com/~f/Indometric?i=ULmxl" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=RCYSL"><img src="http://feeds.feedburner.com/~f/Indometric?i=RCYSL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=aEKSl"><img src="http://feeds.feedburner.com/~f/Indometric?i=aEKSl" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Indometric/~4/403112279" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.indometric.com/getting-a-grip-on-reality-wide-open-80211-networks-around-us/feed/</wfw:commentRss>
	
		<series:name><![CDATA[Wireless Security]]></series:name>
	<feedburner:origLink>http://www.indometric.com/getting-a-grip-on-reality-wide-open-80211-networks-around-us/</feedburner:origLink></item>
		<item>
		<title>Why Do We Concentrate on 802.11 Security?</title>
		<link>http://feeds.feedburner.com/~r/Indometric/~3/403108598/</link>
		<comments>http://www.indometric.com/why-do-we-concentrate-on-80211-security/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 20:08:12 +0000</pubDate>
		<dc:creator>John</dc:creator>
		
		<category><![CDATA[WiFi]]></category>

		<category><![CDATA[cable network]]></category>

		<category><![CDATA[client cards]]></category>

		<category><![CDATA[common security]]></category>

		<category><![CDATA[coverage zones]]></category>

		<category><![CDATA[national heritage]]></category>

		<category><![CDATA[network bandwidth]]></category>

		<category><![CDATA[network coverage]]></category>

		<category><![CDATA[packet switched networks]]></category>

		<category><![CDATA[physical premises]]></category>

		<category><![CDATA[proprietary hardware]]></category>

		<category><![CDATA[wireless deployment]]></category>

		<category><![CDATA[wireless networking]]></category>

		<category><![CDATA[wireless packet]]></category>

		<guid isPermaLink="false">http://www.indometric.com/?p=85</guid>
		<description><![CDATA[The widespread area of 802.11 network coverage zones is one of the major reasons for rising security concerns and interest: An attacker can be positioned where no one expects him or her to be and stay well away from the network&#8217;s physical premises. Another reason is the widespread use of 802.11 networks themselves: By 2006 [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><p>The widespread area of <strong>802.11 network</strong> coverage zones is one of the major reasons for rising security concerns and interest: An attacker can be positioned where no one expects him or her to be and stay well away from the network&#8217;s physical premises. Another reason is the widespread use of 802.11 networks themselves: By 2006 the number of shipped 802.11-enabled hardware devices is estimated to exceed 40 million units (<strong>Figure 1-2</strong>), even as the prices on these units keep falling. After 802.11g products hit the market, the price for many 802.11b client cards dropped to the cost level of 100BaseT Ethernet client cards. Of course there is a great speed disadvantage (5–7 Mbps on 802.11b vs. 100 Mbps on switched fast Ethernet), but not every network has high-speed requirements, and in many cases wireless deployment will be preferable. These cases include old houses in Europe protected as a part of the National Heritage. In such houses, drilling through obstacles to lay the cabling is prohibited by law. Another case is offices positioned on opposite sides of a busy street, highway, or office park. Finally, the last loop provider services via wireless are basically a replacement for the cable or xDSL link and 802.11b &#8220;pipe&#8221; is not likely to be a bottleneck in such cases, taking into account common xDSL or cable network bandwidth.</p>
<p><strong>Figure 1.2. The growth of the 802.11 wireless market.</strong></p>
<p><img class="alignnone size-full wp-image-86" title="figure-12" src="http://www.indometric.com/im-contents/upload/2008/09/figure-12.gif" alt="" width="350" height="307" /></p>
<p>802.11 networks are everywhere, easy to find, and, as you will see in this book, often do not require any effort to associate with. Even if they are protected by WEP (which still remains the most common security countermeasure on 802.11 LANs), the vulnerabilities of WEP are very well publicized and known to practically anyone with a minimal interest in wireless networking. On the contrary, other wireless packet-switched networks are far from being that common and widespread, do not have well-known and &#8220;advertised&#8221; vulnerabilities, and often require obscure and expensive proprietary hardware to explore. At the same time, 802.11 crackers commonly run their own wireless LANs (WLANs) and use their equipment for both cracking and home and community networking.</p>
<p><span id="more-85"></span>Attacks on <strong>GSM</strong> and <strong>GPRS</strong> phones are mainly related to unit &#8220;cloning,&#8221; which lies outside the realm of network hacking to which this book is devoted. On the personal area network (PAN) side, the hacking situation is far more interesting to dive into from a network security consultant&#8217;s viewpoint.</p>
<p>Attacks on infrared PANs are a form of opportunistic cracking based on being in the right place at the right time—a cracker would have to be close to the attacked device and be in a 30-degree zone from its infrared port. Because the infrared irradiation power is limited to 2 mW only, the signal is not expected to spread further than two meters. An exemption to the 30 degrees/2 mW limitations is the case when an infrared access point (e.g., Compex iRE201) is deployed in an office or conference hall. In such a situation, all that a cracker needs to sniff traffic and associate with the infrared PAN is to be in the same room with the access point. There is no layer 2 security in Infrared Data Association (IrDA) PANs and unless higher layers&#8217; encryption or authentication means are deployed, the infrared network is open for anyone to exploit. Windows 2000 and Windows XP clients automatically associate with other IrDA hosts and Linux IrDA project stack (<a title="irda.sourceforge.net" href="http://irda.sourceforge.net/" >http://irda.sourceforge.net/</a>) provides a remote IrDA host discovery option (do irattach -s) as well as irdadump, which is a utility similar to tcpdump. Irdaping has been used to freeze dead unpatched Windows 2000 machines before the Service Pack 3 release (see the Bugtraq post at <a title="securityfocus.com" href="http://www.securityfocus.com/archive/1/209385/2003-03-11/2003-03-17/2" >http://www.securityfocus.com/archive/1/209385/2003-03-11/2003-03-17/2</a>). If you want to dump layer 2 IrDA frames under Windows 2000, an infrared debugger interface in rCOMM2k (a port of Linux IrDA stack, <a title="stud.uni-hannover.de" href="http://www.stud.uni-hannover.de/~kiszka/IrCOMM2k/English/" >http://www.stud.uni-hannover.de/~kiszka/IrCOMM2k/English/</a>) will do a decent job. However, no matter how insecure the infrared networks are, their limited use and physically limited spread means that scanning for data over light will never be as popular as scanning for data over radio frequency (RF) waves.</p>
<p>As such, warnibbling or looking for <strong>Bluetooth networks</strong> will gain much higher popularity than looking for infrared connections and might one day compete with wardriving in popularity. The tools for Bluetooth network discovery such as Redfang from @Stake and a graphical user interface (GUI) for it (Bluesniff, Shmoo Group) are already available to grab and use and more tools will no doubt follow suit.</p>
<p>Three factors limit the spread of Bluetooth hacking. One is the still limited use of this technology, but that is very likely to change in a few years. Another factor is the limited (if compared to 802.11 LANs) coverage zone. However, Class 1 Bluetooth devices (output transmission power up to 100 mW) such as Bluetooth-enabled laptops and access points can cover a 100-meter radius or greater if high-gain antennas are used. Such networks are de facto WLANs and can be suitable targets for remote cracking. The third factor is the security mechanisms protecting Bluetooth PANs against both snooping and unauthorized connections. So far there are no known attacks circumventing the E0 streaming cipher used to encrypt data on Bluetooth PANs. However, only time will determine if this proprietary cipher will stand Kerckhoffs&#8217;s assumption and whether the famous story of the unauthorized Cypherpunks mail list disclosure of the RC4 algorithm structure will not repeat itself again (see next article 11 if you find this example confusing). There are already theoretical observations of possible Bluetooth security mechanism weaknesses (see <a title="tcs.hut.fi" href="http://www.tcs.hut.fi/~helger/crypto/link/practice/bluetooth.html" >http://www.tcs.hut.fi/~helger/crypto/link/practice/bluetooth.html</a>). Besides, even the best security countermeasure is useless unless it is implemented, and Bluetooth devices are usually set to the first (lowest) security mode out of the three Bluetooth security modes available and have the default of &#8220;0000&#8243; as the session security PIN. It is also common to use the year of birth or any other meaningful (and guessable) four-digit number as a Bluetooth PIN. This happens for convenience reasons, but the unintended consequence is that it makes the cracker&#8217;s job much easier. In our observations, about 50 percent of Bluetooth-enabled devices have the default PIN unchanged. There are also devices that have default PINs prewired without any possibility of changing them: all the attacker would have to do is find the list with the default PINs online. Although this provides a great opportunity for the potential attacker, we have yet to meet a real flesh-and-bone &#8220;warnibbler&#8221; who goes beyond sending prank messages via Bluetooth on the street. At the same time, security breaches of 802.11 networks occur on a daily, if not hourly, basis bringing us back to the main topic: Why and, most important, how they take place.</p>
</div><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Indometric?a=HydzL"><img src="http://feeds.feedburner.com/~f/Indometric?i=HydzL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=PH86l"><img src="http://feeds.feedburner.com/~f/Indometric?i=PH86l" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=3GLxL"><img src="http://feeds.feedburner.com/~f/Indometric?i=3GLxL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=hgbfL"><img src="http://feeds.feedburner.com/~f/Indometric?i=hgbfL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=H5Ral"><img src="http://feeds.feedburner.com/~f/Indometric?i=H5Ral" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=Q0SgL"><img src="http://feeds.feedburner.com/~f/Indometric?i=Q0SgL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=Fedrl"><img src="http://feeds.feedburner.com/~f/Indometric?i=Fedrl" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Indometric/~4/403108598" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.indometric.com/why-do-we-concentrate-on-80211-security/feed/</wfw:commentRss>
	
		<series:name><![CDATA[Wireless Security]]></series:name>
	<feedburner:origLink>http://www.indometric.com/why-do-we-concentrate-on-80211-security/</feedburner:origLink></item>
		<item>
		<title>Real World Wireless Security</title>
		<link>http://feeds.feedburner.com/~r/Indometric/~3/403099891/</link>
		<comments>http://www.indometric.com/real-world-wireless-security/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 19:58:41 +0000</pubDate>
		<dc:creator>John</dc:creator>
		
		<category><![CDATA[WiFi]]></category>

		<category><![CDATA[802 11b]]></category>

		<category><![CDATA[information security]]></category>

		<category><![CDATA[internet service providers]]></category>

		<category><![CDATA[isps]]></category>

		<category><![CDATA[lans and wans]]></category>

		<category><![CDATA[local area networks]]></category>

		<category><![CDATA[providers]]></category>

		<category><![CDATA[radio communications]]></category>

		<category><![CDATA[wan connections]]></category>

		<category><![CDATA[wide area network]]></category>

		<category><![CDATA[wireless internet service]]></category>

		<category><![CDATA[wireless networks]]></category>

		<guid isPermaLink="false">http://www.indometric.com/?p=83</guid>
		<description><![CDATA[Rather than concentrating on the basics of general information security or wireless networking, this introductory chapter focuses on something grossly overlooked by many &#8220;armchair experts&#8221;: The state of wireless security in the real world. Before getting down to it, though, there is a need to tell why we are so keen on the security of [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><p>Rather than concentrating on the basics of general information security or wireless networking, this introductory chapter focuses on something grossly overlooked by many &#8220;armchair experts&#8221;: The state of wireless security in the real world. Before getting down to it, though, there is a need to tell why we are so keen on the security of 802.11 standards-based wireless networks and not other packet-switched radio communications. <strong>Figure 1-1</strong> presents an overview of wireless networks in the modern world, with <strong>802.11 networks</strong> taking the medium circle.</p>
<p><strong>Figure 1.1. An overview of modern wireless networks.</strong></p>
<p><img class="aligncenter size-full wp-image-84" title="figure-11" src="http://www.indometric.com/im-contents/upload/2008/09/figure-11.gif" alt="" width="500" height="500" /></p>
<p>As shown, we tend to use the term <strong>802.11 wireless network</strong> rather than <strong>802.11 LAN</strong>. This particular technology dissolves the margin between local and wide area connectivity: 802.11b point-to-point links can reach beyond 50 miles in distance, efficiently becoming wireless wide area network (WAN) connections when used as a last mile data delivery solution by wireless Internet service providers (ISPs) or long-range links between offices. Thus, we consider specifying the use of 802.11 technology to be necessary: Local area networks (LANs) and WANs always had and will have different security requirements and approaches.</p>
</div><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Indometric?a=gAyWL"><img src="http://feeds.feedburner.com/~f/Indometric?i=gAyWL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=sDAhl"><img src="http://feeds.feedburner.com/~f/Indometric?i=sDAhl" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=94BtL"><img src="http://feeds.feedburner.com/~f/Indometric?i=94BtL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=HmaqL"><img src="http://feeds.feedburner.com/~f/Indometric?i=HmaqL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=YNCyl"><img src="http://feeds.feedburner.com/~f/Indometric?i=YNCyl" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=wxiYL"><img src="http://feeds.feedburner.com/~f/Indometric?i=wxiYL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=g7Cal"><img src="http://feeds.feedburner.com/~f/Indometric?i=g7Cal" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Indometric/~4/403099891" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.indometric.com/real-world-wireless-security/feed/</wfw:commentRss>
	
		<series:name><![CDATA[Wireless Security]]></series:name>
	<feedburner:origLink>http://www.indometric.com/real-world-wireless-security/</feedburner:origLink></item>
		<item>
		<title>Overview of the Payment Processing System</title>
		<link>http://feeds.feedburner.com/~r/Indometric/~3/324198199/</link>
		<comments>http://www.indometric.com/overview-of-the-payment-processing-system/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 17:20:29 +0000</pubDate>
		<dc:creator>Linda</dc:creator>
		
		<category><![CDATA[E-Commerce]]></category>

		<category><![CDATA[E-Commerce for Beginner]]></category>

		<category><![CDATA[E-Commerce Howto]]></category>

		<category><![CDATA[Learn E-Commerce]]></category>

		<category><![CDATA[Learn Payment Gateway]]></category>

		<category><![CDATA[Miva Merchant]]></category>

		<category><![CDATA[Online Shopping]]></category>

		<category><![CDATA[Payment Gateway]]></category>

		<category><![CDATA[Payment Gateway 101]]></category>

		<category><![CDATA[Payment Processing System]]></category>

		<category><![CDATA[Paypal]]></category>

		<category><![CDATA[Secure Payment]]></category>

		<category><![CDATA[Shopping Cart]]></category>

		<category><![CDATA[Shopping Cart Application]]></category>

		<category><![CDATA[What is E-Commerce]]></category>

		<category><![CDATA[What is Miva Merchant]]></category>

		<category><![CDATA[What is Payment Gateway]]></category>

		<guid isPermaLink="false">http://www.indometric.com/?p=79</guid>
		<description><![CDATA[Figure 3-8 shows a diagram of a typical e-business payment processing system. The three functional elements of the electronic storefront&#8217;s payment processing system are order confirmation, payment gateway interface, and transaction database interface, as illustrated in Figure 3-9.

Figure 3-8. Use of the Discover one-time credit card to pay for purchases


Figure 3-9. Payment System—technology perspective
Innovative Ways [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><p>Figure 3-8 shows a diagram of a typical e-business payment processing system. The three functional elements of the electronic storefront&#8217;s payment processing system are order confirmation, payment gateway interface, and transaction database interface, as illustrated in Figure 3-9.</p>
<p><img class="alignnone size-full wp-image-80" src="http://www.indometric.com/im-contents/upload/2008/07/3fig8.jpg" alt="" width="500" height="336" /></p>
<p><strong>Figure 3-8. Use of the Discover one-time credit card to pay for purchases</strong></p>
<p><span id="more-79"></span></p>
<p><img class="alignnone size-full wp-image-81" src="http://www.indometric.com/im-contents/upload/2008/07/3fig9.jpg" alt="" width="500" height="307" /></p>
<p><strong>Figure 3-9. Payment System—technology perspective</strong></p>
<h3>Innovative Ways to Combat Credit Card Fraud</h3>
<p>One of the most popular topics of e-business discussion is credit card fraud. Incidents of credit card fraud are reported in the news media almost every day. Many more incidents are swept under the rug and never reported. Today&#8217;s marketing jargon has established a myth that credit card security hinges entirely on SSL. In fact, SSL has very little to do with most cases of credit card fraud. However, an SSL session does prevent an eavesdropper from snooping on network traffic and recovering sensitive financial information being sent from the customer to the electronic storefront. To date, we haven&#8217;t heard of a single case of an attacker perpetuating a credit card fraud by cracking a &#8220;weak&#8221; 40-bit SSL encrypted session and stealing customer credentials from it. Rather, the number one cause of e-business credit card fraud is when an attacker breaks into an electronic storefront and steals the transaction database.</p>
<p>A few years ago, the Secure Electronic Transaction (SET) protocol was designed so that the merchant didn&#8217;t receive the actual credit card information. The system involved three parties to the transaction participating simultaneously—namely, the customer, the merchant, and the financial institution. When a customer decides to pay for a purchase, the SET system on the customer&#8217;s computer sends a message to the merchant providing the transaction details and a copy of the customer&#8217;s digital certificate. No credit card details are sent. The merchant then sends a request to the merchant&#8217;s financial institution, which in turn asks for authorization from the customer&#8217;s financial institution based on the certificate provided by the customer. Once everything has been approved, payment is completed. Thus the merchant never gets the actual credit card details, and theft of information from the merchant&#8217;s system can&#8217;t result in fraud. However, the SET protocol didn&#8217;t catch on. It was based on an idealized model, requiring heavy software and PKI support by all three participants.</p>
<p>An innovative way to achieve a similar result is used by some credit card companies. It calls for a &#8220;one-time-use credit card.&#8221; A &#8220;virtual&#8221; credit card is issued by the credit card company whenever a customer wants to make an online payment. The customer accesses the credit card company&#8217;s Web site and signs in. The customer then enters parameters such as the amount to be paid and validity of payment. In return, the credit card company generates a &#8220;virtual&#8221; credit card number, which is valid for one transaction only. This credit card number is internally linked to the customer&#8217;s actual credit card, and it is also stored by the credit card company during the period for which it is valid.</p>
<p>The customer then uses the virtual credit card number, instead of the actual credit card number. To the merchant, the virtual credit card is processed exactly the same as a normal credit card. The merchant&#8217;s financial institution sends a verification and settlement message to the customer&#8217;s credit card company. The credit card company determines whether the virtual credit card is valid and whether the amount of payment falls within the limits of the amount requested by the customer—and approved when the virtual credit card was issued. The rest of the payment process goes through normally.</p>
<p>Once used, the virtual credit card is automatically destroyed by the credit card company. The credit card number will never work again. In the event of a fraud where credit card information gets stolen from the merchant&#8217;s Web site, and an attacker reuses the virtual credit card, the fraud will be detected and, in addition to denial of the transaction, a fraud investigation can be initiated.</p>
<p>Discover Financial Services, the issuers of the Discover credit card, uses such a scheme, which it calls Single-Use Credit Card number. Discover also provides customers with software called Discover DeskShop, which can be integrated with browsers to facilitate quick issuing of single-use credit cards from Discover.com. More details on Discover&#8217;s single-use credit card approach can be found at <a title="www2.discovercard.com" href="http://www2.discovercard.com/shopcenter/deskshop/main.shtml" >http://www2.discovercard.com/shopcenter/deskshop/main.shtml</a>. Figure 3-8 summarizes the use of one-time credit cards.</p>
<p><strong>Order Confirmation Page</strong><br />
 After deciding to purchase the items that were placed in the shopping cart, the customer is guided to an order confirmation page, which captures information such as credit card number, customer name, shipment address, billing address, and mode of shipment.</p>
<p><strong>Payment Gateway Interface</strong><br />
 Every electronic storefront has an interface to a payment gateway operated by a financial institution. The interface is provided by the financial institution as a software component. For example, Verisign&#8217;s PayFlow Pro payment gateway provides a variety of PFPro components, including a Java object, a Microsoft COM DLL, and a Unix shared module.</p>
<p>The payment gateway interface component is invoked by the electronic storefront application. This component transmits the payment information to the payment gateway system over an encrypted channel such as SSL. This component also returns a response code to the electronic storefront application, indicating the status of the transaction. The response code indicates whether the transaction succeeded or failed and gives various other details about the transaction. Based on the response code, the electronic storefront application decides what to do with the order.</p>
<p><strong>Transaction Database Interface</strong><br />
 Once a transaction is passed to the payment gateway, the transaction details, along with the response code, are written into a back-end transaction database for future use. The transaction database interface must be carefully designed so it does not allow attackers to retrieve or tamper with the transaction data.</p>
<h3>Interfacing with a Payment Gateway—An Example</h3>
<p>A popular payment gateway service called PayFlow Pro is provided by VeriSign. PayFlow Pro&#8217;s client-side component resides in the electronic storefront application. The client component interfaces with PayFlow Pro&#8217;s servers owned by VeriSign. The PayFlow Pro client communicates with the PayFlow Pro servers, using HTTP requests sent via SSL. The HTTP request contains various parameters for processing the transaction.</p>
<p><img class="alignnone size-full wp-image-82" src="http://www.indometric.com/im-contents/upload/2008/07/3fig10.jpg" alt="" width="409" height="219" /></p>
<p><strong>Figure 3-10. Sample HTML page that interfaces with PayFlow Pro</strong></p>
<p>This example features a PayFlow Pro interface implemented with Java Servlets. On the client side, the PayFlow Pro Java object is wrapped into a Java Servlet. Figure 3-10 shows what the page looks like in the Web browser.</p>
<p>The following HTML code is from a sample HTML page that interfaces with the PayFlow Pro payment processing system and invokes the payment processing component:</p>
<pre>&lt;H1&gt;Payment Gateway Interface&lt;/H1&gt;</pre>
<pre>&lt;p&gt;</pre>
<pre>&lt;form name=pfpro_form method=GET</pre>
<pre> action="https://payment.example.com/servlet/PFServlet/"&gt;</pre>
<pre>&lt;table border=0&gt;</pre>
<pre>&lt;tr&gt;&lt;td&gt;Cart code&lt;/td&gt;&lt;td&gt;&lt;input type=text name=SHOPCART size=6&gt;&lt;/td&gt;&lt;/tr&gt;</pre>
<pre>&lt;tr&gt;&lt;td&gt;Credit Card number&lt;/td&gt;&lt;td&gt;&lt;input type=text name=CARDNUM size=16&gt;&lt;/td&gt;</pre>
<pre>&lt;/tr&gt;</pre>
<pre>&lt;tr&gt;&lt;td&gt;Expiration date&lt;br&gt;(month/year)&lt;/td&gt;</pre>
<pre> &lt;td&gt;&lt;input type=text name=EXPMONTH size=2&gt;</pre>
<pre> &lt;input type=text name=EXPYEAR size=2&gt;&lt;/td&gt;&lt;/tr&gt;</pre>
<pre>&lt;/table&gt;</pre>
<pre>&lt;p&gt;&lt;input type=submit value="Process payment"&gt;</pre>
<pre>&lt;/form&gt;</pre>
<p>The HTML page contains a form that invokes <code>https://payment.example.com/servlet/PFServlet/</code>. PFServlet invokes the PFPro Java object, which interfaces with the PayFlow Pro payment gateway. The HTML form accepts the following parameters:</p>
<table border="1" cellpadding="2">
<tbody>
<tr>
<td><strong>Parameter</strong></td>
<td><strong> Description</strong></td>
</tr>
<tr>
<td>SHOPCART</td>
<td>Shopping cart code</td>
</tr>
<tr>
<td>CARDNUM</td>
<td>Customer&#8217;s credit card number</td>
</tr>
<tr>
<td>EXPMONTH</td>
<td>Expiration month of credit card</td>
</tr>
<tr>
<td>EXPYEAR</td>
<td>Expiration year of credit card</td>
</tr>
</tbody>
</table>
<p>Each customer&#8217;s shopping cart has a unique code associated with it. The PFServlet uses that code to process all the items in the shopping cart. Ideally, the shopping cart code is passed automatically to the payment processing system by the shopping cart session management system. The following is the code for the Java PFServlet.</p>
<pre>import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.Signio.PFProAPI;</pre>
<pre>public class PFServlet extends HttpServlet {</pre>
<pre>public void doGet (HttpServletRequest req, HttpServletResponse res) throws</pre>
<pre>ServletException, IOException</pre>
<pre>{</pre>
<pre> PrintWrite            rout;</pre>
<pre> PFProAPI pfObject = new PFProAPI();</pre>
<pre> String ver = pfObject.PNVersion();</pre>
<pre> // get HTML form parameters</pre>
<pre> String EXPMONTH = req.getParameter("EXPMONTH");</pre>
<pre> String EXPYEAR = req.getParameter("EXPYEAR");</pre>
<pre> String CARDNUM = req.getParameter("CARDNUM");</pre>
<pre> String SHOPCART = req.getParameter("SHOPCART");</pre>
<pre> String EXPDATE = EXPMONTH + EXPYEAR;</pre>
<pre> // calculate total amount from the shopping cart contents</pre>
<pre> String AMOUNT = CalculateTotalAmount(SHOPCART);</pre>
<pre> // Receive PayFlow Pro username and password credentials from</pre>
<pre> // a stored repository</pre>
<pre> String username = PFCredentials.getUserName();</pre>
<pre> String password = PFCredentials.getPassword();</pre>
<pre> // Server hosting PayFlowPro payment gateway</pre>
<pre> String HostAddress   = "test.signio.com";</pre>
<pre> String HostPort      = "443";</pre>
<pre> // Construct the parameter string to be passed to PayFlow Pro</pre>
<pre> String ParmList      =</pre>
<pre> "TRXTYPE=S&amp;TENDER=C&amp;USER=" + username + "&amp;PWD=" + password +</pre>
<pre> "&amp;ACCT=" + CARDNUM + "&amp;EXPDATE=" + EXPDATE + "&amp;AMT=" + AMOUNT +</pre>
<pre> "&amp;COMMENT1[10]=TestPay&amp;INVNUM=1234567890&amp;STREET=120+WIGGINS+ST</pre>
<pre> &amp;ZIP=47907";</pre>
<pre> String Timeout       = "30";</pre>
<pre> // Send request to process payment and receive a response</pre>
<pre> int rc = pfObject.ProcessTransaction( HostAddress, HostPort,</pre>
<pre> "", "", "", "", ParmList, Timeout);</pre>
<pre> // Write the result</pre>
<pre> res.setContentType("text/html");</pre>
<pre> out = res.getWriter();</pre>
<pre> // Customer response and receipt generation code goes here.</pre>
<pre> // At the very end, the transaction is written out to the database.</pre>
<pre>}</pre>
<p>The <code>com.signio.PFProAPI</code> package provides the PayFlow Pro Java object API calls. This package is imported and placed within the PFServlet code. Next <code>pfObject</code> is instantiated from the PFProAPI class. The pfObject is used to communicate with the PayFlow Pro servers.</p>
<p>Then the form parameters, described previously, passed to the <code>PFServlet</code> are processed. Once the parameters are received, the function <code>CalculateTotalAmount()</code> is used to process the contents of the customer&#8217;s shopping cart and generate the total purchase amount to be passed for payment processing.</p>
<p>The next part of the code deals with setting up connection parameters for the payment gateway. First, the payment gateway credentials issued by PayFlow Pro to the merchant are retrieved from an internal repository. These credentials also can be hard-coded but doing so isn&#8217;t good programming practice. Next the server&#8217;s IP address and port numbers are set up. Finally, the string ParmList, containing a list of parameters to be passed as an HTTP request to the PayFlow Pro server, is created. These parameters indicate the transaction type (in this case a &#8220;Sale&#8221; indicated by an &#8220;S&#8221;) and the payment method (a &#8220;C&#8221; for &#8220;Credit Card&#8221;). In addition, they provide the PayFlow Pro user name and password, the credit card number and expiration date, the amount to be debited, some comments regarding the transaction, the customer&#8217;s invoice number, and the customer&#8217;s address. Full details of these parameters are found in the PayFlow Pro&#8217;s developer guide document available from VeriSign.</p>
<p>The request for payment processing is then issued by the <code>pfObject.ProcessTransaction()</code> method. The variable &#8220;rc&#8221; stores the response code received from the PayFlow Pro&#8217;s payment gateway server. Typically, all the processing—from the request to the response—occurs within a few seconds.</p>
<p>The rest of the servlet code generates the appropriate results based on the response code. If the payment is accepted, the servlet generates an order confirmation and a receipt and initiates the order fulfillment process. If the payment is denied, the servlet generates an appropriate response to the customer. In the end, the transaction is recorded in the transactions database.</p>
<h3>Payment System Implementation Issues</h3>
<p>Implementing a payment system and integrating it with a payment gateway raises certain issues that must be addressed.</p>
<p><strong>Integration</strong><br />
 Integrating the payment processing system of the electronic storefront with the payment gateway interface object requires that no sensitive parameters be derived from data passed from the client side. For example, the total price of the items selected should always be calculated by looking up the shopping cart contents and price lists from tables on the server side and never depending on any client-side data.</p>
<p><strong>Temporary Information</strong><br />
 If any temporary information needs to be stored on the server side, it should be stored outside the Web document root directory in a separate temporary file area. This way, attackers can&#8217;t retrieve intermediate or temporary files by requesting them over a Web browser. All temporary information stored should be destroyed as soon as it is no longer needed. Care should be also taken to ensure that temporary information stored from two concurrent sessions do not overwrite one another.</p>
<p><strong>SSL</strong><br />
 Although SSL doesn&#8217;t imply server-side security, it is essential that SSL be used between the customer and the electronic storefront Web site and between the storefront application and the payment gateway so that eavesdroppers can&#8217;t lay their hands on sensitive data traveling across the Internet.</p>
<p><strong>Storing User Profiles</strong><br />
 Many electronic retail storefronts allow users to create a profile and store it on the businesses&#8217; system. In many cases, the stored profile also contains payment information, including credit card information. In such cases, extreme care should be taken to ensure that stored user profiles not be compromised in any way.</p>
<p><strong>Vulnerabilities Caused by Poor Integration of Shopping Cart and Payment Gateway</strong><br />
 A vulnerability was reported on January 4, 2002, concerning the <strong>Miva Merchant shopping cart</strong> (versions 3.x) and <strong>VeriSign&#8217;s PayFlow</strong> link payment system. The vulnerability causes the shopping cart to accept invalid credit card transactions as valid. In essence, the bug isn&#8217;t in the payment processing system but in the way the shopping cart application is integrated with the payment gateway.</p>
<p>There are two ways to exploit the <strong>Miva Merchant shopping cart</strong>. The first method is to edit the HTML code by saving the HTML contents of the final checkout page so that, instead of the payment form invoking the PayFlow URL, it directly invokes the final payment acceptance URL within the shopping cart, thus entirely skipping the validation stage. The second way of exploiting the system is to sign up for a free test merchant account with VeriSign&#8217;s PayFlow system. The test merchant account will validate certain credit card numbers that have been designated as test numbers for developers who want to test their applications. Again, the way to exploit the shopping cart is to edit the HTML code on the checkout page, and instead of the HTML form invoking the PayFlow URL, the form invokes the test account validation URL. Then a fake &#8220;testing&#8221; credit card number can be used to validate the purchases. Full details of the exploitations are available at <a title="securitytracker.com" href="http://securitytracker.com/alerts/2002/Jan/1003102.html" >http://securitytracker.com/alerts/2002/Jan/1003102.html</a>.</p>
<h3>PayPal—Enabling Individuals to Accept Electronic Payments</h3>
<p>Payment processing systems such as <strong>PayPal</strong> (<a title="Paypal" href="http://www.paypal.com" >http://www.paypal.com</a>) have enabled individuals to accept electronic payments over the Web. This capability has led to a dramatic increase in individuals, including small-scale entrepreneurs, and small businesses doing business over the Internet.</p>
<p>PayPal&#8217;s transactions are performed via credit card. Every user is allowed to sign up for a PayPal account at no cost. The account binds users&#8217; identities with their credit cards. Users simply use their e-mail addresses to refer to their PayPal accounts. Assume that a user named Mallory wants to make a payment to a user named Jill who has a PayPal account. Jill&#8217;s PayPal account is simply referred to by her e-mail address, jill@example.com. If Mallory wants to make a payment to Jill, Mallory first has to sign up for a PayPal account. To do so he creates a PayPal account and assigns his credit card to the account. To make the payment, Mallory signs onto PayPal and initiates a payment to the jill@example.com account. PayPal uses Mallory&#8217;s credit card to credit Jill&#8217;s account with the specified amount. An e-mail is automatically sent to Jill stating that she has received money from Mallory.</p>
<p>PayPal offers three types of accounts: personal, premium, and business with different features and facilities customized for individual users, individual users with high volumes of payment receipts, and small businesses, respectively. Facilities such as receiving direct credit card payments, using an ATM or a debit card connected to the PayPal account, handling mass payments, and the like are provided by PayPal.</p>
<p>Some fifteen million individuals and small businesses currently use PayPal, enabling them to carry on business online. PayPal is the number one method of accepting payments on auction sites such as eBay. PayPal also encourages the &#8220;shareware&#8221; software market. Shareware is based on the concept of &#8220;try before buy.&#8221; Software developers distribute their software at no cost and give customers an option to purchase copies if they like it and want to continue using it. PayPal allows individual software developers to accept payments via credit cards from such customers who use their software. Interestingly, PayPal is also used extensively by the Internet pornography industry, which has now enabled individuals to accept payments for pornographic content.</p>
<h3>Summary</h3>
<p>Shopping carts and payment gateways are the heart of any e-commerce application that serves customers over the Internet. These parts of the application exchange confidential and essential information between customers and businesses over the Internet. Hence it needs serious attention with respect to security. Each component should be tightly coupled with other parts of the application. Any loophole in implementation can cause serious information leakage from the server. The several products available should be thoroughly tested with regard to security before purchase, not after installation.</p>
</div><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Indometric?a=795RWJ"><img src="http://feeds.feedburner.com/~f/Indometric?i=795RWJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=ufRcoj"><img src="http://feeds.feedburner.com/~f/Indometric?i=ufRcoj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=aC76KJ"><img src="http://feeds.feedburner.com/~f/Indometric?i=aC76KJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=LqNpsJ"><img src="http://feeds.feedburner.com/~f/Indometric?i=LqNpsJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=3ITtxj"><img src="http://feeds.feedburner.com/~f/Indometric?i=3ITtxj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=n7q5XJ"><img src="http://feeds.feedburner.com/~f/Indometric?i=n7q5XJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=u9Cs0j"><img src="http://feeds.feedburner.com/~f/Indometric?i=u9Cs0j" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Indometric/~4/324198199" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.indometric.com/overview-of-the-payment-processing-system/feed/</wfw:commentRss>
	
		<series:name><![CDATA[E-Commerce Playground]]></series:name>
	<feedburner:origLink>http://www.indometric.com/overview-of-the-payment-processing-system/</feedburner:origLink></item>
		<item>
		<title>Implementation of a Shopping Cart Application</title>
		<link>http://feeds.feedburner.com/~r/Indometric/~3/324185227/</link>
		<comments>http://www.indometric.com/implementation-of-a-shopping-cart-application/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 16:58:41 +0000</pubDate>
		<dc:creator>Linda</dc:creator>
		
		<category><![CDATA[E-Commerce]]></category>

		<category><![CDATA[E-Commerce for Beginner]]></category>

		<category><![CDATA[E-Commerce Howto]]></category>

		<category><![CDATA[Learn E-Commerce]]></category>

		<category><![CDATA[Learn Payment Gateway]]></category>

		<category><![CDATA[Online Shopping]]></category>

		<category><![CDATA[Payment Gateway]]></category>

		<category><![CDATA[Payment Gateway 101]]></category>

		<category><![CDATA[Payment Processing System]]></category>

		<category><![CDATA[Paypal]]></category>

		<category><![CDATA[Shopping Cart]]></category>

		<category><![CDATA[Shopping Cart Application]]></category>

		<category><![CDATA[What is E-Commerce]]></category>

		<category><![CDATA[What is Payment Gateway]]></category>

		<guid isPermaLink="false">http://www.indometric.com/?p=76</guid>
		<description><![CDATA[As shown in Figure 3-7, proper implementation of the shopping cart application requires integration of several different electronic business components. First, it is integrated with a session management component, which keeps track of a customer&#8217;s shopping session. Second, it is integrated with the product catalog application, which generates a display of products sold by the [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><p>As shown in Figure 3-7, proper implementation of the shopping cart application requires integration of several different electronic business components. First, it is integrated with a session management component, which keeps track of a customer&#8217;s shopping session. Second, it is integrated with the product catalog application, which generates a display of products sold by the storefront and allows the customer to browse the products; the customer can select a product from the catalog and place it in the shopping cart. Third, it is integrated with—acts as an input to—the payment gateway, which comes into play at the end of the shopping session. Fourth, it is integrated with back-end databases such as product inventory for automatically verifying and updating stock quantities, customer information for tracking customers&#8217; buying preferences, and so on.</p>
<p><img class="alignnone size-full wp-image-78" src="http://www.indometric.com/im-contents/upload/2008/07/3fig71.jpg" alt="" width="500" height="187" /></p>
<p><strong>Figure 3-7. Shopping cart implementation - technology perspective</strong></p>
<p>Since the early days of electronic retail shopping, many types of shopping carts have been introduced. Some shopping carts were made publicly available along with the source code, whereas some were sold as commercial third-party applications. Of the plethora of shopping carts, many failed because of improper implementation, which eventually led to security vulnerabilities.</p>
<h3><span id="more-76"></span>Product Catalog</h3>
<p>The product catalog typically consists of a product code, a product description, pricing, and other information. When a customer selects a product from the catalog, she places it in her shopping cart. Weak integration of the product catalog and the shopping cart leads to security vulnerabilities.</p>
<p>For example, if the customer can find a way to manipulate the price while selecting a product, a major error will occur. We look at such attacks in more detail in Chapter 10, where poorly implemented shopping carts allow customers to purchase products at reduced prices.</p>
<p>A well-implemented shopping cart application interfaces with the back-end product information database. Then parameters such as prices are derived from the database instead of relying on HTML form fields being passed back and forth. Quantity validation is an equally important issue. What happens if a customer enters a negative quantity into the shopping cart? What happens if the customer enters a fractional quantity?</p>
<h3>Session Management</h3>
<p>Another important aspect of shopping cart implementation is the session management mechanism. Each customer has to have a separate shopping cart while making purchases from the electronic store. Like regular storefronts, an electronic storefront probably caters to many customers at the same time. A poor session management mechanism may cause customers&#8217; shopping carts to get mixed up, which may lead to disastrous results, especially if one customer ends up paying for another customer&#8217;s purchases. To manage customer shopping activities, a well-designed server-side session management system is essential. A poorly designed session management system can lead to session hijacking or information leakage.</p>
<h3>Database Interfacing</h3>
<p>The database interface between the shopping cart application and back-end databases is a focus for attacks. If it isn&#8217;t implemented properly, an attacker can inject malicious SQL queries to the database and cause a security breach. An attacker may also modify intermediate tables that store other users&#8217; shopping sessions and selections.</p>
<h3>Integration with the Payment Gateway</h3>
<p>At the end of the shopping session, all selected items in the shopping cart and the corresponding bill are passed to the invoice generation and payment processing page of the electronic store application. Weak integration in this area can lead to the tampering of prices or entering of illegal quantities before the information is passed to the payment gateway.</p>
<h3>Examples of Poorly Implemented Shopping Carts</h3>
<p>We illustrate briefly what can go wrong if shopping carts are poorly implemented by presenting some examples in this section. More complete coverage of the vulnerabilities illustrated here are presented in later chapters and in Chapter 10, in particular.</p>
<p><strong>Carello Shopping Cart</strong><br />
 The Carello shopping cart (http://www.carelloweb.com) running on Windows NT has a flaw that allows remote command execution over HTTP. This shopping cart has a component called Carello.dll that interacts with the client. An attacker can inject commands by using malformed URLs that lead to remote command execution on the Web server.</p>
<p>For example, the following URL can execute the dir command on the server:</p>
<pre>http://target/scripts/Carello/Carello.dll?CARELLOCODE=SITE2&amp;VBEXE=C:\..\winnt\system32\cmd.exe%20/c%20dir</pre>
<p>A full description is available at <a title="securitytracker.com" href="http://securitytracker.com/alerts/2001/May/1001526.html" >http://securitytracker.com/alerts/2001/May/1001526.html</a>.</p>
<p><strong>DCShop Shopping Cart</strong><br />
 The DCShop shopping cart (http://www.dcscripts.com/dcforum/dcshop/44.html) stores temporary order information in clear text in a temporary file called orders.txt. This file is in DCShop&#8217;s Order subdirectory and can be retrieved directly via HTTP by any user. The orders.txt file contains all the data related to customers&#8217; recent orders, including names, shipping addresses, billing addresses, e-mail addresses, and credit card data. The attack can be performed simply by issuing the following URL:</p>
<pre>http://target/cgi-bin/DCShop/Orders/orders.txt</pre>
<p>A full description is available at <a title="securitytracker.com" href="http://securitytracker.com/alerts/2001/Jun/1001777.html" >http://securitytracker.com/alerts/2001/Jun/1001777.html</a>.</p>
<p><strong>Hassan Consulting&#8217;s Shopping Cart</strong><br />
 Hassan Consulting&#8217;s shopping cart (http://www.irata.com/products.html) allows arbitrary command execution on the server. The shopping cart runs on Unix and is written in Perl. The script, shop.pl, doesn&#8217;t filter out characters such as &#8220;;&#8221; and &#8220;|,&#8221; which allow remote users to inject commands on the server via the URL. URL exploitation occurs as follows:</p>
<pre>http://target/cgi-local/shop.pl/SID=947626980.19094/page=;ls|</pre>
<p>A full description is available at <a title="securitytracker.com" href="http://securitytracker.com/alerts/2001/Sep/1002379.html" >http://securitytracker.com/alerts/2001/Sep/1002379.html</a>.</p>
<p><strong>Cart32 and Several Other Shopping Carts</strong><br />
 Some shopping carts have hidden form fields within the html source code that contain product information such as price, weight, quantity, and identification. An attacker can save the Web page of a particular item to his computer and edit the html source, allowing him to alter the parameters of the product, including the price of the product.</p>
<p>A full description is available at <a title="online.securityfocus.com" href="http://online.securityfocus.com/bid/1237" >http://online.securityfocus.com/bid/1237</a>.</p>
<h3>Processing Payments</h3>
<p>So far, we&#8217;ve looked at how a customer goes about browsing the electronic storefront and selecting items for purchase. The product catalog application and the shopping cart application take care of this process. Let&#8217;s now focus on the checkout process and how customers pay for their purchases.</p>
<p><strong>Finalizing the Order</strong><br />
 Once a customer has finalized the selection of items she wishes to purchase, the payment processing system captures the order details from the customer&#8217;s shopping cart. The system also asks for extra information to complete the order, such as shipping address, mode of shipment, method of payment, and so on. At this point, the customer is given the option of revising the order if necessary.</p>
<p><strong>Method of Payment</strong><br />
 Customers have several options for making payment. Credit cards and debit cards are the most popular methods of payment in almost all retail shopping, be it physical or electronic. All electronic payment processing systems can handle payment by credit card and check.<br />
 <strong><br />
 Verification and Fraud Protection</strong><br />
 Payment processing systems communicate with the payment gateway to verify the authenticity of the customer&#8217;s method of payment for the purchases. In the case of credit cards, the payment gateway validates credit card numbers and expiration dates, verifies ownership, and determines whether the credit balance covers the amount of the purchase, and the like.</p>
<p>At the electronic storefront site, the payment processing system keeps a detailed log of all transactions so that they can be reconciled when payments are settled with the financial institution. Maintaining transaction logs is mandatory in most cases, and they should also be closely guarded. An attacker&#8217;s gaining access to the transaction log database would pose a huge security risk involving customers&#8217; identities and payment instruments, which could then be used in fraudulent schemes.</p>
<p><strong>Order Fulfillment and Receipt Generation</strong><br />
 Once the payment is processed successfully, the payment system application in the electronic storefront confirms the order acceptance and generates a receipt for the customer. Nowadays, such applications have the ability to e-mail receipts to customers and notify them of the initiation of shipment, with a tracking number for use with the delivery agency so that the customers can track their shipments themselves.</p>
</div><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Indometric?a=HmAvVJ"><img src="http://feeds.feedburner.com/~f/Indometric?i=HmAvVJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=JXeb9j"><img src="http://feeds.feedburner.com/~f/Indometric?i=JXeb9j" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=10u4jJ"><img src="http://feeds.feedburner.com/~f/Indometric?i=10u4jJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=ic10IJ"><img src="http://feeds.feedburner.com/~f/Indometric?i=ic10IJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=cvrW8j"><img src="http://feeds.feedburner.com/~f/Indometric?i=cvrW8j" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=qD6RJJ"><img src="http://feeds.feedburner.com/~f/Indometric?i=qD6RJJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=ThJDMj"><img src="http://feeds.feedburner.com/~f/Indometric?i=ThJDMj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Indometric/~4/324185227" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.indometric.com/implementation-of-a-shopping-cart-application/feed/</wfw:commentRss>
	
		<series:name><![CDATA[E-Commerce Playground]]></series:name>
	<feedburner:origLink>http://www.indometric.com/implementation-of-a-shopping-cart-application/</feedburner:origLink></item>
		<item>
		<title>Shopping Carts and Payment Gateways</title>
		<link>http://feeds.feedburner.com/~r/Indometric/~3/324176985/</link>
		<comments>http://www.indometric.com/shopping-carts-and-payment-gateways/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 16:47:37 +0000</pubDate>
		<dc:creator>Linda</dc:creator>
		
		<category><![CDATA[E-Commerce]]></category>

		<category><![CDATA[E-Commerce for Beginner]]></category>

		<category><![CDATA[E-Commerce Howto]]></category>

		<category><![CDATA[Learn E-Commerce]]></category>

		<category><![CDATA[Online Shopping]]></category>

		<category><![CDATA[Payment Gateway]]></category>

		<category><![CDATA[Payment Gateway 101]]></category>

		<category><![CDATA[Paypal]]></category>

		<category><![CDATA[Shopping Cart]]></category>

		<category><![CDATA[Shopping Cart Application]]></category>

		<category><![CDATA[What is E-Commerce]]></category>

		<category><![CDATA[What is Payment Gateway]]></category>

		<guid isPermaLink="false">http://www.indometric.com/?p=69</guid>
		<description><![CDATA[Introduction
Retail shopping has evolved dramatically over the years. In the earlier days of shopping, a shopkeeper would sit behind a counter and respond to requests from a customer, selecting a product from the shelf and handing it to the customer for her consideration. The customer would then indicate whether she was interested in buying it. [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><h3>Introduction</h3>
<p>Retail shopping has evolved dramatically over the years. In the earlier days of shopping, a shopkeeper would sit behind a counter and respond to requests from a customer, selecting a product from the shelf and handing it to the customer for her consideration. The customer would then indicate whether she was interested in buying it. If so, the product would be set aside, the shopkeeper would respond to the customer&#8217;s next request, and after the customer was satisfied with all the items set aside, the shopkeeper would prepare the final bill and accept payment. If the customer didn&#8217;t like a product, the shopkeeper would naturally reshelve it.</p>
<p><span id="more-69"></span>Today, most stores allow customers to do their own shopping. A customer may ask for assistance from one of the attendants, but on the whole, products are displayed in ways that make shopping easy. Thus stores can cater to many customers, each going about his shopping individually. The entire shopping experience has been made easy for the customer. Factors such as product layout, arrangement of displays, location and width of aisles, location of check out counters, and the availability of human assistance all play a key role in the overall shopping experience.</p>
<p>Another innovation in the shopping experience was the advent of &#8220;catalog shopping.&#8221; Here the entire storefront was replaced with a printed catalog of products and a precise method of placing orders via phone or mail. This new approach allowed businesses to operate in an entire region or an entire nation without maintaining retail stores. Catalog shopping offered competitive prices, as there was no overhead for maintaining retail stores, inventory, staff, and stocking logistics; few central warehouses and a well-established delivery system were used to fill orders. From the customer&#8217;s viewpoint, the entire shopping experience was now available from home.</p>
<p>Electronic shopping is an attempt to combine the shopping experience of both in-store shopping and catalog shopping. Web-based applications offer more interactivity than a printed catalog. They also have the ability to provide more media forms, such as audio, video clips, and animation, in addition to static text and pictures—all in an effort to enhance the shopping experience and, in the end, sell more merchandise. In fact, the success of the online shopping experience depends almost entirely on ease of shopping coupled with factors such as richer media.</p>
<p>Customers have their own shopping styles and sets of needs when they go shopping. A storefront and its contents look different and more or less appealing when viewed through the eyes of different customers. Thus the greatest challenge facing electronic storefronts is to cater to diverse customer needs and desires over a Web-based interface. The set of customer choices also varies. For example, one customer may like to pile up all potential purchases while shopping but delay the final decision of which item(s) to purchase until the very end. Another customer may like to make a single selection at a time. Customers have different payment habits too. Although the majority use credit cards to pay for retail purchases, customers still like to pay cash or by check in some cases. Even with credit cards, customers may prefer one credit card company to another. Shopping systems have to anticipate and take care of all these needs and preferences.</p>
<p>As Web shopping applications have matured, some technologies and components became standard for every electronic storefront implementation. In this chapter we focus on the two most important aspects of an electronic storefront—shopping carts and payment gateways. The purpose of this chapter is to familiarize you with a few key concepts and issues related to security.</p>
<h3>Evolution of the Storefront</h3>
<p>By taking a look at how retail businesses evolved over time, you can understand better the roles of various components of an electronic shopping framework. Let&#8217;s begin with the traditional model of retail shopping. Figure 3-1 shows various entities and interrelationships of traditional retail shopping.</p>
<p><img class="alignnone size-full wp-image-70" src="http://www.indometric.com/im-contents/upload/2008/07/3fig1.jpg" alt="" width="500" height="301" /></p>
<p><strong>Figure 3-1. Traditional retail business</strong></p>
<p>In a traditional retail business, customers interact with the merchant via a storefront. The purpose of the storefront is to display and generally to stock enough merchandise for customers to purchase on a day-to-day basis. The storefront has ways to accept payments from customers for their purchases and if some orders can&#8217;t be filled directly on the store&#8217;s premises, the merchant is responsible for taking the order and payment information. The order is then passed along to the company owning the store for further processing.</p>
<p>The entire purchase and delivery process works something like this. First, the company validates the order in terms of accuracy of information and availability of requested merchandise. When it finds everything in order, the company processes the payment instructions with the help of its financial institution. Upon proper processing of the payment, the company interacts with its suppliers and its clearinghouse (distribution center or warehouse) to initiate shipment of the purchased goods against the order.</p>
<p>In addition to selling goods, a retail business has many other peripheral functions and activities. For example, it is also responsible for marketing the company&#8217;s merchandise, which is what draws customers to its storefront in the first place.</p>
<p>As the scale of operations, volumes, and need for efficiency increased, retail businesses began using software applications that captured the business logic of transactions and inventory control and carried out various business processes automatically. As they continued to prosper, businesses used more and more automation in their processes. Figure 3-2 shows how businesses increased their use of automation via computerization.</p>
<p><img class="alignnone size-full wp-image-71" src="http://www.indometric.com/im-contents/upload/2008/07/3fig2.jpg" alt="" width="500" height="273" /></p>
<p><strong>Figure 3-2. Automation via computerization</strong></p>
<p>Computer systems capture and process transactions efficiently at the storefront. At the end of the day, all orders are transferred electronically to the company&#8217;s corporate computer systems. These systems are updated with data from suppliers and the clearinghouse, which help track inventory. The company&#8217;s systems, in turn, typically communicate with the bank&#8217;s computers to process payments in bulk. Once the payments are processed, the orders are sent to suppliers and the clearinghouse to be filled. However, the evolution doesn&#8217;t end here. As more users were connected to the Internet—and as Web application servers matured—electronic retail business (e-business or e-commerce) came into being. Instead of businesses making use of automation, businesses themselves became automated. Application servers were now capable of hosting entire business processes on the Internet and interfacing with business processes of other entities, such as financial institutions and suppliers. The Internet also provided the means for providing ancillary services such as marketing. The physical storefront began to be replaced by an electronic storefront. People began hosting storefronts on the Internet and selling directly to customers, who interacted with the electronic storefront through a Web browser.</p>
<p>It is now possible to capture orders, process payments, update inventories, and initiate order fulfillment in a matter of minutes. The entire system requires little human intervention. Figure 3-3 depicts the e-commerce model.</p>
<p><img class="alignnone size-full wp-image-72" src="http://www.indometric.com/im-contents/upload/2008/07/3fig3.jpg" alt="" width="500" height="289" /></p>
<p><strong>Figure 3-3. E-commerce model</strong></p>
<h3>Electronic Shopping</h3>
<p>With the electronic retail business model in mind, let&#8217;s now follow the process of electronic shopping in an electronic storefront. Companies host their storefronts as Web applications on Web servers. The Web site becomes the store&#8217;s electronic identity. Customers &#8220;step into&#8221; stores by browsing the store&#8217;s Web site. The electronic storefront provides customers with a virtual shopping experience, as they browse the merchandise and decide what they want to buy. The electronic storefront also interfaces with a payment processing system or a payment gateway provided by the company&#8217;s financial institution for accepting payments on the merchant&#8217;s behalf. The electronic storefront also interfaces with the company&#8217;s corporate systems and the suppliers&#8217; and clearinghouse&#8217;s systems for order processing and fulfillment.</p>
<p>When the customer visits the electronic storefront, or Web site, he browses the different products that the store sells. The customer then reads the description of the products, looks at product prices, and decides whether to buy one or more product. Once a customer has arrived at a decision to buy a particular product, he needs to set the product aside until the shopping &#8220;trip&#8221; completed. In a regular storefront, the customer uses a shopping cart to hold his selections until he is ready to check out. Today&#8217;s electronic shopping cart is analogous to the metal or plastic shopping cart familiar to every shopper. An electronic shopping cart holds the customer&#8217;s selections and when all the selections are made, the shopping cart helps the customer check out and pay for his purchases. Electronic storefronts handle customer payments via payment gateways provided by the storefront&#8217;s financial institution where it has its bank accounts. This application provides some sort of customization to serve customers&#8217; varying needs. The payment gateway verifies the validity of the payment instrument used by the customer and takes the necessary actions to process the payment instrument and credit the merchant&#8217;s account with the appropriate funds. Figure 3-4 depicts a customer&#8217;s interaction with an electronic retail business.</p>
<p><img class="alignnone size-full wp-image-73" src="http://www.indometric.com/im-contents/upload/2008/07/3fig4.jpg" alt="" width="500" height="512" /></p>
<p><strong>Figure 3-4. Use of electronic shopping cart and payment gateway</strong></p>
<h3>Shopping Cart Systems</h3>
<p>Shopping carts in storefronts are provided for the customer&#8217;s convenience. A customer picks up a shopping cart from the row of carts in the parking lot or at the storefront entrance. The customer pushes the cart around the store&#8217;s floor during the shopping session, filling it as she goes, until she is ready to check out. The customer then (sometimes) returns the cart to the store when she has finished transferring her purchases to her vehicle. Similarly, when a customer visits an electronic retail storefront, the shopping cart&#8217;s purpose is to make shopping easy for the customer. To understand the technologies that govern an electronic shopping cart, you need to understand how the technology works.</p>
<p><strong>Scope and Lifetime of an Electronic Shopping Cart</strong><br />
 When a customer first enters an electronic retail storefront, the shopping cart application provides him with a virtual shopping cart. It remains with the customer until he places an order and exits the storefront&#8217;s Web site. Once the order is placed, the virtual shopping cart&#8217;s contents are cleared and the resources used by the virtual shopping cart are freed. In essence, without further need, the virtual shopping cart is destroyed by the shopping cart application.</p>
<p><strong>Collecting, Analyzing, and Comparing Selected Components</strong><br />
 As with a conventional shopping cart, another important aspect of an electronic shopping cart is that the customer can select items after analyzing them thoroughly—including comparing different brands—and place them in the cart. The ability to hold items and carry them along electronically saves shopping time. Otherwise, the customer would have to pay for each item immediately upon selection and then continue with his shopping. Also, at any time during the shopping process, the customer can view the selected items and compare them with other items.</p>
<p><strong>Keeping Track of the Total Cost</strong><br />
 One advantage that an electronic shopping cart has over a conventional shopping cart is that is displays the running total of the items as they&#8217;re added to the shopping cart. In this way, the customer can keep track of the cost of his selections and compare it to his budget.</p>
<p><strong>Change of Mind</strong><br />
 A customer often changes her mind after deciding to buy an item. If the customer notices a better or cheaper item than the one being carried, she can replace the previous selection with the new one. If she overshoots her budget, she may decide not to buy some items or reduce the quantities of the items selected. Electronic shopping carts allow the customer to change the quantities and remove items previously selected.</p>
<p><strong>Processing the Purchase</strong><br />
 The electronic shopping cart also helps the merchant do the final billing at the checkout counter. By carrying the total cost of the selected items, the shopping cart saves the checkout system the trouble of adding up the costs. The system simply applies any taxes and surcharges and generates the final bill. Payment is accepted against this final bill.</p>
<p><img class="alignnone size-full wp-image-74" src="http://www.indometric.com/im-contents/upload/2008/07/3fig5.jpg" alt="" width="500" height="340" /></p>
<p><strong>Figure 3-5. Shopping cart integrated with product catalog</strong></p>
<p>Hence the shopping cart application forms the heart of the electronic storefront. The shopping cart application binds the customer, the catalog, the inventory system, and the payment system closely. Certain electronic shopping cart systems provide the customer with product recommendations and price comparisons with equivalent products on the fly. Most shopping cart systems are implemented with server-side code. When maintaining shopping cart instances on the server side, some applications allow the user to resume shopping where she left off, if for some reason the shopping session is terminated abruptly. Incidentally, if shopping cart applications aren&#8217;t implemented with server-side code, they become candidates for electronic shoplifting!</p>
<p><img class="alignnone size-full wp-image-75" src="http://www.indometric.com/im-contents/upload/2008/07/3fig6.jpg" alt="" width="500" height="306" /></p>
<p><strong>Figure 3-6. Shopping cart contents</strong></p>
<p>Figures 3-5 and 3-6 show how the shopping cart is integrated with the product catalog and how a customer can keep track of selections during the shopping session.</p>
</div><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Indometric?a=YP60bJ"><img src="http://feeds.feedburner.com/~f/Indometric?i=YP60bJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=NsZmAj"><img src="http://feeds.feedburner.com/~f/Indometric?i=NsZmAj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=l5Xl7J"><img src="http://feeds.feedburner.com/~f/Indometric?i=l5Xl7J" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=EzQt0J"><img src="http://feeds.feedburner.com/~f/Indometric?i=EzQt0J" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=HTnpHj"><img src="http://feeds.feedburner.com/~f/Indometric?i=HTnpHj" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=0FqM4J"><img src="http://feeds.feedburner.com/~f/Indometric?i=0FqM4J" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Indometric?a=HyTzXj"><img src="http://feeds.feedburner.com/~f/Indometric?i=HyTzXj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Indometric/~4/324176985" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.indometric.com/shopping-carts-and-payment-gateways/feed/</wfw:commentRss>
	
		<series:name><![CDATA[E-Commerce Playground]]></series:name>
	<feedburner:origLink>http://www.indometric.com/shopping-carts-and-payment-gateways/</feedburner:origLink></item>
		<item>
		<title>HTML Basics</title>
		<link>http://feeds.feedburner.com/~r/Indometric/~3/321468027/</link>
		<comments>http://www.indometric.com/html-basics/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 17:23:56 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
		
		<category><![CDATA[Misc Applications]]></category>

		<category><![CDATA[Cascading Style Sheets]]></category>

		<category><![CDATA[CERN]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[CSS for Beginner]]></category>

		<category><![CDATA[CSS2]]></category>

		<category><![CDATA[Development of CSS]]></category>

		<category><![CDATA[HTML Articles]]></category>

		<category><![CDATA[HTML Basic]]></category>

		<category><![CDATA[HTML for Beginner]]></category>

		<category><![CDATA[HTML Short Course]]></category>

		<category><![CDATA[HTML Tag]]></category>

		<category><![CDATA[Learning CSS]]></category>

		<category><![CDATA[Learning HTML]]></category>

		<category><![CDATA[Robert Cailliau]]></category>

		<category><![CDATA[Tim Berners-Lee]]></category>

		<category><![CDATA[Web Design]]></category>

		<category><![CDATA[Web Designer]]></category>

		<guid isPermaLink="false">http://www.indometric.com/?p=48</guid>
		<description><![CDATA[
CSS was designed to work with HTML. To take advantage of CSS, you need to know some HTML. As stated in the Preface, we assume most readers have had some exposure to HTML. However, to ensure we all talk about the same thing, we now review the basics of HTML.
Elements
HTML is simple to write. It [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><p><img class="alignnone size-full wp-image-45" src="http://www.indometric.com/im-contents/upload/2008/06/css_designing_for_the_web1.gif" alt="" width="100" height="100" /></p>
<p><strong>CSS</strong> was designed to work with HTML. To take advantage of CSS, you need to know some HTML. As stated in the Preface, we assume most readers have had some exposure to HTML. However, to ensure we all talk about the same thing, we now review the basics of HTML.</p>
<h3><span id="more-48"></span>Elements</h3>
<p>HTML is simple to write. It is essentially a series of elements that define the structure of your document. An element normally has three parts:</p>
<ul>
<li>Start tag</li>
<li>Content</li>
<li>End tag</li>
</ul>
<p><img class="alignnone size-full wp-image-49" src="http://www.indometric.com/im-contents/upload/2008/06/04fig02.png" alt="" width="500" height="54" /></p>
<p><strong>Figure 1.2 illustrates the three parts of an element.</strong></p>
<p>All tags in HTML start with a &#8220;<code>&lt;</code>&#8221; and end with a &#8220;<code>&gt;.</code>&#8221; Between these comes the name of the element. In Figure 1.2, the name of the element is SENTENCE. The content of the element is a string of characters (but we will soon see that the content of an element can be another element). After that comes the end tag. End tags look like the start tag, except they have a &#8220;<code>/</code>&#8221; (slash) before the element name.</p>
<h3>Building a Simple HTML Document</h3>
<p>HTML has approximately 30 commonly used elements. SENTENCE isn&#8217;t one of them, in fact, SENTENCE isn&#8217;t an HTML element at all. We used it as an example to show the basic structure of all elements. Let&#8217;s look at a real HTML element:</p>
<pre>&lt;HTML&gt;&lt;/HTML&gt;</pre>
<p>In this book, all element names are printed using small-cap letters (for example, <code>BODY</code>). HTML elements are case-insensitive. That is, any combination of uppercase and lowercase letters can be used. Hence, &#8220;<code>TITLE</code>,&#8221; &#8220;<code>Title</code>,&#8221; and &#8220;<code>title</code>&#8221; are all the same. XML, however, is case-sensitive.</p>
<p>One of the elements in HTML is called HTML. The HTML start tag (<code>&lt;HTML&gt;</code>) marks the beginning of an HTML document, and the HTML end tag (<code>&lt;/HTML&gt;</code>) marks the end. Everything between these two tags is the content of the HTML element. In the example, nothing is between the start and the end tag. In the next example, we add some content:</p>
<p>&lt;HTML&gt;&lt;TITLE&gt;Bach&#8217;s home page&lt;/TITLE&gt;&lt;/HTML&gt;</p>
<p>What we added from the last example is marked in bold letters (this is a convention we will use throughout this chapter). Unlike the SENTENCE example, the content of the HTML element is not just a string of characters – it&#8217;s actually another element. The <code>TITLE</code> element contains the title of an HTML document. The title of the document we build in this chapter is &#8220;Bach&#8217;s home page.&#8221; Figure 1.3 maps out the two elements we have so far.</p>
<p><img class="alignnone size-full wp-image-50" src="http://www.indometric.com/im-contents/upload/2008/06/04fig03.png" alt="" width="500" height="106" /></p>
<p><strong>Figure 1.3. Diagram of an element.</strong></p>
<p>When a browser displays an HTML document in a window onscreen, the content of the title element generally goes into the title bar of the window. The title bar is at the top of the window. Below that is often the browser&#8217;s control panel. Further below that is the most interesting part of the browser window: the canvas. The canvas is the part of the window where documents are actually displayed. See Figure 1.4.</p>
<p><img class="alignnone size-full wp-image-52" src="http://www.indometric.com/im-contents/upload/2008/06/04fig04.png" alt="" width="500" height="370" /></p>
<p><strong>Figure 1.4. The parts of a browser&#8217;s window. The top line is the title bar, the large grey area is the canvas. CSS only deals with the content of the canvas.</strong></p>
<p>As you can see, we have yet to put anything in the document that will be displayed on the canvas. To have something actually show up on the canvas, you must place it in the <code>BODY</code> element. The <code>BODY</code> element is inside the HTML element:</p>
<pre>&lt;HTML&gt;</pre>
<pre>&lt;TITLE&gt;Bach's home page&lt;/TITLE&gt;</pre>
<pre>&lt;BODY&gt;</pre>
<pre>&lt;/BODY&gt;</pre>
<pre>&lt;/HTML&gt;</pre>
<p>To make it easier to see where elements start and end, we show the HTML examples over several lines and indent elements that are inside others. We do this because it makes the code easier to read. The browser ignores the extra space and the line breaks that separate one line from another.</p>
<p>The content of the HTML element now consists of not one, but two other elements. By themselves, the <code>BODY</code> tags do not add anything to the canvas; we need to give the <code>BODY</code> element some content. Let&#8217;s start by adding a first-level heading to the sample document. The standard HTML tag for a first-level heading is <code>H1</code>. Here&#8217;s the HTML code:</p>
<pre>&lt;HTML&gt;</pre>
<pre>&lt;TITLE&gt;Bach's home page&lt;/TITLE&gt;</pre>
<pre>&lt;BODY&gt;</pre>
<pre>&lt;H1&gt;Bach's home page&lt;/H1&gt;</pre>
<pre>&lt;/BODY&gt;</pre>
<pre>&lt;/HTML&gt;</pre>
<p>The title of the document is the same as the first-level heading. This will often be the case in HTML documents, but it doesn&#8217;t have to be.</p>
<p>HTML also has other headings you can use: <code>H2</code>, <code>H3</code>, <code>H4</code>, <code>H5</code>, and <code>H6</code>. The higher the number, the less important the heading is. If <code>H1</code> corresponds to a chapter, <code>H2</code> is a section, <code>H3</code> a subsection, etc. Typically, also, the higher the number, the smaller the font size. Here&#8217;s the document with a couple of extra headings added:</p>
<pre>&lt;HTML&gt;</pre>
<pre>&lt;TITLE&gt;Bach's home page&lt;/TITLE&gt;</pre>
<pre>&lt;BODY&gt;</pre>
<pre>&lt;H1&gt;Bach's home page&lt;/H1&gt;</pre>
<pre>&lt;H2&gt;Bach's compositions&lt;/H2&gt;</pre>
<pre>&lt;H3&gt;The keyboard music&lt;/H3&gt;</pre>
<pre>&lt;/BODY&gt;</pre>
<pre>&lt;/HTML&gt;</pre>
<p><img class="alignnone size-full wp-image-51" src="http://www.indometric.com/im-contents/upload/2008/06/04fig05.png" alt="" width="308" height="140" /></p>
<p><strong>Figure 1.5 shows the heading levels as they might appear onscreen.</strong></p>
<p>However, we don&#8217;t need those two extra headings right now, so we delete them and add a paragraph of text instead. We do this using the paragraph element, <code>P</code>:</p>
<pre>&lt;HTML&gt;</pre>
<pre>&lt;TITLE&gt;Bach's home page&lt;/TITLE&gt;</pre>
<pre>&lt;BODY&gt;</pre>
<pre>&lt;H1&gt;Bach's home page&lt;/H1&gt;</pre>
<pre>&lt;P&gt;Johann Sebastian Bach was a prolific</pre>
<pre>composer.</pre>
<pre>&lt;/BODY&gt;</pre>
<pre>&lt;/HTML&gt;</pre>
<p><img class="alignnone size-full wp-image-53" src="http://www.indometric.com/im-contents/upload/2008/06/04fig06.png" alt="" width="362" height="84" /></p>
<p><strong>Figure 1.6 shows the new paragraph.</strong></p>
<p>Note that we left out the ending paragraph tag, <code>&lt;/P&gt;</code>. Normally, an element begins with a start tag and ends with an end tag. However, for some HTML elements, the end tag may be omitted. The end tag notifies the browser when the element ends, but in some cases, the browser can figure this out for itself, so the tag is not needed. For example, the <code>P</code> element cannot exist outside of the <code>BODY</code> element. So, when the browser encounters the <code>BODY</code> end tag (<code>&lt;/BODY&gt;</code>), it knows that the P element has also ended. Still, including the P end tag is perfectly legal. HTML specifies that leaving out the <code>&lt;/P&gt;</code> has no effect on the way the document is displayed.</p>
<p>You can also see that the browser ignored the spaces and line breaks in the source document. There is only one space between each pair of words and the line breaks are gone.</p>
<p>Next, suppose we want to emphasize a word relative to the surrounding text. Several HTML elements can express this; among them, we find <code>STRONG</code> and <code>EM</code> (<code>EM</code> stands for emphasis). These elements do not say anything about how they are to be displayed, but there are some conventions: <code>STRONG</code> elements are normally displayed in bold, and <code>EM</code> elements are displayed in italic.</p>
<p>The following code shows the use of the <code>STRONG</code> element:</p>
<pre>&lt;HTML&gt;</pre>
<pre>&lt;TITLE&gt;Bach's home page&lt;/TITLE&gt;</pre>
<pre>&lt;BODY&gt;</pre>
<pre>&lt;H1&gt;Bach's home page&lt;/H1&gt;</pre>
<pre>&lt;P&gt;Johann Sebastian Bach was a</pre>
<pre>&lt;STRONG&gt;prolific&lt;/STRONG&gt;</pre>
<pre>composer.</pre>
<pre>&lt;/BODY&gt;</pre>
<pre>&lt;/HTML&gt;</pre>
<p><img class="alignnone size-full wp-image-54" src="http://www.indometric.com/im-contents/upload/2008/06/04fig07.png" alt="" width="367" height="88" /></p>
<p><strong>Figure 1.7 shows how this code is displayed.</strong></p>
<p>Notice how the word &#8220;prolific&#8221; stands out relative to the surrounding text. Also note that although the H1 and P elements start on a new line, the <code>STRONG</code> element continues on the same line where the P element started. H1 and P are examples of block-level elements, while the <code>STRONG</code> element is an inline element. We discuss block-level and inline elements in the next section.</p>
<h3>Block-Level and Inline Elements</h3>
<p>In the previous section, the STRONG element was placed in the middle of an element, <code>P</code>, while the <code>P</code> and <code>H1</code> elements both began and ended a line. You can&#8217;t insert a <code>P</code> element in the middle of another <code>P</code> or <code>H1</code> element or vice versa. But, you can insert an element like <code>STRONG</code> in the middle of most other elements. This is because the <code>P</code> and <code>H1</code> elements are block-level elements, while the <code>STRONG</code> element is an inline element.</p>
<ul>
<li>Elements can be divided into three groups:</li>
<li>Block-level</li>
<li>Inline</li>
<li>Invisible</li>
</ul>
<p>A block-level element is an element that begins and ends a line or, put another way, that has a line break before and after its content. Examples of block-level elements that you&#8217;ve seen so far in this chapter are <code>H1</code> and <code>P</code>.</p>
<h3>Element Overview</h3>
<p>Confused about the different elements? Don&#8217;t worry. Table 1.1 gives you an overview of the most common HTML elements. We&#8217;ve introduced you to several of these already and will discuss others shortly. We talk about others when appropriate throughout the rest of this book and use them in many examples. Also, we suggest that you refer to the table as needed as you work your way through this book. The last column of the table (&#8221;Empty? Replaced?&#8221;) is explained later in this chapter.</p>
<p>Among the elements that are not included in Table 1.1 are the elements that create forms and tables. Also, the non-standard elements have been left out.</p>
<p>In the next several sections, we add to your repertoire of HTML tags by discussing elements that you can use to create lists, add a horizontal rule, force a line break, and link to text and images.</p>
<h3>Comments</h3>
<p>Most of your documents will consist of elements. However, you can also insert HTML comments into the document. A comment is anything you want to say about what is going on with your document that you don&#8217;t want to be displayed. The user won&#8217;t see the comment on the canvas because browsers ignore comments; that is, they do not display a comment&#8217;s contents. Comments can be a helpful way of communicating something about your document to other designers who will see your code.</p>
<p>To ensure that the comment really is not viewable by the user, you enclose it between special strings that the browser will recognize as enclosing a comment. You begin the comment with the string <code>&lt;!--</code> and end it with the string <code>--&gt;</code>. (That&#8217;s two hyphens in both cases.) Here&#8217;s a sample comment:</p>
<pre>&lt;!-- CSS is the greatest thing</pre>
<pre>to hit the Web since hyperlinks --&gt;</pre>
<h3>Lists</h3>
<p>Lists are common in HTML documents. HTML has three elements that create lists:</p>
<p><code>OL</code>, which creates an ordered list. In an ordered list, each list item has a label that indicates the order, e.g., a digit (1, 2, 3, 4, or I, II, III, IV) or letter (a, b, c, d). In desktop-publishing terminology, ordered lists are often called numbered lists.</p>
<p><code>UL</code>, which creates an unordered list. In an unordered list, each list item has a mark that does not indicate order, e.g., a bullet symbol. In desktop-publishing terminology, unordered lists are often called bulleted lists.</p>
<p><code>DL</code>, which creates a definition list. A definition list is a list of terms with their corresponding definitions. For example, a dictionary is a (long!) definition list.</p>
<p>Bach&#8217;s home page must surely include a list of some of his compositions. Let&#8217;s add an ordered list:</p>
<pre>&lt;HTML&gt;</pre>
<pre>&lt;TITLE&gt;Bach's home page&lt;/TITLE&gt;</pre>
<pre>&lt;BODY&gt;</pre>
<pre>&lt;H1&gt;Bach's home page&lt;/H1&gt;</pre>
<pre>&lt;P&gt;Johann Sebastian Bach was a</pre>
<pre>&lt;STRONG&gt;prolific&lt;/STRONG&gt;</pre>
<pre>composer. Here are his best works:</pre>
<pre>&lt;OL&gt;</pre>
<pre>&lt;LI&gt;the Goldberg Variations</pre>
<pre>&lt;LI&gt;the Brandenburg Concertos</pre>
<pre>&lt;LI&gt;the Christmas Oratorio</pre>
<pre>&lt;/OL&gt;</pre>
<pre>&lt;/BODY&gt;</pre>
<pre>&lt;/HTML&gt;</pre>
<p>Notice that an <code>LI</code> doesn&#8217;t need an end tag, but an <code>OL</code> does. Figure 1.8 shows the result.</p>
<p><img class="alignnone size-full wp-image-55" src="http://www.indometric.com/im-contents/upload/2008/06/04fig08.png" alt="" width="500" height="153" /></p>
<p><strong>Figure 1.8. An ordered list.</strong></p>
<p>This ordered list is unfair to all the other great compositions by Bach. (What about the Mass in B-minor?) Let&#8217;s change the ordered list into an unordered list. To do this, we simply change the <code>OL</code> to UL:</p>
<pre>&lt;HTML&gt;</pre>
<pre>&lt;TITLE&gt;Bach's home page&lt;/TITLE&gt;</pre>
<pre>&lt;BODY&gt;</pre>
<pre>&lt;H1&gt;Bach's home page&lt;/H1&gt;</pre>
<pre>&lt;P&gt;Johann Sebastian Bach was a</pre>
<pre>&lt;STRONG&gt;prolific&lt;/STRONG&gt;composer.</pre>
<pre>Among his works are:</pre>
<pre>&lt;UL&gt;</pre>
<pre>&lt;LI&gt;the Goldberg Variations</pre>
<pre>&lt;LI&gt;the Brandenburg Concertos</pre>
<pre>&lt;LI&gt;the Christmas Oratorio</pre>
<pre>&lt;/UL&gt;</pre>
<pre>&lt;/BODY&gt;</pre>
<pre>&lt;/HTML&gt;</pre>
<p>Figure 1.9 shows the result.</p>
<p><img class="alignnone size-full wp-image-56" src="http://www.indometric.com/im-contents/upload/2008/06/04fig09.png" alt="" width="500" height="159" /></p>
<p><strong>Figure 1.9. An unordered list.</strong></p>
<p>Notice that we do not have to change the <code>LI</code> elements to change the list from unordered to ordered: Both <code>UL</code> and <code>OL</code> use <code>LI</code> as the list item element. But, because the <code>LI</code> elements are now inside the <code>UL</code> element, they will look different.</p>
<p>A <code>DL</code>, or definition list, is used for lists that have terms and their corresponding definitions. Each term is contained in a <code>DT</code> element, and each definition in a <code>DD</code> element. An example of a <code>DL</code> is a dictionary or glossary. In the next example, we change our <code>OL</code> to a <code>DL</code>. Notice how the LIs, change to DTs and that like the LIs, they do not require end tags. Figure 1.10 shows the result.</p>
<p><img class="alignnone size-full wp-image-57" src="http://www.indometric.com/im-contents/upload/2008/06/04fig10.png" alt="" width="500" height="217" /></p>
<p><strong>Figure 1.10. A definition list.</strong></p>
<pre>&lt;HTML&gt;</pre>
<pre>&lt;TITLE&gt;Bach's home page&lt;/TITLE&gt;</pre>
<pre>&lt;BODY&gt;</pre>
<pre>&lt;H1&gt;Bach's home page&lt;/H1&gt;</pre>
<pre>&lt;P&gt;Johann Sebastian Bach was a</pre>
<pre>&lt;STRONG&gt;prolific&lt;/STRONG&gt; composer.</pre>
<pre>Among his works are:</pre>
<pre>&lt;DL&gt;</pre>
<pre>&lt;DT&gt;the Goldberg Variations</pre>
<pre>&lt;DD&gt;composed in 1741, catalog number BWV988</pre>
<pre>&lt;DT&gt;the Brandenburg Concertos</pre>
<pre>&lt;DD&gt;composed in 1713, catalog numbers</pre>
<pre>BWV1046-1051</pre>
<pre>&lt;DT&gt;the Christmas Oratorio</pre>
<pre>&lt;DD&gt;composed in 1734, catalog number BWV248</pre>
<pre>&lt;/DL&gt;</pre>
<pre>&lt;/BODY&gt;</pre>
<pre>&lt;/HTML&gt;</pre>
<h3>Empty Elements HR and BR</h3>
<p>All the HTML elements that we have discussed so far have had content. HTML also has some elements that do not have content; they are called empty elements. One example is the <code>HR</code> element, which inserts a horizontal rule in the document. It doesn&#8217;t need any content. Also, the <code>BR</code> element&#8217;s sole purpose is to force a line break. Because empty elements do not have any content, they don&#8217;t need any end tags.</p>
<p>We can add a horizontal rule to a document by using the <code>HR</code> (horizontal rule) element. <code>HR</code> is an empty element, so you should omit its end tag. Here&#8217;s the code for adding an <code>HR</code> element:</p>
<pre>&lt;HTML&gt;</pre>
<pre>&lt;TITLE&gt;Bach's home page&lt;/TITLE&gt;</pre>
<pre>&lt;BODY&gt;</pre>
<pre>&lt;H1&gt;Bach's home page&lt;/H1&gt;</pre>
<pre>&lt;P&gt;Johann Sebastian Bach was a</pre>
<pre>&lt;STRONG&gt;prolific&lt;/STRONG&gt;</pre>
<pre>composer. Among his works are:</pre>
<pre>&lt;UL&gt;</pre>
<pre>&lt;LI&gt;the Goldberg Variations</pre>
<pre>&lt;LI&gt;the Brandenburg Concertos</pre>
<pre>&lt;LI&gt;the Christmas Oratorio</pre>
<pre>&lt;/UL&gt;</pre>
<pre>&lt;HR&gt;</pre>
<pre>&lt;/BODY&gt;</pre>
<pre>&lt;/HTML&gt;</pre>
<p>Figure 1.11 shows the result.</p>
<p><img class="alignnone size-full wp-image-58" src="http://www.indometric.com/im-contents/upload/2008/06/04fig11.png" alt="" width="500" height="175" /></p>
<p><strong>Figure 1.11. Adding a horizontal rule.</strong></p>
<p>We can force a line break in the middle of an element by using the <code>BR</code> (break) element. The browser normally ignores line breaks in the HTML document and automatically breaks a line when needed when it displays the document. However, if you want to force a line break at a certain spot in the document, <code>BR</code> enables you to do this. Because <code>BR</code> is an empty element, you can omit its end tag.</p>
<p>Here is our example with a BR element added:</p>
<pre>&lt;HTML&gt;</pre>
<pre>&lt;TITLE&gt;Bach's home page&lt;/TITLE&gt;</pre>
<pre>&lt;BODY&gt;</pre>
<pre>&lt;H1&gt;Bach's &lt;BR&gt;home page&lt;/H1&gt;</pre>
<pre>&lt;P&gt;Johann Sebastian Bach was a</pre>
<pre>&lt;STRONG&gt;prolific&lt;/STRONG&gt;</pre>
<pre>composer. Among his works are:</pre>
<pre>&lt;UL&gt;</pre>
<pre>&lt;LI&gt;the Goldberg Variations</pre>
<pre>&lt;LI&gt;the Brandenburg Concertos</pre>
<pre>&lt;LI&gt;the Christmas Oratorio</pre>
<pre>&lt;/UL&gt;</pre>
<pre>&lt;/BODY&gt;</pre>
<pre>&lt;/HTML&gt;</pre>
<p>Figure 1.12 shows the result.</p>
<p><img class="alignnone size-full wp-image-59" src="http://www.indometric.com/im-contents/upload/2008/06/04fig12.png" alt="" width="500" height="197" /></p>
<p><strong>Figure 1.12. Adding a line break.</strong></p>
<p>It is usually better to let the browser determine the line breaks, because as an author, you cannot know how wide the user&#8217;s window is or how large the fonts are. So, we&#8217;ll take out the <code>BR</code> element as we move on.</p>
<h3>Maintaining Preformatted Text</h3>
<p>In the previous example, we mentioned that a browser generally ignores line breaks, except for those that you enter using the BR element. The browser also ignores tabs and extra white space. Tabspaces are converted to single white-space characters, while extra white-space characters – any more than one – are collapsed into one white-space character. Generally, this is what we want. This feature enables us to space out our code so that it is more readable and reflects the structure of the document, secure in the knowledge that the browser ignores all the extra white spaces.</p>
<p>Sometimes, however, you may want to insert white space and have the browser display your text exactly as you formatted it. The <code>PRE</code> (preformatted) element allows you do this. Simply enclose within <code>&lt;PRE&gt;</code> tags the information whose formatting you want to preserve. The <code>PRE</code> element is often used for simple tables where columns need to align vertically:</p>
<pre>&lt;HTML&gt;</pre>
<pre>&lt;TITLE&gt;Bach's home page&lt;/TITLE&gt;</pre>
<pre>&lt;BODY&gt;</pre>
<pre>&lt;H1&gt;Bach's &lt;BR&gt;home page&lt;/H1&gt;</pre>
<pre>&lt;P&gt;Johann Sebastian Bach was a</pre>
<pre>&lt;STRONG&gt;prolific&lt;/STRONG&gt;</pre>
<pre>composer. Among his works are:</pre>
<pre>&lt;PRE&gt;</pre>
<pre>COMPOSITION           YEAR  CATALOG#</pre>
<pre>Goldberg Variation    1741  BWV988</pre>
<pre>Brandenburg Concertos 1713  BWV1046-1051</pre>
<pre>Christmas Oratorio    1734  BWV248</pre>
<pre>&lt;/PRE&gt;</pre>
<pre>&lt;/BODY&gt;</pre>
<pre>&lt;/HTML&gt;</pre>
<p>Notice that the content of the PRE element cannot be aligned with the other elements because the extra white space would appear on the canvas. Figure 1.13 shows the result.</p>
<p><img class="alignnone size-full wp-image-60" src="http://www.indometric.com/im-contents/upload/2008/06/04fig13.png" alt="" width="500" height="180" /></p>
<p><strong>Figure 1.13. Preserving preformatted text.</strong></p>
<p>This is actually not a very good example because by using <code>PRE</code>, we hide the fact that the content is a table. This is a case where using a table is in fact the right thing to do because it enhances accessibility (see the section &#8220;Placing text in a table&#8221; earlier in this chapter).</p>
<h3>Adding Hyperlinks</h3>
<p>We can make our document more interesting by adding hyperlinks to it. When hyperlinks are in place, users can click on them to access related documents from somewhere else on the Web. Hyperlinks are integral to HTML and the Web. Without hyperlinks, there would be no Web.</p>
<p>To make a hyperlink, you use the <code>A</code> (anchor) element. When the user clicks on the <code>A</code> element, the browser fetches the document at the other end of the hyperlink. The browser needs to be told where it can find the other document, and this information goes into an attribute on the <code>A</code> element. An attribute is a characteristic quality of the element, other than the type or content of an element. The <code>A</code> element uses an attribute called HREF (hypertext reference) to add a hyperlink:</p>
<pre>&lt;HTML&gt;</pre>
<pre>&lt;TITLE&gt;Bach's home page&lt;/TITLE&gt;</pre>
<pre>&lt;BODY&gt;</pre>
<pre>&lt;H1&gt;Bach's home page&lt;/H1&gt;</pre>
<pre>&lt;P&gt;Johann Sebastian Bach was a</pre>
<pre>&lt;STRONG&gt;prolific&lt;/STRONG&gt;</pre>
<pre>composer. Among his works are:</pre>
<pre>&lt;UL&gt;</pre>
<pre>&lt;LI&gt;the &lt;A HREF="goldberg.html"&gt;Goldberg&lt;/A&gt;</pre>
<pre>Variations</pre>
<pre>&lt;LI&gt;the Brandenburg Concertos</pre>
<pre>&lt;LI&gt;the Christmas Oratorio</pre>
<pre>&lt;/UL&gt;</pre>
<pre>&lt;HR&gt;</pre>
<pre>&lt;/BODY&gt;</pre>
<pre>&lt;/HTML&gt;</pre>
<p>Let&#8217;s take a closer look at the newly added A element. Figure 1.14 shows the different parts of the A element.</p>
<p><img class="alignnone size-full wp-image-61" src="http://www.indometric.com/im-contents/upload/2008/06/04fig14.png" alt="" width="450" height="174" /></p>
<p><strong>Figure 1.14. The parts of an A element.</strong></p>
<p>The A start tag is a bit more complicated than the other start tags we have seen so far; in addition to the element name, it includes an attribute. Different element types have different attributes; among the most common ones is the <code>HREF</code> attribute on the <code>A</code> element. Attributes can only go into the start tag of the element, after the element name. Most attributes need a value: The <code>HREF</code> attributes always takes a URL as a value. A URL (Universal Resource Locator) is a Web address that the browser uses to locate the hyperlinked document. When URLs are 