31 December 2014

android file partition

s5

$df
Filesystem                   Size     Used     Free   Blksize
/dev                       845.9M   144.0K   845.7M      4.0K
/sys/fs/cgroup             845.9M    12.0K   845.9M      4.0K
/mnt/secure                845.9M     0.0K   845.9M      4.0K
/mnt/secure/asec           845.9M     0.0K   845.9M      4.0K
/mnt/asec                  845.9M     0.0K   845.9M      4.0K
/mnt/obb                   845.9M     0.0K   845.9M      4.0K
/system                      2.4G     2.3G   139.0M      4.0K
/data                       11.8G     8.2G     3.6G      4.0K
/cache                      31.5M     4.4M    27.1M      4.0K
/persist                     7.9M     4.0M     3.8M      4.0K
/efs                        13.8M     4.3M     9.5M      4.0K
/persdata/absolute           8.8M     4.1M     4.8M      4.0K
/firmware                   77.0M     6.8M    70.2M     16.0K
/firmware-modem             64.0M    52.3M    11.7M     16.0K
/mnt/shell/privatemode      11.8G     8.2G     3.6G      4.0K
/mnt/shell/knox-emulated    11.8G     8.2G     3.6G      4.0K
/mnt/shell/emulated         11.8G     8.2G     3.5G      4.0K



$ mount                                      
[ext4]
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,seclabel,relatime,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 rw,seclabel,nosuid,nodev,noatime,discard,journal_checksum,journal_async_commit,noauto_da_alloc,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 rw,seclabel,nosuid,nodev,noatime,discard,journal_checksum,journal_async_commit,noauto_da_alloc,errors=panic,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 rw,seclabel,nosuid,nodev,noatime,discard,journal_checksum,journal_async_commit,noauto_da_alloc,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/efs /efs ext4 rw,seclabel,nosuid,nodev,noatime,discard,journal_checksum,journal_async_commit,noauto_da_alloc,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/persdata /persdata/absolute ext4 rw,seclabel,nosuid,nodev,relatime,data=ordered 0 0

[vfat]
/dev/block/platform/msm_sdcc.1/by-name/apnhlos /firmware vfat ro,context=u:object_r:firmware:s0,relatime,uid=1000,gid=1000,fmask=0337,dmask=0227,codepage=cp437,iocharset=iso8859-1,shortname=lower,errors=remount-ro 0 0
/dev/block/platform/msm_sdcc.1/by-name/modem /firmware-modem vfat ro,context=u:object_r:firmware:s0,relatime,uid=1000,gid=1000,fmask=0337,dmask=0227,codepage=cp437,iocharset=iso8859-1,shortname=lower,errors=remount-ro 0 0


[sdcardfs [all partition has same size]]
/data/privatemode /mnt/shell/privatemode sdcardfs rw,nosuid,nodev,relatime,uid=1000,gid=1000,derive=none 0 0
/data/knox/sdcard /mnt/shell/knox-emulated sdcardfs rw,nosuid,nodev,relatime,uid=1000,gid=1000,derive=none 0 0
/data/media /mnt/shell/emulated sdcardfs rw,nosuid,nodev,relatime,uid=1023,gid=1023,derive=legacy,reserved=20MB 0 0

[tmpfs [all partition has same size]]
tmpfs /dev tmpfs rw,seclabel,nosuid,relatime,size=866180k,nr_inodes=128706,mode=755 0 0
none /sys/fs/cgroup tmpfs rw,seclabel,relatime,size=866180k,nr_inodes=128706,mode=750,gid=1000 0 0
tmpfs /mnt/secure tmpfs rw,seclabel,relatime,size=866180k,nr_inodes=128706,mode=700 0 0
tmpfs /mnt/secure/asec tmpfs rw,seclabel,relatime,size=866180k,nr_inodes=128706,mode=700 0 0
tmpfs /mnt/asec tmpfs rw,seclabel,relatime,size=866180k,nr_inodes=128706,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,seclabel,relatime,size=866180k,nr_inodes=128706,mode=755,gid=1000 0 0

[below not mention in df]
rootfs / rootfs ro,relatime 0 0
devpts /dev/pts devpts rw,seclabel,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,seclabel,relatime 0 0
selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0



--------------------------------

cm11 s5

