Tagged with "reference" http://www.addedbytes.com/feeds/tag-feed/ en Web Development in Brighton - Added Bytes 2006 120 Text Readability Scores http://www.addedbytes.com/blog/code/readability-score/ This tool has moved! It's now on its own domain, at Readability-Score.com. (It's also had a small makeover and is now full of speedy AJAXy goodness.)

The code that powers the tool is still available on GitHub.



]]>
Wed, 07 Jul 2004 15:14:59 +0100 http://www.addedbytes.com/blog/code/readability-score/ Dave Child ,,,,,,,,,,
PHP Querystring Functions http://www.addedbytes.com/blog/code/php-querystring-functions/ 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.



Add Querystring Variable



A PHP function that will add the querystring variable $key with a value $value to $ur

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.

Add Querystring Variable

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.

function add_querystring_var($url, $key, $value) {
    $url = preg_replace('/(.*)(?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&');
    $url = substr($url, 0, -1);
    if (strpos($url, '?') === false) {
        return ($url . '?' . $key . '=' . $value);
    } else {
        return ($url . '&' . $key . '=' . $value);
    }
}

Remove Querystring Variable

A PHP function that will remove the variable $key and its value from the given $url.

function remove_querystring_var($url, $key) {
    $url = preg_replace('/(.*)(?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&');
    $url = substr($url, 0, -1);
    return ($url);
}


]]>
Tue, 05 Dec 2006 15:41:30 +0000 http://www.addedbytes.com/blog/code/php-querystring-functions/ Dave Child ,,,,,,,,,,
Jargon Explained http://www.addedbytes.com/articles/online-marketing/jargon-explained/ Anchor Text

Anchor text is the text used to link to another site. In this example - Google Web Search - the anchor text is "Google Web Search".

Atom

Atom is a file format used for web feeds. It is a type of XML document, and is used in syndication.

Black Hat

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 can result in a site being penalised or removed from search engine listings. Black Hat is the opposite of White Hat.

ccTLD

A ccTLD is a country-code top level domain. .uk, for example, is a ccTLD, as are .au (Australia), .de (Germany), .fr (France), .ca (Canada) and .nz (New Zealand).

Click-through Rate

See CTR.

Cloaking

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 conversions from that page. Search engines dislike this technique and many sites are banned for using it. It is a Black Hat technique.

Conversion

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.

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 Are Cookies Dangerous?

CPA

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 conversion, be that a sale or a signup.

CPC

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.

CPM

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.

Crawler

See Spider.

CTR

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%.

Directory

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 spider, and often a small fee is charged for this addition.

Data Center

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.

Doorway Page

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 Black Hat technique.

Feed

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 syndication purposes. Using feeds and programs designed to use feeds, users can often keep up to date with many hundreds of websites.

FFA

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.

Google Dance

The Google Dance is the name for the process Google used to go through very regularly when it updated an algorithm. As various data centres 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.

Hit

A "hit" can mean one of two things.

  • When searching the web, a hit can be a result found by a search engines that matches the search criteria.
  • 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.

IBL

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).

Impression

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.

Keyword

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.

Keyphrase

A keyphrase is very similar to a keyword, except that it is a phrase made up of several words.

Keyword Stuffing

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.

Link Building

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.

Meta Data / Meta Tag

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 Meta Tags.

Page Title

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.

PageRank / PR

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.

Pay Per Action

Pay Per Action advertising is the same advertising model as CPA, in that an advertiser will pay every time a user completes a specific action.

Pay Per Call

Pay Per Call advertising is a subset of Pay Per Action, and is the same advertising model as CPA, in that an advertiser will pay every time a user calls a specific number.

Pay Per Click

Pay Per Click advertising is the same advertising model as CPC, in that an advertiser will pay every time a user clicks on their advert.

PFI

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.

PPC

See Pay Per Click.

Robots.txt

A robots.txt file is a simple text file that contains instructions for search engine spiders. It can tell specific spiders to slow down, or not to index specific area of a site. For more information, please read robots.txt.

ROI

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.

RSS

RSS is a type of XML file, and is the most commonly used file format for website feeds.

SEM

SEM is an acronym of "Search Engine Marketing". SEM is a broader topic than SEO, and can include, for example, an online PR campaign or PPC (and other forms of) advertising.

SEO

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!).

SERPs

