Andrew Que Sites list Photos
Projects Contact


I have a comment system that allows people to leave feedback that I use on several locations throughout It is the system used on the photoblog and most of the project pages. The original system was mostly PHP driven, with PHP generating the all the HTML output. There was a little Javascript used to submit comments and show the comment form. This adheres to an old principle of mine: a website should be functional without Javascript. The problem with the original system is it requires too much on the PHP side and would work better with a system designed around Javascript with AJAX. Clients without Javascript enabled would not be able to view comments or add their own, but otherwise the pages are functional.

One of the drawbacks to the PHP driven system was that I have sites that get a lot of comments. My online Polynomial Regression site is an example. It has several pages of user comments. I wanted a way to initially display just the most recent comments, with the option to show more. I also wanted the ability to use some markdown text. For programming sites, markdown is useful when sharing blocks of code. So I started doing an update.

After getting an initial system that is pretty good, I started testing the system using Lorem Ipsum— placeholder text. There is a good site that can generate the classic Latin lorem ipsum as well as the similar text in various languages using different character sets. I ended up finding problems with Luxembourgish due to the character set, and it has taken days to track down.

It started when posting in Luxembourgish. The comments would break. PHP was returning a warning about unexpected characters. Tracing this down was a pain. It could have originated from any number of place: the Javascript POST encoding, the PHP POST decoding, the MySQL escaping when saving, the MySQL unescaping when reading, the PHP response building, or the Javascript response extraction. It turns out that my use of SimpleXMLElement in PHP was the root of the problem. It can only handle ISO-8859-1 characters, and I was using UTF-8 in the generated text. Oddly, it was handling without error Cyrillic, Hebrew, Arabic, and CJK Unified Ideographs (Chinese, Japanese and Korean).

I traced the problem down to the XML encoding of the reply packet, and there was no workaround for getting this to respond properly. So I tested and then switched to use DOMDocument which is the more classic method for generating XML. The syntax isn’t as nice as SimpleXMLElement, but it handles unicode just fine. After the change the comment system was back to being functional.

   Spectacular sunrise on my ride into work after breakfast this morning.  Just a few degrees above 0°F/-17°C and I had to wear my googles and face mask.  Thus I couldn't really see through the viewfinder when taking the shots.  Nonetheless I got several pictures that capture the lovely sunrise.
   Monday is a cleaning day.  As I was cleaning the stairs, I noticed the bottom step was again falling out of place.  This has happened once before as the stringers separate from the treads.  Last time Xiphos and I hammered the stringer back into place and put a drywall screw into the bottom step.  Seem the head of this screw snapped off and began to separate again.  So this time I ran a series of screws.  In order to get the system compressed back together I couldn't just hit it with a hammer—I had to use a large one-handed bar clamp.  That did the trick and the stairs are again sound.
   Tonight I installed some track lighting for Pluvius' basement office.  The basement bedroom is a partly finished room with a plaster ceiling and walls, and I don't like them.  The ceiling makes getting anything to the electrical box very difficult and blocks heating ducts as well as water pipes and power conduits.  It took me over an hour to get a piece of wire run back to the breaker box so I could wire the lights.  However, I got it and the lights are installed.  Pluvius should be happy with the results.