2011年12月11日 星期日

Eclipse Modeling Framework Technology (EMFT)

URL: http://www.eclipse.org/modeling/emft/?project=ecoretools

Ecore Tools
EEF


Book:

EMF: Eclipse Modeling Framework, 2nd Edition (2009)

http://www.informit.com/store/product.aspx?isbn=9780321331885


Acceleo:
http://www.acceleo.org

2011年9月21日 星期三

The usage of Table/TableLayout

TableLayout.register(Actor):
Save to HashMap nameToWidget.

Actor: UI component (widgets), such as Swing JTextField / Android Button.

Window extend Table and contains a TableLayout.

Window.add:
Save to HashMap widgetToCell.

What's the difference?

TableLayout.parse(FileHandle):
Parse a table info and adds the widgets and cells to the table from file.

2011年6月13日 星期一

DLTK tutorial

實作Python DLTK需要以下class與檔案:
1. Project nature
定義 content type
定義 nature
並加入以下class XML資訊:

ScriptNature :
2. ExamplePythonNature extends ScriptNature

Describer:
3. ExamplePythonContentDescriber extends ScriptContentDescriber

DLTK Language Toolkit:
4. ExamplePythonLanguageToolkit extends AbstractLanguageToolkit

DLTK UI-Language Toolkit:
5. ExamplePythonUILanguageToolkit extends AbstractDLTKUILanguageToolkit

Structure Parser:
6. ExamplePythonSourceElementParser extends AbstractSourceElementParser

Interpreter:
7. ExamplePythonInstallType extends AbstractInterpreterInstallType
8. ExamplePythonInstall extends AbstractInterpreterInstall
9. ExamplePythonInterpreterPreferencePage extends ScriptInterpreterPreferencePage

Interpreter Preference (optional):
10. ExamplePythonInterpreterPreferencePage extends ScriptInterpreterPreferencePage
11. ExamplePythonInterpretersBlock extends InterpretersBlock
11. ExampleAddPythonInterpreterDialog extends AddScriptInterpreterDialog
12. ExamplePythonInterpreterLibraryBlock extends AbstractInterpreterLibraryBlock

Editor:
13. ExamplePythonEditor extends ScriptEditor

Syntax highlighting:
14. create interfaceIExamplePythonPartitions


Editor Source configuration:

15. ExamplePythonTextTools extends ScriptTextTools (For creating SourceViewerConfiguration)
16. ExamplePythonSourceViewerConfiguration extends ScriptSourceViewerConfiguration
17. ExamplePythonContentAssistPreference extends ContentAssistPreference

Eclipse platform UI:
18. ExmplePythonUI extends AbstractUIPlugin (To hold the text tools)

Partitioning (used for highlighting) 特定 Scanner <-> Partition:
(如: code partition (for source code), commentary partition (for source code comments), string partition)
19. ExamplePythonPartitionScanner extends RuleBasedPartitionScanner
20: create interface: IPartitionTokenScanner from: ExamplePythonTextTools.getPartitionScanner()

Color constants:
21: create interface: IExamplePythonColorConstants
22. ExamplePythonUIPreferenceInitializer extends AbstractPreferenceInitializer

Keyword highlighting:
23. ExamplePythonCodeScanner extends AbstractScriptScanner (關鍵字)

Search:
24. ExamplePythonSearchPage extends ScriptSearchPage
25. ExamplePythonSearchFactory extends AbstractSearchFactory
26. ExamplePythonMatchLocationParser extends  MatchLocatorParser

Open type:
27. ExamplePythonOpenTypeAction extends OpenTypeAction

Open declaration:
28. ExamplePythonSelectionEngine implements ISelectionEngine

Simple documentation provider for comments:
29. ExamplePythonCommentDocumentationProvider implements IScriptDocumentationProvider

Code assistance:
30. ExamplePythonCompletionEngine implements ICompletionEngine

Completion:
31. ExamplePythonCompletionProposalComputer extends  ScriptCompletionProposalComputer
32. ExamplePythonCompletionProposalCollector extends ScriptCompletionProposalCollector
33. ExamplePythonCompletionProposal extends ScriptCompletionProposal
34. ExamplePythonCompletionProcessor extends ScriptCompletionProcessor

Code templates
35. ExamplePythonUniversalTemplateContextType extends ScriptTemplateContextType
36. ExamplePythonTemplateContext extends ScriptTemplateContext
37. ExamplePythonTemplateCompletionProcessor extends ScriptTemplateCompletionProcessor
38. ExamplePythonTemplateAccess extends ScriptTemplateAccess
39. ExamplePythonCodeTemplatesPreferencePage extends ScriptTemplatePreferencePage
40. ExamplePythonUILanguageToolkit2 extends ExamplePythonUILanguageToolkit (AbstractDLTKUILanguageToolkit)
41. ExampleSimplePythonSourceViewerConfiguration extends ExamplePythonSourceViewerConfiguration (SourceViewerConfiguration)

