Category Archives: Asides

Interesting links.

On Orkut

What can I say, I like it. Orkut is a new social networking site funded by Google that takes the best of all the other sites out there and rolls it into one fast system. Let me emphasize fast. I gave up on Friendster because I’m not patient enough to wait minutes for every screen to load. I don’t know if anyone else has noticed this, but every site I’ve tried so far (with the exception of LinkedIn) feels like it’s held together by spit and duck tape and run on a 486. Not to mention the atrocious markup.

A neat thing about Orkut is that it’s invitation-only, so everyone there is connected to the original seed guy and programmer (whose name is Orkut, incidentally) which I think is an interesting idea. Scott Allen (who has a great new WordPress-powered blog) says that’s the most innovative thing about Orkut.

Scott remarked to me that he didn’t see Orkut flourishing the same way Ryze or Linkedin have because it mixes the personal and business aspect of things, while those two are mainly for business networking and only flirt with personal aspects. It’s too soon to tell, but I think Orkut is going to be a big success. It does a lot of things right.

So go check it out, and if you’re having trouble getting in let me know and I’ll send you an invite. If you’re already on, introduce yourself.

Wildcard DNS and Sub Domains

What follows is what I consider to be best practice for my personal sites and a guide for those who wish to do the same. Months ago I dropped the www. prefix from my domain in part because I think it’s redundant and also because I wanted to experiment with how Google treated valid HTTP redirect codes. The experiment has been a great success. Google seems to fully respect 301 Permanent Redirects and the change has taken my previously split PageRank has been combined and now I am at 7. There are other factors that have contributed to this, of course, and people still continue to link to my site and posts with a www. (or worse) in front of it, but overall it just feels so much cleaner to have one URI for one resource, all the time. I’m sure that’s the wrong way to say that, but the feeling is there nonetheless.

Now for the meat. What’s a good way to do this? Let’s look at our goals:

  • No links should break.
  • Visitors should be redirected using a permanent redirect, HTTP code 301, meaning that the address bar should update and intelligent user agents may change a stored URI
  • It should be transparent to the user.
  • It should also work for mistyped “sub domains” such as ww. or wwww. (I still get hits from Carrie’s bad link)

So we need a little magic in DNS and in our web server. In my case these are Bind and Apache. I am writing about this because at some point the code I put in to catch any subdomain stopped working and while I reimplemented it I decided to write about what I was doing. This method also works with virtual hosts on shared IPs where my previous method did not.

In Bind you need to set up a wildcard entry to catch anything that a misguided user or bad typist might enter in front of your domain name. Just like when searching or using regular expressions you use an asterisk (or splat) to match any number of any characters the same thing applies in Bind. So at the end of my zone DB file (/var/named/photomatt.net.db) I added the following line:

*.photomatt.net. 14400 IN A 64.246.62.114

Note the period after my domain. The IP is my shared IP address. That’s all you need, now restart bind. (For me /etc/init.d/named restart.)

Now you need to set up Apache to respond to requests on any hostname under photomatt.net. Before I just used the convinence of having a dedicated IP for this site and having the redirect VirtualHost entry occur first in my httpd.conf file. That works, but I have a better solution now. So we want to tell Apache to respond to any request on any subdomain (that does not already have an existing subdomain entry) and redirect it to photomatt.net. Here’s what I have:

<VirtualHost 64.246.62.114>
DocumentRoot /home/photomat/public_html
BytesLog domlogs/photomatt.net-bytes_log
ServerAlias *.photomatt.net
ServerName www.photomatt.net
CustomLog domlogs/photomatt.net combined
RedirectMatch 301 (.*) http://photomatt.net$1
</VirtualHost>

The two magic lines are the ServerAlias directive which is self explanitory and the RedirectMatch line which redirects all requests to photomatt.net in a permanent manner.

There is a catch though. The redirecting VirtualHost entry must come after any valid subdomain VirtualHost entries you may have, for example I have one for cvs.photomatt.net and I had to move that entry up in the httpd.conf because Apache just moves down that file and uses the first one it comes to that matches, so the wildcard should be last.

That is it, I’m open to comments and suggestions for improvement.

Books to Live By

Jeffrey is in good company:

In the early stages of moving I could only take a handful of books so I chose the ones that I knew I would need for my classes, the ones that I referred to often, and the ones that mean the most to me. The books, from left to right:

  • On Writing Well, William Zinsser
  • The Journey of the Mind to God, Bonaventure
  • MLA Handbook
  • Philosophy of Language, William Lycan
  • Autobiography of Red, Anne Carson
  • Fear and Trembling, Soren Kierkegaard
  • Selected Poems, William Wordsworth
  • The Republic, Plato
  • Designing with Web Standards, Jeffrey Zeldman
  • History of the Peloponnesian War, Thucydides
  • The Federalist
  • The Prince, Niccolo Machiavelli
  • Four Plays, Aristophanes
  • Bowling Alone, Robert Putnam
  • The Anti-Federalist Papers and the Constitutional Convention Debates
  • Utilitarianism, J. S. Mill
  • The Diamond Age, Neal Stephenson

I Spy CSS

The inimitable Joe Clark’s Ten Years Ago in Spy has a brand-spanking new all-CSS layout from yours truly. As Joe said, “Take that, Alex Isley, Christiaan Kuypers, and B.W. Honeycutt!”

I didn’t do a strict before and after comparison, but I estimate at least several K have been saved. The biggest savings should come from the table, which had an elaborate system of classes that I was able to all but eliminate thanks to the flexbility provided by Joe’s semantic markup. Enjoy, and take some time to browse the archives, it’s quite entertaining.

The Blogging Software Dilemma

This site is beginning to grow and grow, and forward compatibility has lately been in my mind more. Several days ago this site passed twenty thousand unique visitors, and more than seventy thousand hits, since late August. I recently converted everything (except the photolog) to XHTML 1.1, which was nice, but it’s not the markup I’m worried about. My logging software hasn’t been updated for months, and the main developer has disappeared, and I can only hope that he’s okay.

What to do? Well, Textpattern looks like everything I could ever want, but it doesn’t look like it’s going to be licensed under something politically I could agree with. Fortunately, b2/cafelog is GPL, which means that I could use the existing codebase to create a fork, integrating all the cool stuff that Michel would be working on right now if only he was around. The work would never be lost, as if I fell of the face of the planet a year from now, whatever code I made would be free to the world, and if someone else wanted to pick it up they could. I’ve decided that this the course of action I’d like to go in, now all I need is a name. What should it do? Well, it would be nice to have the flexibility of MovableType, the parsing of TextPattern, the hackability of b2, and the ease of setup of Blogger. Someday, right?

Update, 2003-12-26: This became WordPress.