2018年2月28日 星期三

C/C++面試題目


constant
https://stackoverflow.com/questions/10091825/constant-pointer-vs-pointer-on-a-constant-value

deep-c slides
https://www.slideshare.net/olvemaudal/deep-c/246

lvalue, rvalue
http://hamersun.blogspot.tw/2012/12/c-lvalues-and-rvalues.html

lvalue reference, rvalue reference
http://hamersun.blogspot.tw/2012/12/lvalue-reference-and-rvalue-reference.html

*pointer vs array[]

**pointer, *pointer vs arrar[][]

reference& vs address&

operator overloading

rules of zero/three/five

polymorphism

template

undefined behavior

memory layout
https://blog.gtwang.org/programming/memory-layout-of-c-program/

https://www.youtube.com/channel/UCIm-u7l65hp5jboSJrB7U5w/videos

2018年2月26日 星期一

C變數宣告之解讀方式與const

從右邊開始往回解讀
char * p;
p是個指標指向char
const char *p;
p是個指標指到char,這個char是常數
char const *p;
p是個指標指到一個常數char
const char * p; 等同於 char const * p;
char * const p;
p是個常數指標指向char
char a[16];中的a就像是個 char * const a;一樣
這是為什麼pointer跟array很接近的原因

2018年1月7日 星期日

4G+記錄

Carrier Aggregation
載波聚合
可以同時使用不同頻段以加速無線網路
有人2CA測得200Mbps
聯發科要MT67XX、P10、X20等等才支援
高通要中階以上,s430、s617,s800系列等等等
Cat.x只代表處理器支援的網路速度,和CA無關。單一頻段頻寬夠大,不用CA也能跑到Cat.x的上限
台版紅米不支援CA
使用CA時,網路圖示多會呈現4G+
2CA理論速度225Mbps
3CA理論速度375Mbps
三星可以進Service Mode查詢。進入方式:對*#0011#打電話
Mobile01的peter大整理的表格
Band
頻段
台灣目前常見的4G頻段700/900/1800/2600MHz
低頻訊號好但承載人數少
高頻訊號死角較多但承載人數多,適合室外
LTE UE-Category (Cat)

python env

# Ubuntu
sudo apt install python python-pip python-dev
pip install --user virtualenv
cd ~
ENV_NAME=tensorflow
mkdir ~/${ENV_NAME}
virtualenv --no-site-packages ${ENV_NAME}
source ~/${ENV_NAME}/bin/activate
pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.1-cp27-none-linux_x86_64.whl
#url https://www.tensorflow.org/install/install_linux#the_url_of_the_tensorflow_python_package
pip install jupyter pandas

# Windows
# Make sure you download 64bit version python
pip install tensorflow

2017年2月25日 星期六

Folding@home on Ubuntu16.04 using Nvidia Graphic Card

Install some dependencies
$ wget http://launchpadlibrarian.net/109052632/python-support_1.0.15_all.deb
$ sudo dpkg -i python-support_1.0.15_all.deb
$ sudo apt-get install python-gnome2
Download fahclient and fahcontrol
Install fah program
$ sudo dpkg -i fah*.deb
 Get newest GPUs.txt
$ wget http://fah.stanford.edu/file-releases/public/GPUs.txt
Move to replace the old one
$ mv  GPUs.txt /var/lib/fahclient/
Start to fold

2016年9月28日 星期三

TensorFlow Census predict


如果得到如下的結果
Traceback (most recent call last):
  File "census.py", line 22, in <module>
    print (df_train["income_bracket"].apply(lambda x: ">50K" in x))
  File "/usr/lib/python2.7/dist-packages/pandas/core/series.py", line 2023, in apply
    mapped = lib.map_infer(values, f, convert=convert_dtype)
  File "inference.pyx", line 920, in pandas.lib.map_infer (pandas/lib.c:44780)
  File "census.py", line 22, in <lambda>
    print (df_train["income_bracket"].apply(lambda x: ">50K" in x))
TypeError: argument of type 'float' is not iterable
在read_csv時用skipfooter=2 跳過最後兩行

2016年7月20日 星期三

Install Nvidia driver with dkms may help you

DKMS is Dynamic Kernel Module Support, which can help you when you upgrade your kernel with the out come modules.

To install Nvidia Graphic Card driver with DKMS support, install DKMS first.
$ sudo apt-get install dkms
Then install the driver, take NVIDIA-Linux-x86_64-367.35.run for example
$ chmod +x  NVIDIA-Linux-x86_64-367.35.run
$ sudo sh NVIDIA-Linux-x86_64-367.35.run --dkms
When the installation finish
$ dkms status
You can find  "nvidia, 367.35, 3.19.0-64-generic, x86_64: installed".
And you can build all modules for current kernel by
$ dkms autoinstall
And for a specifi kernel by
$ dkms autoinstall -k 4.4.15 
Or install a module for all kernels
$ dkms install -m nvidia -v 367.35 --all

Reference  https://wiki.archlinux.org/index.php/Dynamic_Kernel_Module_Support