sam 的个人资料>>> 這也將會過去 <<<照片日志列表 工具 帮助
12月31日

Groovy MOP DSL AOP

 
隱約記得在google上搜尋 [Groovy AOP]
結果就多看了幾個概念名詞和實做,
可能是我才剛進入Java的世界,
所以對很多名詞和概念還存著好奇的心態吧 :p
有興趣的人可以研究
 
Groovy MOP实现mini-language 如传说中Java7.0的XML嵌入式语法
http://www.blogjava.net/calvin/archive/2005/08/17/10333.html
http://www.javaeye.com/topic/15358
 
 
 

CK's Blog -- Showing posts with label AOP
http://chanwit.blogspot.com/search/label/AOP
 
會去Google搜尋[Groovy AOP]最大的起因之一應該是這篇文章 ,  :p
Spring Gossip / AOP 入門 / 從代理機制初探 AOP
http://caterpillar.onlyfun.net/Gossip/SpringGossip/FromProxyToAOP.html
Spring Gossip
http://caterpillar.onlyfun.net/Gossip/SpringGossip/SpringGossip.html
 
12月29日

GTD (Getting Things Done) Resoruce

GTD (Getting Things Done) Resoruce


[Book]
http://www.books.com.tw/exep/prod/booksfile.php?item=0010205787&


[Tools - Software List]
http://www.priacta.com/Articles/Comparison_of_GTD_Software.php
http://www.lifebang.com/archives/145


[Tool]
lis.to [opensource; java; linux, win, mac]
http://lis.to/
Chandler [opensource; python, wxWidget; linux, win, mac]
http://chandlerproject.org/
ACHIEVER
http://www.rightzing.com/

 

[Wiki]
http://zh.wikipedia.org/wiki/GTD
http://en.wikipedia.org/wiki/Getting_Things_Done


[User Blog]


開始你的GTD
http://blog.roodo.com/appleseed/archives/3909749.html
你怎麼設定與組織管理你的系統?
http://blog.roodo.com/appleseed/archives/2016469.html
WorkFlow Diagram From "Getting Things Done"
http://www.wretch.cc/blog/phielk/2068739


twhsi時間管理線上課程
http://lomobangdoll.blogspot.com/2007/11/gtdtwhsi.html


twhsi時間管理 線上課程 (5) 收集雜事 時間管理健身房 77/100
http://blog.xuite.net/twhsi/Blog/14111267
twhsi時間管理 線上課程 (6) 加工處理雜事 時間管理健身房 78/100
http://blog.xuite.net/twhsi/Blog/14131878
iGTD時間管理軟體介紹 59/100時間管理健身房
http://blog.xuite.net/twhsi/Blog/12624685
iGTD的介紹(2) 介面的介紹--六個功能鍵 時間管理健身房 61/100
http://blog.xuite.net/twhsi/Blog/12756458
iGTD的介紹(3)不同圖標的意義 時間管理健身房 63/100
http://blog.xuite.net/twhsi/Blog/12942872
iGTD的介紹(4)我的任務及場合規劃 時間管理健身房 68/100
http://blog.xuite.net/twhsi/Blog/13946956
......


使用GTD軟體對個人時間管理上有怎樣的改變呢?效益又是如何呢?
http://blog.xuite.net/nx7000/blog/3493495?ref=rel


GTD ... 時間管理
http://blog.xuite.net/eliza129/blog/17872025?ref=rel
終極邊疆BLOG   » GTD
http://blog.serv.idv.tw/category/gtd/


Getting Things Done 把事情搞定
http://hohohou.blogspot.com/2007/07/getting-things-done.html
搞定! GTD
http://ihower.idv.tw/blog/archives/1483


利用Gmail Labels管理工作清單
http://www.clubeddy.com/2008/12/gmail-labels-as-task-management.html


[題外話]
<<lis.to>>
lis.to 是用Java寫成的
Java source code
http://code.google.com/p/listo/


利用svn check out
閱讀README可以瞭解重編的技巧
因為搭配Ant,所以還不難
並且搭配Launch4j可以打包成windows單一執行檔
並且在/res/lang底下有語系檔可以直接修改
我加了一個檔
UI_zh_TW.properties
-------------------
menuitem.about.name = About Fix
-------------------
重編後是成功的,相關的參數請參照/res/lang/UI.properties
不過用中文來測試卻出現亂碼,不論UI_zh_TW.properties是用UTF-8還是Big5都是亂碼
目前是看到
src/listo/client/Lang.java
對Java不熟,
http://www.eland.com.tw/www/javaland/2002_06/javatech_tag_lib2.htm
所以還沒找到Why   :p

 經過研究,結論原來是
