顯示具有 Command 標籤的文章。 顯示所有文章
顯示具有 Command 標籤的文章。 顯示所有文章

2017年7月24日 星期一

Rename a directory in a Git repository

Reference:

https://stackoverflow.com/questions/11183788/in-a-git-repository-how-to-properly-rename-a-directory

Command:

git mv <old name> <new name>

Example:
Rename the directory from source to target

git mv source tmp
git mv tmp target

2016年3月7日 星期一

Send android broadcast by adb

Reference:

http://blog.csdn.net/yelangjueqi/article/details/43231425

Command:

adb shell am broadcast:

[-a <ACTION>]
[-d <DATA_URI>]
[-t <MIME_TYPE>]
[-c <CATEGORY> [-c <CATEGORY>] ...]
[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
[-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
[-n <COMPONENT>]
[-f <FLAGS>] [<URI>]

Example:
adb shell am broadcast -a com.android.test --es test_string "this is test string" --ei test_int 100 --ez test_boolean true

2015年11月5日 星期四

How to solve "adb server is out of date.killing" problem

Reference:
http://yeeapps.com/11/news_detial.php?news_id=adb%20server%20is%20out%20of%20date.killing%E7%9A%84%E8%A7%A3%E6%B1%BA%E6%96%B9%E6%B3%95

Step:
1. 在cmd中執行adb nodaemon server,查看adb的埠號是多少,一般情況下是5037
2. 再執行netstat -ano | findstr "5037",找出佔據埠號5037的程序,並記錄其 PID
3. 到工作管理員中,將同一個 PID的程序刪除

2015年7月14日 星期二

Install Java JDK on Ubuntu

Refernece:

http://www.dotblogs.com.tw/jhsiao/archive/2013/09/03/116186.aspx


Step1.首先到Oracle官網上下載,最新版的"jdk-7u25-linux-x64.tar.gz" or "jdk-7u25-linux-i586.tar.gz"
          (事先建立一個Downloads的資料夾,下載的東西都可放這裡面集中。)
Step2.將下載下來的JDK檔進行解壓縮,指令:tar -zxvf jdk-7u25-linux-i586.tar.gz
Step3.複製解壓縮後的資料夾jdk_1.7.0_25,到/usr/lib/jdk/目錄下面,指令:cp -r ~/Downloads/jdk1.7.0_25/ /usr/lib/jdk/
          (這裡如果沒有jdk資料夾,則建立該資料夾,指令:sudo mkdir /usr/lib/jdk)
Step4.設置環境變數,打開文件/etc/profile,指令:sudo vi /etc/profile
Step5.
在文件的最後端加上:
export JAVA_HOME=/usr/lib/jdk/jdk1.7.0_25 
export JRE_HOME=/usr/lib/jdk/jdk1.7.0_25/jre 
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
Step6.將系統默認的jdk修改過來,也就是java和javac指令由系統自帶的換成你自己安裝的
指令:
sudo update-alternatives --install /usr/bin/java java /usr/lib/jdk/jdk1.7.0_25/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jdk/jdk1.7.0_25/bin/javac 300
sudo update-alternatives --config java
sudo update-alternatives --config javac
Step7.檢查版本,指令:java -version
如果出現以下字樣,代表順利完成安裝。
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) Server VM (build 23.25-b01, mixed mode)

Installing Android Studio behind Proxy on Ubuntu

l操作步驟:

1. 進入 ${android-studio path}/bin
    Ex: ~/Program/android-studio/bin
2. 編輯  idea.properties
    vi idea.properties
    在檔案尾端加入下列這行並儲存檔案
     disable.android.first.run=true
3. 執行執行Studio
    ./Program/android-studio/bi/studio.sh
4. 進入進入Studio後 從跳出的視窗進行進行proxy設定
    Configure > Settings > Appearance & Behavior > System Settings > HTTP Proxy
5. 關閉Studio
6.  編輯 idea.properties 將步驟2加入的那行刪除並儲存
7.  重新啟動Studio
     

Reference:

http://mayneax.blogspot.tw/2015/01/installing-android-studio-behind-proxy.html


Navigate to the android-studio/bin directory

you need to edit  idea.properties script to skip the initial set up page

so run vi idea.properties
and add this line at the end of the script

disable.android.first.run=true

save the script and the run
 ./studio.sh

 On the window that appears go to Configure>System Settings>http proxy  then set your proxy.

Exit and then edit idea.properties file and remove the line you added, then run

./studio.sh

2015年7月1日 星期三

Enable/Disable SELinux by command

SELinux 可以使用setenforce 0/1來切換mode.
<Permissive mode>
$setenforce 0
<Enforcing mode>
$setenforce 1


SELinux 可以使用getenforce 0/1讀取mode.
Ex:
shell@hollyds:/ # getenforce
getenforce
Enforcing