顯示具有 Java 標籤的文章。 顯示所有文章
顯示具有 Java 標籤的文章。 顯示所有文章

2007年8月21日 星期二

+1 for Closures

Java7 即將導入 closure 語法, 這個在 Ruby 中非常精巧方便的特性, 即將導入 Java 中, 在許多論壇上造成很大的激辯.

對於 Java 是一個成長中的語言. 它會一直的進步以及導入新的語法及特性. 然而, 其中平衡點的拿捏真的就很重要了.

Java6 中的 Scripting Language 介面, 以及 JRuby 的成熟, 已經可以讓您在 JVM 中使用 javascript / python / ruby , 其實我們有很多方式可以混合開發應用在我們的專案中.

Java7 中導入了 closure 雖可以讓程式語法精簡且較為優雅, 然而, 它變的太 Ruby.
阿土伯我不想喝著一杯 "走味的咖啡" 呀~ 即始它鑲上了紅寶石~
不過..............
##CONTINUE##
如果有辣妹站台, 那阿土伯也要加入支持 closure 進入 java7 嘍.







無關人身攻擊... 不過這位太重量級了, 會讓 java7 的包袱更沈重, 那就免了唄....


原文: Closures Are Hot
原文: +1 for Closures

2007年6月24日 星期日

ExifPhotoStamper 1.0.3 - 更新版推出

每天一新版, 這大概是阿土伯的 opensource/freeware 中更版最快的了..
因為它有個惡勢力使用者(老婆大人), 他的需求會立即新增上去 :D

##CONTINUE##
因為 google code 限制單一檔案 20mb, 請下載分割檔案以下面指令合併或用 7-zip 合併解壓即可.


copy /b exifphotostamper-1.0.3-win32.zip.001+exifphotostamper-1.0.3-win32.zip.002 exifphotostamper-1.0.3-win32.zip

1.0.3 版:

  • 目的檔案 變更檔名 功能.
  • 執行結果 debug.log , 有使用上的問題, 請將 log 寄給阿土伯.

詳情請見:

http://racklin.blogspot.com/2007/06/exifphotostamper.html

2007年6月21日 星期四

ExifPhotoStamper 1.0.2 - 更新版推出

部份網友反應的問題及想法, 阿土伯將它做了修正, 並加上了新的功能.. 謝謝大家的建議..
因為, 阿土伯的小土仔只有一位, 沒有太多 Sample Case 可以測, 還望大家繼續試用嘍 :D

##CONTINUE##
1.0.2 版:
  • 修正部份年齡日推算得到大於 1000 的 bug (阿土伯沒注意到 java 回傳的是 微秒, 不是秒 Orz....)
  • 新增字體外框可設定顏色.
  • 字體下方畫陰影.

詳情請見:

http://racklin.blogspot.com/2007/06/exifphotostamper.html

2007年6月20日 星期三

ExifPhotoStamper 1.0.3 - 批次為照片加上日期+


簡介:
ExifPhotoStamper 是一個精巧的 Java 應用程式 For JavaSE 5.0 或 以上.
它提供您批次處理 Exif 中的拍照日期加入到您的照片的四個角落其中一個.
然而, 除此之外, 它提供了一個特殊的功能: "開始日期" 功能.

##CONTINUE##
什麼是"開始日期", 利用"開始日期"功能, 您可以為您的照片設定一個起始的日期, 如您寶寶的出生日期, 男女朋友開始交往日期, 阿土伯的生日等, 利用 ExifPhotoStamper , 它除了將您相片 Exif 中的拍照日期加在相片中外, 還會加上由開始日期到拍照日期經過的時間.
所以, 你可以很輕鬆知道這是寶寶幾個月大的相片, 男女雙方交往多久後的相片, 或阿土伯混吃等死多少年了等, 方便為您的寶寶及親人做相片日記.

當然, 利用 format syntax 功能, 您可以自定壓上去的日期格式或乎略開始時間功能, 將 ExifPhotoStamper 當成標準的 批次壓日期小工具.

最後, ExifPhotoStamper 產生的圖檔, 依然會保留著原始檔案中的 Exif 資訊, 所以您上傳到 flickr 或支援 exif 的網路相簿或管理軟體, 依然可以正確的排序/統計及管理.


支援功能:
  • Exif Date/Time support.
  • Target File will exist Source File 's Exif Infomation metadata.
  • Font/Size/Color Setup.
  • Corner / Margin Setup.
  • Stamp Format Syntax support.
  • Font Border Color Setup.
  • Drop Shadow .
  • Target File Rename.
  • Debug Log.

ScreenShot:




小土仔的 Sample:

Sample (客制化格式, 中文 format)




Sample (Stamp)



Large-dl:http://exifphotostamper.googlecode.com/svn/trunk/sample/DSCN2007-out.JPG

Sample (Orig)

Large-dl:http://exifphotostamper.googlecode.com/svn/trunk/sample/DSCN2007.JPG


使用中文格式:

1. 請在字形名稱中選擇一個中文字體.
2. 格式: (%Y歲%M個月%D日) %y/%m/%d

其中 % 後面緊跟一個英文字母表示指令, 其它隨您填寫, 您也可填

格式: 我的小寶貝 - (%Y歲%M個月%D日) 於 %y年.%m月.%d日.

它等於是幫您浮水印字在上面唷..

