Arrays in Java are also objects.we use the following syntax:
int[ ] arry; // There is no size
We create new size like below
arry = new int[5]
To show array length
arry.length
To see the array value
int[ ] arry = { 1, 2, 3, 4, 5}
or
arry[1] = 20;
Here is example code :
public class Demo {
public static void main(String[ ] args) {
int[ ] arry ;
arry = new int[5];
arry[0] = 33;
arry[1] = 34;
arry[2] = 35;
arry[3] = 36;
arry[3] = 37;
for ( int i = 0; i < arry.length; i++)
{
System.out.println(arry[i]);
}
}
}
2015年5月12日 星期二
2013年6月5日 星期三
mount samba on ubuntu
sudo mount.cifs //hostname/sharename ~/mounts/sharename -o user=username,pass=password
sshfs on ubuntu
Use sshfs instead, there is no setup necessary at all and you get "proper" mount points that are recognized by any application:
sudo apt-get install sshfs
Mount the remote filesystem withsshfs user@host:/path /local/mount/point
and unmount withfusermount -u /local/mount/point
2013年5月9日 星期四
更新git
使用的是ubuntu 10.04,出現這個問題
fatal: git 1.7.2 or later required
git版本太舊
處理的方法如下:
$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt-get update
$ sudo apt-get install git
就可以更新到新版的git
fatal: git 1.7.2 or later required
git版本太舊
處理的方法如下:
$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt-get update
$ sudo apt-get install git
就可以更新到新版的git
2013年4月3日 星期三
Android CTS test
step1 : download tool ;
http://source.android.com/compatibility/cts-intro.html
step2:
http://source.android.com/compatibility/cts-intro.html
step2:
Added the below in cts-tradefed
CTS_ROOT=/home/test/projects/cts
CTS/android-cts/tools$ ./cts-tradefed
cts-tf > run cts -c
android.permission2.cts.ProtectedBroadcastsTest -m testSendProtectedBroadcasts
2013年3月25日 星期一
git auto completion
git clone git://git.kernel.org/pub/scm/git/git.git
$cp git/contrib/completion/git-completion.bash ~/.git-completion.bash
在 .bashrc 中加入:
source ~/.git-completion.bash
$ git coconfig commit
2013年3月4日 星期一
Bluetooth Profile
http://www.palowireless.com/infotooth/tutorial/profiles.asp
https://support.google.com/android/bin/answer.py?hl=en&answer=1650159
http://processors.wiki.ti.com/index.php/Android-Adding_Bluetooth_Profile
https://support.google.com/android/bin/answer.py?hl=en&answer=1650159
http://processors.wiki.ti.com/index.php/Android-Adding_Bluetooth_Profile
2012年11月5日 星期一
2012年10月16日 星期二
Driver: update firmware metho
http://www.makelinux.net/ldd3/chp-14-sect-8
http://www.mjmwired.net/kernel/Documentation/firmware_class/
/sys/class/firmware
http://www.mjmwired.net/kernel/Documentation/firmware_class/
/sys/class/firmware
#includeint request_firmware(const struct firmware **fw, char *name, struct device *device);
struct firmware {
size_t size;
u8 *data;
};
void release_firmware(struct firmware *fw);
2012年10月15日 星期一
2012年10月10日 星期三
trick : vi and cscope
vi
cscope
- CTRL-] : 檢索游標所在位置的函式(或變數),跳到函式本體或變數定義的地方
- CTRL-O : 跳回前一個游標的位置 (Go to older cursor position in jump list)
- CTRL-I : 跳到下一個游標的位置 (Go to newer cursor position in jump list)
-
CTRL-N-P : 在 Insert mode 下按住 CTRL,連續輸入 n,p,會出現如下畫面的選單讓我們挑選函式(或變數)
cscope
Ctrl+[ s "s表Symbol,列出所有參考到游標所在字串的地方,包含定義和呼叫。
ctrl+[ g "g表Global,與ctags的Ctrl+]相同。
ctrl+[ c "c表Call,列出所有以游標所在字串當函數名的地方。
ctrl+[ t "t表Text,列出專案中所有出現游標所在字串的地方。
ctrl+[ f "f表File,以游標所在字串當檔名,開啟之。
ctrl+[ i "i表Include,以游標所在字串當檔名,列出所有include此檔的檔案。
ctrl+[ d "d表calleD,以游標所在字串當函式名,列出所有此函式呼叫的函式。
2012年10月9日 星期二
2012年9月27日 星期四
ubuntu :setup 中文輸入 gcin
1. system -> Admin -> package manager -> gcin
2. Terminal
$im-switch -s gcin
3. reboot
2. Terminal
$im-switch -s gcin
3. reboot
2012年9月12日 星期三
ubuntu 11.10: change gcc for build android
$sudo apt-get install gcc-4.4 g++-4.4 gcc-4.4-multilib g++-4.4-multilib
$sudo update-alternatives --install \
/usr/bin/gcc gcc /usr/bin/gcc-4.6 60 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.6
$sudo update-alternatives --install \
/usr/bin/gcc gcc /usr/bin/gcc-4.4 40 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.4
$sudo update-alternatives --config gcc
$gcc -v
$g++ -v
$sudo update-alternatives --install \
/usr/bin/gcc gcc /usr/bin/gcc-4.6 60 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.6
$sudo update-alternatives --install \
/usr/bin/gcc gcc /usr/bin/gcc-4.4 40 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.4
$sudo update-alternatives --config gcc
$gcc -v
$g++ -v
2012年8月19日 星期日
2012年8月12日 星期日
repo:Change branch in existed repo directory
Get code with a manifest in branch ABC:
#cd .repo/manifests
#git pull
#git checkout -b ABC origin/ABC
#cd ../..
#repo sync -d
#repo start NEW_BRANCH --all
2012年7月25日 星期三
android: how to see LOGV message
In your code add
#define LOG_NDEBUG 0
The reason is log.h at system/core/include/cutils/log.h
Ex:
In you want to see LOGV in audio_hw.c
You must add
#define LOG_TAG "audio_hw_primary"
#define LOG_NDEBUG 0
#define LOG_NDEBUG_FUNCTION
#ifndef LOG_NDEBUG_FUNCTION
#define LOGFUNC(...) ((void)0)
#else
#define LOGFUNC(...) (LOGV(__VA_ARGS__))
#endif
android: Filter logcat to get only you want message
adb -d logcat your_package_name:log_level *:S ex: adb -d logcat com.example.example:I *:Sreference:
http://stackoverflow.com/questions/6854127/filter-logcat-to-get-only-the-messages-from-my-application-in-android
訂閱:
文章 (Atom)