分类
English 技术

Call for vote on turning off Voice Dialer on Android

用Milestone上的更新程序升级到了Android 2.1。系统里自带的语音拨号Voice Dialer是个好玩的东西,相信对于驾驶员也是很有用的工具。但我认为它对我而言没有太大用途,反而是个累赘。原因有三:
I’ve got my Milestone updated to Android 2.1 via its update function. The Voice Dialer bound with this version is certainly an interesting tool which could be very useful tool for drivers. However, I think it’s none of use but a burden to me. Reasons as follows:

  • 我不开车,所以用手操作还是很方便的;
    I’m not a driver so that it’s convenient of me to use my finger;
  • 通讯录上以中文名字为主,可惜Voice Dialer不支持中文;
    Most of contacts in my list are Chinese, pity that Voice Dialer don’t support Chinese language yet;
  • 最重要的问题是这个程序会占掉4~5MB甚至更多珍贵的内存,同时也很耗电。
    I found the Voice Dialer process is always consuming at least 5MB of the RAM and up to 30% of the battery.

用Advanced Task Killer之类的工具尝试关闭Voice Dialer进程未果,看来这属于特殊的系统服务。Google一下得知,可以通过root的方式去重命名或删除Voice Dialer。不过这貌似太折腾了,毕竟手机玩家不一定都要当黑客。所以,希望Android开发小组能考虑给这个程序做个开关,方便我们这些不需要Voice Dialer的用户。
I failed to shut down the Voice Dialer process using tools like Advanced Task Killer, seems this is a special system service. According to a quick googling, I found it possible to rename or delete the Voice Dialer application after rooted. I don’t feel this way to be suitable for the mobile funs who have no interest to be hackers. So maybe it’s a good idea to suggest Android developers to add a turn on/off switch to the Voice Dialer application, for the convenience of us users that do not need Voice Dialer.

在这里,我倡议大家去顶这个申请条目,加星标或者跟帖均可:
Here, I call for your help to vote on the Enhancement ticket by either starring or replying.

http://code.google.com/p/android/issues/detail?id=7669

要点是关注度越高的条目,越能引起Android开发人员的注意。
The point is that, only hot tickets may draw developers’ attention.

分类
English 技术

Some comments on my first GAE (Java) trial

Java版Google App Engine试用感想
Some comments on my first GAE (Java) trial

上一篇,发表一些自己的试用感想。

例子应用的架构及实现
Architecture & Implementation of the Previous Example

先看一下自己开发了一个什么样的例子。用图说明。

me.evis.gae.guestbook_architecture

看源代码,me.evis.gae.guestbook、me.evis.gae.guestbook.client和me.evis.gae.guestbook.sever三个包就是为了形成GWT的表现层和逻辑层。而me.evis.gae.guestbook.bo及其子包是为了包装GAE的数据存储服务形成数据层。

就开发过程而言,在装有Google插件的Eclipse上添加新GAE项目时,插件会代为准备好GAE相关的配置和jar包,同时也有GWT的。而创建新模块时,就纯粹是与GWT有关的事情了。在我看来Google为GWT提供的最佳实践是:

  • 在前端弱化HTML的作用,而由后端位于client包里的入口类(Entry Point Class)编写用户界面及相关交互,在运行时Java的入口类会生成Javascript返回给客户端浏览器;
  • 由入口类来调用同一包内的各种服务接口,并处理返回值;
  • 对于client包中服务接口的实现,都放在server包中。

我之所以加入了bo包及其子包,主要还是是为了能更清楚地了解GWT与GAE之间的关系。由Comment DTO/DAO去以JDO方式去调用GAE的数据存储服务,然后再让上边的Comment服务的实现去调用Comment DTO/DAO而不是直接去调GAE的东西。

同时,这样的分离也给了我做单元测试的机会。我为bo包加入了test的子包。JUnit 3的测试用例直接写会出App ID之类的错误,原因是GAE的服务都是云计算,本地调用需要构建一个相应的测试环境,详见Google的官方文档或者是例子应用的源代码。

