Iraq Agrees to Re-admit Inspectors, U.N. Says–and not a moment too soon. It was starting to get hot in here.
Category Archives: Asides
Curly Quotes for Movable Type
I’ve finally gotten around to writing the instructions for Movable Type users to implement the curlme function using Brad Choate’s MTRegex plugin. The regex is the same, just the manner that it’s being implemented is a bit different. I’ve tested this out pretty extensively across this site, and there have been no problems. In fact, it’s in action right now. Once again I would like to thank Mark Pilgrim, who inspired this all.
The best instructions I can give, since I’m not a MT user myself, are to follow the very excellent instructions I’ve summarized below, replacing the MTAddRegex tags with the new ones.
- Install the MTRegex plugin.
- Create a new template module called
curlyquoteswith the following code:
Code depreciated, see latest version - $MTInclude module=”curlyquotes”$> to the top of all your templates.
- Replace all occurrences of
<$MTEntryBody$>with<$MTEntryBody.
regex="1"$>
And you’re done! Post any questions you might have and I’ll respond ASAP.
They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.
—Benjamin Franklin
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.
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 Mullenweg.com, 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="http://www.photomatt.net">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 “http://www.photomatt.net”. 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 “http://www.photomatt.net”. (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="http://www.photomatt.net" 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. Zeldman.com 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 Zeldman.com. Here’s a tricked out example of what we have so far:
<a href="http://www.photomatt.net" 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.
Keyboard Compare Applet for Dvorak and Qwerty Keyboards
I’ve found a very cool site: Keyboard Compare Applet for Dvorak and Qwerty Keyboards. The Dvorak layout places the keys you most under the fingers best suited to use them.
Plugging the top 500 words from the english language into the applet came up with some interesting results: your fingers would have moved 72.09 meters if you used QWERTY, but only 42.44 meters with Dvorak. See the site for more details. If anyone is interested in switching and want’s some computer help feel free to contact me.
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.Regards,
====================
Sandra Song
Communications Director
SafeWeb, Inc.
(510) 601-8855 x108
sandra@safeweb.com <mailto:sandra@safeweb.com>
Nice followup to a previous entry.
i <3 emily
It seems I’ve managed to contract a case of the flu right around the most romantic day of the year. I spent most of the day in Methodist Hospital with a nasty fever, and the rest at home getting a suprising amount of work done. Actually it was probably my most pleasant hospital visit ever, as with the miracles of modern technology they were able to subdue my fever (103+), headache, dizziness, and nausea.