Tuesday, November 20, 2012

MooTools More Form.Validator Serial Option Doesn't Do What You Think It Does

MooTools More is pretty great. It has a lot of features that make my life easier. One thing in specific is the Form.Validator class. It makes it super easy to build form validation that works in all browsers.

My one current gripe is the documentation of the serial option. It appears as if it is functioning as expected and actually writing out what it does would be far to wordy for standard documentation.

I started with my standard grade school mathematics approach. Guess and check. I change serial to true. I changed serial to false. I checked to see what it did. I didn't notice anything.

I double checked my code for errors. Nothing. I hopped on Google and found a post to the MooTools user group; Form.Validator "serial" property seems to do nothing. No replies.

Eventually I tracked down an old posting on Lighthouse (MooTools tracked bugs there before GitHub) about the serial option and that shed some light onto the face of things.

The official documentation of the feature is:

  • serial - (boolean) whether to validate other fields if one field fails validation unless the other fields' contents actually change (instead of onblur); defaults to true
A more correct documentation of the feature is:
  • serial - (boolean) whether to validate other fields if one field fails validation unless the other fields' contents actually change (instead of onblur); does not effect number of fields validated onsubmit; defaults to true
I'm pretty sure nobody is ever going to read this. None the less I'm going to post an ad to see how it looks. Ha! Commerce!



Maybe this book would have helped. Maybe not.

Tuesday, November 13, 2012

Capello CR21 Sleep & Charge Dual Alarm Clock

My wife and I have been looking for an alarm clock for quite a few years that fulfill our laundry list of feature requests. We'd find a clock or two along the way but for the most part we had given up looking. We were not going to pay more than $100 for an alarm clock.

I knew the DST change was just around the corner so when we were at Target I picked this one up because it had our most basic desired feature - dual alarm clocks. Not just two different times for the same alarm but two separate alarms. $30 at Target wasn't much and we could always return it if it was junk.

I got it home added my radio presets. Set the alarm and went about my day. Time for sleeping so I turned on the radio hit the sleep timer and nodded off to the dulcet tones of BBC World. 3 hours later I woke up and the radio was still on. Maybe my wife hit the button or maybe I didn't do it right. I didn't know. Didn't matter. It was 3am and I wanted the radio to stop so I turned it off.

The next night the same thing happened. I turned on the sleep timer and woke up in the middle of the night when the radio was still on. So I experimented. Did it turn off at all? Did I not read the manual correctly? What was going on. I deduced that I was following the directions as printed correctly but the radio was not turning off (even though the sleep timer LED did).

So I sent an email out to Capello support asking about the CR21 and got a response in a timely fashion. They notified me that they had identified a portion of the manufactured radios did not have a proper sleep function and would send me a replacement. The email mentioned that I should not take the radio back to Target.

Right here it seems a little fishy. There are very few times a manufacturer would actually prefer you to not deal with a retailer. Either (A) Capello didn't want me to let the people at Target know that the radio is busted because Target Corp would drop the hammer on Capello or (B) Capello knows that so many of the radios were manufactured with the defect that I would just be getting a replacement with the same problem.

I sent them my shipping information and within a week my UPS account notified me that I had a package on the way. At this point it is interesting to note that at no time did Capello require any proof that I purchased the product. I don't know if this was just the person I was dealing what but it seemed a bit odd.

On Friday I came home to the usual UPS yellow sticker on my window that a package from "Life lab" had been attempted to be delivered but wasn't because it required someone show an ID verifying that they were over the age of 21. Life Lab sent something that is potentially adult in nature? I asked my wife if she ordered a cloning kit or something potentially dangerous but she didn't. I looked up the tracking numbers and sure enough it was the replacement alarm clock. I don't know who Life Lab is or what branch of theirs is Capello and I don't really care.

The bigger question is why did Capello send me my replacement CR21 requiring an adult's signature. It is just an alarm clock after all. If I had suspected that they would do such a thing I would have had it shipped to my work place where people are accepting packages all day long. But no. It was just an alarm clock. I couldn't suspect that they'd send it anything other than baseline shipping.

