Category Archives: misc

Lumen: A port of Blacklight to Scala and the Play framework

I’ve done some work the past two years using Blacklight, a great discovery interface for Solr with a lot of library catalog features. It’s quality software with years of work invested in it by some very smart people.

Over time, “the Ruby way” of doing things, as well as “the Rails way,” has bugged me more and more. Things like the use of naming conventions for hooks, passing arrays and hashes around in lieu of actual data structures, the varying use of hashes and OpenStructs, the ability to monkey patch, the difficulty of looking at a method and not being able to tell what its arguments are or can be, the need to go digging around in the source code of a gem to figure out how certain APIs are dynamically created because those methods can’t get automatically documented by tools like rubydoc or yard. These things often make life easier when you’re writing new code and trying to do it quickly, but they create nightmares when you try to refactor stuff or upgrade gem dependencies.

The last few months, I’ve been slowly porting Blacklight to Scala and the Play framework. I’m calling this new project Lumen.

Scala is a powerful statically typed, compiled language that permits you to mix object-oriented and functional paradigms, and it allows you to take advantage of the enormous ecosystem of existing Java libraries. It also incorporates some of the innovations of the last two decades of dynamic languages that make programmers happy. I think it’s a language that privileges software quality over rapid development.

So far, Lumen has been a hobby project to learn Scala, so I’ve approached it in a less disciplined fashion than I otherwise might. This means there are lots of TODOs scattered throughout, and style/design inconsistencies as I’ve learned better ways to do things but haven’t always gone back to change things everywhere. That’s life when you’re noodling around in your spare time. Lumen is largely an experiment right now, but I hope it will eventually grow into a full-featured, production-quality piece of software. We’ll see.

You can check out a demo here:

Upgrading the Touchpad on a Thinkpad x240

This is a stock photo of a Thinkpad x240, stolen from the interwebs:


This is my own x240, which I bought back in January 2015.


If you know about Thinkpads, you probably noticed the difference right away. The x240 (and other models that year) suffered from an incredibly crappy buttonless touchpad. It’s so bad that it’s barely usable. Clicking is ridiculously inaccurate: there’s so much travel that the mouse pointer moves during a click, and there are no buttons to use instead. There were so many complaints that Lenovo replaced it with a better one in the next year’s lineup.

This weekend I finally got around to upgrading it with a touchpad replacement part for the x250. It cost $32 on ebay. This modification is popular, so you can find info about it scattered around in forums and such. I followed the instructions on this page, How to change an x240 trackpad, as it’s one of the clearest ones out there. I couldn’t find much info about the author, whose name appears only as “Michael” on that blog.

Some notes and tips from my experience:

1) Michael’s picture shows a set of wires connected to the touchpad along its side, but mine didn’t have them.

2) The touchpad sits in a well, held in place with adhesive tape, so to remove it, you just pry it off. The problem is that it’s hard to reach “under” the entire touchpad assembly, which is sort of like a sandwich with layers. I ended up partially prying off the top layer before I could get to the bottom and pry the whole thing from the case. Needless to say, this bent the touchpad.

I couldn’t figure out a way to avoid effectively destroying the old touchpad. But since it was so crappy, it was also somewhat satisfying.

3) Detaching and re-attaching the small ribbon cable from/to the underside of the touchpad is VERY tricky. The end of the ribbon is held in place to the connector on the touchpad by a thin black “latch” sitting just behind it. You CANNOT just yank the ribbon out. (This took me a while to figure out!) Lift the black latch, and the ribbon will slide from the connector easily. When connecting it to the new touchpad, tuck the ribbon end securely into the connector, then flip the latch down to lock it in place.

4) At first, the new touchpad wasn’t being recognized by the machine. It worked after I re-seated the ribbon in the connector and also reset the BIOS (as shown in this video: stick a paper clip end into the tiny hole beside the battery and press for 20 seconds). I should have tried those things separately, but got a bit too excited. So you may or may not have to do a BIOS reset.

So far so good. The new touchpad is definitely a big improvement. There’s much less click travel using the pad, and it feels snappier. I really like having the buttons.

The only quirk is that the surface of the touchpad now sits just a hair higher than the palm rest. It’s probably slightly more likely for my hand to accidentally brush it while typing, as compared to the original touchpad, but only time will tell for sure.

It feels like a totally different computer.

“Proxy mode” added in refine_viaf 1.4

A refine_viaf user recently commented that she would like to get Library of Congress IDs for the name candidates in OpenRefine, instead of VIAF IDs.

It would be ideal if the name IDs for LC and other sources could be additional fields in the JSON data returned from refine_viaf, which you could then extract using some GREL code. Unfortunately, OpenRefine doesn’t allow you to access additional fields on name candidate objects.

So I’ve created a separate “proxy mode” that returns IDs used by source institutions themselves, rather than the VIAF IDs. To use proxy mode, add a reconciliation service in OpenRefine using this URL format instead of the usual URL:

