Posted by Tom Moertel
Mon, 30 Jan 2012 04:48:00 GMT
I have finally done it! With my recent post on tree traversals, I have managed to write 100 thousand words for my blog:
>> Article.find(:all).inject(0) { |sum,a| sum +=
?> (a.body + a.extended.to_s).split(/\s+/).length }
=> 100334
That sounds impressive until you realize that my first blog post, Fun with Asterisk, was about nine years ago. So we’re only talking, on average, about 11 thousand words per year. And that’s not hard, if you stick with it.
For me, the trick has been sticking with it. I joined a startup at the end of 2007, and my blogging abruptly lost about four fifths of its pace:

So I need to discipline myself to blog more frequently. I hope the next 100 thousand words won’t take so long to write.
Finally, I’d like to take this opportunity to thank you for reading and commenting. You’re the reason I wrote those words in the first place. You made the first 100 thousand words fun.
Thank you!
Your pal,
Tom Moertel
Posted in site news
Tags 100k, blog, blogging, statistics, writing
no comments
no trackbacks

Posted by Tom Moertel
Sat, 26 Mar 2011 16:14:00 GMT
I recently started redirecting requests for my blog’s RSS and Atom feeds to a consolidated feed with FeedBurner. If you’re reading my blog via one of these feeds – and you should be since my blog’s design is sufficiently horrible to burst your eyeballs if you try to read it directly – please let me know if the feeds break for you.
Examples of breakage:
- the feeds no longer update
- the content of the feeds looks garbled or goofy
- images or links are broken
- the feeds literally catch on fire and burn
If you see any of the above, please let me know.
Thanks!
Posted in site news
Tags feedburner, feeds, redirect
4 comments
no trackbacks

Posted by Tom Moertel
Tue, 28 Dec 2010 19:02:00 GMT
What did people read on my blog in 2010? Mostly, it was older content. Here are the ten most-popular pages, ordered by unique page views relative to that of the home page (1.0):
1. A Coder’s Guide to Coffee (2002, popularity = 5.30). This oldie continues to be popular mainly because coders still drink coffee – and because the Guide gets rediscovered every few months and posted to Reddit or Hacker News. This year it got an additional boost from being the cover story of Hacker Monthly #4.
2. Never store passwords in a database! (2006, popularity = 3.18). Despite being 4 years old, this article gets a steady flow of readers because lots of programmers are still storing passwords in databases. And getting owned.
3. Ruby 1.9 gets handy new method Object#tap (2007, popularity = 1.37). I’m not sure why this article keeps getting the hits, but it does. People just love Object#tap, I guess.
4. Wondrous oddities: R’s function-call semantics (2006, popularity = 1.22). This article’s popularity is easy to explain: R continues to steamroll just about everything else in statistical computing and has a continuous influx of new, curious users who want to know more about R’s inner workings.
5. Verizon FiOS fiber-optic Internet service: a first look (2005, popularity = 1.05). I think this article is popular because I was an early adopter of FiOS had one of the first hands-on reviews. It gets lots of search hits.
6. A couple of tips for writing Puppet manifests (2007, popularity = 1.02). I’m not sure either of these tips is still relevant. Still, this article brings in readers.
7. How I stopped missing Darcs and started loving Git (2007, popularity = 1.01). Programmers love to talk about DVCSs, Git and Darcs especially. Plus, if you search on “darcs git”, this article is one of the first results.
8. A type-based solution to the ‘strings problem’: a fitting end to XSS and SQL-injection holes? (2006, popularity = 1.00). This article remains popular because it gets readers from two sources: from religious wars over typing systems and from discussions of what to do about XSS vulnerabilities.
9. Don’t let password recovery keep you from protecting your users (2007, popularity = 0.93). This article is a follow-up to Never store passwords…! and tends to pick up a share of its sibling’s traffic.
10. On the evidence of a single coin toss (2010, popularity = 0.78). This short article raises a simple question: If I hand you a coin and claim that it always comes up heads, and you toss the coin and it does come up heads, how much more should you believe my claim compared to before the coin toss? This kind of question is irresistible to anyone even remotely Bayesian, so it ended up on Hacker News and got a lot of traffic in a few days. (The follow-up article is also popular, but didn’t make the top-ten list.)
So, once again, it looks like the old content dominates. Only one article from 2010 made the top ten, and just barely at that.
Posted in site news
Tags blog, content, popularity, statistics
no comments
no trackbacks

