Thursday, December 16, 2010

IT Jargons

POC - proof of concept, for proving an preliminary idea feasible

SDLC - software development life cycle

Web service signature:
An interface for connecting functional modules over internet, typically with 10 to 100 calls' signature for a single system.

Four-tier architecture design:
UI + App Service + Data Access Layer (DAL) + Database

ThinkBulbs

A HK startup with iPhone apps business.


http://www.thinkbulbs.com/
http://www.hksilicon.com/kb/articles/3470/iphone6

Wednesday, August 11, 2010

Android Programming Tips

1. Hotkeys in Eclipse
  • Auto-import - Ctrl-Shift-O
  • Auto-format - Ctrl-Shift-F
  • Save - Ctrl-Shift-S
  • Refresh - F5
  • Debug - F11
  • Run - Ctrl-F11 (this hotkey changes the AVD orientation if the focus is on the AVD window) 
2. On-device debug (for running debugger only)
  • Declare your application as "debuggable" in your Android Manifest. In Eclipse, you can do this from the Application tab when viewing the Manifest (on the right side, set Debuggable to true). Otherwise, in the AndroidManifest.xml file, addandroid:debuggable="true" to the <application> element.
  • In your phone, select Settings > Applications > Development > USB debugging. When this option is checked, Windows will detect a new device and prompt for driver update.
  • If you want to deploy your app to a device, make sure no emulator is automatically selected in the "Run Configuration".
3. Activity.findViewById(int id)
  • The id param is an id attribute of view element in xml, not the commonly referred resource id.
  • Retrieve a widget from the layout that is set by setContentView(int). If the widget is not defined in the layout xml file, null will be returned.
  • Different from View.findViewById(int id) which looks for a child view in the hierarchy.
4. inflate(int resource, ViewGroup root)
5. Layout Parameters (layout_width and layout_height)
  • All view groups include a width and height (layout_width and layout_height), and each view is required to define them.
  • fill_parent (renamed match_parent in API Level 8)
6. Dimension measurement units
7. For a list of the widgets provided by Android, see the android.widget package.

8. State List (drawable)
  • During each state change, the state list is traversed top to bottom and the first item that matches the current state is used—the selection is not based on the "best match," but simply the first item that meets the minimum criteria of the state.
9. XML No grammar constraints detected for this document
  • The regular text editor and the Android layout editor should not complain but the XML editor from WTP will sometimes complain because it doesn’t have a DTD or schema to validate and offer code completion against.
  • You can get rid of the warning by going into Window > Preferences > XML > XML Files and setting the “Indicate when no grammar is specified” option to “Ignore”. Then do an XML validation (right-click > Validate) and it should take the warning away.
10. If your application cannot get start, see if you already put all Activities to your AndroidManifest. Activities not in the manifest are not visible to the system!!

11. Common Tasks and How to Do Them in Android

12. Logging
13. ADB
  • To check if a device is active, type "adb devices"
14. Process
  • When the first of an application's components needs to be run, Android starts a Linux process for it with a single thread of execution. By default, all components of the application run in that process and thread.
15. Intent and Intent Filter
  • The DEFAULT category is required for the Context.startActivity method to resolve your activity when its component name is not explicitly specified.
  • Intent filters are not consulted for explicit intents.
16. In android, the method for registering a listener is setXXXListener but not addXXXListener, which actually reflect the truth in android that one cannot attach multiple listeners to a View.
18. Handler
  • When you create a new Handler, it is bound to the thread / message queue of the thread that is creating it -- from that point on, it will deliver messages and runnables to that message queue and execute them as they come out of the message queue.
19. SD Card path
  • 隨著 Android 越來越普及, 軟件數量幾何級上升, 試用新軟件已經成為一種樂趣.

    但當經過一段時間, 用家不難發覺 SD card 的根目錄會變得十分混亂. 因為不同的開發者都有建立自己的文件夾, 當軟件被刪除後文件夾卻留在 SD card 裡. 原來由 Froyo 開始, 開發文件便有提及外存路徑的正確位置, 只要開發者把軟件的存取路徑置為 getExternalFilesDir() 或 " /Android/data/<package_name>/files/", 軟件被刪除的時候文件夾及裡面的內容會被一同刪除 .

    多一個軟件使用正確路徑, 就少一分混亂. 為保持一個良好 SD card 環境, 請各開發者將你下一個更新把軟件使用的文件夾放入正確位置.

    注: 該路徑亦會於 Upgrade 軟件時刪除, 如有大量要保留下載資料的軟件可能不適用.


20. Share Preferences Across Applications



21. LogCat



  • To watch the log of an active device continually: adb logcat
  • To dump the whole log: adb logcat -d
  • To dump the whole log to a file: adb logcat -d > log.txt
  • To filter and display a particular log tag: adb logcat -s MyLogTag

22. Get the system-dependent newline character by this:

  • public static String newline = System.getProperty("line.separator");

23. Good Reference for SQLite Database 

24. Spinner + SimpleCursorAdapter
  • When using SimpleCursorAdapter, the primary key of the querying table must be named '_id'
  • When binding SimpleCursorAdapter to Spinner and calling getSelectedItem() from Spinner, the item returned by this method is the Cursor that pointing to the selected row.
    see also onItemSelected()
25. Toast message can be customized using:

26. Notification Icon Size Guide


27. SQLite default row ID

  • You can access the ROWID of an SQLite table using one the special column names ROWID, _ROWID_, or OID. 


28. Support Video Format