วันอังคาร, ธันวาคม 11, 2550

Simulation env/tool in Java

เท่าที่คุยกับรามิซัง เค้าแนะนำทูลสำหรับใช้ทำพวก Discrete Event Simulation หรือ Simulation ด้วยJava มีรายกันดังนี้

DEMO-J
JiST/SWANS good for parallel (รามิใช้อันนี้อยู่)
JSim
NECO

แปะไว้กันลืมเฉยๆ

วันจันทร์, พฤศจิกายน 19, 2550

ข้าวมันไก่

เมื่อวานลองทำข้าวมันไก่โดยให้พี่นุ้ยสอน
บันทึกของที่ต้องใช้ และ ขั้นตอนการทำคร่าวๆ เก็บไว้
วันหลังจะได้ทำกินเอง

ของที่ต้องเตรียม
  1. เนื้อไก่อก, น่องไก่, และ โคลงกระดูกไก่
  2. แตงกวา --- หั่นเป็นแว่นบางเฉียงๆ
  3. กระเทียม --- ปอก, หั่นหยาบ ใช้หุงข้าวมัน และ หั่นเล็กหน่อย ใช้ทำน้ำจิ้ม
  4. พริก --- หั่นเล็กหน่อย ใช้ทำน้ำจิ้ม
  5. ขิง --- ปอก, หั่นเล็กหน่อย ใช้ทำน้ำจิ้ม
  6. เต้าเจี้ยว --- ใช้ทำน้ำจิ้ม
  7. น้ำมะนาว --- ใช้ทำน้ำจิ้ม
  8. ซอสหอยนางรม หรือ ซีอิ๊วขาว หรือ น้ำปลา --- ใช้ปรุงแกงฟัก
  9. ฟัก (冬瓜「とうがん」) --- หั่นเป็นชิ้นเล็กพอดีคำ ใช้ทำแกงฟัก
  10. พริกไทย --- ใช้ปรุงแกงฟัก
  11. เกลือ --- ใช้ปรุงแกงฟัก
ขั้นตอนการทำ
  1. ต้มไก่ --- ต้มโคลงไก่กับน่องก่อน เพื่อให้ได้น้ำซุปที่เข้มข้น (ถ้าไม่มีโคลงไก่ก็ต้มเนื้อไก่อกไปเลยได้)
  2. หุงข้าว --- ใส่น้ำมันเล็กน้อย หรือใช้หนังไก่มันๆใส่ลงไป เอากระเทียมที่สับหยาบๆใส่ลงไป ผัดกับข้าวสารที่ซาวแล้วคลุกแป๊บเดียวให้พอหอมกระเทียม แล้วก็เอาไปหุง โดยใช้น้ำที่ได้จากการต้มโคลงไก่
  3. ต้มเนื้อไก่ --- เอาเนื้อไก่อกใส่ลงไปต้ม หลังจาำกเอาน้ำต้มโคลงไก่บางส่วนไปหุงข้าวแล้ว พอเนื้อไก่สุกก็เอาขึ้นมา ไว้รอหั่น
  4. ต้มน้ำแกงฟัก --- เอาฟักใส่ลงไปในน้ำต้มโคลงไก่ หลังจากต้มอกไก่เสร็จแล้ว, ต้มจนฟักสุก ปรุงรสโดยใส่เกลือ ซอสหอยนางรมเล็กน้อยระวังเค็ม พริกไทย
  5. ทำน้ำจิ้ม --- ใส่เต้าเจี้ยวลงไปในกระทะไฟอ่อน, ใส่พริกและขิง ลงไป, ใส่น้ำเล็กน้อยเพื่อเจือจางความเค็มของเต้าเจี้ยว, จากนั้นปรุงรส โดยใส่น้ำตาล, น้ำมะนาวเล็กน้อย คนให้ทั่ว
  6. หั่นไก่เป็นชิ้นเล็กๆเรียงใส่จาน พร้อมแตงกวา
  7. เสร็จแล้ว

ขั้นตอนง่ายๆ เพียงเท่านี้ก็จะได้ข้าวมันไก่มากินแล้วครับ

วันพฤหัสบดี, พฤศจิกายน 01, 2550

บันทึกการติดตั้งไอ้เสือดาว 10.5 (Mac OS X 10.5 Leopard installation memo)

  1. รีไซส์พาร์ทิชั่น โดยใช้ แผ่น Live CD Ubuntu 6.06.1 LTS Dapper Drake
    1. เปิด shell ขึ้นมา
    2. # sudo parted
    3. # print
      1. 3 134MB 20GB hfs+ Apple_HFS_Untitled_1
    4. #resize 3 134MB 10GB
    5. รอนานประมาณ 30 นาที จนเสร็จ
  2. ยัดตัวอินสตอลเลอร์ลงไปในExternal drive ระหว่างที่รอ เปิด Disk Utility ขึ้นมา เลือก restore ลงไปใน partition ที่ว่างใน external drive (อาจต้องฟอร์แมตหรือทำพาร์ทิชั่นใหม่ถ้าจำเป็น)
  3. เอา external drive มาบูตตัว installer ตอนเปิดเครื่อง ให้กดปุ่ม option ค้างไว้ มันจะให้เลือกว่าเราจะบูตเครื่องด้วยพาร์ทิชั่นไหน เลือกพาทิชั่นของตัวอินสตอลเลอร์ซะ
  4. เสร็จเรียบร้อย ก็แค่ติดตั้งไปตามคำแนะนำบนหน้าจอ

วันเสาร์, ตุลาคม 13, 2550

เริ่มต้นกับ WALA เครื่องมือสำหรับการวิเคราะห์โปรแกรม (getting started with WALA)

สรุปขั้นตอนต่างๆ สำหรับการเริ่มต้นใช้เครื่องมือ WALA
  1. download Eclipse (the big one, version with RCP/plugin developer), as suggested by the WalaWiki the version for Java dev seems not sufficient.
  2. install EMF from eclipse software update. Europa update -> Model and Modeling Environment -> EMF runtime & End user.
  3. install Subclipse.
  4. edit ...wala.core/dat/wala.properties
    1. java_runtime_dir = c:/program files/Java/jre-1.6.0_03/lib
    2. output_dir = w:/WALA/WALA_output
  5. install graphviz (examples in wala.core.tests use dot.exe provided by graphviz)
  6. edit ...wala.core.tests/dat/wala.examples.properties
    1. provide absolute path for gsview32.exe
    2. and dot.exe
  7. run examples from launcher in Eclipse. Edit arguments, for examples, -appJar c:/lib/foo.jar or -sig method_a()V

วันพุธ, ตุลาคม 10, 2550

en-dash และ em-dash ใน XeLaTeX

เนื่องจาก TeX ประมวลผลอินพุตไฟล์ซึ่งเป็นASCII 8-bit codepage ที่ไม่มีตัวอักษรซึ่งตรงกับ en-dash และ em-dash ทำให้ใช้ไฮเฟ่น 2 หรือ 3 อัน (--, ---) แทน. แต่เนื่องจาก XeTeX นั้นประมวลผลอินพุตเท็กส์ที่เป็นยูนิโค้ด ซึ่งมีอักขระสำหรับ en-dash และ em-dash ทำให้การใช้ --/--- จึงไม่จำเป็น
วิธีการพิมพ์ en/em-dash นั้น สำหรับวินโด้เอ๊กพี ทำได้โดย
  • เปิด Num Lock
  • กด Alt ค้าง พิมพ์ 0150 / 0151 ที่แป้น Numeric Pad ถ้าพิมพ์ที่คีย์บอร์ดธรรมดา จะไม่ติด

บันทึกเกี่ยวกับการลง TeXLive 2007 แทน MiKTeX 2.7 beta3

หลังจากเขียนดีวีดีอิมเมจที่ดาวน์โหลดมาแล้ว ลองติดตั้งดูในเครื่องคัมปานา
อินสตอเลอร์มันไม่เข้าโหมดอินสตอลให้ เนื่องจากเรามี MiKTeX ติดตั้งไว้อยู่ก่อนแล้ว
เราต้องแก้ environment variables เพื่อให้อินสตอลเลอร์มันทำงานในโหมดอินสตอล
(จริงๆแล้วสามารถโอเวอไรด์ได้ด้วยออพชั่นของคอมมานไลน์ แต่มันจะไปเขียนทัพ env var บางตัว)

env var ที่แก้คือ
  1. System Variable: Path= C:\Program Files\MiKTeX 2.7\miktex\bin;c:\program files\imagemagick-6.3.4-q16;
มันจะถามเรื่องอินสตอล Perl กับ Ghostscript

พบว่าใช้ TeXLive ดีกว่า

วันอังคาร, ตุลาคม 09, 2550

บันทึกเรื่องฟอนต์ที่ใช้ใน XeTeX in MiKTeX (installing fonts for XeTeX in MiKTeX 2.7)

ก่อนอื่นต้องรันใน fc-cache ในคอมมานด์พรอมพ์ของวินโด้
พลาดไปรันใน bash shell ของ cygwin ซะ มันเลยไม่เวิร์ค
ผลลัพธ์การรัน fc-cache -f -v แสดงข้างล่างนี้
C:/WINDOWS/Fonts: caching, 162 fonts, 0 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1: caching, 0 fonts, 6 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/adobe: caching, 0 fonts, 2 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/adobe/courier: caching, 6 fonts, 0 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/adobe/utopia: caching, 4 fonts, 0 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/bluesky: caching, 0 fonts, 3 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/bluesky/ams: caching, 34 fonts, 0 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/bluesky/cm: caching, 75 fonts, 0 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/bluesky/latex-fonts: caching, 14 fonts,
0 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/groff: caching, 1 fonts, 0 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/hoekwater: caching, 0 fonts, 4 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/hoekwater/mflogo: caching, 8 fonts, 0 di
rs
C:/Program Files/MiKTeX 2.7/fonts/type1/hoekwater/misc: caching, 1 fonts, 0 dirs

C:/Program Files/MiKTeX 2.7/fonts/type1/hoekwater/rsfs: caching, 3 fonts, 0 dirs

C:/Program Files/MiKTeX 2.7/fonts/type1/hoekwater/stmaryrd: caching, 6 fonts, 0
dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/public: caching, 0 fonts, 3 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/public/eurosym: caching, 12 fonts, 0 dir
s
C:/Program Files/MiKTeX 2.7/fonts/type1/public/lm: caching, 92 fonts, 0 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/public/xypic: caching, 9 fonts, 0 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/urw: caching, 0 fonts, 9 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/urw/avantgar: caching, 4 fonts, 0 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/urw/bookman: caching, 4 fonts, 0 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/urw/courier: caching, 4 fonts, 0 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/urw/helvetic: caching, 14 fonts, 0 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/urw/ncntrsbk: caching, 4 fonts, 0 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/urw/palatino: caching, 4 fonts, 0 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/urw/times: caching, 4 fonts, 0 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/urw/zapfchan: caching, 1 fonts, 0 dirs
C:/Program Files/MiKTeX 2.7/fonts/type1/urw/zapfding: caching, 1 fonts, 0 dirs
C:/Program Files/MiKTeX 2.7/fonts/opentype: caching, 0 fonts, 1 dirs
C:/Program Files/MiKTeX 2.7/fonts/opentype/public: caching, 0 fonts, 1 dirs
C:/Program Files/MiKTeX 2.7/fonts/opentype/public/lm: caching, 72 fonts, 0 dirs
C:/Documents and Settings/All Users/Application Data/MiKTeX/2.7/fontconfig/cache
: cleaning cache directory
fc-cache: succeeded

วันศุกร์, ตุลาคม 05, 2550

ว่าด้วยการนับเรียงของส่วนพาดหัวใน LaTeX (Numbering Heading)

REF: The LaTeX Companion, pp. 25

Every counter in LaTeX has an associated command constructed by prefixing the counter name with `\the', which generates a typeset representation of the counter in question. In case of the sectioning commands this representation form is used to produce the full number associated with the commands, as in the following definitions:
  • \renewcommand\thechapter{\arabic{chapter}}
  • \renewcommand\thesection{\thechapter.\arabic{section}}
  • \renewcommand\thesubsection{thesection.\arabic{subsection}}
This kind of recursive definition facilitates modifications to the counter representations because changes do not need to be made in more than one place. If you want to number sections using capital letters, you can just redefine the command \thesection:
  • \renewcommand\thesection{\Alph{section}}

วันอังคาร, ตุลาคม 02, 2550

Google TechTalk video

ref: http://www.scottberkun.com/services/speakingsamples/

Today I watched some video of some presentations, presented by professionals, to be my guideline. I then dive down into Google Video site where I found a lot of interesting Google TechTalk video, though i have not so much time to view them till the end. Here are some of those videos:



This is one in the Advanced in Programming series by Google.

เลคเชอร์สุดท้ายของ แรนดี้ พอช CMU

วันจันทร์, ตุลาคม 01, 2550

จาก 華麗なる一族

ข้อความตอนจบในจดหมายของเท็ปเป
人間はちっぽけな存在だ。
自分を強く見せようとして
背伸びしては傷つき
その傷口を自分自身で広げてしまう。
愚かで弱い生き物だ。

だからこそ人間は夢を見るのかもしれない。
夢の実現には困難を伴い
時として夢は人を苦しめる。
それでも僕は未来を切り開くことができるのは
夢に情熱を注ぐ人間の力だと信じている。
しかし 志を忘れたとき栄光はすぐに終わりへ向かうだろう。

วันพฤหัสบดี, กันยายน 20, 2550

บิตทอเร้น ทอร์ และ ไพรวอกซี่

วันนี้ลองใช้ไมโครทอเร้น(ซึ่งถูกห้ามใช้)ดู โหลดไฟล์ที่มีซีดเดอร์คนเดียว ดังนั้นมันจึงไม่ได้อัพโหลดให้ใคร คิดว่าไม่น่าจะมีปัญหาอะไร? แต่เพื่อความชัวร์ เลยลองทำแอนโนนิไมซ์มันซะหน่อย (ไม่รู้มีผลอะไรป่าว?) ก็เลยลง ทอร์แพค ซึ่งรวม ทอร์ กับไพร์วอกซี่ แล้วก็วิลาเดียมา แต่เนื่องจากว่าใช้บราวเซอร์ของซีโร่แบงค์อยู่แล้ว จึงไม่จำเป็นที่จะต้องสตาร์ททอร์ด้วยวิลาเดีย เปิดเบราเซอร์ไว้มันก็สตาร์ททอร์ให้อยู่แล้ว

การเซตค่าในไมโครทอเร้นก็เซตให้มันดาวน์โหลดไฟล์ผ่านพรอกซี่ โดยใช้ Socks5 และ 127.0.0.1 ที่พอร์ท 9050 (การเซตค่าตามนี้ฟอร์เวิร์ดไปที่ทอร์โดยไม่ผ่านไพรวอกซี่)

ถ้าจะเซตให้ผ่านไพรวอกซี่ให้เซต โดยใช้ HTTP, 127.0.0.1, พอร์ท 8118

วันศุกร์, กันยายน 14, 2550

ใช้ wget ดาวน์โหลดโดยไม่ต้องสนใจ robots.txt (wget ignore robots.txt)

ปกติเวลาใช้ wget ดาวน์โหลดไฟล์มันจะมองหา robots.txt ในรีโมทไซต์ก่อนว่ามี disallow อยู่รึเปล่า ซึ่งถ้ามีมันก็จะไม่ยอมโหลด

ซึ่งเราสามารถเพิกเฉย robots.txt ได้ โดยเพิ่มออพชั่น -e robots=off ลงไป
$ wget www.example.com/i_want_this/ -e robots=off

วันพุธ, กันยายน 12, 2550

ย้าย Subversion server ไปยังเครื่องใหม่ P4 แรม 1G

ขั้นตอนการย้ายคร่าวๆ
  1. ลง Apache HTTP server (httpd)
  2. ลง OpenSSL ให้ httpd
  3. ลง Subversion ของ windows บน module Apache
---- ลง Apache HTTP server (httpd) ----
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 แก้ค่าตามสมควร
ระวังเรื่อง ด้วยถ้ามี<-- ห่าไรวะเนี่ย ---- ลง Subversion บน Apache ---- 1.โหลด subversion สำหรับ Windows32 สามารถทำได้ 2 วิธี (แนะนำวิธี setup.exe)
วิธีแรก: โหลดไฟล์ที่เป็น setup.exe มาแล้ว ก็ดับเบิ้ลคลิ๊ก แก้ httpd.conf นิดหน่อย จบ
วิธีหลัง : ที่เป็น ZIP ไฟล์มา แล้วแตกไฟล์ออก 2. ก๊อปปี้ ไฟล์ mod_*svn*.so ไปที่ modules ใน Apache แก้ config apache ให้โหลด module เหล่านี้ด้วย (บางครั้งจำเป็นต้อง restart เครื่อง ไม่งั้นมันจะมองไม่เห็น module ใหม่)

note: ปัญหาที่เจอคือหลังจากก๊อป mod_ssl ไปแล้วมันสตาร์ท apache ไม่ติด มันจะ crash
แก้โดยเอาไฟล์ที่อยู่ใน apache-with-ssl.ZIP ไปแทนที่อินสตอลไว้ให้หมด

==== อพยพ repository ไดเรคทอรี่ เก่าไปสู่ที่ใหม่ด้วยการ dump ดังต่อไปนี้ ====
svnadmin dump /path/to/repo > reponame.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:

cd /path/to/new
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)

ต่อจากบทความเก่า http://xoguy.blogspot.com/2007/05/tag-subversion.html ที่เคยแปะค้างๆไว้
ได้ลองใช้พวก tag (จริงๆในคู่มือเค้าเรียกว่า keyword) ต่างๆ ของ Subversion ดูแล้วเลยมาเมโม่เก็บไว้

ref: http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.keywords.html

คีย์เวิร์ด
คีย์เวิร์ดที่ใช้มี 5 อันคือ
  1. Date (alias = LastChangedDate)
  2. Revision (alias = LastChangedRevision, Rev)
  3. Author (alias = LastChangedBy)
  4. Id (no alias)
  5. HeadURL (alias = URL)

วิธีการใช้
1. เพิ่มคีย์เวิร์ดเหล่านี้ไว้ในไฟล์ อย่างเช่นในคอมเม้นท์ตรงหัวไฟล์
/* foo.txt initiated 2007/05/05
* $Revision$ last committed rev
* $Author$ last committed author
* $Date$ last committed date
* $Id$ last committed Id
* $URL$ head URL
*/
2.
เซต property svn:keywords ของไฟล์ foo.txt เพื่อเซตให้คีย์เวิร์ดเหล่านั้นถูกแทนค่าตอนคอมมิต, Subversion จะไม่แทนค่าคีย์เวิร์ดเหล่านี้ถ้าหากเราไม่เซต การเซตให้ LastChangedDate กับ Author ถูกแทนค่าทำได้โดย
$ svn propset svn:keywords "Date Author" foo.txt
property 'svn:keywords' set on 'foo.txt'
3. คอมมิตซะ! คีย์เวิร์ดเหล่านี้ก็จะถูกแทนค่าโดยอัตโนมัติตอนคอมมิต


นอกจากนี้แล้วการแสดงผลแบบกำหนดความกว้างตายตัวเพื่อความสวยงามสามารถทำได้โดยเพิ่มโคล่อนสองอันไว้หลังคีย์เวิร์ดซะ ใช้รูปแบบ อย่างนี้
$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 as LastChangedDate.

Revision

This 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 as LastChangedRevision or Rev.

Author

This keyword describes the last known user to change this file in the repository, and looks something like $Author: harry $. It may also be specified as LastChangedBy.

HeadURL

This 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 as URL.

Id

This 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 file calc.c was last changed in revision 148 on the evening of July 28, 2006 by the user sally.

วันอาทิตย์, สิงหาคม 26, 2550

Eclipse workspace management

read some good tips --> http://www.ibm.com/developerworks/opensource/library/os-ecl-manage/



ดูเหมือนว่าเราจะสามารถใช้ binary ของ eclipse เดียวรันหลายๆ workspace ได้
ตัวอย่างเช่นเราอาจจะแบ่งเป็น workspace สำหรับ Java, workspace สำหรับเขียนเปเปอร์ด้วย LaTeX หรือ อาจจะเป็น workspace สำหรับพัฒนาโปรแกรมเล่นๆ ที่ไม่ใช่โปรดัค ก็แค่แยกใช้ workspace สำหรับวัตถุประสงค์ต่างๆเหล่านั้น ก็จะทำให้จัดการโปรเจคได้ง่ายขึ้น

ข้อควรรู้
  1. รันด้วย eclipse.exe -showlocation เพื่อให้มันแสดง location ของ workspace ที่ Title bar
  2. ค่า preferences ถูกเก็บในแต่ละ workspace ดังนั้นจึงไม่เกี่ยวข้องกัน
  3. File -> Export -> Preferences เก็บ preferences เป็นไฟล์ XML เอาไว้ใช้กับ workspace อื่น
  4. สำหรับ plug-in ต่างๆนั้น ถูกเก็บอยู่ใน installation ของ eclipse binary ที่เราเรียกใช้ ดังนั้นหากเราโหลด eclipse เวอร์ชั่นใหม่กว่ามาลง พวก plug-in ที่เคยใช้ก็จะต้องลงใหม่

วันศุกร์, สิงหาคม 24, 2550

ข้อแตกต่างระหว่าง WAIT and AWAIT

wait แตกต่างจาก await อย่างไร?
อ้างอิงจาก ที่นี่: http://www.bbc.co.uk/worldservice/learningenglish/radio/specials/1535_questionanswer/page15.shtml

–AWAIT and WAIT: to sum up, there are two kinds of difference
  • •grammartical difference
    • the verb `await’ must have an object
      • ex. I am awaiting for your answer.
      • the object of 'await' is normally inanimate, not a person, and often abstract.
      • »So you can't say, 'John was awaiting me'.
    • –the verb `wait’ can come in different structures.
      • »Use `wait’ on its own à ex. We have been waiting and waiting and nobody has come to talk to us.
      • »Use `wait’ with another verb à ex. I waited in line to go into the theatre.
      • »Use `wait’ with the length of time à ex. I have been waiting here for at least half an hour.
      • »Use `wait’ to mention what or who the speaker have been waiting for à ex. I have been waiting for Joe for two hours!.
  • •Formality difference
    • –`await’ is more formal than `wait’ , so it would be used in formal writing.

Granting privileges to Java RTS Users on Solaris 10

Note that you (may) need to logout and login again for the new priviledges to take effect. The preferred approach might be to create a new administrative role, `rtsj_role', then assign `Java Real-Time System User' right to `rtsj_role', and make the user who want to use Java RTS assumes the rtsj_role.

The following procedures are quoted from /opt/SUNWrtjv/doc/JavaRTSInstallation.html#privileges



Granting Privileges to Java RTS Users

The Java Real-Time System uses a number of Solaris resources, such as the real-time scheduling class, whose usage is restricted to privileged processes. Therefore, the Java RTS Virtual Machine must be run as the superuser (root) or must be explicitly granted additional rights by the system administrator in order to ensure predictable timing of operations.

Solaris supports role-based access control (RBAC), which enforces security policy at a more fine-grained level than the conventional superuser security model. This enables a user to be assigned the precise level of privilege that is necessary to execute the Java RTS.

This is typically achieved by means of a specific rights profile, that is, a collection of commands with security attributes. Rights profiles are usually included in an administrative role, and the role is then assigned to a user. Direct assignment of rights profiles to a user is also possible. In that latter case, this user must use a profile shell such as pfsh(1) or pfcsh(1) for the commands with security attributes to succeed.

Rights profiles can be managed using the Solaris Management Console, smc(1), a graphical user interface that provides access to Solaris system administration tools.

To invoke the Solaris Management Console, type the following command:

    # /usr/sbin/smc

The 'Java Real-Time System User' rights profile can also be assigned to an administrative role using the following command:

    # /usr/sbin/rolemod -P "Java Real-Time System User" 

where is an existing role account.

This rights profile can also be directly assigned to a Solaris user by using:

    # /usr/sbin/usermod -P "Java Real-Time System User" 

where is an existing, local user name.

Alternatively, you can decide not to use the Java RTS profile and assign additional rights directly to the Java RTS users. In that later case, be aware that all the processes created by such Java RTS users (that is, not only the Java RTS Virtual Machine) will be granted these additional rights.

Rights management is implemented on Solaris through privileges, that is, discrete rights required to perform particular operations. Privileges decrease the security risk that is associated with one user or one process having full superuser capabilities on a system.

If you decide to bypass the Java RTS rights profile, then the Java RTS users must be granted at least the following privileges, for them to be able to run properly the Java RTS Virtual Machine:

  • sys_res_config: allows a process to create and delete processor sets, assign CPUs to processor sets, and change the operational status of CPUs in the system.
  • proc_priocntl: allows a process to elevate its priority above its current level and change its scheduling class to any scheduling class, including the RT class.
  • proc_lock_memory: allows a process to lock pages in physical memory.
  • proc_clock_highres: allows a process to use high resolution timers.

To assign the above set of privileges directly to a Java RTS user, use the Solaris Management Console, smc(1), or type the following command:

    # /usr/sbin/usermod -K \
defaultpriv=basic,sys_res_config,proc_priocntl,proc_lock_memory,proc_clock_highres

where is an existing, local user name.

Note that the usermod(1M) command does not allow privileges to be assigned to non-local users (that is, to users who do not appear in the local /etc/passwd file). To assign privileges to a non-local user, add the following line to the /etc/user_attr file:

::::type=normal;profiles=Basic Solaris User;defaultpriv=basic,
sys_res_config,proc_priocntl,proc_lock_memory,proc_clock_highres

where is an existing, non-local user name.

Java PathFinder where to start?

When I started writing my tool, I realized it is a good idea to read the code of the great tool that several great people(?) have contributed---the Java PathFinder (JPF).
The entry point for reading Java PathFinder may be at
  • gov.nasa.jpf.tools.JavaJPF : main() is here.
  • gov.nasa.jpf.JPF : main class for JPF verification framework. It reads config, instantiates the Search and VM objects, and starts the Search.
  • gov.nasa.jpf.jvm.JVM : the class for virtual machine that can move forward / backward one transition at a time.
  • Besides, ThreadInfo, MethodInfo in gov.nasa.jpf.jvm are also worth looking.

Eclipse preferences: using multiple instances of Eclipse

เวลาใช้ Eclipse หลายอินสแตนซ์แล้ว มันมีเรื่องเล็กน้อยคือต้องคอยปรับค่า preferences ให้มันเป็นตามที่เราคุ้นเคย

จริงๆมันก็สามารถ File > Export > preferences ได้ แต่ทีนี้พอไม่ได้ทำนานๆแล้วมันก็ลืม
จดไว้ตรงนี้กันลืมว่า เวลาสร้างอินสแตนซ์ของ Eclipse ขึ้นมาใหม่เมื่อไหร่ก็ Export / Import preferences จากอันเก่าที่ใช้ประจำมา.

วันพฤหัสบดี, สิงหาคม 16, 2550

การย้ายรูปที่เก็บด้วย Picasa ไปยังคอมเครื่องใหม่, migrating picasa photo library to a new computer

ลองค้นหาในเฮ้ลป์ของ Picasa help & support เค้าบอกให้ใช้ Tools > Backup Pictures แต่ผมคิดว่าไม่จำเป็น เราสามารถก๊อปปี้โฟลเดอร์ที่เก็บรูปไว้ (ซึ่งเป็นโฟลเดอร์ ที่ให้ Picasa คอยดูแลให้เราอยู่) หรือ ย้ายมาได้ตรงๆ แล้วพอลง Picasa ที่คอมเครื่องใหม่ก็ให้มัน watch! โฟลเดอร์นั้นให้ก็เรียบร้อย

อย่างไรก็ดี อัลบั้มที่เราสร้างไว้ใน Picasa มันไม่ได้เก็บเป็นโฟลเดอร์ต่างหาก แต่เก็บเป็น XML แต่ใช้นามสกุล .pal (Picasa ALbum) อยู่ที่ $USER\Local Settings\Application Data\Google\Picasa2Albums
ซึ่งในไดเรคทอรี่นี้ จะมี
  1. watchedfolders.txt เป็นเท็กส์ไฟล์ ที่เก็บว่า Picasa มัน watch ไดเรคทอรี่ไหนอยู่ และ
  2. ซับไดเรคทอรี่ที่มีชื่อเป็น HEX ยาวๆ ex. b8ce842...2d2 ซึ่งในไดเรคทอรี่นี้จะมีไฟล์ .pal ที่เก็บ Picasa Album อยู่

ให้เราก๊อปไฟล์นั้นไปไว้แล้วเปิด Picasa ขึ้นมาใหม่ก็น่าจะเรียบร้อย

ถ้าเปลี่ยนโลเคชั่นของโฟโต้ไลบรารี่ก็แก้ไขไฟล์ .pal ให้เป็นที่ใหม่ซะด้วย เช่นใน
 
[D]\Photos\20000229\PIC001.JPG


[D] คือ drive D: [E] ก็คือ drive E:

+ เพิ่มเติม +
หากเราเคยอัพอัลบั้มนั้นขึ้นใน Picasa Web โดยใช้ ,2 มันจะมีเอ็นทรี่ คล้ายๆอย่างงี้
>_lh" type="num64" value="0"/>
>_lh" type="num64" value="0"/>

<< >> เป็น place holder

ในไฟล์ .pal ทำให้ก๊อปไปแล้วกลับไม่ปรากฎอัลบั้มนั้นขึ้นใน Picasa
การแก้ไขก็ทำได้โดยลบสองบรรทัดนั้นออกไป ลบแล้วพอก๊อปไปก็จะได้ดังเดิม

ติดตั้ง Webmin ใน Solaris 10 เพื่อความสะดวกในการคอนฟิก Samba

วันนี้คุยกับเด็กรุ่นน้องที่ำทำงานด้วยกัน เรื่องการลงแซมบ้าใน Solaris 10 ซึ่งใน Solaris 10 นั้นมันมี Samba มาให้อยู่แล้ว เพียงแต่คอนฟิกยากเล็กน้อยเพราะยังไม่ได้ศึกษา SMF เท่าไหร่
สรุปก็คือใช้ Webmin ง่ายดี ใช้แอ๊ดมินได้หลายๆอย่างด้วย

บันทึกการติดตั้ง
ref: http://www.webmin.com/solaris.html

  1. ดาวน์โหลดแพคเกจของ Solaris มาซะ
  2. # pkgadd -d webmin-1.360.pkg
  3. แล้วก็คอนฟิกอีกเล็กน้อย โดยเพิ่ม user หรือ sync มันมาจาก unix account ซะ
  4. แล้วก็เพิ่มไดเรคทอรี่ที่จะแชร์ลงไป
  5. คอนฟิก อื่นๆ ตามสมควร อาจดูที่ smb.conf เพื่อความชัวร์
  6. คลิก รีสตาร์ท Samba server

วันอังคาร, กรกฎาคม 17, 2550

vnc on Solaris 10

บันทึกการติดตั้งโปรแกรม vnc ใน Solaris 10 เมื่อวาน

ref:
  1. http://blogs.sun.com/timthomas/entry/update_on_vnc_and_solaris
  2. http://www.salixtraining.co.uk/index_files/vncsol10.htm
  3. http://www.softpanorama.org/Xwindows/VNC/vnc_on_solaris.shtml
ขั้นตอนที่ทำคือ
  1. โหลด CompanionDVD ของ Solaris 10 11/06 มา ในนั้นจะมี SFWvnc อยู่ เราใช้ package นี้ในการติดตั้ง
  2. โปรแกรมอื่นที่จำเป็น(prerequisite) ถูกลงไปก่อนแล้วนั้นหาได้จาก sunfreeware
  3. โหลดสคริปต์ติดตั้งจาก [2] (www.salixtraining.co.uk) เราใช้สคริปต์นี้ช่วยให้การติดตั้งสะดวกขึ้นมาก
  4. เอาแพคเกจของ SFWvnc จาก CompanionDVD แทนในแพคเกจที่มีอยู่ในสคริปต์จาก [2] ใช้คำสั่ง 
  5. pkgtrans . /mytemp/SFWvnc.pkg SFWvnc
  6. modify the script installsol10vnc.ksh in the initialise function remove the SFWgcc341.pkg away:
  7. packages="SFWgcmn.pkg SFWvnc.pkg"
  8. comment the line: fix_gnome_bug, it worked fine without doing this for me too.




วันพฤหัสบดี, กรกฎาคม 12, 2550

Solaris 10 : Changing password policy, root login policy

see /etc/default/passwd
The file specify password complexity and so on.

see /etc/default/login
When CONSOLE is set root can only login on the specified device.
Comment to unset the CONSOLE to allow remote root login.

The use of "BY" (method, agent) and "WITH" (tools, etc).

ทั้ง by และ with ใช้บอกเกี่ยวกับวิธีการ ในการกระทำของ somebody.

BY
ใช้ by เมื่อพูดถึงการกระทำว่าเราทำอย่างไร จึงได้ผลลัพธ์อย่างนั้น

WITH
ใช้ with เมื่อกล่าวถึง tool หรือ object ที่เราใช้เพื่อให้บรรลุเป้าหมาย

ex.
I killed the spider by hitting it.
I killed the spider with a shoe.
"I got where I am by hard work".
"No you didn't. You got there with your wife money."

WITH มักจะใช้กับการกล่าวถึง tool หรือ instrument used by somebody.
ex.
He was killed by a heavy stone. (This could mean 'A stone fell and killed him'.)
He was killed with a heavy stone. (This means 'Somebody used a stone to kill him.')

สรุป
การกระทำ killed ทำโดย a heavy stone ดังนั้นจะใช้ by.
การกระทำ killed ทำโดยคนอื่น ซึ่งใช้ a heavy stone เป็นเครื่องมือ ใช้ with

เครื่องเซิฟเวอร์ Sunfire 880 กับ StorEdge A1000

พึ่งรู้ว่าเครื่องเซิฟเวอร์ที่เปิดมากว่า 3 ปี และมีext hdd อย่างไฮโซนั้น มันไม่ได้ถูกใช้งานเลยแม้แต่น้อย อันนี้เป็นความดีความชอบของ admin ณ สมัยนั้น

ก็เลยได้โอกาสที่จะใช้ประโยชน์ให้เต็มที่
เริ่มจากการสร้างไฟล์ซิสเต็มซะก่อน บันทึกเล็กๆน้อย เปิดดูจาก Solaris Administration document ในเว๊บของ Sun น่ะแหละ

ใช้คำสั่ง format
และใน format ให้เลือก partition
แล้วเลือก modify
ใช้ All free hogs
แล้วก็ accept table ไปก่อน กำหนดพื้นที่ตามความเหมาะสม
แล้ว label เพื่อwrite change ลงไป
แล้วก็ newfs /dev/..../c4t0d0
แล้วก็ลอง mount ดู
ถ้าโอเคก็แก้ /ets/vfstab เพื่อให้มัน mount โดยอัตโตมัติ

ความละเอียดของเวลา ใน RTSJ implementation ต่างกัน (time resolution is different from implementations to implementations)

จากการทดลอง Sun Java RTS ให้ความละเอียดสูงที่ 1 ns
ส่วน RI ของ TimeSys ซึ่งรันบนLinuxนั้นให้ความละเอียดที่ 1000 ns หรือ 1 ms เท่านั้น

เป็นผลจากคำสั่ง clock.getResolution();

วันนี้ลองลง LyX

I installed the following programs:

MacTeX-2007 | http://www.tug.org/mactex/
MacTeX installs TeXlive and includes XeTeX which is a nice extension to support.

วันอาทิตย์, กรกฎาคม 01, 2550

สถานะของฟอนในแผนที่ฟอน Fon map status

ref: http://elfonblog.fondoo.net/?feedrss2&p=56


- orange: Foneros without registered routers (according to Martin, potential Aliens, but I think originally any Fonero was registered orange, including people that bought but didn’t register a router)

- light green: registered routers that didn’t show activity in the last hour

- dark green: registered routers that did show activity in the last hour

- dark green with white star: dark green AND personalized page.

That is information from the map site, check the config options.

The information given, is incorrect (of course…).
At my address, two routers are portrayed, one light green (a non-existing router), one darkgreen with whitestar.
The last is an existing FON router, where nobody logged on the last week. So active is apparently equal to the thinclient being active… and doesn’t depend on user activity.
And that combined, would lead to the conclusion that all light-green icons are not alive and kicking; if the thinclients would work, they should be dark green. (Or am I jumping to conclusions ?)

วันพุธ, มิถุนายน 27, 2550

การเปลี่ยนฟอนต์ใน LaTeX (Changing Fonts in LaTeX)

ref: http://web.image.ufl.edu/help/latex/fonts.shtml

Changing Fonts

If you use any packages that change the font, those packages will change the default of the same type. For instance, using the Bookman font (which is done by using this command in the preamble: \usepackage{bookman})makes the default Roman font Bookman, but leaves the sans-serif and monospace fonts alone. Similarly, using the Helvetica font (done with this command in the preamble: \usepackage{helvet}) changes the default sas-serif font to Helvetica, but leaves the Roman and Monospace fonts alone. When changing fonts, you can do so like this, using the command and calling the particular font, or you can change all of the default fonts at once with the following commands.

CommandChanges the defaults to
timesTimes, Helvetica, Courier
pslatexsame as Times, but uses a specially narrowed Courier. This is preferred over Times because of the way it handles Courier.
newcentNew Century Schoolbook, Avant Garde, Courier
palatinoPalatino, Helevetica, Courier
palatcmchanges the Roman to Palatino only, but uses CM mathematics

For more on the fonts available with a typical LaTeX installation, please see the documentation in the IMAGE Lab (page 75 in A Beginner's Guide to Typsetting with LaTeX). Also, please note that there are many more fonts available for download.

Changing Fonts Temporarily

To change the font temporarily, first group the text where you want the font changed in curly braces. Then, use the commands \fontencoding, \fontfamily, and \selectfont. These commands should be used immediately inside the opening curly braces, like:

{\fontfamily{phv}\selectfont Helvetica looks like this}
and {\fontencoding{OT1}\fontfamily{ppl} Palatino looks like this}.
}

The above commands would make a sentence where "Helvetica looks like this" would be in the Helvetica font (phv is the code for Helvetica) and "and" would be in the default font and "Palatino looks like this" would be in the Palatino font (denoted with the Palatino code, which is ppl). This example would be very rare, but it shows how the fonts can be changed in the most extreme circumstances.

วันพฤหัสบดี, มิถุนายน 07, 2550

ว่าด้วยเรื่องของการโทรศัพท์กลับบ้านโดยVoIP : voipbuster vs 12voip

ค่าบริการ ณ วันที่ 6 มิถุนายน 2550
โทรกลับประเทศไทย
voipbuster 0.01 euro (ทั้งโทรศัพท์บ้านและมือถือ)
12voip 0.02 euro สำหรับโทรศัพท์มือถือ และฟรีสำหรับโทรศัพท์บ้าน

ถ้าโทรเข้าืมือถือบ่อยกว่าก็ใช้ voipbuster ดีกว่า
แต่ถ้าโทรเข้าบ้านบ่อยกว่าก็ใช้ 12voip (จ่าย 10 euro ใช้โทรฟรีได้ 3 เดือน)
ทั้งสองเจ้าเป็นของ betamax บริษัททางด้านเทคโนโลยี Voip ของเยอรมัน
ิี

วันอังคาร, พฤษภาคม 29, 2550

ว่าด้วยเรื่องของ Tag ต่างๆใน Subversion

Tag ที่น่าจะได้ใช้มีดังนี้
* $LastChangedDate: 2006-09-28 14:35:32 +0800 (Thu, 28 Sep 2006) $
* $Date: 2006-09-28 14:35:32 +0800 (Thu, 28 Sep 2006) $
* $LastChangedRevision: 1221 $
* $Revision: 1221 $
* $LastChangedBy: cs $
* $Author: cauchy $
* $URL: http://127.0.0.1/svn/repos $
* $Id$

แต่จะใช้ยังไง ยังไม่ได้ลอง

วันศุกร์, เมษายน 13, 2550

ว่าด้วยเรื่อง Samba บน OpenSolaris or Solaris 10

นึกอยากจะใช้ ๏แซมบ้า๛ บนเครื่อง๏โอเพ่นโซลาริส๛ เลยลองจัดการดูจนเวิร์ค
สรุปสั้นๆ ดังนี้
  • Solaris 10 and opensolaris already include Samba. No need to get it from sunfreeware.
  • The init process has been changed from Solaris 9 and previous versions. Sun introduced SMF (Service Management Facility) which is believed that, once mastered, it'll be better than the old one. I havn't mastered that so I can't tell anything about it.
  • Samba's binaries are in /usr/sfw/bin
  • Samba's config is in /etc/sfw/smb.conf
  • What you need is create smbpasswd for user(s) and edit smb.conf for your needs.
  • Use inetconv -i /etc/inet/inetd.conf to convert the inetd configuation to SMF service manifest, and import them to smf repository
Other related commands:
  • svcs -vx can be used to check the status of a service
  • svcconfig import .xml : to import a manifest for a service
  • svcadm enable : to enable a service
Memo:
- You can view installed files of a package by : less /var/sadm/pkg/SMCsamba/.......

วันพุธ, เมษายน 04, 2550

ว่าด้วยเรื่องการจัดการเมมโมรี่ใน Real-time Java (real-time java memory management: assimilated)

keyword: real-time java, memory management, memory area, immortal memory, scoped memory, heap.

ถาม ทำไมใน RTSJ ถึงได้กำหนด API สำหรับจัดการเม็ม ?
ตอบ เพราะไม่อยากให้เกิดการขัดจังหวะโดยGCในขณะที่รัน time-critical thread. ถึงแม้เราจะให้ตัว time-critical thread นี้มีpriorityสูงกว่าthreadอื่นๆ มันก็อาจจะถูกหน่วงไม่ให้รันได้อยู่ดี ลองพิจารณา low priority thread รันแล้วใช้ฮีปหมด GCเข้ามาเก็บกวาด ครึ่งๆกลางๆ แล้วเจ้า time-critical thread ซึ่งอาจจะเป็นperiodicก็ถึงเวลารัน ถ้ามันรันในขณะที่ GC ยังเก็บกวาดไม่เสร็จ ก็อาจจะทำให้มันเข้าไปอ้างถึงเม็มที่ยังเละเทะอยู่ (ชัดๆว่าเป็นพฤติกรรมที่ไม่เป็นน่าปรารถนา) ทันจึงถูกหน่วงให้รอ.

ด้วยเหตุฉะนี้ RTSJ จึงได้กำหนดให้มี memory area ซึ่งไม่ใช่ heap ได้แก่ immortal กับ scoped มา เพื่อให้แอพพลิเคชั่นไม่ถูกGC เข้ามารบกวน

วันจันทร์, เมษายน 02, 2550

Disable system beep

อ้างอิงจาก mailing list จำไม่ได้ว่าที่ไหน
1) สำหรับ X Window
$ xset b off
# better put this in ~/.xsession


2) สำหรับ Console
$ setterm -blength
หรือ
$ setterm -blength 0
# better put this in ~/.bash_profile or maybe .bashrc

วันพฤหัสบดี, มีนาคม 29, 2550

ว่าด้วยเรื่องของการใช้ภาษาไทยใน TeX ด้วย XeTeX (Another solution for using Thai in TeX)

keyword: ภาษาไทย, ไทย, Thai, เรียงพิมพ์, XeTeX, LaTeX, TeX, typesetting, multilingual.

ความเป็นมา
เรื่องมันก็เริ่มขึ้นจากการหยิบหนังสือวิธีฝึกสมาธิ วิปัสสนาของท่านพุทธทาส มาอ่านในยามดึกของคืนๆหนึ่ง. แล้วเราก็นึกออกว่าเคยดาวน์โหลดไฟล์พระไตรปิฎกที่เป็นเท็กส์ไฟล์ (TIS-620) มานี่หว่า แต่ไม่เคยอ่านเลย. พอลองเปิดดูก็ปรากฏว่าอ่านไม่ได้, เลยลอง convert ไปเป็น UTF-8 ด้วย iconv ดู แล้วเปิดด้วย Eclipse ก็อ่านได้ไม่มีปัญหา. คราวนี้ก็เลยลองกูเกิ้นดู ว่าพอจะมีพระไตรปิฎกแบบที่เป็น pdf ไฟล์สวยๆบ้างมั้ยจะได้เอามาปริ้นท์อ่าน. ก็หาไม่เจอ เดาว่าคงไม่มีด้วยเลยเกิดความคิดที่จะใช้ TeX มาเรียงพิมพ์พระไตรปิฎกให้เป็นรูปร่างสวยงาม ดูน่าอ่านกว่าแบบที่เป็นเท็กส์ไฟล์

วิธีอื่นนอกจาก XeTeX
เท่าที่ลองคุ้ยๆดูในเนตก็เห็นว่ามี thai extension สำหรับ miktex ลองลงดูแล้วระบบอินสตอลของมันงี่เง่า ใช้กับ miktex-2.5 ไม่ได้ ลองแก้ Windows registry ดูจนลงได้แล้วก๊อปไฟล์ไปติดตั้งในเครื่องที่จะใช้จริง ก็เหมือนจะใช้ได้แต่มีปัญหาเรื่องฟอนต์ ก็เลยไม่ใช้ หัดใช้ XeTeX ดีกว่าเพราะสามารถใช้ภาษาอะไรก็ได้ด้วย เนื่องจากรองรับยูนิโค้ด
ต่อไปนี้เป็นบันทึกเกี่ยวกับการติดตั้ง XeTeX

การติดตั้ง
ดูได้ที่ http://www.fsci.fuk.kindai.ac.jp/kakuto/win32-ptex/web2c75-e.html (ฮิตจากการคุ้ยด้วยคีย์เวิร์ด: win32 xetex)

ก๊อปปี้ฟอนต์ที่ต้องการมาเพิ่ม
ณ ที่นี้เราก๊อปจาก Font Book ของ Mac OS X โดยฟอนต์ที่ก๊อปปี้มาคือฟอนต์ดีฟอลท์ของ Thai LaTeX ได้แก่ : Norasi, Thonburi, Loma.
ไม่แน่ใจว่ามันมีมาแต่แรกเริ่มเดิมทีหรือมาลงเองทีหลังตอนที่ลง XeTeX บนเครื่องmac.

แก้ไขไฟล์เพื่อเพิ่มฟอนต์
แก้ไฟล์ $TEX/share/texmf/fonts/conf/fonts.conf
  c:/windows/fonts
c:/myfonts
จากนั้นรันคำสั่ง
  $ fc-cache -f -v
เพื่อสร้างแคชไฟล์ใน $TEX/share/texmf/fonts/cache
ถ้าต้องการดูว่าเรามีฟอนต์อะไรใช้บ้างก็รันคำสั่ง
$ fc-list > fontlist.txt
ก็จะได้ไฟล์ fontlist.txt มาเป็น UTF-8.
รันคำสั่งเพื่อให้มันรู้ว่ามีการเพิ่มฟอนต์ใหม่เข้าไป(เมื่อแก้ fonts.conf)
    $ fc-cache -r -v
คำสั่งนี้จะเคลียร์ข้อมูลในแคชแล้วสร้างใหม่

ถ้าก๊อปปี้ไฟล์เพิ่มเข้ามาใส่ในฟอนต์ไดเรคทอรี่ก็รันคำสั่ง,
$ fc-cache -v

การกำหนดฟอนต์สำหรับแสดงผลภาษาไทย
\usepackage{fontspec} % อันนี้ยังไม่ค่อยรู้ว่าแพคเกจนี้เอาไว้ทำอะไร fontspec
% define font
\setromanfont{Norasi}
\setmonofont[Scale=0.8]{Loma}

บทความภาษาไทยที่ตามมาก็จะแสดงด้วยฟอนต์ที่ระบุไว้

วันพฤหัสบดี, มีนาคม 15, 2550

ว่าด้วยเรื่องของ LaTeX

บันทึกช่วยจำเกี่ยวกับคำสั่งต่างๆของ LaTeX
  • \secit ใช้สั่งให้เป็น italic ใน \section{This will be {\secit italic}}
  • \subsecit เหมือน \secit ข้างบนแต่ใช้ใน subsection.
  • ...