Thursday, 14 June 2007

W3C Validator is not infallible

If you want your pages to be considered valid, you probably use W3C's mark-up validator. This thing is pretty smart - even though some of its messages don't make a lot of sense.

I used to think it was infallible, but I should have known better. Like CSS and JavaScript inconsistencies across browsers, the W3C validator is also not quite perfect.

I recently used to it validate some php pages. Obviously, the validator only validated the X/HTML that was rendered, but it failed to pick up the following slips.

I had to edit what was a textarea, to make it a simple text input box:


<td class="hr"><textarea name="street_address_1" rows="4" cols="35" maxlength="100"><?php echo str_replace('"', '"', trim($row["street_address_1"])) ?></textarea></td>


<td class="hr"><input maxlength="100"

Even though I had failed to remove the </textarea> tag in my edited version, my page validated.

On top of this, I had a few instances of
<input type="checkbox" value="Yes" name="is_publisher">

The validator ignored the fact I hadn't closed the tag, and I'm pretty sure that's a basic requirement of XHTML 1.0 Strict Mark-up!?

Sunday, 10 June 2007

MySQL says "boo" to booleans

MySQL is supposed to be "all that". Simpler than SQL yet just as powerful (and hey, it's free, so I ain't complaining here)... however, I was pretty surprised to find that there's no data type called "boolean" in MySQL. If you want to do something as simple as store a 'yes' or 'no', you've got to use the enum data type and then create a string of values that will represent your options, eg.

For yes/no radioboxes on a form, you'll need to use
enum('1', '0')
as your data type, where 1 = 'yes' and 0 = 'no', but you could use whatever labels you wanted, eg. 999 = 'yes' and 666 = 'no'.

Mind you, enum is pretty cool, because unlike the narrowminded boolean, enum will allow you to extend your list of options, eg.

For a form with a drop-down box containing the following options:
- Yes
- No
- Occasionally
- Prefer not to answer

You could use
enum('1', '0', '2', '3')
as your data type.

In this example, 'Yes' = 1, 'No' = 0, 'Occasionally' = 2, and 'Prefer not to answer' = 3.

Thursday, 7 June 2007

Please explain indexing...

So the DMT class is over but I figure I'm gonna do a few more blog posts - I just might pass this subject if I blog on the things I thought were interesting 10-12 weeks ago... but as for this blog, it's about something I just learnt (this betrays the status of my 'System Build')... indexing in MySQL, what a neat function. Now I understand how clever uses of the index feature can speed up data retrieval in a database.

Thank you Ian Gilfillan for explaining this in "Optimizing MySQL: Queries and Indexes".

Basically, the index feature allows the quick look up of data. For example, rather than scouring an entire databases for someone's name, if you index the 'firstname' and 'lastname' columns of your 'contact' table, when you run a name query, these columns get queried first - so rather than looking through your entire database until your query gets lucky, it looks straight at where the data sits.

Ian also covers the EXPLAIN query in MySQL, which enables you to QA just how efficiently you have used the index feature. I know this is a bit late for a lot of my fellow students to take advantage of, but it's a handy tip nonetheless.

Monday, 14 May 2007

Entity Relationship Modelling

I started filling out Excel worksheets with column names for a DB I'm creating for my DMT class. Each worksheet represented a table in my DB. I realised that my brain would soon explode unless I had some way of plotting how the tables related to eachother. I searched the web and found two gems...

The first is a library of exisiting database schemas for common systems <>. These are handy blueprints to have and I recommend that my fellow DMTers browse through it (unfortunately, it didn't have anything that quite fit what I'm building). What I got out of it was being reminded of the notation that's used in Entity Relationship models (I was also reminded of the term "Entity Relationships"!).

originally proposed by Peter in 1976 [Chen76] as a way to unify the network and relational database views. Simply stated the ER model is a conceptual data model that views the real world as entities and relationships.

( viewed 14th May, 2007)

The part I love most about ER modelling is the notation used. Once you learn it, it makes you feel smart - and it's so easy. Any time-poor sod can learn it within a few minutes. "Crows feet" and "one-to-many" relationships etc. the following diagram sums it up really well. Can't wait to add it to my System Plan, I almost feel like a real IT geek.

Click here for full-size image.

Sunday, 6 May 2007

XHTML Not Fully Supported by IE?

While researching for my DMT "Micro and Macro Analysis", I came across a web page that surprised me. It seemed to say that XHTML is not fully supported by IE (should I be surprised?). The page can be found at <>.

I included this 'IE' fact in my "Analysis" but it seemed like a bit of a lazy blanket statement so I revisited the above web page tonight - to try and make sense of what the test results actually mean. I am having trouble understanding what it does means and would love if someone could throw a layman's explanation my way.

Basically, what is the difference between the four scenarios being tested?:
1. text/html
2. application/xhtml+xml
3. text/xml
4. application/xml

And how do these different 'types'(?) exist in an XHTML document? What would the declarations for each look like? I looked at sample code for 1. and 2. and can't actually see any difference!?

Example for 1. <>
Example for 2. <>

Tuesday, 24 April 2007

Surprising Blog - PHP uses less resources than ASP .NET!

I usually yawn at the thought of reading blogs, until I find myself drawn into one after a casual web search. When I find myself wanting to reply to the blogger, then I am really shocked. One such blog/ger caught my eye tonight... the URI is and yes, I even made a comment, the same I want to make here:

For years I worked with some developers who said ASP was absolutely the way
to go, and that PHP was rubbish because it sucked up system resources, so it's
very interesting to read that "PHP code is much faster, ASP is developed on the
COM based architecture, this is an overhead for the server."

It is interesting to note that it seems this blogger uses "ASP" to refer to ASP .NET, when officially, ASP does not use the .NET framework at all (because it's an older version of the technology, with a file extension of .asp rather than .aspx). I wonder if this abbreviated term will become the norm - as more systems move to .NET and no one remembers ASP ever existed without it?

Sunday, 22 April 2007

Final Learning Contract for Digital Media Technology

I have updated my Learning Contract - it is no longer going to be a system to update flash ads using XML but rather a database to contain publisher's rich media advertising specifications. I made this change because of the demand for a system such as this at work. I figured that I could sneak it in as part of this project and "kill two birds with one stone".

My updated Learning Contract has also moved home - from the UTS servers to a privately hosted space at: