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

You can’t go wrong with Amazon’s 100 Books To Read In A Lifetime. I’ve only read a bit over a dozen of them, and some of those in school when I probably didn’t appreciate them. I’ve never had a time in my life when I thought, “You know, I’m reading too much.” It’s a weekend — read!

Murphy Schmurphy

“Today looks like it’s going to be a long day.” Oh Fate! Such a cruel and fickle force. It started shortly after the last post when I missed the shuttle to transport me across the UH campus to my car. Because of some sort of irregularity in the bus schedule, or perhaps just horrid management, instead of having a bus come by say every 7 or 8 minutes, they have two come every 15 minutes. Of course that is just for the Blue route, the other three routes just happened to have their buses come at the same time, so it takes forever for everyone to load up. The loading was made even longer by the fact that we had to load a wheelchair up too. Now I’m not complaining about that, as no one can help that situation, but I’m just pointing out that it is an amazing set of circumstances.

So I make it to my car. I can’t write the rest of the story, because it’s too painful. Too make a painful story short, I stopped to pick something up, left, left my wallet, went back, and when I started to leave for the second time my car would not start. So here I sit awaiting the white trucks of AAA to pick me up and tow me home. The timing couldn’t be better either, I have two important appointments this afternoon and I was planning to go to Austin tomorrow.Times like this I try my best to see the bright side of things, try to find of ray of light in this gloomy day. I guess things could be worse, but I don’t want to tempt Fate, or Murphy, again.

Update: Ray of light — it was just a minor battery problem.

ReadWriteWeb covers the WordPress.com / Federated Media deal which will give high-end bloggers access to run advertising from FM, which is significantly higher quality than alternatives like Google Adsense, which has been declining in quality and is no longer a great choice for bloggers. Proud to be part of the empowerment of the Independent Web, which is the dark matter of the internet.

“Apple Lossless, also known as ALAC, is a lossless audio codec Apple developed some time ago for digital music. The codec compresses music files anywhere from 40-60 percent of their original size with no discernible loss in audio quality or fidelity.” — Apples ALAC codec is now open source. About a year and a half ago I started re-ripping all my music in ALAC, it’s fantastic, especially now that iTunes can down-convert when syncing to iPhones / iPods.

Jish Goes to Houston

Had a wonderful time tonight at Market Square Grill with a number of new people who I hadn’t met in person before. The guest of honor, Jish, was an extremely nice guy. I think he really enjoyed his visit, because everything is bigger in Texas. It was wonderful meeting everyone, such colorful personalities, and I’m definitely going to make it out to the next event. In attendance were (Kathy’s list helped me out here) Katie, Mike, Jish, Elaine, Chuck, Ted, Robert, Hanna, David, Kathy, Christine, and Kymberlie.

The pictures from tonight are now online. I’ve also gotten around to putting up the entire morning shoot from the Sights Unseen series. I also added some photos from 9-27 with some interesting ones in the downtown area that Sarah took. Actually she didn’t take all of them, just the good ones.

Archives Page Tip

I’m finally fixing all the bugs on photomatt.net, converting a lot of old stuff into WordPress Pages and generally tidying a few things. For my archives I wanted to display a list of recent entry titles like Hemingway does, but I ran into the problem that it would only show 10 at a time (or whatever you have set in your options) and then makes you page through the rest, which sucks. But, thanks to WP, the fix is easy! I added query_posts($query_string . '&showposts=1000&order=asc'); to the archive.php template right under the header call. Basically what this says is to take the current page query and add the part that shows a bunch of posts, in this case 1000, and also to sort it chronologically instead of newest to oldest. (Eric would be happy.) Since it’s in my archive template it doesn’t mess with any other pages. That’s all!