The Boston Diaries

The ongoing saga of a programmer who doesn't live in Boston, nor does he even like Boston, but yet named his weblog/journal “The Boston Diaries.”

Go figure.

Monday, September 07, 2009

A rabbit hole to China

R seems to have weathered the changes in gambling legislation and called for some help on a website he's been working on. It involves moving a site from an undocumented overwrought PHP framework to a documented overwrought PHP framework (which is mostly done) and one of the last bits to do is the integration of a questionnaire.

How hard could it be to integrate a questionnaire?

Oh, it's 18,449 lines of non-integrated PHP code.

Lovely.

So I'm going through the code and see a bunch of stuff like this:

<input 
	type="checkbox" 
	name="followanswer_7" 
	id="followanswer_7" 
	value="1"
	onclick="checkbox_selected_fu(7)"
>

So my guess is not only is it 18,449 lines of PHP, but there's probably a nice dose of AJAXy goodness thrown in. Curious as to what checkbox_selected_fu() might be doing, I search for its definition.

Deep in a PHP function I find the following:

echo 'function checkbox_selected_fu(followup_questionsid) {'.b;
$qry = "SELECT * FROM followup_questions WHERE conditions='yes';";

If I thought 18,499 lines of PHP code was lovely, this is just peachy keen! Constructing JavaScript on the fly from PHP and SQL! Woot! Please sir, can I have some more?

Update a few hours later …

Why yes, I can have more!

That JavaScript being generated on the fly by PHP and SQL? Turns out it's generating HTML on the fly.

I can't tell you how thrilled I am to learn that.

I talked to R, and we both agreed that it would probably be best to turn the questionnaire into something that runs as standalone as possible. Which we think is doable since the questionnaire was one of the last things done under the undocumented overwrought PHP framework and even the developers were getting tired of the framework (which should tell you something about the framework) and just wrote the questionnaire as quickly as possible. Which probably explains the code quite a bit …

Obligatory Picture

An abstract representation of where you're coming from]

Obligatory Contact Info

Obligatory Feeds

Obligatory Links

Obligatory Miscellaneous

Obligatory AI Disclaimer

No AI was used in the making of this site, unless otherwise noted.

You have my permission to link freely to any entry here. Go ahead, I won't bite. I promise.

The dates are the permanent links to that day's entries (or entry, if there is only one entry). The titles are the permanent links to that entry only. The format for the links are simple: Start with the base link for this site: https://boston.conman.org/, then add the date you are interested in, say 2000/08/01, so that would make the final URL:

https://boston.conman.org/2000/08/01

You can also specify the entire month by leaving off the day portion. You can even select an arbitrary portion of time.

You may also note subtle shading of the links and that's intentional: the “closer” the link is (relative to the page) the “brighter” it appears. It's an experiment in using color shading to denote the distance a link is from here. If you don't notice it, don't worry; it's not all that important.

It is assumed that every brand name, slogan, corporate name, symbol, design element, et cetera mentioned in these pages is a protected and/or trademarked entity, the sole property of its owner(s), and acknowledgement of this status is implied.

Copyright © 1999-2024 by Sean Conner. All Rights Reserved.