damien.h

Running Greasemonkey scripts on Ubiquity

Mozilla Ubiquity is not only a wonderful command engine and launcher. It can also be used to do stuff what Greasemonkey is good at, manipulating page DOM dynamically, by utilizing the “pageLoad_” function hook. To demonstrate this case I’ve quickly migrated the recently popular Twitter search on Google monkey script onto Ubiquity. You can get the Ubiq version of Twitter+Google search from here.

I retained the original DOM building code, but replaced the Ajax call with a JQuery one along with a couple hacks explained below to get it working from Ubiquity.

First, while Greasemonkey has built-in mechanism for filtering page URLs for selective script invocation, you have to do that on your own with Ubiquity. Look at the first few lines in the Ubiq command for the regex job to filter out Google search addresses.

    var href = doc.location.href;
    var q = (/^https?:\/\/(?:www\.)?google\..*\/.*[&?]q=([^&]*)(?:&|$)/(href)||0)[1];

Secondly, before publishing the script, you have to put such a line of comment in the script in order for Ubiquity to consider it an installable command and trigger the install bar at the top of the page. (Kudos to satyr for pointing out this hack)

//function cmd_

In similar ways, most of the Greasemonkey scripts can be migrated to Ubiquity.

Feedlr公开上线咯

Feedlr是我用Grails做的一个pet project(宠物项目?)现在已经公开上线咯~

Feedlr是一个类似twitterfeed的miniblog mashup。但它除了twitter同时还支持国内的叽歪饭否,并且能让用户浏览所有在feedlr上创建的bot,就像个bot超市,找自己感兴趣的就能直接follow/关注了。

如果你经常用miniblog,特别是国内的叽歪或者饭否用户的话,不妨去feedlr找找看有趣的bot吧。

或者,如果你有自己的博客,希望更多的人能随时随地收到你博客的更新的话,就可以用feedlr把自己的blog广播到miniblog上。现在不用再羡慕英文blog圈流行的twitterfeed了,用feedlr把你的博客直接广播到国内的叽歪和饭否吧~

另外,你也可以把任何你感兴趣别人也可能感兴趣的feed用feedlr建立bot,让大家都能随时随地收到新鲜消息,比如我建立的cnBeta botGoogle新闻 bot,就有很多叽歪的朋友关注着咯。

你还可以访问Feedlr的叽歪留言板,关注和讨论最新的Feedlr功能和用法,还可以给我提意见~我直接就能通过叽歪收到你的留言呢:))

Notes 8在Ubuntu Gutsy下启动崩溃问题和解决

Notes 8在Gutsy下已经运行的不错了,除了用scim不能输入中文。但是今天在一次意外退出以后,Notes每次启动都会提示出错,错误号CLFRJ00010E(毫无意义的出错信息并不是m$专利)。Google以后终于找到这篇文章,经过尝试以后我的解决方法是这样的。

sudo rm ~/lotus/notes/data/~notes.lck
ps -ef | grep lotus

如果看到还有notes进程的话,比如
user 22514 1 0 10:19 ? 00:00:01 /opt/ibm/lotus/notes/taskldr /opt/ibm/lotus/notes/taskldr

pkill -9 taskldr

以上两步就可以让notes重新启动成功了,并不需要清空workspace。

P.S. 2008第一贴,祝各位新年快乐!

Tags: ,

用Launchy提高你的生活品质:直接搜索你想要的任何东西

几天前Launchy 2.0发布了。2.0出现了哪些新功能呢?其实并没有什么惊天动地的新功能,Launchy已经很好的达到了简约而强大的目的了,如果越变越复杂的话其实会违背其本意。2.0主要是改善了界面和易用性,可扩展性。