SERPs is an acronym for "Search Engine Result Pages".

SEs

SE is an abbreviation of "Search Engine".

Site Map

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.

Spam

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 Black Hat techniques, especially cloaking and doorway pages.

Spider

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.

Splash Page

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.

Stop Word

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".

Syndication

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 feed), to allows visitors to keep up to date easily with new content added to many sites.

Text Link Ad

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.

TLD

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 ccTLDs, which are country-code domains.

URL / URI

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.

Visit

A visit is different from a Hit or an Impression, in that it indicates a single person's visit to a website. A visit may include many page impressions, and many hits.

White Hat

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 Black Hat.

XML

XML is a file format designed to create files that are easy to share and understand.



]]>
Wed, 03 May 2006 13:17:00 +0100 http://www.addedbytes.com/articles/online-marketing/jargon-explained/ Dave Child ,,,,,,,,
Internet Country Codes http://www.addedbytes.com/blog/code/internet-country-codes/ 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!

Afghanistan.af
Albania.al
Algeria.dz
American Samoa.as
Andorra.ad
Angola.ao
Anguilla.ai
Antarctica.aq
Antigua and Barbuda.ag
Argentina.ar
Armenia.am
Aruba.aw
Australia.au
Austria.at
Azerbaijan.az
Bahamas, The.bs
Bahrain.bh
Bangladesh.bd
Barbados.bb
Belarus.by
Belgium.be
Belize.bz
Benin.bj
Bermuda.bm
Bhutan.bt
Bolivia.bo
Bosnia and Herzegovina.ba
Botswana.bw
Bouvet Island.bv
Brazil.br
British Indian Ocean Territory.io
British Virgin Islands.vg
Brunei.bn
Bulgaria.bg
Burkina Faso.bf
Burma.mm
Burundi.bi
Cambodia.kh
Cameroon.cm
Canada.ca
Cape Verde.cv
Cayman Islands.ky
Central African Republic.cf
Chad.td
Chile.cl
China.cn
Christmas Island.cx
Cocos (Keeling) Islands.cc
Colombia.co
Comoros.km
Congo, Democratic Republic of the.cd
Congo, Republic of the.cg
Cook Islands.ck
Costa Rica.cr
Cote d'Ivoire.ci
Croatia.hr
Cuba.cu
Cyprus.cy
Czech Republic.cz
Denmark.dk
Djibouti.dj
Dominica.dm
Dominican Republic.do
East Timor.tl
Ecuador.ec
Egypt.eg
El Salvador.sv
Equatorial Guinea.gq
Eritrea.er
Estonia.ee
Ethiopia.et
Falkland Islands (Islas Malvinas).fk
Faroe Islands.fo
Fiji.fj
Finland.fi
France.fr
France, Metropolitan.fx
French Guiana.gf
French Polynesia.pf
French Southern and Antarctic Lands.tf
Gabon.ga
Gambia, The.gm
Gaza Strip.ps
Georgia.ge
Germany.de
Ghana.gh
Gibraltar.gi
Greece.gr
Greenland.gl
Grenada.gd
Guadeloupe.gp
Guam.gu
Guatemala.gt
Guernsey.gg
Guinea.gn
Guinea-Bissau.gw
Guyana.gy
Haiti.ht
Heard Island and McDonald Islands.hm
Holy See.va
Honduras.hn
Hong Kong.hk
Hungary.hu
Iceland.is
India.in
Indonesia.id
Iran.ir
Iraq.iq
Ireland.ie
Israel.il
Italy.it
Jamaica.jm
Japan.jp
Jersey.je
Jordan.jo
Kazakhstan.kz
Kenya.ke
Kiribati.ki
Korea, North.kp
Korea, South.kr
Kuwait.kw
Kyrgyzstan.kg
Laos.la
Latvia.lv
Lebanon.lb
Lesotho.ls
Liberia.lr
Libya.ly
Liechtenstein.li
Lithuania.lt
Luxembourg.lu
Macau.mo
Macedonia.mk
Madagascar.mg
Malawi.mw
Malaysia.my
Maldives.mv
Mali.ml
Malta.mt
Man, Isle of.im
Marshall Islands.mh
Martinique.mq
Mauritania.mr
Mauritius.mu
Mayotte.yt
Mexico.mx
Micronesia, Federated States of.fm
Moldova.md
Monaco.mc
Mongolia.mn
Montserrat.ms
Morocco.ma
Mozambique.mz
Namibia.na
Nauru.nr
Nepal.np
Netherlands.nl
Netherlands Antilles.an
New Caledonia.nc
New Zealand.nz
Nicaragua.ni
Niger.ne
Nigeria.ng
Niue.nu
Norfolk Island.nf
Northern Mariana Islands.mp
Norway.no
Oman.om
Pakistan.pk
Palau.pw
Panama.pa
Papua New Guinea.pg
Paraguay.py
Peru.pe
Philippines.ph
Pitcairn Islands.pn
Poland.pl
Portugal.pt
Puerto Rico.pr
Qatar.qa
Reunion.re
Romania.ro
Russia.ru
Rwanda.rw
Saint Helena.sh
Saint Kitts and Nevis.kn
Saint Lucia.lc
Saint Pierre and Miquelon.pm
Saint Vincent and the Grenadines.vc
Samoa.ws
San Marino.sm
Sao Tome and Principe.st
Saudi Arabia.sa
Senegal.sn
Serbia and Montenegro.cs
Seychelles.sc
Sierra Leone.sl
Singapore.sg
Slovakia.sk
Slovenia.si
Solomon Islands.sb
Somalia.so
South Africa.za
South Georgia and the Islands.gs
Soviet Union.su
Spain.es
Sri Lanka.lk
Sudan.sd
Suriname.sr
Svalbard.sj
Swaziland.sz
Sweden.se
Switzerland.ch
Syria.sy
Taiwan.tw
Tajikistan.tj
Tanzania.tz
Thailand.th
Togo.tg
Tokelau.tk
Tonga.to
Trinidad and Tobago.tt
Tunisia.tn
Turkey.tr
Turkmenistan.tm
Turks and Caicos Islands.tc
Tuvalu.tv
Uganda.ug
Ukraine.ua
United Arab Emirates.ae
United Kingdom.uk
United States.us
United States Minor Outlying Islands.um
Uruguay.uy
Uzbekistan.uz
Vanuatu.vu
Venezuela.ve
Vietnam.vn
Virgin Islands.vi
Virgin Islands (UK).vg
Virgin Islands (US).vi
Wallis and Futuna.wf
West Bank.ps
Western Sahara.eh
Western Samoa.ws
Zambia.zm
Zimbabwe.zw

