Data Unbound

Data Architect, Consultant, Trainer, and Author Raymond Yee on data and software in research and education

November 21st, 2008

Fixing the OpenID setup my WordPress blogs

Since I want to make it easier for people to write comments on my weblogs (while not making it too easy for spammers), I added support for OpenID for my blogs by using the WordPress OpenID plugin. Unfortunately, the plug-in stopped working sometime along the way, giving rise to the following error message when users try to log in using OpenID:

    User was created fine, but wp_login() for the new user failed. This is probably a bug.

WordPress › Support » OpenID Plugin (WP 2.5) calls non-existant error() method suggests a possible solution. But I think a better one is to install more current OpenID WordPress plug-in. I've installed the plug-in on Hypotyposis on a Good Day, Mashup Guide, and Data Unbound, and Mixing and Remixing Info and tested the plug-in with two OpenID providers (myOpenID and Yahoo! OpenID)– and things seem to work. My apologies to those who had tried OpenID on my weblogs but were not able to post comments.

November 21st, 2008

A screencast to show Chickenfoot scripting of Zotero

Several weeks ago, I wrote (a blog post and a post on the zotero-dev group) on how to use Chickenfoot to script Zotero. I'm starting to experiment with creating little videos that I hope will make my technical posts easier to understand. Here's one I just made to illustrate what I wrote about in the previous post:

Please forgive my video-newbie level of craft — I'm still learning to make my way around Camtasia Studio 6. (One fault is that I produced the video for 640×480, which is not the optimal setting for YouTube.)

Enjoy!

November 12th, 2008

adding all Firefox tabs to Zotero using Chickenfoot

We can now build on what was presented in the previous blog post: Adding items to Zotero with Chickenfoot.

The end goal is to loop through all the tabs and add Each of them as items into Zotero. So we need to figure out how to access the tabs. I would do so here by presenting a series of code fragments that you can try out using Chickenfoot and Zotero.

But let's first work through some code to manipulate tabs in Firefox, drawn from two reference documents:

  • tabbrowser - MDC: a reference to the tabbrowser object
  • Tabbed browser - MDC has some nice sample code, which seems to work best in Firefox 3.x, — something seemed to fail in Firefox 2.x (I should put an example here)

For example, one example of code doesn't work in 2.x — using addTab:

var tabBrowser = getTabBrowser(chromeWindow);
tabBrowser.addTab("http://yahoo.com");

Since I've had some problems using Firefox 2.x, I recommend running the following code fragments in Firefox 3.x.

First, let's get the tabbrowser object:

var tabBrowser = getTabBrowser(chromeWindow);
tabBrowser;

You can show the URL of the currently selected tab:

var tabBrowser = getTabBrowser(chromeWindow);
tabBrowser.selectedBrowser.contentWindow.location;

The following code advances selects the tab to the right of the currently tab — and loops around if needed:

var tabBrowser = getTabBrowser(chromeWindow);
tabBrowser.mTabContainer.advanceSelectedTab(1, true);

We can write out the current number of open tabs:

var tabBrowser = getTabBrowser(chromeWindow);
output(tabBrowser.browsers.length);

Here's code to select each tab in turn and output its location:

var tabBrowser = getTabBrowser(chromeWindow);
output(tabBrowser.browsers.length);
for (var i=0; i < tabBrowser.browsers.length; i++) {
  tabBrowser.mTabContainer.advanceSelectedTab(1, true);
  output(tabBrowser.selectedBrowser.contentWindow.location);
}

how to create a new collection in Zotero:

var Zotero = chromeWindow.Zotero;
var new_Collection = Zotero.Collections.add("testing");
new_Collection;

Here's code to create a new collection and add an item to it. (In my tries, the code crashes in FF 2.0.x but seems to work in FF 3.0.3):

var Zotero = chromeWindow.Zotero;
var ZoteroPane = chromeWindow.ZoteroPane;

var new_Collection = Zotero.Collections.add("testing");
var new_item = ZoteroPane.addItemFromPage(new_Collection.id);

Here's code that pulls it altogether — it loops through the tabs and adds the document of each tab to Zotero in a new collection:

var Zotero = chromeWindow.Zotero;
var ZoteroPane = chromeWindow.ZoteroPane;
var tabBrowser = getTabBrowser(chromeWindow);

var new_Collection = Zotero.Collections.add("Saved from tabs");
output(tabBrowser.browsers.length);

for (var i=0; i < tabBrowser.browsers.length; i++) {
  tabBrowser.mTabContainer.advanceSelectedTab(1, true);
  output(tabBrowser.selectedBrowser.contentWindow.location);
  var new_item = ZoteroPane.addItemFromPage(new_Collection.id);
}
November 3rd, 2008

Python 2.6

I just installed Python 2.6:

I've not had a chance to figure out how it's different from Python 2.5.

November 1st, 2008

Adding items to Zotero with Chickenfoot

Here I report a few code fragments that you can try in Chickenfoot to create a Zotero item from the contents in the selected tab of your browser. (For a bit of context for what I'm talking about here, see my previous post Data Unbound » Accessing Zotero via Chickenfoot: a warm up exercise.)

There's a difference between the Zotero function that is invoked if an appropriate translator is found verses when there is no translator (and you have to then "create a new item from current page". (It would be helpful to show you how I deduced what these code fragments should be — I hope to do so later.)

When there is an appropriate translator, you invoke Zotero_Browser.scrapeThisPage:

var Zotero_Browser = chromeWindow.Zotero_Browser;
Zotero_Browser.scrapeThisPage();

When there isn't — and you add the page to Zotero as a web page using ZoteroPane.addItemFromPage:

var ZoteroPane = chromeWindow.ZoteroPane;
ZoteroPane.addItemFromPage();

Yet to figure out: How to ask Zotero whether for the selected tab there is an appropriate translator to use.

November 1st, 2008

Remembering how to map the key to a function in OpenOffice.org Writer

Yesterday, I installed the new version 3.0 of Open`Office.org. I had configured the old version of open office.org to map Ctrl-Q to insert a timestamp of the current time. (I'm using the key mapping from Ecco Pro.) It took me a little while to figure out how to do this configuration once again. Hence I made a little screencast to remind myself of how to do this task, should I have to do it again:

This was also an opportunity to remind myself how to make a rudimentary screencast using Camtasia Studio. In the future I have to learn how to create more sophisticated effects. I'm also looking into using Jing Project: Visual conversation starts here. Mac or Windows, not only because it's free but actually might be more convenient for simple application. I must say that I'm tempted to upgrade my Camtasia Studio setup to version 1.5 because of its new Zoom-n-Pan Effects. have to download the new version and evaluate whether it's worth the money to upgrade from version 4.0)

On a larger note, I can see making a lot more videos to document what I'm learning so that I can remember how to do things, will also teach others to perform some tasks. I think these videos will expand beyond recording the computer screen.

November 1st, 2008

Congrats to smARThistory!

Hearty congratulations to my colleagues Beth Harris and Steven Zucker for winning a prestigious international award for their newly redesigned smARThistory! I'm looking forward to studying the new site in detail — and learning a lot about art history while doing so. (I started reading the number of books on art history (including Julian Bell's Mirror of the world : a new history of art) but haven't yet gotten all the way through the books. I hope that the smARThistory site will give me a different and complementary perspective to these books.)

|