用了几天Launchy 2.0以后,有一个实实在在非常有用的用法分享给大家:直接从Launchy向常用的网站提交搜索。用法是这样的:

  1. 从Launchy右上角的按钮进入Optionsimage2.png
  2. 在Plugins里选择Weby插件image3.png
  3. 在Weby配置里添加你最常用的网站搜索URL和查询格式。比如淘宝,URL是:http://search1.taobao.com/browse/search_auction.htm,Query是:?q=%s
    其中%s是使用Launchy搜索淘宝的时候输入的字串。
    image4.png
  4. 设好了!使用起来只要Alt+Space召唤出Launchy,然后打taobao+TAB+搜索字串,直接就能打开淘宝搜索结果页面了。再也不用为了搜一点东西摸上网站填表提交了。爽吧!
    image5.png

和大家分享一下我在默认搜索之外添加的常用搜索:

taobao http://search1.taobao.com/browse/search_auction.htm ?q=%s
shooter http://shooter.cn/sub/ ?searchword=%s
nti http://www.newtorrents.info/search/ %s
mininova http://www.mininova.org/search/ ?search=%s
gmail http://mail.google.com/mail/#search/ %s
ciba http://dict.iciba.com/search ?s=%s
flickr http://www.flickr.com/search/ ?q=%s

要添加你自己常用的搜索,只要照常在网页上搜索的时候留意一下搜索结果的URL,或者看看form的代码,就知道怎么设置Launchy了。

接下来,把Firefox search bar里面的search engine和google toolbar上的custom search全都搬到Launchy上来吧!

LinkStation改装攻略备忘 补充

今天拿了台新换的linkstation回来,很快又改会原来的状态了。上次写的备忘有些需要补充的地方。

  1. 这次试验了ls2直接连电脑后,在电脑和ls2的c网段不同的情况下刷机。结果是firmware刷新失败!不过不用怕,firmware刷新失败后ls2会进入工程模式(Engineer Mode, EM)。这时候ip会回到默认的192.168.11.150,firmware刷新工具仍旧能搜索到ls2。把电脑设置到和ls2相同c网段,重新刷一次就行了。
  2. 建议在第一次e2fsck检查完Debian分区,重启进系统之后,执行tune2fs -i 0 -c 0 /dev/hda1,禁止系统启动时自动检查硬盘,从而避免出现检测超时无法开机的麻烦情况。
  3. 快速改机档的默认ip直接修改/mnt/hda/etc/network/interfaces,这样就不用重启进入Debian再接上电脑改了

LinkStation改装攻略备忘 svn + 动态域名

有2周多没有更新blog了吧,最近在折腾不少事情,升级了台式机,hack了新买的linkstation HD-H120LAN(以下简称ls2),想打造一个高效的soho环境。工欲善其事必先利其器嘛,好的环境和工具是非常必要的。

Linkstation的改装基本按照计划,初步完工以后这个白色的小家伙跑着Debian连续工作了两个礼拜,120G硬盘塞满了90%,这周三突然挂了,为了不破保不敢拆机,于是今天去送修,基本要换个新的了。虽然除了意外,但是linkstation的改装真的是非常值得做的,改装以后非常超值。为了拿到新机以后再改一次,还是把本次改装经过记录下来备忘吧。

国外玩家对linkstation的改装已经很有造诣了,改装社区2年多前就很热了,所以其实现在对linkstation的改装资源已经很成熟了。我的改装过程基本参照这里这里的两篇文章,用了文章里的Debian快速改装包,装完Debian以后常用的工具都已经预装好了,包括torrentflux, mldonkey, samba, lamp, phpmysqladmin。具体过程参照文章就行了,但是有几点要注意。

  1. 关于第三方改装firmware的说明两篇文章都没有交代清楚,刚接触linkstation改装的同学可能会有点晕。linkstation改装的资料在http://www.nas-central.org都有完整说明。最常用的第三方firmware是openlinkfreelink,两者的区别是openlink只是在原厂firmware基础上打开了telnet,其他原厂功能不变,而freelink是直接把原厂linux替换成了Debian。其实也可以直接按照nascentral上面的攻略来改,但上面两篇文章里改法的好处是用了openlink以后在hda3上装Debian,和原厂linux互不影响,可以随时切换,所以是个合理的选择。
  2. 把ls2直接连到电脑以后,电脑不必修改ip到192.168.11网段firmware刷新工具也能搜到ls2。但是我刷的时候为了保险还是把电脑改到11网段了。也许不用改网段也能刷。
  3. 刷完openlink改装版firmware以后,ls2预设的静态ip就是192.168.11.150。因为我用的linksys wireless-b路由只允许192.168.1网段,改完以后不能直接接上路由,不然ls2是拿不到ip的。必须还是连在电脑上的时候把静态ip改掉。由于openlink只是相当于在原厂firmware基础上把原厂linux的telnet打开,所以刷完以后ls2的使用和原来的一摸一样。可以通过http访问192.168.11.150进原厂管理界面直接改掉ip到192.168.1网段,再接到路由上面就行了。
  4. 以下这步非常重要!上面两篇文章里都没有突出这一步的重要性!我的ls2就是因为reboot之前忘了做这一步出问题的!
    强烈建议在每次reboot进debian之前,执行下面操作检查硬盘,防止重启以后因为硬盘检查超时导致无法进入系统的问题!

    umount /dev/hda3
    e2fsck /dev/hda3
  5. 装完Debian以后第一次启动默认静态ip还是192.168.11.150,所以我需要把ls2再接到电脑上改静态ip到192.168.1网段。
  6. 推荐使用下面的Debian源,不推荐第二篇文章里的netselect-apt,至少在我的情况下netselect-apt自动找的源很慢,还会造成deb包的混乱,最后还得用apt-get -f install来整理。
    deb http://mirror.pacific.net.au/debian/ etch main contrib
    deb-src http://mirror.pacific.net.au/debian/ etch main contrib
    deb http://security.debian.org/ testing/updates main
  7. Debian基本都搞舒服了以后就可以根据自己需要装更多软件了。我装了subversion,把ls2用作home lan上的svn server,用下来速度也很不错,推荐一下。apt-get install subversion就行了。顺便说一下我感觉ls2上用svnserve就行了,没必要用apache配webdav,毕竟不是pc还是要节约一下计算资源。
  8. 动态域名问题。之前是打算装花生壳linux版的,后来才发现在ls2的Debian上运行不了,而且没有提供源码,所以就没戏了。后来用的是3322.org,使用非常简单,不需要客户端,只要用lynx定时ping一下3322的web service url就行了。ls2的Debian默认没有lynx,需要apt-get install lynx一下。把下面的命令存为3322org.sh
    lynx -mime_header -auth=user:pass "http://www.3322.org/dyndns/update?system=dyndns&hostname=myhost.3322.org"

    然后chmod +x 3322org.sh,再写个cron job定时执行这条命令:

    crontab -e

    加上这条cron job,每隔5分钟执行一下3322org.sh并把输出保存到3322.org

    */5 * * * * /home/user/3322org.sh >>/home/user/3322.log

    为了防止log文件无限暴涨,可以再加上这条cron job,每天0点删除log

    0 0 * * * rm /home/user/3322org.log

    完了以后别忘了在路由上设好端口映射,之后就可以用动态域名访问ls2上的所有服务了!

搞定!我的完美ls2 server就这样基本完成了!两个星期来已经用torrentflux消耗了无数带宽,还动不动很bt的用手机访问tf。。。等机器拿回来再搞一遍吧。。。

Subversion 1.4.5 + Apache 2.2.4 crash问题备忘

由于工作关系没机会用svn(大家都被迫使用clearcase这个使用和维护超级麻烦动不动出问题的重量级复杂工具),今天在家里的windows xp上装了一个svn 1.4.5,在配置连接apache 2.2.4的时候遇到一些问题,写在这里备忘。

由于我本来就跑着一个apache 2.2.4,所以自然就打算直接把svn连上去。从Subversion网站上下载for apache 2.2的binary,没有windows installer,解压并把bin加入path即可。

