Sponsor: The JavaScript Anthology
The JavaScript Anthology: 101 Essential Tips, Tricks & Hacks (external link)
Browse Blog Archives
« March 2005 April 2005 May 2005 »
Blog Entries from April 2005
-
Opera Chef Takes a Bath
A few days ago Jon S. von Tetzchner, CEO of Opera Software (external link), said:
Quotation by "Jon S. von Tetzchner, CEO of Opera"
I will swim from Norway to the USA if download numbers of Opera 8 reach 1 million in four days
Further the official press release (external link) said:
Opera has now installed additional servers with increased capacity, and it was the download counter showing 600 000 downloads in 48 hours that sparked Mr Tetzschner's enthusiasm and thus his courageous promise to boldly swim where no man has swum before. "I am not sure he realizes how cold the Norwegian Sea is in April," says Anne Stavnes, Human Resource Manager, Opera Software. "However, having seen Jon in his red beach attire before, I am not sure if swimming to the USA is scarier than exposing people to this sight.
There were 600.000 downloads in the first 48 hours (external link).
I hope someone brings a camera along with his attempt. :-D
-
Adobe Acquired Macromedia
Well, what is there to say about it? The most interesting thing for myself is that this will most likely mean the end of the separate Dreamweaver and GoLive applications. Dreamweaver is a commercially more successful and better known product, so my bet would be a Dreamweaver extended with all the good sides of GoLive *coughs*Presto*coughs*.
Another interesting thing to watch will be Illustrator (Adobe)/Freehand (Macromedia). While Illustrator is arguebly the best vector graphics product on the market, Freehand offers some interesting things as well.
And if you want to know more, read the official press announcement (external link).
-
Color Schemes
Designing a web page can prove to be a challenge at first when you have to decide on the perfect color scheme. It can be the most challenging design practice as you have to find the perfect colors. You want colors that are easy going, have good readability, and look great!
Color Generators
True designers have created tools for those of us who are 'Color-Palette-Impaired'. Although there are quite a few effective color generators, I find wellstyled.com's (external link) to be the best.
Their color scheme generator allows for a variety of useful options to get millions of great color schemes. I've been using this color generator myself for quite a long time, although it has jumped a few URL's over time.
Good Article - Color for Coders
Internet columnist have also tackled tutorials and explanations on picking a color scheme. The most useful I've found is Color for Coders - Color and Design for the Non-Designer (external link), published by SitePoint.com.
In the article Jason Beaird addressees three main types of color schemes - analogous, complimentary, and monochromatic. He gives nice explanations and examples of each color scheme type. His article is a nice push from the un-creative programmer into a web designer.
-
Adobe GoLive CS2
Adobe GoLive CS2 (external link) is out. What does this offer? It uses Presto (Opera's rendering engine) for the WYSIWYG interface. This is great news in various aspects. First, according to some (including myself) Presto is the best rendering engine out there. Second, because this software is easy to use everybody can do his thing with this and create a standards supporting web without even realising it! (in Dreamweaver as well, but that's still more IE oriented)
It also comes with WYSIWYG handheld authoring and everything else Opera's rendering engine supports, like SVG and other useful features.
If you wonder why I consider this product superior to Nvu, a similar software program on the Gecko engine, just create something in that program. You'll get:
XHTML
<span style="font: Verdana 10pt">text</span>Validating? Yes. Better than using
<font>? No way. GoLive CS2 will do this better.So, if you want to recommend something to someone who wants to do some easy stuff, recommend this.
-
Content Negotiation
In this entry I will discuss how to use content negotiation to your advantage and offer the correct mime-type for your code to the browsers which can handle it.
Last year, I only used to check the HTTP_ACCEPT header of a browser for the presence of application/xhtml+xml, which can be done easily by using:
PHP
<?php
if (stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml'))
{
}
?>However, conversations with others showed me that this is not the right way to do this, because if a browser adds a q value to the HTTP_ACCEPT header (like application/xml;q=0.9), it's telling you that it accepts it, but doesn't prefer it above mime-types with a higher q value (no q-value means that it has a value of 1). Therefore we need to build-in another test before we serve the document as application/xhtml+xml:
PHP
<?php
if (stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml'))
{
if (preg_match('/application/xhtml+xml;q=0(.[1-9]+)/i', $_SERVER['HTTP_ACCEPT'], $matches))
{
$xhtml_q = $matches[1];
if (preg_match('/text/html;q=0(.[1-9]+)/i', $_SERVER['HTTP_ACCEPT'], $matches))
{
$html_q = $matches[1];
if ($xhtml_q >= $html_q)
{
$mime = 'application/xhtml+xml';
}
}
}
else
{
$mime = 'application/xhtml+xml';
}
}
?>This code checks which one of the mime-types you can offer is preferred by the browser. The default value of
$mimewas already set to text/html, because that is what any browser will be able to handle.Next, you might be aware that the W3C validator is perfectly capable of handling application/xhtml+xml, but doesn't say so in its accept header. As such, we'll add a few extra lines.
PHP
<?php
if (stristr($_SERVER['HTTP_USER_AGENT'],'WDG_Validator') ||
stristr($_SERVER['HTTP_USER_AGENT'],'W3C_Validator') ||
stristr($_SERVER['HTTP_USER_AGENT'],'W3C_CSS_Validator')
)
{
$mime = 'application/xhtml+xml';
}
?>Now the W3C Validator will receive application/xhtml+xml as we want it to.
We still need to modify the actual header information and, as a finishing touch, we want to state that the document is XML when it gets an XML mime-type.
PHP
<?php
header('Content-type: '.$mime);
if ($mime == 'application/xhtml+xml')
{
print '<?xml version="1.0" encoding="UTF-8"?>';
}
?>The complete code will thus be as follows.
PHP
<?php
$mime = 'text/html';
if (stristr($_SERVER['HTTP_ACCEPT'],'application/xhtml+xml'))
{
if(preg_match('/application/xhtml+xml;q=0(.[1-9]+)/i',$_SERVER['HTTP_ACCEPT'],$matches))
{
$xhtml_q = $matches[1];
if(preg_match('/text/html;q=0(.[1-9]+)/i',$_SERVER['HTTP_ACCEPT'],$matches))
{
$html_q = $matches[1];
if($xhtml_q >= $html_q)
{
$mime = 'application/xhtml+xml';
}
}
}
else
{
$mime = 'application/xhtml+xml';
}
}
if (stristr($_SERVER['HTTP_USER_AGENT'],'WDG_Validator') || stristr($_SERVER['HTTP_USER_AGENT'],'W3C_Validator') || stristr($_SERVER['HTTP_USER_AGENT'],'W3C_CSS_Validator'))
{
$mime = 'application/xhtml+xml';
}
header('Content-type: '.$mime);
if ($mime == 'application/xhtml+xml')
{
echo '<?xml version="1.0" encoding="UTF-8"?>'."n";
}
?>Before you add this to your site, you should ensure that it is well-formed, or display will break in conforming browsers. Enjoy.
Browse Blog Archives
« March 2005 April 2005 May 2005 »
Sponsor: Sunbird Calendar Application
Manage your schedule easily and store it where you want to. (external link)