Reverse Lookup

This list is ordered by the domain names, rather than countries, to allow you to find out which country a domain name represents.

Andorra.ad
United Arab Emirates.ae
Afghanistan.af
Antigua and Barbuda.ag
Anguilla.ai
Albania.al
Armenia.am
Netherlands Antilles.an
Angola.ao
Antarctica.aq
Argentina.ar
American Samoa.as
Austria.at
Australia.au
Aruba.aw
Azerbaijan.az
Bosnia and Herzegovina.ba
Barbados.bb
Bangladesh.bd
Belgium.be
Burkina Faso.bf
Bulgaria.bg
Bahrain.bh
Burundi.bi
Benin.bj
Bermuda.bm
Brunei.bn
Bolivia.bo
Brazil.br
Bahamas, The.bs
Bhutan.bt
Bouvet Island.bv
Botswana.bw
Belarus.by
Belize.bz
Canada.ca
Cocos (Keeling) Islands.cc
Congo, Democratic Republic of the.cd
Central African Republic.cf
Congo, Republic of the.cg
Switzerland.ch
Cote d'Ivoire.ci
Chile.cl
Cameroon.cm
China.cn
Colombia.co
Costa Rica.cr
Serbia and Montenegro.cs
Cuba.cu
Cape Verde.cv
Christmas Island.cx
Cyprus.cy
Czech Republic.cz
Germany.de
Djibouti.dj
Denmark.dk
Dominica.dm
Dominican Republic.do
Algeria.dz
Ecuador.ec
Estonia.ee
Egypt.eg
Western Sahara.eh
Eritrea.er
Spain.es
Ethiopia.et
Finland.fi
Fiji.fj
Falkland Islands (Islas Malvinas).fk
Micronesia, Federated States of.fm
Faroe Islands.fo
France.fr
France, Metropolitan.fx
Gabon.ga
Grenada.gd
Georgia.ge
French Guiana.gf
Guernsey.gg
Ghana.gh
Gibraltar.gi
Greenland.gl
Gambia, The.gm
Guinea.gn
Guadeloupe.gp
Equatorial Guinea.gq
Greece.gr
South Georgia and the Islands.gs
Guatemala.gt
Guam.gu
Guinea-Bissau.gw
Guyana.gy
Hong Kong.hk
Heard Island and McDonald Islands.hm
Honduras.hn
Croatia.hr
Haiti.ht
Hungary.hu
Indonesia.id
Ireland.ie
Israel.il
Man, Isle of.im
India.in
British Indian Ocean Territory.io
Iraq.iq
Iran.ir
Iceland.is
Italy.it
Jersey.je
Jamaica.jm
Jordan.jo
Japan.jp
Kenya.ke
Kyrgyzstan.kg
Cambodia.kh
Kiribati.ki
Comoros.km
Saint Kitts and Nevis.kn
Korea, North.kp
Korea, South.kr
Kuwait.kw
Cayman Islands.ky
Kazakhstan.kz
Laos.la
Lebanon.lb
Saint Lucia.lc
Liechtenstein.li
Sri Lanka.lk
Liberia.lr
Lesotho.ls
Lithuania.lt
Luxembourg.lu
Latvia.lv
Libya.ly
Morocco.ma
Monaco.mc
Moldova.md
Madagascar.mg
Marshall Islands.mh
Macedonia.mk
Mali.ml
Burma.mm
Mongolia.mn
Macau.mo
Northern Mariana Islands.mp
Martinique.mq
Mauritania.mr
Montserrat.ms
Malta.mt
Mauritius.mu
Maldives.mv
Malawi.mw
Mexico.mx
Malaysia.my
Mozambique.mz
Namibia.na
New Caledonia.nc
Niger.ne
Norfolk Island.nf
Nigeria.ng
Nicaragua.ni
Netherlands.nl
Norway.no
Nepal.np
Nauru.nr
Niue.nu
New Zealand.nz
Oman.om
Panama.pa
Peru.pe
French Polynesia.pf
Papua New Guinea.pg
Philippines.ph
Pakistan.pk
Poland.pl
Saint Pierre and Miquelon.pm
Pitcairn Islands.pn
Puerto Rico.pr
Gaza Strip.ps
West Bank.ps
Portugal.pt
Palau.pw
Paraguay.py
Qatar.qa
Reunion.re
Romania.ro
Russia.ru
Rwanda.rw
Saudi Arabia.sa
Solomon Islands.sb
Seychelles.sc
Sudan.sd
Sweden.se
Singapore.sg
Saint Helena.sh
Slovenia.si
Svalbard.sj
Slovakia.sk
Sierra Leone.sl
San Marino.sm
Senegal.sn
Somalia.so
Suriname.sr
Sao Tome and Principe.st
Soviet Union.su
El Salvador.sv
Syria.sy
Swaziland.sz
Turks and Caicos Islands.tc
Chad.td
French Southern and Antarctic Lands.tf
Togo.tg
Thailand.th
Tajikistan.tj
Tokelau.tk
East Timor.tl
Turkmenistan.tm
Tunisia.tn
Tonga.to
Turkey.tr
Trinidad and Tobago.tt
Tuvalu.tv
Taiwan.tw
Tanzania.tz
Ukraine.ua
Uganda.ug
United Kingdom.uk
United States Minor Outlying Islands.um
United States.us
Uruguay.uy
Uzbekistan.uz
Holy See.va
Saint Vincent and the Grenadines.vc
Venezuela.ve
British Virgin Islands.vg
Virgin Islands (UK).vg
Virgin Islands.vi
Virgin Islands (US).vi
Vietnam.vn
Vanuatu.vu
Wallis and Futuna.wf
Samoa.ws
Western Samoa.ws
Mayotte.yt
South Africa.za
Zambia.zm
Zimbabwe.zw


]]>
Fri, 07 Oct 2005 09:06:59 +0100 http://www.addedbytes.com/blog/code/internet-country-codes/ Dave Child ,,,,,,,,,,
Block Prefetching http://www.addedbytes.com/blog/block-prefetching/ Mozilla and Google's prefetching functions are a nice addition to browser technology in many ways. Unsurprisingly, they are not very well thought through.

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).

