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/ I added the following line:

* 14400 IN A

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 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 Here’s what I have:

DocumentRoot /home/photomat/public_html
BytesLog domlogs/
ServerAlias *
CustomLog domlogs/ combined
RedirectMatch 301 (.*)$1

The two magic lines are the ServerAlias directive which is self explanitory and the RedirectMatch line which redirects all requests to 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 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


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.

Houston Wireless Meeting

The meeting today of the Houston Wireless meeting tonight was very interesting, with a lot of blue sky concepts being discussed. Tonight’s guest was Alan Levy, the adviser to the United Nations Information and Communication Technologies Task Force. To be honest I was a bit confused by his terminology for probably the first part of the meeting, as he tended to throw out the terms OS and VPN quite freely. I’m still not sure what to make of the whole thing, but the gist I got from it was that the current state of WiFi technology is a fluke, a mistake by the governments and corporations in that they created the space for a technology which completely bypasses traditional and monolithic communications infrastructure which is completely unregulated. He described this state as an accident, and stated that there was a small window of opportunity of about ten to twelve months where this advantage could be pushed and reach critical mass in changing the way we communicate before it can be trivialized by regulation. He also intimated that there are several “extremely subtle” measures working their way through legislation, but he failed to identify any of them, saying there was really only one and he didn’t want to comment on it specifically because he hadn’t had a chance to look at it very closely.

He also emphasized several times the insidiousness of corporations with vested interests in the markets that WiFi can engulf, and I got the feeling that he had dealt with this before. That message combined with the sense of urgency he instilled made me feel like a freedom fighter or something, or someone who was around at critical times in the development of the internet or radio. Barrett likened it to the start of Linux, with the analogy following that we’ve been flying under the radar, so to speak, until now and so it’s time to really buckle down and take the platform to the next level. So what was his goal? I wasn’t altogether clear on this either, but what I got out of it was that he envisioned wireless ad hoc networks existing on a community level over which a number of “applications” could operate. The applications he referred to are things that are normally provided to us by large corporations in monopolistic fields, such as television, telephone, cable, radio, and anything else that the community can provide and there is a need for. His main point seemed to be that cost and security weren’t holding back widespread WiFi adoption one bit, it was familiarity and applications. Just like an operating system with nothing to run over it, right now the applications of current wireless networks sans the internet are pretty sparse. Seattle Wireless and their goal of creating a distinct network separate from the internet was brought up several times. What he called on us, and by us I mean the Houston Wireless group, to do is create the platform which would allow the current wireless broadband community to create a Metropolitan Area Network which replaces many of the current communication infrastructure and promotes near universal access to its resources regardless of economic status or location.

At least that’s what I can get out of it at this time of night. The great erewhon has the whole thing on video, including some of the questions from people who appeared to be as confused as I was at points. When the video finally goes up I’ll take a look at it and maybe reexamine my thoughts on the subject. At this point I’m not sure exactly how much of this was what he said and how much is me mixing other thing in, but if you note any crazy discrepancies leave a comment and I’ll patch things up. With that, I bid you all adieu and I think I’ll try and get some sleep. (Finally.)

Smart Quotes in PHP

One of the true joys I find in reading different websites is when the author of whatever text you see has taken the time to make his text typographically pleasing to the eye through the use of proper typographical elements. CSS has enabled designers to shape text on the web in ways that allow for far greater control over presentation than the creators of HTML ever envisioned. However, I see many sites where it’s obvious that great pain has been put into the layout and presentation of the text, but there are still things like single and double prime marks being used instead of true quotes or apostrophes. Part of the reason for this is it’s a pain to enter the proper entities in when you type, especially if the entry is being added through a normal text box like most blogging software use. While I’m not going to go start a society (more) I still have written a small function in PHP that will hopefully make the world a better place, one curly quote at a time :). Thanks to my dad, Mark Pilgrim for inspiration and the code that got me started, and Barrett for help.

A little background: This whole thing started a few hours ago when I was writing a paper and when I looked back to proofread I saw that there were a number of occurrences of words like it’s, where writing out the HTML entities had become so ingrained in me from various situations where I hand code that it was now translating into my ‘normal’ typing. At that moment I immediately thought of ten other reasons why it’s probably better for the content to be entered into the database as a single or double prime and then translated to its proper character on display. Most of all, it’s just easier, and the free flow of ideas into your writing is not impeded in any way. My mind also went back to an entry I read on Dive Into Mark early last month which addressed a similar issue, but from looking at the code I saw no easy way I could drop that into my site. And thus this very generic function was born. It can be dropped into any PHP application anytime you want to make some text display worthy. Without further ado: Update: fixed a display issue, and a small bug.

Continue reading Smart Quotes in PHP

Before the Storm

Going through some of my stuff from the DC trip and found this, note the date:

I really should write something about that visit. WorldCom was one of the coolest places I’ve ever visited, and the optimism of the employees I talked to was amazing. I distinctly remember one telling me what a good buy WorldCom bonds were at the time.

Anchor Tag Demystified

I’m writing this mainly for my sister Charleen, who wanted to know this for something on, but hopefully it will be helpful to anyone wanting to learn a little HTML.

Most Basic

The purpose of the anchor, or <A> tag, is to reference someplace. Links are the very essence of the web, the hyper in hypertext. Let’s talk about the most most important attribute, href. A very basic link might look something like this:
<a href="">PhotoMatt</a>
To break it down, the <a at the front indicates the beginning of the anchor tag. After that we have the href attribute, which basically tells the browser where to go when you click on that link. You can have a fully qualified address or a relative address there, which we’ll discuss more in a minute. The place we want to send the browser to is equal to “”. The two biggest mistakes people make when making an anchor tag are forgetting the equal sign and forgetting to quote the attribute value, in this case “”. (Note: you can quote it either with double or single quotes, which can be useful when echoing out statements in PHP.) Then we close the first part of the A tag (don’t forget the endquote!) with >. Now we write the text which we want to appear linked, which in this case is PhotoMatt, then we close the anchor tag with </a> to indicate that the link is over. You can enclose multiple words or even an entire sentence. That’s it! You now have a link. Note that all the code should be lowercase, like in the example above. This is a good practice in every version of HTML, and is required in XHTML.

Getting Fancy

Now I know you’re thinking, what more could there be? Well to be honest, there isn’t that much else. One common technique, and one I like to use on this site, it to use the title attribute to give a little more information about the link. The title attribute works functionally just like href, but instead the content displays as a tooltip or popup in most browsers, and can be useful for telling additional information about the link. Here’s an example:
<a href="" title="Photos and thoughts from Matthew Mullenweg">PhotoMatt</a>
The end result is this: PhotoMatt. In the title attribute you can put a description of the link, warn that it’s a PDF or Word document, warn that it’s opening in a new window, whatever you want. makes great use of the title attribute on almost all his links.

Another commonly used attribute is target, which tells the browser where to open the link. You should use it when you want to open a link someplace other than the current window or frame. In XHTML the target tag is depreciated (illegal, gone) unless you’re using frames and the corresponding DOCTYPE. The goal of this attribute is to facilitate linking in frames. A common use of the target attribute is to open a link in a new window, and to do that you set the attribute equal to “_blank”. If you’re using frames you can set it to “_top”,”_self”, or “_parent”, which will replace either the entire window, the same window/frame, or the parent framesetting document. If you’re not using frames you should’t have to mess with much other than “_blank”, so don’t worry about this too much. There is one neat trick you might use though: if you want to open new windows on certain links, but you don’t want to be too intrusive, you can have all your links open in one separate window. The target attribute can refer to windows by name, very useful in a framed setting. However if no window/frame with that frame exists, it will open a new one. So if you gave all your link targets the same name, say “dalink”, the first time someone clicks a link with that target it will open a new window. If they leave that window open, go back to your page, and click on another link with an identical target, instead of opening a brand new window it will reuse the window you’ve already opened. A good example of this (again) is Here’s a tricked out example of what we have so far:
<a href="" title="Photos and thoughts from Matthew Mullenweg" target="_blank">PhotoMatt</a>

Coming soon: Accessibility, It’s All Relative, and Style Notes! Keep your dials locked.

Safeweb Fix

Hello — Just wanted to inform you that we have completed the patch we promised,
and we have implemented the changes so that PrivaSec users can now turn off JavaScript
on their browsers and still have some functionality when surfing the Web anonymously.
This solves all problems pointed out in the paper by Martin and Schulman.

Sandra Song
Communications Director
SafeWeb, Inc.
(510) 601-8855 x108 <>

Nice followup to a previous entry.