Friday, June 22, 2007

PostScript libraries

I've been writing some PostScript lately, such as matrix multiplication routines: things that really belong in a library. So I spent a good chunk of time today writing some software for preparing postscript files to be libraries. I wrote a Perl script `curdle` which takes a PostScript file as input and compresses it to a binary encoding with no comments and minimal spaces. At some point I'll add a script which will rename long internal variable names (as directed by comments). Once the file is compacted, it can be run through encode85 (which I found on some random FTP site) and put into a resource file a big block of gibberish, which is then either included automatically by the PostScript viewer, or else pasted at the top of the PostScript file which includes it. In any case, it should help significantly with PostScript library version control. Especially when I automate the resource part and include a "built on" date in the header.

If you're interested you can get the most up-to-date version of it with darcs (or just browse to this directory):

darcs get http://www.physics.cornell.edu/~shicks/darcs/pslib/

Tuesday, May 29, 2007

Blogger pain

I get frustrated when Blogger wants to "Save as Draft" whenever I hit Ctrl+D. I usually expect this keystroke to ask as delete. So I hit it often, and get annoyed when it loads a new page. So I fixed it. Here's another Greasemonkey script.

Firefox + Google Scholar + Cornell Library

So, I was sick of having to go through the CU Library homepage for every journal article I wanted to download at home. And so I wrote a quick and dirty plugin to add a link to each Google Scholar result to access it through the CU Library proxy automatically, this saving gobs of time (maybe someday as much time as I spent writing it in the first place!).

One (small) issue with this is that it only works if you're logged into CUWebLogin, but checking for that each time is very slow. So I actually make two links - the "login" link goes through the official channels while the other link attempts to bypass them and go directly to the article, so it should be quicker if you're already logged in. It probably wouldn't be too tough to edit it to work for a different school with a little investigation.

To use the plugin, you need to have GreaseMonkey, which is a pretty standard Firefox plugin allowing you to use any of a multitude of "user scripts" which are basically scripts people write to post-process webpages.

I also wrote a standalone plugin to add a button to the (right-click) context menu to access a page through the library, in case it came from somewhere other than Google Scholar. This one is only the slow access method, although it could be configured to access it quicker with enough demand.

At some point, I may integrate all this into a standalone plugin. And I may look into adding a configuration tool so that other university libraries will be usable (although I'd need help from others for this to work). For now, if you're at a different school and would like to try using this, talk to me and I'll see if I can hack together a version for you.

Installation

  1. Install Greasemonkey if you haven't already.
  2. Install the userscript for Google Scholar links.
  3. Install the browser plugin for the context menu:
EDIT(2010 Nov 23): Added Chrome extension.