cloudsoup

no soup, no clouds

Archive for June, 2004

A Welsh Culture RSS feed – no brainer no cost no time

leave a comment

Easy-to-build RSS feeds on any subject

Using the excellent and free features of AnyRSS and Feedburner you can create a feed on just about any topic in a few seconds and with no bandwidth cost because of subscriptions. This is one I created as a demo.

Preview the Welsh Culture feed here – you just need a browser.

Subscribe to sample Welsh culture feed

Here’s how it was done:

  1. I signed-up to Feedburner (free)

  2. I went to AnyRSS and used the keywords :
    ‘Wales Welsh Culture Arts’. and clicked the ‘Generate Feed URL’ button. That gave me a feed URL of :

    http://anyrss.maquis.org/feed.php ? q=Wales %20 Welsh %20 Culture %20 Arts & s=r

  3. I copied that URL, went to Feedburner and pasted it into the ‘Feed URL’ on the front page of Feedburner.

  4. I accepted most of Feedburner’s defaults although I changed the URL to:

    http://feeds.feedburner.com/welshculture

    and ‘burned the feed’.

  5. Feedburner generated the feed and the links to include on a website:


    <a href="http://feeds.feedburner.com/welshartsandculture" alt="Welsh Culture feed at feedburner" title="Subscribe to my feed"><img src="http://www.feedburner.com/fb/images/pub/fbapix.gif" border="0"/></a>

    Which I changed just a bit to fit in with my DOCTYPE

  6. Done

Subscribe to sample Welsh culture feed

Written by David

June 19th, 2004 at 11:30 pm

Posted in Uncategorized

Tagged with ,

Selling books through RSS

leave a comment

Scott Rafer of Feedster, talking about which companies get RSS and syndication, suggests that companies (Amazon?) could start selling books as serials through RSS.

Matt Webb has already begun serialising Leonardo da Vinci’s notebooks, the Pepys Diary site has been producing a feed for some time now and recently, a page of Ulysses each day came online. I think the da Vinci and the Ulysses serialisations are possible because of Project Gutenberg.

The format’s well-suited to diaries. Although Dickens, famously, published serially I’m not convinced that it’ll work with extracts larger than a page and unless the book itself is divided into little chunks it’d be easy to lose the plot.

Written by David

June 18th, 2004 at 10:45 pm

Posted in Uncategorized

Tagged with ,

Yay! Zeldman links to Welsh Assembly Post

leave a comment

Zeldman links to our remarks about the Welsh Assembly website.

But other than that, Mrs Lincoln, how did you like the play?

Well, it boosted traffic for a bit.

Written by David

June 17th, 2004 at 1:51 am

Posted in Uncategorized

Tagged with ,

The new Welsh Assembly website

leave a comment

The Welsh Assembly is redeveloping its website. A check of the new homepage shows that:

All of these problems can be fixed quite easily — although some need a little more thought than others — but how they crept through testing I can’t imagine.

The HTML is invalid

It’s a basic accessibility requirement that a document’s HTML should be valid.

  • the HTML or XHTML version should be declared
  • a DTD should be used
  • the page should conform to the declared grammar

For example, this page you’re reading is XHTML 1.0 (Strict) and says so at the very top of the document like this:

<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">

[See : the W3C WCAG on !DOCTYPE]

Checking validity is free and easy. The W3C has an HTML validator so it’s a simple matter to check a document is valid. Validity checks would usually be part of factory acceptance testing by website developers and site acceptance testing by the customer.

The Assembly’s HTML doesn’t validate.

The most obvious problem is the repeated value of an id attribute in the alphabetic navigation device. It looks like this:

The alphabet-based navigation device from wales.gov.uk

The underlying code just gets it wrong:

<span id=\"letter\"><a href=\"…
<span id=\"letter\"><a href=\"…
<span id=\"letter\"><a href=\"…
<span id=\"letter\"><a href=\"…

‘id’ values should be unique in a document. You aren’t supposed to repeat any single id value. It seems the developers are confused by id and the class attribute, whose value may be repeated within a document.

While the letter value of id is repeated, the page can’t pass a validity test and so can’t pass a basic accessibility test. It’s suprising it was written like this in the first place — and that it passed any testing regime at all — but it’s a simple thing to correct.

WCAG 1.0 checkpoint 3.2: Create documents that validate to published formal grammars

(Priority 2)

Top Of Article

The CSS is invalid

Like the HTML, the CSS doesn’t validate. As with the HTML, the CSS can be validated automatically and validation should form a part of development and acceptance testing.
Check the
Welsh Assembly’s CSS
.

The problem with the CSS seems to be that Macromedia’s Dreamweaver has been used with incorrect settings and it has inserted this invalid
CSS:

layer-background-image: url(../images/headercontent_top_bar.gif);

layer-background-image has never been supported by CSS, it’s never been supported in Internet Explorer, it’s never been supported in Opera and it’s only been supported in Netscape versions 4 and 6. While this stays the CSS can’t validate.

