Archive

Archive for December, 2006

Home.

December 28th, 2006 No comments

When we getting ready to fly to Maine for vacation, we were unbelieveable eager to get “home.”  After 9 (wonderful) days with friends and family, we were so happy to get off the plane last night and arrive “home” in Kansas City. I slept great for about 5 hours before getting up and starting to clean the house and check our mail.  I love the mail.  I got a $1.50 rebate check I sent in for!

Most of vacation was spent reading.  I received Michael Crichton’s book State of Fear at our department Christmas Party, and was thrilled the read it.  I read a lot of Crichton back in the day, but it had been awhile.  Having finished that with several days to go (and a day of traveling “home”) I picked up his latest book Next and read it within 24 hours. State of Fear was a lot better I think, but they were both really good (although very similar) but are at times quite… R-rated.  I don’t recall his earlier books being like this.

Categories: Uncategorized Tags:

Minor Changes, Major Revision

December 15th, 2006 No comments

Got to work in a few minor changes today. “Cartoony Joe” (as Dave likes to call him) is back in action at the top of every page here, winking away at the world in all his flash glory. I also created a sidebar module that shows the most recent photos I have uploaded to Flickr, and I updated the layout of the Photos page as well.

These changes were made possible due to the major revision of CLASSES ARE OVER!! Sweet. This morning at 2am I put the finishing touches on my last paper and sent it away, and I intend to spend at least two weeks not thinking about classes. I am sure I will need to begin reading for my Spring module soon enough, but it is rather glorious in the meantime.

Categories: Uncategorized Tags:

Good Things Come in Pairs

December 13th, 2006 No comments

As in papers (to hand in) and folding tables.

I was up last night and again this morning working on two papers for my Preaching class which are well overdue, but Dr. Salter did not seem to have any problems accepting them late.  With those out of the way, as well as the final I took last Monday, all I have left is a paper for my Philosophy class.  I’ve written the bulk of it, and hopefully will get it done tonight!  We’ll see though.

I have also completed my first Craigslist transaction!  I bought two six foot folding tables, which I have been eyeing ever since our LAN party this summer.  I got a great deal, and they are literally brand new.  One still has a sticker on it.  They will be excellent for the department Christmas party (which is at our place on Saturday) and for future LAN parties.  The lady I bought it from was really nice, she lives closeby in Independence and even brought the tables over for us!

Today was also our company Christmas lunch, which was held in-house this year (whereas last year it was at Crown Center).  I liked the change mostly because there were fewer crowds (though it was still crowded) and because the food was better.  They brought in a comedy team that performed whose-line-is-it anyway type material and I gave myself a headache from laughing so hard.  But then I had to go back to work with a headache, and didn’t get very much done.

A last point of interest is that Julie and I met up with a couple friends last night to celebrate Brad’s birthday.  Happy Birthday Brad!  Brad is already done with classes and papers and everything, so he probably got to relax a little more than me :o ) but it was a good time to go out and eat a meal with friends.  I don’t think I should take this too much for granted.  In the words of MacGyver, “Friends are too hard to come by.” (Season 1, “Ugly Duckling”).

Categories: Uncategorized Tags:

Flickr Integration!

December 11th, 2006 No comments

After accidentally installing and configuring my blog using an old version of the K2 theme (no!!) I now have the Photos tab working with the FAlbum plugin. Meaning: Flickr photos dynamically load into that page, as if being hosted right here on JoeDonahue.org. To quote Julie,

I love the internet.

Amen.

But speaking of Flickr, the more I use it, the more I do not like the different strata of friendships.  In other social networking sites, you are either someone’s friend or you are not.  On Flickr, you can be marked as a friend, as family, or just a contact.  This creates a lot of pressure!  I don’t want to categorize my friends, I just want to be able to say “Yeah, I know them” without all the politics of where to classify them.

In protest, I am going to classify all my contacts on Flickr as friends.  Take that!

Categories: Uncategorized Tags:

validateThis 1.0!

December 10th, 2006 No comments