指令有:
%Y - 經過(年) %M - 經過(月) %D - 經過(日)
%y - 拍照(年) %m - 拍照(月) %d - 拍照(日)
%H - 拍照(時) %i - 拍照(分) %s - 拍照(秒)


Featured Download:
所有作業系統: without-jvm
http://exifphotostamper.googlecode.com/files/exifphotostamper-1.0.3-bin.zip (340 KB)

Windows: with-jvm (請下載二個檔後一起解壓縮, 因為 google code 有單一檔案 20mb 的限制)

http://exifphotostamper.googlecode.com/files/exifphotostamper-1.0.3-win32.zip.001
http://exifphotostamper.googlecode.com/files/exifphotostamper-1.0.3-win32.zip.002
(29.5 MB)

copy /b exifphotostamper-1.0.3-win32.zip.001+exifphotostamper-1.0.3-win32.zip.002 exifphotostamper-1.0.3-win32.zip



Open Source:

http://code.google.com/p/exifphotostamper/


Require JavaSE5 以上:
ExifPhotoStamper 需要 JavaSE5 或以上的環境, 若您不是下載 Windows 版, 或您的電腦尚未安裝 JavaSE , 請到下列網址先下載安裝.
http://java.sun.com/javase/downloads/index.jsp
點選 Java Runtime Environment (JRE) 6u1 旁的 Download.


軟體背後:
每一個軟體背後, 都有一個心酸的故事~~~ :D
才瘋狂的結束了前一陣子的專案, 本以為可以利用端午連假休息在家躺四天, 沒想到老婆大人一個命令下, 傕生出了這個軟體.
"把小土仔的相片整理一下, 去采風輸出一本相簿給他的爺爺看吧..." 這個.. 我能躺的時間少了一天 ....
"對了... 送去沖印的相片能不能加上當時拍照的日期"... 這... 容易, 網路上一堆 Free Software 能做吧..
"呀~~ 那日期前面能不能加上小土仔目前 幾個月大又幾天 "... 這... 沒有這樣的軟體吧........
"不管~~ 沒有你就一張一張用 gimp 打字把幾個月大又幾天打上去" ...... orz....

相信一定有很多爸爸/媽媽需要這個軟件... 希望對大家有幫助....

2007年2月24日 星期六

NetBeans 6.0 Milestone 7 Released with JRuby support

NetBeans 6.0M7 發表嘍,您可以在這裡找到. 或使用新的安裝程式,選擇您要安裝的 Package.

這個版本加了多許多新的功能,最讓阿土伯我期待的就是 JRuby support.

##CONTINUE##









JRuby 並未在內建的安裝程式中,您可以透過 Tools\Update Center and install Ruby 下的套件。



Wow... try it.





Technorati Tags: , ,

2007年1月17日 星期三

Java and JSON

引自 ONJava.com 的文章,讓 Java POJO 能直接 serialize 成 JSON Format,或由 JSON Format unserialize 回 Java POJO ,透過 XStream 的 toXML 和 fromXML 相當容易及實用。

##CONTINUE##

Java and JSON
from ONJava.com by webmaster@oreillynet.com (Dejan Bosanac)

It seems that JSON vs. XML debate was one of the hot topics for this winter. Again, I think that “vs.” part is sufficient and that both XML and JSON should have their place in overall technology landscape. One of the obvious JSON advantages is that it can be directly evaluated in JavaScript. And for the Ajax-world we live in, it is not a small thing.

For one project, I started looking for a library that would enable me easy transformations between Java and JSON data. JSON in Java looks nice, but what I really want is a more automated and configurable library like those we have for XML processing. My first thought was XStream since I like its simple API, extensible architecture, powerful converters and support for annotations. After first check I found that from version 1.2 on there is a partial support for JSON (which was logical thing to expect). So, currently you can serialize your Java objects to JSON format."

2007年1月12日 星期五

各語言下的 php like strig_tags.

由於在處理網頁內容及HTML內容過濾, 很常需要將部份 HTML Tag 去除.

在 php 中有內建的 strip_tags 非常好用, 不但能去除Tag, 亦可以接受部份 allow tags.

以下為各語言下的 php like strip_tags.

2006年6月21日 星期三

On the Stre@m - Java

On the Stre@m - Java: "JSP/Java - strip_tags() PHP like function

Another PHP function that is very used is strip_tags.
This function tries to return a string with all HTML tags stripped from a given string.

public static String strip_tags(String text, String allowedTags) {
String[] tag_list = allowedTags.split(',');
Arrays.sort(tag_list);

final Pattern p = Pattern.compile('<[/!]?([^s>]*)s*[^>]*>');
Matcher m = p.matcher(text);

StringBuffer out = new StringBuffer();
int lastPos = 0;
while (m.find()) {
String tag = m.group(1);
// if tag not allowed: skip it
if(Arrays.binarySearch(tags, tag) < lastpos =" m.end();"> 0) {
out.append(text.substring(lastPos));
return out.toString().trim();
} else {
return text;
}
}"

2006年4月12日 星期三

Resin's Quercus: 用Java實作的PHP語言模組

由Resin 3.0.17開始,Resin裡多了一個稱為Quercus的東西, Resin 網站是這麼解譯的:

Resin's Quercus is an implementation of the PHP language (requires JDK 1.5)