实现了一个SCAR的zotero translator

Posted on 五月 27th, 2009 in Program, RS | No Comments »

SCAR: Science of Cold and Arid Regions 是所里新办的一个期刊,看了几篇文章,打算摘录下来,zotero却不支持,需要自己再写一个转换器(translator),花了一下午的时间,终于搞出来了,暂时不支持搜索功能。
把下面的代码保存到zotero下的translator目录,给个名字,如SCAR.js,然后重新启动一下FIREFOX,应该就可以使用了。

{
"translatorID":"d5770df3-b41a-45cb-bb3a-261948c9af49",
"translatorType":4,
"label":"SCAR",
"creator":"Liangxu Wang<wangliangxu@gmail.com>",
"target":"http://www.scar.ac.cn/hhkxen/ch/reader",
"minVersion":"1.0",
"maxVersion":"",
"priority":100,
"inRepository":true,
"lastUpdated":"2009-5-27 22:33:00"
}

function detectWeb(doc, url) {
var articleRe = /view_abstract.aspx/;
var s = articleRe.exec(url);

if(s) {
return "journalArticle";
} else {
return "multiple";
}

return false;
}

function scrape(doc) {
var nsResolver = null;

var itemType = "journalArticle";
var newItem = new Zotero.Item(itemType);
Zotero.debug(itemType);

// 标题
var title = doc.getElementById('EnTitle').textContent;
Zotero.debug("Title:"+title);
newItem.title = title;

// 附件,网页快照
var snapName = title + " (SCAR)";
Zotero.debug(snapName);
newItem.attachments.push({document:doc, title:snapName, mimeType:"text/html"});
//Zotero.debug(doc);

//关键词
var keys=doc.getElementById('EnKeyWord');
var tags=keys.getElementsByTagName('u');
var i=0;
for(i=0;i<tags.length;i++){
newItem.tags.push(tags[i].textContent);
Zotero.debug("tag:"+tags[i].textContent);
}
//摘要
var abstract=doc.getElementById('EnAbstract');
newItem.abstractNote = Zotero.Utilities.trim(abstract.textContent);
// 出版社
newItem.publicationTitle = 'Sciences in Cold and Arid Regions';
newItem.ISSN='1674-3822';
newItem.url = doc.location.href;
//出版时间
var ref=doc.getElementById('ReferenceText').textContent;
if (ref.match(/,(\d+).+Sciences in Cold and Arid Regions,(\d+)\((\d+)\):(.+)\./))
{
newItem.volume=ref.match(/,(\d+).+Sciences in Cold and Arid Regions,(\d+)\((\d+)\):(.+)\./)[2];
newItem.issue=ref.match(/,(\d+).+Sciences in Cold and Arid Regions,(\d+)\((\d+)\):(.+)\./)[3];
newItem.pages=ref.match(/,(\d+).+Sciences in Cold and Arid Regions,(\d+)\((\d+)\):(.+)\./)[4];
newItem.date=ref.match(/,(\d+).+Sciences in Cold and Arid Regions,(\d+)\((\d+)\):(.+)\./)[1];
}
//作者
if (ref.match(/(.+),\d+\.+/))
{
authors=ref.match(/(.+),\d+\.+/)[1].split(',');
for(i=0;i<authors.length-1;i++) {
newItem.creators.push(Zotero.Utilities.cleanAuthor(authors[i], "author", true));
}
author=authors[authors.length-1].split('and');
for(i=0;i<author.length;i++) {
newItem.creators.push(Zotero.Utilities.cleanAuthor(author[i], "author", true));
}
}
Zotero.debug("finished.");
newItem.complete();
}

function doWeb(doc, url) {
var namespace = doc.documentElement.namespaceURI;
var nsResolver = null;

if(detectWeb(doc, url) == "multiple") {
Zotero.debug("Enter multiple~");
// TODO: implement the multiple function.
} else {
var urls = [url];
}
Zotero.debug(urls);
// 下面对每条url进行解析
Zotero.Utilities.processDocuments(urls, scrape, function() { Zotero.done(); });
Zotero.wait();
}

也可以直接下载:scar.js

ubuntu flash方块字的解决

Posted on 六月 11th, 2008 in Linux | No Comments »

其实很简单:

sudo mv /etc/fonts/conf.d/49-sansserif.conf /etc/fonts/conf.d/49-sansserif.conf.bak

参考:

http://wiki.ubuntu.org.cn/index.php?title=Firefox&variant=zh-cn

使用ubuntu gutsy tribe2

Posted on 七月 1st, 2007 in Linux | 3 Comments »

这是ubuntu gutsy的第二个alpha版本,忍不住把当前的系统直接升级了,主要是因为我在VitrualBox里试验的ubuntu gutsy一直超慢,但没有任何问题。

升级比较简单,我使用cn99的源,速度飞快。

存在的几个问题:
1、anjuta 2.20无法使用了。
经检查,是库的问题,重新符号化就可以了:

sudo ln -s /usr/lib/libbfd.so /usr/lib/libbfd-2.17.50.so

