2012年4月18日星期三

相片GIS管理系統 Photo GIS Manager

相片GIS管理系統 (Photo GIS Manager) 是一個用來把GPS座標加入到照片中的應用程式。
Photo GIS Manager is a program to add GPS meta data into the JPEG photo.


Try ...  Photo GIS Manager

2011年4月27日星期三

TVFans電視迷 Android 電視節目表查詢程式 TV guide (TV program schedule) for Android



TVFans 電視迷 是一個在Android手機下運行的電視節目表查詢程式 
內容包括中國 香港澳門台灣以及其他地區的電視台

TVFans is a TV guide (TV program schedule) app for Android. It includes some of the TV channels in China, Hong Kong, Macau, Taiwan and other channels around the world.


用戶可把喜歡的電視 節目分享到 Facebook 上,讓所有朋友都可以知道今天的有趣電視節目

Users can share the interested TV program to their friends through Facebook.

現在只是一個試用版本,內容與功能會不斷更新及改善
若大家有任何意見或建議 ,請張貼在此

It is a testing version until now. The contents or the number of channels will be updated and improved.
If there is any suggestion or comments, please feel free to post it at this blog.










系統要求:
  • Android 2.2 或以上
  • 3.2" 屏幕



下載 TVFans電視迷

2011年4月15日星期五

Android Football Live Scores 足球即時比分

Get the live football match schedules and scores. You can try FootballScores for Android.
Currently only support countries are :

  • England 英格蘭
  • Spain 西班牙
  • Italy 意大利
  • Germany 德國
  • France 法國
  • Holland 荷蘭
  • Portugal 葡萄牙
  • Scotland 蘇格蘭
  • Belgium 比利時
  • Champions League 歐洲冠軍杯










The match information in England.





Select country...


Download FootballScore.apk 


2010年7月13日星期二

簡單易用手機倒數計時器 Smart Countdown for Windows Mobile 6.5 and Android

Recently I developed a simple countdown application for WM6.5 (WM 手機倒數計時器) and Android (Android 手機倒數計時器).
If there is any body interesting in it. Please feel free to download to use.



Android Phone screen




Windows Mobile phone screen



Please feel free to download the Smart Countdown.


If you have any comments or want any functions, please feel free to add comments in the blog.

2009年4月21日星期二

迷官

說明
由於迷宮的設計,老鼠走迷宮的入口至出口路徑可能不只一條,如何求出所有的路徑呢?

解法
求所有路徑看起來複雜但其實更簡單,只要在老鼠走至出口時顯示經過的路徑,然後退回上一格重新選擇下一個位置繼續遞迴就可以了,比求出單一路徑還簡單,我們的程式只要作一點修改就可以了。
演算法

Procedure GO(maze[]) [
VISIT(maze, STARTI, STARTJ);
]

Procedure VISIT(maze[], i, j) [
maze[i][j] = 1;

IF(i == ENDI AND j == ENDJ) [
// FIND A ROUTE, PRINT THE ROUTE
]

IF(maze[i][j+1] == 0)
VISIT(maze, i, j+1);
IF(maze[i+1][j] == 0)
VISIT(maze, i+1, j);
IF(maze[i][j-1] == 0)
VISIT(maze, i, j-1);
if(maze[i-1][j] == 0)
VISIT(maze, i-1, j);

maze[i][j] = 0;
]


  • Java program
public class Mouse {
private int startI, startJ; // 入口
private int endI, endJ; // 出口

public static void main(String[] args) {
int maze[][] = {{2, 2, 2, 2, 2, 2, 2, 2, 2},
{2, 0, 0, 0, 0, 0, 0, 0, 2},
{2, 0, 2, 2, 0, 2, 2, 0, 2},
{2, 0, 2, 0, 0, 2, 0, 0, 2},
{2, 0, 2, 0, 2, 0, 2, 0, 2},
{2, 0, 0, 0, 0, 0, 2, 0, 2},
{2, 2, 0, 2, 2, 0, 2, 2, 2},
{2, 0, 0, 0, 0, 0, 0, 0, 2},
{2, 2, 2, 2, 2, 2, 2, 2, 2}};

System.out.println("顯示迷宮:");
for(int i = 0; i < maze.length; i++) {
for(int j = 0; j < maze[0].length; j++)
if(maze[i][j] == 2)
System.out.print("█");
else
System.out.print(" ");
System.out.println();
}

Mouse mouse = new Mouse();
mouse.setStart(1, 1);
mouse.setEnd(7, 7);

mouse.go(maze);
}

public void setStart(int i, int j) {
this.startI = i;
this.startJ = j;
}

public void setEnd(int i, int j) {
this.endI = i;
this.endJ = j;
}

public void go(int[][] maze) {
visit(maze, startI, startJ);
}

private void visit(int[][] maze, int i, int j) {
maze[i][j] = 1;

if(i == endI && j == endJ) {
System.out.println("\n找到出口!");
for(int m = 0; m < maze.length; m++) {
for(int n = 0; n < maze[0].length; n++) {
if(maze[m][n] == 2)
System.out.print("█");
else if(maze[m][n] == 1)
System.out.print("◇");
else
System.out.print(" ");
}
System.out.println();
}
}

if(maze[i][j+1] == 0)
visit(maze, i, j+1);
if(maze[i+1][j] == 0)
visit(maze, i+1, j);
if(maze[i][j-1] == 0)
visit(maze, i, j-1);
if(maze[i-1][j] == 0)
visit(maze, i-1, j);

maze[i][j] = 0;
}
}

