2010年6月1日 星期二

常見的Coding Style

下面列出一些網路上的coding style,有興趣可以參考一下:

Linux Coding Style

Android Code Style Guildlines

C++ Programming/Code/Style Conventions

Mozilla Coding Style

Code Conventions for the Java Programming Language

Object Pascal Style Guide


要記得errno的存在!!

不知道是沒睡醒還是在恍神
compile總是出現warning
直說我的func_xxx不是prototype

突然看到密密麻麻的func param當中出現了一個很閃的字眼 errno
OMG....趕快改掉吧 XD

2010年5月27日 星期四

165反詐騙網站的daily report

不想接某些電話的時候
可以順便search一下是不是已經出現在報表裡頭了

話說這幾天常常被同一支號碼煩
查了一下,竟然是最近被檢舉次數第一名的門號,還真有點準.....

報表網址:http://net165.erufa.com/outtext.php

Roomba Life

這篇主要紀錄著Roomba相關的網路資訊


2010年5月26日 星期三

Test harness/Test stubs/Test instrumentation的區別

* Test harness " a contrived code that executes the test cases which are invented to test the unit under test

* Test stubs " optional functions (or macros) created to replace functions (or macros) called from the unit under test (UUT) to abstract from the actual behaviors of the real functions.

* Test instrumentation " code plugged into the UUT to expose its behaviors normally not visible from the outside and to output "documentable" traces of execution.

參考文章:http://www.embedded.com/design/201805598

=================================================

In software testing, a test harness or automated test framework is a collection of software and test data configured to test a program unit by running it under varying conditions and monitoring its behavior and outputs.

It has two main parts: the Test execution engine and the Test script repository.


DUT, UUT, SUT的區別

DUT: device under test
UUT: unit under test
SUT: system under test

Device under test (DUT), also known as unit under test (UUT), is a term commonly used to refer to a manufactured product undergoing testing.

System under test (SUT) refers to a system that is being tested for correct operation. The term is used mostly in software testing. The term SUT means also a stage of maturity of the software, because a system test is the successor of integration test in the testing cycle.

2010年5月20日 星期四

Word也可以用滑鼠放大縮小頁面比例

剛剛無意中發現
慣用了MAC的滑鼠放大縮小功能
在Word上也可以
很簡單,按著CTRL再滾動滑鼠滾輪就可以了

一個方向是比例放大
另一個方向是縮小,到後來是變成一個螢幕show出多張page
對我來說還蠻方便的

2010年5月7日 星期五

[MAC] 常常滑到Expose設定的四個角落怎辦?

Expose很好用很實用
但....有些時候滑鼠太靈活會不小心滑到四個角落
而造成工作突然中斷一下也不是很好
後來發現....

Expose的設定是可以加上特定按鍵的
譬如說,可以在進行Expose設定的同時
先按住command,再去下拉式選單選擇你想要的功能即可


[MAC] 如何快速關閉螢幕

快速關閉螢幕 Shift + Control + Eject
快速進入睡眠 Option + Command + Eject
快速進行關機 Control + Option + Command + Eject

另外
如果離開座位有習慣鎖定螢幕的朋友
可以先在System Preference --> Security --> General去設定
然後可以用快速關閉螢幕 or Expose去做鎖定


2010年4月15日 星期四

Configuration of NFS Server and Client

[NFS Server]

Server端的部分有幾種選擇:
  1. pure Linux server
  2. Windows host with Cygwin
  3. Windows host with FreeNFS

(1)
pure Linux Server的部分大家應該都很熟悉
如果有點忘了也可以參考這邊
另外就是,有時候Linux server是共用的,你不見得擁有root權限
所以提供其他選擇讓大家參考

(2)
Cygwin也是很多人使用的環境
要架設NFS server你需要額外的packages
  • Net :: nfs-server
  • Libs :: sunrpc
  • Admin :: cygrunsrv
install完成之後,執行/usr/bin/nfs-server-config
接下來都回答yes,並提供user/passwd供windows services使用
接著cygwin會自動幫你install mountd/nfsd/portmap

上述動作都跑完之後,接著就是去修改/etc/exports來決定你想分享的目錄和權限

再來就是mountd/nfsd/portmap的使用,有兩種方式:

1. 從Windows的控制台->系統管理工具->服務
找到這三個,然後決定自動/手動/停用等選項

2. 從cygwin裡頭去下 /bin/cygrunsrv --stop/start/remove ....

Stop the services:

 cygrunsrv --stop mountd
cygrunsrv --stop nfsd
cygrunsrv --stop portmap

Remove the services:

 cygrunsrv --remove mountd
cygrunsrv --remove nfsd
cygrunsrv --remove portmap
最後就是記得把Windows防火牆針對這些app ports打開

更多內容請參考: 文章一 文章二

(3)
最後來介紹最簡單的設定工具
直接下載sourceforge上的這個freenfs project來用
馬上執行馬上通,很適合不想被眾多設定搞得一頭霧水的朋友們使用

下載點: FreeNFS

=================================================
[NFS Client]

這邊client的部分主要針對embedded target board上的設定
主要要改的有三大部分:
  1. Kernel
  2. uClibc
  3. mount (or busybox)
(1)
首先,要使用NFS是需要kernel的幫忙的
所以在menuconfig中,先找到

(1.1)
Networking --->
Networking support
Networking options --->
TCP/IP networking
[*] IP: kernel level configuration (把底下DHCP和BOOTP都選起來,RARP選起來也safe)

(1.2)
File systems --->
Network File Systems --->
<*>NFS file system support
[*] Provide NFSv3 client support
然後底下
[*]Root file system on NFS (如果你要做的是nfsroot,這邊一定要記得選)

(1.3)
如果是uClinux,在General Setup --->
可以把Initramfs source file設成empfs

(2)
uClibc的部分要支援
Networking Support --->
[*] Remote Procedure Call(RPC) support
[*] Full RPC support

(3)
mount的部分要支援
[*]mount: support NFS mounts

-------------
mount NFS有兩種case
  • mount any directory exported from nfs server
  • mount nfsroot at kernel booting
第一種直接在target shell下
mount -t nfs -o nolock 192.168.1.1:/pub /mnt/nfs

第二種需要傳入一些參數給kernel
方法也有兩種:
  • 直接在kernel menuconfig去寫command string要為何
Kernel command line: root=/dev/nfs rw nfsroot=192.168.0.17:/rootfs,nfsvers=3 ip=192.168.0.15:192.168.0.17:192.168.0.1:255.255.255.0:1:eth0:off
  • 從u-boot下去設環境變數
+ uboot> setenv ipaddr 192.168.1.254
+ uboot> setenv serverip 192.168.1.1
+ uboot> setenv bootargs root=/dev/nfs nfsroot=/tftpboot/rootfs ip=192.168.1.254:192.168.1.1::::eth0:off

參考網址:
uclinux-dist:nfs
[Buildroot] [PATCH] docs/howto: add howto for nfsroot
SkyEye: BootfromNFS
root_file_system_structure

======================================
[Buildroot]
要支持NFS,除了busybox的mount命令要支持NFS外,buildroot需要添加如下设置:
Toolchain----->[*]Enable RPC
Package Selection----->Networking----->[*]portmap

http://buildroot.busybox.net/buildroot.html