Posted by Tom Moertel
Mon, 27 Dec 2010 00:14:00 GMT
After much neglect, my poor blog is finally getting some much-needed care.
The first improvement I wanted to make was to add support for TeX mathematics. Last week’s article on how to update your beliefs after observing a coin toss contained enough painstakingly entered mathematical notation to provide the necessary motivation. The solution I preferred was MathJax, a JavaScript library that runs in the browser to render TeX markup into mathematical notation after a page is loaded. But that solution created a new problem.
MathJax, you see, has a rather large footprint. And my blog runs on a decrepit server that is already overtaxed. So, to use MathJax, I first had to put a reasonably tuned cache in front of my blog to offload the byte-slinging duties soon to be imposed.
Varnish
Enter Varnish, an efficient, highly tunable, caching HTTP proxy. I set it up on a front-end server and told it to cache anything mostly static on the blog’s server:
# allow caching of mostly static resources
sub vcl_fetch {
if (req.url ~ "\.(ico|png|gif|jpg|swf|css|js)$" ||
req.url ~ "^/xml/.*\.xml$" ||
req.url ~ "^/$") {
set obj.ttl = 600s;
}
if (req.url ~ "/javascripts/MathJax/") {
set obj.ttl = 3600s;
}
if (req.url ~ "\.(ico|png|gif|jpg|swf|css|js)\?[0-9]+$") {
set obj.ttl = 1d;
}
}
Basically, that bit of Varnish Configuration Language says that after the proxy fetches a resource from the back-end blog server, if it’s an image, script, feed, or MathJax resource, it should be given some reasonable amount of time to live in the cache. Once in the cache, Varnish will serve it up until its time to live expires, when Varnish will finally ask the old blog server to fetch another copy.
This little change made a big difference in my blog’s responsiveness. It feels much snappier now. (Let me know if you agree.)
MathJax
The front-end cache done, I moved on to installing MathJax. Basically, I downloaded a couple of Zip archives, decompressed them, and dropped the resulting files onto my blog’s server. Then I tweaked the blog’s default page template to load the root MathJax JavaScript file. That’s it.
Now I can have fun with TeX-markup mathematical formulas on the blog: $$1 + x_1 + x_2 + \cdots$$
The only downside to using a client-side library like MathJax is that it will probably not go so well for readers using Instapaper and e-readers. (If you’re one of them, let me know how it goes for you.)
Posted in site news
Tags blog, caching, mathjax, performance, tex, varnish
3 comments
no trackbacks

Posted by Tom Moertel
Fri, 30 Mar 2007 04:34:00 GMT
How much content have I written for my blog? Let’s find out.
My blog runs on Typo, which is built upon
Ruby on Rails. Let’s fire up the Rails
console and gather a quick word count:
$ cd ~/blog
$ ruby script/console
Loading development environment.
>> require 'article'
=> true
>> Article.find(:all).inject(0) { |sum,a| sum +=
(a.body + a.extended.to_s).split(/\s+/).length }
=> 66665
So I have written about 66 kilo-words, which is entering novel
territory. Paperback-wise,
it’s about 190 pages.
All I need now is a villain and some cool cover art.
;-)
Posted in site news, rails, writing
Tags blog, rails, word_count, words, writing
2 comments
no trackbacks

Posted by Tom Moertel
Sat, 04 Nov 2006 19:48:00 GMT
I’m going through some of my older posts and adding tags to them. I’m also colorizing source-code snippets when I find them. Both changes will cause articles to be updated, so if you’re subscribed to one of my feeds, you may be seeing some old content again. Sorry about that.
Posted in site news
2 comments
no trackbacks

Posted by Tom Moertel
Wed, 09 Aug 2006 22:25:00 GMT
Here’s quick patch I made to my Typo 4.0
installation to add Reddit and
del.icio.us buttons to articles. Now one click
is all it takes to submit an article to either site. (These buttons
appear on my blog at the end of each article.)
If you want to apply the patch, be sure to also place copies of the
button images into public/images. You can snag the
images from my site or from the Reddit and del.icio.us sites.
Here’s the patch:
--- typo.orig/app/helpers/articles_helper.rb 2006-07-24 11:04:27.000000000 -0400
+++ typo/app/helpers/articles_helper.rb 2006-08-09 17:06:51.000000000 -0400
@@ -73,7 +74,26 @@
code << tag_links(article) unless article.tags.empty?
code << comments_link(article) if article.allow_comments?
code << trackbacks_link(article) if article.allow_pings?
- end.join(" <strong>|</strong> ")
+ code << submit_this_article_links(article)
+ end.join(" | ")
+ end
+
+ def submit_this_article_links(article)
+ u_url = u(url_of(article, false))
+ u_title = u(article.title)
+ [ # move me into a database table
+ [ "Submit to Reddit.com",
+ "http://reddit.com/submit?url=<URL>&title=<TITLE>",
+ image_tag("reddit.gif", :size => "18x18", :border => 0)
+ ],
+ [ "Save to del.icio.us",
+ "http://del.icio.us/post?v=2&url=<URL>&title=<TITLE>",
+ image_tag("delicious.gif", :size => "16x16", :border => 0)
+ ]
+ ].map do |submit_title, submit_url, image_tag|
+ submit_url = submit_url.gsub(/<URL>/, u_url).gsub(/<TITLE>/, u_title)
+ %(<a href="#{h submit_url}" title="#{h submit_title}: “#{h article.title}”">#{image_tag}</a>)
+ end.join(" ")
end
def category_links(article)
The code is begging for a little refactoring love, but I’m off for vacation
in about twenty minutes, so it will have to wait.
Posted in site news, typo, hacks
Tags delicous, reddit, typo
no comments
no trackbacks

Posted by Tom Moertel
Mon, 24 Jul 2006 17:34:00 GMT
If my blog looks a little weird right now, please bear with me. I am
in the process of upgrading from Typo 2.6.0 to Typo 4.0, and so far
the process has been somewhat painful.
The new Typo installer did not have much luck upgrading my blog to the
new version. After fighting and solving a succession of errors and
confidence-sapping problems, I decided to abandon the upgrade
process. Instead, I changed to the course most likely to result in a
stable configuration: to install a new blog and then move my content
over to it.
The content-moving process was easier than it might sound. I manually
migrated the old blog database to the new database format; dumped it
to a SQL file; edited the file to remove all but the INSERT statements
for articles, comments, pages, and so on; and then I loaded the
statements into the new database.
I did not copy over my configuration and sidebar information, however,
because I figured it would be safer to use the Typo-4.0 defaults,
those being the most tested. I also recreated my user account from
scratch.
So far the blog seems to be running stably, enough at least
for me to restore public access again. But I still have more
restoration ahead. Next I will work on restoring my espresso theme.
Update 2006-07-26: I have now restored my espresso theme. For a while I was considering using
Scribbish, which is delightfully clean by comparison, but it has not yet been updated to support much of Typo 4.0’s goodness. Maybe later.
Posted in site news, typo
Tags typo
no comments
no trackbacks

Posted by Tom Moertel
Thu, 20 Jul 2006 14:43:00 GMT
Every so often I check the stats for my blog to see which articles are
popular and learn how people are finding the blog. I just checked the
stats today, and, if you are curious, here is a summary of what I found.
Most popular articles
As of today, for the month of July 2006, the ten most-visited articles on my blog are as follows:
The numbers in parentheses are the articles’ relative-popularity
scores. Each score tells you how popular an article was when compared
to the blog’s root page, which has a reference score of 1000.
Most popular search keywords
The ten most popular search keywords that led people to my blog are
as follows:
Many of these were combined with other terms as part of a search phrase.
For example, “rails” was often used in the following phrases:
Spam
Over the last 30 days, there have been on average 244 attempts per day to post
spam to my blog (stdev = 96).
That’s it
And that’s the stats!
Posted in site news, statistics
no comments
no trackbacks

Posted by Tom Moertel
Wed, 05 Jul 2006 14:44:00 GMT
Bloglines now offers a way to claim your blogs. Ordinarily, I never bother to do stuff like this. But Bloglines has at least three versions of my blog in their catalog. I would like to consolidate these into a single entry, something Bloglines claims I can do if I register my blog.
The registration process is somewhat annoying, but I can see why it is necessary. In short, I must add a Bloglines-given identifier to my blog’s HTML template. Then I must add another Bloglines-given identifier to a blog post. These allow Bloglines to verify that the blog’s website and feed are both under my control.
I’ll let you know how it goes.
Update: I was able to claim my blog but not its outdated entries in Bloglines's catalog. Neither Bloglines's instructions nor error reporting is specific enough for me to figure out what is wrong. I'm giving up for now.
Update 2 (2006-07-15): I was able to claim one of the outdated entries that had caused Bloglines to choke before. The other entries, however, are still problematic. Bloglines does have more-descriptive error reporting now, but those reports do not inspire confidence:
Verification Failed:
An Unidentified Error occured [sic] while talking to (null) or http://blog.moertel.com/xml/rss/feed.xml?snip=start.
Capitalizing “Unidentified Error” is a nice touch: it makes the error seem both mysterious and important.
Update 3 (2006-07-20): All of my feeds on Bloglines are now consolidated under a single entry. What's the secret? Ruthless URL canonicalization. I perused my logs and found all of the various URLs that Bloglines was using to access my feed. Then I configured my front-end proxy server to redirect (401 permanent) all of them to my preferred feed URL. After a week or so, Bloglines's software took the hint and consolidated the entries.
Posted in site news
Tags bloglines, identity
1 comment
no trackbacks