It appears from the FAQ that Google only intends their accelerator to prefetch specific pages, that have been specified with the <link> tag. However, many people are claiming that normal links have been prefetched.

To prevent prefetching of a page is simple: add the following PHP to the page you do not want prefetched:

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<br><br>Prefetching not allowed here.';
    die();
}

This will serve a "forbidden" header to the prefetcher. Normal browsing should be unaffected.



]]>
Wed, 20 Apr 2005 16:16:00 +0100 http://www.addedbytes.com/blog/block-prefetching/ Dave Child ,,,,,,
Flesch-Kincaid Reading Level http://www.addedbytes.com/blog/code/flesch-kincaid-function/ PLEASE NOTE: This code is now considered out of date. An updated version has been released under an open source license as a Google Code project: php-text-statistics. There is more about this change in the post Readability Code Open Sourced.

A tool for checking the readability scores of text is available - this article covers the functions behind that tool.

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.

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.

The following are two calculations that can give you an indicator of how easy your text is to read.

Flesch-Kincaid Reading Ease

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.

206.835 - (1.015 * average_words_sentence) - (84.6 * average_syllables_word)

The function you will need to use to work this score out (in addition to the three at the bottom of this page) is:

function calculate_flesch($text) { return (206.835 - (1.015 * average_words_sentence($text)) - (84.6 * average_syllables_word($text))); }

