วันอาทิตย์, สิงหาคม 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