Joelith's Journal

Really?

Tuesday 21st October, 2008

Evaluating Javascript libraries at work and I initially decided upon Dojo. It had some nice features, lot's of widgets and some great unit testing stuff. Now that I've actually sat down and started to play with the code I've had to change my mind. Dojo is bloat-ware. For instance, the 'Hello World' tutorial has the following code:

 <style type="text/css">
        @import "ui/javascript/dijit/themes/tundra/tundra.css";
@import "ui/javascript/dojo/resources/dojo.css"; </style> <script type="text/javascript" src="ui/javascript/dojo/dojo.js" djConfig="parseOnLoad: true"></script> <script type="text/javascript"> dojo.require("dijit.form.Button"); </script> </head> <body class="tundra"> <button dojoType="dijit.form.Button" id="helloButton"> Hello World! <script type="dojo/method" event="onClick"> alert('You pressed the button'); </script> </button>

Pretty simple - it just generates a button and when you click it says "You pressed the button". This will load 27 javascript files and take around 2-3 seconds (on my server atleast). What's wrong with:

<button onclick="alert('You pressed the button');">Hello
World</button>

You don't want to know how many files the WYSIWYG editor has to load!

Oh well, back to the drawing board.

Readability

Tuesday 2nd September, 2008

WCAG 2.0 is at release candidate stage and if you're bored already you should probably skip this post! One of the big things about WCAG is that they are attempting to make everything automatically testable. The idea is that you should be able to apply a tool and get an accurate idea of your conformance level. WCAG 1 had too many guidelines that you had to do by hand. Quite a chore when your site has over 30 000 pages.

One of the biggest challenges of WCAG 2.0 is readability. All your content should be written for a lower secondary level (years 7-9). There a number of tools available that you can use to determine your reading level. For instance if I run the tools over this page: http://www.accc.gov.au/content/index.phtml/itemId/ 815327 then I get the following (having stripped out the html tags as they don't count as words):

Dale chall reading grade - Primary (5.6)
Flesch-kincaid grade level - 9.8
Automated readability index - 9.9
Coleman liau index - 12.8
Gunning fog score - 12.6
SMOG index - 9.6

You may know the Flesch-kincaid grade level as that is the one available in Word. As you can see our reading level is too high (but only slightly) in most of the reading indexes (except for the Dale Chall reading grade).

The Flesch-kincaid grade level is defined as 0.39 * average_words_per_sentence - 84.6 * average_syllables_per_word. Research has shown that sentence length is one of the biggest predictors for readability. But here we find a problem: since we are passing in html there a number of elements that should be treated as sentences but don't actually end in a full-stop. Eg: a heading 1 tag will rarely end in a full stop, but for the purposes of this tool it should have one. Ditto for lists, as the style at the ACCC is not to put a full-stop at the end of a list item unless it is actually a full sentence.

So if we add full-stops to the html where needed we get better results:

Dale chall reading grade - Primary (5.4)
Flesch-kincaid grade level - 7.4
Automated readability index - 6.8
Coleman liau index - 12.8
Gunning fog score - 10.1

Now our flesch-kincaid is much better and well within the boundaries of readability.

You'll notice that the dale-chall reading grade hasn't changed much. It is considered to be the most accurate of all reading indexes. It uses a list of 3000 common words (words that will be in the vocabulary of most of the population). If your word is not in there, then it is considered complex and the more complex words you have in a body of text the harder it is to read.

I've modified the code for the php-text-statistics project (as it doesn't take into consideration the html issue and doesn't do the Dale-chall reading grade). I'll hopefully submit this for addition to that project and then everyone can share!

And hopefully that wasn't completely boring to everyone!

How not to organise files

Monday 21st July, 2008

Zend, a PHP programmers best friend. A mostly component IDE that generally does everything you need to design and write PHP (people design in PHP ha!). It's let down in a number of areas (well it's on Java for one). But the one that frustrates me the most is the way it organises open files.

Lets imagine you are working on any project of a decent size. At the ACCC I am/was working on a project to 'webify' the paper-based requisition for travel form. Anyway I have about 30 files open when I'm working on this project. Most of them I need open at once (a couple I looked at once in the project and forgot to close). Zend can handily save the files that are open as a project and I can reload that project and have all those files open next time I start.

The problem is how it manages all these files:


As you can see it's a nightmare. It's not in any order (I think it may be in order of when you opened it). Why can't it be alphabetical at the very least? Worse is when you click on one of the entries in the lower lines. That whole line moves up to the top (since these are considered tabs to the document). This is really confusing since all the other lines shuffle around. So I knew that WorkflowActions.inc was on the 2nd line but then if I activate Email.inc it's now on the 3rd line. This is useless for any more than 7 documents (or enough to fit on one line). I spend a good few minutes looking through the tiny font to find the document that I want.

TextWrangler on the Mac puts the documents down the side in alphabetical order. Coda (another Mac programme) is similiar to Zend but doesn't use tabs, rather each file is effectively a button. When you click it highlights and the document is opened. This solves the problem of the lines being moved around randomly since the file doesn't have to move to the top to 'be attached'.

Crap on TV

Monday 23rd June, 2008

Two comments on current television programmes:

1. Good News Week: GNW is back and it's dropped the stupid variety hour gimmick it had the first time it came to commercial television. And Mikey's back as well. He's lost a hell of a lot of weight but he seems to have also lost his sense of humour. None of his 'jokes' are funny and his timing is way off. The only reason his jokes appear to be funny is because somebody else runs with it and turns it into a funny joke. Also tonight they had this American who was even less funny then Mikey (if that's possible). If they can just drop Mikey (or make sure the rest of the cast is actually funny) then the show should survive.

2. As crap as the Wedge was, are you seriously telling me that the Shane Warne parody was the one that deserved to be turned into spin-off show - 'Mark loves Sharon'. Not that any of the skits on that horrible comedy show (I think it's offensive to real comedy shows to call that bilge comedy) deserved to be spun-off. This is why even American comedy is funnier then the crap that Australians turn out. Ah for a funny Australian sketch comedy show.