The Boston Diaries

The ongoing saga of a programmer who doesn't live in Boston, nor does he even like Boston, but yet named his weblog/journal “The Boston Diaries.”

Go figure.

Sunday, November 05, 2017

The Boston Diaries—now ad free!

Way, way back in February of 2006, I added the block of Amazon products to my blog (and frankly, I'm surprised it was that long ago—who knew?). At the time, I was picking one of the “keywords” (which I keep for all entries, and are more like phrases than actual words) at random from all the entries on the page being displayed. Over three years later (September of 2009, no blog entry about this) I changed to just picking a random “keyword” from the top entry on the page. My thought for that change was that since the ad block always appears next to the top entry, I might get a better response from readers if the book selections from Amazon matched the topic of the entry they were next to.

Okay, there were still the odd problems, like when the keyword “dead zombie languages rising from the dead” was picked (I don't blame Amazon for giving up and displaying a generic ad when given that as a search term). But it was better than before.

Then in January of this year (again no blog entry about this) I thought it might be better to actually pick the “keyword” I sent to Amazon instead of having it picked at random. That might actually improve the selection process a bit more, so I added some code to handle that.

Which brings us to today.

I have noticed over the past month or so that Amazon is always displaying a generic “Shop at Amazon” banner and try as I might, I could not get a list of books (or any other product) to show up. I wondered if the link changed (but Amazon is pretty good about keeping links working) so I checked and no, pretty much the only ads you can run now are either the generic ads like I'm getting (and that's all you can get at the size I use) or ads for a particular product.

Well … darn.

Here I went to the trouble to try to target specific items (mostly books) to readers, and Amazon has finally said, “Nope. Not gonna do it.”

So that's that. The Amazon block is gone. Besides, it wasn't worth it anymore, as I haven't earned enough for a cup of coffee from Starbucks since my last payout (whenever that was, it's been that long). And it sucks, since when it was working, the books being shown were relevent to the post and could (in theory, if my blog were a bit more targeted towards a demographic or topic) benefit both me and Amazon with a sale. That's one thing that I really haven't seen outside of GoogleLinkedMyFacePlusInSpaceBook—well done targeted advertising (inside GoogleLinkedMyFaceBookPlusInSpace? Scarily targeted advertising).


My stance of tail call optimizations has changed over time

In writing the previous entry, I came across a post I made ten years ago about tail call optmization where I stated that I disliked it. But that was then, this is now, and now, I like tail call optimizations.

At the time I wrote that, I only thought tail call optimzations applied to a certain class of recursive functions, but no, it can be done in non-recursive functions as well. There may be limitations in when it can be done, but it's applicable to more than just recursive functions.

It's just a shame that such things are taught poorly and with bad examples (if at all—the term “tail call optimization” never came up in college). Of course, it would help if the language used for teaching supported the concepts as well (when I was in college, it was FORTRAN-77, Pascal and C—I'm not sure if FORTRAN-77 even supports recursion; Pascal was a pedagogical language designed by a computer scientist well known for being critical of the computer industry; and C was just a step above assembly language). Even some population langauges used for teaching today (cough—Python—cough) don't support tail call optimization because it's confusing or something.

Sheesh.


How come the “easy projects” never are?

My idea for NaNoGenMo 2015 was based off an idea that A. K. Dewdney had in 1985 [Yeah, that worked out so well. —Editor] [Shut up, you! —Sean], so I thought I would return to that well and implement an idea that Douglas Hofstadter had in 1983:

You can amuse yourself by looking up the definition of a common word in the dictionary and replacing the main words in it by their definitions. I once carried this process out for “love” (defined as “A strong affection for or attachment or devotion to a person or persons”), substituting for “strong”, ”affection”, “attachment”, “devotion”, and “person”, and coming up with this concoction:

A morally powerful mental state or tendency, having strength of character or will for, or affectionate regard, or loyalty, faithfulness, or deep affection to, a human being or beings, escpecially as distinguished from a thing or lower animal.