And you can call the function like so:

$flesh_score = calculate_flesch($text);

Flesch-Kincaid Grade level

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.

(.39 * average_words_sentence) + (11.8 * average_syllables_word) - 15.59

The function you will need to use to work this score out (in addition to the three at the bottom of this page) is:

function calculate_flesch_grade($text) { return ((.39 * average_words_sentence($text)) + (11.8 * average_syllables_word($text)) - 15.59); }

And you can call the function like so:

$flesh_score = calculate_flesch_grade($text);

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.

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.

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.

The functions you will need in order to calculate the Flesch-Kincaid reading ease or Grade level of text are:

function average_words_sentence($text) { $sentences = strlen(preg_replace('/[^\.!?]/', '', $text)); $words = strlen(preg_replace('/[^ ]/', '', $text)); return ($words/$sentences); } function average_syllables_word($text) { $words = explode(' ', $text); for ($i = 0; $i < count($words); $i++) { $syllables = $syllables + count_syllables($words[$i]); } return ($syllables/count($words)); } 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 => $value) { if ($value <> '') { $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; }

Examples

The following are two examples of text and the readability of that text.

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:

"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."

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.

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:

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.

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.

These are, perhaps, extreme examples, but they should give an idea of the differences between good and bad text on a web page.



]]>
Wed, 07 Jul 2004 14:17:00 +0100 http://www.addedbytes.com/blog/code/flesch-kincaid-function/ Dave Child ,,,,,,,,,,
Faux Columns for Liquid Layouts http://www.addedbytes.com/blog/code/faux-columns-for-liquid-layouts/ In January of 2004, Dan Cederholm (author of Web Standards Solutions) posted an article on AListApart entitled "Faux Columns". In it, he explained how designers can overcome a common problem in CSS-based designs.

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.

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.

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.

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.

However, Dan's solution can be used to apply a background to a page when the layout is liquid, using background positioning.

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 point within the image itself. For example, let's say we have a page and a simple background image. We use the following to set and position the background:

body { background-image: url("image.gif"); background-repeat: no-repeat; background-position: 25% 10%; }

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:

Example of background positioning based upon percentages

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):

Example of background image

Now, we position the background using the following CSS:

body { background-image: url("background.gif"); background-repeat: repeat-y; background-position: 25% 0; }

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 see an example of that here. 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.

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 more complete example is here, 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.



]]>
Tue, 22 Jun 2004 17:31:13 +0100 http://www.addedbytes.com/blog/code/faux-columns-for-liquid-layouts/ Dave Child ,,,,,,,,,,,
HTTP Status Codes for Beginners http://www.addedbytes.com/articles/for-beginners/http-status-codes/ 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.

A more technical breakdown of HTTP 1.1 status codes and their meanings is available at http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html. There are several versions of HTTP, but currently HTTP 1.1 is the most widely used.

Informational

  • 100 - Continue
    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.
  • 101 - Switching Protocols
    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.

