Monday, November 29, 2010

Ruby Autoflush

Google seems to need help with this particular association, so here goes.

In Ruby, to flush currently buffered data just once, call flush on the handle in question:
STDOUT.flush
To "autoflush", or continuously flush output immediately, set the sync attribute:
STDOUT.sync = true
References: flush, sync

Sunday, April 25, 2010

Keyboard Shortcuts for Facebook Photo Tagging

Finally got around to tagging some photos in Facebook. I probably would not have bothered, had gleeBox not made it a bit tolerable by providing some form of keyboard shortcuts for the process:
  • Created an "ESP vision" for the Page URL
    facebook.com/photo.php
    with the jQuery selector
    #photoactions>a[onclick],input[type="submit"]
    #photoactions>a:first-child,input[type="submit"]

  • Changed my "Shortcut to launch gleeBox" to ";"

This allows tagging to go as follows:
  • Navigate to a Facebook photo album

  • Press ;<ENTER> with left hand to enter tagging mode

  • Tag at will

  • Press ;<ENTER> again to leave tagging mode

  • Left-click photo to move to the next photo

With the target crosshairs, it's about as close to an FPS you can get.

7/24/10 Update: Updated to skip new "Share" link.

Thursday, April 15, 2010

Mac Remote Desktop Connection Keyboard Shortcuts

To send the three-finger salute, Ctrl+Alt+Del, to a Windows box when you are connected using a Mac via Microsoft's Remote Desktop Connection, try Ctrl+Option+Delete (backspace).

Sunday, April 4, 2010

Edit "Save Password" Exceptions in Google Chrome for Mac OS X

If you're a Google Chrome for Mac OS X user and you've ever hit "Never for this site" by accident (or have girlfriend who does so consistently), it's a little tricky finding out how to edit these "Save Password" exceptions. It's pretty clear for Windows' Chrome:

http://www.google.com/support/chrome/bin/answer.py?hl=en&answer=156325

but I had trouble finding a solution for the Mac. A little snooping reveals that Chrome keeps its login information in a SQLite database file:
~/Library/Application Support/Google/Chrome/Default/Login Data
To remove an entry from the exception list, do the following:
  1. Shut down Chrome

  2. Probably a good idea to make a backup of the database file

  3. Open the database file in a SQLite database browser; I use SQLite Database Browser

  4. Select the "Browse Data" tab

  5. Sites for which "Never for this Site" has been selected will have the value 1 for the column blacklisted_by_user. Double-click the desired cell, change the value to 0, and click "Apply Changes"

  6. Save and close the database file

  7. Restart Chrome

Monday, April 27, 2009

Ubiquity - Bugmenot command

I like to use BugMeNot when trying to access some websites which require registration, most frequently the New York Times.

Bugmenot has a bookmarklet, but it opens a new window, and is therefore slow, and you have to copy and paste login information yourself.

Ubiquity is a command line interface to various things for Firefox.

I've created a Bugmenot command for Ubiquity.

Simply execute bugmenot while viewing the desired login page, and the top-ranked Bugmenot entry will be populated and submitted.

If that login has expired, you can specify an entry number as a parameter, from the list of entries in the Ubiquity preview pane.

Get it at http://gist.github.com/102363.



Some code was borrowed from Onur Yalazı and Brandon Goldsworthy.

7/9/09 update: Updated to support Ubiquity's Parser 2. The old code is still available here.

Friday, January 2, 2009

Fix for Firefox’s Password Exporter Add-on

7/23/09 Update: Updated to be compatible up to Firefox 3.5.1.

1/8/09 Update: If you tried installing the .xpi and got “Firefox could not install the file at [...] because: Not a valid install package -207,” please see the revised download instructions below.


I like Firefox’s Password Exporter Add-on, but recently I noticed a bug with version 1.1 (released January 5, 2008) when importing into Firefox 3. Several entries return the following error:

'Can't add a login with both a httpRealm and formSubmitURL.' when calling method: [nsILoginManager::addLogin]


I’ve posted the .xpi at http://www.vicshih.com/files/password_exporter-1.1-fx_tb-formSubmitURL-fix.xpi (90.1KB).

Right-click and Left-click this link, which should prompt Firefox to download to your machine. My web page does a redirect, so right-clicking directly actually saves an intermediate web page, which is not what you want. If in doubt, make sure file size is correct. Drag to a browser window to install.

Here’s the diff, in case you are queasy about installing my unsigned version.

Within the file chrome/content/passwordexporter.jar, in the file content/pwdex-loginmanager.js,


540,541c540,549
<
< var bogusLoginInfo = new nsLoginInfo(entries[i].hostname, 'http://passwordexporter',
---
> var doModify = false;
>
> var formSubmitURL = entries[i].formSubmitURL;
>
> if (formSubmitURL) {
> formSubmitURL = '';
> doModify = true;
> }
>
> var bogusLoginInfo = new nsLoginInfo(entries[i].hostname, formSubmitURL,
548c556
< loginManager.modifyLogin(bogusLoginInfo, entries[i]);
---
> if (doModify) loginManager.modifyLogin(bogusLoginInfo, entries[i]);