java要求的unicode文件都是\uxxxx這種格式,
可以利用native2ascii.exe來轉碼
Ant有相關的Task指令

所以我更改了bulid.xml
-----------------------------------------------------------------------
         ...
    <target name="compile" depends="init" description="Compile Java source">
         ...
        <copy toDir="${build.classes.dir}">
            <fileset dir="${res.dir}" excludes="lang/*.properties"/>
        </copy>
            <native2ascii encoding="utf-8" dest="${build.classes.dir}/lang" src="${res.dir}/lang" includes="**/*.properties" />
    </target>
          ...
-----------------------------------------------------------------------

參考文章
-----------------------------------------------------------------------
請問一下ResourceBundle的用途
http://www.javaworld.com.tw/jute/post/view?bid=29&id=27875&sty=1&tpg=5&age=-1
swing/awt 中如何顯示中文?
http://www.lslnet.com/linux/f/docs1/i53/big5355286.htm
Native2Ascii & Ascii2Native
http://blog.xuite.net/genix/destiny/10065779
I18N 入門
http://www.javaworld.com.tw/jute/post/view?bid=42&id=182291&sty=1
使用JDK附送native2ascii.exe進行轉碼
http://blog.xuite.net/jameschih/java/5089783
Trail: Internationalization
http://java.sun.com/docs/books/tutorial/i18n/index.html
Ant OptionalTasks / Native2Ascii
http://ant.apache.org/manual/OptionalTasks/native2ascii.html
Ant CoreTypes / FileSet
http://ant.apache.org/manual/CoreTypes/fileset.html
----------------------------------------------------------------------- 

<<Chandler的故事>>
Chandler
http://blog.ijliao.info/archives/2008/08/20/3618/

“Dreaming in code”: Software is hard
http://ria.richtechmedia.com/2007/02/05/dreaming-in-code-software-is-hard/

12月25日

利用Grails Plugin 撰寫 Java Servlet

利用Grails Plugin 撰寫 Java Servlet
=====================================================================
緣起:
 原本想要研究Grails Flex Plugin的寫法
 http://grails.org/Flex+Plugin
 研究了一下原址碼和一些文件
 所以才有這篇文章

 這個Plugin很讚,可以直接寫mxml在web-app裡
 然後就可以run-time產生.swf
 這是原本flex sdk就有的功能,被整合進來
 http://livedocs.adobe.com/flex/3/html/apache_4.html
 然後還整合BlazeDS
 http://opensource.adobe.com/wiki/display/blazeds/BlazeDS


=====================================================================
作法:

[1] 先產生一個Grails的Project,這裡的範例叫做DemoPrj
grails create-app DemoPrj


[2] 安裝 Grails Flex Plugin,這個步驟是非必要的,只是要參照他的原始碼,或是偷懶直接在這個Plugin製作
cd DemoPrj
grails install-plugin flex


會產生DemoPrj/plugins/資料夾
裡面有flex-0.2和grails-flex-0.2.zip


[3] 產生一個plugin,這裡個範例叫 forservlet


grails create-plugin forservlet


你可以在任何資料夾執行上面的指令,不一定要在DemoPrj底下,好像grails create-app一樣,產生一個專案
可以看看forservlet的資料結構,和grails create-app很像,有些許不同,不同處請參考
http://www.grails.org/The+Plug-in+Developers+Guide


[4] 打包 plugin forservlet


cd forservlet
grails package-plugin


會產生一個 grails-forservlet-0.1.zip
http://www.grails.org/Creating+Plugins


[5] intsall plugin 到 DemoPrj


cd DemoPrj
grails install-plugin forservlet/grails-forservlet-0.1.zip


(我的forservlet是放在DemoPrj底下)


這樣就會產生DemoPrj/plugins/forservlet-0.1


[6] 撰寫一個java Servlet,這裡的範例叫做HelloServlet
cd forservlet/src/java
mkdir org
cd org
mkdir fun
cd fun
mkdir servlet
cd servlet


vi HelloServlet.java


=======================
package org.fun.servlet;

 
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

 
public class HelloServlet extends HttpServlet {
    public void doGet(HttpServletRequest req,
                      HttpServletResponse res)
                  throws ServletException, IOException {
        res.setContentType("text/html");
        PrintWriter out = res.getWriter();
 
        out.println("<html>");
        out.println("<head>");
        out.println("<title>Hello!Servlet!</title>");
        out.println("</head>");
        out.println("<body>");
        out.println("<h1><b>Hello!Servlet!</b></h1>");
        out.println("</body>");
        out.println("</html>");
    }
}


=======================

 