以上的安装非常简单,若干分钟就可以搞定svn协议的server了。接下来按照svnbook第六章配置apache的时候,webdav通过浏览器浏览也是非常顺利就ok了,但是发现一旦从tortoisesvn或者subclipse通过http访问repo的时候,apache就会crash。

google了一阵也没找到这个问题的直接答案,但是发现subclipse faq有这么一段说明subclipse在windows下crash的问题,感觉原因很可能类似。于是把环境变量APR_ICONV_PATH改名(删掉也一样),bingo!果然解决了问题!

问题的原因在subclipse faq解释的很清楚。但是我不清楚为什么我发生的情况是apache崩溃而不是subclipse崩溃。subversion 1.5将解决这个问题,但是要等到至少年底才能发布了。

最后公布一个geek版svn server计划,买一个Linkstation,改成Kurobox,装上svn,再装上花生壳 for linux,就是一个廉价省电环保而且随时随地都能访问的svn server了!smile_teeth

Running Lotus Notes 8 on Ubuntu Feisty

My struggle of getting Lotus Notes 8 to run on Ubuntu Feisty has finally come to an almost perfect end. I feel awfully guilty if I don’t blog it and share with you.

My journey started with installing Notes, of course. This part of the story has already been covered very well by other folks. I recommend this particular post to follow.

It’s the running Notes part that’s really frustrating. It actually stuck me for weeks. First, whenever I start Notes, the splash will freeze at some point and a ridiculous jvm crash dialog will show, whose height well exceeds my screen’s and I can’t even see the whole message.

After numerous failure and with despair, I started into a failsafe gnome session and…man! It runs in failsafe gnome! That could be a close enough workaround, but I can’t live with failsafe all my life. So here’s the way that finally got Notes to run happily without failsafe.

  1. Start Notes with regular gnome. When the jvm crash dialog shows, select all the text and copy it to a new text file.
  2. Remove the first line, which should be like “JVM terminated. Exit code=160”.
  3. Remove all the carriage returns in the remaining messages. This is actually the startup script to run Notes.
  4. Add these lines at the top of the script.
    export MOZILLA_FIVE_HOME=/usr/lib/xulrunner-1.8.0.1-lwp
    export LD_LIBRARY_PATH=/opt/ibm/lotus/notes:$MOZILLA_FIVE_HOME
  5. If you don’t have a /usr/lib/xulrunner-1.8.0.1-lw directory, you can either install a xulrunner package, or if you have Firefox, use this instead.
    export MOZILLA_FIVE_HOME=/usr/lib/firefox
  6. Then you need to find this line
    /opt/ibm/lotus/notes/framework/rcp/eclipse/plugins/com.ibm.rcp.j2se.linux.x86_1.5.0.SR4-200707311521/jre/bin/notes2w

    And add this line next to it.
    -Dswt.library.path=$LD_LIBRARY_PATH
  7. Finally, save the file as “notes.sh”. To run Notes, simply run the sh file.

Below is the script I use to start Notes. To use it for your own, replace all occurrences of “houyr” with your own account name and it probably will work.

