Java Annotation筆記

in java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public class AnnotationTest {
private Logger log = LoggerFactory.getLogger(this.getClass());
@Test
public void test() throws Exception {
Field f_b = Test1.class.getDeclaredField("b");
Annotation annotation_b = f_b.getAnnotation(Ignore.class);
Field f_a = Test1.class.getDeclaredField("a");
Annotation annotation_a = f_a.getAnnotation(Ignore.class);
log.info("" + annotation_a);
log.info("" + annotation_b);
}
}
class Test1 {
String a;
@Ignore
String b;
}

Comment and share

學生時代筆記,可能有誤?

Resource Acquisition Is Initialization

C++中利用物件離開scope即會自動呼叫destructor的特性(stack),使資源類型物件在使用完或有exception跳出時能自動將資源釋放
Java中常見的try catch block中finally{close資源}的寫法在C++中就不需要了
若是必須使用pointer而非物件時,可以在資源物件中宣告該pointer,實際使用還是用資源物件即可
Continue reading

Linux指令筆記

in linux

一般

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 壓縮解壓logs
tar -zcvf 2013-12.tar.gz *.2013-12*
rm *.2013-12*
tar -zxvf 2013-10.tar.gz
# check 硬碟狀況
df
# 查程式pid
ps -ef | grep glassfish
# 強制停止程式
kill -9 <pid>
# 啟動service
service <service name> start
# 列出folder下全folder size(exclude hidden files)
du -sh *
# 列出folder下全folder size(only hidden files)
du -hs .[^.]*
# 列出folder下全folder size(include hidden files)
du -hs .* *
# ssh上傳file
scp <filename> username@hostIP:<remote folder>
scp test.sql cwza@localhost:/usr/local
# ssh下載file
scp username@hostIP:<remote file> <local folder>
scp cwza@localhost:/usr/local/test.sql ~/data
# mkdir 若上層不存在自動建立,若已存在該資料夾則略過不會有錯誤
mkdir -p /tmp/foo/bar
# count numbers of word and line in a file
wc -w file
wc -l file
# trace a live log file
tail -f logfile | ag print

tree

需安裝tree套件
http://www.computerhope.com/unix/tree.htm

1
2
3
4
5
6
tree -a # list all files include hidden files
tree -d # list directories only
tree -C # colorized output
tree -I __pycache__ # ignore some name
tree -L 2 # limit Depth
tree -N #解決中文亂碼

Comment and share

幾年前學生時代的筆記,不確定正確性


PA: physical address
VA: virture address

按下開機紐,送出signal給主機板叫他開始power supply
在所有裝置都收到正確的power後,主機板送Power OK signal給Bios
Continue reading

Spring要用3.1以上版本

applicationContex.xml
1
2
3
4
5
6
7
8
<beans>
<beans profile="LOCAL">
<context:property-placeholder location="classpath*:META-INF/spring/local/*.properties" />
</beans>
<beans profile="PRODUCTION">
<context:property-placeholder location="classpath*:META-INF/spring/production/*.properties" />
</beans>
</beans>

Continue reading

Cwza

Hello everyone.
I’m cwza.
Welcome to my blog.


Software Engineer


Taiwan/Taipei