請參照這個範例
http://caterpillar.onlyfun.net/Gossip/JSPServlet/FirstServlet.htm
http://caterpillar.onlyfun.net/Gossip/JSPServlet/JSPServlet.htm


[7] servlet Mapping


cd forservlet
vi ForservletGrailsPlugin.groovy


=======
 def doWithWebDescriptor = { xml ->
  // TODO Implement additions to web.xml (optional)
  // servlets
  def servlets = xml.servlet
  servlets[servlets.size() - 1] + {
   servlet {
    'servlet-name'("HelloServlet")
    'display-name'("HelloServlet")
    'servlet-class'("org.fun.servlet.HelloServlet") 
   }
  }

  // servlet mappings
  def servletMappings = xml.'servlet-mapping'
  servletMappings[servletMappings.size() - 1] + {
   'servlet-mapping' {
    'servlet-name'("HelloServlet")
    'url-pattern'("/hello/*")
   }
  }
 }
=======


上面的動作等同在撰寫 WEB-INF/web.xml
只不過是動態寫入和用groovy的寫法


請參照
DemoPrj/plugins/flex-0.2/FlexGrailsPlugin.groovy的寫法
http://www.grails.org/Runtime+Configuration+Plugins
http://caterpillar.onlyfun.net/Gossip/JSPServlet/FirstServlet.htm


[8] 測試Hello
重複[4],[5]
cd DemoPrj
grails run-app


http://localhost:8080/DemoPrj/hello


(
在開發的時候,不想反覆[5]和[4]的步驟的偷懶的方法
請自行研究測試,:p
另外也可以直接在Grails flex Plugin上面修改,直接玩
)


=====================================================================


結論:


到目前研究的初步,BlazeDS是透過
MessageBrokerServlet去傳遞訊息
所以我想若WebORB for Java
http://www.themidnightcoders.com/products/weborb-for-java/overview.html
若也是這樣的架構(Java Servlet)的話
http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?content=lcarch_3.html
應該可以依樣畫葫蘆整合成一個Plugin


請參照
http://opensource.adobe.com/wiki/display/blazeds/Developer+Documentation
blazeds-src-3.2.0.3978\modules\core\src\java\flex\messaging\MessageBrokerServlet.java
=====================================================================


參考資料:
除了上面提到的網址


Marcel Overdijk's Blog
http://marceloverdijk.blogspot.com/
這個人應該是Grails Flex Plugin的作者
http://marceloverdijk.blogspot.com/2008/01/flex-on-grails-introducing-grails-flex.html
Grails Flex Plugin 使用範例
http://marceloverdijk.blogspot.com/2008/01/blazeds-test-drive-sample-in-grails.html
BlazeDS 30-minute test drive
http://www.adobe.com/devnet/livecycle/articles/blazeds_testdrive.html


因為還不是很會Java,剛好在學Groovy和Grail的同時,又充實Java的相關知識
真不賴 :-)
JSP/Servlet: Servlet 生命週期
http://blog.csdn.net/wangyun71/archive/2005/12/02/542307.aspx
Java Servlet 入門
http://web.nchu.edu.tw/~jlu/cyut/servlet.shtml
Java Servlet 程式設計初步
http://sun.cis.scu.edu.tw/~nms9115/articles/java/WebAppTutor/ServletPrimer/ServletPrimer.htm
context-param和init-param區別
http://hain.javaeye.com/blog/70731


Flex2中的services-config.xml設定檔 part I
http://blog.riaproject.com/?p=29
Flex2中的services-config.xml設定檔 part II
http://blog.riaproject.com/?p=35


Creating Flex Builder Projects that Use Server Technologies
http://learn.adobe.com/wiki/display/Flex/Creating+Flex+Builder+Projects+that+Use+Server+Technologies
Creating a simple BlazeDS messaging application in Flex Builder
http://learn.adobe.com/wiki/display/Flex/Creating+a+BlazeDS+messaging+application+in+Flex+Builder
Creating a simple BlazeDS web service application in Flex Builder
http://learn.adobe.com/wiki/display/Flex/Creating+a+BlazeDS+web+service+application+in+Flex+Builder


AMFPHP 與 Flex RemoteObject Component
http://blog.ben.idv.tw/2008/04/amfphp-flex-remoteobject-component.html

Using Flex with Spring
http://coenraets.org/flex-spring/

The factory mechanism  [MessageBrokerServlet -> MessageBroker -> Service -> [Spring] -> Destination]
http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?content=factory_2.html
http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/lcds/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=factory_2.html

Spring BlazeDS Integration Home [Another Way]
http://www.springsource.org/spring-flex
http://static.springframework.org/spring-flex/docs/1.0.x/reference/html/index.html
http://www.springsource.org/projects

