<?xml version="1.0" encoding="UTF-8" ?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
			<title>Tagged with "reference"</title>
			<link>http://www.addedbytes.com/feeds/tag-feed/</link>
			<description></description>
			<language>en</language>
			<copyright>Web Development in Brighton - Added Bytes 2006</copyright>
			<ttl>120</ttl>
			<item>
				<title>Text Readability Scores</title>
				<link>http://www.addedbytes.com/blog/code/readability-score/</link>
				<description><![CDATA[ A tool to give an indication of how easy text is to read, using the Flesch-Kincaid, Gunning-Fog, Coleman-Liau, SMOG and Automated Readability scoring systems. <p><strong>This tool has moved!</strong> It's now on its own domain, at <a href="http://www.readability-score.com/">Readability-Score.com</a>. (It's also had a small makeover and is now full of speedy AJAXy goodness.)</p>

<p>The code that powers the tool is still available on <a href="https://github.com/DaveChild/Text-Statistics">GitHub</a>.</p>

<!--<p>There are a few bugs in the system, so I've left the old tool up for now until everything is running smoothly.</p>

[ -- !ReadabilityScore! -- ]

<form method="post" action="blog/code/readability-score/"><fieldset style="border: 0; width: 90%;"><textarea name="text" rows="20" cols="20" style="border: 1px solid #000; width: 100%; margin-bottom: 20px;">[!Repopulate? &field=`text` !]</textarea>
<p style="text-align: center; padding: 20px 0 0 0;"><input type="submit" value="Check Text Readability" /></p></fieldset></form>--> <br><br>]]></description>
				<pubDate>Wed, 07 Jul 2004 15:14:59 +0100</pubDate>
				<guid isPermaLink="false">http://www.addedbytes.com/blog/code/readability-score/</guid>
				<dc:creator>Dave Child</dc:creator>
				<a href="/feeds/tag-feed/?tags=design&amp;start=0" class="ditto_tag" rel="tag">design</a>,<a href="/feeds/tag-feed/?tags=language&amp;start=0" class="ditto_tag" rel="tag">language</a>,<a href="/feeds/tag-feed/?tags=literature&amp;start=0" class="ditto_tag" rel="tag">literature</a>,<a href="/feeds/tag-feed/?tags=readability&amp;start=0" class="ditto_tag" rel="tag">readability</a>,<a href="/feeds/tag-feed/?tags=reference&amp;start=0" class="ditto_tag" rel="tag">reference</a>,<a href="/feeds/tag-feed/?tags=resources&amp;start=0" class="ditto_tag" rel="tag">resources</a>,<a href="/feeds/tag-feed/?tags=tool&amp;start=0" class="ditto_tag" rel="tag">tool</a>,<a href="/feeds/tag-feed/?tags=tools&amp;start=0" class="ditto_tag" rel="tag">tools</a>,<a href="/feeds/tag-feed/?tags=usability&amp;start=0" class="ditto_tag" rel="tag">usability</a>,<a href="/feeds/tag-feed/?tags=webdesign&amp;start=0" class="ditto_tag" rel="tag">webdesign</a>,<a href="/feeds/tag-feed/?tags=writing&amp;start=0" class="ditto_tag" rel="tag">writing</a>
			</item>

			<item>
				<title>PHP Querystring Functions</title>
				<link>http://www.addedbytes.com/blog/code/php-querystring-functions/</link>
				<description><![CDATA[ <p>Adding and removing variables to and from URLs using PHP can be a relatively simple process admittedly, but I have a couple of functions I use often to make the process even less time-consuming.</p><br />
<br />
<h3>Add Querystring Variable</h3><br />
<br />
<p>A PHP function that will add the querystring variable $key with a value $value to $ur</p> <p>Adding and removing variables to and from URLs using PHP can be a relatively simple process admittedly, but I have a couple of functions I use often to make the process even less time-consuming.</p>

<h3>Add Querystring Variable</h3>

<p>A PHP function that will add the querystring variable $key with a value $value to $url. If $key is already specified within $url, it will replace it.</p>

<pre class="php">function add_querystring_var($url, $key, $value) {
    $url = preg_replace('/(.*)(?|&amp;)' . $key . '=[^&amp;]+?(&amp;)(.*)/i', '$1$2$4', $url . '&amp;');
    $url = substr($url, 0, -1);
    if (strpos($url, '?') === false) {
        return ($url . '?' . $key . '=' . $value);
    } else {
        return ($url . '&amp;' . $key . '=' . $value);
    }
}</pre>

<h3>Remove Querystring Variable</h3>

<p>A PHP function that will remove the variable $key and its value from the given $url.</p>

<pre class="php">function remove_querystring_var($url, $key) {
    $url = preg_replace('/(.*)(?|&amp;)' . $key . '=[^&amp;]+?(&amp;)(.*)/i', '$1$2$4', $url . '&amp;');
    $url = substr($url, 0, -1);
    return ($url);
}</pre> <br><br>]]></description>
				<pubDate>Tue, 05 Dec 2006 15:41:30 +0000</pubDate>
				<guid isPermaLink="false">http://www.addedbytes.com/blog/code/php-querystring-functions/</guid>
				<dc:creator>Dave Child</dc:creator>
				<a href="/feeds/tag-feed/?tags=code&amp;start=0" class="ditto_tag" rel="tag">code</a>,<a href="/feeds/tag-feed/?tags=development&amp;start=0" class="ditto_tag" rel="tag">development</a>,<a href="/feeds/tag-feed/?tags=functions&amp;start=0" class="ditto_tag" rel="tag">functions</a>,<a href="/feeds/tag-feed/?tags=links&amp;start=0" class="ditto_tag" rel="tag">links</a>,<a href="/feeds/tag-feed/?tags=php&amp;start=0" class="ditto_tag" rel="tag">php</a>,<a href="/feeds/tag-feed/?tags=programming&amp;start=0" class="ditto_tag" rel="tag">programming</a>,<a href="/feeds/tag-feed/?tags=querystring&amp;start=0" class="ditto_tag" rel="tag">querystring</a>,<a href="/feeds/tag-feed/?tags=reference&amp;start=0" class="ditto_tag" rel="tag">reference</a>,<a href="/feeds/tag-feed/?tags=tips&amp;start=0" class="ditto_tag" rel="tag">tips</a>,<a href="/feeds/tag-feed/?tags=url&amp;start=0" class="ditto_tag" rel="tag">url</a>,<a href="/feeds/tag-feed/?tags=variable&amp;start=0" class="ditto_tag" rel="tag">variable</a>
			</item>

			<item>
				<title>Jargon Explained</title>
				<link>http://www.addedbytes.com/articles/online-marketing/jargon-explained/</link>
				<description><![CDATA[ Many of my clients have worked previously consultants and SEOs that inundated them with jargon, especially where proposals and sales calls are concerned. I find myself sometimes using too much jargon - easily done when you spend so much time working in any field. This jargon guide explains the industry terms in simple language. <h3 id="anchortext">Anchor Text</h3>

<p>Anchor text is the text used to link to another site. In this example - <a href="http://www.google.com">Google Web Search</a> - the anchor text is "Google Web Search".</p>

<h3 id="atom">Atom</h3>

<p>Atom is a file format used for web <a href="http://www.addedbytes.com/seo/jargon-explained/#feeds">feeds</a>. It is a type of <a href="http://www.addedbytes.com/seo/jargon-explained/#xml">XML</a> document, and is used in <a href="http://www.addedbytes.com/seo/jargon-explained/#syndication">syndication</a>.</p>

<h3 id="blackhat">Black Hat</h3>

<p>Black Hat is the term used to describe techniques used by some search marketers to promote websites. These techniques are those that go against guidelines published by search engines, and in many cases their use <em>can</em> result in a site being penalised or removed from search engine listings. Black Hat is the opposite of <a href="http://www.addedbytes.com/seo/jargon-explained/#whitehat">White Hat</a>.</p>

<h3 id="cctld">ccTLD</h3>

<p>A ccTLD is a country-code <a href="http://www.addedbytes.com/seo/jargon-explained/#tld">top level domain</a>. .uk, for example, is a ccTLD, as are .au (Australia), .de (Germany), .fr (France), .ca (Canada) and .nz (New Zealand).</p>

<h3 id="clickthroughrate">Click-through Rate</h3>

<p>See <a href="http://www.addedbytes.com/seo/jargon-explained/#ctr">CTR</a>.</p>

<h3 id="cloaking">Cloaking</h3>

<p>Cloaking is a technique used to show content to a search engine and different content to a user. The content shown to the engine is usually designed to help a page rank very well for a certain phrase or word, and the content shown to the user usually designed to maximise the <a href="http://www.addedbytes.com/seo/jargon-explained/#conversion">conversions</a> from that page. Search engines dislike this technique and many sites are banned for using it. It is a <a href="#blackhat">Black Hat</a> technique.</p>

<h3 id="conversion">Conversion</h3>

<p>A conversion is when a website user completes a specific goal. With some sites that can be to complete a sale; with others, to sign up to a newsletter; and with others to make an enquiry.</p>

<h3 id="cookie">Cookie</h3>

<p>A cookie is a small text file stored on a website user's computer. It identifies a repeat visitor to a site, often with a unique code, allowing people to shop online and removing the need to log in to sites repeatedly. Cookies are often considered dangerous by less experienced web users. You can find out more about cookies in <a href="http://www.addedbytes.com/development/are-cookies-dangerous/">Are Cookies Dangerous?</a></p>

<h3 id="cpa">CPA</h3>

<p>CPA stands for "Cost-Per-Action", and is a form of advertising model. The idea is that an advertiser pays a specific amount for each successful <a href="http://www.addedbytes.com/seo/jargon-explained/#conversion">conversion</a>, be that a sale or a signup.</p>

<h3 id="cpc">CPC</h3>

<p>CPC stands for "Cost-Per-Click", and is a form of advertising model. The idea is that an advertiser pays a specific amount for each visitor referred to their website, regardless of whether that user converts to a sale or not.</p>

<h3 id="cpm">CPM</h3>

<p>CPM stands for "Cost-Per-Mille", and is a form of advertising model. The idea is that an advertiser pays a specific amount for every thousand times his advert is seen on a site, regardless of how many of the users who see the advert click on it and visit the advertiser's site.</p>

<h3 id="crawler">Crawler</h3>

<p>See <a href="http://www.addedbytes.com/seo/jargon-explained/#spider">Spider</a>.</p>

<h3 id="ctr">CTR</h3>

<p>CTR stands for "Click-through Rate". It is an indicator of the percentage of people who see an advert who actually click on it. For example, if one out of every hundred people who view an advert click on it, the advert with have a CTR of 1%.</p>

<h3 id="directory">Directory</h3>

<p>A directory is different to a search engine in that it organises the sites it lists in categories. Sites are usually added by hand, rather than found using a <a href="http://www.addedbytes.com/seo/jargon-explained/#spider">spider</a>, and often a small fee is charged for this addition.</p>

<h3 id="datacenter">Data Center</h3>

<p>A data center is a large collection of computers that hold information for a search engine. Major search engines have several of these around the world. Their purposes is to process search queries.</p>

<h3 id="doorway">Doorway Page</h3>

<p>A doorway page is a page designed specifically to rank well in search engines. Often a visitor to a doorway page will not notice they have visited one, as they will be sent straight on to the target page instantly. Use of doorways is a <a href="http://www.addedbytes.com/seo/jargon-explained/#blackhat">Black Hat</a> technique.</p>

<h3 id="feed">Feed</h3>

<p>A feed is a file that users can download that contains information about recent updates and additions to a website. Often these feeds are used for <a href="http://www.addedbytes.com/seo/jargon-explained/#syndication">syndication</a> purposes. Using feeds and programs designed to use feeds, users can often keep up to date with many hundreds of websites.</p>

<h3 id="ffa">FFA</h3>

<p>FFA stands for "Free-For All". It is usually used in conjunction with links pages that allow anyone and everyone to add a link to the page.</p>

<h3 id="googledance">Google Dance</h3>

<p>The Google Dance is the name for the process Google used to go through very regularly when it updated an algorithm. As various <a href="http://www.addedbytes.com/seo/jargon-explained/#datacenter">data centres</a> around the world were progrssively updated, people would be able to make the same search several times in succession and see different results each time. The Google Dance does not happen as often now, but can still be seen when major changes are made to the Google infrastructure or algorithms.</p>

<h3 id="hit">Hit</h3>

<p>A "hit" can mean one of two things.</p>

<ul><li>When searching the web, a hit can be a result found by a search engines that matches the search criteria.</li><li>In analytics, a hit is when a file is requested by a server. Some people have used hits as a measure of website traffic, however hits to a server include images and repeat visitors, and are a poor indicator of traffic. One thousand hits very rarely equals one thousand visits.</li></ul>

<h3 id="ibl">IBL</h3>

<p>IBL stands for "Inbound Link", and refers to a link pointing to a website from a separate website (unlike an internal link, which refers to a link within one website pointing to somewhere else within the same site).</p>

<h3 id="impression">Impression</h3>

<p>Impression is the word used to describe a single viewing of something. A page impression would mean a single view of a web page. In advertising, one impression is a single view of the advert.</p>

<h3 id="keyword">Keyword</h3>

<p>A keyword is simply a word used to describe a page. It can also be a word used by someone trying to find a site, entered into a search engine.</p>

<h3 id="keyphrase">Keyphrase</h3>

<p>A keyphrase is very similar to a <a href="http://www.addedbytes.com/seo/jargon-explained/#keywords">keyword</a>, except that it is a phrase made up of several words.</p>

<h3 id="keywordstuffing">Keyword Stuffing</h3>

<p>Keyword stuffing is the practice of repeating a keyword (or keywords) far too many times throughout a page. It may be that the keyword is repeated so many times in the text that as a result the text reads badly. It may be that it is repeated lots of times in meta tags, or elsewhere in code, or it may be a combination of these things. Common practice in the late 90s, this is now considered a technique that may harm a site more than help it.</p>

<h3 id="linkbuilding">Link Building</h3>

<p>Link Building is the process used to increase the number of links to a website. This can include submitting a website to directories, creating more content for a website, link rental, and many more techniques. Most search engines now use link data extensively in their algorithms, and so link building has become far more common.</p>

<h3 id="metadata">Meta Data / Meta Tag</h3>

<p>Meta Data is information held about a page or document. It is usually held invisibly within the page, and may include a description of the page, a list of relevant keywords, or the name of the author. For a full explanation of common meta tags, and how to work out which ones are worth using, please read <a href="http://www.addedbytes.com/seo/meta-tags/">Meta Tags</a>.</p>

<h3 id="pagetitle">Page Title</h3>

<p>A page title is an important part of a page - it is usually the part of the page that appears as a link in search results. It is usually visible in the title bar of your browser while you are viewing a page.</p>

<h3 id="pr">PageRank / PR</h3>

<p>PageRank is an algorithm, developer by Larry Page and Sergey Brin, founders of Google. It allows you to find the "best" pages of a group of pages by looking at how the pages link to each other. The more links a page has, the better it is considered, and the more important its links, in turn, are considered. PageRank is named after Larry Page.</p>

<h3 id="payperaction">Pay Per Action</h3>

<p>Pay Per Action advertising is the same advertising model as <a href="http://www.addedbytes.com/seo/jargon-explained/#cpa">CPA</a>, in that an advertiser will pay every time a user completes a specific action.</p>

<h3 id="paypercall">Pay Per Call</h3>

<p>Pay Per Call advertising is a subset of <a href="http://www.addedbytes.com/seo/jargon-explained/#payperaction">Pay Per Action</a>, and is the same advertising model as <a href="http://www.addedbytes.com/seo/jargon-explained/#cpa">CPA</a>, in that an advertiser will pay every time a user calls a specific number.</p>

<h3 id="payperclick">Pay Per Click</h3>

<p>Pay Per Click advertising is the same advertising model as <a href="http://www.addedbytes.com/seo/jargon-explained/#cpc">CPC</a>, in that an advertiser will pay every time a user clicks on their advert.</p>

<h3 id="pfi">PFI</h3>

<p>PFI stands for "Pay For Inclusion". Some engines will charge sites to be listed at all in their results (notably Yahoo for many years). Prices vary greatly, and some engines charge annually, where others charge a one-off fee. This is a far more common feature of directories than search engines.</p>

<h3 id="ppc">PPC</h3>

<p>See <a href="payperclick">Pay Per Click</a>.</p>

<h3 id="robots">Robots.txt</h3>

<p>A robots.txt file is a simple text file that contains instructions for search engine <a href="http://www.addedbytes.com/seo/jargon-explained/#spider">spiders</a>. It can tell specific spiders to slow down, or not to index specific area of a site. For more information, please read <a href="http://www.addedbytes.com/development/robots-txt-file/">robots.txt</a>.</p>

<h3 id="roi">ROI</h3>

<p>ROI stands for "Return on Investment". It is a measure of the success of any marketing campaign. A marketing campaign that cost ?10,000 but made ?3,000 would obviously have a low ROI. A marketing campaign that cost ?10,000 but made ?100,000 would have a high ROI.</p>

<h3 id="rss">RSS</h3>

<p>RSS is a type of <a href="http://www.addedbytes.com/seo/jargon-explained/#xml">XML</a> file, and is the most commonly used file format for website <a href="http://www.addedbytes.com/seo/jargon-explained/#feed">feeds</a>.</p>

<h3 id="sem">SEM</h3>

<p>SEM is an acronym of "Search Engine Marketing". SEM is a broader topic than <a href="http://www.addedbytes.com/seo/jargon-explained/#seo">SEO</a>, and can include, for example, an online PR campaign or <a href="http://www.addedbytes.com/seo/jargon-explained/#ppc">PPC</a> (and other forms of) advertising.</p>

<h3 id="seo">SEO</h3>

<p>SEO is an acronym of "Search Engine Optimisation", and is the art of altering a website to improve a site's performance in search engines (note: an improvement in performance does not equal an increase in traffic!).</p>

<h3 id="serps">SERPs</h3>

<p>SERPs is an acronym for "Search Engine Result Pages".</p>

<h3 id="ses">SEs</h3>

<p>SE is an abbreviation of "Search Engine".</p>

<h3 id="sitemaps">Site Map</h3>

<p>A site map is a page, or set of pages, on a website, designed to help users and search engines find their way around a site.</p>

<h3 id="spam">Spam</h3>

<p>Spam has many different meanings on the web. The most common meaning is related to email, where spam describes unwanted email, often commercial in nature, and often sent out indiscriminately to millions of people at once. In a search engine context, spam refers to pages that are listed out of place. This can mean pages that are found for keywords unrelated to their content. It can also mean pages appearing unnaturally high in search engines. These pages are often promoted using <a href="http://www.addedbytes.com/seo/jargon-explained/#blackhat">Black Hat</a> techniques, especially <a href="http://www.addedbytes.com/seo/jargon-explained/#cloaking">cloaking</a> and <a href="http://www.addedbytes.com/seo/jargon-explained/#doorway">doorway pages</a>.</p>

<h3 id="spider">Spider</h3>

<p>A spider, also often called a "crawler", is a program created by a search engine to index pages on the web. It visits pages on the web, collects their content, and finds links within that page. It then adds the links found on that page to those it intends to crawl.</p>

<h3 id="splashpage">Splash Page</h3>

<p>A splash page is an introduction page to a website, often created using flash. They are much derided, as they slow down access to a website and often provide no useful information to the user.</p>

<h3 id="stopword">Stop Word</h3>

<p>A stop word is a word that is ignored by the search engines. It is a word that appears so often on the web as to be useless to a search engine. Examples include "a", "and", "I", "you" and "it".</p>

<h3 id="syndication">Syndication</h3>

<p>Syndication is where a website makes information available for others to use. In the majority of cases, the information available is a list of the content most recently added to the site (a <a href="http://www.addedbytes.com/seo/jargon-explained/#feed">feed</a>), to allows visitors to keep up to date easily with new content added to many sites.</p>

<h3 id="textlinkad">Text Link Ad</h3>

<p>A text link ad is a type of advert on a website, placed in return for a simple monthly fee. These types of advert can have a positive effect on a website's SEO campaign, and can directly generate traffic to websites.</p>

<h3 id="tld">TLD</h3>

<p>A TLD is an acronym for "Top Level Domain". .com, .org, .net, .biz, .info, .name and .pro are all examples of TLDs. They are usually global TLDs, unlike <a href="http://www.addedbytes.com/seo/jargon-explained/#cctld">ccTLDs</a>, which are country-code domains.</p>

<h3 id="url">URL / URI</h3>

<p>A URL (Uniform Resource Locator), sometimes (more correctly) referred to as a URI (Uniform Resource Identifier), is in basic terms a web address. For example, "http://www.addedbytes.com" is a URI.</p>

<h3 id="visits">Visit</h3>

<p>A visit is different from a <a href="http://www.addedbytes.com/seo/jargon-explained/#hit">Hit</a> or an <a href="http://www.addedbytes.com/seo/jargon-explained/#impression">Impression</a>, in that it indicates a single person's visit to a website. A visit may include many page impressions, and many hits.</p>

<h3 id="whitehat">White Hat</h3>

<p>White Hat is the term used to describe techniques used by some search marketers to promote websites. These techniques are those that adhere to the guidelines published by search engines. White Hat is the opposite of <a href="http://www.addedbytes.com/seo/jargon-explained/#blackhat">Black Hat</a>.</p>

<h3 id="xml">XML</h3>

<p>XML is a file format designed to create files that are easy to share and understand.</p> <br><br>]]></description>
				<pubDate>Wed, 03 May 2006 13:17:00 +0100</pubDate>
				<guid isPermaLink="false">http://www.addedbytes.com/articles/online-marketing/jargon-explained/</guid>
				<dc:creator>Dave Child</dc:creator>
				<a href="/feeds/tag-feed/?tags=article&amp;start=0" class="ditto_tag" rel="tag">article</a>,<a href="/feeds/tag-feed/?tags=blog&amp;start=0" class="ditto_tag" rel="tag">blog</a>,<a href="/feeds/tag-feed/?tags=google&amp;start=0" class="ditto_tag" rel="tag">google</a>,<a href="/feeds/tag-feed/?tags=jargon&amp;start=0" class="ditto_tag" rel="tag">jargon</a>,<a href="/feeds/tag-feed/?tags=reference&amp;start=0" class="ditto_tag" rel="tag">reference</a>,<a href="/feeds/tag-feed/?tags=search&amp;start=0" class="ditto_tag" rel="tag">search</a>,<a href="/feeds/tag-feed/?tags=seo&amp;start=0" class="ditto_tag" rel="tag">seo</a>,<a href="/feeds/tag-feed/?tags=web&amp;start=0" class="ditto_tag" rel="tag">web</a>
			</item>

			<item>
				<title>Internet Country Codes</title>
				<link>http://www.addedbytes.com/blog/code/internet-country-codes/</link>
				<description><![CDATA[ A list of country level domain names, ordered by country or domain name. <p>I recently had need to create a list of the ccTLDs, to allow someone to find out what a country's ccTLD was. Maybe it'll be useful to someone else as well!</p>

<table style="width: 70%;"><tr><td>Afghanistan</td><td>.af</td></tr><tr><td>Albania</td><td>.al</td></tr><tr><td>Algeria</td><td>.dz</td></tr><tr><td>American Samoa</td><td>.as</td></tr><tr><td>Andorra</td><td>.ad</td></tr><tr><td>Angola</td><td>.ao</td></tr><tr><td>Anguilla</td><td>.ai</td></tr><tr><td>Antarctica</td><td>.aq</td></tr><tr><td>Antigua and Barbuda</td><td>.ag</td></tr><tr><td>Argentina</td><td>.ar</td></tr><tr><td>Armenia</td><td>.am</td></tr><tr><td>Aruba</td><td>.aw</td></tr><tr><td>Australia</td><td>.au</td></tr><tr><td>Austria</td><td>.at</td></tr><tr><td>Azerbaijan</td><td>.az</td></tr><tr><td>Bahamas, The</td><td>.bs</td></tr><tr><td>Bahrain</td><td>.bh</td></tr><tr><td>Bangladesh</td><td>.bd</td></tr><tr><td>Barbados</td><td>.bb</td></tr><tr><td>Belarus</td><td>.by</td></tr><tr><td>Belgium</td><td>.be</td></tr><tr><td>Belize</td><td>.bz</td></tr><tr><td>Benin</td><td>.bj</td></tr><tr><td>Bermuda</td><td>.bm</td></tr><tr><td>Bhutan</td><td>.bt</td></tr><tr><td>Bolivia</td><td>.bo</td></tr><tr><td>Bosnia and Herzegovina</td><td>.ba</td></tr><tr><td>Botswana</td><td>.bw</td></tr><tr><td>Bouvet Island</td><td>.bv</td></tr><tr><td>Brazil</td><td>.br</td></tr><tr><td>British Indian Ocean Territory</td><td>.io</td></tr><tr><td>British Virgin Islands</td><td>.vg</td></tr><tr><td>Brunei</td><td>.bn</td></tr><tr><td>Bulgaria</td><td>.bg</td></tr><tr><td>Burkina Faso</td><td>.bf</td></tr><tr><td>Burma</td><td>.mm</td></tr><tr><td>Burundi</td><td>.bi</td></tr><tr><td>Cambodia</td><td>.kh</td></tr><tr><td>Cameroon</td><td>.cm</td></tr><tr><td>Canada</td><td>.ca</td></tr><tr><td>Cape Verde</td><td>.cv</td></tr><tr><td>Cayman Islands</td><td>.ky</td></tr><tr><td>Central African Republic</td><td>.cf</td></tr><tr><td>Chad</td><td>.td</td></tr><tr><td>Chile</td><td>.cl</td></tr><tr><td>China</td><td>.cn</td></tr><tr><td>Christmas Island</td><td>.cx</td></tr><tr><td>Cocos (Keeling) Islands</td><td>.cc</td></tr><tr><td>Colombia</td><td>.co</td></tr><tr><td>Comoros</td><td>.km</td></tr><tr><td>Congo, Democratic Republic of the</td><td>.cd</td></tr><tr><td>Congo, Republic of the</td><td>.cg</td></tr><tr><td>Cook Islands</td><td>.ck</td></tr><tr><td>Costa Rica</td><td>.cr</td></tr><tr><td>Cote d'Ivoire</td><td>.ci</td></tr><tr><td>Croatia</td><td>.hr</td></tr><tr><td>Cuba</td><td>.cu</td></tr><tr><td>Cyprus</td><td>.cy</td></tr><tr><td>Czech Republic</td><td>.cz</td></tr><tr><td>Denmark</td><td>.dk</td></tr><tr><td>Djibouti</td><td>.dj</td></tr><tr><td>Dominica</td><td>.dm</td></tr><tr><td>Dominican Republic</td><td>.do</td></tr><tr><td>East Timor</td><td>.tl</td></tr><tr><td>Ecuador</td><td>.ec</td></tr><tr><td>Egypt</td><td>.eg</td></tr><tr><td>El Salvador</td><td>.sv</td></tr><tr><td>Equatorial Guinea</td><td>.gq</td></tr><tr><td>Eritrea</td><td>.er</td></tr><tr><td>Estonia</td><td>.ee</td></tr><tr><td>Ethiopia</td><td>.et</td></tr><tr><td>Falkland Islands (Islas Malvinas)</td><td>.fk</td></tr><tr><td>Faroe Islands</td><td>.fo</td></tr><tr><td>Fiji</td><td>.fj</td></tr><tr><td>Finland</td><td>.fi</td></tr><tr><td>France</td><td>.fr</td></tr><tr><td>France, Metropolitan</td><td>.fx</td></tr><tr><td>French Guiana</td><td>.gf</td></tr><tr><td>French Polynesia</td><td>.pf</td></tr><tr><td>French Southern and Antarctic Lands</td><td>.tf</td></tr><tr><td>Gabon</td><td>.ga</td></tr><tr><td>Gambia, The</td><td>.gm</td></tr><tr><td>Gaza Strip</td><td>.ps</td></tr><tr><td>Georgia</td><td>.ge</td></tr><tr><td>Germany</td><td>.de</td></tr><tr><td>Ghana</td><td>.gh</td></tr><tr><td>Gibraltar</td><td>.gi</td></tr><tr><td>Greece</td><td>.gr</td></tr><tr><td>Greenland</td><td>.gl</td></tr><tr><td>Grenada</td><td>.gd</td></tr><tr><td>Guadeloupe</td><td>.gp</td></tr><tr><td>Guam</td><td>.gu</td></tr><tr><td>Guatemala</td><td>.gt</td></tr><tr><td>Guernsey</td><td>.gg</td></tr><tr><td>Guinea</td><td>.gn</td></tr><tr><td>Guinea-Bissau</td><td>.gw</td></tr><tr><td>Guyana</td><td>.gy</td></tr><tr><td>Haiti</td><td>.ht</td></tr><tr><td>Heard Island and McDonald Islands</td><td>.hm</td></tr><tr><td>Holy See</td><td>.va</td></tr><tr><td>Honduras</td><td>.hn</td></tr><tr><td>Hong Kong</td><td>.hk</td></tr><tr><td>Hungary</td><td>.hu</td></tr><tr><td>Iceland</td><td>.is</td></tr><tr><td>India</td><td>.in</td></tr><tr><td>Indonesia</td><td>.id</td></tr><tr><td>Iran</td><td>.ir</td></tr><tr><td>Iraq</td><td>.iq</td></tr><tr><td>Ireland</td><td>.ie</td></tr><tr><td>Israel</td><td>.il</td></tr><tr><td>Italy</td><td>.it</td></tr><tr><td>Jamaica</td><td>.jm</td></tr><tr><td>Japan</td><td>.jp</td></tr><tr><td>Jersey</td><td>.je</td></tr><tr><td>Jordan</td><td>.jo</td></tr><tr><td>Kazakhstan</td><td>.kz</td></tr><tr><td>Kenya</td><td>.ke</td></tr><tr><td>Kiribati</td><td>.ki</td></tr><tr><td>Korea, North</td><td>.kp</td></tr><tr><td>Korea, South</td><td>.kr</td></tr><tr><td>Kuwait</td><td>.kw</td></tr><tr><td>Kyrgyzstan</td><td>.kg</td></tr><tr><td>Laos</td><td>.la</td></tr><tr><td>Latvia</td><td>.lv</td></tr><tr><td>Lebanon</td><td>.lb</td></tr><tr><td>Lesotho</td><td>.ls</td></tr><tr><td>Liberia</td><td>.lr</td></tr><tr><td>Libya</td><td>.ly</td></tr><tr><td>Liechtenstein</td><td>.li</td></tr><tr><td>Lithuania</td><td>.lt</td></tr><tr><td>Luxembourg</td><td>.lu</td></tr><tr><td>Macau</td><td>.mo</td></tr><tr><td>Macedonia</td><td>.mk</td></tr><tr><td>Madagascar</td><td>.mg</td></tr><tr><td>Malawi</td><td>.mw</td></tr><tr><td>Malaysia</td><td>.my</td></tr><tr><td>Maldives</td><td>.mv</td></tr><tr><td>Mali</td><td>.ml</td></tr><tr><td>Malta</td><td>.mt</td></tr><tr><td>Man, Isle of</td><td>.im</td></tr><tr><td>Marshall Islands</td><td>.mh</td></tr><tr><td>Martinique</td><td>.mq</td></tr><tr><td>Mauritania</td><td>.mr</td></tr><tr><td>Mauritius</td><td>.mu</td></tr><tr><td>Mayotte</td><td>.yt</td></tr><tr><td>Mexico</td><td>.mx</td></tr><tr><td>Micronesia, Federated States of</td><td>.fm</td></tr><tr><td>Moldova</td><td>.md</td></tr><tr><td>Monaco</td><td>.mc</td></tr><tr><td>Mongolia</td><td>.mn</td></tr><tr><td>Montserrat</td><td>.ms</td></tr><tr><td>Morocco</td><td>.ma</td></tr><tr><td>Mozambique</td><td>.mz</td></tr><tr><td>Namibia</td><td>.na</td></tr><tr><td>Nauru</td><td>.nr</td></tr><tr><td>Nepal</td><td>.np</td></tr><tr><td>Netherlands</td><td>.nl</td></tr><tr><td>Netherlands Antilles</td><td>.an</td></tr><tr><td>New Caledonia</td><td>.nc</td></tr><tr><td>New Zealand</td><td>.nz</td></tr><tr><td>Nicaragua</td><td>.ni</td></tr><tr><td>Niger</td><td>.ne</td></tr><tr><td>Nigeria</td><td>.ng</td></tr><tr><td>Niue</td><td>.nu</td></tr><tr><td>Norfolk Island</td><td>.nf</td></tr><tr><td>Northern Mariana Islands</td><td>.mp</td></tr><tr><td>Norway</td><td>.no</td></tr><tr><td>Oman</td><td>.om</td></tr><tr><td>Pakistan</td><td>.pk</td></tr><tr><td>Palau</td><td>.pw</td></tr><tr><td>Panama</td><td>.pa</td></tr><tr><td>Papua New Guinea</td><td>.pg</td></tr><tr><td>Paraguay</td><td>.py</td></tr><tr><td>Peru</td><td>.pe</td></tr><tr><td>Philippines</td><td>.ph</td></tr><tr><td>Pitcairn Islands</td><td>.pn</td></tr><tr><td>Poland</td><td>.pl</td></tr><tr><td>Portugal</td><td>.pt</td></tr><tr><td>Puerto Rico</td><td>.pr</td></tr><tr><td>Qatar</td><td>.qa</td></tr><tr><td>Reunion</td><td>.re</td></tr><tr><td>Romania</td><td>.ro</td></tr><tr><td>Russia</td><td>.ru</td></tr><tr><td>Rwanda</td><td>.rw</td></tr><tr><td>Saint Helena</td><td>.sh</td></tr><tr><td>Saint Kitts and Nevis</td><td>.kn</td></tr><tr><td>Saint Lucia</td><td>.lc</td></tr><tr><td>Saint Pierre and Miquelon</td><td>.pm</td></tr><tr><td>Saint Vincent and the Grenadines</td><td>.vc</td></tr><tr><td>Samoa</td><td>.ws</td></tr><tr><td>San Marino</td><td>.sm</td></tr><tr><td>Sao Tome and Principe</td><td>.st</td></tr><tr><td>Saudi Arabia</td><td>.sa</td></tr><tr><td>Senegal</td><td>.sn</td></tr><tr><td>Serbia and Montenegro</td><td>.cs</td></tr><tr><td>Seychelles</td><td>.sc</td></tr><tr><td>Sierra Leone</td><td>.sl</td></tr><tr><td>Singapore</td><td>.sg</td></tr><tr><td>Slovakia</td><td>.sk</td></tr><tr><td>Slovenia</td><td>.si</td></tr><tr><td>Solomon Islands</td><td>.sb</td></tr><tr><td>Somalia</td><td>.so</td></tr><tr><td>South Africa</td><td>.za</td></tr><tr><td>South Georgia and the Islands</td><td>.gs</td></tr><tr><td>Soviet Union</td><td>.su</td></tr><tr><td>Spain</td><td>.es</td></tr><tr><td>Sri Lanka</td><td>.lk</td></tr><tr><td>Sudan</td><td>.sd</td></tr><tr><td>Suriname</td><td>.sr</td></tr><tr><td>Svalbard</td><td>.sj</td></tr><tr><td>Swaziland</td><td>.sz</td></tr><tr><td>Sweden</td><td>.se</td></tr><tr><td>Switzerland</td><td>.ch</td></tr><tr><td>Syria</td><td>.sy</td></tr><tr><td>Taiwan</td><td>.tw</td></tr><tr><td>Tajikistan</td><td>.tj</td></tr><tr><td>Tanzania</td><td>.tz</td></tr><tr><td>Thailand</td><td>.th</td></tr><tr><td>Togo</td><td>.tg</td></tr><tr><td>Tokelau</td><td>.tk</td></tr><tr><td>Tonga</td><td>.to</td></tr><tr><td>Trinidad and Tobago</td><td>.tt</td></tr><tr><td>Tunisia</td><td>.tn</td></tr><tr><td>Turkey</td><td>.tr</td></tr><tr><td>Turkmenistan</td><td>.tm</td></tr><tr><td>Turks and Caicos Islands</td><td>.tc</td></tr><tr><td>Tuvalu</td><td>.tv</td></tr><tr><td>Uganda</td><td>.ug</td></tr><tr><td>Ukraine</td><td>.ua</td></tr><tr><td>United Arab Emirates</td><td>.ae</td></tr><tr><td>United Kingdom</td><td>.uk</td></tr><tr><td>United States</td><td>.us</td></tr><tr><td>United States Minor Outlying Islands</td><td>.um</td></tr><tr><td>Uruguay</td><td>.uy</td></tr><tr><td>Uzbekistan</td><td>.uz</td></tr><tr><td>Vanuatu</td><td>.vu</td></tr><tr><td>Venezuela</td><td>.ve</td></tr><tr><td>Vietnam</td><td>.vn</td></tr><tr><td>Virgin Islands</td><td>.vi</td></tr><tr><td>Virgin Islands (UK)</td><td>.vg</td></tr><tr><td>Virgin Islands (US)</td><td>.vi</td></tr><tr><td>Wallis and Futuna</td><td>.wf</td></tr><tr><td>West Bank</td><td>.ps</td></tr><tr><td>Western Sahara</td><td>.eh</td></tr><tr><td>Western Samoa</td><td>.ws</td></tr><tr><td>Zambia</td><td>.zm</td></tr><tr><td>Zimbabwe</td><td>.zw</td></tr></table>

<h3>Reverse Lookup</h3>

<p>This list is ordered by the domain names, rather than countries, to allow you to find out which country a domain name represents.</p>

<table style="width: 70%;"><tr><td>Andorra</td><td>.ad</td></tr><tr><td>United Arab Emirates</td><td>.ae</td></tr><tr><td>Afghanistan</td><td>.af</td></tr><tr><td>Antigua and Barbuda</td><td>.ag</td></tr><tr><td>Anguilla</td><td>.ai</td></tr><tr><td>Albania</td><td>.al</td></tr><tr><td>Armenia</td><td>.am</td></tr><tr><td>Netherlands Antilles</td><td>.an</td></tr><tr><td>Angola</td><td>.ao</td></tr><tr><td>Antarctica</td><td>.aq</td></tr><tr><td>Argentina</td><td>.ar</td></tr><tr><td>American Samoa</td><td>.as</td></tr><tr><td>Austria</td><td>.at</td></tr><tr><td>Australia</td><td>.au</td></tr><tr><td>Aruba</td><td>.aw</td></tr><tr><td>Azerbaijan</td><td>.az</td></tr><tr><td>Bosnia and Herzegovina</td><td>.ba</td></tr><tr><td>Barbados</td><td>.bb</td></tr><tr><td>Bangladesh</td><td>.bd</td></tr><tr><td>Belgium</td><td>.be</td></tr><tr><td>Burkina Faso</td><td>.bf</td></tr><tr><td>Bulgaria</td><td>.bg</td></tr><tr><td>Bahrain</td><td>.bh</td></tr><tr><td>Burundi</td><td>.bi</td></tr><tr><td>Benin</td><td>.bj</td></tr><tr><td>Bermuda</td><td>.bm</td></tr><tr><td>Brunei</td><td>.bn</td></tr><tr><td>Bolivia</td><td>.bo</td></tr><tr><td>Brazil</td><td>.br</td></tr><tr><td>Bahamas, The</td><td>.bs</td></tr><tr><td>Bhutan</td><td>.bt</td></tr><tr><td>Bouvet Island</td><td>.bv</td></tr><tr><td>Botswana</td><td>.bw</td></tr><tr><td>Belarus</td><td>.by</td></tr><tr><td>Belize</td><td>.bz</td></tr><tr><td>Canada</td><td>.ca</td></tr><tr><td>Cocos (Keeling) Islands</td><td>.cc</td></tr><tr><td>Congo, Democratic Republic of the</td><td>.cd</td></tr><tr><td>Central African Republic</td><td>.cf</td></tr><tr><td>Congo, Republic of the</td><td>.cg</td></tr><tr><td>Switzerland</td><td>.ch</td></tr><tr><td>Cote d'Ivoire</td><td>.ci</td></tr><tr><td>Chile</td><td>.cl</td></tr><tr><td>Cameroon</td><td>.cm</td></tr><tr><td>China</td><td>.cn</td></tr><tr><td>Colombia</td><td>.co</td></tr><tr><td>Costa Rica</td><td>.cr</td></tr><tr><td>Serbia and Montenegro</td><td>.cs</td></tr><tr><td>Cuba</td><td>.cu</td></tr><tr><td>Cape Verde</td><td>.cv</td></tr><tr><td>Christmas Island</td><td>.cx</td></tr><tr><td>Cyprus</td><td>.cy</td></tr><tr><td>Czech Republic</td><td>.cz</td></tr><tr><td>Germany</td><td>.de</td></tr><tr><td>Djibouti</td><td>.dj</td></tr><tr><td>Denmark</td><td>.dk</td></tr><tr><td>Dominica</td><td>.dm</td></tr><tr><td>Dominican Republic</td><td>.do</td></tr><tr><td>Algeria</td><td>.dz</td></tr><tr><td>Ecuador</td><td>.ec</td></tr><tr><td>Estonia</td><td>.ee</td></tr><tr><td>Egypt</td><td>.eg</td></tr><tr><td>Western Sahara</td><td>.eh</td></tr><tr><td>Eritrea</td><td>.er</td></tr><tr><td>Spain</td><td>.es</td></tr><tr><td>Ethiopia</td><td>.et</td></tr><tr><td>Finland</td><td>.fi</td></tr><tr><td>Fiji</td><td>.fj</td></tr><tr><td>Falkland Islands (Islas Malvinas)</td><td>.fk</td></tr><tr><td>Micronesia, Federated States of</td><td>.fm</td></tr><tr><td>Faroe Islands</td><td>.fo</td></tr><tr><td>France</td><td>.fr</td></tr><tr><td>France, Metropolitan</td><td>.fx</td></tr><tr><td>Gabon</td><td>.ga</td></tr><tr><td>Grenada</td><td>.gd</td></tr><tr><td>Georgia</td><td>.ge</td></tr><tr><td>French Guiana</td><td>.gf</td></tr><tr><td>Guernsey</td><td>.gg</td></tr><tr><td>Ghana</td><td>.gh</td></tr><tr><td>Gibraltar</td><td>.gi</td></tr><tr><td>Greenland</td><td>.gl</td></tr><tr><td>Gambia, The</td><td>.gm</td></tr><tr><td>Guinea</td><td>.gn</td></tr><tr><td>Guadeloupe</td><td>.gp</td></tr><tr><td>Equatorial Guinea</td><td>.gq</td></tr><tr><td>Greece</td><td>.gr</td></tr><tr><td>South Georgia and the Islands</td><td>.gs</td></tr><tr><td>Guatemala</td><td>.gt</td></tr><tr><td>Guam</td><td>.gu</td></tr><tr><td>Guinea-Bissau</td><td>.gw</td></tr><tr><td>Guyana</td><td>.gy</td></tr><tr><td>Hong Kong</td><td>.hk</td></tr><tr><td>Heard Island and McDonald Islands</td><td>.hm</td></tr><tr><td>Honduras</td><td>.hn</td></tr><tr><td>Croatia</td><td>.hr</td></tr><tr><td>Haiti</td><td>.ht</td></tr><tr><td>Hungary</td><td>.hu</td></tr><tr><td>Indonesia</td><td>.id</td></tr><tr><td>Ireland</td><td>.ie</td></tr><tr><td>Israel</td><td>.il</td></tr><tr><td>Man, Isle of</td><td>.im</td></tr><tr><td>India</td><td>.in</td></tr><tr><td>British Indian Ocean Territory</td><td>.io</td></tr><tr><td>Iraq</td><td>.iq</td></tr><tr><td>Iran</td><td>.ir</td></tr><tr><td>Iceland</td><td>.is</td></tr><tr><td>Italy</td><td>.it</td></tr><tr><td>Jersey</td><td>.je</td></tr><tr><td>Jamaica</td><td>.jm</td></tr><tr><td>Jordan</td><td>.jo</td></tr><tr><td>Japan</td><td>.jp</td></tr><tr><td>Kenya</td><td>.ke</td></tr><tr><td>Kyrgyzstan</td><td>.kg</td></tr><tr><td>Cambodia</td><td>.kh</td></tr><tr><td>Kiribati</td><td>.ki</td></tr><tr><td>Comoros</td><td>.km</td></tr><tr><td>Saint Kitts and Nevis</td><td>.kn</td></tr><tr><td>Korea, North</td><td>.kp</td></tr><tr><td>Korea, South</td><td>.kr</td></tr><tr><td>Kuwait</td><td>.kw</td></tr><tr><td>Cayman Islands</td><td>.ky</td></tr><tr><td>Kazakhstan</td><td>.kz</td></tr><tr><td>Laos</td><td>.la</td></tr><tr><td>Lebanon</td><td>.lb</td></tr><tr><td>Saint Lucia</td><td>.lc</td></tr><tr><td>Liechtenstein</td><td>.li</td></tr><tr><td>Sri Lanka</td><td>.lk</td></tr><tr><td>Liberia</td><td>.lr</td></tr><tr><td>Lesotho</td><td>.ls</td></tr><tr><td>Lithuania</td><td>.lt</td></tr><tr><td>Luxembourg</td><td>.lu</td></tr><tr><td>Latvia</td><td>.lv</td></tr><tr><td>Libya</td><td>.ly</td></tr><tr><td>Morocco</td><td>.ma</td></tr><tr><td>Monaco</td><td>.mc</td></tr><tr><td>Moldova</td><td>.md</td></tr><tr><td>Madagascar</td><td>.mg</td></tr><tr><td>Marshall Islands</td><td>.mh</td></tr><tr><td>Macedonia</td><td>.mk</td></tr><tr><td>Mali</td><td>.ml</td></tr><tr><td>Burma</td><td>.mm</td></tr><tr><td>Mongolia</td><td>.mn</td></tr><tr><td>Macau</td><td>.mo</td></tr><tr><td>Northern Mariana Islands</td><td>.mp</td></tr><tr><td>Martinique</td><td>.mq</td></tr><tr><td>Mauritania</td><td>.mr</td></tr><tr><td>Montserrat</td><td>.ms</td></tr><tr><td>Malta</td><td>.mt</td></tr><tr><td>Mauritius</td><td>.mu</td></tr><tr><td>Maldives</td><td>.mv</td></tr><tr><td>Malawi</td><td>.mw</td></tr><tr><td>Mexico</td><td>.mx</td></tr><tr><td>Malaysia</td><td>.my</td></tr><tr><td>Mozambique</td><td>.mz</td></tr><tr><td>Namibia</td><td>.na</td></tr><tr><td>New Caledonia</td><td>.nc</td></tr><tr><td>Niger</td><td>.ne</td></tr><tr><td>Norfolk Island</td><td>.nf</td></tr><tr><td>Nigeria</td><td>.ng</td></tr><tr><td>Nicaragua</td><td>.ni</td></tr><tr><td>Netherlands</td><td>.nl</td></tr><tr><td>Norway</td><td>.no</td></tr><tr><td>Nepal</td><td>.np</td></tr><tr><td>Nauru</td><td>.nr</td></tr><tr><td>Niue</td><td>.nu</td></tr><tr><td>New Zealand</td><td>.nz</td></tr><tr><td>Oman</td><td>.om</td></tr><tr><td>Panama</td><td>.pa</td></tr><tr><td>Peru</td><td>.pe</td></tr><tr><td>French Polynesia</td><td>.pf</td></tr><tr><td>Papua New Guinea</td><td>.pg</td></tr><tr><td>Philippines</td><td>.ph</td></tr><tr><td>Pakistan</td><td>.pk</td></tr><tr><td>Poland</td><td>.pl</td></tr><tr><td>Saint Pierre and Miquelon</td><td>.pm</td></tr><tr><td>Pitcairn Islands</td><td>.pn</td></tr><tr><td>Puerto Rico</td><td>.pr</td></tr><tr><td>Gaza Strip</td><td>.ps</td></tr><tr><td>West Bank</td><td>.ps</td></tr><tr><td>Portugal</td><td>.pt</td></tr><tr><td>Palau</td><td>.pw</td></tr><tr><td>Paraguay</td><td>.py</td></tr><tr><td>Qatar</td><td>.qa</td></tr><tr><td>Reunion</td><td>.re</td></tr><tr><td>Romania</td><td>.ro</td></tr><tr><td>Russia</td><td>.ru</td></tr><tr><td>Rwanda</td><td>.rw</td></tr><tr><td>Saudi Arabia</td><td>.sa</td></tr><tr><td>Solomon Islands</td><td>.sb</td></tr><tr><td>Seychelles</td><td>.sc</td></tr><tr><td>Sudan</td><td>.sd</td></tr><tr><td>Sweden</td><td>.se</td></tr><tr><td>Singapore</td><td>.sg</td></tr><tr><td>Saint Helena</td><td>.sh</td></tr><tr><td>Slovenia</td><td>.si</td></tr><tr><td>Svalbard</td><td>.sj</td></tr><tr><td>Slovakia</td><td>.sk</td></tr><tr><td>Sierra Leone</td><td>.sl</td></tr><tr><td>San Marino</td><td>.sm</td></tr><tr><td>Senegal</td><td>.sn</td></tr><tr><td>Somalia</td><td>.so</td></tr><tr><td>Suriname</td><td>.sr</td></tr><tr><td>Sao Tome and Principe</td><td>.st</td></tr><tr><td>Soviet Union</td><td>.su</td></tr><tr><td>El Salvador</td><td>.sv</td></tr><tr><td>Syria</td><td>.sy</td></tr><tr><td>Swaziland</td><td>.sz</td></tr><tr><td>Turks and Caicos Islands</td><td>.tc</td></tr><tr><td>Chad</td><td>.td</td></tr><tr><td>French Southern and Antarctic Lands</td><td>.tf</td></tr><tr><td>Togo</td><td>.tg</td></tr><tr><td>Thailand</td><td>.th</td></tr><tr><td>Tajikistan</td><td>.tj</td></tr><tr><td>Tokelau</td><td>.tk</td></tr><tr><td>East Timor</td><td>.tl</td></tr><tr><td>Turkmenistan</td><td>.tm</td></tr><tr><td>Tunisia</td><td>.tn</td></tr><tr><td>Tonga</td><td>.to</td></tr><tr><td>Turkey</td><td>.tr</td></tr><tr><td>Trinidad and Tobago</td><td>.tt</td></tr><tr><td>Tuvalu</td><td>.tv</td></tr><tr><td>Taiwan</td><td>.tw</td></tr><tr><td>Tanzania</td><td>.tz</td></tr><tr><td>Ukraine</td><td>.ua</td></tr><tr><td>Uganda</td><td>.ug</td></tr><tr><td>United Kingdom</td><td>.uk</td></tr><tr><td>United States Minor Outlying Islands</td><td>.um</td></tr><tr><td>United States</td><td>.us</td></tr><tr><td>Uruguay</td><td>.uy</td></tr><tr><td>Uzbekistan</td><td>.uz</td></tr><tr><td>Holy See</td><td>.va</td></tr><tr><td>Saint Vincent and the Grenadines</td><td>.vc</td></tr><tr><td>Venezuela</td><td>.ve</td></tr><tr><td>British Virgin Islands</td><td>.vg</td></tr><tr><td>Virgin Islands (UK)</td><td>.vg</td></tr><tr><td>Virgin Islands</td><td>.vi</td></tr><tr><td>Virgin Islands (US)</td><td>.vi</td></tr><tr><td>Vietnam</td><td>.vn</td></tr><tr><td>Vanuatu</td><td>.vu</td></tr><tr><td>Wallis and Futuna</td><td>.wf</td></tr><tr><td>Samoa</td><td>.ws</td></tr><tr><td>Western Samoa</td><td>.ws</td></tr><tr><td>Mayotte</td><td>.yt</td></tr><tr><td>South Africa</td><td>.za</td></tr><tr><td>Zambia</td><td>.zm</td></tr><tr><td>Zimbabwe</td><td>.zw</td></tr></table> <br><br>]]></description>
				<pubDate>Fri, 07 Oct 2005 09:06:59 +0100</pubDate>
				<guid isPermaLink="false">http://www.addedbytes.com/blog/code/internet-country-codes/</guid>
				<dc:creator>Dave Child</dc:creator>
				<a href="/feeds/tag-feed/?tags=cheatsheet&amp;start=0" class="ditto_tag" rel="tag">cheatsheet</a>,<a href="/feeds/tag-feed/?tags=codes&amp;start=0" class="ditto_tag" rel="tag">codes</a>,<a href="/feeds/tag-feed/?tags=country&amp;start=0" class="ditto_tag" rel="tag">country</a>,<a href="/feeds/tag-feed/?tags=dns&amp;start=0" class="ditto_tag" rel="tag">dns</a>,<a href="/feeds/tag-feed/?tags=domain&amp;start=0" class="ditto_tag" rel="tag">domain</a>,<a href="/feeds/tag-feed/?tags=domains&amp;start=0" class="ditto_tag" rel="tag">domains</a>,<a href="/feeds/tag-feed/?tags=internet&amp;start=0" class="ditto_tag" rel="tag">internet</a>,<a href="/feeds/tag-feed/?tags=reference&amp;start=0" class="ditto_tag" rel="tag">reference</a>,<a href="/feeds/tag-feed/?tags=resources&amp;start=0" class="ditto_tag" rel="tag">resources</a>,<a href="/feeds/tag-feed/?tags=tld&amp;start=0" class="ditto_tag" rel="tag">tld</a>,<a href="/feeds/tag-feed/?tags=webdev&amp;start=0" class="ditto_tag" rel="tag">webdev</a>
			</item>

			<item>
				<title>Block Prefetching</title>
				<link>http://www.addedbytes.com/blog/block-prefetching/</link>
				<description><![CDATA[ <p>Mozilla and Google's prefetching functions are a nice addition to browser technology in many ways. Unsurprisingly, they are not very well thought through.</p> <p>Mozilla and Google's prefetching functions are a nice addition to browser technology in many ways. Unsurprisingly, they are not very well thought through. The main two problems with the prefetching idea are that it messes with log files and it means every link on a page could potentially be followed despite the consequences (dangerous in a site administration context).</p>

<p>It appears from the FAQ that Google only intends their accelerator to prefetch specific pages, that have been specified with the &lt;link&gt; tag. However, many people are claiming that normal links have been prefetched.</p>

<p>To prevent prefetching of a page is simple: add the following PHP to the page you do not want prefetched:</p>

<pre class="php">if ((isset($_SERVER['HTTP_X_MOZ'])) && ($_SERVER['HTTP_X_MOZ'] == 'prefetch')) {
    // This is a prefetch request. Block it.
    header('HTTP/1.0 403 Forbidden');
    echo '403: Forbidden&lt;br&gt;&lt;br&gt;Prefetching not allowed here.';
    die();
}</pre>

<p>This will serve a "forbidden" header to the prefetcher. Normal browsing should be unaffected.</p> <br><br>]]></description>
				<pubDate>Wed, 20 Apr 2005 16:16:00 +0100</pubDate>
				<guid isPermaLink="false">http://www.addedbytes.com/blog/block-prefetching/</guid>
				<dc:creator>Dave Child</dc:creator>
				<a href="/feeds/tag-feed/?tags=block&amp;start=0" class="ditto_tag" rel="tag">block</a>,<a href="/feeds/tag-feed/?tags=google&amp;start=0" class="ditto_tag" rel="tag">google</a>,<a href="/feeds/tag-feed/?tags=mozilla&amp;start=0" class="ditto_tag" rel="tag">mozilla</a>,<a href="/feeds/tag-feed/?tags=php&amp;start=0" class="ditto_tag" rel="tag">php</a>,<a href="/feeds/tag-feed/?tags=prefetching&amp;start=0" class="ditto_tag" rel="tag">prefetching</a>,<a href="/feeds/tag-feed/?tags=reference&amp;start=0" class="ditto_tag" rel="tag">reference</a>,<a href="/feeds/tag-feed/?tags=webdev&amp;start=0" class="ditto_tag" rel="tag">webdev</a>
			</item>

			<item>
				<title>The Box Model For Beginners</title>
				<link>http://www.addedbytes.com/articles/for-beginners/the-box-model-for-beginners/</link>
				<description><![CDATA[ An explanation of what the box model is and how it is treated by different user agents. <p>The term "box model" is often used by people when talking about CSS-based layouts and design. Not everyone understands what is meant by this though, and not everyone understands why it is so important.</p>

<p>Any HTML element can be considered a box, and so the box model applies to all HTML (and XHTML) elements.</p>

<p>The box model is the specification that defines how a box and its attributes relate to each other. In its simplest form, the box model tells browsers that a box defined as having width 100 pixels and height 50 pixels should be drawn 100 pixels wide and 50 pixels tall.</p>

<p>There is more you can add to a box, though, like padding, margins, borders, etc. This image should help explain what I'm about to run through:</p>

<p style="text-align:center;"><img src="content/box-model/box.png" alt="Outline of box model" /></p>

<p>As you can see, a box is made up of four distinct parts. The outside one, the margin, is completely invisible. It has no background color, and will not obstruct elements behind it. The margin is outside the second part, which is the border. The border outlines the visible portion of the element. Inside the border is the third part of the box, the padding, and then inside that the content area of the box. The padding defines the space between the content area of the box and the border.</p>

<p>(Note that in the image above, the only border of the three drawn that would actually be visible is the solid line - the dashed lines are added to help demonstrate the box model).</p>

<p>When you define a width and a height for your box using CSS, you are defining not the entire area taken up by the content, padding, border and margin. You are actually just defining the content area itself - the bit right in the middle. The padding, border and margin must be added to that in order to calculate the total space occupied by the box. (From this point on, we will use width for demonstrations, but the same principles apply to both width and height).</p>

<code>box {
    width: 200px;
    border: 10px solid #99c;
    padding: 20px;
    margin: 20px;
}</code>

<p>The above CSS, applied to a box, would mean that that box occupied 300 pixels of space horizontally on the page. The content of the box would occupy 200 pixels of that (dashed line added to demonstrate the edge of the area occupied by the box):</p>

<p style="text-align:center;"><img src="content/box-model/box_demo.png" alt="Box model demonstration." /></p>

<p>In the above image, you can see that the pale blue area is 240 pixels wide (200 pixels of content plus 20 pixels padding either side). The border is 10 pixels wide either side, making the total width including the border 260 pixels. The margin is 20 pixels either side, making the total width of the box 300 pixels.</p>

<p>In practice, this can cause some confusion. For example, if I have a 100 pixel wide space available, and want to fill it with a pale red box with a dark red border and a small amount of padding, it would be very easy to write the CSS like so:</p>

<code>box {
    width: 100px;
    border: 1px solid #900;
    padding: 10px;
    margin: 0;
    background: #fee;
}</code>

<p>(A declaration of 0, as used for the margin above, does not require a unit to be added. Any value other than 0 does require a unit, e.g. px for pixels. Also, although "background" is defined as a shorthand property, it is more widely supported than the more correct "background-color".)</p>

<p>However, that will not give us a 100 pixel wide box, as the width declaration defines the content area of the box. The content area of the box will be 100 pixels - the total width of the box as defined above will be 122 pixels:</p>

<p style="text-align:center;"><img src="content/box-model/box_demo2.png" alt="Box model demonstration." /></p>

<p>In order to set the above box to only occupy 100 pixels horizontally, you would need to set the width of the content area to be 100 pixels minus the padding and minus the border, in this case 78 pixels, like so:</p>

<code>box {
    width: <strong>78px</strong>;
    border: 1px solid #900;
    padding: 10px;
    margin: 0;
    background: #fee;
}</code>

<p>To calculate the overall width of a box, including all padding, borders and margins, you would use the following formula:</p>

<code>total box width = content area width + left padding + right padding + left border + right border + left margin + right margin</code>

<h3>Compatibility</h3>

<p>At this point, you should now have a good understanding of what the box model is, and how boxes <em>should</em> be treated by different browsers. However, as you will soon learn (if you did not know already), not every browser does as it is supposed to. In order to use boxes, and by extension make the most of CSS in your website, you will need to be aware of how the different browsers treat boxes in practice and how to overcome and work around the problems presented by these idiosyncrasies.</p>

<h3>Top Notch</h3>

<p><img src="images/browser_logos/opera6.gif" alt="Opera 6" /> <img src="images/browser_logos/opera7.gif" alt="Opera 7" /> <img src="images/browser_logos/mozilla.gif" alt="Mozilla" /> <img src="images/browser_logos/firefox.gif" alt="Firefox" /> <img src="images/browser_logos/camino.gif" alt="Camino" /> <img src="images/browser_logos/safari.gif" alt="Safari" /> <img src="images/browser_logos/konqueror.gif" alt="Konqueror" /> <img src="images/browser_logos/netscape6.gif" alt="Netscape 6" /> <img src="images/browser_logos/netscape7.gif" alt="Netscape 7" /> <img src="images/browser_logos/ie6.gif" alt="Internet Explorer 6" /></p>

<p>Most browsers released in the last few years have no problem with boxes and render boxes correctly. Opera 6 and 7, Mozilla 1 (and by extension other browsers based on the Gecko engine like Netscape 7, Camino and Firefox and other derivatives), Safari, Konquerer (and derivatives) and Internet Explorer 5 for the Mac are all shining examples of how a web browser <em>should</em> behave, all rendering boxes flawlessly. IE 6 for Windows also will render a box correctly, as long as the [url=http://www.addedbytes.com/design/dtds-explained]Document Type Definition[/url] for the page is correct.</p>

<h3>Whoops, Mrs Miggins, You're Sitting On My Artichokes</h3>

<p><img src="images/browser_logos/ie5.gif" alt="Internet Explorer 5" /> <img src="images/browser_logos/ie6.gif" alt="Internet Explorer 6" /></p>

<p>Some browsers don't display a box correctly. Unlike those below here, these browsers are widely enough used on the web that it is usually worth the effort to work through the problem. There are various methods for doing this, some better than others, that follow on. Most notable among the browsers with problems are Internet Explorers 4 and 5 and Internet Explorer 6. IE 6 is easy to work around, by adding a correct DTD (which you should be doing anyway).</p>

<p>Internet Explorer 5 is the main reason there is a box model problem at all. It, unfortunately, does not follow the simple definition for box layout as defined by the W3c. When you define a width for a box and it is rendered in IE5, instead of that width defining the content area of the box, it <em>includes the borders and padding</em>. Margins are added on to the content width correctly, but padding and borders are not. Unfortunately, this leaves us with some unpleasant choices:</p>

<ol><li><strong>Use a box model hack</strong><br />
Hack's like [url=http://www.tantek.com/CSS/Examples/boxmodelhack.html]Tantek's box model hack[/url] are unfortunately something of a necessity. While some might argue that using hacks like this is completely missing the point of using CSS for web design, commercial necessity and the prevalence of IE5 leave us with little in the way of choice. The IE5 box model hack is in use all over the web and has spawned plenty of variants.</li><li><strong>Add in extra code</strong><br />
Some might consider this a slightly "better" way of working around this problem. Rather than adding a style sheet hack, you can nest elements within each other. Adding a div within another div means that rather than using padding, you can use just margins, which are handled correctly by IE5. As with the box model hack, it is far from a perfect solution, but there are few other options if you want a site to look the same in IE5 as other more capable browsers.</li></ol>

<h3>Hall of Shame</h3>

<p><img src="images/browser_logos/ie4.gif" alt="Internet Explorer 4" /> <img src="images/browser_logos/netscape4.gif" alt="Netscape 4" /></p>

<p>On the one hand, the browsers that I am about to mention are appalling, all failing dismally to render a simple box correctly for one reason or another. On a more positive note, users of these browsers, mostly old versions of current browsers, make up an extremely small, and continually shrinking, portion of web users. While you could probably find a workaround for the bugs in the display of boxes in these browsers, it is almost certainly not worth the effort - you are likely to cause yourself more harm than good with workarounds for these!</p>

<p>Netscape 4's box model is awful, but even worse, the simple box model hacks to fix the problem for IE5 and IE6 will crash Netscape 4. Netscape 4's style sheet support is abysmal overall, and it is being supported less and less. Though it is strictly a personal choice, I don't think it is worth the time and effort to support Netscape 4 any more - it's just not used enough, and the number of users is only ever going to shrink.</p>

<p>Internet Explorer 4 suffers, basically, the same problem as IE5. It treats boxes in a very similar way. However, it falls over in far more ways, and many of the available hacks will crash IE4. As it is also used by few people, and that number is dropping, many designers ignore it.</p>

<h3>What does the future hold?</h3>

<p>CSS3 promises us the option to determine how we want the user agent to treat boxes, and specify which box model we want to use. Support for CSS3 at a level that will be possible is many many years away yet. Until then, we are stuck with the CSS2 box model, and while IE5 is still used by a significant percentage of the web's population, we are going to have problems with boxes.</p> <br><br>]]></description>
				<pubDate>Fri, 09 Jul 2004 11:48:54 +0100</pubDate>
				<guid isPermaLink="false">http://www.addedbytes.com/articles/for-beginners/the-box-model-for-beginners/</guid>
				<dc:creator>Dave Child</dc:creator>
				<a href="/feeds/tag-feed/?tags=box&amp;start=0" class="ditto_tag" rel="tag">box</a>,<a href="/feeds/tag-feed/?tags=boxmodel&amp;start=0" class="ditto_tag" rel="tag">boxmodel</a>,<a href="/feeds/tag-feed/?tags=css&amp;start=0" class="ditto_tag" rel="tag">css</a>,<a href="/feeds/tag-feed/?tags=design&amp;start=0" class="ditto_tag" rel="tag">design</a>,<a href="/feeds/tag-feed/?tags=html&amp;start=0" class="ditto_tag" rel="tag">html</a>,<a href="/feeds/tag-feed/?tags=model&amp;start=0" class="ditto_tag" rel="tag">model</a>,<a href="/feeds/tag-feed/?tags=reference&amp;start=0" class="ditto_tag" rel="tag">reference</a>,<a href="/feeds/tag-feed/?tags=tips&amp;start=0" class="ditto_tag" rel="tag">tips</a>,<a href="/feeds/tag-feed/?tags=tutorial&amp;start=0" class="ditto_tag" rel="tag">tutorial</a>,<a href="/feeds/tag-feed/?tags=webdesign&amp;start=0" class="ditto_tag" rel="tag">webdesign</a>,<a href="/feeds/tag-feed/?tags=webdev&amp;start=0" class="ditto_tag" rel="tag">webdev</a>
			</item>

			<item>
				<title>Flesch-Kincaid Reading Level</title>
				<link>http://www.addedbytes.com/blog/code/flesch-kincaid-function/</link>
				<description><![CDATA[ Functions to count the number of syllables in a word or sentence, and work out the readability of text. <p><strong><span style="color: #f00;">PLEASE NOTE:</span> This code is now considered out of date. An updated version has been released under an open source license as a Google Code project: <a href="http://code.google.com/p/php-text-statistics/">php-text-statistics</a>. There is more about this change in the post <a href="http://www.addedbytes.com/blog/readability-code-open-sourced/">Readability Code Open Sourced</a>.</strong></p>

<p>A tool for <a href="http://www.readability-score.com/">checking the readability scores of text</a> is available - this article covers the functions behind that tool.</p>

<p>Calculations based upon word structure can tell you a fair bit about the text on your site, most notably the readability of your copy. A lot of sites have text on them that is simply too advanced for their users, which is as useful as having no text at all.</p>

<p>It is therefore usually a good idea to check the copy on your website as thoroughly as possible. Spelling and grammar should be checked as a matter of course. You should also check how difficult your text is to read. If a user cannot easily understand what they are reading, they will leave the site and find one they can comprehend.</p>

<p>The following are two calculations that can give you an indicator of how easy your text is to read.</p>

<h3>Flesch-Kincaid Reading Ease</h3>

<p>The Flesch-Kincaid reading ease score is worked out using the following calculation, which gives a number. The higher that number is, the easier the text is to read.</p>

<code>206.835 - (1.015 * average_words_sentence) - (84.6 * average_syllables_word)</code>

<p>The function you will need to use to work this score out (in addition to the three at the bottom of this page) is:</p>

<code>function calculate_flesch($text) {
    return (206.835 - (1.015 * average_words_sentence($text)) - (84.6 * average_syllables_word($text)));
}</code>

<p>And you can call the function like so:</p>

<code>$flesh_score = calculate_flesch($text);</code>

<h3>Flesch-Kincaid Grade level</h3>

<p>The Flesch-Kincaid grade level is a similar calculation, however gives a number that corresponds to the grade a person will need to have reached to understand it. For example, a Grade level score of 8 means that an eighth grader will understand the text.</p>

<code>(.39 * average_words_sentence) + (11.8 * average_syllables_word) - 15.59</code>

<p>The function you will need to use to work this score out (in addition to the three at the bottom of this page) is:</p>

<code>function calculate_flesch_grade($text) {
    return ((.39 * average_words_sentence($text)) + (11.8 * average_syllables_word($text)) - 15.59);
}</code>

<p>And you can call the function like so:</p>

<code>$flesh_score = calculate_flesch_grade($text);</code>

<p>Both of the functions above make use of the functions below, so these will need to be included in your scripts in order for either function to be used.</p>

<p>Each score returned is not perfectly accurate. Unfortunately, it is not always possible to work out the number of syllables in a word programatically, and not always possible to correctly calculate the number of words per sentence, or indeed number of sentences, in text. However, the function will return a close approximation of the value - certainly good enough for our purposes.</p>

<p>Ideally, you should aim for a reading ease of around 60 to 70 (equivalent to a Grade level of around 6 to 8). The nearer 100 your text scores, the easier it is to read (and conversely, the lower the grade score, the easier the text is to read). Comics, for example, are usually in the 90s. The Harvard Law Review scores in the low 30s. Legal documents are usually lucky to make it into double figures.</p>

<p>The functions you will need in order to calculate the Flesch-Kincaid reading ease or Grade level of text are:</p>

<code>function average_words_sentence($text) {
    $sentences = strlen(preg_replace('/[^\.!?]/', '', $text));
    $words = strlen(preg_replace('/[^ ]/', '', $text));
    return ($words/$sentences);
}</code>

<code>function average_syllables_word($text) {
    $words = explode(' ', $text);
    for ($i = 0; $i &lt; count($words); $i++) {
        $syllables = $syllables + count_syllables($words[$i]);
    }
    return ($syllables/count($words));
}</code>

<code>function count_syllables($word) {

    $subsyl = Array(
        'cial'
        ,'tia'
        ,'cius'
        ,'cious'
        ,'giu'
        ,'ion'
        ,'iou'
        ,'sia$'
        ,'.ely$'
    );

    $addsyl = Array(
        'ia'
        ,'riet'
        ,'dien'
        ,'iu'
        ,'io'
        ,'ii'
        ,'[aeiouym]bl$'
        ,'[aeiou]{3}'
        ,'^mc'
        ,'ism$'
        ,'([^aeiouy])\1l$'
        ,'[^l]lien'
        ,'^coa[dglx].'
        ,'[^gq]ua[^auieo]'
        ,'dnt$'
    );

    // Based on Greg Fast's Perl module Lingua::EN::Syllables
    $word = preg_replace('/[^a-z]/is', '', strtolower($word));
    $word_parts = preg_split('/[^aeiouy]+/', $word);
    foreach ($word_parts as $key =&gt; $value) {
        if ($value &lt;&gt; '') {
            $valid_word_parts[] = $value;
        }
    }

    $syllables = 0;
    // Thanks to Joe Kovar for correcting a bug in the following lines
    foreach ($subsyl as $syl) { 
        $syllables -= preg_match('~'.$syl.'~', $word); 
    } 
    foreach ($addsyl as $syl) { 
        $syllables += preg_match('~'.$syl.'~', $word); 
    }
    if (strlen($word) == 1) {
        $syllables++;
    }
    $syllables += count($valid_word_parts);
    $syllables = ($syllables == 0) ? 1 : $syllables;
    return $syllables;
}</code>

<h3>Examples</h3>

<p>The following are two examples of text and the readability of that text.</p>

<p>The first is an excerpt from [url=http://www.online-literature.com/grahame/windwillows/]The Wind in the Willows[/url]. It is what most people would call easy to read:</p>

<code>"There's Toad Hall," said the Rat; "and that creek on the left, where the notice-board says, 'Private. No landing allowed,' leads to his boat-house, where we'll leave the boat. The stables are over there to the right. That's the banqueting-hall you're looking at now - very old, that is. Toad is rather rich, you know, and this is really one of the nicest houses in these parts, though we never admit as much to Toad."</code>

<p>For reading ease, this scored 69. It also had a Grade Level of 7. This particular passage of Wind in the Willows scores at almost exactly the same level web page text should ideally score.</p>

<p>On the other hand, the following (both this text and the above were generously provided by [url=http://members.dca.net/slawski]Bill Slawski[/url], by the way) is an excerpt from a legal document, and would give many a headache:</p>

<code>The foregoing warranties by each party are in lieu of all other warranties, express or implied, with respect to this agreement, including but not limited to implied warranties of merchantability and fitness for a particular purpose. Neither party shall have any liability whatsoever for any cover or setoff nor for any indirect, consequential, exemplary, incidental or punitive damages, including lost profits, even if such party has been advised of the possibility of such damages.</code>

<p>This scores an incredible -1 on the reading ease scale. The Grade Level required to read it? 22. This is what you could widely consider the most unreadable text you could add to a web page.</p>

<p>These are, perhaps, extreme examples, but they should give an idea of the differences between good and bad text on a web page.</p> <br><br>]]></description>
				<pubDate>Wed, 07 Jul 2004 14:17:00 +0100</pubDate>
				<guid isPermaLink="false">http://www.addedbytes.com/blog/code/flesch-kincaid-function/</guid>
				<dc:creator>Dave Child</dc:creator>
				<a href="/feeds/tag-feed/?tags=accessibility&amp;start=0" class="ditto_tag" rel="tag">accessibility</a>,<a href="/feeds/tag-feed/?tags=algorithm&amp;start=0" class="ditto_tag" rel="tag">algorithm</a>,<a href="/feeds/tag-feed/?tags=language&amp;start=0" class="ditto_tag" rel="tag">language</a>,<a href="/feeds/tag-feed/?tags=php&amp;start=0" class="ditto_tag" rel="tag">php</a>,<a href="/feeds/tag-feed/?tags=programming&amp;start=0" class="ditto_tag" rel="tag">programming</a>,<a href="/feeds/tag-feed/?tags=readability&amp;start=0" class="ditto_tag" rel="tag">readability</a>,<a href="/feeds/tag-feed/?tags=reading&amp;start=0" class="ditto_tag" rel="tag">reading</a>,<a href="/feeds/tag-feed/?tags=reference&amp;start=0" class="ditto_tag" rel="tag">reference</a>,<a href="/feeds/tag-feed/?tags=text&amp;start=0" class="ditto_tag" rel="tag">text</a>,<a href="/feeds/tag-feed/?tags=webdev&amp;start=0" class="ditto_tag" rel="tag">webdev</a>,<a href="/feeds/tag-feed/?tags=writing&amp;start=0" class="ditto_tag" rel="tag">writing</a>
			</item>

			<item>
				<title>Faux Columns for Liquid Layouts</title>
				<link>http://www.addedbytes.com/blog/code/faux-columns-for-liquid-layouts/</link>
				<description><![CDATA[ Using CSS for layouts can be a problem when using backgrounds for two columns that are not of equal length. This article expands on the solution to this problem from AListApart. <p>In January of 2004, <a href="http://simplebits.com/">Dan Cederholm</a> (author of <a href="http://www.amazon.co.uk/exec/obidos/ASIN/1590593812/tooyoo-21">Web Standards Solutions</a>) posted an article on <a href="http://www.alistapart.com">AListApart</a> entitled "<a href="http://www.alistapart.com/articles/fauxcolumns/">Faux Columns</a>". In it, he explained how designers can overcome a common problem in CSS-based designs.</p>

<p>The problem is one that usually rears its ugly head with two and three column designs (though for now, we'll just worry about two columns). If your two columns each have a different background color, how do you make the colours extend to the bottom of the page using css? Equal height columns are difficult to achieve using height and overflow properties. Each column will be of a different height, and you do not always know which is the taller of the two. It is all too easy to end up with a site where one column just doesn't extend all the way to the bottom of the page, where it should end.</p>

<p>CSS does actually include a rather nifty little tool that can be used to work around this problem, the "min-height" declaration, that allows you to specify a minimum height for an element - which you can use to ensure that one specific column is always larger than the other, allowing you to avoid this problem. Unfortunately (and perhaps unsurprisingly) Internet Explorer does not support this declaration, so in practice it isn't a useful solution to the problem.</p>

<p>Dan, in his article (which if you haven't read yet, I suggest you do before continuing), outlines a solution he uses on his own site. This solution involves tiling a background on the page, to give the appearance that there are distinct columns that extend the full length of the page. It's a simple but clever solution, and can be seen in use on a great many sites on the web.</p>

<p>During the recent redesign of this site, though, I came across a small problem. Though Dan's solution is perfect for fixed-width layouts, it just wouldn't work with a percentage-based, liquid layout. The problem was simple - a graphic cannot alter itself based upon the user's screen. If you come up with a background image like the below, and tile it on a page, the left hand column will need to be 200 pixels wide. If your column is 20% of the page, though, that could make it anything from 20 to 2000 pixels - and as a result your columns will rarely look as you intended. This makes equal height columns in liquid layouts a tricky proposal.</p>

<p>However, Dan's solution can be used to apply a background to a page when the layout is liquid, using background positioning.</p>

<p>Background positioning can allow us to give our background the appearance of being liquid. When you positioning a background using pixels, you position the top left corner of the image. When you position a background using percentages or keywords, you don't. Instead, you position a <em>point within the image itself</em>. For example, let's say we have a page and a simple background image. We use the following to set and position the background:</p>

<code>body {
    background-image: url("image.gif");
    background-repeat: no-repeat;
    background-position: 25% 10%;
}</code>

<p>The above will set "image.gif" as the background of the page. It will position the background 25% of the way across the page from the left, and 10% of the way down the page from the top. However, it is not the left hand corner that will appear at that point. It is the point 25% from the left hand side of the background image and 10% from the top that will appear at that point, like so:</p>

<p style="text-align: center;"><img src="content/faux-columns-for-liquid-layouts/faux-example.gif" alt="Example of background positioning based upon percentages" /></p>

<p>We can use this to apply a background to a page that will give the illusion of a pair of columns, even though the columns are not of a fixed width. Let's say we have two columns (for now), of 25% and 75% width. We can create a simple image, 1 pixel tall by 2000 pixels wide (why so wide will become apparent shortly - but don't be afraid to go even larger if you wish - 4000 pixels wouldn't necessarily be a bad thing). We want the left column to be a nice shade of orange, and the right a nice shade of grey, with a black line to divide them. So the image needs to have a black line 25% of the way along, with everything to the left orange and everything to the right grey, like so (scaled for visibility):</p>

<p style="text-align: center;"><img src="content/faux-columns-for-liquid-layouts/faux-example2.gif" alt="Example of background image" /></p>

<p>Now, we position the background using the following CSS:</p>

<code>body {
    background-image: url("background.gif");
    background-repeat: repeat-y;
    background-position: 25% 0;
}</code>

<p>Now, if you were to draw a line down the page, 25% of the way across from the left hand side, then 25% of our background image would be to the left of that line and 75% to the right. If we use the 2000 pixel wide background mentioned earlier, and position it as above, we'll have an orange background for 25% of the page, a black line, then grey will fill the remaining 75% of the page. You can <a href="http://www.addedbytes.com/content/faux-columns-for-liquid-layouts/faux1.html">see an example of that here</a>. If you resize your browser window, while viewing the example, you will see the columns expand and contract to maintain the same proportions of the columns. With a little imagination, and the use of partly transparent background images, you can create image borders between elements using the same technique.</p>

<p>A little markup and a little more CSS, and we can turn the above into a respectable liquid page, with columns that expand and contract with the users' windows, and always extend just as far as they are needed. A <a href="http://www.addedbytes.com/content/faux-columns-for-liquid-layouts/faux2.html">more complete example is here</a>, and this technique is also in use at this very site [please note that this technique is in use in versions 3, 4 and 5 of this site, accessible through the footer], allowing the flexible navigation and content columns to always appear equal in length, despite the fact they almost never are.</p> <br><br>]]></description>
				<pubDate>Tue, 22 Jun 2004 17:31:13 +0100</pubDate>
				<guid isPermaLink="false">http://www.addedbytes.com/blog/code/faux-columns-for-liquid-layouts/</guid>
				<dc:creator>Dave Child</dc:creator>
				<a href="/feeds/tag-feed/?tags=css&amp;start=0" class="ditto_tag" rel="tag">css</a>,<a href="/feeds/tag-feed/?tags=design&amp;start=0" class="ditto_tag" rel="tag">design</a>,<a href="/feeds/tag-feed/?tags=faux&amp;start=0" class="ditto_tag" rel="tag">faux</a>,<a href="/feeds/tag-feed/?tags=fluid&amp;start=0" class="ditto_tag" rel="tag">fluid</a>,<a href="/feeds/tag-feed/?tags=hacks&amp;start=0" class="ditto_tag" rel="tag">hacks</a>,<a href="/feeds/tag-feed/?tags=html&amp;start=0" class="ditto_tag" rel="tag">html</a>,<a href="/feeds/tag-feed/?tags=layout&amp;start=0" class="ditto_tag" rel="tag">layout</a>,<a href="/feeds/tag-feed/?tags=liquid&amp;start=0" class="ditto_tag" rel="tag">liquid</a>,<a href="/feeds/tag-feed/?tags=reference&amp;start=0" class="ditto_tag" rel="tag">reference</a>,<a href="/feeds/tag-feed/?tags=tutorial&amp;start=0" class="ditto_tag" rel="tag">tutorial</a>,<a href="/feeds/tag-feed/?tags=web&amp;start=0" class="ditto_tag" rel="tag">web</a>,<a href="/feeds/tag-feed/?tags=webdesign&amp;start=0" class="ditto_tag" rel="tag">webdesign</a>
			</item>

			<item>
				<title>HTTP Status Codes for Beginners</title>
				<link>http://www.addedbytes.com/articles/for-beginners/http-status-codes/</link>
				<description><![CDATA[ All valid HTTP 1.1 Status Codes simply explained. <p>HTTP, Hypertext Transfer Protocol, is the method by which clients (i.e. you) and servers communicate. When someone clicks a link, types in a URL or submits out a form, their browser sends a request to a server for information. It might be asking for a page, or sending data, but either way, that is called an HTTP Request. When a server receives that request, it sends back an HTTP Response, with information for the client. Usually, this is invisible, though I'm sure you've seen one of the very common Response codes - 404, indicating a page was not found. There are a fair few more status codes sent by servers, and the following is a list of the current ones in HTTP 1.1, along with an explanation of their meanings.</p>

<p>A more technical breakdown of HTTP 1.1 status codes and their meanings is available at <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html</a>. There are several versions of HTTP, but currently HTTP 1.1 is the most widely used.</p>

<h3>Informational</h3>

<ul><li class="reference"><strong>100 - Continue</strong><br />A status code of 100 indicates that (usually the first) part of a request has been received without any problems, and that the rest of the request should now be sent.</li><li class="reference"><strong>101 - Switching Protocols</strong><br />HTTP 1.1 is just one type of protocol for transferring data on the web, and a status code of 101 indicates that the server is changing to the protocol it defines in the "Upgrade" header it returns to the client. For example, when requesting a page, a browser might receive a statis code of 101, followed by an "Upgrade" header showing that the server is changing to a different version of HTTP.</li></ul>

<h3>Successful</h3>

<ul><li class="reference"><strong>200 - OK</strong><br />The 200 status code is by far the most common returned. It means, simply, that the request was received and understood and is being processed.</li><li class="reference"><strong>201 - Created</strong><br />A 201 status code indicates that a request was successful and as a result, a resource has been created (for example a new page).</li><li class="reference"><strong>202 - Accepted</strong><br />The status code 202 indicates that server has received and understood the request, and that it has been accepted for processing, although it may not be processed immediately.</li><li class="reference"><strong>203 - Non-Authoritative Information</strong><br />A 203 status code means that the request was received and understood, and that information sent back about the response is from a third party, rather than the original server. This is virtually identical in meaning to a 200 status code.</li><li class="reference"><strong>204 - No Content</strong><br />The 204 status code means that the request was received and understood, but that there is no need to send any data back.</li><li class="reference"><strong>205 - Reset Content</strong><br />The 205 status code is a request from the server to the client to reset the document from which the original request was sent. For example, if a user fills out a form, and submits it, a status code of 205 means the server is asking the browser to clear the form.</li><li class="reference"><strong>206 - Partial Content</strong><br />A status code of 206 is a response to a request for part of a document. This is used by advanced caching tools, when a user agent requests only a small part of a page, and just that section is returned.</li></ul>

<h3>Redirection</h3>

<ul><li class="reference"><strong>300 - Multiple Choices</strong><br />The 300 status code indicates that a resource has moved. The response will also include a list of locations from which the user agent can select the most appropriate.</li><li class="reference"><strong>301 - Moved Permanently</strong><br />A status code of 301 tells a client that the resource they asked for has permanently moved to a new location. The response should also include this location. It tells the client to use the new URL the next time it wants to fetch the same resource.</li><li class="reference"><strong>302 - Found</strong><br />A status code of 302 tells a client that the resource they asked for has temporarily moved to a new location. The response should also include this location. It tells the client that it should carry on using the same URL to access this resource.</li><li class="reference"><strong>303 - See Other</strong><br />A 303 status code indicates that the response to the request can be found at the specified URL, and should be retrieved from there. It does not mean that something has moved - it is simply specifying the address at which the response to the request can be found.</li><li class="reference"><strong>304 - Not Modified</strong><br />The 304 status code is sent in response to a request (for a document) that asked for the document only if it was newer than the one the client already had. Normally, when a document is cached, the date it was cached is stored. The next time the document is viewed, the client asks the server if the document has changed. If not, the client just reloads the document from the cache.</li><li class="reference"><strong>305 - Use Proxy</strong><br />A 305 status code tells the client that the requested resource has to be reached through a proxy, which will be specified in the response.</li><li class="reference"><strong>307 - Temporary Redirect</strong><br />307 is the status code that is sent when a document is temporarily available at a different URL, which is also returned. There is very little difference between a 302 status code and a 307 status code. 307 was created as another, less ambiguous, version of the 302 status code.</li></ul>

<h3>Client Error</h3>

<ul><li class="reference"><strong>400 - Bad Request</strong><br />A status code of 400 indicates that the server did not understand the request due to bad syntax.</li><li class="reference"><strong>401 - Unauthorized</strong><br />A 401 status code indicates that before a resource can be accessed, the client must be authorised by the server.</li><li class="reference"><strong>402 - Payment Required</strong><br />The 402 status code is not currently in use, being listed as "reserved for future use".</li><li class="reference"><strong>403 - Forbidden</strong><br />A 403 status code indicates that the client cannot access the requested resource. That might mean that the wrong username and password were sent in the request, or that the permissions on the server do not allow what was being asked.</li><li class="reference"><strong>404 - Not Found</strong><br />The best known of them all, the 404 status code indicates that the requested resource was not found at the URL given, and the server has no idea how long for.</li><li class="reference"><strong>405 - Method Not Allowed</strong><br />A 405 status code is returned when the client has tried to use a request method that the server does not allow. Request methods that are allowed should be sent with the response (common request methods are POST and GET).</li><li class="reference"><strong>406 - Not Acceptable</strong><br />The 406 status code means that, although the server understood and processed the request, the response is of a form the client cannot understand. A client sends, as part of a request, headers indicating what types of data it can use, and a 406 error is returned when the response is of a type not i that list.</li><li class="reference"><strong>407 - Proxy Authentication Required</strong><br />The 407 status code is very similar to the 401 status code, and means that the client must be authorised by the proxy before the request can proceed.</li><li class="reference"><strong>408 - Request Timeout</strong><br />A 408 status code means that the client did not produce a request quickly enough. A server is set to only wait a certain amount of time for responses from clients, and a 408 status code indicates that time has passed.</li><li class="reference"><strong>409 - Conflict</strong><br />A 409 status code indicates that the server was unable to complete the request, often because a file would need to be editted, created or deleted, and that file cannot be editted, created or deleted.</li><li class="reference"><strong>410 - Gone</strong><br />A 410 status code is the 404's lesser known cousin. It indicates that a resource has permanently gone (a 404 status code gives no indication if a resource has gine permanently or temporarily), and no new address is known for it.</li><li class="reference"><strong>411 - Length Required</strong><br />The 411 status code occurs when a server refuses to process a request because a content length was not specified.</li><li class="reference"><strong>412 - Precondition Failed</strong><br />A 412 status code indicates that one of the conditions the request was made under has failed.</li><li class="reference"><strong>413 - Request Entity Too Large</strong><br />The 413 status code indicates that the request was larger than the server is able to handle, either due to physical constraints or to settings. Usually, this occurs when a file is sent using the POST method from a form, and the file is larger than the maximum size allowed in the server settings.</li><li class="reference"><strong>414 - Request-URI Too Long</strong><br />The 414 status code indicates the the URL requested by the client was longer than it can process.</li><li class="reference"><strong>415 - Unsupported Media Type</strong><br />A 415 status code is returned by a server to indicate that part of the request was in an unsupported format.</li><li class="reference"><strong>416 - Requested Range Not Satisfiable</strong><br />A 416 status code indicates that the server was unable to fulfill the request. This may be, for example, because the client asked for the 800th-900th bytes of a document, but the document was only 200 bytes long.</li><li class="reference"><strong>417 - Expectation Failed</strong><br />The 417 status code means that the server was unable to properly complete the request. One of the headers sent to the server, the "Expect" header, indicated an expectation the server could not meet.</li></ul>

<h3>Server Error</h3>

<ul><li class="reference"><strong>500 - Internal Server Error</strong><br />A 500 status code (all too often seen by Perl programmers) indicates that the server encountered something it didn't expect and was unable to complete the request.</li><li class="reference"><strong>501 - Not Implemented</strong><br />The 501 status code indicates that the server does not support all that is needed for the request to be completed.</li><li class="reference"><strong>502 - Bad Gateway</strong><br />A 502 status code indicates that a server, while acting as a proxy, received a response from a server further upstream that it judged invalid.</li><li class="reference"><strong>503 - Service Unavailable</strong><br />A 503 status code is most often seen on extremely busy servers, and it indicates that the server was unable to complete the request due to a server overload.</li><li class="reference"><strong>504 - Gateway Timeout</strong><br />A 504 status code is returned when a server acting as a proxy has waited too long for a response from a server further upstream.</li><li class="reference"><strong>505 - HTTP Version Not Supported</strong><br />A 505 status code is returned when the HTTP version indicated in the request is no supported. The response should indicate which HTTP versions are supported.</li></ul> <br><br>]]></description>
				<pubDate>Tue, 11 May 2004 15:33:55 +0100</pubDate>
				<guid isPermaLink="false">http://www.addedbytes.com/articles/for-beginners/http-status-codes/</guid>
				<dc:creator>Dave Child</dc:creator>
				<a href="/feeds/tag-feed/?tags=apache&amp;start=0" class="ditto_tag" rel="tag">apache</a>,<a href="/feeds/tag-feed/?tags=codes&amp;start=0" class="ditto_tag" rel="tag">codes</a>,<a href="/feeds/tag-feed/?tags=development&amp;start=0" class="ditto_tag" rel="tag">development</a>,<a href="/feeds/tag-feed/?tags=html&amp;start=0" class="ditto_tag" rel="tag">html</a>,<a href="/feeds/tag-feed/?tags=http&amp;start=0" class="ditto_tag" rel="tag">http</a>,<a href="/feeds/tag-feed/?tags=reference&amp;start=0" class="ditto_tag" rel="tag">reference</a>,<a href="/feeds/tag-feed/?tags=rest&amp;start=0" class="ditto_tag" rel="tag">rest</a>,<a href="/feeds/tag-feed/?tags=software&amp;start=0" class="ditto_tag" rel="tag">software</a>,<a href="/feeds/tag-feed/?tags=status&amp;start=0" class="ditto_tag" rel="tag">status</a>,<a href="/feeds/tag-feed/?tags=tools&amp;start=0" class="ditto_tag" rel="tag">tools</a>,<a href="/feeds/tag-feed/?tags=web&amp;start=0" class="ditto_tag" rel="tag">web</a>,<a href="/feeds/tag-feed/?tags=webdev&amp;start=0" class="ditto_tag" rel="tag">webdev</a>
			</item>

			<item>
				<title>VBScript Date Format Functions</title>
				<link>http://www.addedbytes.com/blog/code/vbscript-date-format-functions/</link>
				<description><![CDATA[ Date formatting in VBScript is not quite as powerful as PHP. This function gives you plenty more ways to format dates and times in VBScript with the minimum of effort. <p>VBScript's date formatting doesn't offer a huge number of options compared to PHP's date() function. While it's relatively easy to just write small snippets of code every time you need to format a date a specific way, life would be much easier if there was a function you could call on time and again to do the work for you.</p>

<p>Below, you will find three date format functions, all of which make some use of Unix timestamps, a concept most ASP developers will not be familiar with. Unix timestamps are defined as the number of seconds since the epoch, 00:00:00 01/01/1970, and are a very sensible way to store dates and times in a database, in my opinion. They are very easy to work with, especially when selecting data from a database, and once you are used to them, they can make life much much simpler.</p>

<p><em>NOTE: These functions were updated on the 15th March 2004 to fix a couple of known bugs. In addition, any scripts using these functions may need to be tweaked to take account of your locale. Each locale will use a slightly different date and time format, so please check yours before using these functions, or simply set your locale to UK. To set your locale to UK, you can use the code below:</em></p>

<pre class="php">&lt;%@LANGUAGE=VBSCRIPT" LCID=2057%&gt;</pre>

<p><em>There is also a [url=http://www.microsoft.com/globaldev/reference/lcid-all.mspx]complete list of valid locales[/url] on the Microsoft website, with the values in the right hand column being the ones you will want.</em></p>

<p><em>Finally, the "monthname" function is VBScript is not present in every version, so may need to be defined manually. Please see comments on this article for an example.</em></p>

<p>The first function, UDate(), will convert a normal date into a Unix timestamp. The second function, unUDate(), simply does the reverse, converting any timestamp into a readable date. The last function takes a date and a format string, and returns a formatted date according to what you put into the formatting string.</p>

<h3>UDate()</h3>

<pre class="php">function UDate(oldDate)
    UDate = DateDiff("s", "01/01/1970 00:00:00", oldDate)
end function</pre>

<p>In practice, UDate is very easy to use. For example, if you want to know the current Unix time (the number of seconds since the epoch), you would use something like the following, which would give intCurrent_Unix_Time a value of 1069916571 at the time of writing.</p>

<pre class="php">intCurrent_Unix_Time = UDate(Now())</pre>

<h3>unUDate()</h3>

<pre class="php">function unUDate(intTimeStamp)
    unUDate = DateAdd("s", intTimeStamp, "01/01/1970 00:00:00")
end function</pre>

<p>unUDate is as easy to use as UDate. Simply feed in an integer, and it will return a matching date. It will treat the integer as the number of seconds between the epoch and the desired date, and will return a properly formatted date for normal use in VBScript accordingly.</p>
	
<h3>formatDate()</h3>

<p>Now here's where it starts to get tricky. formatDate is also quite easy to use, but only once you get the hang of how it works. As you can see from the below, formatDate requires two values to be passed to it. The first, format, is a string telling the function how you would like the date formatted, and the second, intTimeStamp, can be either a Unix timestamp (preferred) or a normal VBScript date.</p>

<p>The format of the string is what we want to make use of to lay out our dates exactly as we would like, and perhaps this is best shown with an example. I would like a date displayed on my site in the following format: "7:11am, Thursday 27th November, 2003". In normal VBScript that would be a pain to format - I'd probably just end up giving up and using the normal VBLongTime and VBLongDate to display something similar. I would prefer complete control though...</p>

<p>The format string for formatDate can include a whole selection of characters to represent certain date or time entities. There's a table of the ones included in this function just below here. The format string needs to include these entities where it wants them to be replaced by the correct time or date value. To get the above formatted date and time, then, I could use the following:</p>

<pre class="php">strDateTime = formatDate(<strong>"%g:%i%a, %l %j%O %F, %Y"</strong>, UDate(Now()))</pre>

<p>That looks a lot harder than it actually is. To tell the function we are aiming to replace a specific entity in the string with a time or date element, we use a symbol made up of a percent sign (%) and a letter. It is a case sensitive function, so be careful you form your format strings correctly. Without further ado, here's a list of the entities you can include in the format string (anything in the string that is not an entity from the list below will still be in the string when it has been processed).</p>

<ul><li><span class="listpad">%A</span> - AM or PM</li>
<li><span class="listpad">%a</span> - am or pm</li>
<li><span class="listpad">%m</span> - Month with leading zeroes (01 - 12)</li>
<li><span class="listpad">%n</span> - Month without leading zeroes (1 - 12)</li>
<li><span class="listpad">%F</span> - Month name (January - December)</li>
<li><span class="listpad">%M</span> - Three letter month name (Jan - Dec)</li>
<li><span class="listpad">$d</span> - Day with leading zeroes (01 - 31)</li>
<li><span class="listpad">%j</span> - Day without leading zeroes (1 - 31)</li>
<li><span class="listpad">%H</span> - Hour with leading zeroes (12 hour)</li>
<li><span class="listpad">%h</span> - Hour with leading zeroes (24 hour)</li>
<li><span class="listpad">%G</span> - Hour without leading zeroes (12 hour)</li>
<li><span class="listpad">%g</span> - Hour without leading zeroes (24 hour)</li>
<li><span class="listpad">%i</span> - Minute with leading zeroes (01 to 60)</li>
<li><span class="listpad">%I</span> - Minute without leading zeroes (1 to 60)</li>
<li><span class="listpad">%s</span> - Second with leading zeroes (01 to 60)</li>
<li><span class="listpad">%S</span> - Second without leading zeroes (1 to 60)</li>
<li><span class="listpad">%L</span> - Number of day of week (1 to 7)</li>
<li><span class="listpad">%l</span> - Name of day of week (Sunday to Saturday)</li>
<li><span class="listpad">%D</span> - Three letter name of day of week (Sun to Sat)</li>
<li><span class="listpad">%O</span> - Ordinal suffix (st, nd rd, th)</li>
<li><span class="listpad">%U</span> - UNIX Timestamp</li>
<li><span class="listpad">%Y</span> - Four digit year (2003)</li>
<li><span class="listpad">%y</span> - Two digit year (03)</li></ul>

<p>You can include any of the above in the format string at any point. I would recommend not using a percentage sign if you can help it (except obviously as part of one of the elements above), and in the same vein, using ordinals anywhere except after a number is slightly foolish.</p>

<p>If you would like to see anything else added to the list, above, please email me and I will see what I can do.</p>

<p>The below is the formatDate function itself. To use, simply copy and paste it into a script or include file and call it as above, with whichever format string you require.</p>

<pre class="php">function formatDate(format, intTimeStamp)
    dim unUDate, A

    ' Test to see if intTimeStamp looks valid. If not, they have passed a normal date
    if not (isnumeric(intTimeStamp)) then
        if isdate(intTimeStamp) then
            intTimeStamp = DateDiff("S", "01/01/1970 00:00:00", intTimeStamp)
        else
            response.write "Date Invalid"
            exit function
        end if
    end if
    
    if (intTimeStamp=0) then 
        unUDate = now()
    else
        unUDate = DateAdd("s", intTimeStamp, "01/01/1970 00:00:00")
    end if

    unUDate = trim(unUDate)

    dim startM : startM = InStr(1, unUDate, "/", vbTextCompare) + 1
    dim startY : startY = InStr(startM, unUDate, "/", vbTextCompare) + 1
    dim startHour : startHour = InStr(startY, unUDate, " ", vbTextCompare) + 1
    dim startMin : startMin = InStr(startHour, unUDate, ":", vbTextCompare) + 1

    dim dateDay : dateDay = mid(unUDate, 1, 2)
    dim dateMonth : dateMonth = mid(unUDate, startM, 2)
    dim dateYear : dateYear = mid(unUDate, startY, 4)
    dim dateHour : dateHour = mid(unUDate, startHour, 2)
    dim dateMinute : dateMinute = mid(unUDate, startMin, 2)
    dim dateSecond : dateSecond = mid(unUDate, InStr(startMin, unUDate, ":", vbTextCompare) + 1, 2)

    format = replace(format, "%Y", right(dateYear, 4))
    format = replace(format, "%y", right(dateYear, 2))
    format = replace(format, "%m", dateMonth)
    format = replace(format, "%n", cint(dateMonth))
    format = replace(format, "%F", monthname(cint(dateMonth)))
    format = replace(format, "%M", left(monthname(cint(dateMonth)), 3))
    format = replace(format, "%d", dateDay)
    format = replace(format, "%j", cint(dateDay))
    format = replace(format, "%h", mid(unUDate, startHour, 2))
    format = replace(format, "%g", cint(mid(unUDate, startHour, 2)))

    if (cint(dateHour) &gt; 12) then
        A = "PM"
    else
        A = "AM"
    end if
    format = replace(format, "%A", A)
    format = replace(format, "%a", lcase(A))

    if (A = "PM") then format = replace(format, "%H", left("0" &amp; dateHour - 12, 2))
    format = replace(format, "%H", dateHour)
    if (A = "PM") then format = replace(format, "%G", left("0" &amp; cint(dateHour) - 12, 2))
    format = replace(format, "%G", cint(dateHour))

    format = replace(format, "%i", dateMinute)
    format = replace(format, "%I", cint(dateMinute))
    format = replace(format, "%s", dateSecond)
    format = replace(format, "%S", cint(dateSecond))
    format = replace(format, "%L", WeekDay(unUDate))
    format = replace(format, "%D", left(WeekDayName(WeekDay(unUDate)), 3))
    format = replace(format, "%l", WeekDayName(WeekDay(unUDate)))
    format = replace(format, "%U", intTimeStamp)
    format = replace(format, "11%O", "11th")
    format = replace(format, "1%O", "1st")
    format = replace(format, "12%O", "12th")
    format = replace(format, "2%O", "2nd")
    format = replace(format, "13%O", "13th")
    format = replace(format, "3%O", "3rd")
    format = replace(format, "%O", "th")

    formatDate = format

end function</pre> <br><br>]]></description>
				<pubDate>Mon, 15 Mar 2004 14:07:00 +0000</pubDate>
				<guid isPermaLink="false">http://www.addedbytes.com/blog/code/vbscript-date-format-functions/</guid>
				<dc:creator>Dave Child</dc:creator>
				<a href="/feeds/tag-feed/?tags=asp&amp;start=0" class="ditto_tag" rel="tag">asp</a>,<a href="/feeds/tag-feed/?tags=date&amp;start=0" class="ditto_tag" rel="tag">date</a>,<a href="/feeds/tag-feed/?tags=development&amp;start=0" class="ditto_tag" rel="tag">development</a>,<a href="/feeds/tag-feed/?tags=javascript&amp;start=0" class="ditto_tag" rel="tag">javascript</a>,<a href="/feeds/tag-feed/?tags=programming&amp;start=0" class="ditto_tag" rel="tag">programming</a>,<a href="/feeds/tag-feed/?tags=reference&amp;start=0" class="ditto_tag" rel="tag">reference</a>,<a href="/feeds/tag-feed/?tags=scripts&amp;start=0" class="ditto_tag" rel="tag">scripts</a>,<a href="/feeds/tag-feed/?tags=time&amp;start=0" class="ditto_tag" rel="tag">time</a>,<a href="/feeds/tag-feed/?tags=unix&amp;start=0" class="ditto_tag" rel="tag">unix</a>,<a href="/feeds/tag-feed/?tags=vb&amp;start=0" class="ditto_tag" rel="tag">vb</a>,<a href="/feeds/tag-feed/?tags=vbscript&amp;start=0" class="ditto_tag" rel="tag">vbscript</a>,<a href="/feeds/tag-feed/?tags=webdesign&amp;start=0" class="ditto_tag" rel="tag">webdesign</a>
			</item>
	</channel>
</rss>