Tao obeys its own inherent Nature


搬到了: http://theantway.com
posted @ 2011-11-08 13:43 wade 阅读(148) | 评论 (0)编辑 收藏
Ubuntu 11.04

网上找了一些办法都不能用,最后直接打开configure 文件,找到$RM "$cfgfile", 替换为 $RM -f "$cfgfile", 说白了就是出错了也不要停,继续执行。再运行configure, 成功
posted @ 2011-06-02 10:15 wade 阅读(1239) | 评论 (0)编辑 收藏

When I try to use URLConnection to check if a url is accessible using the following code:

try {
    URL url = new URL("");

    URLConnection connection = url.openConnection();
    System.out.println("Connected successfully using url");
} catch (IOException e) {

I expected the behavior is: connect should be success if the host is reachable, else throw exception. It works fine without the anti-virus application, but always print “connected successfully” even the host is not reachable.

Then I tried to use Socket to connect:

Socket socket = new Socket();
socket.connect(new InetSocketAddress("", 80));
if (socket.isConnected()) {
    System.out.println("Connected successfully using socket");
} else {
    System.out.println("Connected failed using socket");

But Still got the same problem.

The solution for it:

Disable http check in anti-virus, for example, in ESET NOD32, the settings is Web access protection -> Http, Https -> Http scanner


posted @ 2009-07-15 13:30 wade 阅读(380) | 评论 (0)编辑 收藏

Preview support edit images, but the menu item is disabled by default when I open an image file. I thought it was because the Preview does not support this kind of file type. Recently, when I try to find a simple image editor only for add some text, oval or rectangle, I found that the Preview support it perfectly.

After customized the toolbar, the buttons enabled, and it’s very easy to add comments, but the menu item still disabled.

The following is what I found about how to customize the toolbar from the Preview Help.


Adding text to an image

You can add text to an image to describe what’s in it or when the image was created.

After you save the image, you can’t edit, move, or delete any text you added to it. If you think you’ll need to edit the text, convert the image to a PDF document, and then add notes to the PDF document. Notes added to a PDF document can be edited after they’re saved.

To add text to an image:

  1. If the Annotate pop-up menu isn’t in the toolbar, choose View > Customize Toolbar and drag the Annotate pop-up menu to the toolbar.
  2. Choose Note from the Annotate pop-up menu in the toolbar.
  3. Drag over the area where you want the text to appear.
  4. Enter your text.

Before you save the image, you can move, resize, edit, or delete the text. First choose Text Annotation from the Annotation pop-up menu in the toolbar. Then to edit the text, double-click it. To delete the text, click it so resize handles appear, and then press Delete.

posted @ 2009-07-14 10:49 wade 阅读(481) | 评论 (0)编辑 收藏
     摘要: 快速生成程序代码, 比如Struts, Spring, Jdbc/Hibernate所有前后台的代码.
支持Mysql, 以及支持Ado连接的数据库.
支持批量生成部分/全部模板, 保存选中的模板到Working Set
使用Javascript作为模板脚本语言  阅读全文
posted @ 2008-03-05 13:28 wade 阅读(4247) | 评论 (18)编辑 收藏
     摘要: Generate code, e.g. all files for Struts, Spring, Jdbc/Hibernate.
Support Mysql, and database which support Ado connection
Support generate file/project files and batch generate, and you can save you selection to a named working set in batch generate mode.
Using Javascript as the template engine  阅读全文
posted @ 2008-03-04 22:48 wade 阅读(812) | 评论 (0)编辑 收藏
diff -r -q -X exclude.list . testing
posted @ 2008-02-29 16:52 wade 阅读(793) | 评论 (0)编辑 收藏
     摘要: 集成Acegi到自己的项目中, 并且将用户信息和权限放到数据库, 提供方法允许权限动态变化,变化后自动加载最新的权限
增加Junit 测试, 这样可以在改变权限后, 方便地检查是否设置正确.
Acegi 提供的Tag不能判断当前用户对某一个URL有没有权限, 由于很多时候需要根据当前用户的权限来控制某些功能是否显示, 所以增加相应的Tag

posted @ 2008-01-30 17:28 wade 阅读(4076) | 评论 (7)编辑 收藏

1. simple join two tables

generate sql like:   

select * from photo p
    left join artist a on p.artist_id = a.artist_id
      where a.genre = 'something' and p.genre = 'something'


if(!CriteriaUtil::hasJoin($criteria, ArtistPeer::TABLE_NAME)){
    $criteria->addJoin(PhotoPeer::ARTIST_ID, ArtistPeer::ARTIST_ID, Criteria::LEFT_JOIN);
$criteria->add(ArtistPeer::GENRE, $genre);    
$criteria->add(PhotoPeer::GENRE, $genre);

2. join two tables, add AND OR between conditions
generate sql like:    

select * from photo p
    left join artist a on p.artist_id = a.artist_id
      where (a.genre = 'some' or p.genre='something')
        and a.name = 'something'


if(!CriteriaUtil::hasJoin($criteria, ArtistPeer::TABLE_NAME)){
   $criteria->addJoin(PhotoPeer::ARTIST_ID, ArtistPeer::ARTIST_ID, Criteria::LEFT_JOIN);
$criteria->add(ArtistPeer::GENRE, $genre);
$c = $criteria->getCriterion(ArtistPeer::GENRE);
if($c != null){
   $c->addOr($criteria->getNewCriterion(PhotoPeer::GENRE, $genre));
$criteria->add(ArtistPeer::NAME, $name);


It's a good habit to check if we have joined the table already. to check this, you can use the following util class, it get all the joined tables, and check if the table exists in them.

class CriteriaUtil{
    public static function hasJoin($c, $table_name){
        $joins = $c->getJoins();
        if($joins != null){
            foreach($joins as $join){
                if($join->getRightTableName() == $table_name){
                    return true;
                if($join->getLeftTableName() == $table_name){
                    return true;
        return false;
posted @ 2007-12-05 17:26 wade 阅读(469) | 评论 (0)编辑 收藏

It maybe popup an error message to say that "QI for IEnumVARIANT failed on the unmanaged server" when open the Windows Live Writer.

After search on google, I found the resolution is import some settings into registry.

Windows Registry Editor Version 5.00






You can also download the file here, unzip and import it to your registry.

posted @ 2007-12-05 17:08 wade 阅读(782) | 评论 (0)编辑 收藏