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

Connection Happiness

I’m here at school on one of the ubiquitous wireless connections and things are moving at least an order of magnitude faster than they usually do. I have no idea what’s changed, but I’m not complaining. Before it was like being on a 56k connection, and I was actually using it to see how my pages would load at slow speeds! Now it feels like decent broadband.

In other news, I got the smart quotes function so it doesn’t mangle my HTML, in fact it’s running on this site now, but it took a slightly ugly workaround and I’m searching to see if there’s a better way. Watch this spot.

Not Ready

About an hour ago I posted a really neat script which will translate normal prime and double prime characters into ‘curly’ quotes where appropiate. Unfortuately I still have a few bugs to work out, so bear with any ghosts you see in the blog machine today.

Average Day

9-3-2002–Since this is the first day I’m back at school and have my camera I wanted to walk through the routine I’ve started to build up. Unfortunately since I was running a little late I didn’t really get an oppurtunity to take any pictures of my Human Situation discussion class, which is by far my favorite (and smallest) class. I did manage to capture the four ravenous but cute squirrels that say hello between classes. Then we move on to my huge math class, and finally to the parking lot with cars as far as the eye can see.

Currently Playing

You may have noticed that the Currently Playing sidebar is now back online, afer about 14 days of being out of commission. This was because of a combonition of my desktop computer’s grahpics card going wonky and Winamp3 coming out. I really don’t like version 3 very much and I’m going to wait a couple of iterations before I try it again. Right now I’m enjoying my favorite pianist of the moment, Bill Evans.

8-31-2002

8-31-2002—even though summer is over now, in spirit if not in weather, I wanted to try and capture some of the things that symbolize summer to me: ants, grass, dirt, bushes, sun. Update: added about a dozen more photos from tonight. Interesting perspectives at the River Oaks shopping center, and some car logos, a new theme.

Comments Back

Well it looks like the issues with MySQL 4.03 aren’t going to resolved anytime soon, and it was messing up other applications anytime a variant of SELECT DISTINCT was used so I went ahead and rolled the installation back to 4.02. So things should be working fine now; if you see any bugs drop me an email or something. I’m getting ready to put some new summer-themed pictures up, so keep your dials locked.

MySQL 4.03 Bug

I seem to have stumbled across a bug in MySQL that crashes the MySQL server every time a query is run. For that reason the comments on this page are going to be disabled until I can get it worked out. The good news is that all entries now have trackback enabled and I’ll post more about that as soon as the comment thing is taken care of.

Camera!

Well I am delighted to say that, thanks to some lobbying from my mother and the graciousness of Annette at Best Buy, I have been issued a replacement for my broken P71. Now this is by no means a testament to their superior service; if this camera ever breaks I’m sending it to Sony, not Best Buy. Their replacement plans can be very useful, but I’m not going to waste my money again on a so-called service plan. All in all though I’m just incredibly grateful to have my camera back. I can’t wait to start taking pictures again! 🙂

So Close, Yet So Far

I’ve had what could be called a trying day, in a sense of the word, and it was not made better by my episode with Best Buy’s service, or lack thereof. I was very excited when at dinner my mother told me that a package had come in the mail today. I haven’t ordered anything lately so my mind raced to try and think what could have come in the mail. A sample for the PUG? Some books from Amazon? My camera back from the dead??? The return address had actually come off the box, but as soon as I opened it and dug through the peanuts I was delighted to see my camera. The slip of paper said they had reconnected two of the circuit boards, cleaned it, and tested it. Wonderful! Right?

The trouble started when I tried to turn it on. The problem before was that every time it tried to use the lens, the camera would just turn off. It would turn on in setup mode, or play mode, but as soon as you turn it to take a picture of any kind it would just turn off. I assume this meant there was some sort of bad connection with the lens mechanism, and whenever it tried to send power there it would short out. I was baffled: how could they send it back with the exact same problem it had before? What happened to this testing they talked about?

So I decided to go back to the store, because maybe there had been a mistake and this was how I should get my replacement, since they couldn’t/didn’t fix it. Nope. The store couldn’t have been less helpful. I eventually talked to a lower level manager, Marcus, who actually informed me to get a replacement they would have to send it to the service center four times! I’m on time number two right now, so taking the time the whole thing has taken so far, it could be well over a month before I can start taking pictures again with the digital. I can’t comprehend how them mailing me a broken unit back and me sending it back four times as a prerequisite to getting a replacement evolved as part of their bueracracy. It just boggles the mind. This has seriously tainted my view of Best Buy’s service and I will think very seriously before making any sort of significant purchase from them again, and I encourage others to do the same.

Final Departures

I know I haven’t been getting enough sleep when the Radiohead songs start to make sense. I just got back from taking Rene his laptop, a Compaq Armada 7800. I had the darndest time getting XP to load up on thereand spent most of last night (this morning?) having to reinstall things. But other than those diffilculties it’s really a nice machine, though somewhat old, but I’ve done a lot to make it good for college. Rene has a very early flight though, and to get it to him I had to be at his house (far North side) at 5:30 AM. The traffic wasn’t bad, but now that I’m home I don’t think I can go back to sleep since this is when I would be getting up anyway. I haven’t gotten to the best part yet though: when I got there the computer wouldn’t turn on! It didn’t respond to any of the buttons at all. Rene packed it and hopefully something will jiggle back into place on the flight to Boston, where he’ll be attending Berklee College of Music.

Everyone leaving so far has been hard, but I think this is the hardest, both because he is leaving so late and because we’ve really grown up together, at least in high school. He’s definitely one of the nicest, friendliest, and most sincerely religious people I know, and Rene will be dearly missed while he’s away. Not to mention the incredible BBQ I’ll be missing ;).

At College

Well I just had my first college class, and now I have one hour of downtime before the next, and I’m pleasantly suprised to find an open wireless connection in the building I’m waiting in. Actually I just found a page that lists all the locations that wireless is supposively available, although where I am right now isn’t even listed, so there may be more hidden goodies like this throughout the campus. More updates later!