Admin Control Panels

Not given this issue much thought yet but I wonder whether having admin control panels are neccessary, certainly in their current form. When creating a blog post or forum post, there’s no more logical place to do it than on the blog or the forum itself. Why does a totally separate interface exist for creating forums or creating categories? If you want to edit a forum topic, you can do it right there. But if you want to edit a forum, you need to log in somewhere else and do it in an interface which is totally different.

I presume the main reason is for security – if you left your computer logged on your website, someone could do limited damage before logging in again. A separate interface may not be the only solution. The software can be designed in such a way when a user would do an action which makes large changes it prompts the user to re-enter their password.

Putting content and user control back into the main interface may give a better workflow. Of course there’s going to be general settings such as board name, e-mail configuration, etc. These could exist as part of the main script as an additional page; it doesn’t need to necessarily be a totally separate script.

XML safe entities with TinyMCE

Currently I use RSS 1.0 with the content stored in a content:encoded property of each item. The full content of blog entries is in the RSS entries. Of course, in XML documents everything must be nested properly, ampersands need to be encoded, etc. People find all kind of strange ways of getting around this requirement and allowing tag soup to be placed in RSS documents. The content:encoded property kind of allows that – if there is a mismatched tag the RSS file will still work.

However, the requirement for properly encoded characters remains. TinyMCE to the rescue! By default, TinyMCE will ensure that anything that needs to be an entity is an entity. If you type £, it generates £ If you type &, it generates &. For some reason, XML doesn’t support all the entities that HTML does – £ is an invalid XML entity. However, the numeric version of the entity, £ works and is valid.

To ensure valid RSS, I tried to set the "entityencoding" : "numeric" property on TinyMCE. It kind of worked – it produced valid numeric entities instead of named entities. This option seems to have a serious bug however; when you try to use an angle bracket it doesn’t encode it. The "hack" which solved it was to use named entity encoding but to configure the names to produce numeric entities.

entities :
encoding : "named",

Switching to HTML

Just yesterday me, neonDragon and a few others were having a chat about XHTML and HTML in #evolution about whether we should use XHTML 1.0 or HTML 4.01.

I caught the XHTML bug around 2 years ago so I actually haven’t written a line of HTML for about that long. I’m using XHTML 1.0 Transitional almost exclusively across all of my sites, sometimes XHTML 1.0 Strict. I’m quite happy with XHTML but it’s true that there haven’t been many benefits.

If you visited this website several weeks ago, you probably wouldn’t have noticed it was sent to you using the application/xhtml+xml mime type providing your browser supported it. For Internet Explorer users, you got the text/html MIME type. This worked fine but sometimes problems could be caused by an non-encoded ampersand or something. Before I added the WYSIWYG editor, I removed the application/xhtml+xml MIME Type because I couldn’t guarantee bulletproof XHTML.

The big problem is this: I can’t guarantee the user submits valid XHTML. Markdown did a pretty good of generating XHTML but it wasn’t perfect. With the application/xhtml+xml MIME type, all it takes for a user to break a web page is to submit content with an unencoded ampersand. If you want to be so dramatic, call it a "denial of service".

I do wonder whether XML_HTMLSax could ensure bulletproof XHTML but I’ve never really tried it. The SafeHTML library I use actually converts ensures tags are closed and stuff as an side-effect but it misses things such as unencoded ampersands.

In the last year or so, HTML 4 has become more popular again. Hixie’s complaints about MIME types (Sending XHTML as text/html considered harmful) is probably one of the most frequently quoted articles on the HTML VS. XHTML debate. Anne van Kesteren writes today on the Rise of HTML:

I guess people have noticed that XHTML 1 is not forwards compatible. At least not with XHTML 2 which is not backwards compatible. HTML 5 on the other hand has a clear migration path. Or perhaps it is none of that bullshit and it came out quite clearly that there where zero benefits. 

One of the reasons I’m seriously thinking about going back to HTML 4 is because HTML 5 is really exciting and it seems like it’ll be out and be supported by browsers way before XHTML 2 is. (Whether IE will support it is a different matter; to be honest I wouldn’t be surprised if it decided to support XHTML 2 at the same time as Web Forms 2) but at least HTML 5 is more backwards-compatible than XHTML 2 is.

