The Four Pillars of the Web

My old high school was deeply involved in Round Square – an international organization of high schools that practiced education that strongly aligns with the following “pillars”:

  • Internationalism
  • Democracy
  • Environment
  • Adventure
  • Leadership
  • Service

My XML teacher mentioned this in the current week’s discussion, almost as a passing thought, but I thought this was a poignant list that is worthy of expounding upon here. These pillars are:

  • Valid code
  • Accessible code
  • Semantic code
  • Separation of content from presentation

Valid code (standards compliance)

Web code should validate according to the specifications set forth for what you’re using. Browsers today often let you get away with murder here by still allowing tag soup to occur – mostly due to documents being still served as text/html instead of application/xhtml+xml. Blame IE6 for now. But standards-mode does exist in all modern browsers, enabled by the power of the DOCTYPE declaration – a simple declaration of independence from browser-lock. Imagine an enterprise architecture, nay an entire Internet, where web applications are completely standards-compliant and the user could move freely between platforms, applications, browsers, and websites without fear or concern for compatibility.

Accessible code

Creating accessible code means thinking about the bare framework of your website infrastructure first, and adding on bells and whistles in a way that gracefully fail over in case of a problem on the client. You can’t predict what people will want to use when they show up to your website, so start with the lowest common denominator. Turn off all your CSS, Javascript, plugins, and images. Only deal with your app in terms of the HTTP requests coming in and out, and the HTML that presents itself. Would you build a house without pouring a foundation first? Heck no. Make a purely accessible web experience your foundation and then add your 15 pieces of flair, Mr. Fancypants. Make sure that your site is as usable to a Lynx, phone, or screenreader user as it is to your cutting-edge IE7 and Safari 3 folks.

Semantically correct code

What the hell is this box of beer bottles doing in my garage? Had I tagged it appropriately, I would clearly see that it is glass non-twist-off bottles suitable for home brewing. Not that I am able to drink most homebrew due to the barley malt causing me reactions due to celiac disease, but I digress…

XML encourages the web author to tag their content appropriately, explaining in-line what the meaning is for each item. Using XML technique in coding your XHTML documents means you are applying more meaning than the usual “here’s a paragraph” markup, information that could be used by future generations. Won’t somebody think of the children?!?

Separation of content and presentation

Spend some time at the CSS Zen Garden and you get the point. Content and presentation do not like to sleep in the same bed. They like to flirt with each other, play the field, sleep around. Tying them together with presentational markup and inline styles just means an unhappy, possessive relationship where neither party is able to grow.

So those are the pillars. Things I’m sure the Round Square would approve of. Keep these in mind and help your code realize its true potential as a member of society.

Creating a TextMate Drag Command for xml-stylesheet

Applying CSS to an XML file is easy, well supported in modern browsers, and can be quite handy at times. For instance, slap some lipstick on that RSS feed. Sick of the tag soup of HTML-land? Make the switch to pure XML web pages with xml-stylesheet!

And now a quick tip for simplifying your venture into xml-stylesheet for TextMate users…

You can create a Bundle Item in TextMate that works just like the CSS Drag Command. Here’s what to do:

  1. In TextMate, choose Bundles > Bundle Editor > Show Bundle Editor.
  2. Click on the “plus” button at the bottom right of the Bundle Editor window and choose New Drag Command…
  3. Name it something like Insert xml-stylesheet.
  4. Enter css in the File Types field.
  5. Now for the money shot – in the Commands textarea, enter the following code:
  6. In the Scope Selector field, enter text.xml
  7. Close the Bundle Editor and choose Bundles > Bundle Editor > Reload Bundles

Now you may simply drag your CSS file from the TextMate file drawer into your XML document and a link to the CSS file will be generated by xml-stylesheet. Fill out the rest of the properties as needed.

As you can see, the prototype for linking a CSS file in XML is strikingly similar to regular HTML. It accepts the same properties. Type and href are required, the rest are optional.

One pitfall in XML CSS: Many browsers do not grok .foo syntax in your css file. Instead you may use *[class="foo"]. Be sure to declare your IDs in your DOCTYPE, such as:

