2018年3月22日 星期四

VMware CPU usage is high when I start adb on ubuntu guest

Message from https://communities.vmware.com/thread/505263?start=15&tstart=0
HoboJ Aug 27, 2015 8:38 PM

 I'd like to confirm that this issue exists too. I have Workstation PRO 12 installed on Windows 10, running a Ubuntu 14.04.03 VM. After booting the VM the host machine will show 0% CPU utilization in task manager (for VMware Workstation (32bit)), but if I execute "adb devices" (which also starts the adb server) in the VM the CPU utilization on the host machine starts to slowly increase and after some time the VM becomes unusable. However, if I execute "adb kill-server" before the VM fully hangs, the host CPU utilization drops back to 0%. Note that the high CPU utilization is seen on the host machine, not on the VM after running the "adb devices" command.

Explanation from VMware: (This issue was solved in VMware Workstation 12 Pro Version 12.1.1)
  Starting an ADB daemon in an Ubuntu or Debian guest operating system causes a memory leak, which in turn causes the VMware Workstation window to become less responsive over time.

Refer to:
  1. https://communities.vmware.com/thread/505263
  2. https://communities.vmware.com/thread/505263?start=15&tstart=0
  3. https://docs.vmware.com/en/VMware-Workstation-Pro/12.0/rn/workstation-1211-release-notes.html

2018年3月21日 星期三

How can I connect to Android with ADB over TCPIP?

1. Activate debug mode in Android
2. Connect to pc via USB
3. Get Android Devices' IP address
4. Open Terminal and type ...

adb tcpip 5555
adb connect <device IP>:5555

5. Disconnect USB
6. Now your adb connection is over TCPIP
7. Return adb over USB


adb usb

8. Now your adb connection is over USB

Refer to:
  https://stackoverflow.com/questions/2604727/how-can-i-connect-to-android-with-adb-over-tcp

Bridge wifi to VMware Guest OS




1. Edit / Virtual Network Editor

2. Edit / Virtual Network Editor / Change Setting

3. Select VMnet0 and Click Automatic Setting, Deselect all of Wi-Fi


4. Add Network -- VMnet2 and bind to Wifi


5. Added Network Adapter 2 and bind to VMnet2




Refer to:
 1. https://www.vmware.com/support/ws55/doc/ws_net_configurations_changing_bridged_windows.html





















2018年1月1日 星期一

Raspberry Pi install chinese input and font


1. Config locale


sudo raspi-config
2. Select "Internationalisation Options"
3. Select "Change Locale"
4. Select "en_US.UTF-8" & "zh_TW.UTF-8", and Press "OK"
5. Select "en_US.UTF-8"  or  "zh_TW.UTF-8"  for console
6. Install 酷音中文輸入法

sudo apt-get install scim-chewing
7.  Install 文泉驛微米黑, 文泉驛正黑, 文泉驛點陣宋體 中文字型

sudo apt-get install ttf-wgy-microhei ttf-wgy-zenhei xfonts-wgy
8. Restart


Refer to:
https://blog.gtwang.org/iot/raspberry-pi-chinese-input-method/

Installing Raspberry Pi Image

1. Format SD card to FAT32
2. Download NOOBS from https://www.raspberrypi.org/downloads/
3. Unzipped NOOBS and copy all files to SD root directory
4. Boot Raspberry Pi with SD card
5. Select Raspbian image to install in SD card

2017年12月15日 星期五

“adb devices” command won't detect any android devices


Step 1. Find vendor ID by using "lsusb"
Step 2. Add vendor Id to ~/.android/adb_usb.ini
Step 3. Restart adb
Step 4. Test. Open a terminal to run "sudo adb logcat". Open another terminal to run "sudo adb devices"





2017年11月20日 星期一

Vim Plugin Howto: NERDTree





1. NERDTree
  a. ":NERDTree" to open NERD Tree in vim
  b. "Up" : to move up cursor
  c. "Down" : to move down cursor
  d. "Enter" : to open a directory
  e. "o": to open a file
  e. "H" :to show or hide hidden files
  f. "R" : Refresh the tree, useful if files change outside of Vim
  h. "m" : show the NERD Tree menu
  i. "?" : NERD Tree quick help
  j. ":q" : exit 



Refer to:
  https://medium.com/usevim/nerd-tree-guide-bb22c803dcd2



2. CScope
1. Run cscope
cscope -R -b
2. 


 Ctrl-]  : split horizontal pane (editing new buffer)


 Ctrl-w s or ":spit" : split horizontal pane (editing current buffer)
 Ctrl-w v or ":vsplit" : split vertical pane (editing current buffer)





Refer to:









2017年11月17日 星期五

vim plugin manager : vim-plug


1. Automatic Installation (load plug.vim to ~/.vim/autoload/plug.vim )
Place the following code in your .vimrc before plug#begin() call
if empty(glob('~/.vim/autoload/plug.vim'))
  silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
Note that --sync flag is used to block the execution until the installer finishes.

2. Migrating from other plugin managers
Download plug.vim in autoload directory
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
and update your .vimrc as needed.
With Vundle.vimEquivalent vim-plug configuration
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'junegunn/seoul256.vim'
Plugin 'junegunn/goyo.vim'
Plugin 'junegunn/limelight.vim'
call vundle#end()
filetype plugin indent on
syntax enable
call plug#begin('~/.vim/plugged')
Plug 'junegunn/seoul256.vim'
Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
call plug#end()
vim-plug does not require any extra statement other than plug#begin() and plug#end(). You can remove filetype offfiletype plugin indent on and syntax on from your .vimrc as they are automatically handled by plug#begin() and plug#end().




Refer to:
  https://github.com/junegunn/vim-plug/wiki/faq





Split windows in Vim


1. Splitting panes

 Ctrl-w n  : split horizontal pane (editing new buffer)

 Ctrl-w s or ":spit" : split horizontal pane (editing current buffer)

 Ctrl-w v or ":vsplit" : split vertical pane (editing current buffer)

2. Closing panes

 Ctrl-w c  or ":q": close pane

 Ctrl-w o  : close all panes, only current pane opened


3. Navigating panes

 Ctrl-w w  : switch to next pane
 Ctrl-w p  : switch to previous pane

 Ctrl-w Up  : switch to up pane
 Ctrl-w Down  : switch to down pane

 Ctrl-w Left  : switch to left pane
 Ctrl-w Right  : switch to right pane


Refer to
  http://codeincomplete.com/posts/split-windows-and-tabs-in-vim/




















tmux installation & easy guide

For Ubuntu

tmux installation

sudo apt-get install tmux

Easy Guide

1. Run tmux
tmux
2. All commands in tmux are triggered by a prefix key followed by a command key (quite similar to emacs). By default, tmux uses Ctrl-b as prefix key. Thus Ctrl-b simply means press the Ctrl and b keys at the same time.

3. Splitting panes
 Ctrl-b %  : split horizontal pane

 Ctrl-b "  : split vertical pane

4. Navigating panes
 Ctrl-b Left  : switch to left pane

 Ctrl-b Right  : switch to right pane

 Ctrl-b Up  : switch to up pane

 Ctrl-b Down  : switch to down pane

 Ctrl-b p  : switch to previous pane


 Ctrl-b n  : switch to next pane


5. Adjust pane size
 Ctrl-b Ctrl-Left  : resize horizontal pane

 Ctrl-b Ctrl-Right  : resize horizontal pane

 Ctrl-b Ctrl-Up  : resize vertical pane

 Ctrl-b Ctrl-Down  : resize vertical pane

 Ctrl-b z  : make a pane go full screen or to shrink it back to its previous size


6. Closing panes / window
 Ctrl-b d  or exit : close pane or window



Refer to
  http://www.hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/