Successful

  • 200 - OK
    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.
  • 201 - Created
    A 201 status code indicates that a request was successful and as a result, a resource has been created (for example a new page).
  • 202 - Accepted
    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.
  • 203 - Non-Authoritative Information
    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.
  • 204 - No Content
    The 204 status code means that the request was received and understood, but that there is no need to send any data back.
  • 205 - Reset Content
    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.
  • 206 - Partial Content
    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.

Redirection

  • 300 - Multiple Choices
    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.
  • 301 - Moved Permanently
    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.
  • 302 - Found
    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.
  • 303 - See Other
    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.
  • 304 - Not Modified
    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.
  • 305 - Use Proxy
    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.
  • 307 - Temporary Redirect
    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.

Client Error

  • 400 - Bad Request
    A status code of 400 indicates that the server did not understand the request due to bad syntax.
  • 401 - Unauthorized
    A 401 status code indicates that before a resource can be accessed, the client must be authorised by the server.
  • 402 - Payment Required
    The 402 status code is not currently in use, being listed as "reserved for future use".
  • 403 - Forbidden
    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.
  • 404 - Not Found
    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.
  • 405 - Method Not Allowed
    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).
  • 406 - Not Acceptable
    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.
  • 407 - Proxy Authentication Required
    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.
  • 408 - Request Timeout
    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.
  • 409 - Conflict
    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.
  • 410 - Gone
    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.
  • 411 - Length Required
    The 411 status code occurs when a server refuses to process a request because a content length was not specified.
  • 412 - Precondition Failed
    A 412 status code indicates that one of the conditions the request was made under has failed.
  • 413 - Request Entity Too Large
    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.
  • 414 - Request-URI Too Long
    The 414 status code indicates the the URL requested by the client was longer than it can process.
  • 415 - Unsupported Media Type
    A 415 status code is returned by a server to indicate that part of the request was in an unsupported format.
  • 416 - Requested Range Not Satisfiable
    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.
  • 417 - Expectation Failed
    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.

Server Error

  • 500 - Internal Server Error
    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.
  • 501 - Not Implemented
    The 501 status code indicates that the server does not support all that is needed for the request to be completed.
  • 502 - Bad Gateway
    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.
  • 503 - Service Unavailable
    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.
  • 504 - Gateway Timeout
    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.
  • 505 - HTTP Version Not Supported
    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.


]]>
Tue, 11 May 2004 15:33:55 +0100 http://www.addedbytes.com/articles/for-beginners/http-status-codes/ Dave Child ,,,,,,,,
VBScript Date Format Functions http://www.addedbytes.com/blog/code/vbscript-date-format-functions/ 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.

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.

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:

<%@LANGUAGE=VBSCRIPT" LCID=2057%>

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.

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.

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.

UDate()

function UDate(oldDate)
    UDate = DateDiff("s", "01/01/1970 00:00:00", oldDate)
end function

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.

intCurrent_Unix_Time = UDate(Now())

unUDate()

function unUDate(intTimeStamp)
    unUDate = DateAdd("s", intTimeStamp, "01/01/1970 00:00:00")
end function

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.

formatDate()

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.

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...

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:

strDateTime = formatDate("%g:%i%a, %l %j%O %F, %Y", UDate(Now()))

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).

  • %A - AM or PM
  • %a - am or pm
  • %m - Month with leading zeroes (01 - 12)
  • %n - Month without leading zeroes (1 - 12)
  • %F - Month name (January - December)
  • %M - Three letter month name (Jan - Dec)
  • $d - Day with leading zeroes (01 - 31)
  • %j - Day without leading zeroes (1 - 31)
  • %H - Hour with leading zeroes (12 hour)
  • %h - Hour with leading zeroes (24 hour)
  • %G - Hour without leading zeroes (12 hour)
  • %g - Hour without leading zeroes (24 hour)
  • %i - Minute with leading zeroes (01 to 60)
  • %I - Minute without leading zeroes (1 to 60)
  • %s - Second with leading zeroes (01 to 60)
  • %S - Second without leading zeroes (1 to 60)
  • %L - Number of day of week (1 to 7)
  • %l - Name of day of week (Sunday to Saturday)
  • %D - Three letter name of day of week (Sun to Sat)
  • %O - Ordinal suffix (st, nd rd, th)
  • %U - UNIX Timestamp
  • %Y - Four digit year (2003)
  • %y - Two digit year (03)

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.

