James Cassell's Blog

Saturday, February 17, 2007

Snow Days and Experts Exchange

I had all of this past week except for Monday off of school because of snow. I got up very late in the day every single one of those days, and stayed up late every one of those nights (something I do anyway). I came across a site (Experts Exchange) a while back when I was trying to fix a problem with my computer. Basically, the site has experts who answer questions asked by subscribers. It costs points to ask questions, and these points are awarded to the expert who gives the correct answer. You can either pay for a membership or earn a membership by becoming an expert. You need to earn 10,000 point to get a free membership, and 3,000 a month after that to keep the membership. I earned myself a membership over the past week, and now have this resource if I ever need it.

Cyberpear Feedback Form

I finally got around to implementing the feedback form on cyberpear. I used a slightly-modified form of the code that I wrote for the NHS site. I had been meaning to implement it for years, originally since I switched from ASP to PHP. I had originally written one in ASP when my site used that technology, but I am now PHP only.

Monday, February 05, 2007

Regular Expression to Limit Lines to 76 Characters

The other day when I was at school, I typed a fairly long quasi blog post into the NHS contact form to continue to test it. When I got the e-mail at home later in the day, a line-break had been put into my post because it was such a long non-breaking string. It was broken in the middle of the word. I decided that I should automatically break the line after 76 characters. I wanted to use a regular expression. I searched Google, but could find nothing that helped. Today, I wrote one that will limit the line-length to 76 characters except when there is a long string that doesn't have any spaces in it such as a URL. I'm posting the regex here in case anyone else would find it useful.

Replace: $1\n


Friday, February 02, 2007

RSS Feed for NHS Site

After completing most of the work on the contact form for the NHS site, I decided to start work on something else I'd had in mind. I decided to learn RSS. Initially, I read that there was no "standard" for RSS. This put me off and I kind of trashed the idea. The other day, I came across the RSS 2.0 Specification. Since the contact form is functional, and I couldn't finish it until I had the approval of the NHS sponsors, I decided to start working on an RSS feed for the site.

RSS is relatively simple to learn and use. I can personally make the content already on the site available on the RSS feed with relative ease. I am concerned, however, that whoever will maintain the site after I am gone will have some trouble. I need to design some sort of implementation where the information can be added to the site in one place, and will appear in both the feed and in the proper place on the site. I will probably do something similar to what I did with the navigation and contact pages: write a function that takes several parameters, and puts that information where it needs to go. In doing this, the RSS feed will no longer be a static file, but will rather be a dynamically created file like the other pages on the site. Implementing this will involve some mod_rewrite directives in my .htaccess file.