石锅拌饭

Tag: hack

Goo - Ruby Gem文档浏览器

by Robin Lu on Aug.28, 2008, under Uncategorized

一般查看ruby gem 文档都会开一个gem server ,但多少有些不便,每次都要运行一个gem server 不说,浏览器本身也身兼数职,又要测试,又要收mail,又要停车,又要看文档,切换起来越来越不方便。索性写了一个ruby gem 文档浏览器 - Goo .

另一只龙。

主要功能就是查看gem 文档。除了查看文档,查看gem的代码也是了解gem必不可少的过程,所以也集成了在Finder和TextMate里打开gem的功能。虽然我在shell里也加了自动匹配打开gem的脚本,不过看着文档,一点就看到代码,还是比在Terminal和Safari之间切来切去要方便一些。

功能不多,源代码也非常之少,LOC只有两百多行,从决定动手到写完花了不到两天的时间。Cocao/Object-C也是开发效率相当高的组合了。源码分享在github

支持Mac OS X 10.5,或许rubygems的版本也需要>1.2.0。目前版本0.2,可以到这里下载

6 Comments :, , , , more...

iCHM - Leopard下的CHM阅读器

by Robin Lu on Aug.06, 2008, under Uncategorized

我差不多有一半的电子书是chm格式的,在mac下看chm基本上就是chmox和xchm。xchm功能比较强,但因为在mac下用X Windows做渲染,用起来非常不流畅。chmox是cocoa写的,可只有基本浏览功能,而且几年如一日的不更新。实在忍受不了,自己写了一个chm阅读器,起了一个很俗的名字叫iChm。

iCHM

(仅以此图标纪念那些消磨我无数时间的龙们)

基本功能如下:

  • Tab浏览。
  • 全文档搜索。
  • 页面内查询。
  • 重置文本编码。
  • 页面自动定位。
  • 前一页、后一页,放大、缩小。这些chmox也有。

总之,都是我自己期盼已久的功能。本来以为很麻烦,但是Object-C/Cocoa非常容易上手,解析chm有现成的chm_lib,渲染用WebKit,Tab有PSMTabBarControl,Search有spotlight,很快就完成了,真是求人不如求自己。

ichm

拿测试版出去给人用才知道有人也做了一个ArCHMock,看着很想像,比我早发布半个月,相比之下,多一个书签功能,但是没有tab,没有页面内查询,没有重置文本编码。差不多就是一个chmox+search。

昨晚在macupdate上发布了1.0,今天居然有好心的德国朋友帮着做了本地化,我自己又做了一下汉化(汗|||),本地化版直接点这里下吧

39 Comments :, , , , more...

How to make ecto work with Ultimate Tag Warrior - Part II

by Robin Lu on Mar.19, 2006, under Uncategorized

[update: I have updated downloadable xmlrpc.php example for wordpress 2.1. It also fixes the wordpress 2.1 bug when getting category via xmlrpc. Check the end of the post. 2007-02-20]

I once wrote about “How to make ecto work with Ultimate Tag Warrior”. In that article, I discussed how to make the wordpress with UTW plugin recognize tag information sent by ecto. It works well except that some friends reported after the post is published, the tag information can not be stored in ecto. It means you lose track of all the tag information in ecto. When you edit a post, you have to set the tags again, which is very inconvenient.

From a post in the ecto forum, I knew that ecto recognizes mt_keywords. After some more hacking of xmlrpc.php, I fixed the problem. Now, you can not only use ecto to publish your post with tag information but also get tag information from your post. Here’s how (UPDATE: be sure to follow the steps in Part I before applying following steps. Thank Bruce for your reminding and all the helps):

First, you need to add one function in xmlrpc.php before the class wp_xmlrpc_server is defined:

/* ROBIN LU HACK get keywords */
function ecto_get_keywords($postid) {
$utw = new UltimateTagWarriorCore();
$tags = $utw->GetTagsForPost($postid);
$postkeywords = '';
if (is_array($tags)) {
foreach($tags as $data) {
if(!empty($data) &&
!empty($postkeywords))
$postkeywords .= ", ";
$postkeywords .= $data->tag;
}
}
return ($postkeywords);
}

Then, add this line

'mt_keywords' => ecto_get_keywords($postdata['ID']),

in function mw_getPost at where $resp is set:

$resp = array(
'dateCreated' => new IXR_Date($post_date),
'userid' => $postdata['post_author'],
'postid' => $postdata['ID'],
'description' => $post['main'],
'title' => $postdata['post_title'],
'link' => $link,
'permaLink' => $link,
// commented out because no other tool seems to use this
//	      'content' => $entry['post_content'],
'categories' => $categories,
'mt_excerpt' => $postdata['post_excerpt'],
'mt_text_more' => $post['extended'],
'mt_allow_comments' => $allow_comments,
//ROBIN LU HACK
'mt_keywords' => ecto_get_keywords($postdata['ID']),
'mt_allow_pings' => $allow_pings
);

Then add this line:

'mt_keywords' => ecto_get_keywords($entry['ID']),

in function mw_getRecentPosts() at where $struct[] is assigned like this:

$struct[] = array(
'dateCreated' => new IXR_Date($post_date),
'userid' => $entry['post_author'],
'postid' => $entry['ID'],
'description' => $post['main'],
'title' => $entry['post_title'],
'link' => $link,
'permaLink' => $link,
// commented out because no other tool seems to use this
//	      'content' => $entry['post_content'],
'categories' => $categories,
'mt_excerpt' => $entry['post_excerpt'],
'mt_text_more' => $post['extended'],
'mt_allow_comments' => $allow_comments,
//ROBIN LU HACK
'mt_keywords' => ecto_get_keywords($entry['ID']),
'mt_allow_pings' => $allow_pings
);

Save your xmlrpc.php and refresh in ecto. You will get all the tag information back to you.
There are xmlrpc.php files for different wordpress version:

53 Comments :, , , , , , more...

How to make ecto work with Ultimate Tag Warrior

by Robin Lu on Dec.29, 2005, under Uncategorized

I once wrote about “How to make ecto work with Jerome’s Keywords“. Unfortunately, Jerome’s Keywords does not work well with Wordpress 2.0. With suggestion from Meng Yan, I switched to Ultimate Tag Warrior. Again, I met the problem of how to make ecto work with it. Here’s the solution.

  1. make sure Ecto is using Movable Type API to contact with your wordpress. You can check it out in the Account settings.
  2. set up the template of tags in Ecto. Set the “Tag separator” as “,” which is the default setting and “Put tags in” as “keywords” which is NOT the default setting.
  3. update the xmlrpc.php in the directory of your blog system. add the following line into the function mw_newPost and mw_editPost after where $content_struct is initialized:

$_POST['tagset'] = $content_struct['mt_keywords'];

Here’s the sample code to show where to make the modification (below the comments “ROBINLU HACK”):

/* metaweblog.newPost creates a post */
function mw_newPost($args) {
global $wpdb, $post_default_category;
... ...
$post_excerpt = $content_struct['mt_excerpt'];
$post_more = $content_struct['mt_text_more'];
// ROBIN LU HACK
$_POST['tagset'] = $content_struct['mt_keywords'];
$comment_status = (empty($content_struct['mt_allow_comments'])) ?
... ...
}
... ...
/* metaweblog.editPost ...edits a post */
function mw_editPost($args) {
global $wpdb, $post_default_category;
$this->escape($args);
$post_ID     = $args[0];
... ...
$post_title = $content_struct['title'];
$post_content = apply_filters( 'content_save_pre', $content_struct['description'] );
$catnames = $content_struct['categories'];
// ROBINLU HACK
$_POST['tagset'] = $content_struct['mt_keywords'];
$post_category = array();
... ...
}

Update: See Part II to get ecto fully functional with UTW.

42 Comments :, , , , , , more...

Madfox 0.3.2 update3发布

by Robin Lu on Oct.01, 2005, under Uncategorized

Madfox 0.3.2 update3 is based on Firefox 1.0.7 with Madpatch version 0.3.2. Firefox 1.0.7 contains important security fix. Please update to Madfox 0.3.2 update3 as soon as possible.

Madfox 0.3.2 update3 基于 Firefox 1.0.7 ,仍然使用 Madfox 0.3.2版的补丁。 Firefox 1.0.7 中有重要的安全漏洞修改,所以请 Madfox 的用户升级到 Madfox 0.3.2 update3。
下载(DOWNLOAD)

Leave a Comment :, more...

Archives

Browse by tags