Category Archives: Miscelaneous

Editing the WordPress Comment Form

I don’t collect email addresses or URLs for my comments, but never removed the default ‘Your email address will not be published.’ text from my comment form.

Removing the email address and URL fields was simple using the 'comment_form_default_fields' hook with the following code in my theme’s functions.php:

add_filter('comment_form_default_fields', 'remove_email_url');
function remove_email_url($fields) {
        if (isset($fields['url'])) {
                unset($fields['url']);
        }
        if (isset($fields['email'])) {
                unset($fields['email']);
        }
        return $fields;
}

I couldn’t find a simple tutorial for editing other aspects of the comments form and I didn’t want to dig into the theme and edit the /wp-content/themes/twentytwelve/comment.php file.
After poking around http://codex.wordpress.org/Function_Reference/comment_form and looking at the /wp-includes/comment-template.php, I realized the difference between the 'comment_form_default_fields' and 'comment_form_defaults' hooks.

'comment_form_default_fields' allows operation on the $fields of the comment_form.
'comment_form_defaults' allows modification on the $args of the comment_form.

Addition to my theme’s functions.php:

add_filter('comment_form_defaults', 'remove_publish_email');
function remove_publish_email($args) {
        $args['comment_notes_before'] = '

All comments are moderated.

'; return $args; }

Safely Printing at a Hotel

When using a hotel’s Business Center or other shared computer; I’m always nervous about the types of malware, viruses, or keyloggers might be installed on the computer. I never login to any accounts. Even if I have two factor authentication, I’d rather not give a criminal the opportunity to gather my password. When I have to print something, I’ve been printing to PDF from my personal computer, transferring the file to a USB flash drive, and printing the PDF on the hotel’s computer. This approach made me feel better, but I still felt like there was the opportunity for a virus on the hotel computer to infect my flash drive. What I needed was a way to prevent the hotel computer form writing to the USB flash drive. A hardware write-protect switch seemed to be the answer.

Now-days, USB flash drives with write-protect switches are pretty rare. After extensive searching on amazon.com, NewEgg, and Tiger Direct; I was only able to find a single modern flash drive with a write-protect switch. The Kanguru Flashblu 2 series of drives.

The other option is to use an SD card. Pretty much all of these have a write-protect switch, but the write-protection is in the card reader, not the card itself. There is a small mechanical switch in the SD card reader that detects if the SD card’s switch is in the lock position. While it’s unlikely someone trying to infect your card will have physically tampered with the SD card reader, it’s safer to bring your your own SD card reader.

Once you have your lockable memory, just unlock it, copy your pdf, lock the memory, insert into the hotel computer and print. Since malicious software can still read the data off of your memory, make sure you don’t store or print any sensitive files. I only print un-important things like movie tickets, directions, and other passes.

Be safe!

Status

Hi everyone. I haven’t gone anywhere, I’ve just been sidetracked trying to figure out how to deal with comment spam and working on some layout updates. I’ll have some new content soon.

Stopping a Logitech Unifying Receiver from being detected as a keyboard

On MacOS, plugging in a Logitech Unifying Receiver brings up the detect keyboard dialog. Unfortunately this happes every time a user logs in if the user is not an Administrator. Following the onscreen instructions doesn’t work. MacOS just gives you an error, saying you’re using the wrong keyboard. Even opening the System Preferences, authenticating as an Administrator, and trying to configure the new “keyboard” doesn’t seem to work.

The solution I found doesn’t make complete sense from an OS design point of view. You need to log in with an Administrator account. When the Keyboard Setup Assistant launches, click Continue. Press any key on your keyboard. Click Skip when told your keyboard can’t be identified. Select “ANSI” and click Done.

Note: If the Keyboard Setup Assistant did not automatically launch, open System Preferences, click Keyboard, and click “Change Keyboard Type…”.

Disaster Preparedness (electronics)

I’m no survival expert, so this is about keeping your electronics (both practical and fun) running if you lose electricity for an extended period of time.

Practical

First of all, you need a way to capture the power of the sun. I have a Socosche solar charger/battery. There are many different solar chargers on the market. I like the Scosche one even though it doesn’t produce a lot of current or have a large battery, because it is compact and feels sturdy.

To distribute the charge, I use a Sanyo USB charger. As of 4/2/13, this charger may have been discontinued, and I don’t see any good alternatives. To go with your USB battery charger, pick up some eneloop AA and AAA batteries. These are a they should stil have some charge when you need them.

Now you can power most devices. I recommend having an LED headlamp and/or an LED flashlight. For headlamps, I like pretty much anything by . Most if not all of their headlamps use 3 AAA batteries. For an LED flashlight, I like Streamlight MicroStream 1xAA LED Flashlight or Streamlight 2xAAA LED Pen Flashlight. Both are nice an bright, last a long time, and feel well built.

Beyond these items, a portable radio that takes AA or AAA batteries would probably be good.

Fun

In case the solar charger/battery doesn’t store enough juice, pick up AA to USB charger/battery adapter. This will all you to use those AA eneloops you charged during the day to power your gadgets at night.

Make sure you have all the USB cords and adapters necessary. It can be a pain keeping track of the little pieces, but my Universal Charging kit consists of: