Tuesday, May 28, 2002

Author, author!
Low End Mac published results of a survey about What we hate on the web.

An interesting one was:

Articles with unidentified authors
729 votes (164/245/173/111/36). 22.5% don't care, 57.3% dislike it somewhat, and 20.2% hate it when a site doesn't identify its writers.

This interests me because one of my favorite lunchtime reads is The Economist, which very very rarely identifies its writers. It doesn't bother me at all. At the same time, however, it is a rather solid and respectable magazine. In a sense, it's almost a big magazine blog. It has short articles, wide geographical and topical coverage, and is as timely as a printed weekly can be.

When it comes to blogs and other web sites, I haven't yet figured out when I care about the authors name and when I don't. In general, I trust The Economist. I think that anonymous correspondent reporting works out well for it, and I think it probably works out for similar styled web sites/blogs as well.
1:39:50 PM  blips[]    

Templates, code, and HTML
Half of our power is out, but the airport base station and the gateways are still on. So, todays teaser medicine consists of a Python translation of some UserTalk code I wrote (the first major script I wrote in Radio), runnable as an External Method in Zope. Also included is the UserTalk code, as well as some DTML and ZPT output.

I show this because, personally, I loathe coming across HTML in code. Sorry Jon. Writing for templates increases possibilities for reuse, since the data producing code is independent from the code that displays it. While you can do this in pure python scripts (by having one script produce data, and have another script as a consumer that outputs HTML from within Python), I take a "why bother?" attitude. I've had to maintain that HTML generating code in the past - the long ago past in web time (1996). And I hated the maintenance chores that seemed to go along with even the most trivial HTML. Why do we keep reinventing old problems? The script-inside-HTML way is often as broken, in my mind, as the HTML-inside-scripts way. It always surprises me to see ASP/PHP code that looks like::

  <% for row in data {
    out.writeln('<td>' + row.name + '</td>');
  } %>

Why bother having the HTML abilities of ?SP/PHP languages at all? I can understand why it happens. I just don't think it should. . But, in the words of Dennis Miller, "Of course, that's just my opinion, I could be wrong".

In any case, I present the Goldberg Variations:

import os
radioWwwFolder = '/Applications/Radio Userland/www'
def listOutlines():
	out  =[]
	path = os.path.join(radioWwwFolder, 'outlines')
	def visit(arg, dirname, fnames):
		for fname in fnames:
			if fname.endswith('.opml'):
				fn = os.path.splitext(fname)[0]    # Split extension off
				if dirname != path:
				    # Deal with subdirectories
				    fn = os.path.join(dirname[len(path):], fn)
	os.path.walk(path, visit, out)
	return out
ZPT = """
 <li tal:repeat="item here/listOutlines">
  <a tal:attributes="href string:${item}.html"
DTML = """
 <dtml-in listOutlines>
  <li><a href="&dtml-sequence-item;.html"><dtml-var item></a></li>
on listOutlines() {
	local(out = "<ol>\n");
	local(path=user.radio.prefs.wwwFolder + "outlines");
	on visit(f) {
		f = file.fileFromPath(f);
		if string.hasSuffix(".opml", f) {
			f = string.popSuffix(f, '.');
			out = out + " <li><a href=\"" + f + ".html">" + f + "</a></li>n"};
		return true};
	file.visitFolder(path, 1, @visit);
	out = out + "</ol>";
	return out

11:15:14 AM  blips[]