2009年4月20日星期一

得分排行

說明

假設有一教師依學生座號輸入考試分數,現希望在輸入完畢後自動顯示學生分數的排行,當然學生的分數可能相同


解法

這個問題基本上要解不難,只要使用額外的一個排行陣列走訪分數陣列就可以了,直接使用下面的程式片段作說明:
for(i = 0; i <>
juni[i] = 1;
for(j = 0; j <>
if(score[j] > score[i])
juni[i]++;
}
}

printf("得分\t排行\n");
for(i = 0; i <>
printf("%d\t%d\n", score[i], juni[i]);


上面這個方法雖然簡單,但是反覆計算的次數是n^2,如果n值變大,那麼運算的時間就會拖長;改變juni陣列的長度為n+2,並將初始值設定為0,如下所示:

得分排行

接下來走訪分數陣列,並在分數所對應的排行陣列索引元素上加1,如下所示:
得分排行

將排行陣列最右邊的元素設定為1,然後依序將右邊的元素值加至左邊一個元素,最後排行陣列中的「分數+1」」就是得該分數的排行,如下所示:
得分排行
這樣的方式看起來複雜,其實不過在計算某分數之前排行的人數,假設89分之前的排行人數為x人,則89分自然就是x+1了,這也是為什麼排行陣列最右邊要設定為1的原因;如果89分有y人,則88分自然就是x+y+1,整個陣列右邊元素向左加的原因正是如此。

如果分數有負分的情況,由於C/C++或Java等程式語言無法處理負的索引,所以必須加上一個偏移值,將所有的分數先往右偏移一個範圍即可,最後顯示的時候記得減回偏移值就可以了。



import java.io.*;

public class ScoreRank {
public static void main(String[] args)
throws NumberFormatException, IOException {
final int MAX = 100;
final int MIN = 0;

int[] score = new int[MAX+1];
int[] juni = new int[MAX+2];

BufferedReader reader =
new BufferedReader(
new InputStreamReader(System.in));
int count = 0;

do {
System.out.print("輸入分數,-1結束:");
score[count++] =
Integer.parseInt(reader.readLine());
} while((score[count-1] != -1));

count--;

for(int i = 0; i < count; i++)
juni[score[i]]++;
juni[MAX+1] = 1;

for(int i = MAX; i >= MIN; i--)
juni[i] = juni[i] + juni[i+1];

System.out.println("得分\t排行");
for(int i = 0; i < count; i++) {
System.out.println(score[i] + "\t" +
juni[score[i]+1]);
}
}
}

2009年4月1日星期三

從Java應用程序存取Microsoft Excel檔案

感謝Apache,現在 利用POI有辦法提供Java應用程序存取Microsoft Excel文件(.xls ) POI 可以從apache.org 下載。 以下是小教程如何寫入Excel文件。 寫Excel文件步驟是:
  1. 創建輸出文件使用FileOutputStream
  2. 創建一個工作簿創建一個實例 HSSFWorkbook
  3. 創建一個新的資產負債表,建立的一個實例 HSSFSheet
  4. 創建字體對象援引法createFont ( )的 HSSFWorkbook
  5. 創建細胞風格對象援引法createCellStyle ( )的 HSSFWorkbook
  6. 創建數據格式對象援引法createDataFormat 階級 HSSFWorkbook
  7. 創建行致電方法createRow ( rowNumber )由實例HSSFSheet
  8. 收件簿到輸出文件。
這裡是一個簡單的程序來寫Excel文件包括2細胞:


import java.util.*;
import org.apache.poi.hssf.usermodel.*;
import java.io.*;
public class WriteSimpleXLS{

public WriteSimpleXLS() {
try{
FileOutputStream fos = new FileOutputStream("output.xls");
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet s = wb.createSheet();
HSSFRow r = null;
HSSFCell c = null;
HSSFCellStyle cs = wb.createCellStyle();
HSSFDataFormat df = wb.createDataFormat();
HSSFFont f = wb.createFont();

//set font
f.setFontHeightInPoints((short) 12);
f.setColor( (short)HSSFFont.COLOR_RED );

//set cell style
cs.setFont(f);
//set data format
cs.setDataFormat(df.getFormat(”#,##0.0〃));
wb.setSheetName(0, “First Sheet”);

//create row
r = s.createRow(0);
//create cell
c = r.createCell((short)0);
c.setCellStyle(cs);
c.setCellValue("Nico");
//create another cell
c = r.createCell((short)1);
c.setCellStyle(cs);
c.setCellValue("Ganteng");

//now that we’re done creating workbook,it’s time to write it to output file
wb.write(fos);
fos.close();
}catch(IOException e){
System.err.println(e.getMessage());
e.printStackTrace();
}
}

public static void main(String[] arg){
WriteSimpleXLS wsx = new WriteSimpleXLS();
}
}

2009年3月30日星期一

利用Facebook Connect 開發與 Facebook 整合的應用程序

Facebook的連接將是未來發展的Facebook的平台-讓您的力量整合Facebook的平台進入自己的網站。 使您的用戶...
  • 您的網站 Facebook的帳戶和信息進行無縫“連接”
  • 連接並找到他們的朋友誰也可以使用您的網站
  • 在您的網站上與他們在Facebook朋友分享信息和行動

可信認證

用戶可以在Facebook帳戶與任何合作夥伴的網站使用我們的簡化和值得信賴的認證。 無論是在登錄,或任何其他地方的開發商想補充的社會背景下,用戶可以驗證和連接他們的帳戶中一個值得信賴的環境。 用戶將完全控制的權限授予。

真實身份

Facebook的用戶代表自己的真實姓名和真實身份。 與Facebook的連接,用戶可以將他們的真實身份資料,他們無論身在何處,在網絡上,其中包括:基本檔案信息,個人資料圖片,名稱,朋友,照片,活動,論壇等等。

好友鏈接

Facebook的人指望保持聯繫其朋友和家人。透過與Facebook的連接,他們無論身在何處或在網絡上,都可以找到他們的朋友,開發人員可以添加豐富的社會方面,他們的網站。開發商甚至可以動態顯示其中的Facebook的朋友已經有帳戶在其網站上。

動態隱私

作為一個移動的用戶開放的網絡,他們的隱私設置將跟隨他們,以確保用戶信息和隱私規則總是最新的。 例如,如果用戶更改其個人資料圖片,或刪除的朋友聯繫,這將是自動更新的外部網站。和用戶可以控制誰可以看到他們的資料片-同樣的規則,他們在Facebook一套可用於您的網站也使用我們的動態隱私控制。

社會分配

作為一個移動的用戶開放的網絡,他們發現有趣的內容,共享信息本身,並參與了很多經驗。 與Facebook的連接,用戶能夠輕鬆共享和發布這一信息,並採取行動,他們的朋友通過Facebook的飼料,要求,通知。


翻譯自: http://developers.facebook.com/connect.php


2009年3月6日星期五

Ajax SmartGWT!

Today, let me introduce a framework that builds on top of GWT Google Web Toolkit, it is called SmartGWT!



SmartGWT Release Notes 1.0 b2

  • GWT 1.6 M1 and M2 support. GWT 1.5.3 continues to be fully supported
  • New lightweight Enterprise Gray skin
  • Performance improvements
  • various API enhancements and bug fixes
  • complete support for WebServices (WSDL)
  • Additional Developer Tools (Inspect DOM and monitor RPC calls from hosted mode)
  • Portal support and samples
  • HTML based Print Preview support. No longer requires JSP
  • Support for auto-arranging and overlapping Calendar events
  • Support for checkbox selection for ListGrids
  • improved support for users to wire DataSource's with GWT-RPC calls
  • Improved javadocs
  • Separated additional skins into a smartgwt-skins.jar
  • Chrome, Firefox 3.1, and OSX hosted mode support


So what's so smart about SmartGWT?

SmartGWT is not just another Widget library. While most Ajax frameworks focus primarily on presentation and displaying mostly read-only data, either local or via XML / JSON, SmartClient was built with server side integration in mind. Most enterprise applications are not just about about data presentation, but about being able to propagate data changes made by the user to the backend. So while its tempting to use library X that has a cool tree widget, it's not until you actually try to use it your application that you encounter the real world hard problems. For example, how do you take data from your business objects on the server to not only display in a tree widget, but also be able to update your data model when, say, the user reorders the tree nodes or make edits / deletes in the UI.

Most Ajax frameworks stop short and leave it up to the user to manage state on the client side and propagating the changes to the server. This is no a trivial problem. Over the past few years UI widget libraries have improved significantly and there are now various options available to users. Simply put, having good looking widgets is not the hard problem today. In addition to having good looking widgets, having end-to-end integration of the UI components with the backend is the hard problem. It's this 20% of the functionality that takes 80% of the time in building most enterprise applications.



SmartGWT showcase: http://www.smartclient.com/smartgwt/showcase/




Reference:
  1. GWT http://code.google.com/webtoolkit/
  2. SmartGWT http://code.google.com/p/smartgwt/