Filesystem               Size     Used     Free   Blksize
/dev                   846.4M   132.0K   846.2M   4096
/sys/fs/cgroup         846.4M    12.0K   846.4M   4096
/mnt/asec              846.4M     0.0K   846.4M   4096
/mnt/obb               846.4M     0.0K   846.4M   4096
/mnt/fuse              846.4M     0.0K   846.4M   4096
/system                  2.4G   670.5M     1.7G   4096
/data                   11.8G     6.8G     5.0G   4096
/cache                 196.7M     4.9M   191.8M   4096
/firmware               77.0M     6.8M    70.2M   16384
/firmware-modem         64.0M    52.3M    11.7M   16384
/persist                 7.9M     4.0M     3.8M   4096
/efs                    13.8M     4.3M     9.5M   4096
/persdata/absolute       8.8M     4.1M     4.8M   4096
/mnt/shell/emulated     11.8G     6.8G     5.0G   4096



$mount
[ext4]
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 rw,seclabel,relatime,errors=panic,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 rw,seclabel,nosuid,nodev,noatime,journal_checksum,journal_async_commit,noauto_da_alloc,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 rw,seclabel,nosuid,nodev,relatime,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 rw,seclabel,nosuid,nodev,noatime,journal_checksum,journal_async_commit,noauto_da_alloc,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/efs /efs ext4 rw,seclabel,nosuid,nodev,noatime,journal_checksum,journal_async_commit,noauto_da_alloc,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/persdata /persdata/absolute ext4 rw,seclabel,nosuid,nodev,relatime,data=ordered 0 0

[vfat]
/dev/block/platform/msm_sdcc.1/by-name/apnhlos /firmware vfat ro,context=u:object_r:firmware_file:s0,relatime,uid=1000,gid=1026,fmask=0337,dmask=0227,codepage=cp437,iocharset=iso8859-1,shortname=lower,errors=remount-ro 0 0
/dev/block/platform/msm_sdcc.1/by-name/modem /firmware-modem vfat ro,context=u:object_r:firmware_file:s0,relatime,uid=1000,gid=1026,fmask=0337,dmask=0227,codepage=cp437,iocharset=iso8859-1,shortname=lower,errors=remount-ro 0 0

[fuse]
/dev/fuse /mnt/shell/emulated fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0

[tmpfs  [all partition has same size]]
tmpfs /dev tmpfs rw,seclabel,nosuid,relatime,size=866688k,nr_inodes=128961,mode=755 0 0
none /sys/fs/cgroup tmpfs rw,seclabel,relatime,size=866688k,nr_inodes=128961,mode=750,gid=1000 0 0
tmpfs /mnt/asec tmpfs rw,seclabel,relatime,size=866688k,nr_inodes=128961,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,seclabel,relatime,size=866688k,nr_inodes=128961,mode=755,gid=1000 0 0
tmpfs /mnt/fuse tmpfs rw,seclabel,relatime,size=866688k,nr_inodes=128961,mode=775,gid=1000 0 0
-----------------
[not in mention in df]
rootfs / rootfs ro,relatime 0 0
devpts /dev/pts devpts rw,seclabel,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,seclabel,relatime 0 0
selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
/sys/kernel/debug /sys/kernel/debug debugfs rw,relatime 0 0

30 December 2014

android /systemp/build.prop

S5 file = /system/build.prop

ro.build.id=KOT49H
ro.build.display.id=KOT49H.G900FXXUANI4
ro.build.version.sdk=19
ro.build.version.codename=REL
ro.build.version.release=4.4.2

ro.product.name=kltexx
ro.product.device=klte
ro.product.board=MSM8974
ro.product.platform=msm8974
ro.product.cpu.abi=armeabi-v7a
ro.product.cpu.abi2=armeabi
ro.product.locale.language=en
ro.product.locale.region=GB
ro.product.model=SM-G900F
#  ro.build.product is obselete
ro.build.product=klte

joomla 3, cheat sheet

1)  dapatkan component options
$params = JFactory::getApplication()->getParams();
$google_apps_domain = $params->get('google_apps_domain'); 
  -variable 'google_apps_domain' define dalam administrator/components/com_mycomponent/config.xml

04 December 2014

zygote fork

Q. how does zygote exactly fork Dalvik VM?
Short Answer: Zygote process basically cold boots a VM on system start up. Once done, it listens to a socket for incoming commands. Other processes (e.g. ActivityManagerService) writes commands to this socket, whenever it needs a new process for an application. This command is read by the Zygote process and calls fork() - so the child process now gets a pre-warmed up VM in which to run. This is how zygote forks the Dalvik VM.
Long answer: (this could be really long) After kernel is loaded, init.rc is parsed and native services are started. With this, the /system/bin/app_process (Source code:frameworks/base/cmds/app_process/app_main.cpp) is run. This eventually calls AndroidRuntime.start() function (Source code: frameworks/base/core/jni/AndroidRuntime.cpp), passing it the parameters com.android.internal.os.ZygoteInit and start-system-server.
The AndroidRuntime.start() starts the Java VM, then calls ZygoteInit.main() (Source code:frameworks/base/core/java/com/android/internal/os/ZygoteInit.java), passing it the parameter start-system-server.
ZygoteInit.main() first registers the zygote socket (the zygote process listens to a socket for incoming commands, and on receiving new command, spawns a new process as requested). Next thing that happens is, it preloads a lot of classes (which is listed in frameworks/base/preloaded-classes, last I checked, 2307 lines, in android 4.0.4) and all the system-wide resources like drawables, xmls, etc. Then it calls startSystemServer() which forks a new process for com.android.server.SystemServer(Source code: frameworks/base/services/java/com/android/server/SystemServer.java). Forking of system server is a special case, because in all other cases, zygote process listens to a socket and forks for new commands, as we will see soon.
After SystemServer is forked, a function runSelectLoopMode() is called. This is a while(true) loop which basically establishes a ZygoteConnection with the zygote socket and waits for commands on it. When a command is received, ZygoteConnection.runOnce() is called (Source code:frameworks/base/core/java/com/android/internal/os/ZygoteConnection.java)
ZygoteConnection.runOnce() calls Zygote.forkAndSpecialize() (Source code:libcore/dalvik/src/main/java/dalvik/system/Zygote.java) which simply calls a natvie function to do the fork. Thus, like in the case of SystemServer, a child process is created which has a pre-warmed up Dalvik for itself.
Q. why it is not possible to run multiple applications in the same Dalvik VM?
This is a design decision as far as I know. Android guys just decided to fork a new VM per process, for security via sandboxing.




ref: http://stackoverflow.com/questions/9153166/understanding-android-zygote-and-dalvikvm

03 December 2014

git: lokasi asal (remote)

git branch -a
git remote show
git remote show origin

or

cat manifests.git/config 
[core]
        repositoryformatversion = 0
        filemode = true
[remote "origin"]
        url = /usr/local/aosp/mirror/platform/manifest.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "default"]
        remote = origin
        merge = android-4.4.2_r1
[user]
        email = siperdana@gmail.com

masalah compile android


  1. semak version java* dan jar* dalam:
    • /etc/alternatives/jar*
    • /etc/alternatives/java*
    • pastikan semua guna version sama (on ubuntu12.04):
    • /etc/alternatives/jar -> /usr/lib/jvm/java-6-oracle/bin/jar*
    • /etc/alternatives/jarsigner -> /usr/lib/jvm/java-6-oracle/bin/jarsigner*
  2. package com.sun.javadoc does not exist 
    • export PATH=/home/rev/BIN/jdk-6u34/jdk1.6.0_34/bin/:$PATH
    • buang / lepas bin
    • export PATH=/home/rev/BIN/jdk-6u34/jdk1.6.0_34/bin:$PATH 



01 December 2014

root dengan odin

http://www.ibtimes.com/how-root-samsung-galaxy-s5-all-models-android-442-kitkat-using-cf-auto-root-tutorial-1577576

vnc on ubuntu server

ref: http://rbgeek.wordpress.com/2012/06/25/how-to-install-vnc-server-on-ubuntu-server-12-04/

ubuntu 14.04
http://www.howtoforge.com/how-to-install-vnc-server-on-ubuntu-14.04

21 November 2014

tambah syscall sendiri

Cara nak tambah syscall sendiri ke dalam linux kernel. Melibatkan recompile kernel

////////////////////////////////////////////////////////////////////////////////////
// 1)  source_path/arch/x86/syscalls/syscall_32.tbl
# The format is:
#
356     i386    memfd_create            sys_memfd_create
357     i386     mhsyscall            sys_mhsyscall  ( new line)


////////////////////////////////////////////////////////////////////////////////////
// 2)  source_path/include/linux/syscalls.h

// last line
asmlinkage long sys_opsyscall(const char *test);
#endif

////////////////////////////////////////////////////////////////////////////////////
// 3)   source_path/mhsyscall/mhfzsyscall.c   ( nama c file suka hati)

#include
#include

//The system call
asmlinkage long sys_mhsyscall(const char *test)
{
   printk(KERN_ALERT "Called with string: %s\n", test);
   // 0 for success
   return 0;
}





////////////////////////////////////////////////////////////////////
// 4)   source_path/mhsyscall/Makefile

// Include the object in the kernel core
obj-y := mhfzsyscall.o


/////////////////////////////////////////////////////////////////////////
// 5)    source_path/Makefile

# Objects we will link into vmlinux / subdirs we need to visit
init-y          := init/
drivers-y       := drivers/ sound/ firmware/
net-y           := net/
libs-y          := lib/
core-y          := usr/ mhsyscall/   ( edit line )




//////////////////////////////////////////////////////////////
// 6)  compile
# make


///////////////////////////////////////////////////////
//  7) userspace binary to call mhsyscall (pemanggil.c)

#include

int main(){
   syscall(357, "Mesage from user space program");
   return 0;
}
//  gcc -o pemanggil pemanggil.c



ref https://www.youtube.com/watch?v=5rr_VoQCOgE&feature=youtu.be

20 November 2014

aosp mirror

These instructions assume that the mirror is created in /usr/local/aosp/mirror. The first step is to create and sync the mirror itself, which uses close to 13GB of network bandwidth and a similar amount of disk space. Notice the --mirror flag, which can only be specified when creating a new client:
$ mkdir -p /usr/local/aosp/mirror
$ cd /usr/local/aosp/mirror
$ repo init -u https://android.googlesource.com/mirror/manifest --mirror
$ repo sync
Once the mirror is synced, new clients can be created from it. Note that it's important to specify an absolute path:
$ mkdir -p /usr/local/aosp/kitkat
$ cd /usr/local/aosp/kitkat
$ repo init -u /usr/local/aosp/mirror/platform/manifest.git -b android-4.4.4
$ repo sync
Finally, to sync a client against the server, the mirror needs to be synced against the server, then the client against the mirror:
$ cd /usr/local/aosp/mirror
$ repo sync
$ cd /usr/local/aosp/kitkat
$ repo sync



ref:  http://stackoverflow.com/questions/15870217/android-source-code-and-repo-what-exactly-is-happening-when-getting-code

18 November 2014

android system_process

android 4.3.1_r1


frameworks/base/services/java/com/android/server/SystemServer.java


frameworks/base/core/java/android/app/ActivityThread.java:4977:            android.ddm.DdmHandleAppName.setAppName("system_process",

06 November 2014

android selfnote

1) getPackageManager().queryBroadcastReceivers(it,0) hanya bergantung pada AndroidManifest
  • Dynamically registered(in code via registerReceiver) tak dapat kenal
2) pm.getInstalledPackages(PackageManager.GET_DISABLED_COMPONENTS | PackageManager.GET_RECEIVERS)

  • Dynamically registered(in code via registerReceiver) tak dapat kenal

  • 3)  Extended class
    • PackageItemInfo
      • ComponentInfo
        • ActivityInfo
    • so >>  ActivityInfo = PackageItemInfo;  // is allowed

    Start Intent dari ResolveInfo

    Get ResolveInfo dari queryBroadcastReceivers()


    Given a ResolveInfo named launchable:
    ActivityInfo activity=launchable.activityInfo;
    ComponentName name=new ComponentName(activity.applicationInfo.packageName,
                                         activity.name);
    Intent i=new Intent(Intent.ACTION_MAIN);
    
    i.addCategory(Intent.CATEGORY_LAUNCHER);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
                Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
    i.setComponent(name);
    
    startActivity(i);

    ref: http://stackoverflow.com/questions/12504954/how-to-start-an-intent-from-a-resolveinfo



    05 November 2014

    install Gapps (Google Play) dalam emulator

    http://stackoverflow.com/questions/11154222/google-play-on-android-4-0-emulator



    1) list avd

    • tukar default home dir for ANDROID_SDK_HOME
      • ANDROID_SDK_HOME="/home/my_home/"
    • android list avd


    2) open avd with specific system partition size

    emulator -avd VM_NAME_HERE -partition-size 500 -no-audio -no-boot-anim



    3) download gapp(names ~ gapps-jb-20130813-signed.zip)
    • http://wiki.rootzwiki.com/Google_Apps#Universal_Packages_2



    4) 
    # Remount in rw mode
    adb shell mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system
    
    # Allow writing to app directory on system partition
    adb shell chmod 777 /system/app
    
    # Install following apk
    adb push GoogleLoginService.apk /system/app/.
    adb push GoogleServicesFramework.apk /system/app/.
    adb push Phonesky.apk /system/app/. # Vending.apk in older versions
    adb shell rm /system/app/SdkSetup*





    ref :http://stackoverflow.com/questions/11154222/google-play-on-android-4-0-emulator

    04 November 2014

    dnsmasq: forward ke dns berbeza, bergantung domain

    1) file /etc/resolv.conf
    # local dnsmasq server
    nameserver 127.0.0.1
    
    # Your main dns server (dnsmasq will forward all requests to this server)
    nameserver 10.20.1.1

    2) file /etc/dnsmasq.conf
    # Tells dnsmasq to forward anything with the domain of remote.local to dns server 10.25.11.2
    server=/remote.local/10.25.11.2
    
    # Listen to requests only coming from the local machine
    listen-address=127.0.0.1
    
    # Do not cache anything
    # A decent dns server will already cache for your local network
    cache-size=0



    ref: http://pyther.net/2010/12/dns-conditional-forwarding-dnsmasq/ 

    02 September 2014

    install vmware workstation on 14.04 ubuntu

    http://askubuntu.com/questions/449629/error-installing-vmware-workstation-on-ubuntu

    20 August 2014

    vCenter Server Web Service Restart

    Kadang-kadang browser tak bleh buka https://vCenter.local/vsphere-client/

    kena restart service berikut.

    1) VMware VirtualCenter Server
    2) VMware VirtualCenter Management Webservices (ini depend yg atas)

    04 July 2014

    Android Build Process

    [Java Source Code.]
          |
          | (javac)
          |
    [Java class Files]
          |
          | (dx)
          |
    [classes.dex]
          |
          | (apkbuilder)
          |
    [App-unaligned.apk]
          |
          | (zipalign)
          |
    [Apk.apk]


    [BinaryOutputs]
    (tools)

    04 June 2014

    Android Binder

    Actor:

    • ServiceManager
    • ServiceProvider (class service)
    • ServiceUser (class activity, or any which call another service)


    1. SeriveManager mesti yg pertama start.
      Daftar dengan BinderDriver, guna handle 0.
    2. ServiceProvider bila start register dengan BinderDriver.
      Binder akan generate handle, eg 10.
      ServiceManager simpan nama service dan handle.
    3. Client akan guna handle 0 utk comunicate dengan ServiceManager.
      Client request base on service Name.
      ServiceManager akan beritahu no handle.
      Client talk using the handle through Binder


    04 April 2014

    Android cmd



    • pm
      • pm install /sdcard/myapk.apk
      • pm list packages | grep my
      • pm path com.myapk
    • top
    • ps
    • mount
      • mount -o rw,remount -t "filesystem" "Device" "Mount Point"
        • mount -o rw,remount -t rootfs /
        • mount -o rw,remount -t yaffs2 /dev/block/mtdblock4 /system

        • busybox mount -o remount,rw /system
        • mount -o loop /sdcard/myimage.img myimage
      • getprop


      ref : http://android.stackexchange.com/questions/11052/what-useful-android-shell-commands-do-you-know

      02 April 2014

      Android Terms

      Factory Reset

      • /system  tak usik
      • /data padam
      • /cache padam
      • /sdcard  tak usik
      # hati hati kalau dah install custom ROM atau root. Biasanya ok, tapi kadang kadang boleh menjadikan telefon 'brick'


      GSM vs CDMA

      - Global System for Mobile Communications
      - Ada SIM kad, senang tukar device.
      - Kat US, telefon murah, tapi carrief 'lock' device
      - - user tak boleh guna SIM kad company lain. (kecuali setelah unlock dulu)


      BootLoader
      - Secara mudah, boleh anggap telefon android spt harddisk
      - Ada beberapa partition
      - - /system   : Operating System(linux)
      - - /data       : Data utk aps
      - - dan lain-lain
      - bootloader: program yg mula bila phone boot/hidup
      - bootloader akan decide nak run program dari partition mana.
      - bootloader ditulis oleh pengilang, sgt spesifik kepada device

      25 March 2014

      Install Cyanogenmod

      Jgn guna cwm, tapi twrp utk custom recover.

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

      stable : cm-10.2 (cm-11 belum stable)

      tools:
      -fastboot

      • fastboot flash recovery TWRPrecovery.img 
      • fastboot erase cache
      • ---

      • fastboot flash boot insert_your_boot_image_name_here.img
      • fastboot erase cache

      -adb
      • adb reboot-bootloader

      19 March 2014

      Android Threading

      - AsyncTask tak boleh execute AsyncTask yg lain.
      - IntentService tak boleh panggil IntentService yg lain
      -AsyncTask, IntentService, Service & Thread boleh panggil Service atau Thread
      #(Rujuk row 'Triggered From')





      ServiceThreadIntentServiceAsyncTask
      When to use ?Task with no UI, but shouldn't be too long. Use threads within service for long tasks.- Long task in general.

      - For tasks in parallel use Multiple threads (traditional mechanisms)
      - Long task usually with no communication to main thread.
      (Update)- If communication is required, can use main thread handler or broadcast intents[3]

      - When callbacks are needed (Intent triggered tasks). 
      - Long task having to communicate with main thread.

      - For tasks in parallel use multiple instances OR Executor [1]
      TriggerCall to method
      onStartService()
      Thread start() methodIntentCall to method execute()
      Triggered From (thread)Any threadAny ThreadMain Thread (Intent is received on main thread and then worker thread is spawed)Main Thread
      Runs On (thread)Main ThreadIts own threadSeparate worker threadWorker thread. However, Main thread methods may be invoked in between to publish progress.
      Limitations /
      Drawbacks
      May block main thread- Manual thread management

      - Code may become difficult to read
      - Cannot run tasks in parallel.

      - Multiple intents are queued on the same worker thread.
      - one instance can only be executed once (hence cannot run in a loop) [2]

      - Must be created and executed from the Main thread


      ref: http://techtej.blogspot.com.es/2011/03/android-thread-constructspart-4.html

      20 February 2014

      apk: analysis

      1) apktool ( apktool d filename.apk)

      • convert apk to human readable
        • AndroidManifest.xml    
        • .smali(class file into java byte code)
      2)  dex2jar (d2j-dex2jar.sh filename.apk)
      • convert apk to standard jar file.

      3) jd-gui
      • convert jar(.class) file to java code
      • (NO AndroidManifest.xml; need to use apktool)




      ref:  http://blog.nviso.be/2013/06/step-by-step-analysis-of-android.html

      apk: jd-gui

      1) running jd-gui yield error on ubuntu 13.10
      • "error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory"
      2) Perlu  install ia32-libs-gtk
      • sudo apt-get install ia32-libs-gtk

      3) Tapi pada Ubuntu saucy 13.10, akan error
      • E: Package 'ia32-libs' has no installation candidate

      4) sudo apt-get install libgtk2.0-0:i386



      ref::  http://wiki.phoenixviewer.com/ia32-libs-in-ubuntu-13-10

      23 January 2014

      Logical Volume

      usefull command:
      • lvs
      • fdisk
        • create partition with Label ID: 8e
      • pvcreate
      • vgcreate    (utk tambah saiz, tak perlu yg ini)
      • lvcreate
      • vgextend 
        • vgextend vg_data /dev/sda6
      • lvextend
        • lvextend -L +100G /dev/mapper/vg_data /dev/sda6
      • resize2fs
        • resize2fs /dev/mapper/vg_data-lvdata
      • other
        • vgdisplay
        • lvdisplay
        • pvdisplay

      Ringkasan:
      1) create partition baru, type 8e
      2) create volume group guna partition itu
      3) create logical volume(guna semua saiz partition atau sebahagian)
      4) jika hanya guna sebahagian, nanti bila dah penuh boleh extend(dengan lvextend)

      Besarkan saiz guna partition baru(berlainan):
      1) add partition baru ke volume group sedia ada (vgextend)
      2) besarkan logical volume, guna ruang dari partition baru
              lvextend -L +G /dev/mapper/vg_data /dev/sda6
      3) resize file system (resize2fs)

      ref>>  http://www.linuxuser.co.uk/features/resize-your-disks-on-the-fly-with-lvm
      ref>> http://stackoverflow.com/questions/16515739/extending-logical-volume-in-ubuntu


      09 January 2014

      masalah ps | grep dalam crontab

      guna ps -auxww | grep cari

      bila run dalam cron, job tak attach pada tty/pty, maka tak tahu berapa saiz lebar screen. Jadi tambah parameter 'ww' pada ps:    ps -auxww | grep cari.


      ref: http://unix.derkeiler.com/Newsgroups/comp.unix.bsd.freebsd.misc/2006-09/msg00102.html