On Monday I came home to the same sticker. Package from Life Lab. Needing verification that I'm an adult. At this point I know that I'm not going to get the package on the third attempt and I'm not going to have them return the package to sender. I've been sleeping without a background noise for more than a week now.

I did eventually get to my local UPS distribution center to pick up my package. When the lady behind the counter saw it required a 21+ signature she gave me a raised eyebrow look before she handed over the box. "It is an alarm clock." I assured her. "I have no idea why they sent it requiring an adult signature."

I got the Capello CR21 home and sure enough it is exactly the same as the clock I had purchased from Target weeks before with the exception that it was manufactured later. My original clock had a serial number in the 2000 range and a sticker proclaiming MANUFACTURED JULY 2012 while the replacement had a serial number in the 4000 range and SEPTEMBER 2012 date. Fortunately, this clock has a functioning sleep timer.

So the moral of the story. If you buy a Capello Sleep & Charge Dual Alarm Clock CR21 from Target and the Sleep Timer doesn't work you should contact Capello directly and have them ship it to a location where you know somebody will be able to sign for the package.

Friday, August 31, 2012

CSS Two Column Layout (via Bootstrap)

The other week I was worrying about the best way to setup two vertical columns using CSS. Most of the resources online are outdated and refer to IE5.5 on Mac and other such antiquities. I turned to twitter, and Chad Kittel suggested just do what Bootstrap does. What Would Bootstrap Do is the most recent WWxD addition to my vocabulary.

So I went digging and here is the results.
Float both columns and use :before and :after to contain things.

The default two columns layout in Bootstrap floats both columns to the left. There is no reason you couldn't change it, but it makes the most sense to keep your code readable and flexible. Adding more columns is simple and it flows the way you'd read.

The largest challenge in the two column layout is keeping things on top and on bottom where they belong. The old stand by is display:none to contain columns but you can hide things that you'd actually want to see. It isn't something I've run into very often, but on occasion I have. My biggest problem with display:none is that is has always felt like a hack and the problem with simple hacks is designers tend to abuse them (they end up everywhere).

All the common browsers support the :before and :after pseudo classes but unfortunately IE7, which enough of our customers still use, doesn't. Fortunately, that is easy to work around without a technical hack.

Here is my class formatted for LESS.

.contain {
    &:before, &:after {
        content: "";
        display: table;
        line-height: 0;
    }
    &:after {
        clear: both;
    }
    *zoom: 1;
}
The work was already done in Bootstrap, but I found a better explanation of the basic ideas from this clearfix page. Basically, if you wanted bare-bones support the single line of :after is all you need. The :before and :after table stuff helps to properly use margin and padding. The zoom puts the block into a special mode on IE7 to contain your floats.

Wednesday, February 29, 2012

HP ScanJet 3670 with Snow Leopard

I have an iMac running Snow Leopard 10.6.8 and I own a HP ScanJet 3670 Scanner.
HP gave up attempting to support this scanner and the accompanying software years ago, but some people have figured out how to give it life again.

You computer is going to freak out if you try to install the software for the HP ScanJet 3670, but everything goes great if you install the same software but tell the installer you actually want to install it for the ScanJet 3690.  Here is how you go about it.

1.) Download an old scanner multi installer from HP's FTP site:
ftp://ftp.hp.com/pub/softlib/software8/COL16498/sj-43494-2/COL16498.dmg

2.) Install it.  It is old junky software so be aware of a few things.  After you put in your administrator password it'll act like it has stalled for a couple minutes (just wait it out).  You'll select ScanJet 3690 after that.  The software will also forcibly quit any applications you have open so make sure you don't have anything unsaved.  If you are viewing this website it'll close your browser.  After the installation is complete it will force you to restart your computer.

3.) Upon restart you'll notice two icons in your dock.  If you are like me you don't want them there, so trash them.  HP will do it's damnedest to force them back in your dock so go checkout your Accounts in System Preferences, find Login Items and remove both of the HP Scanning tools.

4.) Scan stuff.  It should work just as well as you could ever hope.

I have read reports that this trick works exactly the same in Snow Leopard as far back as 10.6.2 but your mileage may vary.  Anybody know if the ScanJet 3670 will work in Lion?  Leave a comment about what Mac OS X system you have gotten the scanner to work in.