วันพฤหัสบดี, กันยายน 20, 2550
บิตทอเร้น ทอร์ และ ไพรวอกซี่
การเซตค่าในไมโครทอเร้นก็เซตให้มันดาวน์โหลดไฟล์ผ่านพรอกซี่ โดยใช้ Socks5 และ 127.0.0.1 ที่พอร์ท 9050 (การเซตค่าตามนี้ฟอร์เวิร์ดไปที่ทอร์โดยไม่ผ่านไพรวอกซี่)
ถ้าจะเซตให้ผ่านไพรวอกซี่ให้เซต โดยใช้ HTTP, 127.0.0.1, พอร์ท 8118
วันศุกร์, กันยายน 14, 2550
ใช้ wget ดาวน์โหลดโดยไม่ต้องสนใจ robots.txt (wget ignore robots.txt)
ซึ่งเราสามารถเพิกเฉย robots.txt ได้ โดยเพิ่มออพชั่น -e robots=off ลงไป
$ wget www.example.com/i_want_this/ -e robots=off
วันพุธ, กันยายน 12, 2550
ย้าย Subversion server ไปยังเครื่องใหม่ P4 แรม 1G
- ลง Apache HTTP server (httpd)
- ลง OpenSSL ให้ httpd
- ลง Subversion ของ windows บน module Apache
1. ดาวน์โหลด installer MSI ไฟล์ จาก apache.org แล้วก็ Install ลงไป. กรอกข้อมูลเกี่ยวกับ servername แล้วก็ admin email แค่นี้
2. แก้ httpd.conf โดยดูจากของเก่า คร่าวๆ ก็เพิ่ม dav_svn_module กับ auuthz_svn_module ลงไป แล้วก็ ssl_module ด้วย
เติมล่างสุดของ config ไฟล์ เกี่ยวกับ Location /svn โดย ก๊อปของเก่ามาตรงๆ
---- ลง Open SSL ----
1. ดูประกอบได้ที่ http://tud.at/programm/apache-ssl-win32-howto.php3
2. ดาวน์โหลด Apache_X-mod_ssl_Y-openssl_Z-WIN32 ที่ http://hunter.campbus.com
3. ใน archive ของไฟล์ที่ดาวน์โหลดมาที่ Apache-modssl\bin\ ก๊อปไฟล์ ssleay32.dll และ libeay32.dll ไปที่ซิสเต็มไดเรคทอรี่ C:\WINDOWS\System32
4. ก๊อปปี้ openssl.exe ใน \bin ใน อาร์ไค๊บ ไปยัง \bin ใน Apache path, และ save/copy ssl.cnf จาก http://tud.at... ไปยัง \conf,
ก๊อปปี้ mod_ssl.so ไปที่ \module, save openssl.cnf ไปที่ conf อันนี้ใช้ generate certificates.
4.1 สร้าง certificate : ..\bin\openssl.exe req -config .\openssl.cnf -new -out my-server.csr
4.2 สร้าง RSA key : ..\bin\openssl.exe rsa -in privkey.pem -out my-server.key
4.3 สร้าง server X509 cert : ..\bin\openssl.exe x590 -in my-server.csr -out my-server.cert -req -signkey my-server.key -days 3654 [about 10 years]
4.5 ก๊อปปี้ certificate file และ passwd ไฟล์ (my-server.{cert|csr|der.crt|key}, privkey.pem, passwd)
5. สร้าง \conf\ssl.cert แล้วก๊อปปี้ my-server.cert และ my-server.key ไปไว้
6. แก้ httpd.conf SSLLog logs/SSL.log SSLLogLevel warn SSLmutex sem
เพิ่ม config file ใน ssl.conf ใน \conf แก้ค่าตามสมควร
ระวังเรื่อง
วิธีหลัง : ที่เป็น ZIP ไฟล์มา แล้วแตกไฟล์ออก 2. ก๊อปปี้ ไฟล์ mod_*svn*.so ไปที่ modules ใน Apache แก้ config apache ให้โหลด module เหล่านี้ด้วย (บางครั้งจำเป็นต้อง restart เครื่อง ไม่งั้นมันจะมองไม่เห็น module ใหม่)
note: ปัญหาที่เจอคือหลังจากก๊อป mod_ssl ไปแล้วมันสตาร์ท apache ไม่ติด มันจะ crash
แก้โดยเอาไฟล์ที่อยู่ใน apache-with-ssl.ZIP ไปแทนที่อินสตอลไว้ให้หมด
==== อพยพ repository ไดเรคทอรี่ เก่าไปสู่ที่ใหม่ด้วยการ dump ดังต่อไปนี้ ====
tar zcf reponame.tgz reponame.dump
scp reponame.tgz hostname:/path/to/new/repo
Then login to the new machine, and set up the new repo:
svnadmin create reponame
tar zxf reponame.tgz
svnadmin load reponame
That’s all.
แก้ locale ใ้ห้เป็น US English โดยกำหนด user's environment variable อันใดอันหนึ่ง
LANGUAGE, LC_ALL, LC_MESSAGESให้เป็น en_US หรือ POSIX ซะ
== ประวัติการแก้ไข ==
1. 07/6/2548
2. 29/9/2549
การใช้คีย์เวิร์ดอัตโนมัติใน Subversion (keywords (tag) substitutions in Subversion)
ได้ลองใช้พวก tag (จริงๆในคู่มือเค้าเรียกว่า keyword) ต่างๆ ของ Subversion ดูแล้วเลยมาเมโม่เก็บไว้
ref: http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.keywords.html
คีย์เวิร์ด
คีย์เวิร์ดที่ใช้มี 5 อันคือ
Date(alias = LastChangedDate)Revision(alias = LastChangedRevision, Rev)Author(alias = LastChangedBy)- Id (no alias)
- HeadURL (alias = URL)
วิธีการใช้
1. เพิ่มคีย์เวิร์ดเหล่านี้ไว้ในไฟล์ อย่างเช่นในคอมเม้นท์ตรงหัวไฟล์
/* foo.txt initiated 2007/05/052. เซต property
* $Revision$ last committed rev
* $Author$ last committed author
* $Date$ last committed date
* $Id$ last committed Id
* $URL$ head URL
*/
svn:keywords ของไฟล์ foo.txt เพื่อเซตให้คีย์เวิร์ดเหล่านั้นถูกแทนค่าตอนคอมมิต, Subversion จะไม่แทนค่าคีย์เวิร์ดเหล่านี้ถ้าหากเราไม่เซต การเซตให้ LastChangedDate กับ Author ถูกแทนค่าทำได้โดย3. คอมมิตซะ! คีย์เวิร์ดเหล่านี้ก็จะถูกแทนค่าโดยอัตโนมัติตอนคอมมิต$ svn propset svn:keywords "Date Author" foo.txt
property 'svn:keywords' set on 'foo.txt'
นอกจากนี้แล้วการแสดงผลแบบกำหนดความกว้างตายตัวเพื่อความสวยงามสามารถทำได้โดยเพิ่มโคล่อนสองอันไว้หลังคีย์เวิร์ดซะ ใช้รูปแบบ อย่างนี้
$Rev:: $: Revision of last commit
$Author:: $: Author of last commit
$Date:: $: Date of last commit
--
Date
This keyword describes the last time the file was known to have been changed in the repository, and is of the form
$Date: 2006-07-22 21:42:37 -0700 (Sat, 22 Jul 2006) $. It may also be specified asLastChangedDate.RevisionThis keyword describes the last known revision in which this file changed in the repository, and looks something like
$Revision: 144 $. It may also be specified asLastChangedRevisionorRev.AuthorThis keyword describes the last known user to change this file in the repository, and looks something like
$Author: harry $. It may also be specified asLastChangedBy.HeadURLThis keyword describes the full URL to the latest version of the file in the repository, and looks something like
$HeadURL: http://svn.collab.net/repos/trunk/README $. It may be abbreviated asURL.IdThis keyword is a compressed combination of the other keywords. Its substitution looks something like
$Id: calc.c 148 2006-07-28 21:30:43Z sally $, and is interpreted to mean that the filecalc.cwas last changed in revision 148 on the evening of July 28, 2006 by the usersally.