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

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.
  • ...

วันจันทร์, ธันวาคม 04, 2549

การจัดการ todo list

แปะไว้กันลืม
http://www.43folders.com/2005/09/12/building-a-smarter-to-do-list-part-i/
หรือไม่ก็
หาคำว่า todo list ใน วิกิ