1.遇到Jar檔的 java.lang.NoClassDefFoundError:
將jar檔放入project/libs/資料夾底下
2014年12月22日 星期一
2014年12月18日 星期四
Eclipse git 專案管理
1.新增tag專案:
2.刪除專案的head分支:
daniel@SW:/data/git/SmartWatch_Android/.git/refs/heads$ rm CW1_V7.4_TransplantSmartWatch
3.同一個git project分開兩個app安裝,並且app name不衝突:
A.rename package
B.新開一個git project
4.Eclipse的 git import :
XXXX_XXX@10.8.XX.XX:/data/git/SmartWatch_Android
5.Git上傳的 帳號(permission denied) 與 同步問題:
A.先synchronized project:
B.使用root 帳號做上傳:
2014年12月14日 星期日
顯卡升級
- 問題 129nev********還有個問題,目前還有貨嗎?(前面問題較多)(2014-12-1510:52:05)答覆:天呀
這是國考的申論題嗎
先回答最重要的一題(12)
請您換電源供應器吧
想要有好效能,電供不可少(2014-12-1513:18:07) - 問題 128nev********8.(DAI)Dragon Age Inquisition ,建議配備如下:
CPU: AMD six core CPU @ 3.2 GHz
RAM:8 GB
Video Card:2 GB, AMD Radeon HD 7870 or R9 270
這款遊戲由我的配備搭R9 280X不知道效果如何?
DAI不知道對AMD陣營優化與否?
9.如果R9 280X售完,下一波(新型號 or 同型號)進貨的時間是?
8.1 您進貨的時間時間周期是?
10.聽說 R9 270X是R9 270的超頻版,所以R9 280X也是超頻出來的?
11.看到文章您說AMD對BattleField4 有優化,而BF4使用frostbite 3引擎,然而Dragon Age Inquisition也用frostbite 3引擎,所以Dragon Age Inquisition 也被AMD陣營優化嗎?
12.另外顯示卡的6pin 跟 8 pin是指接電源供應器嗎?我的SP-450不知是否符合?(2014-12-1510:47:22)答覆:您好
8.
DAI顯卡效能比較圖請看拍賣頁面第二張圖
雖然是標準的AMD專屬遊戲
但這遊戲很吃顯卡呀~~
剛好我有Sapphire R9 290 Tri-X
加上AMD Mantle優化FPS平均44
都快幹掉GTX980囉
9.
二手卡或出清卡要看緣份
新卡則不限,看您喜歡哪張
給我廠牌 型號 我再報價給您(2014-12-1513:59:07)10.
沒錯 R9-270X是R9-270超頻版
流處理器同樣都是1280個,不過270X核心頻率較高
280X流處理器2048個,核心頻率看卡的等級
(PS R7970和R9-280X幾乎相同
要CP值高可以買R7970)
11.
同8 現在AMD Mantle又支援DVI
要玩DVI必選AMD
12.
是的,R9-280X建議500瓦金牌以上
或550瓦銅牌以上(有廠牌的喔)(2014-12-1513:59:15) - 問題 127nev********My Equ:
CPU:AMD Phenom II x4 945 3.0G
MB:GA-MA785GPMT-UD2H
RAM:4 GB DDR3 1600 x 2 + 2 GB DDR3 1333電供:SP-450W
QA:
1.R9 280x保固到何時?包裝跟保固卡都有嗎?
2.藍寶在台灣有維修據點?
3.我的內建HD 4200顯卡與在R9 280x 也插上後,系統資源會被4200拿走嗎?
4.我的cpu 945推得動R9 280x嗎? fps的張數會被cpu抑制到多少%呢?
5.電供足夠嗎?
6.配合我MB R9 280x可以發揮得出D11X嗎?
7. DAI也用frostbite 3引擎,所以DAI也被AMD陣營優化嗎?
8.聽說R9 270有gaming破圖問題,在這一代R9 280X已經改善了嗎?(2014-12-1510:43:27)答覆:您好
1.我問過威健,威健說保三年
2.沒有維修據點,有問題直接換卡
3.看軟體設定,以我的電腦設定平時內顯運作
玩遊戲時用顯卡
4.cpu有影響,相關文章可查詢
什麼是「CPU餵飽顯卡」?
5.不足,請換電供
6.沒問題
7.DAI標準的AMD GAME 290和780效能同
8.破圖問題有很多原因,不限於R9-270
抓出問題處理掉就好(2014-12-1513:36:32)
2014年12月8日 星期一
個人電腦紀錄
家機:
mb:GA-MA785GPMT-UD2H (rev. 1.1)
最大支援到16GB記憶體(需64位元作業系統,與win 7 ,win8 版本無關)
可支援 單面顆粒4GB,雙面顆粒各2GB ,but 雙面顆粒各4GB無支援.
超頻:
cpu voltage :1.4 v
frequency mhz: 240~245
mb:GA-MA785GPMT-UD2H (rev. 1.1)
最大支援到16GB記憶體(需64位元作業系統,與win 7 ,win8 版本無關)
可支援 單面顆粒4GB,雙面顆粒各2GB ,but 雙面顆粒各4GB無支援.
超頻:
cpu voltage :1.4 v
frequency mhz: 240~245
2014年12月5日 星期五
2014年11月16日 星期日
2014年11月9日 星期日
2014年10月21日 星期二
Javascript Date的使用
字串變日期
// value:'2014/08/06'
function becomeRealDate(split_realdata1){
var checkdate = split_realdata1.split('\/');
var year = parseInt(checkdate[0]);
var month = parseInt(checkdate[1]);
var day = parseInt(checkdate[2]);
var newdate = new Date();
newdate.setFullYear(year);
newdate.setMonth(month-1);
newdate.setDate(day);
return newdate;
}
藉由實際日期值(Date)增加5天,獲得新日期值
//value: new Date(), 5
function addDate(newdate , addday){
var expectdate = new Date(newdate);
expectdate.setDate(newdate.getDate()+addday);
return expectdate;
}
兩個日期的比較,如果值大於0 ,則date2較後期
//value: new Date , new Date
function comparetime(date1 , date2){
start = Math.floor( date1.getTime() / (3600*24*1000)); //days as integer from..
end = Math.floor( date2.getTime() / (3600*24*1000)); //days as integer from..
daysDiff = end - start; // exact dates
return daysDiff;
}
// value:'2014/08/06'
function becomeRealDate(split_realdata1){
var checkdate = split_realdata1.split('\/');
var year = parseInt(checkdate[0]);
var month = parseInt(checkdate[1]);
var day = parseInt(checkdate[2]);
var newdate = new Date();
newdate.setFullYear(year);
newdate.setMonth(month-1);
newdate.setDate(day);
return newdate;
}
藉由實際日期值(Date)增加5天,獲得新日期值
//value: new Date(), 5
function addDate(newdate , addday){
var expectdate = new Date(newdate);
expectdate.setDate(newdate.getDate()+addday);
return expectdate;
}
兩個日期的比較,如果值大於0 ,則date2較後期
//value: new Date , new Date
function comparetime(date1 , date2){
start = Math.floor( date1.getTime() / (3600*24*1000)); //days as integer from..
end = Math.floor( date2.getTime() / (3600*24*1000)); //days as integer from..
daysDiff = end - start; // exact dates
return daysDiff;
}
2014年10月5日 星期日
2014年9月22日 星期一
Joomla 與 Xampp 後台教學
1.觀看頁面的整體位置:
2.Module - 側欄
Extension -中間主頁
3.joomla的SQL帳號與密碼設定檔:
C:\xampp\htdocs\Joomla -> configuration.php -> public $password = '1234';
phpMyAdmin網頁登入1045錯誤處理 將auth_type改為cookie:
C:\xampp\phpMyAdmin -> config.inc.php -> $cfg['Servers'][$i]['auth_type'] = 'cookie';
4.密碼的使用:
A兩處的密碼皆使用同一個mysql密碼
A-1. C:\xampp\htdocs\Joomla ->
configuration.php -> public $password = '1234';
A-2. http://localhost/phpmyadmin
B.此密碼為創建網站就使用的root/密碼
http://localhost/joomla/administrator/index.php
5.修改http://localhost/phpmyadmin 密碼只能藉由 登入後台修改
6.修改http://localhost/joomla/administrator/密碼的方式:
貼入d2064d358136996bd22421584a7cb33e:trd7TvKHx6dMeoMmBVxYmg0vuXEA4199 (代表明密碼:secret)
重新由http://localhost/joomla/administrator/ 登入root/secret
再到edit account
給root編輯新的密碼
7.xampp 的phpMyAdmin 在資料庫管理中,點選 結構 導致 錯誤(載入)holding 處理:
將主頁的語系設定為 英文
2014年9月17日 星期三
Android 指令
列出所有package:adb shell pm list packages <app名稱>
指定package作隨機測試:adb shell monkey -p com.example.musictest -v 300
查出android api level : android list target
指定package作隨機測試:adb shell monkey -p com.example.musictest -v 300
查出android api level : android list target
Visual Studio
熱鍵:
下一個游標點:ctrl + -
上一個游標點:ctrl + shift + -
C++ - Window Form:
Message Alert:
MessageBox::Show("USA army","My policy", MessageBoxButtons::OKCancel,
下一個游標點:ctrl + -
上一個游標點:ctrl + shift + -
C++ - Window Form:
Message Alert:
MessageBox::Show("USA army","My policy", MessageBoxButtons::OKCancel,
MessageBoxIcon::Asterisk);
2014年9月11日 星期四
Linux 基本知識
1.tarball 即是 tar.gz壓縮的意思 , carrier 溢位
Alias-別名 : 可使用於將 A.長指令CMD轉成短代號 或 B.將網頁的子目錄對應到 網址的別名上
2.RPM安裝平台-
所有Intel x86指令集的處理器,Pentium 3 ,Pentium 4,AMD的K7 : i386平台
Intel的Pentium 3 ,Pentium 4,pentium M, 與 AMD的Athlon,Duron,Thunderbird 以上等級:i686平 台
Intel x86 處理器平台的Pentium MMX, AMD的K5, K6: i586平台
Intel 64位元 Xeon, AMD K8, Athlon64 等 64位元等級的處理器:x86_64平台
不限定任何平台,通用各類平台的RPM套件軟體: noarch
3.RPM- Redhat Package Manager :套件軟體標準
YUM:套件檔案的版本與相依性資料庫,相依的附加套件一併打包下載回來,且自動安裝完成
4.loopback interface(簡稱lo):回路介面
5.私人IP位址:
class A: 10.0.0.0 ~ 10.255.255.255
class B: 172.16.0.0 ~ 172.31.255.255
class C: 192.168.0.0 ~ 192.168.255.255
6.class A~ class E的遮罩:0XXXXXXX,10XXXXXX,110XXXXX,1110XXXX,11110XXX
7.Linux的服務即稱為Daemon ,所以網頁服務稱為httpd ,telnetd(以d為結尾)
8.服務執行檔目錄:/etc/init.d/
其他/etc/rcX.d/ ; 開機自動執行的shell script:/etc/rc.d/rc.local
9.啟動層級服務腳本目錄:ls -dl /etc/rc*
10.開機自動執行的腳本檔(可於最後列編輯):/etc/rc.local
11.Standalone 獨立型服務-開機後會不停止服務
xinetd 總管服務-有需要才會進行服務
12.系統排程: cat /etc/crontab
排程運作紀錄:/var/log/cron
13. Linux安全防護機制:
iptables - 防火牆:對於進來的連線服務要穿透linux的外層時,所要過濾port號 與 封包
Security Enhanced Linux-SELinux - 增強安全機制
14.vsftpd 安全性ftp-
匿名登入-/var/ftp/
使用者帳號登入- /帳號家目錄
17.FQDN(Fully Qualified Domain Name)-網域名稱
Alias-別名 : 可使用於將 A.長指令CMD轉成短代號 或 B.將網頁的子目錄對應到 網址的別名上
2.RPM安裝平台-
所有Intel x86指令集的處理器,Pentium 3 ,Pentium 4,AMD的K7 : i386平台
Intel的Pentium 3 ,Pentium 4,pentium M, 與 AMD的Athlon,Duron,Thunderbird 以上等級:i686平 台
Intel x86 處理器平台的Pentium MMX, AMD的K5, K6: i586平台
Intel 64位元 Xeon, AMD K8, Athlon64 等 64位元等級的處理器:x86_64平台
不限定任何平台,通用各類平台的RPM套件軟體: noarch
3.RPM- Redhat Package Manager :套件軟體標準
YUM:套件檔案的版本與相依性資料庫,相依的附加套件一併打包下載回來,且自動安裝完成
4.loopback interface(簡稱lo):回路介面
5.私人IP位址:
class A: 10.0.0.0 ~ 10.255.255.255
class B: 172.16.0.0 ~ 172.31.255.255
class C: 192.168.0.0 ~ 192.168.255.255
6.class A~ class E的遮罩:0XXXXXXX,10XXXXXX,110XXXXX,1110XXXX,11110XXX
7.Linux的服務即稱為Daemon ,所以網頁服務稱為httpd ,telnetd(以d為結尾)
8.服務執行檔目錄:/etc/init.d/
其他/etc/rcX.d/ ; 開機自動執行的shell script:/etc/rc.d/rc.local
9.啟動層級服務腳本目錄:ls -dl /etc/rc*
10.開機自動執行的腳本檔(可於最後列編輯):/etc/rc.local
11.Standalone 獨立型服務-開機後會不停止服務
xinetd 總管服務-有需要才會進行服務
12.系統排程: cat /etc/crontab
排程運作紀錄:/var/log/cron
13. Linux安全防護機制:
iptables - 防火牆:對於進來的連線服務要穿透linux的外層時,所要過濾port號 與 封包
Security Enhanced Linux-SELinux - 增強安全機制
14.vsftpd 安全性ftp-
匿名登入-/var/ftp/
使用者帳號登入- /帳號家目錄
15.DNS設定檔- /etc/resolv.conf
16.DNS伺服器架設軟體-BIND(Berkeley Internet Name Domain)
Port-53, use TCP/UDP,need Firewall opened
17.FQDN(Fully Qualified Domain Name)-網域名稱
2014年9月4日 星期四
Linux basic command
搜尋文件裡面的關鍵字:
grep -rnw '/home/xx/xx/software/curl-7.56.1' -e 'curl_easy_perform'
unzip file to another folder:
tar xzf archive.tar.gz -C /destination
change User:
su - knight
check self:
whoami
show command content by page:
ls -al | more
show command content by page in second way:
ll | more
find executable file or command :
which ifconfig
system info:
dmesg | more
find specified file:
find /home -name(-size,-perm,-newer,-ctime)
search some word in file:
grep go install.log
search some word in command:
ls -al | grep word1
find path word:
echo $PATH
append word in exist file:
ls /bin >> file
modified or create file:
touch file1
remove directory forcely:
rm -rf folder1
add write permission for user:
chmod u+w john
Check disk space:
df
check folder space:
du -h
du -sh(total)
process check :
ps aux | more
process tree:
pstree
stop process:
ctrl + z
put process into background 1:
sleep 40 &
put process into background 2:
sleep 50 (ctrl + z)
bg
ps -f
put background/foreground for process:
bg/fg [number]
check bg jobs:
jobs
terminated process:
ps
kill [pid]
kill process :
ps
kill -9 [pid]
kill all process:
killall httpd
ps aux | grep httpd
process priority value:
nice -n -15 sleep 200 &
ps -l
use tree check folder:
tree /proc | more
write info to file directly:
echo "newmsg" > /home/file1
watch process dynamically:
top
tar file in normally:
tar -czvf file1.tar.gz file1
un-tar file in normally:
tar -xzvf file1.tar.gz
tar file with date value:
tar -czvf back-`date +%Y%m%d`.tar.gz file1
fix time to os with network world rule:
ntpdate watch.stdtime.gov.tw
fix time to bios hardware with network world rule:
hwclock -w(hwclock -r)
show rpm installed-softwares:
rpm -qa
install gcc(conveniently way):
yum install gcc
install gcc(conveniently way with direct):
yum -y install ncurses-devel
make specified-size file for testing:
dd if=/dev/zero of=file1 bs=1M count=3
if:use /dev/zero's output zero string
of:file name
bs:every block's size
count:how many block
count file's info:
wc file1.log
11 22 33 file1.log
11 is row count
22 is character count
33 is byte count
ssh connect another linux pc:
ssh root@10.1.1.1
cross another linux to copy(local to remote):
scp file1 root@10.1.1.1:/home/john
cross another linux to copy(remote to local):
scp root@10.1.1.1:/home/john/file1 .(. is now folder)
serial number generator (use in shell script's loop tasks) :
seq 2 17 ,seq (-w) 1 2 13
sort file context by line :
sort file1(english file) , sort -g file2(number file)
remove repeat-line file by line:
uniq doc1
sort & uniq file:
sort f1 | uniq
get column value in records:
raw file-
rex,14,333
gary,53,999
yard,64,022
cut -d',' -f 2 file1
split file:
dd if=/dev/zero of=file1 bs=2M count=3
split -b 1m file1
join file:
cat xaa xab xac > file1
check 2 files are different or not:
diff file1 file2
network basic command:
ping -c 3 tw.yahoo.com
traceroute tw.yahoo.com
hostname
netstat –tnl (-n:port ,-t:tcp ,-u:udp, -l:info ,-p:pid and name)
use simple word cmd to replace long word cmd(alias):
alias dv='du -sh /var'
remove alias:
unalias dv
add alias to fixed setting file for exist alias in reboot:
cat ~/.bashrc
echo variable to show:
echo "$PATH"
echo three line word:
echo -e "line1\nline2\nline3"
set variable and get variable:
set: what=”now”
get: echo $ what
detect previous command success or not:
ls
echo $?
Result: if success ,it is 0; if fail ,it is over 0.
File test(1 is false,0 is true):
-d(folder) ,-e(exist?),-s(size is 0?),-r(read?),-w(write?)
-x(execute?),-L(link?),-n(length over 0?),-z(string is empty?)
A.test –d file1
echo $?
B.w1=”123”
w2=”ggh”
test $w1 == $w2
echo $?
Two value comparison(1 is false,0 is true):
v1=13
v2=16
test $v1 –eq(equal) $v2
-ne(different)
-ge(great or euqlal)
-gt(great)
-le(least or equal)
-lt(least)
echo $?
Check .bashrc content:
cd /root
ls –a .bas*
make a shell script and running it:
vi file1
n1=$1
n2=$2
test $n1 -gt $n2
chmod u+x file1
./file1 11 15
echo $?
If judgement:
if test $v1 –gt $v2
then
echo “bigger”
else
echo “smaller”
fi
For judgement:
for n in ‘seq 1 10’
do
echo $n
done
check Loopback network equipment :
ifconfig eth0
start/stop network card:
ifconfig eth0 up/down
configure network’s ip and netmask:
ifconfig eth0 192.168.1.2 netmask 255.255.255.0
show equipment info:
ip address show , ip link show
equipment Statistics info:
ip –s link show eth0
assign ip to specific equipment:
ip address add 10.2.3.1/24 brd + dev eth0
check assign ip to specific equipment:
ip address show dev eth0
delete ip to specific equipment:
ip address del 10.2.3.1/24 dev eth0
change equipment attribute:
ip link set eth0 up/down
find a specific ps:
ps aux | grep httpd
check system service start or not:
apt-get install chkconfig
chkconfig –list apache2 (--list:boot runlevel show)
system service start or stop:
chkconfig –level 35 httpd on/off
start/stop standalone service:
a.service [httpd/apache2] start
b./etc/init.d/[httpd/apache2] start
add new crontab task:
vi /etc/crontab (add in last line)
0 23 * * 4 root /usr/sbin/backup.sh
service crond restart
add alias to web url path:
echo “Alias /data /opt/docs” >> /etc/httpd/conf/httpd.conf
service httpd restart
限制無法存取其他目錄:
vi /etc/vsftpd/vsftpd.conf
最後加入tcp_wrappers=YES
加入禁錮名單:
echo "edw" >> /etc/vsftpd/user_list
look ip for dns:
dig [@143.25.53.12] www.kimo.com.tw
(@ip is DNS Server)
Look ip for server name:
host www.kimo.om
host www.kimo.com 41.12.124.6
host –t ns you.tube
start DNS server(after installing bind software):
service named start
(or /etc/init.d/named start)
start DNS server(after booting),better to close firewall and SELinux:
chkconfig –level 35 named on
DNS內部查詢:
dig @127.0.0.1 www.websome.com
DNS 外部查詢:
dig @192.168.1.13 www.websome.com
正常DNS 外部查詢:
dig www.websome.com
grep -rnw '/home/xx/xx/software/curl-7.56.1' -e 'curl_easy_perform'
unzip file to another folder:
tar xzf archive.tar.gz -C /destination
change User:
su - knight
check self:
whoami
show command content by page:
ls -al | more
show command content by page in second way:
ll | more
find executable file or command :
which ifconfig
system info:
dmesg | more
find specified file:
find /home -name(-size,-perm,-newer,-ctime)
search some word in file:
grep go install.log
search some word in command:
ls -al | grep word1
find path word:
echo $PATH
append word in exist file:
ls /bin >> file
modified or create file:
touch file1
remove directory forcely:
rm -rf folder1
add write permission for user:
chmod u+w john
Check disk space:
df
check folder space:
du -h
du -sh(total)
process check :
ps aux | more
process tree:
pstree
stop process:
ctrl + z
put process into background 1:
sleep 40 &
put process into background 2:
sleep 50 (ctrl + z)
bg
ps -f
put background/foreground for process:
bg/fg [number]
check bg jobs:
jobs
terminated process:
ps
kill [pid]
kill process :
ps
kill -9 [pid]
kill all process:
killall httpd
ps aux | grep httpd
process priority value:
nice -n -15 sleep 200 &
ps -l
use tree check folder:
tree /proc | more
write info to file directly:
echo "newmsg" > /home/file1
watch process dynamically:
top
tar file in normally:
tar -czvf file1.tar.gz file1
un-tar file in normally:
tar -xzvf file1.tar.gz
tar file with date value:
tar -czvf back-`date +%Y%m%d`.tar.gz file1
fix time to os with network world rule:
ntpdate watch.stdtime.gov.tw
fix time to bios hardware with network world rule:
hwclock -w(hwclock -r)
show rpm installed-softwares:
rpm -qa
install gcc(conveniently way):
yum install gcc
install gcc(conveniently way with direct):
yum -y install ncurses-devel
make specified-size file for testing:
dd if=/dev/zero of=file1 bs=1M count=3
if:use /dev/zero's output zero string
of:file name
bs:every block's size
count:how many block
count file's info:
wc file1.log
11 22 33 file1.log
11 is row count
22 is character count
33 is byte count
ssh connect another linux pc:
ssh root@10.1.1.1
cross another linux to copy(local to remote):
scp file1 root@10.1.1.1:/home/john
cross another linux to copy(remote to local):
scp root@10.1.1.1:/home/john/file1 .(. is now folder)
serial number generator (use in shell script's loop tasks) :
seq 2 17 ,seq (-w) 1 2 13
sort file context by line :
sort file1(english file) , sort -g file2(number file)
remove repeat-line file by line:
uniq doc1
sort & uniq file:
sort f1 | uniq
get column value in records:
raw file-
rex,14,333
gary,53,999
yard,64,022
cut -d',' -f 2 file1
split file:
dd if=/dev/zero of=file1 bs=2M count=3
split -b 1m file1
join file:
cat xaa xab xac > file1
check 2 files are different or not:
diff file1 file2
network basic command:
ping -c 3 tw.yahoo.com
traceroute tw.yahoo.com
hostname
netstat –tnl (-n:port ,-t:tcp ,-u:udp, -l:info ,-p:pid and name)
use simple word cmd to replace long word cmd(alias):
alias dv='du -sh /var'
remove alias:
unalias dv
add alias to fixed setting file for exist alias in reboot:
cat ~/.bashrc
echo variable to show:
echo "$PATH"
echo three line word:
echo -e "line1\nline2\nline3"
set variable and get variable:
set: what=”now”
get: echo $ what
detect previous command success or not:
ls
echo $?
Result: if success ,it is 0; if fail ,it is over 0.
File test(1 is false,0 is true):
-d(folder) ,-e(exist?),-s(size is 0?),-r(read?),-w(write?)
-x(execute?),-L(link?),-n(length over 0?),-z(string is empty?)
A.test –d file1
echo $?
B.w1=”123”
w2=”ggh”
test $w1 == $w2
echo $?
Two value comparison(1 is false,0 is true):
v1=13
v2=16
test $v1 –eq(equal) $v2
-ne(different)
-ge(great or euqlal)
-gt(great)
-le(least or equal)
-lt(least)
echo $?
Check .bashrc content:
cd /root
ls –a .bas*
make a shell script and running it:
vi file1
n1=$1
n2=$2
test $n1 -gt $n2
chmod u+x file1
./file1 11 15
echo $?
If judgement:
if test $v1 –gt $v2
then
echo “bigger”
else
echo “smaller”
fi
For judgement:
for n in ‘seq 1 10’
do
echo $n
done
check Loopback network equipment :
ifconfig eth0
start/stop network card:
ifconfig eth0 up/down
configure network’s ip and netmask:
ifconfig eth0 192.168.1.2 netmask 255.255.255.0
show equipment info:
ip address show , ip link show
equipment Statistics info:
ip –s link show eth0
assign ip to specific equipment:
ip address add 10.2.3.1/24 brd + dev eth0
check assign ip to specific equipment:
ip address show dev eth0
delete ip to specific equipment:
ip address del 10.2.3.1/24 dev eth0
change equipment attribute:
ip link set eth0 up/down
find a specific ps:
ps aux | grep httpd
check system service start or not:
apt-get install chkconfig
chkconfig –list apache2 (--list:boot runlevel show)
system service start or stop:
chkconfig –level 35 httpd on/off
start/stop standalone service:
a.service [httpd/apache2] start
b./etc/init.d/[httpd/apache2] start
add new crontab task:
vi /etc/crontab (add in last line)
0 23 * * 4 root /usr/sbin/backup.sh
service crond restart
add alias to web url path:
echo “Alias /data /opt/docs” >> /etc/httpd/conf/httpd.conf
service httpd restart
限制無法存取其他目錄:
vi /etc/vsftpd/vsftpd.conf
最後加入tcp_wrappers=YES
加入禁錮名單:
echo "edw" >> /etc/vsftpd/user_list
look ip for dns:
dig [@143.25.53.12] www.kimo.com.tw
(@ip is DNS Server)
Look ip for server name:
host www.kimo.om
host www.kimo.com 41.12.124.6
host –t ns you.tube
start DNS server(after installing bind software):
service named start
(or /etc/init.d/named start)
start DNS server(after booting),better to close firewall and SELinux:
chkconfig –level 35 named on
DNS內部查詢:
dig @127.0.0.1 www.websome.com
DNS 外部查詢:
dig @192.168.1.13 www.websome.com
正常DNS 外部查詢:
dig www.websome.com
2014年7月28日 星期一
Visual Studio 2013 Express C++ 繪圖
A.清除已繪圖的Chart之Series:
if (this->chart2->Series["Series1"]->Points->Count >= 0){
Console::WriteLine("Clear Series!");
this->chart2->Series["Series1"]->Points->Clear();
}
B.讓Chart能夠加入Scrollbar
B-1:選擇ChartAreas進入設定.
B-2:選擇CursorX -> IsUserSelectionEnabled (true) 使其Chart能夠選取縮放範圍
B-3: 進入Axes橫軸
B-4:選定MinSize數量可以在畫面有ScrollBar的情況下,一個畫面有多少個橫軸數值
if (this->chart2->Series["Series1"]->Points->Count >= 0){
Console::WriteLine("Clear Series!");
this->chart2->Series["Series1"]->Points->Clear();
}
B.讓Chart能夠加入Scrollbar
B-1:選擇ChartAreas進入設定.
B-3: 進入Axes橫軸
B-4:選定MinSize數量可以在畫面有ScrollBar的情況下,一個畫面有多少個橫軸數值
B-5:程式碼參考
B-5-1:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/f569382a-e05e-4295-b0f8-75cc4e504f79/add-scroll-bar-on-bar-chart-created-by-systemwindowsformsdatavisualizationchartingchart?forum=MSWinWebChart
B-5-2: Visual C++
this->chart2->ChartAreas["ChartArea1"]->AxisX->ScrollBar->Size = 20;
this->chart2->ChartAreas["ChartArea1"]->AxisX->ScrollBar->ButtonStyle = ScrollBarButtonStyles- >SmallScroll;
this->chart2->ChartAreas["ChartArea1"]->AxisX->ScrollBar->IsPositionedInside = true;
this->chart2->ChartAreas["ChartArea1"]->AxisX->ScrollBar->Enabled = true;
//get the current maximum of the axis
double ymax =chart2->ChartAreas["ChartArea1"]->AxisX->Maximum;
//Add the new data
chart1.Series["Series1"].Points.AddXY();
//set the zoom size to the exisiting scale values other wise nothing happens
chart2->ChartAreas["ChartArea1"]->AxisX->ScaleView->Zoom(-10, 10);
chart2->ChartAreas["ChartArea1"]->AxisX->ScaleView->Zoomable;
2014年7月22日 星期二
2014年7月10日 星期四
Android 程式小技巧
A.訊息提示:
Toast.makeText(contextAct, "readHRDatas",
Toast.LENGTH_SHORT).show();
B.讓APP完整的退出for執行緒的處理:
A. intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
B.@Override
public void onDestroy()
{
stopDraw();
Log.d("test onDestroy", "destory");
setResult(0);
finish();
super.onDestroy();
}
@Override
public void onStop(){
super.onStop();
stopDraw();
finish();
}
@Override
public void onPause() {
super.onPause();
stopDraw();
finish();
}
public void stopDraw(){
Log.d("stopDraw","stopDraw!!");
isRunGraph = false;
if(th1 != null ){
th1.interrupt();
th1 = null;
}
if(graphView != null){
//graphView.destroyDrawingCache();
graphView.removeAllViews();
graphView = null;
}
}
C.偵測dialog點擊視窗範圍內與否:
extends Dialog{
@Override
public boolean onTouchEvent(MotionEvent event) {
if ( event.getAction () == MotionEvent.ACTION_UP ) {
Rect r = new Rect ( 0, 0, 0, 0 );
this.getWindow ().getDecorView ().getHitRect ( r );
boolean intersects = r.contains ( (int) event.getX (), (int) event.getY () );
if ( !intersects ) {
this.dismiss();
return true;
}else{
countClick++;
if(countClick == 5){
Intent ite = new Intent();
ite.setClass(mContext, com.foxlink.wearable.engineering.EngineeringActivity.class);
mContext.startActivity(ite);
this.dismiss();
countClick = 0;
}
}
}
return super.onTouchEvent ( event );
}
D.APP中呼叫藍芽設定:
final Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
ComponentName cn = new ComponentName("com.android.settings",
"com.android.settings.bluetooth.BluetoothSettings");
intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity( intent);
E.執行續處理方式:
http://stackoverflow.com/questions/10544515/how-to-stop-a-running-thread-when-activity-on-destroy-at-android
F.網站下載檔案並存檔
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet();
try {
File root = Environment.getExternalStorageDirectory();
BufferedOutputStream bout = new BufferedOutputStream(
new FileOutputStream(
root.getAbsolutePath() + "/version_an.txt"));
Log.d("root.getAbsolutePath()-", root.getAbsolutePath().toString());
request.setURI(new URI("http://1111111/img/version.cfg"));
HttpResponse response = client.execute(request);
StatusLine status = response.getStatusLine();
//textView1.append("status.getStatusCode(): " + status.getStatusCode() + "\n");
Log.d("Test", "Statusline: " + status);
Log.d("Test", "Statuscode: " + status.getStatusCode());
HttpEntity entity = response.getEntity();
//textView1.append("length: " + entity.getContentLength() + "\n");
//textView1.append("type: " + entity.getContentType() + "\n");
Log.d("Test", "Length: " + entity.getContentLength());
Log.d("Test", "type: " + entity.getContentType());
entity.writeTo(bout);
bout.flush();
bout.close();
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
//textView1.append("URISyntaxException");
e.printStackTrace();
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
//textView1.append("ClientProtocolException");
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
//textView1.append("IOException");
e.printStackTrace();
}
Toast.makeText(contextAct, "readHRDatas",
Toast.LENGTH_SHORT).show();
B.讓APP完整的退出for執行緒的處理:
A. intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
B.@Override
public void onDestroy()
{
stopDraw();
Log.d("test onDestroy", "destory");
setResult(0);
finish();
super.onDestroy();
}
@Override
public void onStop(){
super.onStop();
stopDraw();
finish();
}
@Override
public void onPause() {
super.onPause();
stopDraw();
finish();
}
public void stopDraw(){
Log.d("stopDraw","stopDraw!!");
isRunGraph = false;
if(th1 != null ){
th1.interrupt();
th1 = null;
}
if(graphView != null){
//graphView.destroyDrawingCache();
graphView.removeAllViews();
graphView = null;
}
}
C.偵測dialog點擊視窗範圍內與否:
extends Dialog{
@Override
public boolean onTouchEvent(MotionEvent event) {
if ( event.getAction () == MotionEvent.ACTION_UP ) {
Rect r = new Rect ( 0, 0, 0, 0 );
this.getWindow ().getDecorView ().getHitRect ( r );
boolean intersects = r.contains ( (int) event.getX (), (int) event.getY () );
if ( !intersects ) {
this.dismiss();
return true;
}else{
countClick++;
if(countClick == 5){
Intent ite = new Intent();
ite.setClass(mContext, com.foxlink.wearable.engineering.EngineeringActivity.class);
mContext.startActivity(ite);
this.dismiss();
countClick = 0;
}
}
}
return super.onTouchEvent ( event );
}
D.APP中呼叫藍芽設定:
final Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
ComponentName cn = new ComponentName("com.android.settings",
"com.android.settings.bluetooth.BluetoothSettings");
intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity( intent);
E.執行續處理方式:
http://stackoverflow.com/questions/10544515/how-to-stop-a-running-thread-when-activity-on-destroy-at-android
F.網站下載檔案並存檔
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet();
try {
File root = Environment.getExternalStorageDirectory();
BufferedOutputStream bout = new BufferedOutputStream(
new FileOutputStream(
root.getAbsolutePath() + "/version_an.txt"));
Log.d("root.getAbsolutePath()-", root.getAbsolutePath().toString());
request.setURI(new URI("http://1111111/img/version.cfg"));
HttpResponse response = client.execute(request);
StatusLine status = response.getStatusLine();
//textView1.append("status.getStatusCode(): " + status.getStatusCode() + "\n");
Log.d("Test", "Statusline: " + status);
Log.d("Test", "Statuscode: " + status.getStatusCode());
HttpEntity entity = response.getEntity();
//textView1.append("length: " + entity.getContentLength() + "\n");
//textView1.append("type: " + entity.getContentType() + "\n");
Log.d("Test", "Length: " + entity.getContentLength());
Log.d("Test", "type: " + entity.getContentType());
entity.writeTo(bout);
bout.flush();
bout.close();
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
//textView1.append("URISyntaxException");
e.printStackTrace();
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
//textView1.append("ClientProtocolException");
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
//textView1.append("IOException");
e.printStackTrace();
}
Android Tab分頁 手動更新其中一個畫面
http://developer.android.com/training/implementing-navigation/lateral.html
package com.foxlink.wearable.hrm;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.Display;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.Toast;
import com.foxlink.wearable.R;
public class HistoryListSectionFragment extends Fragment {
private View rootView;
static int createCount2 = 0;
private static Context contextAct;
private TableLayout tl;
private LayoutInflater inf;
private ViewGroup con;
private Bundle bl;
public HistoryListSectionFragment(Context con , Display dis){
HistoryListSectionFragment.contextAct = con;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
this.inf = inflater;
this.con = container;
this.bl = savedInstanceState;
readHRDatas();
Toast.makeText(contextAct, "onCreateView",
Toast.LENGTH_SHORT).show();
return rootView;
}
public void callRefresh(){
// onCreateView(inf, con, bl);
getFragmentManager().beginTransaction().detach(this).attach(this).commit();
}
public void readHRDatas(){
rootView = inf.inflate(R.layout.activity_historylist, con, false);
tl = (TableLayout) rootView.findViewById(R.id.hrtable1);
/* Create a new row to be added. */
File[] files = contextAct.getFilesDir().listFiles();
StringBuilder sb = new StringBuilder();
for (int i = 0 ; i < files.length ; i++ ){
sb.append(files[i].getName()+",");
String[] splitName;
if((splitName = files[i].getName().split("\\s+")).length == 3 && splitName[0].contains("_")){
insertHRRecord(i , splitName , files[i].getName() );
}
}
Toast.makeText(contextAct, "all file:"+sb.toString(),
Toast.LENGTH_SHORT).show();
}
/**
* add one record for even saved file
* @param count
* @param fileNames
* @param originalName
*/
public void insertHRRecord(int count , String[] fileNames ,final String originalName){
TableRow tr = new TableRow(contextAct);
tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
if(count%2 == 0){
tr.setBackgroundColor(Color.GRAY);
}
TextView t1 = new TextView(contextAct);
t1.setHeight(150);
String[] splitTime = fileNames[0].split("_");
t1.setText(" "+splitTime[0] + "\n " +splitTime[1]);
t1.setGravity(Gravity.LEFT);
t1.setTextSize(18);
t1.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
tr.addView(t1);
TextView t2 = new TextView(contextAct);
t2.setText(fileNames[1]);
t2.setGravity(Gravity.LEFT);
t2.setTextSize(18);
t2.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
tr.addView(t2);
TextView t3 = new TextView(contextAct);
t3.setText(fileNames[2]);
t3.setGravity(Gravity.LEFT);
t3.setTextSize(18);
t3.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
tr.addView(t3);
tr.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//Get the text file
File readFile = new File(contextAct.getFilesDir(), originalName);
//Read text from file
List<Integer> intList = new ArrayList<Integer>();
try {
BufferedReader br = new BufferedReader(new FileReader(readFile));
String line;
while ((line = br.readLine()) != null) {
intList.add(Integer.valueOf(line));
}
}
catch (IOException e) {
//You'll need to add proper error handling here
}
int[] ret = new int[intList.size()];
for (int i=0; i < ret.length; i++)
{
ret[i] = intList.get(i).intValue();
}
//send value to draw graph for this file
Intent it = new Intent();
it.setClass(HistoryListSectionFragment.contextAct, HistoryList_Graph.class);
it.putExtra("hrvalues", ret);
startActivity(it);
}
});
/* Add row to TableLayout. */
tl.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));
}
}
package com.foxlink.wearable.hrm;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.Display;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.Toast;
import com.foxlink.wearable.R;
public class HistoryListSectionFragment extends Fragment {
private View rootView;
static int createCount2 = 0;
private static Context contextAct;
private TableLayout tl;
private LayoutInflater inf;
private ViewGroup con;
private Bundle bl;
public HistoryListSectionFragment(Context con , Display dis){
HistoryListSectionFragment.contextAct = con;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
this.inf = inflater;
this.con = container;
this.bl = savedInstanceState;
readHRDatas();
Toast.makeText(contextAct, "onCreateView",
Toast.LENGTH_SHORT).show();
return rootView;
}
public void callRefresh(){
// onCreateView(inf, con, bl);
getFragmentManager().beginTransaction().detach(this).attach(this).commit();
}
public void readHRDatas(){
rootView = inf.inflate(R.layout.activity_historylist, con, false);
tl = (TableLayout) rootView.findViewById(R.id.hrtable1);
/* Create a new row to be added. */
File[] files = contextAct.getFilesDir().listFiles();
StringBuilder sb = new StringBuilder();
for (int i = 0 ; i < files.length ; i++ ){
sb.append(files[i].getName()+",");
String[] splitName;
if((splitName = files[i].getName().split("\\s+")).length == 3 && splitName[0].contains("_")){
insertHRRecord(i , splitName , files[i].getName() );
}
}
Toast.makeText(contextAct, "all file:"+sb.toString(),
Toast.LENGTH_SHORT).show();
}
/**
* add one record for even saved file
* @param count
* @param fileNames
* @param originalName
*/
public void insertHRRecord(int count , String[] fileNames ,final String originalName){
TableRow tr = new TableRow(contextAct);
tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
if(count%2 == 0){
tr.setBackgroundColor(Color.GRAY);
}
TextView t1 = new TextView(contextAct);
t1.setHeight(150);
String[] splitTime = fileNames[0].split("_");
t1.setText(" "+splitTime[0] + "\n " +splitTime[1]);
t1.setGravity(Gravity.LEFT);
t1.setTextSize(18);
t1.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
tr.addView(t1);
TextView t2 = new TextView(contextAct);
t2.setText(fileNames[1]);
t2.setGravity(Gravity.LEFT);
t2.setTextSize(18);
t2.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
tr.addView(t2);
TextView t3 = new TextView(contextAct);
t3.setText(fileNames[2]);
t3.setGravity(Gravity.LEFT);
t3.setTextSize(18);
t3.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
tr.addView(t3);
tr.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//Get the text file
File readFile = new File(contextAct.getFilesDir(), originalName);
//Read text from file
List<Integer> intList = new ArrayList<Integer>();
try {
BufferedReader br = new BufferedReader(new FileReader(readFile));
String line;
while ((line = br.readLine()) != null) {
intList.add(Integer.valueOf(line));
}
}
catch (IOException e) {
//You'll need to add proper error handling here
}
int[] ret = new int[intList.size()];
for (int i=0; i < ret.length; i++)
{
ret[i] = intList.get(i).intValue();
}
//send value to draw graph for this file
Intent it = new Intent();
it.setClass(HistoryListSectionFragment.contextAct, HistoryList_Graph.class);
it.putExtra("hrvalues", ret);
startActivity(it);
}
});
/* Add row to TableLayout. */
tl.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));
}
}
訂閱:
文章 (Atom)