export MOZILLA_FIVE_HOME=/usr/lib/xulrunner-1.8.0.1-lwp
#export MOZILLA_FIVE_HOME=/usr/lib/firefox
export LD_LIBRARY_PATH=/opt/ibm/lotus/notes:$MOZILLA_FIVE_HOME
/opt/ibm/lotus/notes/framework/rcp/eclipse/plugins/com.ibm.rcp.j2se.linux.x86_1.5.0.SR4-200707311521/jre/bin/notes2w -Dswt.library.path=$LD_LIBRARY_PATH -Xmx512m -Xquickstart -Xjit:noResumableTrapHandler -Dosgi.framework.extensions=com.ibm.rcp.core.logger.frameworkhook,com.ibm.cds -Xscmx64m -Xshareclasses:name=xpdplat%g,groupAccess,keep,nonfatal -Drcp.home=/opt/ibm/lotus/notes/framework -Drcp.data=/home/houyr/lotus/notes/data/workspace -Dosgi.splashPath=platform:/base/../shared/eclipse/plugins/com.ibm.notes.branding,platform:/base/../shared/eclipse/plugins/com.ibm.notes.branding.nl1,platform:/base/../shared/eclipse/plugins/com.ibm.notes.branding.nl2,platform:/base/../shared/eclipse/plugins/com.ibm.notes.branding.nl3 -Dcom.ibm.rcp.install.id=1189233555789 -Drcp.install.config=multiuser -Declipse.registry.nulltoken=true -Dautopd.logfile.generations=3 -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeAwareParserConfiguration -Dautopd.instance.area=/home/houyr/lotus/notes/data/workspace/autopd/ -Disa.ignoreESR=true -Djava.util.logging.config.class=com.ibm.rcp.core.internal.logger.boot.LoggerConfig -Dcom.ibm.pvc.webcontainer.port=0 -Disa.ignorePortableCollector=true -Disa.ignoreFeedback=true -Disa.ignoreUpdate=true -Dderby.stream.error.file=/home/houyr/lotus/notes/data/workspace/logs/derby.log -Djava.security.properties=file:/opt/ibm/lotus/notes/framework/rcp/eclipse/plugins/com.ibm.rcp.base_6.1.1.200707311521/rcp.security.properties -Djava.protocol.handler.pkgs=com.ibm.net.ssl.www.protocol -Dosgi.hook.configurators.exclude=org.eclipse.core.runtime.internal.adaptor.EclipseLogHook -Drcp.osgi.install.area=/opt/ibm/lotus/notes/framework/eclipse -Xbootclasspath/a:/opt/ibm/lotus/notes/framework/rcp/eclipse/plugins/com.ibm.rcp.base_6.1.1.200707311521/rcpbootcp.jar -jar /opt/ibm/lotus/notes/framework/rcp/eclipse/plugins/com.ibm.rcp.base_6.1.1.200707311521/launcher.jar -os linux -ws gtk -arch x86 -launcher /opt/ibm/lotus/notes/framework/rcp/eclipse/plugins/com.ibm.rcp.base_6.1.1.200707311521/linux/x86/eclipse -name IBM Lotus Notes -showsplash 600 -exitdata 35801c -nl en_US -dir ltr -personality com.ibm.rcp.platform.personality -product com.ibm.notes.branding.notes -data /home/houyr/lotus/notes/data/workspace -configuration /home/houyr/lotus/notes/data/workspace/.config -plugincustomization /opt/ibm/lotus/notes/framework/rcp/plugin_customization.ini -vm /opt/ibm/lotus/notes/framework/rcp/eclipse/plugins/com.ibm.rcp.j2se.linux.x86_1.5.0.SR4-200707311521/jre/bin/notes2w -vmargs -Xmx512m -Xquickstart -Xjit:noResumableTrapHandler -Dosgi.framework.extensions=com.ibm.rcp.core.logger.frameworkhook,com.ibm.cds -Xscmx64m -Xshareclasses:name=xpdplat%g,groupAccess,keep,nonfatal -Drcp.home=/opt/ibm/lotus/notes/framework -Drcp.data=/home/houyr/lotus/notes/data/workspace -Dosgi.splashPath=platform:/base/../shared/eclipse/plugins/com.ibm.notes.branding,platform:/base/../shared/eclipse/plugins/com.ibm.notes.branding.nl1,platform:/base/../shared/eclipse/plugins/com.ibm.notes.branding.nl2,platform:/base/../shared/eclipse/plugins/com.ibm.notes.branding.nl3 -Dcom.ibm.rcp.install.id=1189233555789 -Drcp.install.config=multiuser -Declipse.registry.nulltoken=true -Dautopd.logfile.generations=3 -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeAwareParserConfiguration -Dautopd.instance.area=/home/houyr/lotus/notes/data/workspace/autopd/ -Disa.ignoreESR=true -Djava.util.logging.config.class=com.ibm.rcp.core.internal.logger.boot.LoggerConfig -Dcom.ibm.pvc.webcontainer.port=0 -Disa.ignorePortableCollector=true -Disa.ignoreFeedback=true -Disa.ignoreUpdate=true -Dderby.stream.error.file=/home/houyr/lotus/notes/data/workspace/logs/derby.log -Djava.security.properties=file:/opt/ibm/lotus/notes/framework/rcp/eclipse/plugins/com.ibm.rcp.base_6.1.1.200707311521/rcp.security.properties -Djava.protocol.handler.pkgs=com.ibm.net.ssl.www.protocol -Dosgi.hook.configurators.exclude=org.eclipse.core.runtime.internal.adaptor.EclipseLogHook -Drcp.osgi.install.area=/opt/ibm/lotus/notes/framework/eclipse -Xbootclasspath/a:/opt/ibm/lotus/notes/framework/rcp/eclipse/plugins/com.ibm.rcp.base_6.1.1.200707311521/rcpbootcp.jar -jar /opt/ibm/lotus/notes/framework/rcp/eclipse/plugins/com.ibm.rcp.base_6.1.1.200707311521/launcher.jar
rm -rf ~/lotus/notes/data/workspace/logs/javacore*.txt
rm -rf ~/lotus/notes/data/workspace/logs/core*.dmp

