Archive by Author

iPhone OS 3.0 beta初体验

iPhone OS 3.0 beta发布后马上下载过来体验了一把,把自己的iPod Touch刷了3.0版firmware,也升级了XCode 3.1.3。这次大版本更新带来了非常多的新特性,iPhone离一台完美的手持设备已经非常非常近了。初步体验下来,3.0版OS的潜力还是要靠app来挖掘,系统的本来面目还没有特别大的区别,众多新特性需要有软件的支持才能用得到。普通用户一上手就能看到的改进主要是spotlight搜索,拷贝粘贴,还有开放的蓝牙(但是默认状态是什么蓝牙服务都没有的)。后台Push,in-app支付,turn-by-turn GPS等等重要特性都要等到众多新版应用出现以后才能体现出强大来。先上几张touch上的截图吧。

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.

twtplus - The missing Twitter command for Ubiquity and Firefox

Earlier this year I spent some time to write the “twtplus” command for Ubiquity, the intriguing Quicksilver-like plugin for Firefox. I’ve been tweaking it intermittently and now I’m gonna put together a little handy reference for it. Twtplus has the following features:

  • Post message to your twitter account (of course)
  • Preview your friends timeline. Click avatar to reply.
  • @ and d message to friends with friends username autocompletion. Notice that “@” is a modifier keyword so you need to leave a space after it to get the friend name autocompletion working.
  • Use “#url” tag to substitute the URL of the currently viewing page
  • Automatically shorten all URLs found in a message using http://is.gd
  • “as” modifier for posting as multiple twitter accounts.

Most of the features are pretty straightforward. Take a look at the following screenshot. Notice the grey hints after the “twtplus” command when you type and you’ll be fine.

twtplus

twtplus

In order to get multi-account posting working, there are a couple things I’d like to mention. First, due to the way the browser works, if you have a logged in session for Twitter, the browser will ALWAYS post your tweet as the currently logged in user, regardless of the one you specifies with the “as” modifier keyword. Thus the solution is to avoid being logged in via the Twitter web interface, or when the stock “twitter” command prompts you a login dailog. If you visit twitter.com and find that you’ve already logged in, log out explicitly.

Secondly, twtplus looks for your stored usernames and passwords for Twitter in your Firefox password manager, for the login authentication to Twitter and provide multiple account autocompletion suggestions. So you need to store your Twitter accounts with Firefox if you haven’t already. This is also a more secure and convenient way than the stock “twitter” command since you don’t need to input your twitter login from time to time.

Now get twtplus from here.

Update: Here’s an awesome screencast from @neo4zion

App Engine正式推出计费功能,好消息和坏消息

大家翘首以盼快1年的App Engine计费quota功能今天终于正式推出了!这就意味着App Engine不再是个免费玩具,正式和其他云计算服务开始竞争了。

好消息

没有计费功能的时候,一旦超过免费quota就要给google写信申请,现在只需要让google自动发给你帐单就行了。这样一来对众多商业项目来说App Engine就成为了一个合理的选择。再来仔细看看去年宣布的计费计划和这次正式公布的计费标准是不是一致:

  • $0.10 - $0.12 per CPU core-hour -> $0.10 per CPU core hour
  • $0.15 - $0.18 per GB-month of storage -> $0.15 per GB of data stored by the application per month
  • $0.11 - $0.13 per GB outgoing bandwidth -> $0.12 per GB bandwidth outgoing
  • $0.09 - $0.11 per GB incoming bandwidth -> $0.10 per GB bandwidth incoming

看来正式标准和也原先宣布的确实一致。这是最大的好消息。那么,坏消息是什么呢?

坏消息

首先,免费quota(大幅)缩水了。具体来说

  • CPU quota: 46.30 CPU hours -> 6.5 CPU hours
  • 流量: in/out 10G/day -> 流入0.10G/day,流出0.12G/day

虽然免费的存储quota增加到了1G,但是这两个缩水的影响还是不可忽视的。

然后,付费使用的是Google Checkout,虽然在Dashboard的Billing Settings页面上,Set Country选项中没有China,但是试用后发现把Country设为United States,然后点Google Checkout按钮,在付费页面上就会有China国家选项。付费问题看来不用担心了。于是担心的事情还是发生了:国家里没有China这个选项。那么中国开发者怎么付费呢?看来至少要过一段时间才能知道了。

我的Mac OS X开发环境设置

我是一个Mac新手,算到现在只用了大概4个月的OS X。但是作为长期Linux用户,Mac的上手还是非常顺利的。作为一个开发者,我拿到心爱的Macbook Pro第一件事当然就是开始摸索让自己coding更舒服的环境了。折腾到现在算是小有成就,于是总结分享一下我在OS X下的开发环境设置。(商业软件用*标明)

1. QuickSilver

Linux下我用Gnome Do或者Launchy for Linux,Windows下我用Launchy,而QuickSilver才是大名鼎鼎的鼻祖。必备!

2. Terminal.app

Terminal是开发者最好的朋友。OS X的初始配置是非常弱化命令行功能的,所以需要根据自己的需要好好折腾一下。
首先,默认settings我用的是pro,半透明黑色背景到哪里都是我的最爱。
bash设置也需要按照我在Linux下的习惯调整一下。但是OS X和Linux不一样,默认不读取home下的.bashrc而是.profile。不想把.bashrc内容写到.profile里的话,就在.profile开头加上下面的脚本。

if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

然后把我Linux下的bash配置里适用的部分搬过来,保存为~/.bashrc。

export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
alias ll='ls -l'
alias la='ls -a'

3. Visor

Terminal的配置还没完,Visor是个必备物品。同为QuickSilver的制作公司出品,Visor是一个实现类似fps游戏屏幕顶部下拉命令行的Terminal插件。玩过Quake3的同学都明白这样的下拉式terminal有多爽多酷吧!我的Visor快捷键设成^F12,按下快捷键屏幕顶部的terminal呼之即来招之即去,非常过瘾。Linux下虽然也有Guake和Tilda,但是都比较buggy,还是Visor用得最爽。

4. *TextMate

TextMate是Mac下必备级别的开发利器。轻便的尺寸强大的功能,还有大量的Bundle资源,做绝大多数种类的开发都有很好的支持。我目前的TextMate配置是这样的。

ProjectPlus插件

TM必备,把一些经典IDE的功能带到了TM:用sidebar替换了TM的drawer,支持包括SVN和GIT的多种SCM集成,能直接把项目文件的SCM状态图标显示在文件图标上,支持color labels等等。装了ProjectPlus的TM在project中工作感觉会大不一样。

GetBundles

GetBundles和古老的GetBundle是两回事。GetBundles不光能从官方repository获取bundle,还能从github上拿到最新的bundle。用GetBundles安装bundle也异常方便,只需要指指点点就行了。真希望GetBundles能直接集成到TM2.0里。
安装GetBundles需要用一下SVN,以后就一劳永逸了!

cd ~/Library/Application\ Support/TextMate/Bundles
svn co http://svn.textmate.org/trunk/Review/Bundles/GetBundles.tmbundle/

然后到TM中Bundles>Bundle Editor>Reload Bundles,GetBundles Bundle就装好了。接下来就可以从菜单中选择Bundles>GetBundles>Get Bundles来查看所有可以安装的bundle了。
另外,TM对中文和其他双字节字符显示支持有问题,可以用这款TM专用字体来解决。

附加一个问题的解决方案。如果用了被黑名单了的d版序列号,TM打开了就会强制退出而没法重新输入序列号。这时候可以找到并打开 ~/Library/Preferences/com.macromates.textmate.plist文件,找到“OakSoftwareRegistrationOwner”和“OakSoftwareRegistrationSerialNumber”两项并把值清空就能清除序列号重新进入TM了。

5. *Path Finder

Path Finder是款强大的用来替换Finder的文件管理器。可以新建文件(这个很重要,不是吗?),分tab浏览,更好的路径导航,并排窗口浏览,自定义功能的抽屉等等,强大的不得了。必备级别,用了才知道原来用Finder是多么痛苦!

6. Fink

装了Fink,就能用熟悉的sudo apt-get了。

7. 其他

系统状态监控:iStat Menus和iStat Pro
风扇调速:smcFanControl
还有MacVim
另外,用惯了Ubuntu下的Compiz Fusion,感觉OS X的Spaces还是弱了点,不过总比没有好。窗口太多的时候分门别类到不同的space下去就清爽多了。

基本上必须的部分就是这么多了。欢迎补充!

Grails框架优劣势分析及同类比较

Grails系列的第二篇文章也以在InfoQ中文站发表,可以从这里阅读

在这篇文章里,我试图从客观的角度把Grails和其他两个快速开发框架RoR和Django做一些比较。总的来讲Grails和Rails在各方面都很接近,Grails和Rails各自的开发者如果接触另一个框架都一定容易上手。目前来看,Grails在技术上可圈可点,但是作为开源项目,其最大的软肋来自于社区。没有像RoR和Django这样强大的社区,Grails的发展相比起来缺少活力。而在语言层面上,Groovy也仍旧相当非主流。RoR的成功可以说很大程度上要靠DHH强大的影响力,而Django也许更多是靠着Python社区的影响力,包括Google App Engine对Django的间接推动。Grails在不久之前还是一穷二白:没有强大的社区也没有强大的商业支持。最近SpringSource出手可以说是一大新闻,让我们拭目以待09年Spring会把Grails带到什么样的程度吧。

案例研究:利用Grails搭建Feedlr.com网站

最近为InfoQ中文版供稿了2篇文章,今天第一篇发布了,可以从这里阅读。第一篇文章主要从技术角度介绍使用Grails实现Feedlr的大致过程,以及实现过程中的一些总结。接下来的第二篇将通过Feedlr的经验来引出对当前Grails发展状态的总结和思考,敬请关注。
文章版权属于InfoQ,此处不做转载,请移步InfoQ阅读全文

Google App Engine路线图更新,惊喜多多

今天在地铁上用手机看新闻,惊喜的发现Google App Engine在官方Blog上发布了新的6个月路线图计划,包括了4大重量级新特性:

Click to continue reading “Google App Engine路线图更新,惊喜多多”

Ubiquity叽歪命令火力加强版

Ubiquity jiwai命令现在变得更强了。首先,现在提供了强大的电影,音乐,书籍标签功能,可以通过指定名称关键字来自动在消息里扩展出媒体信息,通过和叽歪富媒体功能的结合,可以非常方便的在叽歪个人主页上显示丰富的媒体信息。另外,经过调试多帐号发消息功能基本可以正常使用了。

Click to continue reading “Ubiquity叽歪命令火力加强版”

Ubiquity叽歪命令加强版

Ubiquity刚出来时候写过个最简单的叽歪命令玩,现在写了个加强版的放出,比以前的好用多了,可以从这里安装。
加强版叽歪命令fork自2ii,做了大量修改重构,并且增加了一些有用的功能,除了预览好友时间线外,还能自动用is.gd服务缩短消息里的所有URL,用#url标签替换当前页面地址,支持@回复好友和d私信好友的名字自动完成。

Click to continue reading “Ubiquity叽歪命令加强版”