2011年6月12日 星期日

How to build a code formatter with your editor within eclipse

1. 實作 MyEditor extends SourceViewerConfiguration
2. 覆寫 MyEditor.getContentFormatter
3. 實作 MyStrategy extends ContextBasedFormattingStrategy
4. 在 plugin.xml 加入: plugin.xml
5. 新增 Action

 <extension
         point="org.eclipse.ui.actionSets">
      <actionSet
            label="MyEditor Action set"
            description="Action set description"
            visible="false"
            id="MY_PLUGIN.myActionSet">
         <action
               definitionId="*MY_PLUGIN_ACTION_NAME*"
               label="Format"
               retarget="true"
               menubarPath="org.eclipse.dltk.ui.source.menu/editGroup"
               id="MY_PLUGIN.MY_ACTION_FORMAT_ID">
         </action>
       </actionSet>
</extension>


6. 新增 Key binding
7. 新增 Command
8. MyScriptEditor implementation override method createActions(){

 super.createActions();


 action= new TextOperationAction(DLTKEditorMessages.getBundleForConstructedKeys(), "Format.", this, ISourceViewer.FORMAT);


 action.setActionDefinitionId("*MY_PLUGIN.MY_ACTION_NAME*");
 setAction("Format", action);
 markAsStateDependentAction("Format", true);
 markAsSelectionDependentAction("Format", true);


}


9. Editor context parent 必須是:
"org.eclipse.dltk.ui.scriptEditorScope"



2011年6月11日 星期六

EeePad TF101 超頻之路

目前最新 Honeycomb v3.1, TF101已經更新.

最原始版本: v8.2.3.9 (HC 3.0)
目前最新版本: v8.4.4.5 (HC 3.1)

1. 若不小心升級到v8.4.4.5, 需要先downgrade到 v8.2.3.9 (參考A參考B)
2. root
3. 安裝 CWM 復原 (Clockwork Mod)
4. 重新開機, Volume down + Power -> 使用 CWM 安裝 custom ROM (PRIME v1.x 或 PRIMORDIALv3.x) 或是 epad_TW_8239_8445-1.zip ROM
  (install zip from sdcard -> choose zip from sdcard)
5. 再度重新開機 (TF101用blob的方式更新rom,只要燒錄過任何東西,一定要重新開機後再燒下一個。不可連續接著燒下去)
5. 換成 custom 超頻核心 (Clemsyn-Blades overclocking kernel)
6. 最高可超頻 1.6 ghz (原始 1.0 ghz)

PS: 若覺該kernel不穩,想要換回來:
a. ClockworkMod 3.1.0.1-solarnz-R3 (此版本修正了備份的一些問題)
b. 原始3.1 kernel

(使用 Quadrant Advanced)
PRIME效能測試
PRIME v1.4 vs PRIMORDIALv3.1

2011年3月4日 星期五

建立AOSP (Dream/Sapphire by Gingerbread for example)

http://forum.xda-developers.com/showthread.php?t=882356


As some of you may know I've been working on a open source build for a near AOSP version of Gingerbread for the Dream/Sapphire.

Unless a better name is conceived I'll call it ezGingerbread!

The idea is to do this mostly in the open; and I'm sure this will be forked into various builds in the future. Here however we can discuss this repository; and make recommendations for maintaining a base stable, and fast install for out phones.

I'll make a new thread for initial release candidates and releases when we are ready. This thread will remain even after said releases for the ongoing development.

NOTICE this thread is to help build & develop gingerbread roms for the Dream/Sapphire platform; no binaries on this page are supported at this point in time; and no rom installation support will be provided.

Help with the build system will be provided within reason.

(FYI: if you are looking for testing binaries they are in post 2)

To Build,

The following is based off CyanogenMod wiki and explains how to build on:
Ubuntu 10.04 (Lucid) & Ubuntu 10.10a3 (Meerkat) and ideally a AMD64 compatible computer

I personally (mostly following the same instructions) use Debian squeeze and others have succeeded with 32bit systems.

Computer Setup (only if you have not made an android build environment before):

1) It is not 100% needed but highly recommended to install the Android SDK
2) Install the build packages
Originally Posted by cmwiki
Install using the package manager of your choice:

For 32-bit & 64-bit systems:

git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush

For 64-bit only systems:

g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilib

Note: On Ubuntu 10.10, and variants, you need to enable the parter repository to install sun-java6-jdk:

add-apt-repository "deb http://archive.canonical.com/ maverick partner"
3) make a directory for you android work say 'mkdir ~/android'
4) download repo: 'curl http://android.git.kernel.org/repo > ~/android/repo'
5) symlink repo to somewhere on your path (Optional but will make things easier) example 'sudo ln -s ~/android/repo /usr/local/bin/repo'

if you do not add repo to the path remember to replace any calls to repo with a calling path.. in all cases below it will be '../repo'

Getting the code

6) cd into your android directory you created above: 'cd ~/android'
7) create a directory for ezGingerbread: 'mkdir ezGingerbread'
8) cd ezGingerbread
9) init the repo: 
Code:
repo init -u git://github.com/ezterry/manifest-gingerbread-DS.git -b gingerbread
it will ask for your name+gmail, answer real or fake
10) sync to download the code: 
Code:
repo sync
(go out and enjoy the day.. this will take a while)

Proprietary files

Extract the proprietary files, historically the extract_files script is used, but requires your phone to already have the rom installed, so we will use unzip_files instead.

11) download the most recent version of the nighties (usually the proprietary files don't change but sometimes we swap them):
Code:
curl http://sandbox.devnull.name/android/gingerbread/GINGERBREAD-DS-Alpha-20110129-1.zip > sapphire_update.zip
12) 'cd device/htc/sapphire/'
13) run './unzip-files.sh'
14) return to the root directory: 'cd ~/android/ezGingerbread'

Note: if you have been asked to re-build the proprietary files, either because an autogenerated make script was updated, or a change in the files: run 'rm -rf vendor;repo sync;' before re-running the above.

Building:

15) run '. build/envsetup.sh'
16) run 'lunch' and select full_sapphire-userdebug (shortcuts you will find are 'lunch full_sapphire-userdebug' or just 'lunch 3' but these may change if the target name is changed in future, the menu will always list all the options)
17) run 'make -j otapackage'
for example if you have a quad code CPU: 'make -j5 otapackage'
a dual core is 'make -j3 otapackage'

The -jN indicates the number of parallel threads make will run, but using -j5 I assure all 4 cores are at 100% utilization .. important as it can take 3-4h to build on a single core.

18) after you realize the build is done (ie fan on computer stopped working overtime) the flashable image will be:
ls out/target/product/sapphire/full_sapphire-ota-eng..zip

so 'ls -l out/target/product/sapphire/full_sapphire-ota-eng*zip'

The resulting image will be an EBI0/EBI1/2708+ anykernel installer

Updating and Rebuilding:

Usually you only need to run the following for a updated clean build:
19) run 'repo sync'
20) make clobber
21) make -j otapackage

In some cases you may wish to re-generate the proprietary files if something changed:

in that case:
* Run 'rm -rf vendor'
* Run 'repo sync'
* pick up with 'Proprietary files' section above.

Last if you are doing active development in the build tree its easy to be confused about the trees state, to restore to the clean tree:

* cd ~/android/ezGingerbread
* run: (note this will delete everything but the .repo (or other hidden) directories, be careful.
Code:
rm -rf `ls -a | grep -v "^\." `
* run 'repo sync' this will not take too long, its just extracting the files, the data has mostly been downloaded from your original sync.
* Continue with the 'Proprietary files' section above.

To Fix,

If you have a patch give me a push on github, a message here, or send me a PM I'll review it and include it if appropriate.

Known issues and status,

I'm currently tracking issues on github:
https://github.com/ezterry/manifest-...read-DS/issues

若在建立aosp遇到無法compile

如果遇到git server有新的程式更新導致無法build, 可以用以下方法退回去:


repo forall -c "git checkout android-2.3.2_r1"
repo sync ezterry/GB-build
repo sync ezterry/GB-platform_dalvik
repo sync ezterry/GB-device_htc_dream-sapphire
repo sync ezterry/GB-device_htc_sapphire
repo sync ezterry/GB-external_clearsilver
repo sync ezterry/GB-android_external_skia
repo sync ezterry/GB-external_webkit
repo sync ezterry/GB-framework_base
repo sync ezterry/GB-hardware_qcom_gpsshim
repo sync ezterry/GB-hardware_qcom_media
repo sync ezterry/GB-packages_inputmethods_LatinIME
repo sync ezterry/GB-system_core
repo sync ezterry/GB-system_extras

2011年2月21日 星期一

adb logcat 除錯

Es: adb logcat pdfJNI:V fpdf:I *:S > log.txt

將 tag = "pdfJNI" 的 Verbose 與 "fpdfWarn 的 log 印到 log.txt




  V    Verbose
  D    Debug
  I    Info
  W    Warn
  E    Error
  F    Fatal
  S    Silent (supress all output)

2011年2月16日 星期三

Create a Android project w/ build.xml via command

android create project --target 8 --name YourProjectName --path  YorProjectPath --activity StartUpActivity --package com.wethink

2011年2月12日 星期六

安裝 ADempiere / PostgreSQL

1. 安裝 ADempiere
 - Email server: smtp.googlemail.com
 - DB server: localhost
 - DB name: adempiere
 - DB user: adempiere

2. 安裝 PostgreSQL
初始DB:
c:\pgsql\bin\initdb -E UTF-8 -U postgres ..\data

啟動service:
c:\pgsql\bin\pg_ctl.exe -D ..\data start

14.png (665×738)

pgAdmin III:
localhost
user: postgres

2011年1月31日 星期一

Android的圖片單位,與定義 (px,dip,sp)

http://blog.sina.com.cn/s/blog_4b93170a0100n6lx.html


關於android平台下px,dip,sp等單位

Android的layout文件中有時候可能會指定具體的單位,比如有時候為px、dip或者sp等。他們的區別如下:

1. px (pixels)像素:這個大家用得比較多, 一般我們HVGA代表320x480像素。

2. dip或dp (device independent pixels)設備獨立像素:這個和設備硬件有關,一般我們為了支持WVGA、HVGA和QVGA cwj推薦使用這個,不依賴像素。
在android上開發的程序將會在不同分辨率的手機上運行。為了讓程序外觀不至於相差太大,所以引入了dip的概念。比如定義一個矩形10 x 10dip. 在分辨率為160dpi 的屏上,比如G1,正好是10 x 10像素。
而在240 dpi 的屏,則是15 x 15 像素.
換算公式為 pixs = dips * (density/160). density 就是屏的分辨率
3. sp (scaled pixels — best for text size)放大像素: 主要處理字體的大小。

下面的不經常用到:

4. in (inches)英吋

5. mm (millimeters)毫米

6. pt (points)點

2011年1月27日 星期四

Google 1/27 釋出Android 3.0平板預覽版

http://www.ithome.com.tw/itadm/article.php?c=65739


Android 3.0一開始就是針對擁有更大螢幕的裝置所設計,特別是平板電腦;Google指出,這仍是Android 3.0 SDK的預覽版,不論是API或系統映像都非正式版。
Google周三(1/26)終於釋出受到各家平板電腦製造商所關注的Android 3.0(代號Honeycomb,蜂窩)開發人員預覽版,並更新其SDK工具。Android 3.0 SDK正式版預計數周內就會出爐。

Google Android SDK技術主管Xavier Ducrohet表示,Android 3.0一開始就是針對擁有更大螢幕的裝置所設計,特別是平板電腦,它有一個新的全像(holographic)使用者介面主題,及結合Android的多工、通知及小工具等功能所打造的互動模式,也新增了其他功能。

除了使用者功能外,Android 3.0也賦予開發人員各種工具及能力以用來打造支援平板電腦或其他相關裝置的應用程式,新的介面適用於既有的應用程式,亦相容於之前的平台及其他尺寸的裝置。

Android 3.0新的UI框架可用來打造支援更大螢幕的應用程式,它提供新的使用者介面元件、新的主題、更豐富的小工具及通知能力,並支援拖曳;另也提供高效能的2D與3D圖像能力,其動畫框架允許開發人員在程式中添增視覺效果,並內建GL renderer以讓開發人員在程式中進行2D描繪時要求硬體加速,以及新增一稱為Renderscript的3D圖像引擎。

此外,Android 3.0還支援多核處理器架構,已針對單核及雙核處理器最佳化;並提供各種新的多媒體功能,包括HTTP即時串流、可插拔的DRM框架,並透過MTP/PTP簡化媒體檔案傳輸設計;以及新增連結方式,例如針對Bluetooth A2DP與HSP設計的新API可允許應用程式提供語音串流及耳麥控制功能,也支援藍牙非安全插槽連結(Bluetooth insecure socket)以讓應用程式可與缺乏使用者介面的裝置連結。

為了促進企業的採用,Android 3.0採用新的管理政策,例如可加密儲存空間或設定密碼期限。

新的SDK工具則改善了程式編輯上的拖曳功能,提供新動畫框架的預覽,並在該平台的各種版本都提供視覺化的UI介面,強化描繪能力,並對客製化檢視有更好的支援。

Ducrohet指出,這仍是Android 3.0 SDK的預覽版,不論是API或系統映像都非正式版,開發人員可利用此預覽版測試既有的應用程式於平板電腦尺寸的裝置上運作的能力,或是用來熟悉新的UI、API及各種新功能,Google預計數周內就會發表Android 3.0 SDK正式版。

現在已有多家業者引頸期盼Android 3.0正式版以推出採用該平台的平板電腦,包括聯想、華碩及摩托羅拉等。(編譯/陳曉莉)