Pages tagged ""

css is the work of the devil

Posted on 26th June, 2007 by Heather

(Not only aiming at two targets with one blog - how economical is that? - but giving it a spurious biblical aura.)

This blog tends to the belief that ID is the personification of evil in (two-alphabetic-character form and in two repellent variants (Intelligent Design and National Identity Card) that we rant about with a pleasingly symmetrical regularity.

But the previous post here mentions, in passing, the differently demonic horrors emanating from its three-alphabetic-character rival for demonic rulership CSS.

We may be forced to form a new anti-css cult, dedicated to blaming all the ills of this world on ranndom initial pairs or triads.

Don’t think its only manifestation on the human plane is just the newly emergent life form CSS, able to resist any human efforts to make it place anything on a blog or webpage where you expect, in a remotely similar way at different resolutions on different browsers.

The cursed initials have meme-wormed their way into the wonderful world of copy protection.The Register said:

Buying a DVD and then copying it for use on your PSP, iPod or laptop could soon become impossible, if the DVD Copy Control Association gets its way…. The association wants to amend the licence underpinning the use of its DVD copy-protection technology, CSS (Content Scrambling System).

(see - the evil letters appear in another context :-))

The amendment would force, say, DVD playback software from displaying ripped content. It would also imply the use of software built into PCs and optical drives to prevent ripping software from saving an unscrambled copy of a disc’s contents for later playback on a device without a DVD drive, such as a PSP or an iPod.

The plan is that the DVD tech will only let you run something while it is physically present in the drive. This is already getting challenged by companies trying to make multiroom home cinemas. However as the Register points out, there is no way that crackers won’t have already got round it. )

Anyone spot in the market for a device manufacturer who takes this stuff into account? From the BBC today, when it refers to a (surprisingly modest) 61% of the population having admitted to crimes from a list of ten:

Presumably, that 61% would be higher still if the list had included a wider range of crimes, such as downloading music and copying software illegally.

Popularity: 30% [?]


Popularity: 30% [?]

Site Admin

Posted on 15th April, 2007 by TW

As mentioned previously, we have added some new plugins here and it seems they have broken the theme quite badly. This leaves us with two choices, and as the theme itself has become a bit annoying (second thoughts over the sponsored links, for example), it seems it is time to try out a new theme. The last time we tried this, there were problems in the old versions of IE so I would appreciate it if people can let us know what you think of the layout of the site now.

In addition a “struggle” is ongoing (offline) against the CSS files but when it is won (and by Toutatis it will be WON), we will be moving (again) to a bespoke theme. Thank you for your patience.

Popularity: 22% [?]


Popularity: 22% [?]

Links 22 Jan 07

Posted on 22nd January, 2007 by TW

After a busy weekend, there isn’t much to blog about (that hasn’t already been blogged!), so while a new round of Intelligent Design and Identity Card rants builds here are some interesting links:

And, for those who like historical-type photographs:

Roman garden - Open in Flickr

Lastly, Compuskills Web design are looking into an overhaul of their portfolio sites. Now is the time to get in touch with any comments and feedback.

Popularity: 24% [?]


Popularity: 24% [?]

Some webdesign links

Posted on 21st June, 2006 by admin

Just as an aside, I have been looking at changing the layout of a goodly number of the sites maintained by the web warriors at Why Dont You, and one of the things I googled was about getting rounded corners. For those who aren’t aware, this is almost the “holy grail” of current web design trends and is normally done through the excessive use of overlapped, css guided, images.

However, thanks to the mighty google, I came across this site - http://www.html.it/articoli/nifty/index.html - and it shows you how to do the trick with just plain old CSS. Excellent. Also useful is this site on colours: http://www.htmlgoodies.com/ tutorials/ colors/ article.php/ 3478961

Popularity: 15% [?]


Popularity: 15% [?]

Content Negotiation - Mirrored Post

Posted on 5th May, 2006 by admin

As mentioned in the last post, there is an excellent article available at http://www.autisticcuckoo.net/archive.php?id=2004/ 11/03/ content-negotiation, but sadly the author of this article has expressed his disinterest in continuing with his blog. While it is possible that he will continue to pay his hosting fees and continue to re-register the domain name, this is not certain so, to try and at least retain this article we have copied it (verbatim) below.

Original Source - http://www.autisticcuckoo.net/archive.php?id=2004/11/03/content-negotiation

We have, for some time, tried to inform people about the fact that there is no point whatsoever in using XHTML as long as you serve the documents with a text/html media type. For those who still want to use XHTML and gain at least something for some

users, we have recommended content negotiation. On several occasions people have asked us to publish a write-up on how to do that, but there hasn’t been time to sit down and write it. Now, finally, we have tried to whip something together that we hope can serve as a guide.

What Is Content Negotiation?

Content negotiation means that the server in one way or another
negotiates with a user agent (browser, search engine, etc) that requests a document. The negotiation means that the user agent announces which media types (also called content type or MIME type) it can handle and, optionally, which one it prefers. The server then serves the document in the way that best suits the user agent.

The user agent announces which media types it can handle through a header in the HTTP request it sends to the server. The header is called Accept and can look something like this:

Accept: text/xml, application/xml, application/xhtml+xml, text/html;q=0.9, text/plain;q=0.8, image/png, image/jpeg, image/gif;q=0.2, */*;q=0.1

The example is what our instance of Mozilla sends. (We have inserted blanks between the media types so that the text will wrap.) Our interest now lies with application/xhtml+xml and

text/html;q=0.9. The part after the semi-colon, q=0.9, is called a quality value and is a value between 0 and 1, inclusive, with up to three decimal places. The higher the quality value, the more the user agent prefers that media type. If no quality value is specified for a particular media type, it means q=1.0. The example thus shows that Mozilla prefers application/xhtml+xml to text/html.

The usual meaning of content negotiation is that the HTTP server itself decides which media type the user agent prefers, and then automatically chooses between a number of different documents. Normally the file suffix is used to associate to different media types, so the server might choose between

index.xhtml and index.html.

This article describes another type of content negotiation; one that is performed through a server-side script. Most web hosts offer some kind of server-side scripting, usually PHP or ASP. Our example uses PHP, since it is available for more platforms and is open source, while ASP is Microsoft-specific. We don’t delve into the finer details here, but presume that you are sufficiently familiar with PHP.

To round off this explanation of what content negotiation means, we want to emphasise that it’s not merely an issue of deciding which media type to send. When you have chosen a media type, you should also serve the document with a content that corresponds to the chosen media type. You either serve XHTML as application/xhtml+xml, or you serve HTML as text/html.

About the Examples

The code samples in this article are written for PHP 4.1.0 or higher. For older versions you need to replace $_SERVER with $HTTP_SERVER_VARS. If the code is executed in a function, you then need to declare the array as a global (global $HTTP_SERVER_VARS;).

This article presumes that the document’s content is marked up as XHTML 1.1, and that it doesn’t contain anything that cannot be converted into HTML 4.01 Strict, for instance element from other XML namespaces, or CDATA sections.

Parsing the Accept Header

First of all we need to find out whether or not the user agent supports the application/xhtml+xml media type and, if so, whether it prefers that to text/html.

  1. $xhtml = false;
  2. if (preg_match('/application\/xhtml\+xml(;q=(\d+\.\d+))?/i', $_SERVER['HTTP_ACCEPT'], $matches)) {
  3. $xhtmlQ = isset($matches[2]) ? $matches[2] : 1;
  4. if (preg_match('/text\/html(;q=(\d+\.\d+))?/i', $_SERVER['HTTP_ACCEPT'], $matches)) {
  5. $htmlQ = isset($matches[2]) ? $matches[2] : 1;
  6. $xhtml = ($xhtmlQ >= $htmlQ);
  7. } else {
  8. $xhtml = true;
  9. }
  10. }

The $xhtml variable indicates whether or not we will serve the document as XHTML. The initial value is false, since many older browsers lack support for XHTML.

On line 2 we check whether the Accept header contains
application/xhtml+xml plus an optional quality value. This regular expression isn’t 100% fool-proof, since it doesn’t limit the value range to [0,1], nor does it limit the number of decimal places to 3. For all intents and purposes, however, it doesn’t matter.

On line 3 we extract the quality value, if present. If not, we set the quality value for application/xhtml+xml to 1.

On lines 4 and 5 we perform the corresponding check for text/html. Line 6 compares the quality values and sets $xhtml=true if the user agent prefers application/xhtml+xml to text/html. Line 8 handles the case of a user agent that specifies application/xhtml+xml in the

Accept header, but not text/html.

After these lines of code we thus have a Boolean variable, $xhtml, which indicates whether the document will be served as XHTML.

Prepare HTML Conversion

If the user agent doesn’t support XHTML, or if it prefers HTML, we have to convert the document’s content from XHTML 1.1 to HTML 4.01. We do this with a simple function:

  1. function xml2html($buffer)
  2. {
  3. $xml = array('/>', 'xml:lang=');
  4. $html = array('>', 'lang=');
  5. return str_replace($xml, $html, $buffer);
  6. }

Lines 3 and 4 declare two arrays, where the elements in the $xml array will be replaced by the corresponding element in the $html array.

On line 5 each occurrence of /> is replaced by > in the $buffer string. At the same time, each occurrence of xml:lang is replaced by lang.

And Finally…

Only a few details now remain. If the $xhtml variable is true, we need to write the document type declaration for XHTML 1.1 and a <html> element with the proper XML namespace. Most likely we also want to start with an XML

declaration, and link to our style sheets through processing instructions.

If the user agent doesn’t want XHTML, we need to write a document type declaration for HTML 4.01 Strict and a <html> element without an XML namespace. Style sheets should be linked through ordinary <link> elements (or be imported in a <style> element). Furthermore, we need to instruct the PHP interpreter to buffer all output to the response stream, and to call our conversion function on the result before sending it back to the user agent.

Before we write anything at all, however, we must send a couple of HTTP headers: one that says which media type we use, and one that informs proxy servers that content negotiation has taken place so that they can consider that in their caching algorithms.

  1. if ($xhtml) {
  2. header('Content-Type: application/xhtml+xml; charset=utf-8');
  3. header('Vary: Accept');
  4. echo '<?xml version="1.0" encoding="utf-8"?>', "\n";
  5. echo '<?xml-stylesheet type="text/css" xhref="/css/screen.css" media="screen"?>', "\n";
  6. echo '<?xml-stylesheet type="text/css" xhref="/css/print.css" media="print"?>', "\n";
  7. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">', "\n";
  8. echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">', "\n";
  9. } else {
  10. header('Content-Type: text/html; charset=utf-8');
  11. header('Vary: Accept');
  12. ob_start('xml2html');
  13. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', "\n";
  14. echo '<html lang="en">', "\n";
  15. }

Don’t forget to link to the style sheets in the <head> if the document is served as HTML.

There is a blatant shortcoming in the example shown in this article: the W3C validator. It doesn’t send application/xhtml+xml in its Accept

header, so it’s impossible to validate the document as XHTML. It is trivial to let a query parameter control the choice of media type, but that is left as an exercise for the reader.

(note: We are aware of some possible copyright issues, and we have attempted to contact the original owner to get permission to repost it verbatim here. At the time of this post, no replies had been received and we can only assume the original source is no longer on line. If you are the original source and would like this post removed please contact us and we will take this post down immediately)

Popularity: 45% [?]


Popularity: 45% [?]