What’s the real difference between valid XHTML and good HTML anyway? A few /> to close tags and making sure entities is encoded correctly?

For the moment I think I’ll keep using XHTML. TinyMCE produces XHTML. The XHTML might not always be perfect but it’s XHTML, not HTML. To return to HTML would mean modifying TinyMCE to produce valid HTML – without the self closing tags for example. The same thing applies to other scripts I use such as SafeHTML and PHP itself. A PHP error message is technically invalid HTML as it has a self-closing br tag. 

Hopefully switching to XHTML 1.0 Strict with application/xhtml+xml will become more practical soon. And whats to stop someone from implementing HTML 5 in an XML format? XHTML 1.2 perhaps? 

Styling text selection colours

I just discovered that you can style the user’s text selection using CSS 3. At the moment it only works in Gecko and Safari – Safari supports it through the official ::selection whilst Mozilla supports it through the proprietary ::-moz-selection rule. I used the following two rules to change the selection colours:

::-moz-selection { color: black; background: #A0B7CC; }
::selection { color: black; background: #A0B7CC; }

There was no real good reason for doing it apart from that it looks hip. Accidently discovered at moo.fx, more info at Quirks Mode.

Geneone 0.4.3 Technology Preview Released

Well, I’ve finally been able to make available a technology preview release of Geneone – the software which powers this blog. This includes many of the features I’ve talked about over the last months including WYSIWYG Editing, Similar Entries and IntelliAnswer. This release also contains the object system which I use. This release is buggy and unfinished. There are bits of code which cleaning up, bits of code which are redundant, and things which need to be shuffled around.

Get it here 

You should only download and install this release if you are comfortable with PHP. Please read the Readme.txt file first; the install.txt file contains some basic instructions on how to set up Geneone. If you are getting a HTTP error 500, try renaming the .htaccess file to something else. If the index.php file is blank, check out rdf.php and see if it presents any errors.

The genescripts/ folder has 3 examples of scripts which integrate with Geneone. Integration with other scripts and being able to write useful scripts utilizing Geneone’s API should become a major selling point in the future.

Feedback, comments and bugs are welcome.

Microsoft building web-based office suite?

A while ago it was rumoured that Google and Sun were building a web-based office suite. The rumours turned out to be false (so far at least) but it now seems Microsoft is rumoured to be building a web-based Office suite.

According to ZDNet, a Microsoft insider said said "Everything. Hosted Office. Everything hosted" when asked what applications Microsoft plans to offer hosted as services.

If this is true, Office 12 may be the last desktop office suite from Microsoft. Perhaps "Office 13" will take advantage of some new functionality in Vista such as XAML and would allow some basic things to be done offline but files, tools such as spelling, etc. to be done online. The disadvantage of hosted web applications is that if your connection breaks or something, you can’t carry on with your work and you may lose data and time. 

I do wonder how practical it would be to create a fully 100% online office suite.

Liquid Sculpture

Came across this wonderful website today. It contains images of liquid in shapes created by dropping or splashing water. The photographs are taken at high speeds with flash to "capture the moment". There are pictures of liquid sculpture created from water, food colouring, milk and oil.

It’s well worth taking a look through the gallery – there are some really nice images. The free fall gallery and squirts gallery contains some of my favourite snaps.

I can’t imagine the amount of work it would have taken to create these images; there’s the artistic elements, photography and the science behind surface tension and viscosities.

Mystery of the Missing HTML: Solution

Many of you have worked out or discovered the solution for the HTML mystery I posed 1 week ago. To recap, it’s a 0 byte HTML page (excluding comments) with images, text and rollover effects. It was quite interesting to see what people wrote on forums, blogs and comments.

Some of the incorrect answers… 

Some people suggested that I was using a proprietary technology which only worked in Mozilla such as XBL or XUL. Wrong. The mystery page follows standards – the HTTP header used is defined in RFC [some random meaningless number]. The stylesheet used should be valid CSS 2.1. Obviously the page itself wasn’t valid as it didn’t contain any content. The demo page also works in Opera 9.

There was a suggestion I was getting Javascript to create the page and then using Javascript to somehow disable or modify the “View Source” functionality of the browser. Interesting ideas; I’m not sure if this is possible but you need one Javascript tag and you can create a DOM and a fully functioning web page. Whether you could then disguise the fact your including Javascript is another matter.

PHP Magic
There was also some suggestion I was doing some magic with PHP. PHP is a server side language which generates HTML and can’t cause something like no source code. Well, it kinda can…

The reason I used PHP was because I needed to send a special HTTP Header:

Link: <nocode.css>; REL=”stylesheet”; MEDIA=”screen”

This HTTP Header is the equivalent of sending a link tag in the head section of the HTML page. The second trick in using CSS was that not many people knew what CSS could do – rollovers, inserting content, images. The following CSS file was used:

body { background: #9EAEB3 url(grad.jpg) repeat-x top; font-size: 20px; text-decoration: blink; font-weight: bold; }
body:after { content: “This page contains 0 bytes of HTML (excluding comments). View the source code, no CSS! Move your mouse here…” }
body:hover { text-decoration: none; color: green; }
body:hover:after { content: “Look, no Javascript, ma! View source… ” url( ””; color: white; background-color: blue; font-size: 24px; line-height: 36px; }

The content attribute allows you to add generated content into a webpage. In practice, this is sometimes used in the printer stylesheet to display URLs linked. For example, a:after { content: “(” attr(href) “)”; } will display the URL of the target page of each hyperlink in the page. The :after and :before pseudo-classes allow content to be added before or after the element.

:hover is also a cool pseudo-class but most people will probably have used these now on their hyperlinks. Back in the day, many people used Javascript for text and image rollovers. 

I do think including stylesheets using HTTP headers is quite a neat trick – perhaps this could be a new method of sending stylesheets only to Gecko and Opera 9+. A “hack” if you like. 

Congrats if you got it! 


moo.fx is a small, light weight JavaScript effects library. It weighs in at 3KB but you’ll also need prototype.js; a light version of prototype included in the download weighs in at another 3KB. Check out the test page to see some of the effects it can do.

At the moment, I’m using the Rico library for effects; I don’t use “AJAX”, Drag and Drop, LiveGrid, etc. On Evolution we use the Rico library with the extra features we don’t use removed. The resulting library is 38KB plus an extra 29KB for Prototype. It seems like moo.fx can do quite a lot of what Rico can do and there is an Accordion-like effect demonstrated on the moo.fx homepage.

moo.fx also claims better Opera and Safari support which is also a bonus. I’m not sure whether I have the energy to migrate Evolution to use moo.fx but it’s certainly a library I’d look at for further use in any similar projects. It’s also open source and released under the MIT license :) 

Similar Entries

I just added a ‘Similar Entries’ section to each blog post. This is highly experimental. It finds 5 blog posts which are similar or relevant to the current blog post. It does this by automatically finding key terms in the blog post using Yahoo!’s Web Services. These are then stored as “tags” or taxonomies in the database. The blog then finds other blog posts with the same keywords and orders them by relevancy.

As it’s experimental, I’ve left quite a lot of debug/test information in – the keywords generated and the “score” of relevant entries. It’s working quite well in some cases; for example on the blog post “Opera to become free?“, it links to a later post when Opera does become free, Opera 8.0 upgrading and some web statistics. Some of the keywords which Yahoo! returns don’t make much sense – on the “Opera to become free?” article it gives key terms such as tries and competes. The automatic key term extraction implementation probably needs some work – perhaps I need to make it only select the most important 5 or so terms to store as labels/tags for that object.

The key terms are generated when the blog post is created. For the older blog posts, I wrote a PHP script to generate them.

/* Load configuration file */
require (“path-to-config-file.php”);

/* Load required core libraries */
define (“IN_GENE”, TRUE);
require (“loader.php”);

$blog = Gene::getObject(1);
$childs = $blog->getChilds();

foreach ($childs as $i) {
    $object = Gene::getObject($i[‘object_id’]);
    $taxonomy =& $object->getTaxonomy(1);
    echo ‘Done ‘.$i[‘object_id’].’\n’;

It’s quite a nice script at 18 lines and shows how easy it is to integrate your scripts with Geneone.

It’d be interesting to see how scripts such as vBulletin find similar topics. If anyone has any knowledge, please share it! Greatfully appreciated!