2013年5月19日 星期日

Google I/O 2013:小編體驗 Google Glass,新 App 、開發者工具進駐

文章來源 : http://www.techbang.com/posts/13333-google-i-o-2013-editor-experience-google-glass

[分享]Jaoso內容管理系統,Struts+Spring+Hibernate實作

文章來源 : http://www.javaworld.com.tw/jute/post/view?bid=35&id=63383&sty=1&tpg=3&age=0


Gmail附件轉寄器

文章來源 : http://www.javaworld.com.tw/jute/post/view?bid=35&id=123353&sty=1&tpg=2&age=0


Tomcat資源管理器模組--動態重載資源

文章來源 : http://www.javaworld.com.tw/jute/post/view?bid=35&id=155328&sty=1&tpg=2&age=0


[JSP]BBS 網頁程式分享

文章來源 : http://www.javaworld.com.tw/jute/post/view?bid=35&id=33962&sty=1&tpg=2&age=0

web 日誌

文章來源 : http://www.javaworld.com.tw/jute/post/view?bid=35&id=135478&sty=1&tpg=2&age=0

TOTOMOMO2 - Java Web MSN 整理 [精華]

文章來源 : http://www.javaworld.com.tw/jute/post/view?bid=35&id=76644&sty=1&tpg=2&age=0

JSP 線上水球 分享

文章來源 : http://www.javaworld.com.tw/jute/post/view?bid=35&id=93597&sty=1&tpg=2&age=0


JSP WebMail 分享

文章來源 : http://www.javaworld.com.tw/jute/post/view?bid=35&id=82147&sty=1&tpg=2&age=0

使用 TagLib 與 Scripting Lanaguage 互動

文章來源 : http://www.javaworld.com.tw/jute/post/view?bid=35&id=218144&sty=1&tpg=2&age=0


動態網頁圖形計數器

文章來源 : http://www.javaworld.com.tw/jute/post/view?bid=35&id=141611&sty=1&tpg=2&age=0

[分享]CheerNote2 個人網誌單機版 or 個人知識管理

文章來源 : http://www.javaworld.com.tw/jute/post/view?bid=35&id=235117&sty=1&tpg=2&age=0

CheerNote2 這是自己寫的一個小作品,不曉該算什麼? 個人網誌單機版 or 個人知識管理
這是單純由html+css+javascript 寫出來的,沒有資料庫,資料全部寫在本機的文字檔內,資料的組織方式,是使用Tag來分類並按日期排序。