If you would like to see anything else added to the list, above, please email me and I will see what I can do.

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.

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) > 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" & dateHour - 12, 2))
    format = replace(format, "%H", dateHour)
    if (A = "PM") then format = replace(format, "%G", left("0" & 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


]]>
Mon, 15 Mar 2004 14:07:00 +0000 http://www.addedbytes.com/blog/code/vbscript-date-format-functions/ Dave Child ,,,,,,,,,,,
US States Select Box http://www.addedbytes.com/blog/code/us-states-select-box/ This states select list was last updated on the 15th March 2004, and should be accurate for that date (and I should imagine, far beyond). If you spot any inaccuracies, please let me know.

This list is provided for you to use as you see fit, but please do not reproduce it elsewhere without creditting this site.

The list comes in two versions. The first is a list without the two-letter codes for each state, the second with the two letter codes.

Without State Abbreviation Codes

<select name="state"> <option>Alabama</option> <option>Alaska</option> <option>Arizona</option> <option>Arkansas</option> <option>California</option> <option>Colorado</option> <option>Connecticut</option> <option>Delaware</option> <option>Florida</option> <option>Georgia</option> <option>Hawaii</option> <option>Idaho</option> <option>Illinois</option> <option>Indiana</option> <option>Iowa</option> <option>Kansas</option> <option>Kentucky</option> <option>Louisiana</option> <option>Maine</option> <option>Maryland</option> <option>Massachusetts</option> <option>Michigan</option> <option>Minnesota</option> <option>Mississippi</option> <option>Missouri</option> <option>Montana</option> <option>Nebraska</option> <option>Nevada</option> <option>New Hampshire</option> <option>New Jersey</option> <option>New Mexico</option> <option>New York</option> <option>North Carolina</option> <option>North Dakota</option> <option>Ohio</option> <option>Oklahoma</option> <option>Oregon</option> <option>Pennsylvania</option> <option>Rhode Island</option> <option>South Carolina</option> <option>South Dakota</option> <option>Tennessee</option> <option>Texas</option> <option>Utah</option> <option>Vermont</option> <option>Virginia</option> <option>Washington</option> <option>West Virginia</option> <option>Wisconsin</option> <option>Wyoming</option> </select>

With State Abbreviation Codes

<select name="state"> <option value="AL">Alabama</option> <option value="AK">Alaska</option> <option value="AZ">Arizona</option> <option value="AR">Arkansas</option> <option value="CA">California</option> <option value="CO">Colorado</option> <option value="CT">Connecticut</option> <option value="DE">Delaware</option> <option value="FL">Florida</option> <option value="GA">Georgia</option> <option value="HI">Hawaii</option> <option value="ID">Idaho</option> <option value="IL">Illinois</option> <option value="IN">Indiana</option> <option value="IA">Iowa</option> <option value="KS">Kansas</option> <option value="KY">Kentucky</option> <option value="LA">Louisiana</option> <option value="ME">Maine</option> <option value="MD">Maryland</option> <option value="MA">Massachusetts</option> <option value="MI">Michigan</option> <option value="MN">Minnesota</option> <option value="MS">Mississippi</option> <option value="MO">Missouri</option> <option value="MT">Montana</option> <option value="NE">Nebraska</option> <option value="NV">Nevada</option> <option value="NH">New Hampshire</option> <option value="NJ">New Jersey</option> <option value="NM">New Mexico</option> <option value="NY">New York</option> <option value="NC">North Carolina</option> <option value="ND">North Dakota</option> <option value="OH">Ohio</option> <option value="OK">Oklahoma</option> <option value="OR">Oregon</option> <option value="PA">Pennsylvania</option> <option value="RI">Rhode Island</option> <option value="SC">South Carolina</option> <option value="SD">South Dakota</option> <option value="TN">Tennessee</option> <option value="TX">Texas</option> <option value="UT">Utah</option> <option value="VT">Vermont</option> <option value="VA">Virginia</option> <option value="WA">Washington</option> <option value="WV">West Virginia</option> <option value="WI">Wisconsin</option> <option value="WY">Wyoming</option> </select>

This list was compiled from a variety of sources, both online and offline, and no guarantee is made as to its accuracy. Please report any mistakes to dave@addedbytes.com.



]]>
Sat, 14 Feb 2004 14:14:00 +0000 http://www.addedbytes.com/blog/code/us-states-select-box/ Dave Child ,,,,,,,,,,