2013/03/30

非 ascii code 網址問題

今天收信有人回報 xgallery 有問題, 無法使用.
檢查並且測試一下對方所給的網址, 發現原來是網址的問題

一般正常的網址大概如下, 用正常 HttpURLConnection 一切都沒問題.
http://www.yahoo.com

但是如果是以下的網址呢 ?
http://www.yahoo.com/abcabc재/test/123.html
用一般正常的瀏覽器看是沒有問題, 但如果使用 HttpURLConnection 就會出現找不到網址的現象.
原因很簡單, 就是要把網址 encode.

原本很簡單的我就直接使用 URLEncode("http://www.yahoo.com/abcabc재/test/123.html", "UTF-8"),
這樣不行, 這樣會連 ":", "/" 等都給 encode 起來, 所以只能一個一個去 encode.

解決方式如下:

public static String getEncodeURL(String url) {
 StringBuilder sb = new StringBuilder();
 Uri uri = Uri.parse(url);
 
 String path = uri.getPath();
 List paths = uri.getPathSegments();
 
 int index = url.indexOf(path);
 
 sb.append(url.substring(0, index));
 for (String s: paths) {
  try {
   sb.append("/"+URLEncoder.encode(s, "UTF-8"));
  } catch (UnsupportedEncodingException e) {
   sb.append("/"+s);
  }
 }
 return sb.toString();
}

只要把每個網址用這個 method 包起來就可以了

PS: 上面那個 </string> 請忽略, 不知道為啥會出現

2013/03/29

論壇瀏覽器 v2.0.1

** 由於無法每個論壇都測試, 有問題請回報連結跟論壇, Thanks **

* 修改加入書籤錯誤的問題
* 修改部份論壇顯示錯誤的問題
* 修改部份論壇連結點擊後會導致 FC 的問題
* 修改按 Back key 時會重載入的問題
* 支援以下論壇感謝的動作

> ck101
> FastZone
> FDZone
> p2p101

剛上傳, 所以 google play store 通常會 delay 一下.
Google play store: http://goo.gl/jdHf5

2013/03/20

`docdir' is not a legitimate directory for `SCRIPTS'

今天在重新 checkout 一份 source code, 準備編譯時出現這個問題.
由於電腦之前硬碟掛掉, 所以編譯環境有所改變, 所以在懷疑是不是重新安裝過程出了問題.

Google 了一下, 終於找到解決問題方法.


原因是 automake 會限制 docdir 的位置, 如果不符合就會出現問題.
但如果想要強制放置在自己所設定的位置, 可以透過一些方式而繞過這個問題.

下面這是會出現 `docdir' is not a legitimate directory for `SCRIPTS'
# This was added at the suggestion of libtoolize
ACLOCAL_AMFLAGS = -I m4

#
# set doc (keyword) directory
#
docdir = $(prefix)/doc
#
# Documents list
#
doc_SCRIPTS = 

CLEANFILES = $(doc_SCRIPTS)
EXTRA_DIST = $(doc_SCRIPTS)


修改方式如下
# This was added at the suggestion of libtoolize
ACLOCAL_AMFLAGS = -I m4

#
# set doc (keyword) directory
#
docdir = $(prefix)/doc
mydocdir = $(docdir)
#
# Documents list
#
mydoc_SCRIPTS = 

CLEANFILES = $(doc_SCRIPTS)
EXTRA_DIST = $(doc_SCRIPTS)


就是這樣簡單.


參考來源:
To prevent the use from using incorrect locations by mistake -- it usually
makes bi sense to install a program in $(docdir) or a library in $(bindir).

But if the user still want to use those location (because he has his
own good reasons hopefully), he can easily circumvent our checks:

  mydocdir = $(docdir)
  mydoc_LIBRARIES = libfoo.a  # Will be installed in docdir.

This is also documented in the manual ("The Uniform Naming Scheme").


http://gnu-automake.7480.n7.nabble.com/limited-install-locations-for-scripts-td5453.html

PostCrossingBot v1.0.0

PostCrossingBot is a ad-supported android client for postcrossing.

Right now, You must be a member of postcrossing to use this app.

It has the following features:

* easy way to navigate, view users profile, statistics.
* viewing postcards with zooming/panning support.

There are some features still working on.
Here are my todo lists.

TODO:
* Edit account profile.
* Send a postcard
* Register a postcard

If you have any suggestions or questions, feel free to email me to weakapp@gmail.com

Google Play: http://goo.gl/4teOO




Screenshot:




2013/03/17

JustDelicious v1.0.0 (Free Version)

JustDelicious Free is an ad-supported delicious.com client with following features:

* Swpie to swich from recent post links to tag view
* In post links, clicking tag can filter the links
* Rename or remove tags
* Remove post links
* Add links from other apps such as browser, youtube ...
* Multi-account support
* Long press to select post links or tags to edit or remove.


Instructions:

* create an account
1. First press menu key and select Accounts to add account or choose account
2. After choose account, press refresh icon to synchronize bookmarks

* edit or remove an account
1. press menu key, choose account and press edit button.
2. you can remove it or edit this account.


If you have any problems or questions, feel free to mail to me weakapp@gmail.com


Google play: http://goo.gl/EFDft




changelog:
v 1.0.0
* add / remove links.
* basic supports.