寫作動機:
1.使用過TiddlyWiki之後,覺得非常好用,不過總是有些地方覺得太煩鎖了,且不需要
(http://groups.google.com/group/TiddlyWiki-zh/web/tiddlywiki)
2.因為「瀏覽器」是最常開啟在桌面的程式了,用它來看一些資料再方便不過了
3.順便在專案閒暇之餘練練功。

引用的javascript套件有:
1.prototype1.6.js(http://www.prototypejs.org/) ,應該是家喻戶曉吧!
2.tiny_mce(http://tinymce.moxiecode.com/)即見即所得的html編輯器

執行方式,打開程式資料夾後,用由瀏覽器(強烈建議使用firefox)執行index.html,即可。

CheerNote2_20080729.7z (272.41k)

用 jQuery + SuckerFish Style 改寫的一個多層 menu

文章來源 : http://www.javaworld.com.tw/jute/post/view?bid=35&id=269764&sty=1&tpg=1&age=0

用 jQuery + SuckerFish Style 改寫的一個多層 menu 菜單

特色:沒有
功能:普通
差別:修改幾處多層 menu 中 IE 的兼容問題

原作:http://be.twixt.us/jquery/suckerFish.php

123.html (2.93k)

身份證字號驗證的 Annotation 寫法

文章來源 : http://www.javaworld.com.tw/jute/post/view?bid=35&id=245715&sty=1&tpg=1&age=0

需要在WEB驗證身份證字號的話,可以試試看用下列的程式喔!
如果我也寫錯的地方也請不吝指教,謝謝。

PersonId.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
 
import org.hibernate.validator.ValidatorClass;
 
/**
 * 身份證字號
 * @author pogi
 * @BuildTime 2008/11/27 下午 1:51:08
 */
@Documented //可以在 JavaDoc 顯示
@Target({ElementType.FIELD, ElementType.METHOD}) //可以用在類別的屬性或方法上
@Retention(RetentionPolicy.RUNTIME) //runtime 期間都會一直保留其值
@ValidatorClass(PersonIdValidator.class) //驗證時要呼叫的類別
public @interface PersonId{
  String message() default "請輸入正確的身份證字號";
}


PersonIdValidator.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.io.Serializable;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
 
import org.hibernate.validator.Validator;
 
/**
 * 中華民國身份證字號驗證
 * @author pogi
 * @BuildTime 2008/11/27 下午 1:58:20
 */
public class PersonIdValidator implements Validator<PersonId>, Serializable{
  private static final long serialVersionUID = 1;
  private Pattern pattern;
  private static final char[] FIRSTWORD = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
  private static final int[] FIRSTWORDNUMBER = {1,10,19,28,37,46,55,64,39,73,82,2,11,20,48,29,38,47,56,65,74,83,21,3,12,30};
 
  /* (non-Javadoc)
   * @see org.hibernate.validator.Validator#isValid(java.lang.Object)
   */
  public boolean isValid(Object arg0){
    if(arg0 == null) return true;
    if(!(arg0 instanceof String)) return false;
    String personId = ((String)arg0).toUpperCase();
    if(personId.length() == 0) return true;
    Matcher matcher = pattern.matcher(personId);
    if(matcher.matches()){
      int verifyNumber = 0;
      //英文字母的轉碼數字
      verifyNumber = FIRSTWORDNUMBER[Arrays.binarySearch(FIRSTWORD, personId.charAt(0))];
      //身份證字號第1~8個數字依次取出乘以8~1
      for(int i = 0; i < 8; i++){
        verifyNumber += Character.digit(personId.charAt(i + 1), 10) * (8 - i); 
      }
      //10 - 上述總和除10之餘數
      verifyNumber = 10 - (verifyNumber % 10);
      //若驗證碼與身份證字號最後一個數字相同即為正確
      if(verifyNumber == Character.digit(personId.charAt(9), 10) || verifyNumber == 10){
        return true;
      }
    }
    return false;
  }
 
  public void initialize(PersonId arg0){
    pattern = Pattern.compile("^\\p{Upper}{1}\\d{9}", Pattern.CASE_INSENSITIVE);
  }
}


上面兩個程式可以放在相同 package,這樣比較好管理

使用範例如下(JavaEE)
Person.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
@Entity
public class Person inplements Serializable{
  private int id;
  private String personId;
 
  @Id
  @GeneratedValue
  public int getId(){
    return this.id;
  }
  public void setId(int id){
    this.id = id;
  }
 
  @NotNull
  @PersonId(message="你偷渡喔!!")
  public String getPersonId(){
    return this.personId;
  }
  public void setPersonId(String personId){
    this.personId = personId;
  }
}

用 jQuery 寫的一個模擬 multiple select box plugin

文章來源 http://www.javaworld.com.tw/jute/post/view?bid=35&id=265091&sty=1&tpg=1&age=0


無聊的禮拜天用 jQuery 寫了一個模擬 multiple select box 的 plugin

模擬功能:
1. 滑鼠 mouse drag 時,能夠跟隨滑鼠移動進行選取
2. 滑鼠 mouse drag 時,scroll bar 能夠跟隨滑鼠進行捲動

現在還少鍵盤的對應動作...

主頁: http://code.google.com/p/jquerymultipleselectbox/

Demo: http://dreamltf.miroko.tw/index.html

[專訪] 解開人氣程式碼得主,不為人知的一面

文章來源 http://www.labviewpro.net/forum_post_detail.php?post=3603&fid=2

大家是否好奇過,寫出風靡全球《哈利波特》的作者J.K.羅琳,在寫作時有什麼特殊的嗜號(或怪癖?!),或面對那麼龐大的小說架構是如何構思其靈感來源呢?同樣的,習慣與程式語言溝通的LabVIEW programer,是如何以程式邏輯撰寫出程式的?這一次專訪了,5 月份人氣程式碼得主:Polung,他將現身說法,分享在撰寫「記憶大考驗」這組程式碼的心得。