...

 

=====================================================================

 

12月23日

Gradle Build System

本來想研究Grails 的 Script的寫法
利用它來做code generator
以後也可以用在其他案子的Build System
http://grails.org/Command+Line+Scripting
http://grails.org/doc/1.0.x/guide/4.%20The%20Command%20Line.html
後來陸續發現幾個專案
Gant
http://gant.codehaus.org/
Gradle
http://www.gradle.org/
Apache Ivy
http://ant.apache.org/ivy/
最讓我感興趣的是Gradle這個Build System
目前學到的:
安裝方便:同Groovy和Grails的安裝方式
http://gradle.org/getting-started.html
語法簡單:撰寫build.gradle,等同在寫Groovy
Userguide(有線上版,和PDF下載)
http://gradle.org/userguide.html
 
又發現一個Groovy的應用,真棒
:-)
12月8日

回應: 關於分割程式功能以及 mix-in 和 include

回應

關於分割程式功能以及 mix-in 和 include
http://blog.roodo.com/rocksaying/archives/5751881.html

===============================================================

http://lp81sam.spaces.live.com/blog/cns!FE9AB5CD84013FC2!324.entry

------------------------------------------------------------------

...
 function __call($name, $args)
 {
  $file = dirname(__FILE__) . '/module_' . $this.moduleName . '/' . $name . '.php';
  if(file_exists($file)) {
   return include($file);
  }
 }
...
------------------------------------------------------------------
<?php

 //test.php
 require_once(dirname(__FILE__) . '/Person.php');
 //test
 $thePerson = new Person("nobody");
 $thePerson->moduleName = 'AAA'; //指定你要mixin的模組資料夾
 /////$thePerson->say(" I am here!"); 
 /////$thePerson->toSay(" Are you All Right!");
 /////上面這兩個function我只是要展現include模擬function呼叫的原理,其實達到mix-in要設計在__call,不用更改原來的class
 $thePerson->hello("I" , 'am', 'ok', '!');

 $thePerson->moduleName = 'BBB'; //指定你要mixin的模組資料夾
 $thePerson->hello("I" , 'am', 'ok', '!');
?>
------------------------------------------------------------------
現在才看到這篇文章 :p

我覺得要達到「由外而內」的重構效果
只要在__call動手腳就好拉
透過檔案去Mix-in
我寫那篇的時候就這麼想
只是沒說明,我只是在展現原理
其實我沒要跟你爭論這樣的作法是不是Mix-in
因為目前php應該本來就沒有這樣的機制
當然有你說的runkit
我只是要利用php既有的特性
去達到你要的效果
當然作法我覺得是越簡單越好
因為這些問題都是可以從底層就處理的
所以現階段的功能到哪,我就善用它
原則就是"簡單易用powerful少寫code"
當然這樣的代價
就是機器去跑
否則怎麼有哪麼多的動態語言
我想未來應該寫程式應該會變成
用說的
或是用比的
或是用眼睛瞄的吧
這樣才會符合人類的習慣  :-)

===============================================================


 

回應 [PHP] PHP 密技: include 與 require

回應
[PHP] PHP 密技: include 與 require
=====================================================
 
你講的在這兩個php官方的manual都有提到
另外我以前有個想法
就是在遠端Server拋出php碼
然後用include來接
以前在玩php-gtk的時候
就有想要用include這個技巧來
玩類似java 的webstart
=====================================================
記得要在php.ini
設定這個參數
allow_url_include = On
http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen
=====================================================
<?php
 //client.php
 include('http://localhost/webstart/server.php');
?>
=======================================================

<?php

 //server.php
 /*//
 $str = '<' . '?php' . "\n"
 .'echo("hello");'
 .'?' .'>'
 .'';
 //*/
 $str = <<<EOT
<?php
 echo("hello");
?>
EOT;
 echo($str);
?>
=======================================================

另外我常用的include技巧
應該是用在template或是所謂的view
我想版主之前應該都有討論過
另外也可以像
"模擬呼叫funcion一樣的用法"
傳參數進去,return結果回來
這些都是php既有的特性
簡單易用 Powerful

=============================================
我的blog寫的相關文章

template簡易版,可以改寫成class版, Zendframework也是這樣在用,用在view
http://lp81sam.spaces.live.com/blog/cns!FE9AB5CD84013FC2!314.entry
基本上我的原則喜歡在view裡面不要有太多的php code
最棒的是只剩echo
所以我以前都說php我只會echo
這樣view裡面的碼才不會亂, view的功能是展現畫面
一些邏輯處理都放在controller或model

=============================================

這些技巧我想在很多原始碼都會看的到蹤影