Select/input combo box using Prototype

I was looking around for a good HTML combo box (a drop-down list with a type-in text box), and found a good looking one over at Particletree (see Update Your Select Element to a Combo Box). There were a few quirks I found with it.

  • The text box used absolute positioning. As a result, if the location of the select element changed (perhaps due to another item on the page being shown or hidden), the text box would be in the wrong place.
  • The code was free-standing and applied event handlers directly, instead of using an event manager like one offered in Prototype‘s Event class.

To clean things up, I modified the code to work with the Prototype JavaScript library, converting element selectors and event management. I also added a hack to handle positioning issues by calling a routine that repositions the text box every 0.05 seconds. Though far from efficient, it didn’t cause any flickering or processor utilization. If JavaScript had an “onpositionchanged” event it would be a lot easier.

Either way, below is the modified JavaScript code. Let me know how it works for you, and remember that 99% of it should be attributed to Ryan Campbell of Particletree.

var nTop;
var nLeft;
var detect = navigator.userAgent.toLowerCase();

function setCombobox(bMethod) {
$$('select.comboBox').each(function(combo) {
positions = Element.positionedOffset(combo);
nTop = positions[1];
nLeft = positions[0];

if(bMethod == true) {
//Use iframe hack for Internet Explorer
if(!(detect.indexOf("opera") + 1) && (detect.indexOf("msie") + 1)) {
else {
textfield = $("txt" +; = nTop + "px"; = nLeft + "px";
if((detect.indexOf("msie") + 1)) {
hackFrame = document.getElementById("frame" +; = nTop + "px"; = nLeft + "px";

// ------------------------------------------------------------------ //
// Create the textfield and move it to desired position               //
// ------------------------------------------------------------------ //

function inittextfield(ctrl) {

selectWidth = ctrl.offsetWidth;

//Create textfield
textfield = document.createElement("input"); = "txt" +;
textfield.className = "comboText"; = "99999";

textfield.value = ""; = "#ccc"; = "absolute"; = nTop + "px"; = nLeft + "px"; = "none";

//Account for Browser Interface Differences Here
if((detect.indexOf("safari") + 1)) {
selectButtonWidth = 18 = "0px"; = "0px";
else if((detect.indexOf("opera") + 1)) {
selectButtonWidth = 27; = "4px"; = "4px";
else {
selectButtonWidth = 27; = "2px"; = "3px";
} = (selectWidth - selectButtonWidth) + "px";
ctrl.onchange=function() {
val = this.options[this.selectedIndex].value;
document.getElementById("txt" + = val;
ctrl.onfocus=function() {
document.getElementById("txt" + = "#333";
textfield.onfocus=function() { = "#333";

// ------------------------------------------------------------------ //
// Internet Explorer hack requires an empty iFrame.  We need to add   //
// one right underneath the div -> it will make the zindex work       //
// ------------------------------------------------------------------ //

function initIframe(ctrl) {
textWidth = textfield.offsetWidth;
textHeight = textfield.offsetHeight;
hackFrame = document.createElement("iframe");
hackFrame.setAttribute("src", "placeHolder.html");
hackFrame.setAttribute("scrolling", "0");
hackFrame.setAttribute("tabindex", "-1"); = "frame" +; = "absolute"; = textWidth + "px"; = textHeight + "px"; = nTop + "px"; = nLeft + "px"; = "3px"; = "3px";
ctrl.parentNode.insertBefore(hackFrame, textfield);

Event.observe(window, 'load', function() {
new PeriodicalExecuter(function(pe) {
}, 0.05);
Event.observe(window, 'resize', function() {

Is it time for a national sales tax?

I just received the following in an e-mail from NewEgg:

As a result of recent changes in the State of New York Tax Law requiring certain out-of-state retailers to collect and remit sales taxes to the State of New York, we regrettably inform you that must begin collecting applicable state and local sales tax for all orders shipped to New York addresses on or after June 1, 2008.

There’s a good reason why businesses don’t charge sales tax to purchasers who are out-of-state, and the reason can be found on Wikipedia‘s Sales taxes in the United States page (bold text added):

Note: Taxes change, are added or eliminated frequently, so this article is prone to being out of date. If so, please change the page accordingly and cite a source if possible. There are private entities that distribute updates weekly regarding the rules in 11,000 different tax jurisdictions in the U.S.

New York State itself has 81 different sales tax jurisdictions (see this PDF). Complying with hundreds (if not thousands) of local sales tax laws is a huge burden that will have two effects, one direct and one indirect:

  • retailers will incur additional administrative charges in order to comply with all the different tax laws;
  • consumers will pay higher prices as retailers charge more for their products.

Perhaps it’s time for a national sales tax to replace the state/local sales tax rates, giving retailers the ability to streamline operations. After all, isn’t the purpose of government to facilitate commerce, not impede in it? (There are many sensible tax reforms which government chooses to ignore. You can read about them at the Cato Institute‘s Budget and Tax Policy research area.)

Of course, this (or any other tax reform) will likely never happen, because taxing people (and spending their money) is what government power is all about. I’d bet the house that you’ll see a national sales tax on top of existing sales taxes and income taxes before you see tax law getting simpleer.

After all, taking (and spending) your money is what government is all about.

Solving distorted sound issues in Boot Camp

I’ve been running a rather expensive Windows Vista computer lately, thanks to Boot Camp. However, two problems continue to plague me:

  1. The latest Boot Camp update from Apple will not install successfully.
  2. Sound is distorted when playing games, typically those using multiple sound channels (i.e. pretty much all games).

Fortunately, I finally found the fix for #2. It wasn’t Vista SP1, and it wasn’t figuring out a way to install the latest Boot Camp drivers (still can’t figure that one out).

The solution: Download and install the latest Realtek HD drivers. Thanks to a post on which pointed me to the Realtek High Definition Audio drivers page.

One odd quirk: It took two installations of the Realtek drivers before it worked. After the first installation (which removed the old drivers) and a restart, there was no sound at all in Windows. A re-installation of the same Realtek drivers (and another restart), and it’s all working fine…

Just in time for Age of Conan, which should be arriving in a day or two! (It’s for work, really… I’m doing research for the soon-to-be-released web site,

Is Verizon FiOS TV in your area? Don’t try checking online.

It seems I always have usability issues with Verizon‘s web sites. After checking to see if, after two weeks, they figured out why an old cell phone number of mine was still showing up on my online profile (they didn’t, it’s still there), I decided to see if FiOS TV was in my area.

They have a nifty Check Availability page where you enter your phone number (if an existing Verizon customer) or address to find out if you can get this service. Being a Verizon customer, I enter my phone number, click the “Can I get it” button, and wait…

While you wait, you do get a little graphic that is somewhat more useful than a spinning Ajax cursor.


So, is FiOS TV available to me? Well, I don’t know. The response you get says nothing about FiOS TV — instead, it tells you about your FiOS internet service.


But wait, that isn’t what I asked! I wanted to know about FiOS TV! I am well aware that I already have FiOS Internet Service.

Alas, there’s apparently no easy way to find out online. Sometimes, you just can’t find what you’re looking for.

Unrelated but related — why did they spell it FiOS? Why the lower case “i”? Was FIOS ruled out for some reason? Or is it an acronym where only the F, O, and S dictate new words (perhaps Fi is for “Fiber”)?

According to Wikipedia’s FiOS article, “Verizon has cited the fact that “fios” is an Irish word for “knowledge.” If that’s the case, couldn’t they just make it FIOS? After all, it’s so hard to type FiOS… Maybe a marketing guru told them that the lower case “i” makes it “cool, hip, and Web 2.0.”

In any case, look elsewhere for your FiOS TV availability.

Free file archiving and (de)compression with 7-Zip [with expensive minimum donations]

In thinking about all the free and open source tools I use, one seems to run underneath the radar: 7-Zip.

7-Zip will compress, expand, encode, and decode more formats than you can shake a stick at. It integrates seamlessly with Windows Explorer, so you just right-click and choose the option you want, as shown below.


[That little fuzzy thing in the background is my dog, Thea. How I miss her!]

The fact that 7-Zip does so much and is free makes me wonder why anyone would pay $30 for a copy of WinZip. Instead, donate that money to Igor Pavlov, author of 7-Zip.

I decided to do just that. Heading over to the donate page for 7-Zip tells you that the “base donation amount is $50 or €40, but if you would like to donate more, just change the Quantity field”. Apparently, you can donate more than $50, but you can not donate less than $50 — donations must be whole-number multiples of $50.

This is a bit odd. I would think a minimum donation for a free product would be less than the retail price of a commercial product. I wonder how many people don’t donate due to this high number?

Considering that 99% of the archive files I receive are ZIP files, that Windows can compress and expand ZIP files (albeit slowly), and that minimum $50 price tag, I’m going to pass. If Mr. Pavlov would let me set a lower donation level, I’d be happy to oblige; until then, I have that weird feeling I get when there’s a minimum tip amount added to a restaurant bill.

I guess I’ll look for another free/open-source product to send my money to.

Verizon lets you debug your own form submissions

About a week ago, I had to contact Verizon to find out why a cell phone number I haven’t owned for three years was showing up on my online statement. In the process of the call, they reset my online account password, and now I can’t log in. (Hence the misuse of the phrase customer support.)

Today, I went to Verizon’s web site to reset my account information, where I was asked to provide my email address and phone number.

Clicking submit opened up Firebug! Thanks, Verizon, for letting me do your debugging work for you. Does this mean I’m on the payroll?

Verizon lets you debug using Firebug

ATI video drivers may be more stable than nVidia drivers (but does it matter?)

A friend of mine (who is a reseller for Diamond Multimedia) forwarded me an email last night which shed some interesting insight into video card driver stability with Windows Vista:

ATI Provides Proven Driver Stability

Microsoft is currently involved in a class action lawsuit regarding problems with its “Vista Capable” marketing. As part of this trial, hundreds of pages of internal Microsoft emails were unsealed. If you want to take a look at them, here they are (pdf). Aside from providing some interesting insight into what goes on internally at Microsoft leading up to the release of a new OS, there is also a ranking of the cause of crashes logged with Microsoft.

The rankings, based on crashes logged with Microsoft in 2007, paint a very positive picture of ATI’s graphics drivers. For instance, 28.8% of all Vista crashes were caused by nVidia drivers, compared with 9.3% caused by ATI. When you adjust for market share, we still see that Vista systems are almost half as likely to crash when using an ATI graphics solution…

Author: Blake Eggleston

Now that may be marketing gumbo, but if not, it’s very intriguing.

Of course, the one critical fact missing is how often crashes are caused by video drivers. Do video drivers cause crashes once every 50 hours? 100 hours? 1,000 hours? More than that?

If I use a computer 80 hours a week (rough estimate), a crash every 80 hours is a crash once a week. To me, that’s too much. However, if a crash occurs every 800 hours, that’s one crash every 10 weeks, something which I can tolerate.

As the saying goes, “Better is the enemy of good enough.” nVidia drivers are likely “good enough” — so the “better” ATI drivers (if the claims are true) don’t really matter much, at least not to me.

Connecting to MSSQL with Apache and PHP on Windows

I set up a Windows server as a WAMP server (Windows, Apache, MySQL, and PHP) to run vBulletin. Everything worked fine, and the learning curve was pretty short.

Then I tried getting PHP to connect to a remote Microsoft SQL server. Sorry, no luck!

The apparent fix required an updated ntwdblib.dll. The one that came with the latest PHP5 bits (5.2.6) was apparently out of date (version 2000.2.8.0). A newer one, which I founded linked to from a UserScape support page, is version 2000.80.194.0. Shut down Apache, download the newer DLL (replacing the old DLL), and restart Apache. Viola! Hello, MSSQL server.

“Do what you love” or “Love what you do”?

A friend of mine has returned once again to a place called “career second-guessing.” He’s an IT guy who’s comfortable but not “happy” with his current employer or work situation. (It’s a decent paying job with little surprises but no room for growth.)

We’ve been bantering via email about what he should do. My last response was something that may be of interest to others, so I’m sharing it below.

“Do what you love” is probably the wrong thing to say. The correct thing to say is “Love what you do.” There are huge differences. Sounds almost the same, and it is — the difference is the chicken and egg.

If you believe, “Do what you love,” you must first figure out what you love — something that’s not easy to do, because we don’t know what we love until we find it. Think about the time before you met your significant other… If you had to describe your perfect mate (physically, mentally, emotionally, etc.), it wouldn’t necessarily describe him or her (at least, not in all ways). It’s no different with work.

Consider how many times we’ve said, “This is my dream job / mate / situation.” How many times has that panned out? Odds are, it flamed out more often than it panned out.

Some people get lucky and love what they do early in their professional career. Sometimes, over time, you fall out of love with what you’re doing. When you’re not loving what you do, it’s time to move on — just like it’s time to move on when you don’t love your mate. You’re fooling yourself otherwise.

I’ve changed jobs more times than most grown men can count (more than a baker’s dozen jobs since college). I average 1 1/2 years between job changes. For a period of time at each new job, I love what I am doing because it’s exciting and new, like a new girlfriend, or a new video game. Then I fall out of love, and I move on.

Your challenge is to find the thing that you’ll love to do, then hope that it’ll continue to keep your interest. If you don’t have it now, it’s time for a new job, where you may find it. If you don’t find it at the next job, then try again. Don’t lock yourself into something you don’t love to do.

Eight cores, four gigs, ten raids, oh my!

Last week, I dealt with an outage of my “business-grade” Internet connection for the last time. The solution? A managed server, courtesy of SoftLayer.

For a pretty darn good price, I get full access to a dual quad-core server with 4 gigs of RAM and 500GB of usable disk space in a RAID10 array. Add in an awesome web-based control panel, an excellent sales staff (thanks, Michael!), and provisioning in less than two hours, it seems like the right decision so far.

It’ll take some time before I migrate completely to this new rig, but until then, I can enjoy the following scenery.