One quirk is that OpenRefine will create broken hyperlinks for a few sources (at the moment, these are BNC, BNF, DBC, and NUKAT). This is due to the fact that the IDs in these URLs don’t match the name record IDs, which is a requirement for the hyperlinking mechanism to work properly.

In short, you can now use refine_viaf to reconcile “directly” against the name authority records of VIAF’s source institutions, which should be useful to many people.

Goodbye, Sublime Text?

When one of my coworkers started using Sublime Text about a year ago, I was intrigued. I played with it and found it to be a very featureful and speedy editor. I wasn’t compelled enough to make the switch from Emacs, though. (You’ll pry it from my cold dead hands!) But I really liked the fact that you could write plugins for it in Python.

So for fun, I gradually ported my emacs library, which integrates with a bunch of custom development tools at work, to Sublime Text. It works very well, and the ST users in the office have been happy with it. Although I don’t actually use ST regularly, I’ve since been following news about its development.

What I discovered is that many of its users are unhappy with the price tag and dissatisfied with the support they received via the forums. So much so, in fact, that there’s now an attempt to create an open source clone by reverse engineering it. The project is named lime.

I learned about this with very mixed feelings. There’s a good chance the project will take off, given how much frustration exists with ST. Of course, the trend is nothing new: open source software has been supplanting closed source commercial software for a long time now. But this isn’t Microsoft or Oracle we’re talking about; it’s a very small company, charging what I think is a reasonable amount of money for their product. While they undoubtedly could do more to make their users happier, I imagine that they probably can’t do so without hurting what I imagine are pretty slim profit margins. That, or not sleeping ever again.

It’s not news that making a software product is much less viable than it used to be. Where money is made, it’s increasingly through consulting and customization, but one wonders about the size of that market.

It’s generally a good thing that open source has “socialized” software development: technology has enabled communities of programmers to contribute and collaborate on a large scale, in a highly distributed fashion, to create good quality software available to all, taking it out of the profit equation. The problem is that the rest of the economy hasn’t caught up with this new kind of economics.

I don’t mean to sound dramatic: there are many jobs out there for programmers, of course. But it saddens me that if you want to try to create a product to sell, it’s simply not enough to have a good idea anymore, in this day and age. It has to be dirt cheap or free, you have to respond to every message immediately, and respect every single feature request. Between the open source world and the big software companies that service corporate customers, there is a vast middle ground of small companies that is quickly vanishing.

Disabling the Open Sans font in the Twentytwelve wordpress theme

This seldom-updated blog uses WordPress, which for the most part works very well for my purposes.

I happened to view it using the Google Chrome browser today and noticed a font problem in the Twentytwelve theme. The links in some of my posts were running right up against the text preceding them. Here’s a screenshot:


Notice how there’s no space between “do” and “multiple dispatch” (the second link).

This only happens in Chrome. In Firefox, it looks fine. It appears that using the “Open Sans” font causes Chrome to render the text inside a hyperlink with an improper amount of spacing beside it in some cases (not all).

I wanted to fix this for Chrome but keep the Open Sans font in other browsers, since I like it better than the other sans serif fonts. After a bit of playing around, this is the cleanest way I came up with to accomplish this.

Step 1) Create a child theme. I made a directory called “twentytwelve-jeff” in the wp-content/themes directory and created a style.css file, per the WordPress instructions, that looks like this:

Step 2) Create a functions.php file in that directory, with the following contents:

The code looks for Chrome in the user agent header; if it finds it, it removes the “custom-font-enabled” css class from the body tag, which had been added by the stock twentytwelve theme. Note the priority level; the default is 10, so we set our priority to 20 to ensure this filter runs after the one in the base theme.

Using a child theme avoids making changes to the twentytwelve theme, which is desirable, since any updates would overwrite your changes. You should be able to update twentytwelve and the above child theme should still work.

Ubuntu Woes with the Samsung Galaxy S3

Last week I purchased a Samsung Galaxy S3. It’s a beautiful phone, and I’ve been happy with it so far. Getting it to work with Ubuntu, so I can transfer or sync my music files with it, has been a huge headache, however.

The short of it is this: version 1.1.0 of libmtp, which is what’s packaged with Ubuntu 11.10, doesn’t seem to work with the Galaxy S3. (MTP is the protocol the phone uses to transfer files to and from a PC. Unlike the previous Galaxy devices, the S3 doesn’t mount as a normal USB drive.) The phone just doesn’t get recognized. After reading this bug report, I downloaded the source for the latest version, 1.1.5, and compiled it by hand. (Note: you’ll need to install a -dev package for libusb via apt-get.) That was partially successful: the gmtp program could connect to the phone and show files and directories, but Banshee (2.2.1) now crashed on startup. I was hoping to use Banshee, since it’s a nice iTunes-like music management application that I’d already been using regularly. I could try the latest Banshee (2.6) by compiling that by hand too, but that feels like a bigger ordeal than I’d like to deal with right now.

