Category Archives: Uncategorized

List of Single Search and Bento Box Search Applications (mostly libraries)

I’ve been collecting examples of single search applications in libraries for a while now and thought the list might be useful to others. I’m sure I’ve missed some — feel free to add a comment or contact me to add more.

In no particular order:

Too bright lights on Motorola 6141 cable modem

New things. New problems.

I’d been having trouble with my old combination cable modem/wireless router for a while. It needed to be reset a few times a week and I wasn’t seeing the download speeds I should have.

Based on online reviews and recommendations from The Wirecutter I purchased an ARRIS / Motorola SurfBoard SB6141 DOCSIS 3.0 Cable Modem and an ASUS RT-N66U Dual-Band Wireless-N900 Gigabit Router. In the few days they’ve been up and running I’ve been really happy with the Asus Router. It has some advanced features I wasn’t expecting and I saw a bump in download speed from 8Mbps to 16Mbps. Not bad. But while the Motorola modem appears to function fine the lights on the stupid thing are so insanely bright it’s as if the engineers had the clever idea that it should double as a lamp. In your office in the daytime this might be OK. But the only cable line in my house runs to my bedroom, and the flashing blue lights from this innocent plastic box were terribly annoying. A dumb flaw in an otherwise fine modem.

Poking around online I saw a lot of complaints about the brightness of the lights. Part of the problem is that the design lets a lot of light leak through the vents in the case so that the normal fix for this sort of problem — covering the front panel with tape — is ineffective.

Helpfully, a fix was posted on This Does Not Compute. It involves cracking open the case and some tape and probably voids your warranty. The instructions and photos posted there were helpful, but I thought a few additional tips and photos might help someone else out.

The sticker on the bottom of the device runs across the seam in the case. I used a razor to slice through it so that I didn’t have to remove or damage the sticker. You’re probably going to need the MAC address on it sometime in the future so don’t just rip it apart.

The two halves of the case came apart easily enough using a small flathead screwdriver to pry at the location of the clips.

IMG_0241

The hardest part for me was removing the front panel with the lights. Here are is a photo of the clips to give you a sense of how they work.
IMG_0242

I decided I didn’t need the lights at all so I covered the LEDs with black electrical tape to cut the light off completely. You might not want to do this, but I figure if the router is reporting an Internet connection I can assume the modem is working.

IMG_0243

The case snapped back together easily and now it doesn’t emit any light at all. Ahhhhhhhh.

Bug related to intercepting clicks for Google Analytics Event tracking

I’ve been using Google Analytics for a number of projects to track usage. To do useful things beyond tracking pageviews you can use javascript to track activity on the page and send these “Events” to Google Analytics. Events are useful for tracking things like clicks on links. The solution to tracking link clicks is to add a listener on click events and then prevent the default behavior, send the event data to Google Analytics, and then send the browser window on its way to the clicked URL.

Something like this:

$(document).on('click', function(e) {
    
    // Send the data to GA
    ga('send', 'event', {
        'hitType': 'event',
        'eventCategory': category,
        'eventAction': action,
        'eventLabel': label,
        'hitCallback': function () {
            // Once send is complete
            // send the browser on its way
            document.location = link;
        }
    });

    // Don't follow the link
    e.preventDefault();

    // in case something goes wrong
    // and the callback doesn't fire
    // send the browser on its way anyway
    setTimeout(function() {
      document.location.href = link.href;
    }, 200);

}

For details about how to do this you should start with Google’s documentation.

The reason we prevent the default behavior is to make sure the data actually gets sent to Google before the browser moves on to the next page. There is, however, a catch to doing this. It breaks a browser shortcut that I (and I would assume others) find useful.

I generally use Chrome on OS X. If I want to open a link in a new tab I hold down the command key and click on the left mouse button. On Ubuntu and Windows the equivalent is ctrl-click. Well, if the link behavior has been overridden by preventDefault() this doesn’t work and the link just opens, stupidly, in the same window as the current page. Ugh. It’s a minor inconvenience for maybe a small number of people, but it’s annoying, makes your website seem broken, and there’s an easy fix.

It turns out you can detect key presses with javascript.

if (e.metaKey || e.ctrlKey) {
    ga(...)
    return;
} else {
    ga(...)
    e.preventDefault();
}

By detecting the pressed modifier keys you can decide whether or not it’s appropriate to use preventDefault(). If the link will open in a new window you don’t really need to override the link opening because the current page will remain and have plenty of time to send the Event data on to Google.