After installing the driver for mac
>screen /dev/tty.usbserial 57600
(but it seems to filter out the control byte)
second solution
zterm
DIY solution
http://developer.apple.com/library/mac/#samplecode/SerialPortSample/Introduction/Intro.html
Monday, March 28, 2011
Friday, March 25, 2011
perl experience - ssh installation
Net::SSH::Perl
Net::SSH2
Net::OpenSSH
Problem:
Math::BigInt: couldn't load specified math lib(s), fallback to Math::BigInt::FastCalc at /opt/local/lib/perl5/site_perl/5.12.3/Crypt/DH.pm line 6
Workaround:
reinstall
Math::BigInt::GMP
Math::BigInt::Pari
Math::BigInt::BitVector (no such thing)
Reference:
http://www.perlmonks.org/?node_id=664894
問題 1:
Can't locate object method "new" via package "Net::SSH::Perl" (perhaps you forgot to load "Net::SSH::Perl"?) at rbt.pl line 28.
解決方法:
透過 perl -V 得知
@INC:
/etc/perl
/usr/local/lib/perl/5.10.1
/usr/local/share/perl/5.10.1
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.10
/usr/share/perl/5.10
/usr/local/lib/site_perl
.
發現有一個 /etc/perl/Net/SSH/Perl.pm -> /usr/share/perl5/Net/SSH.pm, 而它的版本是 0.09
而 Net::SSH::Perl 目前版本為 1.35
所以 mv /etc/perl/Net/SSH/Perl.pm to /etc/perl/Net/SSH/Perl.pm.deprecated
問題 2:
在 cpan, install Net::SSH::Perl
跑到最後,
Running make for S/SC/SCHWIGON/Net-SSH-Perl-1.35.tar.gz
Has already been unwrapped into directory /root/.cpan/build/Net-SSH-Perl-1.35-NKUlxh
CPAN.pm: Building S/SC/SCHWIGON/Net-SSH-Perl-1.35.tar.gz
Warning: Prerequisite 'Crypt::RSA => 1.37' for 'SCHWIGON/Net-SSH-Perl-1.35.tar.gz' failed when processing 'VIPUL/Crypt-RSA-1.99.tar.gz' with 'make_test => NO 2 dependencies missing (Tie::EncryptedHash,Crypt::CBC); additionally test harness failed'. Continuing, but chances to succeed are limited.
make: Warning: File `Makefile.PL' has modification time 1e+06 s in the future
Makefile out-of-date with respect to Makefile.PL
Cleaning current config before rebuilding Makefile...
make -f Makefile.old clean > /dev/null 2>&1
/usr/bin/perl Makefile.PL "INSTALLDIRS=site"
This is Net::SSH::Perl.
As of version 1.00, Net::SSH::Perl supports both the SSH1 and
SSH2 protocols natively. The two protocols have different
module prerequisitives, so you need to decide which protocol(s)
you plan to use. If you use one or the other, only those modules
for your chosen protocol will be installed; if you choose both,
all of the supporting modules will be installed. Please choose
the protocols you'd like to use from the following list ("Both"
is the default).
[1] SSH1
[2] SSH2
[3] Both SSH1 and SSH2
Which protocol(s) do you plan to use? [3]
Some of the Net::SSH::Perl ciphers depend on a Crypt:: module from
CPAN. You may already have the necessary modules installed, in which
case you don't need to bother with this step. Otherwise you'll need
to install at least one cipher to use Net::SSH::Perl. Please choose
at least one from the following list (Crypt::IDEA is the default).
[1] IDEA
[2] DES
[3] DES3
[4] Blowfish
[5] RC4
Enter your choices, separated by spaces: [1]
Checking for optional modules
Crypt::RSA is required if you wish to use the ssh-rsa public
key algorithm (ssh-dss is used by default).
Would you like to install it? (y/n) [y]
Checking if your kit is complete...
Looks good
Warning: prerequisite Crypt::RSA 1.37 not found.
Writing Makefile for Net::SSH::Perl
Writing MYMETA.yml and MYMETA.json
==> Your Makefile has been rebuilt. <==
==> Please rerun the make command. <==
false
make: *** [Makefile] Error 1
SCHWIGON/Net-SSH-Perl-1.35.tar.gz
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Failed during this command:
LDS/Crypt-CBC-2.32.tar.gz : make NO
VIPUL/Tie-EncryptedHash-1.24.tar.gz : make_test NO one dependency not OK (Crypt::CBC); additionally test harness failed
VIPUL/Crypt-RSA-1.99.tar.gz : make_test NO 2 dependencies missing (Tie::EncryptedHash,Crypt::CBC); additionally test harness failed
SCHWIGON/Net-SSH-Perl-1.35.tar.gz : make NO
簡單說, 從倒數幾行提到以下幾個 depency 安裝失敗
Crypt-CBC-2.32
Tie-EncryptedHash-1.24
Crypt-RSA-1.99
解決方法:
到 ~/.cpan/build/ 找到相對應的資料夾內, 依序執行
>perl Makefile.PL
產生 Makefile, 如果有出現 depency 問題, 再逐一解決 depency 問題, 直到沒有再出現 depency 的問題
>make
如果 make fail, 如果是缺乏 library, 則安裝該 library, 如果 library 版本太舊, 則下載 library 源始碼, 自行編譯, 再安裝, 再重新跑 perl Makefile.PL
>make install
如果 make 沒問題, 執行 install
For example, when building Math::GMP, there was an error concerning
"GMP.xs:4:17: error: gmp.h: No such file or directory",
the solution is to
"apt-get install libgmp3-dev"
Net::SSH2
Net::OpenSSH
Problem:
Math::BigInt: couldn't load specified math lib(s), fallback to Math::BigInt::FastCalc at /opt/local/lib/perl5/site_perl/5.12.3/Crypt/DH.pm line 6
Workaround:
reinstall
Math::BigInt::GMP
Math::BigInt::Pari
Math::BigInt::BitVector (no such thing)
Reference:
http://www.perlmonks.org/?node_id=664894
問題 1:
Can't locate object method "new" via package "Net::SSH::Perl" (perhaps you forgot to load "Net::SSH::Perl"?) at rbt.pl line 28.
解決方法:
透過 perl -V 得知
@INC:
/etc/perl
/usr/local/lib/perl/5.10.1
/usr/local/share/perl/5.10.1
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.10
/usr/share/perl/5.10
/usr/local/lib/site_perl
.
發現有一個 /etc/perl/Net/SSH/Perl.pm -> /usr/share/perl5/Net/SSH.pm, 而它的版本是 0.09
而 Net::SSH::Perl 目前版本為 1.35
所以 mv /etc/perl/Net/SSH/Perl.pm to /etc/perl/Net/SSH/Perl.pm.deprecated
問題 2:
在 cpan, install Net::SSH::Perl
跑到最後,
Running make for S/SC/SCHWIGON/Net-SSH-Perl-1.35.tar.gz
Has already been unwrapped into directory /root/.cpan/build/Net-SSH-Perl-1.35-NKUlxh
CPAN.pm: Building S/SC/SCHWIGON/Net-SSH-Perl-1.35.tar.gz
Warning: Prerequisite 'Crypt::RSA => 1.37' for 'SCHWIGON/Net-SSH-Perl-1.35.tar.gz' failed when processing 'VIPUL/Crypt-RSA-1.99.tar.gz' with 'make_test => NO 2 dependencies missing (Tie::EncryptedHash,Crypt::CBC); additionally test harness failed'. Continuing, but chances to succeed are limited.
make: Warning: File `Makefile.PL' has modification time 1e+06 s in the future
Makefile out-of-date with respect to Makefile.PL
Cleaning current config before rebuilding Makefile...
make -f Makefile.old clean > /dev/null 2>&1
/usr/bin/perl Makefile.PL "INSTALLDIRS=site"
This is Net::SSH::Perl.
As of version 1.00, Net::SSH::Perl supports both the SSH1 and
SSH2 protocols natively. The two protocols have different
module prerequisitives, so you need to decide which protocol(s)
you plan to use. If you use one or the other, only those modules
for your chosen protocol will be installed; if you choose both,
all of the supporting modules will be installed. Please choose
the protocols you'd like to use from the following list ("Both"
is the default).
[1] SSH1
[2] SSH2
[3] Both SSH1 and SSH2
Which protocol(s) do you plan to use? [3]
Some of the Net::SSH::Perl ciphers depend on a Crypt:: module from
CPAN. You may already have the necessary modules installed, in which
case you don't need to bother with this step. Otherwise you'll need
to install at least one cipher to use Net::SSH::Perl. Please choose
at least one from the following list (Crypt::IDEA is the default).
[1] IDEA
[2] DES
[3] DES3
[4] Blowfish
[5] RC4
Enter your choices, separated by spaces: [1]
Checking for optional modules
Crypt::RSA is required if you wish to use the ssh-rsa public
key algorithm (ssh-dss is used by default).
Would you like to install it? (y/n) [y]
Checking if your kit is complete...
Looks good
Warning: prerequisite Crypt::RSA 1.37 not found.
Writing Makefile for Net::SSH::Perl
Writing MYMETA.yml and MYMETA.json
==> Your Makefile has been rebuilt. <==
==> Please rerun the make command. <==
false
make: *** [Makefile] Error 1
SCHWIGON/Net-SSH-Perl-1.35.tar.gz
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Failed during this command:
LDS/Crypt-CBC-2.32.tar.gz : make NO
VIPUL/Tie-EncryptedHash-1.24.tar.gz : make_test NO one dependency not OK (Crypt::CBC); additionally test harness failed
VIPUL/Crypt-RSA-1.99.tar.gz : make_test NO 2 dependencies missing (Tie::EncryptedHash,Crypt::CBC); additionally test harness failed
SCHWIGON/Net-SSH-Perl-1.35.tar.gz : make NO
簡單說, 從倒數幾行提到以下幾個 depency 安裝失敗
Crypt-CBC-2.32
Tie-EncryptedHash-1.24
Crypt-RSA-1.99
解決方法:
到 ~/.cpan/build/ 找到相對應的資料夾內, 依序執行
>perl Makefile.PL
產生 Makefile, 如果有出現 depency 問題, 再逐一解決 depency 問題, 直到沒有再出現 depency 的問題
>make
如果 make fail, 如果是缺乏 library, 則安裝該 library, 如果 library 版本太舊, 則下載 library 源始碼, 自行編譯, 再安裝, 再重新跑 perl Makefile.PL
>make install
如果 make 沒問題, 執行 install
For example, when building Math::GMP, there was an error concerning
"GMP.xs:4:17: error: gmp.h: No such file or directory",
the solution is to
"apt-get install libgmp3-dev"
Monday, March 21, 2011
svn on leopard
svn on leopard experience
refer to http://www.sonzea.com/articles/subversion-trac.html
Error 1
bServer/Documents/favicon.ico, referer: https://localhost/repo
[Sun Mar 20 23:51:47 2011] [error] [client ::1] (20014)Internal error: Expected FS format '2'; found format '4'
[Sun Mar 20 23:51:47 2011] [error] [client ::1] Could not fetch resource information. [500, #0]
[Sun Mar 20 23:51:47 2011] [error] [client ::1] Could not open the requested SVN filesystem [500, #160043]
[Sun Mar 20 23:51:47 2011] [error] [client ::1] Could not open the requested SVN filesystem [500, #160043]
[Sun Mar 20 23:51:47 2011] [error] [client ::1] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: https://localhost/repo
Reason
After google, the problem is that there are two versions of svnadmin in my leopard, one is the built-in /usr/bin/svnadmin, and the other is /opt/local/bin/svnadmin. I used /opt/local/bin/svnadmin to create the repository, but Apache used /usr/bin/svnadmin to process the repository, so the problem "(20014)Internal error: Expected FS format '2'; found format '4'" happened.
refer to http://www.sonzea.com/articles/subversion-trac.html
Error 1
bServer/Documents/favicon.ico, referer: https://localhost/repo
[Sun Mar 20 23:51:47 2011] [error] [client ::1] (20014)Internal error: Expected FS format '2'; found format '4'
[Sun Mar 20 23:51:47 2011] [error] [client ::1] Could not fetch resource information. [500, #0]
[Sun Mar 20 23:51:47 2011] [error] [client ::1] Could not open the requested SVN filesystem [500, #160043]
[Sun Mar 20 23:51:47 2011] [error] [client ::1] Could not open the requested SVN filesystem [500, #160043]
[Sun Mar 20 23:51:47 2011] [error] [client ::1] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: https://localhost/repo
Reason
After google, the problem is that there are two versions of svnadmin in my leopard, one is the built-in /usr/bin/svnadmin, and the other is /opt/local/bin/svnadmin. I used /opt/local/bin/svnadmin to create the repository, but Apache used /usr/bin/svnadmin to process the repository, so the problem "(20014)Internal error: Expected FS format '2'; found format '4'" happened.
Thursday, February 03, 2011
How to learn external IP(外部IP)
using browser to check
www.whatismyip.com
http://checkip.dyndns.org:8245/
http://ipid.shat.net/iponly/
lynx -dump http://whatismyip.com | awk ‘/Your/{print $5}’
lynx -dump http://whatismyip.org/
wget -qO - http://cfaj.freeshell.org/ipaddr.cgi
html2text http://checkip.dyndns.org | cut -c21-35
snmpwalk -v 2c -c public $ROUTERIP ip | grep ipAdEntAddr |grep -v $ROUTERIP |grep -v 127.0.0.1 | awk '{ print $4 }'
#!/bin/bash
wget http://www.whatismyip.com/automation/n09230945.asp -O - -o /dev/null
echo
www.whatismyip.com
http://checkip.dyndns.org:8245/
http://ipid.shat.net/iponly/
lynx -dump http://whatismyip.com | awk ‘/Your/{print $5}’
lynx -dump http://whatismyip.org/
wget -qO - http://cfaj.freeshell.org/ipaddr.cgi
html2text http://checkip.dyndns.org | cut -c21-35
snmpwalk -v 2c -c public $ROUTERIP ip | grep ipAdEntAddr |grep -v $ROUTERIP |grep -v 127.0.0.1 | awk '{ print $4 }'
#!/bin/bash
wget http://www.whatismyip.com/automation/n09230945.asp -O - -o /dev/null
echo
Sunday, January 30, 2011
curl/wget experience
curl -C - -o --location
"-C -" specifies Resume.
-o specifies the file name to store.
--location specifies the download address. If needed redirect, then follow redirect.
for example,
curl -C - -o bt4-r2-vm.tar.bz2 --location http://www.backtrack-linux.org/download.php?fname=bt4r2vm
wget --continue --trust-server-names http://downloads.raspberrypi.org/raspbian_latest
it will finally stores as 2014-12-24-wheezy-raspbian.zip.
"-C -" specifies Resume.
-o specifies the file name to store.
--location specifies the download address. If needed redirect, then follow redirect.
for example,
curl -C - -o bt4-r2-vm.tar.bz2 --location http://www.backtrack-linux.org/download.php?fname=bt4r2vm
Wednesday, June 02, 2010
美簽-面談
最後還是來到辦美簽的地方, 跟我想像的, 一整個不一樣, 哈哈哈
到了AIT之後, 門口會有站牌, 指示現在的面談預約時間
我是預約9:30, 大概9點一到, 站牌就換成9:30的預約面談時間
表示說預約9:30的人, 可以進去了
進去之前, 會有人在那邊重覆著"把你的手機PDA拿在手上"
因為他一直重覆, 這讓我想起來 Backstreet boy 的 PDA
your pda hey hey
i want your pda
然後預約那個時間的人, 就會排在那個站牌後面
大概累積一定人數之後, 就開門讓我們進去
[電子產品保管]
[金屬探測門]
排隊 (有人會先檢查有沒有帶護照, 5cm 相片, 預約單, 確認單)
還是排隊 (有人會提供快遞條碼的紙張)
一直排隊
永無止盡的排隊 (有人會檢查照片有沒有符合標準)
[源訊科技檢查手續費單據]
收走源訊的單據
繼續排隊
[面試資格審查]
掃描 DS-160的確認碼
看我的線上資料吧
大概3分鐘, 就結束了
[指紋掃描]
按了好幾下
[跟面試官面試]
面試官掃描 DS-160的確認碼
接下來似乎在看著我線上的資料
然後問我第一個問題
你去美國幹嘛?
(呵呵呵, 這句話我女朋友已經在我耳邊不知道講多少遍了, 我也有把它背下來)
xxx, xxxxx
(他點點頭, 看起來好像沒問題)
(繼續看我的資料, 滑鼠滾來滾去的)
第二個問題出來了
這是你第一次去美國嗎?
(多麼簡單的問題啊)
是的
接著他就說這樣就好了
然後把快遞條碼給我
必備
============
護照
5cm美簽大頭照x1 (保險點多帶幾張吧)
美簽匯款收據
源訊匯款收據
DS-160 確認單
面試預約單
============
我另外有帶的
============
存摺 (面試前, 我還特地把那個戶頭, 匯滿20萬進去, 不過面試官沒有看)
薪資條 (近3個月的, 不過面試官也沒看)
在職證明 (跟公司申請的, 不過面試官也沒看)
名片 (面試官沒看)
門禁卡 (面試官沒看)
上網列印的旅遊資料 (不過面試官也沒有看)
============
希望保險點的
============
戶口名簿 (我是沒帶啦, 不過好像有改過名字的, 最好是帶著吧)
============
到了AIT之後, 門口會有站牌, 指示現在的面談預約時間
我是預約9:30, 大概9點一到, 站牌就換成9:30的預約面談時間
表示說預約9:30的人, 可以進去了
進去之前, 會有人在那邊重覆著"把你的手機PDA拿在手上"
因為他一直重覆, 這讓我想起來 Backstreet boy 的 PDA
your pda hey hey
i want your pda
然後預約那個時間的人, 就會排在那個站牌後面
大概累積一定人數之後, 就開門讓我們進去
[電子產品保管]
[金屬探測門]
排隊 (有人會先檢查有沒有帶護照, 5cm 相片, 預約單, 確認單)
還是排隊 (有人會提供快遞條碼的紙張)
一直排隊
永無止盡的排隊 (有人會檢查照片有沒有符合標準)
[源訊科技檢查手續費單據]
收走源訊的單據
繼續排隊
[面試資格審查]
掃描 DS-160的確認碼
看我的線上資料吧
大概3分鐘, 就結束了
[指紋掃描]
按了好幾下
[跟面試官面試]
面試官掃描 DS-160的確認碼
接下來似乎在看著我線上的資料
然後問我第一個問題
你去美國幹嘛?
(呵呵呵, 這句話我女朋友已經在我耳邊不知道講多少遍了, 我也有把它背下來)
xxx, xxxxx
(他點點頭, 看起來好像沒問題)
(繼續看我的資料, 滑鼠滾來滾去的)
第二個問題出來了
這是你第一次去美國嗎?
(多麼簡單的問題啊)
是的
接著他就說這樣就好了
然後把快遞條碼給我
必備
============
護照
5cm美簽大頭照x1 (保險點多帶幾張吧)
美簽匯款收據
源訊匯款收據
DS-160 確認單
面試預約單
============
我另外有帶的
============
存摺 (面試前, 我還特地把那個戶頭, 匯滿20萬進去, 不過面試官沒有看)
薪資條 (近3個月的, 不過面試官也沒看)
在職證明 (跟公司申請的, 不過面試官也沒看)
名片 (面試官沒看)
門禁卡 (面試官沒看)
上網列印的旅遊資料 (不過面試官也沒有看)
============
希望保險點的
============
戶口名簿 (我是沒帶啦, 不過好像有改過名字的, 最好是帶著吧)
============
Tuesday, June 01, 2010
美簽-DS-160表格
一開始覺得美簽應該不會很難過
不過一直被我女朋友在旁邊叮嚀
文件準備了沒啊?
知不知道要說什麼阿?
小心別給我說錯話啊?
記得只能說中文 不要說英文啊?
他問什麼就回答什麼, 沒有問的 就不要亂答?
一些朋友知道我要去辦美簽, 就說美簽很叨難
搞得我自己覺得好像會被挑到什麼毛病一樣, 沒有辦法拿到美簽
那我一定會被我女朋友殺死, 可能會被我同事笑死
oooooooops
從2010/6/1開始, 全部申請資料, 都是上網寫DS-160表格
不用再寫好幾份DS-xxx的表格
這對我來說覺得還滿方便的
以前我也沒寫過其他DS-XXX表格, 所以也不知道好壞差別在哪
只需要在網路上, 就可以填寫所有資料, 完成之後會有個 DS-160確認碼
拿這個確認碼給 AIT, 他們就可以把全部的線上資料調出來看
省得自己還要再準備一大堆文件表格, 然後拿在手上, 等排隊
另外, 寫完第一次之後, 記得備份線上的資料
如果發現還有遺漏, 還可以回去重新載入備份的檔案
再繼續做修補, 省得還要再重新打一次
最後寫完後, 再更新一下新的 DS-160確認碼
所以對我來說, 只要不是用手寫字, 我就覺得很方便
上網寫表格, 有閒置時間的限制, 好像是20分鐘
也就是說一個頁面寫超過20分鐘
那麼剛剛寫的東西就都不算了 必須再重寫一次
不過, 個人覺得 DS-160 不錯的地方就在
每次你寫完一頁之後, 可以先存檔
就好像打電動, 每次要打魔王之前, 大家都會先儲存遊戲進度一樣
每寫完一頁之後, 就先做存檔的動作, 然後再繼續下一頁
然後 DS-160 也有提供中文說明來的
那就是把滑鼠移到英文句子上面, 那就會有中文的說明出現
個人經驗, 用 IE 會比較好, 因為滑鼠移上去之後, 中文說明都會跑出來
相對用 Firefox 就好像要碰運氣, 有時候中文說明會出來
不過大部分時間, 都沒有任何中文說明出現, 無論滑鼠怎麼擺, 就是沒有東西
DS-160 表格
基本上就是寫一些
個人基本資料
護照號碼...
父母親英文姓名, 生日
工作經歷的公司
求學經歷
有沒有幫派, 宗教信仰, 犯罪記錄...
最後是我覺得比較麻煩的, 好像是叫旅遊規劃吧
必須提出具體的旅遊計劃
比如
何時會抵達美國, 到哪個州?
何時會離開美國, 從哪個州離開?
在美國的連絡人姓名, 地址, 電話, email
有些資料如果真的不知道的話, 就直接勾 DO NOT APPLY(不適用)就好了
要預約面談時間之前, 必須先做"預約申請"
"預約申請", 必須要有一組 DS-160確認碼, 才可以進行申請動作
DS-160確認碼, 又必須在寫完 DS-160 之後, 才會產生一組確認碼
所以儘快把 DS-160 寫完, 然後把線上資料, 儲存一份下來備份
以備將來, 可能要更新一些新的資料, 就可以將上次備份的檔案做上傳的動作
再來談談我寫 DS-160 的經驗
基本上跟自己有相關的, 是比較好寫的部分
比較麻煩的, 就是寫旅遊規劃部份
找了家目的地的旅館資料填上
另外, 在求學經歷這邊, 一開始我只有寫到大學而已
(DS-160 要求, 小學以上的求學經歷)
隨著預約面試的時間愈來愈近
心理愈想愈毛, 該不會就為了求學經歷沒有寫中學, 高中
然後把我踢到吧
最後還是乖乖地, 還去把資料補上
幸好以前有備份那時的線上資料, 所以重新把上次備份的檔案上傳
馬上就可以改好
不過一直被我女朋友在旁邊叮嚀
文件準備了沒啊?
知不知道要說什麼阿?
小心別給我說錯話啊?
記得只能說中文 不要說英文啊?
他問什麼就回答什麼, 沒有問的 就不要亂答?
一些朋友知道我要去辦美簽, 就說美簽很叨難
搞得我自己覺得好像會被挑到什麼毛病一樣, 沒有辦法拿到美簽
那我一定會被我女朋友殺死, 可能會被我同事笑死
oooooooops
從2010/6/1開始, 全部申請資料, 都是上網寫DS-160表格
不用再寫好幾份DS-xxx的表格
這對我來說覺得還滿方便的
以前我也沒寫過其他DS-XXX表格, 所以也不知道好壞差別在哪
只需要在網路上, 就可以填寫所有資料, 完成之後會有個 DS-160確認碼
拿這個確認碼給 AIT, 他們就可以把全部的線上資料調出來看
省得自己還要再準備一大堆文件表格, 然後拿在手上, 等排隊
另外, 寫完第一次之後, 記得備份線上的資料
如果發現還有遺漏, 還可以回去重新載入備份的檔案
再繼續做修補, 省得還要再重新打一次
最後寫完後, 再更新一下新的 DS-160確認碼
所以對我來說, 只要不是用手寫字, 我就覺得很方便
上網寫表格, 有閒置時間的限制, 好像是20分鐘
也就是說一個頁面寫超過20分鐘
那麼剛剛寫的東西就都不算了 必須再重寫一次
不過, 個人覺得 DS-160 不錯的地方就在
每次你寫完一頁之後, 可以先存檔
就好像打電動, 每次要打魔王之前, 大家都會先儲存遊戲進度一樣
每寫完一頁之後, 就先做存檔的動作, 然後再繼續下一頁
然後 DS-160 也有提供中文說明來的
那就是把滑鼠移到英文句子上面, 那就會有中文的說明出現
個人經驗, 用 IE 會比較好, 因為滑鼠移上去之後, 中文說明都會跑出來
相對用 Firefox 就好像要碰運氣, 有時候中文說明會出來
不過大部分時間, 都沒有任何中文說明出現, 無論滑鼠怎麼擺, 就是沒有東西
DS-160 表格
基本上就是寫一些
個人基本資料
護照號碼...
父母親英文姓名, 生日
工作經歷的公司
求學經歷
有沒有幫派, 宗教信仰, 犯罪記錄...
最後是我覺得比較麻煩的, 好像是叫旅遊規劃吧
必須提出具體的旅遊計劃
比如
何時會抵達美國, 到哪個州?
何時會離開美國, 從哪個州離開?
在美國的連絡人姓名, 地址, 電話, email
有些資料如果真的不知道的話, 就直接勾 DO NOT APPLY(不適用)就好了
要預約面談時間之前, 必須先做"預約申請"
"預約申請", 必須要有一組 DS-160確認碼, 才可以進行申請動作
DS-160確認碼, 又必須在寫完 DS-160 之後, 才會產生一組確認碼
所以儘快把 DS-160 寫完, 然後把線上資料, 儲存一份下來備份
以備將來, 可能要更新一些新的資料, 就可以將上次備份的檔案做上傳的動作
再來談談我寫 DS-160 的經驗
基本上跟自己有相關的, 是比較好寫的部分
比較麻煩的, 就是寫旅遊規劃部份
找了家目的地的旅館資料填上
另外, 在求學經歷這邊, 一開始我只有寫到大學而已
(DS-160 要求, 小學以上的求學經歷)
隨著預約面試的時間愈來愈近
心理愈想愈毛, 該不會就為了求學經歷沒有寫中學, 高中
然後把我踢到吧
最後還是乖乖地, 還去把資料補上
幸好以前有備份那時的線上資料, 所以重新把上次備份的檔案上傳
馬上就可以改好
Wednesday, May 26, 2010
ntp
因為BIOS電池沒電, 所以每次開機, 系統時間都要調一次
windows ntp 又好像怪怪的
所以自己寫了個 windows ntp version 3 client
初始化 WSAStarup()
WSAStartup(MAKEWORD(2,2), &wsaData);
create UDP socket()
sockfd=socket(AF_INET, SOCK_DGRAM, 0);
準備structure of NTP data format
ntpData.theFirstByte = (0x3 << 6) | (0x03 << 3) | 0x03;
ntpData.stratum = 0x02;
ntpData.poll_interval=0x04;
ntpData.precision=0x04;
ntpData.root_delay=1;
ntpData.root_dispersion=1;
ntpData.transtime.i=htonl(time(NULL)+time1970);
傳送給 ntp server
sendto(sockfd, (char *)&ntpData, sizeof(ntpData), 0, (struct sockaddr *)&serverAddr, sizeof(serverAddr));
嘗試接收
iResult=select(sockfd+1, &rfds, NULL, NULL, &timeout);
recvfrom(sockfd, (char *)&ntpData, sizeof(ntpData), 0, (struct sockaddr *)&serverAddr, &serverAddrLength);
收到並解開 ntp server 的回應
ntpData.recvtime.i=difftime(ntpData.recvtime.i, time1970);
寫到系統時間
SetLocalTime(&timeUTC);
SetLocalTime()會將 timeUTC 的轉成系統所設定的 timezone
要注意的地方
NTP的起始時間是從1900年算起, time()回傳時間是從1970年算起
所以在傳送或接收 NTP timestamp 時, 記得做必要的時間轉換
當傳送時
ntpData.transtime.i=htonl(time(NULL)+time1970);
當收到時
ntpData.recvtime.i=difftime(ntpData.recvtime.i, time1970);
time1970 定義成 2208988800, 請參考 RFC 868 Time Protocol 說明
windows ntp 又好像怪怪的
所以自己寫了個 windows ntp version 3 client
初始化 WSAStarup()
WSAStartup(MAKEWORD(2,2), &wsaData);
create UDP socket()
sockfd=socket(AF_INET, SOCK_DGRAM, 0);
準備structure of NTP data format
ntpData.theFirstByte = (0x3 << 6) | (0x03 << 3) | 0x03;
ntpData.stratum = 0x02;
ntpData.poll_interval=0x04;
ntpData.precision=0x04;
ntpData.root_delay=1;
ntpData.root_dispersion=1;
ntpData.transtime.i=htonl(time(NULL)+time1970);
傳送給 ntp server
sendto(sockfd, (char *)&ntpData, sizeof(ntpData), 0, (struct sockaddr *)&serverAddr, sizeof(serverAddr));
嘗試接收
iResult=select(sockfd+1, &rfds, NULL, NULL, &timeout);
recvfrom(sockfd, (char *)&ntpData, sizeof(ntpData), 0, (struct sockaddr *)&serverAddr, &serverAddrLength);
收到並解開 ntp server 的回應
ntpData.recvtime.i=difftime(ntpData.recvtime.i, time1970);
寫到系統時間
SetLocalTime(&timeUTC);
SetLocalTime()會將 timeUTC 的轉成系統所設定的 timezone
要注意的地方
NTP的起始時間是從1900年算起, time()回傳時間是從1970年算起
所以在傳送或接收 NTP timestamp 時, 記得做必要的時間轉換
當傳送時
ntpData.transtime.i=htonl(time(NULL)+time1970);
當收到時
ntpData.recvtime.i=difftime(ntpData.recvtime.i, time1970);
time1970 定義成 2208988800, 請參考 RFC 868 Time Protocol 說明
Thursday, March 18, 2010
停車發現
今天騎車回家, 到家門口之後, 把車停好
接著打開機車廂, 發現
原來我的滑板帽在車廂, 怎麼會這樣
那我頭上帶的帽子是誰的
回想一下剛才在牽車的時候
雖然不知道在幹什麼, 但好像真的沒有帶安全帽的印象
不會吧
那我頭上的安全帽是怎麼回事
把手往頭上一摸
唷!
還真的沒有帶安全帽就騎回來了
而且還是慢慢的騎回來
其實最近天氣冷
我還是有記得帶一頂登山毛帽騎車回家
接著打開機車廂, 發現
原來我的滑板帽在車廂, 怎麼會這樣
那我頭上帶的帽子是誰的
回想一下剛才在牽車的時候
雖然不知道在幹什麼, 但好像真的沒有帶安全帽的印象
不會吧
那我頭上的安全帽是怎麼回事
把手往頭上一摸
唷!
還真的沒有帶安全帽就騎回來了
而且還是慢慢的騎回來
其實最近天氣冷
我還是有記得帶一頂登山毛帽騎車回家
Wednesday, March 17, 2010
熱豆漿配燕麥片
以前我很常喝水, 所以身材可以保持不錯, 大概有8塊腹肌吧
最近常常下午訂飲料來喝, 身材漸漸走樣, 只剩明顯的4塊腹肌
最近天氣變化很大, 一會冷一會熱的, 所以也很久沒去游泳
所以要有一些改變, 比如今天晚上就吃熱豆漿配燕麥片當晚餐吃
相信這樣下來, 身材應該會有些改變吧
最近常常下午訂飲料來喝, 身材漸漸走樣, 只剩明顯的4塊腹肌
最近天氣變化很大, 一會冷一會熱的, 所以也很久沒去游泳
所以要有一些改變, 比如今天晚上就吃熱豆漿配燕麥片當晚餐吃
相信這樣下來, 身材應該會有些改變吧
make & segmentation fault
最近想要依靠桌機來build firmware,
結果發現, 嘗試要 build 整個 firmware 時,
往往都會出現 Segmentation Fault (signal 11)
後來, 花了點時間找 signal 11 是什麼意思
原來 signal 11 是指存取到不存在的硬體位置, 通常是硬體裝置有問題
回想一下, 那台桌機之前多加了一台 RAM
反正怎麼 build 就是不會成功
一氣之下, 馬上把那台 RAM 拔下來
想不到, 往後的 build firmware 一帆風順, 一路到底
就沒再發生 Segmentation Fault 了
結果發現, 嘗試要 build 整個 firmware 時,
往往都會出現 Segmentation Fault (signal 11)
後來, 花了點時間找 signal 11 是什麼意思
原來 signal 11 是指存取到不存在的硬體位置, 通常是硬體裝置有問題
回想一下, 那台桌機之前多加了一台 RAM
反正怎麼 build 就是不會成功
一氣之下, 馬上把那台 RAM 拔下來
想不到, 往後的 build firmware 一帆風順, 一路到底
就沒再發生 Segmentation Fault 了
Sunday, March 07, 2010
DELL E4200
規格:
CPU:C2D 1.6GHz
Latitude ON:ready
SSD:64GB
DDR3 1066Hz:2GB
WLAN:Dell 1397 802.11B/G Wireless Mini Card
WWAN:ready
OS:Genuine Windows XP Pro with Vista Business License
External Optical Drive:DVD-ROM
Battery:6 Cell
Adapter:45W
Bluetooth:none
Webcam:none
Warranty:3Yr Basic Ltd Warranty and Mail-In Service
512MB ramdisk






CPU:C2D 1.6GHz
Latitude ON:ready
SSD:64GB
DDR3 1066Hz:2GB
WLAN:Dell 1397 802.11B/G Wireless Mini Card
WWAN:ready
OS:Genuine Windows XP Pro with Vista Business License
External Optical Drive:DVD-ROM
Battery:6 Cell
Adapter:45W
Bluetooth:none
Webcam:none
Warranty:3Yr Basic Ltd Warranty and Mail-In Service
512MB ramdisk
Sunday, January 17, 2010
Cocoa development sequence
The sequence to development cocoa application
1) in Interface builder, layout the components.
2) in XCode, to create the corresponding class to the layout in the interface builder.
3) link the components in IB with the class in XCode.
3.1) create an instance of the class in IB.
3.2) link the components to the corresponding IBOutlets and IBActions.
Build and run.
1) in Interface builder, layout the components.
2) in XCode, to create the corresponding class to the layout in the interface builder.
3) link the components in IB with the class in XCode.
3.1) create an instance of the class in IB.
3.2) link the components to the corresponding IBOutlets and IBActions.
Build and run.
Blackberry development sequence
The sequence to development the Blackberry application
1) create a class of the main screen.
1.1) create the constructor
1.2) add components in order.
2) create a class, like TheApp, that contain the main() entry point.
2.1) create the constructor
2.2) create the instance of the main screen and push it into the system screen.
2.3) in the main()
2.3.1) create an instance of TheApp class.
2.3.2) finally, enterEventDispatcher().
Build and run.
1) create a class of the main screen.
1.1) create the constructor
1.2) add components in order.
2) create a class, like TheApp, that contain the main() entry point.
2.1) create the constructor
2.2) create the instance of the main screen and push it into the system screen.
2.3) in the main()
2.3.1) create an instance of TheApp class.
2.3.2) finally, enterEventDispatcher().
Build and run.
Sunday, January 10, 2010
php & apache on 10.5
Record the steps I made.
1) update /etc/apache2/httpd.conf
Add lines below
LoadModule php5_module libexec/apache2/libphp5.so
AddHandler php5-script php
AddType text/html php
AddType application/x-httpd-php-source phps
2) Locate php script files to /Library/WebServer/CGI-Executables.
3) Restart "Web Sharing" in "System Preferences" > Sharing.
1) update /etc/apache2/httpd.conf
Add lines below
LoadModule php5_module libexec/apache2/libphp5.so
AddHandler php5-script php
AddType text/html php
AddType application/x-httpd-php-source phps
2) Locate php script files to /Library/WebServer/CGI-Executables.
3) Restart "Web Sharing" in "System Preferences" > Sharing.
Saturday, December 26, 2009
鍵盤上的shift
鍵盤上的shift鍵很好用
在瀏覽器上
按 space, 會往下
shift + space 後, 就會往上
在瀏覽器上
按 backspace, 會回到上一頁
shift + space後, 就會到下一頁(如果有下一頁的話)
alt+tab, 可以切換視窗
shift+alt+tab, 反方向切換視窗
在瀏覽器上
按 space, 會往下
shift + space 後, 就會往上
在瀏覽器上
按 backspace, 會回到上一頁
shift + space後, 就會到下一頁(如果有下一頁的話)
alt+tab, 可以切換視窗
shift+alt+tab, 反方向切換視窗
Monday, December 21, 2009
車子被拖吊
1219地震前後很不平靜, 隔天早上, 停在家門口的巷子裡的車子, 竟然被拖吊走了
我剛上完廁所之後, 心理一陣不平靜, 停在門口的車子, 已經停了一夜, 應該下去看一下吧
哪知從平日的窗口小縫望過去, 怎麼沒看到我家小白的屁股, 內心大喊不妙
衝出門口之後, 發現我家的小白已經被拖到路口了
馬上跑過去, 不過員警說已經上拖車, 要到牛埔路的拖吊場領車
沿路心中直幹fuck
上網查了一下, 才知道牛埔路有一間合理拖吊場
http://210.66.55.11/location.html
之後, 想想已經快接近中午, 早餐也沒吃, 先來去吃午餐
趁著天色還早, 趕快把車子牽回來
等等就從民生路走到牛埔路牽車吧
吃過甲一的雞排飯之後, 打電話問拖吊場
要帶駕照, 行照
領車的話要700元
還有另外一張郵局罰單
隨即, 帶上我的毛帽, 從民族路往牛埔路走去
如果我一開始就打算走路去的話
我一定是瘋了吧
其實我只是想要過東大路口攔計程車, 這樣應該會比較便宜吧
事後我發現經國路很難攔到計程車
還有就算走到了牛埔路口, 距離拖吊場還有好長的一段距離
最後, 在HomeBox附近終於招到一台計程車了
馬上衝到牛埔路的拖吊場
到了拖吊場, 看到了許多其他的車主
剛剛走在路上, 也不時看到拖吊車來來去去地
今天拖吊生意真是好
結果我不是車主, 郵局罰單還不給我拿
硬是要寄回家, 免不了要先跟家人說一聲, 免得到時又是一頓開罵
繳了700塊之後, 馬上奔回家, 拿了不能開機的鋁書
準備在公司幫她做手術
我剛上完廁所之後, 心理一陣不平靜, 停在門口的車子, 已經停了一夜, 應該下去看一下吧
哪知從平日的窗口小縫望過去, 怎麼沒看到我家小白的屁股, 內心大喊不妙
衝出門口之後, 發現我家的小白已經被拖到路口了
馬上跑過去, 不過員警說已經上拖車, 要到牛埔路的拖吊場領車
沿路心中直幹fuck
上網查了一下, 才知道牛埔路有一間合理拖吊場
http://210.66.55.11/location.html
之後, 想想已經快接近中午, 早餐也沒吃, 先來去吃午餐
趁著天色還早, 趕快把車子牽回來
等等就從民生路走到牛埔路牽車吧
吃過甲一的雞排飯之後, 打電話問拖吊場
要帶駕照, 行照
領車的話要700元
還有另外一張郵局罰單
隨即, 帶上我的毛帽, 從民族路往牛埔路走去
如果我一開始就打算走路去的話
我一定是瘋了吧
其實我只是想要過東大路口攔計程車, 這樣應該會比較便宜吧
事後我發現經國路很難攔到計程車
還有就算走到了牛埔路口, 距離拖吊場還有好長的一段距離
最後, 在HomeBox附近終於招到一台計程車了
馬上衝到牛埔路的拖吊場
到了拖吊場, 看到了許多其他的車主
剛剛走在路上, 也不時看到拖吊車來來去去地
今天拖吊生意真是好
結果我不是車主, 郵局罰單還不給我拿
硬是要寄回家, 免不了要先跟家人說一聲, 免得到時又是一頓開罵
繳了700塊之後, 馬上奔回家, 拿了不能開機的鋁書
準備在公司幫她做手術
電腦硬碟掛了
Saturday, December 19, 2009
程式記憶
最近用到的技巧
1)
C字串必須要有結束字元 0x00 結尾, 如此才能正確無誤地把字串列印出來
不過最近用到的技巧, 在於記住字串的長度, 不強制, 不特意地, 用結束字元結尾
比如
想要列印 "abc123" 字串中的 "abc", 除了在 '1' 的位置改變內容為0x00外,
printf("%.*s", 3, "abc123");
也可以印出 "abc"
2) mmap
最近遇到 mmap 的問題, 剛好遇到 tmp 資料夾被寫滿, 導致上一手檔案寫不進去, 然後交給我處理後, 我用 mmap 去讀取資料, 因為檔案存在, 但大小為 zero byte, 所以 mmap 回傳 -1
我的 error handler 只判斷 mmap 回傳 NULL 的時候, 所以沒有抓到這個 error, 最後整個process segmentation falut 結束
最後查了一下 man mmap, 發現 mmap 失敗時會回傳 -1, 我猜一開始應該也有注意過, 但一直沒去理會, 抱著僥倖的心理, 最後自食惡果啦
1)
C字串必須要有結束字元 0x00 結尾, 如此才能正確無誤地把字串列印出來
不過最近用到的技巧, 在於記住字串的長度, 不強制, 不特意地, 用結束字元結尾
比如
想要列印 "abc123" 字串中的 "abc", 除了在 '1' 的位置改變內容為0x00外,
printf("%.*s", 3, "abc123");
也可以印出 "abc"
2) mmap
最近遇到 mmap 的問題, 剛好遇到 tmp 資料夾被寫滿, 導致上一手檔案寫不進去, 然後交給我處理後, 我用 mmap 去讀取資料, 因為檔案存在, 但大小為 zero byte, 所以 mmap 回傳 -1
我的 error handler 只判斷 mmap 回傳 NULL 的時候, 所以沒有抓到這個 error, 最後整個process segmentation falut 結束
最後查了一下 man mmap, 發現 mmap 失敗時會回傳 -1, 我猜一開始應該也有注意過, 但一直沒去理會, 抱著僥倖的心理, 最後自食惡果啦
Wednesday, December 09, 2009
backtrack 3
如何在 ubuntu 下 backtrack 3 到 usb 隨身碟
1) download backtrack 3 iso
2) 打開 iso 檔, 並將裡面的 boot/ 與 BT3/ 拷到隨身碟
3) 到隨身碟下, 執行 boot/initinst.sh 即可
1) download backtrack 3 iso
2) 打開 iso 檔, 並將裡面的 boot/ 與 BT3/ 拷到隨身碟
3) 到隨身碟下, 執行 boot/initinst.sh 即可
Subscribe to:
Posts (Atom)