The easiest solution, of course, is to upgrade to a newer version of Ubuntu with newer versions of all the above software. But 12.04 ships with libmtp 1.1.3, and 12.10 ships with 1.1.4, and I have no idea whether these are recent enough to work.

I’ve been putting off an upgrade because I’m not even sure I want to stick with Ubuntu at all, given the recent issues with data privacy in 12.10.

So it looks like I’m out of luck, in terms of using Banshee to sync music on my current OS installation. I’ve resorted to installing an FTP server on the S3, and copying music that way. It’s awkward and annoying, but it will have to do for now. Perhaps I will write a quick script to do better facilitate music sync’ing over FTP…

(NOTE: This blog post was reconstructed after my super-light traffic WordPress database got mysteriously corrupted this afternoon. Thank you, MySQL. This has not been the greatest of technology days.)

When Your Blackberry Loses Its EDGE

An old entry about my T-Mobile phone gets some search traffic, so I thought posting about this experience might be helpful to other desperate googlers as well.

Two days ago, the Internet access—that is, the EDGE connection—on my Blackberry Curve stopped working at my apartment. Voice calls still worked fine. Occasionally the signal would flicker between GSM and EDGE, which has never happened in the past. If I walked four blocks away, applications like the browser and mail client would work again. EDGE also worked on campus, four miles away. So, for some mysterious reason, this problem was location-specific to just the tower near my apartment. It took two days to even figure all of this out.

Three separate calls to T-Mobile did no good, mostly because I didn’t have easy access to another line so they could troubleshoot my Curve. They did something called a “location reset,” if I remember correctly, but that didn’t help. So I started googling some forums and experimenting.

From what I’ve pieced together, the problem above can occur if Service Book settings get corrupted. The way to fix this is to get a new set of Service Book data sent to your phone from the provider. On the Curve, you do this in the following way:

– Select “Options”
– Select “Advanced Options”
– Select “Host Routing Table”
– Hit the Menu key and select “Register Now”
– The phone will re-register with the provider, who will send new Service Book data to the phone.

Obviously, EDGE has to be operational for the data to be sent, so this fix only works if EDGE is broken in certain locations but you can still make the registration request elsewhere.

Hope this helps someone.

The Auto-Renewal Headache

Today I got two emails from One informed me that a few of my domain registrations were about to expire. That was expected; I no longer wanted them. The other was a puzzling order confirmation. My credit card had been charged for renewal of “business registrations” for those same domains.

So while I no longer owned those three domains, I did now have active business registrations for them costing $4.99 each. (I actually can’t even remember what those are or why I had them in the first place.) Great.

It actually took me a few minutes of navigating the insanity that is’s website in order to figure out what had happened. Under “Domain Manager,” my settings had auto-renew set to Off for each domain, which was correct. But under the “Business Registration” page, there is no such setting. The interface only allows you to edit profile information. There appears to be NO WAY to turn off the default auto-renewal for business registrations.

To their credit, I was able to call their billing support number, explain my situation, and get a refund. The person I spoke understood immediately what had happened and was extremely helpful.

Beware, GoDaddy customers.

Okay, I lied.

When I needed a break over the holidays from my research, where do I turn? To coding, of course.

I’m a FixedGearGallery addict. The idea of the site is that people send in photos of their fixed-gear bicycles and usually some details about how they built them up. The site is updated every weekday with new entries. Yeah, it’s a little dorky but for bike nuts (like me!), it’s a lot of fun. There are some really creative things people have done with their bikes.

I decided to write a little script to parse the FGG listings and create an index organized by “marque” (make/model). There’s already two search functions on FGG, but my index lets you browse and also provides a count for each marque. It’s just another way to navigate the content.

Here is the link:


My Perl Hating Days are Over…

… as are my coding days in general. Since September, I’ve returned to grad school.

The decision wasn’t one I made lightly. And with the economic slump, I often wonder if I’ve made a smart choice in taking a 400% pay cut, only to return to teaching and writing my dissertation. In good times, the job prospects for my field were poor; in bad times, they may be practically non-existent.

So why do it? I miss having the kind of intellectual stimulation centered upon social impact. Application programming is challenging and fun, but I no longer find it as fulfilling as I once did or as others do. Increasingly, it is a thankless job where the headaches tend to outweigh personal growth and learning. In the past year, the best gig I had involved smart architecturally-minded people and a strong project lead. And that was pretty nice, though I still felt something missing. The worst gig involved passive aggressive people who mostly feigned their knowledge. It’s interesting that since I left that job, my replacement (a “CTO” who asked for double the salary) did many of the things I recommended, including a complete overhaul of the codebase. Oh well, I guess they needed to hear it from someone other than me.

So this post is a good-bye of sorts. I may still blog occasionally here about technology when the mood strikes. And I have an idea for a project I’d like to do once my time frees up, one that is more about today’s “culture of technology” than about coding.

Thanks to everyone for reading.