2、Firefox有奇怪的问题
多数情况下没有问题,但有时候页面会失去键盘响应,就是无法输入,有时无法点击连接,非常奇怪的问题,还没有发现什么规律,但出现的几率很大。

还没有发现别的问题,同时要赞一下xrandr 1.2,功能非常强,在我的i915显卡上,可以比较好的支持。
在使用前,若要进行双屏显示,需要把原来的xorg.conf进行处理。主要的就是简化device设置,以及去掉Monitor的刷新率设置,在Screen里加上Virtual桌面大小设置。
进入X后,可以运行xrandr,看看当前支持的显示器。

wlx@cngis:~$ xrandr
Screen 0: minimum 320 x 200, current 2304 x 1024, maximum 2304 x 1024
VGA connected 1280x1024+0+0 (normal left inverted right) 376mm x 301mm
1280x1024 60.0*+ 75.0 59.9
1152x864 75.0 74.8
1024x768 84.9 75.1 70.1 60.0
832x624 74.6
800x600 84.9 72.2 75.0 60.3 56.2
640x480 84.6 75.0 72.8 66.7 60.0
720x400 70.1
LVDS connected 1024x768+1280+0 (normal left inverted right) 246mm x 184mm
1024x768 60.0*+
800x600 60.3
640x480 59.9
TMDS-1 disconnected (normal left inverted right)
TV disconnected (normal left inverted right)

然后就可以使用xrandr命令指定双屏的设置:

wlx@cngis:~$ xrandr --output VGA --left-of LVDS

若要修改分辨率,直接执行:

wlx@cngis:~$ xrandr -s 1280x1024

不过,xserver-xorg-video-intel 2.0的驱动,在i915的显卡上,现在还不能支持大于2048x2048的虚拟桌面。象我的两个显示器,一个1280x1024,一个1024x768,加起来正好超过了限制,所以就失去了dri的能力。可惜,我的大显示器不能旋转,否则就可以满足需求了。当然也可以强制两个1024x768,但看着感觉不舒服。

BTW:evince的标注功能还没有完成,期待这个soc项目能早日发布。

MR Tech Local Install:实用的FIREFOX扩展

Posted on 九月 14th, 2006 in Linux | No Comments »

前面曾经提到安装TOR后,无法在FIREFOX 2.0上安装torbutton扩展,今天试验了其他几个proxy切换插件,都不是很好用。
无意中看到了MR Tech Local Install这个插件,安装后就可以安装torbutton了,使用起来没有任何问题。
畅通无阻的网络真好!

flash7播放youtube问题以及定制livecd

Posted on 九月 14th, 2006 in Linux | No Comments »

目前的flash palyer 7.0在FIREFOX 2.0b1中播放youtube的视频时总是有问题:
播放是好的,但在播放结束时会把FIREFOX搞死。

根据这个帖子

If it makes you feel a bit more at ease, youtube occasionally freezes firefox on my computer as well. I'm using firefox with aoss (I start firefox by using 'aoss firefox') and it had been working until recently. Sometimes things go really well, some other times it just hangs.

I'm using firefox 1.5.05 with Shockwave Flash 7.0 r25. I noticed it started to hang recently, when youtube added those fancy video links at the end of the movies.

My guess, however, is that flash support for linux is buggy, and not youtube's code. It hangs as well on some other flashes randomly. It also happens when I'm not using it through aoss.

I noticed that it freezes a lot less when there is no audio playing or it isn't on that fancy screen with video links at the end of the movie, so I usually start and pause the video before switching pages.

By the way, does macromedia ever intends to release an update for linux flash?

估计这个问题可能是FLASH 7和9之间的不兼容问题?
google了一下,又发现了另外一个有趣的内容,定制UBUNTU的LIVE CD,这个是FLASH9的开发人员的一个BLOG。

breezy尝鲜

Posted on 九月 27th, 2005 in Linux | 7 Comments »

其实,也不是我想尝鲜,由于错误的操作,在升级的时候使SKYPE出现问题,最后FIREFOX也起不来了(这边的网络要先firefox然后才能上网,呵呵,导致了死循环),幸亏W3M还能用,尝试了几次,才知道如何用w3m登录网关。
上网后,改成了breezy的源,然后开始更新,大约700兆的内容。起来后x崩溃,经检查,是显卡驱动的问题,i915的驱动需要单独更新:sudo apt-get install xserver-xorg-i810
X起来后,增加了skype的源,但居然不能安装。
breezy里已经没有libqt102c了,不能dpkg,也不能apt,最后还是google到了,使用一个旧版本就没有问题了。参考

http://www.mneylon.com/blog/archives/2005/09/25/skype-on-breezy/

text are not shown in ubuntu firefox flash?

Posted on 七月 5th, 2005 in Linux | 1 Comment »

This is a strange problem.
Flash text can not be shown in Ubuntu hoary, mozilla firefox 1.04,
the reason is some fonts lack in the system.
Just install msttcorefonts can solve this.