Background
Working in web design, it is common to create forms that allow for users to enter information.  It is also common to need to validate this data before it can be passed on to a results page and / or a database.  The concern of data integrity, especially when it is left up to the user to enter data, is a serious and pervasive concern.  It is a standard solution to implement form validation via Javascript to let users know that required fields have been left empty, or that data entered into a field is not acceptable.  Examples are numerous and unnecessary.

Problem
As powerful and wonderful as standard Javascript form validation is, its primary failure is that it is tedious to create new functions and to implement form-specific validation for every form that is created. It is easy enough to do this for a small form, or to do so only in limited scope.  But when you have large forms or large scope, repeating this process is borderline insanity.  Especially for those of us who develop in smaller teams with broad sets of responsibility, spending project time on form validation is often neglected or crudely implemented, with frequent code reduplication (DRY principle in action, for readers of The Pragmatic Programmer!).  In an effort to stem this, I set out to design a generic form validation function, flexible enough to be implemented widely and quickly, yet losing none of the strength and helpfulness of form-specific validation.

Solution 1
I had seen examples of this idea in action at apple, but it is one (or two) steps short of what our development environment required for a quick and powerful generic tool.  The little bit I have done with Javascript (and the DOM tree) so far made me think that a far more elegant and usable solution could be done. Setting up a function of this sort would first need to loop through every element in the form, and there would need to be something inherent about the form element itself that triggered a specific type of validation (is it a phone number, an email address, an integer, etc..).  I began by thinking in traditional and non-creative ways: create the element’s name in such a way so that, when parsed, something about the name itself will trigger the validation.  There would need to be an additional naming convention component for noticing if the element is a required field or not.  Without going into the specifics, it can be said that this solution would have required significant planning as to how to design the form (as well as the backend that handles it) beforehand, and implementing this solution in existing forms would be a nightmare (I know, because I tried it).  The solution, if it is going to be long-lasting, would need to be able to implemented without being figured into the page design, as this would make coding more difficult, and end up in less acceptance by the rest of the group and never being used again.  I also had a need to be able to implement this easily in existing pages, which was not working out.

Solution 2
I kept the core of the function, but needed to change the approach and began searching the DOM tree (and the corresponding Javascript object model) to find out how else to attack, and quickly found the two pieces that would make this work: className and title.  Already a big fan of CSS, it was readily apparent that this would be sweet.  Instead of modifying the element’s name, which would also require code modification of the backend, I can append new classes that are specific to the validator onto the field class (this is a little-known, or at least little-used CSS trick).  The code would look like the following:

  • class=”formFieldText vt_req”
  • class=”formFieldText vt_req vt_email”
  • class=”formFieldText vt_phone”

In each of these examples, multiple classes are assigned.  The formFieldText class is a standard class for controlling the input fields (although other and better ways exist, this is just an example!!) while the other classes are part of the validator.  The prepend “vt_” signifies that this class is used explicitly for my function: validateThis.  The other piece that really rounded out this function is the title property.  Assigning a title to each of the form elements, the validateThis function will access the title to make the message clear about which field is bad (as if the red field border isn’t enough!) in the alert.

View the example here.

Download a zip file of the example files.
Download the example files. (validateexample.html, default.css, validateThis.js, README)

As this is only in version 1.0, it’s capacity and scope is still limited, but it is a great foundation and has already found plenty of places to be implemented.  One last trick:  It can be implemented along with another form-specific function if this doesn’t fit 100% of your needs.  Although I have already found places to use it exclusively, there are always exceptions where something needs to be addressed in a special way.  I have done this by replacing:

onSubmit=”return validateThis(‘myForm’)”

with

onSubmit=”return (validateThis(‘myForm’) && formSpecificValidation(parametersIfAny))”

If you have suggestions, or have found ways to implement validateThis, I only ask that you leave a comment here in return.

Categories: Uncategorized Tags:

Back Up!

December 7th, 2006 1 comment

And after a week of this site being down, we are back in action!  Just another week of classes, then I will get my flickr photos on here, and hopefully cartoony Joe will make a comeback as well.

Peace.

Categories: Uncategorized Tags: