Archive

Archive for August 15th, 2002

googleTitleSearch

August 15th, 2002 No comments

For a while now, I’ve been using Jake’s googleTitleSearch macro to auto-populate the “see also” links after my posts. But I’ve been noticing more and more that all the links that Google is offering for some titles are the same – particularly when I link to articles at sites which operate on multiple URLs. I’m sure Google will sort out this problem eventually, but in the meantime I’ve made a few changes to the macro so that if I create a link for a post, it will do a google search on what is related to that, instead.

The macro, with my changes highlighted:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
on googleTitleSearch (adrpost) {
  local (htmltext = "");
  if defined (adrpost^.title) or defined (adrpost^.link) {
    try {
      local (adrSearchResult = @adrpost^.googleTitleSearchResult);
      if not defined (adrSearchResult^) {
        if defined (adrpost^.link) {
          adrSearchResult^ = google.search ("related:" + adrpost^.link)};
        if not defined (adrSearchResult^) or adrSearchResult^.searchComments == "Sorry, no content found for this URL" {
          adrSearchResult^ = google.search (adrpost^.title)}};
      local (adr);
      for adr in @adrSearchResult^.resultElements {
        try {
          local (url = adr^.url);
          local (title, tooltip);
          if sizeOf (adr^.directoryTitle) > 0 {
            title = adr^.directoryTitle}
          else {
            title = adr^.title};
          title = searchEngine.stripMarkup (title);
          title = string.replaceAll (title, "...", "");
          title = string.trimWhiteSpace (title);
          if sizeOf (adr^.summary) > 0 {
            tooltip = searchEnging.stripMarkup (adr^.summary)}
          else {
            tooltip = searchEngine.stripMarkup (adr^.snippet)};
          tooltip = string.replaceAll (tooltip, """, "&quot");
          htmltext = htmltext + "<a href="" + url + "" title="" + tooltip + "">" + title + "</a> | "}}};
    if sizeOf (htmltext) > 0 {
      htmltext = string.mid (htmltext, 1, sizeOf (htmltext) - 3)}};
  return (htmltext)}

Dijkstra on ‘narrating your work’

August 15th, 2002 No comments

If there is one “scientific” discovery I am proud of, it is the discovery of the habit of writing without publication in mind. I experience it as a liberating habit: without it, doing the work becomes one thing and writing it down another one, which is often viewed as an unpleasant burden. When working and writing have merged, that burden has been taken away.

The habit is also liberating in a much more profound sense. I consider, for instance, EWD975 on the Theorem of Pythagoras – of all theorems! – a major acievement of last semester. It was an unadulterated pleasure to write it; one of its recipients called it “absolutely bloodly marvellous”. Had I only written with publication in mind, it would never have seen the light of day. Not only would aforementioned recipient have been denied his enjoyment, I would have been so too: what I sent out was Sunday’s version, which I could only write after the discovery that I could still improve on Saturday’s version. The only way to discover that a neglected or ignored topic is worth writing about is to write about it.

The EWD-series seems a little unusual. If it is sufficiently unusual to represent a novel style of doing science, the development of that style may be one of my major contributions.

EWD1000