Disabling reCAPTCHA extra function buttons from tab index using jQuery

Here’s an easy way to disable the “Get a new challenge”, “Audio Challenge”, and “Help” buttons from reCAPTCHA display block using jQuery.

Simply add the following to $(document).ready(function() { … } on the page you have reCAPTCHA on:

$(document).ready(function() {
   $("#recaptcha_reload_btn, #recaptcha_switch_audio_btn, #recaptcha_whatsthis_btn").attr("tabindex", -1);
});

Now when you tab out of the word entry field, the extra function buttons are skipped. This is a usability issue because if the extra buttons are left active in tab index, user can easily accidentally reload the challenge image when she thinks she is moving to the next item on the form (which is often the “submit” button), and then quickly hits Enter.

Explorations in the World of Linux

I’ve been a FreeBSD admin for the past decade, and during this time have become quite familiar with the *BSD system. It has its quirks, but overall it’s very clean and easy to maintain.

From time to time – usually when I’ve been getting ready to upgrade to the next major revision of FreeBSD – I’ve taken some time to research what the current pros and cons are for FreeBSD vs. some Linux distro. Always, in the end, FreeBSD has won. However, a development project I’m starting to work on will utilize Zend Server, which is only supported on handful of common Linux distros and on Windows (which is, by default, not an option as I strongly maintain that Windows is not suitable as a web server platform). There is, of course, Linux compatibility layer in FreeBSD, but as Zend doesn’t currently support it as a platform for Zend Server, I wouldn’t feel comfortable using it in a production environment.

So even though I find FreeBSD superior to Linux in many ways, I’ve now spent some time getting acquainted with Linux. I first started with Red Hat, then moved to CentOS which is the Linux distribution I’m currently testing. Now it’s not bad, per se, but I frequently come back to the thought: “Why would someone, anyone prefer THIS over a BSD system?!” The package management with yum, rpm, and the GUI overlays is easy enough, but it’s chaotic! Having to enable and disable repos, set their priorities, etc. seems unnecessarily complicated. On the FreeBSD side there is the ports collection which provides most of the software that one can imagine ever needing. The odd few items that either aren’t available in ports, or whose configuration is somehow not complete enough through ports can be easily compiled from the source tarball. Everything’s quite easy to keep track of, and to duplicate if one’s building a new system.

I’m sure some of this feeling stems from the fact that I have been using a BSD system for so long, and from the fact that I probably don’t yet know Linux well enough (say, to build the system from a scratch..). But as far as I can tell, package management is done with yum and rpm (on CentOS, say), by adjusting repository priorities, and enabling/disabling repositories. That is messy!

Well, I now have a functional development server running Zend Server with Apache, Subversion, and MySQL, and as the vendor (Zend) dictates the rules, I must continue development on Linux. Perhaps in six months time I’ll have more favorable comments about it as compared to FreeBSD… but I sort of doubt it. My guess is I’ll just learn to live with it, every now and then wistfully glancing to the direction of the BSD server.

Something I didn’t know about KVM switches and Motherboard BIOS…

I recently installed Gigabyte GA-EP45T-UD3LR motherboard to a small LAN file server. It’s a decent, stable, inexpensive board. But what I didn’t realize is that if you want to use a shared USB keyboard and mouse with a Windows system, some BIOS options must be available and editable (assuming they’re not set “correctly” by default from the KVM switch’s point of view). This motherboard’s BIOS doesn’t have those options and apparently the BIOS defaults aren’t the right ones for this kind of use. The result: once USB keyboard and mouse have been switched away from the system with a KVM switch, they’ll never be reacquired by the system until the system is rebooted. Fortunately RDC works so that the console is not usually—or at least is very rarely—needed…

For reference, if you’re planning to use a Windows system with a KVM switch, make sure its BIOS has the following options:

  • HALT ON ERROR: All but keyboard (usually in Standard CMOS settings)
  • PnP OS: yes (usually in PnP/PCI settings)
  • USB IRQ: enabled (usually in PnP/PCI settings)

Without these options set the only way to find out whether a specific motherboard will or will not work with a USB KVM switch, is to try. Gigabyte GA-EP45T-UD3LR does not.

Unix Commands Galore

Couple of days ago a friend of mine pointed me to commandlinefu.com. It’s strange how addictive a service like that can be! I’ve perused a good chunk of the commands posted on the site, learned quite a few new things, augmented the command aliases on my servers, and posted few of my brainchildren as well as posted suggested fixes to some that I found to be a cool ideas but that didn’t work for me as they were presented (such as the command to copy database from a local MySQL server to a remote MySQL server over SSH).

Deleting all network interface aliases

I recently needed to move bunch of aliased IPs from one FreeBSD server to another. Adding aliases to /etc/rc.conf and then running ./netstart while in /etc adds new multiplexed IPs to the system all right, but if you need to remove aliased IPs, running /etc/netstart won’t remove them even if the aliases have been removed from /etc/rc.conf. Perhaps there is some easy single command that culls the active alias IPs to those specified in /etc/rc.conf, but I’m not aware of it. The following command can be used to quickly delete all aliased IPs for a specific interface (here “em0″):

ifconfig | grep “0xffffffff” | awk ‘{ print $2 }’ | xargs -n 1 ifconfig em0 delete

For this to work, the netmasks of the aliases and the master IP for the inteface must differ. The netmasks of the aliases are usually set to 255.255.255.255 (hence “0xffffffff”) while the netmask of the master IP is usually something different, specific to your network, e.g. 255.255.255.128 (“0xffffff80″).

Once the above command has been run, /etc/netstart can then be executed to load the remaining or reconfigured aliases (if any) from /etc/rc.conf.