WCAG 1.0 checkpoint 3.3: Use style sheets to control layout and presentation

(Priority 2)

Top Of Article

alt text for accessible images is completely misunderstood

A very basic accessibility requirement, this, and it’s not too difficult to understand. A blind person who browses the web with a screen reader or a refreshable Braille display relies on the alt value of an image (and perhaps the title and the longdesc too) to understand what the image is. All images should have ALT text, period.

But that’s not the whole story. Website designers often use images to provide decoration, or to force gaps between page elements (so-called ‘spacer’ gifs). In these instances the image alt value should be null
— or a screen reader will read out every little structurally significant but semantically meaningless image’s alttext. This is how semantically redundant images should be marked-up:


<img src="blah” alt=”" width=”{x}” height=”{y}” />

A page can be tested in a text-based browser. Lynx is a free donwload that developers often use.

How not to do it

The Assembly’s website gets it wrong and the homepage will sound like, or read like, a pile of gibberish to a blind person. Like this:


spacer graphic
header curve graphic Cymraeg spacer graphic Home | Help | Contacts |
Site Map | Search header curve graphic
spacer graphic
spacer graphic shadow graphic spacer graphic
curve graphic curve graphic
Croeso - Cynulliad Cenedlaethol Cymru
Welcome - National Assembly for Wales
spacer graphic

WCAG 1.0 checkpoint 1.1: Provide a text equivalent for every non-text element

(Priority 1)

Building Accessible Websites, Borders, rules, and other meaningless graphics.

Top Of Article

semantic markup isn’t used effectively

From Mark Pilgrim’s
essay on semantic markup:

Blind people can’t just scan the whole page at once; they need to accomplish the same thing in other ways, and the assistive technology they use relies on (among other things) good semantic markup to mimic the things we can do at a glance.

– and the new homepage of the Welsh Assembly Government manages to get this wrong, too. Take a look at this:

a screenshot of the new homepage

The white-on-red text, ‘National Assembly for Wales’, is clearly a heading, semantically. So too is the title of the news item, ‘British Deaf Association and RNID Cymru to visit the Assembly’. To a sighted visitor the semantics stand out because of their color and font weight. A blind user, though, wouldn’t be able to deduce the semantics of the page available to a sighted user because the text isn’t marked up with <hn> tags.

WCAG 1.0 checkpoint 3.5: Use header elements to convey document structure and use them according to specification

(Priority 2)

Top Of Article

The page’s language is not declared correctly

Managing bilingual websites is a politically sensitive issue in Wales. The new homepage has a language-selector that takes you from the default (English) to the alternative (Welsh, or Cymraeg).

There’s a cute touch in taking you to a new domain name, cymru.gov.uk but it’s a bit beside the point as ‘.gov’ and ‘.uk’ can’t be translated.

The language declaration in the HTML source of the Welsh-language page looks like this:

<HTML lang="en">

which is just wrong. The language of this page is notEnglish but Welsh (Cymraeg). The language declaration should read:

<HTML lang="cy">

WCAG 1.0 checkpoint 4.3: Identify the primary natural language of a document

(Priority 3)

Top Of Article

Written by David

June 16th, 2004 at 12:32 am

Posted in Uncategorized

Tagged with , ,

By their cruft shall ye know them

leave a comment

A post on how to tell the blogging software from the URL cruft.

Some advice on making URLs a bit more friendly, in addition to clearing out that cruft:

  • Don’t use in-page anchors (URIs ending in #whatever) as permalinks
  • Don’t use the ? character … ? should be avoided for any persistent resource
  • Don’t use the _ (underscore) character, like Blogger and Movable Type do. Many computer users have trouble finding _ on their keyboards. And even for those who can, it’s harder to type than -

May have to rethink my use of underscore — I’m using a WordPress plugin specifically to change the default ‘-’ to ‘_’ because I’m used to not using ‘-’ in variable names. Hmmm.

Written by David

June 15th, 2004 at 11:57 pm

Posted in Uncategorized

Tagged with

Juicy Studio on accessibility

leave a comment

Juicy Studio has published a bit of a rant about accessibility standards and their failure to encompass people with learning difficulties and the like. The article makes the mistake of accusing accessibility expert Joe Clark of doublethink. Joe responds and says,

We can make Web sites that work with no vision, no hearing, or no movement, or even none of the above. We cannot make a Web site work with no cognition.

Written by David

June 15th, 2004 at 11:46 pm

Posted in Uncategorized

Tagged with

Development Rates

leave a comment

  • $150/hr Standard Rate
  • $200/hr if you want it NOW
  • $250/hr if you want to watch over my shoulder while I work
  • $300/hr if you want to help
  • $400/hr if you worked on it first

— Signal Vs Noise, All hours are not created equal

Written by David

June 15th, 2004 at 7:27 pm

Posted in Miscellaneous

California, Here We Come

leave a comment

California, here I come
Right back where I started from.
Where bowers of flowers bloom in the spring.
Each morning at dawning,
Birdies sing an’ everything.
A sun-kissed miss said, ‘Don’t be late’
That’s why I can hardly wait.
Open up that Golden Gate,
California here I come.

If anyone would like to offer advice to two Californ-eye-aye novices about where to go, etc, would be great. We’re already planning: Sequoia National Park; Yosemite; Sierra Nevada; North California Coast & whales; SF & Bay Area; Grand Canyon; Las Vegas.

Suggestions to david at cloudsoup dot com. Cheers.

Written by David

June 15th, 2004 at 5:31 am

Posted in Uncategorized

Tagged with

Using RSS content with PHP

one comment

RSS feeds and other syndication formats are becoming common and using an aggregator like NetNewsWire, Sharpreader or Bloglines is an easy way to keep up-to-date with your favourite websites without having to visit all of them every day. But what if you want that RSS content on your own website? Here’s a very simple way to reuse RSS weather information from www.rssweather.com with PHP.

I’ll use an example that reads the weather for West Wales and San Francisco because I live in West Wales and I’m visiting California soon. This is a very quick-and-dirty solution that doesn’t make much of the fact that RSS is an XML format; all I want is the temperature and the cloud cover on my website every day.

The feeds from rssweather.com are simple enough to understand – there are a number of <item> nodes in the XML and the first <item> is always the Current Weather and it contains a <content:encoded> node that has the info I want. I can make use of the fact that the content is very highly structured and consistent to extract what I want without having to parse the RSS XML.

RSS is a generalised syndication format. If you wanted to broadcast weather information as XML from scratch you probably wouldn’t want to use RSS because all the interesting data, made of discrete and well-defined items, is collected in the pre-formatted undifferentiated lump of the <content:encoded> node; but RSS has the benefit that it can be consumed by lots of existing applications and that’s why rssweather.com uses RSS. I’ll have to parse the pre-formatted information to extract the few data items in which I’m interested.

Part of the value of the <content:encoded> node always looks like this:

<span class=”sky”>Mostly clear</span> <span class=”temp”>54°F</span>

and it’ll be easy pick this up with a regular expression.

Get the RSS – once

First of all, you need to consume the RSS. Understandably, rssweather.com don’t want you hammering their server so if you’re testing your own application, test with a copy on your own server until you’re happy everything works.

A good way to pick up the RSS feed with PHP is to use the fopen function which can open remote URLs as well as local files. This code opens a file handle, reads the contents into a buffer and closes the file:


$url = "http://http://www.rssweather.com/rss.php?etc
if (!($fp = fopen($url, “r”))) {
die(”could not open RSS source”);
}
$data = fread($fp,8912);
fclose($fp);

We could go straight ahead and extract the two values we want using the PHP function preg_match_all — but instead I’ll show you a simple way of parsing the XML source.

Parsing the RSS / XML

xml_parse_into_struct parses the XML content into two array structures and it’s a bit easier to handle than SAX event-driven processing; it’s a good solution if your XML source isn’t too massive.


$xml_parser = xml_parser_create();
xml_parse_into_struct($xml_parser, $data, $vals, $index);
xml_parser_free($xml_parser);

Next, we find the <content:encoded> node by iterating through the $vals array. Then we can read the value from the [’value’] element:


foreach ($vals as $xml_elem) {
if($xml_elem[’tag’] == ‘CONTENT:ENCODED’){
$weather = $xml_elem[’value’];
break;
}
}

Regexp to get the data

Now we have the content we can use a regular expression to pick out the values we want.


$itemregexp = "%<span class="sky">(.+?)< /span>(.+?) >(.+?)< /span> %is";
$match_count = preg_match_all($itemregexp, $weather, $items);
if($match_count > 0){
$sky = $items[1][0];
$temp = $items[3][0];
}

Save it for later inclusion

We don’t want to hammer rssweather.com’s server so we’ll save this information as a file that we can include into a PHP page. When that’s working ok we can setup a cron job to do it for us once a day.

Write an include file :


$inc = "<dl>";
$inc .= “<dt>Sky</dt>”;
$inc .= “<dt>Temp</dt>”;
$inc .= “<dd>”.$sky.”</dd>”;
$inc .= “<dd>”.temp.”</dd>”;
$inc .= “</dl>”;
$filename = {myfilename}
$handle= fopen($filename,’w');
fwrite($handle, $inc);
fclose($handle);

Written by David

June 14th, 2004 at 12:48 pm

Posted in Uncategorized

Tagged with , ,

Spyware and Darwin

leave a comment

From boingboing :

Spyware is a disease in the Darwinian ecosystem of the Internet, and it keeps power users ahead of brain-deaders who click moving banner monkeys

Written by David

June 12th, 2004 at 8:01 am

Posted in Uncategorized

Tagged with