不过现在已经在 http://fkpwolf.net 上面了
2011年3月2日星期三
haha
这里是上牌摇号,外地人限购,那边是将养不起的人口划拨出去。
同一个地球,同一个主义,同一个做法啊。
"这里是上牌摇号,外地人限购,那边是将养不起的人口划拨出去。 同一个地球,同一个主义,同一个做法啊。"
- 南方周末 - 金贵的平壤户口 (view on Google Sidewiki)
2009年6月16日星期二
2009年5月29日星期五
gPhone(T1)买后感受
1. 这种东西还可以移植到Netbook上面。对于上网本,肯定是个不小的冲击。相比较linux上网本,虽然内核一样,但是google做过包装,它包装的应该比一般的发行版要好,特别是UI方面。
2.Android用Freetype作的字体渲染器,效果还是很不错的,初一看比Linux上的还要好,这可能是屏幕尺寸的原因。有了字体的反锯齿,屏幕显示就会与众不同了。不知道有没有使用x-window,应该没有,否则负担太重了。
3.Android上的Market模式有点模仿Apple App Store,但是个人认为这会同个人电脑上的软件开发一样,手工作坊式的开发只是小打小闹的。但是容易安装的优点和长尾的考虑让其有一席之地。
4.手机上的开发最后势必考虑到跨平台,所以如果移动平台最后如果能同现在的桌面平台一样流行和重要的话,web模式或者RIA之类的东西势必代替各个应用厂商的SDK。
2009年5月27日星期三
View Google Reader in Android Browser through Yahoo Pipes
I am fan of Google Reader. So when I got a Android G1 device, soon I visited the site through it. Now I can view blogs when I was on the traffic to office. It is cool. But one problem I encountered is the font size is too small to read comfortably. I have tried to set the font size to "large" in browser setting and it works at some common page like www.google.com but not Reader. It looks that Google Reder did some optimize for mobile device(It designed for iPhone at first) and the browser can't adjust itself on font size.
I think I just to want to make the main content's font of blog item bigger.
Greasemonkey is power tool to customize web page. I tried OilCan - Greasymonkey on Android browser. It has an innovative idea but still at beta phase. Google chromium has supported it but at Android chrome lite should not support it at now.
Yahoo Pipes fits this case perfectly. Look below pipe flow:
It was simple: just surround the blog content with a font size modification. Then it works. You can view this pipe from here. Thanks Yahoo to create this great tool. The web UI is impressed and intuitive for building a flow. All operations can be finished by drag & drop or drop-box.
More on this, Pipes can be seen as cloud computing. It is running at Yahoo's server. Different with Google App Engine which is sophisticated and for programmer, it is for general user who does not need to have programming experience. Of course it has less function then full feature language. Its input just accepts RSS and others feeds defined in advance. The more inputs type, the more powerful Pipes becomes.
2009年4月17日星期五
Use Apache Synapse as web service proxy
This is a power configuration tool to mock and test web service.
2009年2月25日星期三
edit on android
Some site like Google Reader has cared this device. Some not, like this site.
Should we need to refactory site? Or write a new client expecially for specific application. Some like write a offline blog writter. Because here when javascript is complex, android cannot render correctly.
2008年12月26日星期五
CouchDB初次体验
我是在Ubuntu上面安装的,还算顺利,几个命令行就搞定,Windows下面可能得花些功夫。
启动Server后,它有个控制台,Web界面的,功能虽不多,但是界面做的很专业,不知道采用的那个theme,看了下web的代码,用了不少jquery的东西。
对数据库的管理方式让人很容易联想到Google App Base,可以自由的添加新的field。访问客户端的语言有很多种选择,我用java试了下,没遇到什么困难。
乍看这东西没啥神秘,不过是一个大的hashmap,每个条目是一个document。有什么用途呢?
SimpleDB也是采用类似的方式,这些大厂商这样做应该有自己的目的吧。
2008年7月29日星期二
MySpace and Portlet
MySpace looks some like Portlet. Is it just like at face?
MySpace has a MySpace Developer Platform. What is it?
标签: Web Development
2008年7月8日星期二
different framework, different web page
the Struts treats a page as a Command;
the Portlet treats a page as a Window;
the JSF treats a page as a lot of Components;
the Spring Web Flow treats a lot of pages as a Flow;
the Tapestry treats a page as a Java class
标签: Web Development
2008年7月3日星期四
JSF Custom Compoment development tips
1. JSP taglib
In JSF, the scriplet like "#{RequestBean1.name}" is treated as a ValueExpression field in tab class. The corresponding tab lib definition file should nests the attribute type with deferred-value.
And also in tld file, jsp-version 2.1 element should be included. If this scriplet is missed, some container like Tomcat 6.0.16 will take this tag as generial tag and if we invoke isLiteralText() on the ValueExpression object, true will return. It was not excepted. But the GlassFish V2 ignored this and took 2.1 as default.
2. Why setProperties() in tag handler java is not invoked?
You should define all property of jsf component java in faces-config.xml. Sometimes it looks like that a attribute is defined twice: one in tld, one in faces-config.xml. JSF Template can make these things easy by generating all configuration file. In order to archive this, it introduces some anonations.
3. Why did some data shown on page disappear after re-loading the page?
implement the saveState/restoreState method.
2008年5月12日星期一
Ubuntu 8.04 使用感受
前些天试了下Ubuntu 8.04,有些感触。
首先,安装。我用的是硬盘安装的方式,可以参考这里。主要是在ubuntu.com找到对应的内核文件。最后MBR要装在linux的主分区上。由于vista sp1采用了新的启动方式,没有了boot.ini文件,要多重启动,需要额外的程序:EasyBCD,这个小工具可以重写MBR来引导多个OS,使用起来还是很方便的。
启动后,主题上,ubuntu变化不大,还是老样子。接上我的ipod,系统可以自动认出,可以关联到相应的程序,运行,提示缺少mp3 plug,然后自动安装,这样就可以播放MP3了,而且mp3 tag中的中文可以正常的显示,这在我的系统的语言是en的前提下,较之以前,是一个很大的进步了。
对于字体,现在相对于以前,有所改进。但是跟vista下的cleartype相比,差距还是蛮明显的。
系统自带Firefox 3.0 beta,所有功能跟vista下的一致。我常用的插件也是可以无碍的使用,可以看出firefox大大的提高了linux的接受程度。和java一样,一个容器就是一个平台,催生了一系列的相关软件。
2008年4月12日星期六
2008年3月15日星期六
从JSP到Velocity
1.JSP有优点。
Rails页面脚本的做法跟JSP其实差不多,也是在HTML中通过<%...%>将Server端语言嵌入其中,这应该是最容易实现的方法。如果说比JSP有强出的地方,那就是Ruby的语法比Java简洁很多。
Grails:
Struts:
对于这种用XML格式来表达逻辑,同JSTL大同小异,个人感觉总是别扭。一则不如Server端语言灵活,二则要掌握另外一种语法。
相比velocity就做的很直观了:
#foreach ( $item in [1..5] )
On this iteration, refers to the value $item.
#end
其做法更多是贴近一般语言的习惯,仿佛只不过是在语句前加上#(velocity里面称为Directives),变量前加上$。
Grails里面变量的表示为"${}"。一些流行的Javascript框架如prototype、JQuery也采用这种写法。不过这种变量的表示在JSP 2.0里面也被引入,我们就再也不必看到难看如<%=name%>的写法了。
对于XML格式的标签写法,可能对于机器来说容易处理,其实在这里没有一般的语法的校验,有的只是XML的scheme的校验,当然这也是一种语法,不过就容易处理多了。
对于Velocity,其采用了Antlr来产生语法分析器,在其源代码包org\apache\velocity\runtime\parser 下可以看到详细的代码。
还有另外一种模板框架freemarker,跟velocity很类似。
如果我们采用更为简洁的做法:将逻辑和页面彻底的分离,如JSF或者Tapestry的做法,让页面更为单一和纯净。这可能是最理想的做法,也有更好的对页面组件的重用性。但是当前台页面异常复杂,需要浏览器端较多javascript操作,特别是AJAX的引入,势必有越来越多的页面逻辑转移到客户端,从而破坏了整个架构的一致性,让扩展更难处理。
这说明B/S架构中的逻辑存在于浏览器端和server段是导致系统复杂的根本原因。
C/S就没有这样的烦恼。
为什么呢?
对旧技术的补丁,最好的技术是GWT,其将逻辑集中于java代码中(虽然客户端的代码和server端的代码还是分开的)。
而新的技术,则是RIA。
标签: Web Development
2008年3月9日星期日
jQuery的做法
最近学习jQuery.
jQuery正如其名字一样,是一个用来方便的查找到HTML文档中的元素的javascript框架,其查找条件的语法借鉴了CSS和XPath中对DOM元素定位的方式,由于CSS的广泛流行,jQuery可以很快的上手。
jQuery对查询的结果统一返回为集合,而且可以对该集合再次查询,如:
$('div.disText').attr('title','点击来编辑数据').mousemove(handleMouseMove).mouseout(handleMouseOut).click(handleClick);
这是很直观的方式,让人奇怪:为什么很少在其他地方见到这样的简洁的模式呢?
(其实在JAVA中也有,比如:
StringBuffer buff = new StringBuffer(128);
buff.append(getModuleName("dojo"))
.append(".require('")
.append(getModuleName(name))
.append("');");
)
jQuery这种视一切为“集合”的方式对“批量”的处理DOM可谓得心应手,而在Web应用中,页面可以显示大量的信息,这些信息可以以常以相同的样式表现,比如“超链接”,在这里用jQuery就可以统一的这些元素处理。和传统的Fat Client不一样,这些页面以XML的格式来定义,还有比如XUL,也以XML来定义界面。XML是一种结构化的数据格式,所以就需要jQuery这样的框架。
后记:LINQ,.net下的一个框架,也有跟上面类似的语法:
var myList = [
{FirstName:"Chris",LastName:"Pearson"},
{FirstName:"Kate",LastName:"Johnson"},
{FirstName:"Josh",LastName:"Sutherland"},
{FirstName:"John",LastName:"Ronald"},
{FirstName:"Steve",LastName:"Pinkerton"}
];
var exampleArray = From(myList).
Where("item.FirstName == 'Chris'").
OrderBy("item.FirstName").
Select("item.FirstName");
标签: Web Development
2007年12月25日星期二
异步I/O实践:Linux & Java
Linux上面的称为AIO,可以参考这篇文章:
编译时使用“gcc a.c -lrt"。这表示链接时包含库/usr/lib/librt.XX,这个库里面可能包含了aio的库,否则会出现"Undefined reference to aio_read"的错误。2007年12月13日星期四
2007年11月27日星期二
Rethink the big element in web page: Data Table
Data Table is heavily used in information system. In most case, these tables just display a query result set. They are read only. The operations on them are: paging, sorting, single selection and multi-selection. The all elements of a table include: field, field title, sort and page number state, and value format(or convert). In some extend, a data table is not too much associated with other page elements. So it will be a better way to define a table in one place other than several places in application.
标签: Web Development
Commet, Grizzly and Tomcat 6
一个比较早的对这方面讨论的帖子在这里: Comet,下一代Ajax? DW上面好几篇文章做了介绍:Comet:基于 HTTP 长连接的“服务器推”技术,面向 Java 开发人员的 Ajax: 使用 Jetty 和 Direct Web Remoting 编写可扩展的 Comet 应用程序。在《Ajax Design Patterns》这本书上也有介绍,不过称为HTTP Streaming。Java EE 迎合 Web 2.0 采用事件驱动的异步架构应对现代 Web 应用程序带来的挑战这篇文章从理论的高度说明了异步模式对提高系统吞吐量的作用。
如果要实现Comet,Server端就需要NIO来解决HTTP长连接的问题,否则Server端支持的并发数就会大大减少。
Servlet和NIO的使用可以参考Servlet API 和 NIO: 最终组合在一起 使用非阻塞 I/O 构建基于 Servlet 的 Web 服务器。虽然是一篇较早的文章,仍然提供了很多关于NIO的有用信息。
Tomcat 6里面相关NIO的配置可以参考其文档,只用修改Connector的protocol即可。接下来可以写一个简单的Servlet A,其implements CometProcessor接口。为测试方便,将Sender存放在Application变量中,在另外一个Servlet B中就可以调用Sender的send(...)方法,当浏览器访问A时,可以动态看到Server端push过来的信息(这时浏览器会一直处于页面正在装载的状态,实际应用中可以用AJAX来接受信息)。
由于是长连接,数据在传送过程中就存在缓冲的问题。一般的一个Server端的发送到客户端的消息(注意这里不是一个响应)不会很大,而默认的Tomcat缓冲配置偏大,导致客户端响应滞后,出现这种奇怪的现象:1)当send(...)方法触发多次后,server才会一次把消息全部push到客户端(即是每次使用了flush方法);2)1 发生后,每次的send(...)的调用会导致server段立即把这条消息发送到客户端(这是buffer又好像不存在一样)。
对于Tomcat 6自带例子里面的bug,也有位哥们在他的blog中提到:Asynchronous IO is hard!。
标签: Web Development
2007年11月25日星期日
Use JPA with Hibernate in Netbeans(Tomcat)
0. prerequisite
Tomcat 6.0.14
Netbeans 6 rc1
Hibernate core 3.2.5GA
Hibernate EntityManager 3.3.1GA
1. Add a new JPA library implement
The default used TopLink. Change to Hibernate.
2. Adjust in JSF design
The default data provider ObjectArrayDataProvider works not well with JSF design UI.
My target is when let a jsf table "Bind to Data", the all fields of a Hibernate JOPO can be chosen as the above dialog. These displayed fields come from provider's getFieldKeys method which is part of interface DataProvider signature. So the simplest way is to extends ObjectArrayDataProvider and overide that method. Or just use setObjectType(Student.class). Be sure to compile that class manually so the JSF Design can take this change into account.
Why not use :
private ObjectArrayDataProvider objectArrayDataProvider1 = new ObjectArrayDataProvider(someType);
It does not work. Even I put them in _init() method of backend bean, as the CachedRowSet provider does.
3. Done.