But not being satisfied with that, I carried the whole process one step further. This was my result:

A set of circumstances or attributes characterizing a person or thing at a given time in, whch, or by the conscious or unconscious together as a unit full of or having a specific ability or capacity in a manner relating to, dealing with, or capable of making the distinction between right and wrong in conduct, or an inclination to move or act in a particular direction or way, baving the state or quality of being strong in moral strength, self-discipline, or fortitude, or the act or process of volition for, or consideration, attention, or concern full of fond or tender feeling for, or the quality, state, or instance of being faithful to, those persons or ideals that one is under obligation to defend of support, or the condition, quality or state of being worthy of trust, or a strongly felt fond or tender feeling to a creature or creatures of or characteristic of a person, or persons, that lives or exists, or is assumed to do so, particularly as separated or marked off by differences from that which is conceived, spoken of, or referred to as existing as an individual entity, or from any living organism inferior in rank, dignity, or authority, typically capable of moving about but not of making its own food by photosynthesis.

Isn't it romantic? …

Metamagical Themas: Questing for the Essence of Mind and Pattern (hey, I may have gotten rid of the Amazon ads, but I still have my affiliate link)

It's a straightforward program:

  1. Set our corpus to a single word, “love.”
  2. For each word in our corpus, replace said word with its definition.
  3. If we haven't reached 50,000 words, repeat step 2.

It can't be that hard, right? It should only be an hour of work, at the most, right?

Two days later …

Well, that was easy! [See? —Editor] [SHUT UP! –Sean]

So it starts out with a dictionary I downloaded from Project: Gutenberg. Oh look—it's in some vague HTMLish markup language (even though the file says it's HTML, it's not HTML) so I should be able to parse what I want out of this. It can't be that much work. The format is straightforward:

otherstuff <hw> word </hw> otherstuff <def> definition </def> otherstuff

And I'm not two dozen words in when parsing fails. I check, and the text I'm up against is:

<hw><hw> word </hw> ... <hw> otherword </hw> ... <hw> ... <def> definition </def>

You have got to be kidding me! That is not even valid HTMLish markup! So I code, and I code and I code code code …

<mhw> ... <hw> word </hw> ... <hw> otherword </hw> ... </mhw> ... <def> definition </def>

It's not even consistently bad markup! So I code, and I code and I code code code …


<hw> word </hw> ... definition </def>

<hw> word </hw> ... <hw> word </hw> ... <def> definition </def> ...

And I'm not even past “AD” in the dictionary!

I do what I should have done when I encountered the first problem and search for a better machine readable dictionary online. And I find one. The markup is sane! And documented! A few hours later and I can parse every one of the 106,622 definitions in the dictionary!

Now I can implement my idea.

Sheesh.

Obligatory Picture

[Here I am, enjoying my vacaton in a rain forest.]

Obligatory Links

Obligatory Miscellaneous

You have my permission to link freely to any entry here. Go ahead, I won't bite. I promise.

The dates are the permanent links to that day's entries (or entry, if there is only one entry). The titles are the permanent links to that entry only. The format for the links are simple: Start with the base link for this site: http://boston.conman.org/, then add the date you are interested in, say 2000/08/01, so that would make the final URL:

http://boston.conman.org/2000/08/01

You can also specify the entire month by leaving off the day portion. You can even select an arbitrary portion of time.

You may also note subtle shading of the links and that's intentional: the “closer” the link is (relative to the page) the “brighter” it appears. It's an experiment in using color shading to denote the distance a link is from here. If you don't notice it, don't worry; it's not all that important.

It is assumed that every brand name, slogan, corporate name, symbol, design element, et cetera mentioned in these pages is a protected and/or trademarked entity, the sole property of its owner(s), and acknowledgement of this status is implied.

Copyright © 1999-2017 by Sean Conner. All Rights Reserved.