< !ELEMENT foobar (#PCDATA)>
< !ATTLIST foobar id ID #REQUIRED>

People think they are funny.

In Basses, Planes, Trains, and Automobiles Part 2 – Trains, Jason writes:

People think that they are very funny — One of the most annoying things about carrying a bass around town is having grown people gape at you, slack-jawed like drugged cattle, as you struggle to get from point A to point B. You know how cattle all slowly turn their heads and stare at you as you walk past them on a country road? That’s just what your fellow commuters do.

After staring for a while, a light bulb goes off in the back of their commuter minds.

“Hey,” they think. ” should make a humorous remark directed toward that person carrying that strange thing! What a great idea!”

They close their gaping mouths, wet their lips, and blurt,

“Did’ja ever think of playing the piccolo? Haw haw haw haw haw haw haw haw!”

this so reminds me of riding the T to gigs back in Boston. My favorite moment was when a fellow bassist and I were riding back on the Green Line from a rehearsal with our basses on one of those tiny little cars, and we received this exact same comment about how we should have picked the flute. Because the face on my friend after that one was priceless – looked like he just took a sip of 2 day old Pabst Blue Ribbon where someone dropped their coals in. I laughed out loud and our stand-up comic erroneously thought she was hilarious.

Penguin suitSome others I’ve heard whilst dragging my bass through the snow:

  • Is that a body in there?
  • Is that your canoe?
  • That’s a big cello/guitar/whatever!
  • How do you get that in your car/a taxi/on the train?

Every single time. Like clockwork. Try it. Walk down a busy street with a double bass in a case and see what you get. You will be running home frantically searching for the Absolut in no-time.

I get the same sorts of inane chatter from having a homophonically similar famous boxing legend.

8 Random Things

I’ve been hit with a meme. I usually ignore these. It’s like getting hit with a tax bill. Or a subpoena. But for a couple of reasons I’m following up on this one. First of all, it came about because of very special circumstances that are close to me – a person whom I have never (probably) met, but who crossed paths with me when I was very young. Second, because I have a raging case of ennui (I feel so Henry Miller) this afternoon and need something to move me forward. Lastly, this reminds me that I need to stay a bit more up to date my primary node contacts in the blogosphere.

The rules for this meme are:

  1. Let others know who tagged you.
  2. Players start with 8 random facts about themselves.
  3. Those who are tagged should post these rules and their 8 random facts.
  4. Players should tag 8 other people and notify them they have been tagged.

Eight random facts. About me? Hmmmm… OK, I think in the spirit of this exercise, I am going to avoid talking about anything obvious such as “I play the bass” or “I speak a little Mandarin.” I’ll have to think about this one. Here goes:

  1. I almost always wear black. I’m not a goth or some depressing artiste or something. That’s just my innate preference. I don’t know why – someone who I had not seen in over 20 years pointed this out to me last October at an event at my old high school Athenian last October by saying “I remember you used to always wear black.” I was in fact wearing a black shirt under a gray suit with a long black overcoat. What can I say? I’m a winter, not a summer…
  2. Cloudy, misty, foggy, cool weather is my favorite climate. I’m not big on hot or even warm weather. Again, this has nothing to do with the wearing black thing.
  3. My Myers-Briggs personality type is ENTP. This is generally classified as extremely creative, scholarly, verbose, and really terrible at follow-through. Nothing could be more true on that last point at least… 😉
  4. I began playing the double bass at the age of nine and started guitar around twelve. I planned to major in both until it was recommended that I narrow it down to one for NEC – where I settled on the double bass. To this day I still practice both. This may very well be related to my ENTP-ness as mentioned previously.
  5. I am writing out a blog post for this meme, when I should be finishing up my homework! 😉
  6. I think I may have had celiac-like symptoms as early as at age 25. I was finally diagnosed two years ago, at 37. After going gluten-free, I can truly say that I haven’t felt this healthy since my early 20’s.
  7. I have had a strong feeling for the past couple of years that civility has been mostly lost from society. I was particularly pleased to see that the person who memed (is that a verb now?) me had also recently blogged on this very same subject.
  8. For some odd reason, I am fascinated with remote human habitation in extreme climates or remote locations. Some that have caught my attention include Svalbard, Tristan da Cunha, and space habitats.

OK now to assign some pumpkins:

  1. Michael
  2. Matt
  3. Jason A.
  4. Jason H.
  5. Steph
  6. Brandon
  7. Seamaiden
  8. Ellen

There you go – my one and only, and probably final contribution to blogmemedom. I think I have less ennui now, because I have this pressing urge to finish my homework.

Set up XML Schema as XML in TextMate

Odd that this was not set by default, but TextMate did not include XML Schema (.xsd) documents to be recognized as XML. No matter – TextMate is beautifully extensible. This is easy to set using TextMate’s Bundle Editor for this and any other document extension that you’d like to be recognized as XML:

  1. In TextMate, choose Bundles > Bundle Editor > Edit Languages. This filters bundles to only show language options.
  2. In the Bundle Editor, expand the XML category and select the XML language icon.
  3. The second line sets a variable for “fileTypes”. Add .xsd to the comma-separated list.
  4. Close the Bundle Editor and you’re done.

The Bundle Editor in TextMate is a really powerful utility for customizing the handling of any language coding. This is a simple example, but it certainly opens the door to much more customization and functionality.