**Update**

Yeah I got Notes to “run”, technically. But getting it to fully work is another thing. Now I’ve found a new problem. Whenever I create a new memo, or reply or forward a mail, a little dialog called “NSD is running” will show, and Notes freezes. In the console window behind, a lot of error is generated by this nsd.sh, which is actually a dumping script.

Anyone has any insight on this issue?

用Launchy发消息到饭否

Launchy真是个用了舍不得放下的小东西,可以双手不离键盘的打开电脑上几乎任何东西。而且,hack一番的话你还可以让Launchy干更多更有趣的事情。

image

比如,今天尝试成功了用Launchy发消息到

Hello world, again (Part II, how I moved from JRoller to WordPress)

This is my summary about the migration of my blog from JRoller to here.

I’m a Java engineer working in China. So when I was looking for a free blogging service, JRoller was my natural choice, because

1. In China, Blogger, WordPress, LiveJournal, and all other mainstream blogging sites are blocked. So there are sadly not many choices left for me.

2. Chinese local blogging sites are crap, specially from a developer’s perspective.

3. JRoller is the best free blogging service implemented in Java today. It’s hosted by JavaLobby which is one of my favorites. There are a lot of brilliant folks hosting their blogs there. And since it’s not so mainstream, it’s not blocked in China. Hurray!

But after more than 3 months living with JRoller, I have to say I’m an unhappy user. Roller’s (JRoller’s, actually) lack of attractive features and looks, defective Chinese support, mysterious API support, make it fairly uncompetitive compared to today’s top ones, and make my blogging experience rather unexciting.

So I decided to move to WordPress, setting up on a server space I’m sharing with my friend, to get rid of all the problems. And I have to say WordPress is simply great.

So I did some Google search about the migration of my posts from JRoller to WordPress. I found a post from zeusville very helpful. And Jesus Rodriguez, the blogger, was kind enough to send me the custom JRoller template file which I wasn’t able to download from his blog anymore. Thanks again, Jesus.

Now I’m already very comfortable with WordPress. BTW. This post is written with Windows Live Writer. I have to say that this is the best free offline blogging software I’ve used so far. Unfortunately it comes from Microsoft so it only runs on Windows. But maybe it’ll have a chance running on Mono on Linux. I’ll give it a try later.

Browse Happy logo

My tweets

2016年七月
« 八    
 123
45678910
11121314151617
18192021222324
25262728293031

分类目录

Articles

Fancy Stats