关于GWT
Comments about GWT

用Java来代替Javascript,有点像写CS的感觉,不过调用服务器端的方法或者使用服务器端的变量都很方便。这种做法确实掩盖了BS和Javascript的复杂性,也有效利用了Java编译所需的严谨性。但是我认为其缺点也是显而易见的:

  • 开发调试用户界面及交互要改Java类,就意味着重新编译,一般也会要求重启服务器,相对来说调试成本较高;
  • 用户界面开发变得不太直观,难以分工。如果所有界面都是Java写出来的,那页面设计师和交互工程师只能轮流给Java程序员端咖啡了。个人觉得如果用GWT,各种页面元素应该还是在HTML上布局好,然后用Java去捕捉那些元素,比如按钮或者区域之类的。

GAE最核心的东西肯定还是数据存储、邮件等这些云计算服务,我想如果有更适合的选择的话,还是没有必要在GWT上投入太多的关注。

关于GAE
Comments about GAE

截止到发文时也只有尝试过数据存储服务而已。关于数据存储服务,Google公布了JDO和JPA两种基于标准的接口。这些现代的数据操作方式大大简化了数据相关的开发,至少不用去数据库里建表了。但GAE是按API调用次数、数据容量、传输大小等因素综合计费的,所以开发时也必须要注意多方面的调优,个人预测Appspot上也许会有不少程序会因为API调用次数和CPU占用时间两项而额外付费。

关于Google的Eclipse插件
Comments about Google Plug-in for Eclipse

  • 装完插件就不要挪动Eclipse了,不然要改好几个配置文件;
  • GWT的Java Editor有时会有些bug导致无法进行语法加亮;
  • GAE的插件方面有些薄弱。除了新工程和调试用的Jetty服务器外好像没看到针对Google各种云计算服务的更细节的功能。

结语
Conclusion

很兴奋,很有用。有机会也要试试其他的服务,有时间可以给自己写个实用些的程序。

缩写
Abbreviations

  • GAE: Google App Engine
  • GWT: Google Web Toolkit
  • JDO: Java Data Objects
  • DTO: Data Transfer Object
  • DAO: Data Access Object
  • CS: Client-server
  • BS: Browser-server
分类
English 技术

A simple guest book on Google App Engine (Java)

终于算是有些时间,可以试试Google新推出的App Engine的Java语言支持。
Finally got some time to have a trial on Google App Engine – the Java Language.

我下载了Eclipse 3.4.1企业开发版并从更新站点安装了Google插件。在Google插件的帮助下,我在新工程里创建了一个简单的留言簿(GuestBook)模块,并根据文档和范例,写了一个留言(Comment)服务,下面跟用JDO(Java Data Objects)实现的DTO/DAO(Data Transfer/Access Objects)接起来。为了单元测试DAO,还依照GAE官方提供的方法写了JUnit test用的基类来创建App Engine的本地环境。
I’ve downloaded an Eclipse 3.4.1 EE and installed Google Plug-in for Eclipse via the update site. Using the Google Plug-in, I’ve created a GuestBook module, then a Comment service, and a JDO based DTO/DAO for Comment. In addition, I’ve tried out the unit test of a GAE project in local environment.

实际上做完这个例子兴奋劲就过去了,多少有些想法值得提一下,会放在下一篇博文里。
I’ve got some comments on this first trial, will update in another blog post later.

总之,以下是已经部署运行在Google云计算环境里边的例子应用:
Anyway, here is the running application hosted on Google’s cloud environment:

http://evis-lab.appspot.com/

源码也在Google Code上边,欢迎朋友们指正:
And the source code is always available here:

https://evis-lab.googlecode.com/svn/appengine/GuestBook/trunk

打算在GAE上尝试各种Java技术或框架的朋友们,不妨经常关注以下这个帖子:
For those are trying various Java techniques on GAE, a thread is strongly recommended:

Will It Play in App Engine (or this wiki page)